From 68e46e81c1f4160b24712efc48551d2acc46e150 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Tue, 8 Nov 2022 11:11:39 +0100 Subject: [PATCH] Fixed hyphenate bug --- dist/iwmlib.3rdparty.js | 13395 +++++++++++++++----------------- dist/iwmlib.3rdparty.min.js | 16 +- lib/3rdparty/jquery.hypher.js | 374 +- lib/3rdparty/pixi-ease.js | 4665 ++--------- lib/3rdparty/pixi-viewport.js | 8475 ++++++++++++-------- lib/card/card.js | 4 +- package.json | 2 +- 7 files changed, 12384 insertions(+), 14547 deletions(-) diff --git a/dist/iwmlib.3rdparty.js b/dist/iwmlib.3rdparty.js index 62ef438..2b268ec 100644 --- a/dist/iwmlib.3rdparty.js +++ b/dist/iwmlib.3rdparty.js @@ -77215,7562 +77215,6472 @@ if ( !noGlobal ) { return jQuery; } ); -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o this.updateCoord(t, h, 'x')) + break + case 'scaleY': + case 'skewY': + ;(i = s), + (o = s - (n = t[(h = e.substr(0, e.length - 1))].y)), + (r = (t) => this.updateCoord(t, h, 'y')) + break + case 'tint': + case 'blend': + const u = Array.isArray(s) ? s : [t.tint, s] + ;(n = 0), + (o = i = u.length), + (r = 'tint' === e ? (t) => this.updateTint(t, u) : (t) => this.updateBlend(t, u)) + break + case 'shake': + ;(n = { x: t.x, y: t.y }), (i = s), (r = (t) => this.updateShake(t)) + break + case 'position': + ;(n = { x: t.x, y: t.y }), + (o = { x: (i = { x: s.x, y: s.y }).x - n.x, y: i.y - n.y }), + (r = (t) => this.updatePosition(t)) + break + case 'skew': + case 'scale': + ;(i = s), (o = s - (n = t[e].x)), (r = (t) => this.updatePoint(t, e)) + break + case 'face': + ;(n = t.rotation), + (o = (i = a.shortestAngle(n, Math.atan2(s.y - t.y, s.x - t.x))) - n), + (r = (t) => this.updateOne(t, 'rotation')) + break + default: + ;(i = s), (o = s - (n = t[e])), (r = (t) => this.updateOne(t, e)) + } + this.eases.push({ element: t, entry: e, update: r, start: n, to: i, delta: o }) + } + static shortestAngle(t, e) { + const s = 2 * Math.PI + let n = Math.abs(t - e) % s + var i + return (n = n > Math.PI ? s - n : n) * (((((e - t + Math.PI) % (i = s)) + i) % i) - Math.PI > 0 ? 1 : -1) + } + remove(t, e) { + if (0 === arguments.length) this.eases = [] + else { + 'string' == typeof e && (e = [e]) + for (let s = 0; s < this.eases.length; s++) { + const n = this.eases[s] + ;(t && n.element !== t) || (e && -1 === e.indexOf(n.entry)) || (this.eases.splice(s, 1), s--) + } + } + if (0 === this.eases.length) return !0 + } + updateOne(t, e) { + t.element[e] = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updatePoint(t, e) { + t.element[e].x = t.element[e].y = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updatePosition(t) { + ;(t.element.x = this.options.ease(this.time, t.start.x, t.delta.x, this.options.duration)), + (t.element.y = this.options.ease(this.time, t.start.y, t.delta.y, this.options.duration)) + } + updateCoord(t, e, s) { + t.element[e][s] = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updateTint(t, e) { + let s = Math.floor(this.options.ease(this.time, t.start, t.delta, this.options.duration)) + s === e.length && (s = e.length - 1), (t.element.tint = e[s]) + } + updateBlend(t, e) { + const s = this.options.ease(this.time, t.start, t.delta, this.options.duration) + let n = Math.floor(s) + n === e.length && (n = e.length - 1) + let i = n + 1 + i === e.length && (i = this.options.reverse ? n - 1 : this.options.repeat ? 0 : n) + const a = s - n, + o = e[n], + r = e[i], + h = 1 - a, + u = h * (o >> 16) + a * (r >> 16), + c = h * ((o >> 8) & 255) + a * ((r >> 8) & 255), + l = h * (255 & o) + a * (255 & r) + t.element.tint = (u << 16) | (c << 8) | l + } + updateShake(t) { + function e(t) { + return Math.floor(Math.random() * t) - Math.floor(t / 2) + } + ;(t.element.x = t.start.x + e(t.to)), (t.element.y = t.start.y + e(t.to)) + } + complete(t) { + 'shake' === t.entry && ((t.element.x = t.start.x), (t.element.y = t.start.y)) + } + reverse(t) { + if ('position' === t.entry) { + const e = t.to.x, + s = t.to.y + ;(t.to.x = t.start.x), + (t.to.y = t.start.y), + (t.start.x = e), + (t.start.y = s), + (t.delta.x = -t.delta.x), + (t.delta.y = -t.delta.y) + } else { + const e = t.to + ;(t.to = t.start), (t.start = e), (t.delta = -t.delta) + } + } + repeat(t) { + switch (t.entry) { + case 'skewX': + t.element.skew.x = t.start + break + case 'skewY': + t.element.skew.y = t.start + break + case 'skew': + ;(t.element.skew.x = t.start), (t.element.skew.y = t.start) + break + case 'scaleX': + t.element.scale.x = t.start + break + case 'scaleY': + t.element.scale.y = t.start + break + case 'scale': + ;(t.element.scale.x = t.start), (t.element.scale.y = t.start) + break + case 'position': + ;(t.element.x = t.start.x), (t.element.y = t.start.y) + break + default: + t.element[t.entry] = t.start + } + } + update(t) { + if (0 === this.eases.length) return !0 + if (this.options.wait) { + if (((this.options.wait -= t), this.options.wait > 0)) return void this.emit('wait', this) + ;(t = -this.options.wait), (this.options.wait = 0), this.emit('wait-end', this) + } + this.time += t + let e = 0 + this.time >= this.options.duration && + ((e = this.time - this.options.duration), (this.time = this.options.duration)) + for (let t = 0; t < this.eases.length; t++) { + const e = this.eases[t] + e.element._destroyed ? (this.eases.splice(t, 1), t--) : e.update(e) + } + if ((this.emit('each', this), this.time >= this.options.duration)) + if (this.options.reverse) + this.eases.forEach((t) => this.reverse(t)), + (this.time = e), + e && this.eases.forEach((t) => t.update(t)), + this.emit('reverse', this), + this.options.repeat + ? !0 !== this.options.repeat && this.options.repeat-- + : (this.options.reverse = !1) + else { + if (!this.options.repeat) + return this.eases.forEach((t) => this.complete(t)), this.emit('complete', this), !0 + this.eases.forEach((t) => this.repeat(t)), + (this.time = e), + e && this.eases.forEach((t) => t.update(t)), + !0 !== this.options.repeat && this.options.repeat--, + this.emit('repeat', this) + } + } + get count() { + return this.eases.length + } + } + const o = { duration: 1e3, ease: n.easeInOutSine, maxFrame: 1e3 / 60, ticker: null, useRAF: !0 } + class r extends i { + constructor(t) { + super(), + (this.options = Object.assign({}, o, t)), + (this.easings = []), + (this.empty = !0), + this.options.ticker && this.options.ticker.add(this.update, this) + } + destroy() { + this.removeAll(), + this.options.useTicker + ? this.ticker.remove(this.update, this) + : this.options.useRAF && (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null)) + } + add(t, e, s) { + ;((s = s || {}).duration = void 0 !== s.duration ? s.duration : this.options.duration), + (s.ease = s.ease || this.options.ease), + 'string' == typeof s.ease && (s.ease = n[s.ease]) + const i = new a(t, e, s) + return ( + this.easings.push(i), + this.empty && + this.options.useRAF && + ((this.handleRAF = requestAnimationFrame(() => this.update())), (this.lastTime = Date.now())), + (this.empty = !1), + i + ) + } + target(t, e, s, n) { + const i = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)) / s + return ((n = n || {}).duration = i), this.add(t, { x: e.x, y: e.y }, n) + } + face(t, e, s, n) { + const i = a.shortestAngle(t.rotation, Math.atan2(e.y - t.y, e.x - t.x)), + o = Math.abs(i - t.rotation) / s + return ((n = n || {}).duration = o), this.add(t, { rotation: i }, n) + } + removeEase(t, e) { + for (let s = 0; s < this.easings.length; s++) + this.easings[s].remove(t, e) && (this.easings.splice(s, 1), s--) + 0 === this.easings.length && + ((this.empty = !0), + this.options.useRAF && + this.handleRAF && + (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null))) + } + removeAll() { + ;(this.easings = []), + (this.empty = !0), + this.options.useRAF && this.handleRAF && (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null)) + } + update(t) { + if (this.options.useTicker) t = this.ticker.elapsedMS + else if (this.options.useRAF) { + const e = Date.now() + ;(t = e - this.lastTime), (this.lastTime = e) + } + if (((t = Math.min(t, this.options.maxFrame)), !this.empty)) { + const e = this.easings.slice(0) + for (let s of e) s.update(t) && this.easings.splice(this.easings.indexOf(s), 1) + this.emit('each', this), 0 === this.easings.length && ((this.empty = !0), this.emit('complete', this)) + } + this.options.useRAF && this.easings.length + ? (this.handleRAF = requestAnimationFrame(() => this.update())) + : (this.handleRAF = null) + } + get count() { + return this.easings.length + } + countRunning() { + let t = 0 + for (let e of this.easings) t += e.count + return t + } + set duration(t) { + this.options.duration = t + } + get duration() { + return this.options.duration + } + set ease(t) { + this.options.ease = t + } + get ease() { + return this.options.ease + } + } + r.id = 0 + let h = new r() + r.ease = h + ;(t.Ease = r), + (t.List = class { + constructor() { + console.warn('Ease.List was deprecated. Use new Ease() instead.') + } + }), + (t.ease = h), + Object.defineProperty(t, '__esModule', { value: !0 }) +}) -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -var angle = function (_wait) { - _inherits(angle, _wait); +/* eslint-disable */ + +/*! + * pixi-viewport - v4.35.1 + * Compiled Sat, 03 Sep 2022 13:47:09 UTC + * + * pixi-viewport is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + * + * Copyright 2019-2020, David Figatner, All Rights Reserved + */ +this.PIXI = this.PIXI || {}; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pixi/math'), require('@pixi/display'), require('@pixi/ticker')) : + typeof define === 'function' && define.amd ? define(['exports', '@pixi/math', '@pixi/display', '@pixi/ticker'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pixi_viewport = {}, global.PIXI, global.PIXI, global.PIXI)); +})(this, (function (exports, math, display, ticker) { 'use strict'; /** - * animate object's {x, y} using an angle - * @param {object} object to animate - * @param {number} angle in radians - * @param {number} speed in pixels/millisecond - * @param {number} [duration=0] in milliseconds; if 0, then continues forever - * @param {object} [options] @see {@link Wait} - * @private + * Derive this class to create user-defined plugins + * + * @public */ - function angle(object, _angle, speed, duration, options) { - _classCallCheck(this, angle); + class Plugin + { + /** The viewport to which this plugin is attached. */ + - options = options || {}; + /** + * Flags whether this plugin has been "paused". + * + * @see Plugin#pause + * @see Plugin#resume + */ + - var _this = _possibleConstructorReturn(this, (angle.__proto__ || Object.getPrototypeOf(angle)).call(this, object, options)); - - _this.type = 'Angle'; - if (options.load) { - _this.load(options.load); - } else { - _this.angle = _angle; - _this.speed = speed; - _this.duration = duration || 0; + /** @param {Viewport} parent */ + constructor(parent) + { + this.parent = parent; + this.paused = false; + } + + /** Called when plugin is removed */ + destroy() + { + // Override for implementation + } + + /** Handler for pointerdown PIXI event */ + down(_e) + { + return false; + } + + /** Handler for pointermove PIXI event */ + move(_e) + { + return false; + } + + /** Handler for pointerup PIXI event */ + up(_e) + { + return false; + } + + /** Handler for wheel event on div */ + wheel(_e) + { + return false; + } + + /** + * Called on each tick + * @param {number} elapsed time in millisecond since last update + */ + update(_delta) + { + // Override for implementation + } + + /** Called when the viewport is resized */ + resize() + { + // Override for implementation + } + + /** Called when the viewport is manually moved */ + reset() + { + // Override for implementation + } + + /** Pause the plugin */ + pause() + { + this.paused = true; + } + + /** Un-pause the plugin */ + resume() + { + this.paused = false; } - return _this; } - _createClass(angle, [{ - key: 'save', - value: function save() { - var save = _get(angle.prototype.__proto__ || Object.getPrototypeOf(angle.prototype), 'save', this).call(this); - save.angle = this.angle; - save.speed = this.speed; - return save; + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function createCommonjsModule(fn, basedir, module) { + return module = { + path: basedir, + exports: {}, + require: function (path, base) { + return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); } - }, { - key: 'load', - value: function load(_load) { - _get(angle.prototype.__proto__ || Object.getPrototypeOf(angle.prototype), 'load', this).call(this, _load); - this.angle = _load.angle; - this.speed = _load.speed; + }, fn(module, module.exports), module.exports; + } + + function getDefaultExportFromNamespaceIfPresent (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n; + } + + function getDefaultExportFromNamespaceIfNotNamed (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n; + } + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); + } + + var penner = createCommonjsModule(function (module, exports) { + /* + Copyright © 2001 Robert Penner + 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. + + Neither the name of the author nor the names of contributors may be used to endorse + or promote products derived from this software without specific prior written permission. + + 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 OWNER 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. + */ + + (function() { + var penner, umd; + + umd = function(factory) { + if ('object' === 'object') { + return module.exports = factory; + } else if (typeof undefined === 'function' && undefined.amd) { + return undefined([], factory); + } else { + return this.penner = factory; } - }, { - key: 'calculate', - value: function calculate(elapsed) { - this.object.x += this.cos * elapsed * this.speed; - this.object.y += this.sin * elapsed * this.speed; - } - }, { - key: 'reverse', - value: function reverse() { - this.angle += Math.PI; - } - }, { - key: 'angle', - get: function get() { - return this._angle; + }; + + penner = { + linear: function(t, b, c, d) { + return c * t / d + b; }, - set: function set(value) { - this._angle = value; - this.sin = Math.sin(this._angle); - this.cos = Math.cos(this._angle); + easeInQuad: function(t, b, c, d) { + return c * (t /= d) * t + b; + }, + easeOutQuad: function(t, b, c, d) { + return -c * (t /= d) * (t - 2) + b; + }, + easeInOutQuad: function(t, b, c, d) { + if ((t /= d / 2) < 1) { + return c / 2 * t * t + b; + } else { + return -c / 2 * ((--t) * (t - 2) - 1) + b; + } + }, + easeInCubic: function(t, b, c, d) { + return c * (t /= d) * t * t + b; + }, + easeOutCubic: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t + 1) + b; + }, + easeInOutCubic: function(t, b, c, d) { + if ((t /= d / 2) < 1) { + return c / 2 * t * t * t + b; + } else { + return c / 2 * ((t -= 2) * t * t + 2) + b; + } + }, + easeInQuart: function(t, b, c, d) { + return c * (t /= d) * t * t * t + b; + }, + easeOutQuart: function(t, b, c, d) { + return -c * ((t = t / d - 1) * t * t * t - 1) + b; + }, + easeInOutQuart: function(t, b, c, d) { + if ((t /= d / 2) < 1) { + return c / 2 * t * t * t * t + b; + } else { + return -c / 2 * ((t -= 2) * t * t * t - 2) + b; + } + }, + easeInQuint: function(t, b, c, d) { + return c * (t /= d) * t * t * t * t + b; + }, + easeOutQuint: function(t, b, c, d) { + return c * ((t = t / d - 1) * t * t * t * t + 1) + b; + }, + easeInOutQuint: function(t, b, c, d) { + if ((t /= d / 2) < 1) { + return c / 2 * t * t * t * t * t + b; + } else { + return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; + } + }, + easeInSine: function(t, b, c, d) { + return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; + }, + easeOutSine: function(t, b, c, d) { + return c * Math.sin(t / d * (Math.PI / 2)) + b; + }, + easeInOutSine: function(t, b, c, d) { + return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; + }, + easeInExpo: function(t, b, c, d) { + if (t === 0) { + return b; + } else { + return c * Math.pow(2, 10 * (t / d - 1)) + b; + } + }, + easeOutExpo: function(t, b, c, d) { + if (t === d) { + return b + c; + } else { + return c * (-Math.pow(2, -10 * t / d) + 1) + b; + } + }, + easeInOutExpo: function(t, b, c, d) { + if (t === 0) { + b; + } + if (t === d) { + b + c; + } + if ((t /= d / 2) < 1) { + return c / 2 * Math.pow(2, 10 * (t - 1)) + b; + } else { + return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; + } + }, + easeInCirc: function(t, b, c, d) { + return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; + }, + easeOutCirc: function(t, b, c, d) { + return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; + }, + easeInOutCirc: function(t, b, c, d) { + if ((t /= d / 2) < 1) { + return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; + } else { + return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; + } + }, + easeInElastic: function(t, b, c, d) { + var a, p, s; + s = 1.70158; + p = 0; + a = c; + if (t === 0) { + b; + } else if ((t /= d) === 1) { + b + c; + } + if (!p) { + p = d * .3; + } + if (a < Math.abs(c)) { + a = c; + s = p / 4; + } else { + s = p / (2 * Math.PI) * Math.asin(c / a); + } + return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + }, + easeOutElastic: function(t, b, c, d) { + var a, p, s; + s = 1.70158; + p = 0; + a = c; + if (t === 0) { + b; + } else if ((t /= d) === 1) { + b + c; + } + if (!p) { + p = d * .3; + } + if (a < Math.abs(c)) { + a = c; + s = p / 4; + } else { + s = p / (2 * Math.PI) * Math.asin(c / a); + } + return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; + }, + easeInOutElastic: function(t, b, c, d) { + var a, p, s; + s = 1.70158; + p = 0; + a = c; + if (t === 0) { + b; + } else if ((t /= d / 2) === 2) { + b + c; + } + if (!p) { + p = d * (.3 * 1.5); + } + if (a < Math.abs(c)) { + a = c; + s = p / 4; + } else { + s = p / (2 * Math.PI) * Math.asin(c / a); + } + if (t < 1) { + return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; + } else { + return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; + } + }, + easeInBack: function(t, b, c, d, s) { + if (s === void 0) { + s = 1.70158; + } + return c * (t /= d) * t * ((s + 1) * t - s) + b; + }, + easeOutBack: function(t, b, c, d, s) { + if (s === void 0) { + s = 1.70158; + } + return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; + }, + easeInOutBack: function(t, b, c, d, s) { + if (s === void 0) { + s = 1.70158; + } + if ((t /= d / 2) < 1) { + return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; + } else { + return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; + } + }, + easeInBounce: function(t, b, c, d) { + var v; + v = penner.easeOutBounce(d - t, 0, c, d); + return c - v + b; + }, + easeOutBounce: function(t, b, c, d) { + if ((t /= d) < 1 / 2.75) { + return c * (7.5625 * t * t) + b; + } else if (t < 2 / 2.75) { + return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; + } else if (t < 2.5 / 2.75) { + return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; + } else { + return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; + } + }, + easeInOutBounce: function(t, b, c, d) { + var v; + if (t < d / 2) { + v = penner.easeInBounce(t * 2, 0, c, d); + return v * .5 + b; + } else { + v = penner.easeOutBounce(t * 2 - d, 0, c, d); + return v * .5 + c * .5 + b; + } } - }]); + }; - return angle; -}(wait); + umd(penner); -module.exports = angle; + }).call(commonjsGlobal); + }); -},{"./wait":11}],2:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Angle = require('yy-angle'); -var wait = require('./wait'); - -/** Rotates an object to face the target */ - -var face = function (_wait) { - _inherits(face, _wait); + // eslint-disable-next-line /** - * @param {object} object - * @param {Point} target - * @param {number} speed in radians/millisecond - * @param {object} [options] @see {@link Wait} - * @param {boolean} [options.keepAlive] don't stop animation when complete + * Returns correct Penner equation using string or Function. + * + * @internal + * @ignore + * @param {(function|string)} [ease] + * @param {defaults} default penner equation to use if none is provided */ - function face(object, target, speed, options) { - _classCallCheck(this, face); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (face.__proto__ || Object.getPrototypeOf(face)).call(this, object, options)); - - _this.type = 'Face'; - _this.target = target; - if (options.load) { - _this.load(options.load); - } else { - _this.speed = speed; + function ease(ease, defaults) + { + if (!ease) + { + return penner[defaults] + } + else if (typeof ease === 'function') + { + return ease + } + else if (typeof ease === 'string') + { + return penner[ease] } - return _this; } - _createClass(face, [{ - key: 'save', - value: function save() { - if (this.options.cancel) { - return null; - } - var save = _get(face.prototype.__proto__ || Object.getPrototypeOf(face.prototype), 'save', this).call(this); - save.speed = this.speed; - save.keepAlive = this.options.keepAlive; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(face.prototype.__proto__ || Object.getPrototypeOf(face.prototype), 'load', this).call(this, _load); - this.speed = _load.speed; - this.options.keepAlive = _load.keepAlive; - } - }, { - key: 'calculate', - value: function calculate(elapsed) { - var angle = Angle.angleTwoPoints(this.object.position, this.target); - var difference = Angle.differenceAngles(angle, this.object.rotation); - if (difference === 0) { - this.emit('done', this.object); - if (!this.options.keepAlive) { - return true; - } - } else { - var sign = Angle.differenceAnglesSign(angle, this.object.rotation); - var change = this.speed * elapsed; - var delta = change > difference ? difference : change; - this.object.rotation += delta * sign; - } - } - }]); - - return face; -}(wait); - -module.exports = face; - -},{"./wait":11,"yy-angle":22}],3:[function(require,module,exports){ -'use strict'; - -var Ease = { - list: require('./list'), - wait: require('./wait'), - to: require('./to'), - shake: require('./shake'), - tint: require('./tint'), - face: require('./face'), - angle: require('./angle'), - target: require('./target'), - movie: require('./movie'), - load: require('./load') -}; - -PIXI.extras.Ease = Ease; - -module.exports = Ease; - -},{"./angle":1,"./face":2,"./list":4,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],4:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Events = require('eventemitter3'); - -var Angle = require('./angle'); -var Face = require('./face'); -var Load = require('./load'); -var Movie = require('./movie'); -var Shake = require('./shake'); -var Target = require('./target'); -var Tint = require('./tint'); -var To = require('./to'); -var Wait = require('./wait'); - -var Ease = function (_Events) { - _inherits(Ease, _Events); - - /** - * Main class for creating eases - * @param {object} [options] - * @param {boolean} [options.noTicker] don't add the update function to PIXI.ticker - * @param {PIXI.ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for the list - * @extends eventemitter - * @fire done - * @fire each - */ - function Ease(options) { - _classCallCheck(this, Ease); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Ease.__proto__ || Object.getPrototypeOf(Ease)).call(this)); - - if (!options.noTicker) { - var ticker = options.ticker || PIXI.ticker.shared; - ticker.add(function () { - return _this.update(ticker.elapsedMS); - }); - } - _this.list = []; - _this.empty = true; - _this.removeWaiting = []; - _this.removeAllWaiting = false; - return _this; - } - - /** - * Add animation(s) to animation list - * @param {(object|object[])} any animation class - * @return {object} first animation - */ - - - _createClass(Ease, [{ - key: 'add', - value: function add() { - var first = void 0; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = arguments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var arg = _step.value; - - if (Array.isArray(arg)) { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = arg[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var entry = _step2.value; - - if (!first) { - first = entry; - } - this.list.push(entry); - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } else { - first = arg; - this.list.push(arg); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.empty = false; - return first; - } - - /** - * remove animation(s) - * @param {object|array} animate - the animation (or array of animations) to remove; can be null - */ - - }, { - key: 'remove', - value: function remove(animate) { - if (this.inUpdate) { - this.removeWaiting.push(animate); - } else { - var index = this.list.indexOf(animate); - if (index !== -1) { - this.list.splice(index, 1); - } - } - } - - /** - * remove all animations from list - * @inherited from yy-loop - */ - - }, { - key: 'removeAll', - value: function removeAll() { - if (this.inUpdate) { - this.removeAllWaiting = true; - } else { - this.list = []; - } - } - - /** - * update frame - * this is automatically added to PIXI.ticker unless options.noTicker is set - * if using options.noTicker, this should be called manually - * @param {number} elasped time in MS since last update - */ - - }, { - key: 'update', - value: function update(elapsed) { - this.inUpdate = true; - for (var i = 0, _i = this.list.length; i < _i; i++) { - if (this.list[i] && this.list[i].update(elapsed)) { - this.list.splice(i, 1); - i--; - _i--; - } - } - this.emit('each', this); - if (this.list.length === 0 && !this.empty) { - this.emit('done', this); - this.empty = true; - } - this.inUpdate = false; - if (this.removeAllWaiting) { - this.removeAll(); - this.removeAllWaiting = false; - } - while (this.removeWaiting.length) { - this.remove(this.removeWaiting.pop()); - } - } - - /** - * number of animations - * @type {number} - */ - - }, { - key: 'to', - - - /** - * default options for all eases - * @typedef {object} EaseOptions - * @param {object} [EaseOptions.options] - * @param {number} [EaseOptions.options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [EaseOptions.options.pause] start the animation paused - * @param {boolean|number} [EaseOptions.options.repeat] true: repeat animation forever n: repeat animation n times - * @param {boolean|number} [EaseOptions.options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {Function} [EaseOptions.options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {string|Function} [EaseOptions.options.ease] name or function from easing.js (see http://easings.net for examples) - */ - - /** - * ease parameters of object - * @param {PIXI.DisplayObject} object to animate - * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI} - * @param {number} duration - time to run - * @fires done - * @fires wait - * @fires first - * @fires each - * @fires loop - * @fires reverse - */ - value: function to() { - return this.add(new (Function.prototype.bind.apply(To, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** - * animate object's {x, y} using an angle - * @param {object} object to animate - * @param {number} angle in radians - * @param {number} speed in pixels/millisecond - * @param {number} [duration=0] in milliseconds; if 0, then continues forever - * @param {object} [options] @see {@link Wait} - */ - - }, { - key: 'angle', - value: function angle() { - return this.add(new (Function.prototype.bind.apply(Angle, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.face class; see Ease.to class below for parameters */ - - }, { - key: 'face', - value: function face() { - return this.add(new (Function.prototype.bind.apply(Face, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.load class; see Ease.to class below for parameters */ - - }, { - key: 'load', - value: function load() { - return this.add(new (Function.prototype.bind.apply(Load, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.movie class; see Ease.to class below for parameters */ - - }, { - key: 'movie', - value: function movie() { - return this.add(new (Function.prototype.bind.apply(Movie, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.shake class; see Ease.to class below for parameters */ - - }, { - key: 'shake', - value: function shake() { - return this.add(new (Function.prototype.bind.apply(Shake, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.target class; see Ease.to class below for parameters */ - - }, { - key: 'target', - value: function target() { - return this.add(new (Function.prototype.bind.apply(Target, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.angle tint; see Ease.to class below for parameters */ - - }, { - key: 'tint', - value: function tint() { - return this.add(new (Function.prototype.bind.apply(Tint, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.wait class; see Ease.to class below for parameters */ - - }, { - key: 'wait', - value: function wait() { - return this.add(new (Function.prototype.bind.apply(Wait, [null].concat(Array.prototype.slice.call(arguments))))()); - } - }, { - key: 'count', - get: function get() { - return this.list.length; - } - - /** - * number of active animations - * @type {number} - */ - - }, { - key: 'countRunning', - get: function get() { - var count = 0; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = this.list[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var entry = _step3.value; - - if (!entry.pause) { - count++; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - return count; - } - }]); - - return Ease; -}(Events); - -module.exports = Ease; - -},{"./angle":1,"./face":2,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11,"eventemitter3":12}],5:[function(require,module,exports){ -'use strict'; - -var wait = require('./wait'); -var to = require('./to'); -var tint = require('./tint'); -var shake = require('./shake'); -var angle = require('./angle'); -var face = require('./face'); -var target = require('./target'); -var movie = require('./movie'); - -/** - * restart an animation = requires a saved state - * @param {object} object(s) to animate - */ -function load(object, load) { - if (!load) { - return null; - } - var options = { load: load }; - switch (load.type) { - case 'Wait': - return new wait(object, options); - case 'To': - return new to(object, null, null, options); - case 'Tint': - return new tint(object, null, null, options); - case 'Shake': - return new shake(object, null, null, options); - case 'Angle': - return new angle(object, null, null, null, options); - case 'Face': - return new face(object[0], object[1], null, options); - case 'Target': - return new target(object[0], object[1], null, options); - case 'Movie': - return new movie(object, object[1], null, options); - } -} - -module.exports = load; - -},{"./angle":1,"./face":2,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],6:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** - * animate a movie of textures - */ - -var movie = function (_wait) { - _inherits(movie, _wait); + /** Options for {@link Animate}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_ANIMATE_OPTIONS = { + removeOnInterrupt: false, + ease: 'linear', + time: 1000, + }; /** - * @param {object} object to animate - * @param {PIXI.Texture[]} textures - * @param {number} [duration=0] time to run (use 0 for infinite duration--should only be used with customized easing functions) - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {(boolean|number)} [options.continue] true: continue animation with new starting values n: continue animation n times - * @param {Function} [options.load] loads an animation using a .save() object note the * parameters below cannot be loaded and must be re-set - * @param {Function} [options.ease] function from easing.js (see http://easings.net for examples) - * @emits {done} animation expires - * @emits {wait} each update during a wait - * @emits {first} first update when animation starts - * @emits {each} each update while animation is running - * @emits {loop} when animation is repeated - * @emits {reverse} when animation is reversed + * Animation plugin. + * + * @see Viewport#animate + * @fires animate-end */ - function movie(object, textures, duration, options) { - _classCallCheck(this, movie); + class Animate extends Plugin + { + - options = options || {}; + /** The starting x-coordinate of the viewport. */ + - var _this = _possibleConstructorReturn(this, (movie.__proto__ || Object.getPrototypeOf(movie)).call(this, object, options)); + /** The starting y-coordinate of the viewport. */ + - _this.type = 'Movie'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; - } - if (options.load) { - _this.load(options.load); - } else { - _this.textures = textures; - _this.duration = duration; - _this.current = 0; - _this.length = textures.length; - _this.interval = duration / _this.length; - _this.isReverse = false; - _this.restart(); - } - return _this; - } + /** The change in the x-coordinate of the viewport through the animation.*/ + - _createClass(movie, [{ - key: 'save', - value: function save() { - var save = _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'save', this).call(this); - save.goto = this.goto; - save.current = this.current; - save.length = this.length; - save.interval = this.interval; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'load', this).call(this, _load); - this.goto = _load.goto; - this.current = _load.current; - this.interval = _load.current; - } - }, { - key: 'restart', - value: function restart() { - this.current = 0; - this.time = 0; - this.isReverse = false; - } - }, { - key: 'reverse', - value: function reverse() { - this.isReverse = !this.isReverse; - } - }, { - key: 'calculate', - value: function calculate() { - var index = Math.round(this.options.ease(this.time, 0, this.length - 1, this.duration)); - if (this.isReverse) { - index = this.length - 1 - index; - } - if (this.list) { - for (var i = 0; i < this.list.length; i++) { - this.list[i].texture = this.textures[index]; - } - } else { - this.object.texture = this.textures[index]; - } - } - }]); + /** The change in the y-coordinate of the viewport through the animation. */ + - return movie; -}(wait); + /** Marks whether the center of the viewport is preserved in the animation. */ + -module.exports = movie; + /** The starting viewport width. */ + __init() {this.startWidth = null;} -},{"./wait":11}],7:[function(require,module,exports){ -'use strict'; + /** The starting viewport height. */ + __init2() {this.startHeight = null;} -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + /** The change in the viewport's width through the animation. */ + __init3() {this.deltaWidth = null;} -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + /** The change in the viewport's height through the animation. */ + __init4() {this.deltaHeight = null;} -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + /** The viewport's width post-animation. */ + __init5() {this.width = null;} -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + /** The viewport's height post-animation. */ + __init6() {this.height = null;} -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + /** The time since the animation started. */ + __init7() {this.time = 0;} -var wait = require('./wait'); + /** + * This is called by {@link Viewport.animate}. + * + * @param parent + * @param options + */ + constructor(parent, options = {}) + { + super(parent);Animate.prototype.__init.call(this);Animate.prototype.__init2.call(this);Animate.prototype.__init3.call(this);Animate.prototype.__init4.call(this);Animate.prototype.__init5.call(this);Animate.prototype.__init6.call(this);Animate.prototype.__init7.call(this);; -/** - * shakes an object or list of objects - */ + this.options = Object.assign({}, DEFAULT_ANIMATE_OPTIONS, options); + this.options.ease = ease(this.options.ease); -var shake = function (_wait) { - _inherits(shake, _wait); + this.setupPosition(); + this.setupZoom(); - /** - * @param {object|array} object or list of objects to shake - * @param {number} amount to shake - * @param {number} duration (in milliseconds) to shake - * @param {object} options (see Animate.wait) - */ - function shake(object, amount, duration, options) { - _classCallCheck(this, shake); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (shake.__proto__ || Object.getPrototypeOf(shake)).call(this, object, options)); - - _this.type = 'Shake'; - if (Array.isArray(object)) { - _this.array = true; - _this.list = object; - } - if (options.load) { - _this.load(options.load); - } else { - if (_this.list) { - _this.start = []; - for (var i = 0; i < object.length; i++) { - var target = object[i]; - _this.start[i] = { x: target.x, y: target.y }; - } - } else { - _this.start = { x: object.x, y: object.y }; - } - _this.amount = amount; - _this.duration = duration; - } - return _this; - } - - _createClass(shake, [{ - key: 'save', - value: function save() { - var save = _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'save', this).call(this); - save.start = this.start; - save.amount = this.amount; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'load', this).call(this, _load); - this.start = _load.start; - this.amount = _load.amount; - } - }, { - key: 'calculate', - value: function calculate() /*elapsed*/{ - var object = this.object; - var start = this.start; - var amount = this.amount; - if (this.array) { - var list = this.list; - for (var i = 0; i < list.length; i++) { - var _object = list[i]; - var actual = start[i]; - _object.x = actual.x + Math.floor(Math.random() * amount * 2) - amount; - _object.y = actual.y + Math.floor(Math.random() * amount * 2) - amount; - } - } - object.x = start.x + Math.floor(Math.random() * amount * 2) - amount; - object.y = start.y + Math.floor(Math.random() * amount * 2) - amount; - } - }, { - key: 'done', - value: function done() { - var object = this.object; - var start = this.start; - if (this.array) { - var list = this.list; - for (var i = 0; i < list.length; i++) { - var _object2 = list[i]; - var actual = start[i]; - _object2.x = actual.x; - _object2.y = actual.y; - } - } else { - object.x = start.x; - object.y = start.y; - } - } - }]); - - return shake; -}(wait); - -module.exports = shake; - -},{"./wait":11}],8:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** move an object to a target's location */ - -var target = function (_wait) { - _inherits(target, _wait); - - /** - * move to a target - * @param {object} object - object to animate - * @param {object} target - object needs to contain {x: x, y: y} - * @param {number} speed - number of pixels to move per millisecond - * @param {object} [options] @see {@link Wait} - * @param {boolean} [options.keepAlive] don't cancel the animation when target is reached - */ - function target(object, _target, speed, options) { - _classCallCheck(this, target); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (target.__proto__ || Object.getPrototypeOf(target)).call(this, object, options)); - - _this.type = 'Target'; - _this.target = _target; - if (options.load) { - _this.load(options.load); - } else { - _this.speed = speed; - } - return _this; - } - - _createClass(target, [{ - key: 'save', - value: function save() { - var save = _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'save', this).call(this); - save.speed = this.speed; - save.keepAlive = this.options.keepAlive; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'load', this).call(this, _load); - this.speed = _load.speed; - this.options.keepAlive = _load.keepAlive; - } - }, { - key: 'calculate', - value: function calculate(elapsed) { - var deltaX = this.target.x - this.object.x; - var deltaY = this.target.y - this.object.y; - if (deltaX === 0 && deltaY === 0) { - this.emit('done', this.object); - if (!this.options.keepAlive) { - return true; - } - } else { - var angle = Math.atan2(deltaY, deltaX); - this.object.x += Math.cos(angle) * elapsed * this.speed; - this.object.y += Math.sin(angle) * elapsed * this.speed; - if (deltaX >= 0 !== this.target.x - this.object.x >= 0) { - this.object.x = this.target.x; - } - if (deltaY >= 0 !== this.target.y - this.object.y >= 0) { - this.object.y = this.target.y; - } - } - } - }]); - - return target; -}(wait); - -module.exports = target; - -},{"./wait":11}],9:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Color = require('yy-color'); -var wait = require('./wait'); - -var tint = function (_wait) { - _inherits(tint, _wait); - - /** - * @param {PIXI.DisplayObject|PIXI.DisplayObject[]} object - * @param {number|number[]} tint - * @param {number} [duration] in milliseconds - * @param {object} [options] @see {@link Wait} - */ - function tint(object, _tint, duration, options) { - _classCallCheck(this, tint); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (tint.__proto__ || Object.getPrototypeOf(tint)).call(this, object, options)); - - _this.type = 'Tint'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; - } - _this.duration = duration; - if (options.load) { - _this.load(options.load); - } else if (Array.isArray(_tint)) { - _this.tints = [_this.object.tint].concat(_toConsumableArray(_tint)); - } else { - _this.start = _this.object.tint; - _this.to = _tint; - } - return _this; - } - - _createClass(tint, [{ - key: 'save', - value: function save() { - var save = _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'save', this).call(this); - save.start = this.start; - save.to = this.to; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'load', this).call(this, _load); - this.start = _load.start; - this.to = _load.to; - } - }, { - key: 'calculate', - value: function calculate() { - var percent = this.options.ease(this.time, 0, 1, this.duration); - if (this.tints) { - var each = 1 / (this.tints.length - 1); - var per = each; - for (var i = 1; i < this.tints.length; i++) { - if (percent <= per) { - var color = Color.blend(1 - (per - percent) / each, this.tints[i - 1], this.tints[i]); - if (this.list) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var object = _step.value; - - object.tint = color; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } else { - this.object.tint = color; - } - break; - } - per += each; - } - } else { - var _color = Color.blend(percent, this.start, this.to); - if (this.list) { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.list[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var _object = _step2.value; - - _object.tint = _color; - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } else { - this.object.tint = _color; - } - } - } - }, { - key: 'reverse', - value: function reverse() { - if (this.tints) { - var tints = []; - for (var i = this.tints.length - 1; i >= 0; i--) { - tints.push(this.tints[i]); - } - this.tints = tints; - } else { - var swap = this.to; - this.to = this.start; - this.start = swap; - } - } - }]); - - return tint; -}(wait); - -module.exports = tint; - -},{"./wait":11,"yy-color":23}],10:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** animate any numeric parameter of an object or array of objects */ - -var to = function (_wait) { - _inherits(to, _wait); - - /** - * @private - * @param {object} object to animate - * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI} - * @param {number} duration - time to run - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {boolean|number} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {boolean|number} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {string|Function} [options.ease] name or function from easing.js (see http://easings.net for examples) - * @emits to:done animation expires - * @emits to:wait each update during a wait - * @emits to:first first update when animation starts - * @emits to:each each update while animation is running - * @emits to:loop when animation is repeated - * @emits to:reverse when animation is reversed - */ - function to(object, goto, duration, options) { - _classCallCheck(this, to); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (to.__proto__ || Object.getPrototypeOf(to)).call(this, object, options)); - - _this.type = 'To'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; - } - if (options.load) { - _this.load(options.load); - } else { - _this.goto = goto; - _this.fixScale(); - _this.duration = duration; - _this.restart(); - } - return _this; - } - - /** - * converts scale from { scale: n } to { scale: { x: n, y: n }} - * @private - */ - - - _createClass(to, [{ - key: 'fixScale', - value: function fixScale() { - if (typeof this.goto['scale'] !== 'undefined' && !Number.isNaN(this.goto['scale'])) { - this.goto['scale'] = { x: this.goto['scale'], y: this.goto['scale'] }; - } - } - }, { - key: 'save', - value: function save() { - var save = _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'save', this).call(this); - save.goto = this.goto; - save.start = this.start; - save.delta = this.delta; - save.keys = this.keys; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'load', this).call(this, _load); - this.goto = _load.goto; - this.start = _load.start; - this.delta = _load.delta; - this.keys = _load.keys; - } - }, { - key: 'restart', - value: function restart() { - var i = 0; - var start = this.start = []; - var delta = this.delta = []; - var keys = this.keys = []; - var goto = this.goto; - var object = this.object; - - // loops through all keys in goto object - for (var key in goto) { - - // handles keys with one additional level e.g.: goto = {scale: {x: 5, y: 3}} - if (isNaN(goto[key])) { - keys[i] = { key: key, children: [] }; - start[i] = []; - delta[i] = []; - var j = 0; - for (var key2 in goto[key]) { - keys[i].children[j] = key2; - start[i][j] = parseFloat(object[key][key2]); - start[i][j] = this._correctDOM(key2, start[i][j]); - start[i][j] = isNaN(this.start[i][j]) ? 0 : start[i][j]; - delta[i][j] = goto[key][key2] - start[i][j]; - j++; - } - } else { - start[i] = parseFloat(object[key]); - start[i] = this._correctDOM(key, start[i]); - start[i] = isNaN(this.start[i]) ? 0 : start[i]; - delta[i] = goto[key] - start[i]; - keys[i] = key; - } - i++; - } this.time = 0; } - }, { - key: 'reverse', - value: function reverse() { - var object = this.object; - var keys = this.keys; - var goto = this.goto; - var delta = this.delta; - var start = this.start; - for (var i = 0, _i = keys.length; i < _i; i++) { - var key = keys[i]; - if (isNaN(goto[key])) { - for (var j = 0, _j = key.children.length; j < _j; j++) { - delta[i][j] = -delta[i][j]; - start[i][j] = parseFloat(object[key.key][key.children[j]]); - start[i][j] = isNaN(start[i][j]) ? 0 : start[i][j]; - } - } else { - delta[i] = -delta[i]; - start[i] = parseFloat(object[key]); - start[i] = isNaN(start[i]) ? 0 : start[i]; - } - } - } - }, { - key: 'calculate', - value: function calculate() /*elapsed*/{ - var object = this.object; - var list = this.list; - var keys = this.keys; - var goto = this.goto; - var time = this.time; - var start = this.start; - var delta = this.delta; - var duration = this.duration; - var ease = this.options.ease; - for (var i = 0, _i = this.keys.length; i < _i; i++) { - var key = keys[i]; - if (isNaN(goto[key])) { - var key1 = key.key; - for (var j = 0, _j = key.children.length; j < _j; j++) { - var key2 = key.children[j]; - var others = object[key1][key2] = time >= duration ? start[i][j] + delta[i][j] : ease(time, start[i][j], delta[i][j], duration); - if (list) { - for (var k = 1, _k = list.length; k < _k; k++) { - list[k][key1][key2] = others; - } - } - } - } else { - var _key = keys[i]; - var _others = object[_key] = time >= duration ? start[i] + delta[i] : ease(time, start[i], delta[i], duration); - if (list) { - for (var _j2 = 1, _j3 = this.list.length; _j2 < _j3; _j2++) { - list[_j2][_key] = _others; - } - } - } - } - } - }]); - - return to; -}(wait); - -module.exports = to; - -},{"./wait":11}],11:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Easing = require('penner'); -var EventEmitter = require('eventemitter3'); - -var wait = function (_EventEmitter) { - _inherits(wait, _EventEmitter); - - /** - * @param {object|object[]} object or list of objects to animate - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * - * @param {number} [options.id] user-generated id (e.g., I use it to properly load animations when an object has multiple animations running) - * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {Function|string} [options.ease] function (or penner function name) from easing.js (see http://easings.net for examples)* - * - * @emits {done} animation expires - * @emits {wait} each update during a wait - * @emits {first} first update when animation starts - * @emits {each} each update while animation is running - * @emits {loop} when animation is repeated - * @emits {reverse} when animation is reversed - */ - function wait(object, options) { - _classCallCheck(this, wait); - - var _this = _possibleConstructorReturn(this, (wait.__proto__ || Object.getPrototypeOf(wait)).call(this)); - - _this.object = object; - _this.options = options || {}; - _this.type = 'Wait'; - if (_this.options.load) { - _this.load(_this.options.load); - } else { - _this.time = 0; - } - if (_this.options.ease && typeof _this.options.ease !== 'function') { - _this.options.easeName = _this.options.ease; - _this.options.ease = Easing[_this.options.ease]; - } - if (!_this.options.ease) { - _this.options.ease = Easing['linear']; - } - return _this; - } - - _createClass(wait, [{ - key: 'save', - value: function save() { - var save = { type: this.type, time: this.time, duration: this.duration, ease: this.options.easeName }; - var options = this.options; - if (options.wait) { - save.wait = options.wait; - } - if (typeof options.id !== 'undefined') { - save.id = options.id; - } - if (options.pause) { - save.pause = options.pause; - } - if (options.repeat) { - save.repeat = options.repeat; - } - if (options.reverse) { - save.reverse = options.reverse; - } - return save; - } - }, { - key: 'load', - value: function load(_load) { - this.options.wait = _load.wait; - this.options.pause = _load.pause; - this.options.repeat = _load.repeat; - this.options.reverse = _load.reverse; - this.options.id = _load.id; - this.options.ease = _load.ease; - if (this.options.ease && typeof this.options.ease !== 'function') { - this.options.easeName = this.options.ease; - this.options.ease = Easing[this.options.ease]; - } - if (!this.options.ease) { - this.options.ease = Easing['linear']; - } - this.time = _load.time; - this.duration = _load.duration; - } - - /** - * pause this entry - * @type {boolean} + /** + * Setup `startX`, `startY`, `deltaX`, `deltaY`, `keepCenter`. + * + * This is called during construction. */ - - }, { - key: 'end', - value: function end(leftOver) { - if (this.options.reverse) { - this.reverse(); - this.time = leftOver; - if (!this.options.repeat) { - if (this.options.reverse === true) { - this.options.reverse = false; - } else { - this.options.reverse--; - } - } else { - if (this.options.repeat !== true) { - this.options.repeat--; - } - } - this.emit('loop', this.list || this.object); - } else if (this.options.repeat) { - this.time = leftOver; - if (this.options.repeat !== true) { - this.options.repeat--; - } - this.emit('loop', this.list || this.object); - } else { - this.done(); - this.emit('done', this.list || this.object, leftOver); - // this.list = this.object = null - return true; + setupPosition() + { + if (typeof this.options.position !== 'undefined') + { + this.startX = this.parent.center.x; + this.startY = this.parent.center.y; + this.deltaX = this.options.position.x - this.parent.center.x; + this.deltaY = this.options.position.y - this.parent.center.y; + this.keepCenter = false; + } + else + { + this.keepCenter = true; } } - }, { - key: 'update', - value: function update(elapsed) { - var options = this.options; - if (options.pause) { + + /** + * Setup `startWidth, `startHeight`, `deltaWidth, `deltaHeight, `width`, `height`. + * + * This is called during construction. + */ + setupZoom() + { + this.width = null; + this.height = null; + + if (typeof this.options.scale !== 'undefined') + { + this.width = this.parent.screenWidth / this.options.scale; + } + else if (typeof this.options.scaleX !== 'undefined' || typeof this.options.scaleY !== 'undefined') + { + if (typeof this.options.scaleX !== 'undefined') + { + // screenSizeInWorldPixels = screenWidth / scale + this.width = this.parent.screenWidth / this.options.scaleX; + } + if (typeof this.options.scaleY !== 'undefined') + { + this.height = this.parent.screenHeight / this.options.scaleY; + } + } + else + { + if (typeof this.options.width !== 'undefined') + { + this.width = this.options.width; + } + if (typeof this.options.height !== 'undefined') + { + this.height = this.options.height; + } + } + + if (this.width !== null) + { + this.startWidth = this.parent.screenWidthInWorldPixels; + this.deltaWidth = this.width - this.startWidth; + } + if (this.height !== null) + { + this.startHeight = this.parent.screenHeightInWorldPixels; + this.deltaHeight = this.height - this.startHeight; + } + } + + down() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('animate'); + } + + return false; + } + + complete() + { + this.parent.plugins.remove('animate'); + if (this.width !== null) + { + this.parent.fitWidth(this.width, this.keepCenter, this.height === null); + } + if (this.height !== null) + { + this.parent.fitHeight(this.height, this.keepCenter, this.width === null); + } + if (!this.keepCenter) + { + this.parent.moveCenter(this.options.position); + } + + this.parent.emit('animate-end', this.parent); + + if (this.options.callbackOnComplete) + { + this.options.callbackOnComplete(this.parent); + } + } + + update(elapsed) + { + if (this.paused) + { return; } - if (options.wait) { - options.wait -= elapsed; - if (options.wait <= 0) { - elapsed = -options.wait; - options.wait = false; - } else { - this.emit('wait', elapsed, this.list || this.object); - return; - } - } - if (!this.first) { - this.first = true; - this.emit('first', this.list || this.object); - } this.time += elapsed; - var leftOver = 0; - var duration = this.duration; - var time = this.time; - if (duration !== 0 && time > duration) { - leftOver = time - duration; - this.time = time = duration; + + const originalZoom = new math.Point(this.parent.scale.x, this.parent.scale.y); + + if (this.time >= this.options.time) + { + const originalWidth = this.parent.width; + const originalHeight = this.parent.height; + + this.complete(); + if (originalWidth !== this.parent.width || originalHeight !== this.parent.height) + { + this.parent.emit('zoomed', { viewport: this.parent, original: originalZoom, type: 'animate' }); + } } - var force = this.calculate(elapsed); - this.emit('each', elapsed, this.list || this.object, this); - if (this.type === 'Wait' || duration !== 0 && time === duration) { - return this.end(leftOver); + else + { + const percent = this.options.ease(this.time, 0, 1, this.options.time); + + if (this.width !== null) + { + const startWidth = this.startWidth ; + const deltaWidth = this.deltaWidth ; + + this.parent.fitWidth( + startWidth + (deltaWidth * percent), + this.keepCenter, + this.height === null); + } + if (this.height !== null) + { + const startHeight = this.startHeight ; + const deltaHeight = this.deltaHeight ; + + this.parent.fitHeight( + startHeight + (deltaHeight * percent), + this.keepCenter, + this.width === null); + } + if (this.width === null) + { + this.parent.scale.x = this.parent.scale.y; + } + else if (this.height === null) + { + this.parent.scale.y = this.parent.scale.x; + } + if (!this.keepCenter) + { + const startX = this.startX ; + const startY = this.startY ; + const deltaX = this.deltaX ; + const deltaY = this.deltaY ; + const original = new math.Point(this.parent.x, this.parent.y); + + this.parent.moveCenter(startX + (deltaX * percent), startY + (deltaY * percent)); + this.parent.emit('moved', { viewport: this.parent, original, type: 'animate' }); + } + if (this.width || this.height) + { + this.parent.emit('zoomed', { viewport: this.parent, original: originalZoom, type: 'animate' }); + } } - return force || time === duration; - } - - // correct certain DOM values - - }, { - key: '_correctDOM', - value: function _correctDOM(key, value) { - switch (key) { - case 'opacity': - return isNaN(value) ? 1 : value; - } - return value; - } - }, { - key: 'reverse', - value: function reverse() {} - }, { - key: 'calculate', - value: function calculate() {} - }, { - key: 'done', - value: function done() {} - }, { - key: 'pause', - set: function set(value) { - this.options.pause = value; - }, - get: function get() { - return this.options.pause; - } - }]); - - return wait; -}(EventEmitter); - -module.exports = wait; - -},{"eventemitter3":12,"penner":13}],12:[function(require,module,exports){ -'use strict'; - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if ('undefined' !== typeof module) { - module.exports = EventEmitter; -} - -},{}],13:[function(require,module,exports){ - -/* - Copyright © 2001 Robert Penner - 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. - - Neither the name of the author nor the names of contributors may be used to endorse - or promote products derived from this software without specific prior written permission. - - 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 OWNER 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. - */ - -(function() { - var penner, umd; - - umd = function(factory) { - if (typeof exports === 'object') { - return module.exports = factory; - } else if (typeof define === 'function' && define.amd) { - return define([], factory); - } else { - return this.penner = factory; - } - }; - - penner = { - linear: function(t, b, c, d) { - return c * t / d + b; - }, - easeInQuad: function(t, b, c, d) { - return c * (t /= d) * t + b; - }, - easeOutQuad: function(t, b, c, d) { - return -c * (t /= d) * (t - 2) + b; - }, - easeInOutQuad: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t + b; - } else { - return -c / 2 * ((--t) * (t - 2) - 1) + b; - } - }, - easeInCubic: function(t, b, c, d) { - return c * (t /= d) * t * t + b; - }, - easeOutCubic: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t + 1) + b; - }, - easeInOutCubic: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t + 2) + b; - } - }, - easeInQuart: function(t, b, c, d) { - return c * (t /= d) * t * t * t + b; - }, - easeOutQuart: function(t, b, c, d) { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - }, - easeInOutQuart: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t + b; - } else { - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - } - }, - easeInQuint: function(t, b, c, d) { - return c * (t /= d) * t * t * t * t + b; - }, - easeOutQuint: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - }, - easeInOutQuint: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - } - }, - easeInSine: function(t, b, c, d) { - return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; - }, - easeOutSine: function(t, b, c, d) { - return c * Math.sin(t / d * (Math.PI / 2)) + b; - }, - easeInOutSine: function(t, b, c, d) { - return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; - }, - easeInExpo: function(t, b, c, d) { - if (t === 0) { - return b; - } else { - return c * Math.pow(2, 10 * (t / d - 1)) + b; - } - }, - easeOutExpo: function(t, b, c, d) { - if (t === d) { - return b + c; - } else { - return c * (-Math.pow(2, -10 * t / d) + 1) + b; - } - }, - easeInOutExpo: function(t, b, c, d) { - if (t === 0) { - b; - } - if (t === d) { - b + c; - } - if ((t /= d / 2) < 1) { - return c / 2 * Math.pow(2, 10 * (t - 1)) + b; - } else { - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; - } - }, - easeInCirc: function(t, b, c, d) { - return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; - }, - easeOutCirc: function(t, b, c, d) { - return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; - }, - easeInOutCirc: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; - } else { - return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; - } - }, - easeInElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - }, - easeOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; - }, - easeInOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d / 2) === 2) { - b + c; - } - if (!p) { - p = d * (.3 * 1.5); - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - if (t < 1) { - return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - } else { - return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; - } - }, - easeInBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * (t /= d) * t * ((s + 1) * t - s) + b; - }, - easeOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - }, - easeInOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - if ((t /= d / 2) < 1) { - return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; - } else { - return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; - } - }, - easeInBounce: function(t, b, c, d) { - var v; - v = penner.easeOutBounce(d - t, 0, c, d); - return c - v + b; - }, - easeOutBounce: function(t, b, c, d) { - if ((t /= d) < 1 / 2.75) { - return c * (7.5625 * t * t) + b; - } else if (t < 2 / 2.75) { - return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; - } else if (t < 2.5 / 2.75) { - return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; - } else { - return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; - } - }, - easeInOutBounce: function(t, b, c, d) { - var v; - if (t < d / 2) { - v = penner.easeInBounce(t * 2, 0, c, d); - return v * .5 + b; - } else { - v = penner.easeOutBounce(t * 2 - d, 0, c, d); - return v * .5 + c * .5 + b; - } - } - }; - - umd(penner); - -}).call(this); - -},{}],14:[function(require,module,exports){ -// A library of seedable RNGs implemented in Javascript. -// -// Usage: -// -// var seedrandom = require('seedrandom'); -// var random = seedrandom(1); // or any seed. -// var x = random(); // 0 <= x < 1. Every bit is random. -// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness. - -// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe. -// Period: ~2^116 -// Reported to pass all BigCrush tests. -var alea = require('./lib/alea'); - -// xor128, a pure xor-shift generator by George Marsaglia. -// Period: 2^128-1. -// Reported to fail: MatrixRank and LinearComp. -var xor128 = require('./lib/xor128'); - -// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl. -// Period: 2^192-2^32 -// Reported to fail: CollisionOver, SimpPoker, and LinearComp. -var xorwow = require('./lib/xorwow'); - -// xorshift7, by François Panneton and Pierre L'ecuyer, takes -// a different approach: it adds robustness by allowing more shifts -// than Marsaglia's original three. It is a 7-shift generator -// with 256 bits, that passes BigCrush with no systmatic failures. -// Period 2^256-1. -// No systematic BigCrush failures reported. -var xorshift7 = require('./lib/xorshift7'); - -// xor4096, by Richard Brent, is a 4096-bit xor-shift with a -// very long period that also adds a Weyl generator. It also passes -// BigCrush with no systematic failures. Its long period may -// be useful if you have many generators and need to avoid -// collisions. -// Period: 2^4128-2^32. -// No systematic BigCrush failures reported. -var xor4096 = require('./lib/xor4096'); - -// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random -// number generator derived from ChaCha, a modern stream cipher. -// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf -// Period: ~2^127 -// No systematic BigCrush failures reported. -var tychei = require('./lib/tychei'); - -// The original ARC4-based prng included in this library. -// Period: ~2^1600 -var sr = require('./seedrandom'); - -sr.alea = alea; -sr.xor128 = xor128; -sr.xorwow = xorwow; -sr.xorshift7 = xorshift7; -sr.xor4096 = xor4096; -sr.tychei = tychei; - -module.exports = sr; - -},{"./lib/alea":15,"./lib/tychei":16,"./lib/xor128":17,"./lib/xor4096":18,"./lib/xorshift7":19,"./lib/xorwow":20,"./seedrandom":21}],15:[function(require,module,exports){ -// A port of an algorithm by Johannes Baagøe , 2010 -// http://baagoe.com/en/RandomMusings/javascript/ -// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror -// Original work is under MIT license - - -// Copyright (C) 2010 by Johannes Baagøe -// -// 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(global, module, define) { - -function Alea(seed) { - var me = this, mash = Mash(); - - me.next = function() { - var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32 - me.s0 = me.s1; - me.s1 = me.s2; - return me.s2 = t - (me.c = t | 0); - }; - - // Apply the seeding algorithm from Baagoe. - me.c = 1; - me.s0 = mash(' '); - me.s1 = mash(' '); - me.s2 = mash(' '); - me.s0 -= mash(seed); - if (me.s0 < 0) { me.s0 += 1; } - me.s1 -= mash(seed); - if (me.s1 < 0) { me.s1 += 1; } - me.s2 -= mash(seed); - if (me.s2 < 0) { me.s2 += 1; } - mash = null; -} - -function copy(f, t) { - t.c = f.c; - t.s0 = f.s0; - t.s1 = f.s1; - t.s2 = f.s2; - return t; -} - -function impl(seed, opts) { - var xg = new Alea(seed), - state = opts && opts.state, - prng = xg.next; - prng.int32 = function() { return (xg.next() * 0x100000000) | 0; } - prng.double = function() { - return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53 - }; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -function Mash() { - var n = 0xefc8249d; - - var mash = function(data) { - data = data.toString(); - for (var i = 0; i < data.length; i++) { - n += data.charCodeAt(i); - var h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000; // 2^32 - } - return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 - }; - - return mash; -} - - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.alea = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],16:[function(require,module,exports){ -// A Javascript implementaion of the "Tyche-i" prng algorithm by -// Samuel Neves and Filipe Araujo. -// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - // Set up generator function. - me.next = function() { - var b = me.b, c = me.c, d = me.d, a = me.a; - b = (b << 25) ^ (b >>> 7) ^ c; - c = (c - d) | 0; - d = (d << 24) ^ (d >>> 8) ^ a; - a = (a - b) | 0; - me.b = b = (b << 20) ^ (b >>> 12) ^ c; - me.c = c = (c - d) | 0; - me.d = (d << 16) ^ (c >>> 16) ^ a; - return me.a = (a - b) | 0; - }; - - /* The following is non-inverted tyche, which has better internal - * bit diffusion, but which is about 25% slower than tyche-i in JS. - me.next = function() { - var a = me.a, b = me.b, c = me.c, d = me.d; - a = (me.a + me.b | 0) >>> 0; - d = me.d ^ a; d = d << 16 ^ d >>> 16; - c = me.c + d | 0; - b = me.b ^ c; b = b << 12 ^ d >>> 20; - me.a = a = a + b | 0; - d = d ^ a; me.d = d = d << 8 ^ d >>> 24; - me.c = c = c + d | 0; - b = b ^ c; - return me.b = (b << 7 ^ b >>> 25); - } - */ - - me.a = 0; - me.b = 0; - me.c = 2654435769 | 0; - me.d = 1367130551; - - if (seed === Math.floor(seed)) { - // Integer seed. - me.a = (seed / 0x100000000) | 0; - me.b = seed | 0; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 20; k++) { - me.b ^= strseed.charCodeAt(k) | 0; - me.next(); - } -} - -function copy(f, t) { - t.a = f.a; - t.b = f.b; - t.c = f.c; - t.d = f.d; - return t; -}; - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.tychei = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],17:[function(require,module,exports){ -// A Javascript implementaion of the "xor128" prng algorithm by -// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - me.x = 0; - me.y = 0; - me.z = 0; - me.w = 0; - - // Set up generator function. - me.next = function() { - var t = me.x ^ (me.x << 11); - me.x = me.y; - me.y = me.z; - me.z = me.w; - return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8); - }; - - if (seed === (seed | 0)) { - // Integer seed. - me.x = seed; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 64; k++) { - me.x ^= strseed.charCodeAt(k) | 0; - me.next(); - } -} - -function copy(f, t) { - t.x = f.x; - t.y = f.y; - t.z = f.z; - t.w = f.w; - return t; -} - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xor128 = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],18:[function(require,module,exports){ -// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm. -// -// This fast non-cryptographic random number generator is designed for -// use in Monte-Carlo algorithms. It combines a long-period xorshift -// generator with a Weyl generator, and it passes all common batteries -// of stasticial tests for randomness while consuming only a few nanoseconds -// for each prng generated. For background on the generator, see Brent's -// paper: "Some long-period random number generators using shifts and xors." -// http://arxiv.org/pdf/1004.3115v1.pdf -// -// Usage: -// -// var xor4096 = require('xor4096'); -// random = xor4096(1); // Seed with int32 or string. -// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits. -// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits. -// -// For nonzero numeric keys, this impelementation provides a sequence -// identical to that by Brent's xorgens 3 implementaion in C. This -// implementation also provides for initalizing the generator with -// string seeds, or for saving and restoring the state of the generator. -// -// On Chrome, this prng benchmarks about 2.1 times slower than -// Javascript's built-in Math.random(). - -(function(global, module, define) { - -function XorGen(seed) { - var me = this; - - // Set up generator function. - me.next = function() { - var w = me.w, - X = me.X, i = me.i, t, v; - // Update Weyl generator. - me.w = w = (w + 0x61c88647) | 0; - // Update xor generator. - v = X[(i + 34) & 127]; - t = X[i = ((i + 1) & 127)]; - v ^= v << 13; - t ^= t << 17; - v ^= v >>> 15; - t ^= t >>> 12; - // Update Xor generator array state. - v = X[i] = v ^ t; - me.i = i; - // Result is the combination. - return (v + (w ^ (w >>> 16))) | 0; - }; - - function init(me, seed) { - var t, v, i, j, w, X = [], limit = 128; - if (seed === (seed | 0)) { - // Numeric seeds initialize v, which is used to generates X. - v = seed; - seed = null; - } else { - // String seeds are mixed into v and X one character at a time. - seed = seed + '\0'; - v = 0; - limit = Math.max(limit, seed.length); - } - // Initialize circular array and weyl value. - for (i = 0, j = -32; j < limit; ++j) { - // Put the unicode characters into the array, and shuffle them. - if (seed) v ^= seed.charCodeAt((j + 32) % seed.length); - // After 32 shuffles, take v as the starting w value. - if (j === 0) w = v; - v ^= v << 10; - v ^= v >>> 15; - v ^= v << 4; - v ^= v >>> 13; - if (j >= 0) { - w = (w + 0x61c88647) | 0; // Weyl. - t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array. - i = (0 == t) ? i + 1 : 0; // Count zeroes. - } - } - // We have detected all zeroes; make the key nonzero. - if (i >= 128) { - X[(seed && seed.length || 0) & 127] = -1; - } - // Run the generator 512 times to further mix the state before using it. - // Factoring this as a function slows the main generator, so it is just - // unrolled here. The weyl generator is not advanced while warming up. - i = 127; - for (j = 4 * 128; j > 0; --j) { - v = X[(i + 34) & 127]; - t = X[i = ((i + 1) & 127)]; - v ^= v << 13; - t ^= t << 17; - v ^= v >>> 15; - t ^= t >>> 12; - X[i] = v ^ t; - } - // Storing state as object members is faster than using closure variables. - me.w = w; - me.X = X; - me.i = i; - } - - init(me, seed); -} - -function copy(f, t) { - t.i = f.i; - t.w = f.w; - t.X = f.X.slice(); - return t; -}; - -function impl(seed, opts) { - if (seed == null) seed = +(new Date); - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (state.X) copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xor4096 = impl; -} - -})( - this, // window object or global - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - -},{}],19:[function(require,module,exports){ -// A Javascript implementaion of the "xorshift7" algorithm by -// François Panneton and Pierre L'ecuyer: -// "On the Xorgshift Random Number Generators" -// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf - -(function(global, module, define) { - -function XorGen(seed) { - var me = this; - - // Set up generator function. - me.next = function() { - // Update xor generator. - var X = me.x, i = me.i, t, v, w; - t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24); - t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10); - t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3); - t = X[(i + 4) & 7]; v ^= t ^ (t << 7); - t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9); - X[i] = v; - me.i = (i + 1) & 7; - return v; - }; - - function init(me, seed) { - var j, w, X = []; - - if (seed === (seed | 0)) { - // Seed state array using a 32-bit integer. - w = X[0] = seed; - } else { - // Seed state using a string. - seed = '' + seed; - for (j = 0; j < seed.length; ++j) { - X[j & 7] = (X[j & 7] << 15) ^ - (seed.charCodeAt(j) + X[(j + 1) & 7] << 13); - } - } - // Enforce an array length of 8, not all zeroes. - while (X.length < 8) X.push(0); - for (j = 0; j < 8 && X[j] === 0; ++j); - if (j == 8) w = X[7] = -1; else w = X[j]; - - me.x = X; - me.i = 0; - - // Discard an initial 256 values. - for (j = 256; j > 0; --j) { - me.next(); - } - } - - init(me, seed); -} - -function copy(f, t) { - t.x = f.x.slice(); - t.i = f.i; - return t; -} - -function impl(seed, opts) { - if (seed == null) seed = +(new Date); - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (state.x) copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xorshift7 = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - -},{}],20:[function(require,module,exports){ -// A Javascript implementaion of the "xorwow" prng algorithm by -// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - // Set up generator function. - me.next = function() { - var t = (me.x ^ (me.x >>> 2)); - me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v; - return (me.d = (me.d + 362437 | 0)) + - (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0; - }; - - me.x = 0; - me.y = 0; - me.z = 0; - me.w = 0; - me.v = 0; - - if (seed === (seed | 0)) { - // Integer seed. - me.x = seed; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 64; k++) { - me.x ^= strseed.charCodeAt(k) | 0; - if (k == strseed.length) { - me.d = me.x << 10 ^ me.x >>> 4; - } - me.next(); - } -} - -function copy(f, t) { - t.x = f.x; - t.y = f.y; - t.z = f.z; - t.w = f.w; - t.v = f.v; - t.d = f.d; - return t; -} - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xorwow = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],21:[function(require,module,exports){ -/* -Copyright 2014 David Bau. - -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 (pool, math) { -// -// The following constants are related to IEEE 754 limits. -// -var global = this, - width = 256, // each RC4 output is 0 <= x < 256 - chunks = 6, // at least six RC4 outputs for each double - digits = 52, // there are 52 significant digits in a double - rngname = 'random', // rngname: name for Math.random and Math.seedrandom - startdenom = math.pow(width, chunks), - significance = math.pow(2, digits), - overflow = significance * 2, - mask = width - 1, - nodecrypto; // node.js crypto module, initialized at the bottom. - -// -// seedrandom() -// This is the seedrandom function described above. -// -function seedrandom(seed, options, callback) { - var key = []; - options = (options == true) ? { entropy: true } : (options || {}); - - // Flatten the seed string or build one from local entropy if needed. - var shortseed = mixkey(flatten( - options.entropy ? [seed, tostring(pool)] : - (seed == null) ? autoseed() : seed, 3), key); - - // Use the seed to initialize an ARC4 generator. - var arc4 = new ARC4(key); - - // This function returns a random double in [0, 1) that contains - // randomness in every bit of the mantissa of the IEEE 754 value. - var prng = function() { - var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48 - d = startdenom, // and denominator d = 2 ^ 48. - x = 0; // and no 'extra last byte'. - while (n < significance) { // Fill up all significant digits by - n = (n + x) * width; // shifting numerator and - d *= width; // denominator and generating a - x = arc4.g(1); // new least-significant-byte. - } - while (n >= overflow) { // To avoid rounding up, before adding - n /= 2; // last byte, shift everything - d /= 2; // right using integer math until - x >>>= 1; // we have exactly the desired bits. - } - return (n + x) / d; // Form the number within [0, 1). - }; - - prng.int32 = function() { return arc4.g(4) | 0; } - prng.quick = function() { return arc4.g(4) / 0x100000000; } - prng.double = prng; - - // Mix the randomness into accumulated entropy. - mixkey(tostring(arc4.S), pool); - - // Calling convention: what to return as a function of prng, seed, is_math. - return (options.pass || callback || - function(prng, seed, is_math_call, state) { - if (state) { - // Load the arc4 state from the given state if it has an S array. - if (state.S) { copy(state, arc4); } - // Only provide the .state method if requested via options.state. - prng.state = function() { return copy(arc4, {}); } - } - - // If called as a method of Math (Math.seedrandom()), mutate - // Math.random because that is how seedrandom.js has worked since v1.0. - if (is_math_call) { math[rngname] = prng; return seed; } - - // Otherwise, it is a newer calling convention, so return the - // prng directly. - else return prng; - })( - prng, - shortseed, - 'global' in options ? options.global : (this == math), - options.state); -} -math['seed' + rngname] = seedrandom; - -// -// ARC4 -// -// An ARC4 implementation. The constructor takes a key in the form of -// an array of at most (width) integers that should be 0 <= x < (width). -// -// The g(count) method returns a pseudorandom integer that concatenates -// the next (count) outputs from ARC4. Its return value is a number x -// that is in the range 0 <= x < (width ^ count). -// -function ARC4(key) { - var t, keylen = key.length, - me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; - - // The empty key [] is treated as [0]. - if (!keylen) { key = [keylen++]; } - - // Set up S using the standard key scheduling algorithm. - while (i < width) { - s[i] = i++; - } - for (i = 0; i < width; i++) { - s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))]; - s[j] = t; - } - - // The "g" method returns the next (count) outputs as one number. - (me.g = function(count) { - // Using instance members instead of closure state nearly doubles speed. - var t, r = 0, - i = me.i, j = me.j, s = me.S; - while (count--) { - t = s[i = mask & (i + 1)]; - r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))]; - } - me.i = i; me.j = j; - return r; - // For robust unpredictability, the function call below automatically - // discards an initial batch of values. This is called RC4-drop[256]. - // See http://google.com/search?q=rsa+fluhrer+response&btnI - })(width); -} - -// -// copy() -// Copies internal state of ARC4 to or from a plain object. -// -function copy(f, t) { - t.i = f.i; - t.j = f.j; - t.S = f.S.slice(); - return t; -}; - -// -// flatten() -// Converts an object tree to nested arrays of strings. -// -function flatten(obj, depth) { - var result = [], typ = (typeof obj), prop; - if (depth && typ == 'object') { - for (prop in obj) { - try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} - } - } - return (result.length ? result : typ == 'string' ? obj : obj + '\0'); -} - -// -// mixkey() -// Mixes a string seed into a key that is an array of integers, and -// returns a shortened string seed that is equivalent to the result key. -// -function mixkey(seed, key) { - var stringseed = seed + '', smear, j = 0; - while (j < stringseed.length) { - key[mask & j] = - mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++)); - } - return tostring(key); -} - -// -// autoseed() -// Returns an object for autoseeding, using window.crypto and Node crypto -// module if available. -// -function autoseed() { - try { - var out; - if (nodecrypto && (out = nodecrypto.randomBytes)) { - // The use of 'out' to remember randomBytes makes tight minified code. - out = out(width); - } else { - out = new Uint8Array(width); - (global.crypto || global.msCrypto).getRandomValues(out); - } - return tostring(out); - } catch (e) { - var browser = global.navigator, - plugins = browser && browser.plugins; - return [+new Date, global, plugins, global.screen, tostring(pool)]; - } -} - -// -// tostring() -// Converts an array of charcodes to a string -// -function tostring(a) { - return String.fromCharCode.apply(0, a); -} - -// -// When seedrandom.js is loaded, we immediately mix a few bits -// from the built-in RNG into the entropy pool. Because we do -// not want to interfere with deterministic PRNG state later, -// seedrandom will not call math.random on its own again after -// initialization. -// -mixkey(math.random(), pool); - -// -// Nodejs and AMD support: export the implementation as a module using -// either convention. -// -if ((typeof module) == 'object' && module.exports) { - module.exports = seedrandom; - // When in node.js, try using crypto package for autoseeding. - try { - nodecrypto = require('crypto'); - } catch (ex) {} -} else if ((typeof define) == 'function' && define.amd) { - define(function() { return seedrandom; }); -} - -// End anonymous scope, and pass initial values. -})( - [], // pool: entropy pool starts empty - Math // math: package containing random, pow, and seedrandom -); - -},{"crypto":25}],22:[function(require,module,exports){ -// angle.js -// Released under MIT license -// Author: David Figatner -// Copyright (c) 2016-17 YOPEY YOPEY LLC - -var _toDegreeConversion = 180 / Math.PI -var _toRadianConversion = Math.PI / 180 - -/** @constant {number} */ -var UP = Math.PI / 2 -var DOWN = 3 * Math.PI / 2 -var LEFT = Math.PI -var RIGHT = 0 - -var NORTH = UP -var SOUTH = DOWN -var WEST = LEFT -var EAST = RIGHT - -var PI_2 = Math.PI * 2 -var PI_QUARTER = Math.PI / 4 -var PI_HALF = Math.PI / 2 - -/** - * converts from radians to degrees (all other functions expect radians) - * @param {number} radians - * @return {number} degrees - */ -function toDegrees(radians) -{ - return radians * _toDegreeConversion -} - -/** - * converts from degrees to radians (all other functions expect radians) - * @param {number} degrees - * @return {number} radians - */ -function toRadians(degrees) -{ - return degrees * _toRadianConversion -} - -/** - * returns whether the target angle is between angle1 and angle2 (in radians) - * (based on: http://stackoverflow.com/questions/11406189/determine-if-angle-lies-between-2-other-angles) - * @param {number} target angle - * @param {number} angle1 - * @param {number} angle2 - * @return {boolean} - */ -function isAngleBetween(target, angle1, angle2) -{ - var rAngle = ((angle2 - angle1) % PI_2 + PI_2) % PI_2 - if (rAngle >= Math.PI) - { - var swap = angle1 - angle1 = angle2 - angle2 = swap - } - - if (angle1 <= angle2) - { - return target >= angle1 && target <= angle2 - } - else - { - return target >= angle1 || target <= angle2 - } -} - -/** - * returns +1 or -1 based on whether the difference between two angles is positive or negative (in radians) - * @param {number} target angle - * @param {number} source angle - * @return {number} 1 or -1 - */ -function differenceAnglesSign(target, source) -{ - function mod(a, n) - { - return (a % n + n) % n - } - - var a = target - source - return mod((a + Math.PI), PI_2) - Math.PI > 0 ? 1 : -1 -} - -/** - * returns the normalized difference between two angles (in radians) - * @param {number} a - first angle - * @param {number} b - second angle - * @return {number} normalized difference between a and b - */ -function differenceAngles(a, b) -{ - var c = Math.abs(a - b) % PI_2 - return c > Math.PI ? (PI_2 - c) : c -} - -/** - * returns a target angle that is the shortest way to rotate an object between start and to--may choose a negative angle - * @param {number} start - * @param {number} to - * @return {number} shortest target angle - */ -function shortestAngle(start, to) -{ - var difference = differenceAngles(to, start) - var sign = differenceAnglesSign(to, start) - var delta = difference * sign - return delta + start -} - -/** - * returns the normalized angle (0 - PI x 2) - * @param {number} radians - * @return {number} normalized angle in radians - */ -function normalize(radians) -{ - return radians - PI_2 * Math.floor(radians / PI_2) -} - -/** - * returns angle between two points (in radians) - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} angle - */ -function angleTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 4) - { - return Math.atan2(arguments[3] - arguments[1], arguments[2] - arguments[0]) - } - else - { - return Math.atan2(arguments[1].y - arguments[0].y, arguments[1].x - arguments[0].x) - } -} - -/** - * returns distance between two points - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} distance - */ -function distanceTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 2) - { - return Math.sqrt(Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2)) - } - else - { - return Math.sqrt(Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2)) - } -} - -/** - * returns the squared distance between two points - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} squared distance - */ -function distanceTwoPointsSquared(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 2) - { - return Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2) - } - else - { - return Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2) - } -} - -/** - * returns the closest cardinal (N, S, E, W) to the given angle (in radians) - * @param {number} angle - * @return {number} closest cardinal in radians - */ -function closestAngle(angle) -{ - var left = differenceAngles(angle, LEFT) - var right = differenceAngles(angle, RIGHT) - var up = differenceAngles(angle, UP) - var down = differenceAngles(angle, DOWN) - if (left <= right && left <= up && left <= down) - { - return LEFT - } - else if (right <= up && right <= down) - { - return RIGHT - } - else if (up <= down) - { - return UP - } - else - { - return DOWN - } -} - -/** - * checks whether angles a1 and a2 are equal (after normalizing) - * @param {number} a1 - * @param {number} a2 - * @param {number} [wiggle] return true if the difference between the angles is <= wiggle - * @return {boolean} a1 === a2 - */ -function equals(a1, a2, wiggle) -{ - if (wiggle) - { - return differenceAngles(a1, a2) < wiggle - } - else - { - return normalize(a1) === normalize(a2) - } -} - -/** - * return a text representation of the cardinal direction - * @param {number} angle - * @returns {string} UP, DOWN, LEFT, RIGHT, or NOT CARDINAL - */ -function explain(angle) -{ - switch (angle) - { - case UP: return 'UP' - case DOWN: return 'DOWN' - case LEFT: return 'LEFT' - case RIGHT: return 'RIGHT' - default: return 'NOT CARDINAL' - } -} - -module.exports = { - UP: UP, - DOWN: DOWN, - LEFT: LEFT, - RIGHT: RIGHT, - NORTH: NORTH, - SOUTH: SOUTH, - WEST: WEST, - EAST: EAST, - PI_2: PI_2, - PI_QUARTER: PI_QUARTER, - PI_HALF: PI_HALF, - - toDegrees: toDegrees, - toRadians: toRadians, - isAngleBetween: isAngleBetween, - differenceAnglesSign: differenceAnglesSign, - differenceAngles: differenceAngles, - shortestAngle: shortestAngle, - normalize: normalize, - angleTwoPoints: angleTwoPoints, - distanceTwoPoints: distanceTwoPoints, - distanceTwoPointsSquared: distanceTwoPointsSquared, - closestAngle: closestAngle, - equals: equals, - explain: explain -} -},{}],23:[function(require,module,exports){ -// yy-color -// by David Figatner -// MIT License -// (c) YOPEY YOPEY LLC 2017 -// https://github.com/davidfig/color - -var Random = require('yy-random') - -/** - * converts a #FFFFFF to 0x123456 - * @param {string} color - * @return {string} - */ -function poundToHex(color) -{ - return '0x' + parseInt(color.substr(1)).toString(16) -} - -/** - * converts a 0x123456 to #FFFFFF - * @param {string} color - * @return {string} - */ -function hexToPound(color) -{ - return '#' + color.substr(2) -} - -/** - * converts a number to #FFFFFF - * @param {number} color - * @return {string} - */ -function valueToPound(color) -{ - return '#' + color.toString(16) -} - -/** - * based on tinycolor - * https://github.com/bgrins/TinyColor - * BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE - * @param {string} color - * @returns {object} - */ -function hexToHsl (color) -{ - var rgb = this.hexToRgb(color), - r = rgb.r, - g = rgb.g, - b = rgb.b - var max = Math.max(r, g, b), - min = Math.min(r, g, b) - var h, s, l = (max + min) / 2 - - if (max === min) - { - h = s = 0 // achromatic - } - else - { - var d = max - min - s = l > 0.5 ? d / (2 - max - min) : d / (max + min) - switch (max) - { - case r: h = (g - b) / d + (g < b ? 6 : 0); break - case g: h = (b - r) / d + 2; break - case b: h = (r - g) / d + 4; break - } - - h /= 6 - } - - return { h: h, s: s, l: l } -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object|number} color {h, s, b} or h -* @param {number} [s] -* @param {number} [l] -* @returns number -*/ -function hslToHex(color) -{ - var r, g, b, h, s, l - if (arguments.length === 1) - { - h = color.h, - s = color.s, - l = color.l - } - else - { - h = arguments[0] - s = arguments[1] - l = arguments[2] - } - - function hue2rgb(p, q, t) { - if (t < 0) t += 1 - if (t > 1) t -= 1 - if (t < 1/6) return p + (q - p) * 6 * t - if (t < 1/2) return q - if (t < 2/3) return p + (q - p) * (2/3 - t) * 6 - return p - } - - if (s === 0) - { - r = g = b = l // achromatic - } - else - { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s - var p = 2 * l - q - r = hue2rgb(p, q, h + 1/3) - g = hue2rgb(p, q, h) - b = hue2rgb(p, q, h - 1/3) - } - - return this.rgbToHex(r * 255, g * 255, b * 255) -} - -/* darkens a color by the percentage -* @param {object} color in hex (0xabcdef) -* @param {number} amount -* @return {number} -*/ -function darken(color, amount) -{ - return this.blend(amount, color, 0) -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object} color -* @param {number} amount -*/ -function saturate(color, amount) -{ - amount = (amount === 0) ? 0 : (amount || 10) - var hsl = this.hexToHsl(color) - hsl.s += amount / 100 - hsl.s = Math.min(1, Math.max(0, hsl.s)) - return this.hslToHex(hsl) -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object} color -* @param {number} amount -*/ -function desaturate(color, amount) -{ - amount = (amount === 0) ? 0 : (amount || 10) - var hsl = this.hexToHsl(color) - hsl.s -= amount / 100 - hsl.s = Math.min(1, Math.max(0, hsl.s)) - return this.hslToHex(hsl) -} - -/** - * blends two colors together - * @param {number} percent [0.0 - 1.0] - * @param {string} color1 first color in 0x123456 format - * @param {string} color2 second color in 0x123456 format - * @return {number} - */ -function blend(percent, color1, color2) -{ - if (percent === 0) - { - return color1 - } - if (percent === 1) - { - return color2 - } - var r1 = color1 >> 16 - var g1 = color1 >> 8 & 0x0000ff - var b1 = color1 & 0x0000ff - var r2 = color2 >> 16 - var g2 = color2 >> 8 & 0x0000ff - var b2 = color2 & 0x0000ff - var percent1 = 1 - percent - var r = percent1 * r1 + percent * r2 - var g = percent1 * g1 + percent * g2 - var b = percent1 * b1 + percent * b2 - return r << 16 | g << 8 | b -} - -/** - * returns a hex color into an rgb value - * @param {number} hex - * @return {string} - */ -function hexToRgb(hex) -{ - if (hex === 0) - { - hex = '0x000000' - } - else if (typeof hex !== 'string') - { - var s = '000000' + hex.toString(16) - hex = '0x' + s.substr(s.length - 6) - } - var result = /^0x?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null -} - -/** - * rgb color to hex in the form of 0x123456 - * @param {(number|string)} r first number or 'rgb(...)' string - * @param {(number|null)} g - * @param {(number|null)} b - * @return {string} - */ -function rgbToHex(r, g, b) -{ - if (arguments.length === 1) { - if (Array.isArray(arguments[0])) { - var number = arguments[0] - r = number[0] - g = number[1] - b = number[2] - } else { - var parse = r.replace(/( *rgb *\( *)|( )|(\) *;?)/,'') - var numbers = parse.split(',') - r = numbers[0] - g = numbers[1] - b = numbers[2] } } - return '0x' + ((1 << 24) + (parseInt(r) << 16) + (parseInt(g) << 8) + parseInt(b)).toString(16).slice(1) -} -/** - * returns a random color with balanced r, g, b values (i.e., r, g, b either have the same value or are 0) - * @param {number} min value for random number - * @param {number} max value for random number - * @return {number} color - */ -function random(min, max) -{ - function random() - { - return Random.range(min, max) - } + function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - var colors = [{r:1, g:1, b:1}, {r:1, g:1, b:0}, {r:1,g:0,b:1}, {r:0,g:1,b:1}, {r:1,g:0,b:0}, {r:0,g:1,b:0}, {r:0,g:0,b:1}] - var color = Random.pick(colors) - min = min || 0 - max = max || 255 - return this.rgbToHex(color.r ? random() : 0, color.g ? random() : 0, color.b ? random() : 0) -} -// h: 0-360, s: 0-1, l: 0-1 -/** - * returns a random color based on hsl - * @param {number} hMin [0, 360] - * @param {number} hMax [hMin, 360] - * @param {number} sMin [0, 1] - * @param {number} sMax [sMin, 1] - * @param {number} lMin [0, 1] - * @param {number} lMax [lMin, 1] - */ -function randomHSL(hMin, hMax, sMin, sMax, lMin, lMax) -{ - var color = { - h: Random.range(hMin, hMax), - s: Random.range(sMin, sMax, true), - l: Random.range(lMin, lMax, true) - } - return this.hslToHex(color) -} -/** - * returns random colors based on HSL with different hues - * based on http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ - * @returns {number[]} colors in hex format (0x123456) - */ -function randomGoldenRatioHSL(count, saturation, luminosity) -{ - var goldenRatio = 0.618033988749895 - var h = Random.get(1, true) - var colors = [] - for (var i = 0; i < count; i++) - { - colors.push(this.hslToHex(h, saturation, luminosity)) - h = (h + goldenRatio) % 1 - } - return colors -} -module.exports = { - poundToHex: poundToHex, - hexToPound: hexToPound, - valueToPound: valueToPound, - hexToHsl: hexToHsl, - hslToHex: hslToHex, - hexToRgb: hexToRgb, - rgbToHex: rgbToHex, - darken: darken, - saturate: saturate, - desaturate: desaturate, - blend: blend, - random: random, - randomHSL: randomHSL, - randomGoldenRatioHSL: randomGoldenRatioHSL -} -},{"yy-random":24}],24:[function(require,module,exports){ -'use strict'; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + /** Options for {@link Bounce}. */ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// yy-random -// by David Figatner -// MIT license -// copyright YOPEY YOPEY LLC 2016-17 -// https://github.com/davidfig/random -var seedrandom = require('seedrandom'); -var Random = function () { - function Random() { - _classCallCheck(this, Random); - this.generator = Math.random; - } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_BOUNCE_OPTIONS = { + sides: 'all', + friction: 0.5, + time: 150, + ease: 'easeInOutSine', + underflow: 'center', + bounceBox: null + }; /** - * generates a seeded number - * @param {number} seed - * @param {object} [options] - * @param {string} [PRNG="alea"] - name of algorithm, see https://github.com/davidbau/seedrandom - * @param {boolean} [save=true] + * @fires bounce-start-x + * @fires bounce.end-x + * @fires bounce-start-y + * @fires bounce-end-y + * @public */ + class Bounce extends Plugin + { + /** The options passed to initialize this plugin, cannot be modified again. */ + + /** Holds whether to bounce from left side. */ + - _createClass(Random, [{ - key: 'seed', - value: function seed(_seed, options) { - options = options || {}; - this.generator = seedrandom[options.PRNG || 'alea'](_seed, { state: options.state }); - this.options = options; - } + /** Holds whether to bounce from top side. */ + + + /** Holds whether to bounce from right side. */ + + + /** Holds whether to bounce from bottom side. */ + + + /** Direction of underflow along x-axis. */ + + + /** Direction of underflow along y-axis. */ + + + /** Easing */ + + + /** Bounce state along x-axis */ + + + /** Bounce state along y-axis */ + /** - * saves the state of the random generator - * can only be used after Random.seed() is called - * @returns {number} state + * This is called by {@link Viewport.bounce}. */ + constructor(parent, options = {}) + { + super(parent); - }, { - key: 'save', - value: function save() { - if (this.generator !== Math.random) { - return this.generator.state(); - } - } + this.options = Object.assign({}, DEFAULT_BOUNCE_OPTIONS, options); + this.ease = ease(this.options.ease, 'easeInOutSine'); - /** - * restores the state of the random generator - * @param {number} state - */ - - }, { - key: 'restore', - value: function restore(state) { - this.generator = seedrandom[this.options.PRNG || 'alea']('', { state: state }); - } - - /** - * changes the generator to use the old Math.sin-based random function - * based on : http://stackoverflow.com/questions/521295/javascript-random-seeds - * (deprecated) Use only for compatibility purposes - * @param {number} seed - */ - - }, { - key: 'seedOld', - value: function seedOld(seed) { - this.generator = function () { - var x = Math.sin(seed++) * 10000; - return x - Math.floor(x); - }; - } - - /** - * create a separate random generator using the seed - * @param {number} seed - * @return {object} - */ - - }, { - key: 'separateSeed', - value: function separateSeed(seed) { - var random = new Random(); - random.seed(seed); - return random; - } - - /** - * resets the random number this.generator to Math.random() - */ - - }, { - key: 'reset', - value: function reset() { - this.generator = Math.random; - } - - /** - * returns a random number using the this.generator between [0, ceiling - 1] - * @param {number} ceiling - * @param {boolean} [useFloat=false] - * @return {number} - */ - - }, { - key: 'get', - value: function get(ceiling, useFloat) { - var negative = ceiling < 0 ? -1 : 1; - ceiling *= negative; - var result = void 0; - if (useFloat) { - result = this.generator() * ceiling; - } else { - result = Math.floor(this.generator() * ceiling); - } - return result * negative; - } - - /** - * returns a random integer between 0 - Number.MAX_SAFE_INTEGER - * @return {number} - */ - - }, { - key: 'getHuge', - value: function getHuge() { - return this.get(Number.MAX_SAFE_INTEGER); - } - - /** - * random number [middle - range, middle + range] - * @param {number} middle - * @param {number} delta - * @param {boolean} [useFloat=false] - * @return {number} - */ - - }, { - key: 'middle', - value: function middle(_middle, delta, useFloat) { - var half = delta / 2; - return this.range(_middle - half, _middle + half, useFloat); - } - - /** - * random number [start, end] - * @param {number} start - * @param {number} end - * @param {boolean} [useFloat=false] if true, then range is (start, end)--i.e., not inclusive to start and end - * @return {number} - */ - - }, { - key: 'range', - value: function range(start, end, useFloat) { - // case where there is no range - if (end === start) { - return end; - } - - if (useFloat) { - return this.get(end - start, true) + start; - } else { - var range = void 0; - if (start < 0 && end > 0) { - range = -start + end + 1; - } else if (start === 0 && end > 0) { - range = end + 1; - } else if (start < 0 && end === 0) { - range = start - 1; - start = 1; - } else if (start < 0 && end < 0) { - range = end - start - 1; - } else { - range = end - start + 1; + if (this.options.sides) + { + if (this.options.sides === 'all') + { + this.top = this.bottom = this.left = this.right = true; } - return Math.floor(this.generator() * range) + start; - } - } - - /** - * an array of random numbers between [start, end] - * @param {number} start - * @param {number} end - * @param {number} count - * @param {boolean} [useFloat=false] - * @return {number[]} - */ - - }, { - key: 'rangeMultiple', - value: function rangeMultiple(start, end, count, useFloat) { - var array = []; - for (var i = 0; i < count; i++) { - array.push(this.range(start, end, useFloat)); - } - return array; - } - - /** - * an array of random numbers between [middle - range, middle + range] - * @param {number} middle - * @param {number} range - * @param {number} count - * @param {boolean} [useFloat=false] - * @return {number[]} - */ - - }, { - key: 'middleMultiple', - value: function middleMultiple(middle, range, count, useFloat) { - var array = []; - for (var i = 0; i < count; i++) { - array.push(middle(middle, range, useFloat)); - } - return array; - } - - /** - * @param {number} [chance=0.5] - * returns random sign (either +1 or -1) - * @return {number} - */ - - }, { - key: 'sign', - value: function sign(chance) { - chance = chance || 0.5; - return this.generator() < chance ? 1 : -1; - } - - /** - * tells you whether a random chance was achieved - * @param {number} [percent=0.5] - * @return {boolean} - */ - - }, { - key: 'chance', - value: function chance(percent) { - return this.generator() < (percent || 0.5); - } - - /** - * returns a random angle in radians [0 - 2 * Math.PI) - */ - - }, { - key: 'angle', - value: function angle() { - return this.get(Math.PI * 2, true); - } - - /** - * Shuffle array (either in place or copied) - * from http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array - * @param {Array} array - * @param {boolean} [copy=false] whether to shuffle in place (default) or return a new shuffled array - * @return {Array} a shuffled array - */ - - }, { - key: 'shuffle', - value: function shuffle(array, copy) { - if (copy) { - array = array.slice(); - } - if (array.length === 0) { - return array; - } - - var currentIndex = array.length, - temporaryValue = void 0, - randomIndex = void 0; - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - // Pick a remaining element... - randomIndex = this.get(currentIndex); - currentIndex -= 1; - - // And swap it with the current element. - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - return array; - } - - /** - * picks a random element from an array - * @param {Array} array - * @return {*} - */ - - }, { - key: 'pick', - value: function pick(array, remove) { - if (!remove) { - return array[this.get(array.length)]; - } else { - var pick = this.get(array.length); - var temp = array[pick]; - array.splice(pick, 1); - return temp; - } - } - - /** - * returns a random property from an object - * from http://stackoverflow.com/questions/2532218/pick-random-property-from-a-javascript-object - * @param {object} obj - * @return {*} - */ - - }, { - key: 'property', - value: function property(obj) { - var result; - var count = 0; - for (var prop in obj) { - if (this.chance(1 / ++count)) { - result = prop; + else if (this.options.sides === 'horizontal') + { + this.right = this.left = true; + this.top = this.bottom = false; } - } - return result; - } - - /** - * creates a random set where each entry is a value between [min, max] - * @param {number} min - * @param {number} max - * @param {number} amount of numbers in set - * @param {number[]} - */ - - }, { - key: 'set', - value: function set(min, max, amount) { - var set = [], - all = [], - i; - for (i = min; i < max; i++) { - all.push(i); - } - - for (i = 0; i < amount; i++) { - var found = this.get(all.length); - set.push(all[found]); - all.splice(found, 1); - } - return set; - } - - /** - * returns a set of numbers with a randomly even distribution (i.e., no overlapping and filling the space) - * @param {number} start position - * @param {number} end position - * @param {number} count of non-start/end points - * @param {boolean} [includeStart=false] includes start point (count++) - * @param {boolean} [includeEnd=false] includes end point (count++) - * @param {boolean} [useFloat=false] - * @param {number[]} - */ - - }, { - key: 'distribution', - value: function distribution(start, end, count, includeStart, includeEnd, useFloat) { - var interval = Math.floor((end - start) / count); - var halfInterval = interval / 2; - var quarterInterval = interval / 4; - var set = []; - if (includeStart) { - set.push(start); - } - for (var i = 0; i < count; i++) { - set.push(start + i * interval + halfInterval + this.range(-quarterInterval, quarterInterval, useFloat)); - } - if (includeEnd) { - set.push(end); - } - return set; - } - - /** - * returns a random number based on weighted probability between [min, max] - * from http://stackoverflow.com/questions/22656126/javascript-random-number-with-weighted-probability - * @param {number} min value - * @param {number} max value - * @param {number} target for average value - * @param {number} stddev - standard deviation - */ - - }, { - key: 'weightedProbabilityInt', - value: function weightedProbabilityInt(min, max, target, stddev) { - function normRand() { - var x1 = void 0, - x2 = void 0, - rad = void 0; - do { - x1 = 2 * this.get(1, true) - 1; - x2 = 2 * this.get(1, true) - 1; - rad = x1 * x1 + x2 * x2; - } while (rad >= 1 || rad === 0); - var c = Math.sqrt(-2 * Math.log(rad) / rad); - return x1 * c; - } - - stddev = stddev || 1; - if (Math.random() < 0.81546) { - while (true) { - var sample = normRand() * stddev + target; - if (sample >= min && sample <= max) { - return sample; - } + else if (this.options.sides === 'vertical') + { + this.left = this.right = false; + this.top = this.bottom = true; + } + else + { + this.top = this.options.sides.indexOf('top') !== -1; + this.bottom = this.options.sides.indexOf('bottom') !== -1; + this.left = this.options.sides.indexOf('left') !== -1; + this.right = this.options.sides.indexOf('right') !== -1; } } else { - return this.range(min, max); + this.left = this.top = this.right = this.bottom = false; } - } - /* - * returns a random hex color (0 - 0xffffff) - * @return {number} - */ + const clamp = this.options.underflow.toLowerCase(); - }, { - key: 'color', - value: function color() { - return this.get(0xffffff); - } - }]); - - return Random; -}(); - -module.exports = new Random(); - -},{"seedrandom":14}],25:[function(require,module,exports){ - -},{}]},{},[3]); - -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= this.time) { + + if (toX.time >= this.options.time) + { this.parent.x = toX.end; this.toX = null; this.parent.emit('bounce-x-end', this.parent); - } else { - this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.time); } - this.parent.dirty = true; + else + { + this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.options.time); + } } - if (this.toY) { - var toY = this.toY; + + if (this.toY) + { + const toY = this.toY; + toY.time += elapsed; this.parent.emit('moved', { viewport: this.parent, type: 'bounce-y' }); - if (toY.time >= this.time) { + + if (toY.time >= this.options.time) + { this.parent.y = toY.end; this.toY = null; this.parent.emit('bounce-y-end', this.parent); - } else { - this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.time); } - this.parent.dirty = true; + else + { + this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.options.time); + } } } - }, { - key: 'calcUnderflowX', - value: function calcUnderflowX() { - var x = void 0; - switch (this.underflowX) { + + /** @internal */ + calcUnderflowX() + { + let x; + + switch (this.underflowX) + { case -1: x = 0; break; case 1: - x = this.parent.screenWidth - this.parent.screenWorldWidth; + x = (this.parent.screenWidth - this.parent.screenWorldWidth); break; default: x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; } + return x; } - }, { - key: 'calcUnderflowY', - value: function calcUnderflowY() { - var y = void 0; - switch (this.underflowY) { + + /** @internal */ + calcUnderflowY() + { + let y; + + switch (this.underflowY) + { case -1: y = 0; break; case 1: - y = this.parent.screenHeight - this.parent.screenWorldHeight; + y = (this.parent.screenHeight - this.parent.screenWorldHeight); break; default: y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; } + return y; } - }, { - key: 'bounce', - value: function bounce() { - if (this.paused) { + + oob() + { + const box = this.options.bounceBox; + + if (box) + { + const x1 = typeof box.x === 'undefined' ? 0 : box.x; + const y1 = typeof box.y === 'undefined' ? 0 : box.y; + const width = typeof box.width === 'undefined' ? this.parent.worldWidth : box.width; + const height = typeof box.height === 'undefined' ? this.parent.worldHeight : box.height; + + return { + left: this.parent.left < x1, + right: this.parent.right > width, + top: this.parent.top < y1, + bottom: this.parent.bottom > height, + topLeft: new math.Point( + x1 * this.parent.scale.x, + y1 * this.parent.scale.y + ), + bottomRight: new math.Point( + width * this.parent.scale.x - this.parent.screenWidth, + height * this.parent.scale.y - this.parent.screenHeight + ) + }; + } + + return { + left: this.parent.left < 0, + right: this.parent.right > this.parent.worldWidth, + top: this.parent.top < 0, + bottom: this.parent.bottom > this.parent.worldHeight, + topLeft: new math.Point(0, 0), + bottomRight: new math.Point( + this.parent.worldWidth * this.parent.scale.x - this.parent.screenWidth, + this.parent.worldHeight * this.parent.scale.y - this.parent.screenHeight + ) + }; + } + + bounce() + { + if (this.paused) + { return; } - var oob = void 0; - var decelerate = this.parent.plugins['decelerate']; - if (decelerate && (decelerate.x || decelerate.y)) { - if (decelerate.x && decelerate.percentChangeX === decelerate.friction || decelerate.y && decelerate.percentChangeY === decelerate.friction) { - oob = this.parent.OOB(); - if (oob.left && this.left || oob.right && this.right) { - decelerate.percentChangeX = this.friction; + let oob; + let decelerate + + + + + + = this.parent.plugins.get('decelerate', true) ; + + if (decelerate && (decelerate.x || decelerate.y)) + { + if ((decelerate.x && decelerate.percentChangeX === _optionalChain$1([decelerate, 'access', _ => _.options, 'optionalAccess', _2 => _2.friction])) || (decelerate.y && decelerate.percentChangeY === _optionalChain$1([decelerate, 'access', _3 => _3.options, 'optionalAccess', _4 => _4.friction]))) + { + oob = this.oob(); + if ((oob.left && this.left) || (oob.right && this.right)) + { + decelerate.percentChangeX = this.options.friction; } - if (oob.top && this.top || oob.bottom && this.bottom) { - decelerate.percentChangeY = this.friction; + if ((oob.top && this.top) || (oob.bottom && this.bottom)) + { + decelerate.percentChangeY = this.options.friction; } } } - var drag = this.parent.plugins['drag'] || {}; - var pinch = this.parent.plugins['pinch'] || {}; + const drag = this.parent.plugins.get('drag', true) || {}; + const pinch = this.parent.plugins.get('pinch', true) || {}; + decelerate = decelerate || {}; - if (!drag.active && !pinch.active && (!this.toX || !this.toY) && (!decelerate.x || !decelerate.y)) { - oob = oob || this.parent.OOB(); - var point = oob.cornerPoint; - if (!this.toX && !decelerate.x) { - var x = null; - if (oob.left && this.left) { - x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : 0; - } else if (oob.right && this.right) { - x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : -point.x; + + if (!_optionalChain$1([drag, 'optionalAccess', _5 => _5.active]) && !_optionalChain$1([pinch, 'optionalAccess', _6 => _6.active]) && ((!this.toX || !this.toY) && (!decelerate.x || !decelerate.y))) + { + oob = oob || this.oob(); + const topLeft = oob.topLeft; + const bottomRight = oob.bottomRight; + + if (!this.toX && !decelerate.x) + { + let x = null; + + if (oob.left && this.left) + { + x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : -topLeft.x; } - if (x !== null && this.parent.x !== x) { + else if (oob.right && this.right) + { + x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : -bottomRight.x; + } + if (x !== null && this.parent.x !== x) + { this.toX = { time: 0, start: this.parent.x, delta: x - this.parent.x, end: x }; this.parent.emit('bounce-x-start', this.parent); } } - if (!this.toY && !decelerate.y) { - var y = null; - if (oob.top && this.top) { - y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : 0; - } else if (oob.bottom && this.bottom) { - y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : -point.y; + if (!this.toY && !decelerate.y) + { + let y = null; + + if (oob.top && this.top) + { + y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : -topLeft.y; } - if (y !== null && this.parent.y !== y) { + else if (oob.bottom && this.bottom) + { + y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : -bottomRight.y; + } + if (y !== null && this.parent.y !== y) + { this.toY = { time: 0, start: this.parent.y, delta: y - this.parent.y, end: y }; this.parent.emit('bounce-y-start', this.parent); } } } } - }, { - key: 'reset', - value: function reset() { + + reset() + { this.toX = this.toY = null; + this.bounce(); } - }]); - - return Bounce; -}(Plugin); - -},{"./plugin":9,"./utils":12}],2:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(ClampZoom, _Plugin); - - /** - * @private - * @param {object} [options] - * @param {number} [options.minWidth] minimum width - * @param {number} [options.minHeight] minimum height - * @param {number} [options.maxWidth] maximum width - * @param {number} [options.maxHeight] maximum height - */ - function ClampZoom(parent, options) { - _classCallCheck(this, ClampZoom); - - var _this = _possibleConstructorReturn(this, (ClampZoom.__proto__ || Object.getPrototypeOf(ClampZoom)).call(this, parent)); - - _this.minWidth = options.minWidth; - _this.minHeight = options.minHeight; - _this.maxWidth = options.maxWidth; - _this.maxHeight = options.maxHeight; - return _this; } - _createClass(ClampZoom, [{ - key: 'resize', - value: function resize() { - this.clamp(); - } - }, { - key: 'clamp', - value: function clamp() { - if (this.paused) { - return; - } - - var width = this.parent.worldScreenWidth; - var height = this.parent.worldScreenHeight; - if (this.minWidth && width < this.minWidth) { - this.parent.fitWidth(this.minWidth); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.maxWidth && width > this.maxWidth) { - this.parent.fitWidth(this.maxWidth); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.minHeight && height < this.minHeight) { - this.parent.fitHeight(this.minHeight); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.maxHeight && height > this.maxHeight) { - this.parent.fitHeight(this.maxHeight); - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - } - }]); - - return ClampZoom; -}(Plugin); - -},{"./plugin":9}],3:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(clamp, _Plugin); - - /** - * @private - * @param {object} options - * @param {(number|boolean)} [options.left] clamp left; true=0 - * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth - * @param {(number|boolean)} [options.top] clamp top; true=0 - * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight - * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen + /** + * There are three ways to clamp: + * 1. direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of the world offscreen + * direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary + * 2. left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side; + * if any of these are set to true, then the location is set to the boundary [0, viewport.worldWidth/viewport.worldHeight] + * eg: to allow the world to be completely dragged offscreen, set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2] + * + * Underflow determines what happens when the world is smaller than the viewport + * 1. none = the world is clamped but there is no special behavior + * 2. center = the world is centered on the viewport + * 3. combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the appropriate boundaries + * */ - function clamp(parent, options) { - _classCallCheck(this, clamp); - options = options || {}; - var _this = _possibleConstructorReturn(this, (clamp.__proto__ || Object.getPrototypeOf(clamp)).call(this, parent)); - if (typeof options.direction === 'undefined') { - _this.left = utils.defaults(options.left, null); - _this.right = utils.defaults(options.right, null); - _this.top = utils.defaults(options.top, null); - _this.bottom = utils.defaults(options.bottom, null); - } else { - _this.left = options.direction === 'x' || options.direction === 'all'; - _this.right = options.direction === 'x' || options.direction === 'all'; - _this.top = options.direction === 'y' || options.direction === 'all'; - _this.bottom = options.direction === 'y' || options.direction === 'all'; - } - _this.parseUnderflow(options.underflow || 'center'); - _this.move(); - return _this; - } - _createClass(clamp, [{ - key: 'parseUnderflow', - value: function parseUnderflow(clamp) { - clamp = clamp.toLowerCase(); - if (clamp === 'center') { - this.underflowX = 0; - this.underflowY = 0; - } else { - this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0; - this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_CLAMP_OPTIONS = { + left: false, + right: false, + top: false, + bottom: false, + direction: null, + underflow: 'center' + }; + + /** + * Plugin to clamp the viewport to a specific world bounding box. + * + * @public + */ + class Clamp extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Last state of viewport */ + + + + + + + + + + + + /** + * This is called by {@link Viewport.clamp}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_CLAMP_OPTIONS, options); + + if (this.options.direction) + { + this.options.left = this.options.direction === 'x' || this.options.direction === 'all' ? true : null; + this.options.right = this.options.direction === 'x' || this.options.direction === 'all' ? true : null; + this.options.top = this.options.direction === 'y' || this.options.direction === 'all' ? true : null; + this.options.bottom = this.options.direction === 'y' || this.options.direction === 'all' ? true : null; } - } - }, { - key: 'move', - value: function move() { + + this.parseUnderflow(); + this.last = { x: null, y: null, scaleX: null, scaleY: null }; this.update(); } - }, { - key: 'update', - value: function update() { - if (this.paused) { + + parseUnderflow() + { + const clamp = this.options.underflow.toLowerCase(); + + if (clamp === 'none') + { + this.noUnderflow = true; + } + else if (clamp === 'center') + { + this.underflowX = this.underflowY = 0; + this.noUnderflow = false; + } + else + { + this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0; + this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0; + this.noUnderflow = false; + } + } + + move() + { + this.update(); + + return false; + } + + update() + { + if (this.paused) + { return; } - var decelerate = this.parent.plugins['decelerate'] || {}; - if (this.left !== null || this.right !== null) { - var moved = void 0; - if (this.parent.screenWorldWidth < this.parent.screenWidth) { - switch (this.underflowX) { + // only clamp on change + if (this.parent.x === this.last.x + && this.parent.y === this.last.y + && this.parent.scale.x === this.last.scaleX + && this.parent.scale.y === this.last.scaleY) + { + return; + } + const original = { x: this.parent.x, y: this.parent.y }; + // TODO: Fix + const decelerate = (this.parent.plugins ).decelerate || {}; + + if (this.options.left !== null || this.options.right !== null) + { + let moved = false; + + if (!this.noUnderflow && this.parent.screenWorldWidth < this.parent.screenWidth) + { + switch (this.underflowX) + { case -1: - if (this.parent.x !== 0) { + if (this.parent.x !== 0) + { this.parent.x = 0; moved = true; } break; case 1: - if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth) { + if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth) + { this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth; moved = true; } break; default: - if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2) { + if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2) + { this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; moved = true; } } - } else { - if (this.left !== null) { - if (this.parent.left < (this.left === true ? 0 : this.left)) { - this.parent.x = -(this.left === true ? 0 : this.left) * this.parent.scale.x; + } + else + { + if (this.options.left !== null) + { + if (this.parent.left < (this.options.left === true ? 0 : this.options.left)) + { + this.parent.x = -(this.options.left === true ? 0 : this.options.left) * this.parent.scale.x; decelerate.x = 0; moved = true; } } - if (this.right !== null) { - if (this.parent.right > (this.right === true ? this.parent.worldWidth : this.right)) { - this.parent.x = -(this.right === true ? this.parent.worldWidth : this.right) * this.parent.scale.x + this.parent.screenWidth; + if (this.options.right !== null) + { + if (this.parent.right > (this.options.right === true ? this.parent.worldWidth : this.options.right)) + { + this.parent.x = -(this.options.right === true ? this.parent.worldWidth : this.options.right) * this.parent.scale.x + this.parent.screenWidth; decelerate.x = 0; moved = true; } } } - if (moved) { - this.parent.emit('moved', { viewport: this.parent, type: 'clamp-x' }); + if (moved) + { + this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-x' }); } } - if (this.top !== null || this.bottom !== null) { - var _moved = void 0; - if (this.parent.screenWorldHeight < this.parent.screenHeight) { - switch (this.underflowY) { + if (this.options.top !== null || this.options.bottom !== null) + { + let moved = false; + + if (!this.noUnderflow && this.parent.screenWorldHeight < this.parent.screenHeight) + { + switch (this.underflowY) + { case -1: - if (this.parent.y !== 0) { + if (this.parent.y !== 0) + { this.parent.y = 0; - _moved = true; + moved = true; } break; case 1: - if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight) { - this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight; - _moved = true; + if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight) + { + this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight); + moved = true; } break; default: - if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2) { + if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2) + { this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; - _moved = true; + moved = true; } } - } else { - if (this.top !== null) { - if (this.parent.top < (this.top === true ? 0 : this.top)) { - this.parent.y = -(this.top === true ? 0 : this.top) * this.parent.scale.y; + } + else + { + if (this.options.top !== null) + { + if (this.parent.top < (this.options.top === true ? 0 : this.options.top)) + { + this.parent.y = -(this.options.top === true ? 0 : this.options.top) + * this.parent.scale.y; decelerate.y = 0; - _moved = true; + moved = true; } } - if (this.bottom !== null) { - if (this.parent.bottom > (this.bottom === true ? this.parent.worldHeight : this.bottom)) { - this.parent.y = -(this.bottom === true ? this.parent.worldHeight : this.bottom) * this.parent.scale.y + this.parent.screenHeight; + if (this.options.bottom !== null) + { + if (this.parent.bottom > (this.options.bottom === true ? this.parent.worldHeight : this.options.bottom)) + { + this.parent.y = -(this.options.bottom === true ? this.parent.worldHeight : this.options.bottom) + * this.parent.scale.y + this.parent.screenHeight; decelerate.y = 0; - _moved = true; + moved = true; } } } - if (_moved) { - this.parent.emit('moved', { viewport: this.parent, type: 'clamp-y' }); + if (moved) + { + this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-y' }); } } + this.last.x = this.parent.x; + this.last.y = this.parent.y; + this.last.scaleX = this.parent.scale.x; + this.last.scaleY = this.parent.scale.y; } - }]); - return clamp; -}(Plugin); - -},{"./plugin":9,"./utils":12}],4:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Decelerate, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.friction=0.95] percent to decelerate after movement - * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active) - * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration - */ - function Decelerate(parent, options) { - _classCallCheck(this, Decelerate); - - var _this = _possibleConstructorReturn(this, (Decelerate.__proto__ || Object.getPrototypeOf(Decelerate)).call(this, parent)); - - options = options || {}; - _this.friction = options.friction || 0.95; - _this.bounce = options.bounce || 0.5; - _this.minSpeed = typeof options.minSpeed !== 'undefined' ? options.minSpeed : 0.01; - _this.saved = []; - return _this; + reset() + { + this.update(); + } } - _createClass(Decelerate, [{ - key: 'down', - value: function down() { - this.saved = []; - this.x = this.y = false; + /** + * Options for {@link ClampZoom}. + * + * Use either minimum width/height or minimum scale + */ + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_CLAMP_ZOOM_OPTIONS = { + minWidth: null, + minHeight: null, + maxWidth: null, + maxHeight: null, + minScale: null, + maxScale: null + }; + + /** + * Plugin to clamp the viewport's zoom to a specific range. + * + * @public + */ + class ClampZoom extends Plugin + { + + + /** + * This is called by {@link Viewport.clampZoom}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_CLAMP_ZOOM_OPTIONS, options); + + this.clamp(); } - }, { - key: 'move', - value: function move() { - if (this.paused) { + + resize() + { + this.clamp(); + } + + /** Clamp the viewport scale zoom) */ + clamp() + { + if (this.paused) + { return; } - var count = this.parent.countDownPointers(); - if (count === 1 || count > 1 && !this.parent.plugins['pinch']) { + if (this.options.minWidth || this.options.minHeight || this.options.maxWidth || this.options.maxHeight) + { + let width = this.parent.worldScreenWidth; + let height = this.parent.worldScreenHeight; + + if (this.options.minWidth !== null && width < this.options.minWidth) + { + const original = this.parent.scale.x; + + this.parent.fitWidth(this.options.minWidth, false, false, true); + this.parent.scale.y *= this.parent.scale.x / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.maxWidth !== null && width > this.options.maxWidth) + { + const original = this.parent.scale.x; + + this.parent.fitWidth(this.options.maxWidth, false, false, true); + this.parent.scale.y *= this.parent.scale.x / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.minHeight !== null && height < this.options.minHeight) + { + const original = this.parent.scale.y; + + this.parent.fitHeight(this.options.minHeight, false, false, true); + this.parent.scale.x *= this.parent.scale.y / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.maxHeight !== null && height > this.options.maxHeight) + { + const original = this.parent.scale.y; + + this.parent.fitHeight(this.options.maxHeight, false, false, true); + this.parent.scale.x *= this.parent.scale.y / original; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + } + else + if (this.options.minScale || this.options.maxScale) + { + const minScale = { x: null, y: null }; + const maxScale = { x: null, y: null }; + + if (typeof this.options.minScale === 'number') + { + minScale.x = this.options.minScale; + minScale.y = this.options.minScale; + } + else if (this.options.minScale !== null) + { + const optsMinScale = this.options.minScale ; + + minScale.x = typeof optsMinScale.x === 'undefined' ? null : optsMinScale.x; + minScale.y = typeof optsMinScale.y === 'undefined' ? null : optsMinScale.y; + } + + if (typeof this.options.maxScale === 'number') + { + maxScale.x = this.options.maxScale; + maxScale.y = this.options.maxScale; + } + else if (this.options.maxScale !== null) + { + const optsMaxScale = this.options.maxScale ; + + maxScale.x = typeof optsMaxScale.x === 'undefined' ? null : optsMaxScale.x; + maxScale.y = typeof optsMaxScale.y === 'undefined' ? null : optsMaxScale.y; + } + + let scaleX = this.parent.scale.x; + let scaleY = this.parent.scale.y; + + if (minScale.x !== null && scaleX < minScale.x) + { + scaleX = minScale.x; + } + if (maxScale.x !== null && scaleX > maxScale.x) + { + scaleX = maxScale.x; + } + if (minScale.y !== null && scaleY < minScale.y) + { + scaleY = minScale.y; + } + if (maxScale.y !== null && scaleY > maxScale.y) + { + scaleY = maxScale.y; + } + if (scaleX !== this.parent.scale.x || scaleY !== this.parent.scale.y) + { + this.parent.scale.set(scaleX, scaleY); + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + } + } + + reset() + { + this.clamp(); + } + } + + /** This allows independent x and y values for min/maxScale */ + + const DEFAULT_DECELERATE_OPTIONS = { + friction: 0.98, + bounce: 0.8, + minSpeed: 0.01 + }; + + /** + * Time period of decay (1 frame) + * + * @internal + * @ignore + */ + const TP = 16; + + /** + * Plugin to decelerate viewport velocity smoothly after panning ends. + * + * @public + */ + class Decelerate extends Plugin + { + /** Options used to initialize this plugin. */ + + + /** + * x-component of the velocity of viewport provided by this plugin, at the current time. + * + * This is measured in px/frame, where a frame is normalized to 16 milliseconds. + */ + + + /** + * y-component of the velocity of the viewport provided by this plugin, at the current time. + * + * This is measured in px/frame, where a frame is normalized to 16 milliseconds. + */ + + + /** + * The decay factor for the x-component of the viewport. + * + * The viewport's velocity decreased by this amount each 16 milliseconds. + */ + + + /** + * The decay factor for the y-component of the viewport. + * + * The viewport's velocity decreased by this amount each 16 milliseconds. + */ + + + /** Saved list of recent viewport position snapshots, to estimate velocity. */ + + + /** The time since the user released panning of the viewport. */ + + + /** + * This is called by {@link Viewport.decelerate}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, DEFAULT_DECELERATE_OPTIONS, options); + this.saved = []; + this.timeSinceRelease = 0; + + this.reset(); + this.parent.on('moved', (data) => this.moved(data)); + } + + down() + { + this.saved = []; + this.x = this.y = null; + + return false; + } + + isActive() + { + return !!(this.x || this.y); + } + + move() + { + if (this.paused) + { + return false; + } + + const count = this.parent.input.count(); + + if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch', true))) + { this.saved.push({ x: this.parent.x, y: this.parent.y, time: performance.now() }); - if (this.saved.length > 60) { + + if (this.saved.length > 60) + { this.saved.splice(0, 30); } } + + // Silently recording viewport positions + return false; } - }, { - key: 'up', - value: function up() { - if (this.parent.countDownPointers() === 0 && this.saved.length) { - var now = performance.now(); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = this.saved[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var save = _step.value; + /** Listener to viewport's "moved" event. */ + moved(data) + { + if (this.saved.length) + { + const last = this.saved[this.saved.length - 1]; - if (save.time >= now - 100) { - var time = now - save.time; - this.x = (this.parent.x - save.x) / time; - this.y = (this.parent.y - save.y) / time; - this.percentChangeX = this.percentChangeY = this.friction; - break; - } + if (data.type === 'clamp-x') + { + if (last.x === data.original.x) + { + last.x = this.parent.x; } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } + } + else if (data.type === 'clamp-y') + { + if (last.y === data.original.y) + { + last.y = this.parent.y; } } } } - /** - * manually activate plugin - * @param {object} options - * @param {number} [options.x] - * @param {number} [options.y] - */ + up() + { + if (this.parent.input.count() === 0 && this.saved.length) + { + const now = performance.now(); - }, { - key: 'activate', - value: function activate(options) { - options = options || {}; - if (typeof options.x !== 'undefined') { - this.x = options.x; - this.percentChangeX = this.friction; + for (const save of this.saved) + { + if (save.time >= now - 100) + { + const time = now - save.time; + + this.x = (this.parent.x - save.x) / time; + this.y = (this.parent.y - save.y) / time; + this.percentChangeX = this.percentChangeY = this.options.friction; + this.timeSinceRelease = 0; + break; + } + } } - if (typeof options.y !== 'undefined') { + + return false; + } + + /** + * Manually activate deceleration, starting from the (x, y) velocity components passed in the options. + * + * @param {object} options + * @param {number} [options.x] - Specify x-component of initial velocity. + * @param {number} [options.y] - Specify y-component of initial velocity. + */ + activate(options) + { + options = options || {}; + + if (typeof options.x !== 'undefined') + { + this.x = options.x; + this.percentChangeX = this.options.friction; + } + if (typeof options.y !== 'undefined') + { this.y = options.y; - this.percentChangeY = this.friction; + this.percentChangeY = this.options.friction; } } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { + + update(elapsed) + { + if (this.paused) + { return; } - var moved = void 0; - if (this.x) { - this.parent.x += this.x * elapsed; - this.x *= this.percentChangeX; - if (Math.abs(this.x) < this.minSpeed) { + /* + * See https://github.com/davidfig/pixi-viewport/issues/271 for math. + * + * The viewport velocity (this.x, this.y) decays exponentially by the the decay factor + * (this.percentChangeX, this.percentChangeY) each frame. This velocity function is integrated + * to calculate the displacement. + */ + + const moved = this.x || this.y; + + const ti = this.timeSinceRelease; + const tf = this.timeSinceRelease + elapsed; + + if (this.x) + { + const k = this.percentChangeX; + const lnk = Math.log(k); + + // Apply velocity delta on the viewport x-coordinate. + this.parent.x += ((this.x * TP) / lnk) * (Math.pow(k, tf / TP) - Math.pow(k, ti / TP)); + + // Apply decay on x-component of velocity + this.x *= Math.pow(this.percentChangeX, elapsed / TP); + } + if (this.y) + { + const k = this.percentChangeY; + const lnk = Math.log(k); + + // Apply velocity delta on the viewport y-coordinate. + this.parent.y += ((this.y * TP) / lnk) * (Math.pow(k, tf / TP) - Math.pow(k, ti / TP)); + + // Apply decay on y-component of velocity + this.y *= Math.pow(this.percentChangeY, elapsed / TP); + } + + this.timeSinceRelease += elapsed; + + // End decelerate velocity once it goes under a certain amount of precision. + if (this.x && this.y) { + if (Math.abs(this.x) < this.options.minSpeed && Math.abs(this.y) < this.options.minSpeed) { + this.x = 0; + this.y = 0; + } + } else { + if (Math.abs(this.x || 0) < this.options.minSpeed) { this.x = 0; } - moved = true; - } - if (this.y) { - this.parent.y += this.y * elapsed; - this.y *= this.percentChangeY; - if (Math.abs(this.y) < this.minSpeed) { + if (Math.abs(this.y || 0) < this.options.minSpeed) { this.y = 0; } - moved = true; } - if (moved) { - this.parent.dirty = true; + + if (moved) + { this.parent.emit('moved', { viewport: this.parent, type: 'decelerate' }); } } - }, { - key: 'reset', - value: function reset() { + + reset() + { this.x = this.y = null; } - }]); - - return Decelerate; -}(Plugin); - -},{"./plugin":9,"./utils":12}],5:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Drag, _Plugin); - - /** - * enable one-finger touch to drag - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {string} [options.direction=all] direction to drag (all, x, or y) - * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active) - * @param {number} [options.wheelScroll=1] number of pixels to scroll with each wheel spin - * @param {boolean} [options.reverse] reverse the direction of the wheel scroll - * @param {boolean|string} [options.clampWheel] (true, x, or y) clamp wheel (to avoid weird bounce with mouse wheel) - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - */ - function Drag(parent, options) { - _classCallCheck(this, Drag); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Drag.__proto__ || Object.getPrototypeOf(Drag)).call(this, parent)); - - _this.moved = false; - _this.wheelActive = utils.defaults(options.wheel, true); - _this.wheelScroll = options.wheelScroll || 1; - _this.reverse = options.reverse ? 1 : -1; - _this.clampWheel = options.clampWheel; - _this.xDirection = !options.direction || options.direction === 'all' || options.direction === 'x'; - _this.yDirection = !options.direction || options.direction === 'all' || options.direction === 'y'; - _this.parseUnderflow(options.underflow || 'center'); - return _this; } - _createClass(Drag, [{ - key: 'parseUnderflow', - value: function parseUnderflow(clamp) { - clamp = clamp.toLowerCase(); - if (clamp === 'center') { + /** Options for {@link Drag}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_DRAG_OPTIONS = { + direction: 'all', + pressDrag: true, + wheel: true, + wheelScroll: 1, + reverse: false, + clampWheel: false, + underflow: 'center', + factor: 1, + mouseButtons: 'all', + keyToPress: null, + ignoreKeyToPressOnTouch: false, + lineHeight: 20, + }; + + /** + * Plugin to enable panning/dragging of the viewport to move around. + * + * @public + */ + class Drag extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Flags when viewport is moving. */ + + + /** Factor to apply from {@link IDecelerateOptions}'s reverse. */ + + + /** Holds whether dragging is enabled along the x-axis. */ + + + /** Holds whether dragging is enabled along the y-axis. */ + + + /** Flags whether the keys required to drag are pressed currently. */ + + + /** Holds whether the left, center, and right buttons are required to pan. */ + + + /** Underflow factor along x-axis */ + + + /** Underflow factor along y-axis */ + + + /** Last pointer position while panning. */ + + + /** The ID of the pointer currently panning the viewport. */ + + + /** + * This is called by {@link Viewport.drag}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, DEFAULT_DRAG_OPTIONS, options); + this.moved = false; + this.reverse = this.options.reverse ? 1 : -1; + this.xDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'x'; + this.yDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'y'; + this.keyIsPressed = false; + + this.parseUnderflow(); + this.mouseButtons(this.options.mouseButtons); + + if (this.options.keyToPress) + { + this.handleKeyPresses(this.options.keyToPress); + } + } + + /** + * Handles keypress events and set the keyIsPressed boolean accordingly + * + * @param {array} codes - key codes that can be used to trigger drag event + */ + handleKeyPresses(codes) + { + window.addEventListener('keydown', (e) => + { + if (codes.includes(e.code)) + { this.keyIsPressed = true; } + }); + + window.addEventListener('keyup', (e) => + { + if (codes.includes(e.code)) + { this.keyIsPressed = false; } + }); + } + + /** + * initialize mousebuttons array + * @param {string} buttons + */ + mouseButtons(buttons) + { + if (!buttons || buttons === 'all') + { + this.mouse = [true, true, true]; + } + else + { + this.mouse = [ + buttons.indexOf('left') !== -1, + buttons.indexOf('middle') !== -1, + buttons.indexOf('right') !== -1 + ]; + } + } + + parseUnderflow() + { + const clamp = this.options.underflow.toLowerCase(); + + if (clamp === 'center') + { this.underflowX = 0; this.underflowY = 0; - } else { - this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0; - this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0; } - } - }, { - key: 'down', - value: function down(e) { - if (this.paused) { - return; - } - var count = this.parent.countDownPointers(); - if ((count === 1 || count > 1 && !this.parent.plugins['pinch']) && this.parent.parent) { - var parent = this.parent.parent.toLocal(e.data.global); - this.last = { x: e.data.global.x, y: e.data.global.y, parent: parent }; - this.current = e.data.pointerId; - } else { - this.last = null; - } - } - }, { - key: 'move', - value: function move(e) { - if (this.paused) { - return; - } - if (this.last && this.current === e.data.pointerId) { - var x = e.data.global.x; - var y = e.data.global.y; - var count = this.parent.countDownPointers(); - if (count === 1 || count > 1 && !this.parent.plugins['pinch']) { - var distX = x - this.last.x; - var distY = y - this.last.y; - if (this.moved || this.xDirection && this.parent.checkThreshold(distX) || this.yDirection && this.parent.checkThreshold(distY)) { - var newParent = this.parent.parent.toLocal(e.data.global); - if (this.xDirection) { - this.parent.x += newParent.x - this.last.parent.x; - } - if (this.yDirection) { - this.parent.y += newParent.y - this.last.parent.y; - } - this.last = { x: x, y: y, parent: newParent }; - if (!this.moved) { - this.parent.emit('drag-start', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent }); - } - this.moved = true; - this.parent.dirty = true; - this.parent.emit('moved', { viewport: this.parent, type: 'drag' }); - } - } else { - this.moved = false; + else + { + if (clamp.includes('left')) + { + this.underflowX = -1; + } + else if (clamp.includes('right')) + { + this.underflowX = 1; + } + else + { + this.underflowX = 0; + } + if (clamp.includes('top')) + { + this.underflowY = -1; + } + else if (clamp.includes('bottom')) + { + this.underflowY = 1; + } + else + { + this.underflowY = 0; } } } - }, { - key: 'up', - value: function up() { - var touches = this.parent.getTouchPointers(); - if (touches.length === 1) { - var pointer = touches[0]; - if (pointer.last) { - var parent = this.parent.parent.toLocal(pointer.last); - this.last = { x: pointer.last.x, y: pointer.last.y, parent: parent }; - this.current = pointer.last.data.pointerId; - } - this.moved = false; - } else if (this.last) { - if (this.moved) { - this.parent.emit('drag-end', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent }); - this.last = this.moved = false; - } - } - } - }, { - key: 'wheel', - value: function wheel(e) { - if (this.paused) { - return; - } - if (this.wheelActive) { - var wheel = this.parent.plugins['wheel']; - if (!wheel) { - this.parent.x += e.deltaX * this.wheelScroll * this.reverse; - this.parent.y += e.deltaY * this.wheelScroll * this.reverse; - if (this.clampWheel) { - this.clamp(); - } - this.parent.emit('wheel-scroll', this.parent); - this.parent.emit('moved', this.parent); - this.parent.dirty = true; - e.preventDefault(); + /** + * @param {PIXI.InteractionEvent} event + * @returns {boolean} + */ + checkButtons(event) + { + const isMouse = event.data.pointerType === 'mouse'; + const count = this.parent.input.count(); + + if ((count === 1) || (count > 1 && !this.parent.plugins.get('pinch', true))) + { + if (!isMouse || this.mouse[event.data.button]) + { return true; } } + + return false; } - }, { - key: 'resume', - value: function resume() { + + /** + * @param {PIXI.InteractionEvent} event + * @returns {boolean} + */ + checkKeyPress(event) + { + return (!this.options.keyToPress + || this.keyIsPressed + || (this.options.ignoreKeyToPressOnTouch && event.data.pointerType === 'touch')); + } + + down(event) + { + if (this.paused || !this.options.pressDrag) + { + return false; + } + if (this.checkButtons(event) && this.checkKeyPress(event)) + { + this.last = { x: event.data.global.x, y: event.data.global.y }; + this.current = event.data.pointerId; + + return true; + } + this.last = null; + + return false; + } + + get active() + { + return this.moved; + } + + move(event) + { + if (this.paused || !this.options.pressDrag) + { + return false; + } + if (this.last && this.current === event.data.pointerId) + { + const x = event.data.global.x; + const y = event.data.global.y; + const count = this.parent.input.count(); + + if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch', true))) + { + const distX = x - this.last.x; + const distY = y - this.last.y; + + if (this.moved + || ((this.xDirection && this.parent.input.checkThreshold(distX)) + || (this.yDirection && this.parent.input.checkThreshold(distY)))) + { + const newPoint = { x, y }; + + if (this.xDirection) + { + this.parent.x += (newPoint.x - this.last.x) * this.options.factor; + } + if (this.yDirection) + { + this.parent.y += (newPoint.y - this.last.y) * this.options.factor; + } + this.last = newPoint; + if (!this.moved) + { + this.parent.emit('drag-start', { + event, + screen: new math.Point(this.last.x, this.last.y), + world: this.parent.toWorld(new math.Point(this.last.x, this.last.y)), + viewport: this.parent + }); + } + this.moved = true; + this.parent.emit('moved', { viewport: this.parent, type: 'drag' }); + + return true; + } + } + else + { + this.moved = false; + } + } + + return false; + } + + up(event) + { + if (this.paused) + { + return false; + } + + const touches = this.parent.input.touches; + + if (touches.length === 1) + { + const pointer = touches[0]; + + if (pointer.last) + { + this.last = { x: pointer.last.x, y: pointer.last.y }; + this.current = pointer.id; + } + this.moved = false; + + return true; + } + else if (this.last) + { + if (this.moved) + { + const screen = new math.Point(this.last.x, this.last.y); + + this.parent.emit('drag-end', { + event, screen, + world: this.parent.toWorld(screen), + viewport: this.parent, + }); + this.last = null; + this.moved = false; + + return true; + } + } + + return false; + } + + wheel(event) + { + if (this.paused) + { + return false; + } + + if (this.options.wheel) + { + const wheel = this.parent.plugins.get('wheel', true); + + if (!wheel || (!wheel.options.wheelZoom && !event.ctrlKey)) + { + const step = event.deltaMode ? this.options.lineHeight : 1; + + if (this.xDirection) + { + this.parent.x += event.deltaX * step * this.options.wheelScroll * this.reverse; + } + if (this.yDirection) + { + this.parent.y += event.deltaY * step * this.options.wheelScroll * this.reverse; + } + if (this.options.clampWheel) + { + this.clamp(); + } + this.parent.emit('wheel-scroll', this.parent); + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + if (!this.parent.options.passiveWheel) + { + event.preventDefault(); + } + if (this.parent.options.stopPropagation) + { + event.stopPropagation(); + } + + return true; + } + } + + return false; + } + + resume() + { this.last = null; this.paused = false; } - }, { - key: 'clamp', - value: function clamp() { - var decelerate = this.parent.plugins['decelerate'] || {}; - if (this.clampWheel !== 'y') { - if (this.parent.screenWorldWidth < this.parent.screenWidth) { - switch (this.underflowX) { + + clamp() + { + const decelerate = this.parent.plugins.get('decelerate', true) || {}; + + if (this.options.clampWheel !== 'y') + { + if (this.parent.screenWorldWidth < this.parent.screenWidth) + { + switch (this.underflowX) + { case -1: this.parent.x = 0; break; case 1: - this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth; + this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth); break; default: this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; } - } else { - if (this.parent.left < 0) { - this.parent.x = 0; - decelerate.x = 0; - } else if (this.parent.right > this.parent.worldWidth) { - this.parent.x = -this.parent.worldWidth * this.parent.scale.x + this.parent.screenWidth; - decelerate.x = 0; - } + } + else + if (this.parent.left < 0) + { + this.parent.x = 0; + decelerate.x = 0; + } + else if (this.parent.right > this.parent.worldWidth) + { + this.parent.x = (-this.parent.worldWidth * this.parent.scale.x) + this.parent.screenWidth; + decelerate.x = 0; } } - if (this.clampWheel !== 'x') { - if (this.parent.screenWorldHeight < this.parent.screenHeight) { - switch (this.underflowY) { + if (this.options.clampWheel !== 'x') + { + if (this.parent.screenWorldHeight < this.parent.screenHeight) + { + switch (this.underflowY) + { case -1: this.parent.y = 0; break; case 1: - this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight; + this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight); break; default: this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; } - } else { - if (this.parent.top < 0) { + } + else + { + if (this.parent.top < 0) + { this.parent.y = 0; decelerate.y = 0; } - if (this.parent.bottom > this.parent.worldHeight) { - this.parent.y = -this.parent.worldHeight * this.parent.scale.y + this.parent.screenHeight; + if (this.parent.bottom > this.parent.worldHeight) + { + this.parent.y = (-this.parent.worldHeight * this.parent.scale.y) + this.parent.screenHeight; decelerate.y = 0; } } } } - }, { - key: 'active', - get: function get() { - return this.moved; - } - }]); - - return Drag; -}(Plugin); - -},{"./plugin":9,"./utils":12}],6:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Follow, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate}) - * @param {object} [options] - * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location) - * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport - */ - function Follow(parent, target, options) { - _classCallCheck(this, Follow); - - var _this = _possibleConstructorReturn(this, (Follow.__proto__ || Object.getPrototypeOf(Follow)).call(this, parent)); - - options = options || {}; - _this.speed = options.speed || 0; - _this.target = target; - _this.radius = options.radius; - return _this; } - _createClass(Follow, [{ - key: 'update', - value: function update() { - if (this.paused) { + /** Options for {@link Follow}. */ + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_FOLLOW_OPTIONS = { + speed: 0, + acceleration: null, + radius: null + }; + + /** + * Plugin to follow a display-object. + * + * @see Viewport.follow + * @public + */ + class Follow extends Plugin + { + /** The options used to initialize this plugin. */ + + + /** The target this plugin will make the viewport follow. */ + + + /** The velocity provided the viewport by following, at the current time. */ + + + /** + * This is called by {@link Viewport.follow}. + * + * @param parent + * @param target - target to follow + * @param options + */ + constructor(parent, target, options = {}) + { + super(parent); + + this.target = target; + this.options = Object.assign({}, DEFAULT_FOLLOW_OPTIONS, options); + this.velocity = { x: 0, y: 0 }; + } + + update(elapsed) + { + if (this.paused) + { return; } - var center = this.parent.center; - var toX = this.target.x, - toY = this.target.y; - if (this.radius) { - var distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2)); - if (distance > this.radius) { - var angle = Math.atan2(this.target.y - center.y, this.target.x - center.x); - toX = this.target.x - Math.cos(angle) * this.radius; - toY = this.target.y - Math.sin(angle) * this.radius; - } else { + const center = this.parent.center; + let toX = this.target.x; + let toY = this.target.y; + + if (this.options.radius) + { + const distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2)); + + if (distance > this.options.radius) + { + const angle = Math.atan2(this.target.y - center.y, this.target.x - center.x); + + toX = this.target.x - (Math.cos(angle) * this.options.radius); + toY = this.target.y - (Math.sin(angle) * this.options.radius); + } + else + { return; } } - if (this.speed) { - var deltaX = toX - center.x; - var deltaY = toY - center.y; - if (deltaX || deltaY) { - var _angle = Math.atan2(toY - center.y, toX - center.x); - var changeX = Math.cos(_angle) * this.speed; - var changeY = Math.sin(_angle) * this.speed; - var x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; - var y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; - this.parent.moveCenter(x, y); + + const deltaX = toX - center.x; + const deltaY = toY - center.y; + + if (deltaX || deltaY) + { + if (this.options.speed) + { + if (this.options.acceleration) + { + const angle = Math.atan2(toY - center.y, toX - center.x); + const distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); + + if (distance) + { + const decelerationDistance = (Math.pow(this.velocity.x, 2) + Math.pow(this.velocity.y, 2)) / (2 * this.options.acceleration); + + if (distance > decelerationDistance) + { + this.velocity = { + x: Math.min(this.velocity.x + this.options.acceleration * elapsed, this.options.speed), + y: Math.min(this.velocity.y + this.options.acceleration * elapsed, this.options.speed) + }; + } + else + { + this.velocity = { + x: Math.max(this.velocity.x - this.options.acceleration * this.options.speed, 0), + y: Math.max(this.velocity.y - this.options.acceleration * this.options.speed, 0) + }; + } + const changeX = Math.cos(angle) * this.velocity.x; + const changeY = Math.sin(angle) * this.velocity.y; + const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; + const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; + + this.parent.moveCenter(x, y); + this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); + } + } + else + { + const angle = Math.atan2(toY - center.y, toX - center.x); + const changeX = Math.cos(angle) * this.options.speed; + const changeY = Math.sin(angle) * this.options.speed; + const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; + const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; + + this.parent.moveCenter(x, y); + this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); + } + } + else + { + this.parent.moveCenter(toX, toY); this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); } - } else { - this.parent.moveCenter(toX, toY); - this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); } } - }]); - - return Follow; -}(Plugin); - -},{"./plugin":9}],7:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(MouseEdges, _Plugin); - - /** - * Scroll viewport when mouse hovers near one of the edges. - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.radius] distance from center of screen in screen pixels - * @param {number} [options.distance] distance from all sides in screen pixels - * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll) - * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll) - * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll) - * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll) - * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport - * @param {boolean} [options.reverse] reverse direction of scroll - * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed - * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center)) - * - * @event mouse-edge-start(Viewport) emitted when mouse-edge starts - * @event mouse-edge-end(Viewport) emitted when mouse-edge ends - */ - function MouseEdges(parent, options) { - _classCallCheck(this, MouseEdges); - - var _this = _possibleConstructorReturn(this, (MouseEdges.__proto__ || Object.getPrototypeOf(MouseEdges)).call(this, parent)); - - options = options || {}; - _this.options = options; - _this.reverse = options.reverse ? 1 : -1; - _this.noDecelerate = options.noDecelerate; - _this.linear = options.linear; - _this.radiusSquared = Math.pow(options.radius, 2); - _this.resize(); - _this.speed = options.speed || 8; - return _this; } - _createClass(MouseEdges, [{ - key: 'resize', - value: function resize() { - var options = this.options; - var distance = options.distance; - if (utils.exists(distance)) { + /** Insets for mouse edges scrolling regions */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const MOUSE_EDGES_OPTIONS = { + radius: null, + distance: null, + top: null, + bottom: null, + left: null, + right: null, + speed: 8, + reverse: false, + noDecelerate: false, + linear: false, + allowButtons: false, + }; + + /** + * Scroll viewport when mouse hovers near one of the edges. + * + * @event mouse-edge-start(Viewport) emitted when mouse-edge starts + * @event mouse-edge-end(Viewport) emitted when mouse-edge ends + */ + class MouseEdges extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Factor from reverse option. */ + + + /** Radius squared */ + + + /** Scroll region size on the left side. */ + + + /** Scroll region size on the top size. */ + + + /** Scroll region size on the right side. */ + + + /** Scroll region size on the bottom side. */ + + + + + + + /** + * This is called by {@link Viewport.mouseEdges}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, MOUSE_EDGES_OPTIONS, options); + this.reverse = this.options.reverse ? 1 : -1; + this.radiusSquared = typeof this.options.radius === 'number' ? Math.pow(this.options.radius, 2) : null; + + this.resize(); + } + + resize() + { + const distance = this.options.distance; + + if (distance !== null) + { this.left = distance; this.top = distance; - this.right = window.innerWidth - distance; - this.bottom = window.innerHeight - distance; - } else if (!this.radius) { - this.left = utils.exists(options.left) ? options.left : null; - this.top = utils.exists(options.top) ? options.top : null; - this.right = utils.exists(options.right) ? window.innerWidth - options.right : null; - this.bottom = utils.exists(options.bottom) ? window.innerHeight - options.bottom : null; + this.right = this.parent.screenWidth - distance; + this.bottom = this.parent.screenHeight - distance; + } + else if (!this.options.radius) + { + this.left = this.options.left; + this.top = this.options.top; + this.right = this.options.right === null ? null : this.parent.screenWidth - this.options.right; + this.bottom = this.options.bottom === null ? null : this.parent.screenHeight - this.options.bottom; } } - }, { - key: 'down', - value: function down() { - this.horizontal = this.vertical = null; - } - }, { - key: 'move', - value: function move(e) { - if (e.data.identifier !== 'MOUSE' || e.data.buttons !== 0) { - return; - } - var x = e.data.global.x; - var y = e.data.global.y; - if (this.radiusSquared) { - var center = this.parent.toScreen(this.parent.center); - var distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2); - if (distance >= this.radiusSquared) { - var angle = Math.atan2(center.y - y, center.x - x); - if (this.linear) { - this.horizontal = Math.round(Math.cos(angle)) * this.speed * this.reverse * (60 / 1000); - this.vertical = Math.round(Math.sin(angle)) * this.speed * this.reverse * (60 / 1000); - } else { - this.horizontal = Math.cos(angle) * this.speed * this.reverse * (60 / 1000); - this.vertical = Math.sin(angle) * this.speed * this.reverse * (60 / 1000); + down() + { + if (this.paused) + { + return false; + } + if (!this.options.allowButtons) + { + this.horizontal = this.vertical = null; + } + + return false; + } + + move(event) + { + if (this.paused) + { + return false; + } + if ((event.data.pointerType !== 'mouse' && event.data.identifier !== 1) + || (!this.options.allowButtons && event.data.buttons !== 0)) + { + return false; + } + + const x = event.data.global.x; + const y = event.data.global.y; + + if (this.radiusSquared) + { + const center = this.parent.toScreen(this.parent.center); + const distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2); + + if (distance >= this.radiusSquared) + { + const angle = Math.atan2(center.y - y, center.x - x); + + if (this.options.linear) + { + this.horizontal = Math.round(Math.cos(angle)) * this.options.speed * this.reverse * (60 / 1000); + this.vertical = Math.round(Math.sin(angle)) * this.options.speed * this.reverse * (60 / 1000); } - } else { - if (this.horizontal) { + else + { + this.horizontal = Math.cos(angle) * this.options.speed * this.reverse * (60 / 1000); + this.vertical = Math.sin(angle) * this.options.speed * this.reverse * (60 / 1000); + } + } + else + { + if (this.horizontal) + { this.decelerateHorizontal(); } - if (this.vertical) { + if (this.vertical) + { this.decelerateVertical(); } + this.horizontal = this.vertical = 0; } - } else { - if (utils.exists(this.left) && x < this.left) { - this.horizontal = 1 * this.reverse * this.speed * (60 / 1000); - } else if (utils.exists(this.right) && x > this.right) { - this.horizontal = -1 * this.reverse * this.speed * (60 / 1000); - } else { + } + else + { + if (this.left !== null && x < this.left) + { + this.horizontal = Number(this.reverse) * this.options.speed * (60 / 1000); + } + else if (this.right !== null && x > this.right) + { + this.horizontal = -1 * this.reverse * this.options.speed * (60 / 1000); + } + else + { this.decelerateHorizontal(); this.horizontal = 0; } - if (utils.exists(this.top) && y < this.top) { - this.vertical = 1 * this.reverse * this.speed * (60 / 1000); - } else if (utils.exists(this.bottom) && y > this.bottom) { - this.vertical = -1 * this.reverse * this.speed * (60 / 1000); - } else { + if (this.top !== null && y < this.top) + { + this.vertical = Number(this.reverse) * this.options.speed * (60 / 1000); + } + else if (this.bottom !== null && y > this.bottom) + { + this.vertical = -1 * this.reverse * this.options.speed * (60 / 1000); + } + else + { this.decelerateVertical(); this.vertical = 0; } } + + return false; } - }, { - key: 'decelerateHorizontal', - value: function decelerateHorizontal() { - var decelerate = this.parent.plugins['decelerate']; - if (this.horizontal && decelerate && !this.noDecelerate) { - decelerate.activate({ x: this.horizontal * this.speed * this.reverse / (1000 / 60) }); + + decelerateHorizontal() + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (this.horizontal && decelerate && !this.options.noDecelerate) + { + decelerate.activate({ x: (this.horizontal * this.options.speed * this.reverse) / (1000 / 60) }); } } - }, { - key: 'decelerateVertical', - value: function decelerateVertical() { - var decelerate = this.parent.plugins['decelerate']; - if (this.vertical && decelerate && !this.noDecelerate) { - decelerate.activate({ y: this.vertical * this.speed * this.reverse / (1000 / 60) }); + + decelerateVertical() + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (this.vertical && decelerate && !this.options.noDecelerate) + { + decelerate.activate({ y: (this.vertical * this.options.speed * this.reverse) / (1000 / 60) }); } } - }, { - key: 'up', - value: function up() { - if (this.horizontal) { + + up() + { + if (this.paused) + { + return false; + } + if (this.horizontal) + { this.decelerateHorizontal(); } - if (this.vertical) { + if (this.vertical) + { this.decelerateVertical(); } this.horizontal = this.vertical = null; + + return false; } - }, { - key: 'update', - value: function update() { - if (this.paused) { + + update() + { + if (this.paused) + { return; } - if (this.horizontal || this.vertical) { - var center = this.parent.center; - if (this.horizontal) { - center.x += this.horizontal * this.speed; + if (this.horizontal || this.vertical) + { + const center = this.parent.center; + + if (this.horizontal) + { + center.x += this.horizontal * this.options.speed; } - if (this.vertical) { - center.y += this.vertical * this.speed; + if (this.vertical) + { + center.y += this.vertical * this.options.speed; } + this.parent.moveCenter(center); this.parent.emit('moved', { viewport: this.parent, type: 'mouse-edges' }); } } - }]); - - return MouseEdges; -}(Plugin); - -},{"./plugin":9,"./utils":12}],8:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Pinch, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {boolean} [options.noDrag] disable two-finger dragging - * @param {number} [options.percent=1.0] percent to modify pinch speed - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers - */ - function Pinch(parent, options) { - _classCallCheck(this, Pinch); - - var _this = _possibleConstructorReturn(this, (Pinch.__proto__ || Object.getPrototypeOf(Pinch)).call(this, parent)); - - options = options || {}; - _this.percent = options.percent || 1.0; - _this.noDrag = options.noDrag; - _this.center = options.center; - return _this; } - _createClass(Pinch, [{ - key: 'down', - value: function down() { - if (this.parent.countDownPointers() >= 2) { - this.active = true; - } + /** Options for {@link Pinch}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_PINCH_OPTIONS = { + noDrag: false, + percent: 1, + center: null, + factor: 1, + axis: 'all', + }; + + /** + * Plugin for enabling two-finger pinching (or dragging). + * + * @public + */ + class Pinch extends Plugin + { + /** Options used to initialize this plugin. */ + + + /** Flags whether this plugin is active, i.e. a pointer is down on the viewport. */ + __init() {this.active = false;} + + /** Flags whether the viewport is being pinched. */ + __init2() {this.pinching = false;} + + __init3() {this.moved = false;} + + + /** + * This is called by {@link Viewport.pinch}. + */ + constructor(parent, options = {}) + { + super(parent);Pinch.prototype.__init.call(this);Pinch.prototype.__init2.call(this);Pinch.prototype.__init3.call(this);; + this.options = Object.assign({}, DEFAULT_PINCH_OPTIONS, options); } - }, { - key: 'move', - value: function move(e) { - if (this.paused || !this.active) { - return; + + down() + { + if (this.parent.input.count() >= 2) + { + this.active = true; + + return true; } - var x = e.data.global.x; - var y = e.data.global.y; + return false; + } - var pointers = this.parent.getTouchPointers(); - if (pointers.length >= 2) { - var first = pointers[0]; - var second = pointers[1]; - var last = first.last && second.last ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) : null; - if (first.pointerId === e.data.pointerId) { - first.last = { x: x, y: y, data: e.data }; - } else if (second.pointerId === e.data.pointerId) { - second.last = { x: x, y: y, data: e.data }; + isAxisX() + { + return ['all', 'x'].includes(this.options.axis); + } + + isAxisY() + { + return ['all', 'y'].includes(this.options.axis); + } + + move(e) + { + if (this.paused || !this.active) + { + return false; + } + + const x = e.data.global.x; + const y = e.data.global.y; + + const pointers = this.parent.input.touches; + + if (pointers.length >= 2) + { + const first = pointers[0] ; + const second = pointers[1] ; + const last = (first.last && second.last) + ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) + : null; + + if (first.id === e.data.pointerId) + { + first.last = { x, y, data: e.data } ; } - if (last) { - var oldPoint = void 0; - var point = { x: first.last.x + (second.last.x - first.last.x) / 2, y: first.last.y + (second.last.y - first.last.y) / 2 }; - if (!this.center) { + else if (second.id === e.data.pointerId) + { + second.last = { x, y, data: e.data } ; + } + if (last) + { + let oldPoint; + + const point = { + x: (first.last ).x + + ((second.last ).x - (first.last ).x) / 2, + y: (first.last ).y + + ((second.last ).y - (first.last ).y) / 2, + }; + + if (!this.options.center) + { oldPoint = this.parent.toLocal(point); } - var dist = Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)); - var change = (dist - last) / this.parent.screenWidth * this.parent.scale.x * this.percent; - this.parent.scale.x += change; - this.parent.scale.y += change; - this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch' }); - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { + let dist = Math.sqrt(Math.pow( + (second.last ).x - (first.last ).x, 2) + + Math.pow((second.last ).y - (first.last ).y, 2)); + + dist = dist === 0 ? dist = 0.0000000001 : dist; + + const change = (1 - last / dist) * this.options.percent + * (this.isAxisX() ? this.parent.scale.x : this.parent.scale.y); + + if (this.isAxisX()) + { + this.parent.scale.x += change; + } + if (this.isAxisY()) + { + this.parent.scale.y += change; + } + + this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch', center: point }); + + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { clamp.clamp(); } - if (this.center) { - this.parent.moveCenter(this.center); - } else { - var newPoint = this.parent.toGlobal(oldPoint); - this.parent.x += point.x - newPoint.x; - this.parent.y += point.y - newPoint.y; + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); + + this.parent.x += (point.x - newPoint.x) * this.options.factor; + this.parent.y += (point.y - newPoint.y) * this.options.factor; this.parent.emit('moved', { viewport: this.parent, type: 'pinch' }); } - if (!this.noDrag && this.lastCenter) { - this.parent.x += point.x - this.lastCenter.x; - this.parent.y += point.y - this.lastCenter.y; + if (!this.options.noDrag && this.lastCenter) + { + this.parent.x += (point.x - this.lastCenter.x) * this.options.factor; + this.parent.y += (point.y - this.lastCenter.y) * this.options.factor; this.parent.emit('moved', { viewport: this.parent, type: 'pinch' }); } + this.lastCenter = point; this.moved = true; - } else { - if (!this.pinching) { - this.parent.emit('pinch-start', this.parent); - this.pinching = true; - } } - this.parent.dirty = true; + else if (!this.pinching) + { + this.parent.emit('pinch-start', this.parent); + this.pinching = true; + } + + return true; } + + return false; } - }, { - key: 'up', - value: function up() { - if (this.pinching) { - if (this.parent.touches.length <= 1) { + + up() + { + if (this.pinching) + { + if (this.parent.input.touches.length <= 1) + { this.active = false; this.lastCenter = null; this.pinching = false; this.moved = false; this.parent.emit('pinch-end', this.parent); + + return true; } } + + return false; } - }]); - - return Pinch; -}(Plugin); - -},{"./plugin":9}],9:[function(require,module,exports){ -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -module.exports = function () { - function Plugin(parent) { - _classCallCheck(this, Plugin); - - this.parent = parent; - this.paused = false; } - _createClass(Plugin, [{ - key: "down", - value: function down() {} - }, { - key: "move", - value: function move() {} - }, { - key: "up", - value: function up() {} - }, { - key: "wheel", - value: function wheel() {} - }, { - key: "update", - value: function update() {} - }, { - key: "resize", - value: function resize() {} - }, { - key: "reset", - value: function reset() {} - }, { - key: "pause", - value: function pause() { - this.paused = true; - } - }, { - key: "resume", - value: function resume() { - this.paused = false; - } - }]); + const DEFAULT_SNAP_OPTIONS = { + topLeft: false, + friction: 0.8, + time: 1000, + ease: 'easeInOutSine', + interrupt: true, + removeOnComplete: false, + removeOnInterrupt: false, + forceStart: false + }; - return Plugin; -}(); - -},{}],10:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(SnapZoom, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom - * @param {boolean} [options.noMove] zoom but do not move - * - * @event snap-zoom-start(Viewport) emitted each time a fit animation starts - * @event snap-zoom-end(Viewport) emitted each time fit reaches its target - * @event snap-zoom-end(Viewport) emitted each time fit reaches its target + /** + * @event snap-start(Viewport) emitted each time a snap animation starts + * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size + * @event snap-end(Viewport) emitted each time snap reaches its target + * @event snap-remove(Viewport) emitted if snap plugin is removed */ - function SnapZoom(parent, options) { - _classCallCheck(this, SnapZoom); + class Snap extends Plugin + { + + + + - var _this = _possibleConstructorReturn(this, (SnapZoom.__proto__ || Object.getPrototypeOf(SnapZoom)).call(this, parent)); + + + + + + - options = options || {}; - _this.width = options.width; - _this.height = options.height; - if (_this.width > 0) { - _this.x_scale = parent._screenWidth / _this.width; - } - if (_this.height > 0) { - _this.y_scale = parent._screenHeight / _this.height; - } - _this.xIndependent = utils.exists(_this.x_scale); - _this.yIndependent = utils.exists(_this.y_scale); - _this.x_scale = _this.xIndependent ? _this.x_scale : _this.y_scale; - _this.y_scale = _this.yIndependent ? _this.y_scale : _this.x_scale; + /** + * This is called by {@link Viewport.snap}. + */ + constructor(parent, x, y, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_SNAP_OPTIONS, options); + this.ease = ease(options.ease, 'easeInOutSine'); + this.x = x; + this.y = y; - _this.time = utils.defaults(options.time, 1000); - _this.ease = utils.ease(options.ease, 'easeInOutSine'); - _this.center = options.center; - _this.noMove = options.noMove; - _this.stopOnResize = options.stopOnResize; - _this.removeOnInterrupt = options.removeOnInterrupt; - _this.removeOnComplete = utils.defaults(options.removeOnComplete, true); - _this.interrupt = utils.defaults(options.interrupt, true); - if (_this.time === 0) { - parent.container.scale.x = _this.x_scale; - parent.container.scale.y = _this.y_scale; - if (_this.removeOnComplete) { - _this.parent.removePlugin('snap-zoom'); - } - } else if (options.forceStart) { - _this.createSnapping(); - } - return _this; - } - - _createClass(SnapZoom, [{ - key: 'createSnapping', - value: function createSnapping() { - var scale = this.parent.scale; - this.snapping = { time: 0, startX: scale.x, startY: scale.y, deltaX: this.x_scale - scale.x, deltaY: this.y_scale - scale.y }; - this.parent.emit('snap-zoom-start', this.parent); - } - }, { - key: 'resize', - value: function resize() { - this.snapping = null; - - if (this.width > 0) { - this.x_scale = this.parent._screenWidth / this.width; - } - if (this.height > 0) { - this.y_scale = this.parent._screenHeight / this.height; - } - this.x_scale = this.xIndependent ? this.x_scale : this.y_scale; - this.y_scale = this.yIndependent ? this.y_scale : this.x_scale; - } - }, { - key: 'reset', - value: function reset() { - this.snapping = null; - } - }, { - key: 'wheel', - value: function wheel() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap-zoom'); + if (this.options.forceStart) + { + this.snapStart(); } } - }, { - key: 'down', - value: function down() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap-zoom'); - } else if (this.interrupt) { - this.snapping = null; - } - } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { - return; - } - if (this.interrupt && this.parent.countDownPointers() !== 0) { - return; - } - var oldCenter = void 0; - if (!this.center && !this.noMove) { - oldCenter = this.parent.center; - } - if (!this.snapping) { - if (this.parent.scale.x !== this.x_scale || this.parent.scale.y !== this.y_scale) { - this.createSnapping(); - } - } else if (this.snapping) { - var snapping = this.snapping; - snapping.time += elapsed; - if (snapping.time >= this.time) { - this.parent.scale.set(this.x_scale, this.y_scale); - if (this.removeOnComplete) { - this.parent.removePlugin('snap-zoom'); - } - this.parent.emit('snap-zoom-end', this.parent); - this.snapping = null; - } else { - var _snapping = this.snapping; - this.parent.scale.x = this.ease(_snapping.time, _snapping.startX, _snapping.deltaX, this.time); - this.parent.scale.y = this.ease(_snapping.time, _snapping.startY, _snapping.deltaY, this.time); - } - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { - clamp.clamp(); - } - if (!this.noMove) { - if (!this.center) { - this.parent.moveCenter(oldCenter); - } else { - this.parent.moveCenter(this.center); - } - } - } - } - }, { - key: 'resume', - value: function resume() { - this.snapping = null; - _get(SnapZoom.prototype.__proto__ || Object.getPrototypeOf(SnapZoom.prototype), 'resume', this).call(this); - } - }]); - - return SnapZoom; -}(Plugin); - -},{"./plugin":9,"./utils":12}],11:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(Snap, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {number} x - * @param {number} y - * @param {object} [options] - * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center - * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location - * - * @event snap-start(Viewport) emitted each time a snap animation starts - * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size - * @event snap-end(Viewport) emitted each time snap reaches its target - * @event snap-remove(Viewport) emitted if snap plugin is removed - */ - function Snap(parent, x, y, options) { - _classCallCheck(this, Snap); - - var _this = _possibleConstructorReturn(this, (Snap.__proto__ || Object.getPrototypeOf(Snap)).call(this, parent)); - - options = options || {}; - _this.friction = options.friction || 0.8; - _this.time = options.time || 1000; - _this.ease = utils.ease(options.ease, 'easeInOutSine'); - _this.x = x; - _this.y = y; - _this.topLeft = options.topLeft; - _this.interrupt = utils.defaults(options.interrupt, true); - _this.removeOnComplete = options.removeOnComplete; - _this.removeOnInterrupt = options.removeOnInterrupt; - if (options.forceStart) { - _this.startEase(); - } - return _this; - } - - _createClass(Snap, [{ - key: 'snapStart', - value: function snapStart() { + snapStart() + { this.percent = 0; this.snapping = { time: 0 }; - var current = this.topLeft ? this.parent.corner : this.parent.center; + const current = this.options.topLeft ? this.parent.corner : this.parent.center; + this.deltaX = this.x - current.x; this.deltaY = this.y - current.y; this.startX = current.x; this.startY = current.y; this.parent.emit('snap-start', this.parent); } - }, { - key: 'wheel', - value: function wheel() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap'); + + wheel() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap'); } + + return false; } - }, { - key: 'down', - value: function down() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap'); - } else if (this.interrupt) { + + down() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap'); + } + else if (this.options.interrupt) + { this.snapping = null; } + + return false; } - }, { - key: 'up', - value: function up() { - if (this.parent.countDownPointers() === 0) { - var decelerate = this.parent.plugins['decelerate']; - if (decelerate && (decelerate.x || decelerate.y)) { - decelerate.percentChangeX = decelerate.percentChangeY = this.friction; + + up() + { + if (this.parent.input.count() === 0) + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (decelerate && (decelerate.x || decelerate.y)) + { + decelerate.percentChangeX = decelerate.percentChangeY = this.options.friction; } } + + return false; } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { + + update(elapsed) + { + if (this.paused) + { return; } - if (this.interrupt && this.parent.countDownPointers() !== 0) { + if (this.options.interrupt && this.parent.input.count() !== 0) + { return; } - if (!this.snapping) { - var current = this.topLeft ? this.parent.corner : this.parent.center; - if (current.x !== this.x || current.y !== this.y) { + if (!this.snapping) + { + const current = this.options.topLeft ? this.parent.corner : this.parent.center; + + if (current.x !== this.x || current.y !== this.y) + { this.snapStart(); } - } else { - var snapping = this.snapping; + } + else + { + const snapping = this.snapping; + snapping.time += elapsed; - var finished = void 0, - x = void 0, - y = void 0; - if (snapping.time > this.time) { + let finished; + let x; + let y; + + const startX = this.startX ; + const startY = this.startY ; + const deltaX = this.deltaX ; + const deltaY = this.deltaY ; + + if (snapping.time > this.options.time) + { finished = true; - x = this.startX + this.deltaX; - y = this.startY + this.deltaY; - } else { - var percent = this.ease(snapping.time, 0, 1, this.time); - x = this.startX + this.deltaX * percent; - y = this.startY + this.deltaY * percent; + x = startX + deltaX; + y = startY + deltaY; } - if (this.topLeft) { + else + { + const percent = this.ease(snapping.time, 0, 1, this.options.time); + + x = startX + (deltaX * percent); + y = startY + (deltaY * percent); + } + if (this.options.topLeft) + { this.parent.moveCorner(x, y); - } else { + } + else + { this.parent.moveCenter(x, y); } + this.parent.emit('moved', { viewport: this.parent, type: 'snap' }); - if (finished) { - if (this.removeOnComplete) { - this.parent.removePlugin('snap'); + + if (finished) + { + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap'); } this.parent.emit('snap-end', this.parent); this.snapping = null; } } } - }]); - - return Snap; -}(Plugin); - -},{"./plugin":9,"./utils":12}],12:[function(require,module,exports){ -'use strict'; - -var Penner = require('penner'); - -function exists(a) { - return a !== undefined && a !== null; -} - -function defaults(a, defaults) { - return a !== undefined && a !== null ? a : defaults; -} - -/** - * @param {(function|string)} [ease] - * @param {string} defaults for pennr equation - * @private - * @returns {function} correct penner equation - */ -function ease(ease, defaults) { - if (!exists(ease)) { - return Penner[defaults]; - } else if (typeof ease === 'function') { - return ease; - } else if (typeof ease === 'string') { - return Penner[ease]; - } -} - -module.exports = { - exists: exists, - defaults: defaults, - ease: ease -}; - -},{"penner":15}],13:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Drag = require('./drag'); -var Pinch = require('./pinch'); -var Clamp = require('./clamp'); -var ClampZoom = require('./clamp-zoom'); -var Decelerate = require('./decelerate'); -var Bounce = require('./bounce'); -var Snap = require('./snap'); -var SnapZoom = require('./snap-zoom'); -var Follow = require('./follow'); -var Wheel = require('./wheel'); -var MouseEdges = require('./mouse-edges'); - -var PLUGIN_ORDER = ['drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', 'snap-zoom', 'clamp-zoom', 'snap', 'clamp']; - -var Viewport = function (_PIXI$Container) { - _inherits(Viewport, _PIXI$Container); - - /** - * @extends PIXI.Container - * @extends EventEmitter - * @param {object} [options] - * @param {number} [options.screenWidth=window.innerWidth] - * @param {number} [options.screenHeight=window.innerHeight] - * @param {number} [options.worldWidth=this.width] - * @param {number} [options.worldHeight=this.height] - * @param {number} [options.threshold = 5] number of pixels to move to trigger an input event (e.g., drag, pinch) - * @param {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)} [options.forceHitArea] change the default hitArea from world size to a new value - * @param {PIXI.ticker.Ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for updates - * @param {PIXI.InteractionManager} [options.interaction=null] InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer postion relative to canvas location on screen - * @param {HTMLElement} [options.divWheel=document.body] div to attach the wheel event - * @fires clicked - * @fires drag-start - * @fires drag-end - * @fires drag-remove - * @fires pinch-start - * @fires pinch-end - * @fires pinch-remove - * @fires snap-start - * @fires snap-end - * @fires snap-remove - * @fires snap-zoom-start - * @fires snap-zoom-end - * @fires snap-zoom-remove - * @fires bounce-x-start - * @fires bounce-x-end - * @fires bounce-y-start - * @fires bounce-y-end - * @fires bounce-remove - * @fires wheel - * @fires wheel-remove - * @fires wheel-scroll - * @fires wheel-scroll-remove - * @fires mouse-edge-start - * @fires mouse-edge-end - * @fires mouse-edge-remove - * @fires moved - */ - function Viewport(options) { - _classCallCheck(this, Viewport); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Viewport.__proto__ || Object.getPrototypeOf(Viewport)).call(this)); - - _this.plugins = {}; - _this.pluginsList = []; - _this._screenWidth = options.screenWidth; - _this._screenHeight = options.screenHeight; - _this._worldWidth = options.worldWidth; - _this._worldHeight = options.worldHeight; - _this.hitAreaFullScreen = utils.defaults(options.hitAreaFullScreen, true); - _this.forceHitArea = options.forceHitArea; - _this.threshold = utils.defaults(options.threshold, 5); - _this.interaction = options.interaction || null; - _this.div = options.divWheel || document.body; - _this.listeners(_this.div); - - /** - * active touch point ids on the viewport - * @type {number[]} - * @readonly - */ - _this.touches = []; - - _this.ticker = options.ticker || PIXI.ticker.shared; - _this.tickerFunction = function () { - return _this.update(); - }; - _this.ticker.add(_this.tickerFunction); - return _this; } - /** - * removes all event listeners from viewport - * (useful for cleanup of wheel and ticker events when removing viewport) + /** Options for {@link SnapZoom}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_SNAP_ZOOM_OPTIONS = { + width: 0, + height: 0, + time: 1000, + ease: 'easeInOutSine', + center: null, + interrupt: true, + removeOnComplete: false, + removeOnInterrupt: false, + forceStart: false, + noMove: false + }; + + /** + * @event snap-zoom-start(Viewport) emitted each time a fit animation starts + * @event snap-zoom-end(Viewport) emitted each time fit reaches its target + * @event snap-zoom-end(Viewport) emitted each time fit reaches its target */ + class SnapZoom extends Plugin + { + + + + + + + + - _createClass(Viewport, [{ - key: 'removeListeners', - value: function removeListeners() { - this.ticker.remove(this.tickerFunction); - this.div.removeEventListener('wheel', this.wheelFunction); - } - /** - * overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners + + + + + /** + * This is called by {@link Viewport.snapZoom}. */ + constructor(parent, options = {}) + { + super(parent); - }, { - key: 'destroy', - value: function destroy(options) { - _get(Viewport.prototype.__proto__ || Object.getPrototypeOf(Viewport.prototype), 'destroy', this).call(this, options); - this.removeListeners(); - } + this.options = Object.assign({}, DEFAULT_SNAP_ZOOM_OPTIONS, options); + this.ease = ease(this.options.ease); - /** - * update animations - * @private - */ + // Assign defaults for typescript. + this.xIndependent = false; + this.yIndependent = false; + this.xScale = 0; + this.yScale = 0; - }, { - key: 'update', - value: function update() { - if (!this.pause) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + if (this.options.width > 0) + { + this.xScale = parent.screenWidth / this.options.width; + this.xIndependent = true; + } + if (this.options.height > 0) + { + this.yScale = parent.screenHeight / this.options.height; + this.yIndependent = true; + } - try { - for (var _iterator = this.pluginsList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var plugin = _step.value; + this.xScale = this.xIndependent ? (this.xScale ) : (this.yScale ); + this.yScale = this.yIndependent ? (this.yScale ) : this.xScale; - plugin.update(this.ticker.elapsedMS); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + if (this.options.time === 0) + { + // TODO: Fix this + // @ts-expect-error todo + parent.container.scale.x = this.xScale; + + // TODO: Fix this + // @ts-expect-error todo + parent.container.scale.y = this.yScale; + + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap-zoom'); } } - if (!this.forceHitArea) { - this.hitArea.x = this.left; - this.hitArea.y = this.top; - this.hitArea.width = this.worldScreenWidth; - this.hitArea.height = this.worldScreenHeight; + else if (options.forceStart) + { + this.createSnapping(); } } - /** - * use this to set screen and world sizes--needed for pinch/wheel/clamp/bounce - * @param {number} screenWidth - * @param {number} screenHeight - * @param {number} [worldWidth] - * @param {number} [worldHeight] - */ + createSnapping() + { + const startWorldScreenWidth = this.parent.worldScreenWidth; + const startWorldScreenHeight = this.parent.worldScreenHeight; + const endWorldScreenWidth = this.parent.screenWidth / this.xScale; + const endWorldScreenHeight = this.parent.screenHeight / this.yScale; - }, { - key: 'resize', - value: function resize(screenWidth, screenHeight, worldWidth, worldHeight) { - this._screenWidth = screenWidth || window.innerWidth; - this._screenHeight = screenHeight || window.innerHeight; - this._worldWidth = worldWidth; - this._worldHeight = worldHeight; - this.resizePlugins(); - } - - /** - * called after a worldWidth/Height change - * @private - */ - - }, { - key: 'resizePlugins', - value: function resizePlugins() { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.pluginsList[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var plugin = _step2.value; - - plugin.resize(); - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } - - /** - * screen width in screen pixels - * @type {number} - */ - - }, { - key: 'listeners', - - - /** - * add input listeners - * @private - */ - value: function listeners(div) { - var _this2 = this; - - this.interactive = true; - if (!this.forceHitArea) { - this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight); - } - this.on('pointerdown', this.down); - this.on('pointermove', this.move); - this.on('pointerup', this.up); - this.on('pointerupoutside', this.up); - this.on('pointercancel', this.up); - this.on('pointerout', this.up); - this.wheelFunction = function (e) { - return _this2.handleWheel(e); + this.snapping = { + time: 0, + startX: startWorldScreenWidth, + startY: startWorldScreenHeight, + deltaX: endWorldScreenWidth - startWorldScreenWidth, + deltaY: endWorldScreenHeight - startWorldScreenHeight }; - div.addEventListener('wheel', this.wheelFunction); - this.leftDown = false; + + this.parent.emit('snap-zoom-start', this.parent); } - /** - * handle down events - * @private - */ + resize() + { + this.snapping = null; - }, { - key: 'down', - value: function down(e) { - if (this.pause) { - return; + if (this.options.width > 0) + { + this.xScale = this.parent.screenWidth / this.options.width; } - if (e.data.pointerType === 'mouse') { - if (e.data.originalEvent.button == 0) { - this.leftDown = true; - } - } else { - this.touches.push(e.data.pointerId); - } - - if (this.countDownPointers() === 1) { - this.last = { x: e.data.global.x, y: e.data.global.y - - // clicked event does not fire if viewport is decelerating or bouncing - };var decelerate = this.plugins['decelerate']; - var bounce = this.plugins['bounce']; - if ((!decelerate || !decelerate.x && !decelerate.y) && (!bounce || !bounce.toX && !bounce.toY)) { - this.clickedAvailable = true; - } - } else { - this.clickedAvailable = false; - } - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = this.pluginsList[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var plugin = _step3.value; - - plugin.down(e); - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } + if (this.options.height > 0) + { + this.yScale = this.parent.screenHeight / this.options.height; } + this.xScale = this.xIndependent ? this.xScale : this.yScale; + this.yScale = this.yIndependent ? this.yScale : this.xScale; } - /** - * whether change exceeds threshold - * @private - * @param {number} change - */ - - }, { - key: 'checkThreshold', - value: function checkThreshold(change) { - if (Math.abs(change) >= this.threshold) { - return true; + wheel() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap-zoom'); } + return false; } - /** - * handle move events - * @private - */ + down() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap-zoom'); + } + else if (this.options.interrupt) + { + this.snapping = null; + } - }, { - key: 'move', - value: function move(e) { - if (this.pause) { + return false; + } + + update(elapsed) + { + if (this.paused) + { + return; + } + if (this.options.interrupt && this.parent.input.count() !== 0) + { return; } - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; + let oldCenter; - try { - for (var _iterator4 = this.pluginsList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var plugin = _step4.value; - - plugin.move(e); - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } + if (!this.options.center && !this.options.noMove) + { + oldCenter = this.parent.center; + } + if (!this.snapping) + { + if (this.parent.scale.x !== this.xScale || this.parent.scale.y !== this.yScale) + { + this.createSnapping(); } } + else if (this.snapping) + { + const snapping = this.snapping; - if (this.clickedAvailable) { - var distX = e.data.global.x - this.last.x; - var distY = e.data.global.y - this.last.y; - if (this.checkThreshold(distX) || this.checkThreshold(distY)) { - this.clickedAvailable = false; - } - } - } + snapping.time += elapsed; - /** - * handle up events - * @private - */ - - }, { - key: 'up', - value: function up(e) { - if (this.pause) { - return; - } - - if (e.data.originalEvent instanceof MouseEvent && e.data.originalEvent.button == 0) { - this.leftDown = false; - } - - if (e.data.pointerType !== 'mouse') { - for (var i = 0; i < this.touches.length; i++) { - if (this.touches[i] === e.data.pointerId) { - this.touches.splice(i, 1); - break; + if (snapping.time >= this.options.time) + { + this.parent.scale.set(this.xScale, this.yScale); + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap-zoom'); } + this.parent.emit('snap-zoom-end', this.parent); + this.snapping = null; } - } + else + { + const snapping = this.snapping; + const worldScreenWidth = this.ease(snapping.time, snapping.startX, snapping.deltaX, this.options.time); + const worldScreenHeight = this.ease(snapping.time, snapping.startY, snapping.deltaY, this.options.time); - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; - - try { - for (var _iterator5 = this.pluginsList[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { - var plugin = _step5.value; - - plugin.up(e); + this.parent.scale.x = this.parent.screenWidth / worldScreenWidth; + this.parent.scale.y = this.parent.screenHeight / worldScreenHeight; } - } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; - } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5.return) { - _iterator5.return(); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { + clamp.clamp(); } - } - - if (this.clickedAvailable && this.countDownPointers() === 0) { - this.emit('clicked', { screen: this.last, world: this.toWorld(this.last), viewport: this }); - this.clickedAvailable = false; - } - } - - /** - * gets pointer position if this.interaction is set - * @param {UIEvent} evt - * @private - */ - - }, { - key: 'getPointerPosition', - value: function getPointerPosition(evt) { - var point = new PIXI.Point(); - if (this.interaction) { - this.interaction.mapPositionToPoint(point, evt.clientX, evt.clientY); - } else { - point.x = evt.clientX; - point.y = evt.clientY; - } - return point; - } - - /** - * handle wheel events - * @private - */ - - }, { - key: 'handleWheel', - value: function handleWheel(e) { - if (this.pause) { - return; - } - - // only handle wheel events where the mouse is over the viewport - var point = this.toLocal(this.getPointerPosition(e)); - if (this.left <= point.x && point.x <= this.right && this.top <= point.y && point.y <= this.bottom) { - var result = void 0; - var _iteratorNormalCompletion6 = true; - var _didIteratorError6 = false; - var _iteratorError6 = undefined; - - try { - for (var _iterator6 = this.pluginsList[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { - var plugin = _step6.value; - - if (plugin.wheel(e)) { - result = true; - } + if (!this.options.noMove) + { + if (!this.options.center) + { + this.parent.moveCenter(oldCenter ); } - } catch (err) { - _didIteratorError6 = true; - _iteratorError6 = err; - } finally { - try { - if (!_iteratorNormalCompletion6 && _iterator6.return) { - _iterator6.return(); - } - } finally { - if (_didIteratorError6) { - throw _iteratorError6; - } - } - } - - return result; - } - } - - /** - * change coordinates from screen to world - * @param {number|PIXI.Point} x - * @param {number} [y] - * @returns {PIXI.Point} - */ - - }, { - key: 'toWorld', - value: function toWorld() { - if (arguments.length === 2) { - var x = arguments[0]; - var y = arguments[1]; - return this.toLocal({ x: x, y: y }); - } else { - return this.toLocal(arguments[0]); - } - } - - /** - * change coordinates from world to screen - * @param {number|PIXI.Point} x - * @param {number} [y] - * @returns {PIXI.Point} - */ - - }, { - key: 'toScreen', - value: function toScreen() { - if (arguments.length === 2) { - var x = arguments[0]; - var y = arguments[1]; - return this.toGlobal({ x: x, y: y }); - } else { - var point = arguments[0]; - return this.toGlobal(point); - } - } - - /** - * screen width in world coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'moveCenter', - - - /** - * move center of viewport to point - * @param {(number|PIXI.PointLike)} x or point - * @param {number} [y] - * @return {Viewport} this - */ - value: function moveCenter() /*x, y | PIXI.Point*/{ - var x = void 0, - y = void 0; - if (!isNaN(arguments[0])) { - x = arguments[0]; - y = arguments[1]; - } else { - x = arguments[0].x; - y = arguments[0].y; - } - this.position.set((this.worldScreenWidth / 2 - x) * this.scale.x, (this.worldScreenHeight / 2 - y) * this.scale.y); - this._reset(); - return this; - } - - /** - * top-left corner - * @type {PIXI.PointLike} - */ - - }, { - key: 'moveCorner', - - - /** - * move viewport's top-left corner; also clamps and resets decelerate and bounce (as needed) - * @param {number|PIXI.Point} x|point - * @param {number} y - * @return {Viewport} this - */ - value: function moveCorner() /*x, y | point*/{ - if (arguments.length === 1) { - this.position.set(-arguments[0].x * this.scale.x, -arguments[0].y * this.scale.y); - } else { - this.position.set(-arguments[0] * this.scale.x, -arguments[1] * this.scale.y); - } - this._reset(); - return this; - } - - /** - * change zoom so the width fits in the viewport - * @param {number} [width=this._worldWidth] in world coordinates - * @param {boolean} [center] maintain the same center - * @return {Viewport} this - */ - - }, { - key: 'fitWidth', - value: function fitWidth(width, center) { - var save = void 0; - if (center) { - save = this.center; - } - width = width || this.worldWidth; - this.scale.x = this.screenWidth / width; - this.scale.y = this.scale.x; - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so the height fits in the viewport - * @param {number} [height=this._worldHeight] in world coordinates - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} this - */ - - }, { - key: 'fitHeight', - value: function fitHeight(height, center) { - var save = void 0; - if (center) { - save = this.center; - } - height = height || this.worldHeight; - this.scale.y = this.screenHeight / height; - this.scale.x = this.scale.y; - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so it fits the entire world in the viewport - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} this - */ - - }, { - key: 'fitWorld', - value: function fitWorld(center) { - var save = void 0; - if (center) { - save = this.center; - } - this.scale.x = this._screenWidth / this._worldWidth; - this.scale.y = this._screenHeight / this._worldHeight; - if (this.scale.x < this.scale.y) { - this.scale.y = this.scale.x; - } else { - this.scale.x = this.scale.y; - } - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so it fits the size or the entire world in the viewport - * @param {boolean} [center] maintain the same center of the screen after zoom - * @param {number} [width] desired width - * @param {number} [height] desired height - * @return {Viewport} this - */ - - }, { - key: 'fit', - value: function fit(center, width, height) { - var save = void 0; - if (center) { - save = this.center; - } - width = width || this.worldWidth; - height = height || this.worldHeight; - this.scale.x = this.screenWidth / width; - this.scale.y = this.screenHeight / height; - if (this.scale.x < this.scale.y) { - this.scale.y = this.scale.x; - } else { - this.scale.x = this.scale.y; - } - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * zoom viewport by a certain percent (in both x and y direction) - * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25) - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} the viewport - */ - - }, { - key: 'zoomPercent', - value: function zoomPercent(percent, center) { - var save = void 0; - if (center) { - save = this.center; - } - var scale = this.scale.x + this.scale.x * percent; - this.scale.set(scale); - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * zoom viewport by increasing/decreasing width by a certain number of pixels - * @param {number} change in pixels - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} the viewport - */ - - }, { - key: 'zoom', - value: function zoom(change, center) { - this.fitWidth(change + this.worldScreenWidth, center); - return this; - } - - /** - * @param {object} [options] - * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom - */ - - }, { - key: 'snapZoom', - value: function snapZoom(options) { - this.plugins['snap-zoom'] = new SnapZoom(this, options); - this.pluginsSort(); - return this; - } - - /** - * @private - * @typedef OutOfBounds - * @type {object} - * @property {boolean} left - * @property {boolean} right - * @property {boolean} top - * @property {boolean} bottom - */ - - /** - * is container out of world bounds - * @return {OutOfBounds} - * @private - */ - - }, { - key: 'OOB', - value: function OOB() { - var result = {}; - result.left = this.left < 0; - result.right = this.right > this._worldWidth; - result.top = this.top < 0; - result.bottom = this.bottom > this._worldHeight; - result.cornerPoint = { - x: this._worldWidth * this.scale.x - this._screenWidth, - y: this._worldHeight * this.scale.y - this._screenHeight - }; - return result; - } - - /** - * world coordinates of the right edge of the screen - * @type {number} - */ - - }, { - key: 'countDownPointers', - - - /** - * count of mouse/touch pointers that are down on the viewport - * @private - * @return {number} - */ - value: function countDownPointers() { - return (this.leftDown ? 1 : 0) + this.touches.length; - } - - /** - * array of touch pointers that are down on the viewport - * @private - * @return {PIXI.InteractionTrackingData[]} - */ - - }, { - key: 'getTouchPointers', - value: function getTouchPointers() { - var results = []; - var pointers = this.trackedPointers; - for (var key in pointers) { - var pointer = pointers[key]; - if (this.touches.indexOf(pointer.pointerId) !== -1) { - results.push(pointer); - } - } - return results; - } - - /** - * array of pointers that are down on the viewport - * @private - * @return {PIXI.InteractionTrackingData[]} - */ - - }, { - key: 'getPointers', - value: function getPointers() { - var results = []; - var pointers = this.trackedPointers; - for (var key in pointers) { - results.push(pointers[key]); - } - return results; - } - - /** - * clamps and resets bounce and decelerate (as needed) after manually moving viewport - * @private - */ - - }, { - key: '_reset', - value: function _reset() { - if (this.plugins['bounce']) { - this.plugins['bounce'].reset(); - this.plugins['bounce'].bounce(); - } - if (this.plugins['decelerate']) { - this.plugins['decelerate'].reset(); - } - if (this.plugins['snap']) { - this.plugins['snap'].reset(); - } - if (this.plugins['clamp']) { - this.plugins['clamp'].update(); - } - if (this.plugins['clamp-zoom']) { - this.plugins['clamp-zoom'].clamp(); - } - this.dirty = true; - } - - // PLUGINS - - /** - * removes installed plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'removePlugin', - value: function removePlugin(type) { - if (this.plugins[type]) { - this.plugins[type] = null; - this.emit(type + '-remove'); - this.pluginsSort(); - } - } - - /** - * pause plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'pausePlugin', - value: function pausePlugin(type) { - if (this.plugins[type]) { - this.plugins[type].pause(); - } - } - - /** - * resume plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'resumePlugin', - value: function resumePlugin(type) { - if (this.plugins[type]) { - this.plugins[type].resume(); - } - } - - /** - * sort plugins for updates - * @private - */ - - }, { - key: 'pluginsSort', - value: function pluginsSort() { - this.pluginsList = []; - var _iteratorNormalCompletion7 = true; - var _didIteratorError7 = false; - var _iteratorError7 = undefined; - - try { - for (var _iterator7 = PLUGIN_ORDER[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { - var plugin = _step7.value; - - if (this.plugins[plugin]) { - this.pluginsList.push(this.plugins[plugin]); - } - } - } catch (err) { - _didIteratorError7 = true; - _iteratorError7 = err; - } finally { - try { - if (!_iteratorNormalCompletion7 && _iterator7.return) { - _iterator7.return(); - } - } finally { - if (_didIteratorError7) { - throw _iteratorError7; + else + { + this.parent.moveCenter(this.options.center); } } } } - /** - * enable one-finger touch to drag - * @param {object} [options] - * @param {string} [options.direction=all] direction to drag (all, x, or y) - * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active) - * @param {number} [options.wheelScroll=10] number of pixels to scroll with each wheel spin - * @param {boolean} [options.reverse] reverse the direction of the wheel scroll - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - */ - - }, { - key: 'drag', - value: function drag(options) { - this.plugins['drag'] = new Drag(this, options); - this.pluginsSort(); - return this; + resume() + { + this.snapping = null; + super.resume(); } - - /** - * clamp to world boundaries or other provided boundaries - * NOTES: - * clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping - * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {(number|boolean)} [options.left] clamp left; true=0 - * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth - * @param {(number|boolean)} [options.top] clamp top; true=0 - * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight - * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - * @return {Viewport} this - */ - - }, { - key: 'clamp', - value: function clamp(options) { - this.plugins['clamp'] = new Clamp(this, options); - this.pluginsSort(); - return this; - } - - /** - * decelerate after a move - * @param {object} [options] - * @param {number} [options.friction=0.95] percent to decelerate after movement - * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active) - * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration - * @return {Viewport} this - */ - - }, { - key: 'decelerate', - value: function decelerate(options) { - this.plugins['decelerate'] = new Decelerate(this, options); - this.pluginsSort(); - return this; - } - - /** - * bounce on borders - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {string} [options.sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right') - * @param {number} [options.friction=0.5] friction to apply to decelerate if active - * @param {number} [options.time=150] time in ms to finish bounce - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - * @return {Viewport} this - */ - - }, { - key: 'bounce', - value: function bounce(options) { - this.plugins['bounce'] = new Bounce(this, options); - this.pluginsSort(); - return this; - } - - /** - * enable pinch to zoom and two-finger touch to drag - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {number} [options.percent=1.0] percent to modify pinch speed - * @param {boolean} [options.noDrag] disable two-finger dragging - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers - * @return {Viewport} this - */ - - }, { - key: 'pinch', - value: function pinch(options) { - this.plugins['pinch'] = new Pinch(this, options); - this.pluginsSort(); - return this; - } - - /** - * snap to a point - * @param {number} x - * @param {number} y - * @param {object} [options] - * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center - * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location - * @return {Viewport} this - */ - - }, { - key: 'snap', - value: function snap(x, y, options) { - this.plugins['snap'] = new Snap(this, x, y, options); - this.pluginsSort(); - return this; - } - - /** - * follow a target - * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate}) - * @param {object} [options] - * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location) - * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport - * @return {Viewport} this - */ - - }, { - key: 'follow', - value: function follow(target, options) { - this.plugins['follow'] = new Follow(this, target, options); - this.pluginsSort(); - return this; - } - - /** - * zoom using mouse wheel - * @param {object} [options] - * @param {number} [options.percent=0.1] percent to scroll with each spin - * @param {boolean} [options.reverse] reverse the direction of the scroll - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position - * @return {Viewport} this - */ - - }, { - key: 'wheel', - value: function wheel(options) { - this.plugins['wheel'] = new Wheel(this, options); - this.pluginsSort(); - return this; - } - - /** - * enable clamping of zoom to constraints - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {number} [options.minWidth] minimum width - * @param {number} [options.minHeight] minimum height - * @param {number} [options.maxWidth] maximum width - * @param {number} [options.maxHeight] maximum height - * @return {Viewport} this - */ - - }, { - key: 'clampZoom', - value: function clampZoom(options) { - this.plugins['clamp-zoom'] = new ClampZoom(this, options); - this.pluginsSort(); - return this; - } - - /** - * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen. - * @param {object} [options] - * @param {number} [options.radius] distance from center of screen in screen pixels - * @param {number} [options.distance] distance from all sides in screen pixels - * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll) - * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll) - * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll) - * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll) - * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport - * @param {boolean} [options.reverse] reverse direction of scroll - * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed - * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center)) - */ - - }, { - key: 'mouseEdges', - value: function mouseEdges(options) { - this.plugins['mouse-edges'] = new MouseEdges(this, options); - this.pluginsSort(); - return this; - } - - /** - * pause viewport (including animation updates such as decelerate) - * NOTE: when setting pause=true, all touches and mouse actions are cleared (i.e., if mousedown was active, it becomes inactive for purposes of the viewport) - * @type {boolean} - */ - - }, { - key: 'screenWidth', - get: function get() { - return this._screenWidth; - }, - set: function set(value) { - this._screenWidth = value; - } - - /** - * screen height in screen pixels - * @type {number} - */ - - }, { - key: 'screenHeight', - get: function get() { - return this._screenHeight; - }, - set: function set(value) { - this._screenHeight = value; - } - - /** - * world width in pixels - * @type {number} - */ - - }, { - key: 'worldWidth', - get: function get() { - if (this._worldWidth) { - return this._worldWidth; - } else { - return this.width; - } - }, - set: function set(value) { - this._worldWidth = value; - this.resizePlugins(); - } - - /** - * world height in pixels - * @type {number} - */ - - }, { - key: 'worldHeight', - get: function get() { - if (this._worldHeight) { - return this._worldHeight; - } else { - return this.height; - } - }, - set: function set(value) { - this._worldHeight = value; - this.resizePlugins(); - } - }, { - key: 'worldScreenWidth', - get: function get() { - return this._screenWidth / this.scale.x; - } - - /** - * screen height in world coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'worldScreenHeight', - get: function get() { - return this._screenHeight / this.scale.y; - } - - /** - * world width in screen coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'screenWorldWidth', - get: function get() { - return this._worldWidth * this.scale.x; - } - - /** - * world height in screen coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'screenWorldHeight', - get: function get() { - return this._worldHeight * this.scale.y; - } - - /** - * get center of screen in world coordinates - * @type {PIXI.PointLike} - */ - - }, { - key: 'center', - get: function get() { - return { x: this.worldScreenWidth / 2 - this.x / this.scale.x, y: this.worldScreenHeight / 2 - this.y / this.scale.y }; - }, - set: function set(value) { - this.moveCenter(value); - } - }, { - key: 'corner', - get: function get() { - return { x: -this.x / this.scale.x, y: -this.y / this.scale.y }; - }, - set: function set(value) { - this.moveCorner(value); - } - }, { - key: 'right', - get: function get() { - return -this.x / this.scale.x + this.worldScreenWidth; - }, - set: function set(value) { - this.x = -value * this.scale.x + this.screenWidth; - this._reset(); - } - - /** - * world coordinates of the left edge of the screen - * @type {number} - */ - - }, { - key: 'left', - get: function get() { - return -this.x / this.scale.x; - }, - set: function set(value) { - this.x = -value * this.scale.x; - this._reset(); - } - - /** - * world coordinates of the top edge of the screen - * @type {number} - */ - - }, { - key: 'top', - get: function get() { - return -this.y / this.scale.y; - }, - set: function set(value) { - this.y = -value * this.scale.y; - this._reset(); - } - - /** - * world coordinates of the bottom edge of the screen - * @type {number} - */ - - }, { - key: 'bottom', - get: function get() { - return -this.y / this.scale.y + this.worldScreenHeight; - }, - set: function set(value) { - this.y = -value * this.scale.y + this.screenHeight; - this._reset(); - } - /** - * determines whether the viewport is dirty (i.e., needs to be renderered to the screen because of a change) - * @type {boolean} - */ - - }, { - key: 'dirty', - get: function get() { - return this._dirty; - }, - set: function set(value) { - this._dirty = value; - } - - /** - * permanently changes the Viewport's hitArea - *

NOTE: normally the hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, Viewport.worldScreenHeight)

- * @type {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)} - */ - - }, { - key: 'forceHitArea', - get: function get() { - return this._forceHitArea; - }, - set: function set(value) { - if (value) { - this._forceHitArea = value; - this.hitArea = value; - } else { - this._forceHitArea = false; - this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight); - } - } - }, { - key: 'pause', - get: function get() { - return this._pause; - }, - set: function set(value) { - this._pause = value; - if (value) { - this.touches = []; - this.leftDown = false; - } - } - }]); - - return Viewport; -}(PIXI.Container); - -/** - * fires after a mouse or touch click - * @event Viewport#clicked - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a drag starts - * @event Viewport#drag-start - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a drag ends - * @event Viewport#drag-end - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a pinch starts - * @event Viewport#pinch-start - * @type {Viewport} - */ - -/** - * fires when a pinch end - * @event Viewport#pinch-end - * @type {Viewport} - */ - -/** - * fires when a snap starts - * @event Viewport#snap-start - * @type {Viewport} - */ - -/** - * fires when a snap ends - * @event Viewport#snap-end - * @type {Viewport} - */ - -/** - * fires when a snap-zoom starts - * @event Viewport#snap-zoom-start - * @type {Viewport} - */ - -/** - * fires when a snap-zoom ends - * @event Viewport#snap-zoom-end - * @type {Viewport} - */ - -/** - * fires when a bounce starts in the x direction - * @event Viewport#bounce-x-start - * @type {Viewport} - */ - -/** - * fires when a bounce ends in the x direction - * @event Viewport#bounce-x-end - * @type {Viewport} - */ - -/** - * fires when a bounce starts in the y direction - * @event Viewport#bounce-y-start - * @type {Viewport} - */ - -/** - * fires when a bounce ends in the y direction - * @event Viewport#bounce-y-end - * @type {Viewport} - */ - -/** - * fires when for a mouse wheel event - * @event Viewport#wheel - * @type {object} - * @property {object} wheel - * @property {number} wheel.dx - * @property {number} wheel.dy - * @property {number} wheel.dz - * @property {Viewport} viewport - */ - -/** - * fires when a wheel-scroll occurs - * @event Viewport#wheel-scroll - * @type {Viewport} - */ - -/** - * fires when a mouse-edge starts to scroll - * @event Viewport#mouse-edge-start - * @type {Viewport} - */ - -/** - * fires when the mouse-edge scrolling ends - * @event Viewport#mouse-edge-end - * @type {Viewport} - */ - -/** - * fires when viewport moves through UI interaction, deceleration, or follow - * @event Viewport#moved - * @type {object} - * @property {Viewport} viewport - * @property {string} type (drag, snap, pinch, follow, bounce-x, bounce-y, clamp-x, clamp-y, decelerate, mouse-edges, wheel) - */ - -/** - * fires when viewport moves through UI interaction, deceleration, or follow - * @event Viewport#zoomed - * @type {object} - * @property {Viewport} viewport - * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom) - */ - -PIXI.extras.Viewport = Viewport; - -module.exports = Viewport; - -},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Wheel, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.percent=0.1] percent to scroll with each spin - * @param {boolean} [options.reverse] reverse the direction of the scroll - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position - * - * @event wheel({wheel: {dx, dy, dz}, event, viewport}) - */ - function Wheel(parent, options) { - _classCallCheck(this, Wheel); - - var _this = _possibleConstructorReturn(this, (Wheel.__proto__ || Object.getPrototypeOf(Wheel)).call(this, parent)); - - options = options || {}; - _this.percent = options.percent || 0.1; - _this.center = options.center; - _this.reverse = options.reverse; - return _this; } - _createClass(Wheel, [{ - key: 'wheel', - value: function wheel(e) { - if (this.paused) { + /** Options for {@link Wheel}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_WHEEL_OPTIONS = { + percent: 0.1, + smooth: false, + interrupt: true, + reverse: false, + center: null, + lineHeight: 20, + axis: 'all', + keyToPress: null, + trackpadPinch: false, + wheelZoom: true, + }; + + /** + * Plugin for handling wheel scrolling for viewport zoom. + * + * @event wheel({wheel: {dx, dy, dz}, event, viewport}) + */ + class Wheel extends Plugin + { + + + + + + + /** Flags whether the keys required to zoom are pressed currently. */ + + + /** + * This is called by {@link Viewport.wheel}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_WHEEL_OPTIONS, options); + this.keyIsPressed = false; + + if (this.options.keyToPress) + { + this.handleKeyPresses(this.options.keyToPress); + } + } + + /** + * Handles keypress events and set the keyIsPressed boolean accordingly + * + * @param {array} codes - key codes that can be used to trigger zoom event + */ + handleKeyPresses(codes) + { + window.addEventListener('keydown', (e) => + { + if (codes.includes(e.code)) + { + this.keyIsPressed = true; + } + }); + + window.addEventListener('keyup', (e) => + { + if (codes.includes(e.code)) + { + this.keyIsPressed = false; + } + }); + } + + checkKeyPress() + { + return !this.options.keyToPress || this.keyIsPressed; + } + + down() + { + if (this.options.interrupt) + { + this.smoothing = null; + } + + return false; + } + + isAxisX() + { + return ['all', 'x'].includes(this.options.axis); + } + + isAxisY() + { + return ['all', 'y'].includes(this.options.axis); + } + + update() + { + if (this.smoothing) + { + const point = this.smoothingCenter; + const change = this.smoothing; + let oldPoint; + + if (!this.options.center) + { + oldPoint = this.parent.toLocal(point ); + } + if (this.isAxisX()) + { + this.parent.scale.x += change.x; + } + if (this.isAxisY()) + { + this.parent.scale.y += change.y; + } + + this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { + clamp.clamp(); + } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); + + this.parent.x += (point ).x - newPoint.x; + this.parent.y += (point ).y - newPoint.y; + } + + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + (this.smoothingCount )++; + + if ((this.smoothingCount ) >= this.options.smooth) + { + this.smoothing = null; + } + } + } + + pinch(e) + { + if (this.paused) + { return; } - var change = void 0; - if (this.reverse) { - change = e.deltaY > 0 ? 1 + this.percent : 1 - this.percent; - } else { - change = e.deltaY > 0 ? 1 - this.percent : 1 + this.percent; - } - var point = this.parent.getPointerPosition(e); + const point = this.parent.input.getPointerPosition(e); + const step = -e.deltaY * (e.deltaMode ? this.options.lineHeight : 1) / 200; + const change = Math.pow(2, (1 + this.options.percent) * step); - var oldPoint = void 0; - if (!this.center) { + let oldPoint; + + if (!this.options.center) + { oldPoint = this.parent.toLocal(point); } - this.parent.scale.x *= change; - this.parent.scale.y *= change; + if (this.isAxisX()) + { + this.parent.scale.x *= change; + } + if (this.isAxisY()) + { + this.parent.scale.y *= change; + } this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { clamp.clamp(); } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); - if (this.center) { - this.parent.moveCenter(this.center); - } else { - var newPoint = this.parent.toGlobal(oldPoint); this.parent.x += point.x - newPoint.x; this.parent.y += point.y - newPoint.y; } this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); - this.parent.emit('wheel', { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); - e.preventDefault(); + this.parent.emit('wheel', + { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); } - }]); - return Wheel; -}(Plugin); + wheel(e) + { + if (this.paused) + { + return false; + } -},{"./plugin":9}],15:[function(require,module,exports){ + if (!this.checkKeyPress()) + { + return false; + } -/* - Copyright © 2001 Robert Penner - All rights reserved. + if (e.ctrlKey && this.options.trackpadPinch) + { + this.pinch(e); + } + else if (this.options.wheelZoom) + { + const point = this.parent.input.getPointerPosition(e); + const sign = this.options.reverse ? -1 : 1; + const step = sign * -e.deltaY * (e.deltaMode ? this.options.lineHeight : 1) / 500; + const change = Math.pow(2, (1 + this.options.percent) * step); - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: + if (this.options.smooth) + { + const original = { + x: this.smoothing ? this.smoothing.x * (this.options.smooth - (this.smoothingCount )) : 0, + y: this.smoothing ? this.smoothing.y * (this.options.smooth - (this.smoothingCount )) : 0 + }; - 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.smoothing = { + x: ((this.parent.scale.x + original.x) * change - this.parent.scale.x) / this.options.smooth, + y: ((this.parent.scale.y + original.y) * change - this.parent.scale.y) / this.options.smooth, + }; + this.smoothingCount = 0; + this.smoothingCenter = point; + } + else + { + let oldPoint; - Neither the name of the author nor the names of contributors may be used to endorse - or promote products derived from this software without specific prior written permission. + if (!this.options.center) + { + oldPoint = this.parent.toLocal(point); + } + if (this.isAxisX()) + { + this.parent.scale.x *= change; + } + if (this.isAxisY()) + { + this.parent.scale.y *= change; + } + this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); + const clamp = this.parent.plugins.get('clamp-zoom', true); - 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 OWNER 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. - */ + if (clamp) + { + clamp.clamp(); + } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); -(function() { - var penner, umd; + this.parent.x += point.x - newPoint.x; + this.parent.y += point.y - newPoint.y; + } + } - umd = function(factory) { - if (typeof exports === 'object') { - return module.exports = factory; - } else if (typeof define === 'function' && define.amd) { - return define([], factory); - } else { - return this.penner = factory; + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + this.parent.emit('wheel', + { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); + } + + return !this.parent.options.passiveWheel; + } } - }; - penner = { - linear: function(t, b, c, d) { - return c * t / d + b; - }, - easeInQuad: function(t, b, c, d) { - return c * (t /= d) * t + b; - }, - easeOutQuad: function(t, b, c, d) { - return -c * (t /= d) * (t - 2) + b; - }, - easeInOutQuad: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t + b; - } else { - return -c / 2 * ((--t) * (t - 2) - 1) + b; - } - }, - easeInCubic: function(t, b, c, d) { - return c * (t /= d) * t * t + b; - }, - easeOutCubic: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t + 1) + b; - }, - easeInOutCubic: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t + 2) + b; - } - }, - easeInQuart: function(t, b, c, d) { - return c * (t /= d) * t * t * t + b; - }, - easeOutQuart: function(t, b, c, d) { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - }, - easeInOutQuart: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t + b; - } else { - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - } - }, - easeInQuint: function(t, b, c, d) { - return c * (t /= d) * t * t * t * t + b; - }, - easeOutQuint: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - }, - easeInOutQuint: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - } - }, - easeInSine: function(t, b, c, d) { - return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; - }, - easeOutSine: function(t, b, c, d) { - return c * Math.sin(t / d * (Math.PI / 2)) + b; - }, - easeInOutSine: function(t, b, c, d) { - return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; - }, - easeInExpo: function(t, b, c, d) { - if (t === 0) { - return b; - } else { - return c * Math.pow(2, 10 * (t / d - 1)) + b; - } - }, - easeOutExpo: function(t, b, c, d) { - if (t === d) { - return b + c; - } else { - return c * (-Math.pow(2, -10 * t / d) + 1) + b; - } - }, - easeInOutExpo: function(t, b, c, d) { - if (t === 0) { - b; - } - if (t === d) { - b + c; - } - if ((t /= d / 2) < 1) { - return c / 2 * Math.pow(2, 10 * (t - 1)) + b; - } else { - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; - } - }, - easeInCirc: function(t, b, c, d) { - return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; - }, - easeOutCirc: function(t, b, c, d) { - return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; - }, - easeInOutCirc: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; - } else { - return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; - } - }, - easeInElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - }, - easeOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; - }, - easeInOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d / 2) === 2) { - b + c; - } - if (!p) { - p = d * (.3 * 1.5); - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - if (t < 1) { - return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - } else { - return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; - } - }, - easeInBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * (t /= d) * t * ((s + 1) * t - s) + b; - }, - easeOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - }, - easeInOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - if ((t /= d / 2) < 1) { - return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; - } else { - return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; - } - }, - easeInBounce: function(t, b, c, d) { - var v; - v = penner.easeOutBounce(d - t, 0, c, d); - return c - v + b; - }, - easeOutBounce: function(t, b, c, d) { - if ((t /= d) < 1 / 2.75) { - return c * (7.5625 * t * t) + b; - } else if (t < 2 / 2.75) { - return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; - } else if (t < 2.5 / 2.75) { - return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; - } else { - return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; - } - }, - easeInOutBounce: function(t, b, c, d) { - var v; - if (t < d / 2) { - v = penner.easeInBounce(t * 2, 0, c, d); - return v * .5 + b; - } else { - v = penner.easeOutBounce(t * 2 - d, 0, c, d); - return v * .5 + c * .5 + b; - } + /** + * Handles all input for Viewport + * + * @internal + * @ignore + * @private + */ + class InputManager + { + + + + + + + /** List of active touches on viewport */ + + + constructor(viewport) + { + this.viewport = viewport; + this.touches = []; + + this.addListeners(); + } + + /** Add input listeners */ + addListeners() + { + this.viewport.interactive = true; + if (!this.viewport.forceHitArea) + { + this.viewport.hitArea = new math.Rectangle(0, 0, this.viewport.worldWidth, this.viewport.worldHeight); + } + this.viewport.on('pointerdown', this.down, this); + this.viewport.on('pointermove', this.move, this); + this.viewport.on('pointerup', this.up, this); + this.viewport.on('pointerupoutside', this.up, this); + this.viewport.on('pointercancel', this.up, this); + this.viewport.on('pointerout', this.up, this); + this.wheelFunction = (e) => this.handleWheel(e); + this.viewport.options.divWheel.addEventListener( + 'wheel', + this.wheelFunction , + { passive: this.viewport.options.passiveWheel }); + this.isMouseDown = false; + } + + /** + * Removes all event listeners from viewport + * (useful for cleanup of wheel when removing viewport) + */ + destroy() + { + this.viewport.options.divWheel.removeEventListener('wheel', this.wheelFunction ); + } + + /** + * handle down events for viewport + * + * @param {PIXI.InteractionEvent} event + */ + down(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + if (event.data.pointerType === 'mouse') + { + this.isMouseDown = true; + } + else if (!this.get(event.data.pointerId)) + { + this.touches.push({ id: event.data.pointerId, last: null }); + } + if (this.count() === 1) + { + this.last = event.data.global.clone(); + + // clicked event does not fire if viewport is decelerating or bouncing + const decelerate = this.viewport.plugins.get('decelerate', true); + const bounce = this.viewport.plugins.get('bounce', true); + + if ((!decelerate || !decelerate.isActive()) && (!bounce || !bounce.isActive())) + { + this.clickedAvailable = true; + } + else + { + this.clickedAvailable = false; + } + } + else + { + this.clickedAvailable = false; + } + + const stop = this.viewport.plugins.down(event); + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Clears all pointer events */ + clear() + { + this.isMouseDown = false; + this.touches = []; + this.last = null; + } + + /** + * @param {number} change + * @returns whether change exceeds threshold + */ + checkThreshold(change) + { + if (Math.abs(change) >= this.viewport.threshold) + { + return true; + } + + return false; + } + + /** Handle move events for viewport */ + move(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + const stop = this.viewport.plugins.move(event); + + if (this.clickedAvailable && this.last) + { + const distX = event.data.global.x - this.last.x; + const distY = event.data.global.y - this.last.y; + + if (this.checkThreshold(distX) || this.checkThreshold(distY)) + { + this.clickedAvailable = false; + } + } + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Handle up events for viewport */ + up(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + if (event.data.pointerType === 'mouse') + { + this.isMouseDown = false; + } + + if (event.data.pointerType !== 'mouse') + { + this.remove(event.data.pointerId); + } + + const stop = this.viewport.plugins.up(event); + + if (this.clickedAvailable && this.count() === 0 && this.last) + { + this.viewport.emit('clicked', { + event, + screen: this.last, + world: this.viewport.toWorld(this.last), + viewport: this + }); + this.clickedAvailable = false; + } + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Gets pointer position if this.interaction is set */ + getPointerPosition(event) + { + const point = new math.Point(); + + if (this.viewport.options.interaction) + { + this.viewport.options.interaction.mapPositionToPoint(point, event.clientX, event.clientY); + } + else if (this.viewport.options.useDivWheelForInputManager && this.viewport.options.divWheel) + { + const rect = this.viewport.options.divWheel.getBoundingClientRect(); + + point.x = event.clientX - rect.left; + point.y = event.clientY - rect.top; + } + else + { + point.x = event.clientX; + point.y = event.clientY; + } + + return point; + } + + /** Handle wheel events */ + handleWheel(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + // do not handle events coming from other elements + if (this.viewport.options.interaction + && (this.viewport.options.interaction ).interactionDOMElement !== event.target) + { + return; + } + + // only handle wheel events where the mouse is over the viewport + const point = this.viewport.toLocal(this.getPointerPosition(event)); + + if (this.viewport.left <= point.x + && point.x <= this.viewport.right + && this.viewport.top <= point.y + && point.y <= this.viewport.bottom) + { + const stop = this.viewport.plugins.wheel(event); + + if (stop && !this.viewport.options.passiveWheel) + { + event.preventDefault(); + } + } + } + + pause() + { + this.touches = []; + this.isMouseDown = false; + } + + /** Get touch by id */ + get(id) + { + for (const touch of this.touches) + { + if (touch.id === id) + { + return touch; + } + } + + return null; + } + + /** Remove touch by number */ + remove(id) + { + for (let i = 0; i < this.touches.length; i++) + { + if (this.touches[i].id === id) + { + this.touches.splice(i, 1); + + return; + } + } + } + + /** + * @returns {number} count of mouse/touch pointers that are down on the viewport + */ + count() + { + return (this.isMouseDown ? 1 : 0) + this.touches.length; + } } - }; - umd(penner); + function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } -}).call(this); -},{}]},{},[13]); + + + + + + + + + + + + + + + + const PLUGIN_ORDER = [ + 'drag', + 'pinch', + 'wheel', + 'follow', + 'mouse-edges', + 'decelerate', + 'animate', + 'bounce', + 'snap-zoom', + 'clamp-zoom', + 'snap', + 'clamp', + ]; + + /** + * Use this to access current plugins or add user-defined plugins + * + * @public + */ + class PluginManager + { + /** Maps mounted plugins by their type */ + + + /** + * List of plugins mounted + * + * This list is kept sorted by the internal priority of plugins (hard-coded). + */ + + + /** The viewport using the plugins managed by `this`. */ + + + /** This is called by {@link Viewport} to initialize the {@link Viewport.plugins plugins}. */ + constructor(viewport) + { + this.viewport = viewport; + this.list = []; + this.plugins = {}; + } + + /** + * Inserts a named plugin or a user plugin into the viewport + * default plugin order: 'drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', + * 'snap-zoom', 'clamp-zoom', 'snap', 'clamp' + * + * @param {string} name of plugin + * @param {Plugin} plugin - instantiated Plugin class + * @param {number} index to insert userPlugin (otherwise inserts it at the end) + */ + add(name, plugin, index = PLUGIN_ORDER.length) + { + this.plugins[name] = plugin; + + const current = PLUGIN_ORDER.indexOf(name); + + if (current !== -1) + { + PLUGIN_ORDER.splice(current, 1); + } + + PLUGIN_ORDER.splice(index, 0, name); + this.sort(); + } + + + + + + + + + + + + + + + + /** + * Get plugin + * + * @param {string} name of plugin + * @param {boolean} [ignorePaused] return null if plugin is paused + */ + get(name, ignorePaused) + { + if (ignorePaused) + { + if (_optionalChain([this, 'access', _ => _.plugins, 'access', _2 => _2[name], 'optionalAccess', _3 => _3.paused])) + { + return null; + } + } + + return this.plugins[name] ; + } + + /** + * Update all active plugins + * + * @internal + * @ignore + * @param {number} elapsed type in milliseconds since last update + */ + update(elapsed) + { + for (const plugin of this.list) + { + plugin.update(elapsed); + } + } + + /** + * Resize all active plugins + * + * @internal + * @ignore + */ + resize() + { + for (const plugin of this.list) + { + plugin.resize(); + } + } + + /** Clamps and resets bounce and decelerate (as needed) after manually moving viewport */ + reset() + { + for (const plugin of this.list) + { + plugin.reset(); + } + } + + /** removes all installed plugins */ + removeAll() + { + this.plugins = {}; + this.sort(); + } + + /** + * Removes installed plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + remove(name) + { + if (this.plugins[name]) + { + delete this.plugins[name]; + this.viewport.emit(`${name}-remove`); + this.sort(); + } + } + + /** + * Pause plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + pause(name) + { + _optionalChain([this, 'access', _4 => _4.plugins, 'access', _5 => _5[name], 'optionalAccess', _6 => _6.pause, 'call', _7 => _7()]); + } + + /** + * Resume plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + resume(name) + { + _optionalChain([this, 'access', _8 => _8.plugins, 'access', _9 => _9[name], 'optionalAccess', _10 => _10.resume, 'call', _11 => _11()]); + } + + /** + * Sort plugins according to PLUGIN_ORDER + * + * @internal + * @ignore + */ + sort() + { + this.list = []; + + for (const plugin of PLUGIN_ORDER) + { + if (this.plugins[plugin]) + { + this.list.push(this.plugins[plugin] ); + } + } + } + + /** + * Handle down for all plugins + * + * @internal + * @ignore + */ + down(event) + { + let stop = false; + + for (const plugin of this.list) + { + if (plugin.down(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle move for all plugins + * + * @internal + * @ignore + */ + move(event) + { + let stop = false; + + for (const plugin of this.viewport.plugins.list) + { + if (plugin.move(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle up for all plugins + * + * @internal + * @ignore + */ + up(event) + { + let stop = false; + + for (const plugin of this.list) + { + if (plugin.up(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle wheel event for all plugins + * + * @internal + * @ignore + */ + wheel(e) + { + let result = false; + + for (const plugin of this.list) + { + if (plugin.wheel(e)) + { + result = true; + } + } + + return result; + } + } + + /** Options for {@link Viewport}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_VIEWPORT_OPTIONS = { + screenWidth: window.innerWidth, + screenHeight: window.innerHeight, + worldWidth: null, + worldHeight: null, + threshold: 5, + passiveWheel: true, + stopPropagation: false, + forceHitArea: null, + noTicker: false, + interaction: null, + disableOnContextMenu: false, + ticker: ticker.Ticker.shared, + }; + + /** + * Main class to use when creating a Viewport + * + * @public + * @fires clicked + * @fires drag-start + * @fires drag-end + * @fires drag-remove + * @fires pinch-start + * @fires pinch-end + * @fires pinch-remove + * @fires snap-start + * @fires snap-end + * @fires snap-remove + * @fires snap-zoom-start + * @fires snap-zoom-end + * @fires snap-zoom-remove + * @fires bounce-x-start + * @fires bounce-x-end + * @fires bounce-y-start + * @fires bounce-y-end + * @fires bounce-remove + * @fires wheel + * @fires wheel-remove + * @fires wheel-scroll + * @fires wheel-scroll-remove + * @fires mouse-edge-start + * @fires mouse-edge-end + * @fires mouse-edge-remove + * @fires moved + * @fires moved-end + * @fires zoomed + * @fires zoomed-end + * @fires frame-end + */ + class Viewport extends display.Container + { + /** Flags whether the viewport is being panned */ + + + + + + /** Number of pixels to move to trigger an input event (e.g., drag, pinch) or disable a clicked event */ + + + + + /** Use this to add user plugins or access existing plugins (e.g., to pause, resume, or remove them) */ + + + /** Flags whether the viewport zoom is being changed. */ + + + + + /** The options passed when creating this viewport, merged with the default values */ + + + + + + + + + + __init() {this._disableOnContextMenu = (e) => e.preventDefault();} + + /** + * @param {IViewportOptions} ViewportOptions + * @param {number} [options.screenWidth=window.innerWidth] + * @param {number} [options.screenHeight=window.innerHeight] + * @param {number} [options.worldWidth=this.width] + * @param {number} [options.worldHeight=this.height] + * @param {number} [options.threshold=5] number of pixels to move to trigger an input event (e.g., drag, pinch) + * or disable a clicked event + * @param {boolean} [options.passiveWheel=true] whether the 'wheel' event is set to passive (note: if false, + * e.preventDefault() will be called when wheel is used over the viewport) + * @param {boolean} [options.stopPropagation=false] whether to stopPropagation of events that impact the viewport + * (except wheel events, see options.passiveWheel) + * @param {HitArea} [options.forceHitArea] change the default hitArea from world size to a new value + * @param {boolean} [options.noTicker] set this if you want to manually call update() function on each frame + * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.ticker for updates + * @param {PIXI.InteractionManager} [options.interaction=null] InteractionManager, available from instantiated + * WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer position relative to canvas + * location on screen + * @param {HTMLElement} [options.divWheel=document.body] div to attach the wheel event + * @param {boolean} [options.disableOnContextMenu] remove oncontextmenu=() => {} from the divWheel element + */ + constructor(options = {}) + { + super();Viewport.prototype.__init.call(this);; + this.options = Object.assign( + {}, + { divWheel: document.body }, + DEFAULT_VIEWPORT_OPTIONS, + options + ); + + this.screenWidth = this.options.screenWidth; + this.screenHeight = this.options.screenHeight; + + this._worldWidth = this.options.worldWidth; + this._worldHeight = this.options.worldHeight; + this.forceHitArea = this.options.forceHitArea; + this.threshold = this.options.threshold; + + this.options.divWheel = this.options.divWheel || document.body; + + if (this.options.disableOnContextMenu) + { + this.options.divWheel.addEventListener('contextmenu', this._disableOnContextMenu); + } + if (!this.options.noTicker) + { + this.tickerFunction = () => this.update(this.options.ticker.elapsedMS); + this.options.ticker.add(this.tickerFunction); + } + + this.input = new InputManager(this); + this.plugins = new PluginManager(this); + } + + /** Overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners */ + destroy(options) + { + if (!this.options.noTicker && this.tickerFunction) + { + this.options.ticker.remove(this.tickerFunction); + } + if (this.options.disableOnContextMenu) + { + this.options.divWheel.removeEventListener('contextmenu', this._disableOnContextMenu); + } + + this.input.destroy(); + super.destroy(options); + } + + /** + * Update viewport on each frame. + * + * By default, you do not need to call this unless you set `options.noTicker=true`. + * + * @param {number} elapsed time in milliseconds since last update + */ + update(elapsed) + { + if (!this.pause) + { + this.plugins.update(elapsed); + + if (this.lastViewport) + { + // Check for moved-end event + if (this.lastViewport.x !== this.x || this.lastViewport.y !== this.y) + { + this.moving = true; + } + else if (this.moving) + { + this.emit('moved-end', this); + this.moving = false; + } + + // Check for zoomed-end event + if (this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y) + { + this.zooming = true; + } + else if (this.zooming) + { + this.emit('zoomed-end', this); + this.zooming = false; + } + } + + if (!this.forceHitArea) + { + this._hitAreaDefault = new math.Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight); + this.hitArea = this._hitAreaDefault; + } + + this._dirty = this._dirty || !this.lastViewport + || this.lastViewport.x !== this.x || this.lastViewport.y !== this.y + || this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y; + + this.lastViewport = { + x: this.x, + y: this.y, + scaleX: this.scale.x, + scaleY: this.scale.y + }; + this.emit('frame-end', this); + } + } + + /** + * Use this to set screen and world sizes, needed for pinch/wheel/clamp/bounce. + * @param {number} screenWidth=window.innerWidth + * @param {number} screenHeight=window.innerHeight + * @param {number} [worldWidth] + * @param {number} [worldHeight] + */ + resize( + screenWidth = window.innerWidth, + screenHeight = window.innerHeight, + worldWidth, + worldHeight + ) + { + this.screenWidth = screenWidth; + this.screenHeight = screenHeight; + + if (typeof worldWidth !== 'undefined') + { + this._worldWidth = worldWidth; + } + if (typeof worldHeight !== 'undefined') + { + this._worldHeight = worldHeight; + } + + this.plugins.resize(); + this.dirty = true; + } + + /** World width, in pixels */ + get worldWidth() + { + if (this._worldWidth) + { + return this._worldWidth; + } + + return this.width / this.scale.x; + } + set worldWidth(value) + { + this._worldWidth = value; + this.plugins.resize(); + } + + /** World height, in pixels */ + get worldHeight() + { + if (this._worldHeight) + { + return this._worldHeight; + } + + return this.height / this.scale.y; + } + set worldHeight(value) + { + this._worldHeight = value; + this.plugins.resize(); + } + + /** Get visible world bounds of viewport */ + getVisibleBounds() + { + return new math.Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight); + } + + /** Change coordinates from screen to world */ + + + + + /** + * Changes coordinate from screen to world + * @param {number|PIXI.Point} x + * @param {number} y + * @returns {PIXI.Point} + */ + toWorld(x, y) + { + if (arguments.length === 2) + { + return this.toLocal(new math.Point(x , y)); + } + + return this.toLocal(x ); + } + + /** Change coordinates from world to screen */ + + + + + /** + * Changes coordinate from world to screen + * @param {number|PIXI.Point} x + * @param {number} y + * @returns {PIXI.Point} + */ + toScreen(x, y) + { + if (arguments.length === 2) + { + return this.toGlobal(new math.Point(x , y)); + } + + return this.toGlobal(x ); + } + + /** Screen width in world coordinates */ + get worldScreenWidth() + { + return this.screenWidth / this.scale.x; + } + + /** Screen height in world coordinates */ + get worldScreenHeight() + { + return this.screenHeight / this.scale.y; + } + + /** World width in screen coordinates */ + get screenWorldWidth() + { + return this.worldWidth * this.scale.x; + } + + /** World height in screen coordinates */ + get screenWorldHeight() + { + return this.worldHeight * this.scale.y; + } + + /** Center of screen in world coordinates */ + get center() + { + return new math.Point( + (this.worldScreenWidth / 2) - (this.x / this.scale.x), + (this.worldScreenHeight / 2) - (this.y / this.scale.y), + ); + } + set center(value) + { + this.moveCenter(value); + } + + + + + + + /** + * Move center of viewport to (x, y) + * @param {number|PIXI.Point} x + * @param {number} [y] + * @return {Viewport} + */ + moveCenter(...args) + { + let x; + let y; + + if (typeof args[0] === 'number') + { + x = args[0]; + y = args[1] ; + } + else + { + x = args[0].x; + y = args[0].y; + } + + const newX = ((this.worldScreenWidth / 2) - x) * this.scale.x; + const newY = ((this.worldScreenHeight / 2) - y) * this.scale.y; + + if (this.x !== newX || this.y !== newY) + { + this.position.set(newX, newY); + this.plugins.reset(); + this.dirty = true; + } + + return this; + } + + /** Top-left corner of Viewport */ + get corner() + { + return new math.Point(-this.x / this.scale.x, -this.y / this.scale.y); + } + set corner(value) + { + this.moveCorner(value); + } + + /** Move Viewport's top-left corner; also clamps and resets decelerate and bounce (as needed) */ + + + + + + /** + * MoveCorner + * @param {number|PIXI.Point} x + * @param {number} [y] + * @returns {Viewport} + */ + moveCorner(...args) + { + let x; + let y; + + if (args.length === 1) + { + x = -args[0].x * this.scale.x; + y = -args[0].y * this.scale.y; + } + else + { + x = -args[0] * this.scale.x; + y = -args[1] * this.scale.y; + } + + if (x !== this.x || y !== this.y) + { + this.position.set(x, y); + this.plugins.reset(); + this.dirty = true; + } + + return this; + } + + /** Get how many world pixels fit in screen's width */ + get screenWidthInWorldPixels() + { + return this.screenWidth / this.scale.x; + } + + /** Get how many world pixels fit on screen's height */ + get screenHeightInWorldPixels() + { + return this.screenHeight / this.scale.y; + } + + /** + * Find the scale value that fits a world width on the screen + * does not change the viewport (use fit... to change) + * + * @param width - Width in world pixels + * @return - scale + */ + findFitWidth(width) + { + return this.screenWidth / width; + } + + /** + * Finds the scale value that fits a world height on the screens + * does not change the viewport (use fit... to change) + * + * @param height - Height in world pixels + * @return - scale + */ + findFitHeight(height) + { + return this.screenHeight / height; + } + + /** + * Finds the scale value that fits the smaller of a world width and world height on the screen + * does not change the viewport (use fit... to change) + * + * @param {number} width in world pixels + * @param {number} height in world pixels + * @returns {number} scale + */ + findFit(width, height) + { + const scaleX = this.screenWidth / width; + const scaleY = this.screenHeight / height; + + return Math.min(scaleX, scaleY); + } + + /** + * Finds the scale value that fits the larger of a world width and world height on the screen + * does not change the viewport (use fit... to change) + * + * @param {number} width in world pixels + * @param {number} height in world pixels + * @returns {number} scale + */ + findCover(width, height) + { + const scaleX = this.screenWidth / width; + const scaleY = this.screenHeight / height; + + return Math.max(scaleX, scaleY); + } + + /** + * Change zoom so the width fits in the viewport + * + * @param width - width in world coordinates + * @param center - maintain the same center + * @param scaleY - whether to set scaleY=scaleX + * @param noClamp - whether to disable clamp-zoom + * @returns {Viewport} this + */ + fitWidth(width = this.worldWidth, center, scaleY = true, noClamp) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.x = this.screenWidth / width; + + if (scaleY) + { + this.scale.y = this.scale.x; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (!noClamp && clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so the height fits in the viewport + * + * @param {number} [height=this.worldHeight] in world coordinates + * @param {boolean} [center] maintain the same center of the screen after zoom + * @param {boolean} [scaleX=true] whether to set scaleX = scaleY + * @param {boolean} [noClamp] whether to disable clamp-zoom + * @returns {Viewport} this + */ + fitHeight(height = this.worldHeight, center, scaleX = true, noClamp) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.y = this.screenHeight / height; + + if (scaleX) + { + this.scale.x = this.scale.y; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (!noClamp && clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so it fits the entire world in the viewport + * + * @param {boolean} center maintain the same center of the screen after zoom + * @returns {Viewport} this + */ + fitWorld(center) + { + let save; + + if (center) + { + save = this.center; + } + + this.scale.x = this.screenWidth / this.worldWidth; + this.scale.y = this.screenHeight / this.worldHeight; + + if (this.scale.x < this.scale.y) + { + this.scale.y = this.scale.x; + } + else + { + this.scale.x = this.scale.y; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so it fits the size or the entire world in the viewport + * + * @param {boolean} [center] maintain the same center of the screen after zoom + * @param {number} [width=this.worldWidth] desired width + * @param {number} [height=this.worldHeight] desired height + * @returns {Viewport} this + */ + fit(center, width = this.worldWidth, height = this.worldHeight) + { + let save; + + if (center) + { + save = this.center; + } + + this.scale.x = this.screenWidth / width; + this.scale.y = this.screenHeight / height; + + if (this.scale.x < this.scale.y) + { + this.scale.y = this.scale.x; + } + else + { + this.scale.x = this.scale.y; + } + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Zoom viewport to specific value. + * + * @param {number} scale value (e.g., 1 would be 100%, 0.25 would be 25%) + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + setZoom(scale, center) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.set(scale); + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Zoom viewport by a certain percent (in both x and y direction). + * + * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25) + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + zoomPercent(percent, center) + { + return this.setZoom(this.scale.x + (this.scale.x * percent), center); + } + + /** + * Zoom viewport by increasing/decreasing width by a certain number of pixels. + * + * @param {number} change in pixels + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + zoom(change, center) + { + this.fitWidth(change + this.worldScreenWidth, center); + + return this; + } + + /** Changes scale of viewport and maintains center of viewport */ + get scaled() + { + return this.scale.x; + } + set scaled(scale) + { + this.setZoom(scale, true); + } + + /** + * Returns zoom to the desired scale + * + * @param {ISnapZoomOptions} options + * @param {number} [options.width=0] - the desired width to snap (to maintain aspect ratio, choose width or height) + * @param {number} [options.height=0] - the desired height to snap (to maintain aspect ratio, choose width or height) + * @param {number} [options.time=1000] - time for snapping in ms + * @param {(string|function)} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ + * for supported names) + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of center of the viewport + * @param {boolean} [options.interrupt=true] - pause snapping with any user input on the viewport + * @param {boolean} [options.removeOnComplete] - removes this plugin after snapping is complete + * @param {boolean} [options.removeOnInterrupt] - removes this plugin if interrupted by any user input + * @param {boolean} [options.forceStart] - starts the snap immediately regardless of whether the viewport is at the + * desired zoom + * @param {boolean} [options.noMove] - zoom but do not move + */ + snapZoom(options) + { + this.plugins.add('snap-zoom', new SnapZoom(this, options)); + + return this; + } + + /** Is container out of world bounds */ + OOB() + + + + + + + { + return { + left: this.left < 0, + right: this.right > this.worldWidth, + top: this.top < 0, + bottom: this.bottom > this.worldHeight, + cornerPoint: new math.Point( + (this.worldWidth * this.scale.x) - this.screenWidth, + (this.worldHeight * this.scale.y) - this.screenHeight + ) + }; + } + + /** World coordinates of the right edge of the screen */ + get right() + { + return (-this.x / this.scale.x) + this.worldScreenWidth; + } + set right(value) + { + this.x = (-value * this.scale.x) + this.screenWidth; + this.plugins.reset(); + } + + /** World coordinates of the left edge of the screen */ + get left() + { + return -this.x / this.scale.x; + } + set left(value) + { + this.x = -value * this.scale.x; + this.plugins.reset(); + } + + /** World coordinates of the top edge of the screen */ + get top() + { + return -this.y / this.scale.y; + } + set top(value) + { + this.y = -value * this.scale.y; + this.plugins.reset(); + } + + /** World coordinates of the bottom edge of the screen */ + get bottom() + { + return (-this.y / this.scale.y) + this.worldScreenHeight; + } + set bottom(value) + { + this.y = (-value * this.scale.y) + this.screenHeight; + this.plugins.reset(); + } + + /** + * Determines whether the viewport is dirty (i.e., needs to be rendered to the screen because of a change) + */ + get dirty() + { + return !!this._dirty; + } + set dirty(value) + { + this._dirty = value; + } + + /** + * Permanently changes the Viewport's hitArea + * + * NOTE: if not set then hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, + * Viewport.worldScreenHeight) + */ + get forceHitArea() + { + return this._forceHitArea; + } + set forceHitArea(value) + { + if (value) + { + this._forceHitArea = value; + this.hitArea = value; + } + else + { + this._forceHitArea = null; + this.hitArea = new math.Rectangle(0, 0, this.worldWidth, this.worldHeight); + } + } + + /** + * Enable one-finger touch to drag + * + * NOTE: if you expect users to use right-click dragging, you should enable `viewport.options.disableOnContextMenu` + * to avoid the context menu popping up on each right-click drag. + * + * @param {IDragOptions} [options] + * @param {string} [options.direction=all] direction to drag + * @param {boolean} [options.pressDrag=true] whether click to drag is active + * @param {boolean} [options.wheel=true] use wheel to scroll in direction (unless wheel plugin is active) + * @param {number} [options.wheelScroll=1] number of pixels to scroll with each wheel spin + * @param {boolean} [options.reverse] reverse the direction of the wheel scroll + * @param {(boolean|string)} [options.clampWheel=false] clamp wheel(to avoid weird bounce with mouse wheel) + * @param {string} [options.underflow=center] where to place world if too small for screen + * @param {number} [options.factor=1] factor to multiply drag to increase the speed of movement + * @param {string} [options.mouseButtons=all] changes which mouse buttons trigger drag, use: 'all', 'left', + * 'right' 'middle', or some combination, like, 'middle-right'; you may want to set + * viewport.options.disableOnContextMenu if you want to use right-click dragging + * @param {string[]} [options.keyToPress=null] - array containing + * {@link key|https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code} codes of keys that can be + * pressed for the drag to be triggered, e.g.: ['ShiftLeft', 'ShiftRight'}. + * @param {boolean} [options.ignoreKeyToPressOnTouch=false] - ignore keyToPress for touch events + * @param {number} [options.lineHeight=20] - scaling factor for non-DOM_DELTA_PIXEL scrolling events + * @returns {Viewport} this + */ + drag(options) + { + this.plugins.add('drag', new Drag(this, options)); + + return this; + } + + /** + * Clamp to world boundaries or other provided boundaries + * There are three ways to clamp: + * 1. direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of offscreen + * direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary + * 2. left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side; + * if any of these are set to true, then the location is set to the boundary + * [0, viewport.worldWidth/viewport.worldHeight], eg: to allow the world to be completely dragged offscreen, + * set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2] + * + * Underflow determines what happens when the world is smaller than the viewport + * 1. none = the world is clamped but there is no special behavior + * 2. center = the world is centered on the viewport + * 3. combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the + * appropriate boundaries + * + * NOTES: + * clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping + * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly + * + * @param {object} [options] + * @param {(number|boolean)} [options.left=false] - clamp left; true = 0 + * @param {(number|boolean)} [options.right=false] - clamp right; true = viewport.worldWidth + * @param {(number|boolean)} [options.top=false] - clamp top; true = 0 + * @param {(number|boolean)} [options.bottom=false] - clamp bottom; true = viewport.worldHeight + * @param {string} [direction] - (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; + * replaces left/right/top/bottom if set + * @param {string} [underflow=center] - where to place world if too small for screen (e.g., top-right, center, + * none, bottomLeft) * @returns {Viewport} this + */ + clamp(options) + { + this.plugins.add('clamp', new Clamp(this, options)); + + return this; + } + + /** + * Decelerate after a move + * + * NOTE: this fires 'moved' event during deceleration + * + * @param {IDecelerateOptions} [options] + * @param {number} [options.friction=0.95] - percent to decelerate after movement + * @param {number} [options.bounce=0.8] - percent to decelerate when past boundaries (only applicable when + * viewport.bounce() is active) + * @param {number} [options.minSpeed=0.01] - minimum velocity before stopping/reversing acceleration + * @return {Viewport} this + */ + decelerate(options) + { + this.plugins.add('decelerate', new Decelerate(this, options)); + + return this; + } + + /** + * Bounce on borders + * NOTES: + * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly + * fires 'moved', 'bounce-x-start', 'bounce-y-start', 'bounce-x-end', and 'bounce-y-end' events + * @param {object} [options] + * @param {string} [options.sides=all] - all, horizontal, vertical, or combination of top, bottom, right, left + * (e.g., 'top-bottom-right') + * @param {number} [options.friction=0.5] - friction to apply to decelerate if active + * @param {number} [options.time=150] - time in ms to finish bounce + * @param {object} [options.bounceBox] - use this bounceBox instead of (0, 0, viewport.worldWidth, viewport.worldHeight) + * @param {number} [options.bounceBox.x=0] + * @param {number} [options.bounceBox.y=0] + * @param {number} [options.bounceBox.width=viewport.worldWidth] + * @param {number} [options.bounceBox.height=viewport.worldHeight] + * @param {string|function} [options.ease=easeInOutSine] - ease function or name + * (see http://easings.net/ for supported names) + * @param {string} [options.underflow=center] - (top/bottom/center and left/right/center, or center) + * where to place world if too small for screen + * @return {Viewport} this + */ + bounce(options) + { + this.plugins.add('bounce', new Bounce(this, options)); + + return this; + } + + /** + * Enable pinch to zoom and two-finger touch to drag + * + * @param {PinchOptions} [options] + * @param {boolean} [options.noDrag] - disable two-finger dragging + * @param {number} [options.percent=1] - percent to modify pinch speed + * @param {number} [options.factor=1] - factor to multiply two-finger drag to increase the speed of movement + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of center of two fingers + * @param {('all'|'x'|'y')} [options.axis=all] - axis to zoom + * @return {Viewport} this + */ + pinch(options) + { + this.plugins.add('pinch', new Pinch(this, options)); + + return this; + } + + /** + * Snap to a point + * + * @param {number} x + * @param {number} y + * @param {ISnapOptions} [options] + * @param {boolean} [options.topLeft] - snap to the top-left of viewport instead of center + * @param {number} [options.friction=0.8] - friction/frame to apply if decelerate is active + * @param {number} [options.time=1000] - time in ms to snap + * @param {string|function} [options.ease=easeInOutSine] - ease function or name (see http://easings.net/ + * for supported names) + * @param {boolean} [options.interrupt=true] - pause snapping with any user input on the viewport + * @param {boolean} [options.removeOnComplete] - removes this plugin after snapping is complete + * @param {boolean} [options.removeOnInterrupt] - removes this plugin if interrupted by any user input + * @param {boolean} [options.forceStart] - starts the snap immediately regardless of whether the viewport is at + * the desired location + * @return {Viewport} this + */ + snap(x, y, options) + { + this.plugins.add('snap', new Snap(this, x, y, options)); + + return this; + } + + /** + * Follow a target + * + * NOTES: + * uses the (x, y) as the center to follow; for PIXI.Sprite to work properly, use sprite.anchor.set(0.5) + * options.acceleration is not perfect as it doesn't know the velocity of the target. It adds acceleration + * to the start of movement and deceleration to the end of movement when the target is stopped. + * To cancel the follow, use: `viewport.plugins.remove('follow')` + * + * @fires 'moved' event + * + * @param {PIXI.DisplayObject} target to follow + * @param {IFollowOptions} [options] + * @param {number} [options.speed=0] - to follow in pixels/frame (0=teleport to location) + * @param {number} [options.acceleration] - set acceleration to accelerate and decelerate at this rate; speed + * cannot be 0 to use acceleration + * @param {number} [options.radius] - radius (in world coordinates) of center circle where movement is allowed + * without moving the viewport * @returns {Viewport} this + * @returns {Viewport} this + */ + follow(target, options) + { + this.plugins.add('follow', new Follow(this, target, options)); + + return this; + } + + /** + * Zoom using mouse wheel + * + * NOTE: the default event listener for 'wheel' event is document.body. Use `Viewport.options.divWheel` to + * change this default + * + * @param {IWheelOptions} [options] + * @param {number} [options.percent=0.1] - percent to scroll with each spin + * @param {number} [options.smooth] - smooth the zooming by providing the number of frames to zoom between wheel spins + * @param {boolean} [options.interrupt=true] - stop smoothing with any user input on the viewport + * @param {boolean} [options.reverse] - reverse the direction of the scroll + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of current mouse position + * @param {number} [options.lineHeight=20] - scaling factor for non-DOM_DELTA_PIXEL scrolling events + * @param {('all'|'x'|'y')} [options.axis=all] - axis to zoom + * @return {Viewport} this + */ + wheel(options) + { + this.plugins.add('wheel', new Wheel(this, options)); + + return this; + } + + /** + * Animate the position and/or scale of the viewport + * To set the zoom level, use: (1) scale, (2) scaleX and scaleY, or (3) width and/or height + * @param {object} options + * @param {number} [options.time=1000] - time to animate + * @param {PIXI.Point} [options.position=viewport.center] - position to move viewport + * @param {number} [options.width] - desired viewport width in world pixels (use instead of scale; + * aspect ratio is maintained if height is not provided) + * @param {number} [options.height] - desired viewport height in world pixels (use instead of scale; + * aspect ratio is maintained if width is not provided) + * @param {number} [options.scale] - scale to change zoom (scale.x = scale.y) + * @param {number} [options.scaleX] - independently change zoom in x-direction + * @param {number} [options.scaleY] - independently change zoom in y-direction + * @param {(function|string)} [options.ease=linear] - easing function to use + * @param {function} [options.callbackOnComplete] + * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input + * @returns {Viewport} this + */ + animate(options) + { + this.plugins.add('animate', new Animate(this, options)); + + return this; + } + + /** + * Enable clamping of zoom to constraints + * + * The minWidth/Height settings are how small the world can get (as it would appear on the screen) + * before clamping. The maxWidth/maxHeight is how larger the world can scale (as it would appear on + * the screen) before clamping. + * + * For example, if you have a world size of 1000 x 1000 and a screen size of 100 x 100, if you set + * minWidth/Height = 100 then the world will not be able to zoom smaller than the screen size (ie, + * zooming out so it appears smaller than the screen). Similarly, if you set maxWidth/Height = 100 + * the world will not be able to zoom larger than the screen size (ie, zooming in so it appears + * larger than the screen). + * + * @param {object} [options] + * @param {number} [options.minWidth] - minimum width + * @param {number} [options.minHeight] - minimum height + * @param {number} [options.maxWidth] - maximum width + * @param {number} [options.maxHeight] - maximum height + * @param {number} [options.minScale] - minimum scale + * @param {number} [options.maxScale] - minimum scale + * @return {Viewport} this + */ + clampZoom(options) + { + this.plugins.add('clamp-zoom', new ClampZoom(this, options)); + + return this; + } + + /** + * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen. + * + * NOTES: fires 'moved' event; there's a known bug where the mouseEdges does not work properly with "windowed" viewports + * + * @param {IMouseEdgesOptions} [options] + * @param {number} [options.radius] - distance from center of screen in screen pixels + * @param {number} [options.distance] - distance from all sides in screen pixels + * @param {number} [options.top] - alternatively, set top distance (leave unset for no top scroll) + * @param {number} [options.bottom] - alternatively, set bottom distance (leave unset for no top scroll) + * @param {number} [options.left] - alternatively, set left distance (leave unset for no top scroll) + * @param {number} [options.right] - alternatively, set right distance (leave unset for no top scroll) + * @param {number} [options.speed=8] - speed in pixels/frame to scroll viewport + * @param {boolean} [options.reverse] - reverse direction of scroll + * @param {boolean} [options.noDecelerate] - don't use decelerate plugin even if it's installed + * @param {boolean} [options.linear] - if using radius, use linear movement (+/- 1, +/- 1) instead of angled + * movement (Math.cos(angle from center), Math.sin(angle from center)) + * @param {boolean} [options.allowButtons] allows plugin to continue working even when there's a mousedown event + */ + mouseEdges(options) + { + this.plugins.add('mouse-edges', new MouseEdges(this, options)); + + return this; + } + + /** Pause viewport (including animation updates such as decelerate) */ + get pause() + { + return !!this._pause; + } + set pause(value) + { + this._pause = value; + + this.lastViewport = null; + this.moving = false; + this.zooming = false; + + if (value) + { + this.input.pause(); + } + } + + /** + * Move the viewport so the bounding box is visible + * + * @param x - left + * @param y - top + * @param width + * @param height + * @param resizeToFit - Resize the viewport so the box fits within the viewport + */ + ensureVisible(x, y, width, height, resizeToFit) + { + if (resizeToFit && (width > this.worldScreenWidth || height > this.worldScreenHeight)) + { + this.fit(true, width, height); + this.emit('zoomed', { viewport: this, type: 'ensureVisible' }); + } + let moved = false; + + if (x < this.left) + { + this.left = x; + moved = true; + } + else if (x + width > this.right) + { + this.right = x + width; + moved = true; + } + if (y < this.top) + { + this.top = y; + moved = true; + } + else if (y + height > this.bottom) + { + this.bottom = y + height; + moved = true; + } + if (moved) + { + this.emit('moved', { viewport: this, type: 'ensureVisible' }); + } + } + } + + /** + * Fires after a mouse or touch click + * @event Viewport#clicked + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a drag starts + * @event Viewport#drag-start + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a drag ends + * @event Viewport#drag-end + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a pinch starts + * @event Viewport#pinch-start + * @type {Viewport} + */ + + /** + * Fires when a pinch end + * @event Viewport#pinch-end + * @type {Viewport} + */ + + /** + * Fires when a snap starts + * @event Viewport#snap-start + * @type {Viewport} + */ + + /** + * Fires when a snap ends + * @event Viewport#snap-end + * @type {Viewport} + */ + + /** + * Fires when a snap-zoom starts + * @event Viewport#snap-zoom-start + * @type {Viewport} + */ + + /** + * Fires when a snap-zoom ends + * @event Viewport#snap-zoom-end + * @type {Viewport} + */ + + /** + * Fires when a bounce starts in the x direction + * @event Viewport#bounce-x-start + * @type {Viewport} + */ + + /** + * Fires when a bounce ends in the x direction + * @event Viewport#bounce-x-end + * @type {Viewport} + */ + + /** + * Fires when a bounce starts in the y direction + * @event Viewport#bounce-y-start + * @type {Viewport} + */ + + /** + * Fires when a bounce ends in the y direction + * @event Viewport#bounce-y-end + * @type {Viewport} + */ + + /** + * Fires when for a mouse wheel event + * @event Viewport#wheel + * @type {object} + * @property {object} wheel + * @property {number} wheel.dx + * @property {number} wheel.dy + * @property {number} wheel.dz + * @property {Viewport} viewport + */ + + /** + * Fires when a wheel-scroll occurs + * @event Viewport#wheel-scroll + * @type {Viewport} + */ + + /** + * Fires when a mouse-edge starts to scroll + * @event Viewport#mouse-edge-start + * @type {Viewport} + */ + + /** + * Fires when the mouse-edge scrolling ends + * @event Viewport#mouse-edge-end + * @type {Viewport} + */ + + /** + * Fires when viewport moves through UI interaction, deceleration, ensureVisible, or follow + * @event Viewport#moved + * @type {object} + * @property {Viewport} viewport + * @property {string} type - (drag, snap, pinch, follow, bounce-x, bounce-y, + * clamp-x, clamp-y, decelerate, mouse-edges, wheel, ensureVisible) + */ + + /** + * Fires when viewport moves through UI interaction, deceleration, ensureVisible, or follow + * @event Viewport#zoomed + * @type {object} + * @property {Viewport} viewport + * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom, ensureVisible) + */ + + /** + * Fires when viewport stops moving + * @event Viewport#moved-end + * @type {Viewport} + */ + + /** + * Fires when viewport stops zooming + * @event Viewport#zoomed-end + * @type {Viewport} + */ + + /** + * Fires at the end of an update frame + * @event Viewport#frame-end + * @type {Viewport} + */ + + exports.Animate = Animate; + exports.Bounce = Bounce; + exports.Clamp = Clamp; + exports.ClampZoom = ClampZoom; + exports.Decelerate = Decelerate; + exports.Drag = Drag; + exports.Follow = Follow; + exports.InputManager = InputManager; + exports.MouseEdges = MouseEdges; + exports.Pinch = Pinch; + exports.Plugin = Plugin; + exports.PluginManager = PluginManager; + exports.Snap = Snap; + exports.SnapZoom = SnapZoom; + exports.Viewport = Viewport; + exports.Wheel = Wheel; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +if (typeof pixi_viewport !== 'undefined') { Object.assign(this.PIXI, pixi_viewport); } + /*jslint plusplus: true, vars: true, indent: 2 */ /* convertPointFromPageToNode.js from @@ -84856,222 +83766,231 @@ module.exports = function (_Plugin) { } })() -(function () { - -var module = { - exports: null -}; -/** - * @constructor - * @param {!{patterns: !Object, leftmin: !number, rightmin: !number}} language The language pattern file. Compatible with Hyphenator.js. - */ -function Hypher(language) { - var exceptions = [], - i = 0; - /** - * @type {!Hypher.TrieNode} - */ - this.trie = this.createTrie(language['patterns']); - - /** - * @type {!number} - * @const - */ - this.leftMin = language['leftmin']; - - /** - * @type {!number} - * @const - */ - this.rightMin = language['rightmin']; - - /** - * @type {!Object.>} - */ - this.exceptions = {}; - - if (language['exceptions']) { - exceptions = language['exceptions'].split(/,\s?/g); - - for (; i < exceptions.length; i += 1) { - this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp('(' + exceptions[i].split('\u2027').join(')(') + ')', 'i'); - } +;(function () { + var module = { + exports: null, } -} + /** + * @constructor + * @param {!{patterns: !Object, leftmin: !number, rightmin: !number}} language The language pattern file. Compatible with Hyphenator.js. + */ + function Hypher(language) { + var exceptions = [], + i = 0 + /** + * @type {!Hypher.TrieNode} + */ + this.trie = this.createTrie(language['patterns']) -/** - * @typedef {{_points: !Array.}} - */ -Hypher.TrieNode; + /** + * @type {!number} + * @const + */ + this.leftMin = language['leftmin'] -/** - * Creates a trie from a language pattern. - * @private - * @param {!Object} patternObject An object with language patterns. - * @return {!Hypher.TrieNode} An object trie. - */ -Hypher.prototype.createTrie = function (patternObject) { - var size = 0, - i = 0, - c = 0, - p = 0, - chars = null, - points = null, - codePoint = null, - t = null, - tree = { - _points: [] - }, - patterns; + /** + * @type {!number} + * @const + */ + this.rightMin = language['rightmin'] - for (size in patternObject) { - if (patternObject.hasOwnProperty(size)) { - patterns = patternObject[size].match(new RegExp('.{1,' + (+size) + '}', 'g')); + /** + * @type {!Object.>} + */ + this.exceptions = {} - for (i = 0; i < patterns.length; i += 1) { - chars = patterns[i].replace(/[0-9]/g, '').split(''); - points = patterns[i].split(/\D/); - t = tree; + if (language['exceptions']) { + exceptions = language['exceptions'].split(/,\s?/g) - for (c = 0; c < chars.length; c += 1) { - codePoint = chars[c].charCodeAt(0); - - if (!t[codePoint]) { - t[codePoint] = {}; - } - t = t[codePoint]; - } - - t._points = []; - - for (p = 0; p < points.length; p += 1) { - t._points[p] = points[p] || 0; - } + for (; i < exceptions.length; i += 1) { + this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp( + '(' + exceptions[i].split('\u2027').join(')(') + ')', + 'i' + ) } } } - return tree; -}; -/** - * Hyphenates a text. - * - * @param {!string} str The text to hyphenate. - * @return {!string} The same text with soft hyphens inserted in the right positions. - */ -Hypher.prototype.hyphenateText = function (str, minLength) { - minLength = minLength || 4; + /** + * @typedef {{_points: !Array.}} + */ + Hypher.TrieNode - // Regexp("\b", "g") splits on word boundaries, - // compound separators and ZWNJ so we don't need - // any special cases for those characters. Unfortunately - // it does not support unicode word boundaries, so - // we implement it manually. - var words = str.split(/([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g); + /** + * Creates a trie from a language pattern. + * @private + * @param {!Object} patternObject An object with language patterns. + * @return {!Hypher.TrieNode} An object trie. + */ + Hypher.prototype.createTrie = function (patternObject) { + var size = 0, + i = 0, + c = 0, + p = 0, + chars = null, + points = null, + codePoint = null, + t = null, + tree = { + _points: [], + }, + patterns - for (var i = 0; i < words.length; i += 1) { - if (words[i].indexOf('/') !== -1) { - // Don't insert a zero width space if the slash is at the beginning or end - // of the text, or right after or before a space. - if (i !== 0 && i !== words.length - 1 && !(/\s+\/|\/\s+/.test(words[i]))) { - words[i] += '\u200B'; - } - } else if (words[i].length > minLength) { - words[i] = this.hyphenate(words[i]).join('\u00AD'); - } - } - return words.join(''); -}; + for (size in patternObject) { + if (patternObject.hasOwnProperty(size)) { + patterns = patternObject[size].match(new RegExp('.{1,' + +size + '}', 'g')) -/** - * Hyphenates a word. - * - * @param {!string} word The word to hyphenate - * @return {!Array.} An array of word fragments indicating valid hyphenation points. - */ -Hypher.prototype.hyphenate = function (word) { - var characters, - characterPoints = [], - originalCharacters, - i, - j, - k, - node, - points = [], - wordLength, - lowerCaseWord = word.toLowerCase(), - nodePoints, - nodePointsLength, - m = Math.max, - trie = this.trie, - result = ['']; + for (i = 0; i < patterns.length; i += 1) { + chars = patterns[i].replace(/[0-9]/g, '').split('') + points = patterns[i].split(/\D/) + t = tree - if (this.exceptions.hasOwnProperty(lowerCaseWord)) { - return word.match(this.exceptions[lowerCaseWord]).slice(1); - } + for (c = 0; c < chars.length; c += 1) { + codePoint = chars[c].charCodeAt(0) - if (word.indexOf('\u00AD') !== -1) { - return [word]; - } + if (!t[codePoint]) { + t[codePoint] = {} + } + t = t[codePoint] + } - word = '_' + word + '_'; + t._points = [] - characters = word.toLowerCase().split(''); - originalCharacters = word.split(''); - wordLength = characters.length; - - for (i = 0; i < wordLength; i += 1) { - points[i] = 0; - characterPoints[i] = characters[i].charCodeAt(0); - } - - for (i = 0; i < wordLength; i += 1) { - node = trie; - for (j = i; j < wordLength; j += 1) { - node = node[characterPoints[j]]; - - if (node) { - nodePoints = node._points; - if (nodePoints) { - for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) { - points[i + k] = m(points[i + k], nodePoints[k]); + for (p = 0; p < points.length; p += 1) { + t._points[p] = points[p] || 0 } } + } + } + return tree + } + + /** + * Hyphenates a text. + * + * @param {!string} str The text to hyphenate. + * @return {!string} The same text with soft hyphens inserted in the right positions. + */ + Hypher.prototype.hyphenateText = function (str, minLength) { + minLength = minLength || 4 + + // Regexp("\b", "g") splits on word boundaries, + // compound separators and ZWNJ so we don't need + // any special cases for those characters. Unfortunately + // it does not support unicode word boundaries, so + // we implement it manually. + var words = str.split( + /([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g + ) + + for (var i = 0; i < words.length; i += 1) { + if (words[i].indexOf('/') !== -1) { + // Don't insert a zero width space if the slash is at the beginning or end + // of the text, or right after or before a space. + if (i !== 0 && i !== words.length - 1 && !/\s+\/|\/\s+/.test(words[i])) { + words[i] += '\u200B' + } + } else if (words[i].length > minLength) { + words[i] = this.hyphenate(words[i]).join('\u00AD') + } + } + return words.join('') + } + + /** + * Hyphenates a word. + * + * @param {!string} word The word to hyphenate + * @return {!Array.} An array of word fragments indicating valid hyphenation points. + */ + Hypher.prototype.hyphenate = function (word) { + var characters, + characterPoints = [], + originalCharacters, + i, + j, + k, + node, + points = [], + wordLength, + lowerCaseWord = word.toLowerCase(), + nodePoints, + nodePointsLength, + m = Math.max, + trie = this.trie, + result = [''] + + if (this.exceptions.hasOwnProperty(lowerCaseWord)) { + return word.match(this.exceptions[lowerCaseWord]).slice(1) + } + + if (word.indexOf('\u00AD') !== -1) { + return [word] + } + + word = '_' + word + '_' + + characters = word.toLowerCase().split('') + originalCharacters = word.split('') + wordLength = characters.length + + for (i = 0; i < wordLength; i += 1) { + points[i] = 0 + characterPoints[i] = characters[i].charCodeAt(0) + } + + for (i = 0; i < wordLength; i += 1) { + node = trie + for (j = i; j < wordLength; j += 1) { + node = node[characterPoints[j]] + + if (node) { + nodePoints = node._points + if (nodePoints) { + for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) { + points[i + k] = m(points[i + k], nodePoints[k]) + } + } + } else { + break + } + } + } + + for (i = 1; i < wordLength - 1; i += 1) { + if (i > this.leftMin && i < wordLength - this.rightMin && points[i] % 2) { + result.push(originalCharacters[i]) } else { - break; + result[result.length - 1] += originalCharacters[i] } } + + return result } - for (i = 1; i < wordLength - 1; i += 1) { - if (i > this.leftMin && i < (wordLength - this.rightMin) && points[i] % 2) { - result.push(originalCharacters[i]); - } else { - result[result.length - 1] += originalCharacters[i]; - } - } + module.exports = Hypher + window['Hypher'] = module.exports - return result; -}; - -module.exports = Hypher; -window['Hypher'] = module.exports; - -window['Hypher']['languages'] = {}; -}());(function ($) { + window['Hypher']['languages'] = {} +})() +;(function ($) { $.fn.hyphenate = function (language) { if (window['Hypher']['languages'][language]) { return this.each(function () { - var i = 0, len = this.childNodes.length; + var i = 0, + len = this.childNodes.length for (; i < len; i += 1) { if (this.childNodes[i].nodeType === 3) { - this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText(this.childNodes[i].nodeValue); + this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText( + this.childNodes[i].nodeValue + ) } } - }); + }) } - }; -}(jQuery)); + } +})(jQuery) + (function () { var module = { diff --git a/dist/iwmlib.3rdparty.min.js b/dist/iwmlib.3rdparty.min.js index f142526..7496df7 100644 --- a/dist/iwmlib.3rdparty.min.js +++ b/dist/iwmlib.3rdparty.min.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return r=[function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=function(e){for(var t=e.length,r=new Array(t),i=0;i@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){for(var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return c("",e,"",t);var n=[i.pop()];for(;1/g,"> ").trim()};var i=r(3),u=(i=i)&&i.__esModule?i:{default:i},h=r(0);function c(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(f(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),l=0,t=s.length;l/.test(i)&&(e=i.replace(/>/,""),a=""+r+e+n,f(document.querySelectorAll(a),o)&&(i=e)),/:nth-child/.test(i)&&(e=i.replace(/nth-child/g,"nth-of-type"),a=""+r+e+n,f(document.querySelectorAll(a),o)&&(i=e)),/\.\S+\.\S+/.test(i)){for(var u=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});u.length;){var h=i.replace(u.shift(),"").trim();if(!(a=(""+r+h+n).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;f(document.querySelectorAll(a),o)&&(i=h)}if((u=i&&i.match(/\./g))&&2)(\S)/g,"$1 $2").trim()).split(" ").reverse().map(function(e,t){var r,i,n,o=0===t,t=e.split(":"),e=m(t,2),a=e[0],t=e[1],s=null,l=null;switch(!0){case/>/.test(a):l=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(a):var u=a.substr(1).split(".");s=function(e){var t=e.attribs.class;return t&&u.every(function(e){return-1 "+l+":nth-child("+(a+1)+")",i.unshift(u)):console.warn("\n Element couldn't be matched through strict ignore pattern!\n ",h,r,l)}}(o,l,a,s)}l=l.parentNode,u=s.length}l===i&&(t=m(o,l,a),s.unshift(t));return s.join(" ")};var f=r(0),c={attribute:function(e){return-1<["style","data-reactid","data-react-checksum"].indexOf(e)}};function p(e,t,r,i,n){n=4\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",t=n.console&&(n.console.warn||n.console.log);return t&&t.call(n.console,i,e),r.apply(this,arguments)}}var s="function"!=typeof Object.assign?function(e){if(e===h||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;rt[r]}):i.sort():i}function d(e,t){for(var r,i=t[0].toUpperCase()+t.slice(1),n=0;nc(a.y)?a.x:a.y,i.scale=s?function(e,t){return O(t[0],t[1],A)/O(e[0],e[1],A)}(s.pointers,t):1,i.rotation=s?function(e,t){return he(t[1],t[0],A)+he(e[1],e[0],A)}(s.pointers,t):0,i.maxPointers=!o.prevInput||i.pointers.length>o.prevInput.maxPointers?i.pointers.length:o.prevInput.maxPointers,function(e,t){var r,i,n,o=e.lastInterval||t,a=t.timeStamp-o.timeStamp;{var s,l;t.eventType!=v&&(rec(a.y)?a.x:a.y,s=ue(s,l),e.lastInterval=t):(r=o.velocity,i=o.velocityX,n=o.velocityY,s=o.direction)}t.velocity=r,t.velocityX=i,t.velocityY=n,t.direction=s}(o,i),n.element);V(i.srcEvent.target,l)&&(l=i.srcEvent.target),i.target=l,e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function ae(e){for(var t=[],r=0;r=c(t)?e<0?b:x:t<0?T:w}function O(e,t,r){var i=t[(r=r||ne)[0]]-e[r[0]],t=t[r[1]]-e[r[1]];return Math.sqrt(i*i+t*t)}function he(e,t,r){var i=t[(r=r||ne)[0]]-e[r[0]],t=t[r[1]]-e[r[1]];return 180*Math.atan2(t,i)/Math.PI}k.prototype={handler:function(){},init:function(){this.evEl&&t(this.element,this.evEl,this.domHandler),this.evTarget&&t(this.target,this.evTarget,this.domHandler),this.evWin&&t(Z(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&i(this.element,this.evEl,this.domHandler),this.evTarget&&i(this.target,this.evTarget,this.domHandler),this.evWin&&i(Z(this.element),this.evWin,this.domHandler)}};var ce={mousedown:_,mousemove:2,mouseup:g};function P(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,k.apply(this,arguments)}e(P,k,{handler:function(e){var t=ce[e.type];t&_&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=g),this.pressed&&(t&g&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:te,srcEvent:e}))}});var fe={pointerdown:_,pointermove:2,pointerup:g,pointercancel:v,pointerout:v},pe={2:m,3:"pen",4:te,5:"kinect"},de="pointerdown",me="pointermove pointerup pointercancel";function _e(){this.evEl=de,this.evWin=me,k.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}n.MSPointerEvent&&!n.PointerEvent&&(de="MSPointerDown",me="MSPointerMove MSPointerUp MSPointerCancel"),e(_e,k,{handler:function(e){var t=this.store,r=!1,i=e.type.toLowerCase().replace("ms",""),i=fe[i],n=pe[e.pointerType]||e.pointerType,o=n==m,a=f(t,e.pointerId,"pointerId");i&_&&(0===e.button||o)?a<0&&(t.push(e),a=t.length-1):i&(g|v)&&(r=!0),a<0||(t[a]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:n,srcEvent:e}),r&&t.splice(a,1))}});var ge={touchstart:_,touchmove:2,touchend:g,touchcancel:v};function ve(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,k.apply(this,arguments)}e(ve,k,{handler:function(e){var t,r=ge[e.type];r===_&&(this.started=!0),this.started&&(t=function(e,t){var r=p(e.touches),e=p(e.changedTouches);t&(g|v)&&(r=K(r.concat(e),"identifier",!0));return[r,e]}.call(this,e,r),r&(g|v)&&t[0].length-t[1].length==0&&(this.started=!1),this.callback(this.manager,r,{pointers:t[0],changedPointers:t[1],pointerType:m,srcEvent:e}))}});var ye={touchstart:_,touchmove:2,touchend:g,touchcancel:v};function be(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},k.apply(this,arguments)}e(be,k,{handler:function(e){var t=ye[e.type],r=function(e,t){var r=p(e.touches),i=this.targetIds;if(t&(2|_)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,a=p(e.changedTouches),s=[],l=this.target;if(o=r.filter(function(e){return V(e.target,l)}),t===_)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return D.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),e(Fe,D,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[R]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){var t;1!==e.scale&&(t=e.scale<1?"in":"out",e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),e(Ne,I,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distancet.time;if(this._input=e,!i||!r||e.eventType&(g|v)&&!n)this.reset();else if(e.eventType&_)this.reset(),this._timer=U(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&g)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&g?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=j(),this.manager.emit(this.options.event,this._input)))}}),e(ze,D,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[R]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),e(Be,D,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:E|S,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(E|S)?t=e.overallVelocity:r&E?t=e.overallVelocityX:r&S&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(t)>this.options.velocity&&e.eventType&g},emit:function(e){var t=Ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),e(je,I,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Pe]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distance=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&a=i.x&&i.x>=h&&n!==i.x&&be(or.x||i.x===r.x&&function(e,t){return xe(e.prev,e,t.prev)<0&&xe(t.next,e,e.next)<0}(r,i)))&&(r=i,f=l)),i=i.next,i!==u;);return r}(e,t);return r?(_e(e=ke(r,e),e.next),_e(r,r.next)):t}(l[n],r);return r}(e,t,h,r)),e.length>80*r){for(var f=i=e[0],p=n=e[1],d=r;d=g&&b&&b.z<=v;){if(y.x>=p&&y.x<=m&&y.y>=d&&y.y<=_&&y!==n&&y!==a&&be(s,h,l,c,u,f,y.x,y.y)&&0<=xe(y.prev,y,y.next))return;if(y=y.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=_&&b!==n&&b!==a&&be(s,h,l,c,u,f,b.x,b.y)&&0<=xe(b.prev,b,b.next))return;b=b.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=m&&y.y>=d&&y.y<=_&&y!==n&&y!==a&&be(s,h,l,c,u,f,y.x,y.y)&&0<=xe(y.prev,y,y.next))return;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=_&&b!==n&&b!==a&&be(s,h,l,c,u,f,b.x,b.y)&&0<=xe(b.prev,b,b.next))return;b=b.nextZ}return 1}(e,i,n,o):function(e){var t=e.prev,r=e,e=e.next;if(0<=xe(t,r,e))return;var i=t.x,n=r.x,o=e.x,a=t.y,s=r.y,l=e.y,u=i=u&&p.x<=c&&p.y>=h&&p.y<=f&&be(i,a,n,s,o,l,p.x,p.y)&&0<=xe(p.prev,p,p.next))return;p=p.next}return 1}(e))t.push(T.i/r|0),t.push(e.i/r|0),t.push(w.i/r|0),Pe(e),e=w.next,E=w.next;else if((e=w)===E){a?1===a?ge(e=function(e,t,r){var i=e;do{var n=i.prev,o=i.next.next}while(!Te(n,o)&&we(n,i,i.next,o)&&Ae(n,o)&&Ae(o,n)&&(t.push(n.i/r|0),t.push(i.i/r|0),t.push(o.i/r|0),Pe(i),Pe(i.next),i=e=o),i=i.next,i!==e);return _e(i)}(_e(e),t,r),t,r,i,n,o,2):2===a&&function(e,t,r,i,n,o){var a=e;do{for(var s,l=a.next.next;l!==a.prev;){if(a.i!==l.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&we(r,r.next,e,t))return 1}while(r=r.next,r!==e);return}(e,t)&&(Ae(e,t)&&Ae(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next,r!==e;);return i}(e,t)&&(xe(e.prev,e,t.prev)||xe(e,t.prev,t))||Te(e,t)&&0=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Se(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=g-1,y=Math.floor,b=String.fromCharCode;function x(e){throw RangeError(f[e])}function d(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function m(e,t){var r=e.split("@"),i="",r=(1>>10&1023|55296),e=56320|1023&e),t+=b(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,r){var i=0;for(e=r?y(e/l):e>>1,e+=y(e/t);p*v>>1y((_-h)/o))&&x("overflow"),h+=s*o,!(s<(s=a<=f?1:f+v<=a?v:a-f));a+=g)o>y(_/(s=g-s))&&x("overflow"),o*=s;f=S(h-n,t=l.length+1,0==n),y(h/t)>_-c&&x("overflow"),c+=y(h/t),h%=t,l.splice(h++,0,c)}return w(l)}function k(e){for(var t,r,i,n,o,a,s,l,u,h,c=[],f=(e=T(e)).length,p=128,d=72,m=t=0;my((_-t)/(l=r+1))&&x("overflow"),t+=(n-p)*l,p=n,m=0;m_&&x("overflow"),s==p){for(o=t,a=g;!(o<(u=a<=d?1:d+v<=a?v:a-d));a+=g)c.push(b(E(u+(h=o-u)%(u=g-u),0))),o=y(h/u);c.push(b(E(o,0))),d=S(t,l,r==i),t=0,++r}++t,++p}return c.join("")}if(o={version:"1.3.2",ucs2:{decode:T,encode:w},decode:A,encode:k,toASCII:function(e){return m(e,function(e){return h.test(e)?"xn--"+k(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?A(e.slice(4).toLowerCase()):e})}},i&&t)if(e.exports==i)t.exports=o;else for(a in o)o.hasOwnProperty(a)&&(i[a]=o[a]);else r.punycode=o}),Ie=function(e){return"string"==typeof e},De=function(e){return"object"==typeof e&&null!==e},Le=function(e){return null===e},Fe=function(e){return null==e};function Ne(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"==typeof e&&0!==e.length){var o=/\+/g,t=(e=e.split(t),1e3),a=(i&&"number"==typeof i.maxKeys&&(t=i.maxKeys),e.length);0",'"',"`"," ","\r","\n","\t"]),Ve=["'"].concat(r),Ke=["%","/","?",";","#"].concat(Ve),Je=["/","?","#"],Ze=/^[+a-z0-9A-Z_-]{0,63}$/,Qe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$e={javascript:!0,"javascript:":!0},et={javascript:!0,"javascript:":!0},tt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function rt(e,t,r){var i;return e&&De(e)&&e instanceof He?e:((i=new He).parse(e,t,r),i)}He.prototype.parse=function(e,t,r){if(!Ie(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),i=-1!==i&&i]*?)$/i.test(e)},hasProtocol:function(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol:function(e){ot(e),e=this.toPosix(e);var t="",r=/^file:\/\/\//.exec(e),i=/^[^/:]+:\/\//.exec(e),n=/^[^/:]+:\//.exec(e);return(r||i||n)&&(r=(null==r?void 0:r[0])||(null==i?void 0:i[0])||(null==n?void 0:n[0]),e=e.slice((t=r).length)),t},toAbsolute:function(e,t,r){return this.isDataUrl(e)?e:(t=at(this.toPosix(null!=t?t:R.ADAPTER.getBaseUrl())),r=at(this.toPosix(null!=r?r:this.rootname(t))),ot(e),(e=this.toPosix(e)).startsWith("/")?lt.join(r,e.slice(1)):this.isAbsolute(e)?e:this.join(t,e))},normalize:function(e){var t,r,i;return ot(e=this.toPosix(e)),0===e.length?".":(t="",r=e.startsWith("/"),this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length)),i=e.endsWith("/"),0<(e=function(e,t){for(var r,i="",n=0,o=-1,a=0,s=0;s<=e.length;++s){if(s>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function dt(e){e=e.toString(16);return"#"+("000000".substring(0,6-e.length)+e)}function mt(e){return"string"==typeof e&&"#"===(e=ft[e.toLowerCase()]||e)[0]&&(e=e.slice(1)),parseInt(e,16)}var _t=function(){for(var e=[],t=[],r=0;r<32;r++)t[e[r]=r]=r;e[$.BLEND_MODES.NORMAL_NPM]=$.BLEND_MODES.NORMAL,e[$.BLEND_MODES.ADD_NPM]=$.BLEND_MODES.ADD,e[$.BLEND_MODES.SCREEN_NPM]=$.BLEND_MODES.SCREEN,t[$.BLEND_MODES.NORMAL]=$.BLEND_MODES.NORMAL_NPM,t[$.BLEND_MODES.ADD]=$.BLEND_MODES.ADD_NPM,t[$.BLEND_MODES.SCREEN]=$.BLEND_MODES.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function gt(e,t){return _t[t?1:0][e]}function vt(e,t,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=t,r}function yt(e,t){return 1===t?(255*t<<24)+e:0===t?0:(255*t<<24)+(((e>>16&255)*t+.5|0)<<16)+(((e>>8&255)*t+.5|0)<<8)+((255&e)*t+.5|0)}function bt(e,t,r,i){return(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,!i&&void 0!==i||(r[0]*=t,r[1]*=t,r[2]*=t),r[3]=t,r}function xt(e,t){var r=6*e;if((t=(t=void 0===t?null:t)||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+r);for(var i=0,n=0;i>>1)|e>>>2)|e>>>4)|e>>>8)|e>>>16)+1}function St(e){return!(e&e-1||!e)}function At(e){var t=(65535>>=t)?1:0)<<3;return(t|=r)|(r=(15<(e>>>=r)?1:0)<<2)|(r=(3<(e>>>=r)?1:0)<<1)|(e>>>=r)>>1}function kt(e,t,r){var i=e.length;if(!(i<=t||0===r)){for(var n=i-(r=i=this.x&&e=this.y&&t=i||Math.max(a.y,d.y,s.y,l.y)<=n||Math.min(a.y,d.y,s.y,l.y)>=o)&&(h=(t=u*(d.y-a.y))*r+(d=u*(a.x-d.x))*n,c=t*i+d*n,f=t*r+d*o,p=t*i+d*o,!(Math.max(h,c,f,p)<=t*a.x+d*a.y||Math.min(h,c,f,p)>=t*l.x+d*l.y)&&(f=(h=u*(a.y-s.y))*r+(c=u*(s.x-a.x))*n,p=h*i+c*n,t=h*r+c*o,d=h*i+c*o,!(Math.max(f,p,t,d)<=h*a.x+c*a.y||Math.min(f,p,t,d)>=h*l.x+c*l.y))))))):(u=(this.xe.right?e:this).right<=u)&&(this.ye.bottom?e:this).bottom)},Kt.prototype.pad=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this.x-=e,this.y-=t,this.width+=2*e,this.height+=2*t,this},Kt.prototype.fit=function(e){var t=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),e=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(r-t,0),this.y=i,this.height=Math.max(e-i,0),this},Kt.prototype.ceil=function(e,t){void 0===e&&(e=1),void 0===t&&(t=.001);var r=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=r-this.x,this.height=i-this.y,this},Kt.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),e=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=r-t,this.y=i,this.height=e-i,this},Kt.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},Kt);function Kt(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=Number(e),this.y=Number(t),this.width=Number(r),this.height=Number(i),this.type=$.SHAPES.RECT}Zt.prototype.clone=function(){return new Zt(this.x,this.y,this.radius)},Zt.prototype.contains=function(e,t){var r;return!(this.radius<=0)&&(r=this.radius*this.radius,e=this.x-e,t=this.y-t,(e*=e)+(t*=t)<=r)},Zt.prototype.getBounds=function(){return new w(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},Zt.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"};var Jt=Zt;function Zt(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.x=e=void 0===e?0:e,this.y=t,this.radius=r,this.type=$.SHAPES.CIRC}$t.prototype.clone=function(){return new $t(this.x,this.y,this.width,this.height)},$t.prototype.contains=function(e,t){return!(this.width<=0||this.height<=0)&&(e=(e-this.x)/this.width,t=(t-this.y)/this.height,(e*=e)+(t*=t)<=1)},$t.prototype.getBounds=function(){return new w(this.x-this.width,this.y-this.height,this.width,this.height)},$t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"};var Qt=$t;function $t(e,t,r,i){void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=e=void 0===e?0:e,this.y=t,this.width=r,this.height=i,this.type=$.SHAPES.ELIP}tr.prototype.clone=function(){var e=new tr(this.points.slice());return e.closeStroke=this.closeStroke,e},tr.prototype.contains=function(e,t){for(var r=!1,i=this.points.length/2,n=0,o=i-1;n=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+r&&t<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;var i=e-(this.x+r),n=t-(this.y+r),o=r*r;if(i*i+n*n<=o)return!0;if((i=e-(this.x+this.width-r))*i+n*n<=o)return!0;if(i*i+(n=t-(this.y+this.height-r))*n<=o)return!0;if((i=e-(this.x+r))*i+n*n<=o)return!0}return!1},ir.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"};var rr=ir;function ir(e,t,r,i,n){void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=20),this.x=e=void 0===e?0:e,this.y=t,this.width=r,this.height=i,this.radius=n,this.type=$.SHAPES.RREC}or.prototype.clone=function(e,t){return new or(e=void 0===e?this.cb:e,t=void 0===t?this.scope:t,this._x,this._y)},or.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this._x===e&&this._y===t||(this._x=e,this._y=t,this.cb.call(this.scope)),this},or.prototype.copyFrom=function(e){return this._x===e.x&&this._y===e.y||(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},or.prototype.copyTo=function(e){return e.set(this._x,this._y),e},or.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},or.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(or.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(or.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0});var nr=or;function or(e,t,r,i){void 0===i&&(i=0),this._x=r=void 0===r?0:r,this._y=i,this.cb=e,this.scope=t}sr.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},sr.prototype.set=function(e,t,r,i,n,o){return this.a=e,this.b=t,this.c=r,this.d=i,this.tx=n,this.ty=o,this},sr.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));t=t||this.array;return e?(t[0]=this.a,t[1]=this.b,t[2]=0,t[3]=this.c,t[4]=this.d,t[5]=0,t[6]=this.tx,t[7]=this.ty):(t[0]=this.a,t[1]=this.c,t[2]=this.tx,t[3]=this.b,t[4]=this.d,t[5]=this.ty,t[6]=0,t[7]=0),t[8]=1,t},sr.prototype.apply=function(e,t){t=t||new ee;var r=e.x,e=e.y;return t.x=this.a*r+this.c*e+this.tx,t.y=this.b*r+this.d*e+this.ty,t},sr.prototype.applyInverse=function(e,t){t=t||new ee;var r=1/(this.a*this.d+this.c*-this.b),i=e.x,e=e.y;return t.x=this.d*r*i+-this.c*r*e+(this.ty*this.c-this.tx*this.d)*r,t.y=this.a*r*e+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,t},sr.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},sr.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},sr.prototype.rotate=function(e){var t=Math.cos(e),e=Math.sin(e),r=this.a,i=this.c,n=this.tx;return this.a=r*t-this.b*e,this.b=r*e+this.b*t,this.c=i*t-this.d*e,this.d=i*e+this.d*t,this.tx=n*t-this.ty*e,this.ty=n*e+this.ty*t,this},sr.prototype.append=function(e){var t=this.a,r=this.b,i=this.c,n=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*r+e.b*n,this.c=e.c*t+e.d*i,this.d=e.c*r+e.d*n,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*r+e.ty*n+this.ty,this},sr.prototype.setTransform=function(e,t,r,i,n,o,a,s,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-s)*o,this.d=Math.cos(a-s)*o,this.tx=e-(r*this.a+i*this.c),this.ty=t-(r*this.b+i*this.d),this},sr.prototype.prepend=function(e){var t,r,i=this.tx;return 1===e.a&&0===e.b&&0===e.c&&1===e.d||(t=this.a,r=this.c,this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d),this.tx=i*e.a+this.ty*e.c+e.tx,this.ty=i*e.b+this.ty*e.d+e.ty,this},sr.prototype.decompose=function(e){var t=this.a,r=this.b,i=this.c,n=this.d,o=e.pivot,a=-Math.atan2(-i,n),s=Math.atan2(r,t),l=Math.abs(a+s);return l<1e-5||Math.abs(Ht-l)<1e-5?(e.rotation=s,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=s),e.scale.x=Math.sqrt(t*t+r*r),e.scale.y=Math.sqrt(i*i+n*n),e.position.x=this.tx+(o.x*t+o.y*i),e.position.y=this.ty+(o.x*r+o.y*n),e},sr.prototype.invert=function(){var e=this.a,t=this.b,r=this.c,i=this.d,n=this.tx,o=e*i-t*r;return this.a=i/o,this.b=-t/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-i*n)/o,this.ty=-(e*this.ty-t*n)/o,this},sr.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},sr.prototype.clone=function(){var e=new sr;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},sr.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},sr.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},sr.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(sr,"IDENTITY",{get:function(){return new sr},enumerable:!1,configurable:!0}),Object.defineProperty(sr,"TEMP_MATRIX",{get:function(){return new sr},enumerable:!1,configurable:!0});var ar=sr;function sr(e,t,r,i,n,o){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=e,this.b=t,this.c=r,this.d=i,this.tx=n,this.ty=o}var lr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ur=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],hr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],cr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],fr=[],pr=[],dr=Math.sign;for(var mr=0;mr<16;mr++){var _r=[];fr.push(_r);for(var gr=0;gr<16;gr++)for(var vr=dr(lr[mr]*lr[gr]+hr[mr]*ur[gr]),yr=dr(ur[mr]*lr[gr]+cr[mr]*ur[gr]),br=dr(lr[mr]*hr[gr]+hr[mr]*cr[gr]),xr=dr(ur[mr]*hr[gr]+cr[mr]*cr[gr]),Tr=0;Tr<16;Tr++)if(lr[Tr]===vr&&ur[Tr]===yr&&hr[Tr]===br&&cr[Tr]===xr){_r.push(Tr);break}}for(mr=0;mr<16;mr++){var wr=new ar;wr.set(lr[mr],ur[mr],hr[mr],cr[mr],0,0),pr.push(wr)}var Er={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(e){return lr[e]},uY:function(e){return ur[e]},vX:function(e){return hr[e]},vY:function(e){return cr[e]},inv:function(e){return 8&e?15&e:7&-e},add:function(e,t){return fr[e][t]},sub:function(e,t){return fr[e][Er.inv(t)]},rotate180:function(e){return 4^e},isVertical:function(e){return 2==(3&e)},byDirection:function(e,t){return 2*Math.abs(e)<=Math.abs(t)?0<=t?Er.S:Er.N:2*Math.abs(t)<=Math.abs(e)?0this.maxX||this.minY>this.maxY},Or.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Or.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?w.EMPTY:((e=e||new w(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},Or.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},Or.prototype.addPointMatrix=function(e,t){var r=e.a,i=e.b,n=e.c,o=e.d,a=e.tx,e=e.ty,r=r*t.x+n*t.y+a,n=i*t.x+o*t.y+e;this.minX=Math.min(this.minX,r),this.maxX=Math.max(this.maxX,r),this.minY=Math.min(this.minY,n),this.maxY=Math.max(this.maxY,n)},Or.prototype.addQuad=function(e){var t=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=e[0],a=e[1],t=oi?e.maxX:i,this.maxY=e.maxY>n?e.maxY:n},Or.prototype.addBoundsMask=function(e,t){var r,i,n,o=(e.minX>t.minX?e:t).minX,a=(e.minY>t.minY?e:t).minY,s=(e.maxXt.x?e.minX:t.x,a=e.minY>t.y?e.minY:t.y,s=e.maxXr?this.maxX:r,this.minY=this.minYi?this.maxY:i};var kr=Or;function Or(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}var Pr=function(e,t){return(Pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function Rr(e,t){function r(){this.constructor=e}Pr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Rr(l,Cr=re),l.mixin=function(e){for(var t=Object.keys(e),r=0;rthis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e},u.prototype.swapChildren=function(e,t){var r,i;e!==t&&(r=this.getChildIndex(e),i=this.getChildIndex(t),this.children[r]=t,this.children[i]=e,this.onChildrenChange(r=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(e);kt(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},u.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},u.prototype.removeChild=function(){for(var e=arguments,t=[],r=0;rt.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},h.prototype.remove=function(e,t){for(var r=this._head.next;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(h.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),h.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},h.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},h.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},h.prototype.update=function(e){var t;if((e=void 0===e?performance.now():e)>this.lastTime){if((t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var r=e-this._lastFrame|0;if(r)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var yi,d=bi;function bi(e,t){var r=this;return t=t||{},(r=yi.call(this,R.ADAPTER.createCanvas())||this)._width=0,r._height=0,r.svg=e,r.scale=t.scale||1,r._overrideWidth=t.width,r._overrideHeight=t.height,r._resolve=null,r._crossorigin=t.crossorigin,r._load=null,!1!==t.autoLoad&&r.load(),r}c(wi,xi=hi),wi.prototype.update=function(e){var t;this.destroyed||(t=Wr.shared.elapsedMS*this.source.playbackRate,this._msToNextUpdate=Math.floor(this._msToNextUpdate-t),(!this._updateFPS||this._msToNextUpdate<=0)&&(xi.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0))},wi.prototype.load=function(){var t,r=this;return this._load||(((t=this.source).readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart.bind(this)),t.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise(function(e){r.valid?e(r):(r._resolve=e,t.load())})),this._load},wi.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},wi.prototype._isSourcePlaying=function(){var e=this.source;return 0this.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a)throw t="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,r="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height,new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+t+" "+(o&&a?"and":"or")+" "+r);this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),m.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(m,"EMPTY",{get:function(){return m._EMPTY||(Bi(m._EMPTY=new m(new C)),Bi(m._EMPTY.baseTexture)),m._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(m,"WHITE",{get:function(){var e,t;return m._WHITE||(t=(e=R.ADAPTER.createCanvas(16,16)).getContext("2d"),e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Bi(m._WHITE=new m(C.from(e))),Bi(m._WHITE.baseTexture)),m._WHITE},enumerable:!1,configurable:!0});var ji,te=m;function m(e,t,r,i,n,o){var a=ji.call(this)||this;if(a.noFrame=!1,t||(a.noFrame=!0,t=new w(0,0,1,1)),e instanceof m&&(e=e.baseTexture),a.baseTexture=e,a._frame=t,a.trim=i,a.valid=!1,a._uvs=zi,a.uvMatrix=null,a.orig=r||t,a._rotate=Number(n||0),!0===n)a._rotate=2;else if(a._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return a.defaultAnchor=o?new ee(o.x,o.y):new ee(0,0),a._updateID=0,a.textureCacheIds=[],e.valid?a.noFrame?e.valid&&a.onBaseTextureUpdated(e):a.frame=t:e.once("loaded",a.onBaseTextureUpdated,a),a.noFrame&&e.on("update",a.onBaseTextureUpdated,a),a}c(Xi,Ui=te),Object.defineProperty(Xi.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(Xi.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),Xi.prototype.resize=function(e,t,r){void 0===r&&(r=!0);var i=this.baseTexture.resolution,e=Math.round(e*i)/i,t=Math.round(t*i)/i;this.valid=0>>0,1=$.ENV.WEBGL2?e.getContext("webgl2",t):r)this.webGLVersion=2;else if(this.webGLVersion=1,!(r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl},Sn.prototype.getExtensions=function(){var e=this.gl,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},Sn.prototype.handleContextLost=function(e){e.preventDefault()},Sn.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},Sn.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},Sn.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},Sn.prototype.validateContext=function(e){var t=e.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext,t=(r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly"),r||!!e.getExtension("OES_element_index_uint"));(this.supports.uint32Indices=t)||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},Sn);function Sn(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),e.view.addEventListener("webglcontextlost",this.handleContextLost,!1),e.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}var An=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=$.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},kn=new w,On=(Pn.prototype.contextChange=function(){var t,e,r=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new w,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion?(t=this.renderer.context.extensions.drawBuffers,e=this.renderer.context.extensions.depthTexture,R.PREFER_ENV===$.ENV.WEBGL_LEGACY&&(e=t=null),t?r.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,r.drawBuffers=function(){}),e||(this.writeDepthTexture=!1)):this.msaaSamples=r.getInternalformatParameter(r.RENDERBUFFER,r.RGBA8,r.SAMPLES)},Pn.prototype.bind=function(e,t,r){void 0===r&&(r=0);var i=this.gl;if(e){var n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var o,a,s=0;s>r,a=t.height>>r,n=o/t.width,this.setViewport(t.x*n,t.y*n,o,a)):(o=e.width>>r,a=e.height>>r,this.setViewport(0,0,o,a))}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},Pn.prototype.setViewport=function(e,t,r,i){var n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===e&&n.y===t||(n.x=e,n.y=t,n.width=r,n.height=i,this.gl.viewport(e,t,r,i))},Object.defineProperty(Pn.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),Pn.prototype.clear=function(e,t,r,i,n){void 0===n&&(n=$.BUFFER_BITS.COLOR|$.BUFFER_BITS.DEPTH);var o=this.gl;o.clearColor(e,t,r,i),o.clear(n)},Pn.prototype.initFramebuffer=function(e){var t=this.gl,t=new An(t.createFramebuffer());return t.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=t,this.managedFramebuffers.push(e),e.disposeRunner.add(this),t},Pn.prototype.resizeFramebuffer=function(e){var t=this.gl,r=e.glFramebuffers[this.CONTEXT_UID],i=(r.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,r.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.RGBA8,e.width,e.height)),r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height)),e.colorTextures),n=i.length;t.drawBuffers||(n=Math.min(n,1));for(var o=0;o=$.ENV.WEBGL2?e.getContext("webgl2",{}):t)||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),Un=t),Un}function Xn(e,t,r){return"precision"!==e.substring(0,9)?"precision "+(t===$.PRECISION.HIGH&&r!==$.PRECISION.HIGH?$.PRECISION.MEDIUM:t)+" float;\n"+e:r!==$.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var Hn={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Yn(e){return Hn[e]}var Wn=null,qn={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Vn(e,t){if(!Wn){var r=Object.keys(qn);Wn={};for(var i=0;i>=1,r++;this.stateId=e.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},Qo.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),r=!(t[i]=null))}if(r){for(var o=0,i=0;i=e.data.byteLength?r.bufferSubData(e.type,0,e.data):(t=e.static?r.STATIC_DRAW:r.DYNAMIC_DRAW,i.byteLength=e.data.byteLength,r.bufferData(e.type,e.data,t)))},ua.prototype.dispose=function(e,t){var r,i;this.managedBuffers[e.id]&&(delete this.managedBuffers[e.id],r=e._glBuffers[this.CONTEXT_UID],i=this.gl,e.disposeRunner.remove(this),r&&(t||i.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID]))},ua.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),r=0;r=$.MSAA_QUALITY.HIGH?this.multisample=$.MSAA_QUALITY.HIGH:e>=$.MSAA_QUALITY.MEDIUM?this.multisample=$.MSAA_QUALITY.MEDIUM:e>=$.MSAA_QUALITY.LOW?this.multisample=$.MSAA_QUALITY.LOW:this.multisample=$.MSAA_QUALITY.NONE},fa.prototype.addSystem=function(e,t){var r,i=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(r in this[t]=i,this.runners)this.runners[r].add(i);return this},fa.prototype.render=function(e,t){var r,i,n,o;t&&(o=t instanceof Gi?(Mt("6.0.0","Renderer#render arguments changed, use options instead."),r=t,i=arguments[2],n=arguments[3],arguments[4]):(r=t.renderTexture,i=t.clear,n=t.transform,t.skipUpdateTransform)),this.renderingToScreen=!r,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,this.context.isLost||(r||(this._lastObjectRendered=e),o||(t=e.enableTempParent(),e.updateTransform(),e.disableTempParent(t)),this.renderTexture.bind(r),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),r&&r.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender"))},fa.prototype.generateTexture=function(e,t,r,i){e=ha.prototype.generateTexture.call(this,e,t=void 0===t?{}:t,r,i);return this.framebuffer.blit(),e},fa.prototype.resize=function(e,t){ha.prototype.resize.call(this,e,t),this.runners.resize.emit(this.screen.height,this.screen.width)},fa.prototype.reset=function(){return this.runners.reset.emit(),this},fa.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},fa.prototype.destroy=function(e){for(var t in this.runners.destroy.emit(),this.runners)this.runners[t].destroy();ha.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(fa.prototype,"extract",{get:function(){return Mt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),fa.registerPlugin=function(e,t){Mt("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Ur.add({name:e,type:$.ExtensionType.RendererPlugin,ref:t})},fa.__plugins={};var ha,ca=fa;function fa(e){var t=ha.call(this,$.RENDERER_TYPE.WEBGL,e)||this;return e=t.options,t.gl=null,t.CONTEXT_UID=0,t.runners={destroy:new Gr("destroy"),contextChange:new Gr("contextChange"),reset:new Gr("reset"),update:new Gr("update"),postrender:new Gr("postrender"),prerender:new Gr("prerender"),resize:new Gr("resize")},t.runners.contextChange.add(t),t.globalUniforms=new cn({projectionMatrix:new ar},!0),t.addSystem(vo,"mask").addSystem(En,"context").addSystem(Ko,"state").addSystem(qo,"shader").addSystem(ea,"texture").addSystem(la,"buffer").addSystem(Cn,"geometry").addSystem(On,"framebuffer").addSystem(Eo,"scissor").addSystem(ko,"stencil").addSystem(Po,"projection").addSystem(Zo,"textureGC").addSystem(gn,"filter").addSystem(Io,"renderTexture").addSystem(xn,"batch"),t.initPlugins(fa.__plugins),t.multisample=void 0,e.context?t.context.initFromContext(e.context):t.context.initFromOptions({alpha:!!t.useContextAlpha,antialias:e.antialias,premultipliedAlpha:t.useContextAlpha&&"notMultiplied"!==t.useContextAlpha,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:t.options.powerPreference}),t.renderingToScreen=!0,ht(2===t.context.webGLVersion?"WebGL 2":"WebGL 1"),t.resize(t.options.width,t.options.height),t}function pa(e){return ca.create(e)}Ur.handleByMap($.ExtensionType.RendererPlugin,ca.__plugins);var da="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",ma="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",_a=(ga.prototype.destroy=function(){this.renderer=null},ga);function ga(e){Mt("6.1.0","System class is deprecated, implemement ISystem interface instead."),this.renderer=e}var va=function(){this.texArray=null,this.blend=0,this.type=$.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},ya=(ba.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},Sa.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=Sa._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++C._globalBatch,s=0,l=r[0],u=0;i.copyBoundTextures(n,t);for(var h=0;h=t&&(i.boundArray(l,n,a,t),this.buildDrawCalls(l,u,h),u=h,l=r[++s],++a),c._batchEnabled=a,c.touched=o,l.elements[l.count++]=c)}0 title : "+e.title+"
tabIndex: "+e.tabIndex},za.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,r=t.width,t=t.height;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>t&&(e.height=t-e.y)},za.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2..toString(),t.style.borderStyle="none",-1>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(e.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(o=0;os[0]&&t[1]>1||1)+i-1&~(i-1))*(f=(h=h>>1||1)+n-1&~(n-1))*ws[t];return s};var Rs,Cs=Ms;function Ms(e,t){var r=Rs.call(this,e,t)||this;return r.format=t.format,r.levels=t.levels||1,r._width=t.width,r._height=t.height,r._extension=Ms._formatToExtension(r.format),(t.levelBuffers||r.buffer)&&(r._levelBuffers=t.levelBuffers||Ms._createLevelBuffers(e instanceof Uint8Array?e:r.buffer.uint8View,r.format,r.levels,4,4,r.width,r.height)),r}Is.use=function(r,i){var e=r.data;if(r.type===$.LoaderResource.TYPE.JSON&&e&&e.cacheID&&e.textures){for(var t,n,o=e.textures,a=void 0,s=void 0,l=0,u=o.length;l>>=1,m>>>=1;for(var g=148,_=0;_>1||1)+4-1&-4)*(x=(y=y>>1||1)+4-1&-4)*_}return 0!==o?{uncompressed:d.map(function(e){var t=e[0].levelBuffer,r=!1;return o===$.TYPES.FLOAT?t=new Float32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4):o===$.TYPES.UNSIGNED_INT?(r=!0,t=new Uint32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)):o===$.TYPES.INT&&(r=!0,t=new Int32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)),{resource:new ti(t,{width:e[0].levelWidth,height:e[0].levelHeight}),type:o,format:r?function(e){switch(e){case $.FORMATS.RGBA:return $.FORMATS.RGBA_INTEGER;case $.FORMATS.RGB:return $.FORMATS.RGB_INTEGER;case $.FORMATS.RG:return $.FORMATS.RG_INTEGER;case $.FORMATS.RED:return $.FORMATS.RED_INTEGER;default:return e}}(a):a}}),kvData:r}:{compressed:d.map(function(e){return new Cs(null,{format:s,width:l,height:u,levels:f,levelBuffers:e})}),kvData:r}}$.LoaderResource.setExtensionXhrType("dds",$.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);cl.use=function(e,t){if("dds"===e.extension&&e.data)try{Object.assign(e,Ds(e.name||e.url,qs(e.data),e.metadata))}catch(e){return void t(e)}t()},cl.extension=$.ExtensionType.Loader;var v=cl;function cl(){}$.LoaderResource.setExtensionXhrType("ktx",$.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);pl.use=function(e,t){if("ktx"===e.extension&&e.data)try{var i,n=e.name||e.url,r=hl(n,e.data,this.loadKeyValueData),o=r.compressed,a=r.uncompressed,s=r.kvData;if(o){var l=Ds(n,o,e.metadata);if(s&&l.textures)for(var u in l.textures)l.textures[u].baseTexture.ktxKeyValueData=s;Object.assign(e,l)}else a&&(i={},a.forEach(function(e,t){var e=new te(new C(e.resource,{mipmap:$.MIPMAP_MODES.OFF,alphaMode:$.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,type:e.type,format:e.format})),r=n+"-"+(t+1);s&&(e.baseTexture.ktxKeyValueData=s),C.addToCache(e.baseTexture,r),te.addToCache(e,r),0===t&&(i[n]=e,C.addToCache(e.baseTexture,n),te.addToCache(e,n)),i[r]=e}),Object.assign(e,{textures:i}))}catch(e){return void t(e)}t()},pl.extension=$.ExtensionType.Loader,pl.loadKeyValueData=!1;var fl=pl;function pl(){}var dl=function(e,t){return(dl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function ml(e,t){function r(){this.constructor=e}dl(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}ml(vl,_l=zr),vl.prototype.setProperties=function(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])},vl.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(vl.prototype,"tint",{get:function(){return this._tint},set:function(e){pt(this._tint=e,this.tintRgb)},enumerable:!1,configurable:!0}),vl.prototype.render=function(e){var t=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return t.onChildrenChange(0)})),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))},vl.prototype.onChildrenChange=function(e){for(var t=Math.floor(e/this._batchSize);this._bufferUpdateIDs.length=a.length&&a.push(this._generateOneMoreBuffer(e)),a[f]),m=(d.uploadDynamic(t,c,p),e._bufferUpdateIDs[f]||0);(h=h||d._updateIDthis.maxSegments&&(e=this.maxSegments),e):t}},Sl=(Al.prototype.clone=function(){var e=new Al;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},Al.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=te.WHITE,this.matrix=null,this.visible=!1},Al.prototype.destroy=function(){this.texture=null,this.matrix=null},Al);function Al(){this.color=16777215,this.alpha=1,this.texture=te.WHITE,this.matrix=null,this.visible=!1,this.reset()}var kl=function(e,t){return(kl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function Ol(e,t){function r(){this.constructor=e}kl(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Pl(e,t){void 0===t&&(t=!1);var r=e.length;if(!(r<6)){for(var i=0,n=0,o=e[r-2],a=e[r-1];n>0),m=c/d;if(f+=m,s){a.push(e,t),a.push(r,i);for(var _=1,g=f;_>16)+(65280&t)+((255&t)<<16),r);e.length=Math.max(e.length,n+i);for(var a=0;a>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,e.shader.bind(t),e.geometry.bind(r,t),e.state.set(this.state);for(var s=0,l=a.length;s>16)+(65280&i)+((255&i)<<16)}}},b.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var e=this.transform.worldTransform,t=e.a,r=e.b,i=e.c,n=e.d,o=e.tx,a=e.ty,s=this._geometry.points,l=this.vertexData,u=0,h=0;h=r&&fu.x=r&&fu.y>16)+(65280&e)+((255&e)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||te.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),_u);function mu(){this.constructor=cu}function _u(e){var t=hu.call(this)||this;return t._anchor=new nr(t._onAnchorUpdate,t,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),t._texture=null,t._width=0,t._height=0,t._tint=null,t._tintRGB=null,t.tint=16777215,t.blendMode=$.BLEND_MODES.NORMAL,t._cachedTint=16777215,t.uvs=null,t.texture=e||te.EMPTY,t.vertexData=new Float32Array(8),t.vertexTrimmedData=null,t._transformID=-1,t._textureID=-1,t._transformTrimmedID=-1,t._textureTrimmedID=-1,t.indices=pu,t.pluginName="batch",t.isSprite=!0,t._roundPixels=R.ROUND_PIXELS,t}var gu=function(e,t){return(gu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};$.TEXT_GRADIENT=void 0,(Ll=$.TEXT_GRADIENT||($.TEXT_GRADIENT={}))[Ll.LINEAR_VERTICAL=0]="LINEAR_VERTICAL";var vu={align:"left",breakWords:!(Ll[Ll.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"),dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},yu=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],bu=(x.prototype.clone=function(){var e={};return wu(e,this,vu),new x(e)},x.prototype.reset=function(){wu(this,vu,vu)},Object.defineProperty(x.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){e=Tu(e);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fill",{get:function(){return this._fill},set:function(e){e=Tu(e);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){!function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return;if(e.length!==t.length)return;for(var r=0;r=r&&nh.x=r&&nh.y>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),wh.prototype.update=function(){var e;this._colorDirty&&(this._colorDirty=!1,e=this.texture.baseTexture,bt(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)};var xh,Th=wh;function wh(e,t){var r=this,i={uSampler:e,alpha:1,uTextureMatrix:ar.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t)).uniforms&&Object.assign(i,t.uniforms),(r=xh.call(this,t.program||io.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),i)||this)._colorDirty=!1,r.uvMatrix=new fo(e),r.batchable=void 0===t.program,r.pluginName=t.pluginName,r.tint=t.tint,r.alpha=t.alpha,r}ph(Ah,Eh=tn),Object.defineProperty(Ah.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0});var Eh,Sh=Ah;function Ah(e,t,r){var i=Eh.call(this)||this,e=new Ki(e),t=new Ki(t,!0),r=new Ki(r,!0,!0);return i.addAttribute("aVertexPosition",e,2,!1,$.TYPES.FLOAT).addAttribute("aTextureCoord",t,2,!1,$.TYPES.FLOAT).addIndex(r),i._updateId=-1,i}var kh=function(e,t){return(kh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var Oh=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},Ph=(Rh.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},Rh.parse=function(e){var t,r=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(t in r){var n,o=r[t].match(/^[a-z]+/gm)[0],a=r[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(n in a){var l=a[n].split("="),u=l[0],l=l[1].replace(/"/gm,""),h=parseFloat(l),l=isNaN(h)?l:h;s[u]=l}i[o].push(s)}var c=new Oh;return i.info.forEach(function(e){return c.info.push({face:e.face,size:parseInt(e.size,10)})}),i.common.forEach(function(e){return c.common.push({lineHeight:parseInt(e.lineHeight,10)})}),i.page.forEach(function(e){return c.page.push({id:parseInt(e.id,10),file:e.file})}),i.char.forEach(function(e){return c.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})}),i.kerning.forEach(function(e){return c.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})}),i.distanceField.forEach(function(e){return c.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})}),c},Rh);function Rh(){}Mh.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},Mh.parse=function(e){for(var t=new Oh,r=e.getElementsByTagName("info"),i=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),l=0;l")&&(e=(new globalThis.DOMParser).parseFromString(e,"text/xml"),Ch.test(e))},Dh.parse=function(e){e=(new globalThis.DOMParser).parseFromString(e,"text/xml");return Ch.parse(e)};var Ih=Dh;function Dh(){}var Lh=[Ph,Ch,Ih];function Fh(e){for(var t=0;tF&&(kt(i,1+c-++z,1+d-c),d=c,c=-1,n.push(f),o.push(06*E)||I.vertices.length<2*yh.BATCHABLE_SIZE)I.vertices=new Float32Array(8*E),I.uvs=new Float32Array(8*E),I.indices=new Uint16Array(6*E);else for(var Y=I.total,W=I.vertices,q=4*Y*2;q>16&255)/255,0,0,0,0,0,(e>>8&255)/255,0,0,0,0,0,(255&e)/255,0,0,0,0,0,1,0],t)},E.prototype.greyscale=function(e,t){this._loadMatrix([e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0],t)},E.prototype.blackAndWhite=function(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)},E.prototype.hue=function(e,t){e=(e||0)/180*Math.PI;var r=Math.cos(e),e=Math.sin(e),i=(0,Math.sqrt)(1/3);this._loadMatrix([r+1/3*(1-r),1/3*(1-r)-i*e,1/3*(1-r)+i*e,0,0,1/3*(1-r)+i*e,r+1/3*(1-r),1/3*(1-r)-i*e,0,0,1/3*(1-r)-i*e,1/3*(1-r)+i*e,r+1/3*(1-r),0,0,0,0,0,1,0],t)},E.prototype.contrast=function(e,t){var e=(e||0)+1,r=-.5*(e-1);this._loadMatrix([e,0,0,0,r,0,e,0,0,r,0,0,e,0,r,0,0,0,1,0],t)},E.prototype.saturate=function(e,t){var e=2*(e=void 0===e?0:e)/3+1,r=-.5*(e-1);this._loadMatrix([e,r,r,0,0,r,e,r,0,0,r,r,e,0,0,0,0,0,1,0],t)},E.prototype.desaturate=function(){this.saturate(-1)},E.prototype.negative=function(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)},E.prototype.sepia=function(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)},E.prototype.technicolor=function(e){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],e)},E.prototype.polaroid=function(e){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],e)},E.prototype.toBGR=function(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)},E.prototype.kodachrome=function(e){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],e)},E.prototype.browni=function(e){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],e)},E.prototype.vintage=function(e){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],e)},E.prototype.colorTone=function(e,t,r,i,n){var o=((r=r||16770432)>>16&255)/255,a=(r>>8&255)/255,r=(255&r)/255,s=((i=i||3375104)>>16&255)/255,l=(i>>8&255)/255,i=(255&i)/255;this._loadMatrix([.3,.59,.11,0,0,o,a,r,e=e||.2,0,s,l,i,t=t||.15,0,o-s,a-l,r-i,0,0],n)},E.prototype.night=function(e,t){this._loadMatrix([-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0],t)},E.prototype.predator=function(e,t){this._loadMatrix([11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0],t)},E.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},E.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(E.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0});var _c,gc,vc=E;function yc(){this.constructor=gc}function E(){var e=this,t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return(e=_c.call(this,ma,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",t)||this).alpha=1,e}vc.prototype.grayscale=vc.prototype.greyscale;var bc=function(e,t){return(bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};bc(Tc=Sc,wc=xc=Q),Tc.prototype=null===wc?Object.create(wc):(Ec.prototype=wc.prototype,new Ec),Sc.prototype.apply=function(e,t,r,i){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==a&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),e.applyFilter(this,t,r,i)},Object.defineProperty(Sc.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(e){this.uniforms.mapSampler=e},enumerable:!1,configurable:!0});var xc,Tc,wc=Sc;function Ec(){this.constructor=Tc}function Sc(e,t){var r=this,i=new ar;return e.renderable=!1,(r=xc.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,r.maskMatrix=i,r.scale=new ee(t=null==t?20:t,t),r}var Ac=function(e,t){return(Ac=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};Ac(Oc=Cc,Pc=kc=Q),Oc.prototype=null===Pc?Object.create(Pc):(Rc.prototype=Pc.prototype,new Rc);var kc,Oc,Pc=Cc;function Rc(){this.constructor=Oc}function Cc(){return kc.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}var Mc=function(e,t){return(Mc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};Mc(Dc=Nc,Lc=Ic=Q),Dc.prototype=null===Lc?Object.create(Lc):(Fc.prototype=Lc.prototype,new Fc),Object.defineProperty(Nc.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(Nc.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0});var Ic,Dc,Lc=Nc;function Fc(){this.constructor=Dc}function Nc(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random());var r=Ic.call(this,ma,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return r.noise=e,r.seed=t,r}(A={NORMAL:0,0:"NORMAL",ADD:1,1:"ADD",MULTIPLY:2,2:"MULTIPLY",SCREEN:3,3:"SCREEN",OVERLAY:4,4:"OVERLAY",DARKEN:5,5:"DARKEN",LIGHTEN:6,6:"LIGHTEN",COLOR_DODGE:7,7:"COLOR_DODGE",COLOR_BURN:8,8:"COLOR_BURN",HARD_LIGHT:9,9:"HARD_LIGHT",SOFT_LIGHT:10,10:"SOFT_LIGHT",DIFFERENCE:11,11:"DIFFERENCE",EXCLUSION:12,12:"EXCLUSION",HUE:13,13:"HUE",SATURATION:14,14:"SATURATION",COLOR:15,15:"COLOR",LUMINOSITY:16,16:"LUMINOSITY",NORMAL_NPM:17,17:"NORMAL_NPM",ADD_NPM:18,18:"ADD_NPM",SCREEN_NPM:19,19:"SCREEN_NPM",NONE:20,20:"NONE",SRC_OVER:0})[0]="SRC_OVER",A[A.SRC_IN=21]="SRC_IN",A[A.SRC_OUT=22]="SRC_OUT",A[A.SRC_ATOP=23]="SRC_ATOP",A[A.DST_OVER=24]="DST_OVER",A[A.DST_IN=25]="DST_IN",A[A.DST_OUT=26]="DST_OUT",A[A.DST_ATOP=27]="DST_ATOP",A[A.ERASE=26]="ERASE",A[A.SUBTRACT=28]="SUBTRACT",A[A.XOR=29]="XOR",(A={NPM:0,0:"NPM",UNPACK:1,1:"UNPACK",PMA:2,2:"PMA",NO_PREMULTIPLIED_ALPHA:0})[0]="NO_PREMULTIPLIED_ALPHA",A[A.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",A[A.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",A[A.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",(A={NO:0,0:"NO",YES:1,1:"YES",AUTO:2,2:"AUTO",BLEND:0})[0]="BLEND",A[A.CLEAR=1]="CLEAR",A[A.BLIT=2]="BLIT",(A=k=k||{})[A.NONE=0]="NONE",A[A.LOW=2]="LOW",A[A.MEDIUM=4]="MEDIUM",A[A.HIGH=8]="HIGH";var zc,Bc,jc,Uc,Gc,Xc,Hc=new ar,Yc=(r.prototype._cacheAsBitmap=!1,r.prototype._cacheData=null,r.prototype._cacheAsBitmapResolution=null,r.prototype._cacheAsBitmapMultisample=k.NONE,function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}),A=(Object.defineProperties(r.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(e){e!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(e){e!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new Yc),(t=this._cacheData).originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((t=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea))}}}),r.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},r.prototype._initCachedDisplayObject=function(e){var t,r,i,n,o,a,s,l;this._cacheData&&this._cacheData.sprite||(t=this.alpha,this.alpha=1,e.batch.flush(),r=this.getLocalBounds(null,!0).clone(),this.filters&&this.filters.length&&(i=this.filters[0].padding,r.pad(i)),r.ceil(R.RESOLUTION),i=e.renderTexture.current,n=e.renderTexture.sourceFrame.clone(),o=e.renderTexture.destinationFrame.clone(),a=e.projection.transform,s=Gi.create({width:r.width,height:r.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:null!=(s=this.cacheAsBitmapMultisample)?s:e.multisample}),l="cacheAsBitmap_"+ ++Pt,this._cacheData.textureCacheId=l,C.addToCache(s.baseTexture,l),te.addToCache(s,l),l=this.transform.localTransform.copyTo(Hc).invert().translate(-r.x,-r.y),this.render=this._cacheData.originalRender,e.render(this,{renderTexture:s,clear:!0,transform:l,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=a,e.renderTexture.bind(i,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t,(l=new du(s)).transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(r.x/r.width),l.anchor.y=-(r.y/r.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l))},r.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},r.prototype._initCachedDisplayObjectCanvas=function(e){var t,r,i,n,o,a;this._cacheData&&this._cacheData.sprite||(t=this.getLocalBounds(null,!0),r=this.alpha,this.alpha=1,i=e.context,n=e._projTransform,t.ceil(R.RESOLUTION),o=Gi.create({width:t.width,height:t.height}),a="cacheAsBitmap_"+ ++Pt,this._cacheData.textureCacheId=a,C.addToCache(o.baseTexture,a),te.addToCache(o,a),this.transform.localTransform.copyTo(a=Hc),a.invert(),a.tx-=t.x,a.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:o,clear:!0,transform:a,skipUpdateTransform:!1}),e.context=i,e._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r,(a=new du(o)).transform.worldTransform=this.transform.worldTransform,a.anchor.x=-(t.x/t.width),a.anchor.y=-(t.y/t.height),a.alpha=r,a._bounds=this._bounds,this._cacheData.sprite=a,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=a.containsPoint.bind(a))},r.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},r.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},r.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,C.removeFromCache(this._cacheData.textureCacheId),te.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},r.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},r.prototype.name=null,zr.prototype.getChildByName=function(e,t){for(var r=0,i=this.children.length;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=g-1,y=Math.floor,b=String.fromCharCode;function x(e){throw RangeError(f[e])}function d(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function m(e,t){var r=e.split("@"),i="",r=(1>>10&1023|55296),e=56320|1023&e),t+=b(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,r){var i=0;for(e=r?y(e/l):e>>1,e+=y(e/t);p*v>>1y((_-h)/o))&&x("overflow"),h+=s*o,!(s<(s=a<=f?1:f+v<=a?v:a-f));a+=g)o>y(_/(s=g-s))&&x("overflow"),o*=s;f=S(h-n,t=l.length+1,0==n),y(h/t)>_-c&&x("overflow"),c+=y(h/t),h%=t,l.splice(h++,0,c)}return w(l)}function k(e){for(var t,r,i,n,o,a,s,l,u,h,c=[],f=(e=T(e)).length,p=128,d=72,m=t=0;my((_-t)/(l=r+1))&&x("overflow"),t+=(n-p)*l,p=n,m=0;m_&&x("overflow"),s==p){for(o=t,a=g;!(o<(u=a<=d?1:d+v<=a?v:a-d));a+=g)c.push(b(E(u+(h=o-u)%(u=g-u),0))),o=y(h/u);c.push(b(E(o,0))),d=S(t,l,r==i),t=0,++r}++t,++p}return c.join("")}if(o={version:"1.3.2",ucs2:{decode:T,encode:w},decode:A,encode:k,toASCII:function(e){return m(e,function(e){return h.test(e)?"xn--"+k(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?A(e.slice(4).toLowerCase()):e})}},i&&t)if(e.exports==i)t.exports=o;else for(a in o)o.hasOwnProperty(a)&&(i[a]=o[a]);else r.punycode=o});function p0(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"==typeof e&&0!==e.length){var o=/\+/g,t=(e=e.split(t),1e3),a=(i&&"number"==typeof i.maxKeys&&(t=i.maxKeys),e.length);0e?1:this._width/e,t=this._topHeight+this._bottomHeight,t=this._height>t?1:this._height/t;return Math.min(e,t)},Object.defineProperty(B0.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"topHeight",{get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()},enumerable:!1,configurable:!0}),B0.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data,e=(this._origWidth=e.orig.width,this._origHeight=e.orig.height,1/this._origWidth),r=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()};var z0,i0=B0;function B0(e,t,r,i,n){void 0===t&&(t=10),void 0===r&&(r=10),void 0===i&&(i=10),void 0===n&&(n=10);var o=z0.call(this,te.WHITE,4,4)||this;return o._origWidth=e.orig.width,o._origHeight=e.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=t,o._rightWidth=i,o._topHeight=r,o._bottomHeight=n,o.texture=e,o}var j0=function(e,t){return(j0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};j0(G0=H0,n0=U0=du),G0.prototype=null===n0?Object.create(n0):(X0.prototype=n0.prototype,new X0),H0.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Wr.shared.remove(this.update,this),this._isConnectedToTicker=!1))},H0.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Wr.shared.add(this.update,this,$.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},H0.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},H0.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},H0.prototype.update=function(e){if(this._playing){var t=this.animationSpeed*e,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=t/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=t;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0r)&&this.onLoop(),this.updateTexture())}},H0.prototype.updateTexture=function(){var e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},H0.prototype.destroy=function(e){this.stop(),U0.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},H0.fromFrames=function(e){for(var t=[],r=0;r 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka: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:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,i){return i&&i.length?((i=i.splice?i:Array.prototype.slice.call(i)).splice(0,0,r),e["dynCall_"+t].apply(null,i)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*(t>>>0):(e>>>0)+4294967296*(0|t)},Ua:8,J:4,vd:0},na=(e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb,!1),oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(c){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch(r="*"===(r=r||"i8").charAt(r.length-1)?"i32":r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,1<=+xa(oa=t)?0>>0:~~+Aa((oa-(~~oa>>>0))/4294967296)>>>0:0],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch(t="*"===(t=t||"i8").charAt(t.length-1)?"i32":t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a,s,l="number"==typeof e?(o=!0,e):(o=!1,e.length),u="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(l,u?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&l);i>2]=0;for(e=r+l;i>0]=0}else if("i8"===u)e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r);else{i=0;for(;i>0],0!=i||r)&&(o++,!r||o!=r););if(r=r||o,i="",n<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,i){if(!(0>6}else{if(a<=65535){if(i<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(i<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(i<=r+4)break;t[r++]=248|a>>24}else{if(i<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-n}function La(e){for(var t=0,r=0;r"):o=n;e:for(;c>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var i=z[e+2*t>>1];if(0==i)return r;++t,r+=String.fromCharCode(i)}},e.stringToUTF16=function(e,t,r){if((r=void 0===r?2147483647:r)<2)return 0;var i=t;r=(r-=2)<2*e.length?r/2:e.length;for(var n=0;n>1]=e.charCodeAt(n),t+=2;return z[t>>1]=0,t-i},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var i=C[e+4*t>>2];if(0==i)return r;++t,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}},e.stringToUTF32=function(e,t,r){if((r=void 0===r?2147483647:r)<4)return 0;var i=t;r=i+r-4;for(var n=0;n>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-i},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*i+r*(t>>>16)<<16)|0}),Math.Jd=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.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){var t;I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)&&(t=jb,jb=null,t())}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,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,88,0,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,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,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,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,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,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,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,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,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,54,95,95,115,104,105,109,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,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,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,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,i=e.length-1;0<=i;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t?e:".")&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?e+(t=t&&t.substr(0,t.length-1)):"."}function Bb(e){var t;return"/"===e?"/":-1===(t=e.lastIndexOf("/"))?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,i){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var n,o=0,a=0;ae.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-n,i))),8>1)}catch(e){if(e.code)throw new L(J[e.code]);throw e}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},lookup:function(e,t){var r=K(P.B(e),t),r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,i){e=P.createNode(e,t,r,i),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(e.code)throw new L(J[e.code]);throw e}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},unlink:function(e,t){e=K(P.B(e),t);try{fs.unlinkSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},rmdir:function(e,t){e=K(P.B(e),t);try{fs.rmdirSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(e.code)throw new L(J[e.code]);throw e}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(e.code)throw new L(J[e.code]);throw e}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},read:function(e,t,r,i,n){if(0===i)return 0;var o,a=new Buffer(i);try{o=fs.readSync(e.V,a,0,i,n)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var i=r.name;if(r.parent.id===e.id&&i===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,i){return Zb||((Zb=function(e,t,r,i){this.parent=e=e||this,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=i}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,i)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb||(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,i="/"===t,n=!t;if(i&&Pb)throw new L(J.fa);if(!i&&!n){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}n={type:e,pa:{},Oa:t,lb:[]},t=e.A(n);(t.A=n).root=t,i?Pb=t:r&&(r.U=n,r.A&&r.A.lb.push(n))}function fc(e,t,r){var i=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var n=ac(i,e);if(n)throw new L(n);if(i.k.T)return i.k.T(i,e,t,r);throw new L(J.I)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var t=Bb(t),i=ac(r,t);if(i)throw new L(i);if(r.k.symlink)return r.k.symlink(r,t,e);throw new L(J.I)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(e.k.readlink)return Db(T(e.parent),e.k.readlink(e));throw new L(J.q)}function jc(e,t){e="string"==typeof e?S(e,{la:!0}).g:e;if(!e.k.u)throw new L(J.I);e.k.u(e,{mode:4095&t|-4096&e.mode,timestamp:Date.now()})}function kc(t,r){var i,n;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(i=$b[r]))throw Error("Unknown file open mode: "+r)}else i=r;if(o=64&(r=i)?4095&(void 0===o?438:o)|32768:0,"object"==typeof t)n=t;else{t=zb(t);try{n=S(t,{la:!(131072&r)}).g}catch(e){}}if(i=!1,64&r)if(n){if(128&r)throw new L(J.wa)}else n=fc(t,o,0),i=!0;if(!n)throw new L(J.F);if(8192==(61440&n.mode)&&(r&=-513),65536&r&&!N(n.mode))throw new L(J.ya);if(!i&&(o=n?40960==(61440&n.mode)?J.ga:N(n.mode)&&(0!=(2097155&r)||512&r)?J.P:(o=["r","w","rw"][3&r],512&r&&(o+="w"),Yb(n,o)):J.F))throw new L(o);if(512&r){var o,a="string"==typeof(o=n)?S(o,{la:!0}).g:o;if(!a.k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(o=Yb(a,"w"))throw new L(o);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(n=cc({g:n,path:T(n),flags:r,seekable:!0,position:0,n:n.n,tb:[],error:!1})).n.open&&n.n.open(n),!e.logReadFiles||1&r||(t in(lc=lc||{})||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return n}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,i,n,o){if(i<0||n<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===n)n=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,i,n,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,i){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,i))}function tc(e,t,r,i,n,o){if(n=gc(e=t?K("string"==typeof e?e:T(e),t):e,i=rc(i,n)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e=X();if(e=Rb[e])return e;throw new L(J.ea)}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){var r;return Dc=e,Ec=t,Fc?(0==e?(Y=function(){setTimeout(Gc,t)},Hc="timeout"):1==e?(Y=function(){Ic(Gc)},Hc="rAF"):2==e&&(window.setImmediate||(r=[],window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}),Y=function(){window.setImmediate(Gc)},Hc="immediate"),0):1}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var l=Lc;if(Gc=function(){var t,r,i,o;na||(0>r-6&63,r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n];2==r?e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4]+"==":4==r&&(e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2]+"="),u.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(u)}},u.src=n,ad(function(){s(u)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,i,n){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},n)for(var s in n)a[s]=n[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(i&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,i){function n(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=i)&&(jd=null);var o=e.canvas,a=(cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1)),document.createElement("div"));o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),i?a.p({Ud:i}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd,fs,Ob;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){var e;"undefined"!=typeof SDL&&(e=Sa[SDL.screen+0*n.J>>2],C[SDL.screen+0*n.J>>2]=8388608|e),pd()}function hd(){var e;"undefined"!=typeof SDL&&(e=Sa[SDL.screen+0*n.J>>2],C[SDL.screen+0*n.J>>2]=-8388609&e),pd()}function id(t,r,i){r&&i?(t.ub=r,t.hb=i):(r=t.ub,i=t.hb);var n,o=r,a=i;e.forcedAspectRatio&&0this.length-1||e<0))return t=e%this.chunkSize,this.gb(e/this.chunkSize|0)[t]},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",l,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+l+". Status: "+e.status);var o=Number(e.getResponseHeader("Content-length")),a=1048576,s=((e=e.getResponseHeader("Accept-Ranges"))&&"bytes"===e||(a=o),this);s.pb(function(e){var t=e*a,r=(e+1)*a-1,r=Math.min(r,o-1);if(void 0===s.Y[e]){var i=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(i=Math.min(e.length-n,i))),e.slice)for(var o=0;o>2]=0):-J.Q;case 21520:return i.tty?-J.q:-J.Q;case 21531:if(r=X(),i.n.ib)return i.n.ib(i,n,r);throw new L(J.Q);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){tb.p--,ub.push(e);e:{if(e&&!vb[e])for(var t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;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}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),i=X(),n=X(),o=X(),a=X();return assert(0===i),nc(r,n,a),C[o>>2]=r.position,r.na&&0===n&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,i=xc(),n=X();e:{for(var o=X(),a=0,s=0;s>2],C[n+(8*s+4)>>2],void 0);if(l<0){r=-1;break e}a+=l}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd},function(e,t,r){"use asm";var i=e.Int8Array;var n=e.Int16Array;var o=e.Int32Array;var s=e.Uint8Array;var u=e.Uint16Array;var h=e.Uint32Array;var c=e.Float32Array;var f=e.Float64Array;var pe=new i(r);var $=new n(r);var de=new o(r);var me=new s(r);var _e=new u(r);var p=new h(r);var d=new c(r);var ee=new f(r);var y=e.byteLength;var ge=t.STACKTOP|0;var x=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var T=t.ABORT|0;var w=t.cttz_i8|0;var E=0;var S=0;var A=0;var k=0;var O=e.NaN,P=e.Infinity;var R=0,C=0,M=0,I=0,D=0.0,L=0,H=0,Y=0,W=0.0;var re=0;var q=0;var V=0;var K=0;var J=0;var Z=0;var Q=0;var le=0;var ue=0;var he=0;var ce=e.Math.floor;var fe=e.Math.abs;var Te=e.Math.sqrt;var we=e.Math.pow;var Ee=e.Math.cos;var Se=e.Math.sin;var Ae=e.Math.tan;var ke=e.Math.acos;var Oe=e.Math.asin;var Pe=e.Math.atan;var Re=e.Math.atan2;var Ce=e.Math.exp;var Me=e.Math.log;var Ie=e.Math.ceil;var ve=e.Math.imul;var De=e.Math.min;var m=e.Math.clz32;var a=t.abort;var Le=t.assert;var Fe=t.invoke_iiii;var Ne=t.invoke_viiiii;var ze=t.invoke_vi;var Be=t.invoke_ii;var je=t.invoke_viii;var Ue=t.invoke_v;var Ge=t.invoke_viiiiii;var Xe=t.invoke_iiiiii;var He=t.invoke_viiii;var Ye=t._pthread_cleanup_pop;var We=t.___syscall54;var qe=t.___syscall6;var Ve=t._emscripten_set_main_loop_timing;var Ke=t.__ZSt18uncaught_exceptionv;var Je=t.___setErrNo;var z=t._sbrk;var Ze=t.___cxa_begin_catch;var Qe=t._emscripten_memcpy_big;var $e=t._sysconf;var et=t._pthread_getspecific;var tt=t._pthread_self;var rt=t._pthread_once;var it=t._pthread_key_create;var nt=t.___unlock;var ot=t._emscripten_set_main_loop;var at=t._pthread_setspecific;var st=t.___lock;var B=t._abort;var lt=t._pthread_cleanup_push;var ut=t._time;var ht=t.___syscall140;var ct=t.___syscall146;var ft=0.0;function pt(e){if(y(e)&16777215||y(e)<=16777215||y(e)>2147483648)return false;pe=new i(e);$=new n(e);de=new o(e);me=new s(e);_e=new u(e);p=new h(e);d=new c(e);ee=new f(e);r=e;return true}function dt(e){e=e|0;var t=0;t=ge;ge=ge+e|0;ge=ge+15&-16;return t|0}function mt(){return ge|0}function _t(e){e=e|0;ge=e}function gt(e,t){e=e|0;t=t|0;ge=e;x=t}function vt(e,t){e=e|0;t=t|0;if(!E){E=e;S=t}}function yt(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0]}function bt(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0];pe[te+4>>0]=pe[e+4>>0];pe[te+5>>0]=pe[e+5>>0];pe[te+6>>0]=pe[e+6>>0];pe[te+7>>0]=pe[e+7>>0]}function xt(e){e=e|0;re=e}function Tt(){return re|0}function F(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ge;ge=ge+608|0;f=m+88|0;c=m+72|0;l=m+64|0;s=m+48|0;a=m+24|0;o=m;h=m+96|0;p=m+92|0;u=e+4|0;d=e+8|0;if((de[u>>2]|0)>>>0>(de[d>>2]|0)>>>0){de[o>>2]=1154;de[o+4>>2]=2120;de[o+8>>2]=1133;xe(h,1100,o)|0;be(h,m+16|0)|0}if((2147418112/(i>>>0)|0)>>>0<=t>>>0){de[a>>2]=1154;de[a+4>>2]=2121;de[a+8>>2]=1169;xe(h,1100,a)|0;be(h,m+40|0)|0}a=de[d>>2]|0;if(a>>>0>=t>>>0){d=1;ge=m;return d|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){de[s>>2]=1154;de[s+4>>2]=2130;de[s+8>>2]=1217;xe(h,1100,s)|0;be(h,l)|0}r=ve(t,i)|0;do{if(!n){o=wt(de[e>>2]|0,r,p,1)|0;if(!o){d=0;ge=m;return d|0}else{de[e>>2]=o;break}}else{a=j(r,p)|0;if(!a){d=0;ge=m;return d|0}Ci[n&0](a,de[e>>2]|0,de[u>>2]|0);o=de[e>>2]|0;do{if(o)if(!(o&7)){X[de[104>>2]&1](o,0,0,1,de[27]|0)|0;break}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;xe(h,1100,c)|0;be(h,f)|0;break}}while(0);de[e>>2]=a}}while(0);o=de[p>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(i>>>0)|0;de[d>>2]=t;d=1;ge=m;return d|0}function wt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=ge;ge=ge+592|0;l=u+48|0;o=u+24|0;n=u;s=u+72|0;a=u+68|0;if(e&7){de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1494;xe(s,1100,n)|0;be(s,u+16|0)|0;l=0;ge=u;return l|0}if(t>>>0>2147418112){de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1387;xe(s,1100,o)|0;be(s,u+40|0)|0;l=0;ge=u;return l|0}de[a>>2]=t;i=X[de[104>>2]&1](e,t,a,i,de[27]|0)|0;if(r)de[r>>2]=de[a>>2];if(!(i&7)){l=i;ge=u;return l|0}de[l>>2]=1154;de[l+4>>2]=2551;de[l+8>>2]=1440;xe(s,1100,l)|0;be(s,u+64|0)|0;l=i;ge=u;return l|0}function j(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ge;ge=ge+592|0;a=l+48|0;s=l+24|0;r=l;o=l+72|0;n=l+68|0;i=e+3&-4;i=(i|0)!=0?i:4;if(i>>>0>2147418112){de[r>>2]=1154;de[r+4>>2]=2499;de[r+8>>2]=1387;xe(o,1100,r)|0;be(o,l+16|0)|0;s=0;ge=l;return s|0}de[n>>2]=i;r=X[de[104>>2]&1](0,i,n,1,de[27]|0)|0;e=de[n>>2]|0;if(t)de[t>>2]=e;if((r|0)==0|e>>>0
>>0){de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1413;xe(o,1100,s)|0;be(o,l+40|0)|0;s=0;ge=l;return s|0}if(!(r&7)){s=r;ge=l;return s|0}de[a>>2]=1154;de[a+4>>2]=2526;de[a+8>>2]=1440;xe(o,1100,a)|0;be(o,l+64|0)|0;s=r;ge=l;return s|0}function Et(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,O=0,P=0,R=0,F=0,C=0,N=0,M=0,z=0,I=0,D=0,L=0;L=ge;ge=ge+960|0;z=L+232|0;M=L+216|0;N=L+208|0;C=L+192|0;F=L+184|0;R=L+168|0;P=L+160|0;O=L+144|0;S=L+136|0;E=L+120|0;w=L+112|0;T=L+96|0;y=L+88|0;v=L+72|0;g=L+64|0;_=L+48|0;c=L+40|0;p=L+24|0;f=L+16|0;h=L;k=L+440|0;I=L+376|0;D=L+304|0;m=L+236|0;if((t|0)==0|i>>>0>11){e=0;ge=L;return e|0}de[e>>2]=t;n=D;o=n+68|0;do{de[n>>2]=0;n=n+4|0}while((n|0)<(o|0));o=0;do{n=pe[r+o>>0]|0;if(n<<24>>24){A=D+((n&255)<<2)|0;de[A>>2]=(de[A>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;u=1;a=0;s=-1;l=0;while(1){n=de[D+(u<<2)>>2]|0;if(!n)de[e+28+(u+-1<<2)>>2]=0;else{A=u+-1|0;de[I+(A<<2)>>2]=o;o=n+o|0;x=16-u|0;de[e+28+(A<<2)>>2]=(o+-1<>2]=l;de[m+(u<<2)>>2]=l;a=a>>>0>u>>>0?a:u;s=s>>>0>>0?s:u;l=n+l|0}u=u+1|0;if((u|0)==17){A=a;break}else o=o<<1}de[e+4>>2]=l;o=e+172|0;do{if(l>>>0>(de[o>>2]|0)>>>0){de[o>>2]=l;if(l){n=l+-1|0;if(n&l)d=14}else{n=-1;d=14}if((d|0)==14){x=n>>>16|n;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;de[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;n=de[a>>2]|0;do{if(n){x=de[n+-4>>2]|0;n=n+-8|0;if(!((x|0)!=0?(x|0)==(~de[n>>2]|0):0)){de[h>>2]=1154;de[h+4>>2]=644;de[h+8>>2]=1863;xe(k,1100,h)|0;be(k,f)|0}if(!(n&7)){X[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;xe(k,1100,p)|0;be(k,c)|0;break}}}while(0);o=de[o>>2]|0;o=(o|0)!=0?o:1;n=j((o<<1)+8|0,0)|0;if(!n){de[a>>2]=0;n=0;break}else{de[n+4>>2]=o;de[n>>2]=~o;de[a>>2]=n+8;d=25;break}}else d=25}while(0);e:do{if((d|0)==25){x=e+24|0;pe[x>>0]=s;pe[e+25>>0]=A;o=e+176|0;a=0;do{b=pe[r+a>>0]|0;n=b&255;if(b<<24>>24){if(!(de[D+(n<<2)>>2]|0)){de[_>>2]=1154;de[_+4>>2]=2273;de[_+8>>2]=1261;xe(k,1100,_)|0;be(k,g)|0}b=m+(n<<2)|0;n=de[b>>2]|0;de[b>>2]=n+1;if(n>>>0>=l>>>0){de[v>>2]=1154;de[v+4>>2]=2277;de[v+8>>2]=1274;xe(k,1100,v)|0;be(k,y)|0}$[(de[o>>2]|0)+(n<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));n=pe[x>>0]|0;y=(n&255)>>>0>>0?i:0;b=e+8|0;de[b>>2]=y;v=(y|0)!=0;if(v){g=1<>>0>(de[n>>2]|0)>>>0){de[n>>2]=g;a=e+168|0;n=de[a>>2]|0;do{if(n){_=de[n+-4>>2]|0;n=n+-8|0;if(!((_|0)!=0?(_|0)==(~de[n>>2]|0):0)){de[T>>2]=1154;de[T+4>>2]=644;de[T+8>>2]=1863;xe(k,1100,T)|0;be(k,w)|0}if(!(n&7)){X[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[E>>2]=1154;de[E+4>>2]=2499;de[E+8>>2]=1516;xe(k,1100,E)|0;be(k,S)|0;break}}}while(0);n=g<<2;o=j(n+8|0,0)|0;if(!o){de[a>>2]=0;n=0;break e}else{S=o+8|0;de[o+4>>2]=g;de[o>>2]=~g;de[a>>2]=S;o=S;break}}else{o=e+168|0;n=g<<2;a=o;o=de[o>>2]|0}}while(0);G(o|0,-1,n|0)|0;d=e+176|0;_=1;do{if(de[D+(_<<2)>>2]|0){t=y-_|0;m=1<>2]|0;if(o>>>0>=16){de[O>>2]=1154;de[O+4>>2]=1953;de[O+8>>2]=1737;xe(k,1100,O)|0;be(k,P)|0}n=de[e+28+(o<<2)>>2]|0;if(!n)p=-1;else p=(n+-1|0)>>>(16-_|0);if(s>>>0<=p>>>0){c=(de[e+96+(o<<2)>>2]|0)-s|0;f=_<<16;do{n=_e[(de[d>>2]|0)+(c+s<<1)>>1]|0;if((me[r+n>>0]|0|0)!=(_|0)){de[R>>2]=1154;de[R+4>>2]=2319;de[R+8>>2]=1303;xe(k,1100,R)|0;be(k,F)|0}h=s<>>0>=g>>>0){de[C>>2]=1154;de[C+4>>2]=2325;de[C+8>>2]=1337;xe(k,1100,C)|0;be(k,N)|0}n=de[a>>2]|0;if((de[n+(l<<2)>>2]|0)!=-1){de[M>>2]=1154;de[M+4>>2]=2327;de[M+8>>2]=1360;xe(k,1100,M)|0;be(k,z)|0;n=de[a>>2]|0}de[n+(l<<2)>>2]=o;u=u+1|0}while(u>>>0>>0);s=s+1|0}while(s>>>0<=p>>>0)}}_=_+1|0}while(y>>>0>=_>>>0);n=pe[x>>0]|0}o=e+96|0;de[o>>2]=(de[o>>2]|0)-(de[I>>2]|0);o=e+100|0;de[o>>2]=(de[o>>2]|0)-(de[I+4>>2]|0);o=e+104|0;de[o>>2]=(de[o>>2]|0)-(de[I+8>>2]|0);o=e+108|0;de[o>>2]=(de[o>>2]|0)-(de[I+12>>2]|0);o=e+112|0;de[o>>2]=(de[o>>2]|0)-(de[I+16>>2]|0);o=e+116|0;de[o>>2]=(de[o>>2]|0)-(de[I+20>>2]|0);o=e+120|0;de[o>>2]=(de[o>>2]|0)-(de[I+24>>2]|0);o=e+124|0;de[o>>2]=(de[o>>2]|0)-(de[I+28>>2]|0);o=e+128|0;de[o>>2]=(de[o>>2]|0)-(de[I+32>>2]|0);o=e+132|0;de[o>>2]=(de[o>>2]|0)-(de[I+36>>2]|0);o=e+136|0;de[o>>2]=(de[o>>2]|0)-(de[I+40>>2]|0);o=e+140|0;de[o>>2]=(de[o>>2]|0)-(de[I+44>>2]|0);o=e+144|0;de[o>>2]=(de[o>>2]|0)-(de[I+48>>2]|0);o=e+148|0;de[o>>2]=(de[o>>2]|0)-(de[I+52>>2]|0);o=e+152|0;de[o>>2]=(de[o>>2]|0)-(de[I+56>>2]|0);o=e+156|0;de[o>>2]=(de[o>>2]|0)-(de[I+60>>2]|0);o=e+16|0;de[o>>2]=0;a=e+20|0;de[a>>2]=n&255;t:do{if(v){while(1){if(!i)break t;n=i+-1|0;if(!(de[D+(i<<2)>>2]|0))i=n;else break}de[o>>2]=de[e+28+(n<<2)>>2];n=y+1|0;de[a>>2]=n;if(n>>>0<=A>>>0){while(1){if(de[D+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>A>>>0)break t}de[a>>2]=n}}}while(0);de[e+92>>2]=-1;de[e+160>>2]=1048575;de[e+12>>2]=32-(de[b>>2]|0);n=1}}while(0);e=n;ge=L;return e|0}function St(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0;if(!e){n=Yr(t)|0;if(!r){r=n;return r|0}if(!n)o=0;else o=qr(n)|0;de[r>>2]=o;r=n;return r|0}if(!t){b(e);if(!r){r=0;return r|0}de[r>>2]=0;r=0;return r|0}n=Wr(e,t)|0;o=(n|0)!=0;if(o|i^1)o=o?n:e;else{n=Wr(e,t)|0;o=(n|0)==0?e:n}if(!r){r=n;return r|0}t=qr(o)|0;de[r>>2]=t;r=n;return r|0}function _(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((de[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}de[r+4>>2]=(me[e+12>>0]|0)<<8|(me[e+13>>0]|0);de[r+8>>2]=(me[e+14>>0]|0)<<8|(me[e+15>>0]|0);de[r+12>>2]=me[e+16>>0];de[r+16>>2]=me[e+17>>0];t=e+18|0;i=r+32|0;de[i>>2]=me[t>>0];de[i+4>>2]=0;t=pe[t>>0]|0;de[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;de[r+24>>2]=(me[e+26>>0]|0)<<16|(me[e+25>>0]|0)<<24|(me[e+27>>0]|0)<<8|(me[e+28>>0]|0);de[r+28>>2]=(me[e+30>>0]|0)<<16|(me[e+29>>0]|0)<<24|(me[e+31>>0]|0)<<8|(me[e+32>>0]|0);r=1;return r|0}function At(e){e=e|0;Ze(e|0)|0;$t()}function N(e){e=e|0;var t=0,r=0,i=0,n=0,o=0;o=ge;ge=ge+544|0;n=o;i=o+24|0;t=de[e+20>>2]|0;if(t)kt(t);t=e+4|0;r=de[t>>2]|0;if(!r){n=e+16|0;pe[n>>0]=0;ge=o;return}if(!(r&7))X[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;xe(i,1100,n)|0;be(i,o+16|0)|0}de[t>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;n=e+16|0;pe[n>>0]=0;ge=o}function kt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=ge;ge=ge+640|0;f=p+112|0;c=p+96|0;h=p+88|0;u=p+72|0;l=p+64|0;s=p+48|0;i=p+40|0;o=p+24|0;n=p+16|0;r=p;a=p+120|0;if(!e){ge=p;return}t=de[e+168>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[r>>2]=1154;de[r+4>>2]=644;de[r+8>>2]=1863;xe(a,1100,r)|0;be(a,n)|0}if(!(t&7)){X[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1516;xe(a,1100,o)|0;be(a,i)|0;break}}}while(0);t=de[e+176>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[s>>2]=1154;de[s+4>>2]=644;de[s+8>>2]=1863;xe(a,1100,s)|0;be(a,l)|0}if(!(t&7)){X[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[u>>2]=1154;de[u+4>>2]=2499;de[u+8>>2]=1516;xe(a,1100,u)|0;be(a,h)|0;break}}}while(0);if(!(e&7)){X[de[104>>2]&1](e,0,0,1,de[27]|0)|0;ge=p}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;xe(a,1100,c)|0;be(a,f)|0;ge=p}}function Ot(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ge;ge=ge+560|0;a=h+40|0;s=h+24|0;t=h;o=h+48|0;n=e+8|0;r=de[n>>2]|0;if((r+-1|0)>>>0>=8192){de[t>>2]=1154;de[t+4>>2]=2997;de[t+8>>2]=1541;xe(o,1100,t)|0;be(o,h+16|0)|0}de[e>>2]=r;i=e+20|0;t=de[i>>2]|0;if(!t){t=j(180,0)|0;if(!t)t=0;else{u=t+164|0;de[u>>2]=0;de[u+4>>2]=0;de[u+8>>2]=0;de[u+12>>2]=0}de[i>>2]=t;u=t;l=de[e>>2]|0}else{u=t;l=r}if(!(de[n>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;xe(o,1100,s)|0;be(o,a)|0;o=de[e>>2]|0}else o=l;n=de[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;u=Et(u,l,n,e)|0;ge=h;return u|0}while(1){i=t+1|0;if(r>>>0>3){r=r>>>1;t=i}else{r=i;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;u=Et(u,l,n,e)|0;ge=h;return u|0}function U(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,O=0,P=0,R=0,C=0,M=0,I=0,D=0,L=0;L=ge;ge=ge+800|0;R=L+256|0;P=L+240|0;O=L+232|0;k=L+216|0;A=L+208|0;S=L+192|0;E=L+184|0;w=L+168|0;T=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;v=L+112|0;g=L+96|0;_=L+88|0;m=L+72|0;c=L+64|0;h=L+48|0;s=L+40|0;l=L+24|0;o=L+16|0;n=L;I=L+288|0;D=L+264|0;C=Pt(e,14)|0;if(!C){de[t>>2]=0;r=t+4|0;i=de[r>>2]|0;if(i){if(!(i&7))X[de[104>>2]&1](i,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;xe(I,1100,n)|0;be(I,o)|0}de[r>>2]=0;de[t+8>>2]=0;de[t+12>>2]=0}pe[t+16>>0]=0;r=t+20|0;i=de[r>>2]|0;if(!i){t=1;ge=L;return t|0}kt(i);de[r>>2]=0;t=1;ge=L;return t|0}p=t+4|0;d=t+8|0;r=de[d>>2]|0;if((r|0)!=(C|0)){if(r>>>0<=C>>>0){do{if((de[t+12>>2]|0)>>>0>>0){if(F(p,C,(r+1|0)==(C|0),1,0)|0){r=de[d>>2]|0;break}pe[t+16>>0]=1;t=0;ge=L;return t|0}}while(0);G((de[p>>2]|0)+r|0,0,C-r|0)|0}de[d>>2]=C}G(de[p>>2]|0,0,C|0)|0;f=e+20|0;r=de[f>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;n=e+16|0;do{i=de[o>>2]|0;if((i|0)==(de[a>>2]|0))i=0;else{de[o>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;xe(I,1100,l)|0;be(I,s)|0;r=de[f>>2]|0}i=i<<32-r|de[n>>2];de[n>>2]=i}while((r|0)<5)}else{i=e+16|0;n=i;i=de[i>>2]|0}u=i>>>27;de[n>>2]=i<<5;de[f>>2]=r+-5;if((u+-1|0)>>>0>20){t=0;ge=L;return t|0}de[D+20>>2]=0;de[D>>2]=0;de[D+4>>2]=0;de[D+8>>2]=0;de[D+12>>2]=0;pe[D+16>>0]=0;r=D+4|0;i=D+8|0;e:do{if(F(r,21,0,1,0)|0){s=de[i>>2]|0;l=de[r>>2]|0;G(l+s|0,0,21-s|0)|0;de[i>>2]=21;if(u){n=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=de[f>>2]|0;if((r|0)<3)do{i=de[n>>2]|0;if((i|0)==(de[o>>2]|0))i=0;else{de[n>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[h>>2]=1154;de[h+4>>2]=3199;de[h+8>>2]=1650;xe(I,1100,h)|0;be(I,c)|0;r=de[f>>2]|0}i=i<<32-r|de[a>>2];de[a>>2]=i}while((r|0)<3);else i=de[a>>2]|0;de[a>>2]=i<<3;de[f>>2]=r+-3;pe[l+(me[1611+s>>0]|0)>>0]=i>>>29;s=s+1|0}while((s|0)!=(u|0))}if(Ot(D)|0){s=e+4|0;l=e+8|0;u=e+16|0;i=0;t:while(1){a=C-i|0;r=ye(e,D)|0;r:do{if(r>>>0<17){if((de[d>>2]|0)>>>0<=i>>>0){de[m>>2]=1154;de[m+4>>2]=903;de[m+8>>2]=1781;xe(I,1100,m)|0;be(I,_)|0}pe[(de[p>>2]|0)+i>>0]=r;r=i+1|0}else switch(r|0){case 17:{r=de[f>>2]|0;if((r|0)<3)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[g>>2]=1154;de[g+4>>2]=3199;de[g+8>>2]=1650;xe(I,1100,g)|0;be(I,v)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<3);else n=de[u>>2]|0;de[u>>2]=n<<3;de[f>>2]=r+-3;r=(n>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}case 18:{r=de[f>>2]|0;if((r|0)<7)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[y>>2]=1154;de[y+4>>2]=3199;de[y+8>>2]=1650;xe(I,1100,y)|0;be(I,b)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<7);else n=de[u>>2]|0;de[u>>2]=n<<7;de[f>>2]=r+-7;r=(n>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}default:{if((r+-19|0)>>>0>=2){M=90;break t}o=de[f>>2]|0;if((r|0)==19){if((o|0)<2){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[x>>2]=1154;de[x+4>>2]=3199;de[x+8>>2]=1650;xe(I,1100,x)|0;be(I,T)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<2)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<2;de[f>>2]=r+-2;o=(n>>>30)+3|0}else{if((o|0)<6){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[w>>2]=1154;de[w+4>>2]=3199;de[w+8>>2]=1650;xe(I,1100,w)|0;be(I,E)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<6)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<6;de[f>>2]=r+-6;o=(n>>>26)+7|0}if((i|0)==0|o>>>0>a>>>0){r=0;break e}r=i+-1|0;if((de[d>>2]|0)>>>0<=r>>>0){de[S>>2]=1154;de[S+4>>2]=903;de[S+8>>2]=1781;xe(I,1100,S)|0;be(I,A)|0}n=pe[(de[p>>2]|0)+r>>0]|0;if(!(n<<24>>24)){r=0;break e}r=o+i|0;if(i>>>0>=r>>>0){r=i;break r}do{if((de[d>>2]|0)>>>0<=i>>>0){de[k>>2]=1154;de[k+4>>2]=903;de[k+8>>2]=1781;xe(I,1100,k)|0;be(I,O)|0}pe[(de[p>>2]|0)+i>>0]=n;i=i+1|0}while((i|0)!=(r|0))}}}while(0);if(C>>>0>r>>>0)i=r;else break}if((M|0)==90){de[P>>2]=1154;de[P+4>>2]=3140;de[P+8>>2]=1632;xe(I,1100,P)|0;be(I,R)|0;r=0;break}if((C|0)==(r|0))r=Ot(t)|0;else r=0}else r=0}else{pe[D+16>>0]=1;r=0}}while(0);N(D);t=r;ge=L;return t|0}function Pt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ge;ge=ge+544|0;s=h+16|0;a=h;o=h+24|0;if(!t){u=0;ge=h;return u|0}if(t>>>0<=16){u=Rt(e,t)|0;ge=h;return u|0}l=Rt(e,t+-16|0)|0;u=e+20|0;t=de[u>>2]|0;if((t|0)<16){i=e+4|0;n=e+8|0;r=e+16|0;do{e=de[i>>2]|0;if((e|0)==(de[n>>2]|0))e=0;else{de[i>>2]=e+1;e=me[e>>0]|0}t=t+8|0;de[u>>2]=t;if((t|0)>=33){de[a>>2]=1154;de[a+4>>2]=3199;de[a+8>>2]=1650;xe(o,1100,a)|0;be(o,s)|0;t=de[u>>2]|0}e=e<<32-t|de[r>>2];de[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=de[e>>2]|0}de[r>>2]=e<<16;de[u>>2]=t+-16;u=e>>>16|l<<16;ge=h;return u|0}function ye(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0;y=ge;ge=ge+608|0;m=y+88|0;d=y+72|0;f=y+64|0;c=y+48|0;h=y+40|0;p=y+24|0;u=y+16|0;l=y;g=y+96|0;_=de[t+20>>2]|0;v=e+20|0;s=de[v>>2]|0;do{if((s|0)<24){a=e+4|0;i=de[a>>2]|0;n=de[e+8>>2]|0;r=i>>>0>>0;if((s|0)>=16){if(r){de[a>>2]=i+1;r=me[i>>0]|0}else r=0;de[v>>2]=s+8;a=e+16|0;o=r<<24-s|de[a>>2];de[a>>2]=o;break}if(r){o=(me[i>>0]|0)<<8;r=i+1|0}else{o=0;r=i}if(r>>>0>>0){i=me[r>>0]|0;r=r+1|0}else i=0;de[a>>2]=r;de[v>>2]=s+16;a=e+16|0;o=(i|o)<<16-s|de[a>>2];de[a>>2]=o}else{o=e+16|0;a=o;o=de[o>>2]|0}}while(0);n=(o>>>16)+1|0;do{if(n>>>0<=(de[_+16>>2]|0)>>>0){i=de[(de[_+168>>2]|0)+(o>>>(32-(de[_+8>>2]|0)|0)<<2)>>2]|0;if((i|0)==-1){de[l>>2]=1154;de[l+4>>2]=3244;de[l+8>>2]=1677;xe(g,1100,l)|0;be(g,u)|0}r=i&65535;i=i>>>16;if((de[t+8>>2]|0)>>>0<=r>>>0){de[p>>2]=1154;de[p+4>>2]=902;de[p+8>>2]=1781;xe(g,1100,p)|0;be(g,h)|0}if((me[(de[t+4>>2]|0)+r>>0]|0|0)!=(i|0)){de[c>>2]=1154;de[c+4>>2]=3248;de[c+8>>2]=1694;xe(g,1100,c)|0;be(g,f)|0}}else{i=de[_+20>>2]|0;while(1){r=i+-1|0;if(n>>>0>(de[_+28+(r<<2)>>2]|0)>>>0)i=i+1|0;else break}r=(o>>>(32-i|0))+(de[_+96+(r<<2)>>2]|0)|0;if(r>>>0<(de[t>>2]|0)>>>0){r=_e[(de[_+176>>2]|0)+(r<<1)>>1]|0;break}de[d>>2]=1154;de[d+4>>2]=3266;de[d+8>>2]=1632;xe(g,1100,d)|0;be(g,m)|0;v=0;ge=y;return v|0}}while(0);de[a>>2]=de[a>>2]<>2]=(de[v>>2]|0)-i;v=r;ge=y;return v|0}function Rt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ge;ge=ge+560|0;s=h+40|0;l=h+24|0;r=h;a=h+48|0;if(t>>>0>=33){de[r>>2]=1154;de[r+4>>2]=3190;de[r+8>>2]=1634;xe(a,1100,r)|0;be(a,h+16|0)|0}u=e+20|0;r=de[u>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=de[o>>2]|0;s=r;l=32-t|0;l=o>>>l;o=o<>2]=o;t=s-t|0;de[u>>2]=t;ge=h;return l|0}n=e+4|0;o=e+8|0;i=e+16|0;do{e=de[n>>2]|0;if((e|0)==(de[o>>2]|0))e=0;else{de[n>>2]=e+1;e=me[e>>0]|0}r=r+8|0;de[u>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;xe(a,1100,l)|0;be(a,s)|0;r=de[u>>2]|0}e=e<<32-r|de[i>>2];de[i>>2]=e}while((r|0)<(t|0));l=32-t|0;l=e>>>l;s=e<>2]=s;t=r-t|0;de[u>>2]=t;ge=h;return l|0}function Ct(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0;d=ge;ge=ge+544|0;f=d+16|0;c=d;h=d+24|0;if((e|0)==0|t>>>0<62){p=0;ge=d;return p|0}u=j(300,0)|0;if(!u){p=0;ge=d;return p|0}de[u>>2]=519686845;r=u+4|0;de[r>>2]=0;i=u+8|0;de[i>>2]=0;l=u+88|0;n=u+136|0;o=u+160|0;a=l;s=a+44|0;do{de[a>>2]=0;a=a+4|0}while((a|0)<(s|0));pe[l+44>>0]=0;m=u+184|0;a=u+208|0;s=u+232|0;_=u+252|0;de[_>>2]=0;de[_+4>>2]=0;de[_+8>>2]=0;pe[_+12>>0]=0;_=u+268|0;de[_>>2]=0;de[_+4>>2]=0;de[_+8>>2]=0;pe[_+12>>0]=0;_=u+284|0;de[_>>2]=0;de[_+4>>2]=0;de[_+8>>2]=0;pe[_+12>>0]=0;de[n>>2]=0;de[n+4>>2]=0;de[n+8>>2]=0;de[n+12>>2]=0;de[n+16>>2]=0;pe[n+20>>0]=0;de[o>>2]=0;de[o+4>>2]=0;de[o+8>>2]=0;de[o+12>>2]=0;de[o+16>>2]=0;pe[o+20>>0]=0;de[m>>2]=0;de[m+4>>2]=0;de[m+8>>2]=0;de[m+12>>2]=0;de[m+16>>2]=0;pe[m+20>>0]=0;de[a>>2]=0;de[a+4>>2]=0;de[a+8>>2]=0;de[a+12>>2]=0;de[a+16>>2]=0;pe[a+20>>0]=0;de[s>>2]=0;de[s+4>>2]=0;de[s+8>>2]=0;de[s+12>>2]=0;pe[s+16>>0]=0;do{if(((t>>>0>=74?((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)==18552:0)?((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0>=74:0)?((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0<=t>>>0:0){de[l>>2]=e;de[r>>2]=e;de[i>>2]=t;if(jt(u)|0){r=de[l>>2]|0;if((me[r+39>>0]|0)<<8|(me[r+40>>0]|0)){if(!(Ut(u)|0))break;if(!(Gt(u)|0))break;r=de[l>>2]|0}if(!((me[r+55>>0]|0)<<8|(me[r+56>>0]|0))){_=u;ge=d;return _|0}if(Xt(u)|0?Ht(u)|0:0){_=u;ge=d;return _|0}}}else p=7}while(0);if((p|0)==7)de[l>>2]=0;Kt(u);if(!(u&7)){X[de[104>>2]&1](u,0,0,1,de[27]|0)|0;_=0;ge=d;return _|0}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;xe(h,1100,c)|0;be(h,f)|0;_=0;ge=d;return _|0}return 0}function Mt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0;h=ge;ge=ge+544|0;u=h;l=h+24|0;o=de[e+88>>2]|0;s=(me[o+70+(n<<2)+1>>0]|0)<<16|(me[o+70+(n<<2)>>0]|0)<<24|(me[o+70+(n<<2)+2>>0]|0)<<8|(me[o+70+(n<<2)+3>>0]|0);a=n+1|0;if(a>>>0<(me[o+16>>0]|0)>>>0)o=(me[o+70+(a<<2)+1>>0]|0)<<16|(me[o+70+(a<<2)>>0]|0)<<24|(me[o+70+(a<<2)+2>>0]|0)<<8|(me[o+70+(a<<2)+3>>0]|0);else o=de[e+8>>2]|0;if(o>>>0>s>>>0){l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=It(e,l,u,t,r,i,n)|0;ge=h;return u|0}de[u>>2]=1154;de[u+4>>2]=3704;de[u+8>>2]=1792;xe(l,1100,u)|0;be(l,h+16|0)|0;l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=It(e,l,u,t,r,i,n)|0;ge=h;return u|0}function It(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;var s=0,l=0,u=0,h=0;h=de[e+88>>2]|0;l=((me[h+12>>0]|0)<<8|(me[h+13>>0]|0))>>>a;u=((me[h+14>>0]|0)<<8|(me[h+15>>0]|0))>>>a;l=l>>>0>1?(l+3|0)>>>2:1;u=u>>>0>1?(u+3|0)>>>2:1;h=h+18|0;a=pe[h>>0]|0;a=ve(a<<24>>24==0|a<<24>>24==9?8:16,l)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((ve(a,u)|0)>>>0>n>>>0){e=0;return e|0}o=(l+1|0)>>>1;s=(u+1|0)>>>1;if(!r){e=0;return e|0}de[e+92>>2]=t;de[e+96>>2]=t;de[e+104>>2]=r;de[e+100>>2]=t+r;de[e+108>>2]=0;de[e+112>>2]=0;switch(me[h>>0]|0|0){case 0:{Yt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Wt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 9:{qt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 8:case 7:{Vt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function Dt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ge;ge=ge+48|0;r=i;de[r>>2]=40;_(e,t,r)|0;ge=i;return de[r+4>>2]|0}function Lt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ge;ge=ge+48|0;r=i;de[r>>2]=40;_(e,t,r)|0;ge=i;return de[r+8>>2]|0}function Ft(e,t){e=e|0;t=t|0;var r=0,i=0;i=ge;ge=ge+48|0;r=i;de[r>>2]=40;_(e,t,r)|0;ge=i;return de[r+12>>2]|0}function Nt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ge;ge=ge+48|0;r=i;de[r>>2]=40;_(e,t,r)|0;ge=i;return de[r+32>>2]|0}function zt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0;l=ge;ge=ge+576|0;a=l+56|0;o=l+40|0;n=l+64|0;u=l;de[u>>2]=40;_(e,t,u)|0;i=(((de[u+4>>2]|0)>>>r)+3|0)>>>2;t=(((de[u+8>>2]|0)>>>r)+3|0)>>>2;r=u+32|0;e=de[r+4>>2]|0;do{switch(de[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){de[o>>2]=1154;de[o+4>>2]=2663;de[o+8>>2]=1535;xe(n,1100,o)|0;be(n,a)|0;e=0}u=ve(ve(t,i)|0,e)|0;ge=l;return u|0}function Bt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;d=ge;ge=ge+608|0;f=d+80|0;p=d+64|0;s=d+56|0;a=d+40|0;h=d+88|0;m=d;c=d+84|0;de[m>>2]=40;_(e,t,m)|0;l=(((de[m+4>>2]|0)>>>n)+3|0)>>>2;m=m+32|0;o=de[m+4>>2]|0;do{switch(de[m>>2]|0){case 0:{if(!o)o=8;else u=13;break}case 1:{if(!o)u=12;else u=13;break}case 2:{if(!o)u=12;else u=13;break}case 3:{if(!o)u=12;else u=13;break}case 4:{if(!o)u=12;else u=13;break}case 5:{if(!o)u=12;else u=13;break}case 6:{if(!o)u=12;else u=13;break}case 7:{if(!o)u=12;else u=13;break}case 8:{if(!o)u=12;else u=13;break}case 9:{if(!o)o=8;else u=13;break}default:u=13}}while(0);if((u|0)==12)o=16;else if((u|0)==13){de[a>>2]=1154;de[a+4>>2]=2663;de[a+8>>2]=1535;xe(h,1100,a)|0;be(h,s)|0;o=0}s=ve(o,l)|0;a=Ct(e,t)|0;de[c>>2]=r;o=(a|0)==0;if(!(n>>>0>15|(i>>>0<8|o))?(de[a>>2]|0)==519686845:0)Mt(a,c,i,s,n)|0;if(o){ge=d;return}if((de[a>>2]|0)!=519686845){ge=d;return}Kt(a);if(!(a&7)){X[de[104>>2]&1](a,0,0,1,de[27]|0)|0;ge=d;return}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;xe(h,1100,p)|0;be(h,f)|0;ge=d;return}}function jt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;a=e+92|0;i=de[e+4>>2]|0;o=e+88|0;n=de[o>>2]|0;t=(me[n+68>>0]|0)<<8|(me[n+67>>0]|0)<<16|(me[n+69>>0]|0);r=i+t|0;n=(me[n+65>>0]|0)<<8|(me[n+66>>0]|0);if(!n){e=0;return e|0}de[a>>2]=r;de[e+96>>2]=r;de[e+104>>2]=n;de[e+100>>2]=i+(n+t);de[e+108>>2]=0;de[e+112>>2]=0;if(!(U(a,e+116|0)|0)){e=0;return e|0}t=de[o>>2]|0;do{if(!((me[t+39>>0]|0)<<8|(me[t+40>>0]|0))){if(!((me[t+55>>0]|0)<<8|(me[t+56>>0]|0))){e=0;return e|0}}else{if(!(U(a,e+140|0)|0)){e=0;return e|0}if(U(a,e+188|0)|0){t=de[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((me[t+55>>0]|0)<<8|(me[t+56>>0]|0)){if(!(U(a,e+164|0)|0)){e=0;return e|0}if(!(U(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function Ut(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ge;ge=ge+592|0;l=d+16|0;s=d;a=d+72|0;p=d+24|0;i=e+88|0;t=de[i>>2]|0;f=(me[t+39>>0]|0)<<8|(me[t+40>>0]|0);h=e+236|0;o=e+240|0;r=de[o>>2]|0;if((r|0)!=(f|0)){if(r>>>0<=f>>>0){do{if((de[e+244>>2]|0)>>>0>>0){if(F(h,f,(r+1|0)==(f|0),4,0)|0){t=de[o>>2]|0;break}pe[e+248>>0]=1;p=0;ge=d;return p|0}else t=r}while(0);G((de[h>>2]|0)+(t<<2)|0,0,f-t<<2|0)|0;t=de[i>>2]|0}de[o>>2]=f}u=e+92|0;r=de[e+4>>2]|0;i=(me[t+34>>0]|0)<<8|(me[t+33>>0]|0)<<16|(me[t+35>>0]|0);n=r+i|0;t=(me[t+37>>0]|0)<<8|(me[t+36>>0]|0)<<16|(me[t+38>>0]|0);if(!t){p=0;ge=d;return p|0}de[u>>2]=n;de[e+96>>2]=n;de[e+104>>2]=t;de[e+100>>2]=r+(t+i);de[e+108>>2]=0;de[e+112>>2]=0;de[p+20>>2]=0;de[p>>2]=0;de[p+4>>2]=0;de[p+8>>2]=0;de[p+12>>2]=0;pe[p+16>>0]=0;e=p+24|0;de[p+44>>2]=0;de[e>>2]=0;de[e+4>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;pe[e+16>>0]=0;if(U(u,p)|0?(c=p+24|0,U(u,c)|0):0){if(!(de[o>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;xe(a,1100,s)|0;be(a,l)|0}if(!f)t=1;else{i=0;n=0;o=0;t=0;a=0;e=0;s=0;r=de[h>>2]|0;while(1){i=(ye(u,p)|0)+i&31;n=(ye(u,c)|0)+n&63;o=(ye(u,p)|0)+o&31;t=(ye(u,p)|0)+t|0;a=(ye(u,c)|0)+a&63;e=(ye(u,p)|0)+e&31;de[r>>2]=n<<5|i<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(f|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;N(p+24|0);N(p);p=t;ge=d;return p|0}function Gt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0;S=ge;ge=ge+1024|0;s=S+16|0;a=S;o=S+504|0;E=S+480|0;T=S+284|0;w=S+88|0;x=S+24|0;n=de[e+88>>2]|0;b=(me[n+47>>0]|0)<<8|(me[n+48>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+42>>0]|0)<<8|(me[n+41>>0]|0)<<16|(me[n+43>>0]|0);i=t+r|0;n=(me[n+45>>0]|0)<<8|(me[n+44>>0]|0)<<16|(me[n+46>>0]|0);if(!n){E=0;ge=S;return E|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[E+20>>2]=0;de[E>>2]=0;de[E+4>>2]=0;de[E+8>>2]=0;de[E+12>>2]=0;pe[E+16>>0]=0;if(U(y,E)|0){r=0;i=-3;n=-3;while(1){de[T+(r<<2)>>2]=i;de[w+(r<<2)>>2]=n;t=(i|0)>2;r=r+1|0;if((r|0)==49)break;else{i=t?-3:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));v=e+252|0;r=e+256|0;t=de[r>>2]|0;e:do{if((t|0)==(b|0))l=13;else{if(t>>>0<=b>>>0){do{if((de[e+260>>2]|0)>>>0>>0)if(F(v,b,(t+1|0)==(b|0),4,0)|0){t=de[r>>2]|0;break}else{pe[e+264>>0]=1;t=0;break e}}while(0);G((de[v>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}de[r>>2]=b;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;xe(o,1100,a)|0;be(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;_=x+60|0;g=0;r=de[v>>2]|0;while(1){t=0;do{A=ye(y,E)|0;v=t<<1;k=x+(v<<2)|0;de[k>>2]=(de[k>>2]|0)+(de[T+(A<<2)>>2]|0)&3;v=x+((v|1)<<2)|0;de[v>>2]=(de[v>>2]|0)+(de[w+(A<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);de[r>>2]=(me[1725+(de[i>>2]|0)>>0]|0)<<2|(me[1725+(de[x>>2]|0)>>0]|0)|(me[1725+(de[n>>2]|0)>>0]|0)<<4|(me[1725+(de[e>>2]|0)>>0]|0)<<6|(me[1725+(de[o>>2]|0)>>0]|0)<<8|(me[1725+(de[a>>2]|0)>>0]|0)<<10|(me[1725+(de[s>>2]|0)>>0]|0)<<12|(me[1725+(de[l>>2]|0)>>0]|0)<<14|(me[1725+(de[u>>2]|0)>>0]|0)<<16|(me[1725+(de[h>>2]|0)>>0]|0)<<18|(me[1725+(de[c>>2]|0)>>0]|0)<<20|(me[1725+(de[f>>2]|0)>>0]|0)<<22|(me[1725+(de[p>>2]|0)>>0]|0)<<24|(me[1725+(de[d>>2]|0)>>0]|0)<<26|(me[1725+(de[m>>2]|0)>>0]|0)<<28|(me[1725+(de[_>>2]|0)>>0]|0)<<30;g=g+1|0;if((g|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;N(E);k=t;ge=S;return k|0}function Xt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ge;ge=ge+560|0;l=f+16|0;s=f;a=f+48|0;c=f+24|0;n=de[e+88>>2]|0;h=(me[n+55>>0]|0)<<8|(me[n+56>>0]|0);u=e+92|0;t=de[e+4>>2]|0;r=(me[n+50>>0]|0)<<8|(me[n+49>>0]|0)<<16|(me[n+51>>0]|0);i=t+r|0;n=(me[n+53>>0]|0)<<8|(me[n+52>>0]|0)<<16|(me[n+54>>0]|0);if(!n){c=0;ge=f;return c|0}de[u>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[c+20>>2]=0;de[c>>2]=0;de[c+4>>2]=0;de[c+8>>2]=0;de[c+12>>2]=0;pe[c+16>>0]=0;e:do{if(U(u,c)|0){o=e+268|0;r=e+272|0;t=de[r>>2]|0;if((t|0)!=(h|0)){if(t>>>0<=h>>>0){do{if((de[e+276>>2]|0)>>>0>>0)if(F(o,h,(t+1|0)==(h|0),2,0)|0){t=de[r>>2]|0;break}else{pe[e+280>>0]=1;t=0;break e}}while(0);G((de[o>>2]|0)+(t<<1)|0,0,h-t<<1|0)|0}de[r>>2]=h}if(!h){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;xe(a,1100,s)|0;be(a,l)|0;t=1;break}r=0;i=0;n=0;t=de[o>>2]|0;while(1){l=ye(u,c)|0;r=l+r&255;i=(ye(u,c)|0)+i&255;$[t>>1]=i<<8|r;n=n+1|0;if((n|0)==(h|0)){t=1;break}else t=t+2|0}}else t=0}while(0);N(c);c=t;ge=f;return c|0}function Ht(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0;S=ge;ge=ge+2432|0;s=S+16|0;a=S;o=S+1912|0;E=S+1888|0;T=S+988|0;w=S+88|0;x=S+24|0;n=de[e+88>>2]|0;b=(me[n+63>>0]|0)<<8|(me[n+64>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+58>>0]|0)<<8|(me[n+57>>0]|0)<<16|(me[n+59>>0]|0);i=t+r|0;n=(me[n+61>>0]|0)<<8|(me[n+60>>0]|0)<<16|(me[n+62>>0]|0);if(!n){E=0;ge=S;return E|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[E+20>>2]=0;de[E>>2]=0;de[E+4>>2]=0;de[E+8>>2]=0;de[E+12>>2]=0;pe[E+16>>0]=0;if(U(y,E)|0){r=0;i=-7;n=-7;while(1){de[T+(r<<2)>>2]=i;de[w+(r<<2)>>2]=n;t=(i|0)>6;r=r+1|0;if((r|0)==225)break;else{i=t?-7:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));v=e+284|0;r=b*3|0;i=e+288|0;t=de[i>>2]|0;e:do{if((t|0)==(r|0))l=13;else{if(t>>>0<=r>>>0){do{if((de[e+292>>2]|0)>>>0>>0)if(F(v,r,(t+1|0)==(r|0),2,0)|0){t=de[i>>2]|0;break}else{pe[e+296>>0]=1;t=0;break e}}while(0);G((de[v>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}de[i>>2]=r;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;xe(o,1100,a)|0;be(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;_=x+60|0;g=0;r=de[v>>2]|0;while(1){t=0;do{A=ye(y,E)|0;v=t<<1;k=x+(v<<2)|0;de[k>>2]=(de[k>>2]|0)+(de[T+(A<<2)>>2]|0)&7;v=x+((v|1)<<2)|0;de[v>>2]=(de[v>>2]|0)+(de[w+(A<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);A=me[1729+(de[a>>2]|0)>>0]|0;$[r>>1]=(me[1729+(de[i>>2]|0)>>0]|0)<<3|(me[1729+(de[x>>2]|0)>>0]|0)|(me[1729+(de[n>>2]|0)>>0]|0)<<6|(me[1729+(de[e>>2]|0)>>0]|0)<<9|(me[1729+(de[o>>2]|0)>>0]|0)<<12|A<<15;k=me[1729+(de[c>>2]|0)>>0]|0;$[r+2>>1]=(me[1729+(de[s>>2]|0)>>0]|0)<<2|A>>>1|(me[1729+(de[l>>2]|0)>>0]|0)<<5|(me[1729+(de[u>>2]|0)>>0]|0)<<8|(me[1729+(de[h>>2]|0)>>0]|0)<<11|k<<14;$[r+4>>1]=(me[1729+(de[f>>2]|0)>>0]|0)<<1|k>>>2|(me[1729+(de[p>>2]|0)>>0]|0)<<4|(me[1729+(de[d>>2]|0)>>0]|0)<<7|(me[1729+(de[m>>2]|0)>>0]|0)<<10|(me[1729+(de[_>>2]|0)>>0]|0)<<13;g=g+1|0;if((g|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;N(E);k=t;ge=S;return k|0}function Yt(e,F,t,r,i,n,N,o){e=e|0;F=F|0;t=t|0;r=r|0;i=i|0;n=n|0;N=N|0;o=o|0;var a=0,s=0,l=0,z=0,u=0,h=0,c=0,f=0,B=0,j=0,p=0,U=0,G=0,d=0,m=0,X=0,_=0,g=0,H=0,Y=0,W=0,q=0,v=0,V=0,K=0,J=0,y=0,Z=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,b=0,x=0,T=0,w=0,E=0,S=0,oe=0,A=0,ae=0,k=0,se=0,O=0,le=0,ue=0,P=0,he=0,R=0,ce=0,C=0,M=0,fe=0,I=0,D=0,L=0;I=ge;ge=ge+720|0;fe=I+184|0;C=I+168|0;ce=I+160|0;R=I+144|0;he=I+136|0;P=I+120|0;ue=I+112|0;O=I+96|0;se=I+88|0;k=I+72|0;ae=I+64|0;A=I+48|0;oe=I+40|0;M=I+24|0;le=I+16|0;S=I;w=I+208|0;E=I+192|0;te=e+240|0;re=de[te>>2]|0;b=e+256|0;x=de[b>>2]|0;t=pe[(de[e+88>>2]|0)+17>>0]|0;T=r>>>2;if(!(t<<24>>24)){ge=I;return 1}ie=(o|0)==0;ne=o+-1|0;K=(n&1|0)!=0;J=r<<1;y=e+92|0;Z=e+116|0;Q=e+140|0;$=e+236|0;ee=N+-1|0;V=(i&1|0)!=0;v=e+188|0;g=e+252|0;H=T+1|0;Y=T+2|0;W=T+3|0;q=ee<<4;X=t&255;t=0;n=0;i=1;_=0;do{if(!ie){d=de[F+(_<<2)>>2]|0;m=0;while(1){p=m&1;a=(p|0)==0;j=(p<<5^32)+-16|0;p=(p<<1^2)+-1|0;G=a?N:-1;s=a?0:ee;e=(m|0)==(ne|0);U=K&e;if((s|0)!=(G|0)){B=K&e^1;f=a?d:d+q|0;while(1){if((i|0)==1)i=ye(y,Z)|0|512;c=i&7;i=i>>>3;a=me[1823+c>>0]|0;e=0;do{u=(ye(y,Q)|0)+n|0;h=u-re|0;n=h>>31;n=n&u|h&~n;if((de[te>>2]|0)>>>0<=n>>>0){de[S>>2]=1154;de[S+4>>2]=903;de[S+8>>2]=1781;xe(w,1100,S)|0;be(w,le)|0}de[E+(e<<2)>>2]=de[(de[$>>2]|0)+(n<<2)>>2];e=e+1|0}while(e>>>0>>0);h=V&(s|0)==(ee|0);if(U|h){u=0;do{l=ve(u,r)|0;e=f+l|0;a=(u|0)==0|B;z=u<<1;L=(ye(y,v)|0)+t|0;D=L-x|0;t=D>>31;t=t&L|D&~t;do{if(h){if(!a){D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;break}de[e>>2]=de[E+((me[1831+(c<<2)+z>>0]|0)<<2)>>2];if((de[b>>2]|0)>>>0<=t>>>0){de[R>>2]=1154;de[R+4>>2]=903;de[R+8>>2]=1781;xe(w,1100,R)|0;be(w,ce)|0}de[f+(l+4)>>2]=de[(de[g>>2]|0)+(t<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t}else{if(!a){D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;break}de[e>>2]=de[E+((me[1831+(c<<2)+z>>0]|0)<<2)>>2];if((de[b>>2]|0)>>>0<=t>>>0){de[P>>2]=1154;de[P+4>>2]=903;de[P+8>>2]=1781;xe(w,1100,P)|0;be(w,he)|0}de[f+(l+4)>>2]=de[(de[g>>2]|0)+(t<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;de[f+(l+8)>>2]=de[E+((me[(z|1)+(1831+(c<<2))>>0]|0)<<2)>>2];if((de[b>>2]|0)>>>0<=t>>>0){de[C>>2]=1154;de[C+4>>2]=903;de[C+8>>2]=1781;xe(w,1100,C)|0;be(w,fe)|0}de[f+(l+12)>>2]=de[(de[g>>2]|0)+(t<<2)>>2]}}while(0);u=u+1|0}while((u|0)!=2)}else{de[f>>2]=de[E+((me[1831+(c<<2)>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((de[b>>2]|0)>>>0<=t>>>0){de[M>>2]=1154;de[M+4>>2]=903;de[M+8>>2]=1781;xe(w,1100,M)|0;be(w,oe)|0}de[f+4>>2]=de[(de[g>>2]|0)+(t<<2)>>2];de[f+8>>2]=de[E+((me[1831+(c<<2)+1>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((de[b>>2]|0)>>>0<=t>>>0){de[A>>2]=1154;de[A+4>>2]=903;de[A+8>>2]=1781;xe(w,1100,A)|0;be(w,ae)|0}de[f+12>>2]=de[(de[g>>2]|0)+(t<<2)>>2];de[f+(T<<2)>>2]=de[E+((me[1831+(c<<2)+2>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((de[b>>2]|0)>>>0<=t>>>0){de[k>>2]=1154;de[k+4>>2]=903;de[k+8>>2]=1781;xe(w,1100,k)|0;be(w,se)|0}de[f+(H<<2)>>2]=de[(de[g>>2]|0)+(t<<2)>>2];de[f+(Y<<2)>>2]=de[E+((me[1831+(c<<2)+3>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((de[b>>2]|0)>>>0<=t>>>0){de[O>>2]=1154;de[O+4>>2]=903;de[O+8>>2]=1781;xe(w,1100,O)|0;be(w,ue)|0}de[f+(W<<2)>>2]=de[(de[g>>2]|0)+(t<<2)>>2]}s=s+p|0;if((s|0)==(G|0))break;else f=f+j|0}}m=m+1|0;if((m|0)==(o|0))break;else d=d+J|0}}_=_+1|0}while((_|0)!=(X|0));ge=I;return 1}function Wt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,F=0,N=0,d=0,m=0,_=0,g=0,v=0,z=0,B=0,y=0,b=0,x=0,T=0,j=0,w=0,U=0,G=0,X=0,H=0,Y=0,W=0,q=0,V=0,K=0,J=0,E=0,Z=0,Q=0,$=0,S=0,ee=0,te=0,A=0,re=0,k=0,ie=0,ne=0,oe=0,O=0,ae=0,se=0,P=0,le=0,R=0,ue=0,C=0,he=0,M=0,ce=0,fe=0,I=0,D=0,L=0;D=ge;ge=ge+640|0;ce=D+88|0;M=D+72|0;he=D+64|0;C=D+48|0;ue=D+40|0;I=D+24|0;fe=D+16|0;R=D;P=D+128|0;le=D+112|0;se=D+96|0;E=e+240|0;Z=de[E>>2]|0;S=e+256|0;oe=de[S>>2]|0;O=e+272|0;ae=de[O>>2]|0;r=de[e+88>>2]|0;Q=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ge=D;return 1}$=(s|0)==0;ee=s+-1|0;te=i<<1;A=e+92|0;re=e+116|0;k=a+-1|0;ie=e+212|0;ne=e+188|0;J=(n&1|0)==0;K=(o&1|0)==0;X=e+288|0;H=e+284|0;Y=e+252|0;W=e+140|0;q=e+236|0;V=e+164|0;U=e+268|0;G=k<<5;j=r&255;r=0;n=0;o=0;e=0;l=1;w=0;do{if(!$){x=de[t+(w<<2)>>2]|0;T=0;while(1){y=T&1;u=(y|0)==0;B=(y<<6^64)+-32|0;y=(y<<1^2)+-1|0;b=u?a:-1;h=u?0:k;if((h|0)!=(b|0)){z=K|(T|0)!=(ee|0);v=u?x:x+G|0;while(1){if((l|0)==1)l=ye(A,re)|0|512;g=l&7;l=l>>>3;c=me[1823+g>>0]|0;u=0;do{m=(ye(A,V)|0)+n|0;_=m-ae|0;n=_>>31;n=n&m|_&~n;if((de[O>>2]|0)>>>0<=n>>>0){de[R>>2]=1154;de[R+4>>2]=903;de[R+8>>2]=1781;xe(P,1100,R)|0;be(P,fe)|0}de[se+(u<<2)>>2]=_e[(de[U>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{m=(ye(A,W)|0)+e|0;_=m-Z|0;e=_>>31;e=e&m|_&~e;if((de[E>>2]|0)>>>0<=e>>>0){de[I>>2]=1154;de[I+4>>2]=903;de[I+8>>2]=1781;xe(P,1100,I)|0;be(P,ue)|0}de[le+(u<<2)>>2]=de[(de[q>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=J|(h|0)!=(k|0);d=0;m=v;while(1){N=z|(d|0)==0;F=d<<1;f=0;p=m;while(1){c=(ye(A,ie)|0)+r|0;u=c-Q|0;r=u>>31;r=r&c|u&~r;u=(ye(A,ne)|0)+o|0;c=u-oe|0;o=c>>31;o=o&u|c&~o;if((_|(f|0)==0)&N){u=me[f+F+(1831+(g<<2))>>0]|0;c=r*3|0;if((de[X>>2]|0)>>>0<=c>>>0){de[C>>2]=1154;de[C+4>>2]=903;de[C+8>>2]=1781;xe(P,1100,C)|0;be(P,he)|0}L=de[H>>2]|0;de[p>>2]=(_e[L+(c<<1)>>1]|0)<<16|de[se+(u<<2)>>2];de[p+4>>2]=(_e[L+(c+2<<1)>>1]|0)<<16|(_e[L+(c+1<<1)>>1]|0);de[p+8>>2]=de[le+(u<<2)>>2];if((de[S>>2]|0)>>>0<=o>>>0){de[M>>2]=1154;de[M+4>>2]=903;de[M+8>>2]=1781;xe(P,1100,M)|0;be(P,ce)|0}de[p+12>>2]=de[(de[Y>>2]|0)+(o<<2)>>2]}f=f+1|0;if((f|0)==2)break;else p=p+16|0}d=d+1|0;if((d|0)==2)break;else m=m+i|0}h=h+y|0;if((h|0)==(b|0))break;else v=v+B|0}}T=T+1|0;if((T|0)==(s|0))break;else x=x+te|0}}w=w+1|0}while((w|0)!=(j|0));ge=D;return 1}function qt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,F=0,N=0,v=0,y=0,b=0,x=0,T=0,z=0,B=0,j=0,U=0,w=0,E=0,G=0,X=0,S=0,H=0,A=0,Y=0,W=0,q=0,k=0,V=0,O=0,P=0,R=0,C=0,M=0,K=0,I=0,J=0,Z=0,D=0,L=0;L=ge;ge=ge+608|0;J=L+64|0;I=L+48|0;K=L+40|0;D=L+24|0;Z=L+16|0;M=L;C=L+88|0;R=L+72|0;S=e+272|0;H=de[S>>2]|0;r=de[e+88>>2]|0;A=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ge=L;return 1}Y=(s|0)==0;W=s+-1|0;q=i<<1;k=e+92|0;V=e+116|0;O=a+-1|0;P=e+212|0;X=(o&1|0)==0;w=e+288|0;E=e+284|0;G=e+164|0;j=e+268|0;U=O<<4;B=r&255;z=(n&1|0)!=0;r=0;o=0;e=1;T=0;do{if(!Y){b=de[t+(T<<2)>>2]|0;x=0;while(1){v=x&1;n=(v|0)==0;N=(v<<5^32)+-16|0;v=(v<<1^2)+-1|0;y=n?a:-1;l=n?0:O;if((l|0)!=(y|0)){F=X|(x|0)!=(W|0);g=n?b:b+U|0;while(1){if((e|0)==1)e=ye(k,V)|0|512;_=e&7;e=e>>>3;u=me[1823+_>>0]|0;n=0;do{d=(ye(k,G)|0)+o|0;m=d-H|0;o=m>>31;o=o&d|m&~o;if((de[S>>2]|0)>>>0<=o>>>0){de[M>>2]=1154;de[M+4>>2]=903;de[M+8>>2]=1781;xe(C,1100,M)|0;be(C,Z)|0}de[R+(n<<2)>>2]=_e[(de[j>>2]|0)+(o<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(O|0)&z;p=0;d=g;while(1){f=F|(p|0)==0;c=p<<1;n=(ye(k,P)|0)+r|0;h=n-A|0;u=h>>31;u=u&n|h&~u;if(f){r=me[1831+(_<<2)+c>>0]|0;n=u*3|0;if((de[w>>2]|0)>>>0<=n>>>0){de[D>>2]=1154;de[D+4>>2]=903;de[D+8>>2]=1781;xe(C,1100,D)|0;be(C,K)|0}h=de[E>>2]|0;de[d>>2]=(_e[h+(n<<1)>>1]|0)<<16|de[R+(r<<2)>>2];de[d+4>>2]=(_e[h+(n+2<<1)>>1]|0)<<16|(_e[h+(n+1<<1)>>1]|0)}h=d+8|0;n=(ye(k,P)|0)+u|0;u=n-A|0;r=u>>31;r=r&n|u&~r;if(!(m|f^1)){n=me[(c|1)+(1831+(_<<2))>>0]|0;u=r*3|0;if((de[w>>2]|0)>>>0<=u>>>0){de[I>>2]=1154;de[I+4>>2]=903;de[I+8>>2]=1781;xe(C,1100,I)|0;be(C,J)|0}f=de[E>>2]|0;de[h>>2]=(_e[f+(u<<1)>>1]|0)<<16|de[R+(n<<2)>>2];de[d+12>>2]=(_e[f+(u+2<<1)>>1]|0)<<16|(_e[f+(u+1<<1)>>1]|0)}p=p+1|0;if((p|0)==2)break;else d=d+i|0}l=l+v|0;if((l|0)==(y|0))break;else g=g+N|0}}x=x+1|0;if((x|0)==(s|0))break;else b=b+q|0}}T=T+1|0}while((T|0)!=(B|0));ge=L;return 1}function Vt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,F=0,N=0,g=0,v=0,y=0,b=0,x=0,z=0,B=0,T=0,w=0,E=0,S=0,j=0,A=0,U=0,G=0,X=0,H=0,Y=0,W=0,q=0,k=0,V=0,K=0,J=0,Z=0,Q=0,O=0,$=0,P=0,ee=0,te=0,re=0,R=0,C=0,ie=0,M=0,ne=0,I=0,oe=0,ae=0,D=0,L=0;L=ge;ge=ge+640|0;oe=L+88|0;I=L+72|0;ne=L+64|0;M=L+48|0;ie=L+40|0;D=L+24|0;ae=L+16|0;C=L;R=L+128|0;te=L+112|0;re=L+96|0;k=e+272|0;V=de[k>>2]|0;r=de[e+88>>2]|0;K=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ge=L;return 1}J=(s|0)==0;Z=s+-1|0;Q=i<<1;O=e+92|0;$=e+116|0;P=a+-1|0;ee=e+212|0;q=(n&1|0)==0;W=(o&1|0)==0;X=e+288|0;H=e+284|0;Y=e+164|0;U=e+268|0;G=P<<5;j=r&255;r=0;n=0;o=0;e=0;l=1;A=0;do{if(!J){E=de[t+(A<<2)>>2]|0;S=0;while(1){T=S&1;u=(T|0)==0;B=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;w=u?a:-1;h=u?0:P;if((h|0)!=(w|0)){z=W|(S|0)!=(Z|0);x=u?E:E+G|0;while(1){if((l|0)==1)l=ye(O,$)|0|512;b=l&7;l=l>>>3;c=me[1823+b>>0]|0;u=0;do{v=(ye(O,Y)|0)+e|0;y=v-V|0;e=y>>31;e=e&v|y&~e;if((de[k>>2]|0)>>>0<=e>>>0){de[C>>2]=1154;de[C+4>>2]=903;de[C+8>>2]=1781;xe(R,1100,C)|0;be(R,ae)|0}de[te+(u<<2)>>2]=_e[(de[U>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(ye(O,Y)|0)+n|0;y=v-V|0;n=y>>31;n=n&v|y&~n;if((de[k>>2]|0)>>>0<=n>>>0){de[D>>2]=1154;de[D+4>>2]=903;de[D+8>>2]=1781;xe(R,1100,D)|0;be(R,ie)|0}de[re+(u<<2)>>2]=_e[(de[U>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);y=q|(h|0)!=(P|0);g=0;v=x;while(1){N=z|(g|0)==0;F=g<<1;m=0;_=v;while(1){d=(ye(O,ee)|0)+o|0;p=d-K|0;o=p>>31;o=o&d|p&~o;p=(ye(O,ee)|0)+r|0;d=p-K|0;r=d>>31;r=r&p|d&~r;if((y|(m|0)==0)&N){p=me[m+F+(1831+(b<<2))>>0]|0;d=o*3|0;u=de[X>>2]|0;if(u>>>0<=d>>>0){de[M>>2]=1154;de[M+4>>2]=903;de[M+8>>2]=1781;xe(R,1100,M)|0;be(R,ne)|0;u=de[X>>2]|0}c=de[H>>2]|0;f=r*3|0;if(u>>>0>f>>>0)u=c;else{de[I>>2]=1154;de[I+4>>2]=903;de[I+8>>2]=1781;xe(R,1100,I)|0;be(R,oe)|0;u=de[H>>2]|0}de[_>>2]=(_e[c+(d<<1)>>1]|0)<<16|de[te+(p<<2)>>2];de[_+4>>2]=(_e[c+(d+2<<1)>>1]|0)<<16|(_e[c+(d+1<<1)>>1]|0);de[_+8>>2]=(_e[u+(f<<1)>>1]|0)<<16|de[re+(p<<2)>>2];de[_+12>>2]=(_e[u+(f+2<<1)>>1]|0)<<16|(_e[u+(f+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else _=_+16|0}g=g+1|0;if((g|0)==2)break;else v=v+i|0}h=h+T|0;if((h|0)==(w|0))break;else x=x+B|0}}S=S+1|0;if((S|0)==(s|0))break;else E=E+Q|0}}A=A+1|0}while((A|0)!=(j|0));ge=L;return 1}function Kt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ge;ge=ge+608|0;c=f+88|0;h=f+72|0;l=f+64|0;s=f+48|0;o=f+40|0;a=f+24|0;n=f+16|0;i=f;u=f+96|0;de[e>>2]=0;t=e+284|0;r=de[t>>2]|0;if(r){if(!(r&7))X[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[i>>2]=1154;de[i+4>>2]=2499;de[i+8>>2]=1516;xe(u,1100,i)|0;be(u,n)|0}de[t>>2]=0;de[e+288>>2]=0;de[e+292>>2]=0}pe[e+296>>0]=0;t=e+268|0;r=de[t>>2]|0;if(r){if(!(r&7))X[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[a>>2]=1154;de[a+4>>2]=2499;de[a+8>>2]=1516;xe(u,1100,a)|0;be(u,o)|0}de[t>>2]=0;de[e+272>>2]=0;de[e+276>>2]=0}pe[e+280>>0]=0;t=e+252|0;r=de[t>>2]|0;if(r){if(!(r&7))X[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1516;xe(u,1100,s)|0;be(u,l)|0}de[t>>2]=0;de[e+256>>2]=0;de[e+260>>2]=0}pe[e+264>>0]=0;t=e+236|0;r=de[t>>2]|0;if(!r){c=e+248|0;pe[c>>0]=0;c=e+212|0;N(c);c=e+188|0;N(c);c=e+164|0;N(c);c=e+140|0;N(c);c=e+116|0;N(c);ge=f;return}if(!(r&7))X[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[h>>2]=1154;de[h+4>>2]=2499;de[h+8>>2]=1516;xe(u,1100,h)|0;be(u,c)|0}de[t>>2]=0;de[e+240>>2]=0;de[e+244>>2]=0;c=e+248|0;pe[c>>0]=0;c=e+212|0;N(c);c=e+188|0;N(c);c=e+164|0;N(c);c=e+140|0;N(c);c=e+116|0;N(c);ge=f}function l(e,t){e=e|0;t=t|0;var r=0;r=ge;ge=ge+16|0;de[r>>2]=t;t=de[63]|0;Pr(t,e,r)|0;Or(10,t)|0;B()}function Jt(){var e=0,t=0;e=ge;ge=ge+16|0;if(!(rt(200,2)|0)){t=et(de[49]|0)|0;ge=e;return t|0}else l(2090,e);return 0}function Zt(e){e=e|0;b(e)}function Qt(e){e=e|0;var t=0;t=ge;ge=ge+16|0;Mi[e&3]();l(2139,t)}function $t(){var e=0,t=0;e=Jt()|0;if(((e|0)!=0?(t=de[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(de[e>>2]&-256|0)==1126902528?(de[e+4>>2]|0)==1129074247:0):0)Qt(de[t+12>>2]|0);t=de[28]|0;de[28]=t+0;Qt(t)}function er(e){e=e|0}function tr(e){e=e|0;return}function rr(e){e=e|0;return}function ir(e){e=e|0;return}function nr(e){e=e|0;Zt(e);return}function or(e){e=e|0;Zt(e);return}function ar(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;a=ge;ge=ge+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(n=hr(t,24,40,0)|0,(n|0)!=0):0){t=o;i=t+56|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(i|0));de[o>>2]=n;de[o+8>>2]=e;de[o+12>>2]=-1;de[o+48>>2]=1;Di[de[(de[n>>2]|0)+28>>2]&3](n,o,de[r>>2]|0,1);if((de[o+24>>2]|0)==1){de[r>>2]=de[o+16>>2];t=1}else t=0}else t=0;else t=1;ge=a;return t|0}function sr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0;e=t+16|0;n=de[e>>2]|0;do{if(n){if((n|0)!=(r|0)){i=t+36|0;de[i>>2]=(de[i>>2]|0)+1;de[t+24>>2]=2;pe[t+54>>0]=1;break}e=t+24|0;if((de[e>>2]|0)==2)de[e>>2]=i}else{de[e>>2]=r;de[t+24>>2]=i;de[t+36>>2]=1}}while(0)}function lr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))sr(0,t,r,i);return}function ur(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))sr(0,t,r,i);else{e=de[e+8>>2]|0;Di[de[(de[e>>2]|0)+28>>2]&3](e,t,r,i)}return}function hr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0;p=ge;ge=ge+64|0;f=p;c=de[e>>2]|0;h=e+(de[c+-8>>2]|0)|0;c=de[c+-4>>2]|0;de[f>>2]=r;de[f+4>>2]=e;de[f+8>>2]=t;de[f+12>>2]=i;i=f+16|0;e=f+20|0;t=f+24|0;n=f+28|0;o=f+32|0;a=f+40|0;s=(c|0)==(r|0);l=i;u=l+36|0;do{de[l>>2]=0;l=l+4|0}while((l|0)<(u|0));$[i+36>>1]=0;pe[i+38>>0]=0;e:do{if(s){de[f+48>>2]=1;Ii[de[(de[r>>2]|0)+20>>2]&3](r,f,h,h,1,0);i=(de[t>>2]|0)==1?h:0}else{Oi[de[(de[c>>2]|0)+24>>2]&3](c,f,h,1,0);switch(de[f+36>>2]|0){case 0:{i=(de[a>>2]|0)==1&(de[n>>2]|0)==1&(de[o>>2]|0)==1?de[e>>2]|0:0;break e}case 1:break;default:{i=0;break e}}if((de[t>>2]|0)!=1?!((de[a>>2]|0)==0&(de[n>>2]|0)==1&(de[o>>2]|0)==1):0){i=0;break}i=de[i>>2]|0}}while(0);ge=p;return i|0}function cr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;pe[t+53>>0]=1;do{if((de[t+4>>2]|0)==(i|0)){pe[t+52>>0]=1;i=t+16|0;e=de[i>>2]|0;if(!e){de[i>>2]=r;de[t+24>>2]=n;de[t+36>>2]=1;if(!((n|0)==1?(de[t+48>>2]|0)==1:0))break;pe[t+54>>0]=1;break}if((e|0)!=(r|0)){n=t+36|0;de[n>>2]=(de[n>>2]|0)+1;pe[t+54>>0]=1;break}e=t+24|0;i=de[e>>2]|0;if((i|0)==2){de[e>>2]=n;i=n}if((i|0)==1?(de[t+48>>2]|0)==1:0)pe[t+54>>0]=1}}while(0)}function fr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0;e:do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(o=t+28|0,(de[o>>2]|0)!=1):0)de[o>>2]=i}else{if((e|0)!=(de[t>>2]|0)){s=de[e+8>>2]|0;Oi[de[(de[s>>2]|0)+24>>2]&3](s,t,r,i,n);break}if((de[t+16>>2]|0)!=(r|0)?(a=t+20|0,(de[a>>2]|0)!=(r|0)):0){de[t+32>>2]=i;i=t+44|0;if((de[i>>2]|0)==4)break;o=t+52|0;pe[o>>0]=0;l=t+53|0;pe[l>>0]=0;e=de[e+8>>2]|0;Ii[de[(de[e>>2]|0)+20>>2]&3](e,t,r,r,1,n);if(pe[l>>0]|0){if(!(pe[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){de[a>>2]=r;l=t+40|0;de[l>>2]=(de[l>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0){pe[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;de[i>>2]=4;break e}}while(0);de[i>>2]=3;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function pr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0;do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(a=t+28|0,(de[a>>2]|0)!=1):0)de[a>>2]=i}else if((e|0)==(de[t>>2]|0)){if((de[t+16>>2]|0)!=(r|0)?(o=t+20|0,(de[o>>2]|0)!=(r|0)):0){de[t+32>>2]=i;de[o>>2]=r;n=t+40|0;de[n>>2]=(de[n>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0)pe[t+54>>0]=1;de[t+44>>2]=4;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function dr(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))cr(0,t,r,i,n);else{e=de[e+8>>2]|0;Ii[de[(de[e>>2]|0)+20>>2]&3](e,t,r,i,n,o)}return}function mr(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))cr(0,t,r,i,n);return}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ge;ge=ge+16|0;i=n;de[i>>2]=de[r>>2];e=v[de[(de[e>>2]|0)+16>>2]&7](e,t,i)|0;if(e)de[r>>2]=de[i>>2];ge=n;return e&1|0}function gr(e){e=e|0;if(!e)e=0;else e=(hr(e,24,72,0)|0)!=0;return e&1|0}function vr(){var e=0,t=0,r=0,i=0,n=0,o=0,a=0,s=0;n=ge;ge=ge+48|0;a=n+32|0;r=n+24|0;s=n+16|0;o=n;n=n+36|0;e=Jt()|0;if((e|0)!=0?(i=de[e>>2]|0,(i|0)!=0):0){e=i+48|0;t=de[e>>2]|0;e=de[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){de[r>>2]=de[51];l(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=de[i+44>>2]|0;else e=i+80|0;de[n>>2]=e;i=de[i>>2]|0;e=de[i+4>>2]|0;if(v[de[(de[8>>2]|0)+16>>2]&7](8,i,n)|0){s=de[n>>2]|0;n=de[51]|0;s=Ri[de[(de[s>>2]|0)+8>>2]&1](s)|0;de[o>>2]=n;de[o+4>>2]=e;de[o+8>>2]=s;l(2282,o)}else{de[s>>2]=de[51];de[s+4>>2]=e;l(2327,s)}}l(2406,a)}function yr(){var e=0;e=ge;ge=ge+16|0;if(!(it(196,6)|0)){ge=e;return}else l(2179,e)}function br(e){e=e|0;var t=0;t=ge;ge=ge+16|0;b(e);if(!(at(de[49]|0,0)|0)){ge=t;return}else l(2229,t)}function xr(e){e=e|0;var t=0,r=0;t=0;while(1){if((me[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(pe[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function ie(){var e=0;if(!(de[52]|0))e=264;else{e=(tt()|0)+60|0;e=de[e>>2]|0}return e|0}function Tr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=ie()|0;de[t>>2]=0-e;e=-1}return e|0}function wr(e,t){e=+e;t=t|0;var r=0,i=0,n=0;ee[te>>3]=e;r=de[te>>2]|0;i=de[te+4>>2]|0;n=Zr(r|0,i|0,52)|0;n=n&2047;switch(n|0){case 0:{if(e!=0.0){e=+wr(e*18446744073709552.0e3,t);r=(de[t>>2]|0)+-64|0}else r=0;de[t>>2]=r;break}case 2047:break;default:{de[t>>2]=n+-1022;de[te>>2]=r;de[te+4>>2]=i&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function Er(e,t){e=+e;t=t|0;return+ +wr(e,t)}function Sr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){pe[e>>0]=t;e=1;break}if(t>>>0<2048){pe[e>>0]=t>>>6|192;pe[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){pe[e>>0]=t>>>12|224;pe[e+1>>0]=t>>>6&63|128;pe[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){pe[e>>0]=t>>>18|240;pe[e+1>>0]=t>>>12&63|128;pe[e+2>>0]=t>>>6&63|128;pe[e+3>>0]=t&63|128;e=4;break}else{e=ie()|0;de[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function Ar(e,t){e=e|0;t=t|0;if(!e)e=0;else e=Sr(e,t,0)|0;return e|0}function kr(e){e=e|0;var t=0,r=0;do{if(e){if((de[e+76>>2]|0)<=-1){t=jr(e)|0;break}r=(Mr(e)|0)==0;t=jr(e)|0;if(!r)g(e)}else{if(!(de[65]|0))t=0;else t=kr(de[65]|0)|0;st(236);e=de[58]|0;if(e)do{if((de[e+76>>2]|0)>-1)r=Mr(e)|0;else r=0;if((de[e+20>>2]|0)>>>0>(de[e+28>>2]|0)>>>0)t=jr(e)|0|t;if(r)g(e);e=de[e+56>>2]|0}while((e|0)!=0);nt(236)}}while(0);return t|0}function Or(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0;if((de[t+76>>2]|0)>=0?(Mr(t)|0)!=0:0){if((pe[t+75>>0]|0)!=(e|0)?(i=t+20|0,n=de[i>>2]|0,n>>>0<(de[t+16>>2]|0)>>>0):0){de[i>>2]=n+1;pe[n>>0]=e;r=e&255}else r=Ir(t,e)|0;g(t)}else a=3;do{if((a|0)==3){if((pe[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=de[o>>2]|0,r>>>0<(de[t+16>>2]|0)>>>0):0){de[o>>2]=r+1;pe[r>>0]=e;r=e&255;break}r=Ir(t,e)|0}}while(0);return r|0}function ne(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=r+16|0;n=de[i>>2]|0;if(!n)if(!(zr(r)|0)){n=de[i>>2]|0;o=4}else i=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=de[a>>2]|0;if((n-o|0)>>>0>>0){i=v[de[r+36>>2]&7](r,e,t)|0;break}t:do{if((pe[r+75>>0]|0)>-1){i=t;while(1){if(!i){n=o;i=0;break t}n=i+-1|0;if((pe[e+n>>0]|0)==10)break;else i=n}if((v[de[r+36>>2]&7](r,e,i)|0)>>>0>>0)break e;t=t-i|0;e=e+i|0;n=de[a>>2]|0}else{n=o;i=0}}while(0);ei(n|0,e|0,t|0)|0;de[a>>2]=(de[a>>2]|0)+t;i=i+t|0}}while(0);return i|0}function be(e,t){e=e|0;t=t|0;var r=0,i=0;r=ge;ge=ge+16|0;i=r;de[i>>2]=t;t=Pr(de[64]|0,e,i)|0;ge=r;return t|0}function xe(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=ge;ge=ge+16|0;n=i;de[n>>2]=r;r=Cr(e,t,n)|0;ge=i;return r|0}function Pr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ge;ge=ge+224|0;c=m+120|0;d=m+80|0;p=m;f=m+136|0;i=d;n=i+40|0;do{de[i>>2]=0;i=i+4|0}while((i|0)<(n|0));de[c>>2]=de[r>>2];if((Ur(0,t,c,p,d)|0)<0)r=-1;else{if((de[e+76>>2]|0)>-1)u=Mr(e)|0;else u=0;r=de[e>>2]|0;h=r&32;if((pe[e+74>>0]|0)<1)de[e>>2]=r&-33;r=e+48|0;if(!(de[r>>2]|0)){n=e+44|0;o=de[n>>2]|0;de[n>>2]=f;a=e+28|0;de[a>>2]=f;s=e+20|0;de[s>>2]=f;de[r>>2]=80;l=e+16|0;de[l>>2]=f+80;i=Ur(e,t,c,p,d)|0;if(o){v[de[e+36>>2]&7](e,0,0)|0;i=(de[s>>2]|0)==0?-1:i;de[n>>2]=o;de[r>>2]=0;de[l>>2]=0;de[a>>2]=0;de[s>>2]=0}}else i=Ur(e,t,c,p,d)|0;r=de[e>>2]|0;de[e>>2]=r|h;if(u)g(e);r=(r&32|0)==0?i:-1}ge=m;return r|0}function Rr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ge;ge=ge+128|0;n=h+112|0;u=h;o=u;a=268;s=o+112|0;do{de[o>>2]=de[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;l=4}else{t=ie()|0;de[t>>2]=75;t=-1}else{n=e;l=4}if((l|0)==4){l=-2-n|0;l=t>>>0>l>>>0?l:t;de[u+48>>2]=l;e=u+20|0;de[e>>2]=n;de[u+44>>2]=n;t=n+l|0;n=u+16|0;de[n>>2]=t;de[u+28>>2]=t;t=Pr(u,r,i)|0;if(l){r=de[e>>2]|0;pe[r+(((r|0)==(de[n>>2]|0))<<31>>31)>>0]=0}}ge=h;return t|0}function Cr(e,t,r){e=e|0;t=t|0;r=r|0;return Rr(e,2147483647,t,r)|0}function Mr(e){e=e|0;return 0}function g(e){e=e|0}function Ir(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ge;ge=ge+16|0;s=l;a=t&255;pe[s>>0]=a;i=e+16|0;n=de[i>>2]|0;if(!n)if(!(zr(e)|0)){n=de[i>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){i=e+20|0;o=de[i>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(pe[e+75>>0]|0)):0){de[i>>2]=o+1;pe[o>>0]=a;break}if((v[de[e+36>>2]&7](e,s,1)|0)==1)r=me[s>>0]|0;else r=-1}}while(0);ge=l;return r|0}function Dr(e){e=e|0;var t=0,r=0;t=ge;ge=ge+16|0;r=t;de[r>>2]=de[e+60>>2];e=Tr(qe(6,r|0)|0)|0;ge=t;return e|0}function Lr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0;n=ge;ge=ge+32|0;o=n;i=n+20|0;de[o>>2]=de[e+60>>2];de[o+4>>2]=0;de[o+8>>2]=t;de[o+12>>2]=i;de[o+16>>2]=r;if((Tr(ht(140,o|0)|0)|0)<0){de[i>>2]=-1;e=-1}else e=de[i>>2]|0;ge=n;return e|0}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ge;ge=ge+48|0;c=d+16|0;h=d;i=d+32|0;f=e+28|0;n=de[f>>2]|0;de[i>>2]=n;p=e+20|0;n=(de[p>>2]|0)-n|0;de[i+4>>2]=n;de[i+8>>2]=t;de[i+12>>2]=r;l=e+60|0;u=e+44|0;t=2;n=n+r|0;while(1){if(!(de[52]|0)){de[c>>2]=de[l>>2];de[c+4>>2]=i;de[c+8>>2]=t;a=Tr(ct(146,c|0)|0)|0}else{lt(7,e|0);de[h>>2]=de[l>>2];de[h+4>>2]=i;de[h+8>>2]=t;a=Tr(ct(146,h|0)|0)|0;Ye(0)}if((n|0)==(a|0)){n=6;break}if((a|0)<0){n=8;break}n=n-a|0;o=de[i+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){de[f>>2]=(de[f>>2]|0)+a;s=o;t=2}else s=o;else{s=de[u>>2]|0;de[f>>2]=s;de[p>>2]=s;s=de[i+12>>2]|0;a=a-o|0;i=i+8|0;t=t+-1|0}de[i>>2]=(de[i>>2]|0)+a;de[i+4>>2]=s-a}if((n|0)==6){c=de[u>>2]|0;de[e+16>>2]=c+(de[e+48>>2]|0);e=c;de[f>>2]=e;de[p>>2]=e}else if((n|0)==8){de[e+16>>2]=0;de[f>>2]=0;de[p>>2]=0;de[e>>2]=de[e>>2]|32;if((t|0)==2)r=0;else r=r-(de[i+4>>2]|0)|0}ge=d;return r|0}function Nr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ge;ge=ge+80|0;i=n;de[e+36>>2]=3;if((de[e>>2]&64|0)==0?(de[i>>2]=de[e+60>>2],de[i+4>>2]=21505,de[i+8>>2]=n+12,(We(54,i|0)|0)!=0):0)pe[e+75>>0]=-1;i=Fr(e,t,r)|0;ge=n;return i|0}function zr(e){e=e|0;var t=0,r=0;t=e+74|0;r=pe[t>>0]|0;pe[t>>0]=r+255|r;t=de[e>>2]|0;if(!(t&8)){de[e+8>>2]=0;de[e+4>>2]=0;t=de[e+44>>2]|0;de[e+28>>2]=t;de[e+20>>2]=t;de[e+16>>2]=t+(de[e+48>>2]|0);t=0}else{de[e>>2]=t|32;t=-1}return t|0}function Br(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;o=t&255;i=(r|0)!=0;e:do{if(i&(e&3|0)!=0){n=t&255;while(1){if((pe[e>>0]|0)==n<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;i=(r|0)!=0;if(!(i&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(i)a=6;else r=0;e:do{if((a|0)==6){n=t&255;if((pe[e>>0]|0)!=n<<24>>24){i=ve(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=de[e>>2]^i;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((pe[e>>0]|0)==n<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function jr(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;t=e+20|0;o=e+28|0;if((de[t>>2]|0)>>>0>(de[o>>2]|0)>>>0?(v[de[e+36>>2]&7](e,0,0)|0,(de[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=de[a>>2]|0;i=e+8|0;n=de[i>>2]|0;if(r>>>0>>0)v[de[e+40>>2]&7](e,r-n|0,1)|0;de[e+16>>2]=0;de[o>>2]=0;de[t>>2]=0;de[i>>2]=0;de[a>>2]=0;t=0}return t|0}function Ur(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0.0,h=0,c=0,f=0,p=0,d=0.0,m=0,_=0,g=0,v=0,F=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,O=0,N=0,P=0,z=0,B=0,j=0,R=0,U=0,G=0,X=0,H=0,Y=0,W=0,q=0,V=0,C=0,K=0,M=0,J=0,I=0,D=0,Z=0,Q=0,L=0;L=ge;ge=ge+624|0;J=L+24|0;D=L+16|0;I=L+588|0;q=L+576|0;M=L;H=L+536|0;Q=L+8|0;Z=L+528|0;N=(e|0)!=0;P=H+40|0;X=P;H=H+39|0;Y=Q+4|0;W=q+12|0;q=q+11|0;V=I;C=W;K=C-V|0;z=-2-V|0;B=C+2|0;j=J+288|0;R=I+9|0;U=R;G=I+8|0;o=0;m=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=ie()|0;de[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=pe[m>>0]|0;if(!(a<<24>>24)){O=245;break}else s=m;t:while(1){switch(a<<24>>24){case 37:{a=s;O=9;break t}case 0:{a=s;break t}default:{}}k=s+1|0;a=pe[k>>0]|0;s=k}t:do{if((O|0)==9)while(1){O=0;if((pe[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((pe[a>>0]|0)==37)O=9;else break}}while(0);g=s-m|0;if(N?(de[e>>2]&32|0)==0:0)ne(m,g,e)|0;if((s|0)!=(m|0)){m=a;a=g;continue}h=a+1|0;s=pe[h>>0]|0;l=(s<<24>>24)+-48|0;if(l>>>0<10){k=(pe[a+2>>0]|0)==36;h=k?a+3|0:h;s=pe[h>>0]|0;p=k?l:-1;t=k?1:t}else p=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){l=0;while(1){if(!(1<>24)+-32|l;h=h+1|0;s=pe[h>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){c=l;a=h;break}}}else{c=0;a=h}}while(0);do{if(s<<24>>24==42){l=a+1|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+2>>0]|0)==36:0){de[n+(s<<2)>>2]=10;t=1;a=a+3|0;s=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!N){_=c;a=l;t=0;k=0;break}t=(de[r>>2]|0)+(4-1)&~(4-1);s=de[t>>2]|0;de[r>>2]=t+4;t=0;a=l}if((s|0)<0){_=c|8192;k=0-s|0}else{_=c;k=s}}else{l=(s<<24>>24)+-48|0;if(l>>>0<10){s=0;do{s=(s*10|0)+l|0;a=a+1|0;l=(pe[a>>0]|0)+-48|0}while(l>>>0<10);if((s|0)<0){o=-1;break e}else{_=c;k=s}}else{_=c;k=0}}}while(0);t:do{if((pe[a>>0]|0)==46){l=a+1|0;s=pe[l>>0]|0;if(s<<24>>24!=42){h=(s<<24>>24)+-48|0;if(h>>>0<10){a=l;s=0}else{a=l;h=0;break}while(1){s=(s*10|0)+h|0;a=a+1|0;h=(pe[a>>0]|0)+-48|0;if(h>>>0>=10){h=s;break t}}}l=a+2|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+3>>0]|0)==36:0){de[n+(s<<2)>>2]=10;a=a+4|0;h=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(N){a=(de[r>>2]|0)+(4-1)&~(4-1);h=de[a>>2]|0;de[r>>2]=a+4;a=l}else{a=l;h=0}}else h=-1}while(0);f=0;while(1){s=(pe[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}l=a+1|0;s=pe[5359+(f*58|0)+s>>0]|0;c=s&255;if((c+-1|0)>>>0<8){a=l;f=c}else{A=l;break}}if(!(s<<24>>24)){o=-1;break}l=(p|0)>-1;do{if(s<<24>>24==19)if(l){o=-1;break e}else O=52;else{if(l){de[n+(p<<2)>>2]=c;E=i+(p<<3)|0;S=de[E+4>>2]|0;O=M;de[O>>2]=de[E>>2];de[O+4>>2]=S;O=52;break}if(!N){o=0;break e}Hr(M,c,r)}}while(0);if((O|0)==52?(O=0,!N):0){m=A;a=g;continue}p=pe[a>>0]|0;p=(f|0)!=0&(p&15|0)==3?p&-33:p;l=_&-65537;S=(_&8192|0)==0?_:l;t:do{switch(p|0){case 110:switch(f|0){case 0:{de[de[M>>2]>>2]=o;m=A;a=g;continue e}case 1:{de[de[M>>2]>>2]=o;m=A;a=g;continue e}case 2:{m=de[M>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=A;a=g;continue e}case 3:{$[de[M>>2]>>1]=o;m=A;a=g;continue e}case 4:{pe[de[M>>2]>>0]=o;m=A;a=g;continue e}case 6:{de[de[M>>2]>>2]=o;m=A;a=g;continue e}case 7:{m=de[M>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=A;a=g;continue e}default:{m=A;a=g;continue e}}case 112:{f=S|8;h=h>>>0>8?h:8;p=120;O=64;break}case 88:case 120:{f=S;O=64;break}case 111:{l=M;s=de[l>>2]|0;l=de[l+4>>2]|0;if((s|0)==0&(l|0)==0)a=P;else{a=P;do{a=a+-1|0;pe[a>>0]=s&7|48;s=Zr(s|0,l|0,3)|0;l=re}while(!((s|0)==0&(l|0)==0))}if(!(S&8)){s=S;f=0;c=5839;O=77}else{f=X-a+1|0;s=S;h=(h|0)<(f|0)?f:h;f=0;c=5839;O=77}break}case 105:case 100:{s=M;a=de[s>>2]|0;s=de[s+4>>2]|0;if((s|0)<0){a=se(0,0,a|0,s|0)|0;s=re;l=M;de[l>>2]=a;de[l+4>>2]=s;l=1;c=5839;O=76;break t}if(!(S&2048)){c=S&1;l=c;c=(c|0)==0?5839:5841;O=76}else{l=1;c=5840;O=76}break}case 117:{s=M;a=de[s>>2]|0;s=de[s+4>>2]|0;l=0;c=5839;O=76;break}case 99:{pe[H>>0]=de[M>>2];m=H;s=1;f=0;p=5839;a=P;break}case 109:{a=ie()|0;a=xr(de[a>>2]|0)|0;O=82;break}case 115:{a=de[M>>2]|0;a=(a|0)!=0?a:5849;O=82;break}case 67:{de[Q>>2]=de[M>>2];de[Y>>2]=0;de[M>>2]=Q;h=-1;O=86;break}case 83:{if(!h){ae(e,32,k,0,S);a=0;O=98}else O=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[M>>3];de[D>>2]=0;ee[te>>3]=u;if((de[te+4>>2]|0)>=0)if(!(S&2048)){E=S&1;w=E;E=(E|0)==0?5857:5862}else{w=1;E=5859}else{u=-u;w=1;E=5856}ee[te>>3]=u;T=de[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){d=+Er(u,D)*2.0;s=d!=0.0;if(s)de[D>>2]=(de[D>>2]|0)+-1;b=p|32;if((b|0)==97){m=p&32;g=(m|0)==0?E:E+9|0;_=w|2;a=12-h|0;do{if(!(h>>>0>11|(a|0)==0)){u=8.0;do{a=a+-1|0;u=u*16.0}while((a|0)!=0);if((pe[g>>0]|0)==45){u=-(u+(-d-u));break}else{u=d+u-u;break}}else u=d}while(0);s=de[D>>2]|0;a=(s|0)<0?0-s|0:s;a=oe(a,((a|0)<0)<<31>>31,W)|0;if((a|0)==(W|0)){pe[q>>0]=48;a=q}pe[a+-1>>0]=(s>>31&2)+43;f=a+-2|0;pe[f>>0]=p+15;c=(h|0)<1;l=(S&8|0)==0;s=I;while(1){E=~~u;a=s+1|0;pe[s>>0]=me[5823+E>>0]|m;u=(u-+(E|0))*16.0;do{if((a-V|0)==1){if(l&(c&u==0.0))break;pe[a>>0]=46;a=s+2|0}}while(0);if(!(u!=0.0))break;else s=a}h=(h|0)!=0&(z+a|0)<(h|0)?B+h-f|0:K-f+a|0;l=h+_|0;ae(e,32,k,l,S);if(!(de[e>>2]&32))ne(g,_,e)|0;ae(e,48,k,l,S^65536);a=a-V|0;if(!(de[e>>2]&32))ne(I,a,e)|0;s=C-f|0;ae(e,48,h-(a+s)|0,0,0);if(!(de[e>>2]&32))ne(f,s,e)|0;ae(e,32,k,l,S^8192);a=(l|0)<(k|0)?k:l;break}a=(h|0)<0?6:h;if(s){s=(de[D>>2]|0)+-28|0;de[D>>2]=s;u=d*268435456.0}else{u=d;s=de[D>>2]|0}T=(s|0)<0?J:j;x=T;s=T;do{y=~~u>>>0;de[s>>2]=y;s=s+4|0;u=(u-+(y>>>0))*1.0e9}while(u!=0.0);l=s;s=de[D>>2]|0;if((s|0)>0){c=T;while(1){f=(s|0)>29?29:s;h=l+-4|0;do{if(h>>>0>>0)h=c;else{s=0;do{y=Qr(de[h>>2]|0,0,f|0)|0;y=$r(y|0,re|0,s|0,0)|0;s=re;F=li(y|0,s|0,1e9,0)|0;de[h>>2]=F;s=si(y|0,s|0,1e9,0)|0;h=h+-4|0}while(h>>>0>=c>>>0);if(!s){h=c;break}h=c+-4|0;de[h>>2]=s}}while(0);while(1){if(l>>>0<=h>>>0)break;s=l+-4|0;if(!(de[s>>2]|0))l=s;else break}s=(de[D>>2]|0)-f|0;de[D>>2]=s;if((s|0)>0)c=h;else break}}else h=T;if((s|0)<0){g=((a+25|0)/9|0)+1|0;v=(b|0)==102;m=h;while(1){_=0-s|0;_=(_|0)>9?9:_;do{if(m>>>0>>0){s=(1<<_)+-1|0;c=1e9>>>_;h=0;f=m;do{y=de[f>>2]|0;de[f>>2]=(y>>>_)+h;h=ve(y&s,c)|0;f=f+4|0}while(f>>>0>>0);s=(de[m>>2]|0)==0?m+4|0:m;if(!h){h=s;break}de[l>>2]=h;h=s;l=l+4|0}else h=(de[m>>2]|0)==0?m+4|0:m}while(0);s=v?T:h;l=(l-s>>2|0)>(g|0)?s+(g<<2)|0:l;s=(de[D>>2]|0)+_|0;de[D>>2]=s;if((s|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){s=(x-m>>2)*9|0;c=de[m>>2]|0;if(c>>>0<10)break;else h=10;do{h=h*10|0;s=s+1|0}while(c>>>0>=h>>>0)}else s=0}while(0);F=(b|0)==103;y=(a|0)!=0;h=a-((b|0)!=102?s:0)+((y&F)<<31>>31)|0;if((h|0)<(((l-x>>2)*9|0)+-9|0)){f=h+9216|0;v=(f|0)/9|0;h=T+(v+-1023<<2)|0;f=((f|0)%9|0)+1|0;if((f|0)<9){c=10;do{c=c*10|0;f=f+1|0}while((f|0)!=9)}else c=10;_=de[h>>2]|0;g=(_>>>0)%(c>>>0)|0;if((g|0)==0?(T+(v+-1022<<2)|0)==(l|0):0)c=m;else O=163;do{if((O|0)==163){O=0;d=(((_>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;f=(c|0)/2|0;do{if(g>>>0>>0)u=.5;else{if((g|0)==(f|0)?(T+(v+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(w){if((pe[E>>0]|0)!=45)break;d=-d;u=-u}}while(0);f=_-g|0;de[h>>2]=f;if(!(d+u!=d)){c=m;break}b=f+c|0;de[h>>2]=b;if(b>>>0>999999999){s=m;while(1){c=h+-4|0;de[h>>2]=0;if(c>>>0>>0){s=s+-4|0;de[s>>2]=0}b=(de[c>>2]|0)+1|0;de[c>>2]=b;if(b>>>0>999999999)h=c;else{m=s;h=c;break}}}s=(x-m>>2)*9|0;f=de[m>>2]|0;if(f>>>0<10){c=m;break}else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0);c=m}}while(0);b=h+4|0;m=c;l=l>>>0>b>>>0?b:l}g=0-s|0;while(1){if(l>>>0<=m>>>0){v=0;b=l;break}h=l+-4|0;if(!(de[h>>2]|0))l=h;else{v=1;b=l;break}}do{if(F){a=(y&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){p=p+-1|0;a=a+-1-s|0}else{p=p+-2|0;a=a+-1|0}l=S&8;if(l)break;do{if(v){l=de[b+-4>>2]|0;if(!l){h=9;break}if(!((l>>>0)%10|0)){c=10;h=0}else{h=0;break}do{c=c*10|0;h=h+1|0}while(((l>>>0)%(c>>>0)|0|0)==0)}else h=9}while(0);l=((b-x>>2)*9|0)+-9|0;if((p|32|0)==102){l=l-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}else{l=l+s-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}}else l=S&8}while(0);_=a|l;c=(_|0)!=0&1;f=(p|32|0)==102;if(f){s=(s|0)>0?s:0;p=0}else{h=(s|0)<0?g:s;h=oe(h,((h|0)<0)<<31>>31,W)|0;if((C-h|0)<2)do{h=h+-1|0;pe[h>>0]=48}while((C-h|0)<2);pe[h+-1>>0]=(s>>31&2)+43;x=h+-2|0;pe[x>>0]=p;s=C-x|0;p=x}g=w+1+a+c+s|0;ae(e,32,k,g,S);if(!(de[e>>2]&32))ne(E,w,e)|0;ae(e,48,k,g,S^65536);do{if(f){h=m>>>0>T>>>0?T:m;s=h;do{l=oe(de[s>>2]|0,0,R)|0;do{if((s|0)==(h|0)){if((l|0)!=(R|0))break;pe[G>>0]=48;l=G}else{if(l>>>0<=I>>>0)break;do{l=l+-1|0;pe[l>>0]=48}while(l>>>0>I>>>0)}}while(0);if(!(de[e>>2]&32))ne(l,U-l|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(_){if(de[e>>2]&32)break;ne(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){l=s;while(1){s=oe(de[l>>2]|0,0,R)|0;if(s>>>0>I>>>0)do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>I>>>0);if(!(de[e>>2]&32))ne(s,(a|0)>9?9:a,e)|0;l=l+4|0;s=a+-9|0;if(!((a|0)>9&l>>>0>>0)){a=s;break}else a=s}}ae(e,48,a+9|0,9,0)}else{f=v?b:m+4|0;if((a|0)>-1){c=(l|0)==0;h=m;do{s=oe(de[h>>2]|0,0,R)|0;if((s|0)==(R|0)){pe[G>>0]=48;s=G}do{if((h|0)==(m|0)){l=s+1|0;if(!(de[e>>2]&32))ne(s,1,e)|0;if(c&(a|0)<1){s=l;break}if(de[e>>2]&32){s=l;break}ne(5891,1,e)|0;s=l}else{if(s>>>0<=I>>>0)break;do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>I>>>0)}}while(0);l=U-s|0;if(!(de[e>>2]&32))ne(s,(a|0)>(l|0)?l:a,e)|0;a=a-l|0;h=h+4|0}while(h>>>0>>0&(a|0)>-1)}ae(e,48,a+18|0,18,0);if(de[e>>2]&32)break;ne(p,C-p|0,e)|0}}while(0);ae(e,32,k,g,S^8192);a=(g|0)<(k|0)?k:g}else{f=(p&32|0)!=0;c=u!=u|0.0!=0.0;s=c?0:w;h=s+3|0;ae(e,32,k,h,l);a=de[e>>2]|0;if(!(a&32)){ne(E,s,e)|0;a=de[e>>2]|0}if(!(a&32))ne(c?f?5883:5887:f?5875:5879,3,e)|0;ae(e,32,k,h,S^8192);a=(h|0)<(k|0)?k:h}}while(0);m=A;continue e}default:{l=S;s=h;f=0;p=5839;a=P}}}while(0);t:do{if((O|0)==64){l=M;s=de[l>>2]|0;l=de[l+4>>2]|0;c=p&32;if(!((s|0)==0&(l|0)==0)){a=P;do{a=a+-1|0;pe[a>>0]=me[5823+(s&15)>>0]|c;s=Zr(s|0,l|0,4)|0;l=re}while(!((s|0)==0&(l|0)==0));O=M;if((f&8|0)==0|(de[O>>2]|0)==0&(de[O+4>>2]|0)==0){s=f;f=0;c=5839;O=77}else{s=f;f=2;c=5839+(p>>4)|0;O=77}}else{a=P;s=f;f=0;c=5839;O=77}}else if((O|0)==76){a=oe(a,s,P)|0;s=S;f=l;O=77}else if((O|0)==82){O=0;S=Br(a,0,h)|0;E=(S|0)==0;m=a;s=E?h:S-a|0;f=0;p=5839;a=E?a+h|0:S}else if((O|0)==86){O=0;s=0;a=0;c=de[M>>2]|0;while(1){l=de[c>>2]|0;if(!l)break;a=Ar(Z,l)|0;if((a|0)<0|a>>>0>(h-s|0)>>>0)break;s=a+s|0;if(h>>>0>s>>>0)c=c+4|0;else break}if((a|0)<0){o=-1;break e}ae(e,32,k,s,S);if(!s){a=0;O=98}else{l=0;h=de[M>>2]|0;while(1){a=de[h>>2]|0;if(!a){a=s;O=98;break t}a=Ar(Z,a)|0;l=a+l|0;if((l|0)>(s|0)){a=s;O=98;break t}if(!(de[e>>2]&32))ne(Z,a,e)|0;if(l>>>0>=s>>>0){a=s;O=98;break}else h=h+4|0}}}}while(0);if((O|0)==98){O=0;ae(e,32,k,a,S^8192);m=A;a=(k|0)>(a|0)?k:a;continue}if((O|0)==77){O=0;l=(h|0)>-1?s&-65537:s;s=M;s=(de[s>>2]|0)!=0|(de[s+4>>2]|0)!=0;if((h|0)!=0|s){s=(s&1^1)+(X-a)|0;m=a;s=(h|0)>(s|0)?h:s;p=c;a=P}else{m=P;s=0;p=c;a=P}}c=a-m|0;s=(s|0)<(c|0)?c:s;h=f+s|0;a=(k|0)<(h|0)?h:k;ae(e,32,a,h,l);if(!(de[e>>2]&32))ne(p,f,e)|0;ae(e,48,a,h,l^65536);ae(e,48,s,c,0);if(!(de[e>>2]&32))ne(m,c,e)|0;ae(e,32,a,h,l^8192);m=A}e:do{if((O|0)==245)if(!e)if(t){o=1;while(1){t=de[n+(o<<2)>>2]|0;if(!t)break;Hr(i+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(de[n+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ge=L;return o|0}function Gr(e){e=e|0;if(!(de[e+68>>2]|0))g(e);return}function Xr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=e+20|0;n=de[i>>2]|0;e=(de[e+16>>2]|0)-n|0;e=e>>>0>r>>>0?r:e;ei(n|0,t|0,e|0)|0;de[i>>2]=(de[i>>2]|0)+e;return r|0}function Hr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;de[e>>2]=t;break e}case 10:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=0;break e}case 12:{i=(de[r>>2]|0)+(8-1)&~(8-1);t=i;n=de[t>>2]|0;t=de[t+4>>2]|0;de[r>>2]=i+8;i=e;de[i>>2]=n;de[i+4>>2]=t;break e}case 13:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&65535)<<16>>16;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 14:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&65535;de[n+4>>2]=0;break e}case 15:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&255)<<24>>24;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 16:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&255;de[n+4>>2]=0;break e}case 17:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}case 18:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0)}function oe(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){i=li(e|0,t|0,10,0)|0;r=r+-1|0;pe[r>>0]=i|48;i=si(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=i;t=re}else{e=i;break}}if(e)while(1){r=r+-1|0;pe[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function ae(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0;s=ge;ge=ge+256|0;a=s;do{if((r|0)>(i|0)&(n&73728|0)==0){n=r-i|0;G(a|0,t|0,(n>>>0>256?256:n)|0)|0;t=de[e>>2]|0;o=(t&32|0)==0;if(n>>>0>255){i=r-i|0;do{if(o){ne(a,256,e)|0;t=de[e>>2]|0}n=n+-256|0;o=(t&32|0)==0}while(n>>>0>255);if(o)n=i&255;else break}else if(!o)break;ne(a,n,e)|0}}while(0);ge=s}function Yr(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,F=0,N=0,O=0,P=0,R=0,C=0,M=0,I=0,D=0,L=0;do{if(e>>>0<245){p=e>>>0<11?16:e+11&-8;e=p>>>3;s=de[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;n=de[i>>2]|0;o=n+8|0;a=de[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(de[155]|0)>>>0)B();t=a+12|0;if((de[t>>2]|0)==(n|0)){de[t>>2]=r;de[i>>2]=a;break}else B()}else de[151]=s&~(1<>2]=L|3;L=n+(L|4)|0;de[L>>2]=de[L>>2]|1;L=o;return L|0}a=de[153]|0;if(p>>>0>a>>>0){if(r){i=2<>>12&16;i=i>>>l;n=i>>>5&8;i=i>>>n;o=i>>>2&4;i=i>>>o;r=i>>>1&2;i=i>>>r;e=i>>>1&1;e=(n|l|o|r|e)+(i>>>e)|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;o=de[i>>2]|0;l=o+8|0;n=de[l>>2]|0;do{if((r|0)!=(n|0)){if(n>>>0<(de[155]|0)>>>0)B();t=n+12|0;if((de[t>>2]|0)==(o|0)){de[t>>2]=r;de[i>>2]=n;u=de[153]|0;break}else B()}else{de[151]=s&~(1<>2]=p|3;s=o+p|0;de[o+(p|4)>>2]=a|1;de[o+L>>2]=a;if(u){n=de[156]|0;r=u>>>3;t=r<<1;i=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(t>>>0<(de[155]|0)>>>0)B();else{h=e;c=t}}else{de[151]=e|r;h=644+(t+2<<2)|0;c=i}de[h>>2]=n;de[c+12>>2]=n;de[n+8>>2]=c;de[n+12>>2]=i}de[153]=a;de[156]=s;L=l;return L|0}e=de[152]|0;if(e){r=(e&0-e)+-1|0;D=r>>>12&16;r=r>>>D;I=r>>>5&8;r=r>>>I;L=r>>>2&4;r=r>>>L;e=r>>>1&2;r=r>>>e;i=r>>>1&1;i=de[908+((I|D|L|e|i)+(r>>>i)<<2)>>2]|0;r=(de[i+4>>2]&-8)-p|0;e=i;while(1){t=de[e+16>>2]|0;if(!t){t=de[e+20>>2]|0;if(!t){l=r;break}}e=(de[t+4>>2]&-8)-p|0;L=e>>>0>>0;r=L?e:r;e=t;i=L?t:i}o=de[155]|0;if(i>>>0>>0)B();s=i+p|0;if(i>>>0>=s>>>0)B();a=de[i+24>>2]|0;r=de[i+12>>2]|0;do{if((r|0)==(i|0)){e=i+20|0;t=de[e>>2]|0;if(!t){e=i+16|0;t=de[e>>2]|0;if(!t){f=0;break}}while(1){r=t+20|0;n=de[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=de[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)B();else{de[e>>2]=0;f=t;break}}else{n=de[i+8>>2]|0;if(n>>>0>>0)B();t=n+12|0;if((de[t>>2]|0)!=(i|0))B();e=r+8|0;if((de[e>>2]|0)==(i|0)){de[t>>2]=r;de[e>>2]=n;f=r;break}else B()}}while(0);do{if(a){t=de[i+28>>2]|0;e=908+(t<<2)|0;if((i|0)==(de[e>>2]|0)){de[e>>2]=f;if(!f){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();t=a+16|0;if((de[t>>2]|0)==(i|0))de[t>>2]=f;else de[a+20>>2]=f;if(!f)break}e=de[155]|0;if(f>>>0>>0)B();de[f+24>>2]=a;t=de[i+16>>2]|0;do{if(t)if(t>>>0>>0)B();else{de[f+16>>2]=t;de[t+24>>2]=f;break}}while(0);t=de[i+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)B();else{de[f+20>>2]=t;de[t+24>>2]=f;break}}}while(0);if(l>>>0<16){L=l+p|0;de[i+4>>2]=L|3;L=i+(L+4)|0;de[L>>2]=de[L>>2]|1}else{de[i+4>>2]=p|3;de[i+(p|4)>>2]=l|1;de[i+(l+p)>>2]=l;t=de[153]|0;if(t){o=de[156]|0;r=t>>>3;t=r<<1;n=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)B();else{d=t;m=e}}else{de[151]=e|r;d=644+(t+2<<2)|0;m=n}de[d>>2]=o;de[m+12>>2]=o;de[o+8>>2]=m;de[o+12>>2]=n}de[153]=l;de[156]=s}L=i+8|0;return L|0}else m=p}else m=p}else if(e>>>0<=4294967231){e=e+11|0;c=e&-8;h=de[152]|0;if(h){r=0-c|0;e=e>>>8;if(e)if(c>>>0>16777215)u=31;else{m=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;u=14-(d|m|u)+(b<>>15)|0;u=c>>>(u+7|0)&1|u<<1}else u=0;e=de[908+(u<<2)>>2]|0;e:do{if(!e){n=0;e=0;b=86}else{a=r;n=0;s=c<<((u|0)==31?0:25-(u>>>1)|0);l=e;e=0;while(1){o=de[l+4>>2]&-8;r=o-c|0;if(r>>>0>>0)if((o|0)==(c|0)){o=l;e=l;b=90;break e}else e=l;else r=a;b=de[l+20>>2]|0;l=de[l+16+(s>>>31<<2)>>2]|0;n=(b|0)==0|(b|0)==(l|0)?n:b;if(!l){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((n|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>f;h=e>>>5&8;e=e>>>h;d=e>>>2&4;e=e>>>d;m=e>>>1&2;e=e>>>m;n=e>>>1&1;n=de[908+((h|f|d|m|n)+(e>>>n)<<2)>>2]|0;e=0}if(!n){s=r;l=e}else{o=n;b=90}}if((b|0)==90)while(1){b=0;m=(de[o+4>>2]&-8)-c|0;n=m>>>0>>0;r=n?m:r;e=n?o:e;n=de[o+16>>2]|0;if(n){o=n;b=90;continue}o=de[o+20>>2]|0;if(!o){s=r;l=e;break}else b=90}if((l|0)!=0?s>>>0<((de[153]|0)-c|0)>>>0:0){n=de[155]|0;if(l>>>0>>0)B();a=l+c|0;if(l>>>0>=a>>>0)B();o=de[l+24>>2]|0;r=de[l+12>>2]|0;do{if((r|0)==(l|0)){e=l+20|0;t=de[e>>2]|0;if(!t){e=l+16|0;t=de[e>>2]|0;if(!t){p=0;break}}while(1){r=t+20|0;i=de[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=de[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)B();else{de[e>>2]=0;p=t;break}}else{i=de[l+8>>2]|0;if(i>>>0>>0)B();t=i+12|0;if((de[t>>2]|0)!=(l|0))B();e=r+8|0;if((de[e>>2]|0)==(l|0)){de[t>>2]=r;de[e>>2]=i;p=r;break}else B()}}while(0);do{if(o){t=de[l+28>>2]|0;e=908+(t<<2)|0;if((l|0)==(de[e>>2]|0)){de[e>>2]=p;if(!p){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();t=o+16|0;if((de[t>>2]|0)==(l|0))de[t>>2]=p;else de[o+20>>2]=p;if(!p)break}e=de[155]|0;if(p>>>0>>0)B();de[p+24>>2]=o;t=de[l+16>>2]|0;do{if(t)if(t>>>0>>0)B();else{de[p+16>>2]=t;de[t+24>>2]=p;break}}while(0);t=de[l+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)B();else{de[p+20>>2]=t;de[t+24>>2]=p;break}}}while(0);e:do{if(s>>>0>=16){de[l+4>>2]=c|3;de[l+(c|4)>>2]=s|1;de[l+(s+c)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)B();else{g=t;v=e}}else{de[151]=r|t;g=644+(e+2<<2)|0;v=i}de[g>>2]=a;de[v+12>>2]=a;de[l+(c+8)>>2]=v;de[l+(c+12)>>2]=i;break}t=s>>>8;if(t)if(s>>>0>16777215)i=31;else{D=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(I|D|i)+(L<>>15)|0;i=s>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;de[l+(c+28)>>2]=i;de[l+(c+20)>>2]=0;de[l+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break}t=de[t>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(s|0)){i=s<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(s|0)){w=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)B();else{de[e>>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break e}}else w=t}while(0);t=w+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&w>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[l+(c+8)>>2]=e;de[l+(c+12)>>2]=w;de[l+(c+24)>>2]=0;break}else B()}else{L=s+c|0;de[l+4>>2]=L|3;L=l+(L+4)|0;de[L>>2]=de[L>>2]|1}}while(0);L=l+8|0;return L|0}else m=c}else m=c}else m=-1}while(0);r=de[153]|0;if(r>>>0>=m>>>0){t=r-m|0;e=de[156]|0;if(t>>>0>15){de[156]=e+m;de[153]=t;de[e+(m+4)>>2]=t|1;de[e+r>>2]=t;de[e+4>>2]=m|3}else{de[153]=0;de[156]=0;de[e+4>>2]=r|3;L=e+(r+4)|0;de[L>>2]=de[L>>2]|1}L=e+8|0;return L|0}e=de[154]|0;if(e>>>0>m>>>0){D=e-m|0;de[154]=D;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=D|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}do{if(!(de[269]|0)){e=$e(30)|0;if(!(e+-1&e)){de[271]=e;de[270]=e;de[272]=-1;de[273]=-1;de[274]=0;de[262]=0;w=(ut(0)|0)&-16^1431655768;de[269]=w;break}else B()}}while(0);l=m+48|0;s=de[271]|0;u=m+47|0;a=s+u|0;s=0-s|0;h=a&s;if(h>>>0<=m>>>0){L=0;return L|0}e=de[261]|0;if((e|0)!=0?(v=de[259]|0,w=v+h|0,w>>>0<=v>>>0|w>>>0>e>>>0):0){L=0;return L|0}e:do{if(!(de[262]&4)){e=de[157]|0;t:do{if(e){n=1052;while(1){r=de[n>>2]|0;if(r>>>0<=e>>>0?(_=n+4|0,(r+(de[_>>2]|0)|0)>>>0>e>>>0):0){o=n;e=_;break}n=de[n+8>>2]|0;if(!n){b=174;break t}}r=a-(de[154]|0)&s;if(r>>>0<2147483647){n=z(r|0)|0;w=(n|0)==((de[o>>2]|0)+(de[e>>2]|0)|0);e=w?r:0;if(w){if((n|0)!=(-1|0)){x=n;d=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=z(0)|0;if((o|0)!=(-1|0)){e=o;r=de[270]|0;n=r+-1|0;if(!(n&e))r=h;else r=h-e+(n+e&0-r)|0;e=de[259]|0;n=e+r|0;if(r>>>0>m>>>0&r>>>0<2147483647){w=de[261]|0;if((w|0)!=0?n>>>0<=e>>>0|n>>>0>w>>>0:0){e=0;break}n=z(r|0)|0;w=(n|0)==(o|0);e=w?r:0;if(w){x=o;d=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(l>>>0>r>>>0&(r>>>0<2147483647&(n|0)!=(-1|0))?(y=de[271]|0,y=u-r+y&0-y,y>>>0<2147483647):0)if((z(y|0)|0)==(-1|0)){z(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((n|0)!=(-1|0)){x=n;d=r;b=194;break e}}}while(0);de[262]=de[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?h>>>0<2147483647:0)?(x=z(h|0)|0,T=z(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(T|0)!=(-1|0))):0)?(E=T-x|0,S=E>>>0>(m+40|0)>>>0,S):0){d=S?E:e;b=194}if((b|0)==194){e=(de[259]|0)+d|0;de[259]=e;if(e>>>0>(de[260]|0)>>>0)de[260]=e;a=de[157]|0;e:do{if(a){o=1052;do{e=de[o>>2]|0;r=o+4|0;n=de[r>>2]|0;if((x|0)==(e+n|0)){A=e;k=r;F=n;N=o;b=204;break}o=de[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(de[N+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=A>>>0:0){de[k>>2]=F+d;L=(de[154]|0)+d|0;D=a+8|0;D=(D&7|0)==0?0:0-D&7;I=L-D|0;de[157]=a+D;de[154]=I;de[a+(D+4)>>2]=I|1;de[a+(L+4)>>2]=40;de[158]=de[273];break}e=de[155]|0;if(x>>>0>>0){de[155]=x;e=x}r=x+d|0;o=1052;while(1){if((de[o>>2]|0)==(r|0)){n=o;r=o;b=212;break}o=de[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(de[r+12>>2]&8)){de[n>>2]=x;f=r+4|0;de[f>>2]=(de[f>>2]|0)+d;f=x+8|0;f=(f&7|0)==0?0:0-f&7;u=x+(d+8)|0;u=(u&7|0)==0?0:0-u&7;t=x+(u+d)|0;c=f+m|0;p=x+c|0;h=t-(x+f)-m|0;de[x+(f+4)>>2]=m|3;t:do{if((t|0)!=(a|0)){if((t|0)==(de[156]|0)){L=(de[153]|0)+h|0;de[153]=L;de[156]=p;de[x+(c+4)>>2]=L|1;de[x+(L+c)>>2]=L;break}s=d+4|0;r=de[x+(s+u)>>2]|0;if((r&3|0)==1){l=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=de[x+((u|24)+d)>>2]|0;i=de[x+(d+12+u)>>2]|0;do{if((i|0)==(t|0)){n=u|16;i=x+(s+n)|0;r=de[i>>2]|0;if(!r){i=x+(n+d)|0;r=de[i>>2]|0;if(!r){M=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)B();else{de[i>>2]=0;M=r;break}}else{n=de[x+((u|8)+d)>>2]|0;if(n>>>0>>0)B();e=n+12|0;if((de[e>>2]|0)!=(t|0))B();r=i+8|0;if((de[r>>2]|0)==(t|0)){de[e>>2]=i;de[r>>2]=n;M=i;break}else B()}}while(0);if(!a)break;e=de[x+(d+28+u)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(de[r>>2]|0)){if(a>>>0<(de[155]|0)>>>0)B();e=a+16|0;if((de[e>>2]|0)==(t|0))de[e>>2]=M;else de[a+20>>2]=M;if(!M)break r}else{de[r>>2]=M;if(M)break;de[152]=de[152]&~(1<>>0>>0)B();de[M+24>>2]=a;t=u|16;e=de[x+(t+d)>>2]|0;do{if(e)if(e>>>0>>0)B();else{de[M+16>>2]=e;de[e+24>>2]=M;break}}while(0);t=de[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(de[155]|0)>>>0)B();else{de[M+20>>2]=t;de[t+24>>2]=M;break}}else{i=de[x+((u|8)+d)>>2]|0;n=de[x+(d+12+u)>>2]|0;r=644+(o<<1<<2)|0;do{if((i|0)!=(r|0)){if(i>>>0>>0)B();if((de[i+12>>2]|0)==(t|0))break;B()}}while(0);if((n|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)B();e=n+8|0;if((de[e>>2]|0)==(t|0)){O=e;break}B()}}while(0);de[i+12>>2]=n;de[O>>2]=i}}while(0);t=x+((l|u)+d)|0;n=l+h|0}else n=h;t=t+4|0;de[t>>2]=de[t>>2]&-2;de[x+(c+4)>>2]=n|1;de[x+(n+c)>>2]=n;t=n>>>3;if(n>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0>=(de[155]|0)>>>0){I=t;D=e;break}B()}}while(0);de[I>>2]=p;de[D+12>>2]=p;de[x+(c+8)>>2]=D;de[x+(c+12)>>2]=i;break}t=n>>>8;do{if(!t)i=0;else{if(n>>>0>16777215){i=31;break}I=(t+1048320|0)>>>16&8;D=t<>>16&4;D=D<>>16&2;i=14-(M|I|i)+(D<>>15)|0;i=n>>>(i+7|0)&1|i<<1}}while(0);t=908+(i<<2)|0;de[x+(c+28)>>2]=i;de[x+(c+20)>>2]=0;de[x+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break}t=de[t>>2]|0;r:do{if((de[t+4>>2]&-8|0)!=(n|0)){i=n<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(n|0)){L=r;break r}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)B();else{de[e>>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break t}}else L=t}while(0);t=L+8|0;e=de[t>>2]|0;D=de[155]|0;if(e>>>0>=D>>>0&L>>>0>=D>>>0){de[e+12>>2]=p;de[t>>2]=p;de[x+(c+8)>>2]=e;de[x+(c+12)>>2]=L;de[x+(c+24)>>2]=0;break}else B()}else{L=(de[154]|0)+h|0;de[154]=L;de[157]=p;de[x+(c+4)>>2]=L|1}}while(0);L=x+(f|8)|0;return L|0}else r=1052;while(1){e=de[r>>2]|0;if(e>>>0<=a>>>0?(t=de[r+4>>2]|0,i=e+t|0,i>>>0>a>>>0):0)break;r=de[r+8>>2]|0}n=e+(t+-39)|0;e=e+(t+-47+((n&7|0)==0?0:0-n&7))|0;n=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;L=d+-40-r|0;de[157]=x+r;de[154]=L;de[x+(r+4)>>2]=L|1;de[x+(d+-36)>>2]=40;de[158]=de[273];r=e+4|0;de[r>>2]=27;de[t>>2]=de[263];de[t+4>>2]=de[264];de[t+8>>2]=de[265];de[t+12>>2]=de[266];de[263]=x;de[264]=d;de[266]=0;de[265]=t;t=e+28|0;de[t>>2]=7;if((e+32|0)>>>0>>0)do{L=t;t=t+4|0;de[t>>2]=7}while((L+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;de[r>>2]=de[r>>2]&-2;de[a+4>>2]=o|1;de[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)B();else{P=t;R=e}}else{de[151]=r|t;P=644+(e+2<<2)|0;R=i}de[P>>2]=a;de[R+12>>2]=a;de[a+8>>2]=R;de[a+12>>2]=i;break}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{D=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(I|D|i)+(L<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;r=908+(i<<2)|0;de[a+28>>2]=i;de[a+20>>2]=0;de[n>>2]=0;t=de[152]|0;e=1<>2]=a;de[a+24>>2]=r;de[a+12>>2]=a;de[a+8>>2]=a;break}t=de[r>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(o|0)){C=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)B();else{de[e>>2]=a;de[a+24>>2]=t;de[a+12>>2]=a;de[a+8>>2]=a;break e}}else C=t}while(0);t=C+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&C>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[a+8>>2]=e;de[a+12>>2]=C;de[a+24>>2]=0;break}else B()}}else{L=de[155]|0;if((L|0)==0|x>>>0>>0)de[155]=x;de[263]=x;de[264]=d;de[266]=0;de[160]=de[269];de[159]=-1;t=0;do{L=t<<1;D=644+(L<<2)|0;de[644+(L+3<<2)>>2]=D;de[644+(L+2<<2)>>2]=D;t=t+1|0}while((t|0)!=32);L=x+8|0;L=(L&7|0)==0?0:0-L&7;D=d+-40-L|0;de[157]=x+L;de[154]=D;de[x+(L+4)>>2]=D|1;de[x+(d+-36)>>2]=40;de[158]=de[273]}}while(0);t=de[154]|0;if(t>>>0>m>>>0){D=t-m|0;de[154]=D;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=D|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}}L=ie()|0;de[L>>2]=12;L=0;return L|0}function b(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0,y=0;if(!e)return;t=e+-8|0;s=de[155]|0;if(t>>>0>>0)B();r=de[e+-4>>2]|0;i=r&3;if((i|0)==1)B();p=r&-8;m=e+(p+-8)|0;do{if(!(r&1)){t=de[t>>2]|0;if(!i)return;l=-8-t|0;h=e+l|0;c=t+p|0;if(h>>>0>>0)B();if((h|0)==(de[156]|0)){t=e+(p+-4)|0;r=de[t>>2]|0;if((r&3|0)!=3){y=h;o=c;break}de[153]=c;de[t>>2]=r&-2;de[e+(l+4)>>2]=c|1;de[m>>2]=c;return}n=t>>>3;if(t>>>0<256){i=de[e+(l+8)>>2]|0;r=de[e+(l+12)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0>>0)B();if((de[i+12>>2]|0)!=(h|0))B()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)B();t=r+8|0;if((de[t>>2]|0)==(h|0))a=t;else B()}else a=r+8|0;de[i+12>>2]=r;de[a>>2]=i;y=h;o=c;break}a=de[e+(l+24)>>2]|0;i=de[e+(l+12)>>2]|0;do{if((i|0)==(h|0)){r=e+(l+20)|0;t=de[r>>2]|0;if(!t){r=e+(l+16)|0;t=de[r>>2]|0;if(!t){u=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0>>0)B();else{de[r>>2]=0;u=t;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)B();t=n+12|0;if((de[t>>2]|0)!=(h|0))B();r=i+8|0;if((de[r>>2]|0)==(h|0)){de[t>>2]=i;de[r>>2]=n;u=i;break}else B()}}while(0);if(a){t=de[e+(l+28)>>2]|0;r=908+(t<<2)|0;if((h|0)==(de[r>>2]|0)){de[r>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();t=a+16|0;if((de[t>>2]|0)==(h|0))de[t>>2]=u;else de[a+20>>2]=u;if(!u){y=h;o=c;break}}r=de[155]|0;if(u>>>0>>0)B();de[u+24>>2]=a;t=de[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)B();else{de[u+16>>2]=t;de[t+24>>2]=u;break}}while(0);t=de[e+(l+20)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)B();else{de[u+20>>2]=t;de[t+24>>2]=u;y=h;o=c;break}else{y=h;o=c}}else{y=h;o=c}}else{y=t;o=p}}while(0);if(y>>>0>=m>>>0)B();t=e+(p+-4)|0;r=de[t>>2]|0;if(!(r&1))B();if(!(r&2)){if((m|0)==(de[157]|0)){v=(de[154]|0)+o|0;de[154]=v;de[157]=y;de[y+4>>2]=v|1;if((y|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){v=(de[153]|0)+o|0;de[153]=v;de[156]=y;de[y+4>>2]=v|1;de[y+v>>2]=v;return}o=(r&-8)+o|0;n=r>>>3;do{if(r>>>0>=256){a=de[e+(p+16)>>2]|0;t=de[e+(p|4)>>2]|0;do{if((t|0)==(m|0)){r=e+(p+12)|0;t=de[r>>2]|0;if(!t){r=e+(p+8)|0;t=de[r>>2]|0;if(!t){d=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0<(de[155]|0)>>>0)B();else{de[r>>2]=0;d=t;break}}else{r=de[e+p>>2]|0;if(r>>>0<(de[155]|0)>>>0)B();i=r+12|0;if((de[i>>2]|0)!=(m|0))B();n=t+8|0;if((de[n>>2]|0)==(m|0)){de[i>>2]=t;de[n>>2]=r;d=t;break}else B()}}while(0);if(a){t=de[e+(p+20)>>2]|0;r=908+(t<<2)|0;if((m|0)==(de[r>>2]|0)){de[r>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();t=a+16|0;if((de[t>>2]|0)==(m|0))de[t>>2]=d;else de[a+20>>2]=d;if(!d)break}r=de[155]|0;if(d>>>0>>0)B();de[d+24>>2]=a;t=de[e+(p+8)>>2]|0;do{if(t)if(t>>>0>>0)B();else{de[d+16>>2]=t;de[t+24>>2]=d;break}}while(0);t=de[e+(p+12)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)B();else{de[d+20>>2]=t;de[t+24>>2]=d;break}}}else{i=de[e+p>>2]|0;r=de[e+(p|4)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0<(de[155]|0)>>>0)B();if((de[i+12>>2]|0)!=(m|0))B()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0<(de[155]|0)>>>0)B();t=r+8|0;if((de[t>>2]|0)==(m|0))f=t;else B()}else f=r+8|0;de[i+12>>2]=r;de[f>>2]=i}}while(0);de[y+4>>2]=o|1;de[y+o>>2]=o;if((y|0)==(de[156]|0)){de[153]=o;return}}else{de[t>>2]=r&-2;de[y+4>>2]=o|1;de[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;n=644+(r<<2)|0;i=de[151]|0;t=1<>2]|0;if(r>>>0<(de[155]|0)>>>0)B();else{_=t;g=r}}else{de[151]=i|t;_=644+(r+2<<2)|0;g=n}de[_>>2]=y;de[g+12>>2]=y;de[y+8>>2]=g;de[y+12>>2]=n;return}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{_=(t+1048320|0)>>>16&8;g=t<<_;m=(g+520192|0)>>>16&4;g=g<>>16&2;n=14-(m|_|n)+(g<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;de[y+28>>2]=n;de[y+20>>2]=0;de[y+16>>2]=0;r=de[152]|0;i=1<>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){r=t+16+(n>>>31<<2)|0;i=de[r>>2]|0;if(!i)break;if((de[i+4>>2]&-8|0)==(o|0)){v=i;break t}else{n=n<<1;t=i}}if(r>>>0<(de[155]|0)>>>0)B();else{de[r>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y;break e}}else v=t}while(0);t=v+8|0;r=de[t>>2]|0;g=de[155]|0;if(r>>>0>=g>>>0&v>>>0>=g>>>0){de[r+12>>2]=y;de[t>>2]=y;de[y+8>>2]=r;de[y+12>>2]=v;de[y+24>>2]=0;break}else B()}else{de[152]=r|i;de[t>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y}}while(0);y=(de[159]|0)+-1|0;de[159]=y;if(!y)t=1060;else return;while(1){t=de[t>>2]|0;if(!t)break;else t=t+8|0}de[159]=-1;return}function Wr(e,t){e=e|0;t=t|0;var r=0,i=0;if(!e){e=Yr(t)|0;return e|0}if(t>>>0>4294967231){e=ie()|0;de[e>>2]=12;e=0;return e|0}r=Vr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=Yr(t)|0;if(!r){e=0;return e|0}i=de[e+-4>>2]|0;i=(i&-8)-((i&3|0)==0?8:4)|0;ei(r|0,e|0,(i>>>0>>0?i:t)|0)|0;b(e);e=r;return e|0}function qr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=de[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Vr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=e+4|0;d=de[p>>2]|0;l=d&-8;h=e+l|0;s=de[155]|0;r=d&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))B();i=e+(l|4)|0;n=de[i>>2]|0;if(!(n&1))B();if(!r){if(t>>>0<256){e=0;return e|0}if(l>>>0>=(t+4|0)>>>0?(l-t|0)>>>0<=de[271]<<1>>>0:0)return e|0;e=0;return e|0}if(l>>>0>=t>>>0){r=l-t|0;if(r>>>0<=15)return e|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|3;de[i>>2]=de[i>>2]|1;Kr(e+t|0,r);return e|0}if((h|0)==(de[157]|0)){r=(de[154]|0)+l|0;if(r>>>0<=t>>>0){e=0;return e|0}f=r-t|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|1;de[157]=e+t;de[154]=f;return e|0}if((h|0)==(de[156]|0)){i=(de[153]|0)+l|0;if(i>>>0>>0){e=0;return e|0}r=i-t|0;if(r>>>0>15){de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|1;de[e+i>>2]=r;i=e+(i+4)|0;de[i>>2]=de[i>>2]&-2;i=e+t|0}else{de[p>>2]=d&1|i|2;i=e+(i+4)|0;de[i>>2]=de[i>>2]|1;i=0;r=0}de[153]=r;de[156]=i;return e|0}if(n&2){e=0;return e|0}c=(n&-8)+l|0;if(c>>>0>>0){e=0;return e|0}f=c-t|0;o=n>>>3;do{if(n>>>0>=256){a=de[e+(l+24)>>2]|0;o=de[e+(l+12)>>2]|0;do{if((o|0)==(h|0)){i=e+(l+20)|0;r=de[i>>2]|0;if(!r){i=e+(l+16)|0;r=de[i>>2]|0;if(!r){u=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)B();else{de[i>>2]=0;u=r;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)B();r=n+12|0;if((de[r>>2]|0)!=(h|0))B();i=o+8|0;if((de[i>>2]|0)==(h|0)){de[r>>2]=o;de[i>>2]=n;u=o;break}else B()}}while(0);if(a){r=de[e+(l+28)>>2]|0;i=908+(r<<2)|0;if((h|0)==(de[i>>2]|0)){de[i>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();r=a+16|0;if((de[r>>2]|0)==(h|0))de[r>>2]=u;else de[a+20>>2]=u;if(!u)break}i=de[155]|0;if(u>>>0>>0)B();de[u+24>>2]=a;r=de[e+(l+16)>>2]|0;do{if(r)if(r>>>0>>0)B();else{de[u+16>>2]=r;de[r+24>>2]=u;break}}while(0);r=de[e+(l+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)B();else{de[u+20>>2]=r;de[r+24>>2]=u;break}}}else{n=de[e+(l+8)>>2]|0;i=de[e+(l+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)B();if((de[n+12>>2]|0)!=(h|0))B()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)B();r=i+8|0;if((de[r>>2]|0)==(h|0))a=r;else B()}else a=i+8|0;de[n+12>>2]=i;de[a>>2]=n}}while(0);if(f>>>0<16){de[p>>2]=c|d&1|2;t=e+(c|4)|0;de[t>>2]=de[t>>2]|1;return e|0}else{de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|3;d=e+(c|4)|0;de[d>>2]=de[d>>2]|1;Kr(e+t|0,f);return e|0}return 0}function Kr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,_=0,g=0,v=0;m=e+t|0;r=de[e+4>>2]|0;do{if(!(r&1)){u=de[e>>2]|0;if(!(r&3))return;f=e+(0-u)|0;c=u+t|0;l=de[155]|0;if(f>>>0>>0)B();if((f|0)==(de[156]|0)){i=e+(t+4)|0;r=de[i>>2]|0;if((r&3|0)!=3){v=f;a=c;break}de[153]=c;de[i>>2]=r&-2;de[e+(4-u)>>2]=c|1;de[m>>2]=c;return}o=u>>>3;if(u>>>0<256){n=de[e+(8-u)>>2]|0;i=de[e+(12-u)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)B();if((de[n+12>>2]|0)!=(f|0))B()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)B();r=i+8|0;if((de[r>>2]|0)==(f|0))s=r;else B()}else s=i+8|0;de[n+12>>2]=i;de[s>>2]=n;v=f;a=c;break}s=de[e+(24-u)>>2]|0;n=de[e+(12-u)>>2]|0;do{if((n|0)==(f|0)){n=16-u|0;i=e+(n+4)|0;r=de[i>>2]|0;if(!r){i=e+n|0;r=de[i>>2]|0;if(!r){h=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)B();else{de[i>>2]=0;h=r;break}}else{o=de[e+(8-u)>>2]|0;if(o>>>0>>0)B();r=o+12|0;if((de[r>>2]|0)!=(f|0))B();i=n+8|0;if((de[i>>2]|0)==(f|0)){de[r>>2]=n;de[i>>2]=o;h=n;break}else B()}}while(0);if(s){r=de[e+(28-u)>>2]|0;i=908+(r<<2)|0;if((f|0)==(de[i>>2]|0)){de[i>>2]=h;if(!h){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();r=s+16|0;if((de[r>>2]|0)==(f|0))de[r>>2]=h;else de[s+20>>2]=h;if(!h){v=f;a=c;break}}n=de[155]|0;if(h>>>0>>0)B();de[h+24>>2]=s;r=16-u|0;i=de[e+r>>2]|0;do{if(i)if(i>>>0>>0)B();else{de[h+16>>2]=i;de[i+24>>2]=h;break}}while(0);r=de[e+(r+4)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)B();else{de[h+20>>2]=r;de[r+24>>2]=h;v=f;a=c;break}else{v=f;a=c}}else{v=f;a=c}}else{v=e;a=t}}while(0);l=de[155]|0;if(m>>>0>>0)B();r=e+(t+4)|0;i=de[r>>2]|0;if(!(i&2)){if((m|0)==(de[157]|0)){g=(de[154]|0)+a|0;de[154]=g;de[157]=v;de[v+4>>2]=g|1;if((v|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){g=(de[153]|0)+a|0;de[153]=g;de[156]=v;de[v+4>>2]=g|1;de[v+g>>2]=g;return}a=(i&-8)+a|0;o=i>>>3;do{if(i>>>0>=256){s=de[e+(t+24)>>2]|0;n=de[e+(t+12)>>2]|0;do{if((n|0)==(m|0)){i=e+(t+20)|0;r=de[i>>2]|0;if(!r){i=e+(t+16)|0;r=de[i>>2]|0;if(!r){d=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)B();else{de[i>>2]=0;d=r;break}}else{o=de[e+(t+8)>>2]|0;if(o>>>0>>0)B();r=o+12|0;if((de[r>>2]|0)!=(m|0))B();i=n+8|0;if((de[i>>2]|0)==(m|0)){de[r>>2]=n;de[i>>2]=o;d=n;break}else B()}}while(0);if(s){r=de[e+(t+28)>>2]|0;i=908+(r<<2)|0;if((m|0)==(de[i>>2]|0)){de[i>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)B();r=s+16|0;if((de[r>>2]|0)==(m|0))de[r>>2]=d;else de[s+20>>2]=d;if(!d)break}i=de[155]|0;if(d>>>0>>0)B();de[d+24>>2]=s;r=de[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)B();else{de[d+16>>2]=r;de[r+24>>2]=d;break}}while(0);r=de[e+(t+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)B();else{de[d+20>>2]=r;de[r+24>>2]=d;break}}}else{n=de[e+(t+8)>>2]|0;i=de[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)B();if((de[n+12>>2]|0)!=(m|0))B()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)B();r=i+8|0;if((de[r>>2]|0)==(m|0))p=r;else B()}else p=i+8|0;de[n+12>>2]=i;de[p>>2]=n}}while(0);de[v+4>>2]=a|1;de[v+a>>2]=a;if((v|0)==(de[156]|0)){de[153]=a;return}}else{de[r>>2]=i&-2;de[v+4>>2]=a|1;de[v+a>>2]=a}r=a>>>3;if(a>>>0<256){i=r<<1;o=644+(i<<2)|0;n=de[151]|0;r=1<>2]|0;if(i>>>0<(de[155]|0)>>>0)B();else{_=r;g=i}}else{de[151]=n|r;_=644+(i+2<<2)|0;g=o}de[_>>2]=v;de[g+12>>2]=v;de[v+8>>2]=g;de[v+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{_=(r+1048320|0)>>>16&8;g=r<<_;m=(g+520192|0)>>>16&4;g=g<>>16&2;o=14-(m|_|o)+(g<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;de[v+28>>2]=o;de[v+20>>2]=0;de[v+16>>2]=0;i=de[152]|0;n=1<>2]=v;de[v+24>>2]=r;de[v+12>>2]=v;de[v+8>>2]=v;return}r=de[r>>2]|0;e:do{if((de[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){i=r+16+(o>>>31<<2)|0;n=de[i>>2]|0;if(!n)break;if((de[n+4>>2]&-8|0)==(a|0)){r=n;break e}else{o=o<<1;r=n}}if(i>>>0<(de[155]|0)>>>0)B();de[i>>2]=v;de[v+24>>2]=r;de[v+12>>2]=v;de[v+8>>2]=v;return}}while(0);i=r+8|0;n=de[i>>2]|0;g=de[155]|0;if(!(n>>>0>=g>>>0&r>>>0>=g>>>0))B();de[n+12>>2]=v;de[i>>2]=v;de[v+8>>2]=n;de[v+12>>2]=r;de[v+24>>2]=0}function Jr(){}function se(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;i=t-i-(r>>>0>e>>>0|0)>>>0;return(re=i,e-r>>>0|0)|0}function G(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;n=i&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){pe[e>>0]=t;e=e+1|0}}while((e|0)<(n|0)){de[e>>2]=a;e=e+4|0}}while((e|0)<(i|0)){pe[e>>0]=t;e=e+1|0}return e-r|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+i+(r>>>0>>0|0)>>>0,r|0)|0}function ei(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if((r|0)>=4096)return Qe(e|0,t|0,r|0)|0;i=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return i|0;pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){de[e>>2]=de[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return i|0}function ti(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return}re=(t|0)<0?-1:0}function ri(e){e=e|0;var t=0;t=pe[w+(e&255)>>0]|0;if((t|0)<8)return t|0;t=pe[w+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=pe[w+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(pe[w+(e>>>24)>>0]|0)+24|0}function ii(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0;o=e&65535;n=t&65535;r=ve(n,o)|0;i=e>>>16;e=(r>>>16)+(ve(n,i)|0)|0;n=t>>>16;t=ve(n,o)|0;return(re=(e>>>16)+(ve(n,i)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function ni(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=t>>31|((t|0)<0?-1:0)<<1;l=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=i>>31|((i|0)<0?-1:0)<<1;n=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;s=se(u^e,l^t,u,l)|0;a=re;e=o^u;t=n^l;se((ui(s,a,se(o^r,n^i,o,n)|0,re,0)|0)^e,re^t,e,t)}function oi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;n=ge;ge=ge+16|0;s=n|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;u=i>>31|((i|0)<0?-1:0)<<1;l=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;e=se(a^e,o^t,a,o)|0;t=re;ui(e,t,se(u^r,l^i,u,l)|0,re,s)|0;i=se(de[s>>2]^a,de[s+4>>2]^o,a,o)|0;r=re;ge=n;re=r}function ai(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;n=e;o=r;r=ii(n,o)|0;e=re;re=(ve(t,o)|0)+(ve(i,n)|0)+e|e&0}function si(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return ui(e,t,r,i,0)|0}function li(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;o=ge;ge=ge+16|0;n=o|0;ui(e,t,r,i,n)|0;ge=o;return(re=de[n+4>>2]|0,de[n>>2]|0)|0}function ui(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;h=e;l=t;u=l;a=r;f=i;s=f;if(!u){o=(n|0)!=0;if(!s){if(o){de[n>>2]=(h>>>0)%(a>>>0);de[n+4>>2]=0}f=0;n=(h>>>0)/(a>>>0)>>>0;return(re=f,n)|0}else{if(!o){f=0;n=0;return(re=f,n)|0}de[n>>2]=e|0;de[n+4>>2]=t&0;f=0;n=0;return(re=f,n)|0}}o=(s|0)==0;do{if(a){if(!o){o=(m(s|0)|0)-(m(u|0)|0)|0;if(o>>>0<=31){c=o+1|0;s=31-o|0;t=o-31>>31;a=c;e=h>>>(c>>>0)&t|u<>>(c>>>0)&t;o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;f=0;n=0;return(re=f,n)|0}o=a-1|0;if(o&a){s=(m(a|0)|0)+33-(m(u|0)|0)|0;d=64-s|0;c=32-s|0;l=c>>31;p=s-32|0;t=p>>31;a=s;e=c-1>>31&u>>>(p>>>0)|(u<>>(s>>>0))&t;t=t&u>>>(s>>>0);o=h<>>(p>>>0))&l|h<>31;break}if(n){de[n>>2]=o&h;de[n+4>>2]=0}if((a|0)==1){p=l|t&0;d=e|0|0;return(re=p,d)|0}else{d=ri(a|0)|0;p=u>>>(d>>>0)|0;d=u<<32-d|h>>>(d>>>0)|0;return(re=p,d)|0}}else{if(o){if(n){de[n>>2]=(u>>>0)%(a>>>0);de[n+4>>2]=0}p=0;d=(u>>>0)/(a>>>0)>>>0;return(re=p,d)|0}if(!h){if(n){de[n>>2]=0;de[n+4>>2]=(u>>>0)%(s>>>0)}p=0;d=(u>>>0)/(s>>>0)>>>0;return(re=p,d)|0}o=s-1|0;if(!(o&s)){if(n){de[n>>2]=e|0;de[n+4>>2]=o&u|t&0}p=0;d=u>>>((ri(s|0)|0)>>>0);return(re=p,d)|0}o=(m(s|0)|0)-(m(u|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=u<>>(t>>>0);t=u>>>(t>>>0);o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;p=0;d=0;return(re=p,d)|0}}while(0);if(!a){u=s;l=0;s=0}else{c=r|0|0;h=f|i&0;u=$r(c|0,h|0,-1,-1)|0;r=re;l=s;s=0;do{i=l;l=o>>>31|l<<1;o=s|o<<1;i=e<<1|i>>>31|0;f=e>>>31|t<<1|0;se(u,r,i,f)|0;d=re;p=d>>31|((d|0)<0?-1:0)<<1;s=p&1;e=se(i,f,p&c,(((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1)&h)|0;t=re;a=a-1|0}while((a|0)!=0);u=l;l=0}a=0;if(n){de[n>>2]=e;de[n+4>>2]=t}p=(o|0)>>>31|(u|a)<<1|(a<<1|o>>>31)&0|l;d=(o<<1|0>>>31)&-2|s;return(re=p,d)|0}function hi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return v[e&7](t|0,r|0,i|0)|0}function ci(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;Oi[e&3](t|0,r|0,i|0,n|0,o|0)}function fi(e,t){e=e|0;t=t|0;Pi[e&7](t|0)}function pi(e,t){e=e|0;t=t|0;return Ri[e&1](t|0)|0}function di(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;Ci[e&0](t|0,r|0,i|0)}function mi(e){e=e|0;Mi[e&3]()}function _i(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;Ii[e&3](t|0,r|0,i|0,n|0,o|0,a|0)}function gi(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;return X[e&1](t|0,r|0,i|0,n|0,o|0)|0}function vi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;Di[e&3](t|0,r|0,i|0,n|0)}function yi(e,t,r){e=e|0;t=t|0;r=r|0;a(0);return 0}function bi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;a(1)}function xi(e){e=e|0;a(2)}function Ti(e){e=e|0;a(3);return 0}function wi(e,t,r){e=e|0;t=t|0;r=r|0;a(4)}function Ei(){a(5)}function Si(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a(6)}function Ai(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;a(7);return 0}function ki(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;a(8)}var v=[yi,ar,Xr,Fr,Lr,Nr,yi,yi];var Oi=[bi,pr,fr,bi];var Pi=[xi,tr,nr,rr,ir,or,br,Gr];var Ri=[Ti,Dr];var Ci=[wi];var Mi=[Ei,vr,yr,Ei];var Ii=[Si,mr,dr,Si];var X=[Ai,St];var Di=[ki,lr,ur,ki];return{___cxa_can_catch:_r,_crn_get_levels:Ft,_crn_get_uncompressed_size:zt,_crn_decompress:Bt,_i64Add:$r,_crn_get_width:Dt,___cxa_is_pointer_type:gr,_i64Subtract:se,_memset:G,_malloc:Yr,_free:b,_memcpy:ei,_bitshift64Lshr:Zr,_fflush:kr,_bitshift64Shl:Qr,_crn_get_height:Lt,___errno_location:ie,_crn_get_dxt_format:Nt,runPostSets:Jr,_emscripten_replace_memory:pt,stackAlloc:dt,stackSave:mt,stackRestore:_t,establishStackSpace:gt,setThrew:vt,setTempRet0:xt,getTempRet0:Tt,dynCall_iiii:hi,dynCall_viiiii:ci,dynCall_vi:fi,dynCall_ii:pi,dynCall_viii:di,dynCall_v:mi,dynCall_viiiiii:_i,dynCall_iiiiii:gi,dynCall_viiii:vi}}(e.Ya,e.Za,buffer)),zc=(e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress,e._i64Add=Z._i64Add),nb=(e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type,e._i64Subtract=Z._i64Subtract),qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory,rb=(e._crn_get_dxt_format=Z._crn_get_dxt_format,e._bitshift64Lshr=Z._bitshift64Lshr),Na=e._free=Z._free,sb=(e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location,e._bitshift64Shl=Z._bitshift64Shl);function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>8&255,e>>16&255,e>>24&255)}!function(s){s.loadFromArrayBuffer=function(e,t,r){return new i(t).loadFromArrayBuffer(e,r)};l=PIXI.resources.Resource,__extends(e,l),e.prototype.init=function(e,t,r,i,n,o,a){void 0===i&&(i=-1),void 0===n&&(n=-1),this.src=e,this.resize(i,n),this._width=i,this._height=n,this.data=t,this.type=r,this.levels=o,this.internalFormat=a;e=this.complete;return this.complete=!!t,!e&&this.complete&&this.onload&&this.onload({target:this}),this.update(),this},e.prototype.dispose=function(){this.data=null},e.prototype.bind=function(e){void 0!==e.alphaMode?e.alphaMode=PIXI.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA:e.premultiplyAlpha=!1,l.prototype.bind.call(this,e)},e.prototype.upload=function(e,t,r){var i=e.state.gl;if(r.compressed=!1,e.texture.initCompressed(),null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var n=this.levels,o=this.width,a=this.height,s=0,l=0;l>=1)<1&&(o=1),(a>>=1)<1&&(a=1),s+=u}return this._internalLoader.free(),this.preserveSource||(this.data=null),!0},e.prototype.style=function(e,t,r){var e=e.state.gl,i=this.levels;return t.scaleMode===PIXI.SCALE_MODES.LINEAR?1>2)*(t+3>>2)*8;case 33778:case 33779:case 35987:case 34798:return(e+3>>2)*(t+3>>2)*16;default:return 0}},h.type="DDS",h);function h(e){return r.call(this,e)||this}e.DDSLoader=i}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(e){(r={})[0]=35841,r[1]=35843,r[2]=35840,r[3]=35842,r[6]=36196,r[7]=33776,r[9]=33778,r[5]=33779;var t,a=r,r=(t=e.AbstractInternalLoader,__extends(s,t),s.prototype.load=function(e){var t,r,i,n,o;if(s.test(e))return t=(o=new Int32Array(e,0,13))[2],t=a[t]||-1,r=o[7],i=o[6],n=o[11],o=o[12]+52,e=new Uint8Array(e,o),o=this._image,this._format=t,o.init(o.src,e,"PVR",r,i,n,t),o;throw"Invalid magic number in PVR header"},s.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},s.prototype.levelBufferSize=function(e,t,r){switch(void 0===r&&(r=0),this._format){case 33776:case 36196:return(e+3>>2)*(t+3>>2)*8;case 33778:case 33779:return(e+3>>2)*(t+3>>2)*16;case 35840:case 35842:return Math.floor((Math.max(e,8)*Math.max(t,8)*4+7)/8);case 35841:case 35843:return Math.floor((Math.max(e,16)*Math.max(t,8)*2+7)/8);default:return 0}},s.type="PVR",s);function s(e){return t.call(this,e)||this}e.PVRTCLoader=r}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(l){var e,t,r=0,i=2,n=3,o=8,a=9,s=10,u=11,h=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),c=((e={})[u]=-1,e[r]=36196,e[i]=33776,e[n]=33779,e[o]=35840,e[a]=35842,e[s]=37808,e),f=Object.keys(c).reduce(function(e,t){return e[c[+t]]=+t,e},{}),u=(t=l.AbstractInternalLoader,__extends(p,t),p.test=function(e){var e=1262195===new Uint32Array(e,0,1)[0]&&!!p.BASIS_BINDING,t=p.RGB_FORMAT&&p.RGBA_FORMAT;return!e&&t&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),t&&e},p.bindTranscoder=function(e,r){if(!e||!r)throw"Invalid state! undef fileCtr or ext invalid!";var t,i=Object.keys(r).reduce(function(e,t){t=r[t];return t?Object.assign(e,t.__proto__):e},{}),n=void 0,o=void 0;for(t in i){var a,s=i[t];void 0!==f[s]&&(a=f[s],h[a]?o={native:s,name:t,basis:a}:n={native:s,name:t,basis:a})}p.RGB_FORMAT=n||o,p.RGBA_FORMAT=o||n,p.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+p.RGB_FORMAT.name+"\nRGBA:"+p.RGBA_FORMAT.name),l.RegisterCompressedLoader(p),l.RegisterCompressedExtensions("basis")},p.prototype.load=function(e){if(p.test(e))return this._loadAsync(e),this._image;throw"BASIS Transcoder not binded or transcoding not supported =(!"},p.prototype._loadAsync=function(e){var t=performance.now(),e=new p.BASIS_BINDING(new Uint8Array(e)),r=e.getImageWidth(0,0),i=e.getImageHeight(0,0),n=e.getHasAlpha(),o=this._image;if(!e.startTranscoding())throw"Transcoding error!";var n=n?p.RGBA_FORMAT:p.RGB_FORMAT,a=(console.log("Grats! BASIS will be transcoded to:",n),new Uint8Array(e.getImageTranscodedSizeInBytes(0,0,n.basis)));if(!e.transcodeImage(a,0,0,n.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=n.native,this._file=e;t=n.name.replace("COMPRESSED_","");return Promise.resolve(o.init(o.src,a,"BASIS|"+t,r,i,1,n.native))},p.prototype.levelBufferSize=function(e,t,r){return this._file?this._file.getImageTranscodedSizeInBytes(0,r,f[this._format]):void 0},p.BASIS_BINDING=void 0,p);function p(e){e=t.call(this,e)||this;return e.type="BASIS",e._file=void 0,e}l.BASISLoader=u}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(i){var g=window.CRN_Module;var t,v=[33776,33778,33779],e=(t=i.AbstractInternalLoader,__extends(r,t),r.prototype.load=function(e){for(var t=e.byteLength,e=new Uint8Array(e),r=g._malloc(t),i=e,n=g.HEAPU8,o=r,a=t,s=o/4,e=a%4,l=new Uint32Array(i.buffer,0,(a-e)/4),u=new Uint32Array(n.buffer),h=0;hn.count))return e=new a,n.workers.push(e),e.init(t,r).then(function(){r=e.binary,i()})}var n=this,o=0;return i().then(function(){return n})},r.prototype.transcode=function(t,r){var n,o,a,s;if(this.workers&&this.workers.length)return n=this.workers,o=void 0,a=0,s=function(e){for(var t=0,r=n;t>0,i=e[t];e[t]=e[r],e[r]=i}},E.prototype._randomizeOffsets=function(){for(var e=0;e>0,e,1+a>>0),i+=a}t.baseTexture.update(),this.uniforms.displacementMap=t},Object.defineProperty(E.prototype,"sizes",{get:function(){return this._sizes},set:function(e){for(var t=Math.min(this._slices,e.length),r=0;r>0)},Object.defineProperty(x.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(e){this.uniforms.uOffset=e},enumerable:!1,configurable:!0}),x),Ge=(t(b,$=s.Filter),Object.defineProperty(b.prototype,"replacements",{get:function(){return this._replacements},set:function(e){var t=this.uniforms.originalColors,r=this.uniforms.targetColors,i=e.length;if(i>this._maxColors)throw new Error("Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")");t[3*i]=-1;for(var n=0;n= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n".replace("${maxKernelSize}",t.toFixed(1)))||this;return Object.assign(t,e),t}function i(e){var t=j.call(this,f,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n")||this;return Object.assign(t,i.defaults,e),t}function n(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600);var n=U.call(this)||this;return n.tiltShiftXFilter=new Qe(e,t,r,i),n.tiltShiftYFilter=new $e(e,t,r,i),n}function it(){return null!==G&&G.apply(this,arguments)||this}function nt(){return null!==X&&X.apply(this,arguments)||this}function o(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600);var n=H.call(this,f,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n")||this;return n.uniforms.blur=e,n.uniforms.gradientBlur=t,n.uniforms.start=r||new l.Point(0,window.innerHeight/2),n.uniforms.end=i||new l.Point(600,window.innerHeight/2),n.uniforms.delta=new l.Point(30,30),n.uniforms.texSize=new l.Point(window.innerWidth,window.innerHeight),n.updateDelta(),n}function a(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1);var i=Y.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n")||this;return i._color=0,i.uniforms.dimensions=new Float32Array(2),i.uniforms.ambientColor=new Float32Array([0,0,0,r]),i.texture=e,i.color=t,i}function d(e,t,r){void 0===e&&(e=[0,0]),void 0===r&&(r=0);var i=W.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n")||this;return i.center=e,Object.assign(i,d.defaults,t),i.time=r,i}function m(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]);var i=q.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n")||this;return i.red=e,i.green=t,i.blue=r,i}function _(e){var t=V.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n")||this;return t.time=0,t.uniforms.amplitude=new Float32Array(2),t.uniforms.waveLength=new Float32Array(2),t.uniforms.alpha=new Float32Array(2),t.uniforms.dimensions=new Float32Array(2),Object.assign(t,_.defaults,e),t}function g(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===i&&(i=-1);var n=K.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return n._angle=0,n.angle=e,n.center=t,n.kernelSize=r,n.radius=i,n}function ot(e){void 0===e&&(e=10);var t=J.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n")||this;return t.size=e,t}function v(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0);var i=Z.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,v.getAngleStep(r=void 0===r?.1:r)))||this;return i._thickness=1,i.uniforms.thickness=new Float32Array([0,0]),i.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(i,{thickness:e,color:t,quality:r}),i}function y(e,t){void 0===t&&(t=0);var r=Q.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform float sepia;\nuniform float noise;\nuniform float noiseSize;\nuniform float scratch;\nuniform float scratchDensity;\nuniform float scratchWidth;\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\nuniform float seed;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n")||this;return r.seed=0,r.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(r.seed=e,e=void 0):r.seed=t,Object.assign(r,y.defaults,e),r}function b(e,t,r){void 0===t&&(t=.05),void 0===r&&(r=e.length);var i=$.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float epsilon;\n\nconst int MAX_COLORS = %maxColors%;\n\nuniform vec3 originalColors[MAX_COLORS];\nuniform vec3 targetColors[MAX_COLORS];\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n float alpha = gl_FragColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = gl_FragColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = originalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < epsilon)\n {\n vec3 targetColor = targetColors[i];\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n".replace(/%maxColors%/g,r.toFixed(0)))||this;return i._replacements=[],i._maxColors=0,i.epsilon=t,i._maxColors=r,i.uniforms.originalColors=new Float32Array(3*r),i.uniforms.targetColors=new Float32Array(3*r),i.replacements=e,i}function x(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t=5),void 0===r&&(r=0);var i=ee.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uVelocity;\nuniform int uKernelSize;\nuniform float uOffset;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\n// Notice:\n// the perfect way:\n// int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n// BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n// So use uKernelSize directly.\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n vec2 velocity = uVelocity / filterArea.xy;\n float offset = -uOffset / length(uVelocity) - 0.5;\n int k = uKernelSize - 1;\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n vec2 bias = velocity * (float(i) / float(k) + offset);\n color += texture2D(uSampler, vTextureCoord + bias);\n }\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return i.kernelSize=5,i.uniforms.uVelocity=new Float32Array(2),i._velocity=new l.ObservablePoint(i.velocityChanged,i),i.setVelocity(e),i.kernelSize=t,i.offset=r,i}function T(e){var t=te.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform vec2 light;\nuniform bool parallel;\nuniform float aspect;\n\nuniform float gain;\nuniform float lacunarity;\nuniform float time;\nuniform float alpha;\n\n${perlin}\n\nvoid main(void) {\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n float d;\n\n if (parallel) {\n float _cos = light.x;\n float _sin = light.y;\n d = (_cos * coord.x) + (_sin * coord.y * aspect);\n } else {\n float dx = coord.x - light.x / dimensions.x;\n float dy = (coord.y - light.y / dimensions.y) * aspect;\n float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n vec3 dir = vec3(d, d, 0.0);\n\n float noise = turb(dir + vec3(time, 0.0, 62.1 + time) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n vec4 mist = vec4(noise, noise, noise, 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord) + mist;\n\n}\n".replace("${perlin}","vec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n float sum = 0.0;\n float sc = 1.0;\n float totalgain = 1.0;\n for (float i = 0.0; i < 6.0; i++)\n {\n sum += totalgain * pnoise(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}\n"))||this,e=(t.parallel=!0,t.time=0,t._angle=0,t.uniforms.dimensions=new Float32Array(2),Object.assign(T.defaults,e));return t._angleLight=new l.Point,t.angle=e.angle,t.gain=e.gain,t.lacunarity=e.lacunarity,t.alpha=e.alpha,t.parallel=e.parallel,t.center=e.center,t.time=e.time,t}function w(e){var t=this,e=Object.assign({},w.defaults,e),r=e.outerStrength,i=e.innerStrength,n=e.color,o=e.knockout,a=e.quality,e=Math.round(e.distance);return(t=re.call(this,f,"varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float outerStrength;\nuniform float innerStrength;\n\nuniform vec4 glowColor;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform bool knockout;\n\nconst float PI = 3.14159265358979323846264;\n\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.0);\nconst float ANGLE_STEP_NUM = ceil(PI * 2.0 / ANGLE_STEP_SIZE);\n\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.0) / 2.0;\n\nvoid main(void) {\n vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\n float totalAlpha = 0.0;\n\n vec2 direction;\n vec2 displaced;\n vec4 curColor;\n\n for (float angle = 0.0; angle < PI * 2.0; angle += ANGLE_STEP_SIZE) {\n direction = vec2(cos(angle), sin(angle)) * px;\n\n for (float curDistance = 0.0; curDistance < DIST; curDistance++) {\n displaced = clamp(vTextureCoord + direction * \n (curDistance + 1.0), filterClamp.xy, filterClamp.zw);\n\n curColor = texture2D(uSampler, displaced);\n\n totalAlpha += (DIST - curDistance) * curColor.a;\n }\n }\n \n curColor = texture2D(uSampler, vTextureCoord);\n\n float alphaRatio = (totalAlpha / MAX_TOTAL_ALPHA);\n\n float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * curColor.a;\n float innerGlowStrength = min(1.0, innerGlowAlpha);\n \n vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\n float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a);\n float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);\n\n vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n gl_FragColor = innerColor + outerGlowColor;\n }\n}\n".replace(/__ANGLE_STEP_SIZE__/gi,""+(1/a/e).toFixed(7)).replace(/__DIST__/gi,e.toFixed(0)+".0"))||this).uniforms.glowColor=new Float32Array([0,0,0,1]),Object.assign(t,{color:n,outerStrength:r,innerStrength:i,padding:e,knockout:o}),t}function E(e){var t=ie.call(this,f,"// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n")||this;return t.offset=100,t.fillMode=E.TRANSPARENT,t.average=!1,t.seed=0,t.minSize=8,t.sampleSize=512,t._slices=0,t._offsets=new Float32Array(1),t._sizes=new Float32Array(1),t._direction=-1,t.uniforms.dimensions=new Float32Array(2),t._canvas=document.createElement("canvas"),t._canvas.width=4,t._canvas.height=t.sampleSize,t.texture=s.Texture.from(t._canvas,{scaleMode:c.SCALE_MODES.NEAREST}),Object.assign(t,E.defaults,e),t}function at(e){void 0===e&&(e=5);var t=ne.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n")||this;return t.strength=e,t}function S(e){var t=oe.call(this)||this,e=(t.angle=45,t._distance=5,t._resolution=u.settings.FILTER_RESOLUTION,e?xe(xe({},S.defaults),e):S.defaults),r=e.kernels,i=e.blur,n=e.quality,o=e.pixelSize,a=e.resolution,r=(t._tintFilter=new s.Filter(f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Premultiply alpha\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),t._tintFilter.uniforms.color=new Float32Array(4),t._tintFilter.uniforms.shift=new l.Point,t._tintFilter.resolution=a,t._blurFilter=r?new p(r):new p(i,n),t.pixelSize=o,t.resolution=a,e.shadowOnly),i=e.rotation,n=e.distance,o=e.alpha,a=e.color;return t.shadowOnly=r,t.rotation=i,t.distance=n,t.alpha=o,t.color=a,t._updatePadding(),t}function A(e,t){void 0===e&&(e=1),void 0===t&&(t=5);var r=ae.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n")||this;return r.scale=e,r.angle=t,r}function k(e){var t=se.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5));\n \n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n")||this;return t.time=0,t.seed=0,t.uniforms.dimensions=new Float32Array(2),Object.assign(t,k.defaults,e),t}function st(){return le.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")||this}function O(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200);var i=ue.call(this,f,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n")||this;return i.uniforms.texelSize=new Float32Array(2),i.uniforms.matrix=new Float32Array(9),void 0!==e&&(i.matrix=e),i.width=t,i.height=r,i}function P(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4);var i=he.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n")||this;return i._originalColor=16711680,i._newColor=0,i.uniforms.originalColor=new Float32Array(3),i.uniforms.newColor=new Float32Array(3),i.originalColor=e,i.newColor=t,i.epsilon=r,i}function lt(e,t){void 0===e&&(e=0),void 0===t&&(t=1);var r=ce.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 color;\nuniform float alpha;\n\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\n}\n")||this;return r._color=0,r._alpha=1,r.uniforms.color=new Float32Array(3),r.color=e,r.alpha=t,r}function R(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1);var i=fe.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}")||this;return i.mix=1,i._size=0,i._sliceSize=0,i._slicePixelSize=0,i._sliceInnerSize=0,i._nearest=!1,i._scaleMode=null,i._colorMap=null,i._scaleMode=null,i.nearest=t,i.mix=r,i.colorMap=e,i}function C(e){var t=pe.call(this,f,"uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n")||this;return t.uniforms.dimensions=new Float32Array(2),Object.assign(t,C.defaults,e),t}function M(e,t,r,i){void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=u.settings.FILTER_RESOLUTION),void 0===i&&(i=5);var n,o,a=de.call(this)||this;return"number"==typeof e?o=n=e:e instanceof l.Point?(n=e.x,o=e.y):Array.isArray(e)&&(n=e[0],o=e[1]),a.blurXFilter=new N.BlurFilterPass(!0,n,t,r,i),a.blurYFilter=new N.BlurFilterPass(!1,o,t,r,i),a.blurYFilter.blendMode=c.BLEND_MODES.SCREEN,a.defaultFilter=new F.AlphaFilter,a}function I(e){var t=me.call(this,f,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n")||this;return t._thickness=2,t._angle=0,t.uniforms.lightColor=new Float32Array(3),t.uniforms.shadowColor=new Float32Array(3),Object.assign(t,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),t.padding=1,t}function ut(e){void 0===e&&(e=8);var t=_e.call(this,f,"varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n")||this;return t.size=e,t}function D(e){var t=ge.call(this,f,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n")||this,e=(t.bloomScale=1,t.brightness=1,t._resolution=u.settings.FILTER_RESOLUTION,"number"==typeof e&&(e={threshold:e}),Object.assign(D.defaults,e)),r=(t.bloomScale=e.bloomScale,t.brightness=e.brightness,e.kernels),i=e.blur,n=e.quality,o=e.pixelSize,a=e.resolution;return t._extractFilter=new we(e.threshold),t._extractFilter.resolution=a,t._blurFilter=r?new p(r):new p(i,n),t.pixelSize=o,t.resolution=a,t}function L(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3);var i=ve.call(this,f,(r=void 0===r?!1:r)?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}")||this;return i._kernels=[],i._blur=4,i._quality=3,i.uniforms.uOffset=new Float32Array(2),i._pixelSize=new l.Point,i.pixelSize=1,i._clamp=r,Array.isArray(e)?i.kernels=e:(i._blur=e,i.quality=t),i}function ht(e){void 0===e&&(e=.5);var t=ye.call(this,f,"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n")||this;return t.threshold=e,t}function ct(e){var t=be.call(this,f,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n")||this;return t.gamma=1,t.saturation=1,t.contrast=1,t.brightness=1,t.red=1,t.green=1,t.blue=1,t.alpha=1,Object.assign(t,e),t}return e.AdjustmentFilter=Te,e.AdvancedBloomFilter=Ee,e.AsciiFilter=Se,e.BevelFilter=Ae,e.BloomFilter=ke,e.BulgePinchFilter=Oe,e.CRTFilter=De,e.ColorMapFilter=Pe,e.ColorOverlayFilter=Re,e.ColorReplaceFilter=Ce,e.ConvolutionFilter=Me,e.CrossHatchFilter=Ie,e.DotFilter=Le,e.DropShadowFilter=Fe,e.EmbossFilter=Ne,e.GlitchFilter=ze,e.GlowFilter=Be,e.GodrayFilter=je,e.KawaseBlurFilter=p,e.MotionBlurFilter=Ue,e.MultiColorReplaceFilter=Ge,e.OldFilmFilter=Xe,e.OutlineFilter=He,e.PixelateFilter=Ye,e.RGBSplitFilter=Ve,e.RadialBlurFilter=We,e.ReflectionFilter=qe,e.ShockwaveFilter=Ke,e.SimpleLightmapFilter=Je,e.TiltShiftAxisFilter=Ze,e.TiltShiftFilter=et,e.TiltShiftXFilter=Qe,e.TiltShiftYFilter=$e,e.TwistFilter=tt,e.ZoomBlurFilter=rt,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),_gsScope=(Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},!function(l,m){"use strict";u.createList=function(e){if("list"in e){var t=e.list,r=void 0,i=t[0],n=i.value,i=i.time,i=r=new u("string"==typeof n?l.ParticleUtils.hexToRGB(n):n,i,e.ease);if(2a.time;)n=a,a=e[++o];var l=(l-n.time)/(a.time-n.time),u=f.hexToRGB(n.value),h=f.hexToRGB(a.value),h={r:(h.r-u.r)*l+u.r,g:(h.g-u.g)*l+u.g,b:(h.b-u.b)*l+u.b};i.next=new c(h,s/t),i=i.next}return r};var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function r(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function n(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function o(e){this.ease&&(e=this.ease(e));var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,r=(r.b-t.b)*e+t.b;return l.ParticleUtils.combineRGBComponents(i,n,r)}function a(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function s(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,r=(r.b-t.b)*e+t.b;return l.ParticleUtils.combineRGBComponents(i,n,r)}function p(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function d(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return l.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}g.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?o:n:e.isStepped?this.interpolate=this.isColor?d:p:this.interpolate=this.isColor?s:a,this.ease=this.current.ease};var _=g;function g(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}r(b,v=m.Sprite),b.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,l.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=l.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=l.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=l.ParticleUtils.DEG_TO_RADS,this.alpha=this.alphaList.current.value,this.scale.x=this.scale.y=this.scaleList.current.value,this._doAlpha=!!this.alphaList.current.next,this._doSpeed=!!this.speedList.current.next,this._doScale=!!this.scaleList.current.next,this._doColor=!!this.colorList.current.next,this._doAcceleration=0!==this.acceleration.x||0!==this.acceleration.y,this._doNormalMovement=this._doSpeed||0!==this.speedList.current.value||this._doAcceleration,this._oneOverLife=1/this.maxLife;var e=this.colorList.current.value;this.tint=l.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},b.prototype.applyArt=function(e){this.texture=e||m.Texture.EMPTY},b.prototype.update=function(e){var t,r,i,n,o,a;return this.age+=e,this.age>=this.maxLife||this.age<0?(this.kill(),-1):(t=this.age*this._oneOverLife,this.ease&&(t=4===this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale&&(r=this.scaleList.interpolate(t)*this.scaleMultiplier,this.scale.x=this.scale.y=r),this._doNormalMovement&&(o=r=void 0,o=this._doSpeed?(i=this.speedList.interpolate(t)*this.speedMultiplier,l.ParticleUtils.normalize(this.velocity),l.ParticleUtils.scaleBy(this.velocity,i),r=this.velocity.x*e,this.velocity.y*e):this._doAcceleration?(i=this.velocity.x,n=this.velocity.y,this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed&&(a=l.ParticleUtils.length(this.velocity))>this.maxSpeed&&l.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/a),r=(i+this.velocity.x)/2*e,(n+this.velocity.y)/2*e):(r=this.velocity.x*e,this.velocity.y*e),this.position.x+=r,this.position.y+=o),this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration?(a=this.rotationSpeed+this.rotationAcceleration*e,this.rotation+=(this.rotationSpeed+a)/2*e,this.rotationSpeed=a):0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x)),t)},b.prototype.kill=function(){this.emitter.recycle(this)},b.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},b.parseArt=function(e){for(var t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(l.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles);else{var l=void 0,l=this.minLifetime===this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime;if(-this._spawnTimer=this.spawnChance||(f=void 0,this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new this.particleConstructor(this),1=this.particleImages.length)&&(this._currentImageIndex=0)):f.applyArt(this.particleImages[Math.floor(Math.random()*this.particleImages.length)]):f.applyArt(this.particleImages[0]),f.alphaList.reset(this.startAlpha),1!==this.minimumSpeedMultiplier&&(f.speedMultiplier=Math.random()*(1-this.minimumSpeedMultiplier)+this.minimumSpeedMultiplier),f.speedList.reset(this.startSpeed),f.acceleration.x=this.acceleration.x,f.acceleration.y=this.acceleration.y,f.maxSpeed=this.maxSpeed,1!==this.minimumScaleMultiplier&&(f.scaleMultiplier=Math.random()*(1-this.minimumScaleMultiplier)+this.minimumScaleMultiplier),f.scaleList.reset(this.startScale),f.colorList.reset(this.startColor),this.minRotationSpeed===this.maxRotationSpeed?f.rotationSpeed=this.minRotationSpeed:f.rotationSpeed=Math.random()*(this.maxRotationSpeed-this.minRotationSpeed)+this.minRotationSpeed,f.rotationAcceleration=this.rotationAcceleration,f.noRotation=this.noRotation,f.maxLife=l,f.blendMode=this.particleBlendMode,f.ease=this.customEase,f.extraData=this.extraData,this.applyAdditionalProperties(f),this._spawnFunc(f,h,c,p),f.init(),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),this._activeParticlesLast?((this._activeParticlesLast.next=f).prev=this._activeParticlesLast,this._activeParticlesLast=f):this._activeParticlesLast=this._activeParticlesFirst=f,++this.particleCount,f.update(-this._spawnTimer))}}this._spawnTimer+=this._frequency}this._posChanged&&(this._prevEmitterPos.x=a,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),this._emit||this._activeParticlesFirst||(this._completeCallback&&(o=this._completeCallback,this._completeCallback=null,o()),this._destroyWhenComplete&&this.destroy())}},S.prototype.applyAdditionalProperties=function(e){},S.prototype._spawnPoint=function(e,t,r){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,e.position.x=t,e.position.y=r},S.prototype._spawnRect=function(e,t,r){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,E.x=Math.random()*this.spawnRect.width+this.spawnRect.x,E.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=r+E.y},S.prototype._spawnCircle=function(e,t,r){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,E.x=Math.random()*this.spawnCircle.radius,E.y=0,l.ParticleUtils.rotatePoint(360*Math.random(),E),E.x+=this.spawnCircle.x,E.y+=this.spawnCircle.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=r+E.y},S.prototype._spawnRing=function(e,t,r){var i=this.spawnCircle,i=(this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,i.minRadius!==i.radius?E.x=Math.random()*(i.radius-i.minRadius)+i.minRadius:E.x=i.radius,E.y=0,360*Math.random());e.rotation+=i,l.ParticleUtils.rotatePoint(i,E),E.x+=this.spawnCircle.x,E.y+=this.spawnCircle.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=r+E.y},S.prototype._spawnPolygonalChain=function(e,t,r){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,this.spawnPolygonalChain.getRandomPoint(E),0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=r+E.y},S.prototype._spawnBurst=function(e,t,r,i){0===this.particleSpacing?e.rotation=360*Math.random():e.rotation=this.angleStart+this.particleSpacing*i+this.rotation,e.position.x=t,e.position.y=r},S.prototype.cleanup=function(){for(var e,t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t),t.parent&&t.parent.removeChild(t);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},S.prototype.destroy=function(){var e;this.autoUpdate=!1,this.cleanup();for(var t=this._poolFirst;t;t=e)e=t.next,t.destroy();this._poolFirst=this._parent=this.particleImages=this.spawnPos=this.ownerPos=this.startColor=this.startScale=this.startAlpha=this.startSpeed=this.customEase=this._completeCallback=null},S);function S(e,t,r){this._currentImageIndex=-1,this._particleConstructor=y,this.particleImages=null,this.startAlpha=null,this.startSpeed=null,this.minimumSpeedMultiplier=1,this.acceleration=null,this.maxSpeed=NaN,this.startScale=null,this.minimumScaleMultiplier=1,this.startColor=null,this.minLifetime=0,this.maxLifetime=0,this.minStartRotation=0,this.maxStartRotation=0,this.noRotation=!1,this.minRotationSpeed=0,this.maxRotationSpeed=0,this.particleBlendMode=0,this.customEase=null,this.extraData=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=null,this.spawnType=null,this._spawnFunc=null,this.spawnRect=null,this.spawnCircle=null,this.spawnPolygonalChain=null,this.particlesPerWave=1,this.particleSpacing=0,this.angleStart=0,this.rotation=0,this.ownerPos=null,this._prevEmitterPos=null,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._origArt=null,this._autoUpdate=!1,this._currentImageIndex=-1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=e,t&&r&&this.init(t,r),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}var A=new m.Point,k=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],O=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(k).join("|"),"g");r(C,P=y),C.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},C.prototype.update=function(e){var t,r=this.Particle_update(e);return 0<=r&&this.path&&(t=this._doSpeed?this.speedList.interpolate(r)*this.speedMultiplier:this.speedList.current.value*this.speedMultiplier,this.movement+=t*e,A.x=this.movement,A.y=this.path(this.movement),l.ParticleUtils.rotatePoint(this.initialRotation,A),this.position.x=this.initialPosition.x+A.x,this.position.y=this.initialPosition.y+A.y),r},C.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},C.parseArt=function(e){return y.parseArt(e)},C.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(O),r=t.length-1;0<=r;--r)0<=k.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){l.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else l.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t};var P,R=C;function C(e){e=P.call(this,e)||this;return e.path=null,e.initialRotation=0,e.initialPosition=new m.Point,e.movement=0,e}r(I,M=y),I.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},I.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},I.prototype.update=function(e){var t=this.Particle_update(e);return 0<=t&&(this.elapsed+=e,this.elapsed>=this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6),e=this.elapsed*this.framerate+1e-7|0,this.texture=this.textures[e]||this.textures[this.textures.length-1]||m.Texture.EMPTY),t},I.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},I.parseArt=function(e){for(var t=[],r=0;rthis._childCount)throw new Error("addChildAt: The index "+t+" supplied is out of bounds "+this._childCount);e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1;var r=e;if(this._firstChild)if(0===t)(this._firstChild.prevChild=r).nextChild=this._firstChild,this._firstChild=r;else if(t===this._childCount)(this._lastChild.nextChild=r).prevChild=this._lastChild,this._lastChild=r;else{for(var i=0,n=this._firstChild;i=this._childCount)throw new Error("The index "+t+" supplied is out of bounds "+this._childCount);if(e.parent!==this)throw new Error("The supplied DisplayObject must be a child of the caller");if(e.nextChild&&(e.nextChild.prevChild=e.prevChild),e.prevChild&&(e.prevChild.nextChild=e.nextChild),this._firstChild===e&&(this._firstChild=e.nextChild),this._lastChild===e&&(this._lastChild=e.prevChild),e.nextChild=null,e.prevChild=null,this._firstChild)if(0===t)(this._firstChild.prevChild=e).nextChild=this._firstChild,this._firstChild=e;else if(t===this._childCount)(this._lastChild.nextChild=e).prevChild=this._lastChild,this._lastChild=e;else{for(var r=0,i=this._firstChild;r=this._childCount)throw new Error("getChildAt: Index ("+e+") does not exist.");if(0===e)return this._firstChild;if(e===this._childCount)return this._lastChild;for(var t=0,r=this._firstChild;t@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){for(var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(r.length<2)return c("",e,"",t);var n=[r.pop()];for(;1/g,"> ").trim()};var r=i(3),u=(r=r)&&r.__esModule?r:{default:r},h=i(0);function c(i,r,n,s){if(i.length&&(i+=" "),n.length&&(n=" "+n),/\[*\]/.test(r)){var e=r.replace(/=.*$/,"]"),o=""+i+e+n;if(p(document.querySelectorAll(o),s))r=e;else for(var a=document.querySelectorAll(""+i+e),l=0,t=a.length;l/.test(r)&&(e=r.replace(/>/,""),o=""+i+e+n,p(document.querySelectorAll(o),s)&&(r=e)),/:nth-child/.test(r)&&(e=r.replace(/nth-child/g,"nth-of-type"),o=""+i+e+n,p(document.querySelectorAll(o),s)&&(r=e)),/\.\S+\.\S+/.test(r)){for(var u=r.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});u.length;){var h=r.replace(u.shift(),"").trim();if(!(o=(""+i+h+n).trim()).length||">"===o.charAt(0)||">"===o.charAt(o.length-1))break;p(document.querySelectorAll(o),s)&&(r=h)}if((u=r&&r.match(/\./g))&&2)(\S)/g,"$1 $2").trim()).split(" ").reverse().map(function(e,t){var i,r,n,s=0===t,t=e.split(":"),e=m(t,2),o=e[0],t=e[1],a=null,l=null;switch(!0){case/>/.test(o):l=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(o):var u=o.substr(1).split(".");a=function(e){var t=e.attribs.class;return t&&u.every(function(e){return-1 "+l+":nth-child("+(o+1)+")",r.unshift(u)):console.warn("\n Element couldn't be matched through strict ignore pattern!\n ",h,i,l)}}(s,l,o,a)}l=l.parentNode,u=a.length}l===r&&(t=m(s,l,o),a.unshift(t));return a.join(" ")};var p=i(0),c={attribute:function(e){return-1<["style","data-reactid","data-react-checksum"].indexOf(e)}};function d(e,t,i,r,n){n=4\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",t=n.console&&(n.console.warn||n.console.log);return t&&t.call(n.console,r,e),i.apply(this,arguments)}}var a="function"!=typeof Object.assign?function(e){if(e===h||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;it[i]}):r.sort():r}function f(e,t){for(var i,r=t[0].toUpperCase()+t.slice(1),n=0;nc(o.y)?o.x:o.y,r.scale=a?function(e,t){return P(t[0],t[1],A)/P(e[0],e[1],A)}(a.pointers,t):1,r.rotation=a?function(e,t){return he(t[1],t[0],A)+he(e[1],e[0],A)}(a.pointers,t):0,r.maxPointers=!s.prevInput||r.pointers.length>s.prevInput.maxPointers?r.pointers.length:s.prevInput.maxPointers,function(e,t){var i,r,n,s=e.lastInterval||t,o=t.timeStamp-s.timeStamp;{var a,l;t.eventType!=v&&(iec(o.y)?o.x:o.y,a=ue(a,l),e.lastInterval=t):(i=s.velocity,r=s.velocityX,n=s.velocityY,a=s.direction)}t.velocity=i,t.velocityX=r,t.velocityY=n,t.direction=a}(s,r),n.element);q(r.srcEvent.target,l)&&(l=r.srcEvent.target),r.target=l,e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function oe(e){for(var t=[],i=0;i=c(t)?e<0?b:x:t<0?T:w}function P(e,t,i){var r=t[(i=i||ne)[0]]-e[i[0]],t=t[i[1]]-e[i[1]];return Math.sqrt(r*r+t*t)}function he(e,t,i){var r=t[(i=i||ne)[0]]-e[i[0]],t=t[i[1]]-e[i[1]];return 180*Math.atan2(t,r)/Math.PI}k.prototype={handler:function(){},init:function(){this.evEl&&t(this.element,this.evEl,this.domHandler),this.evTarget&&t(this.target,this.evTarget,this.domHandler),this.evWin&&t(J(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&r(this.element,this.evEl,this.domHandler),this.evTarget&&r(this.target,this.evTarget,this.domHandler),this.evWin&&r(J(this.element),this.evWin,this.domHandler)}};var ce={mousedown:_,mousemove:2,mouseup:g};function O(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,k.apply(this,arguments)}e(O,k,{handler:function(e){var t=ce[e.type];t&_&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=g),this.pressed&&(t&g&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:te,srcEvent:e}))}});var pe={pointerdown:_,pointermove:2,pointerup:g,pointercancel:v,pointerout:v},de={2:m,3:"pen",4:te,5:"kinect"},fe="pointerdown",me="pointermove pointerup pointercancel";function _e(){this.evEl=fe,this.evWin=me,k.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}n.MSPointerEvent&&!n.PointerEvent&&(fe="MSPointerDown",me="MSPointerMove MSPointerUp MSPointerCancel"),e(_e,k,{handler:function(e){var t=this.store,i=!1,r=e.type.toLowerCase().replace("ms",""),r=pe[r],n=de[e.pointerType]||e.pointerType,s=n==m,o=p(t,e.pointerId,"pointerId");r&_&&(0===e.button||s)?o<0&&(t.push(e),o=t.length-1):r&(g|v)&&(i=!0),o<0||(t[o]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:n,srcEvent:e}),i&&t.splice(o,1))}});var ge={touchstart:_,touchmove:2,touchend:g,touchcancel:v};function ve(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,k.apply(this,arguments)}e(ve,k,{handler:function(e){var t,i=ge[e.type];i===_&&(this.started=!0),this.started&&(t=function(e,t){var i=d(e.touches),e=d(e.changedTouches);t&(g|v)&&(i=K(i.concat(e),"identifier",!0));return[i,e]}.call(this,e,i),i&(g|v)&&t[0].length-t[1].length==0&&(this.started=!1),this.callback(this.manager,i,{pointers:t[0],changedPointers:t[1],pointerType:m,srcEvent:e}))}});var ye={touchstart:_,touchmove:2,touchend:g,touchcancel:v};function be(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},k.apply(this,arguments)}e(be,k,{handler:function(e){var t=ye[e.type],i=function(e,t){var i=d(e.touches),r=this.targetIds;if(t&(2|_)&&1===i.length)return r[i[0].identifier]=!0,[i,i];var n,s,o=d(e.changedTouches),a=[],l=this.target;if(s=i.filter(function(e){return q(e.target,l)}),t===_)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return D.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),e(Fe,D,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[R]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){var t;1!==e.scale&&(t=e.scale<1?"in":"out",e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),e(Ne,I,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distancet.time;if(this._input=e,!r||!i||e.eventType&(g|v)&&!n)this.reset();else if(e.eventType&_)this.reset(),this._timer=j(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&g)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&g?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=U(),this.manager.emit(this.options.event,this._input)))}}),e(ze,D,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[R]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),e(Be,D,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:E|S,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(E|S)?t=e.overallVelocity:i&E?t=e.overallVelocityX:i&S&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(t)>this.options.velocity&&e.eventType&g},emit:function(e){var t=Ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),e(Ue,I,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Oe]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,r=e.distance=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&o=r.x&&r.x>=h&&n!==r.x&&be(si.x||r.x===i.x&&function(e,t){return xe(e.prev,e,t.prev)<0&&xe(t.next,e,e.next)<0}(i,r)))&&(i=r,p=l)),r=r.next,r!==u;);return i}(e,t);return i?(_e(e=ke(i,e),e.next),_e(i,i.next)):t}(l[n],i);return i}(e,t,h,i)),e.length>80*i){for(var p=r=e[0],d=n=e[1],f=i;f=g&&b&&b.z<=v;){if(y.x>=d&&y.x<=m&&y.y>=f&&y.y<=_&&y!==n&&y!==o&&be(a,h,l,c,u,p,y.x,y.y)&&0<=xe(y.prev,y,y.next))return;if(y=y.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=_&&b!==n&&b!==o&&be(a,h,l,c,u,p,b.x,b.y)&&0<=xe(b.prev,b,b.next))return;b=b.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=m&&y.y>=f&&y.y<=_&&y!==n&&y!==o&&be(a,h,l,c,u,p,y.x,y.y)&&0<=xe(y.prev,y,y.next))return;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=_&&b!==n&&b!==o&&be(a,h,l,c,u,p,b.x,b.y)&&0<=xe(b.prev,b,b.next))return;b=b.nextZ}return 1}(e,r,n,s):function(e){var t=e.prev,i=e,e=e.next;if(0<=xe(t,i,e))return;var r=t.x,n=i.x,s=e.x,o=t.y,a=i.y,l=e.y,u=r=u&&d.x<=c&&d.y>=h&&d.y<=p&&be(r,o,n,a,s,l,d.x,d.y)&&0<=xe(d.prev,d,d.next))return;d=d.next}return 1}(e))t.push(T.i/i|0),t.push(e.i/i|0),t.push(w.i/i|0),Oe(e),e=w.next,E=w.next;else if((e=w)===E){o?1===o?ge(e=function(e,t,i){var r=e;do{var n=r.prev,s=r.next.next}while(!Te(n,s)&&we(n,r,r.next,s)&&Ae(n,s)&&Ae(s,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(s.i/i|0),Oe(r),Oe(r.next),r=e=s),r=r.next,r!==e);return _e(r)}(_e(e),t,i),t,i,r,n,s,2):2===o&&function(e,t,i,r,n,s){var o=e;do{for(var a,l=o.next.next;l!==o.prev;){if(o.i!==l.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&we(i,i.next,e,t))return 1}while(i=i.next,i!==e);return}(e,t)&&(Ae(e,t)&&Ae(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;for(;i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next,i!==e;);return r}(e,t)&&(xe(e.prev,e,t.prev)||xe(e,t.prev,t))||Te(e,t)&&0=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Se(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=g-1,y=Math.floor,b=String.fromCharCode;function x(e){throw RangeError(p[e])}function f(e,t){for(var i=e.length,r=[];i--;)r[i]=t(e[i]);return r}function m(e,t){var i=e.split("@"),r="",i=(1>>10&1023|55296),e=56320|1023&e),t+=b(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,i){var r=0;for(e=i?y(e/l):e>>1,e+=y(e/t);d*v>>1y((_-h)/s))&&x("overflow"),h+=a*s,!(a<(a=o<=p?1:p+v<=o?v:o-p));o+=g)s>y(_/(a=g-a))&&x("overflow"),s*=a;p=S(h-n,t=l.length+1,0==n),y(h/t)>_-c&&x("overflow"),c+=y(h/t),h%=t,l.splice(h++,0,c)}return w(l)}function k(e){for(var t,i,r,n,s,o,a,l,u,h,c=[],p=(e=T(e)).length,d=128,f=72,m=t=0;my((_-t)/(l=i+1))&&x("overflow"),t+=(n-d)*l,d=n,m=0;m_&&x("overflow"),a==d){for(s=t,o=g;!(s<(u=o<=f?1:f+v<=o?v:o-f));o+=g)c.push(b(E(u+(h=s-u)%(u=g-u),0))),s=y(h/u);c.push(b(E(s,0))),f=S(t,l,i==r),t=0,++i}++t,++d}return c.join("")}if(s={version:"1.3.2",ucs2:{decode:T,encode:w},decode:A,encode:k,toASCII:function(e){return m(e,function(e){return h.test(e)?"xn--"+k(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?A(e.slice(4).toLowerCase()):e})}},r&&t)if(e.exports==r)t.exports=s;else for(o in s)s.hasOwnProperty(o)&&(r[o]=s[o]);else i.punycode=s}),Ie=function(e){return"string"==typeof e},De=function(e){return"object"==typeof e&&null!==e},Le=function(e){return null===e},Fe=function(e){return null==e};function Ne(e,t,i,r){t=t||"&",i=i||"=";var n={};if("string"==typeof e&&0!==e.length){var s=/\+/g,t=(e=e.split(t),1e3),o=(r&&"number"==typeof r.maxKeys&&(t=r.maxKeys),e.length);0",'"',"`"," ","\r","\n","\t"]),qe=["'"].concat(i),Ke=["%","/","?",";","#"].concat(qe),Ze=["/","?","#"],Je=/^[+a-z0-9A-Z_-]{0,63}$/,Qe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$e={javascript:!0,"javascript:":!0},et={javascript:!0,"javascript:":!0},tt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function it(e,t,i){var r;return e&&De(e)&&e instanceof He?e:((r=new He).parse(e,t,i),r)}He.prototype.parse=function(e,t,i){if(!Ie(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),r=-1!==r&&r]*?)$/i.test(e)},hasProtocol:function(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol:function(e){st(e),e=this.toPosix(e);var t="",i=/^file:\/\/\//.exec(e),r=/^[^/:]+:\/\//.exec(e),n=/^[^/:]+:\//.exec(e);return(i||r||n)&&(i=(null==i?void 0:i[0])||(null==r?void 0:r[0])||(null==n?void 0:n[0]),e=e.slice((t=i).length)),t},toAbsolute:function(e,t,i){return this.isDataUrl(e)?e:(t=ot(this.toPosix(null!=t?t:R.ADAPTER.getBaseUrl())),i=ot(this.toPosix(null!=i?i:this.rootname(t))),st(e),(e=this.toPosix(e)).startsWith("/")?lt.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(t,e))},normalize:function(e){var t,i,r;return st(e=this.toPosix(e)),0===e.length?".":(t="",i=e.startsWith("/"),this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length)),r=e.endsWith("/"),0<(e=function(e,t){for(var i,r="",n=0,s=-1,o=0,a=0;a<=e.length;++a){if(a>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function ft(e){e=e.toString(16);return"#"+("000000".substring(0,6-e.length)+e)}function mt(e){return"string"==typeof e&&"#"===(e=pt[e.toLowerCase()]||e)[0]&&(e=e.slice(1)),parseInt(e,16)}var _t=function(){for(var e=[],t=[],i=0;i<32;i++)t[e[i]=i]=i;e[$.BLEND_MODES.NORMAL_NPM]=$.BLEND_MODES.NORMAL,e[$.BLEND_MODES.ADD_NPM]=$.BLEND_MODES.ADD,e[$.BLEND_MODES.SCREEN_NPM]=$.BLEND_MODES.SCREEN,t[$.BLEND_MODES.NORMAL]=$.BLEND_MODES.NORMAL_NPM,t[$.BLEND_MODES.ADD]=$.BLEND_MODES.ADD_NPM,t[$.BLEND_MODES.SCREEN]=$.BLEND_MODES.SCREEN_NPM;var r=[];return r.push(t),r.push(e),r}();function gt(e,t){return _t[t?1:0][e]}function vt(e,t,i,r){return i=i||new Float32Array(4),r||void 0===r?(i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t):(i[0]=e[0],i[1]=e[1],i[2]=e[2]),i[3]=t,i}function yt(e,t){return 1===t?(255*t<<24)+e:0===t?0:(255*t<<24)+(((e>>16&255)*t+.5|0)<<16)+(((e>>8&255)*t+.5|0)<<8)+((255&e)*t+.5|0)}function bt(e,t,i,r){return(i=i||new Float32Array(4))[0]=(e>>16&255)/255,i[1]=(e>>8&255)/255,i[2]=(255&e)/255,!r&&void 0!==r||(i[0]*=t,i[1]*=t,i[2]*=t),i[3]=t,i}function xt(e,t){var i=6*e;if((t=(t=void 0===t?null:t)||new Uint16Array(i)).length!==i)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+i);for(var r=0,n=0;r>>1)|e>>>2)|e>>>4)|e>>>8)|e>>>16)+1}function St(e){return!(e&e-1||!e)}function At(e){var t=(65535>>=t)?1:0)<<3;return(t|=i)|(i=(15<(e>>>=i)?1:0)<<2)|(i=(3<(e>>>=i)?1:0)<<1)|(e>>>=i)>>1}function kt(e,t,i){var r=e.length;if(!(r<=t||0===i)){for(var n=r-(i=r=this.x&&e=this.y&&t=r||Math.max(o.y,f.y,a.y,l.y)<=n||Math.min(o.y,f.y,a.y,l.y)>=s)&&(h=(t=u*(f.y-o.y))*i+(f=u*(o.x-f.x))*n,c=t*r+f*n,p=t*i+f*s,d=t*r+f*s,!(Math.max(h,c,p,d)<=t*o.x+f*o.y||Math.min(h,c,p,d)>=t*l.x+f*l.y)&&(p=(h=u*(o.y-a.y))*i+(c=u*(a.x-o.x))*n,d=h*r+c*n,t=h*i+c*s,f=h*r+c*s,!(Math.max(p,d,t,f)<=h*o.x+c*o.y||Math.min(p,d,t,f)>=h*l.x+c*l.y))))))):(u=(this.xe.right?e:this).right<=u)&&(this.ye.bottom?e:this).bottom)},Kt.prototype.pad=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this.x-=e,this.y-=t,this.width+=2*e,this.height+=2*t,this},Kt.prototype.fit=function(e){var t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),e=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=r,this.height=Math.max(e-r,0),this},Kt.prototype.ceil=function(e,t){void 0===e&&(e=1),void 0===t&&(t=.001);var i=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=r-this.y,this},Kt.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),e=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=r,this.height=e-r,this},Kt.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},Kt);function Kt(e,t,i,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(r),this.type=$.SHAPES.RECT}Jt.prototype.clone=function(){return new Jt(this.x,this.y,this.radius)},Jt.prototype.contains=function(e,t){var i;return!(this.radius<=0)&&(i=this.radius*this.radius,e=this.x-e,t=this.y-t,(e*=e)+(t*=t)<=i)},Jt.prototype.getBounds=function(){return new w(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},Jt.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"};var Zt=Jt;function Jt(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=e=void 0===e?0:e,this.y=t,this.radius=i,this.type=$.SHAPES.CIRC}$t.prototype.clone=function(){return new $t(this.x,this.y,this.width,this.height)},$t.prototype.contains=function(e,t){return!(this.width<=0||this.height<=0)&&(e=(e-this.x)/this.width,t=(t-this.y)/this.height,(e*=e)+(t*=t)<=1)},$t.prototype.getBounds=function(){return new w(this.x-this.width,this.y-this.height,this.width,this.height)},$t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"};var Qt=$t;function $t(e,t,i,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=e=void 0===e?0:e,this.y=t,this.width=i,this.height=r,this.type=$.SHAPES.ELIP}ti.prototype.clone=function(){var e=new ti(this.points.slice());return e.closeStroke=this.closeStroke,e},ti.prototype.contains=function(e,t){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var r=e-(this.x+i),n=t-(this.y+i),s=i*i;if(r*r+n*n<=s)return!0;if((r=e-(this.x+this.width-i))*r+n*n<=s)return!0;if(r*r+(n=t-(this.y+this.height-i))*n<=s)return!0;if((r=e-(this.x+i))*r+n*n<=s)return!0}return!1},ri.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"};var ii=ri;function ri(e,t,i,r,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=20),this.x=e=void 0===e?0:e,this.y=t,this.width=i,this.height=r,this.radius=n,this.type=$.SHAPES.RREC}si.prototype.clone=function(e,t){return new si(e=void 0===e?this.cb:e,t=void 0===t?this.scope:t,this._x,this._y)},si.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this._x===e&&this._y===t||(this._x=e,this._y=t,this.cb.call(this.scope)),this},si.prototype.copyFrom=function(e){return this._x===e.x&&this._y===e.y||(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},si.prototype.copyTo=function(e){return e.set(this._x,this._y),e},si.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},si.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(si.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(si.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0});var ni=si;function si(e,t,i,r){void 0===r&&(r=0),this._x=i=void 0===i?0:i,this._y=r,this.cb=e,this.scope=t}ai.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},ai.prototype.set=function(e,t,i,r,n,s){return this.a=e,this.b=t,this.c=i,this.d=r,this.tx=n,this.ty=s,this},ai.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));t=t||this.array;return e?(t[0]=this.a,t[1]=this.b,t[2]=0,t[3]=this.c,t[4]=this.d,t[5]=0,t[6]=this.tx,t[7]=this.ty):(t[0]=this.a,t[1]=this.c,t[2]=this.tx,t[3]=this.b,t[4]=this.d,t[5]=this.ty,t[6]=0,t[7]=0),t[8]=1,t},ai.prototype.apply=function(e,t){t=t||new ee;var i=e.x,e=e.y;return t.x=this.a*i+this.c*e+this.tx,t.y=this.b*i+this.d*e+this.ty,t},ai.prototype.applyInverse=function(e,t){t=t||new ee;var i=1/(this.a*this.d+this.c*-this.b),r=e.x,e=e.y;return t.x=this.d*i*r+-this.c*i*e+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*e+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,t},ai.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},ai.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},ai.prototype.rotate=function(e){var t=Math.cos(e),e=Math.sin(e),i=this.a,r=this.c,n=this.tx;return this.a=i*t-this.b*e,this.b=i*e+this.b*t,this.c=r*t-this.d*e,this.d=r*e+this.d*t,this.tx=n*t-this.ty*e,this.ty=n*e+this.ty*t,this},ai.prototype.append=function(e){var t=this.a,i=this.b,r=this.c,n=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*i+e.b*n,this.c=e.c*t+e.d*r,this.d=e.c*i+e.d*n,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*i+e.ty*n+this.ty,this},ai.prototype.setTransform=function(e,t,i,r,n,s,o,a,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=e-(i*this.a+r*this.c),this.ty=t-(i*this.b+r*this.d),this},ai.prototype.prepend=function(e){var t,i,r=this.tx;return 1===e.a&&0===e.b&&0===e.c&&1===e.d||(t=this.a,i=this.c,this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d),this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this},ai.prototype.decompose=function(e){var t=this.a,i=this.b,r=this.c,n=this.d,s=e.pivot,o=-Math.atan2(-r,n),a=Math.atan2(i,t),l=Math.abs(o+a);return l<1e-5||Math.abs(Ht-l)<1e-5?(e.rotation=a,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=a),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(r*r+n*n),e.position.x=this.tx+(s.x*t+s.y*r),e.position.y=this.ty+(s.x*i+s.y*n),e},ai.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,r=this.d,n=this.tx,s=e*r-t*i;return this.a=r/s,this.b=-t/s,this.c=-i/s,this.d=e/s,this.tx=(i*this.ty-r*n)/s,this.ty=-(e*this.ty-t*n)/s,this},ai.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},ai.prototype.clone=function(){var e=new ai;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},ai.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},ai.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},ai.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(ai,"IDENTITY",{get:function(){return new ai},enumerable:!1,configurable:!0}),Object.defineProperty(ai,"TEMP_MATRIX",{get:function(){return new ai},enumerable:!1,configurable:!0});var oi=ai;function ai(e,t,i,r,n,s){void 0===e&&(e=1),void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=r,this.tx=n,this.ty=s}var li=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ui=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],hi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ci=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],pi=[],di=[],fi=Math.sign;for(var mi=0;mi<16;mi++){var _i=[];pi.push(_i);for(var gi=0;gi<16;gi++)for(var vi=fi(li[mi]*li[gi]+hi[mi]*ui[gi]),yi=fi(ui[mi]*li[gi]+ci[mi]*ui[gi]),bi=fi(li[mi]*hi[gi]+hi[mi]*ci[gi]),xi=fi(ui[mi]*hi[gi]+ci[mi]*ci[gi]),Ti=0;Ti<16;Ti++)if(li[Ti]===vi&&ui[Ti]===yi&&hi[Ti]===bi&&ci[Ti]===xi){_i.push(Ti);break}}for(mi=0;mi<16;mi++){var wi=new oi;wi.set(li[mi],ui[mi],hi[mi],ci[mi],0,0),di.push(wi)}var Ei={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(e){return li[e]},uY:function(e){return ui[e]},vX:function(e){return hi[e]},vY:function(e){return ci[e]},inv:function(e){return 8&e?15&e:7&-e},add:function(e,t){return pi[e][t]},sub:function(e,t){return pi[e][Ei.inv(t)]},rotate180:function(e){return 4^e},isVertical:function(e){return 2==(3&e)},byDirection:function(e,t){return 2*Math.abs(e)<=Math.abs(t)?0<=t?Ei.S:Ei.N:2*Math.abs(t)<=Math.abs(e)?0this.maxX||this.minY>this.maxY},Pi.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Pi.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?w.EMPTY:((e=e||new w(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},Pi.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},Pi.prototype.addPointMatrix=function(e,t){var i=e.a,r=e.b,n=e.c,s=e.d,o=e.tx,e=e.ty,i=i*t.x+n*t.y+o,n=r*t.x+s*t.y+e;this.minX=Math.min(this.minX,i),this.maxX=Math.max(this.maxX,i),this.minY=Math.min(this.minY,n),this.maxY=Math.max(this.maxY,n)},Pi.prototype.addQuad=function(e){var t=this.minX,i=this.minY,r=this.maxX,n=this.maxY,s=e[0],o=e[1],t=sr?e.maxX:r,this.maxY=e.maxY>n?e.maxY:n},Pi.prototype.addBoundsMask=function(e,t){var i,r,n,s=(e.minX>t.minX?e:t).minX,o=(e.minY>t.minY?e:t).minY,a=(e.maxXt.x?e.minX:t.x,o=e.minY>t.y?e.minY:t.y,a=e.maxXi?this.maxX:i,this.minY=this.minYr?this.maxY:r};var ki=Pi;function Pi(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}var Oi=function(e,t){return(Oi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function Ri(e,t){function i(){this.constructor=e}Oi(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}Ri(l,Ci=ie),l.mixin=function(e){for(var t=Object.keys(e),i=0;ithis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e},u.prototype.swapChildren=function(e,t){var i,r;e!==t&&(i=this.getChildIndex(e),r=this.getChildIndex(t),this.children[i]=t,this.children[r]=e,this.onChildrenChange(i=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(e);kt(this.children,i,1),this.children.splice(t,0,e),this.onChildrenChange(t)},u.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},u.prototype.removeChild=function(){for(var e=arguments,t=[],i=0;it.priority){e.connect(i);break}t=(i=t).next}e.previous||e.connect(i)}else e.connect(i);return this._startIfPossible(),this},h.prototype.remove=function(e,t){for(var i=this._head.next;i;)i=i.match(e,t)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(h.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),h.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},h.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},h.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},h.prototype.update=function(e){var t;if((e=void 0===e?performance.now():e)>this.lastTime){if((t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var i=e-this._lastFrame|0;if(i)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var yr,f=br;function br(e,t){var i=this;return t=t||{},(i=yr.call(this,R.ADAPTER.createCanvas())||this)._width=0,i._height=0,i.svg=e,i.scale=t.scale||1,i._overrideWidth=t.width,i._overrideHeight=t.height,i._resolve=null,i._crossorigin=t.crossorigin,i._load=null,!1!==t.autoLoad&&i.load(),i}c(wr,xr=hr),wr.prototype.update=function(e){var t;this.destroyed||(t=Wi.shared.elapsedMS*this.source.playbackRate,this._msToNextUpdate=Math.floor(this._msToNextUpdate-t),(!this._updateFPS||this._msToNextUpdate<=0)&&(xr.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0))},wr.prototype.load=function(){var t,i=this;return this._load||(((t=this.source).readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart.bind(this)),t.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise(function(e){i.valid?e(i):(i._resolve=e,t.load())})),this._load},wr.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},wr.prototype._isSourcePlaying=function(){var e=this.source;return 0this.baseTexture.width,o=i+n>this.baseTexture.height;if(s||o)throw t="X: "+t+" + "+r+" = "+(t+r)+" > "+this.baseTexture.width,i="Y: "+i+" + "+n+" = "+(i+n)+" > "+this.baseTexture.height,new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+t+" "+(s&&o?"and":"or")+" "+i);this.valid=r&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),m.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(m,"EMPTY",{get:function(){return m._EMPTY||(Br(m._EMPTY=new m(new C)),Br(m._EMPTY.baseTexture)),m._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(m,"WHITE",{get:function(){var e,t;return m._WHITE||(t=(e=R.ADAPTER.createCanvas(16,16)).getContext("2d"),e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Br(m._WHITE=new m(C.from(e))),Br(m._WHITE.baseTexture)),m._WHITE},enumerable:!1,configurable:!0});var Ur,te=m;function m(e,t,i,r,n,s){var o=Ur.call(this)||this;if(o.noFrame=!1,t||(o.noFrame=!0,t=new w(0,0,1,1)),e instanceof m&&(e=e.baseTexture),o.baseTexture=e,o._frame=t,o.trim=r,o.valid=!1,o._uvs=zr,o.uvMatrix=null,o.orig=i||t,o._rotate=Number(n||0),!0===n)o._rotate=2;else if(o._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return o.defaultAnchor=s?new ee(s.x,s.y):new ee(0,0),o._updateID=0,o.textureCacheIds=[],e.valid?o.noFrame?e.valid&&o.onBaseTextureUpdated(e):o.frame=t:e.once("loaded",o.onBaseTextureUpdated,o),o.noFrame&&e.on("update",o.onBaseTextureUpdated,o),o}c(Xr,jr=te),Object.defineProperty(Xr.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(Xr.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),Xr.prototype.resize=function(e,t,i){void 0===i&&(i=!0);var r=this.baseTexture.resolution,e=Math.round(e*r)/r,t=Math.round(t*r)/r;this.valid=0>>0,1=$.ENV.WEBGL2?e.getContext("webgl2",t):i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},Sn.prototype.getExtensions=function(){var e=this.gl,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},Sn.prototype.handleContextLost=function(e){e.preventDefault()},Sn.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},Sn.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},Sn.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},Sn.prototype.validateContext=function(e){var t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext,t=(i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly"),i||!!e.getExtension("OES_element_index_uint"));(this.supports.uint32Indices=t)||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},Sn);function Sn(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),e.view.addEventListener("webglcontextlost",this.handleContextLost,!1),e.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}var An=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=$.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},kn=new w,Pn=(On.prototype.contextChange=function(){var t,e,i=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new w,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion?(t=this.renderer.context.extensions.drawBuffers,e=this.renderer.context.extensions.depthTexture,R.PREFER_ENV===$.ENV.WEBGL_LEGACY&&(e=t=null),t?i.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,i.drawBuffers=function(){}),e||(this.writeDepthTexture=!1)):this.msaaSamples=i.getInternalformatParameter(i.RENDERBUFFER,i.RGBA8,i.SAMPLES)},On.prototype.bind=function(e,t,i){void 0===i&&(i=0);var r=this.gl;if(e){var n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=i),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var s,o,a=0;a>i,o=t.height>>i,n=s/t.width,this.setViewport(t.x*n,t.y*n,s,o)):(s=e.width>>i,o=e.height>>i,this.setViewport(0,0,s,o))}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},On.prototype.setViewport=function(e,t,i,r){var n=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),r=Math.round(r),n.width===i&&n.height===r&&n.x===e&&n.y===t||(n.x=e,n.y=t,n.width=i,n.height=r,this.gl.viewport(e,t,i,r))},Object.defineProperty(On.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),On.prototype.clear=function(e,t,i,r,n){void 0===n&&(n=$.BUFFER_BITS.COLOR|$.BUFFER_BITS.DEPTH);var s=this.gl;s.clearColor(e,t,i,r),s.clear(n)},On.prototype.initFramebuffer=function(e){var t=this.gl,t=new An(t.createFramebuffer());return t.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=t,this.managedFramebuffers.push(e),e.disposeRunner.add(this),t},On.prototype.resizeFramebuffer=function(e){var t=this.gl,i=e.glFramebuffers[this.CONTEXT_UID],r=(i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.RGBA8,e.width,e.height)),i.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,i.stencil),i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height)),e.colorTextures),n=r.length;t.drawBuffers||(n=Math.min(n,1));for(var s=0;s=$.ENV.WEBGL2?e.getContext("webgl2",{}):t)||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),jn=t),jn}function Xn(e,t,i){return"precision"!==e.substring(0,9)?"precision "+(t===$.PRECISION.HIGH&&i!==$.PRECISION.HIGH?$.PRECISION.MEDIUM:t)+" float;\n"+e:i!==$.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var Hn={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Yn(e){return Hn[e]}var Wn=null,Vn={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function qn(e,t){if(!Wn){var i=Object.keys(Vn);Wn={};for(var r=0;r>=1,i++;this.stateId=e.data}for(i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},Js.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,i=!1,r=0;rthis.maxIdle&&(e.destroyTexture(n,!0),i=!(t[r]=null))}if(i){for(var s=0,r=0;r=e.data.byteLength?i.bufferSubData(e.type,0,e.data):(t=e.static?i.STATIC_DRAW:i.DYNAMIC_DRAW,r.byteLength=e.data.byteLength,i.bufferData(e.type,e.data,t)))},lo.prototype.dispose=function(e,t){var i,r;this.managedBuffers[e.id]&&(delete this.managedBuffers[e.id],i=e._glBuffers[this.CONTEXT_UID],r=this.gl,e.disposeRunner.remove(this),i&&(t||r.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID]))},lo.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),i=0;i=$.MSAA_QUALITY.HIGH?this.multisample=$.MSAA_QUALITY.HIGH:e>=$.MSAA_QUALITY.MEDIUM?this.multisample=$.MSAA_QUALITY.MEDIUM:e>=$.MSAA_QUALITY.LOW?this.multisample=$.MSAA_QUALITY.LOW:this.multisample=$.MSAA_QUALITY.NONE},co.prototype.addSystem=function(e,t){var i,r=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(i in this[t]=r,this.runners)this.runners[i].add(r);return this},co.prototype.render=function(e,t){var i,r,n,s;t&&(s=t instanceof Gr?(Mt("6.0.0","Renderer#render arguments changed, use options instead."),i=t,r=arguments[2],n=arguments[3],arguments[4]):(i=t.renderTexture,r=t.clear,n=t.transform,t.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,this.context.isLost||(i||(this._lastObjectRendered=e),s||(t=e.enableTempParent(),e.updateTransform(),e.disableTempParent(t)),this.renderTexture.bind(i),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender"))},co.prototype.generateTexture=function(e,t,i,r){e=uo.prototype.generateTexture.call(this,e,t=void 0===t?{}:t,i,r);return this.framebuffer.blit(),e},co.prototype.resize=function(e,t){uo.prototype.resize.call(this,e,t),this.runners.resize.emit(this.screen.height,this.screen.width)},co.prototype.reset=function(){return this.runners.reset.emit(),this},co.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},co.prototype.destroy=function(e){for(var t in this.runners.destroy.emit(),this.runners)this.runners[t].destroy();uo.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(co.prototype,"extract",{get:function(){return Mt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),co.registerPlugin=function(e,t){Mt("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ji.add({name:e,type:$.ExtensionType.RendererPlugin,ref:t})},co.__plugins={};var uo,ho=co;function co(e){var t=uo.call(this,$.RENDERER_TYPE.WEBGL,e)||this;return e=t.options,t.gl=null,t.CONTEXT_UID=0,t.runners={destroy:new Gi("destroy"),contextChange:new Gi("contextChange"),reset:new Gi("reset"),update:new Gi("update"),postrender:new Gi("postrender"),prerender:new Gi("prerender"),resize:new Gi("resize")},t.runners.contextChange.add(t),t.globalUniforms=new cn({projectionMatrix:new oi},!0),t.addSystem(gs,"mask").addSystem(En,"context").addSystem(qs,"state").addSystem(Ws,"shader").addSystem($s,"texture").addSystem(ao,"buffer").addSystem(Cn,"geometry").addSystem(Pn,"framebuffer").addSystem(ws,"scissor").addSystem(As,"stencil").addSystem(Ps,"projection").addSystem(Zs,"textureGC").addSystem(gn,"filter").addSystem(Ms,"renderTexture").addSystem(xn,"batch"),t.initPlugins(co.__plugins),t.multisample=void 0,e.context?t.context.initFromContext(e.context):t.context.initFromOptions({alpha:!!t.useContextAlpha,antialias:e.antialias,premultipliedAlpha:t.useContextAlpha&&"notMultiplied"!==t.useContextAlpha,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:t.options.powerPreference}),t.renderingToScreen=!0,ht(2===t.context.webGLVersion?"WebGL 2":"WebGL 1"),t.resize(t.options.width,t.options.height),t}function po(e){return ho.create(e)}ji.handleByMap($.ExtensionType.RendererPlugin,ho.__plugins);var fo="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",mo="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",_o=(go.prototype.destroy=function(){this.renderer=null},go);function go(e){Mt("6.1.0","System class is deprecated, implemement ISystem interface instead."),this.renderer=e}var vo=function(){this.texArray=null,this.blend=0,this.type=$.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},yo=(bo.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},So.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,i=So._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,s=this.renderer.textureGC.count,o=++C._globalBatch,a=0,l=i[0],u=0;r.copyBoundTextures(n,t);for(var h=0;h=t&&(r.boundArray(l,n,o,t),this.buildDrawCalls(l,u,h),u=h,l=i[++a],++o),c._batchEnabled=o,c.touched=s,l.elements[l.count++]=c)}0 title : "+e.title+"
tabIndex: "+e.tabIndex},zo.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,t=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>t&&(e.height=t-e.y)},zo.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2..toString(),t.style.borderStyle="none",-1>2,n[1]=(3&r[0])<<4|r[1]>>4,n[2]=(15&r[1])<<2|r[2]>>6,n[3]=63&r[2],i-(e.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(s=0;sa[0]&&t[1]>1||1)+r-1&~(r-1))*(p=(h=h>>1||1)+n-1&~(n-1))*wa[t];return a};var Ra,Ca=Ma;function Ma(e,t){var i=Ra.call(this,e,t)||this;return i.format=t.format,i.levels=t.levels||1,i._width=t.width,i._height=t.height,i._extension=Ma._formatToExtension(i.format),(t.levelBuffers||i.buffer)&&(i._levelBuffers=t.levelBuffers||Ma._createLevelBuffers(e instanceof Uint8Array?e:i.buffer.uint8View,i.format,i.levels,4,4,i.width,i.height)),i}Ia.use=function(i,r){var e=i.data;if(i.type===$.LoaderResource.TYPE.JSON&&e&&e.cacheID&&e.textures){for(var t,n,s=e.textures,o=void 0,a=void 0,l=0,u=s.length;l>>=1,m>>>=1;for(var g=148,_=0;_>1||1)+4-1&-4)*(x=(y=y>>1||1)+4-1&-4)*_}return 0!==s?{uncompressed:f.map(function(e){var t=e[0].levelBuffer,i=!1;return s===$.TYPES.FLOAT?t=new Float32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4):s===$.TYPES.UNSIGNED_INT?(i=!0,t=new Uint32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)):s===$.TYPES.INT&&(i=!0,t=new Int32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)),{resource:new tr(t,{width:e[0].levelWidth,height:e[0].levelHeight}),type:s,format:i?function(e){switch(e){case $.FORMATS.RGBA:return $.FORMATS.RGBA_INTEGER;case $.FORMATS.RGB:return $.FORMATS.RGB_INTEGER;case $.FORMATS.RG:return $.FORMATS.RG_INTEGER;case $.FORMATS.RED:return $.FORMATS.RED_INTEGER;default:return e}}(o):o}}),kvData:i}:{compressed:f.map(function(e){return new Ca(null,{format:a,width:l,height:u,levels:p,levelBuffers:e})}),kvData:i}}$.LoaderResource.setExtensionXhrType("dds",$.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);cl.use=function(e,t){if("dds"===e.extension&&e.data)try{Object.assign(e,Da(e.name||e.url,Va(e.data),e.metadata))}catch(e){return void t(e)}t()},cl.extension=$.ExtensionType.Loader;var v=cl;function cl(){}$.LoaderResource.setExtensionXhrType("ktx",$.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);dl.use=function(e,t){if("ktx"===e.extension&&e.data)try{var r,n=e.name||e.url,i=hl(n,e.data,this.loadKeyValueData),s=i.compressed,o=i.uncompressed,a=i.kvData;if(s){var l=Da(n,s,e.metadata);if(a&&l.textures)for(var u in l.textures)l.textures[u].baseTexture.ktxKeyValueData=a;Object.assign(e,l)}else o&&(r={},o.forEach(function(e,t){var e=new te(new C(e.resource,{mipmap:$.MIPMAP_MODES.OFF,alphaMode:$.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,type:e.type,format:e.format})),i=n+"-"+(t+1);a&&(e.baseTexture.ktxKeyValueData=a),C.addToCache(e.baseTexture,i),te.addToCache(e,i),0===t&&(r[n]=e,C.addToCache(e.baseTexture,n),te.addToCache(e,n)),r[i]=e}),Object.assign(e,{textures:r}))}catch(e){return void t(e)}t()},dl.extension=$.ExtensionType.Loader,dl.loadKeyValueData=!1;var pl=dl;function dl(){}var fl=function(e,t){return(fl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function ml(e,t){function i(){this.constructor=e}fl(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}ml(vl,_l=zi),vl.prototype.setProperties=function(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])},vl.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(vl.prototype,"tint",{get:function(){return this._tint},set:function(e){dt(this._tint=e,this.tintRgb)},enumerable:!1,configurable:!0}),vl.prototype.render=function(e){var t=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return t.onChildrenChange(0)})),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))},vl.prototype.onChildrenChange=function(e){for(var t=Math.floor(e/this._batchSize);this._bufferUpdateIDs.length=o.length&&o.push(this._generateOneMoreBuffer(e)),o[p]),m=(f.uploadDynamic(t,c,d),e._bufferUpdateIDs[p]||0);(h=h||f._updateIDthis.maxSegments&&(e=this.maxSegments),e):t}},Sl=(Al.prototype.clone=function(){var e=new Al;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},Al.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=te.WHITE,this.matrix=null,this.visible=!1},Al.prototype.destroy=function(){this.texture=null,this.matrix=null},Al);function Al(){this.color=16777215,this.alpha=1,this.texture=te.WHITE,this.matrix=null,this.visible=!1,this.reset()}var kl=function(e,t){return(kl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function Pl(e,t){function i(){this.constructor=e}kl(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function Ol(e,t){void 0===t&&(t=!1);var i=e.length;if(!(i<6)){for(var r=0,n=0,s=e[i-2],o=e[i-1];n>0),m=c/f;if(p+=m,a){o.push(e,t),o.push(i,r);for(var _=1,g=p;_>16)+(65280&t)+((255&t)<<16),i);e.length=Math.max(e.length,n+r);for(var o=0;o>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,e.shader.bind(t),e.geometry.bind(i,t),e.state.set(this.state);for(var a=0,l=o.length;a>16)+(65280&r)+((255&r)<<16)}}},b.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var e=this.transform.worldTransform,t=e.a,i=e.b,r=e.c,n=e.d,s=e.tx,o=e.ty,a=this._geometry.points,l=this.vertexData,u=0,h=0;h=i&&pu.x=i&&pu.y>16)+(65280&e)+((255&e)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||te.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),_u);function mu(){this.constructor=cu}function _u(e){var t=hu.call(this)||this;return t._anchor=new ni(t._onAnchorUpdate,t,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),t._texture=null,t._width=0,t._height=0,t._tint=null,t._tintRGB=null,t.tint=16777215,t.blendMode=$.BLEND_MODES.NORMAL,t._cachedTint=16777215,t.uvs=null,t.texture=e||te.EMPTY,t.vertexData=new Float32Array(8),t.vertexTrimmedData=null,t._transformID=-1,t._textureID=-1,t._transformTrimmedID=-1,t._textureTrimmedID=-1,t.indices=du,t.pluginName="batch",t.isSprite=!0,t._roundPixels=R.ROUND_PIXELS,t}var gu=function(e,t){return(gu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};$.TEXT_GRADIENT=void 0,(Ll=$.TEXT_GRADIENT||($.TEXT_GRADIENT={}))[Ll.LINEAR_VERTICAL=0]="LINEAR_VERTICAL";var vu={align:"left",breakWords:!(Ll[Ll.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"),dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},yu=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],bu=(x.prototype.clone=function(){var e={};return wu(e,this,vu),new x(e)},x.prototype.reset=function(){wu(this,vu,vu)},Object.defineProperty(x.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){e=Tu(e);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fill",{get:function(){return this._fill},set:function(e){e=Tu(e);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){!function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return;if(e.length!==t.length)return;for(var i=0;i=i&&nh.x=i&&nh.y>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),wh.prototype.update=function(){var e;this._colorDirty&&(this._colorDirty=!1,e=this.texture.baseTexture,bt(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)};var xh,Th=wh;function wh(e,t){var i=this,r={uSampler:e,alpha:1,uTextureMatrix:oi.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t)).uniforms&&Object.assign(r,t.uniforms),(i=xh.call(this,t.program||rs.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),r)||this)._colorDirty=!1,i.uvMatrix=new ps(e),i.batchable=void 0===t.program,i.pluginName=t.pluginName,i.tint=t.tint,i.alpha=t.alpha,i}dh(Ah,Eh=tn),Object.defineProperty(Ah.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0});var Eh,Sh=Ah;function Ah(e,t,i){var r=Eh.call(this)||this,e=new Kr(e),t=new Kr(t,!0),i=new Kr(i,!0,!0);return r.addAttribute("aVertexPosition",e,2,!1,$.TYPES.FLOAT).addAttribute("aTextureCoord",t,2,!1,$.TYPES.FLOAT).addIndex(i),r._updateId=-1,r}var kh=function(e,t){return(kh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};var Ph=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},Oh=(Rh.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},Rh.parse=function(e){var t,i=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(t in i){var n,s=i[t].match(/^[a-z]+/gm)[0],o=i[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(n in o){var l=o[n].split("="),u=l[0],l=l[1].replace(/"/gm,""),h=parseFloat(l),l=isNaN(h)?l:h;a[u]=l}r[s].push(a)}var c=new Ph;return r.info.forEach(function(e){return c.info.push({face:e.face,size:parseInt(e.size,10)})}),r.common.forEach(function(e){return c.common.push({lineHeight:parseInt(e.lineHeight,10)})}),r.page.forEach(function(e){return c.page.push({id:parseInt(e.id,10),file:e.file})}),r.char.forEach(function(e){return c.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})}),r.kerning.forEach(function(e){return c.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})}),r.distanceField.forEach(function(e){return c.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})}),c},Rh);function Rh(){}Mh.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},Mh.parse=function(e){for(var t=new Ph,i=e.getElementsByTagName("info"),r=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),s=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),a=e.getElementsByTagName("distanceField"),l=0;l")&&(e=(new globalThis.DOMParser).parseFromString(e,"text/xml"),Ch.test(e))},Dh.parse=function(e){e=(new globalThis.DOMParser).parseFromString(e,"text/xml");return Ch.parse(e)};var Ih=Dh;function Dh(){}var Lh=[Oh,Ch,Ih];function Fh(e){for(var t=0;tF&&(kt(r,1+c-++z,1+f-c),f=c,c=-1,n.push(p),s.push(06*E)||I.vertices.length<2*yh.BATCHABLE_SIZE)I.vertices=new Float32Array(8*E),I.uvs=new Float32Array(8*E),I.indices=new Uint16Array(6*E);else for(var Y=I.total,W=I.vertices,V=4*Y*2;V>16&255)/255,0,0,0,0,0,(e>>8&255)/255,0,0,0,0,0,(255&e)/255,0,0,0,0,0,1,0],t)},E.prototype.greyscale=function(e,t){this._loadMatrix([e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0],t)},E.prototype.blackAndWhite=function(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)},E.prototype.hue=function(e,t){e=(e||0)/180*Math.PI;var i=Math.cos(e),e=Math.sin(e),r=(0,Math.sqrt)(1/3);this._loadMatrix([i+1/3*(1-i),1/3*(1-i)-r*e,1/3*(1-i)+r*e,0,0,1/3*(1-i)+r*e,i+1/3*(1-i),1/3*(1-i)-r*e,0,0,1/3*(1-i)-r*e,1/3*(1-i)+r*e,i+1/3*(1-i),0,0,0,0,0,1,0],t)},E.prototype.contrast=function(e,t){var e=(e||0)+1,i=-.5*(e-1);this._loadMatrix([e,0,0,0,i,0,e,0,0,i,0,0,e,0,i,0,0,0,1,0],t)},E.prototype.saturate=function(e,t){var e=2*(e=void 0===e?0:e)/3+1,i=-.5*(e-1);this._loadMatrix([e,i,i,0,0,i,e,i,0,0,i,i,e,0,0,0,0,0,1,0],t)},E.prototype.desaturate=function(){this.saturate(-1)},E.prototype.negative=function(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)},E.prototype.sepia=function(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)},E.prototype.technicolor=function(e){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],e)},E.prototype.polaroid=function(e){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],e)},E.prototype.toBGR=function(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)},E.prototype.kodachrome=function(e){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],e)},E.prototype.browni=function(e){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],e)},E.prototype.vintage=function(e){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],e)},E.prototype.colorTone=function(e,t,i,r,n){var s=((i=i||16770432)>>16&255)/255,o=(i>>8&255)/255,i=(255&i)/255,a=((r=r||3375104)>>16&255)/255,l=(r>>8&255)/255,r=(255&r)/255;this._loadMatrix([.3,.59,.11,0,0,s,o,i,e=e||.2,0,a,l,r,t=t||.15,0,s-a,o-l,i-r,0,0],n)},E.prototype.night=function(e,t){this._loadMatrix([-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0],t)},E.prototype.predator=function(e,t){this._loadMatrix([11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0],t)},E.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},E.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(E.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0});var _c,gc,vc=E;function yc(){this.constructor=gc}function E(){var e=this,t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return(e=_c.call(this,mo,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",t)||this).alpha=1,e}vc.prototype.grayscale=vc.prototype.greyscale;var bc=function(e,t){return(bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};bc(Tc=Sc,wc=xc=Q),Tc.prototype=null===wc?Object.create(wc):(Ec.prototype=wc.prototype,new Ec),Sc.prototype.apply=function(e,t,i,r){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,s=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);0!==s&&0!==o&&(this.uniforms.rotation[0]=n.a/s,this.uniforms.rotation[1]=n.b/s,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),e.applyFilter(this,t,i,r)},Object.defineProperty(Sc.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(e){this.uniforms.mapSampler=e},enumerable:!1,configurable:!0});var xc,Tc,wc=Sc;function Ec(){this.constructor=Tc}function Sc(e,t){var i=this,r=new oi;return e.renderable=!1,(i=xc.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:e._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,i.maskMatrix=r,i.scale=new ee(t=null==t?20:t,t),i}var Ac=function(e,t){return(Ac=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};Ac(Pc=Cc,Oc=kc=Q),Pc.prototype=null===Oc?Object.create(Oc):(Rc.prototype=Oc.prototype,new Rc);var kc,Pc,Oc=Cc;function Rc(){this.constructor=Pc}function Cc(){return kc.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}var Mc=function(e,t){return(Mc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};Mc(Dc=Nc,Lc=Ic=Q),Dc.prototype=null===Lc?Object.create(Lc):(Fc.prototype=Lc.prototype,new Fc),Object.defineProperty(Nc.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(Nc.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0});var Ic,Dc,Lc=Nc;function Fc(){this.constructor=Dc}function Nc(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random());var i=Ic.call(this,mo,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return i.noise=e,i.seed=t,i}(A={NORMAL:0,0:"NORMAL",ADD:1,1:"ADD",MULTIPLY:2,2:"MULTIPLY",SCREEN:3,3:"SCREEN",OVERLAY:4,4:"OVERLAY",DARKEN:5,5:"DARKEN",LIGHTEN:6,6:"LIGHTEN",COLOR_DODGE:7,7:"COLOR_DODGE",COLOR_BURN:8,8:"COLOR_BURN",HARD_LIGHT:9,9:"HARD_LIGHT",SOFT_LIGHT:10,10:"SOFT_LIGHT",DIFFERENCE:11,11:"DIFFERENCE",EXCLUSION:12,12:"EXCLUSION",HUE:13,13:"HUE",SATURATION:14,14:"SATURATION",COLOR:15,15:"COLOR",LUMINOSITY:16,16:"LUMINOSITY",NORMAL_NPM:17,17:"NORMAL_NPM",ADD_NPM:18,18:"ADD_NPM",SCREEN_NPM:19,19:"SCREEN_NPM",NONE:20,20:"NONE",SRC_OVER:0})[0]="SRC_OVER",A[A.SRC_IN=21]="SRC_IN",A[A.SRC_OUT=22]="SRC_OUT",A[A.SRC_ATOP=23]="SRC_ATOP",A[A.DST_OVER=24]="DST_OVER",A[A.DST_IN=25]="DST_IN",A[A.DST_OUT=26]="DST_OUT",A[A.DST_ATOP=27]="DST_ATOP",A[A.ERASE=26]="ERASE",A[A.SUBTRACT=28]="SUBTRACT",A[A.XOR=29]="XOR",(A={NPM:0,0:"NPM",UNPACK:1,1:"UNPACK",PMA:2,2:"PMA",NO_PREMULTIPLIED_ALPHA:0})[0]="NO_PREMULTIPLIED_ALPHA",A[A.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",A[A.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",A[A.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",(A={NO:0,0:"NO",YES:1,1:"YES",AUTO:2,2:"AUTO",BLEND:0})[0]="BLEND",A[A.CLEAR=1]="CLEAR",A[A.BLIT=2]="BLIT",(A=k=k||{})[A.NONE=0]="NONE",A[A.LOW=2]="LOW",A[A.MEDIUM=4]="MEDIUM",A[A.HIGH=8]="HIGH";var zc,Bc,Uc,jc,Gc,Xc,Hc=new oi,Yc=(i.prototype._cacheAsBitmap=!1,i.prototype._cacheData=null,i.prototype._cacheAsBitmapResolution=null,i.prototype._cacheAsBitmapMultisample=k.NONE,function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}),A=(Object.defineProperties(i.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(e){e!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(e){e!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=e,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new Yc),(t=this._cacheData).originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((t=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea))}}}),i.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},i.prototype._initCachedDisplayObject=function(e){var t,i,r,n,s,o,a,l;this._cacheData&&this._cacheData.sprite||(t=this.alpha,this.alpha=1,e.batch.flush(),i=this.getLocalBounds(null,!0).clone(),this.filters&&this.filters.length&&(r=this.filters[0].padding,i.pad(r)),i.ceil(R.RESOLUTION),r=e.renderTexture.current,n=e.renderTexture.sourceFrame.clone(),s=e.renderTexture.destinationFrame.clone(),o=e.projection.transform,a=Gr.create({width:i.width,height:i.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:null!=(a=this.cacheAsBitmapMultisample)?a:e.multisample}),l="cacheAsBitmap_"+ ++Ot,this._cacheData.textureCacheId=l,C.addToCache(a.baseTexture,l),te.addToCache(a,l),l=this.transform.localTransform.copyTo(Hc).invert().translate(-i.x,-i.y),this.render=this._cacheData.originalRender,e.render(this,{renderTexture:a,clear:!0,transform:l,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=o,e.renderTexture.bind(r,n,s),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t,(l=new fu(a)).transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(i.x/i.width),l.anchor.y=-(i.y/i.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l))},i.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},i.prototype._initCachedDisplayObjectCanvas=function(e){var t,i,r,n,s,o;this._cacheData&&this._cacheData.sprite||(t=this.getLocalBounds(null,!0),i=this.alpha,this.alpha=1,r=e.context,n=e._projTransform,t.ceil(R.RESOLUTION),s=Gr.create({width:t.width,height:t.height}),o="cacheAsBitmap_"+ ++Ot,this._cacheData.textureCacheId=o,C.addToCache(s.baseTexture,o),te.addToCache(s,o),this.transform.localTransform.copyTo(o=Hc),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:s,clear:!0,transform:o,skipUpdateTransform:!1}),e.context=r,e._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i,(o=new fu(s)).transform.worldTransform=this.transform.worldTransform,o.anchor.x=-(t.x/t.width),o.anchor.y=-(t.y/t.height),o.alpha=i,o._bounds=this._bounds,this._cacheData.sprite=o,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=o.containsPoint.bind(o))},i.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},i.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},i.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,C.removeFromCache(this._cacheData.textureCacheId),te.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},i.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},i.prototype.name=null,zi.prototype.getChildByName=function(e,t){for(var i=0,r=this.children.length;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=g-1,y=Math.floor,b=String.fromCharCode;function x(e){throw RangeError(p[e])}function f(e,t){for(var i=e.length,r=[];i--;)r[i]=t(e[i]);return r}function m(e,t){var i=e.split("@"),r="",i=(1>>10&1023|55296),e=56320|1023&e),t+=b(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,i){var r=0;for(e=i?y(e/l):e>>1,e+=y(e/t);d*v>>1y((_-h)/s))&&x("overflow"),h+=a*s,!(a<(a=o<=p?1:p+v<=o?v:o-p));o+=g)s>y(_/(a=g-a))&&x("overflow"),s*=a;p=S(h-n,t=l.length+1,0==n),y(h/t)>_-c&&x("overflow"),c+=y(h/t),h%=t,l.splice(h++,0,c)}return w(l)}function k(e){for(var t,i,r,n,s,o,a,l,u,h,c=[],p=(e=T(e)).length,d=128,f=72,m=t=0;my((_-t)/(l=i+1))&&x("overflow"),t+=(n-d)*l,d=n,m=0;m_&&x("overflow"),a==d){for(s=t,o=g;!(s<(u=o<=f?1:f+v<=o?v:o-f));o+=g)c.push(b(E(u+(h=s-u)%(u=g-u),0))),s=y(h/u);c.push(b(E(s,0))),f=S(t,l,i==r),t=0,++i}++t,++d}return c.join("")}if(s={version:"1.3.2",ucs2:{decode:T,encode:w},decode:A,encode:k,toASCII:function(e){return m(e,function(e){return h.test(e)?"xn--"+k(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?A(e.slice(4).toLowerCase()):e})}},r&&t)if(e.exports==r)t.exports=s;else for(o in s)s.hasOwnProperty(o)&&(r[o]=s[o]);else i.punycode=s});function d0(e,t,i,r){t=t||"&",i=i||"=";var n={};if("string"==typeof e&&0!==e.length){var s=/\+/g,t=(e=e.split(t),1e3),o=(r&&"number"==typeof r.maxKeys&&(t=r.maxKeys),e.length);0e?1:this._width/e,t=this._topHeight+this._bottomHeight,t=this._height>t?1:this._height/t;return Math.min(e,t)},Object.defineProperty(B0.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"topHeight",{get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(B0.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()},enumerable:!1,configurable:!0}),B0.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data,e=(this._origWidth=e.orig.width,this._origHeight=e.orig.height,1/this._origWidth),i=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()};var z0,r0=B0;function B0(e,t,i,r,n){void 0===t&&(t=10),void 0===i&&(i=10),void 0===r&&(r=10),void 0===n&&(n=10);var s=z0.call(this,te.WHITE,4,4)||this;return s._origWidth=e.orig.width,s._origHeight=e.orig.height,s._width=s._origWidth,s._height=s._origHeight,s._leftWidth=t,s._rightWidth=r,s._topHeight=i,s._bottomHeight=n,s.texture=e,s}var U0=function(e,t){return(U0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};U0(G0=H0,n0=j0=fu),G0.prototype=null===n0?Object.create(n0):(X0.prototype=n0.prototype,new X0),H0.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Wi.shared.remove(this.update,this),this._isConnectedToTicker=!1))},H0.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Wi.shared.add(this.update,this,$.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},H0.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},H0.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},H0.prototype.update=function(e){if(this._playing){var t=this.animationSpeed*e,i=this.currentFrame;if(null!==this._durations){var r=this._currentTime%1*this._durations[this.currentFrame];for(r+=t/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=t;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(0i)&&this.onLoop(),this.updateTexture())}},H0.prototype.updateTexture=function(){var e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},H0.prototype.destroy=function(e){this.stop(),j0.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},H0.fromFrames=function(e){for(var t=[],i=0;i 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka: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:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,i){return i||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,i,r){return r&&r.length?((r=r.splice?r:Array.prototype.slice.call(r)).splice(0,0,i),e["dynCall_"+t].apply(null,r)):e["dynCall_"+t].call(null,i)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*(t>>>0):(e>>>0)+4294967296*(0|t)},Ua:8,J:4,vd:0},na=(e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb,!1),oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(c){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,i){switch(i="*"===(i=i||"i8").charAt(i.length-1)?"i32":i){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,1<=+xa(oa=t)?0>>0:~~+Aa((oa-(~~oa>>>0))/4294967296)>>>0:0],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+i)}}function Da(e,t){switch(t="*"===(t=t||"i8").charAt(t.length-1)?"i32":t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,i,r){var s,o,a,l="number"==typeof e?(s=!0,e):(s=!1,e.length),u="string"==typeof t?t:null;if(i=4==i?r:[Ea,n.aa,n.Ra,n.R][void 0===i?2:i](Math.max(l,u?1:t.length)),s){for(assert(0==(3&(r=i))),e=i+(-4&l);r>2]=0;for(e=i+l;r>0]=0}else if("i8"===u)e.subarray||e.slice?E.set(e,i):E.set(new Uint8Array(e),i);else{r=0;for(;r>0],0!=r||i)&&(s++,!i||s!=i););if(i=i||s,r="",n<128){for(;0>10,56320|1023&i)))):a+=String.fromCharCode(i)}}function Ka(e,t,i,r){if(!(0>6}else{if(o<=65535){if(r<=i+2)break;t[i++]=224|o>>12}else{if(o<=2097151){if(r<=i+3)break;t[i++]=240|o>>18}else{if(o<=67108863){if(r<=i+4)break;t[i++]=248|o>>24}else{if(r<=i+5)break;t[i++]=252|o>>30,t[i++]=128|o>>24&63}t[i++]=128|o>>18&63}t[i++]=128|o>>12&63}t[i++]=128|o>>6&63}t[i++]=128|63&o}}return t[i]=0,i-n}function La(e){for(var t=0,i=0;i"):s=n;e:for(;c>0];if(!i)return t;t+=String.fromCharCode(i)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,i){return Ka(e,E,t,i)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,i="";;){var r=z[e+2*t>>1];if(0==r)return i;++t,i+=String.fromCharCode(r)}},e.stringToUTF16=function(e,t,i){if((i=void 0===i?2147483647:i)<2)return 0;var r=t;i=(i-=2)<2*e.length?i/2:e.length;for(var n=0;n>1]=e.charCodeAt(n),t+=2;return z[t>>1]=0,t-r},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,i="";;){var r=C[e+4*t>>2];if(0==r)return i;++t,65536<=r?(r-=65536,i+=String.fromCharCode(55296|r>>10,56320|1023&r)):i+=String.fromCharCode(r)}},e.stringToUTF32=function(e,t,i){if((i=void 0===i?2147483647:i)<4)return 0;var r=t;i=r+i-4;for(var n=0;n>2]=s,i<(t+=4)+4)break}return C[t>>2]=0,t-r},e.lengthBytesUTF32=function(e){for(var t=0,i=0;i>0]=e[i],i+=1}function ta(e,t){for(var i=0;i>0]=e[i]}function Ia(e,t,i){for(var r=0;r>0]=e.charCodeAt(r);i||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],i=0;i>>16)*r+i*(t>>>16)<<16)|0}),Math.Jd=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.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){var t;I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)&&(t=jb,jb=null,t())}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,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,88,0,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,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,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,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,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,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,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,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,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,54,95,95,115,104,105,109,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,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,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,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var i=0,r=e.length-1;0<=r;r--){var n=e[r];"."===n?e.splice(r,1):".."===n?(e.splice(r,1),i++):i&&(e.splice(r,1),i--)}if(t)for(;i--;)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),i="/"===e.substr(-1);return(e=(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t?e:".")&&i&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?e+(t=t&&t.substr(0,t.length-1)):"."}function Bb(e){var t;return"/"===e?"/":-1===(t=e.lastIndexOf("/"))?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,i=arguments.length-1;-1<=i&&!t;i--){if("string"!=typeof(t=0<=i?arguments[i]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,i,r){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var n,s=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var i=e.e?e.e.buffer.byteLength:0;t<=i||(t=Math.max(t,i*(i<1048576?2:1.125)|0),0!=i&&(t=Math.max(t,256)),i=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-n,r))),8>1)}catch(e){if(e.code)throw new L(J[e.code]);throw e}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var i=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(i,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(i,t.size)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},lookup:function(e,t){var i=K(P.B(e),t),i=P.Ja(i);return P.createNode(e,t,i)},T:function(e,t,i,r){e=P.createNode(e,t,i,r),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(e.code)throw new L(J[e.code]);throw e}return e},rename:function(e,t,i){e=P.B(e),t=K(P.B(t),i);try{fs.renameSync(e,t)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},unlink:function(e,t){e=K(P.B(e),t);try{fs.unlinkSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},rmdir:function(e,t){e=K(P.B(e),t);try{fs.rmdirSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},symlink:function(e,t,i){e=K(P.B(e),t);try{fs.symlinkSync(i,e)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(e.code)throw new L(J[e.code]);throw e}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(e.code)throw new L(J[e.code]);throw e}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(e.code)throw new L(J[e.code]);throw e}},read:function(e,t,i,r,n){if(0===r)return 0;var s,o=new Buffer(r);try{s=fs.readSync(e.V,o,0,r,n)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var i;if(i=(i=Yb(e,"x"))?i:e.k.lookup?0:J.da)throw new L(i,e);for(i=Q[Wb(e.id,t)];i;i=i.M){var r=i.name;if(i.parent.id===e.id&&r===t)return i}return e.k.lookup(e,t)}function Lb(e,t,i,r){return Zb||((Zb=function(e,t,i,r){this.parent=e=e||this,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=i,this.k={},this.n={},this.rdev=r}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,i,r)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb||(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,i=new dc;for(t in e)i[t]=e[t];return e=i,i=bc(),e.fd=i,Rb[i]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var i,r="/"===t,n=!t;if(r&&Pb)throw new L(J.fa);if(!r&&!n){if(t=(i=S(t,{Ia:!1})).path,(i=i.g).U)throw new L(J.fa);if(!N(i.mode))throw new L(J.ya)}n={type:e,pa:{},Oa:t,lb:[]},t=e.A(n);(t.A=n).root=t,r?Pb=t:i&&(i.U=n,i.A&&i.A.lb.push(n))}function fc(e,t,i){var r=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var n=ac(r,e);if(n)throw new L(n);if(r.k.T)return r.k.T(r,e,t,i);throw new L(J.I)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,i){return void 0===i&&(i=t,t=438),fc(e,8192|t,i)}function ic(e,t){if(!Db(e))throw new L(J.F);var i=S(t,{parent:!0}).g;if(!i)throw new L(J.F);var t=Bb(t),r=ac(i,t);if(r)throw new L(r);if(i.k.symlink)return i.k.symlink(i,t,e);throw new L(J.I)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(e.k.readlink)return Db(T(e.parent),e.k.readlink(e));throw new L(J.q)}function jc(e,t){e="string"==typeof e?S(e,{la:!0}).g:e;if(!e.k.u)throw new L(J.I);e.k.u(e,{mode:4095&t|-4096&e.mode,timestamp:Date.now()})}function kc(t,i){var r,n;if(""===t)throw new L(J.F);if("string"==typeof i){if(void 0===(r=$b[i]))throw Error("Unknown file open mode: "+i)}else r=i;if(s=64&(i=r)?4095&(void 0===s?438:s)|32768:0,"object"==typeof t)n=t;else{t=zb(t);try{n=S(t,{la:!(131072&i)}).g}catch(e){}}if(r=!1,64&i)if(n){if(128&i)throw new L(J.wa)}else n=fc(t,s,0),r=!0;if(!n)throw new L(J.F);if(8192==(61440&n.mode)&&(i&=-513),65536&i&&!N(n.mode))throw new L(J.ya);if(!r&&(s=n?40960==(61440&n.mode)?J.ga:N(n.mode)&&(0!=(2097155&i)||512&i)?J.P:(s=["r","w","rw"][3&i],512&i&&(s+="w"),Yb(n,s)):J.F))throw new L(s);if(512&i){var s,o="string"==typeof(s=n)?S(s,{la:!0}).g:s;if(!o.k.u)throw new L(J.I);if(N(o.mode))throw new L(J.P);if(32768!=(61440&o.mode))throw new L(J.q);if(s=Yb(o,"w"))throw new L(s);o.k.u(o,{size:0,timestamp:Date.now()})}i&=-641,(n=cc({g:n,path:T(n),flags:i,seekable:!0,position:0,n:n.n,tb:[],error:!1})).n.open&&n.n.open(n),!e.logReadFiles||1&i||(t in(lc=lc||{})||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(o=0,1!=(2097155&i)&&(o|=1),0!=(2097155&i)&&(o|=2),R.onOpenFile(t,o))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return n}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,i){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,i),e.tb=[]}function oc(e,t,i,r,n,s){if(r<0||n<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var o=!0;if(void 0===n)n=e.position,o=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,i,r,n,s),o||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var i=0;return e&&(i|=365),t&&(i|=146),i}function sc(e,t,i,r){return gc(e=K("string"==typeof e?e:T(e),t),rc(i,r))}function tc(e,t,i,r,n,s){if(n=gc(e=t?K("string"==typeof e?e:T(e),t):e,r=rc(r,n)),i){if("string"==typeof i){e=Array(i.length),t=0;for(var o=i.length;t>2]}function xc(){var e=X();if(e=Rb[e])return e;throw new L(J.ea)}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){var i;return Dc=e,Ec=t,Fc?(0==e?(Y=function(){setTimeout(Gc,t)},Hc="timeout"):1==e?(Y=function(){Ic(Gc)},Hc="rAF"):2==e&&(window.setImmediate||(i=[],window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),i.shift()())},!0),window.setImmediate=function(e){i.push(e),window.postMessage("__emcc","*")}),Y=function(){window.setImmediate(Gc)},Hc="immediate"),0):1}function Jc(o,t,i,a,r){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=o,Kc=a;var l=Lc;if(Gc=function(){var t,i,r,s;na||(0>i-6&63,i=i-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n];2==i?e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4]+"==":4==i&&(e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2]+"="),u.src="data:audio/x-"+o.substr(-3)+";base64,"+e,a(u)}},u.src=n,ad(function(){a(u)})}});var i=e.canvas;i&&(i.sa=i.requestPointerLock||i.mozRequestPointerLock||i.webkitRequestPointerLock||i.msRequestPointerLock||function(){},i.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},i.Fa=i.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&i.addEventListener("click",function(e){!Tc&&i.sa&&(i.sa(),e.preventDefault())},!1))}}function bd(t,i,r,n){if(i&&e.ka&&t==e.canvas)return e.ka;var s,o;if(i){if(o={antialias:!1,alpha:!1},n)for(var a in n)o[a]=n[a];(o=GL.createContext(t,o))&&(s=GL.getContext(o).td),t.style.backgroundColor="black"}else s=t.getContext("2d");return s?(r&&(i||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=s,i&&GL.Od(o),e.Td=i,Uc.forEach(function(e){e()}),Vc()),s):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,i,r){function n(){Sc=!1;var t=s.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(s.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},s.Da=s.Da.bind(document),dd&&s.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(s,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(s)}void 0===(dd=t)&&(dd=!0),void 0===(ed=i)&&(ed=!1),void 0===(jd=r)&&(jd=null);var s=e.canvas,o=(cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1)),document.createElement("div"));s.parentNode.insertBefore(o,s),o.appendChild(s),o.p=o.requestFullScreen||o.mozRequestFullScreen||o.msRequestFullscreen||(o.webkitRequestFullScreen?function(){o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),r?o.p({Ud:r}):o.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,i){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):i()},r.onerror=i,r.send(null)}function nd(t,i,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),i(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd,fs,Ob;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){var e;"undefined"!=typeof SDL&&(e=Sa[SDL.screen+0*n.J>>2],C[SDL.screen+0*n.J>>2]=8388608|e),pd()}function hd(){var e;"undefined"!=typeof SDL&&(e=Sa[SDL.screen+0*n.J>>2],C[SDL.screen+0*n.J>>2]=-8388609&e),pd()}function id(t,i,r){i&&r?(t.ub=i,t.hb=r):(i=t.ub,r=t.hb);var n,s=i,o=r;e.forcedAspectRatio&&0this.length-1||e<0))return t=e%this.chunkSize,this.gb(e/this.chunkSize|0)[t]},o.prototype.pb=function(e){this.gb=e},o.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",l,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+l+". Status: "+e.status);var s=Number(e.getResponseHeader("Content-length")),o=1048576,a=((e=e.getResponseHeader("Accept-Ranges"))&&"bytes"===e||(o=s),this);a.pb(function(e){var t=e*o,i=(e+1)*o-1,i=Math.min(i,s-1);if(void 0===a.Y[e]){var r=a.Y;if(i=(e=e.g.e).length)return 0;if(assert(0<=(r=Math.min(e.length-n,r))),e.slice)for(var s=0;s>2]=0):-J.Q;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(i=X(),r.n.ib)return r.n.ib(r,n,i);throw new L(J.Q);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){tb.p--,ub.push(e);e:{if(e&&!vb[e])for(var t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,i){return E.set(E.subarray(t,t+i),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;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}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var i=xc(),r=X(),n=X(),s=X(),o=X();return assert(0===r),nc(i,n,o),C[s>>2]=i.position,i.na&&0===n&&0===o&&(i.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var i,r=xc(),n=X();e:{for(var s=X(),o=0,a=0;a>2],C[n+(8*a+4)>>2],void 0);if(l<0){i=-1;break e}o+=l}i=o}return i}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd},function(e,t,i){"use asm";var r=e.Int8Array;var n=e.Int16Array;var s=e.Int32Array;var a=e.Uint8Array;var u=e.Uint16Array;var h=e.Uint32Array;var c=e.Float32Array;var p=e.Float64Array;var de=new r(i);var $=new n(i);var fe=new s(i);var me=new a(i);var _e=new u(i);var d=new h(i);var f=new c(i);var ee=new p(i);var y=e.byteLength;var ge=t.STACKTOP|0;var x=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var T=t.ABORT|0;var w=t.cttz_i8|0;var E=0;var S=0;var A=0;var k=0;var P=e.NaN,O=e.Infinity;var R=0,C=0,M=0,I=0,D=0.0,L=0,H=0,Y=0,W=0.0;var ie=0;var V=0;var q=0;var K=0;var Z=0;var J=0;var Q=0;var le=0;var ue=0;var he=0;var ce=e.Math.floor;var pe=e.Math.abs;var Te=e.Math.sqrt;var we=e.Math.pow;var Ee=e.Math.cos;var Se=e.Math.sin;var Ae=e.Math.tan;var ke=e.Math.acos;var Pe=e.Math.asin;var Oe=e.Math.atan;var Re=e.Math.atan2;var Ce=e.Math.exp;var Me=e.Math.log;var Ie=e.Math.ceil;var ve=e.Math.imul;var De=e.Math.min;var m=e.Math.clz32;var o=t.abort;var Le=t.assert;var Fe=t.invoke_iiii;var Ne=t.invoke_viiiii;var ze=t.invoke_vi;var Be=t.invoke_ii;var Ue=t.invoke_viii;var je=t.invoke_v;var Ge=t.invoke_viiiiii;var Xe=t.invoke_iiiiii;var He=t.invoke_viiii;var Ye=t._pthread_cleanup_pop;var We=t.___syscall54;var Ve=t.___syscall6;var qe=t._emscripten_set_main_loop_timing;var Ke=t.__ZSt18uncaught_exceptionv;var Ze=t.___setErrNo;var z=t._sbrk;var Je=t.___cxa_begin_catch;var Qe=t._emscripten_memcpy_big;var $e=t._sysconf;var et=t._pthread_getspecific;var tt=t._pthread_self;var it=t._pthread_once;var rt=t._pthread_key_create;var nt=t.___unlock;var st=t._emscripten_set_main_loop;var ot=t._pthread_setspecific;var at=t.___lock;var B=t._abort;var lt=t._pthread_cleanup_push;var ut=t._time;var ht=t.___syscall140;var ct=t.___syscall146;var pt=0.0;function dt(e){if(y(e)&16777215||y(e)<=16777215||y(e)>2147483648)return false;de=new r(e);$=new n(e);fe=new s(e);me=new a(e);_e=new u(e);d=new h(e);f=new c(e);ee=new p(e);i=e;return true}function ft(e){e=e|0;var t=0;t=ge;ge=ge+e|0;ge=ge+15&-16;return t|0}function mt(){return ge|0}function _t(e){e=e|0;ge=e}function gt(e,t){e=e|0;t=t|0;ge=e;x=t}function vt(e,t){e=e|0;t=t|0;if(!E){E=e;S=t}}function yt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0]}function bt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0];de[te+4>>0]=de[e+4>>0];de[te+5>>0]=de[e+5>>0];de[te+6>>0]=de[e+6>>0];de[te+7>>0]=de[e+7>>0]}function xt(e){e=e|0;ie=e}function Tt(){return ie|0}function F(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0;m=ge;ge=ge+608|0;p=m+88|0;c=m+72|0;l=m+64|0;a=m+48|0;o=m+24|0;s=m;h=m+96|0;d=m+92|0;u=e+4|0;f=e+8|0;if((fe[u>>2]|0)>>>0>(fe[f>>2]|0)>>>0){fe[s>>2]=1154;fe[s+4>>2]=2120;fe[s+8>>2]=1133;xe(h,1100,s)|0;be(h,m+16|0)|0}if((2147418112/(r>>>0)|0)>>>0<=t>>>0){fe[o>>2]=1154;fe[o+4>>2]=2121;fe[o+8>>2]=1169;xe(h,1100,o)|0;be(h,m+40|0)|0}o=fe[f>>2]|0;if(o>>>0>=t>>>0){f=1;ge=m;return f|0}do{if(i){if(t){s=t+-1|0;if(!(s&t)){s=11;break}else t=s}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;s=10}else s=10}while(0);if((s|0)==10)if(!t){t=0;s=12}else s=11;if((s|0)==11)if(t>>>0<=o>>>0)s=12;if((s|0)==12){fe[a>>2]=1154;fe[a+4>>2]=2130;fe[a+8>>2]=1217;xe(h,1100,a)|0;be(h,l)|0}i=ve(t,r)|0;do{if(!n){s=wt(fe[e>>2]|0,i,d,1)|0;if(!s){f=0;ge=m;return f|0}else{fe[e>>2]=s;break}}else{o=U(i,d)|0;if(!o){f=0;ge=m;return f|0}Cr[n&0](o,fe[e>>2]|0,fe[u>>2]|0);s=fe[e>>2]|0;do{if(s)if(!(s&7)){X[fe[104>>2]&1](s,0,0,1,fe[27]|0)|0;break}else{fe[c>>2]=1154;fe[c+4>>2]=2499;fe[c+8>>2]=1516;xe(h,1100,c)|0;be(h,p)|0;break}}while(0);fe[e>>2]=o}}while(0);s=fe[d>>2]|0;if(s>>>0>i>>>0)t=(s>>>0)/(r>>>0)|0;fe[f>>2]=t;f=1;ge=m;return f|0}function wt(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0;u=ge;ge=ge+592|0;l=u+48|0;s=u+24|0;n=u;a=u+72|0;o=u+68|0;if(e&7){fe[n>>2]=1154;fe[n+4>>2]=2499;fe[n+8>>2]=1494;xe(a,1100,n)|0;be(a,u+16|0)|0;l=0;ge=u;return l|0}if(t>>>0>2147418112){fe[s>>2]=1154;fe[s+4>>2]=2499;fe[s+8>>2]=1387;xe(a,1100,s)|0;be(a,u+40|0)|0;l=0;ge=u;return l|0}fe[o>>2]=t;r=X[fe[104>>2]&1](e,t,o,r,fe[27]|0)|0;if(i)fe[i>>2]=fe[o>>2];if(!(r&7)){l=r;ge=u;return l|0}fe[l>>2]=1154;fe[l+4>>2]=2551;fe[l+8>>2]=1440;xe(a,1100,l)|0;be(a,u+64|0)|0;l=r;ge=u;return l|0}function U(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0;l=ge;ge=ge+592|0;o=l+48|0;a=l+24|0;i=l;s=l+72|0;n=l+68|0;r=e+3&-4;r=(r|0)!=0?r:4;if(r>>>0>2147418112){fe[i>>2]=1154;fe[i+4>>2]=2499;fe[i+8>>2]=1387;xe(s,1100,i)|0;be(s,l+16|0)|0;a=0;ge=l;return a|0}fe[n>>2]=r;i=X[fe[104>>2]&1](0,r,n,1,fe[27]|0)|0;e=fe[n>>2]|0;if(t)fe[t>>2]=e;if((i|0)==0|e>>>0>>0){fe[a>>2]=1154;fe[a+4>>2]=2499;fe[a+8>>2]=1413;xe(s,1100,a)|0;be(s,l+40|0)|0;a=0;ge=l;return a|0}if(!(i&7)){a=i;ge=l;return a|0}fe[o>>2]=1154;fe[o+4>>2]=2526;fe[o+8>>2]=1440;xe(s,1100,o)|0;be(s,l+64|0)|0;a=i;ge=l;return a|0}function Et(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,P=0,O=0,R=0,F=0,C=0,N=0,M=0,z=0,I=0,D=0,L=0;L=ge;ge=ge+960|0;z=L+232|0;M=L+216|0;N=L+208|0;C=L+192|0;F=L+184|0;R=L+168|0;O=L+160|0;P=L+144|0;S=L+136|0;E=L+120|0;w=L+112|0;T=L+96|0;y=L+88|0;v=L+72|0;g=L+64|0;_=L+48|0;c=L+40|0;d=L+24|0;p=L+16|0;h=L;k=L+440|0;I=L+376|0;D=L+304|0;m=L+236|0;if((t|0)==0|r>>>0>11){e=0;ge=L;return e|0}fe[e>>2]=t;n=D;s=n+68|0;do{fe[n>>2]=0;n=n+4|0}while((n|0)<(s|0));s=0;do{n=de[i+s>>0]|0;if(n<<24>>24){A=D+((n&255)<<2)|0;fe[A>>2]=(fe[A>>2]|0)+1}s=s+1|0}while((s|0)!=(t|0));s=0;u=1;o=0;a=-1;l=0;while(1){n=fe[D+(u<<2)>>2]|0;if(!n)fe[e+28+(u+-1<<2)>>2]=0;else{A=u+-1|0;fe[I+(A<<2)>>2]=s;s=n+s|0;x=16-u|0;fe[e+28+(A<<2)>>2]=(s+-1<>2]=l;fe[m+(u<<2)>>2]=l;o=o>>>0>u>>>0?o:u;a=a>>>0
>>0?a:u;l=n+l|0}u=u+1|0;if((u|0)==17){A=o;break}else s=s<<1}fe[e+4>>2]=l;s=e+172|0;do{if(l>>>0>(fe[s>>2]|0)>>>0){fe[s>>2]=l;if(l){n=l+-1|0;if(n&l)f=14}else{n=-1;f=14}if((f|0)==14){x=n>>>16|n;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;fe[s>>2]=x>>>0>t>>>0?t:x}o=e+176|0;n=fe[o>>2]|0;do{if(n){x=fe[n+-4>>2]|0;n=n+-8|0;if(!((x|0)!=0?(x|0)==(~fe[n>>2]|0):0)){fe[h>>2]=1154;fe[h+4>>2]=644;fe[h+8>>2]=1863;xe(k,1100,h)|0;be(k,p)|0}if(!(n&7)){X[fe[104>>2]&1](n,0,0,1,fe[27]|0)|0;break}else{fe[d>>2]=1154;fe[d+4>>2]=2499;fe[d+8>>2]=1516;xe(k,1100,d)|0;be(k,c)|0;break}}}while(0);s=fe[s>>2]|0;s=(s|0)!=0?s:1;n=U((s<<1)+8|0,0)|0;if(!n){fe[o>>2]=0;n=0;break}else{fe[n+4>>2]=s;fe[n>>2]=~s;fe[o>>2]=n+8;f=25;break}}else f=25}while(0);e:do{if((f|0)==25){x=e+24|0;de[x>>0]=a;de[e+25>>0]=A;s=e+176|0;o=0;do{b=de[i+o>>0]|0;n=b&255;if(b<<24>>24){if(!(fe[D+(n<<2)>>2]|0)){fe[_>>2]=1154;fe[_+4>>2]=2273;fe[_+8>>2]=1261;xe(k,1100,_)|0;be(k,g)|0}b=m+(n<<2)|0;n=fe[b>>2]|0;fe[b>>2]=n+1;if(n>>>0>=l>>>0){fe[v>>2]=1154;fe[v+4>>2]=2277;fe[v+8>>2]=1274;xe(k,1100,v)|0;be(k,y)|0}$[(fe[s>>2]|0)+(n<<1)>>1]=o}o=o+1|0}while((o|0)!=(t|0));n=de[x>>0]|0;y=(n&255)>>>0>>0?r:0;b=e+8|0;fe[b>>2]=y;v=(y|0)!=0;if(v){g=1<>>0>(fe[n>>2]|0)>>>0){fe[n>>2]=g;o=e+168|0;n=fe[o>>2]|0;do{if(n){_=fe[n+-4>>2]|0;n=n+-8|0;if(!((_|0)!=0?(_|0)==(~fe[n>>2]|0):0)){fe[T>>2]=1154;fe[T+4>>2]=644;fe[T+8>>2]=1863;xe(k,1100,T)|0;be(k,w)|0}if(!(n&7)){X[fe[104>>2]&1](n,0,0,1,fe[27]|0)|0;break}else{fe[E>>2]=1154;fe[E+4>>2]=2499;fe[E+8>>2]=1516;xe(k,1100,E)|0;be(k,S)|0;break}}}while(0);n=g<<2;s=U(n+8|0,0)|0;if(!s){fe[o>>2]=0;n=0;break e}else{S=s+8|0;fe[s+4>>2]=g;fe[s>>2]=~g;fe[o>>2]=S;s=S;break}}else{s=e+168|0;n=g<<2;o=s;s=fe[s>>2]|0}}while(0);G(s|0,-1,n|0)|0;f=e+176|0;_=1;do{if(fe[D+(_<<2)>>2]|0){t=y-_|0;m=1<>2]|0;if(s>>>0>=16){fe[P>>2]=1154;fe[P+4>>2]=1953;fe[P+8>>2]=1737;xe(k,1100,P)|0;be(k,O)|0}n=fe[e+28+(s<<2)>>2]|0;if(!n)d=-1;else d=(n+-1|0)>>>(16-_|0);if(a>>>0<=d>>>0){c=(fe[e+96+(s<<2)>>2]|0)-a|0;p=_<<16;do{n=_e[(fe[f>>2]|0)+(c+a<<1)>>1]|0;if((me[i+n>>0]|0|0)!=(_|0)){fe[R>>2]=1154;fe[R+4>>2]=2319;fe[R+8>>2]=1303;xe(k,1100,R)|0;be(k,F)|0}h=a<>>0>=g>>>0){fe[C>>2]=1154;fe[C+4>>2]=2325;fe[C+8>>2]=1337;xe(k,1100,C)|0;be(k,N)|0}n=fe[o>>2]|0;if((fe[n+(l<<2)>>2]|0)!=-1){fe[M>>2]=1154;fe[M+4>>2]=2327;fe[M+8>>2]=1360;xe(k,1100,M)|0;be(k,z)|0;n=fe[o>>2]|0}fe[n+(l<<2)>>2]=s;u=u+1|0}while(u>>>0>>0);a=a+1|0}while(a>>>0<=d>>>0)}}_=_+1|0}while(y>>>0>=_>>>0);n=de[x>>0]|0}s=e+96|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I>>2]|0);s=e+100|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+4>>2]|0);s=e+104|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+8>>2]|0);s=e+108|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+12>>2]|0);s=e+112|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+16>>2]|0);s=e+116|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+20>>2]|0);s=e+120|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+24>>2]|0);s=e+124|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+28>>2]|0);s=e+128|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+32>>2]|0);s=e+132|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+36>>2]|0);s=e+136|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+40>>2]|0);s=e+140|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+44>>2]|0);s=e+144|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+48>>2]|0);s=e+148|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+52>>2]|0);s=e+152|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+56>>2]|0);s=e+156|0;fe[s>>2]=(fe[s>>2]|0)-(fe[I+60>>2]|0);s=e+16|0;fe[s>>2]=0;o=e+20|0;fe[o>>2]=n&255;t:do{if(v){while(1){if(!r)break t;n=r+-1|0;if(!(fe[D+(r<<2)>>2]|0))r=n;else break}fe[s>>2]=fe[e+28+(n<<2)>>2];n=y+1|0;fe[o>>2]=n;if(n>>>0<=A>>>0){while(1){if(fe[D+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>A>>>0)break t}fe[o>>2]=n}}}while(0);fe[e+92>>2]=-1;fe[e+160>>2]=1048575;fe[e+12>>2]=32-(fe[b>>2]|0);n=1}}while(0);e=n;ge=L;return e|0}function St(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0;if(!e){n=Yi(t)|0;if(!i){i=n;return i|0}if(!n)s=0;else s=Vi(n)|0;fe[i>>2]=s;i=n;return i|0}if(!t){b(e);if(!i){i=0;return i|0}fe[i>>2]=0;i=0;return i|0}n=Wi(e,t)|0;s=(n|0)!=0;if(s|r^1)s=s?n:e;else{n=Wi(e,t)|0;s=(n|0)==0?e:n}if(!i){i=n;return i|0}t=Vi(s)|0;fe[i>>2]=t;i=n;return i|0}function _(e,t,i){e=e|0;t=t|0;i=i|0;var r=0;if(!((e|0)!=0&t>>>0>73&(i|0)!=0)){i=0;return i|0}if((fe[i>>2]|0)!=40|t>>>0<74){i=0;return i|0}if(((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)!=18552){i=0;return i|0}if(((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0<74){i=0;return i|0}if(((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0>t>>>0){i=0;return i|0}fe[i+4>>2]=(me[e+12>>0]|0)<<8|(me[e+13>>0]|0);fe[i+8>>2]=(me[e+14>>0]|0)<<8|(me[e+15>>0]|0);fe[i+12>>2]=me[e+16>>0];fe[i+16>>2]=me[e+17>>0];t=e+18|0;r=i+32|0;fe[r>>2]=me[t>>0];fe[r+4>>2]=0;t=de[t>>0]|0;fe[i+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;fe[i+24>>2]=(me[e+26>>0]|0)<<16|(me[e+25>>0]|0)<<24|(me[e+27>>0]|0)<<8|(me[e+28>>0]|0);fe[i+28>>2]=(me[e+30>>0]|0)<<16|(me[e+29>>0]|0)<<24|(me[e+31>>0]|0)<<8|(me[e+32>>0]|0);i=1;return i|0}function At(e){e=e|0;Je(e|0)|0;$t()}function N(e){e=e|0;var t=0,i=0,r=0,n=0,s=0;s=ge;ge=ge+544|0;n=s;r=s+24|0;t=fe[e+20>>2]|0;if(t)kt(t);t=e+4|0;i=fe[t>>2]|0;if(!i){n=e+16|0;de[n>>0]=0;ge=s;return}if(!(i&7))X[fe[104>>2]&1](i,0,0,1,fe[27]|0)|0;else{fe[n>>2]=1154;fe[n+4>>2]=2499;fe[n+8>>2]=1516;xe(r,1100,n)|0;be(r,s+16|0)|0}fe[t>>2]=0;fe[e+8>>2]=0;fe[e+12>>2]=0;n=e+16|0;de[n>>0]=0;ge=s}function kt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0;d=ge;ge=ge+640|0;p=d+112|0;c=d+96|0;h=d+88|0;u=d+72|0;l=d+64|0;a=d+48|0;r=d+40|0;s=d+24|0;n=d+16|0;i=d;o=d+120|0;if(!e){ge=d;return}t=fe[e+168>>2]|0;do{if(t){f=fe[t+-4>>2]|0;t=t+-8|0;if(!((f|0)!=0?(f|0)==(~fe[t>>2]|0):0)){fe[i>>2]=1154;fe[i+4>>2]=644;fe[i+8>>2]=1863;xe(o,1100,i)|0;be(o,n)|0}if(!(t&7)){X[fe[104>>2]&1](t,0,0,1,fe[27]|0)|0;break}else{fe[s>>2]=1154;fe[s+4>>2]=2499;fe[s+8>>2]=1516;xe(o,1100,s)|0;be(o,r)|0;break}}}while(0);t=fe[e+176>>2]|0;do{if(t){f=fe[t+-4>>2]|0;t=t+-8|0;if(!((f|0)!=0?(f|0)==(~fe[t>>2]|0):0)){fe[a>>2]=1154;fe[a+4>>2]=644;fe[a+8>>2]=1863;xe(o,1100,a)|0;be(o,l)|0}if(!(t&7)){X[fe[104>>2]&1](t,0,0,1,fe[27]|0)|0;break}else{fe[u>>2]=1154;fe[u+4>>2]=2499;fe[u+8>>2]=1516;xe(o,1100,u)|0;be(o,h)|0;break}}}while(0);if(!(e&7)){X[fe[104>>2]&1](e,0,0,1,fe[27]|0)|0;ge=d}else{fe[c>>2]=1154;fe[c+4>>2]=2499;fe[c+8>>2]=1516;xe(o,1100,c)|0;be(o,p)|0;ge=d}}function Pt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0;h=ge;ge=ge+560|0;o=h+40|0;a=h+24|0;t=h;s=h+48|0;n=e+8|0;i=fe[n>>2]|0;if((i+-1|0)>>>0>=8192){fe[t>>2]=1154;fe[t+4>>2]=2997;fe[t+8>>2]=1541;xe(s,1100,t)|0;be(s,h+16|0)|0}fe[e>>2]=i;r=e+20|0;t=fe[r>>2]|0;if(!t){t=U(180,0)|0;if(!t)t=0;else{u=t+164|0;fe[u>>2]=0;fe[u+4>>2]=0;fe[u+8>>2]=0;fe[u+12>>2]=0}fe[r>>2]=t;u=t;l=fe[e>>2]|0}else{u=t;l=i}if(!(fe[n>>2]|0)){fe[a>>2]=1154;fe[a+4>>2]=903;fe[a+8>>2]=1781;xe(s,1100,a)|0;be(s,o)|0;s=fe[e>>2]|0}else s=l;n=fe[e+4>>2]|0;if(s>>>0>16){i=s;t=0}else{e=0;u=Et(u,l,n,e)|0;ge=h;return u|0}while(1){r=t+1|0;if(i>>>0>3){i=i>>>1;t=r}else{i=r;break}}e=t+2+((i|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;u=Et(u,l,n,e)|0;ge=h;return u|0}function j(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,P=0,O=0,R=0,C=0,M=0,I=0,D=0,L=0;L=ge;ge=ge+800|0;R=L+256|0;O=L+240|0;P=L+232|0;k=L+216|0;A=L+208|0;S=L+192|0;E=L+184|0;w=L+168|0;T=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;v=L+112|0;g=L+96|0;_=L+88|0;m=L+72|0;c=L+64|0;h=L+48|0;a=L+40|0;l=L+24|0;s=L+16|0;n=L;I=L+288|0;D=L+264|0;C=Ot(e,14)|0;if(!C){fe[t>>2]=0;i=t+4|0;r=fe[i>>2]|0;if(r){if(!(r&7))X[fe[104>>2]&1](r,0,0,1,fe[27]|0)|0;else{fe[n>>2]=1154;fe[n+4>>2]=2499;fe[n+8>>2]=1516;xe(I,1100,n)|0;be(I,s)|0}fe[i>>2]=0;fe[t+8>>2]=0;fe[t+12>>2]=0}de[t+16>>0]=0;i=t+20|0;r=fe[i>>2]|0;if(!r){t=1;ge=L;return t|0}kt(r);fe[i>>2]=0;t=1;ge=L;return t|0}d=t+4|0;f=t+8|0;i=fe[f>>2]|0;if((i|0)!=(C|0)){if(i>>>0<=C>>>0){do{if((fe[t+12>>2]|0)>>>0>>0){if(F(d,C,(i+1|0)==(C|0),1,0)|0){i=fe[f>>2]|0;break}de[t+16>>0]=1;t=0;ge=L;return t|0}}while(0);G((fe[d>>2]|0)+i|0,0,C-i|0)|0}fe[f>>2]=C}G(fe[d>>2]|0,0,C|0)|0;p=e+20|0;i=fe[p>>2]|0;if((i|0)<5){s=e+4|0;o=e+8|0;n=e+16|0;do{r=fe[s>>2]|0;if((r|0)==(fe[o>>2]|0))r=0;else{fe[s>>2]=r+1;r=me[r>>0]|0}i=i+8|0;fe[p>>2]=i;if((i|0)>=33){fe[l>>2]=1154;fe[l+4>>2]=3199;fe[l+8>>2]=1650;xe(I,1100,l)|0;be(I,a)|0;i=fe[p>>2]|0}r=r<<32-i|fe[n>>2];fe[n>>2]=r}while((i|0)<5)}else{r=e+16|0;n=r;r=fe[r>>2]|0}u=r>>>27;fe[n>>2]=r<<5;fe[p>>2]=i+-5;if((u+-1|0)>>>0>20){t=0;ge=L;return t|0}fe[D+20>>2]=0;fe[D>>2]=0;fe[D+4>>2]=0;fe[D+8>>2]=0;fe[D+12>>2]=0;de[D+16>>0]=0;i=D+4|0;r=D+8|0;e:do{if(F(i,21,0,1,0)|0){a=fe[r>>2]|0;l=fe[i>>2]|0;G(l+a|0,0,21-a|0)|0;fe[r>>2]=21;if(u){n=e+4|0;s=e+8|0;o=e+16|0;a=0;do{i=fe[p>>2]|0;if((i|0)<3)do{r=fe[n>>2]|0;if((r|0)==(fe[s>>2]|0))r=0;else{fe[n>>2]=r+1;r=me[r>>0]|0}i=i+8|0;fe[p>>2]=i;if((i|0)>=33){fe[h>>2]=1154;fe[h+4>>2]=3199;fe[h+8>>2]=1650;xe(I,1100,h)|0;be(I,c)|0;i=fe[p>>2]|0}r=r<<32-i|fe[o>>2];fe[o>>2]=r}while((i|0)<3);else r=fe[o>>2]|0;fe[o>>2]=r<<3;fe[p>>2]=i+-3;de[l+(me[1611+a>>0]|0)>>0]=r>>>29;a=a+1|0}while((a|0)!=(u|0))}if(Pt(D)|0){a=e+4|0;l=e+8|0;u=e+16|0;r=0;t:while(1){o=C-r|0;i=ye(e,D)|0;i:do{if(i>>>0<17){if((fe[f>>2]|0)>>>0<=r>>>0){fe[m>>2]=1154;fe[m+4>>2]=903;fe[m+8>>2]=1781;xe(I,1100,m)|0;be(I,_)|0}de[(fe[d>>2]|0)+r>>0]=i;i=r+1|0}else switch(i|0){case 17:{i=fe[p>>2]|0;if((i|0)<3)do{n=fe[a>>2]|0;if((n|0)==(fe[l>>2]|0))n=0;else{fe[a>>2]=n+1;n=me[n>>0]|0}i=i+8|0;fe[p>>2]=i;if((i|0)>=33){fe[g>>2]=1154;fe[g+4>>2]=3199;fe[g+8>>2]=1650;xe(I,1100,g)|0;be(I,v)|0;i=fe[p>>2]|0}n=n<<32-i|fe[u>>2];fe[u>>2]=n}while((i|0)<3);else n=fe[u>>2]|0;fe[u>>2]=n<<3;fe[p>>2]=i+-3;i=(n>>>29)+3|0;if(i>>>0>o>>>0){i=0;break e}i=i+r|0;break i}case 18:{i=fe[p>>2]|0;if((i|0)<7)do{n=fe[a>>2]|0;if((n|0)==(fe[l>>2]|0))n=0;else{fe[a>>2]=n+1;n=me[n>>0]|0}i=i+8|0;fe[p>>2]=i;if((i|0)>=33){fe[y>>2]=1154;fe[y+4>>2]=3199;fe[y+8>>2]=1650;xe(I,1100,y)|0;be(I,b)|0;i=fe[p>>2]|0}n=n<<32-i|fe[u>>2];fe[u>>2]=n}while((i|0)<7);else n=fe[u>>2]|0;fe[u>>2]=n<<7;fe[p>>2]=i+-7;i=(n>>>25)+11|0;if(i>>>0>o>>>0){i=0;break e}i=i+r|0;break i}default:{if((i+-19|0)>>>0>=2){M=90;break t}s=fe[p>>2]|0;if((i|0)==19){if((s|0)<2){n=s;while(1){i=fe[a>>2]|0;if((i|0)==(fe[l>>2]|0))s=0;else{fe[a>>2]=i+1;s=me[i>>0]|0}i=n+8|0;fe[p>>2]=i;if((i|0)>=33){fe[x>>2]=1154;fe[x+4>>2]=3199;fe[x+8>>2]=1650;xe(I,1100,x)|0;be(I,T)|0;i=fe[p>>2]|0}n=s<<32-i|fe[u>>2];fe[u>>2]=n;if((i|0)<2)n=i;else break}}else{n=fe[u>>2]|0;i=s}fe[u>>2]=n<<2;fe[p>>2]=i+-2;s=(n>>>30)+3|0}else{if((s|0)<6){n=s;while(1){i=fe[a>>2]|0;if((i|0)==(fe[l>>2]|0))s=0;else{fe[a>>2]=i+1;s=me[i>>0]|0}i=n+8|0;fe[p>>2]=i;if((i|0)>=33){fe[w>>2]=1154;fe[w+4>>2]=3199;fe[w+8>>2]=1650;xe(I,1100,w)|0;be(I,E)|0;i=fe[p>>2]|0}n=s<<32-i|fe[u>>2];fe[u>>2]=n;if((i|0)<6)n=i;else break}}else{n=fe[u>>2]|0;i=s}fe[u>>2]=n<<6;fe[p>>2]=i+-6;s=(n>>>26)+7|0}if((r|0)==0|s>>>0>o>>>0){i=0;break e}i=r+-1|0;if((fe[f>>2]|0)>>>0<=i>>>0){fe[S>>2]=1154;fe[S+4>>2]=903;fe[S+8>>2]=1781;xe(I,1100,S)|0;be(I,A)|0}n=de[(fe[d>>2]|0)+i>>0]|0;if(!(n<<24>>24)){i=0;break e}i=s+r|0;if(r>>>0>=i>>>0){i=r;break i}do{if((fe[f>>2]|0)>>>0<=r>>>0){fe[k>>2]=1154;fe[k+4>>2]=903;fe[k+8>>2]=1781;xe(I,1100,k)|0;be(I,P)|0}de[(fe[d>>2]|0)+r>>0]=n;r=r+1|0}while((r|0)!=(i|0))}}}while(0);if(C>>>0>i>>>0)r=i;else break}if((M|0)==90){fe[O>>2]=1154;fe[O+4>>2]=3140;fe[O+8>>2]=1632;xe(I,1100,O)|0;be(I,R)|0;i=0;break}if((C|0)==(i|0))i=Pt(t)|0;else i=0}else i=0}else{de[D+16>>0]=1;i=0}}while(0);N(D);t=i;ge=L;return t|0}function Ot(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0;h=ge;ge=ge+544|0;a=h+16|0;o=h;s=h+24|0;if(!t){u=0;ge=h;return u|0}if(t>>>0<=16){u=Rt(e,t)|0;ge=h;return u|0}l=Rt(e,t+-16|0)|0;u=e+20|0;t=fe[u>>2]|0;if((t|0)<16){r=e+4|0;n=e+8|0;i=e+16|0;do{e=fe[r>>2]|0;if((e|0)==(fe[n>>2]|0))e=0;else{fe[r>>2]=e+1;e=me[e>>0]|0}t=t+8|0;fe[u>>2]=t;if((t|0)>=33){fe[o>>2]=1154;fe[o+4>>2]=3199;fe[o+8>>2]=1650;xe(s,1100,o)|0;be(s,a)|0;t=fe[u>>2]|0}e=e<<32-t|fe[i>>2];fe[i>>2]=e}while((t|0)<16)}else{e=e+16|0;i=e;e=fe[e>>2]|0}fe[i>>2]=e<<16;fe[u>>2]=t+-16;u=e>>>16|l<<16;ge=h;return u|0}function ye(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0;y=ge;ge=ge+608|0;m=y+88|0;f=y+72|0;p=y+64|0;c=y+48|0;h=y+40|0;d=y+24|0;u=y+16|0;l=y;g=y+96|0;_=fe[t+20>>2]|0;v=e+20|0;a=fe[v>>2]|0;do{if((a|0)<24){o=e+4|0;r=fe[o>>2]|0;n=fe[e+8>>2]|0;i=r>>>0>>0;if((a|0)>=16){if(i){fe[o>>2]=r+1;i=me[r>>0]|0}else i=0;fe[v>>2]=a+8;o=e+16|0;s=i<<24-a|fe[o>>2];fe[o>>2]=s;break}if(i){s=(me[r>>0]|0)<<8;i=r+1|0}else{s=0;i=r}if(i>>>0>>0){r=me[i>>0]|0;i=i+1|0}else r=0;fe[o>>2]=i;fe[v>>2]=a+16;o=e+16|0;s=(r|s)<<16-a|fe[o>>2];fe[o>>2]=s}else{s=e+16|0;o=s;s=fe[s>>2]|0}}while(0);n=(s>>>16)+1|0;do{if(n>>>0<=(fe[_+16>>2]|0)>>>0){r=fe[(fe[_+168>>2]|0)+(s>>>(32-(fe[_+8>>2]|0)|0)<<2)>>2]|0;if((r|0)==-1){fe[l>>2]=1154;fe[l+4>>2]=3244;fe[l+8>>2]=1677;xe(g,1100,l)|0;be(g,u)|0}i=r&65535;r=r>>>16;if((fe[t+8>>2]|0)>>>0<=i>>>0){fe[d>>2]=1154;fe[d+4>>2]=902;fe[d+8>>2]=1781;xe(g,1100,d)|0;be(g,h)|0}if((me[(fe[t+4>>2]|0)+i>>0]|0|0)!=(r|0)){fe[c>>2]=1154;fe[c+4>>2]=3248;fe[c+8>>2]=1694;xe(g,1100,c)|0;be(g,p)|0}}else{r=fe[_+20>>2]|0;while(1){i=r+-1|0;if(n>>>0>(fe[_+28+(i<<2)>>2]|0)>>>0)r=r+1|0;else break}i=(s>>>(32-r|0))+(fe[_+96+(i<<2)>>2]|0)|0;if(i>>>0<(fe[t>>2]|0)>>>0){i=_e[(fe[_+176>>2]|0)+(i<<1)>>1]|0;break}fe[f>>2]=1154;fe[f+4>>2]=3266;fe[f+8>>2]=1632;xe(g,1100,f)|0;be(g,m)|0;v=0;ge=y;return v|0}}while(0);fe[o>>2]=fe[o>>2]<>2]=(fe[v>>2]|0)-r;v=i;ge=y;return v|0}function Rt(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0;h=ge;ge=ge+560|0;a=h+40|0;l=h+24|0;i=h;o=h+48|0;if(t>>>0>=33){fe[i>>2]=1154;fe[i+4>>2]=3190;fe[i+8>>2]=1634;xe(o,1100,i)|0;be(o,h+16|0)|0}u=e+20|0;i=fe[u>>2]|0;if((i|0)>=(t|0)){s=e+16|0;o=s;s=fe[s>>2]|0;a=i;l=32-t|0;l=s>>>l;s=s<>2]=s;t=a-t|0;fe[u>>2]=t;ge=h;return l|0}n=e+4|0;s=e+8|0;r=e+16|0;do{e=fe[n>>2]|0;if((e|0)==(fe[s>>2]|0))e=0;else{fe[n>>2]=e+1;e=me[e>>0]|0}i=i+8|0;fe[u>>2]=i;if((i|0)>=33){fe[l>>2]=1154;fe[l+4>>2]=3199;fe[l+8>>2]=1650;xe(o,1100,l)|0;be(o,a)|0;i=fe[u>>2]|0}e=e<<32-i|fe[r>>2];fe[r>>2]=e}while((i|0)<(t|0));l=32-t|0;l=e>>>l;a=e<>2]=a;t=i-t|0;fe[u>>2]=t;ge=h;return l|0}function Ct(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0;f=ge;ge=ge+544|0;p=f+16|0;c=f;h=f+24|0;if((e|0)==0|t>>>0<62){d=0;ge=f;return d|0}u=U(300,0)|0;if(!u){d=0;ge=f;return d|0}fe[u>>2]=519686845;i=u+4|0;fe[i>>2]=0;r=u+8|0;fe[r>>2]=0;l=u+88|0;n=u+136|0;s=u+160|0;o=l;a=o+44|0;do{fe[o>>2]=0;o=o+4|0}while((o|0)<(a|0));de[l+44>>0]=0;m=u+184|0;o=u+208|0;a=u+232|0;_=u+252|0;fe[_>>2]=0;fe[_+4>>2]=0;fe[_+8>>2]=0;de[_+12>>0]=0;_=u+268|0;fe[_>>2]=0;fe[_+4>>2]=0;fe[_+8>>2]=0;de[_+12>>0]=0;_=u+284|0;fe[_>>2]=0;fe[_+4>>2]=0;fe[_+8>>2]=0;de[_+12>>0]=0;fe[n>>2]=0;fe[n+4>>2]=0;fe[n+8>>2]=0;fe[n+12>>2]=0;fe[n+16>>2]=0;de[n+20>>0]=0;fe[s>>2]=0;fe[s+4>>2]=0;fe[s+8>>2]=0;fe[s+12>>2]=0;fe[s+16>>2]=0;de[s+20>>0]=0;fe[m>>2]=0;fe[m+4>>2]=0;fe[m+8>>2]=0;fe[m+12>>2]=0;fe[m+16>>2]=0;de[m+20>>0]=0;fe[o>>2]=0;fe[o+4>>2]=0;fe[o+8>>2]=0;fe[o+12>>2]=0;fe[o+16>>2]=0;de[o+20>>0]=0;fe[a>>2]=0;fe[a+4>>2]=0;fe[a+8>>2]=0;fe[a+12>>2]=0;de[a+16>>0]=0;do{if(((t>>>0>=74?((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)==18552:0)?((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0>=74:0)?((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0<=t>>>0:0){fe[l>>2]=e;fe[i>>2]=e;fe[r>>2]=t;if(Ut(u)|0){i=fe[l>>2]|0;if((me[i+39>>0]|0)<<8|(me[i+40>>0]|0)){if(!(jt(u)|0))break;if(!(Gt(u)|0))break;i=fe[l>>2]|0}if(!((me[i+55>>0]|0)<<8|(me[i+56>>0]|0))){_=u;ge=f;return _|0}if(Xt(u)|0?Ht(u)|0:0){_=u;ge=f;return _|0}}}else d=7}while(0);if((d|0)==7)fe[l>>2]=0;Kt(u);if(!(u&7)){X[fe[104>>2]&1](u,0,0,1,fe[27]|0)|0;_=0;ge=f;return _|0}else{fe[c>>2]=1154;fe[c+4>>2]=2499;fe[c+8>>2]=1516;xe(h,1100,c)|0;be(h,p)|0;_=0;ge=f;return _|0}return 0}function Mt(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0,u=0,h=0;h=ge;ge=ge+544|0;u=h;l=h+24|0;s=fe[e+88>>2]|0;a=(me[s+70+(n<<2)+1>>0]|0)<<16|(me[s+70+(n<<2)>>0]|0)<<24|(me[s+70+(n<<2)+2>>0]|0)<<8|(me[s+70+(n<<2)+3>>0]|0);o=n+1|0;if(o>>>0<(me[s+16>>0]|0)>>>0)s=(me[s+70+(o<<2)+1>>0]|0)<<16|(me[s+70+(o<<2)>>0]|0)<<24|(me[s+70+(o<<2)+2>>0]|0)<<8|(me[s+70+(o<<2)+3>>0]|0);else s=fe[e+8>>2]|0;if(s>>>0>a>>>0){l=e+4|0;l=fe[l>>2]|0;l=l+a|0;u=s-a|0;u=It(e,l,u,t,i,r,n)|0;ge=h;return u|0}fe[u>>2]=1154;fe[u+4>>2]=3704;fe[u+8>>2]=1792;xe(l,1100,u)|0;be(l,h+16|0)|0;l=e+4|0;l=fe[l>>2]|0;l=l+a|0;u=s-a|0;u=It(e,l,u,t,i,r,n)|0;ge=h;return u|0}function It(e,t,i,r,n,s,o){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o=o|0;var a=0,l=0,u=0,h=0;h=fe[e+88>>2]|0;l=((me[h+12>>0]|0)<<8|(me[h+13>>0]|0))>>>o;u=((me[h+14>>0]|0)<<8|(me[h+15>>0]|0))>>>o;l=l>>>0>1?(l+3|0)>>>2:1;u=u>>>0>1?(u+3|0)>>>2:1;h=h+18|0;o=de[h>>0]|0;o=ve(o<<24>>24==0|o<<24>>24==9?8:16,l)|0;if(s)if((s&3|0)==0&o>>>0<=s>>>0)o=s;else{e=0;return e|0}if((ve(o,u)|0)>>>0>n>>>0){e=0;return e|0}s=(l+1|0)>>>1;a=(u+1|0)>>>1;if(!i){e=0;return e|0}fe[e+92>>2]=t;fe[e+96>>2]=t;fe[e+104>>2]=i;fe[e+100>>2]=t+i;fe[e+108>>2]=0;fe[e+112>>2]=0;switch(me[h>>0]|0|0){case 0:{Yt(e,r,n,o,l,u,s,a)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Wt(e,r,n,o,l,u,s,a)|0;e=1;return e|0}case 9:{Vt(e,r,n,o,l,u,s,a)|0;e=1;return e|0}case 8:case 7:{qt(e,r,n,o,l,u,s,a)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function Dt(e,t){e=e|0;t=t|0;var i=0,r=0;r=ge;ge=ge+48|0;i=r;fe[i>>2]=40;_(e,t,i)|0;ge=r;return fe[i+4>>2]|0}function Lt(e,t){e=e|0;t=t|0;var i=0,r=0;r=ge;ge=ge+48|0;i=r;fe[i>>2]=40;_(e,t,i)|0;ge=r;return fe[i+8>>2]|0}function Ft(e,t){e=e|0;t=t|0;var i=0,r=0;r=ge;ge=ge+48|0;i=r;fe[i>>2]=40;_(e,t,i)|0;ge=r;return fe[i+12>>2]|0}function Nt(e,t){e=e|0;t=t|0;var i=0,r=0;r=ge;ge=ge+48|0;i=r;fe[i>>2]=40;_(e,t,i)|0;ge=r;return fe[i+32>>2]|0}function zt(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0,a=0,l=0,u=0;l=ge;ge=ge+576|0;o=l+56|0;s=l+40|0;n=l+64|0;u=l;fe[u>>2]=40;_(e,t,u)|0;r=(((fe[u+4>>2]|0)>>>i)+3|0)>>>2;t=(((fe[u+8>>2]|0)>>>i)+3|0)>>>2;i=u+32|0;e=fe[i+4>>2]|0;do{switch(fe[i>>2]|0){case 0:{if(!e)e=8;else a=13;break}case 1:{if(!e)a=12;else a=13;break}case 2:{if(!e)a=12;else a=13;break}case 3:{if(!e)a=12;else a=13;break}case 4:{if(!e)a=12;else a=13;break}case 5:{if(!e)a=12;else a=13;break}case 6:{if(!e)a=12;else a=13;break}case 7:{if(!e)a=12;else a=13;break}case 8:{if(!e)a=12;else a=13;break}case 9:{if(!e)e=8;else a=13;break}default:a=13}}while(0);if((a|0)==12)e=16;else if((a|0)==13){fe[s>>2]=1154;fe[s+4>>2]=2663;fe[s+8>>2]=1535;xe(n,1100,s)|0;be(n,o)|0;e=0}u=ve(ve(t,r)|0,e)|0;ge=l;return u|0}function Bt(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0;f=ge;ge=ge+608|0;p=f+80|0;d=f+64|0;a=f+56|0;o=f+40|0;h=f+88|0;m=f;c=f+84|0;fe[m>>2]=40;_(e,t,m)|0;l=(((fe[m+4>>2]|0)>>>n)+3|0)>>>2;m=m+32|0;s=fe[m+4>>2]|0;do{switch(fe[m>>2]|0){case 0:{if(!s)s=8;else u=13;break}case 1:{if(!s)u=12;else u=13;break}case 2:{if(!s)u=12;else u=13;break}case 3:{if(!s)u=12;else u=13;break}case 4:{if(!s)u=12;else u=13;break}case 5:{if(!s)u=12;else u=13;break}case 6:{if(!s)u=12;else u=13;break}case 7:{if(!s)u=12;else u=13;break}case 8:{if(!s)u=12;else u=13;break}case 9:{if(!s)s=8;else u=13;break}default:u=13}}while(0);if((u|0)==12)s=16;else if((u|0)==13){fe[o>>2]=1154;fe[o+4>>2]=2663;fe[o+8>>2]=1535;xe(h,1100,o)|0;be(h,a)|0;s=0}a=ve(s,l)|0;o=Ct(e,t)|0;fe[c>>2]=i;s=(o|0)==0;if(!(n>>>0>15|(r>>>0<8|s))?(fe[o>>2]|0)==519686845:0)Mt(o,c,r,a,n)|0;if(s){ge=f;return}if((fe[o>>2]|0)!=519686845){ge=f;return}Kt(o);if(!(o&7)){X[fe[104>>2]&1](o,0,0,1,fe[27]|0)|0;ge=f;return}else{fe[d>>2]=1154;fe[d+4>>2]=2499;fe[d+8>>2]=1516;xe(h,1100,d)|0;be(h,p)|0;ge=f;return}}function Ut(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0;o=e+92|0;r=fe[e+4>>2]|0;s=e+88|0;n=fe[s>>2]|0;t=(me[n+68>>0]|0)<<8|(me[n+67>>0]|0)<<16|(me[n+69>>0]|0);i=r+t|0;n=(me[n+65>>0]|0)<<8|(me[n+66>>0]|0);if(!n){e=0;return e|0}fe[o>>2]=i;fe[e+96>>2]=i;fe[e+104>>2]=n;fe[e+100>>2]=r+(n+t);fe[e+108>>2]=0;fe[e+112>>2]=0;if(!(j(o,e+116|0)|0)){e=0;return e|0}t=fe[s>>2]|0;do{if(!((me[t+39>>0]|0)<<8|(me[t+40>>0]|0))){if(!((me[t+55>>0]|0)<<8|(me[t+56>>0]|0))){e=0;return e|0}}else{if(!(j(o,e+140|0)|0)){e=0;return e|0}if(j(o,e+188|0)|0){t=fe[s>>2]|0;break}else{e=0;return e|0}}}while(0);if((me[t+55>>0]|0)<<8|(me[t+56>>0]|0)){if(!(j(o,e+164|0)|0)){e=0;return e|0}if(!(j(o,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function jt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0;f=ge;ge=ge+592|0;l=f+16|0;a=f;o=f+72|0;d=f+24|0;r=e+88|0;t=fe[r>>2]|0;p=(me[t+39>>0]|0)<<8|(me[t+40>>0]|0);h=e+236|0;s=e+240|0;i=fe[s>>2]|0;if((i|0)!=(p|0)){if(i>>>0<=p>>>0){do{if((fe[e+244>>2]|0)>>>0

>>0){if(F(h,p,(i+1|0)==(p|0),4,0)|0){t=fe[s>>2]|0;break}de[e+248>>0]=1;d=0;ge=f;return d|0}else t=i}while(0);G((fe[h>>2]|0)+(t<<2)|0,0,p-t<<2|0)|0;t=fe[r>>2]|0}fe[s>>2]=p}u=e+92|0;i=fe[e+4>>2]|0;r=(me[t+34>>0]|0)<<8|(me[t+33>>0]|0)<<16|(me[t+35>>0]|0);n=i+r|0;t=(me[t+37>>0]|0)<<8|(me[t+36>>0]|0)<<16|(me[t+38>>0]|0);if(!t){d=0;ge=f;return d|0}fe[u>>2]=n;fe[e+96>>2]=n;fe[e+104>>2]=t;fe[e+100>>2]=i+(t+r);fe[e+108>>2]=0;fe[e+112>>2]=0;fe[d+20>>2]=0;fe[d>>2]=0;fe[d+4>>2]=0;fe[d+8>>2]=0;fe[d+12>>2]=0;de[d+16>>0]=0;e=d+24|0;fe[d+44>>2]=0;fe[e>>2]=0;fe[e+4>>2]=0;fe[e+8>>2]=0;fe[e+12>>2]=0;de[e+16>>0]=0;if(j(u,d)|0?(c=d+24|0,j(u,c)|0):0){if(!(fe[s>>2]|0)){fe[a>>2]=1154;fe[a+4>>2]=903;fe[a+8>>2]=1781;xe(o,1100,a)|0;be(o,l)|0}if(!p)t=1;else{r=0;n=0;s=0;t=0;o=0;e=0;a=0;i=fe[h>>2]|0;while(1){r=(ye(u,d)|0)+r&31;n=(ye(u,c)|0)+n&63;s=(ye(u,d)|0)+s&31;t=(ye(u,d)|0)+t|0;o=(ye(u,c)|0)+o&63;e=(ye(u,d)|0)+e&31;fe[i>>2]=n<<5|r<<11|s|t<<27|o<<21|e<<16;a=a+1|0;if((a|0)==(p|0)){t=1;break}else{t=t&31;i=i+4|0}}}}else t=0;N(d+24|0);N(d);d=t;ge=f;return d|0}function Gt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0;S=ge;ge=ge+1024|0;a=S+16|0;o=S;s=S+504|0;E=S+480|0;T=S+284|0;w=S+88|0;x=S+24|0;n=fe[e+88>>2]|0;b=(me[n+47>>0]|0)<<8|(me[n+48>>0]|0);y=e+92|0;t=fe[e+4>>2]|0;i=(me[n+42>>0]|0)<<8|(me[n+41>>0]|0)<<16|(me[n+43>>0]|0);r=t+i|0;n=(me[n+45>>0]|0)<<8|(me[n+44>>0]|0)<<16|(me[n+46>>0]|0);if(!n){E=0;ge=S;return E|0}fe[y>>2]=r;fe[e+96>>2]=r;fe[e+104>>2]=n;fe[e+100>>2]=t+(n+i);fe[e+108>>2]=0;fe[e+112>>2]=0;fe[E+20>>2]=0;fe[E>>2]=0;fe[E+4>>2]=0;fe[E+8>>2]=0;fe[E+12>>2]=0;de[E+16>>0]=0;if(j(y,E)|0){i=0;r=-3;n=-3;while(1){fe[T+(i<<2)>>2]=r;fe[w+(i<<2)>>2]=n;t=(r|0)>2;i=i+1|0;if((i|0)==49)break;else{r=t?-3:r+1|0;n=(t&1)+n|0}}t=x;i=t+64|0;do{fe[t>>2]=0;t=t+4|0}while((t|0)<(i|0));v=e+252|0;i=e+256|0;t=fe[i>>2]|0;e:do{if((t|0)==(b|0))l=13;else{if(t>>>0<=b>>>0){do{if((fe[e+260>>2]|0)>>>0>>0)if(F(v,b,(t+1|0)==(b|0),4,0)|0){t=fe[i>>2]|0;break}else{de[e+264>>0]=1;t=0;break e}}while(0);G((fe[v>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}fe[i>>2]=b;l=13}}while(0);do{if((l|0)==13){if(!b){fe[o>>2]=1154;fe[o+4>>2]=903;fe[o+8>>2]=1781;xe(s,1100,o)|0;be(s,a)|0;t=1;break}r=x+4|0;n=x+8|0;e=x+12|0;s=x+16|0;o=x+20|0;a=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;p=x+44|0;d=x+48|0;f=x+52|0;m=x+56|0;_=x+60|0;g=0;i=fe[v>>2]|0;while(1){t=0;do{A=ye(y,E)|0;v=t<<1;k=x+(v<<2)|0;fe[k>>2]=(fe[k>>2]|0)+(fe[T+(A<<2)>>2]|0)&3;v=x+((v|1)<<2)|0;fe[v>>2]=(fe[v>>2]|0)+(fe[w+(A<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);fe[i>>2]=(me[1725+(fe[r>>2]|0)>>0]|0)<<2|(me[1725+(fe[x>>2]|0)>>0]|0)|(me[1725+(fe[n>>2]|0)>>0]|0)<<4|(me[1725+(fe[e>>2]|0)>>0]|0)<<6|(me[1725+(fe[s>>2]|0)>>0]|0)<<8|(me[1725+(fe[o>>2]|0)>>0]|0)<<10|(me[1725+(fe[a>>2]|0)>>0]|0)<<12|(me[1725+(fe[l>>2]|0)>>0]|0)<<14|(me[1725+(fe[u>>2]|0)>>0]|0)<<16|(me[1725+(fe[h>>2]|0)>>0]|0)<<18|(me[1725+(fe[c>>2]|0)>>0]|0)<<20|(me[1725+(fe[p>>2]|0)>>0]|0)<<22|(me[1725+(fe[d>>2]|0)>>0]|0)<<24|(me[1725+(fe[f>>2]|0)>>0]|0)<<26|(me[1725+(fe[m>>2]|0)>>0]|0)<<28|(me[1725+(fe[_>>2]|0)>>0]|0)<<30;g=g+1|0;if((g|0)==(b|0)){t=1;break}else i=i+4|0}}}while(0)}else t=0;N(E);k=t;ge=S;return k|0}function Xt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0;p=ge;ge=ge+560|0;l=p+16|0;a=p;o=p+48|0;c=p+24|0;n=fe[e+88>>2]|0;h=(me[n+55>>0]|0)<<8|(me[n+56>>0]|0);u=e+92|0;t=fe[e+4>>2]|0;i=(me[n+50>>0]|0)<<8|(me[n+49>>0]|0)<<16|(me[n+51>>0]|0);r=t+i|0;n=(me[n+53>>0]|0)<<8|(me[n+52>>0]|0)<<16|(me[n+54>>0]|0);if(!n){c=0;ge=p;return c|0}fe[u>>2]=r;fe[e+96>>2]=r;fe[e+104>>2]=n;fe[e+100>>2]=t+(n+i);fe[e+108>>2]=0;fe[e+112>>2]=0;fe[c+20>>2]=0;fe[c>>2]=0;fe[c+4>>2]=0;fe[c+8>>2]=0;fe[c+12>>2]=0;de[c+16>>0]=0;e:do{if(j(u,c)|0){s=e+268|0;i=e+272|0;t=fe[i>>2]|0;if((t|0)!=(h|0)){if(t>>>0<=h>>>0){do{if((fe[e+276>>2]|0)>>>0>>0)if(F(s,h,(t+1|0)==(h|0),2,0)|0){t=fe[i>>2]|0;break}else{de[e+280>>0]=1;t=0;break e}}while(0);G((fe[s>>2]|0)+(t<<1)|0,0,h-t<<1|0)|0}fe[i>>2]=h}if(!h){fe[a>>2]=1154;fe[a+4>>2]=903;fe[a+8>>2]=1781;xe(o,1100,a)|0;be(o,l)|0;t=1;break}i=0;r=0;n=0;t=fe[s>>2]|0;while(1){l=ye(u,c)|0;i=l+i&255;r=(ye(u,c)|0)+r&255;$[t>>1]=r<<8|i;n=n+1|0;if((n|0)==(h|0)){t=1;break}else t=t+2|0}}else t=0}while(0);N(c);c=t;ge=p;return c|0}function Ht(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0;S=ge;ge=ge+2432|0;a=S+16|0;o=S;s=S+1912|0;E=S+1888|0;T=S+988|0;w=S+88|0;x=S+24|0;n=fe[e+88>>2]|0;b=(me[n+63>>0]|0)<<8|(me[n+64>>0]|0);y=e+92|0;t=fe[e+4>>2]|0;i=(me[n+58>>0]|0)<<8|(me[n+57>>0]|0)<<16|(me[n+59>>0]|0);r=t+i|0;n=(me[n+61>>0]|0)<<8|(me[n+60>>0]|0)<<16|(me[n+62>>0]|0);if(!n){E=0;ge=S;return E|0}fe[y>>2]=r;fe[e+96>>2]=r;fe[e+104>>2]=n;fe[e+100>>2]=t+(n+i);fe[e+108>>2]=0;fe[e+112>>2]=0;fe[E+20>>2]=0;fe[E>>2]=0;fe[E+4>>2]=0;fe[E+8>>2]=0;fe[E+12>>2]=0;de[E+16>>0]=0;if(j(y,E)|0){i=0;r=-7;n=-7;while(1){fe[T+(i<<2)>>2]=r;fe[w+(i<<2)>>2]=n;t=(r|0)>6;i=i+1|0;if((i|0)==225)break;else{r=t?-7:r+1|0;n=(t&1)+n|0}}t=x;i=t+64|0;do{fe[t>>2]=0;t=t+4|0}while((t|0)<(i|0));v=e+284|0;i=b*3|0;r=e+288|0;t=fe[r>>2]|0;e:do{if((t|0)==(i|0))l=13;else{if(t>>>0<=i>>>0){do{if((fe[e+292>>2]|0)>>>0>>0)if(F(v,i,(t+1|0)==(i|0),2,0)|0){t=fe[r>>2]|0;break}else{de[e+296>>0]=1;t=0;break e}}while(0);G((fe[v>>2]|0)+(t<<1)|0,0,i-t<<1|0)|0}fe[r>>2]=i;l=13}}while(0);do{if((l|0)==13){if(!b){fe[o>>2]=1154;fe[o+4>>2]=903;fe[o+8>>2]=1781;xe(s,1100,o)|0;be(s,a)|0;t=1;break}r=x+4|0;n=x+8|0;e=x+12|0;s=x+16|0;o=x+20|0;a=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;p=x+44|0;d=x+48|0;f=x+52|0;m=x+56|0;_=x+60|0;g=0;i=fe[v>>2]|0;while(1){t=0;do{A=ye(y,E)|0;v=t<<1;k=x+(v<<2)|0;fe[k>>2]=(fe[k>>2]|0)+(fe[T+(A<<2)>>2]|0)&7;v=x+((v|1)<<2)|0;fe[v>>2]=(fe[v>>2]|0)+(fe[w+(A<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);A=me[1729+(fe[o>>2]|0)>>0]|0;$[i>>1]=(me[1729+(fe[r>>2]|0)>>0]|0)<<3|(me[1729+(fe[x>>2]|0)>>0]|0)|(me[1729+(fe[n>>2]|0)>>0]|0)<<6|(me[1729+(fe[e>>2]|0)>>0]|0)<<9|(me[1729+(fe[s>>2]|0)>>0]|0)<<12|A<<15;k=me[1729+(fe[c>>2]|0)>>0]|0;$[i+2>>1]=(me[1729+(fe[a>>2]|0)>>0]|0)<<2|A>>>1|(me[1729+(fe[l>>2]|0)>>0]|0)<<5|(me[1729+(fe[u>>2]|0)>>0]|0)<<8|(me[1729+(fe[h>>2]|0)>>0]|0)<<11|k<<14;$[i+4>>1]=(me[1729+(fe[p>>2]|0)>>0]|0)<<1|k>>>2|(me[1729+(fe[d>>2]|0)>>0]|0)<<4|(me[1729+(fe[f>>2]|0)>>0]|0)<<7|(me[1729+(fe[m>>2]|0)>>0]|0)<<10|(me[1729+(fe[_>>2]|0)>>0]|0)<<13;g=g+1|0;if((g|0)==(b|0)){t=1;break}else i=i+6|0}}}while(0)}else t=0;N(E);k=t;ge=S;return k|0}function Yt(e,F,t,i,r,n,N,s){e=e|0;F=F|0;t=t|0;i=i|0;r=r|0;n=n|0;N=N|0;s=s|0;var o=0,a=0,l=0,z=0,u=0,h=0,c=0,p=0,B=0,U=0,d=0,j=0,G=0,f=0,m=0,X=0,_=0,g=0,H=0,Y=0,W=0,V=0,v=0,q=0,K=0,Z=0,y=0,J=0,Q=0,$=0,ee=0,te=0,ie=0,re=0,ne=0,b=0,x=0,T=0,w=0,E=0,S=0,se=0,A=0,oe=0,k=0,ae=0,P=0,le=0,ue=0,O=0,he=0,R=0,ce=0,C=0,M=0,pe=0,I=0,D=0,L=0;I=ge;ge=ge+720|0;pe=I+184|0;C=I+168|0;ce=I+160|0;R=I+144|0;he=I+136|0;O=I+120|0;ue=I+112|0;P=I+96|0;ae=I+88|0;k=I+72|0;oe=I+64|0;A=I+48|0;se=I+40|0;M=I+24|0;le=I+16|0;S=I;w=I+208|0;E=I+192|0;te=e+240|0;ie=fe[te>>2]|0;b=e+256|0;x=fe[b>>2]|0;t=de[(fe[e+88>>2]|0)+17>>0]|0;T=i>>>2;if(!(t<<24>>24)){ge=I;return 1}re=(s|0)==0;ne=s+-1|0;K=(n&1|0)!=0;Z=i<<1;y=e+92|0;J=e+116|0;Q=e+140|0;$=e+236|0;ee=N+-1|0;q=(r&1|0)!=0;v=e+188|0;g=e+252|0;H=T+1|0;Y=T+2|0;W=T+3|0;V=ee<<4;X=t&255;t=0;n=0;r=1;_=0;do{if(!re){f=fe[F+(_<<2)>>2]|0;m=0;while(1){d=m&1;o=(d|0)==0;U=(d<<5^32)+-16|0;d=(d<<1^2)+-1|0;G=o?N:-1;a=o?0:ee;e=(m|0)==(ne|0);j=K&e;if((a|0)!=(G|0)){B=K&e^1;p=o?f:f+V|0;while(1){if((r|0)==1)r=ye(y,J)|0|512;c=r&7;r=r>>>3;o=me[1823+c>>0]|0;e=0;do{u=(ye(y,Q)|0)+n|0;h=u-ie|0;n=h>>31;n=n&u|h&~n;if((fe[te>>2]|0)>>>0<=n>>>0){fe[S>>2]=1154;fe[S+4>>2]=903;fe[S+8>>2]=1781;xe(w,1100,S)|0;be(w,le)|0}fe[E+(e<<2)>>2]=fe[(fe[$>>2]|0)+(n<<2)>>2];e=e+1|0}while(e>>>0>>0);h=q&(a|0)==(ee|0);if(j|h){u=0;do{l=ve(u,i)|0;e=p+l|0;o=(u|0)==0|B;z=u<<1;L=(ye(y,v)|0)+t|0;D=L-x|0;t=D>>31;t=t&L|D&~t;do{if(h){if(!o){D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;break}fe[e>>2]=fe[E+((me[1831+(c<<2)+z>>0]|0)<<2)>>2];if((fe[b>>2]|0)>>>0<=t>>>0){fe[R>>2]=1154;fe[R+4>>2]=903;fe[R+8>>2]=1781;xe(w,1100,R)|0;be(w,ce)|0}fe[p+(l+4)>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t}else{if(!o){D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;break}fe[e>>2]=fe[E+((me[1831+(c<<2)+z>>0]|0)<<2)>>2];if((fe[b>>2]|0)>>>0<=t>>>0){fe[O>>2]=1154;fe[O+4>>2]=903;fe[O+8>>2]=1781;xe(w,1100,O)|0;be(w,he)|0}fe[p+(l+4)>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;fe[p+(l+8)>>2]=fe[E+((me[(z|1)+(1831+(c<<2))>>0]|0)<<2)>>2];if((fe[b>>2]|0)>>>0<=t>>>0){fe[C>>2]=1154;fe[C+4>>2]=903;fe[C+8>>2]=1781;xe(w,1100,C)|0;be(w,pe)|0}fe[p+(l+12)>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2]}}while(0);u=u+1|0}while((u|0)!=2)}else{fe[p>>2]=fe[E+((me[1831+(c<<2)>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((fe[b>>2]|0)>>>0<=t>>>0){fe[M>>2]=1154;fe[M+4>>2]=903;fe[M+8>>2]=1781;xe(w,1100,M)|0;be(w,se)|0}fe[p+4>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2];fe[p+8>>2]=fe[E+((me[1831+(c<<2)+1>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((fe[b>>2]|0)>>>0<=t>>>0){fe[A>>2]=1154;fe[A+4>>2]=903;fe[A+8>>2]=1781;xe(w,1100,A)|0;be(w,oe)|0}fe[p+12>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2];fe[p+(T<<2)>>2]=fe[E+((me[1831+(c<<2)+2>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((fe[b>>2]|0)>>>0<=t>>>0){fe[k>>2]=1154;fe[k+4>>2]=903;fe[k+8>>2]=1781;xe(w,1100,k)|0;be(w,ae)|0}fe[p+(H<<2)>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2];fe[p+(Y<<2)>>2]=fe[E+((me[1831+(c<<2)+3>>0]|0)<<2)>>2];D=(ye(y,v)|0)+t|0;L=D-x|0;t=L>>31;t=t&D|L&~t;if((fe[b>>2]|0)>>>0<=t>>>0){fe[P>>2]=1154;fe[P+4>>2]=903;fe[P+8>>2]=1781;xe(w,1100,P)|0;be(w,ue)|0}fe[p+(W<<2)>>2]=fe[(fe[g>>2]|0)+(t<<2)>>2]}a=a+d|0;if((a|0)==(G|0))break;else p=p+U|0}}m=m+1|0;if((m|0)==(s|0))break;else f=f+Z|0}}_=_+1|0}while((_|0)!=(X|0));ge=I;return 1}function Wt(e,t,i,r,n,s,o,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o=o|0;a=a|0;var l=0,u=0,h=0,c=0,p=0,d=0,F=0,N=0,f=0,m=0,_=0,g=0,v=0,z=0,B=0,y=0,b=0,x=0,T=0,U=0,w=0,j=0,G=0,X=0,H=0,Y=0,W=0,V=0,q=0,K=0,Z=0,E=0,J=0,Q=0,$=0,S=0,ee=0,te=0,A=0,ie=0,k=0,re=0,ne=0,se=0,P=0,oe=0,ae=0,O=0,le=0,R=0,ue=0,C=0,he=0,M=0,ce=0,pe=0,I=0,D=0,L=0;D=ge;ge=ge+640|0;ce=D+88|0;M=D+72|0;he=D+64|0;C=D+48|0;ue=D+40|0;I=D+24|0;pe=D+16|0;R=D;O=D+128|0;le=D+112|0;ae=D+96|0;E=e+240|0;J=fe[E>>2]|0;S=e+256|0;se=fe[S>>2]|0;P=e+272|0;oe=fe[P>>2]|0;i=fe[e+88>>2]|0;Q=(me[i+63>>0]|0)<<8|(me[i+64>>0]|0);i=de[i+17>>0]|0;if(!(i<<24>>24)){ge=D;return 1}$=(a|0)==0;ee=a+-1|0;te=r<<1;A=e+92|0;ie=e+116|0;k=o+-1|0;re=e+212|0;ne=e+188|0;Z=(n&1|0)==0;K=(s&1|0)==0;X=e+288|0;H=e+284|0;Y=e+252|0;W=e+140|0;V=e+236|0;q=e+164|0;j=e+268|0;G=k<<5;U=i&255;i=0;n=0;s=0;e=0;l=1;w=0;do{if(!$){x=fe[t+(w<<2)>>2]|0;T=0;while(1){y=T&1;u=(y|0)==0;B=(y<<6^64)+-32|0;y=(y<<1^2)+-1|0;b=u?o:-1;h=u?0:k;if((h|0)!=(b|0)){z=K|(T|0)!=(ee|0);v=u?x:x+G|0;while(1){if((l|0)==1)l=ye(A,ie)|0|512;g=l&7;l=l>>>3;c=me[1823+g>>0]|0;u=0;do{m=(ye(A,q)|0)+n|0;_=m-oe|0;n=_>>31;n=n&m|_&~n;if((fe[P>>2]|0)>>>0<=n>>>0){fe[R>>2]=1154;fe[R+4>>2]=903;fe[R+8>>2]=1781;xe(O,1100,R)|0;be(O,pe)|0}fe[ae+(u<<2)>>2]=_e[(fe[j>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{m=(ye(A,W)|0)+e|0;_=m-J|0;e=_>>31;e=e&m|_&~e;if((fe[E>>2]|0)>>>0<=e>>>0){fe[I>>2]=1154;fe[I+4>>2]=903;fe[I+8>>2]=1781;xe(O,1100,I)|0;be(O,ue)|0}fe[le+(u<<2)>>2]=fe[(fe[V>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=Z|(h|0)!=(k|0);f=0;m=v;while(1){N=z|(f|0)==0;F=f<<1;p=0;d=m;while(1){c=(ye(A,re)|0)+i|0;u=c-Q|0;i=u>>31;i=i&c|u&~i;u=(ye(A,ne)|0)+s|0;c=u-se|0;s=c>>31;s=s&u|c&~s;if((_|(p|0)==0)&N){u=me[p+F+(1831+(g<<2))>>0]|0;c=i*3|0;if((fe[X>>2]|0)>>>0<=c>>>0){fe[C>>2]=1154;fe[C+4>>2]=903;fe[C+8>>2]=1781;xe(O,1100,C)|0;be(O,he)|0}L=fe[H>>2]|0;fe[d>>2]=(_e[L+(c<<1)>>1]|0)<<16|fe[ae+(u<<2)>>2];fe[d+4>>2]=(_e[L+(c+2<<1)>>1]|0)<<16|(_e[L+(c+1<<1)>>1]|0);fe[d+8>>2]=fe[le+(u<<2)>>2];if((fe[S>>2]|0)>>>0<=s>>>0){fe[M>>2]=1154;fe[M+4>>2]=903;fe[M+8>>2]=1781;xe(O,1100,M)|0;be(O,ce)|0}fe[d+12>>2]=fe[(fe[Y>>2]|0)+(s<<2)>>2]}p=p+1|0;if((p|0)==2)break;else d=d+16|0}f=f+1|0;if((f|0)==2)break;else m=m+r|0}h=h+y|0;if((h|0)==(b|0))break;else v=v+B|0}}T=T+1|0;if((T|0)==(a|0))break;else x=x+te|0}}w=w+1|0}while((w|0)!=(U|0));ge=D;return 1}function Vt(e,t,i,r,n,s,o,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o=o|0;a=a|0;var l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,F=0,N=0,v=0,y=0,b=0,x=0,T=0,z=0,B=0,U=0,j=0,w=0,E=0,G=0,X=0,S=0,H=0,A=0,Y=0,W=0,V=0,k=0,q=0,P=0,O=0,R=0,C=0,M=0,K=0,I=0,Z=0,J=0,D=0,L=0;L=ge;ge=ge+608|0;Z=L+64|0;I=L+48|0;K=L+40|0;D=L+24|0;J=L+16|0;M=L;C=L+88|0;R=L+72|0;S=e+272|0;H=fe[S>>2]|0;i=fe[e+88>>2]|0;A=(me[i+63>>0]|0)<<8|(me[i+64>>0]|0);i=de[i+17>>0]|0;if(!(i<<24>>24)){ge=L;return 1}Y=(a|0)==0;W=a+-1|0;V=r<<1;k=e+92|0;q=e+116|0;P=o+-1|0;O=e+212|0;X=(s&1|0)==0;w=e+288|0;E=e+284|0;G=e+164|0;U=e+268|0;j=P<<4;B=i&255;z=(n&1|0)!=0;i=0;s=0;e=1;T=0;do{if(!Y){b=fe[t+(T<<2)>>2]|0;x=0;while(1){v=x&1;n=(v|0)==0;N=(v<<5^32)+-16|0;v=(v<<1^2)+-1|0;y=n?o:-1;l=n?0:P;if((l|0)!=(y|0)){F=X|(x|0)!=(W|0);g=n?b:b+j|0;while(1){if((e|0)==1)e=ye(k,q)|0|512;_=e&7;e=e>>>3;u=me[1823+_>>0]|0;n=0;do{f=(ye(k,G)|0)+s|0;m=f-H|0;s=m>>31;s=s&f|m&~s;if((fe[S>>2]|0)>>>0<=s>>>0){fe[M>>2]=1154;fe[M+4>>2]=903;fe[M+8>>2]=1781;xe(C,1100,M)|0;be(C,J)|0}fe[R+(n<<2)>>2]=_e[(fe[U>>2]|0)+(s<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(P|0)&z;d=0;f=g;while(1){p=F|(d|0)==0;c=d<<1;n=(ye(k,O)|0)+i|0;h=n-A|0;u=h>>31;u=u&n|h&~u;if(p){i=me[1831+(_<<2)+c>>0]|0;n=u*3|0;if((fe[w>>2]|0)>>>0<=n>>>0){fe[D>>2]=1154;fe[D+4>>2]=903;fe[D+8>>2]=1781;xe(C,1100,D)|0;be(C,K)|0}h=fe[E>>2]|0;fe[f>>2]=(_e[h+(n<<1)>>1]|0)<<16|fe[R+(i<<2)>>2];fe[f+4>>2]=(_e[h+(n+2<<1)>>1]|0)<<16|(_e[h+(n+1<<1)>>1]|0)}h=f+8|0;n=(ye(k,O)|0)+u|0;u=n-A|0;i=u>>31;i=i&n|u&~i;if(!(m|p^1)){n=me[(c|1)+(1831+(_<<2))>>0]|0;u=i*3|0;if((fe[w>>2]|0)>>>0<=u>>>0){fe[I>>2]=1154;fe[I+4>>2]=903;fe[I+8>>2]=1781;xe(C,1100,I)|0;be(C,Z)|0}p=fe[E>>2]|0;fe[h>>2]=(_e[p+(u<<1)>>1]|0)<<16|fe[R+(n<<2)>>2];fe[f+12>>2]=(_e[p+(u+2<<1)>>1]|0)<<16|(_e[p+(u+1<<1)>>1]|0)}d=d+1|0;if((d|0)==2)break;else f=f+r|0}l=l+v|0;if((l|0)==(y|0))break;else g=g+N|0}}x=x+1|0;if((x|0)==(a|0))break;else b=b+V|0}}T=T+1|0}while((T|0)!=(B|0));ge=L;return 1}function qt(e,t,i,r,n,s,o,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o=o|0;a=a|0;var l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,F=0,N=0,g=0,v=0,y=0,b=0,x=0,z=0,B=0,T=0,w=0,E=0,S=0,U=0,A=0,j=0,G=0,X=0,H=0,Y=0,W=0,V=0,k=0,q=0,K=0,Z=0,J=0,Q=0,P=0,$=0,O=0,ee=0,te=0,ie=0,R=0,C=0,re=0,M=0,ne=0,I=0,se=0,oe=0,D=0,L=0;L=ge;ge=ge+640|0;se=L+88|0;I=L+72|0;ne=L+64|0;M=L+48|0;re=L+40|0;D=L+24|0;oe=L+16|0;C=L;R=L+128|0;te=L+112|0;ie=L+96|0;k=e+272|0;q=fe[k>>2]|0;i=fe[e+88>>2]|0;K=(me[i+63>>0]|0)<<8|(me[i+64>>0]|0);i=de[i+17>>0]|0;if(!(i<<24>>24)){ge=L;return 1}Z=(a|0)==0;J=a+-1|0;Q=r<<1;P=e+92|0;$=e+116|0;O=o+-1|0;ee=e+212|0;V=(n&1|0)==0;W=(s&1|0)==0;X=e+288|0;H=e+284|0;Y=e+164|0;j=e+268|0;G=O<<5;U=i&255;i=0;n=0;s=0;e=0;l=1;A=0;do{if(!Z){E=fe[t+(A<<2)>>2]|0;S=0;while(1){T=S&1;u=(T|0)==0;B=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;w=u?o:-1;h=u?0:O;if((h|0)!=(w|0)){z=W|(S|0)!=(J|0);x=u?E:E+G|0;while(1){if((l|0)==1)l=ye(P,$)|0|512;b=l&7;l=l>>>3;c=me[1823+b>>0]|0;u=0;do{v=(ye(P,Y)|0)+e|0;y=v-q|0;e=y>>31;e=e&v|y&~e;if((fe[k>>2]|0)>>>0<=e>>>0){fe[C>>2]=1154;fe[C+4>>2]=903;fe[C+8>>2]=1781;xe(R,1100,C)|0;be(R,oe)|0}fe[te+(u<<2)>>2]=_e[(fe[j>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(ye(P,Y)|0)+n|0;y=v-q|0;n=y>>31;n=n&v|y&~n;if((fe[k>>2]|0)>>>0<=n>>>0){fe[D>>2]=1154;fe[D+4>>2]=903;fe[D+8>>2]=1781;xe(R,1100,D)|0;be(R,re)|0}fe[ie+(u<<2)>>2]=_e[(fe[j>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);y=V|(h|0)!=(O|0);g=0;v=x;while(1){N=z|(g|0)==0;F=g<<1;m=0;_=v;while(1){f=(ye(P,ee)|0)+s|0;d=f-K|0;s=d>>31;s=s&f|d&~s;d=(ye(P,ee)|0)+i|0;f=d-K|0;i=f>>31;i=i&d|f&~i;if((y|(m|0)==0)&N){d=me[m+F+(1831+(b<<2))>>0]|0;f=s*3|0;u=fe[X>>2]|0;if(u>>>0<=f>>>0){fe[M>>2]=1154;fe[M+4>>2]=903;fe[M+8>>2]=1781;xe(R,1100,M)|0;be(R,ne)|0;u=fe[X>>2]|0}c=fe[H>>2]|0;p=i*3|0;if(u>>>0>p>>>0)u=c;else{fe[I>>2]=1154;fe[I+4>>2]=903;fe[I+8>>2]=1781;xe(R,1100,I)|0;be(R,se)|0;u=fe[H>>2]|0}fe[_>>2]=(_e[c+(f<<1)>>1]|0)<<16|fe[te+(d<<2)>>2];fe[_+4>>2]=(_e[c+(f+2<<1)>>1]|0)<<16|(_e[c+(f+1<<1)>>1]|0);fe[_+8>>2]=(_e[u+(p<<1)>>1]|0)<<16|fe[ie+(d<<2)>>2];fe[_+12>>2]=(_e[u+(p+2<<1)>>1]|0)<<16|(_e[u+(p+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else _=_+16|0}g=g+1|0;if((g|0)==2)break;else v=v+r|0}h=h+T|0;if((h|0)==(w|0))break;else x=x+B|0}}S=S+1|0;if((S|0)==(a|0))break;else E=E+Q|0}}A=A+1|0}while((A|0)!=(U|0));ge=L;return 1}function Kt(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0;p=ge;ge=ge+608|0;c=p+88|0;h=p+72|0;l=p+64|0;a=p+48|0;s=p+40|0;o=p+24|0;n=p+16|0;r=p;u=p+96|0;fe[e>>2]=0;t=e+284|0;i=fe[t>>2]|0;if(i){if(!(i&7))X[fe[104>>2]&1](i,0,0,1,fe[27]|0)|0;else{fe[r>>2]=1154;fe[r+4>>2]=2499;fe[r+8>>2]=1516;xe(u,1100,r)|0;be(u,n)|0}fe[t>>2]=0;fe[e+288>>2]=0;fe[e+292>>2]=0}de[e+296>>0]=0;t=e+268|0;i=fe[t>>2]|0;if(i){if(!(i&7))X[fe[104>>2]&1](i,0,0,1,fe[27]|0)|0;else{fe[o>>2]=1154;fe[o+4>>2]=2499;fe[o+8>>2]=1516;xe(u,1100,o)|0;be(u,s)|0}fe[t>>2]=0;fe[e+272>>2]=0;fe[e+276>>2]=0}de[e+280>>0]=0;t=e+252|0;i=fe[t>>2]|0;if(i){if(!(i&7))X[fe[104>>2]&1](i,0,0,1,fe[27]|0)|0;else{fe[a>>2]=1154;fe[a+4>>2]=2499;fe[a+8>>2]=1516;xe(u,1100,a)|0;be(u,l)|0}fe[t>>2]=0;fe[e+256>>2]=0;fe[e+260>>2]=0}de[e+264>>0]=0;t=e+236|0;i=fe[t>>2]|0;if(!i){c=e+248|0;de[c>>0]=0;c=e+212|0;N(c);c=e+188|0;N(c);c=e+164|0;N(c);c=e+140|0;N(c);c=e+116|0;N(c);ge=p;return}if(!(i&7))X[fe[104>>2]&1](i,0,0,1,fe[27]|0)|0;else{fe[h>>2]=1154;fe[h+4>>2]=2499;fe[h+8>>2]=1516;xe(u,1100,h)|0;be(u,c)|0}fe[t>>2]=0;fe[e+240>>2]=0;fe[e+244>>2]=0;c=e+248|0;de[c>>0]=0;c=e+212|0;N(c);c=e+188|0;N(c);c=e+164|0;N(c);c=e+140|0;N(c);c=e+116|0;N(c);ge=p}function l(e,t){e=e|0;t=t|0;var i=0;i=ge;ge=ge+16|0;fe[i>>2]=t;t=fe[63]|0;Oi(t,e,i)|0;Pi(10,t)|0;B()}function Zt(){var e=0,t=0;e=ge;ge=ge+16|0;if(!(it(200,2)|0)){t=et(fe[49]|0)|0;ge=e;return t|0}else l(2090,e);return 0}function Jt(e){e=e|0;b(e)}function Qt(e){e=e|0;var t=0;t=ge;ge=ge+16|0;Mr[e&3]();l(2139,t)}function $t(){var e=0,t=0;e=Zt()|0;if(((e|0)!=0?(t=fe[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(fe[e>>2]&-256|0)==1126902528?(fe[e+4>>2]|0)==1129074247:0):0)Qt(fe[t+12>>2]|0);t=fe[28]|0;fe[28]=t+0;Qt(t)}function ei(e){e=e|0}function ti(e){e=e|0;return}function ii(e){e=e|0;return}function ri(e){e=e|0;return}function ni(e){e=e|0;Jt(e);return}function si(e){e=e|0;Jt(e);return}function oi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0;o=ge;ge=ge+64|0;s=o;if((e|0)!=(t|0))if((t|0)!=0?(n=hi(t,24,40,0)|0,(n|0)!=0):0){t=s;r=t+56|0;do{fe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));fe[s>>2]=n;fe[s+8>>2]=e;fe[s+12>>2]=-1;fe[s+48>>2]=1;Dr[fe[(fe[n>>2]|0)+28>>2]&3](n,s,fe[i>>2]|0,1);if((fe[s+24>>2]|0)==1){fe[i>>2]=fe[s+16>>2];t=1}else t=0}else t=0;else t=1;ge=o;return t|0}function ai(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0;e=t+16|0;n=fe[e>>2]|0;do{if(n){if((n|0)!=(i|0)){r=t+36|0;fe[r>>2]=(fe[r>>2]|0)+1;fe[t+24>>2]=2;de[t+54>>0]=1;break}e=t+24|0;if((fe[e>>2]|0)==2)fe[e>>2]=r}else{fe[e>>2]=i;fe[t+24>>2]=r;fe[t+36>>2]=1}}while(0)}function li(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;if((e|0)==(fe[t+8>>2]|0))ai(0,t,i,r);return}function ui(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;if((e|0)==(fe[t+8>>2]|0))ai(0,t,i,r);else{e=fe[e+8>>2]|0;Dr[fe[(fe[e>>2]|0)+28>>2]&3](e,t,i,r)}return}function hi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0;d=ge;ge=ge+64|0;p=d;c=fe[e>>2]|0;h=e+(fe[c+-8>>2]|0)|0;c=fe[c+-4>>2]|0;fe[p>>2]=i;fe[p+4>>2]=e;fe[p+8>>2]=t;fe[p+12>>2]=r;r=p+16|0;e=p+20|0;t=p+24|0;n=p+28|0;s=p+32|0;o=p+40|0;a=(c|0)==(i|0);l=r;u=l+36|0;do{fe[l>>2]=0;l=l+4|0}while((l|0)<(u|0));$[r+36>>1]=0;de[r+38>>0]=0;e:do{if(a){fe[p+48>>2]=1;Ir[fe[(fe[i>>2]|0)+20>>2]&3](i,p,h,h,1,0);r=(fe[t>>2]|0)==1?h:0}else{Pr[fe[(fe[c>>2]|0)+24>>2]&3](c,p,h,1,0);switch(fe[p+36>>2]|0){case 0:{r=(fe[o>>2]|0)==1&(fe[n>>2]|0)==1&(fe[s>>2]|0)==1?fe[e>>2]|0:0;break e}case 1:break;default:{r=0;break e}}if((fe[t>>2]|0)!=1?!((fe[o>>2]|0)==0&(fe[n>>2]|0)==1&(fe[s>>2]|0)==1):0){r=0;break}r=fe[r>>2]|0}}while(0);ge=d;return r|0}function ci(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;de[t+53>>0]=1;do{if((fe[t+4>>2]|0)==(r|0)){de[t+52>>0]=1;r=t+16|0;e=fe[r>>2]|0;if(!e){fe[r>>2]=i;fe[t+24>>2]=n;fe[t+36>>2]=1;if(!((n|0)==1?(fe[t+48>>2]|0)==1:0))break;de[t+54>>0]=1;break}if((e|0)!=(i|0)){n=t+36|0;fe[n>>2]=(fe[n>>2]|0)+1;de[t+54>>0]=1;break}e=t+24|0;r=fe[e>>2]|0;if((r|0)==2){fe[e>>2]=n;r=n}if((r|0)==1?(fe[t+48>>2]|0)==1:0)de[t+54>>0]=1}}while(0)}function pi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0;e:do{if((e|0)==(fe[t+8>>2]|0)){if((fe[t+4>>2]|0)==(i|0)?(s=t+28|0,(fe[s>>2]|0)!=1):0)fe[s>>2]=r}else{if((e|0)!=(fe[t>>2]|0)){a=fe[e+8>>2]|0;Pr[fe[(fe[a>>2]|0)+24>>2]&3](a,t,i,r,n);break}if((fe[t+16>>2]|0)!=(i|0)?(o=t+20|0,(fe[o>>2]|0)!=(i|0)):0){fe[t+32>>2]=r;r=t+44|0;if((fe[r>>2]|0)==4)break;s=t+52|0;de[s>>0]=0;l=t+53|0;de[l>>0]=0;e=fe[e+8>>2]|0;Ir[fe[(fe[e>>2]|0)+20>>2]&3](e,t,i,i,1,n);if(de[l>>0]|0){if(!(de[s>>0]|0)){s=1;a=13}}else{s=0;a=13}do{if((a|0)==13){fe[o>>2]=i;l=t+40|0;fe[l>>2]=(fe[l>>2]|0)+1;if((fe[t+36>>2]|0)==1?(fe[t+24>>2]|0)==2:0){de[t+54>>0]=1;if(s)break}else a=16;if((a|0)==16?s:0)break;fe[r>>2]=4;break e}}while(0);fe[r>>2]=3;break}if((r|0)==1)fe[t+32>>2]=1}}while(0);return}function di(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0;do{if((e|0)==(fe[t+8>>2]|0)){if((fe[t+4>>2]|0)==(i|0)?(o=t+28|0,(fe[o>>2]|0)!=1):0)fe[o>>2]=r}else if((e|0)==(fe[t>>2]|0)){if((fe[t+16>>2]|0)!=(i|0)?(s=t+20|0,(fe[s>>2]|0)!=(i|0)):0){fe[t+32>>2]=r;fe[s>>2]=i;n=t+40|0;fe[n>>2]=(fe[n>>2]|0)+1;if((fe[t+36>>2]|0)==1?(fe[t+24>>2]|0)==2:0)de[t+54>>0]=1;fe[t+44>>2]=4;break}if((r|0)==1)fe[t+32>>2]=1}}while(0);return}function fi(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;if((e|0)==(fe[t+8>>2]|0))ci(0,t,i,r,n);else{e=fe[e+8>>2]|0;Ir[fe[(fe[e>>2]|0)+20>>2]&3](e,t,i,r,n,s)}return}function mi(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;if((e|0)==(fe[t+8>>2]|0))ci(0,t,i,r,n);return}function _i(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0;n=ge;ge=ge+16|0;r=n;fe[r>>2]=fe[i>>2];e=v[fe[(fe[e>>2]|0)+16>>2]&7](e,t,r)|0;if(e)fe[i>>2]=fe[r>>2];ge=n;return e&1|0}function gi(e){e=e|0;if(!e)e=0;else e=(hi(e,24,72,0)|0)!=0;return e&1|0}function vi(){var e=0,t=0,i=0,r=0,n=0,s=0,o=0,a=0;n=ge;ge=ge+48|0;o=n+32|0;i=n+24|0;a=n+16|0;s=n;n=n+36|0;e=Zt()|0;if((e|0)!=0?(r=fe[e>>2]|0,(r|0)!=0):0){e=r+48|0;t=fe[e>>2]|0;e=fe[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){fe[i>>2]=fe[51];l(2368,i)}if((t|0)==1126902529&(e|0)==1129074247)e=fe[r+44>>2]|0;else e=r+80|0;fe[n>>2]=e;r=fe[r>>2]|0;e=fe[r+4>>2]|0;if(v[fe[(fe[8>>2]|0)+16>>2]&7](8,r,n)|0){a=fe[n>>2]|0;n=fe[51]|0;a=Rr[fe[(fe[a>>2]|0)+8>>2]&1](a)|0;fe[s>>2]=n;fe[s+4>>2]=e;fe[s+8>>2]=a;l(2282,s)}else{fe[a>>2]=fe[51];fe[a+4>>2]=e;l(2327,a)}}l(2406,o)}function yi(){var e=0;e=ge;ge=ge+16|0;if(!(rt(196,6)|0)){ge=e;return}else l(2179,e)}function bi(e){e=e|0;var t=0;t=ge;ge=ge+16|0;b(e);if(!(ot(fe[49]|0,0)|0)){ge=t;return}else l(2229,t)}function xi(e){e=e|0;var t=0,i=0;t=0;while(1){if((me[2427+t>>0]|0)==(e|0)){i=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;i=5;break}}if((i|0)==2)if(!t)e=2515;else{e=2515;i=5}if((i|0)==5)while(1){i=e;while(1){e=i+1|0;if(!(de[i>>0]|0))break;else i=e}t=t+-1|0;if(!t)break;else i=5}return e|0}function re(){var e=0;if(!(fe[52]|0))e=264;else{e=(tt()|0)+60|0;e=fe[e>>2]|0}return e|0}function Ti(e){e=e|0;var t=0;if(e>>>0>4294963200){t=re()|0;fe[t>>2]=0-e;e=-1}return e|0}function wi(e,t){e=+e;t=t|0;var i=0,r=0,n=0;ee[te>>3]=e;i=fe[te>>2]|0;r=fe[te+4>>2]|0;n=Ji(i|0,r|0,52)|0;n=n&2047;switch(n|0){case 0:{if(e!=0.0){e=+wi(e*18446744073709552.0e3,t);i=(fe[t>>2]|0)+-64|0}else i=0;fe[t>>2]=i;break}case 2047:break;default:{fe[t>>2]=n+-1022;fe[te>>2]=i;fe[te+4>>2]=r&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function Ei(e,t){e=+e;t=t|0;return+ +wi(e,t)}function Si(e,t,i){e=e|0;t=t|0;i=i|0;do{if(e){if(t>>>0<128){de[e>>0]=t;e=1;break}if(t>>>0<2048){de[e>>0]=t>>>6|192;de[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){de[e>>0]=t>>>12|224;de[e+1>>0]=t>>>6&63|128;de[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){de[e>>0]=t>>>18|240;de[e+1>>0]=t>>>12&63|128;de[e+2>>0]=t>>>6&63|128;de[e+3>>0]=t&63|128;e=4;break}else{e=re()|0;fe[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function Ai(e,t){e=e|0;t=t|0;if(!e)e=0;else e=Si(e,t,0)|0;return e|0}function ki(e){e=e|0;var t=0,i=0;do{if(e){if((fe[e+76>>2]|0)<=-1){t=Ui(e)|0;break}i=(Mi(e)|0)==0;t=Ui(e)|0;if(!i)g(e)}else{if(!(fe[65]|0))t=0;else t=ki(fe[65]|0)|0;at(236);e=fe[58]|0;if(e)do{if((fe[e+76>>2]|0)>-1)i=Mi(e)|0;else i=0;if((fe[e+20>>2]|0)>>>0>(fe[e+28>>2]|0)>>>0)t=Ui(e)|0|t;if(i)g(e);e=fe[e+56>>2]|0}while((e|0)!=0);nt(236)}}while(0);return t|0}function Pi(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0;if((fe[t+76>>2]|0)>=0?(Mi(t)|0)!=0:0){if((de[t+75>>0]|0)!=(e|0)?(r=t+20|0,n=fe[r>>2]|0,n>>>0<(fe[t+16>>2]|0)>>>0):0){fe[r>>2]=n+1;de[n>>0]=e;i=e&255}else i=Ii(t,e)|0;g(t)}else o=3;do{if((o|0)==3){if((de[t+75>>0]|0)!=(e|0)?(s=t+20|0,i=fe[s>>2]|0,i>>>0<(fe[t+16>>2]|0)>>>0):0){fe[s>>2]=i+1;de[i>>0]=e;i=e&255;break}i=Ii(t,e)|0}}while(0);return i|0}function ne(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0;r=i+16|0;n=fe[r>>2]|0;if(!n)if(!(zi(i)|0)){n=fe[r>>2]|0;s=4}else r=0;else s=4;e:do{if((s|0)==4){o=i+20|0;s=fe[o>>2]|0;if((n-s|0)>>>0>>0){r=v[fe[i+36>>2]&7](i,e,t)|0;break}t:do{if((de[i+75>>0]|0)>-1){r=t;while(1){if(!r){n=s;r=0;break t}n=r+-1|0;if((de[e+n>>0]|0)==10)break;else r=n}if((v[fe[i+36>>2]&7](i,e,r)|0)>>>0>>0)break e;t=t-r|0;e=e+r|0;n=fe[o>>2]|0}else{n=s;r=0}}while(0);er(n|0,e|0,t|0)|0;fe[o>>2]=(fe[o>>2]|0)+t;r=r+t|0}}while(0);return r|0}function be(e,t){e=e|0;t=t|0;var i=0,r=0;i=ge;ge=ge+16|0;r=i;fe[r>>2]=t;t=Oi(fe[64]|0,e,r)|0;ge=i;return t|0}function xe(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0;r=ge;ge=ge+16|0;n=r;fe[n>>2]=i;i=Ci(e,t,n)|0;ge=r;return i|0}function Oi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0;m=ge;ge=ge+224|0;c=m+120|0;f=m+80|0;d=m;p=m+136|0;r=f;n=r+40|0;do{fe[r>>2]=0;r=r+4|0}while((r|0)<(n|0));fe[c>>2]=fe[i>>2];if((ji(0,t,c,d,f)|0)<0)i=-1;else{if((fe[e+76>>2]|0)>-1)u=Mi(e)|0;else u=0;i=fe[e>>2]|0;h=i&32;if((de[e+74>>0]|0)<1)fe[e>>2]=i&-33;i=e+48|0;if(!(fe[i>>2]|0)){n=e+44|0;s=fe[n>>2]|0;fe[n>>2]=p;o=e+28|0;fe[o>>2]=p;a=e+20|0;fe[a>>2]=p;fe[i>>2]=80;l=e+16|0;fe[l>>2]=p+80;r=ji(e,t,c,d,f)|0;if(s){v[fe[e+36>>2]&7](e,0,0)|0;r=(fe[a>>2]|0)==0?-1:r;fe[n>>2]=s;fe[i>>2]=0;fe[l>>2]=0;fe[o>>2]=0;fe[a>>2]=0}}else r=ji(e,t,c,d,f)|0;i=fe[e>>2]|0;fe[e>>2]=i|h;if(u)g(e);i=(i&32|0)==0?r:-1}ge=m;return i|0}function Ri(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0,h=0;h=ge;ge=ge+128|0;n=h+112|0;u=h;s=u;o=268;a=s+112|0;do{fe[s>>2]=fe[o>>2];s=s+4|0;o=o+4|0}while((s|0)<(a|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;l=4}else{t=re()|0;fe[t>>2]=75;t=-1}else{n=e;l=4}if((l|0)==4){l=-2-n|0;l=t>>>0>l>>>0?l:t;fe[u+48>>2]=l;e=u+20|0;fe[e>>2]=n;fe[u+44>>2]=n;t=n+l|0;n=u+16|0;fe[n>>2]=t;fe[u+28>>2]=t;t=Oi(u,i,r)|0;if(l){i=fe[e>>2]|0;de[i+(((i|0)==(fe[n>>2]|0))<<31>>31)>>0]=0}}ge=h;return t|0}function Ci(e,t,i){e=e|0;t=t|0;i=i|0;return Ri(e,2147483647,t,i)|0}function Mi(e){e=e|0;return 0}function g(e){e=e|0}function Ii(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0;l=ge;ge=ge+16|0;a=l;o=t&255;de[a>>0]=o;r=e+16|0;n=fe[r>>2]|0;if(!n)if(!(zi(e)|0)){n=fe[r>>2]|0;s=4}else i=-1;else s=4;do{if((s|0)==4){r=e+20|0;s=fe[r>>2]|0;if(s>>>0>>0?(i=t&255,(i|0)!=(de[e+75>>0]|0)):0){fe[r>>2]=s+1;de[s>>0]=o;break}if((v[fe[e+36>>2]&7](e,a,1)|0)==1)i=me[a>>0]|0;else i=-1}}while(0);ge=l;return i|0}function Di(e){e=e|0;var t=0,i=0;t=ge;ge=ge+16|0;i=t;fe[i>>2]=fe[e+60>>2];e=Ti(Ve(6,i|0)|0)|0;ge=t;return e|0}function Li(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0;n=ge;ge=ge+32|0;s=n;r=n+20|0;fe[s>>2]=fe[e+60>>2];fe[s+4>>2]=0;fe[s+8>>2]=t;fe[s+12>>2]=r;fe[s+16>>2]=i;if((Ti(ht(140,s|0)|0)|0)<0){fe[r>>2]=-1;e=-1}else e=fe[r>>2]|0;ge=n;return e|0}function Fi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0;f=ge;ge=ge+48|0;c=f+16|0;h=f;r=f+32|0;p=e+28|0;n=fe[p>>2]|0;fe[r>>2]=n;d=e+20|0;n=(fe[d>>2]|0)-n|0;fe[r+4>>2]=n;fe[r+8>>2]=t;fe[r+12>>2]=i;l=e+60|0;u=e+44|0;t=2;n=n+i|0;while(1){if(!(fe[52]|0)){fe[c>>2]=fe[l>>2];fe[c+4>>2]=r;fe[c+8>>2]=t;o=Ti(ct(146,c|0)|0)|0}else{lt(7,e|0);fe[h>>2]=fe[l>>2];fe[h+4>>2]=r;fe[h+8>>2]=t;o=Ti(ct(146,h|0)|0)|0;Ye(0)}if((n|0)==(o|0)){n=6;break}if((o|0)<0){n=8;break}n=n-o|0;s=fe[r+4>>2]|0;if(o>>>0<=s>>>0)if((t|0)==2){fe[p>>2]=(fe[p>>2]|0)+o;a=s;t=2}else a=s;else{a=fe[u>>2]|0;fe[p>>2]=a;fe[d>>2]=a;a=fe[r+12>>2]|0;o=o-s|0;r=r+8|0;t=t+-1|0}fe[r>>2]=(fe[r>>2]|0)+o;fe[r+4>>2]=a-o}if((n|0)==6){c=fe[u>>2]|0;fe[e+16>>2]=c+(fe[e+48>>2]|0);e=c;fe[p>>2]=e;fe[d>>2]=e}else if((n|0)==8){fe[e+16>>2]=0;fe[p>>2]=0;fe[d>>2]=0;fe[e>>2]=fe[e>>2]|32;if((t|0)==2)i=0;else i=i-(fe[r+4>>2]|0)|0}ge=f;return i|0}function Ni(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0;n=ge;ge=ge+80|0;r=n;fe[e+36>>2]=3;if((fe[e>>2]&64|0)==0?(fe[r>>2]=fe[e+60>>2],fe[r+4>>2]=21505,fe[r+8>>2]=n+12,(We(54,r|0)|0)!=0):0)de[e+75>>0]=-1;r=Fi(e,t,i)|0;ge=n;return r|0}function zi(e){e=e|0;var t=0,i=0;t=e+74|0;i=de[t>>0]|0;de[t>>0]=i+255|i;t=fe[e>>2]|0;if(!(t&8)){fe[e+8>>2]=0;fe[e+4>>2]=0;t=fe[e+44>>2]|0;fe[e+28>>2]=t;fe[e+20>>2]=t;fe[e+16>>2]=t+(fe[e+48>>2]|0);t=0}else{fe[e>>2]=t|32;t=-1}return t|0}function Bi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0;s=t&255;r=(i|0)!=0;e:do{if(r&(e&3|0)!=0){n=t&255;while(1){if((de[e>>0]|0)==n<<24>>24){o=6;break e}e=e+1|0;i=i+-1|0;r=(i|0)!=0;if(!(r&(e&3|0)!=0)){o=5;break}}}else o=5}while(0);if((o|0)==5)if(r)o=6;else i=0;e:do{if((o|0)==6){n=t&255;if((de[e>>0]|0)!=n<<24>>24){r=ve(s,16843009)|0;t:do{if(i>>>0>3)while(1){s=fe[e>>2]^r;if((s&-2139062144^-2139062144)&s+-16843009)break;e=e+4|0;i=i+-4|0;if(i>>>0<=3){o=11;break t}}else o=11}while(0);if((o|0)==11)if(!i){i=0;break}while(1){if((de[e>>0]|0)==n<<24>>24)break e;e=e+1|0;i=i+-1|0;if(!i){i=0;break}}}}}while(0);return((i|0)!=0?e:0)|0}function Ui(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0;t=e+20|0;s=e+28|0;if((fe[t>>2]|0)>>>0>(fe[s>>2]|0)>>>0?(v[fe[e+36>>2]&7](e,0,0)|0,(fe[t>>2]|0)==0):0)t=-1;else{o=e+4|0;i=fe[o>>2]|0;r=e+8|0;n=fe[r>>2]|0;if(i>>>0>>0)v[fe[e+40>>2]&7](e,i-n|0,1)|0;fe[e+16>>2]=0;fe[s>>2]=0;fe[t>>2]=0;fe[r>>2]=0;fe[o>>2]=0;t=0}return t|0}function ji(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0,u=0.0,h=0,c=0,p=0,d=0,f=0.0,m=0,_=0,g=0,v=0,F=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,P=0,N=0,O=0,z=0,B=0,U=0,R=0,j=0,G=0,X=0,H=0,Y=0,W=0,V=0,q=0,C=0,K=0,M=0,Z=0,I=0,D=0,J=0,Q=0,L=0;L=ge;ge=ge+624|0;Z=L+24|0;D=L+16|0;I=L+588|0;V=L+576|0;M=L;H=L+536|0;Q=L+8|0;J=L+528|0;N=(e|0)!=0;O=H+40|0;X=O;H=H+39|0;Y=Q+4|0;W=V+12|0;V=V+11|0;q=I;C=W;K=C-q|0;z=-2-q|0;B=C+2|0;U=Z+288|0;R=I+9|0;j=R;G=I+8|0;s=0;m=t;o=0;t=0;e:while(1){do{if((s|0)>-1)if((o|0)>(2147483647-s|0)){s=re()|0;fe[s>>2]=75;s=-1;break}else{s=o+s|0;break}}while(0);o=de[m>>0]|0;if(!(o<<24>>24)){P=245;break}else a=m;t:while(1){switch(o<<24>>24){case 37:{o=a;P=9;break t}case 0:{o=a;break t}default:{}}k=a+1|0;o=de[k>>0]|0;a=k}t:do{if((P|0)==9)while(1){P=0;if((de[o+1>>0]|0)!=37)break t;a=a+1|0;o=o+2|0;if((de[o>>0]|0)==37)P=9;else break}}while(0);g=a-m|0;if(N?(fe[e>>2]&32|0)==0:0)ne(m,g,e)|0;if((a|0)!=(m|0)){m=o;o=g;continue}h=o+1|0;a=de[h>>0]|0;l=(a<<24>>24)+-48|0;if(l>>>0<10){k=(de[o+2>>0]|0)==36;h=k?o+3|0:h;a=de[h>>0]|0;d=k?l:-1;t=k?1:t}else d=-1;o=a<<24>>24;t:do{if((o&-32|0)==32){l=0;while(1){if(!(1<>24)+-32|l;h=h+1|0;a=de[h>>0]|0;o=a<<24>>24;if((o&-32|0)!=32){c=l;o=h;break}}}else{c=0;o=h}}while(0);do{if(a<<24>>24==42){l=o+1|0;a=(de[l>>0]|0)+-48|0;if(a>>>0<10?(de[o+2>>0]|0)==36:0){fe[n+(a<<2)>>2]=10;t=1;o=o+3|0;a=fe[r+((de[l>>0]|0)+-48<<3)>>2]|0}else{if(t){s=-1;break e}if(!N){_=c;o=l;t=0;k=0;break}t=(fe[i>>2]|0)+(4-1)&~(4-1);a=fe[t>>2]|0;fe[i>>2]=t+4;t=0;o=l}if((a|0)<0){_=c|8192;k=0-a|0}else{_=c;k=a}}else{l=(a<<24>>24)+-48|0;if(l>>>0<10){a=0;do{a=(a*10|0)+l|0;o=o+1|0;l=(de[o>>0]|0)+-48|0}while(l>>>0<10);if((a|0)<0){s=-1;break e}else{_=c;k=a}}else{_=c;k=0}}}while(0);t:do{if((de[o>>0]|0)==46){l=o+1|0;a=de[l>>0]|0;if(a<<24>>24!=42){h=(a<<24>>24)+-48|0;if(h>>>0<10){o=l;a=0}else{o=l;h=0;break}while(1){a=(a*10|0)+h|0;o=o+1|0;h=(de[o>>0]|0)+-48|0;if(h>>>0>=10){h=a;break t}}}l=o+2|0;a=(de[l>>0]|0)+-48|0;if(a>>>0<10?(de[o+3>>0]|0)==36:0){fe[n+(a<<2)>>2]=10;o=o+4|0;h=fe[r+((de[l>>0]|0)+-48<<3)>>2]|0;break}if(t){s=-1;break e}if(N){o=(fe[i>>2]|0)+(4-1)&~(4-1);h=fe[o>>2]|0;fe[i>>2]=o+4;o=l}else{o=l;h=0}}else h=-1}while(0);p=0;while(1){a=(de[o>>0]|0)+-65|0;if(a>>>0>57){s=-1;break e}l=o+1|0;a=de[5359+(p*58|0)+a>>0]|0;c=a&255;if((c+-1|0)>>>0<8){o=l;p=c}else{A=l;break}}if(!(a<<24>>24)){s=-1;break}l=(d|0)>-1;do{if(a<<24>>24==19)if(l){s=-1;break e}else P=52;else{if(l){fe[n+(d<<2)>>2]=c;E=r+(d<<3)|0;S=fe[E+4>>2]|0;P=M;fe[P>>2]=fe[E>>2];fe[P+4>>2]=S;P=52;break}if(!N){s=0;break e}Hi(M,c,i)}}while(0);if((P|0)==52?(P=0,!N):0){m=A;o=g;continue}d=de[o>>0]|0;d=(p|0)!=0&(d&15|0)==3?d&-33:d;l=_&-65537;S=(_&8192|0)==0?_:l;t:do{switch(d|0){case 110:switch(p|0){case 0:{fe[fe[M>>2]>>2]=s;m=A;o=g;continue e}case 1:{fe[fe[M>>2]>>2]=s;m=A;o=g;continue e}case 2:{m=fe[M>>2]|0;fe[m>>2]=s;fe[m+4>>2]=((s|0)<0)<<31>>31;m=A;o=g;continue e}case 3:{$[fe[M>>2]>>1]=s;m=A;o=g;continue e}case 4:{de[fe[M>>2]>>0]=s;m=A;o=g;continue e}case 6:{fe[fe[M>>2]>>2]=s;m=A;o=g;continue e}case 7:{m=fe[M>>2]|0;fe[m>>2]=s;fe[m+4>>2]=((s|0)<0)<<31>>31;m=A;o=g;continue e}default:{m=A;o=g;continue e}}case 112:{p=S|8;h=h>>>0>8?h:8;d=120;P=64;break}case 88:case 120:{p=S;P=64;break}case 111:{l=M;a=fe[l>>2]|0;l=fe[l+4>>2]|0;if((a|0)==0&(l|0)==0)o=O;else{o=O;do{o=o+-1|0;de[o>>0]=a&7|48;a=Ji(a|0,l|0,3)|0;l=ie}while(!((a|0)==0&(l|0)==0))}if(!(S&8)){a=S;p=0;c=5839;P=77}else{p=X-o+1|0;a=S;h=(h|0)<(p|0)?p:h;p=0;c=5839;P=77}break}case 105:case 100:{a=M;o=fe[a>>2]|0;a=fe[a+4>>2]|0;if((a|0)<0){o=ae(0,0,o|0,a|0)|0;a=ie;l=M;fe[l>>2]=o;fe[l+4>>2]=a;l=1;c=5839;P=76;break t}if(!(S&2048)){c=S&1;l=c;c=(c|0)==0?5839:5841;P=76}else{l=1;c=5840;P=76}break}case 117:{a=M;o=fe[a>>2]|0;a=fe[a+4>>2]|0;l=0;c=5839;P=76;break}case 99:{de[H>>0]=fe[M>>2];m=H;a=1;p=0;d=5839;o=O;break}case 109:{o=re()|0;o=xi(fe[o>>2]|0)|0;P=82;break}case 115:{o=fe[M>>2]|0;o=(o|0)!=0?o:5849;P=82;break}case 67:{fe[Q>>2]=fe[M>>2];fe[Y>>2]=0;fe[M>>2]=Q;h=-1;P=86;break}case 83:{if(!h){oe(e,32,k,0,S);o=0;P=98}else P=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[M>>3];fe[D>>2]=0;ee[te>>3]=u;if((fe[te+4>>2]|0)>=0)if(!(S&2048)){E=S&1;w=E;E=(E|0)==0?5857:5862}else{w=1;E=5859}else{u=-u;w=1;E=5856}ee[te>>3]=u;T=fe[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){f=+Ei(u,D)*2.0;a=f!=0.0;if(a)fe[D>>2]=(fe[D>>2]|0)+-1;b=d|32;if((b|0)==97){m=d&32;g=(m|0)==0?E:E+9|0;_=w|2;o=12-h|0;do{if(!(h>>>0>11|(o|0)==0)){u=8.0;do{o=o+-1|0;u=u*16.0}while((o|0)!=0);if((de[g>>0]|0)==45){u=-(u+(-f-u));break}else{u=f+u-u;break}}else u=f}while(0);a=fe[D>>2]|0;o=(a|0)<0?0-a|0:a;o=se(o,((o|0)<0)<<31>>31,W)|0;if((o|0)==(W|0)){de[V>>0]=48;o=V}de[o+-1>>0]=(a>>31&2)+43;p=o+-2|0;de[p>>0]=d+15;c=(h|0)<1;l=(S&8|0)==0;a=I;while(1){E=~~u;o=a+1|0;de[a>>0]=me[5823+E>>0]|m;u=(u-+(E|0))*16.0;do{if((o-q|0)==1){if(l&(c&u==0.0))break;de[o>>0]=46;o=a+2|0}}while(0);if(!(u!=0.0))break;else a=o}h=(h|0)!=0&(z+o|0)<(h|0)?B+h-p|0:K-p+o|0;l=h+_|0;oe(e,32,k,l,S);if(!(fe[e>>2]&32))ne(g,_,e)|0;oe(e,48,k,l,S^65536);o=o-q|0;if(!(fe[e>>2]&32))ne(I,o,e)|0;a=C-p|0;oe(e,48,h-(o+a)|0,0,0);if(!(fe[e>>2]&32))ne(p,a,e)|0;oe(e,32,k,l,S^8192);o=(l|0)<(k|0)?k:l;break}o=(h|0)<0?6:h;if(a){a=(fe[D>>2]|0)+-28|0;fe[D>>2]=a;u=f*268435456.0}else{u=f;a=fe[D>>2]|0}T=(a|0)<0?Z:U;x=T;a=T;do{y=~~u>>>0;fe[a>>2]=y;a=a+4|0;u=(u-+(y>>>0))*1.0e9}while(u!=0.0);l=a;a=fe[D>>2]|0;if((a|0)>0){c=T;while(1){p=(a|0)>29?29:a;h=l+-4|0;do{if(h>>>0>>0)h=c;else{a=0;do{y=Qi(fe[h>>2]|0,0,p|0)|0;y=$i(y|0,ie|0,a|0,0)|0;a=ie;F=lr(y|0,a|0,1e9,0)|0;fe[h>>2]=F;a=ar(y|0,a|0,1e9,0)|0;h=h+-4|0}while(h>>>0>=c>>>0);if(!a){h=c;break}h=c+-4|0;fe[h>>2]=a}}while(0);while(1){if(l>>>0<=h>>>0)break;a=l+-4|0;if(!(fe[a>>2]|0))l=a;else break}a=(fe[D>>2]|0)-p|0;fe[D>>2]=a;if((a|0)>0)c=h;else break}}else h=T;if((a|0)<0){g=((o+25|0)/9|0)+1|0;v=(b|0)==102;m=h;while(1){_=0-a|0;_=(_|0)>9?9:_;do{if(m>>>0>>0){a=(1<<_)+-1|0;c=1e9>>>_;h=0;p=m;do{y=fe[p>>2]|0;fe[p>>2]=(y>>>_)+h;h=ve(y&a,c)|0;p=p+4|0}while(p>>>0>>0);a=(fe[m>>2]|0)==0?m+4|0:m;if(!h){h=a;break}fe[l>>2]=h;h=a;l=l+4|0}else h=(fe[m>>2]|0)==0?m+4|0:m}while(0);a=v?T:h;l=(l-a>>2|0)>(g|0)?a+(g<<2)|0:l;a=(fe[D>>2]|0)+_|0;fe[D>>2]=a;if((a|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){a=(x-m>>2)*9|0;c=fe[m>>2]|0;if(c>>>0<10)break;else h=10;do{h=h*10|0;a=a+1|0}while(c>>>0>=h>>>0)}else a=0}while(0);F=(b|0)==103;y=(o|0)!=0;h=o-((b|0)!=102?a:0)+((y&F)<<31>>31)|0;if((h|0)<(((l-x>>2)*9|0)+-9|0)){p=h+9216|0;v=(p|0)/9|0;h=T+(v+-1023<<2)|0;p=((p|0)%9|0)+1|0;if((p|0)<9){c=10;do{c=c*10|0;p=p+1|0}while((p|0)!=9)}else c=10;_=fe[h>>2]|0;g=(_>>>0)%(c>>>0)|0;if((g|0)==0?(T+(v+-1022<<2)|0)==(l|0):0)c=m;else P=163;do{if((P|0)==163){P=0;f=(((_>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;p=(c|0)/2|0;do{if(g>>>0

>>0&(o|0)>-1)}oe(e,48,o+18|0,18,0);if(fe[e>>2]&32)break;ne(d,C-d|0,e)|0}}while(0);oe(e,32,k,g,S^8192);o=(g|0)<(k|0)?k:g}else{p=(d&32|0)!=0;c=u!=u|0.0!=0.0;a=c?0:w;h=a+3|0;oe(e,32,k,h,l);o=fe[e>>2]|0;if(!(o&32)){ne(E,a,e)|0;o=fe[e>>2]|0}if(!(o&32))ne(c?p?5883:5887:p?5875:5879,3,e)|0;oe(e,32,k,h,S^8192);o=(h|0)<(k|0)?k:h}}while(0);m=A;continue e}default:{l=S;a=h;p=0;d=5839;o=O}}}while(0);t:do{if((P|0)==64){l=M;a=fe[l>>2]|0;l=fe[l+4>>2]|0;c=d&32;if(!((a|0)==0&(l|0)==0)){o=O;do{o=o+-1|0;de[o>>0]=me[5823+(a&15)>>0]|c;a=Ji(a|0,l|0,4)|0;l=ie}while(!((a|0)==0&(l|0)==0));P=M;if((p&8|0)==0|(fe[P>>2]|0)==0&(fe[P+4>>2]|0)==0){a=p;p=0;c=5839;P=77}else{a=p;p=2;c=5839+(d>>4)|0;P=77}}else{o=O;a=p;p=0;c=5839;P=77}}else if((P|0)==76){o=se(o,a,O)|0;a=S;p=l;P=77}else if((P|0)==82){P=0;S=Bi(o,0,h)|0;E=(S|0)==0;m=o;a=E?h:S-o|0;p=0;d=5839;o=E?o+h|0:S}else if((P|0)==86){P=0;a=0;o=0;c=fe[M>>2]|0;while(1){l=fe[c>>2]|0;if(!l)break;o=Ai(J,l)|0;if((o|0)<0|o>>>0>(h-a|0)>>>0)break;a=o+a|0;if(h>>>0>a>>>0)c=c+4|0;else break}if((o|0)<0){s=-1;break e}oe(e,32,k,a,S);if(!a){o=0;P=98}else{l=0;h=fe[M>>2]|0;while(1){o=fe[h>>2]|0;if(!o){o=a;P=98;break t}o=Ai(J,o)|0;l=o+l|0;if((l|0)>(a|0)){o=a;P=98;break t}if(!(fe[e>>2]&32))ne(J,o,e)|0;if(l>>>0>=a>>>0){o=a;P=98;break}else h=h+4|0}}}}while(0);if((P|0)==98){P=0;oe(e,32,k,o,S^8192);m=A;o=(k|0)>(o|0)?k:o;continue}if((P|0)==77){P=0;l=(h|0)>-1?a&-65537:a;a=M;a=(fe[a>>2]|0)!=0|(fe[a+4>>2]|0)!=0;if((h|0)!=0|a){a=(a&1^1)+(X-o)|0;m=o;a=(h|0)>(a|0)?h:a;d=c;o=O}else{m=O;a=0;d=c;o=O}}c=o-m|0;a=(a|0)<(c|0)?c:a;h=p+a|0;o=(k|0)<(h|0)?h:k;oe(e,32,o,h,l);if(!(fe[e>>2]&32))ne(d,p,e)|0;oe(e,48,o,h,l^65536);oe(e,48,a,c,0);if(!(fe[e>>2]&32))ne(m,c,e)|0;oe(e,32,o,h,l^8192);m=A}e:do{if((P|0)==245)if(!e)if(t){s=1;while(1){t=fe[n+(s<<2)>>2]|0;if(!t)break;Hi(r+(s<<3)|0,t,i);s=s+1|0;if((s|0)>=10){s=1;break e}}if((s|0)<10)while(1){if(fe[n+(s<<2)>>2]|0){s=-1;break e}s=s+1|0;if((s|0)>=10){s=1;break}}else s=1}else s=0}while(0);ge=L;return s|0}function Gi(e){e=e|0;if(!(fe[e+68>>2]|0))g(e);return}function Xi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0;r=e+20|0;n=fe[r>>2]|0;e=(fe[e+16>>2]|0)-n|0;e=e>>>0>i>>>0?i:e;er(n|0,t|0,e|0)|0;fe[r>>2]=(fe[r>>2]|0)+e;return i|0}function Hi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{r=(fe[i>>2]|0)+(4-1)&~(4-1);t=fe[r>>2]|0;fe[i>>2]=r+4;fe[e>>2]=t;break e}case 10:{r=(fe[i>>2]|0)+(4-1)&~(4-1);t=fe[r>>2]|0;fe[i>>2]=r+4;r=e;fe[r>>2]=t;fe[r+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{r=(fe[i>>2]|0)+(4-1)&~(4-1);t=fe[r>>2]|0;fe[i>>2]=r+4;r=e;fe[r>>2]=t;fe[r+4>>2]=0;break e}case 12:{r=(fe[i>>2]|0)+(8-1)&~(8-1);t=r;n=fe[t>>2]|0;t=fe[t+4>>2]|0;fe[i>>2]=r+8;r=e;fe[r>>2]=n;fe[r+4>>2]=t;break e}case 13:{n=(fe[i>>2]|0)+(4-1)&~(4-1);r=fe[n>>2]|0;fe[i>>2]=n+4;r=(r&65535)<<16>>16;n=e;fe[n>>2]=r;fe[n+4>>2]=((r|0)<0)<<31>>31;break e}case 14:{n=(fe[i>>2]|0)+(4-1)&~(4-1);r=fe[n>>2]|0;fe[i>>2]=n+4;n=e;fe[n>>2]=r&65535;fe[n+4>>2]=0;break e}case 15:{n=(fe[i>>2]|0)+(4-1)&~(4-1);r=fe[n>>2]|0;fe[i>>2]=n+4;r=(r&255)<<24>>24;n=e;fe[n>>2]=r;fe[n+4>>2]=((r|0)<0)<<31>>31;break e}case 16:{n=(fe[i>>2]|0)+(4-1)&~(4-1);r=fe[n>>2]|0;fe[i>>2]=n+4;n=e;fe[n>>2]=r&255;fe[n+4>>2]=0;break e}case 17:{n=(fe[i>>2]|0)+(8-1)&~(8-1);s=+ee[n>>3];fe[i>>2]=n+8;ee[e>>3]=s;break e}case 18:{n=(fe[i>>2]|0)+(8-1)&~(8-1);s=+ee[n>>3];fe[i>>2]=n+8;ee[e>>3]=s;break e}default:break e}}while(0)}while(0)}function se(e,t,i){e=e|0;t=t|0;i=i|0;var r=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){r=lr(e|0,t|0,10,0)|0;i=i+-1|0;de[i>>0]=r|48;r=ar(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=r;t=ie}else{e=r;break}}if(e)while(1){i=i+-1|0;de[i>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return i|0}function oe(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0;a=ge;ge=ge+256|0;o=a;do{if((i|0)>(r|0)&(n&73728|0)==0){n=i-r|0;G(o|0,t|0,(n>>>0>256?256:n)|0)|0;t=fe[e>>2]|0;s=(t&32|0)==0;if(n>>>0>255){r=i-r|0;do{if(s){ne(o,256,e)|0;t=fe[e>>2]|0}n=n+-256|0;s=(t&32|0)==0}while(n>>>0>255);if(s)n=r&255;else break}else if(!s)break;ne(o,n,e)|0}}while(0);ge=a}function Yi(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0,b=0,x=0,T=0,w=0,E=0,S=0,A=0,k=0,F=0,N=0,P=0,O=0,R=0,C=0,M=0,I=0,D=0,L=0;do{if(e>>>0<245){d=e>>>0<11?16:e+11&-8;e=d>>>3;a=fe[151]|0;i=a>>>e;if(i&3){e=(i&1^1)+e|0;r=e<<1;i=644+(r<<2)|0;r=644+(r+2<<2)|0;n=fe[r>>2]|0;s=n+8|0;o=fe[s>>2]|0;do{if((i|0)!=(o|0)){if(o>>>0<(fe[155]|0)>>>0)B();t=o+12|0;if((fe[t>>2]|0)==(n|0)){fe[t>>2]=i;fe[r>>2]=o;break}else B()}else fe[151]=a&~(1<>2]=L|3;L=n+(L|4)|0;fe[L>>2]=fe[L>>2]|1;L=s;return L|0}o=fe[153]|0;if(d>>>0>o>>>0){if(i){r=2<>>12&16;r=r>>>l;n=r>>>5&8;r=r>>>n;s=r>>>2&4;r=r>>>s;i=r>>>1&2;r=r>>>i;e=r>>>1&1;e=(n|l|s|i|e)+(r>>>e)|0;r=e<<1;i=644+(r<<2)|0;r=644+(r+2<<2)|0;s=fe[r>>2]|0;l=s+8|0;n=fe[l>>2]|0;do{if((i|0)!=(n|0)){if(n>>>0<(fe[155]|0)>>>0)B();t=n+12|0;if((fe[t>>2]|0)==(s|0)){fe[t>>2]=i;fe[r>>2]=n;u=fe[153]|0;break}else B()}else{fe[151]=a&~(1<>2]=d|3;a=s+d|0;fe[s+(d|4)>>2]=o|1;fe[s+L>>2]=o;if(u){n=fe[156]|0;i=u>>>3;t=i<<1;r=644+(t<<2)|0;e=fe[151]|0;i=1<>2]|0;if(t>>>0<(fe[155]|0)>>>0)B();else{h=e;c=t}}else{fe[151]=e|i;h=644+(t+2<<2)|0;c=r}fe[h>>2]=n;fe[c+12>>2]=n;fe[n+8>>2]=c;fe[n+12>>2]=r}fe[153]=o;fe[156]=a;L=l;return L|0}e=fe[152]|0;if(e){i=(e&0-e)+-1|0;D=i>>>12&16;i=i>>>D;I=i>>>5&8;i=i>>>I;L=i>>>2&4;i=i>>>L;e=i>>>1&2;i=i>>>e;r=i>>>1&1;r=fe[908+((I|D|L|e|r)+(i>>>r)<<2)>>2]|0;i=(fe[r+4>>2]&-8)-d|0;e=r;while(1){t=fe[e+16>>2]|0;if(!t){t=fe[e+20>>2]|0;if(!t){l=i;break}}e=(fe[t+4>>2]&-8)-d|0;L=e>>>0>>0;i=L?e:i;e=t;r=L?t:r}s=fe[155]|0;if(r>>>0>>0)B();a=r+d|0;if(r>>>0>=a>>>0)B();o=fe[r+24>>2]|0;i=fe[r+12>>2]|0;do{if((i|0)==(r|0)){e=r+20|0;t=fe[e>>2]|0;if(!t){e=r+16|0;t=fe[e>>2]|0;if(!t){p=0;break}}while(1){i=t+20|0;n=fe[i>>2]|0;if(n){t=n;e=i;continue}i=t+16|0;n=fe[i>>2]|0;if(!n)break;else{t=n;e=i}}if(e>>>0>>0)B();else{fe[e>>2]=0;p=t;break}}else{n=fe[r+8>>2]|0;if(n>>>0>>0)B();t=n+12|0;if((fe[t>>2]|0)!=(r|0))B();e=i+8|0;if((fe[e>>2]|0)==(r|0)){fe[t>>2]=i;fe[e>>2]=n;p=i;break}else B()}}while(0);do{if(o){t=fe[r+28>>2]|0;e=908+(t<<2)|0;if((r|0)==(fe[e>>2]|0)){fe[e>>2]=p;if(!p){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();t=o+16|0;if((fe[t>>2]|0)==(r|0))fe[t>>2]=p;else fe[o+20>>2]=p;if(!p)break}e=fe[155]|0;if(p>>>0>>0)B();fe[p+24>>2]=o;t=fe[r+16>>2]|0;do{if(t)if(t>>>0>>0)B();else{fe[p+16>>2]=t;fe[t+24>>2]=p;break}}while(0);t=fe[r+20>>2]|0;if(t)if(t>>>0<(fe[155]|0)>>>0)B();else{fe[p+20>>2]=t;fe[t+24>>2]=p;break}}}while(0);if(l>>>0<16){L=l+d|0;fe[r+4>>2]=L|3;L=r+(L+4)|0;fe[L>>2]=fe[L>>2]|1}else{fe[r+4>>2]=d|3;fe[r+(d|4)>>2]=l|1;fe[r+(l+d)>>2]=l;t=fe[153]|0;if(t){s=fe[156]|0;i=t>>>3;t=i<<1;n=644+(t<<2)|0;e=fe[151]|0;i=1<>2]|0;if(e>>>0<(fe[155]|0)>>>0)B();else{f=t;m=e}}else{fe[151]=e|i;f=644+(t+2<<2)|0;m=n}fe[f>>2]=s;fe[m+12>>2]=s;fe[s+8>>2]=m;fe[s+12>>2]=n}fe[153]=l;fe[156]=a}L=r+8|0;return L|0}else m=d}else m=d}else if(e>>>0<=4294967231){e=e+11|0;c=e&-8;h=fe[152]|0;if(h){i=0-c|0;e=e>>>8;if(e)if(c>>>0>16777215)u=31;else{m=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;u=14-(f|m|u)+(b<>>15)|0;u=c>>>(u+7|0)&1|u<<1}else u=0;e=fe[908+(u<<2)>>2]|0;e:do{if(!e){n=0;e=0;b=86}else{o=i;n=0;a=c<<((u|0)==31?0:25-(u>>>1)|0);l=e;e=0;while(1){s=fe[l+4>>2]&-8;i=s-c|0;if(i>>>0>>0)if((s|0)==(c|0)){s=l;e=l;b=90;break e}else e=l;else i=o;b=fe[l+20>>2]|0;l=fe[l+16+(a>>>31<<2)>>2]|0;n=(b|0)==0|(b|0)==(l|0)?n:b;if(!l){b=86;break}else{o=i;a=a<<1}}}}while(0);if((b|0)==86){if((n|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>p;h=e>>>5&8;e=e>>>h;f=e>>>2&4;e=e>>>f;m=e>>>1&2;e=e>>>m;n=e>>>1&1;n=fe[908+((h|p|f|m|n)+(e>>>n)<<2)>>2]|0;e=0}if(!n){a=i;l=e}else{s=n;b=90}}if((b|0)==90)while(1){b=0;m=(fe[s+4>>2]&-8)-c|0;n=m>>>0>>0;i=n?m:i;e=n?s:e;n=fe[s+16>>2]|0;if(n){s=n;b=90;continue}s=fe[s+20>>2]|0;if(!s){a=i;l=e;break}else b=90}if((l|0)!=0?a>>>0<((fe[153]|0)-c|0)>>>0:0){n=fe[155]|0;if(l>>>0>>0)B();o=l+c|0;if(l>>>0>=o>>>0)B();s=fe[l+24>>2]|0;i=fe[l+12>>2]|0;do{if((i|0)==(l|0)){e=l+20|0;t=fe[e>>2]|0;if(!t){e=l+16|0;t=fe[e>>2]|0;if(!t){d=0;break}}while(1){i=t+20|0;r=fe[i>>2]|0;if(r){t=r;e=i;continue}i=t+16|0;r=fe[i>>2]|0;if(!r)break;else{t=r;e=i}}if(e>>>0>>0)B();else{fe[e>>2]=0;d=t;break}}else{r=fe[l+8>>2]|0;if(r>>>0>>0)B();t=r+12|0;if((fe[t>>2]|0)!=(l|0))B();e=i+8|0;if((fe[e>>2]|0)==(l|0)){fe[t>>2]=i;fe[e>>2]=r;d=i;break}else B()}}while(0);do{if(s){t=fe[l+28>>2]|0;e=908+(t<<2)|0;if((l|0)==(fe[e>>2]|0)){fe[e>>2]=d;if(!d){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();t=s+16|0;if((fe[t>>2]|0)==(l|0))fe[t>>2]=d;else fe[s+20>>2]=d;if(!d)break}e=fe[155]|0;if(d>>>0>>0)B();fe[d+24>>2]=s;t=fe[l+16>>2]|0;do{if(t)if(t>>>0>>0)B();else{fe[d+16>>2]=t;fe[t+24>>2]=d;break}}while(0);t=fe[l+20>>2]|0;if(t)if(t>>>0<(fe[155]|0)>>>0)B();else{fe[d+20>>2]=t;fe[t+24>>2]=d;break}}}while(0);e:do{if(a>>>0>=16){fe[l+4>>2]=c|3;fe[l+(c|4)>>2]=a|1;fe[l+(a+c)>>2]=a;t=a>>>3;if(a>>>0<256){e=t<<1;r=644+(e<<2)|0;i=fe[151]|0;t=1<>2]|0;if(e>>>0<(fe[155]|0)>>>0)B();else{g=t;v=e}}else{fe[151]=i|t;g=644+(e+2<<2)|0;v=r}fe[g>>2]=o;fe[v+12>>2]=o;fe[l+(c+8)>>2]=v;fe[l+(c+12)>>2]=r;break}t=a>>>8;if(t)if(a>>>0>16777215)r=31;else{D=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;r=14-(I|D|r)+(L<>>15)|0;r=a>>>(r+7|0)&1|r<<1}else r=0;t=908+(r<<2)|0;fe[l+(c+28)>>2]=r;fe[l+(c+20)>>2]=0;fe[l+(c+16)>>2]=0;e=fe[152]|0;i=1<>2]=o;fe[l+(c+24)>>2]=t;fe[l+(c+12)>>2]=o;fe[l+(c+8)>>2]=o;break}t=fe[t>>2]|0;t:do{if((fe[t+4>>2]&-8|0)!=(a|0)){r=a<<((r|0)==31?0:25-(r>>>1)|0);while(1){e=t+16+(r>>>31<<2)|0;i=fe[e>>2]|0;if(!i)break;if((fe[i+4>>2]&-8|0)==(a|0)){w=i;break t}else{r=r<<1;t=i}}if(e>>>0<(fe[155]|0)>>>0)B();else{fe[e>>2]=o;fe[l+(c+24)>>2]=t;fe[l+(c+12)>>2]=o;fe[l+(c+8)>>2]=o;break e}}else w=t}while(0);t=w+8|0;e=fe[t>>2]|0;L=fe[155]|0;if(e>>>0>=L>>>0&w>>>0>=L>>>0){fe[e+12>>2]=o;fe[t>>2]=o;fe[l+(c+8)>>2]=e;fe[l+(c+12)>>2]=w;fe[l+(c+24)>>2]=0;break}else B()}else{L=a+c|0;fe[l+4>>2]=L|3;L=l+(L+4)|0;fe[L>>2]=fe[L>>2]|1}}while(0);L=l+8|0;return L|0}else m=c}else m=c}else m=-1}while(0);i=fe[153]|0;if(i>>>0>=m>>>0){t=i-m|0;e=fe[156]|0;if(t>>>0>15){fe[156]=e+m;fe[153]=t;fe[e+(m+4)>>2]=t|1;fe[e+i>>2]=t;fe[e+4>>2]=m|3}else{fe[153]=0;fe[156]=0;fe[e+4>>2]=i|3;L=e+(i+4)|0;fe[L>>2]=fe[L>>2]|1}L=e+8|0;return L|0}e=fe[154]|0;if(e>>>0>m>>>0){D=e-m|0;fe[154]=D;L=fe[157]|0;fe[157]=L+m;fe[L+(m+4)>>2]=D|1;fe[L+4>>2]=m|3;L=L+8|0;return L|0}do{if(!(fe[269]|0)){e=$e(30)|0;if(!(e+-1&e)){fe[271]=e;fe[270]=e;fe[272]=-1;fe[273]=-1;fe[274]=0;fe[262]=0;w=(ut(0)|0)&-16^1431655768;fe[269]=w;break}else B()}}while(0);l=m+48|0;a=fe[271]|0;u=m+47|0;o=a+u|0;a=0-a|0;h=o&a;if(h>>>0<=m>>>0){L=0;return L|0}e=fe[261]|0;if((e|0)!=0?(v=fe[259]|0,w=v+h|0,w>>>0<=v>>>0|w>>>0>e>>>0):0){L=0;return L|0}e:do{if(!(fe[262]&4)){e=fe[157]|0;t:do{if(e){n=1052;while(1){i=fe[n>>2]|0;if(i>>>0<=e>>>0?(_=n+4|0,(i+(fe[_>>2]|0)|0)>>>0>e>>>0):0){s=n;e=_;break}n=fe[n+8>>2]|0;if(!n){b=174;break t}}i=o-(fe[154]|0)&a;if(i>>>0<2147483647){n=z(i|0)|0;w=(n|0)==((fe[s>>2]|0)+(fe[e>>2]|0)|0);e=w?i:0;if(w){if((n|0)!=(-1|0)){x=n;f=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){s=z(0)|0;if((s|0)!=(-1|0)){e=s;i=fe[270]|0;n=i+-1|0;if(!(n&e))i=h;else i=h-e+(n+e&0-i)|0;e=fe[259]|0;n=e+i|0;if(i>>>0>m>>>0&i>>>0<2147483647){w=fe[261]|0;if((w|0)!=0?n>>>0<=e>>>0|n>>>0>w>>>0:0){e=0;break}n=z(i|0)|0;w=(n|0)==(s|0);e=w?i:0;if(w){x=s;f=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){s=0-i|0;do{if(l>>>0>i>>>0&(i>>>0<2147483647&(n|0)!=(-1|0))?(y=fe[271]|0,y=u-i+y&0-y,y>>>0<2147483647):0)if((z(y|0)|0)==(-1|0)){z(s|0)|0;break t}else{i=y+i|0;break}}while(0);if((n|0)!=(-1|0)){x=n;f=i;b=194;break e}}}while(0);fe[262]=fe[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?h>>>0<2147483647:0)?(x=z(h|0)|0,T=z(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(T|0)!=(-1|0))):0)?(E=T-x|0,S=E>>>0>(m+40|0)>>>0,S):0){f=S?E:e;b=194}if((b|0)==194){e=(fe[259]|0)+f|0;fe[259]=e;if(e>>>0>(fe[260]|0)>>>0)fe[260]=e;o=fe[157]|0;e:do{if(o){s=1052;do{e=fe[s>>2]|0;i=s+4|0;n=fe[i>>2]|0;if((x|0)==(e+n|0)){A=e;k=i;F=n;N=s;b=204;break}s=fe[s+8>>2]|0}while((s|0)!=0);if(((b|0)==204?(fe[N+12>>2]&8|0)==0:0)?o>>>0>>0&o>>>0>=A>>>0:0){fe[k>>2]=F+f;L=(fe[154]|0)+f|0;D=o+8|0;D=(D&7|0)==0?0:0-D&7;I=L-D|0;fe[157]=o+D;fe[154]=I;fe[o+(D+4)>>2]=I|1;fe[o+(L+4)>>2]=40;fe[158]=fe[273];break}e=fe[155]|0;if(x>>>0>>0){fe[155]=x;e=x}i=x+f|0;s=1052;while(1){if((fe[s>>2]|0)==(i|0)){n=s;i=s;b=212;break}s=fe[s+8>>2]|0;if(!s){i=1052;break}}if((b|0)==212)if(!(fe[i+12>>2]&8)){fe[n>>2]=x;p=i+4|0;fe[p>>2]=(fe[p>>2]|0)+f;p=x+8|0;p=(p&7|0)==0?0:0-p&7;u=x+(f+8)|0;u=(u&7|0)==0?0:0-u&7;t=x+(u+f)|0;c=p+m|0;d=x+c|0;h=t-(x+p)-m|0;fe[x+(p+4)>>2]=m|3;t:do{if((t|0)!=(o|0)){if((t|0)==(fe[156]|0)){L=(fe[153]|0)+h|0;fe[153]=L;fe[156]=d;fe[x+(c+4)>>2]=L|1;fe[x+(L+c)>>2]=L;break}a=f+4|0;i=fe[x+(a+u)>>2]|0;if((i&3|0)==1){l=i&-8;s=i>>>3;i:do{if(i>>>0>=256){o=fe[x+((u|24)+f)>>2]|0;r=fe[x+(f+12+u)>>2]|0;do{if((r|0)==(t|0)){n=u|16;r=x+(a+n)|0;i=fe[r>>2]|0;if(!i){r=x+(n+f)|0;i=fe[r>>2]|0;if(!i){M=0;break}}while(1){n=i+20|0;s=fe[n>>2]|0;if(s){i=s;r=n;continue}n=i+16|0;s=fe[n>>2]|0;if(!s)break;else{i=s;r=n}}if(r>>>0>>0)B();else{fe[r>>2]=0;M=i;break}}else{n=fe[x+((u|8)+f)>>2]|0;if(n>>>0>>0)B();e=n+12|0;if((fe[e>>2]|0)!=(t|0))B();i=r+8|0;if((fe[i>>2]|0)==(t|0)){fe[e>>2]=r;fe[i>>2]=n;M=r;break}else B()}}while(0);if(!o)break;e=fe[x+(f+28+u)>>2]|0;i=908+(e<<2)|0;do{if((t|0)!=(fe[i>>2]|0)){if(o>>>0<(fe[155]|0)>>>0)B();e=o+16|0;if((fe[e>>2]|0)==(t|0))fe[e>>2]=M;else fe[o+20>>2]=M;if(!M)break i}else{fe[i>>2]=M;if(M)break;fe[152]=fe[152]&~(1<>>0>>0)B();fe[M+24>>2]=o;t=u|16;e=fe[x+(t+f)>>2]|0;do{if(e)if(e>>>0>>0)B();else{fe[M+16>>2]=e;fe[e+24>>2]=M;break}}while(0);t=fe[x+(a+t)>>2]|0;if(!t)break;if(t>>>0<(fe[155]|0)>>>0)B();else{fe[M+20>>2]=t;fe[t+24>>2]=M;break}}else{r=fe[x+((u|8)+f)>>2]|0;n=fe[x+(f+12+u)>>2]|0;i=644+(s<<1<<2)|0;do{if((r|0)!=(i|0)){if(r>>>0>>0)B();if((fe[r+12>>2]|0)==(t|0))break;B()}}while(0);if((n|0)==(r|0)){fe[151]=fe[151]&~(1<>>0>>0)B();e=n+8|0;if((fe[e>>2]|0)==(t|0)){P=e;break}B()}}while(0);fe[r+12>>2]=n;fe[P>>2]=r}}while(0);t=x+((l|u)+f)|0;n=l+h|0}else n=h;t=t+4|0;fe[t>>2]=fe[t>>2]&-2;fe[x+(c+4)>>2]=n|1;fe[x+(n+c)>>2]=n;t=n>>>3;if(n>>>0<256){e=t<<1;r=644+(e<<2)|0;i=fe[151]|0;t=1<>2]|0;if(e>>>0>=(fe[155]|0)>>>0){I=t;D=e;break}B()}}while(0);fe[I>>2]=d;fe[D+12>>2]=d;fe[x+(c+8)>>2]=D;fe[x+(c+12)>>2]=r;break}t=n>>>8;do{if(!t)r=0;else{if(n>>>0>16777215){r=31;break}I=(t+1048320|0)>>>16&8;D=t<>>16&4;D=D<>>16&2;r=14-(M|I|r)+(D<>>15)|0;r=n>>>(r+7|0)&1|r<<1}}while(0);t=908+(r<<2)|0;fe[x+(c+28)>>2]=r;fe[x+(c+20)>>2]=0;fe[x+(c+16)>>2]=0;e=fe[152]|0;i=1<>2]=d;fe[x+(c+24)>>2]=t;fe[x+(c+12)>>2]=d;fe[x+(c+8)>>2]=d;break}t=fe[t>>2]|0;i:do{if((fe[t+4>>2]&-8|0)!=(n|0)){r=n<<((r|0)==31?0:25-(r>>>1)|0);while(1){e=t+16+(r>>>31<<2)|0;i=fe[e>>2]|0;if(!i)break;if((fe[i+4>>2]&-8|0)==(n|0)){L=i;break i}else{r=r<<1;t=i}}if(e>>>0<(fe[155]|0)>>>0)B();else{fe[e>>2]=d;fe[x+(c+24)>>2]=t;fe[x+(c+12)>>2]=d;fe[x+(c+8)>>2]=d;break t}}else L=t}while(0);t=L+8|0;e=fe[t>>2]|0;D=fe[155]|0;if(e>>>0>=D>>>0&L>>>0>=D>>>0){fe[e+12>>2]=d;fe[t>>2]=d;fe[x+(c+8)>>2]=e;fe[x+(c+12)>>2]=L;fe[x+(c+24)>>2]=0;break}else B()}else{L=(fe[154]|0)+h|0;fe[154]=L;fe[157]=d;fe[x+(c+4)>>2]=L|1}}while(0);L=x+(p|8)|0;return L|0}else i=1052;while(1){e=fe[i>>2]|0;if(e>>>0<=o>>>0?(t=fe[i+4>>2]|0,r=e+t|0,r>>>0>o>>>0):0)break;i=fe[i+8>>2]|0}n=e+(t+-39)|0;e=e+(t+-47+((n&7|0)==0?0:0-n&7))|0;n=o+16|0;e=e>>>0>>0?o:e;t=e+8|0;i=x+8|0;i=(i&7|0)==0?0:0-i&7;L=f+-40-i|0;fe[157]=x+i;fe[154]=L;fe[x+(i+4)>>2]=L|1;fe[x+(f+-36)>>2]=40;fe[158]=fe[273];i=e+4|0;fe[i>>2]=27;fe[t>>2]=fe[263];fe[t+4>>2]=fe[264];fe[t+8>>2]=fe[265];fe[t+12>>2]=fe[266];fe[263]=x;fe[264]=f;fe[266]=0;fe[265]=t;t=e+28|0;fe[t>>2]=7;if((e+32|0)>>>0>>0)do{L=t;t=t+4|0;fe[t>>2]=7}while((L+8|0)>>>0>>0);if((e|0)!=(o|0)){s=e-o|0;fe[i>>2]=fe[i>>2]&-2;fe[o+4>>2]=s|1;fe[e>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;r=644+(e<<2)|0;i=fe[151]|0;t=1<>2]|0;if(e>>>0<(fe[155]|0)>>>0)B();else{O=t;R=e}}else{fe[151]=i|t;O=644+(e+2<<2)|0;R=r}fe[O>>2]=o;fe[R+12>>2]=o;fe[o+8>>2]=R;fe[o+12>>2]=r;break}t=s>>>8;if(t)if(s>>>0>16777215)r=31;else{D=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;r=14-(I|D|r)+(L<>>15)|0;r=s>>>(r+7|0)&1|r<<1}else r=0;i=908+(r<<2)|0;fe[o+28>>2]=r;fe[o+20>>2]=0;fe[n>>2]=0;t=fe[152]|0;e=1<>2]=o;fe[o+24>>2]=i;fe[o+12>>2]=o;fe[o+8>>2]=o;break}t=fe[i>>2]|0;t:do{if((fe[t+4>>2]&-8|0)!=(s|0)){r=s<<((r|0)==31?0:25-(r>>>1)|0);while(1){e=t+16+(r>>>31<<2)|0;i=fe[e>>2]|0;if(!i)break;if((fe[i+4>>2]&-8|0)==(s|0)){C=i;break t}else{r=r<<1;t=i}}if(e>>>0<(fe[155]|0)>>>0)B();else{fe[e>>2]=o;fe[o+24>>2]=t;fe[o+12>>2]=o;fe[o+8>>2]=o;break e}}else C=t}while(0);t=C+8|0;e=fe[t>>2]|0;L=fe[155]|0;if(e>>>0>=L>>>0&C>>>0>=L>>>0){fe[e+12>>2]=o;fe[t>>2]=o;fe[o+8>>2]=e;fe[o+12>>2]=C;fe[o+24>>2]=0;break}else B()}}else{L=fe[155]|0;if((L|0)==0|x>>>0>>0)fe[155]=x;fe[263]=x;fe[264]=f;fe[266]=0;fe[160]=fe[269];fe[159]=-1;t=0;do{L=t<<1;D=644+(L<<2)|0;fe[644+(L+3<<2)>>2]=D;fe[644+(L+2<<2)>>2]=D;t=t+1|0}while((t|0)!=32);L=x+8|0;L=(L&7|0)==0?0:0-L&7;D=f+-40-L|0;fe[157]=x+L;fe[154]=D;fe[x+(L+4)>>2]=D|1;fe[x+(f+-36)>>2]=40;fe[158]=fe[273]}}while(0);t=fe[154]|0;if(t>>>0>m>>>0){D=t-m|0;fe[154]=D;L=fe[157]|0;fe[157]=L+m;fe[L+(m+4)>>2]=D|1;fe[L+4>>2]=m|3;L=L+8|0;return L|0}}L=re()|0;fe[L>>2]=12;L=0;return L|0}function b(e){e=e|0;var t=0,i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0,y=0;if(!e)return;t=e+-8|0;a=fe[155]|0;if(t>>>0>>0)B();i=fe[e+-4>>2]|0;r=i&3;if((r|0)==1)B();d=i&-8;m=e+(d+-8)|0;do{if(!(i&1)){t=fe[t>>2]|0;if(!r)return;l=-8-t|0;h=e+l|0;c=t+d|0;if(h>>>0>>0)B();if((h|0)==(fe[156]|0)){t=e+(d+-4)|0;i=fe[t>>2]|0;if((i&3|0)!=3){y=h;s=c;break}fe[153]=c;fe[t>>2]=i&-2;fe[e+(l+4)>>2]=c|1;fe[m>>2]=c;return}n=t>>>3;if(t>>>0<256){r=fe[e+(l+8)>>2]|0;i=fe[e+(l+12)>>2]|0;t=644+(n<<1<<2)|0;if((r|0)!=(t|0)){if(r>>>0>>0)B();if((fe[r+12>>2]|0)!=(h|0))B()}if((i|0)==(r|0)){fe[151]=fe[151]&~(1<>>0>>0)B();t=i+8|0;if((fe[t>>2]|0)==(h|0))o=t;else B()}else o=i+8|0;fe[r+12>>2]=i;fe[o>>2]=r;y=h;s=c;break}o=fe[e+(l+24)>>2]|0;r=fe[e+(l+12)>>2]|0;do{if((r|0)==(h|0)){i=e+(l+20)|0;t=fe[i>>2]|0;if(!t){i=e+(l+16)|0;t=fe[i>>2]|0;if(!t){u=0;break}}while(1){r=t+20|0;n=fe[r>>2]|0;if(n){t=n;i=r;continue}r=t+16|0;n=fe[r>>2]|0;if(!n)break;else{t=n;i=r}}if(i>>>0>>0)B();else{fe[i>>2]=0;u=t;break}}else{n=fe[e+(l+8)>>2]|0;if(n>>>0>>0)B();t=n+12|0;if((fe[t>>2]|0)!=(h|0))B();i=r+8|0;if((fe[i>>2]|0)==(h|0)){fe[t>>2]=r;fe[i>>2]=n;u=r;break}else B()}}while(0);if(o){t=fe[e+(l+28)>>2]|0;i=908+(t<<2)|0;if((h|0)==(fe[i>>2]|0)){fe[i>>2]=u;if(!u){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();t=o+16|0;if((fe[t>>2]|0)==(h|0))fe[t>>2]=u;else fe[o+20>>2]=u;if(!u){y=h;s=c;break}}i=fe[155]|0;if(u>>>0>>0)B();fe[u+24>>2]=o;t=fe[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)B();else{fe[u+16>>2]=t;fe[t+24>>2]=u;break}}while(0);t=fe[e+(l+20)>>2]|0;if(t)if(t>>>0<(fe[155]|0)>>>0)B();else{fe[u+20>>2]=t;fe[t+24>>2]=u;y=h;s=c;break}else{y=h;s=c}}else{y=h;s=c}}else{y=t;s=d}}while(0);if(y>>>0>=m>>>0)B();t=e+(d+-4)|0;i=fe[t>>2]|0;if(!(i&1))B();if(!(i&2)){if((m|0)==(fe[157]|0)){v=(fe[154]|0)+s|0;fe[154]=v;fe[157]=y;fe[y+4>>2]=v|1;if((y|0)!=(fe[156]|0))return;fe[156]=0;fe[153]=0;return}if((m|0)==(fe[156]|0)){v=(fe[153]|0)+s|0;fe[153]=v;fe[156]=y;fe[y+4>>2]=v|1;fe[y+v>>2]=v;return}s=(i&-8)+s|0;n=i>>>3;do{if(i>>>0>=256){o=fe[e+(d+16)>>2]|0;t=fe[e+(d|4)>>2]|0;do{if((t|0)==(m|0)){i=e+(d+12)|0;t=fe[i>>2]|0;if(!t){i=e+(d+8)|0;t=fe[i>>2]|0;if(!t){f=0;break}}while(1){r=t+20|0;n=fe[r>>2]|0;if(n){t=n;i=r;continue}r=t+16|0;n=fe[r>>2]|0;if(!n)break;else{t=n;i=r}}if(i>>>0<(fe[155]|0)>>>0)B();else{fe[i>>2]=0;f=t;break}}else{i=fe[e+d>>2]|0;if(i>>>0<(fe[155]|0)>>>0)B();r=i+12|0;if((fe[r>>2]|0)!=(m|0))B();n=t+8|0;if((fe[n>>2]|0)==(m|0)){fe[r>>2]=t;fe[n>>2]=i;f=t;break}else B()}}while(0);if(o){t=fe[e+(d+20)>>2]|0;i=908+(t<<2)|0;if((m|0)==(fe[i>>2]|0)){fe[i>>2]=f;if(!f){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();t=o+16|0;if((fe[t>>2]|0)==(m|0))fe[t>>2]=f;else fe[o+20>>2]=f;if(!f)break}i=fe[155]|0;if(f>>>0>>0)B();fe[f+24>>2]=o;t=fe[e+(d+8)>>2]|0;do{if(t)if(t>>>0>>0)B();else{fe[f+16>>2]=t;fe[t+24>>2]=f;break}}while(0);t=fe[e+(d+12)>>2]|0;if(t)if(t>>>0<(fe[155]|0)>>>0)B();else{fe[f+20>>2]=t;fe[t+24>>2]=f;break}}}else{r=fe[e+d>>2]|0;i=fe[e+(d|4)>>2]|0;t=644+(n<<1<<2)|0;if((r|0)!=(t|0)){if(r>>>0<(fe[155]|0)>>>0)B();if((fe[r+12>>2]|0)!=(m|0))B()}if((i|0)==(r|0)){fe[151]=fe[151]&~(1<>>0<(fe[155]|0)>>>0)B();t=i+8|0;if((fe[t>>2]|0)==(m|0))p=t;else B()}else p=i+8|0;fe[r+12>>2]=i;fe[p>>2]=r}}while(0);fe[y+4>>2]=s|1;fe[y+s>>2]=s;if((y|0)==(fe[156]|0)){fe[153]=s;return}}else{fe[t>>2]=i&-2;fe[y+4>>2]=s|1;fe[y+s>>2]=s}t=s>>>3;if(s>>>0<256){i=t<<1;n=644+(i<<2)|0;r=fe[151]|0;t=1<>2]|0;if(i>>>0<(fe[155]|0)>>>0)B();else{_=t;g=i}}else{fe[151]=r|t;_=644+(i+2<<2)|0;g=n}fe[_>>2]=y;fe[g+12>>2]=y;fe[y+8>>2]=g;fe[y+12>>2]=n;return}t=s>>>8;if(t)if(s>>>0>16777215)n=31;else{_=(t+1048320|0)>>>16&8;g=t<<_;m=(g+520192|0)>>>16&4;g=g<>>16&2;n=14-(m|_|n)+(g<>>15)|0;n=s>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;fe[y+28>>2]=n;fe[y+20>>2]=0;fe[y+16>>2]=0;i=fe[152]|0;r=1<>2]|0;t:do{if((fe[t+4>>2]&-8|0)!=(s|0)){n=s<<((n|0)==31?0:25-(n>>>1)|0);while(1){i=t+16+(n>>>31<<2)|0;r=fe[i>>2]|0;if(!r)break;if((fe[r+4>>2]&-8|0)==(s|0)){v=r;break t}else{n=n<<1;t=r}}if(i>>>0<(fe[155]|0)>>>0)B();else{fe[i>>2]=y;fe[y+24>>2]=t;fe[y+12>>2]=y;fe[y+8>>2]=y;break e}}else v=t}while(0);t=v+8|0;i=fe[t>>2]|0;g=fe[155]|0;if(i>>>0>=g>>>0&v>>>0>=g>>>0){fe[i+12>>2]=y;fe[t>>2]=y;fe[y+8>>2]=i;fe[y+12>>2]=v;fe[y+24>>2]=0;break}else B()}else{fe[152]=i|r;fe[t>>2]=y;fe[y+24>>2]=t;fe[y+12>>2]=y;fe[y+8>>2]=y}}while(0);y=(fe[159]|0)+-1|0;fe[159]=y;if(!y)t=1060;else return;while(1){t=fe[t>>2]|0;if(!t)break;else t=t+8|0}fe[159]=-1;return}function Wi(e,t){e=e|0;t=t|0;var i=0,r=0;if(!e){e=Yi(t)|0;return e|0}if(t>>>0>4294967231){e=re()|0;fe[e>>2]=12;e=0;return e|0}i=qi(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(i){e=i+8|0;return e|0}i=Yi(t)|0;if(!i){e=0;return e|0}r=fe[e+-4>>2]|0;r=(r&-8)-((r&3|0)==0?8:4)|0;er(i|0,e|0,(r>>>0>>0?r:t)|0)|0;b(e);e=i;return e|0}function Vi(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=fe[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function qi(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0;d=e+4|0;f=fe[d>>2]|0;l=f&-8;h=e+l|0;a=fe[155]|0;i=f&3;if(!((i|0)!=1&e>>>0>=a>>>0&e>>>0>>0))B();r=e+(l|4)|0;n=fe[r>>2]|0;if(!(n&1))B();if(!i){if(t>>>0<256){e=0;return e|0}if(l>>>0>=(t+4|0)>>>0?(l-t|0)>>>0<=fe[271]<<1>>>0:0)return e|0;e=0;return e|0}if(l>>>0>=t>>>0){i=l-t|0;if(i>>>0<=15)return e|0;fe[d>>2]=f&1|t|2;fe[e+(t+4)>>2]=i|3;fe[r>>2]=fe[r>>2]|1;Ki(e+t|0,i);return e|0}if((h|0)==(fe[157]|0)){i=(fe[154]|0)+l|0;if(i>>>0<=t>>>0){e=0;return e|0}p=i-t|0;fe[d>>2]=f&1|t|2;fe[e+(t+4)>>2]=p|1;fe[157]=e+t;fe[154]=p;return e|0}if((h|0)==(fe[156]|0)){r=(fe[153]|0)+l|0;if(r>>>0>>0){e=0;return e|0}i=r-t|0;if(i>>>0>15){fe[d>>2]=f&1|t|2;fe[e+(t+4)>>2]=i|1;fe[e+r>>2]=i;r=e+(r+4)|0;fe[r>>2]=fe[r>>2]&-2;r=e+t|0}else{fe[d>>2]=f&1|r|2;r=e+(r+4)|0;fe[r>>2]=fe[r>>2]|1;r=0;i=0}fe[153]=i;fe[156]=r;return e|0}if(n&2){e=0;return e|0}c=(n&-8)+l|0;if(c>>>0>>0){e=0;return e|0}p=c-t|0;s=n>>>3;do{if(n>>>0>=256){o=fe[e+(l+24)>>2]|0;s=fe[e+(l+12)>>2]|0;do{if((s|0)==(h|0)){r=e+(l+20)|0;i=fe[r>>2]|0;if(!i){r=e+(l+16)|0;i=fe[r>>2]|0;if(!i){u=0;break}}while(1){n=i+20|0;s=fe[n>>2]|0;if(s){i=s;r=n;continue}n=i+16|0;s=fe[n>>2]|0;if(!s)break;else{i=s;r=n}}if(r>>>0>>0)B();else{fe[r>>2]=0;u=i;break}}else{n=fe[e+(l+8)>>2]|0;if(n>>>0>>0)B();i=n+12|0;if((fe[i>>2]|0)!=(h|0))B();r=s+8|0;if((fe[r>>2]|0)==(h|0)){fe[i>>2]=s;fe[r>>2]=n;u=s;break}else B()}}while(0);if(o){i=fe[e+(l+28)>>2]|0;r=908+(i<<2)|0;if((h|0)==(fe[r>>2]|0)){fe[r>>2]=u;if(!u){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();i=o+16|0;if((fe[i>>2]|0)==(h|0))fe[i>>2]=u;else fe[o+20>>2]=u;if(!u)break}r=fe[155]|0;if(u>>>0>>0)B();fe[u+24>>2]=o;i=fe[e+(l+16)>>2]|0;do{if(i)if(i>>>0>>0)B();else{fe[u+16>>2]=i;fe[i+24>>2]=u;break}}while(0);i=fe[e+(l+20)>>2]|0;if(i)if(i>>>0<(fe[155]|0)>>>0)B();else{fe[u+20>>2]=i;fe[i+24>>2]=u;break}}}else{n=fe[e+(l+8)>>2]|0;r=fe[e+(l+12)>>2]|0;i=644+(s<<1<<2)|0;if((n|0)!=(i|0)){if(n>>>0>>0)B();if((fe[n+12>>2]|0)!=(h|0))B()}if((r|0)==(n|0)){fe[151]=fe[151]&~(1<>>0>>0)B();i=r+8|0;if((fe[i>>2]|0)==(h|0))o=i;else B()}else o=r+8|0;fe[n+12>>2]=r;fe[o>>2]=n}}while(0);if(p>>>0<16){fe[d>>2]=c|f&1|2;t=e+(c|4)|0;fe[t>>2]=fe[t>>2]|1;return e|0}else{fe[d>>2]=f&1|t|2;fe[e+(t+4)>>2]=p|3;f=e+(c|4)|0;fe[f>>2]=fe[f>>2]|1;Ki(e+t|0,p);return e|0}return 0}function Ki(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0,m=0,_=0,g=0,v=0;m=e+t|0;i=fe[e+4>>2]|0;do{if(!(i&1)){u=fe[e>>2]|0;if(!(i&3))return;p=e+(0-u)|0;c=u+t|0;l=fe[155]|0;if(p>>>0>>0)B();if((p|0)==(fe[156]|0)){r=e+(t+4)|0;i=fe[r>>2]|0;if((i&3|0)!=3){v=p;o=c;break}fe[153]=c;fe[r>>2]=i&-2;fe[e+(4-u)>>2]=c|1;fe[m>>2]=c;return}s=u>>>3;if(u>>>0<256){n=fe[e+(8-u)>>2]|0;r=fe[e+(12-u)>>2]|0;i=644+(s<<1<<2)|0;if((n|0)!=(i|0)){if(n>>>0>>0)B();if((fe[n+12>>2]|0)!=(p|0))B()}if((r|0)==(n|0)){fe[151]=fe[151]&~(1<>>0>>0)B();i=r+8|0;if((fe[i>>2]|0)==(p|0))a=i;else B()}else a=r+8|0;fe[n+12>>2]=r;fe[a>>2]=n;v=p;o=c;break}a=fe[e+(24-u)>>2]|0;n=fe[e+(12-u)>>2]|0;do{if((n|0)==(p|0)){n=16-u|0;r=e+(n+4)|0;i=fe[r>>2]|0;if(!i){r=e+n|0;i=fe[r>>2]|0;if(!i){h=0;break}}while(1){n=i+20|0;s=fe[n>>2]|0;if(s){i=s;r=n;continue}n=i+16|0;s=fe[n>>2]|0;if(!s)break;else{i=s;r=n}}if(r>>>0>>0)B();else{fe[r>>2]=0;h=i;break}}else{s=fe[e+(8-u)>>2]|0;if(s>>>0>>0)B();i=s+12|0;if((fe[i>>2]|0)!=(p|0))B();r=n+8|0;if((fe[r>>2]|0)==(p|0)){fe[i>>2]=n;fe[r>>2]=s;h=n;break}else B()}}while(0);if(a){i=fe[e+(28-u)>>2]|0;r=908+(i<<2)|0;if((p|0)==(fe[r>>2]|0)){fe[r>>2]=h;if(!h){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();i=a+16|0;if((fe[i>>2]|0)==(p|0))fe[i>>2]=h;else fe[a+20>>2]=h;if(!h){v=p;o=c;break}}n=fe[155]|0;if(h>>>0>>0)B();fe[h+24>>2]=a;i=16-u|0;r=fe[e+i>>2]|0;do{if(r)if(r>>>0>>0)B();else{fe[h+16>>2]=r;fe[r+24>>2]=h;break}}while(0);i=fe[e+(i+4)>>2]|0;if(i)if(i>>>0<(fe[155]|0)>>>0)B();else{fe[h+20>>2]=i;fe[i+24>>2]=h;v=p;o=c;break}else{v=p;o=c}}else{v=p;o=c}}else{v=e;o=t}}while(0);l=fe[155]|0;if(m>>>0>>0)B();i=e+(t+4)|0;r=fe[i>>2]|0;if(!(r&2)){if((m|0)==(fe[157]|0)){g=(fe[154]|0)+o|0;fe[154]=g;fe[157]=v;fe[v+4>>2]=g|1;if((v|0)!=(fe[156]|0))return;fe[156]=0;fe[153]=0;return}if((m|0)==(fe[156]|0)){g=(fe[153]|0)+o|0;fe[153]=g;fe[156]=v;fe[v+4>>2]=g|1;fe[v+g>>2]=g;return}o=(r&-8)+o|0;s=r>>>3;do{if(r>>>0>=256){a=fe[e+(t+24)>>2]|0;n=fe[e+(t+12)>>2]|0;do{if((n|0)==(m|0)){r=e+(t+20)|0;i=fe[r>>2]|0;if(!i){r=e+(t+16)|0;i=fe[r>>2]|0;if(!i){f=0;break}}while(1){n=i+20|0;s=fe[n>>2]|0;if(s){i=s;r=n;continue}n=i+16|0;s=fe[n>>2]|0;if(!s)break;else{i=s;r=n}}if(r>>>0>>0)B();else{fe[r>>2]=0;f=i;break}}else{s=fe[e+(t+8)>>2]|0;if(s>>>0>>0)B();i=s+12|0;if((fe[i>>2]|0)!=(m|0))B();r=n+8|0;if((fe[r>>2]|0)==(m|0)){fe[i>>2]=n;fe[r>>2]=s;f=n;break}else B()}}while(0);if(a){i=fe[e+(t+28)>>2]|0;r=908+(i<<2)|0;if((m|0)==(fe[r>>2]|0)){fe[r>>2]=f;if(!f){fe[152]=fe[152]&~(1<>>0<(fe[155]|0)>>>0)B();i=a+16|0;if((fe[i>>2]|0)==(m|0))fe[i>>2]=f;else fe[a+20>>2]=f;if(!f)break}r=fe[155]|0;if(f>>>0>>0)B();fe[f+24>>2]=a;i=fe[e+(t+16)>>2]|0;do{if(i)if(i>>>0>>0)B();else{fe[f+16>>2]=i;fe[i+24>>2]=f;break}}while(0);i=fe[e+(t+20)>>2]|0;if(i)if(i>>>0<(fe[155]|0)>>>0)B();else{fe[f+20>>2]=i;fe[i+24>>2]=f;break}}}else{n=fe[e+(t+8)>>2]|0;r=fe[e+(t+12)>>2]|0;i=644+(s<<1<<2)|0;if((n|0)!=(i|0)){if(n>>>0>>0)B();if((fe[n+12>>2]|0)!=(m|0))B()}if((r|0)==(n|0)){fe[151]=fe[151]&~(1<>>0>>0)B();i=r+8|0;if((fe[i>>2]|0)==(m|0))d=i;else B()}else d=r+8|0;fe[n+12>>2]=r;fe[d>>2]=n}}while(0);fe[v+4>>2]=o|1;fe[v+o>>2]=o;if((v|0)==(fe[156]|0)){fe[153]=o;return}}else{fe[i>>2]=r&-2;fe[v+4>>2]=o|1;fe[v+o>>2]=o}i=o>>>3;if(o>>>0<256){r=i<<1;s=644+(r<<2)|0;n=fe[151]|0;i=1<>2]|0;if(r>>>0<(fe[155]|0)>>>0)B();else{_=i;g=r}}else{fe[151]=n|i;_=644+(r+2<<2)|0;g=s}fe[_>>2]=v;fe[g+12>>2]=v;fe[v+8>>2]=g;fe[v+12>>2]=s;return}i=o>>>8;if(i)if(o>>>0>16777215)s=31;else{_=(i+1048320|0)>>>16&8;g=i<<_;m=(g+520192|0)>>>16&4;g=g<>>16&2;s=14-(m|_|s)+(g<>>15)|0;s=o>>>(s+7|0)&1|s<<1}else s=0;i=908+(s<<2)|0;fe[v+28>>2]=s;fe[v+20>>2]=0;fe[v+16>>2]=0;r=fe[152]|0;n=1<>2]=v;fe[v+24>>2]=i;fe[v+12>>2]=v;fe[v+8>>2]=v;return}i=fe[i>>2]|0;e:do{if((fe[i+4>>2]&-8|0)!=(o|0)){s=o<<((s|0)==31?0:25-(s>>>1)|0);while(1){r=i+16+(s>>>31<<2)|0;n=fe[r>>2]|0;if(!n)break;if((fe[n+4>>2]&-8|0)==(o|0)){i=n;break e}else{s=s<<1;i=n}}if(r>>>0<(fe[155]|0)>>>0)B();fe[r>>2]=v;fe[v+24>>2]=i;fe[v+12>>2]=v;fe[v+8>>2]=v;return}}while(0);r=i+8|0;n=fe[r>>2]|0;g=fe[155]|0;if(!(n>>>0>=g>>>0&i>>>0>=g>>>0))B();fe[n+12>>2]=v;fe[r>>2]=v;fe[v+8>>2]=n;fe[v+12>>2]=i;fe[v+24>>2]=0}function Zi(){}function ae(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;r=t-r-(i>>>0>e>>>0|0)>>>0;return(ie=r,e-i>>>0|0)|0}function G(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,o=0;r=e+i|0;if((i|0)>=20){t=t&255;s=e&3;o=t|t<<8|t<<16|t<<24;n=r&~3;if(s){s=e+4-s|0;while((e|0)<(s|0)){de[e>>0]=t;e=e+1|0}}while((e|0)<(n|0)){fe[e>>2]=o;e=e+4|0}}while((e|0)<(r|0)){de[e>>0]=t;e=e+1|0}return e-i|0}function Ji(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){ie=t>>>i;return e>>>i|(t&(1<>>i-32|0}function Qi(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){ie=t<>>32-i;return e<>>0;return(ie=t+r+(i>>>0>>0|0)>>>0,i|0)|0}function er(e,t,i){e=e|0;t=t|0;i=i|0;var r=0;if((i|0)>=4096)return Qe(e|0,t|0,i|0)|0;r=e|0;if((e&3)==(t&3)){while(e&3){if(!i)return r|0;de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}while((i|0)>=4){fe[e>>2]=fe[t>>2];e=e+4|0;t=t+4|0;i=i-4|0}}while((i|0)>0){de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}return r|0}function tr(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){ie=t>>i;return}ie=(t|0)<0?-1:0}function ir(e){e=e|0;var t=0;t=de[w+(e&255)>>0]|0;if((t|0)<8)return t|0;t=de[w+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=de[w+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(de[w+(e>>>24)>>0]|0)+24|0}function rr(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0;s=e&65535;n=t&65535;i=ve(n,s)|0;r=e>>>16;e=(i>>>16)+(ve(n,r)|0)|0;n=t>>>16;t=ve(n,s)|0;return(ie=(e>>>16)+(ve(n,r)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|i&65535|0)|0}function nr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0;u=t>>31|((t|0)<0?-1:0)<<1;l=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;s=r>>31|((r|0)<0?-1:0)<<1;n=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1;a=ae(u^e,l^t,u,l)|0;o=ie;e=s^u;t=n^l;ae((ur(a,o,ae(s^i,n^r,s,n)|0,ie,0)|0)^e,ie^t,e,t)}function sr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,o=0,a=0,l=0,u=0;n=ge;ge=ge+16|0;a=n|0;o=t>>31|((t|0)<0?-1:0)<<1;s=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;u=r>>31|((r|0)<0?-1:0)<<1;l=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1;e=ae(o^e,s^t,o,s)|0;t=ie;ur(e,t,ae(u^i,l^r,u,l)|0,ie,a)|0;r=ae(fe[a>>2]^o,fe[a+4>>2]^s,o,s)|0;i=ie;ge=n;ie=i}function or(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0;n=e;s=i;i=rr(n,s)|0;e=ie;ie=(ve(t,s)|0)+(ve(r,n)|0)+e|e&0}function ar(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;return ur(e,t,i,r,0)|0}function lr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0;s=ge;ge=ge+16|0;n=s|0;ur(e,t,i,r,n)|0;ge=s;return(ie=fe[n+4>>2]|0,fe[n>>2]|0)|0}function ur(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,o=0,a=0,l=0,u=0,h=0,c=0,p=0,d=0,f=0;h=e;l=t;u=l;o=i;p=r;a=p;if(!u){s=(n|0)!=0;if(!a){if(s){fe[n>>2]=(h>>>0)%(o>>>0);fe[n+4>>2]=0}p=0;n=(h>>>0)/(o>>>0)>>>0;return(ie=p,n)|0}else{if(!s){p=0;n=0;return(ie=p,n)|0}fe[n>>2]=e|0;fe[n+4>>2]=t&0;p=0;n=0;return(ie=p,n)|0}}s=(a|0)==0;do{if(o){if(!s){s=(m(a|0)|0)-(m(u|0)|0)|0;if(s>>>0<=31){c=s+1|0;a=31-s|0;t=s-31>>31;o=c;e=h>>>(c>>>0)&t|u<>>(c>>>0)&t;s=0;a=h<>2]=e|0;fe[n+4>>2]=l|t&0;p=0;n=0;return(ie=p,n)|0}s=o-1|0;if(s&o){a=(m(o|0)|0)+33-(m(u|0)|0)|0;f=64-a|0;c=32-a|0;l=c>>31;d=a-32|0;t=d>>31;o=a;e=c-1>>31&u>>>(d>>>0)|(u<>>(a>>>0))&t;t=t&u>>>(a>>>0);s=h<>>(d>>>0))&l|h<>31;break}if(n){fe[n>>2]=s&h;fe[n+4>>2]=0}if((o|0)==1){d=l|t&0;f=e|0|0;return(ie=d,f)|0}else{f=ir(o|0)|0;d=u>>>(f>>>0)|0;f=u<<32-f|h>>>(f>>>0)|0;return(ie=d,f)|0}}else{if(s){if(n){fe[n>>2]=(u>>>0)%(o>>>0);fe[n+4>>2]=0}d=0;f=(u>>>0)/(o>>>0)>>>0;return(ie=d,f)|0}if(!h){if(n){fe[n>>2]=0;fe[n+4>>2]=(u>>>0)%(a>>>0)}d=0;f=(u>>>0)/(a>>>0)>>>0;return(ie=d,f)|0}s=a-1|0;if(!(s&a)){if(n){fe[n>>2]=e|0;fe[n+4>>2]=s&u|t&0}d=0;f=u>>>((ir(a|0)|0)>>>0);return(ie=d,f)|0}s=(m(a|0)|0)-(m(u|0)|0)|0;if(s>>>0<=30){t=s+1|0;a=31-s|0;o=t;e=u<>>(t>>>0);t=u>>>(t>>>0);s=0;a=h<>2]=e|0;fe[n+4>>2]=l|t&0;d=0;f=0;return(ie=d,f)|0}}while(0);if(!o){u=a;l=0;a=0}else{c=i|0|0;h=p|r&0;u=$i(c|0,h|0,-1,-1)|0;i=ie;l=a;a=0;do{r=l;l=s>>>31|l<<1;s=a|s<<1;r=e<<1|r>>>31|0;p=e>>>31|t<<1|0;ae(u,i,r,p)|0;f=ie;d=f>>31|((f|0)<0?-1:0)<<1;a=d&1;e=ae(r,p,d&c,(((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1)&h)|0;t=ie;o=o-1|0}while((o|0)!=0);u=l;l=0}o=0;if(n){fe[n>>2]=e;fe[n+4>>2]=t}d=(s|0)>>>31|(u|o)<<1|(o<<1|s>>>31)&0|l;f=(s<<1|0>>>31)&-2|a;return(ie=d,f)|0}function hr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;return v[e&7](t|0,i|0,r|0)|0}function cr(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;Pr[e&3](t|0,i|0,r|0,n|0,s|0)}function pr(e,t){e=e|0;t=t|0;Or[e&7](t|0)}function dr(e,t){e=e|0;t=t|0;return Rr[e&1](t|0)|0}function fr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;Cr[e&0](t|0,i|0,r|0)}function mr(e){e=e|0;Mr[e&3]()}function _r(e,t,i,r,n,s,o){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o=o|0;Ir[e&3](t|0,i|0,r|0,n|0,s|0,o|0)}function gr(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;return X[e&1](t|0,i|0,r|0,n|0,s|0)|0}function vr(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;Dr[e&3](t|0,i|0,r|0,n|0)}function yr(e,t,i){e=e|0;t=t|0;i=i|0;o(0);return 0}function br(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;o(1)}function xr(e){e=e|0;o(2)}function Tr(e){e=e|0;o(3);return 0}function wr(e,t,i){e=e|0;t=t|0;i=i|0;o(4)}function Er(){o(5)}function Sr(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;o(6)}function Ar(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;o(7);return 0}function kr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;o(8)}var v=[yr,oi,Xi,Fi,Li,Ni,yr,yr];var Pr=[br,di,pi,br];var Or=[xr,ti,ni,ii,ri,si,bi,Gi];var Rr=[Tr,Di];var Cr=[wr];var Mr=[Er,vi,yi,Er];var Ir=[Sr,mi,fi,Sr];var X=[Ar,St];var Dr=[kr,li,ui,kr];return{___cxa_can_catch:_i,_crn_get_levels:Ft,_crn_get_uncompressed_size:zt,_crn_decompress:Bt,_i64Add:$i,_crn_get_width:Dt,___cxa_is_pointer_type:gi,_i64Subtract:ae,_memset:G,_malloc:Yi,_free:b,_memcpy:er,_bitshift64Lshr:Ji,_fflush:ki,_bitshift64Shl:Qi,_crn_get_height:Lt,___errno_location:re,_crn_get_dxt_format:Nt,runPostSets:Zi,_emscripten_replace_memory:dt,stackAlloc:ft,stackSave:mt,stackRestore:_t,establishStackSpace:gt,setThrew:vt,setTempRet0:xt,getTempRet0:Tt,dynCall_iiii:hr,dynCall_viiiii:cr,dynCall_vi:pr,dynCall_ii:dr,dynCall_viii:fr,dynCall_v:mr,dynCall_viiiiii:_r,dynCall_iiiiii:gr,dynCall_viiii:vr}}(e.Ya,e.Za,buffer)),zc=(e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress,e._i64Add=Z._i64Add),nb=(e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type,e._i64Subtract=Z._i64Subtract),qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory,rb=(e._crn_get_dxt_format=Z._crn_get_dxt_format,e._bitshift64Lshr=Z._bitshift64Lshr),Na=e._free=Z._free,sb=(e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location,e._bitshift64Shl=Z._bitshift64Shl);function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function i(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>8&255,e>>16&255,e>>24&255)}!function(a){a.loadFromArrayBuffer=function(e,t,i){return new r(t).loadFromArrayBuffer(e,i)};l=PIXI.resources.Resource,__extends(e,l),e.prototype.init=function(e,t,i,r,n,s,o){void 0===r&&(r=-1),void 0===n&&(n=-1),this.src=e,this.resize(r,n),this._width=r,this._height=n,this.data=t,this.type=i,this.levels=s,this.internalFormat=o;e=this.complete;return this.complete=!!t,!e&&this.complete&&this.onload&&this.onload({target:this}),this.update(),this},e.prototype.dispose=function(){this.data=null},e.prototype.bind=function(e){void 0!==e.alphaMode?e.alphaMode=PIXI.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA:e.premultiplyAlpha=!1,l.prototype.bind.call(this,e)},e.prototype.upload=function(e,t,i){var r=e.state.gl;if(i.compressed=!1,e.texture.initCompressed(),null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var n=this.levels,s=this.width,o=this.height,a=0,l=0;l>=1)<1&&(s=1),(o>>=1)<1&&(o=1),a+=u}return this._internalLoader.free(),this.preserveSource||(this.data=null),!0},e.prototype.style=function(e,t,i){var e=e.state.gl,r=this.levels;return t.scaleMode===PIXI.SCALE_MODES.LINEAR?1>2)*(t+3>>2)*8;case 33778:case 33779:case 35987:case 34798:return(e+3>>2)*(t+3>>2)*16;default:return 0}},h.type="DDS",h);function h(e){return i.call(this,e)||this}e.DDSLoader=r}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(e){(i={})[0]=35841,i[1]=35843,i[2]=35840,i[3]=35842,i[6]=36196,i[7]=33776,i[9]=33778,i[5]=33779;var t,o=i,i=(t=e.AbstractInternalLoader,__extends(a,t),a.prototype.load=function(e){var t,i,r,n,s;if(a.test(e))return t=(s=new Int32Array(e,0,13))[2],t=o[t]||-1,i=s[7],r=s[6],n=s[11],s=s[12]+52,e=new Uint8Array(e,s),s=this._image,this._format=t,s.init(s.src,e,"PVR",i,r,n,t),s;throw"Invalid magic number in PVR header"},a.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},a.prototype.levelBufferSize=function(e,t,i){switch(void 0===i&&(i=0),this._format){case 33776:case 36196:return(e+3>>2)*(t+3>>2)*8;case 33778:case 33779:return(e+3>>2)*(t+3>>2)*16;case 35840:case 35842:return Math.floor((Math.max(e,8)*Math.max(t,8)*4+7)/8);case 35841:case 35843:return Math.floor((Math.max(e,16)*Math.max(t,8)*2+7)/8);default:return 0}},a.type="PVR",a);function a(e){return t.call(this,e)||this}e.PVRTCLoader=i}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(l){var e,t,i=0,r=2,n=3,s=8,o=9,a=10,u=11,h=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),c=((e={})[u]=-1,e[i]=36196,e[r]=33776,e[n]=33779,e[s]=35840,e[o]=35842,e[a]=37808,e),p=Object.keys(c).reduce(function(e,t){return e[c[+t]]=+t,e},{}),u=(t=l.AbstractInternalLoader,__extends(d,t),d.test=function(e){var e=1262195===new Uint32Array(e,0,1)[0]&&!!d.BASIS_BINDING,t=d.RGB_FORMAT&&d.RGBA_FORMAT;return!e&&t&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),t&&e},d.bindTranscoder=function(e,i){if(!e||!i)throw"Invalid state! undef fileCtr or ext invalid!";var t,r=Object.keys(i).reduce(function(e,t){t=i[t];return t?Object.assign(e,t.__proto__):e},{}),n=void 0,s=void 0;for(t in r){var o,a=r[t];void 0!==p[a]&&(o=p[a],h[o]?s={native:a,name:t,basis:o}:n={native:a,name:t,basis:o})}d.RGB_FORMAT=n||s,d.RGBA_FORMAT=s||n,d.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+d.RGB_FORMAT.name+"\nRGBA:"+d.RGBA_FORMAT.name),l.RegisterCompressedLoader(d),l.RegisterCompressedExtensions("basis")},d.prototype.load=function(e){if(d.test(e))return this._loadAsync(e),this._image;throw"BASIS Transcoder not binded or transcoding not supported =(!"},d.prototype._loadAsync=function(e){var t=performance.now(),e=new d.BASIS_BINDING(new Uint8Array(e)),i=e.getImageWidth(0,0),r=e.getImageHeight(0,0),n=e.getHasAlpha(),s=this._image;if(!e.startTranscoding())throw"Transcoding error!";var n=n?d.RGBA_FORMAT:d.RGB_FORMAT,o=(console.log("Grats! BASIS will be transcoded to:",n),new Uint8Array(e.getImageTranscodedSizeInBytes(0,0,n.basis)));if(!e.transcodeImage(o,0,0,n.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=n.native,this._file=e;t=n.name.replace("COMPRESSED_","");return Promise.resolve(s.init(s.src,o,"BASIS|"+t,i,r,1,n.native))},d.prototype.levelBufferSize=function(e,t,i){return this._file?this._file.getImageTranscodedSizeInBytes(0,i,p[this._format]):void 0},d.BASIS_BINDING=void 0,d);function d(e){e=t.call(this,e)||this;return e.type="BASIS",e._file=void 0,e}l.BASISLoader=u}(pixi_compressed_textures=pixi_compressed_textures||{}),!function(r){var g=window.CRN_Module;var t,v=[33776,33778,33779],e=(t=r.AbstractInternalLoader,__extends(i,t),i.prototype.load=function(e){for(var t=e.byteLength,e=new Uint8Array(e),i=g._malloc(t),r=e,n=g.HEAPU8,s=i,o=t,a=s/4,e=o%4,l=new Uint32Array(r.buffer,0,(o-e)/4),u=new Uint32Array(n.buffer),h=0;hn.count))return e=new o,n.workers.push(e),e.init(t,i).then(function(){i=e.binary,r()})}var n=this,s=0;return r().then(function(){return n})},i.prototype.transcode=function(t,i){var n,s,o,a;if(this.workers&&this.workers.length)return n=this.workers,s=void 0,o=0,a=function(e){for(var t=0,i=n;t>0,r=e[t];e[t]=e[i],e[i]=r}},E.prototype._randomizeOffsets=function(){for(var e=0;e>0,e,1+o>>0),r+=o}t.baseTexture.update(),this.uniforms.displacementMap=t},Object.defineProperty(E.prototype,"sizes",{get:function(){return this._sizes},set:function(e){for(var t=Math.min(this._slices,e.length),i=0;i>0)},Object.defineProperty(x.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(e){this.uniforms.uOffset=e},enumerable:!1,configurable:!0}),x),Ge=(t(b,$=a.Filter),Object.defineProperty(b.prototype,"replacements",{get:function(){return this._replacements},set:function(e){var t=this.uniforms.originalColors,i=this.uniforms.targetColors,r=e.length;if(r>this._maxColors)throw new Error("Length of replacements ("+r+") exceeds the maximum colors length ("+this._maxColors+")");t[3*r]=-1;for(var n=0;n= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n".replace("${maxKernelSize}",t.toFixed(1)))||this;return Object.assign(t,e),t}function r(e){var t=U.call(this,p,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n")||this;return Object.assign(t,r.defaults,e),t}function n(e,t,i,r){void 0===e&&(e=100),void 0===t&&(t=600);var n=j.call(this)||this;return n.tiltShiftXFilter=new Qe(e,t,i,r),n.tiltShiftYFilter=new $e(e,t,i,r),n}function rt(){return null!==G&&G.apply(this,arguments)||this}function nt(){return null!==X&&X.apply(this,arguments)||this}function s(e,t,i,r){void 0===e&&(e=100),void 0===t&&(t=600);var n=H.call(this,p,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n")||this;return n.uniforms.blur=e,n.uniforms.gradientBlur=t,n.uniforms.start=i||new l.Point(0,window.innerHeight/2),n.uniforms.end=r||new l.Point(600,window.innerHeight/2),n.uniforms.delta=new l.Point(30,30),n.uniforms.texSize=new l.Point(window.innerWidth,window.innerHeight),n.updateDelta(),n}function o(e,t,i){void 0===t&&(t=0),void 0===i&&(i=1);var r=Y.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n")||this;return r._color=0,r.uniforms.dimensions=new Float32Array(2),r.uniforms.ambientColor=new Float32Array([0,0,0,i]),r.texture=e,r.color=t,r}function f(e,t,i){void 0===e&&(e=[0,0]),void 0===i&&(i=0);var r=W.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n")||this;return r.center=e,Object.assign(r,f.defaults,t),r.time=i,r}function m(e,t,i){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===i&&(i=[0,0]);var r=V.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n")||this;return r.red=e,r.green=t,r.blue=i,r}function _(e){var t=q.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n")||this;return t.time=0,t.uniforms.amplitude=new Float32Array(2),t.uniforms.waveLength=new Float32Array(2),t.uniforms.alpha=new Float32Array(2),t.uniforms.dimensions=new Float32Array(2),Object.assign(t,_.defaults,e),t}function g(e,t,i,r){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===i&&(i=5),void 0===r&&(r=-1);var n=K.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return n._angle=0,n.angle=e,n.center=t,n.kernelSize=i,n.radius=r,n}function st(e){void 0===e&&(e=10);var t=Z.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n")||this;return t.size=e,t}function v(e,t,i){void 0===e&&(e=1),void 0===t&&(t=0);var r=J.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,v.getAngleStep(i=void 0===i?.1:i)))||this;return r._thickness=1,r.uniforms.thickness=new Float32Array([0,0]),r.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(r,{thickness:e,color:t,quality:i}),r}function y(e,t){void 0===t&&(t=0);var i=Q.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform float sepia;\nuniform float noise;\nuniform float noiseSize;\nuniform float scratch;\nuniform float scratchDensity;\nuniform float scratchWidth;\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\nuniform float seed;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n")||this;return i.seed=0,i.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(i.seed=e,e=void 0):i.seed=t,Object.assign(i,y.defaults,e),i}function b(e,t,i){void 0===t&&(t=.05),void 0===i&&(i=e.length);var r=$.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float epsilon;\n\nconst int MAX_COLORS = %maxColors%;\n\nuniform vec3 originalColors[MAX_COLORS];\nuniform vec3 targetColors[MAX_COLORS];\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n float alpha = gl_FragColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = gl_FragColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = originalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < epsilon)\n {\n vec3 targetColor = targetColors[i];\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n".replace(/%maxColors%/g,i.toFixed(0)))||this;return r._replacements=[],r._maxColors=0,r.epsilon=t,r._maxColors=i,r.uniforms.originalColors=new Float32Array(3*i),r.uniforms.targetColors=new Float32Array(3*i),r.replacements=e,r}function x(e,t,i){void 0===e&&(e=[0,0]),void 0===t&&(t=5),void 0===i&&(i=0);var r=ee.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uVelocity;\nuniform int uKernelSize;\nuniform float uOffset;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\n// Notice:\n// the perfect way:\n// int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n// BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n// So use uKernelSize directly.\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n vec2 velocity = uVelocity / filterArea.xy;\n float offset = -uOffset / length(uVelocity) - 0.5;\n int k = uKernelSize - 1;\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n vec2 bias = velocity * (float(i) / float(k) + offset);\n color += texture2D(uSampler, vTextureCoord + bias);\n }\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return r.kernelSize=5,r.uniforms.uVelocity=new Float32Array(2),r._velocity=new l.ObservablePoint(r.velocityChanged,r),r.setVelocity(e),r.kernelSize=t,r.offset=i,r}function T(e){var t=te.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform vec2 light;\nuniform bool parallel;\nuniform float aspect;\n\nuniform float gain;\nuniform float lacunarity;\nuniform float time;\nuniform float alpha;\n\n${perlin}\n\nvoid main(void) {\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n float d;\n\n if (parallel) {\n float _cos = light.x;\n float _sin = light.y;\n d = (_cos * coord.x) + (_sin * coord.y * aspect);\n } else {\n float dx = coord.x - light.x / dimensions.x;\n float dy = (coord.y - light.y / dimensions.y) * aspect;\n float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n vec3 dir = vec3(d, d, 0.0);\n\n float noise = turb(dir + vec3(time, 0.0, 62.1 + time) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n vec4 mist = vec4(noise, noise, noise, 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord) + mist;\n\n}\n".replace("${perlin}","vec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n float sum = 0.0;\n float sc = 1.0;\n float totalgain = 1.0;\n for (float i = 0.0; i < 6.0; i++)\n {\n sum += totalgain * pnoise(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}\n"))||this,e=(t.parallel=!0,t.time=0,t._angle=0,t.uniforms.dimensions=new Float32Array(2),Object.assign(T.defaults,e));return t._angleLight=new l.Point,t.angle=e.angle,t.gain=e.gain,t.lacunarity=e.lacunarity,t.alpha=e.alpha,t.parallel=e.parallel,t.center=e.center,t.time=e.time,t}function w(e){var t=this,e=Object.assign({},w.defaults,e),i=e.outerStrength,r=e.innerStrength,n=e.color,s=e.knockout,o=e.quality,e=Math.round(e.distance);return(t=ie.call(this,p,"varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float outerStrength;\nuniform float innerStrength;\n\nuniform vec4 glowColor;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform bool knockout;\n\nconst float PI = 3.14159265358979323846264;\n\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.0);\nconst float ANGLE_STEP_NUM = ceil(PI * 2.0 / ANGLE_STEP_SIZE);\n\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.0) / 2.0;\n\nvoid main(void) {\n vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\n float totalAlpha = 0.0;\n\n vec2 direction;\n vec2 displaced;\n vec4 curColor;\n\n for (float angle = 0.0; angle < PI * 2.0; angle += ANGLE_STEP_SIZE) {\n direction = vec2(cos(angle), sin(angle)) * px;\n\n for (float curDistance = 0.0; curDistance < DIST; curDistance++) {\n displaced = clamp(vTextureCoord + direction * \n (curDistance + 1.0), filterClamp.xy, filterClamp.zw);\n\n curColor = texture2D(uSampler, displaced);\n\n totalAlpha += (DIST - curDistance) * curColor.a;\n }\n }\n \n curColor = texture2D(uSampler, vTextureCoord);\n\n float alphaRatio = (totalAlpha / MAX_TOTAL_ALPHA);\n\n float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * curColor.a;\n float innerGlowStrength = min(1.0, innerGlowAlpha);\n \n vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\n float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a);\n float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);\n\n vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n gl_FragColor = innerColor + outerGlowColor;\n }\n}\n".replace(/__ANGLE_STEP_SIZE__/gi,""+(1/o/e).toFixed(7)).replace(/__DIST__/gi,e.toFixed(0)+".0"))||this).uniforms.glowColor=new Float32Array([0,0,0,1]),Object.assign(t,{color:n,outerStrength:i,innerStrength:r,padding:e,knockout:s}),t}function E(e){var t=re.call(this,p,"// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n")||this;return t.offset=100,t.fillMode=E.TRANSPARENT,t.average=!1,t.seed=0,t.minSize=8,t.sampleSize=512,t._slices=0,t._offsets=new Float32Array(1),t._sizes=new Float32Array(1),t._direction=-1,t.uniforms.dimensions=new Float32Array(2),t._canvas=document.createElement("canvas"),t._canvas.width=4,t._canvas.height=t.sampleSize,t.texture=a.Texture.from(t._canvas,{scaleMode:c.SCALE_MODES.NEAREST}),Object.assign(t,E.defaults,e),t}function ot(e){void 0===e&&(e=5);var t=ne.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n")||this;return t.strength=e,t}function S(e){var t=se.call(this)||this,e=(t.angle=45,t._distance=5,t._resolution=u.settings.FILTER_RESOLUTION,e?xe(xe({},S.defaults),e):S.defaults),i=e.kernels,r=e.blur,n=e.quality,s=e.pixelSize,o=e.resolution,i=(t._tintFilter=new a.Filter(p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Premultiply alpha\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),t._tintFilter.uniforms.color=new Float32Array(4),t._tintFilter.uniforms.shift=new l.Point,t._tintFilter.resolution=o,t._blurFilter=i?new d(i):new d(r,n),t.pixelSize=s,t.resolution=o,e.shadowOnly),r=e.rotation,n=e.distance,s=e.alpha,o=e.color;return t.shadowOnly=i,t.rotation=r,t.distance=n,t.alpha=s,t.color=o,t._updatePadding(),t}function A(e,t){void 0===e&&(e=1),void 0===t&&(t=5);var i=oe.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n")||this;return i.scale=e,i.angle=t,i}function k(e){var t=ae.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5));\n \n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n")||this;return t.time=0,t.seed=0,t.uniforms.dimensions=new Float32Array(2),Object.assign(t,k.defaults,e),t}function at(){return le.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")||this}function P(e,t,i){void 0===t&&(t=200),void 0===i&&(i=200);var r=ue.call(this,p,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n")||this;return r.uniforms.texelSize=new Float32Array(2),r.uniforms.matrix=new Float32Array(9),void 0!==e&&(r.matrix=e),r.width=t,r.height=i,r}function O(e,t,i){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===i&&(i=.4);var r=he.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n")||this;return r._originalColor=16711680,r._newColor=0,r.uniforms.originalColor=new Float32Array(3),r.uniforms.newColor=new Float32Array(3),r.originalColor=e,r.newColor=t,r.epsilon=i,r}function lt(e,t){void 0===e&&(e=0),void 0===t&&(t=1);var i=ce.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 color;\nuniform float alpha;\n\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\n}\n")||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=e,i.alpha=t,i}function R(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=1);var r=pe.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}")||this;return r.mix=1,r._size=0,r._sliceSize=0,r._slicePixelSize=0,r._sliceInnerSize=0,r._nearest=!1,r._scaleMode=null,r._colorMap=null,r._scaleMode=null,r.nearest=t,r.mix=i,r.colorMap=e,r}function C(e){var t=de.call(this,p,"uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n")||this;return t.uniforms.dimensions=new Float32Array(2),Object.assign(t,C.defaults,e),t}function M(e,t,i,r){void 0===e&&(e=2),void 0===t&&(t=4),void 0===i&&(i=u.settings.FILTER_RESOLUTION),void 0===r&&(r=5);var n,s,o=fe.call(this)||this;return"number"==typeof e?s=n=e:e instanceof l.Point?(n=e.x,s=e.y):Array.isArray(e)&&(n=e[0],s=e[1]),o.blurXFilter=new N.BlurFilterPass(!0,n,t,i,r),o.blurYFilter=new N.BlurFilterPass(!1,s,t,i,r),o.blurYFilter.blendMode=c.BLEND_MODES.SCREEN,o.defaultFilter=new F.AlphaFilter,o}function I(e){var t=me.call(this,p,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n")||this;return t._thickness=2,t._angle=0,t.uniforms.lightColor=new Float32Array(3),t.uniforms.shadowColor=new Float32Array(3),Object.assign(t,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),t.padding=1,t}function ut(e){void 0===e&&(e=8);var t=_e.call(this,p,"varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n")||this;return t.size=e,t}function D(e){var t=ge.call(this,p,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n")||this,e=(t.bloomScale=1,t.brightness=1,t._resolution=u.settings.FILTER_RESOLUTION,"number"==typeof e&&(e={threshold:e}),Object.assign(D.defaults,e)),i=(t.bloomScale=e.bloomScale,t.brightness=e.brightness,e.kernels),r=e.blur,n=e.quality,s=e.pixelSize,o=e.resolution;return t._extractFilter=new we(e.threshold),t._extractFilter.resolution=o,t._blurFilter=i?new d(i):new d(r,n),t.pixelSize=s,t.resolution=o,t}function L(e,t,i){void 0===e&&(e=4),void 0===t&&(t=3);var r=ve.call(this,p,(i=void 0===i?!1:i)?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}")||this;return r._kernels=[],r._blur=4,r._quality=3,r.uniforms.uOffset=new Float32Array(2),r._pixelSize=new l.Point,r.pixelSize=1,r._clamp=i,Array.isArray(e)?r.kernels=e:(r._blur=e,r.quality=t),r}function ht(e){void 0===e&&(e=.5);var t=ye.call(this,p,"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n")||this;return t.threshold=e,t}function ct(e){var t=be.call(this,p,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n")||this;return t.gamma=1,t.saturation=1,t.contrast=1,t.brightness=1,t.red=1,t.green=1,t.blue=1,t.alpha=1,Object.assign(t,e),t}return e.AdjustmentFilter=Te,e.AdvancedBloomFilter=Ee,e.AsciiFilter=Se,e.BevelFilter=Ae,e.BloomFilter=ke,e.BulgePinchFilter=Pe,e.CRTFilter=De,e.ColorMapFilter=Oe,e.ColorOverlayFilter=Re,e.ColorReplaceFilter=Ce,e.ConvolutionFilter=Me,e.CrossHatchFilter=Ie,e.DotFilter=Le,e.DropShadowFilter=Fe,e.EmbossFilter=Ne,e.GlitchFilter=ze,e.GlowFilter=Be,e.GodrayFilter=Ue,e.KawaseBlurFilter=d,e.MotionBlurFilter=je,e.MultiColorReplaceFilter=Ge,e.OldFilmFilter=Xe,e.OutlineFilter=He,e.PixelateFilter=Ye,e.RGBSplitFilter=qe,e.RadialBlurFilter=We,e.ReflectionFilter=Ve,e.ShockwaveFilter=Ke,e.SimpleLightmapFilter=Ze,e.TiltShiftAxisFilter=Je,e.TiltShiftFilter=et,e.TiltShiftXFilter=Qe,e.TiltShiftYFilter=$e,e.TwistFilter=tt,e.ZoomBlurFilter=it,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),_gsScope=(Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},!function(l,m){"use strict";u.createList=function(e){if("list"in e){var t=e.list,i=void 0,r=t[0],n=r.value,r=r.time,r=i=new u("string"==typeof n?l.ParticleUtils.hexToRGB(n):n,r,e.ease);if(2o.time;)n=o,o=e[++s];var l=(l-n.time)/(o.time-n.time),u=p.hexToRGB(n.value),h=p.hexToRGB(o.value),h={r:(h.r-u.r)*l+u.r,g:(h.g-u.g)*l+u.g,b:(h.b-u.b)*l+u.b};r.next=new c(h,a/t),r=r.next}return i};var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function i(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function n(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function s(e){this.ease&&(e=this.ease(e));var t=this.current.value,i=this.next.value,r=(i.r-t.r)*e+t.r,n=(i.g-t.g)*e+t.g,i=(i.b-t.b)*e+t.b;return l.ParticleUtils.combineRGBComponents(r,n,i)}function o(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function a(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,i=this.next.value,r=(i.r-t.r)*e+t.r,n=(i.g-t.g)*e+t.g,i=(i.b-t.b)*e+t.b;return l.ParticleUtils.combineRGBComponents(r,n,i)}function d(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function f(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return l.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}g.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?s:n:e.isStepped?this.interpolate=this.isColor?f:d:this.interpolate=this.isColor?a:o,this.ease=this.current.ease};var _=g;function g(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}i(b,v=m.Sprite),b.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,l.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=l.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=l.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=l.ParticleUtils.DEG_TO_RADS,this.alpha=this.alphaList.current.value,this.scale.x=this.scale.y=this.scaleList.current.value,this._doAlpha=!!this.alphaList.current.next,this._doSpeed=!!this.speedList.current.next,this._doScale=!!this.scaleList.current.next,this._doColor=!!this.colorList.current.next,this._doAcceleration=0!==this.acceleration.x||0!==this.acceleration.y,this._doNormalMovement=this._doSpeed||0!==this.speedList.current.value||this._doAcceleration,this._oneOverLife=1/this.maxLife;var e=this.colorList.current.value;this.tint=l.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},b.prototype.applyArt=function(e){this.texture=e||m.Texture.EMPTY},b.prototype.update=function(e){var t,i,r,n,s,o;return this.age+=e,this.age>=this.maxLife||this.age<0?(this.kill(),-1):(t=this.age*this._oneOverLife,this.ease&&(t=4===this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale&&(i=this.scaleList.interpolate(t)*this.scaleMultiplier,this.scale.x=this.scale.y=i),this._doNormalMovement&&(s=i=void 0,s=this._doSpeed?(r=this.speedList.interpolate(t)*this.speedMultiplier,l.ParticleUtils.normalize(this.velocity),l.ParticleUtils.scaleBy(this.velocity,r),i=this.velocity.x*e,this.velocity.y*e):this._doAcceleration?(r=this.velocity.x,n=this.velocity.y,this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed&&(o=l.ParticleUtils.length(this.velocity))>this.maxSpeed&&l.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/o),i=(r+this.velocity.x)/2*e,(n+this.velocity.y)/2*e):(i=this.velocity.x*e,this.velocity.y*e),this.position.x+=i,this.position.y+=s),this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration?(o=this.rotationSpeed+this.rotationAcceleration*e,this.rotation+=(this.rotationSpeed+o)/2*e,this.rotationSpeed=o):0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x)),t)},b.prototype.kill=function(){this.emitter.recycle(this)},b.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},b.parseArt=function(e){for(var t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(l.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles);else{var l=void 0,l=this.minLifetime===this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime;if(-this._spawnTimer=this.spawnChance||(p=void 0,this._poolFirst?(p=this._poolFirst,this._poolFirst=this._poolFirst.next,p.next=null):p=new this.particleConstructor(this),1=this.particleImages.length)&&(this._currentImageIndex=0)):p.applyArt(this.particleImages[Math.floor(Math.random()*this.particleImages.length)]):p.applyArt(this.particleImages[0]),p.alphaList.reset(this.startAlpha),1!==this.minimumSpeedMultiplier&&(p.speedMultiplier=Math.random()*(1-this.minimumSpeedMultiplier)+this.minimumSpeedMultiplier),p.speedList.reset(this.startSpeed),p.acceleration.x=this.acceleration.x,p.acceleration.y=this.acceleration.y,p.maxSpeed=this.maxSpeed,1!==this.minimumScaleMultiplier&&(p.scaleMultiplier=Math.random()*(1-this.minimumScaleMultiplier)+this.minimumScaleMultiplier),p.scaleList.reset(this.startScale),p.colorList.reset(this.startColor),this.minRotationSpeed===this.maxRotationSpeed?p.rotationSpeed=this.minRotationSpeed:p.rotationSpeed=Math.random()*(this.maxRotationSpeed-this.minRotationSpeed)+this.minRotationSpeed,p.rotationAcceleration=this.rotationAcceleration,p.noRotation=this.noRotation,p.maxLife=l,p.blendMode=this.particleBlendMode,p.ease=this.customEase,p.extraData=this.extraData,this.applyAdditionalProperties(p),this._spawnFunc(p,h,c,d),p.init(),this.addAtBack?this._parent.addChildAt(p,0):this._parent.addChild(p),this._activeParticlesLast?((this._activeParticlesLast.next=p).prev=this._activeParticlesLast,this._activeParticlesLast=p):this._activeParticlesLast=this._activeParticlesFirst=p,++this.particleCount,p.update(-this._spawnTimer))}}this._spawnTimer+=this._frequency}this._posChanged&&(this._prevEmitterPos.x=o,this._prevEmitterPos.y=a,this._prevPosIsValid=!0,this._posChanged=!1),this._emit||this._activeParticlesFirst||(this._completeCallback&&(s=this._completeCallback,this._completeCallback=null,s()),this._destroyWhenComplete&&this.destroy())}},S.prototype.applyAdditionalProperties=function(e){},S.prototype._spawnPoint=function(e,t,i){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,e.position.x=t,e.position.y=i},S.prototype._spawnRect=function(e,t,i){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,E.x=Math.random()*this.spawnRect.width+this.spawnRect.x,E.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=i+E.y},S.prototype._spawnCircle=function(e,t,i){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,E.x=Math.random()*this.spawnCircle.radius,E.y=0,l.ParticleUtils.rotatePoint(360*Math.random(),E),E.x+=this.spawnCircle.x,E.y+=this.spawnCircle.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=i+E.y},S.prototype._spawnRing=function(e,t,i){var r=this.spawnCircle,r=(this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,r.minRadius!==r.radius?E.x=Math.random()*(r.radius-r.minRadius)+r.minRadius:E.x=r.radius,E.y=0,360*Math.random());e.rotation+=r,l.ParticleUtils.rotatePoint(r,E),E.x+=this.spawnCircle.x,E.y+=this.spawnCircle.y,0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=i+E.y},S.prototype._spawnPolygonalChain=function(e,t,i){this.minStartRotation===this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,this.spawnPolygonalChain.getRandomPoint(E),0!==this.rotation&&l.ParticleUtils.rotatePoint(this.rotation,E),e.position.x=t+E.x,e.position.y=i+E.y},S.prototype._spawnBurst=function(e,t,i,r){0===this.particleSpacing?e.rotation=360*Math.random():e.rotation=this.angleStart+this.particleSpacing*r+this.rotation,e.position.x=t,e.position.y=i},S.prototype.cleanup=function(){for(var e,t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t),t.parent&&t.parent.removeChild(t);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},S.prototype.destroy=function(){var e;this.autoUpdate=!1,this.cleanup();for(var t=this._poolFirst;t;t=e)e=t.next,t.destroy();this._poolFirst=this._parent=this.particleImages=this.spawnPos=this.ownerPos=this.startColor=this.startScale=this.startAlpha=this.startSpeed=this.customEase=this._completeCallback=null},S);function S(e,t,i){this._currentImageIndex=-1,this._particleConstructor=y,this.particleImages=null,this.startAlpha=null,this.startSpeed=null,this.minimumSpeedMultiplier=1,this.acceleration=null,this.maxSpeed=NaN,this.startScale=null,this.minimumScaleMultiplier=1,this.startColor=null,this.minLifetime=0,this.maxLifetime=0,this.minStartRotation=0,this.maxStartRotation=0,this.noRotation=!1,this.minRotationSpeed=0,this.maxRotationSpeed=0,this.particleBlendMode=0,this.customEase=null,this.extraData=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=null,this.spawnType=null,this._spawnFunc=null,this.spawnRect=null,this.spawnCircle=null,this.spawnPolygonalChain=null,this.particlesPerWave=1,this.particleSpacing=0,this.angleStart=0,this.rotation=0,this.ownerPos=null,this._prevEmitterPos=null,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._origArt=null,this._autoUpdate=!1,this._currentImageIndex=-1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=e,t&&i&&this.init(t,i),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}var A=new m.Point,k=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],P=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(k).join("|"),"g");i(C,O=y),C.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},C.prototype.update=function(e){var t,i=this.Particle_update(e);return 0<=i&&this.path&&(t=this._doSpeed?this.speedList.interpolate(i)*this.speedMultiplier:this.speedList.current.value*this.speedMultiplier,this.movement+=t*e,A.x=this.movement,A.y=this.path(this.movement),l.ParticleUtils.rotatePoint(this.initialRotation,A),this.position.x=this.initialPosition.x+A.x,this.position.y=this.initialPosition.y+A.y),i},C.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},C.parseArt=function(e){return y.parseArt(e)},C.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(P),i=t.length-1;0<=i;--i)0<=k.indexOf(t[i])&&(t[i]="Math."+t[i]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){l.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else l.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t};var O,R=C;function C(e){e=O.call(this,e)||this;return e.path=null,e.initialRotation=0,e.initialPosition=new m.Point,e.movement=0,e}i(I,M=y),I.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},I.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},I.prototype.update=function(e){var t=this.Particle_update(e);return 0<=t&&(this.elapsed+=e,this.elapsed>=this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6),e=this.elapsed*this.framerate+1e-7|0,this.texture=this.textures[e]||this.textures[this.textures.length-1]||m.Texture.EMPTY),t},I.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},I.parseArt=function(e){for(var t=[],i=0;ithis._childCount)throw new Error("addChildAt: The index "+t+" supplied is out of bounds "+this._childCount);e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1;var i=e;if(this._firstChild)if(0===t)(this._firstChild.prevChild=i).nextChild=this._firstChild,this._firstChild=i;else if(t===this._childCount)(this._lastChild.nextChild=i).prevChild=this._lastChild,this._lastChild=i;else{for(var r=0,n=this._firstChild;r=this._childCount)throw new Error("The index "+t+" supplied is out of bounds "+this._childCount);if(e.parent!==this)throw new Error("The supplied DisplayObject must be a child of the caller");if(e.nextChild&&(e.nextChild.prevChild=e.prevChild),e.prevChild&&(e.prevChild.nextChild=e.nextChild),this._firstChild===e&&(this._firstChild=e.nextChild),this._lastChild===e&&(this._lastChild=e.prevChild),e.nextChild=null,e.prevChild=null,this._firstChild)if(0===t)(this._firstChild.prevChild=e).nextChild=this._firstChild,this._firstChild=e;else if(t===this._childCount)(this._lastChild.nextChild=e).prevChild=this._lastChild,this._lastChild=e;else{for(var i=0,r=this._firstChild;i=this._childCount)throw new Error("getChildAt: Index ("+e+") does not exist.");if(0===e)return this._firstChild;if(e===this._childCount)return this._lastChild;for(var t=0,i=this._firstChild;t=s.TRANSFORM_STEP.PROJ?(i||this.displayObjectUpdateTransform(),(this.proj.affine?this.transform.worldTransform:this.proj.world).applyInverse(e,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):(r.x=e.x,r.y=e.y),n===s.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const $=Q.prototype.toLocal;class d extends o.Mesh{static __initStatic(){this.defaultVertexShader=`precision highp float; +`,e)}__init(){this.quad=new _.QuadUv}render(e){var t=this.renderer,i=this.quad;let r=i.vertices;r[0]=r[6]=e._width*-e.anchor.x,r[1]=r[3]=e._height*-e.anchor.y,r[2]=r[4]=e._width*(1-e.anchor.x),r[5]=r[7]=e._height*(1-e.anchor.y),e.uvRespectAnchor&&((r=i.uvs)[0]=r[6]=-e.anchor.x,r[1]=r[3]=-e.anchor.y,r[2]=r[4]=1-e.anchor.x,r[5]=r[7]=1-e.anchor.y),i.invalidate();var n=e._texture,s=n.baseTexture,o=e.tileProj.world,a=e.uvMatrix;let l=s.isPowerOfTwo&&n.frame.width===s.width&&n.frame.height===s.height;l&&(s._glTextures[t.CONTEXT_UID]?l=s.wrapMode!==h.WRAP_MODES.CLAMP:s.wrapMode===h.WRAP_MODES.CLAMP&&(s.wrapMode=h.WRAP_MODES.REPEAT));var u=l?this.simpleShader:this.shader;c.identity(),c.scale(n.width,n.height),c.prepend(o),c.scale(1/e._width,1/e._height),c.invert(),l?c.prepend(a.mapCoord):(u.uniforms.uMapCoord=a.mapCoord.toArray(!0),u.uniforms.uClampFrame=a.uClampFrame,u.uniforms.uClampOffset=a.uClampOffset),u.uniforms.uTransform=c.toArray(!0),u.uniforms.uColor=g.premultiplyTintToRgba(e.tint,e.worldAlpha,u.uniforms.uColor,s.premultiplyAlpha),u.uniforms.translationMatrix=e.worldTransform.toArray(!0),u.uniforms.uSampler=n,t.shader.bind(u,!1),t.geometry.bind(i,void 0),t.state.setBlendMode(g.correctBlendMode(e.blendMode,s.premultiplyAlpha)),t.geometry.draw(h.DRAW_MODES.TRIANGLES,6,0)}}const u=new d.Point,p=[new d.Point,new d.Point,new d.Point,new d.Point],o=new d.Rectangle,Z=new n;class l extends r{constructor(e,t){super(e,t),l.prototype.__init.call(this),l.prototype.__init2.call(this),l.prototype.__init3.call(this),this.local=new n,this.world=new n}__init(){this.matrix=new n}__init2(){this.pivot=new d.ObservablePoint(this.onChange,this,0,0)}__init3(){this.reverseLocalOrder=!1}onChange(){var e=this.pivot,t=this.matrix.mat3;t[6]=-(e._x*t[0]+e._y*t[3]),t[7]=-(e._x*t[1]+e._y*t[4]),this._projID++}setAxisX(e,t=1){var i=e.x,e=e.y,r=Math.sqrt(i*i+e*e),n=this.matrix.mat3;n[0]=i/r,n[1]=e/r,n[2]=t/r,this.onChange()}setAxisY(e,t=1){var i=e.x,e=e.y,r=Math.sqrt(i*i+e*e),n=this.matrix.mat3;n[3]=i/r,n[4]=e/r,n[5]=t/r,this.onChange()}mapSprite(e,t){var i=e.texture;o.x=-e.anchor.x*i.orig.width,o.y=-e.anchor.y*i.orig.height,o.width=i.orig.width,o.height=i.orig.height,this.mapQuad(o,t)}mapQuad(t,i){p[0].set(t.x,t.y),p[1].set(t.x+t.width,t.y),p[2].set(t.x+t.width,t.y+t.height),p[3].set(t.x,t.y+t.height);let r=1,n=2,s=3;t=W(i[0],i[2],i[1],i[3],u);if(0!==t){r=1,n=3,s=2;var t=Math.sqrt((i[0].x-u.x)*(i[0].x-u.x)+(i[0].y-u.y)*(i[0].y-u.y)),o=Math.sqrt((i[r].x-u.x)*(i[r].x-u.x)+(i[r].y-u.y)*(i[r].y-u.y)),a=Math.sqrt((i[n].x-u.x)*(i[n].x-u.x)+(i[n].y-u.y)*(i[n].y-u.y)),l=Math.sqrt((i[s].x-u.x)*(i[s].x-u.x)+(i[s].y-u.y)*(i[s].y-u.y)),t=(t+l)/l,l=(o+a)/a,a=(o+a)/o;let e=this.matrix.mat3;e[0]=p[0].x*t,e[1]=p[0].y*t,e[2]=t,e[3]=p[r].x*l,e[4]=p[r].y*l,e[5]=l,e[6]=p[n].x*a,e[7]=p[n].y*a,e[8]=a,this.matrix.invert(),(e=Z.mat3)[0]=i[0].x,e[1]=i[0].y,e[2]=1,e[3]=i[r].x,e[4]=i[r].y,e[5]=1,e[6]=i[n].x,e[7]=i[n].y,e[8]=1,this.matrix.setToMult(Z,this.matrix),this._projID++}}updateLocalTransform(e){0!==this._projID?this.reverseLocalOrder?this.local.setToMultLegacy2(this.matrix,e):this.local.setToMultLegacy(e,this.matrix):this.local.copyFrom(e)}clear(){super.clear(),this.matrix.identity(),this.pivot.set(0,0)}}function J(){return this.proj.affine?this.transform.worldTransform:this.proj.world}class Q extends e.Container{constructor(){super(),this.proj=new l(this.transform)}toLocal(e,t,i,r,n=a.TRANSFORM_STEP.ALL){return t&&(e=t.toGlobal(e,i,r)),r||this._recursivePostUpdateTransform(),n>=a.TRANSFORM_STEP.PROJ?(r||this.displayObjectUpdateTransform(),(this.proj.affine?this.transform.worldTransform:this.proj.world).applyInverse(e,i)):(this.parent?i=this.parent.worldTransform.applyInverse(e,i):(i.x=e.x,i.y=e.y),n===a.TRANSFORM_STEP.NONE?i:this.transform.localTransform.applyInverse(i,i))}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const $=Q.prototype.toLocal;class f extends s.Mesh{static __initStatic(){this.defaultVertexShader=`precision highp float; attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; @@ -98,7 +98,7 @@ uniform sampler2D uSampler; void main(void) { gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor; -}`}constructor(e,t,r,i){super(e,t,r,i),d.prototype.__init.call(this),this.proj=new l(this.transform)}__init(){this.vertexData2d=null}calculateVertices(){if(this.proj._affine)this.vertexData2d=null,super.calculateVertices();else{var e=this.geometry,t=e.buffers[0].data;if(e.vertexDirtyId!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length)),this.vertexData2d&&this.vertexData2d.length===3*t.length/2||(this.vertexData2d=new Float32Array(3*t.length));var r=this.proj.world.mat3,i=this.vertexData2d,n=this.vertexData;for(let e=0;er.call(t,...e)),t=void 0)}return r}([t,"access",e=>e.program,"access",e=>e.uniformData,"optionalAccess",e=>e.translationMatrix])&&(t.uniforms.translationMatrix=this.worldTransform.toArray(!0)),e.shader.bind(t,!1),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}toLocal(e,t,r,i,n=s.TRANSFORM_STEP.ALL){return $.call(this,e,t,r,i,n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}d.__initStatic(),d.__initStatic2();class ee extends d{constructor(e,t,r,i,n){super(new o.MeshGeometry(t,r,i),new o.MeshMaterial(e,{program:_.Program.from(d.defaultVertexShader,d.defaultFragmentShader),pluginName:"batch2d"}),null,n),ee.prototype.__init2.call(this),this.geometry.getBuffer("aVertexPosition").static=!1}__init2(){this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(e){this.geometry.getBuffer("aVertexPosition").data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(e)}}class m extends t.Sprite{constructor(e){super(e),m.prototype.__init.call(this),this.proj=new l(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){var n=this._texture;if(this.proj._affine)this.vertexData2d=null,super.calculateVertices();else{this.vertexData2d||(this.vertexData2d=new Float32Array(12));var o=this.transform._worldID,a=n._updateID;if(this._transformID!==o||this._textureID!==a){this._textureID!==a&&(this.uvs=n._uvs.uvsFloat32),this._transformID=o,this._textureID=a;var o=this.proj.world.mat3,a=this.vertexData2d,s=this.vertexData,l=n.trim,n=n.orig,u=this._anchor;let e,t,r,i;r=l?(t=l.x-u._x*n.width,e=t+l.width,(i=l.y-u._y*n.height)+l.height):(t=-u._x*n.width,e=t+n.width,(i=-u._y*n.height)+n.height),a[0]=o[0]*t+o[3]*i+o[6],a[1]=o[1]*t+o[4]*i+o[7],a[2]=o[2]*t+o[5]*i+o[8],a[3]=o[0]*e+o[3]*i+o[6],a[4]=o[1]*e+o[4]*i+o[7],a[5]=o[2]*e+o[5]*i+o[8],a[6]=o[0]*e+o[3]*r+o[6],a[7]=o[1]*e+o[4]*r+o[7],a[8]=o[2]*e+o[5]*r+o[8],a[9]=o[0]*t+o[3]*r+o[6],a[10]=o[1]*t+o[4]*r+o[7],a[11]=o[2]*t+o[5]*r+o[8],s[0]=a[0]/a[2],s[1]=a[1]/a[2],s[2]=a[3]/a[5],s[3]=a[4]/a[5],s[4]=a[6]/a[8],s[5]=a[7]/a[8],s[6]=a[9]/a[11],s[7]=a[10]/a[11]}}}calculateTrimmedVertices(){if(this.proj._affine)super.calculateTrimmedVertices();else{var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var e=this._texture,t=this.vertexTrimmedData,e=e.orig,r=this.tileProj?this._width:e.width,e=this.tileProj?this._height:e.height,i=this._anchor,n=this.proj.world.mat3,o=-i._x*r,r=o+r,i=-i._y*e,e=i+e,a=1/(n[2]*o+n[5]*i+n[8]);t[0]=a*(n[0]*o+n[3]*i+n[6]),t[1]=a*(n[1]*o+n[4]*i+n[7]),a=1/(n[2]*r+n[5]*i+n[8]),t[2]=a*(n[0]*r+n[3]*i+n[6]),t[3]=a*(n[1]*r+n[4]*i+n[7]),a=1/(n[2]*r+n[5]*e+n[8]),t[4]=a*(n[0]*r+n[3]*e+n[6]),t[5]=a*(n[1]*r+n[4]*e+n[7]),a=1/(n[2]*o+n[5]*e+n[8]),t[6]=a*(n[0]*o+n[3]*e+n[6]),t[7]=a*(n[1]*o+n[4]*e+n[7])}}toLocal(e,t,r,i,n=s.TRANSFORM_STEP.ALL){return $.call(this,e,t,r,i,n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const te=new p.Transform;class re extends F.TilingSprite{constructor(e,t,r){super(e,t,r),this.tileProj=new l(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.proj=new l(this.transform),this.pluginName="tilingSprite2d",this.uvRespectAnchor=!0}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(e,t,r,i,n=s.TRANSFORM_STEP.ALL){return $.call(this,e,t,r,i,n)}_render(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateTransform(te),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))}}function ie(){this.proj||(this.proj=new l(this.transform),this.toLocal=Q.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:Z,enumerable:!0,configurable:!0}))}e.Container.prototype.convertTo2d=ie,t.Sprite.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=m.prototype.calculateVertices,this.calculateTrimmedVertices=m.prototype.calculateTrimmedVertices,this._calculateBounds=m.prototype._calculateBounds,this.pluginName="batch2d",ie.call(this))},e.Container.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(let e=0;ei.call(t,...e)),t=void 0)}return i}([t,"access",e=>e.program,"access",e=>e.uniformData,"optionalAccess",e=>e.translationMatrix])&&(t.uniforms.translationMatrix=this.worldTransform.toArray(!0)),e.shader.bind(t,!1),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}toLocal(e,t,i,r,n=a.TRANSFORM_STEP.ALL){return $.call(this,e,t,i,r,n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}f.__initStatic(),f.__initStatic2();class ee extends f{constructor(e,t,i,r,n){super(new s.MeshGeometry(t,i,r),new s.MeshMaterial(e,{program:_.Program.from(f.defaultVertexShader,f.defaultFragmentShader),pluginName:"batch2d"}),null,n),ee.prototype.__init2.call(this),this.geometry.getBuffer("aVertexPosition").static=!1}__init2(){this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(e){this.geometry.getBuffer("aVertexPosition").data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(e)}}class m extends t.Sprite{constructor(e){super(e),m.prototype.__init.call(this),this.proj=new l(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){var n=this._texture;if(this.proj._affine)this.vertexData2d=null,super.calculateVertices();else{this.vertexData2d||(this.vertexData2d=new Float32Array(12));var s=this.transform._worldID,o=n._updateID;if(this._transformID!==s||this._textureID!==o){this._textureID!==o&&(this.uvs=n._uvs.uvsFloat32),this._transformID=s,this._textureID=o;var s=this.proj.world.mat3,o=this.vertexData2d,a=this.vertexData,l=n.trim,n=n.orig,u=this._anchor;let e,t,i,r;i=l?(t=l.x-u._x*n.width,e=t+l.width,(r=l.y-u._y*n.height)+l.height):(t=-u._x*n.width,e=t+n.width,(r=-u._y*n.height)+n.height),o[0]=s[0]*t+s[3]*r+s[6],o[1]=s[1]*t+s[4]*r+s[7],o[2]=s[2]*t+s[5]*r+s[8],o[3]=s[0]*e+s[3]*r+s[6],o[4]=s[1]*e+s[4]*r+s[7],o[5]=s[2]*e+s[5]*r+s[8],o[6]=s[0]*e+s[3]*i+s[6],o[7]=s[1]*e+s[4]*i+s[7],o[8]=s[2]*e+s[5]*i+s[8],o[9]=s[0]*t+s[3]*i+s[6],o[10]=s[1]*t+s[4]*i+s[7],o[11]=s[2]*t+s[5]*i+s[8],a[0]=o[0]/o[2],a[1]=o[1]/o[2],a[2]=o[3]/o[5],a[3]=o[4]/o[5],a[4]=o[6]/o[8],a[5]=o[7]/o[8],a[6]=o[9]/o[11],a[7]=o[10]/o[11]}}}calculateTrimmedVertices(){if(this.proj._affine)super.calculateTrimmedVertices();else{var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var e=this._texture,t=this.vertexTrimmedData,e=e.orig,i=this.tileProj?this._width:e.width,e=this.tileProj?this._height:e.height,r=this._anchor,n=this.proj.world.mat3,s=-r._x*i,i=s+i,r=-r._y*e,e=r+e,o=1/(n[2]*s+n[5]*r+n[8]);t[0]=o*(n[0]*s+n[3]*r+n[6]),t[1]=o*(n[1]*s+n[4]*r+n[7]),o=1/(n[2]*i+n[5]*r+n[8]),t[2]=o*(n[0]*i+n[3]*r+n[6]),t[3]=o*(n[1]*i+n[4]*r+n[7]),o=1/(n[2]*i+n[5]*e+n[8]),t[4]=o*(n[0]*i+n[3]*e+n[6]),t[5]=o*(n[1]*i+n[4]*e+n[7]),o=1/(n[2]*s+n[5]*e+n[8]),t[6]=o*(n[0]*s+n[3]*e+n[6]),t[7]=o*(n[1]*s+n[4]*e+n[7])}}toLocal(e,t,i,r,n=a.TRANSFORM_STEP.ALL){return $.call(this,e,t,i,r,n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const te=new d.Transform;class ie extends F.TilingSprite{constructor(e,t,i){super(e,t,i),this.tileProj=new l(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.proj=new l(this.transform),this.pluginName="tilingSprite2d",this.uvRespectAnchor=!0}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(e,t,i,r,n=a.TRANSFORM_STEP.ALL){return $.call(this,e,t,i,r,n)}_render(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateTransform(te),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))}}function re(){this.proj||(this.proj=new l(this.transform),this.toLocal=Q.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:J,enumerable:!0,configurable:!0}))}e.Container.prototype.convertTo2d=re,t.Sprite.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=m.prototype.calculateVertices,this.calculateTrimmedVertices=m.prototype.calculateTrimmedVertices,this._calculateBounds=m.prototype._calculateBounds,this.pluginName="batch2d",re.call(this))},e.Container.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(let e=0;et[e]&&(i=t[e]),ot[e+1]&&(n=t[e+1]),aR[e]&&(l=P[t],P[t]=P[e],P[e]=l,l=R[t],R[t]=R[e],R[e]=l)}t[0]=P[0].x,t[1]=P[0].y,t[2]=P[1].x,t[3]=P[1].y,t[4]=P[2].x,t[5]=P[2].y,t[6]=P[3].x,t[7]=P[3].y,(P[3].x-P[2].x)*(P[1].y-P[2].y)-(P[1].x-P[2].x)*(P[3].y-P[2].y)<0&&(t[4]=P[3].x,t[5]=P[3].y)}}}const ve=new p.Matrix,M=new p.Rectangle,I=new p.Point;class ye extends C{constructor(...e){super(...e),ye.prototype.__init.call(this)}__init(){this.distortion=new p.Point}clear(){this.distortion.set(0,0)}apply(e,t){t=t||new p.Point;var r=this.distortion,i=e.x*e.y;return t.x=e.x+r.x*i,t.y=e.y+r.y*i,t}applyInverse(e,t){t=t||new p.Point;var r=e.x,e=e.y,i=this.distortion.x,n=this.distortion.y;if(0===i)t.x=r,t.y=e/(1+n*r);else if(0===n)t.y=e,t.x=r/(1+i*e);else{var e=.5*(e*i-r*n+1)/n,o=e*e+r/n;if(o<=1e-5)return t.set(NaN,NaN),t;t.x=0>0,0!==h._cycle&&h._cycle===h._totalTime/c&&p<=e&&h._cycle--,h._time=h._totalTime-h._cycle*c,h._yoyo&&0!=(1&h._cycle)&&(h._time=m-h._time,(u=h._yoyoEase||h.vars.yoyoEase)&&(h._yoyoEase||(!0!==u||h._initted?h._yoyoEase=u=!0===u?h._ease:u instanceof Ease?u:Ease.map[u]:(u=h.vars.ease,h._yoyoEase=u=u?u instanceof Ease?u:"function"==typeof u?new Ease(u,h.vars.easeParams):Ease.map[u]||g.defaultEase:g.defaultEase)),h.ratio=u?1-u.getRatio((m-h._time)/m):0)),h._time>m?h._time=m:h._time<0&&(h._time=0)),h._easeType&&!u?(c=h._time/m,(1===(a=h._easeType)||3===a&&.5<=c)&&(c=1-c),3===a&&(c*=2),1===(s=h._easePower)?c*=c:2===s?c*=c*c:3===s?c*=c*c*c:4===s&&(c*=c*c*c*c),h.ratio=1===a?1-c:2===a?c:h._time/m<.5?c/2:1-c/2):u||(h.ratio=h._ease.getRatio(h._time/m))),f!==h._time||r||d!==h._cycle){if(!h._initted){if(h._init(),!h._initted||h._gc)return;if(!r&&h._firstPT&&(!1!==h.vars.lazy&&h._duration||h.vars.lazy&&!h._duration))return h._time=f,h._totalTime=p,h._rawPrevTime=_,h._cycle=d,x.lazyTweens.push(h),void(h._lazy=[e,t]);!h._time||i||u?i&&this._ease._calcEnd&&!u&&(h.ratio=h._ease.getRatio(0===h._time?0:1)):h.ratio=h._ease.getRatio(h._time/m)}for(!1!==h._lazy&&(h._lazy=!1),h._active||!h._paused&&h._time!==f&&0<=e&&(h._active=!0),0===p&&(2===h._initted&&0e._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},e.remove=function(e){var t;if(e instanceof c)return this._remove(e,!1),t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline,e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this;if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},e._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},e.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},e.insert=e.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},e.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},e.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},e.addPause=function(e,t,r,i){r=d.delayedCall(0,n,r,i||this);return r.vars.onComplete=r.vars.onReverseComplete=t,r.data="isPause",this._hasPause=!0,this.add(r,e)},e.removeLabel=function(e){return delete this._labels[e],this},e.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},e._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}!c._onUpdate||t||(b.length&&x(),c._callback("onUpdate")),!a||c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(b.length&&x(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a))}},e._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},e.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},e._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},e.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},e.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},e._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},e.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},e.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},e.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},e.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},e.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},e.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,c._cycle&&c._cycle===c._totalTime/x&&m<=e&&c._cycle--,c._time=c._totalTime-c._cycle*x,c._yoyo&&1&c._cycle&&(c._time=d-c._time),c._time>d?e=(c._time=d)+1e-4:c._time<0?c._time=e=0:e=c._time));if(c._hasPause&&!c._forcingPlayhead&&!t){if(f<(e=c._time)||c._repeat&&b!==c._cycle)for(i=c._first;i&&i._startTime<=e&&!l;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===c._rawPrevTime||(l=i),i=i._next;else for(i=c._last;i&&i._startTime>=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}!c._onUpdate||t||(O.length&&P(),c._callback("onUpdate")),!a||c._locked||c._gc||_!==c._startTime&&g===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(O.length&&P(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a))}else m!==c._totalTime&&c._onUpdate&&!t&&c._callback("onUpdate")},i.getActive=function(e,t,r){for(var i,n=[],o=this.getChildren(e||null==e,t||null==e,!!r),a=0,s=o.length,l=0;le)return t[i].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].time>0||6)-1,c=[],f=[];for(r in e){x=b=y=v=x=g=_=m=d=p=y=A=S=void 0;for(var p,d,m,_,g,v,y,b,x,T=e[r],w=a,E=t,S=1/E,A=T.length;-1<--A;)for(d=(b=T[A]).a,m=b.d-d,_=b.c-d,g=b.b-d,p=0,v=1;v<=E;v++)y=p-(p=((x=S*v)*x*m+3*(y=1-x)*(x*_+y*g))*x),w[x=A*E+v-1]=(w[x]||0)+y*y}for(n=a.length,i=0;i>0]=f,s[o]=u,l=0,f=[]);return{length:u,lengths:s,segments:c}}(this._beziers,this._timeRes),this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length),c=this._autoRotate)for(this._initialRotations=[],c[0]instanceof Array||(this._autoRotate=c=[c]),o=c.length;-1<--o;){for(a=0;a<3;a++)i=c[o][a],this._func[i]="function"==typeof e[i]&&e[i.indexOf("set")||"function"!=typeof e["get"+i.substr(3)]?i:"get"+i.substr(3)];i=c[o][2],this._initialRotations[o]=(this._func[i]?this._func[i].call(this._target):this._target[i])||0,this._overwriteProps.push(i)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,i,n,o,a,s,l,u,h,c=this._segCount,f=this._func,p=this._target,d=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,u=this._curSeg,h=e*this._length,w=this._li,h>this._l2&&w=h;);0===w&&hthis._s2&&w=h;);0===w&&h>0)*(1/c))*c;for(r=1-o,w=this._props.length;-1<--w;)i=this._props[w],a=(o*o*(n=this._beziers[i][t]).da+3*r*(o*n.ca+r*n.ba))*o+n.a,this._mod[i]&&(a=this._mod[i](a,p)),f[i]?p[i](a):p[i]=a;if(this._autoRotate)for(var m,_,g,v,y,b,x,T=this._autoRotate,w=T.length;-1<--w;)i=T[w][2],b=T[w][3]||0,x=!0===T[w][4]?1:E,n=this._beziers[T[w][0]],m=this._beziers[T[w][1]],n&&m&&(n=n[t],m=m[t],_=n.a+(n.b-n.a)*o,_+=((v=n.b+(n.c-n.b)*o)-_)*o,v+=(n.c+(n.d-n.c)*o-v)*o,g=m.a+(m.b-m.a)*o,g+=((y=m.b+(m.c-m.b)*o)-g)*o,y+=(m.c+(m.d-m.c)*o-y)*o,a=d?Math.atan2(y-g,v-_)*x+b:this._initialRotations[w],this._mod[i]&&(a=this._mod[i](a,p)),f[i]?p[i](a):p[i]=a)}}),e=_.prototype,_.bezierThrough=f,_.cubicToQuadratic=j,_._autoCSS=!0,_.quadraticToCubic=function(e,t,r){return new B(e,(2*t+e)/3,(2*t+r)/3,r)},_._cssRegister=function(){var p,d,m,e=t.CSSPlugin;e&&(e=e._internals,p=e._parseToProxy,d=e._setPluginRatio,m=e.CSSPropTween,e._registerComplexSpecialProp("bezier",{parser:function(e,t,r,i,n,o){t instanceof Array&&(t={values:t}),o=new _;var a,s,l,u=t.values,h=u.length-1,c=[],f={};if(!(h<0)){for(a=0;a<=h;a++)l=p(e,u[a],i,n,o,h!==a),c[a]=l.end;for(s in t)f[s]=t[s];f.values=c,(n=new m(e,"bezier",0,0,l.pt,2)).data=l,n.plugin=o,n.setRatio=d,0===f.autoRotate&&(f.autoRotate=!0),!f.autoRotate||f.autoRotate instanceof Array||(a=!0===f.autoRotate?0:Number(f.autoRotate),f.autoRotate=null!=l.end.left?[["left","top","rotation",a,!1]]:null!=l.end.x&&[["x","y","rotation",a,!1]]),f.autoRotate&&(i._transform||i._enableTransforms(!1),l.autoRotate=i._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,i._overwriteProps.push("rotation")),o._onInitTween(l.proxy,f,i._tween)}return n}}))},e._mod=function(e){for(var t,r=this._overwriteProps,i=r.length;-1<--i;)(t=e[r[i]])&&"function"==typeof t&&(this._mod[r[i]]=t)},e._kill=function(e){var t,r,i=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=i.length;-1<--r;)i[r]===t&&i.splice(r,1);if(i=this._autoRotate)for(r=i.length;-1<--r;)e[i[r][2]]&&i.splice(r,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(a,R){function C(){a.call(this,"css"),this._overwriteProps.length=0,this.setRatio=C.prototype.setRatio}function s(e,t){return t.toUpperCase()}function l(e,t){return(t=L.createElementNS?L.createElementNS(t||"http://www.w3.org/1999/xhtml",e):L.createElement(e)).style?t:L.createElement(e)}function u(e){return ne.test("string"==typeof e?e:(e.currentStyle||e.style).filter||"")?parseFloat(RegExp.$1)/100:1}function _(e){_gsScope.console&&console.log(e)}function T(e,t){var r,i,n=(t=t||F).style;if(void 0!==n[e])return e;for(e=e.charAt(0).toUpperCase()+e.substr(1),r=["O","Moz","ms","Ms","Webkit"],i=5;-1<--i&&void 0===n[r[i]+e];);return 0<=i?(ve="-"+(ye=3===i?"ms":r[i]).toLowerCase()+"-",ye+e):null}function d(e){return be.getComputedStyle(e)}function f(e,t){var r,i,n={};if(t=t||d(e))if(r=t.length)for(;-1<--r;)-1!==(i=t[r]).indexOf("-transform")&&Ge!==i||(n[i.replace(ue,s)]=t.getPropertyValue(i));else for(r in t)-1!==r.indexOf("Transform")&&H!==r||(n[r]=t[r]);else if(t=e.currentStyle||e.style)for(r in t)"string"==typeof r&&void 0===n[r]&&(n[r.replace(ue,s)]=t[r]);return N||(n.opacity=u(e)),e=Je(e,t,!1),n.rotation=e.rotation,n.skewX=e.skewX,n.scaleX=e.scaleX,n.scaleY=e.scaleY,n.x=e.x,n.y=e.y,Y&&(n.z=e.z,n.rotationX=e.rotationX,n.rotationY=e.rotationY,n.scaleZ=e.scaleZ),n.filters&&delete n.filters,n}function g(e,t,r,i,n){var o,a,s,l={},u=e.style;for(a in r)"cssText"===a||"length"!==a&&isNaN(a)&&(t[a]!==(o=r[a])||n&&n[a])&&-1===a.indexOf("Origin")&&("number"==typeof o||"string"==typeof o)&&(l[a]="auto"!==o||"left"!==a&&"top"!==a?""!==o&&"auto"!==o&&"none"!==o||"string"!=typeof t[a]||""===t[a].replace(re,"")?o:0:xe(e,a),void 0!==u[a]&&(s=new Oe(u,a,u[a],s)));if(i)for(a in i)"className"!==a&&(l[a]=i[a]);return{difs:l,firstMPT:s}}function A(e,t){return"string"==typeof(e="function"==typeof e?e(P,O):e)&&"="===e.charAt(1)?parseInt(e.charAt(0)+"1",10)*parseFloat(e.substr(2)):parseFloat(e)-parseFloat(t)||0}function E(e,t){var r="string"==typeof(e="function"==typeof e?e(P,O):e)&&"="===e.charAt(1);return null==(e="string"==typeof e&&"v"===e.charAt(e.length-2)?(r?e.substr(0,2):0)+window["inner"+("vh"===e.substr(-2)?"Height":"Width")]*(parseFloat(r?e.substr(2):e)/100):e)?t:r?parseInt(e.charAt(0)+"1",10)*parseFloat(e.substr(2))+t:parseFloat(e)||0}function S(e,t,r,i){var n,o;return n=(n=null==(e="function"==typeof e?e(P,O):e)?t:"number"==typeof e?e:(n=e.split("_"),o=((o="="===e.charAt(1))?parseInt(e.charAt(0)+"1",10)*parseFloat(n[0].substr(2)):parseFloat(n[0]))*(-1===e.indexOf("rad")?1:D)-(o?0:t),n.length&&(i&&(i[r]=t+o),-1!==e.indexOf("short")&&(o%=360)!==o%180&&(o=o<0?o+360:o-360),-1!==e.indexOf("_cw")&&o<0?o=(o+3599999999640)%360-360*(o/360|0):-1!==e.indexOf("ccw")&&0>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),Ee[e])r=Ee[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(i=e.charAt(1))+i+(n=e.charAt(2))+n+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=u=e.match(Q),t){if(-1!==e.indexOf("="))return e.match($)}else a=Number(r[0])%360/360,s=Number(r[1])/100,i=2*(l=Number(r[2])/100)-(n=l<=.5?l*(s+1):l+s-l*s),3i--)for(;++ii--)for(;++i>0];return i.parse(e,a,n,o)}}function Oe(e,t,r,i,n){this.t=e,this.p=t,this.v=r,this.r=n,i&&((i._prev=this)._next=i)}t._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,i,n,o,a=this.data,s=a.proxy,l=a.firstMPT;l;)t=s[l.v],l.r?t=l.r(t):t<1e-6&&-1e-6s.length?l:s).length,a=0;an.pr;)o=o._next;(n._prev=o?o._prev:s)?n._prev._next=n:a=n,(n._next=o)?o._prev=n:s=n,n=l}this._firstPT=a}return!0},e.parse=function(e,t,r,i){var n,o,a,s,l,u,h,c,f=e.style;for(n in t){if(l=t[n],s=m[n],"function"!=typeof l||s&&s.allowFunc||(l=l(P,O)),s)r=s.parse(e,l,n,this,r,i,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",d(e).getPropertyValue(n)+"",l+"",n,!1,n);continue}s=z(e,n,k)+"",h="string"==typeof l,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||h&&se.test(l)?(h||(l=(3<(l=Se(l)).length?"rgba(":"rgb(")+l.join(",")+")"),r=Re(f,n,s,l,!0,"transparent",r,0,i)):h&&de.test(l)?r=Re(f,n,s,l,!0,null,r,0,i):(u=(o=parseFloat(s))||0===o?s.substr((o+"").length):"",""!==s&&"auto"!==s||(u="width"===n||"height"===n?(o=function(e,t,r){if("svg"===(e.nodeName+"").toLowerCase())return(r||d(e))[t]||0;if(e.getCTM&&Ve(e))return e.getBBox()[t]||0;var i=parseFloat("width"===t?e.offsetWidth:e.offsetHeight),n=Te[t],o=n.length;for(r=r||d(e);-1<--o;)i=(i-=parseFloat(z(e,"padding"+n[o],r,!0))||0)-(parseFloat(z(e,"border"+n[o]+"Width",r,!0))||0);return i}(e,n,k),"px"):"left"===n||"top"===n?(o=xe(e,n,k),"px"):(o="opacity"!==n?0:1,"")),""===(h=(c=h&&"="===l.charAt(1))?(a=parseInt(l.charAt(0)+"1",10),l=l.substr(2),a*=parseFloat(l),l.replace(ie,"")):(a=parseFloat(l),h?l.replace(ie,""):""))&&(h=n in W?W[n]:u),l=a||0===a?(c?a+o:a)+h:t[n],u===h||""===h&&"lineHeight"!==n||(a||0===a)&&o&&(o=w(e,n,o,u),"%"===h?(o/=w(e,n,100,"%")/100,!0!==t.strictUnits&&(s=o+"%")):"em"===h||"rem"===h||"vw"===h||"vh"===h?o/=w(e,n,1,h):"px"!==h&&(a=w(e,n,a,h),h="px"),c&&(a||0===a)&&(l=a+o+h)),c&&(a+=o),!o&&0!==o||!a&&0!==a?void 0!==f[n]&&(l||l+""!="NaN"&&null!=l)?(r=new U(f,n,a||o||0,0,r,-1,n,!1,0,s,l)).xs0="none"!==l||"display"!==n&&-1===n.indexOf("Style")?l:s:_("invalid "+n+" tween value: "+t[n]):(r=new U(f,n,o,a-o,r,0,n,!1!==q&&("px"===h||"zIndex"===n),0,s,l)).xs0=h)}i&&r&&!r.plugin&&(r.plugin=i)}return r},e.setRatio=function(e){var t,r,i,n=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;n;){if(t=n.c*e+n.s,n.r?t=n.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},f.ease=new f(.7,.7),p.config=f.config=function(e,t,r){return new f(e,t,r)},(p=(i=h("easing.SteppedEase",function(e,t){this._p1=1/(e=e||1),this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new _).constructor=i,p.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},p.config=i.config=function(e,t){return new i(e,t)},(p=(n=h("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new _).constructor=n,p.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},p.config=n.config=function(e,t,r){return new n(e,t,r)},(p=(o=h("easing.RoughEase",function(e){for(var t,r,i,n,o,a,s=(e=e||{}).taper||"none",l=[],u=0,h=0|(e.points||20),c=h,f=!1!==e.randomize,p=!0===e.clamp,d=e.template instanceof _?e.template:null,m="number"==typeof e.strength?.4*e.strength:.4;-1<--c;)t=f?Math.random():1/h*c,r=d?d.getRatio(t):t,i="none"===s?m:"out"===s?(n=1-t)*n*m:"in"===s?t*t*m:t<.5?(n=2*t)*n*.5*m:(n=2*(1-t))*n*.5*m,f?r+=Math.random()*i-.5*i:c%2?r+=.5*i:r-=.5*i,p&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},p.config=function(e){return new o(e)},o.ease=new o,t("Bounce",e("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),e("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),e("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),t("Circ",e("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),e("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),e("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),t("Elastic",(p=function(e,t,r){var i=h("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/l*(Math.asin(1/this._p1)||0),this._p2=l/this._p2},!0),e=i.prototype=new _;return e.constructor=i,e.getRatio=t,e.config=function(e,t){return new i(e,t)},i})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),p("ElasticIn",function(e){return-(this._p1*Math.pow(2,10*--e)*Math.sin((e-this._p3)*this._p2))},.3),p("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*--e)*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*--e)*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),t("Expo",e("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),e("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),e("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),t("Sine",e("SineOut",function(e){return Math.sin(e*u)}),e("SineIn",function(e){return 1-Math.cos(e*u)}),e("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),h("easing.EaseLookup",{find:function(e){return _.map[e]}},!0),c(a.SlowMo,"SlowMo","ease,"),c(o,"RoughEase","ease,"),c(i,"SteppedEase","ease,"),s},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),!function(m,f){"use strict";var p={},d=m.document,_=m.GreenSockGlobals=m.GreenSockGlobals||m,e=_[f];if(e)"undefined"!=typeof module&&module.exports&&(module.exports=e);else{var g,t,F,N=function(e){for(var t=e.split("."),r=_,i=0;i=t&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,r){if(g||O.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var i=this._totalDuration,n=this._timeline;if(io;)n=n._prev;return n?(e._next=n._next,n._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=n,this._recent=e,this._timeline&&this._uncache(!0),this},n._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},n.render=function(e,t,r){var i,n=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;n;)i=n._next,(n._active||e>=n._startTime&&!n._paused&&!n._gc)&&(n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)),n=i},n.rawTime=function(){return g||O.wake(),this._totalTime},x("TweenLite",function(e,t,r){if(s.call(this,t,r),this.render=P.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"==typeof e&&P.selector(e)||e;var i,n,o,r=e.jquery||e.length&&e!==m&&e[0]&&(e[0]===m||e[0].nodeType&&e[0].style&&!e.nodeType),a=this.vars.overwrite;if(this._overwrite=a=null==a?ee[P.defaultOverwrite]:"number"==typeof a?a>>0:ee[a],(r||e instanceof Array||e.push&&y(e))&&"number"!=typeof e[0])for(this._targets=o=z(e),this._propLookup=[],this._siblings=[],i=0;i=te){for(r in te=O.frame+(parseInt(P.autoSleep,10)||120),l){for(e=(t=l[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete l[r]}if((!(r=h._first)||r._paused)&&P.autoSleep&&!u._first&&1===O._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||O.sleep()}}},O.addEventListener("tick",s._updateRoot),function(e,t,r){var i,n,o=e._gsTweenID;if(l[o||(e._gsTweenID=o="t"+Q++)]||(l[o]={target:e,tweens:[]}),t&&((i=l[o].tweens)[n=i.length]=t,r))for(;-1<--n;)i[n]===t&&i.splice(n,1);return l[o].tweens}),re=function(e,t,r,i){var n,o,a=e.vars.onOverwrite;return a&&(n=a(e,t,r,i)),(a=P.onOverwrite)&&(o=a(e,t,r,i)),!1!==n&&!1!==o},ie=function(e,t,r,i,n){var o,a,s;if(1===i||4<=i){for(s=n.length,p=0;pu&&((f||!a._initted)&&u-a._startTime<=2e-8||(h[c++]=a)));for(p=c;-1<--p;)s=(a=h[p])._firstPT,2===i&&a._kill(r,e,t)&&(o=!0),(2!==i||!a._firstPT&&a._initted&&s)&&(2===i||re(a,t))&&a._enabled(!1,!1)&&(o=!0)}return o},ne=function(e,t,r){for(var i=e._timeline,n=i._timeScale,o=e._startTime;i._timeline;){if(o+=i._startTime,n*=i._timeScale,i._paused)return-100;i=i._timeline}return t<(o/=n)?o-t:r&&o===t||!e._initted&&o-t<2e-8?v:(o+=e.totalDuration()/e._timeScale/n)>t+v?0:o-t-v},L=(n._init=function(){var e,t,r,i,n,o,a=this.vars,s=this._overwrittenProps,l=this._duration,u=!!a.immediateRender,h=a.ease,c=this._startAt;if(a.startAt){for(i in c&&(c.render(-1,!0),c.kill()),n={},a.startAt)n[i]=a.startAt[i];if(n.data="isStart",n.overwrite=!1,n.immediateRender=!0,n.lazy=u&&!1!==a.lazy,n.startAt=n.delay=null,n.onUpdate=a.onUpdate,n.onUpdateParams=a.onUpdateParams,n.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=P.to(this.target||{},0,n),u)if(0s.pr;)i=i._next;(s._prev=i?i._prev:o)?s._prev._next=s:n=s,(s._next=i)?i._prev=s:o=s,s=a}s=t._firstPT=n}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},L.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===L.API&&(M[(new e[t])._propName]=e[t]);return!0},i.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,i=e.priority||0,n=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=x("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){L.call(this,r,i),this._overwriteProps=n||[]},!0===e.global),s=a.prototype=new L(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,L.activate([a]),a},o=m._gsQueue){for(a=0;a>0,c._cycle&&c._cycle===c._totalTime/x&&m<=e&&c._cycle--,c._time=c._totalTime-c._cycle*x,c._yoyo&&1&c._cycle&&(c._time=d-c._time),c._time>d?e=(c._time=d)+1e-4:c._time<0?c._time=e=0:e=c._time));if(c._hasPause&&!c._forcingPlayhead&&!t){if(f<(e=c._time)||c._repeat&&b!==c._cycle)for(i=c._first;i&&i._startTime<=e&&!l;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===c._rawPrevTime||(l=i),i=i._next;else for(i=c._last;i&&i._startTime>=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}!c._onUpdate||t||(O.length&&P(),c._callback("onUpdate")),!a||c._locked||c._gc||_!==c._startTime&&g===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(O.length&&P(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a))}else m!==c._totalTime&&c._onUpdate&&!t&&c._callback("onUpdate")},i.getActive=function(e,t,r){for(var i,n=[],o=this.getChildren(e||null==e,t||null==e,!!r),a=0,s=o.length,l=0;le)return t[i].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].timee._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},e.remove=function(e){var t;if(e instanceof c)return this._remove(e,!1),t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline,e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this;if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},e._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},e.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},e.insert=e.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},e.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},e.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},e.addPause=function(e,t,r,i){r=d.delayedCall(0,n,r,i||this);return r.vars.onComplete=r.vars.onReverseComplete=t,r.data="isPause",this._hasPause=!0,this.add(r,e)},e.removeLabel=function(e){return delete this._labels[e],this},e.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},e._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}!c._onUpdate||t||(b.length&&x(),c._callback("onUpdate")),!a||c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(b.length&&x(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a))}},e._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},e.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},e._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},e.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},e.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},e._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},e.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},e.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},e.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},e.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},e.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},e.rawTime=function(e){return e&&(this._paused||this._repeat&&0>10|55296,1023&i|56320)}function N(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}function z(){T()}var e,p,b,o,B,d,j,U,x,l,u,T,w,r,E,m,i,n,_,S="sizzle"+ +new Date,g=F.document,A=0,G=0,X=ce(),H=ce(),v=ce(),Y=function(e,t){return e===t&&(u=!0),0},W={}.hasOwnProperty,t=[],q=t.pop,V=t.push,k=t.push,K=t.slice,y=function(e,t){for(var r=0,i=e.length;r+~]|"+a+")"+a+"*"),re=new RegExp("="+a+"*([^\\]'\"]*?)"+a+"*\\]","g"),ie=new RegExp(Q),ne=new RegExp("^"+s+"$"),f={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),TAG:new RegExp("^("+s+"|[*])"),ATTR:new RegExp("^"+Z),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+a+"*(even|odd|(([+-]|)(\\d*)n|)"+a+"*(?:([+-]|)"+a+"*(\\d+)|))"+a+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+a+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+a+"*((?:-\\d)?\\d*)"+a+"*\\)|)(?=[^-]|$)","i")},oe=/^(?:input|select|textarea|button)$/i,ae=/^h\d$/i,h=/^[^{]+\{\s*\[native \w/,se=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,le=/[+~]/,P=new RegExp("\\\\([\\da-f]{1,6}"+a+"?|("+a+")|.)","ig"),ue=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,he=L(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{k.apply(t=K.call(g.childNodes),g.childNodes),t[g.childNodes.length].nodeType}catch(e){k={apply:t.length?function(e,t){V.apply(e,K.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}function R(e,t,r,i){var n,o,a,s,l,u,h,c=t&&t.ownerDocument,f=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==f&&9!==f&&11!==f)return r;if(!i&&((t?t.ownerDocument||t:g)!==w&&T(t),t=t||w,E)){if(11!==f&&(l=se.exec(e)))if(n=l[1]){if(9===f){if(!(a=t.getElementById(n)))return r;if(a.id===n)return r.push(a),r}else if(c&&(a=c.getElementById(n))&&_(t,a)&&a.id===n)return r.push(a),r}else{if(l[2])return k.apply(r,t.getElementsByTagName(e)),r;if((n=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return k.apply(r,t.getElementsByClassName(n)),r}if(p.qsa&&!v[e+" "]&&(!m||!m.test(e))){if(1!==f)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(ue,N):t.setAttribute("id",s=S),o=(u=d(e)).length;o--;)u[o]="#"+s+" "+D(u[o]);h=u.join(","),c=le.test(e)&&me(t.parentNode)||t}if(h)try{return k.apply(r,c.querySelectorAll(h)),r}catch(e){}finally{s===S&&t.removeAttribute("id")}}}return U(e.replace(O,"$1"),t,r,i)}function ce(){var r=[];function i(e,t){return r.push(e+" ")>b.cacheLength&&delete i[r.shift()],i[e+" "]=t}return i}function C(e){return e[S]=!0,e}function M(e){var t=w.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function fe(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function pe(e,t){var r=t&&e,i=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function de(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&he(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function I(a){return C(function(o){return o=+o,C(function(e,t){for(var r,i=a([],e.length,o),n=i.length;n--;)e[r=i[n]]&&(e[r]=!(t[r]=e[r]))})})}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in p=R.support={},B=R.isXML=function(e){e=e&&(e.ownerDocument||e).documentElement;return!!e&&"HTML"!==e.nodeName},T=R.setDocument=function(e){var e=e?e.ownerDocument||e:g;return e!==w&&9===e.nodeType&&e.documentElement&&(r=(w=e).documentElement,E=!B(w),g!==w&&(e=w.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",z,!1):e.attachEvent&&e.attachEvent("onunload",z)),p.attributes=M(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=M(function(e){return e.appendChild(w.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=h.test(w.getElementsByClassName),p.getById=M(function(e){return r.appendChild(e).id=S,!w.getElementsByName||!w.getElementsByName(S).length}),p.getById?(b.filter.ID=function(e){var t=e.replace(P,c);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&E)return(t=t.getElementById(e))?[t]:[]}):(b.filter.ID=function(e){var t=e.replace(P,c);return function(e){e=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&E){var r,i,n,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(n=t.getElementsByName(e),i=0;o=n[i++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=p.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):p.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,i=[],n=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;r=o[n++];)1===r.nodeType&&i.push(r);return i},b.find.CLASS=p.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&E)return t.getElementsByClassName(e)},i=[],m=[],(p.qsa=h.test(w.querySelectorAll))&&(M(function(e){r.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+a+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+a+"*(?:value|"+J+")"),e.querySelectorAll("[id~="+S+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||m.push(".#.+[+~]")}),M(function(e){e.innerHTML="";var t=w.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+a+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(p.matchesSelector=h.test(n=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.oMatchesSelector||r.msMatchesSelector))&&M(function(e){p.disconnectedMatch=n.call(e,"*"),n.call(e,"[s!='']:x"),i.push("!=",Q)}),m=m.length&&new RegExp(m.join("|")),i=i.length&&new RegExp(i.join("|")),e=h.test(r.compareDocumentPosition),_=e||h.test(r.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,t=t&&t.parentNode;return e===t||!(!t||1!==t.nodeType||!(r.contains?r.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Y=e?function(e,t){var r;return e===t?(u=!0,0):(r=!e.compareDocumentPosition-!t.compareDocumentPosition)||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===r?e===w||e.ownerDocument===g&&_(g,e)?-1:t===w||t.ownerDocument===g&&_(g,t)?1:l?y(l,e)-y(l,t):0:4&r?-1:1)}:function(e,t){if(e===t)return u=!0,0;var r,i=0,n=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!n||!o)return e===w?-1:t===w?1:n?-1:o?1:l?y(l,e)-y(l,t):0;if(n===o)return pe(e,t);for(r=e;r=r.parentNode;)a.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;a[i]===s[i];)i++;return i?pe(a[i],s[i]):a[i]===g?-1:s[i]===g?1:0}),w},R.matches=function(e,t){return R(e,null,null,t)},R.matchesSelector=function(e,t){if((e.ownerDocument||e)!==w&&T(e),t=t.replace(re,"='$1']"),p.matchesSelector&&E&&!v[t+" "]&&(!i||!i.test(t))&&(!m||!m.test(t)))try{var r=n.call(e,t);if(r||p.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(P,c),e[3]=(e[3]||e[4]||e[5]||"").replace(P,c),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||R.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&R.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return f.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&ie.test(r)&&(t=d(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(P,c).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=X[e+" "];return t||(t=new RegExp("(^|"+a+")"+e+"("+a+"|$)"))&&X(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,r,i){return function(e){e=R.attr(e,t);return null==e?"!="===r:!r||(e+="","="===r?e===i:"!="===r?e!==i:"^="===r?i&&0===e.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function $(e,r,i){return v(r)?w.grep(e,function(e,t){return!!r.call(e,t,e)!==i}):r.nodeType?w.grep(e,function(e){return e===r!==i}):"string"!=typeof r?w.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/,re=((w.fn.init=function(e,t,r){if(e){if(r=r||ee,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==r.ready?r.ready(e):e(w):w.makeArray(e,this);if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:te.exec(e))||!i[1]&&t)return(!t||t.jquery?t||r:this.constructor(t)).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:T,!0)),Q.test(i[1])&&w.isPlainObject(t))for(var i in t)v(this[i])?this[i](t[i]):this.attr(i,t[i])}else(r=T.getElementById(i[2]))&&(this[0]=r,this.length=1)}return this}).prototype=w.fn,ee=w(T),/^(?:parents|prev(?:Until|All))/),ie={children:!0,contents:!0,next:!0,prev:!0};function ne(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}w.fn.extend({has:function(e){var t=w(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,we=/^$|^module$|\/(?:java|ecma)script/i,S={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function A(e,t){var r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&l(e,t)?w.merge([e],r):r}function Ee(e,t){for(var r=0,i=e.length;rx",_.noCloneChecked=!!C.cloneNode(!0).lastChild.defaultValue;var ke=T.documentElement,Oe=/^key/,Pe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Re=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function k(){return!1}function Me(){try{return T.activeElement}catch(e){}}function Ie(e,t,r,i,n,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof r&&(i=i||r,r=void 0),t)Ie(e,s,r,i,t[s],o);return e}if(null==i&&null==n?(n=r,i=r=void 0):null==n&&("string"==typeof r?(n=i,i=void 0):(n=i,i=r,r=void 0)),!1===n)n=k;else if(!n)return e;return 1===o&&(a=n,(n=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,n,i,r)})}w.event={global:{},add:function(t,e,r,i,n){var o,a,s,l,u,h,c,f,p,d=g.get(t);if(d)for(r.handler&&(r=(o=r).handler,n=o.selector),n&&w.find.matchesSelector(ke,n),r.guid||(r.guid=w.guid++),(s=d.events)||(s=d.events={}),(a=d.handle)||(a=d.handle=function(e){return void 0!==w&&w.event.triggered!==e.type?w.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(E)||[""]).length;l--;)c=p=(f=Re.exec(e[l])||[])[1],f=(f[2]||"").split(".").sort(),c&&(u=w.event.special[c]||{},c=(n?u.delegateType:u.bindType)||c,u=w.event.special[c]||{},p=w.extend({type:c,origType:p,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&w.expr.match.needsContext.test(n),namespace:f.join(".")},o),(h=s[c])||((h=s[c]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(t,i,f,a)||t.addEventListener&&t.addEventListener(c,a)),u.add&&(u.add.call(t,p),p.handler.guid||(p.handler.guid=r.guid)),n?h.splice(h.delegateCount++,0,p):h.push(p),w.event.global[c]=!0)},remove:function(e,t,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,_=g.hasData(e)&&g.get(e);if(_&&(l=_.events)){for(u=(t=(t||"").match(E)||[""]).length;u--;)if(p=m=(s=Re.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),p){for(c=w.event.special[p]||{},f=l[p=(i?c.delegateType:c.bindType)||p]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)h=f[o],!n&&m!==h.origType||r&&r.guid!==h.guid||s&&!s.test(h.namespace)||i&&i!==h.selector&&("**"!==i||!h.selector)||(f.splice(o,1),h.selector&&f.delegateCount--,c.remove&&c.remove.call(e,h));a&&!f.length&&(c.teardown&&!1!==c.teardown.call(e,d,_.handle)||w.removeEvent(e,p,_.handle),delete l[p])}else for(p in l)w.event.remove(e,p+t[u],r,i,!0);w.isEmptyObject(l)&&g.remove(e,"handle events")}},dispatch:function(e){var t,r,i,n,o,a=w.event.fix(e),s=new Array(arguments.length),e=(g.get(this,"events")||{})[a.type]||[],l=w.event.special[a.type]||{};for(s[0]=a,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Le=/\s*$/g;function ze(e,t){return l(e,"table")&&l(11!==t.nodeType?t:t.firstChild,"tr")&&w(e).children("tbody")[0]||e}function Be(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function je(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ue(e,t){var r,i,n,o,a,s;if(1===t.nodeType){if(g.hasData(e)&&(o=g.access(e),a=g.set(t,o),s=o.events))for(n in delete a.handle,a.events={},s)for(r=0,i=s[n].length;r")},clone:function(e,t,r){var i,n,o,a,s,l,u,h=e.cloneNode(!0),c=w.contains(e.ownerDocument,e);if(!(_.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=A(h),i=0,n=(o=A(e)).length;i").prop({charset:r.scriptCharset,src:r.url}).on("load error",n=function(e){i.remove(),n=null,e&&t("error"===e.type?404:200,e.type)}),T.head.appendChild(i[0])},abort:function(){n&&n()}}}),[]),qt=/(=)\?(?=&|$)|\?\?/,Vt=(w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Wt.pop()||w.expando+"_"+St++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(e,t,r){var i,n,o,a=!1!==e.jsonp&&(qt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&qt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(qt,"$1"+i):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||w.error(i+" was not called"),o[0]},e.dataTypes[0]="json",n=x[i],x[i]=function(){o=arguments},r.always(function(){void 0===n?w(x).removeProp(i):x[i]=n,e[i]&&(e.jsonpCallback=t.jsonpCallback,Wt.push(i)),o&&v(n)&&n(o[0]),o=n=void 0}),"script"}),_.createHTMLDocument=((e=T.implementation.createHTMLDocument("").body).innerHTML="

",2===e.childNodes.length),w.parseHTML=function(e,t,r){var i;return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(_.createHTMLDocument?((i=(t=T.implementation.createHTMLDocument("")).createElement("base")).href=T.location.href,t.head.appendChild(i)):t=T),i=!r&&[],(r=Q.exec(e))?[t.createElement(r[1])]:(r=Ae([e],t,i),i&&i.length&&w(i).remove(),w.merge([],r.childNodes)))},w.fn.load=function(e,t,r){var i,n,o,a=this,s=e.indexOf(" ");return-1").append(w.parseHTML(e)).find(i):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(t){return w.grep(w.timers,function(e){return t===e.elem}).length},w.offset={setOffset:function(e,t,r){var i,n,o,a,s=w.css(e,"position"),l=w(e),u={};"static"===s&&(e.style.position="relative"),o=l.offset(),i=w.css(e,"top"),a=w.css(e,"left"),s=("absolute"===s||"fixed"===s)&&-1<(i+a).indexOf("auto")?(n=(s=l.position()).top,s.left):(n=parseFloat(i)||0,parseFloat(a)||0),null!=(t=v(t)?t.call(e,r,w.extend({},o)):t).top&&(u.top=t.top-o.top+n),null!=t.left&&(u.left=t.left-o.left+s),"using"in t?t.using.call(e,u):l.css(u)}},w.fn.extend({offset:function(t){var e,r;return arguments.length?void 0===t?this:this.each(function(e){w.offset.setOffset(this,t,e)}):(r=this[0])?r.getClientRects().length?(e=r.getBoundingClientRect(),r=r.ownerDocument.defaultView,{top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,i=this[0],n={top:0,left:0};if("fixed"===w.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),r=i.ownerDocument,e=i.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===w.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((n=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),n.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-w.css(i,"marginTop",!0),left:t.left-n.left-w.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===w.css(e,"position");)e=e.offsetParent;return e||ke})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var o="pageYOffset"===n;w.fn[t]=function(e){return c(this,function(e,t,r){var i;if(m(e)?i=e:9===e.nodeType&&(i=e.defaultView),void 0===r)return i?i[n]:e[t];i?i.scrollTo(o?i.pageXOffset:r,o?r:i.pageYOffset):e[t]=r},t,e,arguments.length)}}),w.each(["top","left"],function(e,r){w.cssHooks[r]=$e(_.pixelPosition,function(e,t){if(t)return t=P(e,r),Je.test(t)?w(e).position()[r]+"px":t})}),w.each({Height:"height",Width:"width"},function(a,s){w.each({padding:"inner"+a,content:s,"":"outer"+a},function(i,o){w.fn[o]=function(e,t){var r=arguments.length&&(i||"boolean"!=typeof e),n=i||(!0===e||!0===t?"margin":"border");return c(this,function(e,t,r){var i;return m(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(i=e.documentElement,Math.max(e.body["scroll"+a],i["scroll"+a],e.body["offset"+a],i["offset"+a],i["client"+a])):void 0===r?w.css(e,t,n):w.style(e,t,r,n)},s,r?e:void 0,r)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,r){w.fn[r]=function(e,t){return 0>>0))*i)>>>0,i+=4294967296*(r-=i)}return 2.3283064365386963e-10*(i>>>0)});t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1)}function o(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function r(e,t){var r=new n(e),e=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,e&&("object"==typeof e&&o(e,r),i.state=function(){return o(r,{})}),i}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.alea=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],16:[function(e,t,r){!function(e,t){function n(e){var n=this,t="";n.next=function(){var e=(e=n.b)<<25^e>>>7^(t=n.c),t=t-(r=n.d)|0,r=r<<24^r>>>8^(i=n.a),i=i-e|0;return n.b=e=e<<20^e>>>12^t,n.c=t=t-r|0,n.d=r<<16^t>>>16^i,n.a=i-e|0},n.a=0,n.b=0,n.c=-1640531527,n.d=1367130551,e===Math.floor(e)?(n.a=e/4294967296|0,n.b=0|e):t+=e;for(var r=0;r>>0)/4294967296}var i=new n(e),e=t&&t.state;return r.double=function(){do{var e=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=i.next,r.quick=r,e&&("object"==typeof e&&o(e,i),r.state=function(){return o(i,{})}),r}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.tychei=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],17:[function(e,t,r){!function(e,t){function n(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var i=0;i>>0)/4294967296}var i=new n(e),e=t&&t.state;return r.double=function(){do{var e=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=i.next,r.quick=r,e&&("object"==typeof e&&o(e,i),r.state=function(){return o(i,{})}),r}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.xor128=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],18:[function(e,t,r){!function(e,t){function n(e){var o=this;o.next=function(){var e,t,r=o.w,i=o.X,n=o.i;return o.w=r=r+1640531527|0,t=i[n+34&127],e=i[n=n+1&127],t=i[n]=(t^=t<<13)^t>>>15^((e^=e<<17)^e>>>12),o.i=n,t+(r^r>>>16)|0};var t,r,i,n,a,s=o,l=e,u=[],h=128;for(l===(0|l)?(r=l,l=null):(l+="\0",r=0,h=Math.max(h,l.length)),i=0,n=-32;n>>15)^r<<4)^r>>>13,0<=n&&(i=0==(t=u[127&n]^=r+(a=a+1640531527|0))?i+1:0);for(128<=i&&(u[127&(l&&l.length||0)]=-1),i=127,n=512;0>>15)^(t=(t^=t<<17)^t>>>12);s.w=a,s.X=u,s.i=i}function o(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function r(e,t){function r(){return(i.next()>>>0)/4294967296}var i=new n(e=null==e?+new Date:e),e=t&&t.state;return r.double=function(){do{var e=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=i.next,r.quick=r,e&&(e.X&&o(e,i),r.state=function(){return o(i,{})}),r}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.xor4096=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],19:[function(e,t,r){!function(e,t){function n(e){var n=this;n.next=function(){var e=n.x,t=n.i,r=e[t],i=(r^=r>>>7)^r<<24;return i=(i^=(r=e[t+1&7])^r>>>10)^((r=e[t+3&7])^r>>>3)^((r=e[t+4&7])^r<<7),r=e[t+7&7],e[t]=i^=(r^=r<<13)^r<<9,n.i=t+1&7,i};var t,r=n,i=e,o=[];if(i===(0|i))o[0]=i;else for(i=""+i,t=0;t>>0)/4294967296}var i=new n(e=null==e?+new Date:e),e=t&&t.state;return r.double=function(){do{var e=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=i.next,r.quick=r,e&&(e.x&&o(e,i),r.state=function(){return o(i,{})}),r}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.xorshift7=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],20:[function(e,t,r){!function(e,t){function n(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,e===((t.v=0)|e)?t.x=e:r+=e;for(var i=0;i>>4),t.next()}function o(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function r(e,t){function r(){return(i.next()>>>0)/4294967296}var i=new n(e),e=t&&t.state;return r.double=function(){do{var e=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},r.int32=i.next,r.quick=r,e&&("object"==typeof e&&o(e,i),r.state=function(){return o(i,{})}),r}e&&e.exports?e.exports=r:t&&t.amd?t(function(){return r}):this.xorwow=r}("object"==typeof t&&t,"function"==typeof define&&define)},{}],21:[function(t,r,e){!function(a,s){var l,u=this,h=256,c=6,f="random",p=s.pow(h,c),d=s.pow(2,52),m=2*d,_=h-1;function e(e,t,r){function i(){for(var e=o.g(c),t=p,r=0;e>>=1;return(e+r)/t}var n=[],e=y(function e(t,r){var i,n=[],o=typeof t;if(r&&"object"==o)for(i in t)try{n.push(e(t[i],r-1))}catch(e){}return n.length?n:"string"==o?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,b(a)]:null==e?function(){try{return l&&(t=l.randomBytes)?t=t(h):(t=new Uint8Array(h),(u.crypto||u.msCrypto).getRandomValues(t)),b(t)}catch(e){var t=u.navigator,t=t&&t.plugins;return[+new Date,u,t,u.screen,b(a)]}}():e,3),n),o=new g(n);return i.int32=function(){return 0|o.g(4)},i.quick=function(){return o.g(4)/4294967296},i.double=i,y(b(o.S),a),(t.pass||r||function(e,t,r,i){return i&&(i.S&&v(i,o),e.state=function(){return v(o,{})}),r?(s[f]=e,t):e})(i,e,"global"in t?t.global:this==s,t.state)}function g(e){var t,r=e.length,a=this,i=0,n=a.i=a.j=0,o=a.S=[];for(r||(e=[r++]);iMath.PI?l-e:e}function p(e){return e-l*Math.floor(e/l)}t.exports={UP:o,DOWN:a,LEFT:s,RIGHT:0,NORTH:o,SOUTH:a,WEST:s,EAST:0,PI_2:l,PI_QUARTER:u,PI_HALF:h,toDegrees:function(e){return e*i},toRadians:function(e){return e*n},isAngleBetween:function(e,t,r){var i;return((r-t)%l+l)%l>=Math.PI&&(i=t,t=r,r=i),t<=r?t<=e&&e<=r:t<=e||e<=r},differenceAnglesSign:c,differenceAngles:f,shortestAngle:function(e,t){return f(t,e)*c(t,e)+e},normalize:p,angleTwoPoints:function(){return 4===arguments.length?Math.atan2(arguments[3]-arguments[1],arguments[2]-arguments[0]):Math.atan2(arguments[1].y-arguments[0].y,arguments[1].x-arguments[0].x)},distanceTwoPoints:function(){return 2===arguments.length?Math.sqrt(Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2)):Math.sqrt(Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2))},distanceTwoPointsSquared:function(){return 2===arguments.length?Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2):Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2)},closestAngle:function(e){var t=f(e,s),r=f(e,0),i=f(e,o),e=f(e,a);return t<=r&&t<=i&&t<=e?s:r<=i&&r<=e?0:i<=e?o:a},equals:function(e,t,r){return r?f(e,t)>16)+e*(r>>16)<<16|i*(t>>8&255)+e*(r>>8&255)<<8|i*(255&t)+e*(255&r)},random:function(e,t){function r(){return a.range(e,t)}var i=a.pick([{r:1,g:1,b:1},{r:1,g:1,b:0},{r:1,g:0,b:1},{r:0,g:1,b:1},{r:1,g:0,b:0},{r:0,g:1,b:0},{r:0,g:0,b:1}]);return e=e||0,t=t||255,this.rgbToHex(i.r?r():0,i.g?r():0,i.b?r():0)},randomHSL:function(e,t,r,i,n,o){return e={h:a.range(e,t),s:a.range(r,i,!0),l:a.range(n,o,!0)},this.hslToHex(e)},randomGoldenRatioHSL:function(e,t,r){for(var i=a.get(1,!0),n=[],o=0;o=this.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.time),this.parent.dirty=!0),this.toY&&((t=this.toY).time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.time),this.parent.dirty=!0))}},{key:"calcUnderflowX",value:function(){var e=void 0;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}},{key:"calcUnderflowY",value:function(){var e=void 0;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}},{key:"bounce",value:function(){var e,t,r,i;this.paused||(e=void 0,(i=this.parent.plugins.decelerate)&&(i.x||i.y)&&(i.x&&i.percentChangeX===i.friction||i.y&&i.percentChangeY===i.friction)&&(((e=this.parent.OOB()).left&&this.left||e.right&&this.right)&&(i.percentChangeX=this.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(i.percentChangeY=this.friction)),t=this.parent.plugins.drag||{},r=this.parent.plugins.pinch||{},i=i||{},t.active||r.active||this.toX&&this.toY||i.x&&i.y||(t=(e=e||this.parent.OOB()).cornerPoint,this.toX||i.x||(r=null,e.left&&this.left?r=this.parent.screenWorldWidththis.maxWidth&&(this.parent.fitWidth(this.maxWidth),e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})),this.minHeight&&tthis.maxHeight&&(this.parent.fitHeight(this.maxHeight),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})))}}]),r}()},{"./plugin":9}],3:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r(!0===this.right?this.parent.worldWidth:this.right)&&(this.parent.x=-(!0===this.right?this.parent.worldWidth:this.right)*this.parent.scale.x+this.parent.screenWidth,t=!(e.x=0));t&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-x"})}if(null!==this.top||null!==this.bottom){var r=void 0;if(this.parent.screenWorldHeight(!0===this.bottom?this.parent.worldHeight:this.bottom)&&(this.parent.y=-(!0===this.bottom?this.parent.worldHeight:this.bottom)*this.parent.scale.y+this.parent.screenHeight,r=!(e.y=0));r&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-y"})}}}}]),r}()},{"./plugin":9,"./utils":12}],4:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r=e-100){var s=e-a.time;this.x=(this.parent.x-a.x)/s,this.y=(this.parent.y-a.y)/s,this.percentChangeX=this.percentChangeY=this.friction;break}}}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}}}},{key:"activate",value:function(e){void 0!==(e=e||{}).x&&(this.x=e.x,this.percentChangeX=this.friction),void 0!==e.y&&(this.y=e.y,this.percentChangeY=this.friction)}},{key:"update",value:function(e){var t;this.paused||(t=void 0,this.x&&(this.parent.x+=this.x*e,this.x*=this.percentChangeX,Math.abs(this.x)this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if("x"!==this.clampWheel)if(this.parent.screenWorldHeightthis.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}},{key:"active",get:function(){return this.moved}}]),r}()},{"./plugin":9,"./utils":12}],6:[function(e,t,r){"use strict";var n=function(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e};function i(e,t){for(var r=0;rthis.radius))return;var a=Math.atan2(this.target.y-i.y,this.target.x-i.x),n=this.target.x-Math.cos(a)*this.radius,o=this.target.y-Math.sin(a)*this.radius}this.speed?(a=n-i.x,e=o-i.y,(a||e)&&(t=Math.atan2(o-i.y,n-i.x),r=Math.cos(t)*this.speed,t=Math.sin(t)*this.speed,a=Math.abs(r)>Math.abs(a)?n:i.x+r,r=Math.abs(t)>Math.abs(e)?o:i.y+t,this.parent.moveCenter(a,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"}))):(this.parent.moveCenter(n,o),this.parent.emit("moved",{viewport:this.parent,type:"follow"}))}}}]),i}()},{"./plugin":9}],7:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r=this.radiusSquared?(r=Math.atan2(r.y-e,r.x-t),this.linear?(this.horizontal=Math.round(Math.cos(r))*this.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(r))*this.speed*this.reverse*.06):(this.horizontal=Math.cos(r)*this.speed*this.reverse*.06,this.vertical=Math.sin(r)*this.speed*this.reverse*.06)):(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0)):(o.exists(this.left)&&tthis.right?this.horizontal=-1*this.reverse*this.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),o.exists(this.top)&&ethis.bottom?this.vertical=-1*this.reverse*this.speed*.06:(this.decelerateVertical(),this.vertical=0)))}},{key:"decelerateHorizontal",value:function(){var e=this.parent.plugins.decelerate;this.horizontal&&e&&!this.noDecelerate&&e.activate({x:this.horizontal*this.speed*this.reverse/(1e3/60)})}},{key:"decelerateVertical",value:function(){var e=this.parent.plugins.decelerate;this.vertical&&e&&!this.noDecelerate&&e.activate({y:this.vertical*this.speed*this.reverse/(1e3/60)})}},{key:"up",value:function(){this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null}},{key:"update",value:function(){var e;this.paused||(this.horizontal||this.vertical)&&(e=this.parent.center,this.horizontal&&(e.x+=this.horizontal*this.speed),this.vertical&&(e.y+=this.vertical*this.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"}))}}]),r}()},{"./plugin":9,"./utils":12}],8:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r=this.time?(this.parent.scale.set(this.x_scale,this.y_scale),this.removeOnComplete&&this.parent.removePlugin("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null):(e=this.snapping,this.parent.scale.x=this.ease(e.time,e.startX,e.deltaX,this.time),this.parent.scale.y=this.ease(e.time,e.startY,e.deltaY,this.time)),(r=this.parent.plugins["clamp-zoom"])&&r.clamp(),this.noMove||(this.center?this.parent.moveCenter(this.center):this.parent.moveCenter(t))):this.parent.scale.x===this.x_scale&&this.parent.scale.y===this.y_scale||this.createSnapping())}},{key:"resume",value:function(){this.snapping=null,o(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"resume",this).call(this)}}]),i}()},{"./plugin":9,"./utils":12}],11:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;rthis.time?(e=!0,t=this.startX+this.deltaX,this.startY+this.deltaY):(i=this.ease(i.time,0,1,this.time),t=this.startX+this.deltaX*i,this.startY+this.deltaY*i),this.topLeft?this.parent.moveCorner(t,r):this.parent.moveCenter(t,r),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),e&&(this.removeOnComplete&&this.parent.removePlugin("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)):(i=this.topLeft?this.parent.corner:this.parent.center).x===this.x&&i.y===this.y||this.snapStart())}}]),n}()},{"./plugin":9,"./utils":12}],12:[function(e,t,r){"use strict";var i=e("penner");function n(e){return null!=e}t.exports={exists:n,defaults:function(e,t){return null!=e?e:t},ease:function(e,t){return n(e)?"function"==typeof e?e:"string"==typeof e?i[e]:void 0:i[t]}}},{penner:15}],13:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r=this.threshold}},{key:"move",value:function(e){if(!this.pause){var t=!0,r=!1,i=void 0;try{for(var n,o=this.pluginsList[Symbol.iterator]();!(t=(n=o.next()).done);t=!0)n.value.move(e)}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}this.clickedAvailable&&(r=e.data.global.x-this.last.x,i=e.data.global.y-this.last.y,(this.checkThreshold(r)||this.checkThreshold(i))&&(this.clickedAvailable=!1))}}},{key:"up",value:function(e){if(!this.pause){if(e.data.originalEvent instanceof MouseEvent&&0==e.data.originalEvent.button&&(this.leftDown=!1),"mouse"!==e.data.pointerType)for(var t=0;tthis._worldWidth,e.top=this.top<0,e.bottom=this.bottom>this._worldHeight,e.cornerPoint={x:this._worldWidth*this.scale.x-this._screenWidth,y:this._worldHeight*this.scale.y-this._screenHeight},e}},{key:"countDownPointers",value:function(){return(this.leftDown?1:0)+this.touches.length}},{key:"getTouchPointers",value:function(){var e,t=[],r=this.trackedPointers;for(e in r){var i=r[e];-1!==this.touches.indexOf(i.pointerId)&&t.push(i)}return t}},{key:"getPointers",value:function(){var e,t=[],r=this.trackedPointers;for(e in r)t.push(r[e]);return t}},{key:"_reset",value:function(){this.plugins.bounce&&(this.plugins.bounce.reset(),this.plugins.bounce.bounce()),this.plugins.decelerate&&this.plugins.decelerate.reset(),this.plugins.snap&&this.plugins.snap.reset(),this.plugins.clamp&&this.plugins.clamp.update(),this.plugins["clamp-zoom"]&&this.plugins["clamp-zoom"].clamp(),this.dirty=!0}},{key:"removePlugin",value:function(e){this.plugins[e]&&(this.plugins[e]=null,this.emit(e+"-remove"),this.pluginsSort())}},{key:"pausePlugin",value:function(e){this.plugins[e]&&this.plugins[e].pause()}},{key:"resumePlugin",value:function(e){this.plugins[e]&&this.plugins[e].resume()}},{key:"pluginsSort",value:function(){var e=!0,t=!(this.pluginsList=[]),r=void 0;try{for(var i,n=v[Symbol.iterator]();!(e=(i=n.next()).done);e=!0){var o=i.value;this.plugins[o]&&this.pluginsList.push(this.plugins[o])}}catch(e){t=!0,r=e}finally{try{!e&&n.return&&n.return()}finally{if(t)throw r}}}},{key:"drag",value:function(e){return this.plugins.drag=new s(this,e),this.pluginsSort(),this}},{key:"clamp",value:function(e){return this.plugins.clamp=new u(this,e),this.pluginsSort(),this}},{key:"decelerate",value:function(e){return this.plugins.decelerate=new c(this,e),this.pluginsSort(),this}},{key:"bounce",value:function(e){return this.plugins.bounce=new f(this,e),this.pluginsSort(),this}},{key:"pinch",value:function(e){return this.plugins.pinch=new l(this,e),this.pluginsSort(),this}},{key:"snap",value:function(e,t,r){return this.plugins.snap=new p(this,e,t,r),this.pluginsSort(),this}},{key:"follow",value:function(e,t){return this.plugins.follow=new m(this,e,t),this.pluginsSort(),this}},{key:"wheel",value:function(e){return this.plugins.wheel=new _(this,e),this.pluginsSort(),this}},{key:"clampZoom",value:function(e){return this.plugins["clamp-zoom"]=new h(this,e),this.pluginsSort(),this}},{key:"mouseEdges",value:function(e){return this.plugins["mouse-edges"]=new g(this,e),this.pluginsSort(),this}},{key:"screenWidth",get:function(){return this._screenWidth},set:function(e){this._screenWidth=e}},{key:"screenHeight",get:function(){return this._screenHeight},set:function(e){this._screenHeight=e}},{key:"worldWidth",get:function(){return this._worldWidth||this.width},set:function(e){this._worldWidth=e,this.resizePlugins()}},{key:"worldHeight",get:function(){return this._worldHeight||this.height},set:function(e){this._worldHeight=e,this.resizePlugins()}},{key:"worldScreenWidth",get:function(){return this._screenWidth/this.scale.x}},{key:"worldScreenHeight",get:function(){return this._screenHeight/this.scale.y}},{key:"screenWorldWidth",get:function(){return this._worldWidth*this.scale.x}},{key:"screenWorldHeight",get:function(){return this._worldHeight*this.scale.y}},{key:"center",get:function(){return{x:this.worldScreenWidth/2-this.x/this.scale.x,y:this.worldScreenHeight/2-this.y/this.scale.y}},set:function(e){this.moveCenter(e)}},{key:"corner",get:function(){return{x:-this.x/this.scale.x,y:-this.y/this.scale.y}},set:function(e){this.moveCorner(e)}},{key:"right",get:function(){return-this.x/this.scale.x+this.worldScreenWidth},set:function(e){this.x=-e*this.scale.x+this.screenWidth,this._reset()}},{key:"left",get:function(){return-this.x/this.scale.x},set:function(e){this.x=-e*this.scale.x,this._reset()}},{key:"top",get:function(){return-this.y/this.scale.y},set:function(e){this.y=-e*this.scale.y,this._reset()}},{key:"bottom",get:function(){return-this.y/this.scale.y+this.worldScreenHeight},set:function(e){this.y=-e*this.scale.y+this.screenHeight,this._reset()}},{key:"dirty",get:function(){return this._dirty},set:function(e){this._dirty=e}},{key:"forceHitArea",get:function(){return this._forceHitArea},set:function(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=!1,this.hitArea=new PIXI.Rectangle(0,0,this.worldWidth,this.worldHeight))}},{key:"pause",get:function(){return this._pause},set:function(e){(this._pause=e)&&(this.touches=[],this.leftDown=!1)}}]),r}(PIXI.Container);PIXI.extras.Viewport=e,t.exports=e},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(e,t,r){"use strict";var i=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;rt&&(r[i]=this.hyphenate(r[i]).join("­"));return r.join("")},t.prototype.hyphenate=function(e){var t,r,i,n,o,a,s,l,u,h=[],c=[],f=e.toLowerCase(),p=Math.max,d=this.trie,m=[""];if(this.exceptions.hasOwnProperty(f))return e.match(this.exceptions[f]).slice(1);if(-1!==e.indexOf("­"))return[e];for(t=(e="_"+e+"_").toLowerCase().split(""),r=e.split(""),s=t.length,i=0;ithis.leftMin&&it[e]&&(r=t[e]),st[e+1]&&(n=t[e+1]),oR[e]&&(l=O[t],O[t]=O[e],O[e]=l,l=R[t],R[t]=R[e],R[e]=l)}t[0]=O[0].x,t[1]=O[0].y,t[2]=O[1].x,t[3]=O[1].y,t[4]=O[2].x,t[5]=O[2].y,t[6]=O[3].x,t[7]=O[3].y,(O[3].x-O[2].x)*(O[1].y-O[2].y)-(O[1].x-O[2].x)*(O[3].y-O[2].y)<0&&(t[4]=O[3].x,t[5]=O[3].y)}}}const ve=new d.Matrix,M=new d.Rectangle,I=new d.Point;class ye extends C{constructor(...e){super(...e),ye.prototype.__init.call(this)}__init(){this.distortion=new d.Point}clear(){this.distortion.set(0,0)}apply(e,t){t=t||new d.Point;var i=this.distortion,r=e.x*e.y;return t.x=e.x+i.x*r,t.y=e.y+i.y*r,t}applyInverse(e,t){t=t||new d.Point;var i=e.x,e=e.y,r=this.distortion.x,n=this.distortion.y;if(0===r)t.x=i,t.y=e/(1+n*i);else if(0===n)t.y=e,t.x=i/(1+r*e);else{var e=.5*(e*r-i*n+1)/n,s=e*e+i/n;if(s<=1e-5)return t.set(NaN,NaN),t;t.x=0>0,0!==h._cycle&&h._cycle===h._totalTime/c&&d<=e&&h._cycle--,h._time=h._totalTime-h._cycle*c,h._yoyo&&0!=(1&h._cycle)&&(h._time=m-h._time,(u=h._yoyoEase||h.vars.yoyoEase)&&(h._yoyoEase||(!0!==u||h._initted?h._yoyoEase=u=!0===u?h._ease:u instanceof Ease?u:Ease.map[u]:(u=h.vars.ease,h._yoyoEase=u=u?u instanceof Ease?u:"function"==typeof u?new Ease(u,h.vars.easeParams):Ease.map[u]||g.defaultEase:g.defaultEase)),h.ratio=u?1-u.getRatio((m-h._time)/m):0)),h._time>m?h._time=m:h._time<0&&(h._time=0)),h._easeType&&!u?(c=h._time/m,(1===(o=h._easeType)||3===o&&.5<=c)&&(c=1-c),3===o&&(c*=2),1===(a=h._easePower)?c*=c:2===a?c*=c*c:3===a?c*=c*c*c:4===a&&(c*=c*c*c*c),h.ratio=1===o?1-c:2===o?c:h._time/m<.5?c/2:1-c/2):u||(h.ratio=h._ease.getRatio(h._time/m))),p!==h._time||i||f!==h._cycle){if(!h._initted){if(h._init(),!h._initted||h._gc)return;if(!i&&h._firstPT&&(!1!==h.vars.lazy&&h._duration||h.vars.lazy&&!h._duration))return h._time=p,h._totalTime=d,h._rawPrevTime=_,h._cycle=f,x.lazyTweens.push(h),void(h._lazy=[e,t]);!h._time||r||u?r&&this._ease._calcEnd&&!u&&(h.ratio=h._ease.getRatio(0===h._time?0:1)):h.ratio=h._ease.getRatio(h._time/m)}for(!1!==h._lazy&&(h._lazy=!1),h._active||!h._paused&&h._time!==p&&0<=e&&(h._active=!0),0===d&&(2===h._initted&&0e._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},e.remove=function(e){var t;if(e instanceof c)return this._remove(e,!1),t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline,e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this;if(e instanceof Array||e&&e.push&&d(e)){for(var i=e.length;-1<--i;)this.remove(e[i]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},e._remove=function(e,t){return p.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},e.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},e.insert=e.insertMultiple=function(e,t,i,r){return this.add(e,t||0,i,r)},e.appendMultiple=function(e,t,i,r){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),i,r)},e.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},e.addPause=function(e,t,i,r){i=f.delayedCall(0,n,i,r||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},e.removeLabel=function(e){return delete this._labels[e],this},e.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},e._parseTimeOrLabel=function(e,t,i,r){var n,s;if(r instanceof c&&r.timeline===this)this.remove(r);else if(r&&(r instanceof Array||r.push&&d(r)))for(s=r.length;-1<--s;)r[s]instanceof c&&r[s].timeline===this&&this.remove(r[s]);if(n="number"!=typeof e||t?99999999999=e&&!l;)r._duration||"isPause"===r.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,i),l=l._prev;l=null,c.pause(),c._pauseTime=h}r._reversed?r.render((r._dirty?r.totalDuration():r._totalDuration)-(e-r._startTime)*r._timeScale,t,i):r.render((e-r._startTime)*r._timeScale,t,i)}r=s}!c._onUpdate||t||(b.length&&x(),c._callback("onUpdate")),!o||c._gc||f!==c._startTime&&m===c._timeScale||(0===c._time||d>=c.totalDuration())&&(n&&(b.length&&x(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[o]&&c._callback(o))}},e._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},e.getChildren=function(e,t,i,r){r=r||-9999999999;for(var n=[],s=this._first,o=0;s;)s._startTime=i&&(n._startTime+=e),n=n._next;if(t)for(r in s)s[r]>=i&&(s[r]+=e);return this._uncache(!0)},e._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var i=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),r=i.length,n=!1;-1<--r;)i[r]._kill(e,t)&&(n=!0);return n},e.clear=function(e){var t=this.getChildren(!1,!0,!0),i=t.length;for(this._time=this._totalTime=0;-1<--i;)t[i]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},e.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},e._enabled=function(e,t){if(e===this._gc)for(var i=this._first;i;)i._enabled(e,!0),i=i._next;return p.prototype._enabled.call(this,e,t)},e.totalTime=function(e,t,i){this._forcingPlayhead=!0;var r=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,r},e.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},e.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,i,r=0,n=this,s=n._last,o=999999999999;s;)t=s._prev,s._dirty&&s.totalDuration(),s._startTime>o&&n._sortChildren&&!s._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(s,s._startTime-s._delay),n._calculatingDuration=0):o=s._startTime,s._startTime<0&&!s._paused&&(r-=s._startTime,n._timeline.smoothChildTiming&&(n._startTime+=s._startTime/n._timeScale,n._time-=s._startTime,n._totalTime-=s._startTime,n._rawPrevTime-=s._startTime),n.shiftChildren(-s._startTime,!1,-9999999999),o=0),r<(i=s._startTime+s._totalDuration/s._timeScale)&&(r=i),s=t;n._duration=n._totalDuration=r,n._dirty=!1}return this._totalDuration},e.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},e.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},e.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,c._cycle&&c._cycle===c._totalTime/x&&m<=e&&c._cycle--,c._time=c._totalTime-c._cycle*x,c._yoyo&&1&c._cycle&&(c._time=f-c._time),c._time>f?e=(c._time=f)+1e-4:c._time<0?c._time=e=0:e=c._time));if(c._hasPause&&!c._forcingPlayhead&&!t){if(p<(e=c._time)||c._repeat&&b!==c._cycle)for(r=c._first;r&&r._startTime<=e&&!l;)r._duration||"isPause"!==r.data||r.ratio||0===r._startTime&&0===c._rawPrevTime||(l=r),r=r._next;else for(r=c._last;r&&r._startTime>=e&&!l;)r._duration||"isPause"===r.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,i),l=l._prev;l=null,c.pause(),c._pauseTime=h}r._reversed?r.render((r._dirty?r.totalDuration():r._totalDuration)-(e-r._startTime)*r._timeScale,t,i):r.render((e-r._startTime)*r._timeScale,t,i)}r=s}!c._onUpdate||t||(P.length&&O(),c._callback("onUpdate")),!o||c._locked||c._gc||_!==c._startTime&&g===c._timeScale||(0===c._time||d>=c.totalDuration())&&(n&&(P.length&&O(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[o]&&c._callback(o))}else m!==c._totalTime&&c._onUpdate&&!t&&c._callback("onUpdate")},r.getActive=function(e,t,i){for(var r,n=[],s=this.getChildren(e||null==e,t||null==e,!!i),o=0,a=s.length,l=0;le)return t[r].name;return null},r.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),i=t.length;-1<--i;)if(t[i].time>0||6)-1,c=[],p=[];for(i in e){x=b=y=v=x=g=_=m=f=d=y=A=S=void 0;for(var d,f,m,_,g,v,y,b,x,T=e[i],w=o,E=t,S=1/E,A=T.length;-1<--A;)for(f=(b=T[A]).a,m=b.d-f,_=b.c-f,g=b.b-f,d=0,v=1;v<=E;v++)y=d-(d=((x=S*v)*x*m+3*(y=1-x)*(x*_+y*g))*x),w[x=A*E+v-1]=(w[x]||0)+y*y}for(n=o.length,r=0;r>0]=p,a[s]=u,l=0,p=[]);return{length:u,lengths:a,segments:c}}(this._beziers,this._timeRes),this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length),c=this._autoRotate)for(this._initialRotations=[],c[0]instanceof Array||(this._autoRotate=c=[c]),s=c.length;-1<--s;){for(o=0;o<3;o++)r=c[s][o],this._func[r]="function"==typeof e[r]&&e[r.indexOf("set")||"function"!=typeof e["get"+r.substr(3)]?r:"get"+r.substr(3)];r=c[s][2],this._initialRotations[s]=(this._func[r]?this._func[r].call(this._target):this._target[r])||0,this._overwriteProps.push(r)}return this._startRatio=i.vars.runBackwards?1:0,!0},set:function(e){var t,i,r,n,s,o,a,l,u,h,c=this._segCount,p=this._func,d=this._target,f=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,u=this._curSeg,h=e*this._length,w=this._li,h>this._l2&&w=h;);0===w&&hthis._s2&&w=h;);0===w&&h>0)*(1/c))*c;for(i=1-s,w=this._props.length;-1<--w;)r=this._props[w],o=(s*s*(n=this._beziers[r][t]).da+3*i*(s*n.ca+i*n.ba))*s+n.a,this._mod[r]&&(o=this._mod[r](o,d)),p[r]?d[r](o):d[r]=o;if(this._autoRotate)for(var m,_,g,v,y,b,x,T=this._autoRotate,w=T.length;-1<--w;)r=T[w][2],b=T[w][3]||0,x=!0===T[w][4]?1:E,n=this._beziers[T[w][0]],m=this._beziers[T[w][1]],n&&m&&(n=n[t],m=m[t],_=n.a+(n.b-n.a)*s,_+=((v=n.b+(n.c-n.b)*s)-_)*s,v+=(n.c+(n.d-n.c)*s-v)*s,g=m.a+(m.b-m.a)*s,g+=((y=m.b+(m.c-m.b)*s)-g)*s,y+=(m.c+(m.d-m.c)*s-y)*s,o=f?Math.atan2(y-g,v-_)*x+b:this._initialRotations[w],this._mod[r]&&(o=this._mod[r](o,d)),p[r]?d[r](o):d[r]=o)}}),e=_.prototype,_.bezierThrough=p,_.cubicToQuadratic=U,_._autoCSS=!0,_.quadraticToCubic=function(e,t,i){return new B(e,(2*t+e)/3,(2*t+i)/3,i)},_._cssRegister=function(){var d,f,m,e=t.CSSPlugin;e&&(e=e._internals,d=e._parseToProxy,f=e._setPluginRatio,m=e.CSSPropTween,e._registerComplexSpecialProp("bezier",{parser:function(e,t,i,r,n,s){t instanceof Array&&(t={values:t}),s=new _;var o,a,l,u=t.values,h=u.length-1,c=[],p={};if(!(h<0)){for(o=0;o<=h;o++)l=d(e,u[o],r,n,s,h!==o),c[o]=l.end;for(a in t)p[a]=t[a];p.values=c,(n=new m(e,"bezier",0,0,l.pt,2)).data=l,n.plugin=s,n.setRatio=f,0===p.autoRotate&&(p.autoRotate=!0),!p.autoRotate||p.autoRotate instanceof Array||(o=!0===p.autoRotate?0:Number(p.autoRotate),p.autoRotate=null!=l.end.left?[["left","top","rotation",o,!1]]:null!=l.end.x&&[["x","y","rotation",o,!1]]),p.autoRotate&&(r._transform||r._enableTransforms(!1),l.autoRotate=r._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,r._overwriteProps.push("rotation")),s._onInitTween(l.proxy,p,r._tween)}return n}}))},e._mod=function(e){for(var t,i=this._overwriteProps,r=i.length;-1<--r;)(t=e[i[r]])&&"function"==typeof t&&(this._mod[i[r]]=t)},e._kill=function(e){var t,i,r=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],i=r.length;-1<--i;)r[i]===t&&r.splice(i,1);if(r=this._autoRotate)for(i=r.length;-1<--i;)e[r[i][2]]&&r.splice(i,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,R){function C(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=C.prototype.setRatio}function a(e,t){return t.toUpperCase()}function l(e,t){return(t=L.createElementNS?L.createElementNS(t||"http://www.w3.org/1999/xhtml",e):L.createElement(e)).style?t:L.createElement(e)}function u(e){return ne.test("string"==typeof e?e:(e.currentStyle||e.style).filter||"")?parseFloat(RegExp.$1)/100:1}function _(e){_gsScope.console&&console.log(e)}function T(e,t){var i,r,n=(t=t||F).style;if(void 0!==n[e])return e;for(e=e.charAt(0).toUpperCase()+e.substr(1),i=["O","Moz","ms","Ms","Webkit"],r=5;-1<--r&&void 0===n[i[r]+e];);return 0<=r?(ve="-"+(ye=3===r?"ms":i[r]).toLowerCase()+"-",ye+e):null}function f(e){return be.getComputedStyle(e)}function p(e,t){var i,r,n={};if(t=t||f(e))if(i=t.length)for(;-1<--i;)-1!==(r=t[i]).indexOf("-transform")&&Ge!==r||(n[r.replace(ue,a)]=t.getPropertyValue(r));else for(i in t)-1!==i.indexOf("Transform")&&H!==i||(n[i]=t[i]);else if(t=e.currentStyle||e.style)for(i in t)"string"==typeof i&&void 0===n[i]&&(n[i.replace(ue,a)]=t[i]);return N||(n.opacity=u(e)),e=Ze(e,t,!1),n.rotation=e.rotation,n.skewX=e.skewX,n.scaleX=e.scaleX,n.scaleY=e.scaleY,n.x=e.x,n.y=e.y,Y&&(n.z=e.z,n.rotationX=e.rotationX,n.rotationY=e.rotationY,n.scaleZ=e.scaleZ),n.filters&&delete n.filters,n}function g(e,t,i,r,n){var s,o,a,l={},u=e.style;for(o in i)"cssText"===o||"length"!==o&&isNaN(o)&&(t[o]!==(s=i[o])||n&&n[o])&&-1===o.indexOf("Origin")&&("number"==typeof s||"string"==typeof s)&&(l[o]="auto"!==s||"left"!==o&&"top"!==o?""!==s&&"auto"!==s&&"none"!==s||"string"!=typeof t[o]||""===t[o].replace(ie,"")?s:0:xe(e,o),void 0!==u[o]&&(a=new Pe(u,o,u[o],a)));if(r)for(o in r)"className"!==o&&(l[o]=r[o]);return{difs:l,firstMPT:a}}function A(e,t){return"string"==typeof(e="function"==typeof e?e(O,P):e)&&"="===e.charAt(1)?parseInt(e.charAt(0)+"1",10)*parseFloat(e.substr(2)):parseFloat(e)-parseFloat(t)||0}function E(e,t){var i="string"==typeof(e="function"==typeof e?e(O,P):e)&&"="===e.charAt(1);return null==(e="string"==typeof e&&"v"===e.charAt(e.length-2)?(i?e.substr(0,2):0)+window["inner"+("vh"===e.substr(-2)?"Height":"Width")]*(parseFloat(i?e.substr(2):e)/100):e)?t:i?parseInt(e.charAt(0)+"1",10)*parseFloat(e.substr(2))+t:parseFloat(e)||0}function S(e,t,i,r){var n,s;return n=(n=null==(e="function"==typeof e?e(O,P):e)?t:"number"==typeof e?e:(n=e.split("_"),s=((s="="===e.charAt(1))?parseInt(e.charAt(0)+"1",10)*parseFloat(n[0].substr(2)):parseFloat(n[0]))*(-1===e.indexOf("rad")?1:D)-(s?0:t),n.length&&(r&&(r[i]=t+s),-1!==e.indexOf("short")&&(s%=360)!==s%180&&(s=s<0?s+360:s-360),-1!==e.indexOf("_cw")&&s<0?s=(s+3599999999640)%360-360*(s/360|0):-1!==e.indexOf("ccw")&&0>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),Ee[e])i=Ee[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(r=e.charAt(1))+r+(n=e.charAt(2))+n+(s=e.charAt(3))+s),i=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(i=u=e.match(Q),t){if(-1!==e.indexOf("="))return e.match($)}else o=Number(i[0])%360/360,a=Number(i[1])/100,r=2*(l=Number(i[2])/100)-(n=l<=.5?l*(a+1):l+a-l*a),3r--)for(;++rr--)for(;++r>0];return r.parse(e,o,n,s)}}function Pe(e,t,i,r,n){this.t=e,this.p=t,this.v=i,this.r=n,r&&((r._prev=this)._next=r)}t._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,i,r,n,s,o=this.data,a=o.proxy,l=o.firstMPT;l;)t=a[l.v],l.r?t=l.r(t):t<1e-6&&-1e-6a.length?l:a).length,o=0;on.pr;)s=s._next;(n._prev=s?s._prev:a)?n._prev._next=n:o=n,(n._next=s)?s._prev=n:a=n,n=l}this._firstPT=o}return!0},e.parse=function(e,t,i,r){var n,s,o,a,l,u,h,c,p=e.style;for(n in t){if(l=t[n],a=m[n],"function"!=typeof l||a&&a.allowFunc||(l=l(O,P)),a)i=a.parse(e,l,n,this,i,r,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",f(e).getPropertyValue(n)+"",l+"",n,!1,n);continue}a=z(e,n,k)+"",h="string"==typeof l,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||h&&ae.test(l)?(h||(l=(3<(l=Se(l)).length?"rgba(":"rgb(")+l.join(",")+")"),i=Re(p,n,a,l,!0,"transparent",i,0,r)):h&&fe.test(l)?i=Re(p,n,a,l,!0,null,i,0,r):(u=(s=parseFloat(a))||0===s?a.substr((s+"").length):"",""!==a&&"auto"!==a||(u="width"===n||"height"===n?(s=function(e,t,i){if("svg"===(e.nodeName+"").toLowerCase())return(i||f(e))[t]||0;if(e.getCTM&&qe(e))return e.getBBox()[t]||0;var r=parseFloat("width"===t?e.offsetWidth:e.offsetHeight),n=Te[t],s=n.length;for(i=i||f(e);-1<--s;)r=(r-=parseFloat(z(e,"padding"+n[s],i,!0))||0)-(parseFloat(z(e,"border"+n[s]+"Width",i,!0))||0);return r}(e,n,k),"px"):"left"===n||"top"===n?(s=xe(e,n,k),"px"):(s="opacity"!==n?0:1,"")),""===(h=(c=h&&"="===l.charAt(1))?(o=parseInt(l.charAt(0)+"1",10),l=l.substr(2),o*=parseFloat(l),l.replace(re,"")):(o=parseFloat(l),h?l.replace(re,""):""))&&(h=n in W?W[n]:u),l=o||0===o?(c?o+s:o)+h:t[n],u===h||""===h&&"lineHeight"!==n||(o||0===o)&&s&&(s=w(e,n,s,u),"%"===h?(s/=w(e,n,100,"%")/100,!0!==t.strictUnits&&(a=s+"%")):"em"===h||"rem"===h||"vw"===h||"vh"===h?s/=w(e,n,1,h):"px"!==h&&(o=w(e,n,o,h),h="px"),c&&(o||0===o)&&(l=o+s+h)),c&&(o+=s),!s&&0!==s||!o&&0!==o?void 0!==p[n]&&(l||l+""!="NaN"&&null!=l)?(i=new j(p,n,o||s||0,0,i,-1,n,!1,0,a,l)).xs0="none"!==l||"display"!==n&&-1===n.indexOf("Style")?l:a:_("invalid "+n+" tween value: "+t[n]):(i=new j(p,n,s,o-s,i,0,n,!1!==V&&("px"===h||"zIndex"===n),0,a,l)).xs0=h)}r&&i&&!i.plugin&&(i.plugin=r)}return i},e.setRatio=function(e){var t,i,r,n=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;n;){if(t=n.c*e+n.s,n.r?t=n.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},p.ease=new p(.7,.7),d.config=p.config=function(e,t,i){return new p(e,t,i)},(d=(r=h("easing.SteppedEase",function(e,t){this._p1=1/(e=e||1),this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new _).constructor=r,d.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},d.config=r.config=function(e,t){return new r(e,t)},(d=(n=h("easing.ExpoScaleEase",function(e,t,i){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=i},!0)).prototype=new _).constructor=n,d.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},d.config=n.config=function(e,t,i){return new n(e,t,i)},(d=(s=h("easing.RoughEase",function(e){for(var t,i,r,n,s,o,a=(e=e||{}).taper||"none",l=[],u=0,h=0|(e.points||20),c=h,p=!1!==e.randomize,d=!0===e.clamp,f=e.template instanceof _?e.template:null,m="number"==typeof e.strength?.4*e.strength:.4;-1<--c;)t=p?Math.random():1/h*c,i=f?f.getRatio(t):t,r="none"===a?m:"out"===a?(n=1-t)*n*m:"in"===a?t*t*m:t<.5?(n=2*t)*n*.5*m:(n=2*(1-t))*n*.5*m,p?i+=Math.random()*r-.5*r:c%2?i+=.5*r:i-=.5*r,d&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},d.config=function(e){return new s(e)},s.ease=new s,t("Bounce",e("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),e("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),e("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),t("Circ",e("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),e("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),e("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),t("Elastic",(d=function(e,t,i){var r=h("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||i)/(e<1?e:1),this._p3=this._p2/l*(Math.asin(1/this._p1)||0),this._p2=l/this._p2},!0),e=r.prototype=new _;return e.constructor=r,e.getRatio=t,e.config=function(e,t){return new r(e,t)},r})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),d("ElasticIn",function(e){return-(this._p1*Math.pow(2,10*--e)*Math.sin((e-this._p3)*this._p2))},.3),d("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*--e)*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*--e)*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),t("Expo",e("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),e("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),e("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),t("Sine",e("SineOut",function(e){return Math.sin(e*u)}),e("SineIn",function(e){return 1-Math.cos(e*u)}),e("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),h("easing.EaseLookup",{find:function(e){return _.map[e]}},!0),c(o.SlowMo,"SlowMo","ease,"),c(s,"RoughEase","ease,"),c(r,"SteppedEase","ease,"),a},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),!function(m,p){"use strict";var d={},f=m.document,_=m.GreenSockGlobals=m.GreenSockGlobals||m,e=_[p];if(e)"undefined"!=typeof module&&module.exports&&(module.exports=e);else{var g,t,F,N=function(e){for(var t=e.split("."),i=_,r=0;r=t&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,i){if(g||P.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!i&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var r=this._totalDuration,n=this._timeline;if(rs;)n=n._prev;return n?(e._next=n._next,n._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=n,this._recent=e,this._timeline&&this._uncache(!0),this},n._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},n.render=function(e,t,i){var r,n=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;n;)r=n._next,(n._active||e>=n._startTime&&!n._paused&&!n._gc)&&(n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,i):n.render((e-n._startTime)*n._timeScale,t,i)),n=r},n.rawTime=function(){return g||P.wake(),this._totalTime},x("TweenLite",function(e,t,i){if(a.call(this,t,i),this.render=O.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"==typeof e&&O.selector(e)||e;var r,n,s,i=e.jquery||e.length&&e!==m&&e[0]&&(e[0]===m||e[0].nodeType&&e[0].style&&!e.nodeType),o=this.vars.overwrite;if(this._overwrite=o=null==o?ee[O.defaultOverwrite]:"number"==typeof o?o>>0:ee[o],(i||e instanceof Array||e.push&&y(e))&&"number"!=typeof e[0])for(this._targets=s=z(e),this._propLookup=[],this._siblings=[],r=0;r=te){for(i in te=P.frame+(parseInt(O.autoSleep,10)||120),l){for(e=(t=l[i].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete l[i]}if((!(i=h._first)||i._paused)&&O.autoSleep&&!u._first&&1===P._listeners.tick.length){for(;i&&i._paused;)i=i._next;i||P.sleep()}}},P.addEventListener("tick",a._updateRoot),function(e,t,i){var r,n,s=e._gsTweenID;if(l[s||(e._gsTweenID=s="t"+Q++)]||(l[s]={target:e,tweens:[]}),t&&((r=l[s].tweens)[n=r.length]=t,i))for(;-1<--n;)r[n]===t&&r.splice(n,1);return l[s].tweens}),ie=function(e,t,i,r){var n,s,o=e.vars.onOverwrite;return o&&(n=o(e,t,i,r)),(o=O.onOverwrite)&&(s=o(e,t,i,r)),!1!==n&&!1!==s},re=function(e,t,i,r,n){var s,o,a;if(1===r||4<=r){for(a=n.length,d=0;du&&((p||!o._initted)&&u-o._startTime<=2e-8||(h[c++]=o)));for(d=c;-1<--d;)a=(o=h[d])._firstPT,2===r&&o._kill(i,e,t)&&(s=!0),(2!==r||!o._firstPT&&o._initted&&a)&&(2===r||ie(o,t))&&o._enabled(!1,!1)&&(s=!0)}return s},ne=function(e,t,i){for(var r=e._timeline,n=r._timeScale,s=e._startTime;r._timeline;){if(s+=r._startTime,n*=r._timeScale,r._paused)return-100;r=r._timeline}return t<(s/=n)?s-t:i&&s===t||!e._initted&&s-t<2e-8?v:(s+=e.totalDuration()/e._timeScale/n)>t+v?0:s-t-v},L=(n._init=function(){var e,t,i,r,n,s,o=this.vars,a=this._overwrittenProps,l=this._duration,u=!!o.immediateRender,h=o.ease,c=this._startAt;if(o.startAt){for(r in c&&(c.render(-1,!0),c.kill()),n={},o.startAt)n[r]=o.startAt[r];if(n.data="isStart",n.overwrite=!1,n.immediateRender=!0,n.lazy=u&&!1!==o.lazy,n.startAt=n.delay=null,n.onUpdate=o.onUpdate,n.onUpdateParams=o.onUpdateParams,n.onUpdateScope=o.onUpdateScope||o.callbackScope||this,this._startAt=O.to(this.target||{},0,n),u)if(0a.pr;)r=r._next;(a._prev=r?r._prev:s)?a._prev._next=a:n=a,(a._next=r)?r._prev=a:s=a,a=o}a=t._firstPT=n}for(;a;)a.pg&&"function"==typeof a.t[e]&&a.t[e]()&&(i=!0),a=a._next;return i},L.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===L.API&&(M[(new e[t])._propName]=e[t]);return!0},r.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,i=e.propName,r=e.priority||0,n=e.overwriteProps,s={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},o=x("plugins."+i.charAt(0).toUpperCase()+i.substr(1)+"Plugin",function(){L.call(this,i,r),this._overwriteProps=n||[]},!0===e.global),a=o.prototype=new L(i);for(t in(a.constructor=o).API=e.API,s)"function"==typeof e[t]&&(a[s[t]]=e[t]);return o.version=e.version,L.activate([o]),o},s=m._gsQueue){for(o=0;o>0,c._cycle&&c._cycle===c._totalTime/x&&m<=e&&c._cycle--,c._time=c._totalTime-c._cycle*x,c._yoyo&&1&c._cycle&&(c._time=f-c._time),c._time>f?e=(c._time=f)+1e-4:c._time<0?c._time=e=0:e=c._time));if(c._hasPause&&!c._forcingPlayhead&&!t){if(p<(e=c._time)||c._repeat&&b!==c._cycle)for(r=c._first;r&&r._startTime<=e&&!l;)r._duration||"isPause"!==r.data||r.ratio||0===r._startTime&&0===c._rawPrevTime||(l=r),r=r._next;else for(r=c._last;r&&r._startTime>=e&&!l;)r._duration||"isPause"===r.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,i),l=l._prev;l=null,c.pause(),c._pauseTime=h}r._reversed?r.render((r._dirty?r.totalDuration():r._totalDuration)-(e-r._startTime)*r._timeScale,t,i):r.render((e-r._startTime)*r._timeScale,t,i)}r=s}!c._onUpdate||t||(P.length&&O(),c._callback("onUpdate")),!o||c._locked||c._gc||_!==c._startTime&&g===c._timeScale||(0===c._time||d>=c.totalDuration())&&(n&&(P.length&&O(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[o]&&c._callback(o))}else m!==c._totalTime&&c._onUpdate&&!t&&c._callback("onUpdate")},r.getActive=function(e,t,i){for(var r,n=[],s=this.getChildren(e||null==e,t||null==e,!!i),o=0,a=s.length,l=0;le)return t[r].name;return null},r.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),i=t.length;-1<--i;)if(t[i].timee._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},e.remove=function(e){var t;if(e instanceof c)return this._remove(e,!1),t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline,e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this;if(e instanceof Array||e&&e.push&&d(e)){for(var i=e.length;-1<--i;)this.remove(e[i]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},e._remove=function(e,t){return p.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},e.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},e.insert=e.insertMultiple=function(e,t,i,r){return this.add(e,t||0,i,r)},e.appendMultiple=function(e,t,i,r){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),i,r)},e.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},e.addPause=function(e,t,i,r){i=f.delayedCall(0,n,i,r||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},e.removeLabel=function(e){return delete this._labels[e],this},e.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},e._parseTimeOrLabel=function(e,t,i,r){var n,s;if(r instanceof c&&r.timeline===this)this.remove(r);else if(r&&(r instanceof Array||r.push&&d(r)))for(s=r.length;-1<--s;)r[s]instanceof c&&r[s].timeline===this&&this.remove(r[s]);if(n="number"!=typeof e||t?99999999999=e&&!l;)r._duration||"isPause"===r.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,i),l=l._prev;l=null,c.pause(),c._pauseTime=h}r._reversed?r.render((r._dirty?r.totalDuration():r._totalDuration)-(e-r._startTime)*r._timeScale,t,i):r.render((e-r._startTime)*r._timeScale,t,i)}r=s}!c._onUpdate||t||(b.length&&x(),c._callback("onUpdate")),!o||c._gc||f!==c._startTime&&m===c._timeScale||(0===c._time||d>=c.totalDuration())&&(n&&(b.length&&x(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[o]&&c._callback(o))}},e._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},e.getChildren=function(e,t,i,r){r=r||-9999999999;for(var n=[],s=this._first,o=0;s;)s._startTime=i&&(n._startTime+=e),n=n._next;if(t)for(r in s)s[r]>=i&&(s[r]+=e);return this._uncache(!0)},e._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var i=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),r=i.length,n=!1;-1<--r;)i[r]._kill(e,t)&&(n=!0);return n},e.clear=function(e){var t=this.getChildren(!1,!0,!0),i=t.length;for(this._time=this._totalTime=0;-1<--i;)t[i]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},e.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},e._enabled=function(e,t){if(e===this._gc)for(var i=this._first;i;)i._enabled(e,!0),i=i._next;return p.prototype._enabled.call(this,e,t)},e.totalTime=function(e,t,i){this._forcingPlayhead=!0;var r=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,r},e.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},e.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,i,r=0,n=this,s=n._last,o=999999999999;s;)t=s._prev,s._dirty&&s.totalDuration(),s._startTime>o&&n._sortChildren&&!s._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(s,s._startTime-s._delay),n._calculatingDuration=0):o=s._startTime,s._startTime<0&&!s._paused&&(r-=s._startTime,n._timeline.smoothChildTiming&&(n._startTime+=s._startTime/n._timeScale,n._time-=s._startTime,n._totalTime-=s._startTime,n._rawPrevTime-=s._startTime),n.shiftChildren(-s._startTime,!1,-9999999999),o=0),r<(i=s._startTime+s._totalDuration/s._timeScale)&&(r=i),s=t;n._duration=n._totalDuration=r,n._dirty=!1}return this._totalDuration},e.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},e.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},e.rawTime=function(e){return e&&(this._paused||this._repeat&&0>10|55296,1023&r|56320)}function N(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}function z(){T()}var e,d,b,s,B,f,U,j,x,l,u,T,w,i,E,m,r,n,_,S="sizzle"+ +new Date,g=F.document,A=0,G=0,X=ce(),H=ce(),v=ce(),Y=function(e,t){return e===t&&(u=!0),0},W={}.hasOwnProperty,t=[],V=t.pop,q=t.push,k=t.push,K=t.slice,y=function(e,t){for(var i=0,r=e.length;i+~]|"+o+")"+o+"*"),ie=new RegExp("="+o+"*([^\\]'\"]*?)"+o+"*\\]","g"),re=new RegExp(Q),ne=new RegExp("^"+a+"$"),p={ID:new RegExp("^#("+a+")"),CLASS:new RegExp("^\\.("+a+")"),TAG:new RegExp("^("+a+"|[*])"),ATTR:new RegExp("^"+J),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+o+"*(even|odd|(([+-]|)(\\d*)n|)"+o+"*(?:([+-]|)"+o+"*(\\d+)|))"+o+"*\\)|)","i"),bool:new RegExp("^(?:"+Z+")$","i"),needsContext:new RegExp("^"+o+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+o+"*((?:-\\d)?\\d*)"+o+"*\\)|)(?=[^-]|$)","i")},se=/^(?:input|select|textarea|button)$/i,oe=/^h\d$/i,h=/^[^{]+\{\s*\[native \w/,ae=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,le=/[+~]/,O=new RegExp("\\\\([\\da-f]{1,6}"+o+"?|("+o+")|.)","ig"),ue=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,he=L(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{k.apply(t=K.call(g.childNodes),g.childNodes),t[g.childNodes.length].nodeType}catch(e){k={apply:t.length?function(e,t){q.apply(e,K.call(t))}:function(e,t){for(var i=e.length,r=0;e[i++]=t[r++];);e.length=i-1}}}function R(e,t,i,r){var n,s,o,a,l,u,h,c=t&&t.ownerDocument,p=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return i;if(!r&&((t?t.ownerDocument||t:g)!==w&&T(t),t=t||w,E)){if(11!==p&&(l=ae.exec(e)))if(n=l[1]){if(9===p){if(!(o=t.getElementById(n)))return i;if(o.id===n)return i.push(o),i}else if(c&&(o=c.getElementById(n))&&_(t,o)&&o.id===n)return i.push(o),i}else{if(l[2])return k.apply(i,t.getElementsByTagName(e)),i;if((n=l[3])&&d.getElementsByClassName&&t.getElementsByClassName)return k.apply(i,t.getElementsByClassName(n)),i}if(d.qsa&&!v[e+" "]&&(!m||!m.test(e))){if(1!==p)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((a=t.getAttribute("id"))?a=a.replace(ue,N):t.setAttribute("id",a=S),s=(u=f(e)).length;s--;)u[s]="#"+a+" "+D(u[s]);h=u.join(","),c=le.test(e)&&me(t.parentNode)||t}if(h)try{return k.apply(i,c.querySelectorAll(h)),i}catch(e){}finally{a===S&&t.removeAttribute("id")}}}return j(e.replace(P,"$1"),t,i,r)}function ce(){var i=[];function r(e,t){return i.push(e+" ")>b.cacheLength&&delete r[i.shift()],r[e+" "]=t}return r}function C(e){return e[S]=!0,e}function M(e){var t=w.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function pe(e,t){for(var i=e.split("|"),r=i.length;r--;)b.attrHandle[i[r]]=t}function de(e,t){var i=t&&e,r=i&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function fe(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&he(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function I(o){return C(function(s){return s=+s,C(function(e,t){for(var i,r=o([],e.length,s),n=r.length;n--;)e[i=r[n]]&&(e[i]=!(t[i]=e[i]))})})}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in d=R.support={},B=R.isXML=function(e){e=e&&(e.ownerDocument||e).documentElement;return!!e&&"HTML"!==e.nodeName},T=R.setDocument=function(e){var e=e?e.ownerDocument||e:g;return e!==w&&9===e.nodeType&&e.documentElement&&(i=(w=e).documentElement,E=!B(w),g!==w&&(e=w.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",z,!1):e.attachEvent&&e.attachEvent("onunload",z)),d.attributes=M(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=M(function(e){return e.appendChild(w.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=h.test(w.getElementsByClassName),d.getById=M(function(e){return i.appendChild(e).id=S,!w.getElementsByName||!w.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(O,c);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&E)return(t=t.getElementById(e))?[t]:[]}):(b.filter.ID=function(e){var t=e.replace(O,c);return function(e){e=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&E){var i,r,n,s=t.getElementById(e);if(s){if((i=s.getAttributeNode("id"))&&i.value===e)return[s];for(n=t.getElementsByName(e),r=0;s=n[r++];)if((i=s.getAttributeNode("id"))&&i.value===e)return[s]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,r=[],n=0,s=t.getElementsByTagName(e);if("*"!==e)return s;for(;i=s[n++];)1===i.nodeType&&r.push(i);return r},b.find.CLASS=d.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&E)return t.getElementsByClassName(e)},r=[],m=[],(d.qsa=h.test(w.querySelectorAll))&&(M(function(e){i.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+o+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+o+"*(?:value|"+Z+")"),e.querySelectorAll("[id~="+S+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||m.push(".#.+[+~]")}),M(function(e){e.innerHTML="";var t=w.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+o+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),i.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(d.matchesSelector=h.test(n=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.oMatchesSelector||i.msMatchesSelector))&&M(function(e){d.disconnectedMatch=n.call(e,"*"),n.call(e,"[s!='']:x"),r.push("!=",Q)}),m=m.length&&new RegExp(m.join("|")),r=r.length&&new RegExp(r.join("|")),e=h.test(i.compareDocumentPosition),_=e||h.test(i.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,t=t&&t.parentNode;return e===t||!(!t||1!==t.nodeType||!(i.contains?i.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Y=e?function(e,t){var i;return e===t?(u=!0,0):(i=!e.compareDocumentPosition-!t.compareDocumentPosition)||(1&(i=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===i?e===w||e.ownerDocument===g&&_(g,e)?-1:t===w||t.ownerDocument===g&&_(g,t)?1:l?y(l,e)-y(l,t):0:4&i?-1:1)}:function(e,t){if(e===t)return u=!0,0;var i,r=0,n=e.parentNode,s=t.parentNode,o=[e],a=[t];if(!n||!s)return e===w?-1:t===w?1:n?-1:s?1:l?y(l,e)-y(l,t):0;if(n===s)return de(e,t);for(i=e;i=i.parentNode;)o.unshift(i);for(i=t;i=i.parentNode;)a.unshift(i);for(;o[r]===a[r];)r++;return r?de(o[r],a[r]):o[r]===g?-1:a[r]===g?1:0}),w},R.matches=function(e,t){return R(e,null,null,t)},R.matchesSelector=function(e,t){if((e.ownerDocument||e)!==w&&T(e),t=t.replace(ie,"='$1']"),d.matchesSelector&&E&&!v[t+" "]&&(!r||!r.test(t))&&(!m||!m.test(t)))try{var i=n.call(e,t);if(i||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,c),e[3]=(e[3]||e[4]||e[5]||"").replace(O,c),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||R.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&R.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return p.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&re.test(i)&&(t=f(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,c).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=X[e+" "];return t||(t=new RegExp("(^|"+o+")"+e+"("+o+"|$)"))&&X(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,i,r){return function(e){e=R.attr(e,t);return null==e?"!="===i:!i||(e+="","="===i?e===r:"!="===i?e!==r:"^="===i?r&&0===e.indexOf(r):"*="===i?r&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function $(e,i,r){return v(i)?w.grep(e,function(e,t){return!!i.call(e,t,e)!==r}):i.nodeType?w.grep(e,function(e){return e===i!==r}):"string"!=typeof i?w.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/,ie=((w.fn.init=function(e,t,i){if(e){if(i=i||ee,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==i.ready?i.ready(e):e(w):w.makeArray(e,this);if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:te.exec(e))||!r[1]&&t)return(!t||t.jquery?t||i:this.constructor(t)).find(e);if(r[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:T,!0)),Q.test(r[1])&&w.isPlainObject(t))for(var r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r])}else(i=T.getElementById(r[2]))&&(this[0]=i,this.length=1)}return this}).prototype=w.fn,ee=w(T),/^(?:parents|prev(?:Until|All))/),re={children:!0,contents:!0,next:!0,prev:!0};function ne(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}w.fn.extend({has:function(e){var t=w(e,this),i=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,we=/^$|^module$|\/(?:java|ecma)script/i,S={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function A(e,t){var i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&l(e,t)?w.merge([e],i):i}function Ee(e,t){for(var i=0,r=e.length;ix",_.noCloneChecked=!!C.cloneNode(!0).lastChild.defaultValue;var ke=T.documentElement,Pe=/^key/,Oe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Re=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function k(){return!1}function Me(){try{return T.activeElement}catch(e){}}function Ie(e,t,i,r,n,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof i&&(r=r||i,i=void 0),t)Ie(e,a,i,r,t[a],s);return e}if(null==r&&null==n?(n=i,r=i=void 0):null==n&&("string"==typeof i?(n=r,r=void 0):(n=r,r=i,i=void 0)),!1===n)n=k;else if(!n)return e;return 1===s&&(o=n,(n=function(e){return w().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=w.guid++)),e.each(function(){w.event.add(this,t,n,r,i)})}w.event={global:{},add:function(t,e,i,r,n){var s,o,a,l,u,h,c,p,d,f=g.get(t);if(f)for(i.handler&&(i=(s=i).handler,n=s.selector),n&&w.find.matchesSelector(ke,n),i.guid||(i.guid=w.guid++),(a=f.events)||(a=f.events={}),(o=f.handle)||(o=f.handle=function(e){return void 0!==w&&w.event.triggered!==e.type?w.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(E)||[""]).length;l--;)c=d=(p=Re.exec(e[l])||[])[1],p=(p[2]||"").split(".").sort(),c&&(u=w.event.special[c]||{},c=(n?u.delegateType:u.bindType)||c,u=w.event.special[c]||{},d=w.extend({type:c,origType:d,data:r,handler:i,guid:i.guid,selector:n,needsContext:n&&w.expr.match.needsContext.test(n),namespace:p.join(".")},s),(h=a[c])||((h=a[c]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(t,r,p,o)||t.addEventListener&&t.addEventListener(c,o)),u.add&&(u.add.call(t,d),d.handler.guid||(d.handler.guid=i.guid)),n?h.splice(h.delegateCount++,0,d):h.push(d),w.event.global[c]=!0)},remove:function(e,t,i,r,n){var s,o,a,l,u,h,c,p,d,f,m,_=g.hasData(e)&&g.get(e);if(_&&(l=_.events)){for(u=(t=(t||"").match(E)||[""]).length;u--;)if(d=m=(a=Re.exec(t[u])||[])[1],f=(a[2]||"").split(".").sort(),d){for(c=w.event.special[d]||{},p=l[d=(r?c.delegateType:c.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=p.length;s--;)h=p[s],!n&&m!==h.origType||i&&i.guid!==h.guid||a&&!a.test(h.namespace)||r&&r!==h.selector&&("**"!==r||!h.selector)||(p.splice(s,1),h.selector&&p.delegateCount--,c.remove&&c.remove.call(e,h));o&&!p.length&&(c.teardown&&!1!==c.teardown.call(e,f,_.handle)||w.removeEvent(e,d,_.handle),delete l[d])}else for(d in l)w.event.remove(e,d+t[u],i,r,!0);w.isEmptyObject(l)&&g.remove(e,"handle events")}},dispatch:function(e){var t,i,r,n,s,o=w.event.fix(e),a=new Array(arguments.length),e=(g.get(this,"events")||{})[o.type]||[],l=w.event.special[o.type]||{};for(a[0]=o,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Le=/\s*$/g;function ze(e,t){return l(e,"table")&&l(11!==t.nodeType?t:t.firstChild,"tr")&&w(e).children("tbody")[0]||e}function Be(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ue(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function je(e,t){var i,r,n,s,o,a;if(1===t.nodeType){if(g.hasData(e)&&(s=g.access(e),o=g.set(t,s),a=s.events))for(n in delete o.handle,o.events={},a)for(i=0,r=a[n].length;i")},clone:function(e,t,i){var r,n,s,o,a,l,u,h=e.cloneNode(!0),c=w.contains(e.ownerDocument,e);if(!(_.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(o=A(h),r=0,n=(s=A(e)).length;r").prop({charset:i.scriptCharset,src:i.url}).on("load error",n=function(e){r.remove(),n=null,e&&t("error"===e.type?404:200,e.type)}),T.head.appendChild(r[0])},abort:function(){n&&n()}}}),[]),Vt=/(=)\?(?=&|$)|\?\?/,qt=(w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Wt.pop()||w.expando+"_"+St++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(e,t,i){var r,n,s,o=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(o||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return s||w.error(r+" was not called"),s[0]},e.dataTypes[0]="json",n=x[r],x[r]=function(){s=arguments},i.always(function(){void 0===n?w(x).removeProp(r):x[r]=n,e[r]&&(e.jsonpCallback=t.jsonpCallback,Wt.push(r)),s&&v(n)&&n(s[0]),s=n=void 0}),"script"}),_.createHTMLDocument=((e=T.implementation.createHTMLDocument("").body).innerHTML="
",2===e.childNodes.length),w.parseHTML=function(e,t,i){var r;return"string"!=typeof e?[]:("boolean"==typeof t&&(i=t,t=!1),t||(_.createHTMLDocument?((r=(t=T.implementation.createHTMLDocument("")).createElement("base")).href=T.location.href,t.head.appendChild(r)):t=T),r=!i&&[],(i=Q.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,r),r&&r.length&&w(r).remove(),w.merge([],i.childNodes)))},w.fn.load=function(e,t,i){var r,n,s,o=this,a=e.indexOf(" ");return-1").append(w.parseHTML(e)).find(r):e)}).always(i&&function(e,t){o.each(function(){i.apply(this,s||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(t){return w.grep(w.timers,function(e){return t===e.elem}).length},w.offset={setOffset:function(e,t,i){var r,n,s,o,a=w.css(e,"position"),l=w(e),u={};"static"===a&&(e.style.position="relative"),s=l.offset(),r=w.css(e,"top"),o=w.css(e,"left"),a=("absolute"===a||"fixed"===a)&&-1<(r+o).indexOf("auto")?(n=(a=l.position()).top,a.left):(n=parseFloat(r)||0,parseFloat(o)||0),null!=(t=v(t)?t.call(e,i,w.extend({},s)):t).top&&(u.top=t.top-s.top+n),null!=t.left&&(u.left=t.left-s.left+a),"using"in t?t.using.call(e,u):l.css(u)}},w.fn.extend({offset:function(t){var e,i;return arguments.length?void 0===t?this:this.each(function(e){w.offset.setOffset(this,t,e)}):(i=this[0])?i.getClientRects().length?(e=i.getBoundingClientRect(),i=i.ownerDocument.defaultView,{top:e.top+i.pageYOffset,left:e.left+i.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,i,r=this[0],n={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),i=r.ownerDocument,e=r.offsetParent||i.documentElement;e&&(e===i.body||e===i.documentElement)&&"static"===w.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((n=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),n.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-w.css(r,"marginTop",!0),left:t.left-n.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===w.css(e,"position");)e=e.offsetParent;return e||ke})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var s="pageYOffset"===n;w.fn[t]=function(e){return c(this,function(e,t,i){var r;if(m(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===i)return r?r[n]:e[t];r?r.scrollTo(s?r.pageXOffset:i,s?i:r.pageYOffset):e[t]=i},t,e,arguments.length)}}),w.each(["top","left"],function(e,i){w.cssHooks[i]=$e(_.pixelPosition,function(e,t){if(t)return t=O(e,i),Ze.test(t)?w(e).position()[i]+"px":t})}),w.each({Height:"height",Width:"width"},function(o,a){w.each({padding:"inner"+o,content:a,"":"outer"+o},function(r,s){w.fn[s]=function(e,t){var i=arguments.length&&(r||"boolean"!=typeof e),n=r||(!0===e||!0===t?"margin":"border");return c(this,function(e,t,i){var r;return m(e)?0===s.indexOf("outer")?e["inner"+o]:e.document.documentElement["client"+o]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+o],r["scroll"+o],e.body["offset"+o],r["offset"+o],r["client"+o])):void 0===i?w.css(e,t,n):w.style(e,t,i,n)},a,i?e:void 0,i)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,i){w.fn[i]=function(e,t){return 0this.updateCoord(e,a,"x");break;case"scaleY":case"skewY":n=i,s=i-(r=e[a=t.substr(0,t.length-1)].y),o=e=>this.updateCoord(e,a,"y");break;case"tint":case"blend":const l=Array.isArray(i)?i:[e.tint,i];r=0,s=n=l.length,o="tint"===t?e=>this.updateTint(e,l):e=>this.updateBlend(e,l);break;case"shake":r={x:e.x,y:e.y},n=i,o=e=>this.updateShake(e);break;case"position":r={x:e.x,y:e.y},s={x:(n={x:i.x,y:i.y}).x-r.x,y:n.y-r.y},o=e=>this.updatePosition(e);break;case"skew":case"scale":n=i,s=i-(r=e[t].x),o=e=>this.updatePoint(e,t);break;case"face":r=e.rotation,s=(n=u.shortestAngle(r,Math.atan2(i.y-e.y,i.x-e.x)))-r,o=e=>this.updateOne(e,"rotation");break;default:n=i,s=i-(r=e[t]),o=e=>this.updateOne(e,t)}this.eases.push({element:e,entry:t,update:o,start:r,to:n,delta:s})}static shortestAngle(e,t){var i=2*Math.PI,r=Math.abs(e-t)%i;return(r>Math.PI?i-r:r)*(0<((t-e+Math.PI)%i+i)%i-Math.PI?1:-1)}remove(t,i){if(0===arguments.length)this.eases=[];else{"string"==typeof i&&(i=[i]);for(let e=0;e>16)+i*(t>>16)<<16|o*(s>>8&255)+i*(t>>8&255)<<8|o*(255&s)+i*(255&t)}updateShake(e){function t(e){return Math.floor(Math.random()*e)-Math.floor(e/2)}e.element.x=e.start.x+t(e.to),e.element.y=e.start.y+t(e.to)}complete(e){"shake"===e.entry&&(e.element.x=e.start.x,e.element.y=e.start.y)}reverse(e){var t,i;"position"===e.entry?(i=e.to.x,t=e.to.y,e.to.x=e.start.x,e.to.y=e.start.y,e.start.x=i,e.start.y=t,e.delta.x=-e.delta.x,e.delta.y=-e.delta.y):(i=e.to,e.to=e.start,e.start=i,e.delta=-e.delta)}repeat(e){switch(e.entry){case"skewX":e.element.skew.x=e.start;break;case"skewY":e.element.skew.y=e.start;break;case"skew":e.element.skew.x=e.start,e.element.skew.y=e.start;break;case"scaleX":e.element.scale.x=e.start;break;case"scaleY":e.element.scale.y=e.start;break;case"scale":e.element.scale.x=e.start,e.element.scale.y=e.start;break;case"position":e.element.x=e.start.x,e.element.y=e.start.y;break;default:e.element[e.entry]=e.start}}update(e){if(0===this.eases.length)return!0;if(this.options.wait){if(this.options.wait-=e,0=this.options.duration&&(t=this.time-this.options.duration,this.time=this.options.duration);for(let e=0;e=this.options.duration)if(this.options.reverse)this.eases.forEach(e=>this.reverse(e)),(this.time=t)&&this.eases.forEach(e=>e.update(e)),this.emit("reverse",this),this.options.repeat?!0!==this.options.repeat&&this.options.repeat--:this.options.reverse=!1;else{if(!this.options.repeat)return this.eases.forEach(e=>this.complete(e)),this.emit("complete",this),!0;this.eases.forEach(e=>this.repeat(e)),(this.time=t)&&this.eases.forEach(e=>e.update(e)),!0!==this.options.repeat&&this.options.repeat--,this.emit("repeat",this)}}get count(){return this.eases.length}}const s={duration:1e3,ease:r.easeInOutSine,maxFrame:1e3/60,ticker:null,useRAF:!0};class o extends n{constructor(e){super(),this.options=Object.assign({},s,e),this.easings=[],this.empty=!0,this.options.ticker&&this.options.ticker.add(this.update,this)}destroy(){this.removeAll(),this.options.useTicker?this.ticker.remove(this.update,this):this.options.useRAF&&(cancelAnimationFrame(this.handleRAF),this.handleRAF=null)}add(e,t,i){(i=i||{}).duration=(void 0!==i.duration?i:this.options).duration,i.ease=i.ease||this.options.ease,"string"==typeof i.ease&&(i.ease=r[i.ease]);e=new u(e,t,i);return this.easings.push(e),this.empty&&this.options.useRAF&&(this.handleRAF=requestAnimationFrame(()=>this.update()),this.lastTime=Date.now()),this.empty=!1,e}target(e,t,i,r){i=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))/i;return(r=r||{}).duration=i,this.add(e,{x:t.x,y:t.y},r)}face(e,t,i,r){t=u.shortestAngle(e.rotation,Math.atan2(t.y-e.y,t.x-e.x)),i=Math.abs(t-e.rotation)/i;return(r=r||{}).duration=i,this.add(e,{rotation:t},r)}removeEase(t,i){for(let e=0;ethis.update()):this.handleRAF=null}get count(){return this.easings.length}countRunning(){let e=0;for(var t of this.easings)e+=t.count;return e}set duration(e){this.options.duration=e}get duration(){return this.options.duration}set ease(e){this.options.ease=e}get ease(){return this.options.ease}}o.id=0;n=new o;o.ease=n,e.Ease=o,e.List=class{constructor(){console.warn("Ease.List was deprecated. Use new Ease() instead.")}},e.ease=n,Object.defineProperty(e,"__esModule",{value:!0})}),this.PIXI=this.PIXI||{},!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pixi/math"),require("@pixi/display"),require("@pixi/ticker")):"function"==typeof define&&define.amd?define(["exports","@pixi/math","@pixi/display","@pixi/ticker"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pixi_viewport={},e.PIXI,e.PIXI,e.PIXI)}(this,function(e,a,t,i){"use strict";class r{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(function(t){!function(){var n={linear:function(e,t,i,r){return i*e/r+t},easeInQuad:function(e,t,i,r){return i*(e/=r)*e+t},easeOutQuad:function(e,t,i,r){return-i*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,i,r){return(e/=r/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,i,r){return i*(e/=r)*e*e+t},easeOutCubic:function(e,t,i,r){return i*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,i,r){return(e/=r/2)<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,i,r){return i*(e/=r)*e*e*e+t},easeOutQuart:function(e,t,i,r){return-i*((e=e/r-1)*e*e*e-1)+t},easeInOutQuart:function(e,t,i,r){return(e/=r/2)<1?i/2*e*e*e*e+t:-i/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,i,r){return i*(e/=r)*e*e*e*e+t},easeOutQuint:function(e,t,i,r){return i*((e=e/r-1)*e*e*e*e+1)+t},easeInOutQuint:function(e,t,i,r){return(e/=r/2)<1?i/2*e*e*e*e*e+t:i/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,i,r){return-i*Math.cos(e/r*(Math.PI/2))+i+t},easeOutSine:function(e,t,i,r){return i*Math.sin(e/r*(Math.PI/2))+t},easeInOutSine:function(e,t,i,r){return-i/2*(Math.cos(Math.PI*e/r)-1)+t},easeInExpo:function(e,t,i,r){return 0===e?t:i*Math.pow(2,10*(e/r-1))+t},easeOutExpo:function(e,t,i,r){return e===r?t+i:i*(1-Math.pow(2,-10*e/r))+t},easeInOutExpo:function(e,t,i,r){return(e/=r/2)<1?i/2*Math.pow(2,10*(e-1))+t:i/2*(2-Math.pow(2,-10*--e))+t},easeInCirc:function(e,t,i,r){return-i*(Math.sqrt(1-(e/=r)*e)-1)+t},easeOutCirc:function(e,t,i,r){return i*Math.sqrt(1-(e=e/r-1)*e)+t},easeInOutCirc:function(e,t,i,r){return(e/=r/2)<1?-i/2*(Math.sqrt(1-e*e)-1)+t:i/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(e,t,i,r){var n=1.70158,s=0,o=i;return 0!==e&&(e/=r),s=s||.3*r,n=o=this.options.time?(t=this.parent.width,i=this.parent.height,this.complete(),t===this.parent.width&&i===this.parent.height||this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})):(t=this.options.ease(this.time,0,1,this.options.time),null!==this.width&&(i=this.startWidth,r=this.deltaWidth,this.parent.fitWidth(i+r*t,this.keepCenter,null===this.height)),null!==this.height&&(i=this.startHeight,r=this.deltaHeight,this.parent.fitHeight(i+r*t,this.keepCenter,null===this.width)),null===this.width?this.parent.scale.x=this.parent.scale.y:null===this.height&&(this.parent.scale.y=this.parent.scale.x),this.keepCenter||(i=this.startX,r=this.startY,n=this.deltaX,s=this.deltaY,o=new a.Point(this.parent.x,this.parent.y),this.parent.moveCenter(i+n*t,r+s*t),this.parent.emit("moved",{viewport:this.parent,original:o,type:"animate"})),(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})))}}function p(e){let t=void 0,i=e[0],r=1;for(;ri.call(t,...e)),t=void 0)}return i}const d={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class f extends r{constructor(e,t={}){super(e),this.options=Object.assign({},d,t),this.ease=u(this.options.ease,"easeInOutSine"),this.options.sides?"all"===this.options.sides?this.top=this.bottom=this.left=this.right=!0:"horizontal"===this.options.sides?(this.right=this.left=!0,this.top=this.bottom=!1):"vertical"===this.options.sides?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=-1!==this.options.sides.indexOf("top"),this.bottom=-1!==this.options.sides.indexOf("bottom"),this.left=-1!==this.options.sides.indexOf("left"),this.right=-1!==this.options.sides.indexOf("right")):this.left=this.top=this.right=this.bottom=!1;e=this.options.underflow.toLowerCase();"center"===e?(this.underflowX=0,this.underflowY=0):(this.underflowX=-1!==e.indexOf("left")?-1:-1!==e.indexOf("right")?1:0,this.underflowY=-1!==e.indexOf("top")?-1:-1!==e.indexOf("bottom")?1:0),this.reset()}isActive(){return null!==this.toX||null!==this.toY}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(e){var t;this.paused||(this.bounce(),this.toX&&((t=this.toX).time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),t.time>=this.options.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.options.time)),this.toY&&((t=this.toY).time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.options.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.options.time)))}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){var e,t,i,r=this.options.bounceBox;return r?(e=void 0===r.x?0:r.x,t=void 0===r.y?0:r.y,i=void 0===r.width?this.parent.worldWidth:r.width,r=void 0===r.height?this.parent.worldHeight:r.height,{left:this.parent.lefti,top:this.parent.topr,topLeft:new a.Point(e*this.parent.scale.x,t*this.parent.scale.y),bottomRight:new a.Point(i*this.parent.scale.x-this.parent.screenWidth,r*this.parent.scale.y-this.parent.screenHeight)}):{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new a.Point(0,0),bottomRight:new a.Point(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(!this.paused){let t,e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.x&&e.percentChangeX===p([e,"access",e=>e.options,"optionalAccess",e=>e.friction])||e.y&&e.percentChangeY===p([e,"access",e=>e.options,"optionalAccess",e=>e.friction]))&&(((t=this.oob()).left&&this.left||t.right&&this.right)&&(e.percentChangeX=this.options.friction),(t.top&&this.top||t.bottom&&this.bottom)&&(e.percentChangeY=this.options.friction));var i=this.parent.plugins.get("drag",!0)||{},r=this.parent.plugins.get("pinch",!0)||{};if(e=e||{},!(p([i,"optionalAccess",e=>e.active])||p([r,"optionalAccess",e=>e.active])||this.toX&&this.toY||e.x&&e.y)){i=(t=t||this.oob()).topLeft,r=t.bottomRight;if(!this.toX&&!e.x){let e=null;t.left&&this.left?e=this.parent.screenWorldWidth(!0===this.options.right?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(!0===this.options.right?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,i.x=0,e=!0);e&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(null!==this.options.top||null!==this.options.bottom){let e=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight(!0===this.options.bottom?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(!0===this.options.bottom?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,i.y=0,e=!0);e&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}}reset(){this.update()}}const g={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class v extends r{constructor(e,t={}){super(e),this.options=Object.assign({},g,t),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused)if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight;null!==this.options.minWidth&&ethis.options.maxWidth&&(r=this.parent.scale.x,this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/r,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})),null!==this.options.minHeight&&tthis.options.maxHeight&&(r=this.parent.scale.y,this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/r,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}else if(this.options.minScale||this.options.maxScale){var i,r={x:null,y:null},n={x:null,y:null};"number"==typeof this.options.minScale?(r.x=this.options.minScale,r.y=this.options.minScale):null!==this.options.minScale&&(i=this.options.minScale,r.x=void 0===i.x?null:i.x,r.y=void 0===i.y?null:i.y),"number"==typeof this.options.maxScale?(n.x=this.options.maxScale,n.y=this.options.maxScale):null!==this.options.maxScale&&(i=this.options.maxScale,n.x=void 0===i.x?null:i.x,n.y=void 0===i.y?null:i.y);let e=this.parent.scale.x,t=this.parent.scale.y;null!==r.x&&en.x&&(e=n.x),null!==r.y&&tn.y&&(t=n.y),e===this.parent.scale.x&&t===this.parent.scale.y||(this.parent.scale.set(e,t),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}reset(){this.clamp()}}const y={friction:.98,bounce:.8,minSpeed:.01};class b extends r{constructor(e,t={}){super(e),this.options=Object.assign({},y,t),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",e=>this.moved(e))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!(!this.x&&!this.y)}move(){var e;return this.paused||(1===(e=this.parent.input.count())||1=e-100){var t=e-i.time;this.x=(this.parent.x-i.x)/t,this.y=(this.parent.y-i.y)/t,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){void 0!==(e=e||{}).x&&(this.x=e.x,this.percentChangeX=this.options.friction),void 0!==e.y&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){var t,i,r,n,s;this.paused||(t=this.x||this.y,i=this.timeSinceRelease,r=this.timeSinceRelease+e,this.x&&(s=this.percentChangeX,n=Math.log(s),this.parent.x+=16*this.x/n*(Math.pow(s,r/16)-Math.pow(s,i/16)),this.x*=Math.pow(this.percentChangeX,e/16)),this.y&&(n=this.percentChangeY,s=Math.log(n),this.parent.y+=16*this.y/s*(Math.pow(n,r/16)-Math.pow(n,i/16)),this.y*=Math.pow(this.percentChangeY,e/16)),this.timeSinceRelease+=e,this.x&&this.y?Math.abs(this.x){t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}mouseButtons(e){this.mouse=e&&"all"!==e?[-1!==e.indexOf("left"),-1!==e.indexOf("middle"),-1!==e.indexOf("right")]:[!0,!0,!0]}parseUnderflow(){var e=this.options.underflow.toLowerCase();"center"===e?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){var t="mouse"===e.data.pointerType,i=this.parent.input.count();return!(!(1===i||1this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if("x"!==this.options.clampWheel)if(this.parent.screenWorldHeightthis.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const w={speed:0,acceleration:null,radius:null};class E extends r{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},w,i),this.velocity={x:0,y:0}}update(i){if(!this.paused){var r=this.parent.center;let e=this.target.x,t=this.target.y;if(this.options.radius){if(!(Math.sqrt(Math.pow(this.target.y-r.y,2)+Math.pow(this.target.x-r.x,2))>this.options.radius))return;var n=Math.atan2(this.target.y-r.y,this.target.x-r.x);e=this.target.x-Math.cos(n)*this.options.radius,t=this.target.y-Math.sin(n)*this.options.radius}var s,o,a,n=e-r.x,l=t-r.y;(n||l)&&(this.options.speed?this.options.acceleration?(o=Math.atan2(t-r.y,e-r.x),(s=Math.sqrt(Math.pow(n,2)+Math.pow(l,2)))&&(a=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration),this.velocity=aMath.abs(n)?e:r.x+a,o=Math.abs(s)>Math.abs(l)?t:r.y+s,this.parent.moveCenter(i,o),this.parent.emit("moved",{viewport:this.parent,type:"follow"}))):(a=Math.atan2(t-r.y,e-r.x),s=Math.cos(a)*this.options.speed,i=Math.sin(a)*this.options.speed,o=Math.abs(s)>Math.abs(n)?e:r.x+s,a=Math.abs(i)>Math.abs(l)?t:r.y+i,this.parent.moveCenter(o,a),this.parent.emit("moved",{viewport:this.parent,type:"follow"})):(this.parent.moveCenter(e,t),this.parent.emit("moved",{viewport:this.parent,type:"follow"})))}}}const S={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class A extends r{constructor(e,t={}){super(e),this.options=Object.assign({},S,t),this.reverse=this.options.reverse?1:-1,this.radiusSquared="number"==typeof this.options.radius?Math.pow(this.options.radius,2):null,this.resize()}resize(){var e=this.options.distance;null!==e?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=null===this.options.right?null:this.parent.screenWidth-this.options.right,this.bottom=null===this.options.bottom?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(e){var t,i;return this.paused||"mouse"!==e.data.pointerType&&1!==e.data.identifier||!this.options.allowButtons&&0!==e.data.buttons||(t=e.data.global.x,e=e.data.global.y,this.radiusSquared?(i=this.parent.toScreen(this.parent.center),Math.pow(i.x-t,2)+Math.pow(i.y-e,2)>=this.radiusSquared?(i=Math.atan2(i.y-e,i.x-t),this.options.linear?(this.horizontal=Math.round(Math.cos(i))*this.options.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(i))*this.options.speed*this.reverse*.06):(this.horizontal=Math.cos(i)*this.options.speed*this.reverse*.06,this.vertical=Math.sin(i)*this.options.speed*this.reverse*.06)):(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0)):(null!==this.left&&tthis.right?this.horizontal=-1*this.reverse*this.options.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),null!==this.top&&ethis.bottom?this.vertical=-1*this.reverse*this.options.speed*.06:(this.decelerateVertical(),this.vertical=0))),!1}decelerateHorizontal(){var e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){var e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){var e;this.paused||(this.horizontal||this.vertical)&&(e=this.parent.center,this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"}))}}const F={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class k extends r{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),k.prototype.__init.call(this),k.prototype.__init2.call(this),k.prototype.__init3.call(this),this.options=Object.assign({},F,t)}down(){return 2<=this.parent.input.count()&&(this.active=!0)}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(i){if(!this.paused&&this.active){var r=i.data.global.x,n=i.data.global.y,s=this.parent.input.touches;if(2<=s.length){var o=s[0],s=s[1],a=o.last&&s.last?Math.sqrt(Math.pow(s.last.x-o.last.x,2)+Math.pow(s.last.y-o.last.y,2)):null;if(o.id===i.data.pointerId?o.last={x:r,y:n,data:i.data}:s.id===i.data.pointerId&&(s.last={x:r,y:n,data:i.data}),a){let e;r={x:o.last.x+(s.last.x-o.last.x)/2,y:o.last.y+(s.last.y-o.last.y)/2};this.options.center||(e=this.parent.toLocal(r));let t=Math.sqrt(Math.pow(s.last.x-o.last.x,2)+Math.pow(s.last.y-o.last.y,2));n=(1-a/(t=0===t?t=1e-10:t))*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y),i=(this.isAxisX()&&(this.parent.scale.x+=n),this.isAxisY()&&(this.parent.scale.y+=n),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:r}),this.parent.plugins.get("clamp-zoom",!0));i&&i.clamp(),this.options.center?this.parent.moveCenter(this.options.center):(s=this.parent.toGlobal(e),this.parent.x+=(r.x-s.x)*this.options.factor,this.parent.y+=(r.y-s.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(r.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(r.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=r,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}}return!1}up(){return!!(this.pinching&&this.parent.input.touches.length<=1)&&(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0)}}const N={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class P extends r{constructor(e,t,i,r={}){super(e),this.options=Object.assign({},N,r),this.ease=u(r.ease,"easeInOutSine"),this.x=t,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};var e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){var e;return 0===this.parent.input.count()&&(e=this.parent.plugins.get("decelerate",!0))&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction),!1}update(r){if(!(this.paused||this.options.interrupt&&0!==this.parent.input.count()))if(this.snapping){var n=this.snapping;n.time+=r;let e,t,i;var r=this.startX,s=this.startY,o=this.deltaX,a=this.deltaY;i=n.time>this.options.time?(e=!0,t=r+o,s+a):(n=this.ease(n.time,0,1,this.options.time),t=r+o*n,s+a*n),this.options.topLeft?this.parent.moveCorner(t,i):this.parent.moveCenter(t,i),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),e&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{r=this.options.topLeft?this.parent.corner:this.parent.center;r.x===this.x&&r.y===this.y||this.snapStart()}}}const z={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class O extends r{constructor(e,t={}){super(e),this.options=Object.assign({},z,t),this.ease=u(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,(this.yScale=0)=this.options.time?(this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null):(t=this.snapping,i=this.ease(t.time,t.startX,t.deltaX,this.options.time),t=this.ease(t.time,t.startY,t.deltaY,this.options.time),this.parent.scale.x=this.parent.screenWidth/i,this.parent.scale.y=this.parent.screenHeight/t),(i=this.parent.plugins.get("clamp-zoom",!0))&&i.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))):this.parent.scale.x===this.xScale&&this.parent.scale.y===this.yScale||this.createSnapping()}}resume(){this.snapping=null,super.resume()}}const B={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class R extends r{constructor(e,t={}){super(e),this.options=Object.assign({},B,t),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){var t=this.smoothingCenter,i=this.smoothing;let e;this.options.center||(e=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=i.x),this.isAxisY()&&(this.parent.scale.y+=i.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});var i=this.parent.plugins.get("clamp-zoom",!0);i&&i.clamp(),this.options.center?this.parent.moveCenter(this.options.center):(i=this.parent.toGlobal(e),this.parent.x+=t.x-i.x,this.parent.y+=t.y-i.y),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(!this.paused){var i=this.parent.input.getPointerPosition(t),r=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,r=Math.pow(2,(1+this.options.percent)*r);let e;this.options.center||(e=this.parent.toLocal(i)),this.isAxisX()&&(this.parent.scale.x*=r),this.isAxisY()&&(this.parent.scale.y*=r),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});r=this.parent.plugins.get("clamp-zoom",!0);r&&r.clamp(),this.options.center?this.parent.moveCenter(this.options.center):(r=this.parent.toGlobal(e),this.parent.x+=i.x-r.x,this.parent.y+=i.y-r.y),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:t.deltaX,dy:t.deltaY,dz:t.deltaZ},event:t,viewport:this.parent})}}wheel(e){if(this.paused)return!1;if(!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){var t=this.parent.input.getPointerPosition(e),i=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,i=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){var r={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+r.x)*i-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+r.y)*i-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let e;this.options.center||(e=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=i),this.isAxisY()&&(this.parent.scale.y*=i),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});r=this.parent.plugins.get("clamp-zoom",!0);r&&r.clamp(),this.options.center?this.parent.moveCenter(this.options.center):(i=this.parent.toGlobal(e),this.parent.x+=t.x-i.x,this.parent.y+=t.y-i.y)}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class C{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new a.Rectangle(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){var t,i;!this.viewport.pause&&this.viewport.worldVisible&&("mouse"===e.data.pointerType?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),1!==this.count()||(this.last=e.data.global.clone(),t=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0),t&&t.isActive()||i&&i.isActive())?this.clickedAvailable=!1:this.clickedAvailable=!0,this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation())}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){var t,i,r;!this.viewport.pause&&this.viewport.worldVisible&&(t=this.viewport.plugins.move(e),this.clickedAvailable&&this.last&&(i=e.data.global.x-this.last.x,r=e.data.global.y-this.last.y,(this.checkThreshold(i)||this.checkThreshold(r))&&(this.clickedAvailable=!1)),t&&this.viewport.options.stopPropagation&&e.stopPropagation())}up(e){var t;!this.viewport.pause&&this.viewport.worldVisible&&("mouse"===e.data.pointerType&&(this.isMouseDown=!1),"mouse"!==e.data.pointerType&&this.remove(e.data.pointerId),t=this.viewport.plugins.up(e),this.clickedAvailable&&0===this.count()&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),t&&this.viewport.options.stopPropagation&&e.stopPropagation())}getPointerPosition(e){var t,i=new a.Point;return this.viewport.options.interaction?this.viewport.options.interaction.mapPositionToPoint(i,e.clientX,e.clientY):this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel?(t=this.viewport.options.divWheel.getBoundingClientRect(),i.x=e.clientX-t.left,i.y=e.clientY-t.top):(i.x=e.clientX,i.y=e.clientY),i}handleWheel(e){var t;this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target||(t=this.viewport.toLocal(this.getPointerPosition(e)),this.viewport.left<=t.x&&t.x<=this.viewport.right&&this.viewport.top<=t.y&&t.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault())}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const t of this.touches)if(t.id===e)return t;return null}remove(t){for(let e=0;ei.call(t,...e)),t=void 0)}return i}const I=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class D{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=I.length){this.plugins[e]=t;t=I.indexOf(e);-1!==t&&I.splice(t,1),I.splice(i,0,e),this.sort()}get(t,e){return e&&M([this,"access",e=>e.plugins,"access",e=>e[t],"optionalAccess",e=>e.paused])?null:this.plugins[t]}update(e){for(const t of this.list)t.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.plugins={},this.sort()}remove(e){this.plugins[e]&&(delete this.plugins[e],this.viewport.emit(e+"-remove"),this.sort())}pause(t){M([this,"access",e=>e.plugins,"access",e=>e[t],"optionalAccess",e=>e.pause,"call",e=>e()])}resume(t){M([this,"access",e=>e.plugins,"access",e=>e[t],"optionalAccess",e=>e.resume,"call",e=>e()])}sort(){this.list=[];for(const e of I)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let t=!1;for(const i of this.list)i.down(e)&&(t=!0);return t}move(e){let t=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(t=!0);return t}up(e){let t=!1;for(const i of this.list)i.up(e)&&(t=!0);return t}wheel(e){let t=!1;for(const i of this.list)i.wheel(e)&&(t=!0);return t}}const U={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:i.Ticker.shared};class L extends t.Container{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),L.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},U,e),this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new C(this),this.plugins=new D(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new a.Rectangle(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(e=window.innerWidth,t=window.innerHeight,i,r){this.screenWidth=e,this.screenHeight=t,void 0!==i&&(this._worldWidth=i),void 0!==r&&(this._worldHeight=r),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth||this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight||this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new a.Rectangle(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return 2===arguments.length?this.toLocal(new a.Point(e,t)):this.toLocal(e)}toScreen(e,t){return 2===arguments.length?this.toGlobal(new a.Point(e,t)):this.toGlobal(e)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new a.Point(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let t,i;i="number"==typeof e[0]?(t=e[0],e[1]):(t=e[0].x,e[0].y);var e=(this.worldScreenWidth/2-t)*this.scale.x,r=(this.worldScreenHeight/2-i)*this.scale.y;return this.x===e&&this.y===r||(this.position.set(e,r),this.plugins.reset(),this.dirty=!0),this}get corner(){return new a.Point(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let t,i;return i=1===e.length?(t=-e[0].x*this.scale.x,-e[0].y*this.scale.y):(t=-e[0]*this.scale.x,-e[1]*this.scale.y),t===this.x&&i===this.y||(this.position.set(t,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,t){e=this.screenWidth/e,t=this.screenHeight/t;return Math.min(e,t)}findCover(e,t){e=this.screenWidth/e,t=this.screenHeight/t;return Math.max(e,t)}fitWidth(e=this.worldWidth,t,i=!0,r){let n;t&&(n=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);e=this.plugins.get("clamp-zoom",!0);return!r&&e&&e.clamp(),t&&n&&this.moveCenter(n),this}fitHeight(e=this.worldHeight,t,i=!0,r){let n;t&&(n=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);e=this.plugins.get("clamp-zoom",!0);return!r&&e&&e.clamp(),t&&n&&this.moveCenter(n),this}fitWorld(e){let t;e&&(t=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.xthis.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new a.Point(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new a.Rectangle(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new T(this,e)),this}clamp(e){return this.plugins.add("clamp",new _(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new b(this,e)),this}bounce(e){return this.plugins.add("bounce",new f(this,e)),this}pinch(e){return this.plugins.add("pinch",new k(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new P(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new E(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new R(this,e)),this}animate(e){return this.plugins.add("animate",new c(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new v(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new A(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,t,i,r,n){n&&(i>this.worldScreenWidth||r>this.worldScreenHeight)&&(this.fit(!0,i,r),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let s=!1;ethis.right&&(this.right=e+i,s=!0),tthis.bottom&&(this.bottom=t+r,s=!0),s&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}e.Animate=c,e.Bounce=f,e.Clamp=_,e.ClampZoom=v,e.Decelerate=b,e.Drag=T,e.Follow=E,e.InputManager=C,e.MouseEdges=A,e.Pinch=k,e.Plugin=r,e.PluginManager=D,e.Snap=P,e.SnapZoom=O,e.Viewport=L,e.Wheel=R,Object.defineProperty(e,"__esModule",{value:!0})}),"undefined"!=typeof pixi_viewport&&Object.assign(this.PIXI,pixi_viewport),!function(){"use strict";var h=new("undefined"==typeof WebKitCSSMatrix?DOMMatrix:WebKitCSSMatrix);function c(e,t,i){this.x=e,this.y=t,this.z=i}function r(e){for(var t=h,i=e;null!=i&&i!==i.ownerDocument.documentElement;)var r=window.getComputedStyle(i,void 0).transform||"none",t=("none"===r?h:function(t){try{return new("undefined"==typeof WebKitCSSMatrix?DOMMatrix:WebKitCSSMatrix)(t)}catch(e){return console.warn(t),console.warn(e.toString()),h}}(r)).multiply(t),i=i.parentNode;for(var n=e.offsetWidth,s=e.offsetHeight,o=4,a=1/0,l=1/0;0<=--o;){var u=new c(0===o||1===o?0:n,0===o||3===o?0:s,0).transformBy(t);u.xt&&(i[r]=this.hyphenate(i[r]).join("­"));return i.join("")},t.prototype.hyphenate=function(e){var t,i,r,n,s,o,a,l,u,h=[],c=[],p=e.toLowerCase(),d=Math.max,f=this.trie,m=[""];if(this.exceptions.hasOwnProperty(p))return e.match(this.exceptions[p]).slice(1);if(-1!==e.indexOf("­"))return[e];for(t=(e="_"+e+"_").toLowerCase().split(""),i=e.split(""),a=t.length,r=0;rthis.leftMin&&r>} - */ - this.exceptions = {}; - - if (language['exceptions']) { - exceptions = language['exceptions'].split(/,\s?/g); - - for (; i < exceptions.length; i += 1) { - this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp('(' + exceptions[i].split('\u2027').join(')(') + ')', 'i'); - } +;(function () { + var module = { + exports: null, } -} + /** + * @constructor + * @param {!{patterns: !Object, leftmin: !number, rightmin: !number}} language The language pattern file. Compatible with Hyphenator.js. + */ + function Hypher(language) { + var exceptions = [], + i = 0 + /** + * @type {!Hypher.TrieNode} + */ + this.trie = this.createTrie(language['patterns']) -/** - * @typedef {{_points: !Array.}} - */ -Hypher.TrieNode; + /** + * @type {!number} + * @const + */ + this.leftMin = language['leftmin'] -/** - * Creates a trie from a language pattern. - * @private - * @param {!Object} patternObject An object with language patterns. - * @return {!Hypher.TrieNode} An object trie. - */ -Hypher.prototype.createTrie = function (patternObject) { - var size = 0, - i = 0, - c = 0, - p = 0, - chars = null, - points = null, - codePoint = null, - t = null, - tree = { - _points: [] - }, - patterns; + /** + * @type {!number} + * @const + */ + this.rightMin = language['rightmin'] - for (size in patternObject) { - if (patternObject.hasOwnProperty(size)) { - patterns = patternObject[size].match(new RegExp('.{1,' + (+size) + '}', 'g')); + /** + * @type {!Object.>} + */ + this.exceptions = {} - for (i = 0; i < patterns.length; i += 1) { - chars = patterns[i].replace(/[0-9]/g, '').split(''); - points = patterns[i].split(/\D/); - t = tree; + if (language['exceptions']) { + exceptions = language['exceptions'].split(/,\s?/g) - for (c = 0; c < chars.length; c += 1) { - codePoint = chars[c].charCodeAt(0); - - if (!t[codePoint]) { - t[codePoint] = {}; - } - t = t[codePoint]; - } - - t._points = []; - - for (p = 0; p < points.length; p += 1) { - t._points[p] = points[p] || 0; - } + for (; i < exceptions.length; i += 1) { + this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp( + '(' + exceptions[i].split('\u2027').join(')(') + ')', + 'i' + ) } } } - return tree; -}; -/** - * Hyphenates a text. - * - * @param {!string} str The text to hyphenate. - * @return {!string} The same text with soft hyphens inserted in the right positions. - */ -Hypher.prototype.hyphenateText = function (str, minLength) { - minLength = minLength || 4; + /** + * @typedef {{_points: !Array.}} + */ + Hypher.TrieNode - // Regexp("\b", "g") splits on word boundaries, - // compound separators and ZWNJ so we don't need - // any special cases for those characters. Unfortunately - // it does not support unicode word boundaries, so - // we implement it manually. - var words = str.split(/([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g); + /** + * Creates a trie from a language pattern. + * @private + * @param {!Object} patternObject An object with language patterns. + * @return {!Hypher.TrieNode} An object trie. + */ + Hypher.prototype.createTrie = function (patternObject) { + var size = 0, + i = 0, + c = 0, + p = 0, + chars = null, + points = null, + codePoint = null, + t = null, + tree = { + _points: [], + }, + patterns - for (var i = 0; i < words.length; i += 1) { - if (words[i].indexOf('/') !== -1) { - // Don't insert a zero width space if the slash is at the beginning or end - // of the text, or right after or before a space. - if (i !== 0 && i !== words.length - 1 && !(/\s+\/|\/\s+/.test(words[i]))) { - words[i] += '\u200B'; - } - } else if (words[i].length > minLength) { - words[i] = this.hyphenate(words[i]).join('\u00AD'); - } - } - return words.join(''); -}; + for (size in patternObject) { + if (patternObject.hasOwnProperty(size)) { + patterns = patternObject[size].match(new RegExp('.{1,' + +size + '}', 'g')) -/** - * Hyphenates a word. - * - * @param {!string} word The word to hyphenate - * @return {!Array.} An array of word fragments indicating valid hyphenation points. - */ -Hypher.prototype.hyphenate = function (word) { - var characters, - characterPoints = [], - originalCharacters, - i, - j, - k, - node, - points = [], - wordLength, - lowerCaseWord = word.toLowerCase(), - nodePoints, - nodePointsLength, - m = Math.max, - trie = this.trie, - result = ['']; + for (i = 0; i < patterns.length; i += 1) { + chars = patterns[i].replace(/[0-9]/g, '').split('') + points = patterns[i].split(/\D/) + t = tree - if (this.exceptions.hasOwnProperty(lowerCaseWord)) { - return word.match(this.exceptions[lowerCaseWord]).slice(1); - } + for (c = 0; c < chars.length; c += 1) { + codePoint = chars[c].charCodeAt(0) - if (word.indexOf('\u00AD') !== -1) { - return [word]; - } + if (!t[codePoint]) { + t[codePoint] = {} + } + t = t[codePoint] + } - word = '_' + word + '_'; + t._points = [] - characters = word.toLowerCase().split(''); - originalCharacters = word.split(''); - wordLength = characters.length; - - for (i = 0; i < wordLength; i += 1) { - points[i] = 0; - characterPoints[i] = characters[i].charCodeAt(0); - } - - for (i = 0; i < wordLength; i += 1) { - node = trie; - for (j = i; j < wordLength; j += 1) { - node = node[characterPoints[j]]; - - if (node) { - nodePoints = node._points; - if (nodePoints) { - for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) { - points[i + k] = m(points[i + k], nodePoints[k]); + for (p = 0; p < points.length; p += 1) { + t._points[p] = points[p] || 0 } } + } + } + return tree + } + + /** + * Hyphenates a text. + * + * @param {!string} str The text to hyphenate. + * @return {!string} The same text with soft hyphens inserted in the right positions. + */ + Hypher.prototype.hyphenateText = function (str, minLength) { + minLength = minLength || 4 + + // Regexp("\b", "g") splits on word boundaries, + // compound separators and ZWNJ so we don't need + // any special cases for those characters. Unfortunately + // it does not support unicode word boundaries, so + // we implement it manually. + var words = str.split( + /([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g + ) + + for (var i = 0; i < words.length; i += 1) { + if (words[i].indexOf('/') !== -1) { + // Don't insert a zero width space if the slash is at the beginning or end + // of the text, or right after or before a space. + if (i !== 0 && i !== words.length - 1 && !/\s+\/|\/\s+/.test(words[i])) { + words[i] += '\u200B' + } + } else if (words[i].length > minLength) { + words[i] = this.hyphenate(words[i]).join('\u00AD') + } + } + return words.join('') + } + + /** + * Hyphenates a word. + * + * @param {!string} word The word to hyphenate + * @return {!Array.} An array of word fragments indicating valid hyphenation points. + */ + Hypher.prototype.hyphenate = function (word) { + var characters, + characterPoints = [], + originalCharacters, + i, + j, + k, + node, + points = [], + wordLength, + lowerCaseWord = word.toLowerCase(), + nodePoints, + nodePointsLength, + m = Math.max, + trie = this.trie, + result = [''] + + if (this.exceptions.hasOwnProperty(lowerCaseWord)) { + return word.match(this.exceptions[lowerCaseWord]).slice(1) + } + + if (word.indexOf('\u00AD') !== -1) { + return [word] + } + + word = '_' + word + '_' + + characters = word.toLowerCase().split('') + originalCharacters = word.split('') + wordLength = characters.length + + for (i = 0; i < wordLength; i += 1) { + points[i] = 0 + characterPoints[i] = characters[i].charCodeAt(0) + } + + for (i = 0; i < wordLength; i += 1) { + node = trie + for (j = i; j < wordLength; j += 1) { + node = node[characterPoints[j]] + + if (node) { + nodePoints = node._points + if (nodePoints) { + for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) { + points[i + k] = m(points[i + k], nodePoints[k]) + } + } + } else { + break + } + } + } + + for (i = 1; i < wordLength - 1; i += 1) { + if (i > this.leftMin && i < wordLength - this.rightMin && points[i] % 2) { + result.push(originalCharacters[i]) } else { - break; + result[result.length - 1] += originalCharacters[i] } } + + return result } - for (i = 1; i < wordLength - 1; i += 1) { - if (i > this.leftMin && i < (wordLength - this.rightMin) && points[i] % 2) { - result.push(originalCharacters[i]); - } else { - result[result.length - 1] += originalCharacters[i]; - } - } + module.exports = Hypher + window['Hypher'] = module.exports - return result; -}; - -module.exports = Hypher; -window['Hypher'] = module.exports; - -window['Hypher']['languages'] = {}; -}());(function ($) { + window['Hypher']['languages'] = {} +})() +;(function ($) { $.fn.hyphenate = function (language) { if (window['Hypher']['languages'][language]) { return this.each(function () { - var i = 0, len = this.childNodes.length; + var i = 0, + len = this.childNodes.length for (; i < len; i += 1) { if (this.childNodes[i].nodeType === 3) { - this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText(this.childNodes[i].nodeValue); + this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText( + this.childNodes[i].nodeValue + ) } } - }); + }) } - }; -}(jQuery)); \ No newline at end of file + } +})(jQuery) diff --git a/lib/3rdparty/pixi-ease.js b/lib/3rdparty/pixi-ease.js index 201fb85..f3e1ac0 100644 --- a/lib/3rdparty/pixi-ease.js +++ b/lib/3rdparty/pixi-ease.js @@ -1,4090 +1,609 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o difference ? difference : change; - this.object.rotation += delta * sign; + function a(t, e, n, a, o) { + if ('function' != typeof n) throw new TypeError('The listener must be a function') + var r = new i(n, a || t, o), + h = s ? s + e : e + return ( + t._events[h] + ? t._events[h].fn + ? (t._events[h] = [t._events[h], r]) + : t._events[h].push(r) + : ((t._events[h] = r), t._eventsCount++), + t + ) } - } - }]); - - return face; -}(wait); - -module.exports = face; - -},{"./wait":11,"yy-angle":22}],3:[function(require,module,exports){ -'use strict'; - -var Ease = { - list: require('./list'), - wait: require('./wait'), - to: require('./to'), - shake: require('./shake'), - tint: require('./tint'), - face: require('./face'), - angle: require('./angle'), - target: require('./target'), - movie: require('./movie'), - load: require('./load') -}; - -PIXI.extras.Ease = Ease; - -module.exports = Ease; - -},{"./angle":1,"./face":2,"./list":4,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],4:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Events = require('eventemitter3'); - -var Angle = require('./angle'); -var Face = require('./face'); -var Load = require('./load'); -var Movie = require('./movie'); -var Shake = require('./shake'); -var Target = require('./target'); -var Tint = require('./tint'); -var To = require('./to'); -var Wait = require('./wait'); - -var Ease = function (_Events) { - _inherits(Ease, _Events); - - /** - * Main class for creating eases - * @param {object} [options] - * @param {boolean} [options.noTicker] don't add the update function to PIXI.ticker - * @param {PIXI.ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for the list - * @extends eventemitter - * @fire done - * @fire each - */ - function Ease(options) { - _classCallCheck(this, Ease); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Ease.__proto__ || Object.getPrototypeOf(Ease)).call(this)); - - if (!options.noTicker) { - var ticker = options.ticker || PIXI.ticker.shared; - ticker.add(function () { - return _this.update(ticker.elapsedMS); - }); - } - _this.list = []; - _this.empty = true; - _this.removeWaiting = []; - _this.removeAllWaiting = false; - return _this; - } - - /** - * Add animation(s) to animation list - * @param {(object|object[])} any animation class - * @return {object} first animation - */ - - - _createClass(Ease, [{ - key: 'add', - value: function add() { - var first = void 0; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = arguments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var arg = _step.value; - - if (Array.isArray(arg)) { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = arg[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var entry = _step2.value; - - if (!first) { - first = entry; - } - this.list.push(entry); - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + function o(t, e) { + 0 == --t._eventsCount ? (t._events = new n()) : delete t._events[e] + } + function r() { + ;(this._events = new n()), (this._eventsCount = 0) + } + Object.create && ((n.prototype = Object.create(null)), new n().__proto__ || (s = !1)), + (r.prototype.eventNames = function () { + var t, + n, + i = [] + if (0 === this._eventsCount) return i + for (n in (t = this._events)) e.call(t, n) && i.push(s ? n.slice(1) : n) + return Object.getOwnPropertySymbols ? i.concat(Object.getOwnPropertySymbols(t)) : i + }), + (r.prototype.listeners = function (t) { + var e = s ? s + t : t, + n = this._events[e] + if (!n) return [] + if (n.fn) return [n.fn] + for (var i = 0, a = n.length, o = new Array(a); i < a; i++) o[i] = n[i].fn + return o + }), + (r.prototype.listenerCount = function (t) { + var e = s ? s + t : t, + n = this._events[e] + return n ? (n.fn ? 1 : n.length) : 0 + }), + (r.prototype.emit = function (t, e, n, i, a, o) { + var r = s ? s + t : t + if (!this._events[r]) return !1 + var h, + u, + c = this._events[r], + l = arguments.length + if (c.fn) { + switch ((c.once && this.removeListener(t, c.fn, void 0, !0), l)) { + case 1: + return c.fn.call(c.context), !0 + case 2: + return c.fn.call(c.context, e), !0 + case 3: + return c.fn.call(c.context, e, n), !0 + case 4: + return c.fn.call(c.context, e, n, i), !0 + case 5: + return c.fn.call(c.context, e, n, i, a), !0 + case 6: + return c.fn.call(c.context, e, n, i, a, o), !0 } + for (u = 1, h = new Array(l - 1); u < l; u++) h[u - 1] = arguments[u] + c.fn.apply(c.context, h) } else { - first = arg; - this.list.push(arg); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.empty = false; - return first; - } - - /** - * remove animation(s) - * @param {object|array} animate - the animation (or array of animations) to remove; can be null - */ - - }, { - key: 'remove', - value: function remove(animate) { - if (this.inUpdate) { - this.removeWaiting.push(animate); - } else { - var index = this.list.indexOf(animate); - if (index !== -1) { - this.list.splice(index, 1); - } - } - } - - /** - * remove all animations from list - * @inherited from yy-loop - */ - - }, { - key: 'removeAll', - value: function removeAll() { - if (this.inUpdate) { - this.removeAllWaiting = true; - } else { - this.list = []; - } - } - - /** - * update frame - * this is automatically added to PIXI.ticker unless options.noTicker is set - * if using options.noTicker, this should be called manually - * @param {number} elasped time in MS since last update - */ - - }, { - key: 'update', - value: function update(elapsed) { - this.inUpdate = true; - for (var i = 0, _i = this.list.length; i < _i; i++) { - if (this.list[i] && this.list[i].update(elapsed)) { - this.list.splice(i, 1); - i--; - _i--; - } - } - this.emit('each', this); - if (this.list.length === 0 && !this.empty) { - this.emit('done', this); - this.empty = true; - } - this.inUpdate = false; - if (this.removeAllWaiting) { - this.removeAll(); - this.removeAllWaiting = false; - } - while (this.removeWaiting.length) { - this.remove(this.removeWaiting.pop()); - } - } - - /** - * number of animations - * @type {number} - */ - - }, { - key: 'to', - - - /** - * default options for all eases - * @typedef {object} EaseOptions - * @param {object} [EaseOptions.options] - * @param {number} [EaseOptions.options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [EaseOptions.options.pause] start the animation paused - * @param {boolean|number} [EaseOptions.options.repeat] true: repeat animation forever n: repeat animation n times - * @param {boolean|number} [EaseOptions.options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {Function} [EaseOptions.options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {string|Function} [EaseOptions.options.ease] name or function from easing.js (see http://easings.net for examples) - */ - - /** - * ease parameters of object - * @param {PIXI.DisplayObject} object to animate - * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI} - * @param {number} duration - time to run - * @fires done - * @fires wait - * @fires first - * @fires each - * @fires loop - * @fires reverse - */ - value: function to() { - return this.add(new (Function.prototype.bind.apply(To, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** - * animate object's {x, y} using an angle - * @param {object} object to animate - * @param {number} angle in radians - * @param {number} speed in pixels/millisecond - * @param {number} [duration=0] in milliseconds; if 0, then continues forever - * @param {object} [options] @see {@link Wait} - */ - - }, { - key: 'angle', - value: function angle() { - return this.add(new (Function.prototype.bind.apply(Angle, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.face class; see Ease.to class below for parameters */ - - }, { - key: 'face', - value: function face() { - return this.add(new (Function.prototype.bind.apply(Face, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.load class; see Ease.to class below for parameters */ - - }, { - key: 'load', - value: function load() { - return this.add(new (Function.prototype.bind.apply(Load, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.movie class; see Ease.to class below for parameters */ - - }, { - key: 'movie', - value: function movie() { - return this.add(new (Function.prototype.bind.apply(Movie, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.shake class; see Ease.to class below for parameters */ - - }, { - key: 'shake', - value: function shake() { - return this.add(new (Function.prototype.bind.apply(Shake, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.target class; see Ease.to class below for parameters */ - - }, { - key: 'target', - value: function target() { - return this.add(new (Function.prototype.bind.apply(Target, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.angle tint; see Ease.to class below for parameters */ - - }, { - key: 'tint', - value: function tint() { - return this.add(new (Function.prototype.bind.apply(Tint, [null].concat(Array.prototype.slice.call(arguments))))()); - } - - /** helper to add to the list a new Ease.wait class; see Ease.to class below for parameters */ - - }, { - key: 'wait', - value: function wait() { - return this.add(new (Function.prototype.bind.apply(Wait, [null].concat(Array.prototype.slice.call(arguments))))()); - } - }, { - key: 'count', - get: function get() { - return this.list.length; - } - - /** - * number of active animations - * @type {number} - */ - - }, { - key: 'countRunning', - get: function get() { - var count = 0; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = this.list[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var entry = _step3.value; - - if (!entry.pause) { - count++; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - return count; - } - }]); - - return Ease; -}(Events); - -module.exports = Ease; - -},{"./angle":1,"./face":2,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11,"eventemitter3":12}],5:[function(require,module,exports){ -'use strict'; - -var wait = require('./wait'); -var to = require('./to'); -var tint = require('./tint'); -var shake = require('./shake'); -var angle = require('./angle'); -var face = require('./face'); -var target = require('./target'); -var movie = require('./movie'); - -/** - * restart an animation = requires a saved state - * @param {object} object(s) to animate - */ -function load(object, load) { - if (!load) { - return null; - } - var options = { load: load }; - switch (load.type) { - case 'Wait': - return new wait(object, options); - case 'To': - return new to(object, null, null, options); - case 'Tint': - return new tint(object, null, null, options); - case 'Shake': - return new shake(object, null, null, options); - case 'Angle': - return new angle(object, null, null, null, options); - case 'Face': - return new face(object[0], object[1], null, options); - case 'Target': - return new target(object[0], object[1], null, options); - case 'Movie': - return new movie(object, object[1], null, options); - } -} - -module.exports = load; - -},{"./angle":1,"./face":2,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],6:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** - * animate a movie of textures - */ - -var movie = function (_wait) { - _inherits(movie, _wait); - - /** - * @param {object} object to animate - * @param {PIXI.Texture[]} textures - * @param {number} [duration=0] time to run (use 0 for infinite duration--should only be used with customized easing functions) - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {(boolean|number)} [options.continue] true: continue animation with new starting values n: continue animation n times - * @param {Function} [options.load] loads an animation using a .save() object note the * parameters below cannot be loaded and must be re-set - * @param {Function} [options.ease] function from easing.js (see http://easings.net for examples) - * @emits {done} animation expires - * @emits {wait} each update during a wait - * @emits {first} first update when animation starts - * @emits {each} each update while animation is running - * @emits {loop} when animation is repeated - * @emits {reverse} when animation is reversed - */ - function movie(object, textures, duration, options) { - _classCallCheck(this, movie); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (movie.__proto__ || Object.getPrototypeOf(movie)).call(this, object, options)); - - _this.type = 'Movie'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; - } - if (options.load) { - _this.load(options.load); - } else { - _this.textures = textures; - _this.duration = duration; - _this.current = 0; - _this.length = textures.length; - _this.interval = duration / _this.length; - _this.isReverse = false; - _this.restart(); - } - return _this; - } - - _createClass(movie, [{ - key: 'save', - value: function save() { - var save = _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'save', this).call(this); - save.goto = this.goto; - save.current = this.current; - save.length = this.length; - save.interval = this.interval; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'load', this).call(this, _load); - this.goto = _load.goto; - this.current = _load.current; - this.interval = _load.current; - } - }, { - key: 'restart', - value: function restart() { - this.current = 0; - this.time = 0; - this.isReverse = false; - } - }, { - key: 'reverse', - value: function reverse() { - this.isReverse = !this.isReverse; - } - }, { - key: 'calculate', - value: function calculate() { - var index = Math.round(this.options.ease(this.time, 0, this.length - 1, this.duration)); - if (this.isReverse) { - index = this.length - 1 - index; - } - if (this.list) { - for (var i = 0; i < this.list.length; i++) { - this.list[i].texture = this.textures[index]; - } - } else { - this.object.texture = this.textures[index]; - } - } - }]); - - return movie; -}(wait); - -module.exports = movie; - -},{"./wait":11}],7:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** - * shakes an object or list of objects - */ - -var shake = function (_wait) { - _inherits(shake, _wait); - - /** - * @param {object|array} object or list of objects to shake - * @param {number} amount to shake - * @param {number} duration (in milliseconds) to shake - * @param {object} options (see Animate.wait) - */ - function shake(object, amount, duration, options) { - _classCallCheck(this, shake); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (shake.__proto__ || Object.getPrototypeOf(shake)).call(this, object, options)); - - _this.type = 'Shake'; - if (Array.isArray(object)) { - _this.array = true; - _this.list = object; - } - if (options.load) { - _this.load(options.load); - } else { - if (_this.list) { - _this.start = []; - for (var i = 0; i < object.length; i++) { - var target = object[i]; - _this.start[i] = { x: target.x, y: target.y }; - } - } else { - _this.start = { x: object.x, y: object.y }; - } - _this.amount = amount; - _this.duration = duration; - } - return _this; - } - - _createClass(shake, [{ - key: 'save', - value: function save() { - var save = _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'save', this).call(this); - save.start = this.start; - save.amount = this.amount; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'load', this).call(this, _load); - this.start = _load.start; - this.amount = _load.amount; - } - }, { - key: 'calculate', - value: function calculate() /*elapsed*/{ - var object = this.object; - var start = this.start; - var amount = this.amount; - if (this.array) { - var list = this.list; - for (var i = 0; i < list.length; i++) { - var _object = list[i]; - var actual = start[i]; - _object.x = actual.x + Math.floor(Math.random() * amount * 2) - amount; - _object.y = actual.y + Math.floor(Math.random() * amount * 2) - amount; - } - } - object.x = start.x + Math.floor(Math.random() * amount * 2) - amount; - object.y = start.y + Math.floor(Math.random() * amount * 2) - amount; - } - }, { - key: 'done', - value: function done() { - var object = this.object; - var start = this.start; - if (this.array) { - var list = this.list; - for (var i = 0; i < list.length; i++) { - var _object2 = list[i]; - var actual = start[i]; - _object2.x = actual.x; - _object2.y = actual.y; - } - } else { - object.x = start.x; - object.y = start.y; - } - } - }]); - - return shake; -}(wait); - -module.exports = shake; - -},{"./wait":11}],8:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** move an object to a target's location */ - -var target = function (_wait) { - _inherits(target, _wait); - - /** - * move to a target - * @param {object} object - object to animate - * @param {object} target - object needs to contain {x: x, y: y} - * @param {number} speed - number of pixels to move per millisecond - * @param {object} [options] @see {@link Wait} - * @param {boolean} [options.keepAlive] don't cancel the animation when target is reached - */ - function target(object, _target, speed, options) { - _classCallCheck(this, target); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (target.__proto__ || Object.getPrototypeOf(target)).call(this, object, options)); - - _this.type = 'Target'; - _this.target = _target; - if (options.load) { - _this.load(options.load); - } else { - _this.speed = speed; - } - return _this; - } - - _createClass(target, [{ - key: 'save', - value: function save() { - var save = _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'save', this).call(this); - save.speed = this.speed; - save.keepAlive = this.options.keepAlive; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'load', this).call(this, _load); - this.speed = _load.speed; - this.options.keepAlive = _load.keepAlive; - } - }, { - key: 'calculate', - value: function calculate(elapsed) { - var deltaX = this.target.x - this.object.x; - var deltaY = this.target.y - this.object.y; - if (deltaX === 0 && deltaY === 0) { - this.emit('done', this.object); - if (!this.options.keepAlive) { - return true; - } - } else { - var angle = Math.atan2(deltaY, deltaX); - this.object.x += Math.cos(angle) * elapsed * this.speed; - this.object.y += Math.sin(angle) * elapsed * this.speed; - if (deltaX >= 0 !== this.target.x - this.object.x >= 0) { - this.object.x = this.target.x; - } - if (deltaY >= 0 !== this.target.y - this.object.y >= 0) { - this.object.y = this.target.y; - } - } - } - }]); - - return target; -}(wait); - -module.exports = target; - -},{"./wait":11}],9:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Color = require('yy-color'); -var wait = require('./wait'); - -var tint = function (_wait) { - _inherits(tint, _wait); - - /** - * @param {PIXI.DisplayObject|PIXI.DisplayObject[]} object - * @param {number|number[]} tint - * @param {number} [duration] in milliseconds - * @param {object} [options] @see {@link Wait} - */ - function tint(object, _tint, duration, options) { - _classCallCheck(this, tint); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (tint.__proto__ || Object.getPrototypeOf(tint)).call(this, object, options)); - - _this.type = 'Tint'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; - } - _this.duration = duration; - if (options.load) { - _this.load(options.load); - } else if (Array.isArray(_tint)) { - _this.tints = [_this.object.tint].concat(_toConsumableArray(_tint)); - } else { - _this.start = _this.object.tint; - _this.to = _tint; - } - return _this; - } - - _createClass(tint, [{ - key: 'save', - value: function save() { - var save = _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'save', this).call(this); - save.start = this.start; - save.to = this.to; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'load', this).call(this, _load); - this.start = _load.start; - this.to = _load.to; - } - }, { - key: 'calculate', - value: function calculate() { - var percent = this.options.ease(this.time, 0, 1, this.duration); - if (this.tints) { - var each = 1 / (this.tints.length - 1); - var per = each; - for (var i = 1; i < this.tints.length; i++) { - if (percent <= per) { - var color = Color.blend(1 - (per - percent) / each, this.tints[i - 1], this.tints[i]); - if (this.list) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var object = _step.value; - - object.tint = color; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + var p, + f = c.length + for (u = 0; u < f; u++) + switch ((c[u].once && this.removeListener(t, c[u].fn, void 0, !0), l)) { + case 1: + c[u].fn.call(c[u].context) + break + case 2: + c[u].fn.call(c[u].context, e) + break + case 3: + c[u].fn.call(c[u].context, e, n) + break + case 4: + c[u].fn.call(c[u].context, e, n, i) + break + default: + if (!h) for (p = 1, h = new Array(l - 1); p < l; p++) h[p - 1] = arguments[p] + c[u].fn.apply(c[u].context, h) } - } else { - this.object.tint = color; - } - break; } - per += each; + return !0 + }), + (r.prototype.on = function (t, e, s) { + return a(this, t, e, s, !1) + }), + (r.prototype.once = function (t, e, s) { + return a(this, t, e, s, !0) + }), + (r.prototype.removeListener = function (t, e, n, i) { + var a = s ? s + t : t + if (!this._events[a]) return this + if (!e) return o(this, a), this + var r = this._events[a] + if (r.fn) r.fn !== e || (i && !r.once) || (n && r.context !== n) || o(this, a) + else { + for (var h = 0, u = [], c = r.length; h < c; h++) + (r[h].fn !== e || (i && !r[h].once) || (n && r[h].context !== n)) && u.push(r[h]) + u.length ? (this._events[a] = 1 === u.length ? u[0] : u) : o(this, a) + } + return this + }), + (r.prototype.removeAllListeners = function (t) { + var e + return ( + t + ? ((e = s ? s + t : t), this._events[e] && o(this, e)) + : ((this._events = new n()), (this._eventsCount = 0)), + this + ) + }), + (r.prototype.off = r.prototype.removeListener), + (r.prototype.addListener = r.prototype.on), + (r.prefixed = s), + (r.EventEmitter = r), + (t.exports = r) + }) + class a extends i { + constructor(t, e, s) { + super(), + (this.elements = Array.isArray(t) ? t : [t]), + (this.eases = []), + (this.options = s || {}), + (this.time = 0) + for (let t in e) for (let s of this.elements) this.addParam(s, t, e[t]) + } + addParam(t, e, s) { + let n, + i, + o, + r, + h = e + switch (e) { + case 'scaleX': + case 'skewX': + ;(i = s), + (o = s - (n = t[(h = e.substr(0, e.length - 1))].x)), + (r = (t) => this.updateCoord(t, h, 'x')) + break + case 'scaleY': + case 'skewY': + ;(i = s), + (o = s - (n = t[(h = e.substr(0, e.length - 1))].y)), + (r = (t) => this.updateCoord(t, h, 'y')) + break + case 'tint': + case 'blend': + const u = Array.isArray(s) ? s : [t.tint, s] + ;(n = 0), + (o = i = u.length), + (r = 'tint' === e ? (t) => this.updateTint(t, u) : (t) => this.updateBlend(t, u)) + break + case 'shake': + ;(n = { x: t.x, y: t.y }), (i = s), (r = (t) => this.updateShake(t)) + break + case 'position': + ;(n = { x: t.x, y: t.y }), + (o = { x: (i = { x: s.x, y: s.y }).x - n.x, y: i.y - n.y }), + (r = (t) => this.updatePosition(t)) + break + case 'skew': + case 'scale': + ;(i = s), (o = s - (n = t[e].x)), (r = (t) => this.updatePoint(t, e)) + break + case 'face': + ;(n = t.rotation), + (o = (i = a.shortestAngle(n, Math.atan2(s.y - t.y, s.x - t.x))) - n), + (r = (t) => this.updateOne(t, 'rotation')) + break + default: + ;(i = s), (o = s - (n = t[e])), (r = (t) => this.updateOne(t, e)) + } + this.eases.push({ element: t, entry: e, update: r, start: n, to: i, delta: o }) + } + static shortestAngle(t, e) { + const s = 2 * Math.PI + let n = Math.abs(t - e) % s + var i + return (n = n > Math.PI ? s - n : n) * (((((e - t + Math.PI) % (i = s)) + i) % i) - Math.PI > 0 ? 1 : -1) + } + remove(t, e) { + if (0 === arguments.length) this.eases = [] + else { + 'string' == typeof e && (e = [e]) + for (let s = 0; s < this.eases.length; s++) { + const n = this.eases[s] + ;(t && n.element !== t) || (e && -1 === e.indexOf(n.entry)) || (this.eases.splice(s, 1), s--) } + } + if (0 === this.eases.length) return !0 + } + updateOne(t, e) { + t.element[e] = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updatePoint(t, e) { + t.element[e].x = t.element[e].y = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updatePosition(t) { + ;(t.element.x = this.options.ease(this.time, t.start.x, t.delta.x, this.options.duration)), + (t.element.y = this.options.ease(this.time, t.start.y, t.delta.y, this.options.duration)) + } + updateCoord(t, e, s) { + t.element[e][s] = this.options.ease(this.time, t.start, t.delta, this.options.duration) + } + updateTint(t, e) { + let s = Math.floor(this.options.ease(this.time, t.start, t.delta, this.options.duration)) + s === e.length && (s = e.length - 1), (t.element.tint = e[s]) + } + updateBlend(t, e) { + const s = this.options.ease(this.time, t.start, t.delta, this.options.duration) + let n = Math.floor(s) + n === e.length && (n = e.length - 1) + let i = n + 1 + i === e.length && (i = this.options.reverse ? n - 1 : this.options.repeat ? 0 : n) + const a = s - n, + o = e[n], + r = e[i], + h = 1 - a, + u = h * (o >> 16) + a * (r >> 16), + c = h * ((o >> 8) & 255) + a * ((r >> 8) & 255), + l = h * (255 & o) + a * (255 & r) + t.element.tint = (u << 16) | (c << 8) | l + } + updateShake(t) { + function e(t) { + return Math.floor(Math.random() * t) - Math.floor(t / 2) + } + ;(t.element.x = t.start.x + e(t.to)), (t.element.y = t.start.y + e(t.to)) + } + complete(t) { + 'shake' === t.entry && ((t.element.x = t.start.x), (t.element.y = t.start.y)) + } + reverse(t) { + if ('position' === t.entry) { + const e = t.to.x, + s = t.to.y + ;(t.to.x = t.start.x), + (t.to.y = t.start.y), + (t.start.x = e), + (t.start.y = s), + (t.delta.x = -t.delta.x), + (t.delta.y = -t.delta.y) } else { - var _color = Color.blend(percent, this.start, this.to); - if (this.list) { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.list[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var _object = _step2.value; - - _object.tint = _color; - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } else { - this.object.tint = _color; + const e = t.to + ;(t.to = t.start), (t.start = e), (t.delta = -t.delta) + } + } + repeat(t) { + switch (t.entry) { + case 'skewX': + t.element.skew.x = t.start + break + case 'skewY': + t.element.skew.y = t.start + break + case 'skew': + ;(t.element.skew.x = t.start), (t.element.skew.y = t.start) + break + case 'scaleX': + t.element.scale.x = t.start + break + case 'scaleY': + t.element.scale.y = t.start + break + case 'scale': + ;(t.element.scale.x = t.start), (t.element.scale.y = t.start) + break + case 'position': + ;(t.element.x = t.start.x), (t.element.y = t.start.y) + break + default: + t.element[t.entry] = t.start + } + } + update(t) { + if (0 === this.eases.length) return !0 + if (this.options.wait) { + if (((this.options.wait -= t), this.options.wait > 0)) return void this.emit('wait', this) + ;(t = -this.options.wait), (this.options.wait = 0), this.emit('wait-end', this) + } + this.time += t + let e = 0 + this.time >= this.options.duration && + ((e = this.time - this.options.duration), (this.time = this.options.duration)) + for (let t = 0; t < this.eases.length; t++) { + const e = this.eases[t] + e.element._destroyed ? (this.eases.splice(t, 1), t--) : e.update(e) + } + if ((this.emit('each', this), this.time >= this.options.duration)) + if (this.options.reverse) + this.eases.forEach((t) => this.reverse(t)), + (this.time = e), + e && this.eases.forEach((t) => t.update(t)), + this.emit('reverse', this), + this.options.repeat + ? !0 !== this.options.repeat && this.options.repeat-- + : (this.options.reverse = !1) + else { + if (!this.options.repeat) + return this.eases.forEach((t) => this.complete(t)), this.emit('complete', this), !0 + this.eases.forEach((t) => this.repeat(t)), + (this.time = e), + e && this.eases.forEach((t) => t.update(t)), + !0 !== this.options.repeat && this.options.repeat--, + this.emit('repeat', this) } + } + get count() { + return this.eases.length + } + } + const o = { duration: 1e3, ease: n.easeInOutSine, maxFrame: 1e3 / 60, ticker: null, useRAF: !0 } + class r extends i { + constructor(t) { + super(), + (this.options = Object.assign({}, o, t)), + (this.easings = []), + (this.empty = !0), + this.options.ticker && this.options.ticker.add(this.update, this) + } + destroy() { + this.removeAll(), + this.options.useTicker + ? this.ticker.remove(this.update, this) + : this.options.useRAF && (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null)) + } + add(t, e, s) { + ;((s = s || {}).duration = void 0 !== s.duration ? s.duration : this.options.duration), + (s.ease = s.ease || this.options.ease), + 'string' == typeof s.ease && (s.ease = n[s.ease]) + const i = new a(t, e, s) + return ( + this.easings.push(i), + this.empty && + this.options.useRAF && + ((this.handleRAF = requestAnimationFrame(() => this.update())), (this.lastTime = Date.now())), + (this.empty = !1), + i + ) + } + target(t, e, s, n) { + const i = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)) / s + return ((n = n || {}).duration = i), this.add(t, { x: e.x, y: e.y }, n) + } + face(t, e, s, n) { + const i = a.shortestAngle(t.rotation, Math.atan2(e.y - t.y, e.x - t.x)), + o = Math.abs(i - t.rotation) / s + return ((n = n || {}).duration = o), this.add(t, { rotation: i }, n) + } + removeEase(t, e) { + for (let s = 0; s < this.easings.length; s++) + this.easings[s].remove(t, e) && (this.easings.splice(s, 1), s--) + 0 === this.easings.length && + ((this.empty = !0), + this.options.useRAF && + this.handleRAF && + (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null))) + } + removeAll() { + ;(this.easings = []), + (this.empty = !0), + this.options.useRAF && this.handleRAF && (cancelAnimationFrame(this.handleRAF), (this.handleRAF = null)) + } + update(t) { + if (this.options.useTicker) t = this.ticker.elapsedMS + else if (this.options.useRAF) { + const e = Date.now() + ;(t = e - this.lastTime), (this.lastTime = e) } - } - }, { - key: 'reverse', - value: function reverse() { - if (this.tints) { - var tints = []; - for (var i = this.tints.length - 1; i >= 0; i--) { - tints.push(this.tints[i]); - } - this.tints = tints; - } else { - var swap = this.to; - this.to = this.start; - this.start = swap; + if (((t = Math.min(t, this.options.maxFrame)), !this.empty)) { + const e = this.easings.slice(0) + for (let s of e) s.update(t) && this.easings.splice(this.easings.indexOf(s), 1) + this.emit('each', this), 0 === this.easings.length && ((this.empty = !0), this.emit('complete', this)) } + this.options.useRAF && this.easings.length + ? (this.handleRAF = requestAnimationFrame(() => this.update())) + : (this.handleRAF = null) } - }]); - - return tint; -}(wait); - -module.exports = tint; - -},{"./wait":11,"yy-color":23}],10:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var wait = require('./wait'); - -/** animate any numeric parameter of an object or array of objects */ - -var to = function (_wait) { - _inherits(to, _wait); - - /** - * @private - * @param {object} object to animate - * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI} - * @param {number} duration - time to run - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {boolean|number} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {boolean|number} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {string|Function} [options.ease] name or function from easing.js (see http://easings.net for examples) - * @emits to:done animation expires - * @emits to:wait each update during a wait - * @emits to:first first update when animation starts - * @emits to:each each update while animation is running - * @emits to:loop when animation is repeated - * @emits to:reverse when animation is reversed - */ - function to(object, goto, duration, options) { - _classCallCheck(this, to); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (to.__proto__ || Object.getPrototypeOf(to)).call(this, object, options)); - - _this.type = 'To'; - if (Array.isArray(object)) { - _this.list = object; - _this.object = _this.list[0]; + get count() { + return this.easings.length } - if (options.load) { - _this.load(options.load); - } else { - _this.goto = goto; - _this.fixScale(); - _this.duration = duration; - _this.restart(); + countRunning() { + let t = 0 + for (let e of this.easings) t += e.count + return t + } + set duration(t) { + this.options.duration = t + } + get duration() { + return this.options.duration + } + set ease(t) { + this.options.ease = t + } + get ease() { + return this.options.ease } - return _this; } - - /** - * converts scale from { scale: n } to { scale: { x: n, y: n }} - * @private - */ - - - _createClass(to, [{ - key: 'fixScale', - value: function fixScale() { - if (typeof this.goto['scale'] !== 'undefined' && !Number.isNaN(this.goto['scale'])) { - this.goto['scale'] = { x: this.goto['scale'], y: this.goto['scale'] }; + r.id = 0 + let h = new r() + r.ease = h + ;(t.Ease = r), + (t.List = class { + constructor() { + console.warn('Ease.List was deprecated. Use new Ease() instead.') } - } - }, { - key: 'save', - value: function save() { - var save = _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'save', this).call(this); - save.goto = this.goto; - save.start = this.start; - save.delta = this.delta; - save.keys = this.keys; - return save; - } - }, { - key: 'load', - value: function load(_load) { - _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'load', this).call(this, _load); - this.goto = _load.goto; - this.start = _load.start; - this.delta = _load.delta; - this.keys = _load.keys; - } - }, { - key: 'restart', - value: function restart() { - var i = 0; - var start = this.start = []; - var delta = this.delta = []; - var keys = this.keys = []; - var goto = this.goto; - var object = this.object; - - // loops through all keys in goto object - for (var key in goto) { - - // handles keys with one additional level e.g.: goto = {scale: {x: 5, y: 3}} - if (isNaN(goto[key])) { - keys[i] = { key: key, children: [] }; - start[i] = []; - delta[i] = []; - var j = 0; - for (var key2 in goto[key]) { - keys[i].children[j] = key2; - start[i][j] = parseFloat(object[key][key2]); - start[i][j] = this._correctDOM(key2, start[i][j]); - start[i][j] = isNaN(this.start[i][j]) ? 0 : start[i][j]; - delta[i][j] = goto[key][key2] - start[i][j]; - j++; - } - } else { - start[i] = parseFloat(object[key]); - start[i] = this._correctDOM(key, start[i]); - start[i] = isNaN(this.start[i]) ? 0 : start[i]; - delta[i] = goto[key] - start[i]; - keys[i] = key; - } - i++; - } - this.time = 0; - } - }, { - key: 'reverse', - value: function reverse() { - var object = this.object; - var keys = this.keys; - var goto = this.goto; - var delta = this.delta; - var start = this.start; - - for (var i = 0, _i = keys.length; i < _i; i++) { - var key = keys[i]; - if (isNaN(goto[key])) { - for (var j = 0, _j = key.children.length; j < _j; j++) { - delta[i][j] = -delta[i][j]; - start[i][j] = parseFloat(object[key.key][key.children[j]]); - start[i][j] = isNaN(start[i][j]) ? 0 : start[i][j]; - } - } else { - delta[i] = -delta[i]; - start[i] = parseFloat(object[key]); - start[i] = isNaN(start[i]) ? 0 : start[i]; - } - } - } - }, { - key: 'calculate', - value: function calculate() /*elapsed*/{ - var object = this.object; - var list = this.list; - var keys = this.keys; - var goto = this.goto; - var time = this.time; - var start = this.start; - var delta = this.delta; - var duration = this.duration; - var ease = this.options.ease; - for (var i = 0, _i = this.keys.length; i < _i; i++) { - var key = keys[i]; - if (isNaN(goto[key])) { - var key1 = key.key; - for (var j = 0, _j = key.children.length; j < _j; j++) { - var key2 = key.children[j]; - var others = object[key1][key2] = time >= duration ? start[i][j] + delta[i][j] : ease(time, start[i][j], delta[i][j], duration); - if (list) { - for (var k = 1, _k = list.length; k < _k; k++) { - list[k][key1][key2] = others; - } - } - } - } else { - var _key = keys[i]; - var _others = object[_key] = time >= duration ? start[i] + delta[i] : ease(time, start[i], delta[i], duration); - if (list) { - for (var _j2 = 1, _j3 = this.list.length; _j2 < _j3; _j2++) { - list[_j2][_key] = _others; - } - } - } - } - } - }]); - - return to; -}(wait); - -module.exports = to; - -},{"./wait":11}],11:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Easing = require('penner'); -var EventEmitter = require('eventemitter3'); - -var wait = function (_EventEmitter) { - _inherits(wait, _EventEmitter); - - /** - * @param {object|object[]} object or list of objects to animate - * @param {object} [options] - * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time) - * @param {boolean} [options.pause] start the animation paused - * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times - * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times - * - * @param {number} [options.id] user-generated id (e.g., I use it to properly load animations when an object has multiple animations running) - * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set - * @param {Function|string} [options.ease] function (or penner function name) from easing.js (see http://easings.net for examples)* - * - * @emits {done} animation expires - * @emits {wait} each update during a wait - * @emits {first} first update when animation starts - * @emits {each} each update while animation is running - * @emits {loop} when animation is repeated - * @emits {reverse} when animation is reversed - */ - function wait(object, options) { - _classCallCheck(this, wait); - - var _this = _possibleConstructorReturn(this, (wait.__proto__ || Object.getPrototypeOf(wait)).call(this)); - - _this.object = object; - _this.options = options || {}; - _this.type = 'Wait'; - if (_this.options.load) { - _this.load(_this.options.load); - } else { - _this.time = 0; - } - if (_this.options.ease && typeof _this.options.ease !== 'function') { - _this.options.easeName = _this.options.ease; - _this.options.ease = Easing[_this.options.ease]; - } - if (!_this.options.ease) { - _this.options.ease = Easing['linear']; - } - return _this; - } - - _createClass(wait, [{ - key: 'save', - value: function save() { - var save = { type: this.type, time: this.time, duration: this.duration, ease: this.options.easeName }; - var options = this.options; - if (options.wait) { - save.wait = options.wait; - } - if (typeof options.id !== 'undefined') { - save.id = options.id; - } - if (options.pause) { - save.pause = options.pause; - } - if (options.repeat) { - save.repeat = options.repeat; - } - if (options.reverse) { - save.reverse = options.reverse; - } - return save; - } - }, { - key: 'load', - value: function load(_load) { - this.options.wait = _load.wait; - this.options.pause = _load.pause; - this.options.repeat = _load.repeat; - this.options.reverse = _load.reverse; - this.options.id = _load.id; - this.options.ease = _load.ease; - if (this.options.ease && typeof this.options.ease !== 'function') { - this.options.easeName = this.options.ease; - this.options.ease = Easing[this.options.ease]; - } - if (!this.options.ease) { - this.options.ease = Easing['linear']; - } - this.time = _load.time; - this.duration = _load.duration; - } - - /** - * pause this entry - * @type {boolean} - */ - - }, { - key: 'end', - value: function end(leftOver) { - if (this.options.reverse) { - this.reverse(); - this.time = leftOver; - if (!this.options.repeat) { - if (this.options.reverse === true) { - this.options.reverse = false; - } else { - this.options.reverse--; - } - } else { - if (this.options.repeat !== true) { - this.options.repeat--; - } - } - this.emit('loop', this.list || this.object); - } else if (this.options.repeat) { - this.time = leftOver; - if (this.options.repeat !== true) { - this.options.repeat--; - } - this.emit('loop', this.list || this.object); - } else { - this.done(); - this.emit('done', this.list || this.object, leftOver); - // this.list = this.object = null - return true; - } - } - }, { - key: 'update', - value: function update(elapsed) { - var options = this.options; - if (options.pause) { - return; - } - if (options.wait) { - options.wait -= elapsed; - if (options.wait <= 0) { - elapsed = -options.wait; - options.wait = false; - } else { - this.emit('wait', elapsed, this.list || this.object); - return; - } - } - if (!this.first) { - this.first = true; - this.emit('first', this.list || this.object); - } - this.time += elapsed; - var leftOver = 0; - var duration = this.duration; - var time = this.time; - if (duration !== 0 && time > duration) { - leftOver = time - duration; - this.time = time = duration; - } - var force = this.calculate(elapsed); - this.emit('each', elapsed, this.list || this.object, this); - if (this.type === 'Wait' || duration !== 0 && time === duration) { - return this.end(leftOver); - } - return force || time === duration; - } - - // correct certain DOM values - - }, { - key: '_correctDOM', - value: function _correctDOM(key, value) { - switch (key) { - case 'opacity': - return isNaN(value) ? 1 : value; - } - return value; - } - }, { - key: 'reverse', - value: function reverse() {} - }, { - key: 'calculate', - value: function calculate() {} - }, { - key: 'done', - value: function done() {} - }, { - key: 'pause', - set: function set(value) { - this.options.pause = value; - }, - get: function get() { - return this.options.pause; - } - }]); - - return wait; -}(EventEmitter); - -module.exports = wait; - -},{"eventemitter3":12,"penner":13}],12:[function(require,module,exports){ -'use strict'; - -var has = Object.prototype.hasOwnProperty - , prefix = '~'; - -/** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ -function Events() {} - -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} - -/** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if ('undefined' !== typeof module) { - module.exports = EventEmitter; -} - -},{}],13:[function(require,module,exports){ - -/* - Copyright © 2001 Robert Penner - 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. - - Neither the name of the author nor the names of contributors may be used to endorse - or promote products derived from this software without specific prior written permission. - - 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 OWNER 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. - */ - -(function() { - var penner, umd; - - umd = function(factory) { - if (typeof exports === 'object') { - return module.exports = factory; - } else if (typeof define === 'function' && define.amd) { - return define([], factory); - } else { - return this.penner = factory; - } - }; - - penner = { - linear: function(t, b, c, d) { - return c * t / d + b; - }, - easeInQuad: function(t, b, c, d) { - return c * (t /= d) * t + b; - }, - easeOutQuad: function(t, b, c, d) { - return -c * (t /= d) * (t - 2) + b; - }, - easeInOutQuad: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t + b; - } else { - return -c / 2 * ((--t) * (t - 2) - 1) + b; - } - }, - easeInCubic: function(t, b, c, d) { - return c * (t /= d) * t * t + b; - }, - easeOutCubic: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t + 1) + b; - }, - easeInOutCubic: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t + 2) + b; - } - }, - easeInQuart: function(t, b, c, d) { - return c * (t /= d) * t * t * t + b; - }, - easeOutQuart: function(t, b, c, d) { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - }, - easeInOutQuart: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t + b; - } else { - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - } - }, - easeInQuint: function(t, b, c, d) { - return c * (t /= d) * t * t * t * t + b; - }, - easeOutQuint: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - }, - easeInOutQuint: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - } - }, - easeInSine: function(t, b, c, d) { - return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; - }, - easeOutSine: function(t, b, c, d) { - return c * Math.sin(t / d * (Math.PI / 2)) + b; - }, - easeInOutSine: function(t, b, c, d) { - return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; - }, - easeInExpo: function(t, b, c, d) { - if (t === 0) { - return b; - } else { - return c * Math.pow(2, 10 * (t / d - 1)) + b; - } - }, - easeOutExpo: function(t, b, c, d) { - if (t === d) { - return b + c; - } else { - return c * (-Math.pow(2, -10 * t / d) + 1) + b; - } - }, - easeInOutExpo: function(t, b, c, d) { - if (t === 0) { - b; - } - if (t === d) { - b + c; - } - if ((t /= d / 2) < 1) { - return c / 2 * Math.pow(2, 10 * (t - 1)) + b; - } else { - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; - } - }, - easeInCirc: function(t, b, c, d) { - return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; - }, - easeOutCirc: function(t, b, c, d) { - return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; - }, - easeInOutCirc: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; - } else { - return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; - } - }, - easeInElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - }, - easeOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; - }, - easeInOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d / 2) === 2) { - b + c; - } - if (!p) { - p = d * (.3 * 1.5); - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - if (t < 1) { - return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - } else { - return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; - } - }, - easeInBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * (t /= d) * t * ((s + 1) * t - s) + b; - }, - easeOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - }, - easeInOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - if ((t /= d / 2) < 1) { - return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; - } else { - return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; - } - }, - easeInBounce: function(t, b, c, d) { - var v; - v = penner.easeOutBounce(d - t, 0, c, d); - return c - v + b; - }, - easeOutBounce: function(t, b, c, d) { - if ((t /= d) < 1 / 2.75) { - return c * (7.5625 * t * t) + b; - } else if (t < 2 / 2.75) { - return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; - } else if (t < 2.5 / 2.75) { - return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; - } else { - return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; - } - }, - easeInOutBounce: function(t, b, c, d) { - var v; - if (t < d / 2) { - v = penner.easeInBounce(t * 2, 0, c, d); - return v * .5 + b; - } else { - v = penner.easeOutBounce(t * 2 - d, 0, c, d); - return v * .5 + c * .5 + b; - } - } - }; - - umd(penner); - -}).call(this); - -},{}],14:[function(require,module,exports){ -// A library of seedable RNGs implemented in Javascript. -// -// Usage: -// -// var seedrandom = require('seedrandom'); -// var random = seedrandom(1); // or any seed. -// var x = random(); // 0 <= x < 1. Every bit is random. -// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness. - -// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe. -// Period: ~2^116 -// Reported to pass all BigCrush tests. -var alea = require('./lib/alea'); - -// xor128, a pure xor-shift generator by George Marsaglia. -// Period: 2^128-1. -// Reported to fail: MatrixRank and LinearComp. -var xor128 = require('./lib/xor128'); - -// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl. -// Period: 2^192-2^32 -// Reported to fail: CollisionOver, SimpPoker, and LinearComp. -var xorwow = require('./lib/xorwow'); - -// xorshift7, by François Panneton and Pierre L'ecuyer, takes -// a different approach: it adds robustness by allowing more shifts -// than Marsaglia's original three. It is a 7-shift generator -// with 256 bits, that passes BigCrush with no systmatic failures. -// Period 2^256-1. -// No systematic BigCrush failures reported. -var xorshift7 = require('./lib/xorshift7'); - -// xor4096, by Richard Brent, is a 4096-bit xor-shift with a -// very long period that also adds a Weyl generator. It also passes -// BigCrush with no systematic failures. Its long period may -// be useful if you have many generators and need to avoid -// collisions. -// Period: 2^4128-2^32. -// No systematic BigCrush failures reported. -var xor4096 = require('./lib/xor4096'); - -// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random -// number generator derived from ChaCha, a modern stream cipher. -// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf -// Period: ~2^127 -// No systematic BigCrush failures reported. -var tychei = require('./lib/tychei'); - -// The original ARC4-based prng included in this library. -// Period: ~2^1600 -var sr = require('./seedrandom'); - -sr.alea = alea; -sr.xor128 = xor128; -sr.xorwow = xorwow; -sr.xorshift7 = xorshift7; -sr.xor4096 = xor4096; -sr.tychei = tychei; - -module.exports = sr; - -},{"./lib/alea":15,"./lib/tychei":16,"./lib/xor128":17,"./lib/xor4096":18,"./lib/xorshift7":19,"./lib/xorwow":20,"./seedrandom":21}],15:[function(require,module,exports){ -// A port of an algorithm by Johannes Baagøe , 2010 -// http://baagoe.com/en/RandomMusings/javascript/ -// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror -// Original work is under MIT license - - -// Copyright (C) 2010 by Johannes Baagøe -// -// 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(global, module, define) { - -function Alea(seed) { - var me = this, mash = Mash(); - - me.next = function() { - var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32 - me.s0 = me.s1; - me.s1 = me.s2; - return me.s2 = t - (me.c = t | 0); - }; - - // Apply the seeding algorithm from Baagoe. - me.c = 1; - me.s0 = mash(' '); - me.s1 = mash(' '); - me.s2 = mash(' '); - me.s0 -= mash(seed); - if (me.s0 < 0) { me.s0 += 1; } - me.s1 -= mash(seed); - if (me.s1 < 0) { me.s1 += 1; } - me.s2 -= mash(seed); - if (me.s2 < 0) { me.s2 += 1; } - mash = null; -} - -function copy(f, t) { - t.c = f.c; - t.s0 = f.s0; - t.s1 = f.s1; - t.s2 = f.s2; - return t; -} - -function impl(seed, opts) { - var xg = new Alea(seed), - state = opts && opts.state, - prng = xg.next; - prng.int32 = function() { return (xg.next() * 0x100000000) | 0; } - prng.double = function() { - return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53 - }; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -function Mash() { - var n = 0xefc8249d; - - var mash = function(data) { - data = data.toString(); - for (var i = 0; i < data.length; i++) { - n += data.charCodeAt(i); - var h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000; // 2^32 - } - return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 - }; - - return mash; -} - - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.alea = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],16:[function(require,module,exports){ -// A Javascript implementaion of the "Tyche-i" prng algorithm by -// Samuel Neves and Filipe Araujo. -// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - // Set up generator function. - me.next = function() { - var b = me.b, c = me.c, d = me.d, a = me.a; - b = (b << 25) ^ (b >>> 7) ^ c; - c = (c - d) | 0; - d = (d << 24) ^ (d >>> 8) ^ a; - a = (a - b) | 0; - me.b = b = (b << 20) ^ (b >>> 12) ^ c; - me.c = c = (c - d) | 0; - me.d = (d << 16) ^ (c >>> 16) ^ a; - return me.a = (a - b) | 0; - }; - - /* The following is non-inverted tyche, which has better internal - * bit diffusion, but which is about 25% slower than tyche-i in JS. - me.next = function() { - var a = me.a, b = me.b, c = me.c, d = me.d; - a = (me.a + me.b | 0) >>> 0; - d = me.d ^ a; d = d << 16 ^ d >>> 16; - c = me.c + d | 0; - b = me.b ^ c; b = b << 12 ^ d >>> 20; - me.a = a = a + b | 0; - d = d ^ a; me.d = d = d << 8 ^ d >>> 24; - me.c = c = c + d | 0; - b = b ^ c; - return me.b = (b << 7 ^ b >>> 25); - } - */ - - me.a = 0; - me.b = 0; - me.c = 2654435769 | 0; - me.d = 1367130551; - - if (seed === Math.floor(seed)) { - // Integer seed. - me.a = (seed / 0x100000000) | 0; - me.b = seed | 0; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 20; k++) { - me.b ^= strseed.charCodeAt(k) | 0; - me.next(); - } -} - -function copy(f, t) { - t.a = f.a; - t.b = f.b; - t.c = f.c; - t.d = f.d; - return t; -}; - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.tychei = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],17:[function(require,module,exports){ -// A Javascript implementaion of the "xor128" prng algorithm by -// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - me.x = 0; - me.y = 0; - me.z = 0; - me.w = 0; - - // Set up generator function. - me.next = function() { - var t = me.x ^ (me.x << 11); - me.x = me.y; - me.y = me.z; - me.z = me.w; - return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8); - }; - - if (seed === (seed | 0)) { - // Integer seed. - me.x = seed; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 64; k++) { - me.x ^= strseed.charCodeAt(k) | 0; - me.next(); - } -} - -function copy(f, t) { - t.x = f.x; - t.y = f.y; - t.z = f.z; - t.w = f.w; - return t; -} - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xor128 = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],18:[function(require,module,exports){ -// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm. -// -// This fast non-cryptographic random number generator is designed for -// use in Monte-Carlo algorithms. It combines a long-period xorshift -// generator with a Weyl generator, and it passes all common batteries -// of stasticial tests for randomness while consuming only a few nanoseconds -// for each prng generated. For background on the generator, see Brent's -// paper: "Some long-period random number generators using shifts and xors." -// http://arxiv.org/pdf/1004.3115v1.pdf -// -// Usage: -// -// var xor4096 = require('xor4096'); -// random = xor4096(1); // Seed with int32 or string. -// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits. -// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits. -// -// For nonzero numeric keys, this impelementation provides a sequence -// identical to that by Brent's xorgens 3 implementaion in C. This -// implementation also provides for initalizing the generator with -// string seeds, or for saving and restoring the state of the generator. -// -// On Chrome, this prng benchmarks about 2.1 times slower than -// Javascript's built-in Math.random(). - -(function(global, module, define) { - -function XorGen(seed) { - var me = this; - - // Set up generator function. - me.next = function() { - var w = me.w, - X = me.X, i = me.i, t, v; - // Update Weyl generator. - me.w = w = (w + 0x61c88647) | 0; - // Update xor generator. - v = X[(i + 34) & 127]; - t = X[i = ((i + 1) & 127)]; - v ^= v << 13; - t ^= t << 17; - v ^= v >>> 15; - t ^= t >>> 12; - // Update Xor generator array state. - v = X[i] = v ^ t; - me.i = i; - // Result is the combination. - return (v + (w ^ (w >>> 16))) | 0; - }; - - function init(me, seed) { - var t, v, i, j, w, X = [], limit = 128; - if (seed === (seed | 0)) { - // Numeric seeds initialize v, which is used to generates X. - v = seed; - seed = null; - } else { - // String seeds are mixed into v and X one character at a time. - seed = seed + '\0'; - v = 0; - limit = Math.max(limit, seed.length); - } - // Initialize circular array and weyl value. - for (i = 0, j = -32; j < limit; ++j) { - // Put the unicode characters into the array, and shuffle them. - if (seed) v ^= seed.charCodeAt((j + 32) % seed.length); - // After 32 shuffles, take v as the starting w value. - if (j === 0) w = v; - v ^= v << 10; - v ^= v >>> 15; - v ^= v << 4; - v ^= v >>> 13; - if (j >= 0) { - w = (w + 0x61c88647) | 0; // Weyl. - t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array. - i = (0 == t) ? i + 1 : 0; // Count zeroes. - } - } - // We have detected all zeroes; make the key nonzero. - if (i >= 128) { - X[(seed && seed.length || 0) & 127] = -1; - } - // Run the generator 512 times to further mix the state before using it. - // Factoring this as a function slows the main generator, so it is just - // unrolled here. The weyl generator is not advanced while warming up. - i = 127; - for (j = 4 * 128; j > 0; --j) { - v = X[(i + 34) & 127]; - t = X[i = ((i + 1) & 127)]; - v ^= v << 13; - t ^= t << 17; - v ^= v >>> 15; - t ^= t >>> 12; - X[i] = v ^ t; - } - // Storing state as object members is faster than using closure variables. - me.w = w; - me.X = X; - me.i = i; - } - - init(me, seed); -} - -function copy(f, t) { - t.i = f.i; - t.w = f.w; - t.X = f.X.slice(); - return t; -}; - -function impl(seed, opts) { - if (seed == null) seed = +(new Date); - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (state.X) copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xor4096 = impl; -} - -})( - this, // window object or global - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - -},{}],19:[function(require,module,exports){ -// A Javascript implementaion of the "xorshift7" algorithm by -// François Panneton and Pierre L'ecuyer: -// "On the Xorgshift Random Number Generators" -// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf - -(function(global, module, define) { - -function XorGen(seed) { - var me = this; - - // Set up generator function. - me.next = function() { - // Update xor generator. - var X = me.x, i = me.i, t, v, w; - t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24); - t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10); - t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3); - t = X[(i + 4) & 7]; v ^= t ^ (t << 7); - t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9); - X[i] = v; - me.i = (i + 1) & 7; - return v; - }; - - function init(me, seed) { - var j, w, X = []; - - if (seed === (seed | 0)) { - // Seed state array using a 32-bit integer. - w = X[0] = seed; - } else { - // Seed state using a string. - seed = '' + seed; - for (j = 0; j < seed.length; ++j) { - X[j & 7] = (X[j & 7] << 15) ^ - (seed.charCodeAt(j) + X[(j + 1) & 7] << 13); - } - } - // Enforce an array length of 8, not all zeroes. - while (X.length < 8) X.push(0); - for (j = 0; j < 8 && X[j] === 0; ++j); - if (j == 8) w = X[7] = -1; else w = X[j]; - - me.x = X; - me.i = 0; - - // Discard an initial 256 values. - for (j = 256; j > 0; --j) { - me.next(); - } - } - - init(me, seed); -} - -function copy(f, t) { - t.x = f.x.slice(); - t.i = f.i; - return t; -} - -function impl(seed, opts) { - if (seed == null) seed = +(new Date); - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (state.x) copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xorshift7 = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - -},{}],20:[function(require,module,exports){ -// A Javascript implementaion of the "xorwow" prng algorithm by -// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper - -(function(global, module, define) { - -function XorGen(seed) { - var me = this, strseed = ''; - - // Set up generator function. - me.next = function() { - var t = (me.x ^ (me.x >>> 2)); - me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v; - return (me.d = (me.d + 362437 | 0)) + - (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0; - }; - - me.x = 0; - me.y = 0; - me.z = 0; - me.w = 0; - me.v = 0; - - if (seed === (seed | 0)) { - // Integer seed. - me.x = seed; - } else { - // String seed. - strseed += seed; - } - - // Mix in string seed, then discard an initial batch of 64 values. - for (var k = 0; k < strseed.length + 64; k++) { - me.x ^= strseed.charCodeAt(k) | 0; - if (k == strseed.length) { - me.d = me.x << 10 ^ me.x >>> 4; - } - me.next(); - } -} - -function copy(f, t) { - t.x = f.x; - t.y = f.y; - t.z = f.z; - t.w = f.w; - t.v = f.v; - t.d = f.d; - return t; -} - -function impl(seed, opts) { - var xg = new XorGen(seed), - state = opts && opts.state, - prng = function() { return (xg.next() >>> 0) / 0x100000000; }; - prng.double = function() { - do { - var top = xg.next() >>> 11, - bot = (xg.next() >>> 0) / 0x100000000, - result = (top + bot) / (1 << 21); - } while (result === 0); - return result; - }; - prng.int32 = xg.next; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); } - } - return prng; -} - -if (module && module.exports) { - module.exports = impl; -} else if (define && define.amd) { - define(function() { return impl; }); -} else { - this.xorwow = impl; -} - -})( - this, - (typeof module) == 'object' && module, // present in node.js - (typeof define) == 'function' && define // present with an AMD loader -); - - - -},{}],21:[function(require,module,exports){ -/* -Copyright 2014 David Bau. - -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 (pool, math) { -// -// The following constants are related to IEEE 754 limits. -// -var global = this, - width = 256, // each RC4 output is 0 <= x < 256 - chunks = 6, // at least six RC4 outputs for each double - digits = 52, // there are 52 significant digits in a double - rngname = 'random', // rngname: name for Math.random and Math.seedrandom - startdenom = math.pow(width, chunks), - significance = math.pow(2, digits), - overflow = significance * 2, - mask = width - 1, - nodecrypto; // node.js crypto module, initialized at the bottom. - -// -// seedrandom() -// This is the seedrandom function described above. -// -function seedrandom(seed, options, callback) { - var key = []; - options = (options == true) ? { entropy: true } : (options || {}); - - // Flatten the seed string or build one from local entropy if needed. - var shortseed = mixkey(flatten( - options.entropy ? [seed, tostring(pool)] : - (seed == null) ? autoseed() : seed, 3), key); - - // Use the seed to initialize an ARC4 generator. - var arc4 = new ARC4(key); - - // This function returns a random double in [0, 1) that contains - // randomness in every bit of the mantissa of the IEEE 754 value. - var prng = function() { - var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48 - d = startdenom, // and denominator d = 2 ^ 48. - x = 0; // and no 'extra last byte'. - while (n < significance) { // Fill up all significant digits by - n = (n + x) * width; // shifting numerator and - d *= width; // denominator and generating a - x = arc4.g(1); // new least-significant-byte. - } - while (n >= overflow) { // To avoid rounding up, before adding - n /= 2; // last byte, shift everything - d /= 2; // right using integer math until - x >>>= 1; // we have exactly the desired bits. - } - return (n + x) / d; // Form the number within [0, 1). - }; - - prng.int32 = function() { return arc4.g(4) | 0; } - prng.quick = function() { return arc4.g(4) / 0x100000000; } - prng.double = prng; - - // Mix the randomness into accumulated entropy. - mixkey(tostring(arc4.S), pool); - - // Calling convention: what to return as a function of prng, seed, is_math. - return (options.pass || callback || - function(prng, seed, is_math_call, state) { - if (state) { - // Load the arc4 state from the given state if it has an S array. - if (state.S) { copy(state, arc4); } - // Only provide the .state method if requested via options.state. - prng.state = function() { return copy(arc4, {}); } - } - - // If called as a method of Math (Math.seedrandom()), mutate - // Math.random because that is how seedrandom.js has worked since v1.0. - if (is_math_call) { math[rngname] = prng; return seed; } - - // Otherwise, it is a newer calling convention, so return the - // prng directly. - else return prng; - })( - prng, - shortseed, - 'global' in options ? options.global : (this == math), - options.state); -} -math['seed' + rngname] = seedrandom; - -// -// ARC4 -// -// An ARC4 implementation. The constructor takes a key in the form of -// an array of at most (width) integers that should be 0 <= x < (width). -// -// The g(count) method returns a pseudorandom integer that concatenates -// the next (count) outputs from ARC4. Its return value is a number x -// that is in the range 0 <= x < (width ^ count). -// -function ARC4(key) { - var t, keylen = key.length, - me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; - - // The empty key [] is treated as [0]. - if (!keylen) { key = [keylen++]; } - - // Set up S using the standard key scheduling algorithm. - while (i < width) { - s[i] = i++; - } - for (i = 0; i < width; i++) { - s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))]; - s[j] = t; - } - - // The "g" method returns the next (count) outputs as one number. - (me.g = function(count) { - // Using instance members instead of closure state nearly doubles speed. - var t, r = 0, - i = me.i, j = me.j, s = me.S; - while (count--) { - t = s[i = mask & (i + 1)]; - r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))]; - } - me.i = i; me.j = j; - return r; - // For robust unpredictability, the function call below automatically - // discards an initial batch of values. This is called RC4-drop[256]. - // See http://google.com/search?q=rsa+fluhrer+response&btnI - })(width); -} - -// -// copy() -// Copies internal state of ARC4 to or from a plain object. -// -function copy(f, t) { - t.i = f.i; - t.j = f.j; - t.S = f.S.slice(); - return t; -}; - -// -// flatten() -// Converts an object tree to nested arrays of strings. -// -function flatten(obj, depth) { - var result = [], typ = (typeof obj), prop; - if (depth && typ == 'object') { - for (prop in obj) { - try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} - } - } - return (result.length ? result : typ == 'string' ? obj : obj + '\0'); -} - -// -// mixkey() -// Mixes a string seed into a key that is an array of integers, and -// returns a shortened string seed that is equivalent to the result key. -// -function mixkey(seed, key) { - var stringseed = seed + '', smear, j = 0; - while (j < stringseed.length) { - key[mask & j] = - mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++)); - } - return tostring(key); -} - -// -// autoseed() -// Returns an object for autoseeding, using window.crypto and Node crypto -// module if available. -// -function autoseed() { - try { - var out; - if (nodecrypto && (out = nodecrypto.randomBytes)) { - // The use of 'out' to remember randomBytes makes tight minified code. - out = out(width); - } else { - out = new Uint8Array(width); - (global.crypto || global.msCrypto).getRandomValues(out); - } - return tostring(out); - } catch (e) { - var browser = global.navigator, - plugins = browser && browser.plugins; - return [+new Date, global, plugins, global.screen, tostring(pool)]; - } -} - -// -// tostring() -// Converts an array of charcodes to a string -// -function tostring(a) { - return String.fromCharCode.apply(0, a); -} - -// -// When seedrandom.js is loaded, we immediately mix a few bits -// from the built-in RNG into the entropy pool. Because we do -// not want to interfere with deterministic PRNG state later, -// seedrandom will not call math.random on its own again after -// initialization. -// -mixkey(math.random(), pool); - -// -// Nodejs and AMD support: export the implementation as a module using -// either convention. -// -if ((typeof module) == 'object' && module.exports) { - module.exports = seedrandom; - // When in node.js, try using crypto package for autoseeding. - try { - nodecrypto = require('crypto'); - } catch (ex) {} -} else if ((typeof define) == 'function' && define.amd) { - define(function() { return seedrandom; }); -} - -// End anonymous scope, and pass initial values. -})( - [], // pool: entropy pool starts empty - Math // math: package containing random, pow, and seedrandom -); - -},{"crypto":25}],22:[function(require,module,exports){ -// angle.js -// Released under MIT license -// Author: David Figatner -// Copyright (c) 2016-17 YOPEY YOPEY LLC - -var _toDegreeConversion = 180 / Math.PI -var _toRadianConversion = Math.PI / 180 - -/** @constant {number} */ -var UP = Math.PI / 2 -var DOWN = 3 * Math.PI / 2 -var LEFT = Math.PI -var RIGHT = 0 - -var NORTH = UP -var SOUTH = DOWN -var WEST = LEFT -var EAST = RIGHT - -var PI_2 = Math.PI * 2 -var PI_QUARTER = Math.PI / 4 -var PI_HALF = Math.PI / 2 - -/** - * converts from radians to degrees (all other functions expect radians) - * @param {number} radians - * @return {number} degrees - */ -function toDegrees(radians) -{ - return radians * _toDegreeConversion -} - -/** - * converts from degrees to radians (all other functions expect radians) - * @param {number} degrees - * @return {number} radians - */ -function toRadians(degrees) -{ - return degrees * _toRadianConversion -} - -/** - * returns whether the target angle is between angle1 and angle2 (in radians) - * (based on: http://stackoverflow.com/questions/11406189/determine-if-angle-lies-between-2-other-angles) - * @param {number} target angle - * @param {number} angle1 - * @param {number} angle2 - * @return {boolean} - */ -function isAngleBetween(target, angle1, angle2) -{ - var rAngle = ((angle2 - angle1) % PI_2 + PI_2) % PI_2 - if (rAngle >= Math.PI) - { - var swap = angle1 - angle1 = angle2 - angle2 = swap - } - - if (angle1 <= angle2) - { - return target >= angle1 && target <= angle2 - } - else - { - return target >= angle1 || target <= angle2 - } -} - -/** - * returns +1 or -1 based on whether the difference between two angles is positive or negative (in radians) - * @param {number} target angle - * @param {number} source angle - * @return {number} 1 or -1 - */ -function differenceAnglesSign(target, source) -{ - function mod(a, n) - { - return (a % n + n) % n - } - - var a = target - source - return mod((a + Math.PI), PI_2) - Math.PI > 0 ? 1 : -1 -} - -/** - * returns the normalized difference between two angles (in radians) - * @param {number} a - first angle - * @param {number} b - second angle - * @return {number} normalized difference between a and b - */ -function differenceAngles(a, b) -{ - var c = Math.abs(a - b) % PI_2 - return c > Math.PI ? (PI_2 - c) : c -} - -/** - * returns a target angle that is the shortest way to rotate an object between start and to--may choose a negative angle - * @param {number} start - * @param {number} to - * @return {number} shortest target angle - */ -function shortestAngle(start, to) -{ - var difference = differenceAngles(to, start) - var sign = differenceAnglesSign(to, start) - var delta = difference * sign - return delta + start -} - -/** - * returns the normalized angle (0 - PI x 2) - * @param {number} radians - * @return {number} normalized angle in radians - */ -function normalize(radians) -{ - return radians - PI_2 * Math.floor(radians / PI_2) -} - -/** - * returns angle between two points (in radians) - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} angle - */ -function angleTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 4) - { - return Math.atan2(arguments[3] - arguments[1], arguments[2] - arguments[0]) - } - else - { - return Math.atan2(arguments[1].y - arguments[0].y, arguments[1].x - arguments[0].x) - } -} - -/** - * returns distance between two points - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} distance - */ -function distanceTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 2) - { - return Math.sqrt(Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2)) - } - else - { - return Math.sqrt(Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2)) - } -} - -/** - * returns the squared distance between two points - * @param {Point} [point1] {x: x, y: y} - * @param {Point} [point2] {x: x, y: y} - * @param {number} [x1] - * @param {number} [y1] - * @param {number} [x2] - * @param {number} [y2] - * @return {number} squared distance - */ -function distanceTwoPointsSquared(/* (point1, point2) OR (x1, y1, x2, y2) */) -{ - if (arguments.length === 2) - { - return Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2) - } - else - { - return Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2) - } -} - -/** - * returns the closest cardinal (N, S, E, W) to the given angle (in radians) - * @param {number} angle - * @return {number} closest cardinal in radians - */ -function closestAngle(angle) -{ - var left = differenceAngles(angle, LEFT) - var right = differenceAngles(angle, RIGHT) - var up = differenceAngles(angle, UP) - var down = differenceAngles(angle, DOWN) - if (left <= right && left <= up && left <= down) - { - return LEFT - } - else if (right <= up && right <= down) - { - return RIGHT - } - else if (up <= down) - { - return UP - } - else - { - return DOWN - } -} - -/** - * checks whether angles a1 and a2 are equal (after normalizing) - * @param {number} a1 - * @param {number} a2 - * @param {number} [wiggle] return true if the difference between the angles is <= wiggle - * @return {boolean} a1 === a2 - */ -function equals(a1, a2, wiggle) -{ - if (wiggle) - { - return differenceAngles(a1, a2) < wiggle - } - else - { - return normalize(a1) === normalize(a2) - } -} - -/** - * return a text representation of the cardinal direction - * @param {number} angle - * @returns {string} UP, DOWN, LEFT, RIGHT, or NOT CARDINAL - */ -function explain(angle) -{ - switch (angle) - { - case UP: return 'UP' - case DOWN: return 'DOWN' - case LEFT: return 'LEFT' - case RIGHT: return 'RIGHT' - default: return 'NOT CARDINAL' - } -} - -module.exports = { - UP: UP, - DOWN: DOWN, - LEFT: LEFT, - RIGHT: RIGHT, - NORTH: NORTH, - SOUTH: SOUTH, - WEST: WEST, - EAST: EAST, - PI_2: PI_2, - PI_QUARTER: PI_QUARTER, - PI_HALF: PI_HALF, - - toDegrees: toDegrees, - toRadians: toRadians, - isAngleBetween: isAngleBetween, - differenceAnglesSign: differenceAnglesSign, - differenceAngles: differenceAngles, - shortestAngle: shortestAngle, - normalize: normalize, - angleTwoPoints: angleTwoPoints, - distanceTwoPoints: distanceTwoPoints, - distanceTwoPointsSquared: distanceTwoPointsSquared, - closestAngle: closestAngle, - equals: equals, - explain: explain -} -},{}],23:[function(require,module,exports){ -// yy-color -// by David Figatner -// MIT License -// (c) YOPEY YOPEY LLC 2017 -// https://github.com/davidfig/color - -var Random = require('yy-random') - -/** - * converts a #FFFFFF to 0x123456 - * @param {string} color - * @return {string} - */ -function poundToHex(color) -{ - return '0x' + parseInt(color.substr(1)).toString(16) -} - -/** - * converts a 0x123456 to #FFFFFF - * @param {string} color - * @return {string} - */ -function hexToPound(color) -{ - return '#' + color.substr(2) -} - -/** - * converts a number to #FFFFFF - * @param {number} color - * @return {string} - */ -function valueToPound(color) -{ - return '#' + color.toString(16) -} - -/** - * based on tinycolor - * https://github.com/bgrins/TinyColor - * BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE - * @param {string} color - * @returns {object} - */ -function hexToHsl (color) -{ - var rgb = this.hexToRgb(color), - r = rgb.r, - g = rgb.g, - b = rgb.b - var max = Math.max(r, g, b), - min = Math.min(r, g, b) - var h, s, l = (max + min) / 2 - - if (max === min) - { - h = s = 0 // achromatic - } - else - { - var d = max - min - s = l > 0.5 ? d / (2 - max - min) : d / (max + min) - switch (max) - { - case r: h = (g - b) / d + (g < b ? 6 : 0); break - case g: h = (b - r) / d + 2; break - case b: h = (r - g) / d + 4; break - } - - h /= 6 - } - - return { h: h, s: s, l: l } -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object|number} color {h, s, b} or h -* @param {number} [s] -* @param {number} [l] -* @returns number -*/ -function hslToHex(color) -{ - var r, g, b, h, s, l - if (arguments.length === 1) - { - h = color.h, - s = color.s, - l = color.l - } - else - { - h = arguments[0] - s = arguments[1] - l = arguments[2] - } - - function hue2rgb(p, q, t) { - if (t < 0) t += 1 - if (t > 1) t -= 1 - if (t < 1/6) return p + (q - p) * 6 * t - if (t < 1/2) return q - if (t < 2/3) return p + (q - p) * (2/3 - t) * 6 - return p - } - - if (s === 0) - { - r = g = b = l // achromatic - } - else - { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s - var p = 2 * l - q - r = hue2rgb(p, q, h + 1/3) - g = hue2rgb(p, q, h) - b = hue2rgb(p, q, h - 1/3) - } - - return this.rgbToHex(r * 255, g * 255, b * 255) -} - -/* darkens a color by the percentage -* @param {object} color in hex (0xabcdef) -* @param {number} amount -* @return {number} -*/ -function darken(color, amount) -{ - return this.blend(amount, color, 0) -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object} color -* @param {number} amount -*/ -function saturate(color, amount) -{ - amount = (amount === 0) ? 0 : (amount || 10) - var hsl = this.hexToHsl(color) - hsl.s += amount / 100 - hsl.s = Math.min(1, Math.max(0, hsl.s)) - return this.hslToHex(hsl) -} - -/** based on tinycolor -* https://github.com/bgrins/TinyColor -* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE -* @param {object} color -* @param {number} amount -*/ -function desaturate(color, amount) -{ - amount = (amount === 0) ? 0 : (amount || 10) - var hsl = this.hexToHsl(color) - hsl.s -= amount / 100 - hsl.s = Math.min(1, Math.max(0, hsl.s)) - return this.hslToHex(hsl) -} - -/** - * blends two colors together - * @param {number} percent [0.0 - 1.0] - * @param {string} color1 first color in 0x123456 format - * @param {string} color2 second color in 0x123456 format - * @return {number} - */ -function blend(percent, color1, color2) -{ - if (percent === 0) - { - return color1 - } - if (percent === 1) - { - return color2 - } - var r1 = color1 >> 16 - var g1 = color1 >> 8 & 0x0000ff - var b1 = color1 & 0x0000ff - var r2 = color2 >> 16 - var g2 = color2 >> 8 & 0x0000ff - var b2 = color2 & 0x0000ff - var percent1 = 1 - percent - var r = percent1 * r1 + percent * r2 - var g = percent1 * g1 + percent * g2 - var b = percent1 * b1 + percent * b2 - return r << 16 | g << 8 | b -} - -/** - * returns a hex color into an rgb value - * @param {number} hex - * @return {string} - */ -function hexToRgb(hex) -{ - if (hex === 0) - { - hex = '0x000000' - } - else if (typeof hex !== 'string') - { - var s = '000000' + hex.toString(16) - hex = '0x' + s.substr(s.length - 6) - } - var result = /^0x?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null -} - -/** - * rgb color to hex in the form of 0x123456 - * @param {(number|string)} r first number or 'rgb(...)' string - * @param {(number|null)} g - * @param {(number|null)} b - * @return {string} - */ -function rgbToHex(r, g, b) -{ - if (arguments.length === 1) { - if (Array.isArray(arguments[0])) { - var number = arguments[0] - r = number[0] - g = number[1] - b = number[2] - } else { - var parse = r.replace(/( *rgb *\( *)|( )|(\) *;?)/,'') - var numbers = parse.split(',') - r = numbers[0] - g = numbers[1] - b = numbers[2] - } - } - return '0x' + ((1 << 24) + (parseInt(r) << 16) + (parseInt(g) << 8) + parseInt(b)).toString(16).slice(1) -} - -/** - * returns a random color with balanced r, g, b values (i.e., r, g, b either have the same value or are 0) - * @param {number} min value for random number - * @param {number} max value for random number - * @return {number} color - */ -function random(min, max) -{ - function random() - { - return Random.range(min, max) - } - - var colors = [{r:1, g:1, b:1}, {r:1, g:1, b:0}, {r:1,g:0,b:1}, {r:0,g:1,b:1}, {r:1,g:0,b:0}, {r:0,g:1,b:0}, {r:0,g:0,b:1}] - var color = Random.pick(colors) - min = min || 0 - max = max || 255 - return this.rgbToHex(color.r ? random() : 0, color.g ? random() : 0, color.b ? random() : 0) -} - -// h: 0-360, s: 0-1, l: 0-1 -/** - * returns a random color based on hsl - * @param {number} hMin [0, 360] - * @param {number} hMax [hMin, 360] - * @param {number} sMin [0, 1] - * @param {number} sMax [sMin, 1] - * @param {number} lMin [0, 1] - * @param {number} lMax [lMin, 1] - */ -function randomHSL(hMin, hMax, sMin, sMax, lMin, lMax) -{ - var color = { - h: Random.range(hMin, hMax), - s: Random.range(sMin, sMax, true), - l: Random.range(lMin, lMax, true) - } - return this.hslToHex(color) -} - -/** - * returns random colors based on HSL with different hues - * based on http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ - * @returns {number[]} colors in hex format (0x123456) - */ -function randomGoldenRatioHSL(count, saturation, luminosity) -{ - var goldenRatio = 0.618033988749895 - var h = Random.get(1, true) - var colors = [] - for (var i = 0; i < count; i++) - { - colors.push(this.hslToHex(h, saturation, luminosity)) - h = (h + goldenRatio) % 1 - } - return colors -} - -module.exports = { - poundToHex: poundToHex, - hexToPound: hexToPound, - valueToPound: valueToPound, - hexToHsl: hexToHsl, - hslToHex: hslToHex, - hexToRgb: hexToRgb, - rgbToHex: rgbToHex, - darken: darken, - saturate: saturate, - desaturate: desaturate, - blend: blend, - random: random, - randomHSL: randomHSL, - randomGoldenRatioHSL: randomGoldenRatioHSL -} -},{"yy-random":24}],24:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// yy-random -// by David Figatner -// MIT license -// copyright YOPEY YOPEY LLC 2016-17 -// https://github.com/davidfig/random - -var seedrandom = require('seedrandom'); - -var Random = function () { - function Random() { - _classCallCheck(this, Random); - - this.generator = Math.random; - } - - /** - * generates a seeded number - * @param {number} seed - * @param {object} [options] - * @param {string} [PRNG="alea"] - name of algorithm, see https://github.com/davidbau/seedrandom - * @param {boolean} [save=true] - */ - - - _createClass(Random, [{ - key: 'seed', - value: function seed(_seed, options) { - options = options || {}; - this.generator = seedrandom[options.PRNG || 'alea'](_seed, { state: options.state }); - this.options = options; - } - - /** - * saves the state of the random generator - * can only be used after Random.seed() is called - * @returns {number} state - */ - - }, { - key: 'save', - value: function save() { - if (this.generator !== Math.random) { - return this.generator.state(); - } - } - - /** - * restores the state of the random generator - * @param {number} state - */ - - }, { - key: 'restore', - value: function restore(state) { - this.generator = seedrandom[this.options.PRNG || 'alea']('', { state: state }); - } - - /** - * changes the generator to use the old Math.sin-based random function - * based on : http://stackoverflow.com/questions/521295/javascript-random-seeds - * (deprecated) Use only for compatibility purposes - * @param {number} seed - */ - - }, { - key: 'seedOld', - value: function seedOld(seed) { - this.generator = function () { - var x = Math.sin(seed++) * 10000; - return x - Math.floor(x); - }; - } - - /** - * create a separate random generator using the seed - * @param {number} seed - * @return {object} - */ - - }, { - key: 'separateSeed', - value: function separateSeed(seed) { - var random = new Random(); - random.seed(seed); - return random; - } - - /** - * resets the random number this.generator to Math.random() - */ - - }, { - key: 'reset', - value: function reset() { - this.generator = Math.random; - } - - /** - * returns a random number using the this.generator between [0, ceiling - 1] - * @param {number} ceiling - * @param {boolean} [useFloat=false] - * @return {number} - */ - - }, { - key: 'get', - value: function get(ceiling, useFloat) { - var negative = ceiling < 0 ? -1 : 1; - ceiling *= negative; - var result = void 0; - if (useFloat) { - result = this.generator() * ceiling; - } else { - result = Math.floor(this.generator() * ceiling); - } - return result * negative; - } - - /** - * returns a random integer between 0 - Number.MAX_SAFE_INTEGER - * @return {number} - */ - - }, { - key: 'getHuge', - value: function getHuge() { - return this.get(Number.MAX_SAFE_INTEGER); - } - - /** - * random number [middle - range, middle + range] - * @param {number} middle - * @param {number} delta - * @param {boolean} [useFloat=false] - * @return {number} - */ - - }, { - key: 'middle', - value: function middle(_middle, delta, useFloat) { - var half = delta / 2; - return this.range(_middle - half, _middle + half, useFloat); - } - - /** - * random number [start, end] - * @param {number} start - * @param {number} end - * @param {boolean} [useFloat=false] if true, then range is (start, end)--i.e., not inclusive to start and end - * @return {number} - */ - - }, { - key: 'range', - value: function range(start, end, useFloat) { - // case where there is no range - if (end === start) { - return end; - } - - if (useFloat) { - return this.get(end - start, true) + start; - } else { - var range = void 0; - if (start < 0 && end > 0) { - range = -start + end + 1; - } else if (start === 0 && end > 0) { - range = end + 1; - } else if (start < 0 && end === 0) { - range = start - 1; - start = 1; - } else if (start < 0 && end < 0) { - range = end - start - 1; - } else { - range = end - start + 1; - } - return Math.floor(this.generator() * range) + start; - } - } - - /** - * an array of random numbers between [start, end] - * @param {number} start - * @param {number} end - * @param {number} count - * @param {boolean} [useFloat=false] - * @return {number[]} - */ - - }, { - key: 'rangeMultiple', - value: function rangeMultiple(start, end, count, useFloat) { - var array = []; - for (var i = 0; i < count; i++) { - array.push(this.range(start, end, useFloat)); - } - return array; - } - - /** - * an array of random numbers between [middle - range, middle + range] - * @param {number} middle - * @param {number} range - * @param {number} count - * @param {boolean} [useFloat=false] - * @return {number[]} - */ - - }, { - key: 'middleMultiple', - value: function middleMultiple(middle, range, count, useFloat) { - var array = []; - for (var i = 0; i < count; i++) { - array.push(middle(middle, range, useFloat)); - } - return array; - } - - /** - * @param {number} [chance=0.5] - * returns random sign (either +1 or -1) - * @return {number} - */ - - }, { - key: 'sign', - value: function sign(chance) { - chance = chance || 0.5; - return this.generator() < chance ? 1 : -1; - } - - /** - * tells you whether a random chance was achieved - * @param {number} [percent=0.5] - * @return {boolean} - */ - - }, { - key: 'chance', - value: function chance(percent) { - return this.generator() < (percent || 0.5); - } - - /** - * returns a random angle in radians [0 - 2 * Math.PI) - */ - - }, { - key: 'angle', - value: function angle() { - return this.get(Math.PI * 2, true); - } - - /** - * Shuffle array (either in place or copied) - * from http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array - * @param {Array} array - * @param {boolean} [copy=false] whether to shuffle in place (default) or return a new shuffled array - * @return {Array} a shuffled array - */ - - }, { - key: 'shuffle', - value: function shuffle(array, copy) { - if (copy) { - array = array.slice(); - } - if (array.length === 0) { - return array; - } - - var currentIndex = array.length, - temporaryValue = void 0, - randomIndex = void 0; - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - // Pick a remaining element... - randomIndex = this.get(currentIndex); - currentIndex -= 1; - - // And swap it with the current element. - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - return array; - } - - /** - * picks a random element from an array - * @param {Array} array - * @return {*} - */ - - }, { - key: 'pick', - value: function pick(array, remove) { - if (!remove) { - return array[this.get(array.length)]; - } else { - var pick = this.get(array.length); - var temp = array[pick]; - array.splice(pick, 1); - return temp; - } - } - - /** - * returns a random property from an object - * from http://stackoverflow.com/questions/2532218/pick-random-property-from-a-javascript-object - * @param {object} obj - * @return {*} - */ - - }, { - key: 'property', - value: function property(obj) { - var result; - var count = 0; - for (var prop in obj) { - if (this.chance(1 / ++count)) { - result = prop; - } - } - return result; - } - - /** - * creates a random set where each entry is a value between [min, max] - * @param {number} min - * @param {number} max - * @param {number} amount of numbers in set - * @param {number[]} - */ - - }, { - key: 'set', - value: function set(min, max, amount) { - var set = [], - all = [], - i; - for (i = min; i < max; i++) { - all.push(i); - } - - for (i = 0; i < amount; i++) { - var found = this.get(all.length); - set.push(all[found]); - all.splice(found, 1); - } - return set; - } - - /** - * returns a set of numbers with a randomly even distribution (i.e., no overlapping and filling the space) - * @param {number} start position - * @param {number} end position - * @param {number} count of non-start/end points - * @param {boolean} [includeStart=false] includes start point (count++) - * @param {boolean} [includeEnd=false] includes end point (count++) - * @param {boolean} [useFloat=false] - * @param {number[]} - */ - - }, { - key: 'distribution', - value: function distribution(start, end, count, includeStart, includeEnd, useFloat) { - var interval = Math.floor((end - start) / count); - var halfInterval = interval / 2; - var quarterInterval = interval / 4; - var set = []; - if (includeStart) { - set.push(start); - } - for (var i = 0; i < count; i++) { - set.push(start + i * interval + halfInterval + this.range(-quarterInterval, quarterInterval, useFloat)); - } - if (includeEnd) { - set.push(end); - } - return set; - } - - /** - * returns a random number based on weighted probability between [min, max] - * from http://stackoverflow.com/questions/22656126/javascript-random-number-with-weighted-probability - * @param {number} min value - * @param {number} max value - * @param {number} target for average value - * @param {number} stddev - standard deviation - */ - - }, { - key: 'weightedProbabilityInt', - value: function weightedProbabilityInt(min, max, target, stddev) { - function normRand() { - var x1 = void 0, - x2 = void 0, - rad = void 0; - do { - x1 = 2 * this.get(1, true) - 1; - x2 = 2 * this.get(1, true) - 1; - rad = x1 * x1 + x2 * x2; - } while (rad >= 1 || rad === 0); - var c = Math.sqrt(-2 * Math.log(rad) / rad); - return x1 * c; - } - - stddev = stddev || 1; - if (Math.random() < 0.81546) { - while (true) { - var sample = normRand() * stddev + target; - if (sample >= min && sample <= max) { - return sample; - } - } - } else { - return this.range(min, max); - } - } - - /* - * returns a random hex color (0 - 0xffffff) - * @return {number} - */ - - }, { - key: 'color', - value: function color() { - return this.get(0xffffff); - } - }]); - - return Random; -}(); - -module.exports = new Random(); - -},{"seedrandom":14}],25:[function(require,module,exports){ - -},{}]},{},[3]); + }), + (t.ease = h), + Object.defineProperty(t, '__esModule', { value: !0 }) +}) +//# sourceMappingURL=ease.js.map diff --git a/lib/3rdparty/pixi-viewport.js b/lib/3rdparty/pixi-viewport.js index d0308e3..18782e8 100644 --- a/lib/3rdparty/pixi-viewport.js +++ b/lib/3rdparty/pixi-viewport.js @@ -1,3465 +1,5856 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= this.options.time) + { + const originalWidth = this.parent.width; + const originalHeight = this.parent.height; + + this.complete(); + if (originalWidth !== this.parent.width || originalHeight !== this.parent.height) + { + this.parent.emit('zoomed', { viewport: this.parent, original: originalZoom, type: 'animate' }); + } + } + else + { + const percent = this.options.ease(this.time, 0, 1, this.options.time); + + if (this.width !== null) + { + const startWidth = this.startWidth ; + const deltaWidth = this.deltaWidth ; + + this.parent.fitWidth( + startWidth + (deltaWidth * percent), + this.keepCenter, + this.height === null); + } + if (this.height !== null) + { + const startHeight = this.startHeight ; + const deltaHeight = this.deltaHeight ; + + this.parent.fitHeight( + startHeight + (deltaHeight * percent), + this.keepCenter, + this.width === null); + } + if (this.width === null) + { + this.parent.scale.x = this.parent.scale.y; + } + else if (this.height === null) + { + this.parent.scale.y = this.parent.scale.x; + } + if (!this.keepCenter) + { + const startX = this.startX ; + const startY = this.startY ; + const deltaX = this.deltaX ; + const deltaY = this.deltaY ; + const original = new math.Point(this.parent.x, this.parent.y); + + this.parent.moveCenter(startX + (deltaX * percent), startY + (deltaY * percent)); + this.parent.emit('moved', { viewport: this.parent, original, type: 'animate' }); + } + if (this.width || this.height) + { + this.parent.emit('zoomed', { viewport: this.parent, original: originalZoom, type: 'animate' }); + } + } + } + } + + function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + + + + + + /** Options for {@link Bounce}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_BOUNCE_OPTIONS = { + sides: 'all', + friction: 0.5, + time: 150, + ease: 'easeInOutSine', + underflow: 'center', + bounceBox: null + }; + + /** + * @fires bounce-start-x + * @fires bounce.end-x + * @fires bounce-start-y + * @fires bounce-end-y + * @public + */ + class Bounce extends Plugin + { + /** The options passed to initialize this plugin, cannot be modified again. */ + + + /** Holds whether to bounce from left side. */ + + + /** Holds whether to bounce from top side. */ + + + /** Holds whether to bounce from right side. */ + + + /** Holds whether to bounce from bottom side. */ + + + /** Direction of underflow along x-axis. */ + + + /** Direction of underflow along y-axis. */ + + + /** Easing */ + + + /** Bounce state along x-axis */ + + + /** Bounce state along y-axis */ + + + /** + * This is called by {@link Viewport.bounce}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, DEFAULT_BOUNCE_OPTIONS, options); + this.ease = ease(this.options.ease, 'easeInOutSine'); + + if (this.options.sides) + { + if (this.options.sides === 'all') + { + this.top = this.bottom = this.left = this.right = true; + } + else if (this.options.sides === 'horizontal') + { + this.right = this.left = true; + this.top = this.bottom = false; + } + else if (this.options.sides === 'vertical') + { + this.left = this.right = false; + this.top = this.bottom = true; + } + else + { + this.top = this.options.sides.indexOf('top') !== -1; + this.bottom = this.options.sides.indexOf('bottom') !== -1; + this.left = this.options.sides.indexOf('left') !== -1; + this.right = this.options.sides.indexOf('right') !== -1; + } + } else { + this.left = this.top = this.right = this.bottom = false; + } + + const clamp = this.options.underflow.toLowerCase(); + + if (clamp === 'center') + { + this.underflowX = 0; + this.underflowY = 0; + } + else + { + this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0; + this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0; + } + + this.reset(); + } + + isActive() + { + return this.toX !== null || this.toY !== null; + } + + down() + { this.toX = this.toY = null; + + return false; } - }, { - key: 'up', - value: function up() { + + up() + { this.bounce(); + + return false; } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { + + update(elapsed) + { + if (this.paused) + { return; } this.bounce(); - if (this.toX) { - var toX = this.toX; + + if (this.toX) + { + const toX = this.toX; + toX.time += elapsed; this.parent.emit('moved', { viewport: this.parent, type: 'bounce-x' }); - if (toX.time >= this.time) { + + if (toX.time >= this.options.time) + { this.parent.x = toX.end; this.toX = null; this.parent.emit('bounce-x-end', this.parent); - } else { - this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.time); } - this.parent.dirty = true; + else + { + this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.options.time); + } } - if (this.toY) { - var toY = this.toY; + + if (this.toY) + { + const toY = this.toY; + toY.time += elapsed; this.parent.emit('moved', { viewport: this.parent, type: 'bounce-y' }); - if (toY.time >= this.time) { + + if (toY.time >= this.options.time) + { this.parent.y = toY.end; this.toY = null; this.parent.emit('bounce-y-end', this.parent); - } else { - this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.time); } - this.parent.dirty = true; + else + { + this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.options.time); + } } } - }, { - key: 'calcUnderflowX', - value: function calcUnderflowX() { - var x = void 0; - switch (this.underflowX) { + + /** @internal */ + calcUnderflowX() + { + let x; + + switch (this.underflowX) + { case -1: x = 0; break; case 1: - x = this.parent.screenWidth - this.parent.screenWorldWidth; + x = (this.parent.screenWidth - this.parent.screenWorldWidth); break; default: x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; } + return x; } - }, { - key: 'calcUnderflowY', - value: function calcUnderflowY() { - var y = void 0; - switch (this.underflowY) { + + /** @internal */ + calcUnderflowY() + { + let y; + + switch (this.underflowY) + { case -1: y = 0; break; case 1: - y = this.parent.screenHeight - this.parent.screenWorldHeight; + y = (this.parent.screenHeight - this.parent.screenWorldHeight); break; default: y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; } + return y; } - }, { - key: 'bounce', - value: function bounce() { - if (this.paused) { + + oob() + { + const box = this.options.bounceBox; + + if (box) + { + const x1 = typeof box.x === 'undefined' ? 0 : box.x; + const y1 = typeof box.y === 'undefined' ? 0 : box.y; + const width = typeof box.width === 'undefined' ? this.parent.worldWidth : box.width; + const height = typeof box.height === 'undefined' ? this.parent.worldHeight : box.height; + + return { + left: this.parent.left < x1, + right: this.parent.right > width, + top: this.parent.top < y1, + bottom: this.parent.bottom > height, + topLeft: new math.Point( + x1 * this.parent.scale.x, + y1 * this.parent.scale.y + ), + bottomRight: new math.Point( + width * this.parent.scale.x - this.parent.screenWidth, + height * this.parent.scale.y - this.parent.screenHeight + ) + }; + } + + return { + left: this.parent.left < 0, + right: this.parent.right > this.parent.worldWidth, + top: this.parent.top < 0, + bottom: this.parent.bottom > this.parent.worldHeight, + topLeft: new math.Point(0, 0), + bottomRight: new math.Point( + this.parent.worldWidth * this.parent.scale.x - this.parent.screenWidth, + this.parent.worldHeight * this.parent.scale.y - this.parent.screenHeight + ) + }; + } + + bounce() + { + if (this.paused) + { return; } - var oob = void 0; - var decelerate = this.parent.plugins['decelerate']; - if (decelerate && (decelerate.x || decelerate.y)) { - if (decelerate.x && decelerate.percentChangeX === decelerate.friction || decelerate.y && decelerate.percentChangeY === decelerate.friction) { - oob = this.parent.OOB(); - if (oob.left && this.left || oob.right && this.right) { - decelerate.percentChangeX = this.friction; + let oob; + let decelerate + + + + + + = this.parent.plugins.get('decelerate', true) ; + + if (decelerate && (decelerate.x || decelerate.y)) + { + if ((decelerate.x && decelerate.percentChangeX === _optionalChain$1([decelerate, 'access', _ => _.options, 'optionalAccess', _2 => _2.friction])) || (decelerate.y && decelerate.percentChangeY === _optionalChain$1([decelerate, 'access', _3 => _3.options, 'optionalAccess', _4 => _4.friction]))) + { + oob = this.oob(); + if ((oob.left && this.left) || (oob.right && this.right)) + { + decelerate.percentChangeX = this.options.friction; } - if (oob.top && this.top || oob.bottom && this.bottom) { - decelerate.percentChangeY = this.friction; + if ((oob.top && this.top) || (oob.bottom && this.bottom)) + { + decelerate.percentChangeY = this.options.friction; } } } - var drag = this.parent.plugins['drag'] || {}; - var pinch = this.parent.plugins['pinch'] || {}; + const drag = this.parent.plugins.get('drag', true) || {}; + const pinch = this.parent.plugins.get('pinch', true) || {}; + decelerate = decelerate || {}; - if (!drag.active && !pinch.active && (!this.toX || !this.toY) && (!decelerate.x || !decelerate.y)) { - oob = oob || this.parent.OOB(); - var point = oob.cornerPoint; - if (!this.toX && !decelerate.x) { - var x = null; - if (oob.left && this.left) { - x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : 0; - } else if (oob.right && this.right) { - x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : -point.x; + + if (!_optionalChain$1([drag, 'optionalAccess', _5 => _5.active]) && !_optionalChain$1([pinch, 'optionalAccess', _6 => _6.active]) && ((!this.toX || !this.toY) && (!decelerate.x || !decelerate.y))) + { + oob = oob || this.oob(); + const topLeft = oob.topLeft; + const bottomRight = oob.bottomRight; + + if (!this.toX && !decelerate.x) + { + let x = null; + + if (oob.left && this.left) + { + x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : -topLeft.x; } - if (x !== null && this.parent.x !== x) { + else if (oob.right && this.right) + { + x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : -bottomRight.x; + } + if (x !== null && this.parent.x !== x) + { this.toX = { time: 0, start: this.parent.x, delta: x - this.parent.x, end: x }; this.parent.emit('bounce-x-start', this.parent); } } - if (!this.toY && !decelerate.y) { - var y = null; - if (oob.top && this.top) { - y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : 0; - } else if (oob.bottom && this.bottom) { - y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : -point.y; + if (!this.toY && !decelerate.y) + { + let y = null; + + if (oob.top && this.top) + { + y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : -topLeft.y; } - if (y !== null && this.parent.y !== y) { + else if (oob.bottom && this.bottom) + { + y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : -bottomRight.y; + } + if (y !== null && this.parent.y !== y) + { this.toY = { time: 0, start: this.parent.y, delta: y - this.parent.y, end: y }; this.parent.emit('bounce-y-start', this.parent); } } } } - }, { - key: 'reset', - value: function reset() { + + reset() + { this.toX = this.toY = null; + this.bounce(); } - }]); - - return Bounce; -}(Plugin); - -},{"./plugin":9,"./utils":12}],2:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(ClampZoom, _Plugin); - - /** - * @private - * @param {object} [options] - * @param {number} [options.minWidth] minimum width - * @param {number} [options.minHeight] minimum height - * @param {number} [options.maxWidth] maximum width - * @param {number} [options.maxHeight] maximum height - */ - function ClampZoom(parent, options) { - _classCallCheck(this, ClampZoom); - - var _this = _possibleConstructorReturn(this, (ClampZoom.__proto__ || Object.getPrototypeOf(ClampZoom)).call(this, parent)); - - _this.minWidth = options.minWidth; - _this.minHeight = options.minHeight; - _this.maxWidth = options.maxWidth; - _this.maxHeight = options.maxHeight; - return _this; } - _createClass(ClampZoom, [{ - key: 'resize', - value: function resize() { - this.clamp(); - } - }, { - key: 'clamp', - value: function clamp() { - if (this.paused) { - return; - } - - var width = this.parent.worldScreenWidth; - var height = this.parent.worldScreenHeight; - if (this.minWidth && width < this.minWidth) { - this.parent.fitWidth(this.minWidth); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.maxWidth && width > this.maxWidth) { - this.parent.fitWidth(this.maxWidth); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.minHeight && height < this.minHeight) { - this.parent.fitHeight(this.minHeight); - width = this.parent.worldScreenWidth; - height = this.parent.worldScreenHeight; - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - if (this.maxHeight && height > this.maxHeight) { - this.parent.fitHeight(this.maxHeight); - this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); - } - } - }]); - - return ClampZoom; -}(Plugin); - -},{"./plugin":9}],3:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(clamp, _Plugin); - - /** - * @private - * @param {object} options - * @param {(number|boolean)} [options.left] clamp left; true=0 - * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth - * @param {(number|boolean)} [options.top] clamp top; true=0 - * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight - * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen + /** + * There are three ways to clamp: + * 1. direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of the world offscreen + * direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary + * 2. left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side; + * if any of these are set to true, then the location is set to the boundary [0, viewport.worldWidth/viewport.worldHeight] + * eg: to allow the world to be completely dragged offscreen, set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2] + * + * Underflow determines what happens when the world is smaller than the viewport + * 1. none = the world is clamped but there is no special behavior + * 2. center = the world is centered on the viewport + * 3. combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the appropriate boundaries + * */ - function clamp(parent, options) { - _classCallCheck(this, clamp); - options = options || {}; - var _this = _possibleConstructorReturn(this, (clamp.__proto__ || Object.getPrototypeOf(clamp)).call(this, parent)); - if (typeof options.direction === 'undefined') { - _this.left = utils.defaults(options.left, null); - _this.right = utils.defaults(options.right, null); - _this.top = utils.defaults(options.top, null); - _this.bottom = utils.defaults(options.bottom, null); - } else { - _this.left = options.direction === 'x' || options.direction === 'all'; - _this.right = options.direction === 'x' || options.direction === 'all'; - _this.top = options.direction === 'y' || options.direction === 'all'; - _this.bottom = options.direction === 'y' || options.direction === 'all'; - } - _this.parseUnderflow(options.underflow || 'center'); - _this.move(); - return _this; - } - _createClass(clamp, [{ - key: 'parseUnderflow', - value: function parseUnderflow(clamp) { - clamp = clamp.toLowerCase(); - if (clamp === 'center') { - this.underflowX = 0; - this.underflowY = 0; - } else { - this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0; - this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_CLAMP_OPTIONS = { + left: false, + right: false, + top: false, + bottom: false, + direction: null, + underflow: 'center' + }; + + /** + * Plugin to clamp the viewport to a specific world bounding box. + * + * @public + */ + class Clamp extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Last state of viewport */ + + + + + + + + + + + + /** + * This is called by {@link Viewport.clamp}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_CLAMP_OPTIONS, options); + + if (this.options.direction) + { + this.options.left = this.options.direction === 'x' || this.options.direction === 'all' ? true : null; + this.options.right = this.options.direction === 'x' || this.options.direction === 'all' ? true : null; + this.options.top = this.options.direction === 'y' || this.options.direction === 'all' ? true : null; + this.options.bottom = this.options.direction === 'y' || this.options.direction === 'all' ? true : null; } - } - }, { - key: 'move', - value: function move() { + + this.parseUnderflow(); + this.last = { x: null, y: null, scaleX: null, scaleY: null }; this.update(); } - }, { - key: 'update', - value: function update() { - if (this.paused) { + + parseUnderflow() + { + const clamp = this.options.underflow.toLowerCase(); + + if (clamp === 'none') + { + this.noUnderflow = true; + } + else if (clamp === 'center') + { + this.underflowX = this.underflowY = 0; + this.noUnderflow = false; + } + else + { + this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0; + this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0; + this.noUnderflow = false; + } + } + + move() + { + this.update(); + + return false; + } + + update() + { + if (this.paused) + { return; } - var decelerate = this.parent.plugins['decelerate'] || {}; - if (this.left !== null || this.right !== null) { - var moved = void 0; - if (this.parent.screenWorldWidth < this.parent.screenWidth) { - switch (this.underflowX) { + // only clamp on change + if (this.parent.x === this.last.x + && this.parent.y === this.last.y + && this.parent.scale.x === this.last.scaleX + && this.parent.scale.y === this.last.scaleY) + { + return; + } + const original = { x: this.parent.x, y: this.parent.y }; + // TODO: Fix + const decelerate = (this.parent.plugins ).decelerate || {}; + + if (this.options.left !== null || this.options.right !== null) + { + let moved = false; + + if (!this.noUnderflow && this.parent.screenWorldWidth < this.parent.screenWidth) + { + switch (this.underflowX) + { case -1: - if (this.parent.x !== 0) { + if (this.parent.x !== 0) + { this.parent.x = 0; moved = true; } break; case 1: - if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth) { + if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth) + { this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth; moved = true; } break; default: - if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2) { + if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2) + { this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; moved = true; } } - } else { - if (this.left !== null) { - if (this.parent.left < (this.left === true ? 0 : this.left)) { - this.parent.x = -(this.left === true ? 0 : this.left) * this.parent.scale.x; + } + else + { + if (this.options.left !== null) + { + if (this.parent.left < (this.options.left === true ? 0 : this.options.left)) + { + this.parent.x = -(this.options.left === true ? 0 : this.options.left) * this.parent.scale.x; decelerate.x = 0; moved = true; } } - if (this.right !== null) { - if (this.parent.right > (this.right === true ? this.parent.worldWidth : this.right)) { - this.parent.x = -(this.right === true ? this.parent.worldWidth : this.right) * this.parent.scale.x + this.parent.screenWidth; + if (this.options.right !== null) + { + if (this.parent.right > (this.options.right === true ? this.parent.worldWidth : this.options.right)) + { + this.parent.x = -(this.options.right === true ? this.parent.worldWidth : this.options.right) * this.parent.scale.x + this.parent.screenWidth; decelerate.x = 0; moved = true; } } } - if (moved) { - this.parent.emit('moved', { viewport: this.parent, type: 'clamp-x' }); + if (moved) + { + this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-x' }); } } - if (this.top !== null || this.bottom !== null) { - var _moved = void 0; - if (this.parent.screenWorldHeight < this.parent.screenHeight) { - switch (this.underflowY) { + if (this.options.top !== null || this.options.bottom !== null) + { + let moved = false; + + if (!this.noUnderflow && this.parent.screenWorldHeight < this.parent.screenHeight) + { + switch (this.underflowY) + { case -1: - if (this.parent.y !== 0) { + if (this.parent.y !== 0) + { this.parent.y = 0; - _moved = true; + moved = true; } break; case 1: - if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight) { - this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight; - _moved = true; + if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight) + { + this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight); + moved = true; } break; default: - if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2) { + if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2) + { this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; - _moved = true; + moved = true; } } - } else { - if (this.top !== null) { - if (this.parent.top < (this.top === true ? 0 : this.top)) { - this.parent.y = -(this.top === true ? 0 : this.top) * this.parent.scale.y; + } + else + { + if (this.options.top !== null) + { + if (this.parent.top < (this.options.top === true ? 0 : this.options.top)) + { + this.parent.y = -(this.options.top === true ? 0 : this.options.top) + * this.parent.scale.y; decelerate.y = 0; - _moved = true; + moved = true; } } - if (this.bottom !== null) { - if (this.parent.bottom > (this.bottom === true ? this.parent.worldHeight : this.bottom)) { - this.parent.y = -(this.bottom === true ? this.parent.worldHeight : this.bottom) * this.parent.scale.y + this.parent.screenHeight; + if (this.options.bottom !== null) + { + if (this.parent.bottom > (this.options.bottom === true ? this.parent.worldHeight : this.options.bottom)) + { + this.parent.y = -(this.options.bottom === true ? this.parent.worldHeight : this.options.bottom) + * this.parent.scale.y + this.parent.screenHeight; decelerate.y = 0; - _moved = true; + moved = true; } } } - if (_moved) { - this.parent.emit('moved', { viewport: this.parent, type: 'clamp-y' }); + if (moved) + { + this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-y' }); } } + this.last.x = this.parent.x; + this.last.y = this.parent.y; + this.last.scaleX = this.parent.scale.x; + this.last.scaleY = this.parent.scale.y; } - }]); - return clamp; -}(Plugin); - -},{"./plugin":9,"./utils":12}],4:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Decelerate, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.friction=0.95] percent to decelerate after movement - * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active) - * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration - */ - function Decelerate(parent, options) { - _classCallCheck(this, Decelerate); - - var _this = _possibleConstructorReturn(this, (Decelerate.__proto__ || Object.getPrototypeOf(Decelerate)).call(this, parent)); - - options = options || {}; - _this.friction = options.friction || 0.95; - _this.bounce = options.bounce || 0.5; - _this.minSpeed = typeof options.minSpeed !== 'undefined' ? options.minSpeed : 0.01; - _this.saved = []; - return _this; + reset() + { + this.update(); + } } - _createClass(Decelerate, [{ - key: 'down', - value: function down() { - this.saved = []; - this.x = this.y = false; + /** + * Options for {@link ClampZoom}. + * + * Use either minimum width/height or minimum scale + */ + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_CLAMP_ZOOM_OPTIONS = { + minWidth: null, + minHeight: null, + maxWidth: null, + maxHeight: null, + minScale: null, + maxScale: null + }; + + /** + * Plugin to clamp the viewport's zoom to a specific range. + * + * @public + */ + class ClampZoom extends Plugin + { + + + /** + * This is called by {@link Viewport.clampZoom}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_CLAMP_ZOOM_OPTIONS, options); + + this.clamp(); } - }, { - key: 'move', - value: function move() { - if (this.paused) { + + resize() + { + this.clamp(); + } + + /** Clamp the viewport scale zoom) */ + clamp() + { + if (this.paused) + { return; } - var count = this.parent.countDownPointers(); - if (count === 1 || count > 1 && !this.parent.plugins['pinch']) { + if (this.options.minWidth || this.options.minHeight || this.options.maxWidth || this.options.maxHeight) + { + let width = this.parent.worldScreenWidth; + let height = this.parent.worldScreenHeight; + + if (this.options.minWidth !== null && width < this.options.minWidth) + { + const original = this.parent.scale.x; + + this.parent.fitWidth(this.options.minWidth, false, false, true); + this.parent.scale.y *= this.parent.scale.x / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.maxWidth !== null && width > this.options.maxWidth) + { + const original = this.parent.scale.x; + + this.parent.fitWidth(this.options.maxWidth, false, false, true); + this.parent.scale.y *= this.parent.scale.x / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.minHeight !== null && height < this.options.minHeight) + { + const original = this.parent.scale.y; + + this.parent.fitHeight(this.options.minHeight, false, false, true); + this.parent.scale.x *= this.parent.scale.y / original; + width = this.parent.worldScreenWidth; + height = this.parent.worldScreenHeight; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + if (this.options.maxHeight !== null && height > this.options.maxHeight) + { + const original = this.parent.scale.y; + + this.parent.fitHeight(this.options.maxHeight, false, false, true); + this.parent.scale.x *= this.parent.scale.y / original; + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + } + else + if (this.options.minScale || this.options.maxScale) + { + const minScale = { x: null, y: null }; + const maxScale = { x: null, y: null }; + + if (typeof this.options.minScale === 'number') + { + minScale.x = this.options.minScale; + minScale.y = this.options.minScale; + } + else if (this.options.minScale !== null) + { + const optsMinScale = this.options.minScale ; + + minScale.x = typeof optsMinScale.x === 'undefined' ? null : optsMinScale.x; + minScale.y = typeof optsMinScale.y === 'undefined' ? null : optsMinScale.y; + } + + if (typeof this.options.maxScale === 'number') + { + maxScale.x = this.options.maxScale; + maxScale.y = this.options.maxScale; + } + else if (this.options.maxScale !== null) + { + const optsMaxScale = this.options.maxScale ; + + maxScale.x = typeof optsMaxScale.x === 'undefined' ? null : optsMaxScale.x; + maxScale.y = typeof optsMaxScale.y === 'undefined' ? null : optsMaxScale.y; + } + + let scaleX = this.parent.scale.x; + let scaleY = this.parent.scale.y; + + if (minScale.x !== null && scaleX < minScale.x) + { + scaleX = minScale.x; + } + if (maxScale.x !== null && scaleX > maxScale.x) + { + scaleX = maxScale.x; + } + if (minScale.y !== null && scaleY < minScale.y) + { + scaleY = minScale.y; + } + if (maxScale.y !== null && scaleY > maxScale.y) + { + scaleY = maxScale.y; + } + if (scaleX !== this.parent.scale.x || scaleY !== this.parent.scale.y) + { + this.parent.scale.set(scaleX, scaleY); + this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' }); + } + } + } + + reset() + { + this.clamp(); + } + } + + /** This allows independent x and y values for min/maxScale */ + + const DEFAULT_DECELERATE_OPTIONS = { + friction: 0.98, + bounce: 0.8, + minSpeed: 0.01 + }; + + /** + * Time period of decay (1 frame) + * + * @internal + * @ignore + */ + const TP = 16; + + /** + * Plugin to decelerate viewport velocity smoothly after panning ends. + * + * @public + */ + class Decelerate extends Plugin + { + /** Options used to initialize this plugin. */ + + + /** + * x-component of the velocity of viewport provided by this plugin, at the current time. + * + * This is measured in px/frame, where a frame is normalized to 16 milliseconds. + */ + + + /** + * y-component of the velocity of the viewport provided by this plugin, at the current time. + * + * This is measured in px/frame, where a frame is normalized to 16 milliseconds. + */ + + + /** + * The decay factor for the x-component of the viewport. + * + * The viewport's velocity decreased by this amount each 16 milliseconds. + */ + + + /** + * The decay factor for the y-component of the viewport. + * + * The viewport's velocity decreased by this amount each 16 milliseconds. + */ + + + /** Saved list of recent viewport position snapshots, to estimate velocity. */ + + + /** The time since the user released panning of the viewport. */ + + + /** + * This is called by {@link Viewport.decelerate}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, DEFAULT_DECELERATE_OPTIONS, options); + this.saved = []; + this.timeSinceRelease = 0; + + this.reset(); + this.parent.on('moved', (data) => this.moved(data)); + } + + down() + { + this.saved = []; + this.x = this.y = null; + + return false; + } + + isActive() + { + return !!(this.x || this.y); + } + + move() + { + if (this.paused) + { + return false; + } + + const count = this.parent.input.count(); + + if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch', true))) + { this.saved.push({ x: this.parent.x, y: this.parent.y, time: performance.now() }); - if (this.saved.length > 60) { + + if (this.saved.length > 60) + { this.saved.splice(0, 30); } } + + // Silently recording viewport positions + return false; } - }, { - key: 'up', - value: function up() { - if (this.parent.countDownPointers() === 0 && this.saved.length) { - var now = performance.now(); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = this.saved[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var save = _step.value; + /** Listener to viewport's "moved" event. */ + moved(data) + { + if (this.saved.length) + { + const last = this.saved[this.saved.length - 1]; - if (save.time >= now - 100) { - var time = now - save.time; - this.x = (this.parent.x - save.x) / time; - this.y = (this.parent.y - save.y) / time; - this.percentChangeX = this.percentChangeY = this.friction; - break; - } + if (data.type === 'clamp-x') + { + if (last.x === data.original.x) + { + last.x = this.parent.x; } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } + } + else if (data.type === 'clamp-y') + { + if (last.y === data.original.y) + { + last.y = this.parent.y; } } } } - /** - * manually activate plugin - * @param {object} options - * @param {number} [options.x] - * @param {number} [options.y] - */ + up() + { + if (this.parent.input.count() === 0 && this.saved.length) + { + const now = performance.now(); - }, { - key: 'activate', - value: function activate(options) { - options = options || {}; - if (typeof options.x !== 'undefined') { - this.x = options.x; - this.percentChangeX = this.friction; + for (const save of this.saved) + { + if (save.time >= now - 100) + { + const time = now - save.time; + + this.x = (this.parent.x - save.x) / time; + this.y = (this.parent.y - save.y) / time; + this.percentChangeX = this.percentChangeY = this.options.friction; + this.timeSinceRelease = 0; + break; + } + } } - if (typeof options.y !== 'undefined') { + + return false; + } + + /** + * Manually activate deceleration, starting from the (x, y) velocity components passed in the options. + * + * @param {object} options + * @param {number} [options.x] - Specify x-component of initial velocity. + * @param {number} [options.y] - Specify y-component of initial velocity. + */ + activate(options) + { + options = options || {}; + + if (typeof options.x !== 'undefined') + { + this.x = options.x; + this.percentChangeX = this.options.friction; + } + if (typeof options.y !== 'undefined') + { this.y = options.y; - this.percentChangeY = this.friction; + this.percentChangeY = this.options.friction; } } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { + + update(elapsed) + { + if (this.paused) + { return; } - var moved = void 0; - if (this.x) { - this.parent.x += this.x * elapsed; - this.x *= this.percentChangeX; - if (Math.abs(this.x) < this.minSpeed) { + /* + * See https://github.com/davidfig/pixi-viewport/issues/271 for math. + * + * The viewport velocity (this.x, this.y) decays exponentially by the the decay factor + * (this.percentChangeX, this.percentChangeY) each frame. This velocity function is integrated + * to calculate the displacement. + */ + + const moved = this.x || this.y; + + const ti = this.timeSinceRelease; + const tf = this.timeSinceRelease + elapsed; + + if (this.x) + { + const k = this.percentChangeX; + const lnk = Math.log(k); + + // Apply velocity delta on the viewport x-coordinate. + this.parent.x += ((this.x * TP) / lnk) * (Math.pow(k, tf / TP) - Math.pow(k, ti / TP)); + + // Apply decay on x-component of velocity + this.x *= Math.pow(this.percentChangeX, elapsed / TP); + } + if (this.y) + { + const k = this.percentChangeY; + const lnk = Math.log(k); + + // Apply velocity delta on the viewport y-coordinate. + this.parent.y += ((this.y * TP) / lnk) * (Math.pow(k, tf / TP) - Math.pow(k, ti / TP)); + + // Apply decay on y-component of velocity + this.y *= Math.pow(this.percentChangeY, elapsed / TP); + } + + this.timeSinceRelease += elapsed; + + // End decelerate velocity once it goes under a certain amount of precision. + if (this.x && this.y) { + if (Math.abs(this.x) < this.options.minSpeed && Math.abs(this.y) < this.options.minSpeed) { + this.x = 0; + this.y = 0; + } + } else { + if (Math.abs(this.x || 0) < this.options.minSpeed) { this.x = 0; } - moved = true; - } - if (this.y) { - this.parent.y += this.y * elapsed; - this.y *= this.percentChangeY; - if (Math.abs(this.y) < this.minSpeed) { + if (Math.abs(this.y || 0) < this.options.minSpeed) { this.y = 0; } - moved = true; } - if (moved) { - this.parent.dirty = true; + + if (moved) + { this.parent.emit('moved', { viewport: this.parent, type: 'decelerate' }); } } - }, { - key: 'reset', - value: function reset() { + + reset() + { this.x = this.y = null; } - }]); - - return Decelerate; -}(Plugin); - -},{"./plugin":9,"./utils":12}],5:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Drag, _Plugin); - - /** - * enable one-finger touch to drag - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {string} [options.direction=all] direction to drag (all, x, or y) - * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active) - * @param {number} [options.wheelScroll=1] number of pixels to scroll with each wheel spin - * @param {boolean} [options.reverse] reverse the direction of the wheel scroll - * @param {boolean|string} [options.clampWheel] (true, x, or y) clamp wheel (to avoid weird bounce with mouse wheel) - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - */ - function Drag(parent, options) { - _classCallCheck(this, Drag); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Drag.__proto__ || Object.getPrototypeOf(Drag)).call(this, parent)); - - _this.moved = false; - _this.wheelActive = utils.defaults(options.wheel, true); - _this.wheelScroll = options.wheelScroll || 1; - _this.reverse = options.reverse ? 1 : -1; - _this.clampWheel = options.clampWheel; - _this.xDirection = !options.direction || options.direction === 'all' || options.direction === 'x'; - _this.yDirection = !options.direction || options.direction === 'all' || options.direction === 'y'; - _this.parseUnderflow(options.underflow || 'center'); - return _this; } - _createClass(Drag, [{ - key: 'parseUnderflow', - value: function parseUnderflow(clamp) { - clamp = clamp.toLowerCase(); - if (clamp === 'center') { + /** Options for {@link Drag}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_DRAG_OPTIONS = { + direction: 'all', + pressDrag: true, + wheel: true, + wheelScroll: 1, + reverse: false, + clampWheel: false, + underflow: 'center', + factor: 1, + mouseButtons: 'all', + keyToPress: null, + ignoreKeyToPressOnTouch: false, + lineHeight: 20, + }; + + /** + * Plugin to enable panning/dragging of the viewport to move around. + * + * @public + */ + class Drag extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Flags when viewport is moving. */ + + + /** Factor to apply from {@link IDecelerateOptions}'s reverse. */ + + + /** Holds whether dragging is enabled along the x-axis. */ + + + /** Holds whether dragging is enabled along the y-axis. */ + + + /** Flags whether the keys required to drag are pressed currently. */ + + + /** Holds whether the left, center, and right buttons are required to pan. */ + + + /** Underflow factor along x-axis */ + + + /** Underflow factor along y-axis */ + + + /** Last pointer position while panning. */ + + + /** The ID of the pointer currently panning the viewport. */ + + + /** + * This is called by {@link Viewport.drag}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, DEFAULT_DRAG_OPTIONS, options); + this.moved = false; + this.reverse = this.options.reverse ? 1 : -1; + this.xDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'x'; + this.yDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'y'; + this.keyIsPressed = false; + + this.parseUnderflow(); + this.mouseButtons(this.options.mouseButtons); + + if (this.options.keyToPress) + { + this.handleKeyPresses(this.options.keyToPress); + } + } + + /** + * Handles keypress events and set the keyIsPressed boolean accordingly + * + * @param {array} codes - key codes that can be used to trigger drag event + */ + handleKeyPresses(codes) + { + window.addEventListener('keydown', (e) => + { + if (codes.includes(e.code)) + { this.keyIsPressed = true; } + }); + + window.addEventListener('keyup', (e) => + { + if (codes.includes(e.code)) + { this.keyIsPressed = false; } + }); + } + + /** + * initialize mousebuttons array + * @param {string} buttons + */ + mouseButtons(buttons) + { + if (!buttons || buttons === 'all') + { + this.mouse = [true, true, true]; + } + else + { + this.mouse = [ + buttons.indexOf('left') !== -1, + buttons.indexOf('middle') !== -1, + buttons.indexOf('right') !== -1 + ]; + } + } + + parseUnderflow() + { + const clamp = this.options.underflow.toLowerCase(); + + if (clamp === 'center') + { this.underflowX = 0; this.underflowY = 0; - } else { - this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0; - this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0; } - } - }, { - key: 'down', - value: function down(e) { - if (this.paused) { - return; - } - var count = this.parent.countDownPointers(); - if ((count === 1 || count > 1 && !this.parent.plugins['pinch']) && this.parent.parent) { - var parent = this.parent.parent.toLocal(e.data.global); - this.last = { x: e.data.global.x, y: e.data.global.y, parent: parent }; - this.current = e.data.pointerId; - } else { - this.last = null; - } - } - }, { - key: 'move', - value: function move(e) { - if (this.paused) { - return; - } - if (this.last && this.current === e.data.pointerId) { - var x = e.data.global.x; - var y = e.data.global.y; - var count = this.parent.countDownPointers(); - if (count === 1 || count > 1 && !this.parent.plugins['pinch']) { - var distX = x - this.last.x; - var distY = y - this.last.y; - if (this.moved || this.xDirection && this.parent.checkThreshold(distX) || this.yDirection && this.parent.checkThreshold(distY)) { - var newParent = this.parent.parent.toLocal(e.data.global); - if (this.xDirection) { - this.parent.x += newParent.x - this.last.parent.x; - } - if (this.yDirection) { - this.parent.y += newParent.y - this.last.parent.y; - } - this.last = { x: x, y: y, parent: newParent }; - if (!this.moved) { - this.parent.emit('drag-start', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent }); - } - this.moved = true; - this.parent.dirty = true; - this.parent.emit('moved', { viewport: this.parent, type: 'drag' }); - } - } else { - this.moved = false; + else + { + if (clamp.includes('left')) + { + this.underflowX = -1; + } + else if (clamp.includes('right')) + { + this.underflowX = 1; + } + else + { + this.underflowX = 0; + } + if (clamp.includes('top')) + { + this.underflowY = -1; + } + else if (clamp.includes('bottom')) + { + this.underflowY = 1; + } + else + { + this.underflowY = 0; } } } - }, { - key: 'up', - value: function up() { - var touches = this.parent.getTouchPointers(); - if (touches.length === 1) { - var pointer = touches[0]; - if (pointer.last) { - var parent = this.parent.parent.toLocal(pointer.last); - this.last = { x: pointer.last.x, y: pointer.last.y, parent: parent }; - this.current = pointer.last.data.pointerId; - } - this.moved = false; - } else if (this.last) { - if (this.moved) { - this.parent.emit('drag-end', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent }); - this.last = this.moved = false; - } - } - } - }, { - key: 'wheel', - value: function wheel(e) { - if (this.paused) { - return; - } - if (this.wheelActive) { - var wheel = this.parent.plugins['wheel']; - if (!wheel) { - this.parent.x += e.deltaX * this.wheelScroll * this.reverse; - this.parent.y += e.deltaY * this.wheelScroll * this.reverse; - if (this.clampWheel) { - this.clamp(); - } - this.parent.emit('wheel-scroll', this.parent); - this.parent.emit('moved', this.parent); - this.parent.dirty = true; - e.preventDefault(); + /** + * @param {PIXI.InteractionEvent} event + * @returns {boolean} + */ + checkButtons(event) + { + const isMouse = event.data.pointerType === 'mouse'; + const count = this.parent.input.count(); + + if ((count === 1) || (count > 1 && !this.parent.plugins.get('pinch', true))) + { + if (!isMouse || this.mouse[event.data.button]) + { return true; } } + + return false; } - }, { - key: 'resume', - value: function resume() { + + /** + * @param {PIXI.InteractionEvent} event + * @returns {boolean} + */ + checkKeyPress(event) + { + return (!this.options.keyToPress + || this.keyIsPressed + || (this.options.ignoreKeyToPressOnTouch && event.data.pointerType === 'touch')); + } + + down(event) + { + if (this.paused || !this.options.pressDrag) + { + return false; + } + if (this.checkButtons(event) && this.checkKeyPress(event)) + { + this.last = { x: event.data.global.x, y: event.data.global.y }; + this.current = event.data.pointerId; + + return true; + } + this.last = null; + + return false; + } + + get active() + { + return this.moved; + } + + move(event) + { + if (this.paused || !this.options.pressDrag) + { + return false; + } + if (this.last && this.current === event.data.pointerId) + { + const x = event.data.global.x; + const y = event.data.global.y; + const count = this.parent.input.count(); + + if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch', true))) + { + const distX = x - this.last.x; + const distY = y - this.last.y; + + if (this.moved + || ((this.xDirection && this.parent.input.checkThreshold(distX)) + || (this.yDirection && this.parent.input.checkThreshold(distY)))) + { + const newPoint = { x, y }; + + if (this.xDirection) + { + this.parent.x += (newPoint.x - this.last.x) * this.options.factor; + } + if (this.yDirection) + { + this.parent.y += (newPoint.y - this.last.y) * this.options.factor; + } + this.last = newPoint; + if (!this.moved) + { + this.parent.emit('drag-start', { + event, + screen: new math.Point(this.last.x, this.last.y), + world: this.parent.toWorld(new math.Point(this.last.x, this.last.y)), + viewport: this.parent + }); + } + this.moved = true; + this.parent.emit('moved', { viewport: this.parent, type: 'drag' }); + + return true; + } + } + else + { + this.moved = false; + } + } + + return false; + } + + up(event) + { + if (this.paused) + { + return false; + } + + const touches = this.parent.input.touches; + + if (touches.length === 1) + { + const pointer = touches[0]; + + if (pointer.last) + { + this.last = { x: pointer.last.x, y: pointer.last.y }; + this.current = pointer.id; + } + this.moved = false; + + return true; + } + else if (this.last) + { + if (this.moved) + { + const screen = new math.Point(this.last.x, this.last.y); + + this.parent.emit('drag-end', { + event, screen, + world: this.parent.toWorld(screen), + viewport: this.parent, + }); + this.last = null; + this.moved = false; + + return true; + } + } + + return false; + } + + wheel(event) + { + if (this.paused) + { + return false; + } + + if (this.options.wheel) + { + const wheel = this.parent.plugins.get('wheel', true); + + if (!wheel || (!wheel.options.wheelZoom && !event.ctrlKey)) + { + const step = event.deltaMode ? this.options.lineHeight : 1; + + if (this.xDirection) + { + this.parent.x += event.deltaX * step * this.options.wheelScroll * this.reverse; + } + if (this.yDirection) + { + this.parent.y += event.deltaY * step * this.options.wheelScroll * this.reverse; + } + if (this.options.clampWheel) + { + this.clamp(); + } + this.parent.emit('wheel-scroll', this.parent); + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + if (!this.parent.options.passiveWheel) + { + event.preventDefault(); + } + if (this.parent.options.stopPropagation) + { + event.stopPropagation(); + } + + return true; + } + } + + return false; + } + + resume() + { this.last = null; this.paused = false; } - }, { - key: 'clamp', - value: function clamp() { - var decelerate = this.parent.plugins['decelerate'] || {}; - if (this.clampWheel !== 'y') { - if (this.parent.screenWorldWidth < this.parent.screenWidth) { - switch (this.underflowX) { + + clamp() + { + const decelerate = this.parent.plugins.get('decelerate', true) || {}; + + if (this.options.clampWheel !== 'y') + { + if (this.parent.screenWorldWidth < this.parent.screenWidth) + { + switch (this.underflowX) + { case -1: this.parent.x = 0; break; case 1: - this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth; + this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth); break; default: this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2; } - } else { - if (this.parent.left < 0) { - this.parent.x = 0; - decelerate.x = 0; - } else if (this.parent.right > this.parent.worldWidth) { - this.parent.x = -this.parent.worldWidth * this.parent.scale.x + this.parent.screenWidth; - decelerate.x = 0; - } + } + else + if (this.parent.left < 0) + { + this.parent.x = 0; + decelerate.x = 0; + } + else if (this.parent.right > this.parent.worldWidth) + { + this.parent.x = (-this.parent.worldWidth * this.parent.scale.x) + this.parent.screenWidth; + decelerate.x = 0; } } - if (this.clampWheel !== 'x') { - if (this.parent.screenWorldHeight < this.parent.screenHeight) { - switch (this.underflowY) { + if (this.options.clampWheel !== 'x') + { + if (this.parent.screenWorldHeight < this.parent.screenHeight) + { + switch (this.underflowY) + { case -1: this.parent.y = 0; break; case 1: - this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight; + this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight); break; default: this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2; } - } else { - if (this.parent.top < 0) { + } + else + { + if (this.parent.top < 0) + { this.parent.y = 0; decelerate.y = 0; } - if (this.parent.bottom > this.parent.worldHeight) { - this.parent.y = -this.parent.worldHeight * this.parent.scale.y + this.parent.screenHeight; + if (this.parent.bottom > this.parent.worldHeight) + { + this.parent.y = (-this.parent.worldHeight * this.parent.scale.y) + this.parent.screenHeight; decelerate.y = 0; } } } } - }, { - key: 'active', - get: function get() { - return this.moved; - } - }]); - - return Drag; -}(Plugin); - -},{"./plugin":9,"./utils":12}],6:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Follow, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate}) - * @param {object} [options] - * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location) - * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport - */ - function Follow(parent, target, options) { - _classCallCheck(this, Follow); - - var _this = _possibleConstructorReturn(this, (Follow.__proto__ || Object.getPrototypeOf(Follow)).call(this, parent)); - - options = options || {}; - _this.speed = options.speed || 0; - _this.target = target; - _this.radius = options.radius; - return _this; } - _createClass(Follow, [{ - key: 'update', - value: function update() { - if (this.paused) { + /** Options for {@link Follow}. */ + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_FOLLOW_OPTIONS = { + speed: 0, + acceleration: null, + radius: null + }; + + /** + * Plugin to follow a display-object. + * + * @see Viewport.follow + * @public + */ + class Follow extends Plugin + { + /** The options used to initialize this plugin. */ + + + /** The target this plugin will make the viewport follow. */ + + + /** The velocity provided the viewport by following, at the current time. */ + + + /** + * This is called by {@link Viewport.follow}. + * + * @param parent + * @param target - target to follow + * @param options + */ + constructor(parent, target, options = {}) + { + super(parent); + + this.target = target; + this.options = Object.assign({}, DEFAULT_FOLLOW_OPTIONS, options); + this.velocity = { x: 0, y: 0 }; + } + + update(elapsed) + { + if (this.paused) + { return; } - var center = this.parent.center; - var toX = this.target.x, - toY = this.target.y; - if (this.radius) { - var distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2)); - if (distance > this.radius) { - var angle = Math.atan2(this.target.y - center.y, this.target.x - center.x); - toX = this.target.x - Math.cos(angle) * this.radius; - toY = this.target.y - Math.sin(angle) * this.radius; - } else { + const center = this.parent.center; + let toX = this.target.x; + let toY = this.target.y; + + if (this.options.radius) + { + const distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2)); + + if (distance > this.options.radius) + { + const angle = Math.atan2(this.target.y - center.y, this.target.x - center.x); + + toX = this.target.x - (Math.cos(angle) * this.options.radius); + toY = this.target.y - (Math.sin(angle) * this.options.radius); + } + else + { return; } } - if (this.speed) { - var deltaX = toX - center.x; - var deltaY = toY - center.y; - if (deltaX || deltaY) { - var _angle = Math.atan2(toY - center.y, toX - center.x); - var changeX = Math.cos(_angle) * this.speed; - var changeY = Math.sin(_angle) * this.speed; - var x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; - var y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; - this.parent.moveCenter(x, y); + + const deltaX = toX - center.x; + const deltaY = toY - center.y; + + if (deltaX || deltaY) + { + if (this.options.speed) + { + if (this.options.acceleration) + { + const angle = Math.atan2(toY - center.y, toX - center.x); + const distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); + + if (distance) + { + const decelerationDistance = (Math.pow(this.velocity.x, 2) + Math.pow(this.velocity.y, 2)) / (2 * this.options.acceleration); + + if (distance > decelerationDistance) + { + this.velocity = { + x: Math.min(this.velocity.x + this.options.acceleration * elapsed, this.options.speed), + y: Math.min(this.velocity.y + this.options.acceleration * elapsed, this.options.speed) + }; + } + else + { + this.velocity = { + x: Math.max(this.velocity.x - this.options.acceleration * this.options.speed, 0), + y: Math.max(this.velocity.y - this.options.acceleration * this.options.speed, 0) + }; + } + const changeX = Math.cos(angle) * this.velocity.x; + const changeY = Math.sin(angle) * this.velocity.y; + const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; + const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; + + this.parent.moveCenter(x, y); + this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); + } + } + else + { + const angle = Math.atan2(toY - center.y, toX - center.x); + const changeX = Math.cos(angle) * this.options.speed; + const changeY = Math.sin(angle) * this.options.speed; + const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX; + const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY; + + this.parent.moveCenter(x, y); + this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); + } + } + else + { + this.parent.moveCenter(toX, toY); this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); } - } else { - this.parent.moveCenter(toX, toY); - this.parent.emit('moved', { viewport: this.parent, type: 'follow' }); } } - }]); - - return Follow; -}(Plugin); - -},{"./plugin":9}],7:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(MouseEdges, _Plugin); - - /** - * Scroll viewport when mouse hovers near one of the edges. - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.radius] distance from center of screen in screen pixels - * @param {number} [options.distance] distance from all sides in screen pixels - * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll) - * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll) - * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll) - * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll) - * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport - * @param {boolean} [options.reverse] reverse direction of scroll - * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed - * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center)) - * - * @event mouse-edge-start(Viewport) emitted when mouse-edge starts - * @event mouse-edge-end(Viewport) emitted when mouse-edge ends - */ - function MouseEdges(parent, options) { - _classCallCheck(this, MouseEdges); - - var _this = _possibleConstructorReturn(this, (MouseEdges.__proto__ || Object.getPrototypeOf(MouseEdges)).call(this, parent)); - - options = options || {}; - _this.options = options; - _this.reverse = options.reverse ? 1 : -1; - _this.noDecelerate = options.noDecelerate; - _this.linear = options.linear; - _this.radiusSquared = Math.pow(options.radius, 2); - _this.resize(); - _this.speed = options.speed || 8; - return _this; } - _createClass(MouseEdges, [{ - key: 'resize', - value: function resize() { - var options = this.options; - var distance = options.distance; - if (utils.exists(distance)) { + /** Insets for mouse edges scrolling regions */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const MOUSE_EDGES_OPTIONS = { + radius: null, + distance: null, + top: null, + bottom: null, + left: null, + right: null, + speed: 8, + reverse: false, + noDecelerate: false, + linear: false, + allowButtons: false, + }; + + /** + * Scroll viewport when mouse hovers near one of the edges. + * + * @event mouse-edge-start(Viewport) emitted when mouse-edge starts + * @event mouse-edge-end(Viewport) emitted when mouse-edge ends + */ + class MouseEdges extends Plugin + { + /** Options used to initialize this plugin, cannot be modified later. */ + + + /** Factor from reverse option. */ + + + /** Radius squared */ + + + /** Scroll region size on the left side. */ + + + /** Scroll region size on the top size. */ + + + /** Scroll region size on the right side. */ + + + /** Scroll region size on the bottom side. */ + + + + + + + /** + * This is called by {@link Viewport.mouseEdges}. + */ + constructor(parent, options = {}) + { + super(parent); + + this.options = Object.assign({}, MOUSE_EDGES_OPTIONS, options); + this.reverse = this.options.reverse ? 1 : -1; + this.radiusSquared = typeof this.options.radius === 'number' ? Math.pow(this.options.radius, 2) : null; + + this.resize(); + } + + resize() + { + const distance = this.options.distance; + + if (distance !== null) + { this.left = distance; this.top = distance; - this.right = window.innerWidth - distance; - this.bottom = window.innerHeight - distance; - } else if (!this.radius) { - this.left = utils.exists(options.left) ? options.left : null; - this.top = utils.exists(options.top) ? options.top : null; - this.right = utils.exists(options.right) ? window.innerWidth - options.right : null; - this.bottom = utils.exists(options.bottom) ? window.innerHeight - options.bottom : null; + this.right = this.parent.screenWidth - distance; + this.bottom = this.parent.screenHeight - distance; + } + else if (!this.options.radius) + { + this.left = this.options.left; + this.top = this.options.top; + this.right = this.options.right === null ? null : this.parent.screenWidth - this.options.right; + this.bottom = this.options.bottom === null ? null : this.parent.screenHeight - this.options.bottom; } } - }, { - key: 'down', - value: function down() { - this.horizontal = this.vertical = null; - } - }, { - key: 'move', - value: function move(e) { - if (e.data.identifier !== 'MOUSE' || e.data.buttons !== 0) { - return; - } - var x = e.data.global.x; - var y = e.data.global.y; - if (this.radiusSquared) { - var center = this.parent.toScreen(this.parent.center); - var distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2); - if (distance >= this.radiusSquared) { - var angle = Math.atan2(center.y - y, center.x - x); - if (this.linear) { - this.horizontal = Math.round(Math.cos(angle)) * this.speed * this.reverse * (60 / 1000); - this.vertical = Math.round(Math.sin(angle)) * this.speed * this.reverse * (60 / 1000); - } else { - this.horizontal = Math.cos(angle) * this.speed * this.reverse * (60 / 1000); - this.vertical = Math.sin(angle) * this.speed * this.reverse * (60 / 1000); + down() + { + if (this.paused) + { + return false; + } + if (!this.options.allowButtons) + { + this.horizontal = this.vertical = null; + } + + return false; + } + + move(event) + { + if (this.paused) + { + return false; + } + if ((event.data.pointerType !== 'mouse' && event.data.identifier !== 1) + || (!this.options.allowButtons && event.data.buttons !== 0)) + { + return false; + } + + const x = event.data.global.x; + const y = event.data.global.y; + + if (this.radiusSquared) + { + const center = this.parent.toScreen(this.parent.center); + const distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2); + + if (distance >= this.radiusSquared) + { + const angle = Math.atan2(center.y - y, center.x - x); + + if (this.options.linear) + { + this.horizontal = Math.round(Math.cos(angle)) * this.options.speed * this.reverse * (60 / 1000); + this.vertical = Math.round(Math.sin(angle)) * this.options.speed * this.reverse * (60 / 1000); } - } else { - if (this.horizontal) { + else + { + this.horizontal = Math.cos(angle) * this.options.speed * this.reverse * (60 / 1000); + this.vertical = Math.sin(angle) * this.options.speed * this.reverse * (60 / 1000); + } + } + else + { + if (this.horizontal) + { this.decelerateHorizontal(); } - if (this.vertical) { + if (this.vertical) + { this.decelerateVertical(); } + this.horizontal = this.vertical = 0; } - } else { - if (utils.exists(this.left) && x < this.left) { - this.horizontal = 1 * this.reverse * this.speed * (60 / 1000); - } else if (utils.exists(this.right) && x > this.right) { - this.horizontal = -1 * this.reverse * this.speed * (60 / 1000); - } else { + } + else + { + if (this.left !== null && x < this.left) + { + this.horizontal = Number(this.reverse) * this.options.speed * (60 / 1000); + } + else if (this.right !== null && x > this.right) + { + this.horizontal = -1 * this.reverse * this.options.speed * (60 / 1000); + } + else + { this.decelerateHorizontal(); this.horizontal = 0; } - if (utils.exists(this.top) && y < this.top) { - this.vertical = 1 * this.reverse * this.speed * (60 / 1000); - } else if (utils.exists(this.bottom) && y > this.bottom) { - this.vertical = -1 * this.reverse * this.speed * (60 / 1000); - } else { + if (this.top !== null && y < this.top) + { + this.vertical = Number(this.reverse) * this.options.speed * (60 / 1000); + } + else if (this.bottom !== null && y > this.bottom) + { + this.vertical = -1 * this.reverse * this.options.speed * (60 / 1000); + } + else + { this.decelerateVertical(); this.vertical = 0; } } + + return false; } - }, { - key: 'decelerateHorizontal', - value: function decelerateHorizontal() { - var decelerate = this.parent.plugins['decelerate']; - if (this.horizontal && decelerate && !this.noDecelerate) { - decelerate.activate({ x: this.horizontal * this.speed * this.reverse / (1000 / 60) }); + + decelerateHorizontal() + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (this.horizontal && decelerate && !this.options.noDecelerate) + { + decelerate.activate({ x: (this.horizontal * this.options.speed * this.reverse) / (1000 / 60) }); } } - }, { - key: 'decelerateVertical', - value: function decelerateVertical() { - var decelerate = this.parent.plugins['decelerate']; - if (this.vertical && decelerate && !this.noDecelerate) { - decelerate.activate({ y: this.vertical * this.speed * this.reverse / (1000 / 60) }); + + decelerateVertical() + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (this.vertical && decelerate && !this.options.noDecelerate) + { + decelerate.activate({ y: (this.vertical * this.options.speed * this.reverse) / (1000 / 60) }); } } - }, { - key: 'up', - value: function up() { - if (this.horizontal) { + + up() + { + if (this.paused) + { + return false; + } + if (this.horizontal) + { this.decelerateHorizontal(); } - if (this.vertical) { + if (this.vertical) + { this.decelerateVertical(); } this.horizontal = this.vertical = null; + + return false; } - }, { - key: 'update', - value: function update() { - if (this.paused) { + + update() + { + if (this.paused) + { return; } - if (this.horizontal || this.vertical) { - var center = this.parent.center; - if (this.horizontal) { - center.x += this.horizontal * this.speed; + if (this.horizontal || this.vertical) + { + const center = this.parent.center; + + if (this.horizontal) + { + center.x += this.horizontal * this.options.speed; } - if (this.vertical) { - center.y += this.vertical * this.speed; + if (this.vertical) + { + center.y += this.vertical * this.options.speed; } + this.parent.moveCenter(center); this.parent.emit('moved', { viewport: this.parent, type: 'mouse-edges' }); } } - }]); - - return MouseEdges; -}(Plugin); - -},{"./plugin":9,"./utils":12}],8:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Pinch, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {boolean} [options.noDrag] disable two-finger dragging - * @param {number} [options.percent=1.0] percent to modify pinch speed - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers - */ - function Pinch(parent, options) { - _classCallCheck(this, Pinch); - - var _this = _possibleConstructorReturn(this, (Pinch.__proto__ || Object.getPrototypeOf(Pinch)).call(this, parent)); - - options = options || {}; - _this.percent = options.percent || 1.0; - _this.noDrag = options.noDrag; - _this.center = options.center; - return _this; } - _createClass(Pinch, [{ - key: 'down', - value: function down() { - if (this.parent.countDownPointers() >= 2) { - this.active = true; - } + /** Options for {@link Pinch}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_PINCH_OPTIONS = { + noDrag: false, + percent: 1, + center: null, + factor: 1, + axis: 'all', + }; + + /** + * Plugin for enabling two-finger pinching (or dragging). + * + * @public + */ + class Pinch extends Plugin + { + /** Options used to initialize this plugin. */ + + + /** Flags whether this plugin is active, i.e. a pointer is down on the viewport. */ + __init() {this.active = false;} + + /** Flags whether the viewport is being pinched. */ + __init2() {this.pinching = false;} + + __init3() {this.moved = false;} + + + /** + * This is called by {@link Viewport.pinch}. + */ + constructor(parent, options = {}) + { + super(parent);Pinch.prototype.__init.call(this);Pinch.prototype.__init2.call(this);Pinch.prototype.__init3.call(this);; + this.options = Object.assign({}, DEFAULT_PINCH_OPTIONS, options); } - }, { - key: 'move', - value: function move(e) { - if (this.paused || !this.active) { - return; + + down() + { + if (this.parent.input.count() >= 2) + { + this.active = true; + + return true; } - var x = e.data.global.x; - var y = e.data.global.y; + return false; + } - var pointers = this.parent.getTouchPointers(); - if (pointers.length >= 2) { - var first = pointers[0]; - var second = pointers[1]; - var last = first.last && second.last ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) : null; - if (first.pointerId === e.data.pointerId) { - first.last = { x: x, y: y, data: e.data }; - } else if (second.pointerId === e.data.pointerId) { - second.last = { x: x, y: y, data: e.data }; + isAxisX() + { + return ['all', 'x'].includes(this.options.axis); + } + + isAxisY() + { + return ['all', 'y'].includes(this.options.axis); + } + + move(e) + { + if (this.paused || !this.active) + { + return false; + } + + const x = e.data.global.x; + const y = e.data.global.y; + + const pointers = this.parent.input.touches; + + if (pointers.length >= 2) + { + const first = pointers[0] ; + const second = pointers[1] ; + const last = (first.last && second.last) + ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) + : null; + + if (first.id === e.data.pointerId) + { + first.last = { x, y, data: e.data } ; } - if (last) { - var oldPoint = void 0; - var point = { x: first.last.x + (second.last.x - first.last.x) / 2, y: first.last.y + (second.last.y - first.last.y) / 2 }; - if (!this.center) { + else if (second.id === e.data.pointerId) + { + second.last = { x, y, data: e.data } ; + } + if (last) + { + let oldPoint; + + const point = { + x: (first.last ).x + + ((second.last ).x - (first.last ).x) / 2, + y: (first.last ).y + + ((second.last ).y - (first.last ).y) / 2, + }; + + if (!this.options.center) + { oldPoint = this.parent.toLocal(point); } - var dist = Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)); - var change = (dist - last) / this.parent.screenWidth * this.parent.scale.x * this.percent; - this.parent.scale.x += change; - this.parent.scale.y += change; - this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch' }); - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { + let dist = Math.sqrt(Math.pow( + (second.last ).x - (first.last ).x, 2) + + Math.pow((second.last ).y - (first.last ).y, 2)); + + dist = dist === 0 ? dist = 0.0000000001 : dist; + + const change = (1 - last / dist) * this.options.percent + * (this.isAxisX() ? this.parent.scale.x : this.parent.scale.y); + + if (this.isAxisX()) + { + this.parent.scale.x += change; + } + if (this.isAxisY()) + { + this.parent.scale.y += change; + } + + this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch', center: point }); + + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { clamp.clamp(); } - if (this.center) { - this.parent.moveCenter(this.center); - } else { - var newPoint = this.parent.toGlobal(oldPoint); - this.parent.x += point.x - newPoint.x; - this.parent.y += point.y - newPoint.y; + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); + + this.parent.x += (point.x - newPoint.x) * this.options.factor; + this.parent.y += (point.y - newPoint.y) * this.options.factor; this.parent.emit('moved', { viewport: this.parent, type: 'pinch' }); } - if (!this.noDrag && this.lastCenter) { - this.parent.x += point.x - this.lastCenter.x; - this.parent.y += point.y - this.lastCenter.y; + if (!this.options.noDrag && this.lastCenter) + { + this.parent.x += (point.x - this.lastCenter.x) * this.options.factor; + this.parent.y += (point.y - this.lastCenter.y) * this.options.factor; this.parent.emit('moved', { viewport: this.parent, type: 'pinch' }); } + this.lastCenter = point; this.moved = true; - } else { - if (!this.pinching) { - this.parent.emit('pinch-start', this.parent); - this.pinching = true; - } } - this.parent.dirty = true; + else if (!this.pinching) + { + this.parent.emit('pinch-start', this.parent); + this.pinching = true; + } + + return true; } + + return false; } - }, { - key: 'up', - value: function up() { - if (this.pinching) { - if (this.parent.touches.length <= 1) { + + up() + { + if (this.pinching) + { + if (this.parent.input.touches.length <= 1) + { this.active = false; this.lastCenter = null; this.pinching = false; this.moved = false; this.parent.emit('pinch-end', this.parent); + + return true; } } + + return false; } - }]); - - return Pinch; -}(Plugin); - -},{"./plugin":9}],9:[function(require,module,exports){ -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -module.exports = function () { - function Plugin(parent) { - _classCallCheck(this, Plugin); - - this.parent = parent; - this.paused = false; } - _createClass(Plugin, [{ - key: "down", - value: function down() {} - }, { - key: "move", - value: function move() {} - }, { - key: "up", - value: function up() {} - }, { - key: "wheel", - value: function wheel() {} - }, { - key: "update", - value: function update() {} - }, { - key: "resize", - value: function resize() {} - }, { - key: "reset", - value: function reset() {} - }, { - key: "pause", - value: function pause() { - this.paused = true; - } - }, { - key: "resume", - value: function resume() { - this.paused = false; - } - }]); + const DEFAULT_SNAP_OPTIONS = { + topLeft: false, + friction: 0.8, + time: 1000, + ease: 'easeInOutSine', + interrupt: true, + removeOnComplete: false, + removeOnInterrupt: false, + forceStart: false + }; - return Plugin; -}(); - -},{}],10:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(SnapZoom, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom - * @param {boolean} [options.noMove] zoom but do not move - * - * @event snap-zoom-start(Viewport) emitted each time a fit animation starts - * @event snap-zoom-end(Viewport) emitted each time fit reaches its target - * @event snap-zoom-end(Viewport) emitted each time fit reaches its target + /** + * @event snap-start(Viewport) emitted each time a snap animation starts + * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size + * @event snap-end(Viewport) emitted each time snap reaches its target + * @event snap-remove(Viewport) emitted if snap plugin is removed */ - function SnapZoom(parent, options) { - _classCallCheck(this, SnapZoom); + class Snap extends Plugin + { + + + + - var _this = _possibleConstructorReturn(this, (SnapZoom.__proto__ || Object.getPrototypeOf(SnapZoom)).call(this, parent)); + + + + + + - options = options || {}; - _this.width = options.width; - _this.height = options.height; - if (_this.width > 0) { - _this.x_scale = parent._screenWidth / _this.width; - } - if (_this.height > 0) { - _this.y_scale = parent._screenHeight / _this.height; - } - _this.xIndependent = utils.exists(_this.x_scale); - _this.yIndependent = utils.exists(_this.y_scale); - _this.x_scale = _this.xIndependent ? _this.x_scale : _this.y_scale; - _this.y_scale = _this.yIndependent ? _this.y_scale : _this.x_scale; + /** + * This is called by {@link Viewport.snap}. + */ + constructor(parent, x, y, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_SNAP_OPTIONS, options); + this.ease = ease(options.ease, 'easeInOutSine'); + this.x = x; + this.y = y; - _this.time = utils.defaults(options.time, 1000); - _this.ease = utils.ease(options.ease, 'easeInOutSine'); - _this.center = options.center; - _this.noMove = options.noMove; - _this.stopOnResize = options.stopOnResize; - _this.removeOnInterrupt = options.removeOnInterrupt; - _this.removeOnComplete = utils.defaults(options.removeOnComplete, true); - _this.interrupt = utils.defaults(options.interrupt, true); - if (_this.time === 0) { - parent.container.scale.x = _this.x_scale; - parent.container.scale.y = _this.y_scale; - if (_this.removeOnComplete) { - _this.parent.removePlugin('snap-zoom'); - } - } else if (options.forceStart) { - _this.createSnapping(); - } - return _this; - } - - _createClass(SnapZoom, [{ - key: 'createSnapping', - value: function createSnapping() { - var scale = this.parent.scale; - this.snapping = { time: 0, startX: scale.x, startY: scale.y, deltaX: this.x_scale - scale.x, deltaY: this.y_scale - scale.y }; - this.parent.emit('snap-zoom-start', this.parent); - } - }, { - key: 'resize', - value: function resize() { - this.snapping = null; - - if (this.width > 0) { - this.x_scale = this.parent._screenWidth / this.width; - } - if (this.height > 0) { - this.y_scale = this.parent._screenHeight / this.height; - } - this.x_scale = this.xIndependent ? this.x_scale : this.y_scale; - this.y_scale = this.yIndependent ? this.y_scale : this.x_scale; - } - }, { - key: 'reset', - value: function reset() { - this.snapping = null; - } - }, { - key: 'wheel', - value: function wheel() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap-zoom'); + if (this.options.forceStart) + { + this.snapStart(); } } - }, { - key: 'down', - value: function down() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap-zoom'); - } else if (this.interrupt) { - this.snapping = null; - } - } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { - return; - } - if (this.interrupt && this.parent.countDownPointers() !== 0) { - return; - } - var oldCenter = void 0; - if (!this.center && !this.noMove) { - oldCenter = this.parent.center; - } - if (!this.snapping) { - if (this.parent.scale.x !== this.x_scale || this.parent.scale.y !== this.y_scale) { - this.createSnapping(); - } - } else if (this.snapping) { - var snapping = this.snapping; - snapping.time += elapsed; - if (snapping.time >= this.time) { - this.parent.scale.set(this.x_scale, this.y_scale); - if (this.removeOnComplete) { - this.parent.removePlugin('snap-zoom'); - } - this.parent.emit('snap-zoom-end', this.parent); - this.snapping = null; - } else { - var _snapping = this.snapping; - this.parent.scale.x = this.ease(_snapping.time, _snapping.startX, _snapping.deltaX, this.time); - this.parent.scale.y = this.ease(_snapping.time, _snapping.startY, _snapping.deltaY, this.time); - } - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { - clamp.clamp(); - } - if (!this.noMove) { - if (!this.center) { - this.parent.moveCenter(oldCenter); - } else { - this.parent.moveCenter(this.center); - } - } - } - } - }, { - key: 'resume', - value: function resume() { - this.snapping = null; - _get(SnapZoom.prototype.__proto__ || Object.getPrototypeOf(SnapZoom.prototype), 'resume', this).call(this); - } - }]); - - return SnapZoom; -}(Plugin); - -},{"./plugin":9,"./utils":12}],11:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); -var utils = require('./utils'); - -module.exports = function (_Plugin) { - _inherits(Snap, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {number} x - * @param {number} y - * @param {object} [options] - * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center - * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location - * - * @event snap-start(Viewport) emitted each time a snap animation starts - * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size - * @event snap-end(Viewport) emitted each time snap reaches its target - * @event snap-remove(Viewport) emitted if snap plugin is removed - */ - function Snap(parent, x, y, options) { - _classCallCheck(this, Snap); - - var _this = _possibleConstructorReturn(this, (Snap.__proto__ || Object.getPrototypeOf(Snap)).call(this, parent)); - - options = options || {}; - _this.friction = options.friction || 0.8; - _this.time = options.time || 1000; - _this.ease = utils.ease(options.ease, 'easeInOutSine'); - _this.x = x; - _this.y = y; - _this.topLeft = options.topLeft; - _this.interrupt = utils.defaults(options.interrupt, true); - _this.removeOnComplete = options.removeOnComplete; - _this.removeOnInterrupt = options.removeOnInterrupt; - if (options.forceStart) { - _this.startEase(); - } - return _this; - } - - _createClass(Snap, [{ - key: 'snapStart', - value: function snapStart() { + snapStart() + { this.percent = 0; this.snapping = { time: 0 }; - var current = this.topLeft ? this.parent.corner : this.parent.center; + const current = this.options.topLeft ? this.parent.corner : this.parent.center; + this.deltaX = this.x - current.x; this.deltaY = this.y - current.y; this.startX = current.x; this.startY = current.y; this.parent.emit('snap-start', this.parent); } - }, { - key: 'wheel', - value: function wheel() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap'); + + wheel() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap'); } + + return false; } - }, { - key: 'down', - value: function down() { - if (this.removeOnInterrupt) { - this.parent.removePlugin('snap'); - } else if (this.interrupt) { + + down() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap'); + } + else if (this.options.interrupt) + { this.snapping = null; } + + return false; } - }, { - key: 'up', - value: function up() { - if (this.parent.countDownPointers() === 0) { - var decelerate = this.parent.plugins['decelerate']; - if (decelerate && (decelerate.x || decelerate.y)) { - decelerate.percentChangeX = decelerate.percentChangeY = this.friction; + + up() + { + if (this.parent.input.count() === 0) + { + const decelerate = this.parent.plugins.get('decelerate', true); + + if (decelerate && (decelerate.x || decelerate.y)) + { + decelerate.percentChangeX = decelerate.percentChangeY = this.options.friction; } } + + return false; } - }, { - key: 'update', - value: function update(elapsed) { - if (this.paused) { + + update(elapsed) + { + if (this.paused) + { return; } - if (this.interrupt && this.parent.countDownPointers() !== 0) { + if (this.options.interrupt && this.parent.input.count() !== 0) + { return; } - if (!this.snapping) { - var current = this.topLeft ? this.parent.corner : this.parent.center; - if (current.x !== this.x || current.y !== this.y) { + if (!this.snapping) + { + const current = this.options.topLeft ? this.parent.corner : this.parent.center; + + if (current.x !== this.x || current.y !== this.y) + { this.snapStart(); } - } else { - var snapping = this.snapping; + } + else + { + const snapping = this.snapping; + snapping.time += elapsed; - var finished = void 0, - x = void 0, - y = void 0; - if (snapping.time > this.time) { + let finished; + let x; + let y; + + const startX = this.startX ; + const startY = this.startY ; + const deltaX = this.deltaX ; + const deltaY = this.deltaY ; + + if (snapping.time > this.options.time) + { finished = true; - x = this.startX + this.deltaX; - y = this.startY + this.deltaY; - } else { - var percent = this.ease(snapping.time, 0, 1, this.time); - x = this.startX + this.deltaX * percent; - y = this.startY + this.deltaY * percent; + x = startX + deltaX; + y = startY + deltaY; } - if (this.topLeft) { + else + { + const percent = this.ease(snapping.time, 0, 1, this.options.time); + + x = startX + (deltaX * percent); + y = startY + (deltaY * percent); + } + if (this.options.topLeft) + { this.parent.moveCorner(x, y); - } else { + } + else + { this.parent.moveCenter(x, y); } + this.parent.emit('moved', { viewport: this.parent, type: 'snap' }); - if (finished) { - if (this.removeOnComplete) { - this.parent.removePlugin('snap'); + + if (finished) + { + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap'); } this.parent.emit('snap-end', this.parent); this.snapping = null; } } } - }]); - - return Snap; -}(Plugin); - -},{"./plugin":9,"./utils":12}],12:[function(require,module,exports){ -'use strict'; - -var Penner = require('penner'); - -function exists(a) { - return a !== undefined && a !== null; -} - -function defaults(a, defaults) { - return a !== undefined && a !== null ? a : defaults; -} - -/** - * @param {(function|string)} [ease] - * @param {string} defaults for pennr equation - * @private - * @returns {function} correct penner equation - */ -function ease(ease, defaults) { - if (!exists(ease)) { - return Penner[defaults]; - } else if (typeof ease === 'function') { - return ease; - } else if (typeof ease === 'string') { - return Penner[ease]; - } -} - -module.exports = { - exists: exists, - defaults: defaults, - ease: ease -}; - -},{"penner":15}],13:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var utils = require('./utils'); -var Drag = require('./drag'); -var Pinch = require('./pinch'); -var Clamp = require('./clamp'); -var ClampZoom = require('./clamp-zoom'); -var Decelerate = require('./decelerate'); -var Bounce = require('./bounce'); -var Snap = require('./snap'); -var SnapZoom = require('./snap-zoom'); -var Follow = require('./follow'); -var Wheel = require('./wheel'); -var MouseEdges = require('./mouse-edges'); - -var PLUGIN_ORDER = ['drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', 'snap-zoom', 'clamp-zoom', 'snap', 'clamp']; - -var Viewport = function (_PIXI$Container) { - _inherits(Viewport, _PIXI$Container); - - /** - * @extends PIXI.Container - * @extends EventEmitter - * @param {object} [options] - * @param {number} [options.screenWidth=window.innerWidth] - * @param {number} [options.screenHeight=window.innerHeight] - * @param {number} [options.worldWidth=this.width] - * @param {number} [options.worldHeight=this.height] - * @param {number} [options.threshold = 5] number of pixels to move to trigger an input event (e.g., drag, pinch) - * @param {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)} [options.forceHitArea] change the default hitArea from world size to a new value - * @param {PIXI.ticker.Ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for updates - * @param {PIXI.InteractionManager} [options.interaction=null] InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer postion relative to canvas location on screen - * @param {HTMLElement} [options.divWheel=document.body] div to attach the wheel event - * @fires clicked - * @fires drag-start - * @fires drag-end - * @fires drag-remove - * @fires pinch-start - * @fires pinch-end - * @fires pinch-remove - * @fires snap-start - * @fires snap-end - * @fires snap-remove - * @fires snap-zoom-start - * @fires snap-zoom-end - * @fires snap-zoom-remove - * @fires bounce-x-start - * @fires bounce-x-end - * @fires bounce-y-start - * @fires bounce-y-end - * @fires bounce-remove - * @fires wheel - * @fires wheel-remove - * @fires wheel-scroll - * @fires wheel-scroll-remove - * @fires mouse-edge-start - * @fires mouse-edge-end - * @fires mouse-edge-remove - * @fires moved - */ - function Viewport(options) { - _classCallCheck(this, Viewport); - - options = options || {}; - - var _this = _possibleConstructorReturn(this, (Viewport.__proto__ || Object.getPrototypeOf(Viewport)).call(this)); - - _this.plugins = {}; - _this.pluginsList = []; - _this._screenWidth = options.screenWidth; - _this._screenHeight = options.screenHeight; - _this._worldWidth = options.worldWidth; - _this._worldHeight = options.worldHeight; - _this.hitAreaFullScreen = utils.defaults(options.hitAreaFullScreen, true); - _this.forceHitArea = options.forceHitArea; - _this.threshold = utils.defaults(options.threshold, 5); - _this.interaction = options.interaction || null; - _this.div = options.divWheel || document.body; - _this.listeners(_this.div); - - /** - * active touch point ids on the viewport - * @type {number[]} - * @readonly - */ - _this.touches = []; - - _this.ticker = options.ticker || PIXI.ticker.shared; - _this.tickerFunction = function () { - return _this.update(); - }; - _this.ticker.add(_this.tickerFunction); - return _this; } - /** - * removes all event listeners from viewport - * (useful for cleanup of wheel and ticker events when removing viewport) + /** Options for {@link SnapZoom}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_SNAP_ZOOM_OPTIONS = { + width: 0, + height: 0, + time: 1000, + ease: 'easeInOutSine', + center: null, + interrupt: true, + removeOnComplete: false, + removeOnInterrupt: false, + forceStart: false, + noMove: false + }; + + /** + * @event snap-zoom-start(Viewport) emitted each time a fit animation starts + * @event snap-zoom-end(Viewport) emitted each time fit reaches its target + * @event snap-zoom-end(Viewport) emitted each time fit reaches its target */ + class SnapZoom extends Plugin + { + + + + + + + + - _createClass(Viewport, [{ - key: 'removeListeners', - value: function removeListeners() { - this.ticker.remove(this.tickerFunction); - this.div.removeEventListener('wheel', this.wheelFunction); - } - /** - * overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners + + + + + /** + * This is called by {@link Viewport.snapZoom}. */ + constructor(parent, options = {}) + { + super(parent); - }, { - key: 'destroy', - value: function destroy(options) { - _get(Viewport.prototype.__proto__ || Object.getPrototypeOf(Viewport.prototype), 'destroy', this).call(this, options); - this.removeListeners(); - } + this.options = Object.assign({}, DEFAULT_SNAP_ZOOM_OPTIONS, options); + this.ease = ease(this.options.ease); - /** - * update animations - * @private - */ + // Assign defaults for typescript. + this.xIndependent = false; + this.yIndependent = false; + this.xScale = 0; + this.yScale = 0; - }, { - key: 'update', - value: function update() { - if (!this.pause) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + if (this.options.width > 0) + { + this.xScale = parent.screenWidth / this.options.width; + this.xIndependent = true; + } + if (this.options.height > 0) + { + this.yScale = parent.screenHeight / this.options.height; + this.yIndependent = true; + } - try { - for (var _iterator = this.pluginsList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var plugin = _step.value; + this.xScale = this.xIndependent ? (this.xScale ) : (this.yScale ); + this.yScale = this.yIndependent ? (this.yScale ) : this.xScale; - plugin.update(this.ticker.elapsedMS); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + if (this.options.time === 0) + { + // TODO: Fix this + // @ts-expect-error todo + parent.container.scale.x = this.xScale; + + // TODO: Fix this + // @ts-expect-error todo + parent.container.scale.y = this.yScale; + + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap-zoom'); } } - if (!this.forceHitArea) { - this.hitArea.x = this.left; - this.hitArea.y = this.top; - this.hitArea.width = this.worldScreenWidth; - this.hitArea.height = this.worldScreenHeight; + else if (options.forceStart) + { + this.createSnapping(); } } - /** - * use this to set screen and world sizes--needed for pinch/wheel/clamp/bounce - * @param {number} screenWidth - * @param {number} screenHeight - * @param {number} [worldWidth] - * @param {number} [worldHeight] - */ + createSnapping() + { + const startWorldScreenWidth = this.parent.worldScreenWidth; + const startWorldScreenHeight = this.parent.worldScreenHeight; + const endWorldScreenWidth = this.parent.screenWidth / this.xScale; + const endWorldScreenHeight = this.parent.screenHeight / this.yScale; - }, { - key: 'resize', - value: function resize(screenWidth, screenHeight, worldWidth, worldHeight) { - this._screenWidth = screenWidth || window.innerWidth; - this._screenHeight = screenHeight || window.innerHeight; - this._worldWidth = worldWidth; - this._worldHeight = worldHeight; - this.resizePlugins(); - } - - /** - * called after a worldWidth/Height change - * @private - */ - - }, { - key: 'resizePlugins', - value: function resizePlugins() { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.pluginsList[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var plugin = _step2.value; - - plugin.resize(); - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } - - /** - * screen width in screen pixels - * @type {number} - */ - - }, { - key: 'listeners', - - - /** - * add input listeners - * @private - */ - value: function listeners(div) { - var _this2 = this; - - this.interactive = true; - if (!this.forceHitArea) { - this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight); - } - this.on('pointerdown', this.down); - this.on('pointermove', this.move); - this.on('pointerup', this.up); - this.on('pointerupoutside', this.up); - this.on('pointercancel', this.up); - this.on('pointerout', this.up); - this.wheelFunction = function (e) { - return _this2.handleWheel(e); + this.snapping = { + time: 0, + startX: startWorldScreenWidth, + startY: startWorldScreenHeight, + deltaX: endWorldScreenWidth - startWorldScreenWidth, + deltaY: endWorldScreenHeight - startWorldScreenHeight }; - div.addEventListener('wheel', this.wheelFunction); - this.leftDown = false; + + this.parent.emit('snap-zoom-start', this.parent); } - /** - * handle down events - * @private - */ + resize() + { + this.snapping = null; - }, { - key: 'down', - value: function down(e) { - if (this.pause) { - return; + if (this.options.width > 0) + { + this.xScale = this.parent.screenWidth / this.options.width; } - if (e.data.pointerType === 'mouse') { - if (e.data.originalEvent.button == 0) { - this.leftDown = true; - } - } else { - this.touches.push(e.data.pointerId); - } - - if (this.countDownPointers() === 1) { - this.last = { x: e.data.global.x, y: e.data.global.y - - // clicked event does not fire if viewport is decelerating or bouncing - };var decelerate = this.plugins['decelerate']; - var bounce = this.plugins['bounce']; - if ((!decelerate || !decelerate.x && !decelerate.y) && (!bounce || !bounce.toX && !bounce.toY)) { - this.clickedAvailable = true; - } - } else { - this.clickedAvailable = false; - } - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = this.pluginsList[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var plugin = _step3.value; - - plugin.down(e); - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } + if (this.options.height > 0) + { + this.yScale = this.parent.screenHeight / this.options.height; } + this.xScale = this.xIndependent ? this.xScale : this.yScale; + this.yScale = this.yIndependent ? this.yScale : this.xScale; } - /** - * whether change exceeds threshold - * @private - * @param {number} change - */ - - }, { - key: 'checkThreshold', - value: function checkThreshold(change) { - if (Math.abs(change) >= this.threshold) { - return true; + wheel() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap-zoom'); } + return false; } - /** - * handle move events - * @private - */ + down() + { + if (this.options.removeOnInterrupt) + { + this.parent.plugins.remove('snap-zoom'); + } + else if (this.options.interrupt) + { + this.snapping = null; + } - }, { - key: 'move', - value: function move(e) { - if (this.pause) { + return false; + } + + update(elapsed) + { + if (this.paused) + { + return; + } + if (this.options.interrupt && this.parent.input.count() !== 0) + { return; } - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; + let oldCenter; - try { - for (var _iterator4 = this.pluginsList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var plugin = _step4.value; - - plugin.move(e); - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } + if (!this.options.center && !this.options.noMove) + { + oldCenter = this.parent.center; + } + if (!this.snapping) + { + if (this.parent.scale.x !== this.xScale || this.parent.scale.y !== this.yScale) + { + this.createSnapping(); } } + else if (this.snapping) + { + const snapping = this.snapping; - if (this.clickedAvailable) { - var distX = e.data.global.x - this.last.x; - var distY = e.data.global.y - this.last.y; - if (this.checkThreshold(distX) || this.checkThreshold(distY)) { - this.clickedAvailable = false; - } - } - } + snapping.time += elapsed; - /** - * handle up events - * @private - */ - - }, { - key: 'up', - value: function up(e) { - if (this.pause) { - return; - } - - if (e.data.originalEvent instanceof MouseEvent && e.data.originalEvent.button == 0) { - this.leftDown = false; - } - - if (e.data.pointerType !== 'mouse') { - for (var i = 0; i < this.touches.length; i++) { - if (this.touches[i] === e.data.pointerId) { - this.touches.splice(i, 1); - break; + if (snapping.time >= this.options.time) + { + this.parent.scale.set(this.xScale, this.yScale); + if (this.options.removeOnComplete) + { + this.parent.plugins.remove('snap-zoom'); } + this.parent.emit('snap-zoom-end', this.parent); + this.snapping = null; } - } + else + { + const snapping = this.snapping; + const worldScreenWidth = this.ease(snapping.time, snapping.startX, snapping.deltaX, this.options.time); + const worldScreenHeight = this.ease(snapping.time, snapping.startY, snapping.deltaY, this.options.time); - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; - - try { - for (var _iterator5 = this.pluginsList[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { - var plugin = _step5.value; - - plugin.up(e); + this.parent.scale.x = this.parent.screenWidth / worldScreenWidth; + this.parent.scale.y = this.parent.screenHeight / worldScreenHeight; } - } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; - } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5.return) { - _iterator5.return(); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { + clamp.clamp(); } - } - - if (this.clickedAvailable && this.countDownPointers() === 0) { - this.emit('clicked', { screen: this.last, world: this.toWorld(this.last), viewport: this }); - this.clickedAvailable = false; - } - } - - /** - * gets pointer position if this.interaction is set - * @param {UIEvent} evt - * @private - */ - - }, { - key: 'getPointerPosition', - value: function getPointerPosition(evt) { - var point = new PIXI.Point(); - if (this.interaction) { - this.interaction.mapPositionToPoint(point, evt.clientX, evt.clientY); - } else { - point.x = evt.clientX; - point.y = evt.clientY; - } - return point; - } - - /** - * handle wheel events - * @private - */ - - }, { - key: 'handleWheel', - value: function handleWheel(e) { - if (this.pause) { - return; - } - - // only handle wheel events where the mouse is over the viewport - var point = this.toLocal(this.getPointerPosition(e)); - if (this.left <= point.x && point.x <= this.right && this.top <= point.y && point.y <= this.bottom) { - var result = void 0; - var _iteratorNormalCompletion6 = true; - var _didIteratorError6 = false; - var _iteratorError6 = undefined; - - try { - for (var _iterator6 = this.pluginsList[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { - var plugin = _step6.value; - - if (plugin.wheel(e)) { - result = true; - } + if (!this.options.noMove) + { + if (!this.options.center) + { + this.parent.moveCenter(oldCenter ); } - } catch (err) { - _didIteratorError6 = true; - _iteratorError6 = err; - } finally { - try { - if (!_iteratorNormalCompletion6 && _iterator6.return) { - _iterator6.return(); - } - } finally { - if (_didIteratorError6) { - throw _iteratorError6; - } - } - } - - return result; - } - } - - /** - * change coordinates from screen to world - * @param {number|PIXI.Point} x - * @param {number} [y] - * @returns {PIXI.Point} - */ - - }, { - key: 'toWorld', - value: function toWorld() { - if (arguments.length === 2) { - var x = arguments[0]; - var y = arguments[1]; - return this.toLocal({ x: x, y: y }); - } else { - return this.toLocal(arguments[0]); - } - } - - /** - * change coordinates from world to screen - * @param {number|PIXI.Point} x - * @param {number} [y] - * @returns {PIXI.Point} - */ - - }, { - key: 'toScreen', - value: function toScreen() { - if (arguments.length === 2) { - var x = arguments[0]; - var y = arguments[1]; - return this.toGlobal({ x: x, y: y }); - } else { - var point = arguments[0]; - return this.toGlobal(point); - } - } - - /** - * screen width in world coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'moveCenter', - - - /** - * move center of viewport to point - * @param {(number|PIXI.PointLike)} x or point - * @param {number} [y] - * @return {Viewport} this - */ - value: function moveCenter() /*x, y | PIXI.Point*/{ - var x = void 0, - y = void 0; - if (!isNaN(arguments[0])) { - x = arguments[0]; - y = arguments[1]; - } else { - x = arguments[0].x; - y = arguments[0].y; - } - this.position.set((this.worldScreenWidth / 2 - x) * this.scale.x, (this.worldScreenHeight / 2 - y) * this.scale.y); - this._reset(); - return this; - } - - /** - * top-left corner - * @type {PIXI.PointLike} - */ - - }, { - key: 'moveCorner', - - - /** - * move viewport's top-left corner; also clamps and resets decelerate and bounce (as needed) - * @param {number|PIXI.Point} x|point - * @param {number} y - * @return {Viewport} this - */ - value: function moveCorner() /*x, y | point*/{ - if (arguments.length === 1) { - this.position.set(-arguments[0].x * this.scale.x, -arguments[0].y * this.scale.y); - } else { - this.position.set(-arguments[0] * this.scale.x, -arguments[1] * this.scale.y); - } - this._reset(); - return this; - } - - /** - * change zoom so the width fits in the viewport - * @param {number} [width=this._worldWidth] in world coordinates - * @param {boolean} [center] maintain the same center - * @return {Viewport} this - */ - - }, { - key: 'fitWidth', - value: function fitWidth(width, center) { - var save = void 0; - if (center) { - save = this.center; - } - width = width || this.worldWidth; - this.scale.x = this.screenWidth / width; - this.scale.y = this.scale.x; - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so the height fits in the viewport - * @param {number} [height=this._worldHeight] in world coordinates - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} this - */ - - }, { - key: 'fitHeight', - value: function fitHeight(height, center) { - var save = void 0; - if (center) { - save = this.center; - } - height = height || this.worldHeight; - this.scale.y = this.screenHeight / height; - this.scale.x = this.scale.y; - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so it fits the entire world in the viewport - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} this - */ - - }, { - key: 'fitWorld', - value: function fitWorld(center) { - var save = void 0; - if (center) { - save = this.center; - } - this.scale.x = this._screenWidth / this._worldWidth; - this.scale.y = this._screenHeight / this._worldHeight; - if (this.scale.x < this.scale.y) { - this.scale.y = this.scale.x; - } else { - this.scale.x = this.scale.y; - } - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * change zoom so it fits the size or the entire world in the viewport - * @param {boolean} [center] maintain the same center of the screen after zoom - * @param {number} [width] desired width - * @param {number} [height] desired height - * @return {Viewport} this - */ - - }, { - key: 'fit', - value: function fit(center, width, height) { - var save = void 0; - if (center) { - save = this.center; - } - width = width || this.worldWidth; - height = height || this.worldHeight; - this.scale.x = this.screenWidth / width; - this.scale.y = this.screenHeight / height; - if (this.scale.x < this.scale.y) { - this.scale.y = this.scale.x; - } else { - this.scale.x = this.scale.y; - } - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * zoom viewport by a certain percent (in both x and y direction) - * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25) - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} the viewport - */ - - }, { - key: 'zoomPercent', - value: function zoomPercent(percent, center) { - var save = void 0; - if (center) { - save = this.center; - } - var scale = this.scale.x + this.scale.x * percent; - this.scale.set(scale); - if (center) { - this.moveCenter(save); - } - return this; - } - - /** - * zoom viewport by increasing/decreasing width by a certain number of pixels - * @param {number} change in pixels - * @param {boolean} [center] maintain the same center of the screen after zoom - * @return {Viewport} the viewport - */ - - }, { - key: 'zoom', - value: function zoom(change, center) { - this.fitWidth(change + this.worldScreenWidth, center); - return this; - } - - /** - * @param {object} [options] - * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height) - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom - */ - - }, { - key: 'snapZoom', - value: function snapZoom(options) { - this.plugins['snap-zoom'] = new SnapZoom(this, options); - this.pluginsSort(); - return this; - } - - /** - * @private - * @typedef OutOfBounds - * @type {object} - * @property {boolean} left - * @property {boolean} right - * @property {boolean} top - * @property {boolean} bottom - */ - - /** - * is container out of world bounds - * @return {OutOfBounds} - * @private - */ - - }, { - key: 'OOB', - value: function OOB() { - var result = {}; - result.left = this.left < 0; - result.right = this.right > this._worldWidth; - result.top = this.top < 0; - result.bottom = this.bottom > this._worldHeight; - result.cornerPoint = { - x: this._worldWidth * this.scale.x - this._screenWidth, - y: this._worldHeight * this.scale.y - this._screenHeight - }; - return result; - } - - /** - * world coordinates of the right edge of the screen - * @type {number} - */ - - }, { - key: 'countDownPointers', - - - /** - * count of mouse/touch pointers that are down on the viewport - * @private - * @return {number} - */ - value: function countDownPointers() { - return (this.leftDown ? 1 : 0) + this.touches.length; - } - - /** - * array of touch pointers that are down on the viewport - * @private - * @return {PIXI.InteractionTrackingData[]} - */ - - }, { - key: 'getTouchPointers', - value: function getTouchPointers() { - var results = []; - var pointers = this.trackedPointers; - for (var key in pointers) { - var pointer = pointers[key]; - if (this.touches.indexOf(pointer.pointerId) !== -1) { - results.push(pointer); - } - } - return results; - } - - /** - * array of pointers that are down on the viewport - * @private - * @return {PIXI.InteractionTrackingData[]} - */ - - }, { - key: 'getPointers', - value: function getPointers() { - var results = []; - var pointers = this.trackedPointers; - for (var key in pointers) { - results.push(pointers[key]); - } - return results; - } - - /** - * clamps and resets bounce and decelerate (as needed) after manually moving viewport - * @private - */ - - }, { - key: '_reset', - value: function _reset() { - if (this.plugins['bounce']) { - this.plugins['bounce'].reset(); - this.plugins['bounce'].bounce(); - } - if (this.plugins['decelerate']) { - this.plugins['decelerate'].reset(); - } - if (this.plugins['snap']) { - this.plugins['snap'].reset(); - } - if (this.plugins['clamp']) { - this.plugins['clamp'].update(); - } - if (this.plugins['clamp-zoom']) { - this.plugins['clamp-zoom'].clamp(); - } - this.dirty = true; - } - - // PLUGINS - - /** - * removes installed plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'removePlugin', - value: function removePlugin(type) { - if (this.plugins[type]) { - this.plugins[type] = null; - this.emit(type + '-remove'); - this.pluginsSort(); - } - } - - /** - * pause plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'pausePlugin', - value: function pausePlugin(type) { - if (this.plugins[type]) { - this.plugins[type].pause(); - } - } - - /** - * resume plugin - * @param {string} type of plugin (e.g., 'drag', 'pinch') - */ - - }, { - key: 'resumePlugin', - value: function resumePlugin(type) { - if (this.plugins[type]) { - this.plugins[type].resume(); - } - } - - /** - * sort plugins for updates - * @private - */ - - }, { - key: 'pluginsSort', - value: function pluginsSort() { - this.pluginsList = []; - var _iteratorNormalCompletion7 = true; - var _didIteratorError7 = false; - var _iteratorError7 = undefined; - - try { - for (var _iterator7 = PLUGIN_ORDER[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { - var plugin = _step7.value; - - if (this.plugins[plugin]) { - this.pluginsList.push(this.plugins[plugin]); - } - } - } catch (err) { - _didIteratorError7 = true; - _iteratorError7 = err; - } finally { - try { - if (!_iteratorNormalCompletion7 && _iterator7.return) { - _iterator7.return(); - } - } finally { - if (_didIteratorError7) { - throw _iteratorError7; + else + { + this.parent.moveCenter(this.options.center); } } } } - /** - * enable one-finger touch to drag - * @param {object} [options] - * @param {string} [options.direction=all] direction to drag (all, x, or y) - * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active) - * @param {number} [options.wheelScroll=10] number of pixels to scroll with each wheel spin - * @param {boolean} [options.reverse] reverse the direction of the wheel scroll - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - */ - - }, { - key: 'drag', - value: function drag(options) { - this.plugins['drag'] = new Drag(this, options); - this.pluginsSort(); - return this; + resume() + { + this.snapping = null; + super.resume(); } - - /** - * clamp to world boundaries or other provided boundaries - * NOTES: - * clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping - * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {(number|boolean)} [options.left] clamp left; true=0 - * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth - * @param {(number|boolean)} [options.top] clamp top; true=0 - * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight - * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - * @return {Viewport} this - */ - - }, { - key: 'clamp', - value: function clamp(options) { - this.plugins['clamp'] = new Clamp(this, options); - this.pluginsSort(); - return this; - } - - /** - * decelerate after a move - * @param {object} [options] - * @param {number} [options.friction=0.95] percent to decelerate after movement - * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active) - * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration - * @return {Viewport} this - */ - - }, { - key: 'decelerate', - value: function decelerate(options) { - this.plugins['decelerate'] = new Decelerate(this, options); - this.pluginsSort(); - return this; - } - - /** - * bounce on borders - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {string} [options.sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right') - * @param {number} [options.friction=0.5] friction to apply to decelerate if active - * @param {number} [options.time=150] time in ms to finish bounce - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen - * @return {Viewport} this - */ - - }, { - key: 'bounce', - value: function bounce(options) { - this.plugins['bounce'] = new Bounce(this, options); - this.pluginsSort(); - return this; - } - - /** - * enable pinch to zoom and two-finger touch to drag - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {number} [options.percent=1.0] percent to modify pinch speed - * @param {boolean} [options.noDrag] disable two-finger dragging - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers - * @return {Viewport} this - */ - - }, { - key: 'pinch', - value: function pinch(options) { - this.plugins['pinch'] = new Pinch(this, options); - this.pluginsSort(); - return this; - } - - /** - * snap to a point - * @param {number} x - * @param {number} y - * @param {object} [options] - * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center - * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active - * @param {number} [options.time=1000] - * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names) - * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport - * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete - * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input - * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location - * @return {Viewport} this - */ - - }, { - key: 'snap', - value: function snap(x, y, options) { - this.plugins['snap'] = new Snap(this, x, y, options); - this.pluginsSort(); - return this; - } - - /** - * follow a target - * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate}) - * @param {object} [options] - * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location) - * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport - * @return {Viewport} this - */ - - }, { - key: 'follow', - value: function follow(target, options) { - this.plugins['follow'] = new Follow(this, target, options); - this.pluginsSort(); - return this; - } - - /** - * zoom using mouse wheel - * @param {object} [options] - * @param {number} [options.percent=0.1] percent to scroll with each spin - * @param {boolean} [options.reverse] reverse the direction of the scroll - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position - * @return {Viewport} this - */ - - }, { - key: 'wheel', - value: function wheel(options) { - this.plugins['wheel'] = new Wheel(this, options); - this.pluginsSort(); - return this; - } - - /** - * enable clamping of zoom to constraints - * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly - * @param {object} [options] - * @param {number} [options.minWidth] minimum width - * @param {number} [options.minHeight] minimum height - * @param {number} [options.maxWidth] maximum width - * @param {number} [options.maxHeight] maximum height - * @return {Viewport} this - */ - - }, { - key: 'clampZoom', - value: function clampZoom(options) { - this.plugins['clamp-zoom'] = new ClampZoom(this, options); - this.pluginsSort(); - return this; - } - - /** - * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen. - * @param {object} [options] - * @param {number} [options.radius] distance from center of screen in screen pixels - * @param {number} [options.distance] distance from all sides in screen pixels - * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll) - * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll) - * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll) - * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll) - * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport - * @param {boolean} [options.reverse] reverse direction of scroll - * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed - * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center)) - */ - - }, { - key: 'mouseEdges', - value: function mouseEdges(options) { - this.plugins['mouse-edges'] = new MouseEdges(this, options); - this.pluginsSort(); - return this; - } - - /** - * pause viewport (including animation updates such as decelerate) - * NOTE: when setting pause=true, all touches and mouse actions are cleared (i.e., if mousedown was active, it becomes inactive for purposes of the viewport) - * @type {boolean} - */ - - }, { - key: 'screenWidth', - get: function get() { - return this._screenWidth; - }, - set: function set(value) { - this._screenWidth = value; - } - - /** - * screen height in screen pixels - * @type {number} - */ - - }, { - key: 'screenHeight', - get: function get() { - return this._screenHeight; - }, - set: function set(value) { - this._screenHeight = value; - } - - /** - * world width in pixels - * @type {number} - */ - - }, { - key: 'worldWidth', - get: function get() { - if (this._worldWidth) { - return this._worldWidth; - } else { - return this.width; - } - }, - set: function set(value) { - this._worldWidth = value; - this.resizePlugins(); - } - - /** - * world height in pixels - * @type {number} - */ - - }, { - key: 'worldHeight', - get: function get() { - if (this._worldHeight) { - return this._worldHeight; - } else { - return this.height; - } - }, - set: function set(value) { - this._worldHeight = value; - this.resizePlugins(); - } - }, { - key: 'worldScreenWidth', - get: function get() { - return this._screenWidth / this.scale.x; - } - - /** - * screen height in world coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'worldScreenHeight', - get: function get() { - return this._screenHeight / this.scale.y; - } - - /** - * world width in screen coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'screenWorldWidth', - get: function get() { - return this._worldWidth * this.scale.x; - } - - /** - * world height in screen coordinates - * @type {number} - * @readonly - */ - - }, { - key: 'screenWorldHeight', - get: function get() { - return this._worldHeight * this.scale.y; - } - - /** - * get center of screen in world coordinates - * @type {PIXI.PointLike} - */ - - }, { - key: 'center', - get: function get() { - return { x: this.worldScreenWidth / 2 - this.x / this.scale.x, y: this.worldScreenHeight / 2 - this.y / this.scale.y }; - }, - set: function set(value) { - this.moveCenter(value); - } - }, { - key: 'corner', - get: function get() { - return { x: -this.x / this.scale.x, y: -this.y / this.scale.y }; - }, - set: function set(value) { - this.moveCorner(value); - } - }, { - key: 'right', - get: function get() { - return -this.x / this.scale.x + this.worldScreenWidth; - }, - set: function set(value) { - this.x = -value * this.scale.x + this.screenWidth; - this._reset(); - } - - /** - * world coordinates of the left edge of the screen - * @type {number} - */ - - }, { - key: 'left', - get: function get() { - return -this.x / this.scale.x; - }, - set: function set(value) { - this.x = -value * this.scale.x; - this._reset(); - } - - /** - * world coordinates of the top edge of the screen - * @type {number} - */ - - }, { - key: 'top', - get: function get() { - return -this.y / this.scale.y; - }, - set: function set(value) { - this.y = -value * this.scale.y; - this._reset(); - } - - /** - * world coordinates of the bottom edge of the screen - * @type {number} - */ - - }, { - key: 'bottom', - get: function get() { - return -this.y / this.scale.y + this.worldScreenHeight; - }, - set: function set(value) { - this.y = -value * this.scale.y + this.screenHeight; - this._reset(); - } - /** - * determines whether the viewport is dirty (i.e., needs to be renderered to the screen because of a change) - * @type {boolean} - */ - - }, { - key: 'dirty', - get: function get() { - return this._dirty; - }, - set: function set(value) { - this._dirty = value; - } - - /** - * permanently changes the Viewport's hitArea - *

NOTE: normally the hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, Viewport.worldScreenHeight)

- * @type {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)} - */ - - }, { - key: 'forceHitArea', - get: function get() { - return this._forceHitArea; - }, - set: function set(value) { - if (value) { - this._forceHitArea = value; - this.hitArea = value; - } else { - this._forceHitArea = false; - this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight); - } - } - }, { - key: 'pause', - get: function get() { - return this._pause; - }, - set: function set(value) { - this._pause = value; - if (value) { - this.touches = []; - this.leftDown = false; - } - } - }]); - - return Viewport; -}(PIXI.Container); - -/** - * fires after a mouse or touch click - * @event Viewport#clicked - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a drag starts - * @event Viewport#drag-start - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a drag ends - * @event Viewport#drag-end - * @type {object} - * @property {PIXI.PointLike} screen - * @property {PIXI.PointLike} world - * @property {Viewport} viewport - */ - -/** - * fires when a pinch starts - * @event Viewport#pinch-start - * @type {Viewport} - */ - -/** - * fires when a pinch end - * @event Viewport#pinch-end - * @type {Viewport} - */ - -/** - * fires when a snap starts - * @event Viewport#snap-start - * @type {Viewport} - */ - -/** - * fires when a snap ends - * @event Viewport#snap-end - * @type {Viewport} - */ - -/** - * fires when a snap-zoom starts - * @event Viewport#snap-zoom-start - * @type {Viewport} - */ - -/** - * fires when a snap-zoom ends - * @event Viewport#snap-zoom-end - * @type {Viewport} - */ - -/** - * fires when a bounce starts in the x direction - * @event Viewport#bounce-x-start - * @type {Viewport} - */ - -/** - * fires when a bounce ends in the x direction - * @event Viewport#bounce-x-end - * @type {Viewport} - */ - -/** - * fires when a bounce starts in the y direction - * @event Viewport#bounce-y-start - * @type {Viewport} - */ - -/** - * fires when a bounce ends in the y direction - * @event Viewport#bounce-y-end - * @type {Viewport} - */ - -/** - * fires when for a mouse wheel event - * @event Viewport#wheel - * @type {object} - * @property {object} wheel - * @property {number} wheel.dx - * @property {number} wheel.dy - * @property {number} wheel.dz - * @property {Viewport} viewport - */ - -/** - * fires when a wheel-scroll occurs - * @event Viewport#wheel-scroll - * @type {Viewport} - */ - -/** - * fires when a mouse-edge starts to scroll - * @event Viewport#mouse-edge-start - * @type {Viewport} - */ - -/** - * fires when the mouse-edge scrolling ends - * @event Viewport#mouse-edge-end - * @type {Viewport} - */ - -/** - * fires when viewport moves through UI interaction, deceleration, or follow - * @event Viewport#moved - * @type {object} - * @property {Viewport} viewport - * @property {string} type (drag, snap, pinch, follow, bounce-x, bounce-y, clamp-x, clamp-y, decelerate, mouse-edges, wheel) - */ - -/** - * fires when viewport moves through UI interaction, deceleration, or follow - * @event Viewport#zoomed - * @type {object} - * @property {Viewport} viewport - * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom) - */ - -PIXI.extras.Viewport = Viewport; - -module.exports = Viewport; - -},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(require,module,exports){ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Plugin = require('./plugin'); - -module.exports = function (_Plugin) { - _inherits(Wheel, _Plugin); - - /** - * @private - * @param {Viewport} parent - * @param {object} [options] - * @param {number} [options.percent=0.1] percent to scroll with each spin - * @param {boolean} [options.reverse] reverse the direction of the scroll - * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position - * - * @event wheel({wheel: {dx, dy, dz}, event, viewport}) - */ - function Wheel(parent, options) { - _classCallCheck(this, Wheel); - - var _this = _possibleConstructorReturn(this, (Wheel.__proto__ || Object.getPrototypeOf(Wheel)).call(this, parent)); - - options = options || {}; - _this.percent = options.percent || 0.1; - _this.center = options.center; - _this.reverse = options.reverse; - return _this; } - _createClass(Wheel, [{ - key: 'wheel', - value: function wheel(e) { - if (this.paused) { + /** Options for {@link Wheel}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_WHEEL_OPTIONS = { + percent: 0.1, + smooth: false, + interrupt: true, + reverse: false, + center: null, + lineHeight: 20, + axis: 'all', + keyToPress: null, + trackpadPinch: false, + wheelZoom: true, + }; + + /** + * Plugin for handling wheel scrolling for viewport zoom. + * + * @event wheel({wheel: {dx, dy, dz}, event, viewport}) + */ + class Wheel extends Plugin + { + + + + + + + /** Flags whether the keys required to zoom are pressed currently. */ + + + /** + * This is called by {@link Viewport.wheel}. + */ + constructor(parent, options = {}) + { + super(parent); + this.options = Object.assign({}, DEFAULT_WHEEL_OPTIONS, options); + this.keyIsPressed = false; + + if (this.options.keyToPress) + { + this.handleKeyPresses(this.options.keyToPress); + } + } + + /** + * Handles keypress events and set the keyIsPressed boolean accordingly + * + * @param {array} codes - key codes that can be used to trigger zoom event + */ + handleKeyPresses(codes) + { + window.addEventListener('keydown', (e) => + { + if (codes.includes(e.code)) + { + this.keyIsPressed = true; + } + }); + + window.addEventListener('keyup', (e) => + { + if (codes.includes(e.code)) + { + this.keyIsPressed = false; + } + }); + } + + checkKeyPress() + { + return !this.options.keyToPress || this.keyIsPressed; + } + + down() + { + if (this.options.interrupt) + { + this.smoothing = null; + } + + return false; + } + + isAxisX() + { + return ['all', 'x'].includes(this.options.axis); + } + + isAxisY() + { + return ['all', 'y'].includes(this.options.axis); + } + + update() + { + if (this.smoothing) + { + const point = this.smoothingCenter; + const change = this.smoothing; + let oldPoint; + + if (!this.options.center) + { + oldPoint = this.parent.toLocal(point ); + } + if (this.isAxisX()) + { + this.parent.scale.x += change.x; + } + if (this.isAxisY()) + { + this.parent.scale.y += change.y; + } + + this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { + clamp.clamp(); + } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); + + this.parent.x += (point ).x - newPoint.x; + this.parent.y += (point ).y - newPoint.y; + } + + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + (this.smoothingCount )++; + + if ((this.smoothingCount ) >= this.options.smooth) + { + this.smoothing = null; + } + } + } + + pinch(e) + { + if (this.paused) + { return; } - var change = void 0; - if (this.reverse) { - change = e.deltaY > 0 ? 1 + this.percent : 1 - this.percent; - } else { - change = e.deltaY > 0 ? 1 - this.percent : 1 + this.percent; - } - var point = this.parent.getPointerPosition(e); + const point = this.parent.input.getPointerPosition(e); + const step = -e.deltaY * (e.deltaMode ? this.options.lineHeight : 1) / 200; + const change = Math.pow(2, (1 + this.options.percent) * step); - var oldPoint = void 0; - if (!this.center) { + let oldPoint; + + if (!this.options.center) + { oldPoint = this.parent.toLocal(point); } - this.parent.scale.x *= change; - this.parent.scale.y *= change; + if (this.isAxisX()) + { + this.parent.scale.x *= change; + } + if (this.isAxisY()) + { + this.parent.scale.y *= change; + } this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); - var clamp = this.parent.plugins['clamp-zoom']; - if (clamp) { + const clamp = this.parent.plugins.get('clamp-zoom', true); + + if (clamp) + { clamp.clamp(); } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); - if (this.center) { - this.parent.moveCenter(this.center); - } else { - var newPoint = this.parent.toGlobal(oldPoint); this.parent.x += point.x - newPoint.x; this.parent.y += point.y - newPoint.y; } this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); - this.parent.emit('wheel', { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); - e.preventDefault(); + this.parent.emit('wheel', + { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); } - }]); - return Wheel; -}(Plugin); + wheel(e) + { + if (this.paused) + { + return false; + } -},{"./plugin":9}],15:[function(require,module,exports){ + if (!this.checkKeyPress()) + { + return false; + } -/* - Copyright © 2001 Robert Penner - All rights reserved. + if (e.ctrlKey && this.options.trackpadPinch) + { + this.pinch(e); + } + else if (this.options.wheelZoom) + { + const point = this.parent.input.getPointerPosition(e); + const sign = this.options.reverse ? -1 : 1; + const step = sign * -e.deltaY * (e.deltaMode ? this.options.lineHeight : 1) / 500; + const change = Math.pow(2, (1 + this.options.percent) * step); - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: + if (this.options.smooth) + { + const original = { + x: this.smoothing ? this.smoothing.x * (this.options.smooth - (this.smoothingCount )) : 0, + y: this.smoothing ? this.smoothing.y * (this.options.smooth - (this.smoothingCount )) : 0 + }; - 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.smoothing = { + x: ((this.parent.scale.x + original.x) * change - this.parent.scale.x) / this.options.smooth, + y: ((this.parent.scale.y + original.y) * change - this.parent.scale.y) / this.options.smooth, + }; + this.smoothingCount = 0; + this.smoothingCenter = point; + } + else + { + let oldPoint; - Neither the name of the author nor the names of contributors may be used to endorse - or promote products derived from this software without specific prior written permission. + if (!this.options.center) + { + oldPoint = this.parent.toLocal(point); + } + if (this.isAxisX()) + { + this.parent.scale.x *= change; + } + if (this.isAxisY()) + { + this.parent.scale.y *= change; + } + this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' }); + const clamp = this.parent.plugins.get('clamp-zoom', true); - 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 OWNER 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. - */ + if (clamp) + { + clamp.clamp(); + } + if (this.options.center) + { + this.parent.moveCenter(this.options.center); + } + else + { + const newPoint = this.parent.toGlobal(oldPoint ); -(function() { - var penner, umd; + this.parent.x += point.x - newPoint.x; + this.parent.y += point.y - newPoint.y; + } + } - umd = function(factory) { - if (typeof exports === 'object') { - return module.exports = factory; - } else if (typeof define === 'function' && define.amd) { - return define([], factory); - } else { - return this.penner = factory; + this.parent.emit('moved', { viewport: this.parent, type: 'wheel' }); + this.parent.emit('wheel', + { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent }); + } + + return !this.parent.options.passiveWheel; + } } - }; - penner = { - linear: function(t, b, c, d) { - return c * t / d + b; - }, - easeInQuad: function(t, b, c, d) { - return c * (t /= d) * t + b; - }, - easeOutQuad: function(t, b, c, d) { - return -c * (t /= d) * (t - 2) + b; - }, - easeInOutQuad: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t + b; - } else { - return -c / 2 * ((--t) * (t - 2) - 1) + b; - } - }, - easeInCubic: function(t, b, c, d) { - return c * (t /= d) * t * t + b; - }, - easeOutCubic: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t + 1) + b; - }, - easeInOutCubic: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t + 2) + b; - } - }, - easeInQuart: function(t, b, c, d) { - return c * (t /= d) * t * t * t + b; - }, - easeOutQuart: function(t, b, c, d) { - return -c * ((t = t / d - 1) * t * t * t - 1) + b; - }, - easeInOutQuart: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t + b; - } else { - return -c / 2 * ((t -= 2) * t * t * t - 2) + b; - } - }, - easeInQuint: function(t, b, c, d) { - return c * (t /= d) * t * t * t * t + b; - }, - easeOutQuint: function(t, b, c, d) { - return c * ((t = t / d - 1) * t * t * t * t + 1) + b; - }, - easeInOutQuint: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return c / 2 * t * t * t * t * t + b; - } else { - return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; - } - }, - easeInSine: function(t, b, c, d) { - return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; - }, - easeOutSine: function(t, b, c, d) { - return c * Math.sin(t / d * (Math.PI / 2)) + b; - }, - easeInOutSine: function(t, b, c, d) { - return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; - }, - easeInExpo: function(t, b, c, d) { - if (t === 0) { - return b; - } else { - return c * Math.pow(2, 10 * (t / d - 1)) + b; - } - }, - easeOutExpo: function(t, b, c, d) { - if (t === d) { - return b + c; - } else { - return c * (-Math.pow(2, -10 * t / d) + 1) + b; - } - }, - easeInOutExpo: function(t, b, c, d) { - if (t === 0) { - b; - } - if (t === d) { - b + c; - } - if ((t /= d / 2) < 1) { - return c / 2 * Math.pow(2, 10 * (t - 1)) + b; - } else { - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; - } - }, - easeInCirc: function(t, b, c, d) { - return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; - }, - easeOutCirc: function(t, b, c, d) { - return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; - }, - easeInOutCirc: function(t, b, c, d) { - if ((t /= d / 2) < 1) { - return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; - } else { - return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; - } - }, - easeInElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - }, - easeOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d) === 1) { - b + c; - } - if (!p) { - p = d * .3; - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; - }, - easeInOutElastic: function(t, b, c, d) { - var a, p, s; - s = 1.70158; - p = 0; - a = c; - if (t === 0) { - b; - } else if ((t /= d / 2) === 2) { - b + c; - } - if (!p) { - p = d * (.3 * 1.5); - } - if (a < Math.abs(c)) { - a = c; - s = p / 4; - } else { - s = p / (2 * Math.PI) * Math.asin(c / a); - } - if (t < 1) { - return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; - } else { - return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; - } - }, - easeInBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * (t /= d) * t * ((s + 1) * t - s) + b; - }, - easeOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; - }, - easeInOutBack: function(t, b, c, d, s) { - if (s === void 0) { - s = 1.70158; - } - if ((t /= d / 2) < 1) { - return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b; - } else { - return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b; - } - }, - easeInBounce: function(t, b, c, d) { - var v; - v = penner.easeOutBounce(d - t, 0, c, d); - return c - v + b; - }, - easeOutBounce: function(t, b, c, d) { - if ((t /= d) < 1 / 2.75) { - return c * (7.5625 * t * t) + b; - } else if (t < 2 / 2.75) { - return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b; - } else if (t < 2.5 / 2.75) { - return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b; - } else { - return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b; - } - }, - easeInOutBounce: function(t, b, c, d) { - var v; - if (t < d / 2) { - v = penner.easeInBounce(t * 2, 0, c, d); - return v * .5 + b; - } else { - v = penner.easeOutBounce(t * 2 - d, 0, c, d); - return v * .5 + c * .5 + b; - } + /** + * Handles all input for Viewport + * + * @internal + * @ignore + * @private + */ + class InputManager + { + + + + + + + /** List of active touches on viewport */ + + + constructor(viewport) + { + this.viewport = viewport; + this.touches = []; + + this.addListeners(); + } + + /** Add input listeners */ + addListeners() + { + this.viewport.interactive = true; + if (!this.viewport.forceHitArea) + { + this.viewport.hitArea = new math.Rectangle(0, 0, this.viewport.worldWidth, this.viewport.worldHeight); + } + this.viewport.on('pointerdown', this.down, this); + this.viewport.on('pointermove', this.move, this); + this.viewport.on('pointerup', this.up, this); + this.viewport.on('pointerupoutside', this.up, this); + this.viewport.on('pointercancel', this.up, this); + this.viewport.on('pointerout', this.up, this); + this.wheelFunction = (e) => this.handleWheel(e); + this.viewport.options.divWheel.addEventListener( + 'wheel', + this.wheelFunction , + { passive: this.viewport.options.passiveWheel }); + this.isMouseDown = false; + } + + /** + * Removes all event listeners from viewport + * (useful for cleanup of wheel when removing viewport) + */ + destroy() + { + this.viewport.options.divWheel.removeEventListener('wheel', this.wheelFunction ); + } + + /** + * handle down events for viewport + * + * @param {PIXI.InteractionEvent} event + */ + down(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + if (event.data.pointerType === 'mouse') + { + this.isMouseDown = true; + } + else if (!this.get(event.data.pointerId)) + { + this.touches.push({ id: event.data.pointerId, last: null }); + } + if (this.count() === 1) + { + this.last = event.data.global.clone(); + + // clicked event does not fire if viewport is decelerating or bouncing + const decelerate = this.viewport.plugins.get('decelerate', true); + const bounce = this.viewport.plugins.get('bounce', true); + + if ((!decelerate || !decelerate.isActive()) && (!bounce || !bounce.isActive())) + { + this.clickedAvailable = true; + } + else + { + this.clickedAvailable = false; + } + } + else + { + this.clickedAvailable = false; + } + + const stop = this.viewport.plugins.down(event); + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Clears all pointer events */ + clear() + { + this.isMouseDown = false; + this.touches = []; + this.last = null; + } + + /** + * @param {number} change + * @returns whether change exceeds threshold + */ + checkThreshold(change) + { + if (Math.abs(change) >= this.viewport.threshold) + { + return true; + } + + return false; + } + + /** Handle move events for viewport */ + move(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + const stop = this.viewport.plugins.move(event); + + if (this.clickedAvailable && this.last) + { + const distX = event.data.global.x - this.last.x; + const distY = event.data.global.y - this.last.y; + + if (this.checkThreshold(distX) || this.checkThreshold(distY)) + { + this.clickedAvailable = false; + } + } + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Handle up events for viewport */ + up(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + if (event.data.pointerType === 'mouse') + { + this.isMouseDown = false; + } + + if (event.data.pointerType !== 'mouse') + { + this.remove(event.data.pointerId); + } + + const stop = this.viewport.plugins.up(event); + + if (this.clickedAvailable && this.count() === 0 && this.last) + { + this.viewport.emit('clicked', { + event, + screen: this.last, + world: this.viewport.toWorld(this.last), + viewport: this + }); + this.clickedAvailable = false; + } + + if (stop && this.viewport.options.stopPropagation) + { + event.stopPropagation(); + } + } + + /** Gets pointer position if this.interaction is set */ + getPointerPosition(event) + { + const point = new math.Point(); + + if (this.viewport.options.interaction) + { + this.viewport.options.interaction.mapPositionToPoint(point, event.clientX, event.clientY); + } + else if (this.viewport.options.useDivWheelForInputManager && this.viewport.options.divWheel) + { + const rect = this.viewport.options.divWheel.getBoundingClientRect(); + + point.x = event.clientX - rect.left; + point.y = event.clientY - rect.top; + } + else + { + point.x = event.clientX; + point.y = event.clientY; + } + + return point; + } + + /** Handle wheel events */ + handleWheel(event) + { + if (this.viewport.pause || !this.viewport.worldVisible) + { + return; + } + + // do not handle events coming from other elements + if (this.viewport.options.interaction + && (this.viewport.options.interaction ).interactionDOMElement !== event.target) + { + return; + } + + // only handle wheel events where the mouse is over the viewport + const point = this.viewport.toLocal(this.getPointerPosition(event)); + + if (this.viewport.left <= point.x + && point.x <= this.viewport.right + && this.viewport.top <= point.y + && point.y <= this.viewport.bottom) + { + const stop = this.viewport.plugins.wheel(event); + + if (stop && !this.viewport.options.passiveWheel) + { + event.preventDefault(); + } + } + } + + pause() + { + this.touches = []; + this.isMouseDown = false; + } + + /** Get touch by id */ + get(id) + { + for (const touch of this.touches) + { + if (touch.id === id) + { + return touch; + } + } + + return null; + } + + /** Remove touch by number */ + remove(id) + { + for (let i = 0; i < this.touches.length; i++) + { + if (this.touches[i].id === id) + { + this.touches.splice(i, 1); + + return; + } + } + } + + /** + * @returns {number} count of mouse/touch pointers that are down on the viewport + */ + count() + { + return (this.isMouseDown ? 1 : 0) + this.touches.length; + } } - }; - umd(penner); + function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } -}).call(this); -},{}]},{},[13]); + + + + + + + + + + + + + + + + const PLUGIN_ORDER = [ + 'drag', + 'pinch', + 'wheel', + 'follow', + 'mouse-edges', + 'decelerate', + 'animate', + 'bounce', + 'snap-zoom', + 'clamp-zoom', + 'snap', + 'clamp', + ]; + + /** + * Use this to access current plugins or add user-defined plugins + * + * @public + */ + class PluginManager + { + /** Maps mounted plugins by their type */ + + + /** + * List of plugins mounted + * + * This list is kept sorted by the internal priority of plugins (hard-coded). + */ + + + /** The viewport using the plugins managed by `this`. */ + + + /** This is called by {@link Viewport} to initialize the {@link Viewport.plugins plugins}. */ + constructor(viewport) + { + this.viewport = viewport; + this.list = []; + this.plugins = {}; + } + + /** + * Inserts a named plugin or a user plugin into the viewport + * default plugin order: 'drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', + * 'snap-zoom', 'clamp-zoom', 'snap', 'clamp' + * + * @param {string} name of plugin + * @param {Plugin} plugin - instantiated Plugin class + * @param {number} index to insert userPlugin (otherwise inserts it at the end) + */ + add(name, plugin, index = PLUGIN_ORDER.length) + { + this.plugins[name] = plugin; + + const current = PLUGIN_ORDER.indexOf(name); + + if (current !== -1) + { + PLUGIN_ORDER.splice(current, 1); + } + + PLUGIN_ORDER.splice(index, 0, name); + this.sort(); + } + + + + + + + + + + + + + + + + /** + * Get plugin + * + * @param {string} name of plugin + * @param {boolean} [ignorePaused] return null if plugin is paused + */ + get(name, ignorePaused) + { + if (ignorePaused) + { + if (_optionalChain([this, 'access', _ => _.plugins, 'access', _2 => _2[name], 'optionalAccess', _3 => _3.paused])) + { + return null; + } + } + + return this.plugins[name] ; + } + + /** + * Update all active plugins + * + * @internal + * @ignore + * @param {number} elapsed type in milliseconds since last update + */ + update(elapsed) + { + for (const plugin of this.list) + { + plugin.update(elapsed); + } + } + + /** + * Resize all active plugins + * + * @internal + * @ignore + */ + resize() + { + for (const plugin of this.list) + { + plugin.resize(); + } + } + + /** Clamps and resets bounce and decelerate (as needed) after manually moving viewport */ + reset() + { + for (const plugin of this.list) + { + plugin.reset(); + } + } + + /** removes all installed plugins */ + removeAll() + { + this.plugins = {}; + this.sort(); + } + + /** + * Removes installed plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + remove(name) + { + if (this.plugins[name]) + { + delete this.plugins[name]; + this.viewport.emit(`${name}-remove`); + this.sort(); + } + } + + /** + * Pause plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + pause(name) + { + _optionalChain([this, 'access', _4 => _4.plugins, 'access', _5 => _5[name], 'optionalAccess', _6 => _6.pause, 'call', _7 => _7()]); + } + + /** + * Resume plugin + * + * @param {string} name of plugin (e.g., 'drag', 'pinch') + */ + resume(name) + { + _optionalChain([this, 'access', _8 => _8.plugins, 'access', _9 => _9[name], 'optionalAccess', _10 => _10.resume, 'call', _11 => _11()]); + } + + /** + * Sort plugins according to PLUGIN_ORDER + * + * @internal + * @ignore + */ + sort() + { + this.list = []; + + for (const plugin of PLUGIN_ORDER) + { + if (this.plugins[plugin]) + { + this.list.push(this.plugins[plugin] ); + } + } + } + + /** + * Handle down for all plugins + * + * @internal + * @ignore + */ + down(event) + { + let stop = false; + + for (const plugin of this.list) + { + if (plugin.down(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle move for all plugins + * + * @internal + * @ignore + */ + move(event) + { + let stop = false; + + for (const plugin of this.viewport.plugins.list) + { + if (plugin.move(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle up for all plugins + * + * @internal + * @ignore + */ + up(event) + { + let stop = false; + + for (const plugin of this.list) + { + if (plugin.up(event)) + { + stop = true; + } + } + + return stop; + } + + /** + * Handle wheel event for all plugins + * + * @internal + * @ignore + */ + wheel(e) + { + let result = false; + + for (const plugin of this.list) + { + if (plugin.wheel(e)) + { + result = true; + } + } + + return result; + } + } + + /** Options for {@link Viewport}. */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const DEFAULT_VIEWPORT_OPTIONS = { + screenWidth: window.innerWidth, + screenHeight: window.innerHeight, + worldWidth: null, + worldHeight: null, + threshold: 5, + passiveWheel: true, + stopPropagation: false, + forceHitArea: null, + noTicker: false, + interaction: null, + disableOnContextMenu: false, + ticker: ticker.Ticker.shared, + }; + + /** + * Main class to use when creating a Viewport + * + * @public + * @fires clicked + * @fires drag-start + * @fires drag-end + * @fires drag-remove + * @fires pinch-start + * @fires pinch-end + * @fires pinch-remove + * @fires snap-start + * @fires snap-end + * @fires snap-remove + * @fires snap-zoom-start + * @fires snap-zoom-end + * @fires snap-zoom-remove + * @fires bounce-x-start + * @fires bounce-x-end + * @fires bounce-y-start + * @fires bounce-y-end + * @fires bounce-remove + * @fires wheel + * @fires wheel-remove + * @fires wheel-scroll + * @fires wheel-scroll-remove + * @fires mouse-edge-start + * @fires mouse-edge-end + * @fires mouse-edge-remove + * @fires moved + * @fires moved-end + * @fires zoomed + * @fires zoomed-end + * @fires frame-end + */ + class Viewport extends display.Container + { + /** Flags whether the viewport is being panned */ + + + + + + /** Number of pixels to move to trigger an input event (e.g., drag, pinch) or disable a clicked event */ + + + + + /** Use this to add user plugins or access existing plugins (e.g., to pause, resume, or remove them) */ + + + /** Flags whether the viewport zoom is being changed. */ + + + + + /** The options passed when creating this viewport, merged with the default values */ + + + + + + + + + + __init() {this._disableOnContextMenu = (e) => e.preventDefault();} + + /** + * @param {IViewportOptions} ViewportOptions + * @param {number} [options.screenWidth=window.innerWidth] + * @param {number} [options.screenHeight=window.innerHeight] + * @param {number} [options.worldWidth=this.width] + * @param {number} [options.worldHeight=this.height] + * @param {number} [options.threshold=5] number of pixels to move to trigger an input event (e.g., drag, pinch) + * or disable a clicked event + * @param {boolean} [options.passiveWheel=true] whether the 'wheel' event is set to passive (note: if false, + * e.preventDefault() will be called when wheel is used over the viewport) + * @param {boolean} [options.stopPropagation=false] whether to stopPropagation of events that impact the viewport + * (except wheel events, see options.passiveWheel) + * @param {HitArea} [options.forceHitArea] change the default hitArea from world size to a new value + * @param {boolean} [options.noTicker] set this if you want to manually call update() function on each frame + * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.ticker for updates + * @param {PIXI.InteractionManager} [options.interaction=null] InteractionManager, available from instantiated + * WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer position relative to canvas + * location on screen + * @param {HTMLElement} [options.divWheel=document.body] div to attach the wheel event + * @param {boolean} [options.disableOnContextMenu] remove oncontextmenu=() => {} from the divWheel element + */ + constructor(options = {}) + { + super();Viewport.prototype.__init.call(this);; + this.options = Object.assign( + {}, + { divWheel: document.body }, + DEFAULT_VIEWPORT_OPTIONS, + options + ); + + this.screenWidth = this.options.screenWidth; + this.screenHeight = this.options.screenHeight; + + this._worldWidth = this.options.worldWidth; + this._worldHeight = this.options.worldHeight; + this.forceHitArea = this.options.forceHitArea; + this.threshold = this.options.threshold; + + this.options.divWheel = this.options.divWheel || document.body; + + if (this.options.disableOnContextMenu) + { + this.options.divWheel.addEventListener('contextmenu', this._disableOnContextMenu); + } + if (!this.options.noTicker) + { + this.tickerFunction = () => this.update(this.options.ticker.elapsedMS); + this.options.ticker.add(this.tickerFunction); + } + + this.input = new InputManager(this); + this.plugins = new PluginManager(this); + } + + /** Overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners */ + destroy(options) + { + if (!this.options.noTicker && this.tickerFunction) + { + this.options.ticker.remove(this.tickerFunction); + } + if (this.options.disableOnContextMenu) + { + this.options.divWheel.removeEventListener('contextmenu', this._disableOnContextMenu); + } + + this.input.destroy(); + super.destroy(options); + } + + /** + * Update viewport on each frame. + * + * By default, you do not need to call this unless you set `options.noTicker=true`. + * + * @param {number} elapsed time in milliseconds since last update + */ + update(elapsed) + { + if (!this.pause) + { + this.plugins.update(elapsed); + + if (this.lastViewport) + { + // Check for moved-end event + if (this.lastViewport.x !== this.x || this.lastViewport.y !== this.y) + { + this.moving = true; + } + else if (this.moving) + { + this.emit('moved-end', this); + this.moving = false; + } + + // Check for zoomed-end event + if (this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y) + { + this.zooming = true; + } + else if (this.zooming) + { + this.emit('zoomed-end', this); + this.zooming = false; + } + } + + if (!this.forceHitArea) + { + this._hitAreaDefault = new math.Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight); + this.hitArea = this._hitAreaDefault; + } + + this._dirty = this._dirty || !this.lastViewport + || this.lastViewport.x !== this.x || this.lastViewport.y !== this.y + || this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y; + + this.lastViewport = { + x: this.x, + y: this.y, + scaleX: this.scale.x, + scaleY: this.scale.y + }; + this.emit('frame-end', this); + } + } + + /** + * Use this to set screen and world sizes, needed for pinch/wheel/clamp/bounce. + * @param {number} screenWidth=window.innerWidth + * @param {number} screenHeight=window.innerHeight + * @param {number} [worldWidth] + * @param {number} [worldHeight] + */ + resize( + screenWidth = window.innerWidth, + screenHeight = window.innerHeight, + worldWidth, + worldHeight + ) + { + this.screenWidth = screenWidth; + this.screenHeight = screenHeight; + + if (typeof worldWidth !== 'undefined') + { + this._worldWidth = worldWidth; + } + if (typeof worldHeight !== 'undefined') + { + this._worldHeight = worldHeight; + } + + this.plugins.resize(); + this.dirty = true; + } + + /** World width, in pixels */ + get worldWidth() + { + if (this._worldWidth) + { + return this._worldWidth; + } + + return this.width / this.scale.x; + } + set worldWidth(value) + { + this._worldWidth = value; + this.plugins.resize(); + } + + /** World height, in pixels */ + get worldHeight() + { + if (this._worldHeight) + { + return this._worldHeight; + } + + return this.height / this.scale.y; + } + set worldHeight(value) + { + this._worldHeight = value; + this.plugins.resize(); + } + + /** Get visible world bounds of viewport */ + getVisibleBounds() + { + return new math.Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight); + } + + /** Change coordinates from screen to world */ + + + + + /** + * Changes coordinate from screen to world + * @param {number|PIXI.Point} x + * @param {number} y + * @returns {PIXI.Point} + */ + toWorld(x, y) + { + if (arguments.length === 2) + { + return this.toLocal(new math.Point(x , y)); + } + + return this.toLocal(x ); + } + + /** Change coordinates from world to screen */ + + + + + /** + * Changes coordinate from world to screen + * @param {number|PIXI.Point} x + * @param {number} y + * @returns {PIXI.Point} + */ + toScreen(x, y) + { + if (arguments.length === 2) + { + return this.toGlobal(new math.Point(x , y)); + } + + return this.toGlobal(x ); + } + + /** Screen width in world coordinates */ + get worldScreenWidth() + { + return this.screenWidth / this.scale.x; + } + + /** Screen height in world coordinates */ + get worldScreenHeight() + { + return this.screenHeight / this.scale.y; + } + + /** World width in screen coordinates */ + get screenWorldWidth() + { + return this.worldWidth * this.scale.x; + } + + /** World height in screen coordinates */ + get screenWorldHeight() + { + return this.worldHeight * this.scale.y; + } + + /** Center of screen in world coordinates */ + get center() + { + return new math.Point( + (this.worldScreenWidth / 2) - (this.x / this.scale.x), + (this.worldScreenHeight / 2) - (this.y / this.scale.y), + ); + } + set center(value) + { + this.moveCenter(value); + } + + + + + + + /** + * Move center of viewport to (x, y) + * @param {number|PIXI.Point} x + * @param {number} [y] + * @return {Viewport} + */ + moveCenter(...args) + { + let x; + let y; + + if (typeof args[0] === 'number') + { + x = args[0]; + y = args[1] ; + } + else + { + x = args[0].x; + y = args[0].y; + } + + const newX = ((this.worldScreenWidth / 2) - x) * this.scale.x; + const newY = ((this.worldScreenHeight / 2) - y) * this.scale.y; + + if (this.x !== newX || this.y !== newY) + { + this.position.set(newX, newY); + this.plugins.reset(); + this.dirty = true; + } + + return this; + } + + /** Top-left corner of Viewport */ + get corner() + { + return new math.Point(-this.x / this.scale.x, -this.y / this.scale.y); + } + set corner(value) + { + this.moveCorner(value); + } + + /** Move Viewport's top-left corner; also clamps and resets decelerate and bounce (as needed) */ + + + + + + /** + * MoveCorner + * @param {number|PIXI.Point} x + * @param {number} [y] + * @returns {Viewport} + */ + moveCorner(...args) + { + let x; + let y; + + if (args.length === 1) + { + x = -args[0].x * this.scale.x; + y = -args[0].y * this.scale.y; + } + else + { + x = -args[0] * this.scale.x; + y = -args[1] * this.scale.y; + } + + if (x !== this.x || y !== this.y) + { + this.position.set(x, y); + this.plugins.reset(); + this.dirty = true; + } + + return this; + } + + /** Get how many world pixels fit in screen's width */ + get screenWidthInWorldPixels() + { + return this.screenWidth / this.scale.x; + } + + /** Get how many world pixels fit on screen's height */ + get screenHeightInWorldPixels() + { + return this.screenHeight / this.scale.y; + } + + /** + * Find the scale value that fits a world width on the screen + * does not change the viewport (use fit... to change) + * + * @param width - Width in world pixels + * @return - scale + */ + findFitWidth(width) + { + return this.screenWidth / width; + } + + /** + * Finds the scale value that fits a world height on the screens + * does not change the viewport (use fit... to change) + * + * @param height - Height in world pixels + * @return - scale + */ + findFitHeight(height) + { + return this.screenHeight / height; + } + + /** + * Finds the scale value that fits the smaller of a world width and world height on the screen + * does not change the viewport (use fit... to change) + * + * @param {number} width in world pixels + * @param {number} height in world pixels + * @returns {number} scale + */ + findFit(width, height) + { + const scaleX = this.screenWidth / width; + const scaleY = this.screenHeight / height; + + return Math.min(scaleX, scaleY); + } + + /** + * Finds the scale value that fits the larger of a world width and world height on the screen + * does not change the viewport (use fit... to change) + * + * @param {number} width in world pixels + * @param {number} height in world pixels + * @returns {number} scale + */ + findCover(width, height) + { + const scaleX = this.screenWidth / width; + const scaleY = this.screenHeight / height; + + return Math.max(scaleX, scaleY); + } + + /** + * Change zoom so the width fits in the viewport + * + * @param width - width in world coordinates + * @param center - maintain the same center + * @param scaleY - whether to set scaleY=scaleX + * @param noClamp - whether to disable clamp-zoom + * @returns {Viewport} this + */ + fitWidth(width = this.worldWidth, center, scaleY = true, noClamp) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.x = this.screenWidth / width; + + if (scaleY) + { + this.scale.y = this.scale.x; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (!noClamp && clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so the height fits in the viewport + * + * @param {number} [height=this.worldHeight] in world coordinates + * @param {boolean} [center] maintain the same center of the screen after zoom + * @param {boolean} [scaleX=true] whether to set scaleX = scaleY + * @param {boolean} [noClamp] whether to disable clamp-zoom + * @returns {Viewport} this + */ + fitHeight(height = this.worldHeight, center, scaleX = true, noClamp) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.y = this.screenHeight / height; + + if (scaleX) + { + this.scale.x = this.scale.y; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (!noClamp && clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so it fits the entire world in the viewport + * + * @param {boolean} center maintain the same center of the screen after zoom + * @returns {Viewport} this + */ + fitWorld(center) + { + let save; + + if (center) + { + save = this.center; + } + + this.scale.x = this.screenWidth / this.worldWidth; + this.scale.y = this.screenHeight / this.worldHeight; + + if (this.scale.x < this.scale.y) + { + this.scale.y = this.scale.x; + } + else + { + this.scale.x = this.scale.y; + } + + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Change zoom so it fits the size or the entire world in the viewport + * + * @param {boolean} [center] maintain the same center of the screen after zoom + * @param {number} [width=this.worldWidth] desired width + * @param {number} [height=this.worldHeight] desired height + * @returns {Viewport} this + */ + fit(center, width = this.worldWidth, height = this.worldHeight) + { + let save; + + if (center) + { + save = this.center; + } + + this.scale.x = this.screenWidth / width; + this.scale.y = this.screenHeight / height; + + if (this.scale.x < this.scale.y) + { + this.scale.y = this.scale.x; + } + else + { + this.scale.x = this.scale.y; + } + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Zoom viewport to specific value. + * + * @param {number} scale value (e.g., 1 would be 100%, 0.25 would be 25%) + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + setZoom(scale, center) + { + let save; + + if (center) + { + save = this.center; + } + this.scale.set(scale); + const clampZoom = this.plugins.get('clamp-zoom', true); + + if (clampZoom) + { + clampZoom.clamp(); + } + if (center && save) + { + this.moveCenter(save); + } + + return this; + } + + /** + * Zoom viewport by a certain percent (in both x and y direction). + * + * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25) + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + zoomPercent(percent, center) + { + return this.setZoom(this.scale.x + (this.scale.x * percent), center); + } + + /** + * Zoom viewport by increasing/decreasing width by a certain number of pixels. + * + * @param {number} change in pixels + * @param {boolean} [center] maintain the same center of the screen after zoom + * @return {Viewport} this + */ + zoom(change, center) + { + this.fitWidth(change + this.worldScreenWidth, center); + + return this; + } + + /** Changes scale of viewport and maintains center of viewport */ + get scaled() + { + return this.scale.x; + } + set scaled(scale) + { + this.setZoom(scale, true); + } + + /** + * Returns zoom to the desired scale + * + * @param {ISnapZoomOptions} options + * @param {number} [options.width=0] - the desired width to snap (to maintain aspect ratio, choose width or height) + * @param {number} [options.height=0] - the desired height to snap (to maintain aspect ratio, choose width or height) + * @param {number} [options.time=1000] - time for snapping in ms + * @param {(string|function)} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ + * for supported names) + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of center of the viewport + * @param {boolean} [options.interrupt=true] - pause snapping with any user input on the viewport + * @param {boolean} [options.removeOnComplete] - removes this plugin after snapping is complete + * @param {boolean} [options.removeOnInterrupt] - removes this plugin if interrupted by any user input + * @param {boolean} [options.forceStart] - starts the snap immediately regardless of whether the viewport is at the + * desired zoom + * @param {boolean} [options.noMove] - zoom but do not move + */ + snapZoom(options) + { + this.plugins.add('snap-zoom', new SnapZoom(this, options)); + + return this; + } + + /** Is container out of world bounds */ + OOB() + + + + + + + { + return { + left: this.left < 0, + right: this.right > this.worldWidth, + top: this.top < 0, + bottom: this.bottom > this.worldHeight, + cornerPoint: new math.Point( + (this.worldWidth * this.scale.x) - this.screenWidth, + (this.worldHeight * this.scale.y) - this.screenHeight + ) + }; + } + + /** World coordinates of the right edge of the screen */ + get right() + { + return (-this.x / this.scale.x) + this.worldScreenWidth; + } + set right(value) + { + this.x = (-value * this.scale.x) + this.screenWidth; + this.plugins.reset(); + } + + /** World coordinates of the left edge of the screen */ + get left() + { + return -this.x / this.scale.x; + } + set left(value) + { + this.x = -value * this.scale.x; + this.plugins.reset(); + } + + /** World coordinates of the top edge of the screen */ + get top() + { + return -this.y / this.scale.y; + } + set top(value) + { + this.y = -value * this.scale.y; + this.plugins.reset(); + } + + /** World coordinates of the bottom edge of the screen */ + get bottom() + { + return (-this.y / this.scale.y) + this.worldScreenHeight; + } + set bottom(value) + { + this.y = (-value * this.scale.y) + this.screenHeight; + this.plugins.reset(); + } + + /** + * Determines whether the viewport is dirty (i.e., needs to be rendered to the screen because of a change) + */ + get dirty() + { + return !!this._dirty; + } + set dirty(value) + { + this._dirty = value; + } + + /** + * Permanently changes the Viewport's hitArea + * + * NOTE: if not set then hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, + * Viewport.worldScreenHeight) + */ + get forceHitArea() + { + return this._forceHitArea; + } + set forceHitArea(value) + { + if (value) + { + this._forceHitArea = value; + this.hitArea = value; + } + else + { + this._forceHitArea = null; + this.hitArea = new math.Rectangle(0, 0, this.worldWidth, this.worldHeight); + } + } + + /** + * Enable one-finger touch to drag + * + * NOTE: if you expect users to use right-click dragging, you should enable `viewport.options.disableOnContextMenu` + * to avoid the context menu popping up on each right-click drag. + * + * @param {IDragOptions} [options] + * @param {string} [options.direction=all] direction to drag + * @param {boolean} [options.pressDrag=true] whether click to drag is active + * @param {boolean} [options.wheel=true] use wheel to scroll in direction (unless wheel plugin is active) + * @param {number} [options.wheelScroll=1] number of pixels to scroll with each wheel spin + * @param {boolean} [options.reverse] reverse the direction of the wheel scroll + * @param {(boolean|string)} [options.clampWheel=false] clamp wheel(to avoid weird bounce with mouse wheel) + * @param {string} [options.underflow=center] where to place world if too small for screen + * @param {number} [options.factor=1] factor to multiply drag to increase the speed of movement + * @param {string} [options.mouseButtons=all] changes which mouse buttons trigger drag, use: 'all', 'left', + * 'right' 'middle', or some combination, like, 'middle-right'; you may want to set + * viewport.options.disableOnContextMenu if you want to use right-click dragging + * @param {string[]} [options.keyToPress=null] - array containing + * {@link key|https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code} codes of keys that can be + * pressed for the drag to be triggered, e.g.: ['ShiftLeft', 'ShiftRight'}. + * @param {boolean} [options.ignoreKeyToPressOnTouch=false] - ignore keyToPress for touch events + * @param {number} [options.lineHeight=20] - scaling factor for non-DOM_DELTA_PIXEL scrolling events + * @returns {Viewport} this + */ + drag(options) + { + this.plugins.add('drag', new Drag(this, options)); + + return this; + } + + /** + * Clamp to world boundaries or other provided boundaries + * There are three ways to clamp: + * 1. direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of offscreen + * direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary + * 2. left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side; + * if any of these are set to true, then the location is set to the boundary + * [0, viewport.worldWidth/viewport.worldHeight], eg: to allow the world to be completely dragged offscreen, + * set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2] + * + * Underflow determines what happens when the world is smaller than the viewport + * 1. none = the world is clamped but there is no special behavior + * 2. center = the world is centered on the viewport + * 3. combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the + * appropriate boundaries + * + * NOTES: + * clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping + * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly + * + * @param {object} [options] + * @param {(number|boolean)} [options.left=false] - clamp left; true = 0 + * @param {(number|boolean)} [options.right=false] - clamp right; true = viewport.worldWidth + * @param {(number|boolean)} [options.top=false] - clamp top; true = 0 + * @param {(number|boolean)} [options.bottom=false] - clamp bottom; true = viewport.worldHeight + * @param {string} [direction] - (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; + * replaces left/right/top/bottom if set + * @param {string} [underflow=center] - where to place world if too small for screen (e.g., top-right, center, + * none, bottomLeft) * @returns {Viewport} this + */ + clamp(options) + { + this.plugins.add('clamp', new Clamp(this, options)); + + return this; + } + + /** + * Decelerate after a move + * + * NOTE: this fires 'moved' event during deceleration + * + * @param {IDecelerateOptions} [options] + * @param {number} [options.friction=0.95] - percent to decelerate after movement + * @param {number} [options.bounce=0.8] - percent to decelerate when past boundaries (only applicable when + * viewport.bounce() is active) + * @param {number} [options.minSpeed=0.01] - minimum velocity before stopping/reversing acceleration + * @return {Viewport} this + */ + decelerate(options) + { + this.plugins.add('decelerate', new Decelerate(this, options)); + + return this; + } + + /** + * Bounce on borders + * NOTES: + * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly + * fires 'moved', 'bounce-x-start', 'bounce-y-start', 'bounce-x-end', and 'bounce-y-end' events + * @param {object} [options] + * @param {string} [options.sides=all] - all, horizontal, vertical, or combination of top, bottom, right, left + * (e.g., 'top-bottom-right') + * @param {number} [options.friction=0.5] - friction to apply to decelerate if active + * @param {number} [options.time=150] - time in ms to finish bounce + * @param {object} [options.bounceBox] - use this bounceBox instead of (0, 0, viewport.worldWidth, viewport.worldHeight) + * @param {number} [options.bounceBox.x=0] + * @param {number} [options.bounceBox.y=0] + * @param {number} [options.bounceBox.width=viewport.worldWidth] + * @param {number} [options.bounceBox.height=viewport.worldHeight] + * @param {string|function} [options.ease=easeInOutSine] - ease function or name + * (see http://easings.net/ for supported names) + * @param {string} [options.underflow=center] - (top/bottom/center and left/right/center, or center) + * where to place world if too small for screen + * @return {Viewport} this + */ + bounce(options) + { + this.plugins.add('bounce', new Bounce(this, options)); + + return this; + } + + /** + * Enable pinch to zoom and two-finger touch to drag + * + * @param {PinchOptions} [options] + * @param {boolean} [options.noDrag] - disable two-finger dragging + * @param {number} [options.percent=1] - percent to modify pinch speed + * @param {number} [options.factor=1] - factor to multiply two-finger drag to increase the speed of movement + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of center of two fingers + * @param {('all'|'x'|'y')} [options.axis=all] - axis to zoom + * @return {Viewport} this + */ + pinch(options) + { + this.plugins.add('pinch', new Pinch(this, options)); + + return this; + } + + /** + * Snap to a point + * + * @param {number} x + * @param {number} y + * @param {ISnapOptions} [options] + * @param {boolean} [options.topLeft] - snap to the top-left of viewport instead of center + * @param {number} [options.friction=0.8] - friction/frame to apply if decelerate is active + * @param {number} [options.time=1000] - time in ms to snap + * @param {string|function} [options.ease=easeInOutSine] - ease function or name (see http://easings.net/ + * for supported names) + * @param {boolean} [options.interrupt=true] - pause snapping with any user input on the viewport + * @param {boolean} [options.removeOnComplete] - removes this plugin after snapping is complete + * @param {boolean} [options.removeOnInterrupt] - removes this plugin if interrupted by any user input + * @param {boolean} [options.forceStart] - starts the snap immediately regardless of whether the viewport is at + * the desired location + * @return {Viewport} this + */ + snap(x, y, options) + { + this.plugins.add('snap', new Snap(this, x, y, options)); + + return this; + } + + /** + * Follow a target + * + * NOTES: + * uses the (x, y) as the center to follow; for PIXI.Sprite to work properly, use sprite.anchor.set(0.5) + * options.acceleration is not perfect as it doesn't know the velocity of the target. It adds acceleration + * to the start of movement and deceleration to the end of movement when the target is stopped. + * To cancel the follow, use: `viewport.plugins.remove('follow')` + * + * @fires 'moved' event + * + * @param {PIXI.DisplayObject} target to follow + * @param {IFollowOptions} [options] + * @param {number} [options.speed=0] - to follow in pixels/frame (0=teleport to location) + * @param {number} [options.acceleration] - set acceleration to accelerate and decelerate at this rate; speed + * cannot be 0 to use acceleration + * @param {number} [options.radius] - radius (in world coordinates) of center circle where movement is allowed + * without moving the viewport * @returns {Viewport} this + * @returns {Viewport} this + */ + follow(target, options) + { + this.plugins.add('follow', new Follow(this, target, options)); + + return this; + } + + /** + * Zoom using mouse wheel + * + * NOTE: the default event listener for 'wheel' event is document.body. Use `Viewport.options.divWheel` to + * change this default + * + * @param {IWheelOptions} [options] + * @param {number} [options.percent=0.1] - percent to scroll with each spin + * @param {number} [options.smooth] - smooth the zooming by providing the number of frames to zoom between wheel spins + * @param {boolean} [options.interrupt=true] - stop smoothing with any user input on the viewport + * @param {boolean} [options.reverse] - reverse the direction of the scroll + * @param {PIXI.Point} [options.center] - place this point at center during zoom instead of current mouse position + * @param {number} [options.lineHeight=20] - scaling factor for non-DOM_DELTA_PIXEL scrolling events + * @param {('all'|'x'|'y')} [options.axis=all] - axis to zoom + * @return {Viewport} this + */ + wheel(options) + { + this.plugins.add('wheel', new Wheel(this, options)); + + return this; + } + + /** + * Animate the position and/or scale of the viewport + * To set the zoom level, use: (1) scale, (2) scaleX and scaleY, or (3) width and/or height + * @param {object} options + * @param {number} [options.time=1000] - time to animate + * @param {PIXI.Point} [options.position=viewport.center] - position to move viewport + * @param {number} [options.width] - desired viewport width in world pixels (use instead of scale; + * aspect ratio is maintained if height is not provided) + * @param {number} [options.height] - desired viewport height in world pixels (use instead of scale; + * aspect ratio is maintained if width is not provided) + * @param {number} [options.scale] - scale to change zoom (scale.x = scale.y) + * @param {number} [options.scaleX] - independently change zoom in x-direction + * @param {number} [options.scaleY] - independently change zoom in y-direction + * @param {(function|string)} [options.ease=linear] - easing function to use + * @param {function} [options.callbackOnComplete] + * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input + * @returns {Viewport} this + */ + animate(options) + { + this.plugins.add('animate', new Animate(this, options)); + + return this; + } + + /** + * Enable clamping of zoom to constraints + * + * The minWidth/Height settings are how small the world can get (as it would appear on the screen) + * before clamping. The maxWidth/maxHeight is how larger the world can scale (as it would appear on + * the screen) before clamping. + * + * For example, if you have a world size of 1000 x 1000 and a screen size of 100 x 100, if you set + * minWidth/Height = 100 then the world will not be able to zoom smaller than the screen size (ie, + * zooming out so it appears smaller than the screen). Similarly, if you set maxWidth/Height = 100 + * the world will not be able to zoom larger than the screen size (ie, zooming in so it appears + * larger than the screen). + * + * @param {object} [options] + * @param {number} [options.minWidth] - minimum width + * @param {number} [options.minHeight] - minimum height + * @param {number} [options.maxWidth] - maximum width + * @param {number} [options.maxHeight] - maximum height + * @param {number} [options.minScale] - minimum scale + * @param {number} [options.maxScale] - minimum scale + * @return {Viewport} this + */ + clampZoom(options) + { + this.plugins.add('clamp-zoom', new ClampZoom(this, options)); + + return this; + } + + /** + * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen. + * + * NOTES: fires 'moved' event; there's a known bug where the mouseEdges does not work properly with "windowed" viewports + * + * @param {IMouseEdgesOptions} [options] + * @param {number} [options.radius] - distance from center of screen in screen pixels + * @param {number} [options.distance] - distance from all sides in screen pixels + * @param {number} [options.top] - alternatively, set top distance (leave unset for no top scroll) + * @param {number} [options.bottom] - alternatively, set bottom distance (leave unset for no top scroll) + * @param {number} [options.left] - alternatively, set left distance (leave unset for no top scroll) + * @param {number} [options.right] - alternatively, set right distance (leave unset for no top scroll) + * @param {number} [options.speed=8] - speed in pixels/frame to scroll viewport + * @param {boolean} [options.reverse] - reverse direction of scroll + * @param {boolean} [options.noDecelerate] - don't use decelerate plugin even if it's installed + * @param {boolean} [options.linear] - if using radius, use linear movement (+/- 1, +/- 1) instead of angled + * movement (Math.cos(angle from center), Math.sin(angle from center)) + * @param {boolean} [options.allowButtons] allows plugin to continue working even when there's a mousedown event + */ + mouseEdges(options) + { + this.plugins.add('mouse-edges', new MouseEdges(this, options)); + + return this; + } + + /** Pause viewport (including animation updates such as decelerate) */ + get pause() + { + return !!this._pause; + } + set pause(value) + { + this._pause = value; + + this.lastViewport = null; + this.moving = false; + this.zooming = false; + + if (value) + { + this.input.pause(); + } + } + + /** + * Move the viewport so the bounding box is visible + * + * @param x - left + * @param y - top + * @param width + * @param height + * @param resizeToFit - Resize the viewport so the box fits within the viewport + */ + ensureVisible(x, y, width, height, resizeToFit) + { + if (resizeToFit && (width > this.worldScreenWidth || height > this.worldScreenHeight)) + { + this.fit(true, width, height); + this.emit('zoomed', { viewport: this, type: 'ensureVisible' }); + } + let moved = false; + + if (x < this.left) + { + this.left = x; + moved = true; + } + else if (x + width > this.right) + { + this.right = x + width; + moved = true; + } + if (y < this.top) + { + this.top = y; + moved = true; + } + else if (y + height > this.bottom) + { + this.bottom = y + height; + moved = true; + } + if (moved) + { + this.emit('moved', { viewport: this, type: 'ensureVisible' }); + } + } + } + + /** + * Fires after a mouse or touch click + * @event Viewport#clicked + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a drag starts + * @event Viewport#drag-start + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a drag ends + * @event Viewport#drag-end + * @type {object} + * @property {PIXI.Point} screen + * @property {PIXI.Point} world + * @property {Viewport} viewport + */ + + /** + * Fires when a pinch starts + * @event Viewport#pinch-start + * @type {Viewport} + */ + + /** + * Fires when a pinch end + * @event Viewport#pinch-end + * @type {Viewport} + */ + + /** + * Fires when a snap starts + * @event Viewport#snap-start + * @type {Viewport} + */ + + /** + * Fires when a snap ends + * @event Viewport#snap-end + * @type {Viewport} + */ + + /** + * Fires when a snap-zoom starts + * @event Viewport#snap-zoom-start + * @type {Viewport} + */ + + /** + * Fires when a snap-zoom ends + * @event Viewport#snap-zoom-end + * @type {Viewport} + */ + + /** + * Fires when a bounce starts in the x direction + * @event Viewport#bounce-x-start + * @type {Viewport} + */ + + /** + * Fires when a bounce ends in the x direction + * @event Viewport#bounce-x-end + * @type {Viewport} + */ + + /** + * Fires when a bounce starts in the y direction + * @event Viewport#bounce-y-start + * @type {Viewport} + */ + + /** + * Fires when a bounce ends in the y direction + * @event Viewport#bounce-y-end + * @type {Viewport} + */ + + /** + * Fires when for a mouse wheel event + * @event Viewport#wheel + * @type {object} + * @property {object} wheel + * @property {number} wheel.dx + * @property {number} wheel.dy + * @property {number} wheel.dz + * @property {Viewport} viewport + */ + + /** + * Fires when a wheel-scroll occurs + * @event Viewport#wheel-scroll + * @type {Viewport} + */ + + /** + * Fires when a mouse-edge starts to scroll + * @event Viewport#mouse-edge-start + * @type {Viewport} + */ + + /** + * Fires when the mouse-edge scrolling ends + * @event Viewport#mouse-edge-end + * @type {Viewport} + */ + + /** + * Fires when viewport moves through UI interaction, deceleration, ensureVisible, or follow + * @event Viewport#moved + * @type {object} + * @property {Viewport} viewport + * @property {string} type - (drag, snap, pinch, follow, bounce-x, bounce-y, + * clamp-x, clamp-y, decelerate, mouse-edges, wheel, ensureVisible) + */ + + /** + * Fires when viewport moves through UI interaction, deceleration, ensureVisible, or follow + * @event Viewport#zoomed + * @type {object} + * @property {Viewport} viewport + * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom, ensureVisible) + */ + + /** + * Fires when viewport stops moving + * @event Viewport#moved-end + * @type {Viewport} + */ + + /** + * Fires when viewport stops zooming + * @event Viewport#zoomed-end + * @type {Viewport} + */ + + /** + * Fires at the end of an update frame + * @event Viewport#frame-end + * @type {Viewport} + */ + + exports.Animate = Animate; + exports.Bounce = Bounce; + exports.Clamp = Clamp; + exports.ClampZoom = ClampZoom; + exports.Decelerate = Decelerate; + exports.Drag = Drag; + exports.Follow = Follow; + exports.InputManager = InputManager; + exports.MouseEdges = MouseEdges; + exports.Pinch = Pinch; + exports.Plugin = Plugin; + exports.PluginManager = PluginManager; + exports.Snap = Snap; + exports.SnapZoom = SnapZoom; + exports.Viewport = Viewport; + exports.Wheel = Wheel; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +if (typeof pixi_viewport !== 'undefined') { Object.assign(this.PIXI, pixi_viewport); } +//# sourceMappingURL=viewport.min.js.map diff --git a/lib/card/card.js b/lib/card/card.js index 1915635..80cddd9 100644 --- a/lib/card/card.js +++ b/lib/card/card.js @@ -1385,7 +1385,7 @@ export default class Card { //jquery hyphenate below if (this._isJQueryPresent()) { - //$('.column').not('.overview').children('p').hyphenate('de') + $('.column').not('.overview').children('p').hyphenate('de') } //logging @@ -1936,7 +1936,7 @@ export default class Card { if (this._isJQueryPresent()) { //jquery hyphenate below - //console.log('hyphenated popup:', $('span').hyphenate('de')) + console.log('hyphenated popup:', $('span').hyphenate('de')) } } diff --git a/package.json b/package.json index 79a3bee..a95b291 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iwmlib", - "version": "2.0.0-beta.0", + "version": "2.0.0-beta.1", "description": "An Open Source library for multi-touch, WebGL powered applications.", "main": "index.js", "directories": {

>>0)u=.5;else{if((g|0)==(p|0)?(T+(v+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(w){if((de[E>>0]|0)!=45)break;f=-f;u=-u}}while(0);p=_-g|0;fe[h>>2]=p;if(!(f+u!=f)){c=m;break}b=p+c|0;fe[h>>2]=b;if(b>>>0>999999999){a=m;while(1){c=h+-4|0;fe[h>>2]=0;if(c>>>0>>0){a=a+-4|0;fe[a>>2]=0}b=(fe[c>>2]|0)+1|0;fe[c>>2]=b;if(b>>>0>999999999)h=c;else{m=a;h=c;break}}}a=(x-m>>2)*9|0;p=fe[m>>2]|0;if(p>>>0<10){c=m;break}else c=10;do{c=c*10|0;a=a+1|0}while(p>>>0>=c>>>0);c=m}}while(0);b=h+4|0;m=c;l=l>>>0>b>>>0?b:l}g=0-a|0;while(1){if(l>>>0<=m>>>0){v=0;b=l;break}h=l+-4|0;if(!(fe[h>>2]|0))l=h;else{v=1;b=l;break}}do{if(F){o=(y&1^1)+o|0;if((o|0)>(a|0)&(a|0)>-5){d=d+-1|0;o=o+-1-a|0}else{d=d+-2|0;o=o+-1|0}l=S&8;if(l)break;do{if(v){l=fe[b+-4>>2]|0;if(!l){h=9;break}if(!((l>>>0)%10|0)){c=10;h=0}else{h=0;break}do{c=c*10|0;h=h+1|0}while(((l>>>0)%(c>>>0)|0|0)==0)}else h=9}while(0);l=((b-x>>2)*9|0)+-9|0;if((d|32|0)==102){l=l-h|0;l=(l|0)<0?0:l;o=(o|0)<(l|0)?o:l;l=0;break}else{l=l+a-h|0;l=(l|0)<0?0:l;o=(o|0)<(l|0)?o:l;l=0;break}}else l=S&8}while(0);_=o|l;c=(_|0)!=0&1;p=(d|32|0)==102;if(p){a=(a|0)>0?a:0;d=0}else{h=(a|0)<0?g:a;h=se(h,((h|0)<0)<<31>>31,W)|0;if((C-h|0)<2)do{h=h+-1|0;de[h>>0]=48}while((C-h|0)<2);de[h+-1>>0]=(a>>31&2)+43;x=h+-2|0;de[x>>0]=d;a=C-x|0;d=x}g=w+1+o+c+a|0;oe(e,32,k,g,S);if(!(fe[e>>2]&32))ne(E,w,e)|0;oe(e,48,k,g,S^65536);do{if(p){h=m>>>0>T>>>0?T:m;a=h;do{l=se(fe[a>>2]|0,0,R)|0;do{if((a|0)==(h|0)){if((l|0)!=(R|0))break;de[G>>0]=48;l=G}else{if(l>>>0<=I>>>0)break;do{l=l+-1|0;de[l>>0]=48}while(l>>>0>I>>>0)}}while(0);if(!(fe[e>>2]&32))ne(l,j-l|0,e)|0;a=a+4|0}while(a>>>0<=T>>>0);do{if(_){if(fe[e>>2]&32)break;ne(5891,1,e)|0}}while(0);if((o|0)>0&a>>>0>>0){l=a;while(1){a=se(fe[l>>2]|0,0,R)|0;if(a>>>0>I>>>0)do{a=a+-1|0;de[a>>0]=48}while(a>>>0>I>>>0);if(!(fe[e>>2]&32))ne(a,(o|0)>9?9:o,e)|0;l=l+4|0;a=o+-9|0;if(!((o|0)>9&l>>>0>>0)){o=a;break}else o=a}}oe(e,48,o+9|0,9,0)}else{p=v?b:m+4|0;if((o|0)>-1){c=(l|0)==0;h=m;do{a=se(fe[h>>2]|0,0,R)|0;if((a|0)==(R|0)){de[G>>0]=48;a=G}do{if((h|0)==(m|0)){l=a+1|0;if(!(fe[e>>2]&32))ne(a,1,e)|0;if(c&(o|0)<1){a=l;break}if(fe[e>>2]&32){a=l;break}ne(5891,1,e)|0;a=l}else{if(a>>>0<=I>>>0)break;do{a=a+-1|0;de[a>>0]=48}while(a>>>0>I>>>0)}}while(0);l=j-a|0;if(!(fe[e>>2]&32))ne(a,(o|0)>(l|0)?l:o,e)|0;o=o-l|0;h=h+4|0}while(h>>>0