From 1c70433b86b209b2b8601e4628749e520bafda7a Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Tue, 4 Feb 2020 16:48:36 +0100 Subject: [PATCH] Updated to PixiJS 5.2.1. --- dist/iwmlib.3rdparty.js | 14733 +++++++++++++++++----------------- dist/iwmlib.3rdparty.min.js | 2 +- package-lock.json | 2294 +++--- package.json | 4 +- 4 files changed, 8747 insertions(+), 8286 deletions(-) diff --git a/dist/iwmlib.3rdparty.js b/dist/iwmlib.3rdparty.js index 0f60fb8..7acb20d 100644 --- a/dist/iwmlib.3rdparty.js +++ b/dist/iwmlib.3rdparty.js @@ -4355,8 +4355,8 @@ if (typeof define === 'function' && define.amd) { })); /*! - * pixi.js - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * pixi.js - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * pixi.js is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -4827,8 +4827,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/polyfill - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/polyfill - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/polyfill is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -4985,19 +4985,110 @@ var PIXI = (function (exports) { window.Int32Array = Array; } - var isMobile_min = createCommonjsModule(function (module) { - !function(e){var n=/iPhone/i,t=/iPod/i,r=/iPad/i,a=/\bAndroid(?:.+)Mobile\b/i,p=/Android/i,b=/\bAndroid(?:.+)SD4930UR\b/i,l=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,f=/Windows Phone/i,s=/\bWindows(?:.+)ARM\b/i,u=/BlackBerry/i,c=/BB10/i,h=/Opera Mini/i,v=/\b(CriOS|Chrome)(?:.+)Mobile/i,w=/Mobile(?:.+)Firefox\b/i;function m(e,i){return e.test(i)}function i(e){var i=e||("undefined"!=typeof navigator?navigator.userAgent:""),o=i.split("[FBAN");void 0!==o[1]&&(i=o[0]),void 0!==(o=i.split("Twitter"))[1]&&(i=o[0]);var d={apple:{phone:m(n,i)&&!m(f,i),ipod:m(t,i),tablet:!m(n,i)&&m(r,i)&&!m(f,i),device:(m(n,i)||m(t,i)||m(r,i))&&!m(f,i)},amazon:{phone:m(b,i),tablet:!m(b,i)&&m(l,i),device:m(b,i)||m(l,i)},android:{phone:!m(f,i)&&m(b,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(b,i)&&!m(a,i)&&(m(l,i)||m(p,i)),device:!m(f,i)&&(m(b,i)||m(l,i)||m(a,i)||m(p,i))||m(/\bokhttp\b/i,i)},windows:{phone:m(f,i),tablet:m(s,i),device:m(f,i)||m(s,i)},other:{blackberry:m(u,i),blackberry10:m(c,i),opera:m(h,i),firefox:m(w,i),chrome:m(v,i),device:m(u,i)||m(c,i)||m(h,i)||m(w,i)||m(v,i)}};return d.any=d.apple.device||d.android.device||d.windows.device||d.other.device,d.phone=d.apple.phone||d.android.phone||d.windows.phone,d.tablet=d.apple.tablet||d.android.tablet||d.windows.tablet,d}"undefined"!='object'&&module.exports&&"undefined"==typeof window?module.exports=i:"undefined"!='object'&&module.exports&&"undefined"!=typeof window?(module.exports=i(),module.exports.isMobile=i):"function"==typeof undefined&&undefined.amd?undefined([],e.isMobile=i()):e.isMobile=i();}(commonjsGlobal); - }); - var isMobile_min_1 = isMobile_min.isMobile; + var appleIphone = /iPhone/i; + var appleIpod = /iPod/i; + var appleTablet = /iPad/i; + var androidPhone = /\bAndroid(?:.+)Mobile\b/i; + var androidTablet = /Android/i; + var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; + var amazonTablet = /Silk/i; + var windowsPhone = /Windows Phone/i; + var windowsTablet = /\bWindows(?:.+)ARM\b/i; + var otherBlackBerry = /BlackBerry/i; + var otherBlackBerry10 = /BB10/i; + var otherOpera = /Opera Mini/i; + var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; + var otherFirefox = /Mobile(?:.+)Firefox\b/i; + function match(regex, userAgent) { + return regex.test(userAgent); + } + function isMobile(userAgent) { + userAgent = + userAgent || (typeof navigator !== 'undefined' ? navigator.userAgent : ''); + var tmp = userAgent.split('[FBAN'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + tmp = userAgent.split('Twitter'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + var result = { + apple: { + phone: match(appleIphone, userAgent) && !match(windowsPhone, userAgent), + ipod: match(appleIpod, userAgent), + tablet: !match(appleIphone, userAgent) && + match(appleTablet, userAgent) && + !match(windowsPhone, userAgent), + device: (match(appleIphone, userAgent) || + match(appleIpod, userAgent) || + match(appleTablet, userAgent)) && + !match(windowsPhone, userAgent), + }, + amazon: { + phone: match(amazonPhone, userAgent), + tablet: !match(amazonPhone, userAgent) && match(amazonTablet, userAgent), + device: match(amazonPhone, userAgent) || match(amazonTablet, userAgent), + }, + android: { + phone: (!match(windowsPhone, userAgent) && match(amazonPhone, userAgent)) || + (!match(windowsPhone, userAgent) && match(androidPhone, userAgent)), + tablet: !match(windowsPhone, userAgent) && + !match(amazonPhone, userAgent) && + !match(androidPhone, userAgent) && + (match(amazonTablet, userAgent) || match(androidTablet, userAgent)), + device: (!match(windowsPhone, userAgent) && + (match(amazonPhone, userAgent) || + match(amazonTablet, userAgent) || + match(androidPhone, userAgent) || + match(androidTablet, userAgent))) || + match(/\bokhttp\b/i, userAgent), + }, + windows: { + phone: match(windowsPhone, userAgent), + tablet: match(windowsTablet, userAgent), + device: match(windowsPhone, userAgent) || match(windowsTablet, userAgent), + }, + other: { + blackberry: match(otherBlackBerry, userAgent), + blackberry10: match(otherBlackBerry10, userAgent), + opera: match(otherOpera, userAgent), + firefox: match(otherFirefox, userAgent), + chrome: match(otherChrome, userAgent), + device: match(otherBlackBerry, userAgent) || + match(otherBlackBerry10, userAgent) || + match(otherOpera, userAgent) || + match(otherFirefox, userAgent) || + match(otherChrome, userAgent), + }, + any: false, + phone: false, + tablet: false, + }; + result.any = + result.apple.device || + result.android.device || + result.windows.device || + result.other.device; + result.phone = + result.apple.phone || result.android.phone || result.windows.phone; + result.tablet = + result.apple.tablet || result.android.tablet || result.windows.tablet; + return result; + } /*! - * @pixi/settings - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/settings - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/settings is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + // The ESM/CJS versions of ismobilejs only + + var isMobile$1 = isMobile(); + /** * The maximum recommended texture units to use. * In theory the bigger the better, and for desktop we'll use as many as we can. @@ -5015,11 +5106,11 @@ var PIXI = (function (exports) { { var allowMax = true; - if (isMobile_min.tablet || isMobile_min.phone) + if (isMobile$1.tablet || isMobile$1.phone) { allowMax = false; - if (isMobile_min.apple.device) + if (isMobile$1.apple.device) { var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); @@ -5034,7 +5125,7 @@ var PIXI = (function (exports) { } } } - if (isMobile_min.android.device) + if (isMobile$1.android.device) { var match$1 = (navigator.userAgent).match(/Android\s([0-9.]*)/); @@ -5064,7 +5155,7 @@ var PIXI = (function (exports) { */ function canUploadSameBuffer() { - return !isMobile_min.apple.device; + return !isMobile$1.apple.device; } /** @@ -5265,7 +5356,7 @@ var PIXI = (function (exports) { * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ - PRECISION_FRAGMENT: isMobile_min.apple.device ? 'highp' : 'mediump', + PRECISION_FRAGMENT: isMobile$1.apple.device ? 'highp' : 'mediump', /** * Can we upload the same buffer in a single frame? @@ -5938,6 +6029,9 @@ var PIXI = (function (exports) { outerNode = findHoleBridge(hole, outerNode); if (outerNode) { var b = splitPolygon(outerNode, hole); + + // filter collinear points around the cuts + filterPoints(outerNode, outerNode.next); filterPoints(b, b.next); } } @@ -7773,8 +7867,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/constants - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/constants - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/constants is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -8117,9 +8211,9 @@ var PIXI = (function (exports) { * * @name PRECISION * @memberof PIXI + * @constant * @static * @enum {string} - * @constant * @property {string} LOW='lowp' * @property {string} MEDIUM='mediump' * @property {string} HIGH='highp' @@ -8152,8 +8246,8 @@ var PIXI = (function (exports) { })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); /*! - * @pixi/utils - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/utils - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/utils is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -8170,7 +8264,6 @@ var PIXI = (function (exports) { * @example `@2x` */ settings.RETINA_PREFIX = /@([0-9\.]+)x/; - /** * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. * For most scenarios this should be left as true, as otherwise the user may have a poor experience. @@ -8185,19 +8278,16 @@ var PIXI = (function (exports) { settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true; var saidHello = false; - var VERSION = '5.2.0'; - + var VERSION = '5.2.1'; /** * Skips the hello message of renderers that are created after this is run. * * @function skipHello * @memberof PIXI.utils */ - function skipHello() - { + function skipHello() { saidHello = true; } - /** * Logs out the version and renderer information for this running instance of PIXI. * If you don't want to see this message you can run `PIXI.utils.skipHello()` before @@ -8208,17 +8298,14 @@ var PIXI = (function (exports) { * @memberof PIXI.utils * @param {string} type - The string renderer type to log. */ - function sayHello(type) - { - if (saidHello) - { + function sayHello(type) { + var _a; + if (saidHello) { return; } - - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) - { + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { var args = [ - ("\n %c %c %c PixiJS " + VERSION + " - ✰ " + type + " ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n"), + "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", 'background: #ff66a5; padding:5px 0;', 'background: #ff66a5; padding:5px 0;', 'color: #ff66a5; background: #030307; padding:5px 0;', @@ -8228,19 +8315,15 @@ var PIXI = (function (exports) { 'color: #ff2424; background: #fff; padding:5px 0;', 'color: #ff2424; background: #fff; padding:5px 0;', 'color: #ff2424; background: #fff; padding:5px 0;' ]; - - window.console.log.apply(console, args); + (_a = window.console).log.apply(_a, args); } - else if (window.console) - { - window.console.log(("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/")); + else if (window.console) { + window.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); } - saidHello = true; } var supported; - /** * Helper for checking for WebGL support. * @@ -8248,51 +8331,35 @@ var PIXI = (function (exports) { * @function isWebGLSupported * @return {boolean} Is WebGL supported. */ - function isWebGLSupported() - { - if (typeof supported === 'undefined') - { - supported = (function supported() - { + function isWebGLSupported() { + if (typeof supported === 'undefined') { + supported = (function supported() { var contextOptions = { stencil: true, failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, }; - - try - { - if (!window.WebGLRenderingContext) - { + try { + if (!window.WebGLRenderingContext) { return false; } - var canvas = document.createElement('canvas'); - var gl = canvas.getContext('webgl', contextOptions) - || canvas.getContext('experimental-webgl', contextOptions); - + var gl = (canvas.getContext('webgl', contextOptions) + || canvas.getContext('experimental-webgl', contextOptions)); var success = !!(gl && gl.getContextAttributes().stencil); - - if (gl) - { + if (gl) { var loseContext = gl.getExtension('WEBGL_lose_context'); - - if (loseContext) - { + if (loseContext) { loseContext.loseContext(); } } - gl = null; - return success; } - catch (e) - { + catch (e) { return false; } })(); } - return supported; } @@ -8307,17 +8374,13 @@ var PIXI = (function (exports) { * @param {number[]} [out=[]] If supplied, this array will be used rather than returning a new one * @return {number[]} An array representing the [R, G, B] of the color where all values are floats. */ - function hex2rgb(hex, out) - { + function hex2rgb(hex, out) { out = out || []; - out[0] = ((hex >> 16) & 0xFF) / 255; out[1] = ((hex >> 8) & 0xFF) / 255; out[2] = (hex & 0xFF) / 255; - return out; } - /** * Converts a hexadecimal color number to a string. * @@ -8328,14 +8391,11 @@ var PIXI = (function (exports) { * @param {number} hex - Number in hex (e.g., `0xffffff`) * @return {string} The string color (e.g., `"#ffffff"`). */ - function hex2string(hex) - { - hex = hex.toString(16); - hex = '000000'.substr(0, 6 - hex.length) + hex; - - return ("#" + hex); + function hex2string(hex) { + var hexString = hex.toString(16); + hexString = '000000'.substr(0, 6 - hexString.length) + hexString; + return "#" + hexString; } - /** * Converts a hexadecimal string to a hexadecimal color number. * @@ -8346,16 +8406,12 @@ var PIXI = (function (exports) { * @param {string} The string color (e.g., `"#ffffff"`) * @return {number} Number in hexadecimal. */ - function string2hex(string) - { - if (typeof string === 'string' && string[0] === '#') - { + function string2hex(string) { + if (typeof string === 'string' && string[0] === '#') { string = string.substr(1); } - return parseInt(string, 16); } - /** * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. * @@ -8366,8 +8422,7 @@ var PIXI = (function (exports) { * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. * @return {number} Number in hexadecimal. */ - function rgb2hex(rgb) - { + function rgb2hex(rgb) { return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); } @@ -8377,36 +8432,26 @@ var PIXI = (function (exports) { * @memberof PIXI.utils * @function mapPremultipliedBlendModes * @private - * @param {Array} [array] - The array to output into. * @return {Array} Mapped modes. */ - function mapPremultipliedBlendModes() - { + function mapPremultipliedBlendModes() { var pm = []; var npm = []; - - for (var i = 0; i < 32; i++) - { + for (var i = 0; i < 32; i++) { pm[i] = i; npm[i] = i; } - pm[exports.BLEND_MODES.NORMAL_NPM] = exports.BLEND_MODES.NORMAL; pm[exports.BLEND_MODES.ADD_NPM] = exports.BLEND_MODES.ADD; pm[exports.BLEND_MODES.SCREEN_NPM] = exports.BLEND_MODES.SCREEN; - npm[exports.BLEND_MODES.NORMAL] = exports.BLEND_MODES.NORMAL_NPM; npm[exports.BLEND_MODES.ADD] = exports.BLEND_MODES.ADD_NPM; npm[exports.BLEND_MODES.SCREEN] = exports.BLEND_MODES.SCREEN_NPM; - var array = []; - array.push(npm); array.push(pm); - return array; } - /** * maps premultiply flag and blendMode to adjusted blendMode * @memberof PIXI.utils @@ -8414,7 +8459,6 @@ var PIXI = (function (exports) { * @type {Array} */ var premultiplyBlendMode = mapPremultipliedBlendModes(); - /** * changes blendMode according to texture format * @@ -8424,11 +8468,9 @@ var PIXI = (function (exports) { * @param {boolean} premultiplied whether source is premultiplied * @returns {number} true blend mode for this texture */ - function correctBlendMode(blendMode, premultiplied) - { + function correctBlendMode(blendMode, premultiplied) { return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; } - /** * combines rgb and alpha to out array * @@ -8440,26 +8482,21 @@ var PIXI = (function (exports) { * @param {boolean} [premultiply=true] do premultiply it * @returns {Float32Array} vec4 rgba */ - function premultiplyRgba(rgb, alpha, out, premultiply) - { + function premultiplyRgba(rgb, alpha, out, premultiply) { out = out || new Float32Array(4); - if (premultiply || premultiply === undefined) - { + if (premultiply || premultiply === undefined) { out[0] = rgb[0] * alpha; out[1] = rgb[1] * alpha; out[2] = rgb[2] * alpha; } - else - { + else { out[0] = rgb[0]; out[1] = rgb[1]; out[2] = rgb[2]; } out[3] = alpha; - return out; } - /** * premultiplies tint * @@ -8469,27 +8506,21 @@ var PIXI = (function (exports) { * @param {number} alpha floating point alpha (0.0-1.0) * @returns {number} tint multiplied by alpha */ - function premultiplyTint(tint, alpha) - { - if (alpha === 1.0) - { + function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { return (alpha * 255 << 24) + tint; } - if (alpha === 0.0) - { + if (alpha === 0.0) { return 0; } var R = ((tint >> 16) & 0xFF); var G = ((tint >> 8) & 0xFF); var B = (tint & 0xFF); - R = ((R * alpha) + 0.5) | 0; G = ((G * alpha) + 0.5) | 0; B = ((B * alpha) + 0.5) | 0; - return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; } - /** * converts integer tint and float alpha to vec4 form, premultiplies by default * @@ -8501,20 +8532,17 @@ var PIXI = (function (exports) { * @param {boolean} [premultiply=true] do premultiply it * @returns {Float32Array} vec4 rgba */ - function premultiplyTintToRgba(tint, alpha, out, premultiply) - { + function premultiplyTintToRgba(tint, alpha, out, premultiply) { out = out || new Float32Array(4); out[0] = ((tint >> 16) & 0xFF) / 255.0; out[1] = ((tint >> 8) & 0xFF) / 255.0; out[2] = (tint & 0xFF) / 255.0; - if (premultiply || premultiply === undefined) - { + if (premultiply || premultiply === undefined) { out[0] *= alpha; out[1] *= alpha; out[2] *= alpha; } out[3] = alpha; - return out; } @@ -8527,23 +8555,16 @@ var PIXI = (function (exports) { * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` * @return {Uint16Array|Uint32Array} - Resulting index buffer */ - function createIndicesForQuads(size, outBuffer) - { - if ( outBuffer === void 0 ) { outBuffer = null; } - + function createIndicesForQuads(size, outBuffer) { + if (outBuffer === void 0) { outBuffer = null; } // the total number of indices in our array, there are 6 points per quad. var totalIndices = size * 6; - outBuffer = outBuffer || new Uint16Array(totalIndices); - - if (outBuffer.length !== totalIndices) - { - throw new Error(("Out buffer length is incorrect, got " + (outBuffer.length) + " and expected " + totalIndices)); + if (outBuffer.length !== totalIndices) { + throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); } - // fill the indices with the quads to draw - for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) - { + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { outBuffer[i + 0] = j + 0; outBuffer[i + 1] = j + 1; outBuffer[i + 2] = j + 2; @@ -8551,10 +8572,121 @@ var PIXI = (function (exports) { outBuffer[i + 4] = j + 2; outBuffer[i + 5] = j + 3; } - return outBuffer; } + function getBufferType(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; + } + + /* eslint-disable object-shorthand */ + var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; + function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + /* + @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way + or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? + */ + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); + } + + // Taken from the bit-twiddle package + /** + * Rounds to next power of two. + * + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v input value + * @return {number} + */ + function nextPow2(v) { + v += v === 0 ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; + } + /** + * Checks if a number is a power of two. + * + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v input value + * @return {boolean} `true` if value is power of two + */ + function isPow2(v) { + return !(v & (v - 1)) && (!!v); + } + /** + * Computes ceil of log base 2 + * + * @function log2 + * @memberof PIXI.utils + * @param {number} v input value + * @return {number} logarithm base 2 + */ + function log2(v) { + var r = (v > 0xFFFF ? 1 : 0) << 4; + v >>>= r; + var shift = (v > 0xFF ? 1 : 0) << 3; + v >>>= shift; + r |= shift; + shift = (v > 0xF ? 1 : 0) << 2; + v >>>= shift; + r |= shift; + shift = (v > 0x3 ? 1 : 0) << 1; + v >>>= shift; + r |= shift; + return r | (v >> 1); + } + /** * Remove items from a javascript array without generating garbage * @@ -8564,42 +8696,20 @@ var PIXI = (function (exports) { * @param {number} startIdx starting index * @param {number} removeCount how many to remove */ - function removeItems(arr, startIdx, removeCount) - { + function removeItems(arr, startIdx, removeCount) { var length = arr.length; var i; - - if (startIdx >= length || removeCount === 0) - { + if (startIdx >= length || removeCount === 0) { return; } - removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); - var len = length - removeCount; - - for (i = startIdx; i < len; ++i) - { + for (i = startIdx; i < len; ++i) { arr[i] = arr[i + removeCount]; } - arr.length = len; } - var nextUid = 0; - - /** - * Gets the next unique identifier - * - * @memberof PIXI.utils - * @function uid - * @return {number} The next unique identifier to use. - */ - function uid() - { - return ++nextUid; - } - /** * Returns sign of number * @@ -8608,72 +8718,65 @@ var PIXI = (function (exports) { * @param {number} n - the number to check the sign of * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive */ - function sign$1(n) - { - if (n === 0) { return 0; } - + function sign$1(n) { + if (n === 0) + { return 0; } return n < 0 ? -1 : 1; } - // Taken from the bit-twiddle package - + var nextUid = 0; /** - * Rounds to next power of two. + * Gets the next unique identifier * - * @function nextPow2 * @memberof PIXI.utils - * @param {number} v input value - * @return {number} + * @function uid + * @return {number} The next unique identifier to use. */ - function nextPow2(v) - { - v += v === 0; - --v; - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - - return v + 1; + function uid() { + return ++nextUid; } + // A map of warning messages already fired + var warnings = {}; /** - * Checks if a number is a power of two. + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. * - * @function isPow2 * @memberof PIXI.utils - * @param {number} v input value - * @return {boolean} `true` if value is power of two + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. */ - function isPow2(v) - { - return !(v & (v - 1)) && (!!v); - } - - /** - * Computes ceil of log base 2 - * - * @function log2 - * @memberof PIXI.utils - * @param {number} v input value - * @return {number} logarithm base 2 - */ - function log2(v) - { - var r = (v > 0xFFFF) << 4; - - v >>>= r; - - var shift = (v > 0xFF) << 3; - - v >>>= shift; r |= shift; - shift = (v > 0xF) << 2; - v >>>= shift; r |= shift; - shift = (v > 0x3) << 1; - v >>>= shift; r |= shift; - - return r | (v >> 1); + function deprecation(version, message, ignoreDepth) { + if (ignoreDepth === void 0) { ignoreDepth = 3; } + // Ignore duplicat + if (warnings[message]) { + return; + } + /* eslint-disable no-console */ + var stack = new Error().stack; + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + } + else { + // chop off the stack trace which includes PixiJS internal calls + stack = stack.split('\n').splice(ignoreDepth).join('\n'); + if (console.groupCollapsed) { + console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + console.warn(stack); + } + } + /* eslint-enable no-console */ + warnings[message] = true; } /** @@ -8685,7 +8788,6 @@ var PIXI = (function (exports) { * @type {Object} */ var ProgramCache = {}; - /** * @todo Describe property usage * @@ -8695,7 +8797,6 @@ var PIXI = (function (exports) { * @type {Object} */ var TextureCache = Object.create(null); - /** * @todo Describe property usage * @@ -8704,7 +8805,6 @@ var PIXI = (function (exports) { * @memberof PIXI.utils * @type {Object} */ - var BaseTextureCache = Object.create(null); /** * Destroys all texture in the cache @@ -8712,40 +8812,119 @@ var PIXI = (function (exports) { * @memberof PIXI.utils * @function destroyTextureCache */ - function destroyTextureCache() - { + function destroyTextureCache() { var key; - - for (key in TextureCache) - { + for (key in TextureCache) { TextureCache[key].destroy(); } - for (key in BaseTextureCache) - { + for (key in BaseTextureCache) { BaseTextureCache[key].destroy(); } } - /** * Removes all textures from cache, but does not destroy them * * @memberof PIXI.utils * @function clearTextureCache */ - function clearTextureCache() - { + function clearTextureCache() { var key; - - for (key in TextureCache) - { + for (key in TextureCache) { delete TextureCache[key]; } - for (key in BaseTextureCache) - { + for (key in BaseTextureCache) { delete BaseTextureCache[key]; } } + /** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * + * @class + * @memberof PIXI.utils + */ + var CanvasRenderTarget = /** @class */ (function () { + /** + * @param {number} width - the width for the newly created canvas + * @param {number} height - the height for the newly created canvas + * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + /** + * The Canvas object that belongs to this CanvasRenderTarget. + * + * @member {HTMLCanvasElement} + */ + this.canvas = document.createElement('canvas'); + /** + * A CanvasRenderingContext2D object representing a two-dimensional rendering context. + * + * @member {CanvasRenderingContext2D} + */ + this.context = this.canvas.getContext('2d'); + this.resolution = resolution || settings.RESOLUTION; + this.resize(width, height); + } + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * + * @private + */ + CanvasRenderTarget.prototype.clear = function () { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + /** + * Resizes the canvas to the specified width and height. + * + * @param {number} width - the new width of the canvas + * @param {number} height - the new height of the canvas + */ + CanvasRenderTarget.prototype.resize = function (width, height) { + this.canvas.width = width * this.resolution; + this.canvas.height = height * this.resolution; + }; + /** + * Destroys this canvas. + * + */ + CanvasRenderTarget.prototype.destroy = function () { + this.context = null; + this.canvas = null; + }; + Object.defineProperty(CanvasRenderTarget.prototype, "width", { + /** + * The width of the canvas buffer in pixels. + * + * @member {number} + */ + get: function () { + return this.canvas.width; + }, + set: function (val) { + this.canvas.width = val; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CanvasRenderTarget.prototype, "height", { + /** + * The height of the canvas buffer in pixels. + * + * @member {number} + */ + get: function () { + return this.canvas.height; + }, + set: function (val) { + this.canvas.height = val; + }, + enumerable: true, + configurable: true + }); + return CanvasRenderTarget; + }()); + /** * Trim transparent borders from a canvas * @@ -8754,18 +8933,14 @@ var PIXI = (function (exports) { * @param {HTMLCanvasElement} canvas - the canvas to trim * @returns {object} Trim data */ - function trimCanvas(canvas) - { + function trimCanvas(canvas) { // https://gist.github.com/remy/784508 - var width = canvas.width; var height = canvas.height; - var context = canvas.getContext('2d'); var imageData = context.getImageData(0, 0, width, height); var pixels = imageData.data; var len = pixels.length; - var bound = { top: null, left: null, @@ -8776,55 +8951,38 @@ var PIXI = (function (exports) { var i; var x; var y; - - for (i = 0; i < len; i += 4) - { - if (pixels[i + 3] !== 0) - { + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { x = (i / 4) % width; y = ~~((i / 4) / width); - - if (bound.top === null) - { + if (bound.top === null) { bound.top = y; } - - if (bound.left === null) - { + if (bound.left === null) { bound.left = x; } - else if (x < bound.left) - { + else if (x < bound.left) { bound.left = x; } - - if (bound.right === null) - { + if (bound.right === null) { bound.right = x + 1; } - else if (bound.right < x) - { + else if (bound.right < x) { bound.right = x + 1; } - - if (bound.bottom === null) - { + if (bound.bottom === null) { bound.bottom = y; } - else if (bound.bottom < y) - { + else if (bound.bottom < y) { bound.bottom = y; } } } - - if (bound.top !== null) - { + if (bound.top !== null) { width = bound.right - bound.left; height = bound.bottom - bound.top + 1; data = context.getImageData(bound.left, bound.top, width, height); } - return { height: height, width: width, @@ -8832,100 +8990,6 @@ var PIXI = (function (exports) { }; } - /** - * Creates a Canvas element of the given size to be used as a target for rendering to. - * - * @class - * @memberof PIXI.utils - */ - var CanvasRenderTarget = function CanvasRenderTarget(width, height, resolution) - { - /** - * The Canvas object that belongs to this CanvasRenderTarget. - * - * @member {HTMLCanvasElement} - */ - this.canvas = document.createElement('canvas'); - - /** - * A CanvasRenderingContext2D object representing a two-dimensional rendering context. - * - * @member {CanvasRenderingContext2D} - */ - this.context = this.canvas.getContext('2d'); - - this.resolution = resolution || settings.RESOLUTION; - - this.resize(width, height); - }; - - var prototypeAccessors = { width: { configurable: true },height: { configurable: true } }; - - /** - * Clears the canvas that was created by the CanvasRenderTarget class. - * - * @private - */ - CanvasRenderTarget.prototype.clear = function clear () - { - this.context.setTransform(1, 0, 0, 1, 0, 0); - this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); - }; - - /** - * Resizes the canvas to the specified width and height. - * - * @param {number} width - the new width of the canvas - * @param {number} height - the new height of the canvas - */ - CanvasRenderTarget.prototype.resize = function resize (width, height) - { - this.canvas.width = width * this.resolution; - this.canvas.height = height * this.resolution; - }; - - /** - * Destroys this canvas. - * - */ - CanvasRenderTarget.prototype.destroy = function destroy () - { - this.context = null; - this.canvas = null; - }; - - /** - * The width of the canvas buffer in pixels. - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return this.canvas.width; - }; - - prototypeAccessors.width.set = function (val) // eslint-disable-line require-jsdoc - { - this.canvas.width = val; - }; - - /** - * The height of the canvas buffer in pixels. - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return this.canvas.height; - }; - - prototypeAccessors.height.set = function (val) // eslint-disable-line require-jsdoc - { - this.canvas.height = val; - }; - - Object.defineProperties( CanvasRenderTarget.prototype, prototypeAccessors ); - /** * Regexp for data URI. * Based on: {@link https://github.com/ragingwind/data-uri-regex} @@ -8938,16 +9002,33 @@ var PIXI = (function (exports) { var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; /** - * Typedef for decomposeDataUri return object. - * * @memberof PIXI.utils - * @typedef {object} DecomposedDataUri - * @property {string} mediaType Media type, eg. `image` - * @property {string} subType Sub type, eg. `png` - * @property {string} encoding Data encoding, eg. `base64` - * @property {string} data The actual data + * @interface DecomposedDataUri + */ + /** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ + /** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ + /** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ + /** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ + /** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data */ - /** * Split a data URI into components. Returns undefined if * parameter `dataUri` is not a valid data URI. @@ -8957,12 +9038,9 @@ var PIXI = (function (exports) { * @param {string} dataUri - the data URI to check * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined */ - function decomposeDataUri(dataUri) - { + function decomposeDataUri(dataUri) { var dataUriMatch = DATA_URI.exec(dataUri); - - if (dataUriMatch) - { + if (dataUriMatch) { return { mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, @@ -8971,12 +9049,10 @@ var PIXI = (function (exports) { data: dataUriMatch[5], }; } - return undefined; } var tempAnchor; - /** * Sets the `crossOrigin` property for this resource based on if the url * for this resource is cross-origin. If crossOrigin was manually set, this @@ -8988,38 +9064,27 @@ var PIXI = (function (exports) { * @param {object} [loc=window.location] - The location object to test against. * @return {string} The crossOrigin value to use (or empty string for none). */ - function determineCrossOrigin(url$1, loc) - { - if ( loc === void 0 ) { loc = window.location; } - + function determineCrossOrigin(url, loc) { + if (loc === void 0) { loc = window.location; } // data: and javascript: urls are considered same-origin - if (url$1.indexOf('data:') === 0) - { + if (url.indexOf('data:') === 0) { return ''; } - // default is window.location loc = loc || window.location; - - if (!tempAnchor) - { + if (!tempAnchor) { tempAnchor = document.createElement('a'); } - // let the browser determine the full href for the url of this resource and then // parse with the node url lib, we can't use the properties of the anchor element // because they don't work in IE9 :( - tempAnchor.href = url$1; - url$1 = url.parse(tempAnchor.href); - - var samePort = (!url$1.port && loc.port === '') || (url$1.port === loc.port); - + tempAnchor.href = url; + var parsedUrl = parse(tempAnchor.href); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); // if cross origin - if (url$1.hostname !== loc.hostname || !samePort || url$1.protocol !== loc.protocol) - { + if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { return 'anonymous'; } - return ''; } @@ -9033,78 +9098,14 @@ var PIXI = (function (exports) { * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. * @return {number} resolution / device pixel ratio of an asset */ - function getResolutionOfUrl(url, defaultValue) - { + function getResolutionOfUrl(url, defaultValue) { var resolution = settings.RETINA_PREFIX.exec(url); - - if (resolution) - { + if (resolution) { return parseFloat(resolution[1]); } - return defaultValue !== undefined ? defaultValue : 1; } - // A map of warning messages already fired - var warnings = {}; - - /** - * Helper for warning developers about deprecated features & settings. - * A stack track for warnings is given; useful for tracking-down where - * deprecated methods/properties/classes are being used within the code. - * - * @memberof PIXI.utils - * @function deprecation - * @param {string} version - The version where the feature became deprecated - * @param {string} message - Message should include what is deprecated, where, and the new solution - * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack - * this is mostly to ignore internal deprecation calls. - */ - function deprecation(version, message, ignoreDepth) - { - if ( ignoreDepth === void 0 ) { ignoreDepth = 3; } - - // Ignore duplicat - if (warnings[message]) - { - return; - } - - /* eslint-disable no-console */ - var stack = new Error().stack; - - // Handle IE < 10 and Safari < 6 - if (typeof stack === 'undefined') - { - console.warn('PixiJS Deprecation Warning: ', (message + "\nDeprecated since v" + version)); - } - else - { - // chop off the stack trace which includes PixiJS internal calls - stack = stack.split('\n').splice(ignoreDepth).join('\n'); - - if (console.groupCollapsed) - { - console.groupCollapsed( - '%cPixiJS Deprecation Warning: %c%s', - 'color:#614108;background:#fffbe6', - 'font-weight:normal;color:#614108;background:#fffbe6', - (message + "\nDeprecated since v" + version) - ); - console.warn(stack); - console.groupEnd(); - } - else - { - console.warn('PixiJS Deprecation Warning: ', (message + "\nDeprecated since v" + version)); - console.warn(stack); - } - } - /* eslint-enable no-console */ - - warnings[message] = true; - } - var utils_es = ({ BaseTextureCache: BaseTextureCache, CanvasRenderTarget: CanvasRenderTarget, @@ -9118,9 +9119,11 @@ var PIXI = (function (exports) { deprecation: deprecation, destroyTextureCache: destroyTextureCache, determineCrossOrigin: determineCrossOrigin, + getBufferType: getBufferType, getResolutionOfUrl: getResolutionOfUrl, hex2rgb: hex2rgb, hex2string: hex2string, + interleaveTypedArrays: interleaveTypedArrays, isPow2: isPow2, isWebGLSupported: isWebGLSupported, log2: log2, @@ -9137,15 +9140,15 @@ var PIXI = (function (exports) { string2hex: string2hex, trimCanvas: trimCanvas, uid: uid, - isMobile: isMobile_min, + isMobile: isMobile$1, EventEmitter: eventemitter3, earcut: earcut_1, url: url }); /*! - * @pixi/math - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/math - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/math is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -9267,12 +9270,14 @@ var PIXI = (function (exports) { * * @param {number} [x=0] - position of the point on the x axis * @param {number} [y=x] - position of the point on the y axis + * @returns {this} Returns itself. */ Point.prototype.set = function (x, y) { if (x === void 0) { x = 0; } if (y === void 0) { y = x; } this.x = x; this.y = y; + return this; }; return Point; }()); @@ -9323,6 +9328,7 @@ var PIXI = (function (exports) { * * @param {number} [x=0] - position of the point on the x axis * @param {number} [y=x] - position of the point on the y axis + * @returns {this} Returns itself. */ ObservablePoint.prototype.set = function (x, y) { if (x === void 0) { x = 0; } @@ -9332,6 +9338,7 @@ var PIXI = (function (exports) { this._y = y; this.cb.call(this.scope); } + return this; }; /** * Copies x and y from the given point @@ -11045,8 +11052,8 @@ var PIXI = (function (exports) { }()); /*! - * @pixi/display - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/display - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/display is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -11127,8 +11134,6 @@ var PIXI = (function (exports) { */ Bounds.prototype.clear = function clear () { - this.updateID++; - this.minX = Infinity; this.minY = Infinity; this.maxX = -Infinity; @@ -11720,11 +11725,21 @@ var PIXI = (function (exports) { */ DisplayObject.prototype.updateTransform = function updateTransform () { + this._boundsID++; + this.transform.updateTransform(this.parent.transform); // multiply the alphas.. this.worldAlpha = this.alpha * this.parent.worldAlpha; + }; - this._bounds.updateID++; + /** + * Recalculates the bounds of the display object. + * + * Does nothing by default and can be overwritten in a parent class. + */ + DisplayObject.prototype.calculateBounds = function calculateBounds () + { + // OVERWRITE; }; /** @@ -11973,11 +11988,11 @@ var PIXI = (function (exports) { */ DisplayObject.prototype.destroy = function destroy () { - this.removeAllListeners(); if (this.parent) { this.parent.removeChild(this); } + this.removeAllListeners(); this.transform = null; this.parent = null; @@ -12207,7 +12222,7 @@ var PIXI = (function (exports) { * sprite.mask = graphics; * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. * - * @member {PIXI.Graphics|PIXI.Sprite|null} + * @member {PIXI.Container|PIXI.MaskData} */ prototypeAccessors.mask.get = function () { @@ -12938,8 +12953,8 @@ var PIXI = (function (exports) { Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; /*! - * @pixi/accessibility - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/accessibility - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/accessibility is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -13075,7 +13090,7 @@ var PIXI = (function (exports) { * @private */ this._hookDiv = null; - if (isMobile_min.tablet || isMobile_min.phone) + if (isMobile$1.tablet || isMobile$1.phone) { this.createTouchHook(); } @@ -13629,204 +13644,8 @@ var PIXI = (function (exports) { }); /*! - * @pixi/runner - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC - * - * @pixi/runner is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * A Runner is a highly performant and simple alternative to signals. Best used in situations - * where events are dispatched to many objects at high frequency (say every frame!) - * - * - * like a signal.. - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myObject = { - * loaded: new Runner('loaded') - * } - * - * const listener = { - * loaded: function(){ - * // thin - * } - * } - * - * myObject.update.add(listener); - * - * myObject.loaded.emit(); - * ``` - * - * Or for handling calling the same function on many items - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myGame = { - * update: new Runner('update') - * } - * - * const gameObject = { - * update: function(time){ - * // update my gamey state - * } - * } - * - * myGame.update.add(gameObject1); - * - * myGame.update.emit(time); - * ``` - * @class - * @memberof PIXI - */ - var Runner = /** @class */ (function () { - /** - * @param {string} name the function name that will be executed on the listeners added to this Runner. - */ - function Runner(name) { - this.items = []; - this._name = name; - this._aliasCount = 0; - } - /** - * Dispatch/Broadcast Runner to all listeners added to the queue. - * @param {...any} params - optional parameters to pass to each listener - * @return {PIXI.Runner} - */ - Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { - if (arguments.length > 8) { - throw new Error('max arguments reached'); - } - var _a = this, name = _a.name, items = _a.items; - this._aliasCount++; - for (var i = 0, len = items.length; i < len; i++) { - items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); - } - if (items === this.items) { - this._aliasCount--; - } - return this; - }; - Runner.prototype.ensureNonAliasedItems = function () { - if (this._aliasCount > 0 && this.items.length > 1) { - this._aliasCount = 0; - this.items = this.items.slice(0); - } - }; - /** - * Add a listener to the Runner - * - * Runners do not need to have scope or functions passed to them. - * All that is required is to pass the listening object and ensure that it has contains a function that has the same name - * as the name provided to the Runner when it was created. - * - * Eg A listener passed to this Runner will require a 'complete' function. - * - * ``` - * import { Runner } from '@pixi/runner'; - * - * const complete = new Runner('complete'); - * ``` - * - * The scope used will be the object itself. - * - * @param {any} item - The object that will be listening. - * @return {PIXI.Runner} - */ - Runner.prototype.add = function (item) { - if (item[this._name]) { - this.ensureNonAliasedItems(); - this.remove(item); - this.items.push(item); - } - return this; - }; - /** - * Remove a single listener from the dispatch queue. - * @param {any} item - The listenr that you would like to remove. - * @return {PIXI.Runner} - */ - Runner.prototype.remove = function (item) { - var index = this.items.indexOf(item); - if (index !== -1) { - this.ensureNonAliasedItems(); - this.items.splice(index, 1); - } - return this; - }; - /** - * Check to see if the listener is already in the Runner - * @param {any} item - The listener that you would like to check. - */ - Runner.prototype.contains = function (item) { - return this.items.indexOf(item) !== -1; - }; - /** - * Remove all listeners from the Runner - * @return {PIXI.Runner} - */ - Runner.prototype.removeAll = function () { - this.ensureNonAliasedItems(); - this.items.length = 0; - return this; - }; - /** - * Remove all references, don't use after this. - */ - Runner.prototype.destroy = function () { - this.removeAll(); - this.items = null; - this._name = null; - }; - Object.defineProperty(Runner.prototype, "empty", { - /** - * `true` if there are no this Runner contains no listeners - * - * @member {boolean} - * @readonly - */ - get: function () { - return this.items.length === 0; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Runner.prototype, "name", { - /** - * The name of the runner. - * - * @member {string} - * @readonly - */ - get: function () { - return this._name; - }, - enumerable: true, - configurable: true - }); - return Runner; - }()); - Object.defineProperties(Runner.prototype, { - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method dispatch - * @see PIXI.Runner#emit - */ - dispatch: { value: Runner.prototype.emit }, - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method run - * @see PIXI.Runner#emit - */ - run: { value: Runner.prototype.emit }, - }); - - /*! - * @pixi/ticker - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/ticker - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/ticker is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -14294,6 +14113,26 @@ var PIXI = (function (exports) { } return this; }; + Object.defineProperty(Ticker.prototype, "count", { + /** + * Counts the number of listeners on this ticker. + * + * @returns {number} The number of listeners on this ticker + */ + get: function () { + if (!this._head) { + return 0; + } + var count = 0; + var current = this._head; + while ((current = current.next)) { + count++; + } + return count; + }, + enumerable: true, + configurable: true + }); /** * Starts the ticker. If the ticker has listeners * a new animation frame is requested at this point. @@ -14647,8 +14486,2801 @@ var PIXI = (function (exports) { }()); /*! - * @pixi/core - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/interaction - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * + * @pixi/interaction is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Holds all information related to an Interaction event + * + * @class + * @memberof PIXI.interaction + */ + var InteractionData = function InteractionData() + { + /** + * This point stores the global coords of where the touch/mouse event happened + * + * @member {PIXI.Point} + */ + this.global = new Point(); + + /** + * The target Sprite that was interacted with + * + * @member {PIXI.Sprite} + */ + this.target = null; + + /** + * When passed to an event handler, this will be the original DOM Event that was captured + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent + * @member {MouseEvent|TouchEvent|PointerEvent} + */ + this.originalEvent = null; + + /** + * Unique identifier for this interaction + * + * @member {number} + */ + this.identifier = null; + + /** + * Indicates whether or not the pointer device that created the event is the primary pointer. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary + * @type {Boolean} + */ + this.isPrimary = false; + + /** + * Indicates which button was pressed on the mouse or pointer device to trigger the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + * @type {number} + */ + this.button = 0; + + /** + * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + * @type {number} + */ + this.buttons = 0; + + /** + * The width of the pointer's contact along the x-axis, measured in CSS pixels. + * radiusX of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width + * @type {number} + */ + this.width = 0; + + /** + * The height of the pointer's contact along the y-axis, measured in CSS pixels. + * radiusY of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height + * @type {number} + */ + this.height = 0; + + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX + * @type {number} + */ + this.tiltX = 0; + + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY + * @type {number} + */ + this.tiltY = 0; + + /** + * The type of pointer that triggered the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType + * @type {string} + */ + this.pointerType = null; + + /** + * Pressure applied by the pointing device during the event. A Touch's force property + * will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure + * @type {number} + */ + this.pressure = 0; + + /** + * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle + * @type {number} + */ + this.rotationAngle = 0; + + /** + * Twist of a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.twist = 0; + + /** + * Barrel pressure on a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.tangentialPressure = 0; + }; + + var prototypeAccessors = { pointerId: { configurable: true } }; + + /** + * The unique identifier of the pointer. It will be the same as `identifier`. + * @readonly + * @member {number} + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId + */ + prototypeAccessors.pointerId.get = function () + { + return this.identifier; + }; + + /** + * This will return the local coordinates of the specified displayObject for this InteractionData + * + * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local + * coords off + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise + * will create a new point) + * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional + * (otherwise will use the current global coords) + * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative + * to the DisplayObject + */ + InteractionData.prototype.getLocalPosition = function getLocalPosition (displayObject, point, globalPos) + { + return displayObject.worldTransform.applyInverse(globalPos || this.global, point); + }; + + /** + * Copies properties from normalized event data. + * + * @param {Touch|MouseEvent|PointerEvent} event The normalized event data + */ + InteractionData.prototype.copyEvent = function copyEvent (event) + { + // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite + // it with "false" on later events when our shim for it on touch events might not be + // accurate + if (event.isPrimary) + { + this.isPrimary = true; + } + this.button = event.button; + // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard + // event.which property instead, which conveys the same information. + this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which; + this.width = event.width; + this.height = event.height; + this.tiltX = event.tiltX; + this.tiltY = event.tiltY; + this.pointerType = event.pointerType; + this.pressure = event.pressure; + this.rotationAngle = event.rotationAngle; + this.twist = event.twist || 0; + this.tangentialPressure = event.tangentialPressure || 0; + }; + + /** + * Resets the data for pooling. + */ + InteractionData.prototype.reset = function reset () + { + // isPrimary is the only property that we really need to reset - everything else is + // guaranteed to be overwritten + this.isPrimary = false; + }; + + Object.defineProperties( InteractionData.prototype, prototypeAccessors ); + + /** + * Event class that mimics native DOM events. + * + * @class + * @memberof PIXI.interaction + */ + var InteractionEvent = function InteractionEvent() + { + /** + * Whether this event will continue propagating in the tree. + * + * Remaining events for the {@link stopsPropagatingAt} object + * will still be dispatched. + * + * @member {boolean} + */ + this.stopped = false; + + /** + * At which object this event stops propagating. + * + * @private + * @member {PIXI.DisplayObject} + */ + this.stopsPropagatingAt = null; + + /** + * Whether we already reached the element we want to + * stop propagating at. This is important for delayed events, + * where we start over deeper in the tree again. + * + * @private + * @member {boolean} + */ + this.stopPropagationHint = false; + + /** + * The object which caused this event to be dispatched. + * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}. + * + * @member {PIXI.DisplayObject} + */ + this.target = null; + + /** + * The object whose event listener’s callback is currently being invoked. + * + * @member {PIXI.DisplayObject} + */ + this.currentTarget = null; + + /** + * Type of the event + * + * @member {string} + */ + this.type = null; + + /** + * InteractionData related to this event + * + * @member {PIXI.interaction.InteractionData} + */ + this.data = null; + }; + + /** + * Prevents event from reaching any objects other than the current object. + * + */ + InteractionEvent.prototype.stopPropagation = function stopPropagation () + { + this.stopped = true; + this.stopPropagationHint = true; + this.stopsPropagatingAt = this.currentTarget; + }; + + /** + * Resets the event. + */ + InteractionEvent.prototype.reset = function reset () + { + this.stopped = false; + this.stopsPropagatingAt = null; + this.stopPropagationHint = false; + this.currentTarget = null; + this.target = null; + }; + + /** + * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions + * + * @class + * @private + * @memberof PIXI.interaction + */ + var InteractionTrackingData = function InteractionTrackingData(pointerId) + { + this._pointerId = pointerId; + this._flags = InteractionTrackingData.FLAGS.NONE; + }; + + var prototypeAccessors$1 = { pointerId: { configurable: true },flags: { configurable: true },none: { configurable: true },over: { configurable: true },rightDown: { configurable: true },leftDown: { configurable: true } }; + + /** + * + * @private + * @param {number} flag - The interaction flag to set + * @param {boolean} yn - Should the flag be set or unset + */ + InteractionTrackingData.prototype._doSet = function _doSet (flag, yn) + { + if (yn) + { + this._flags = this._flags | flag; + } + else + { + this._flags = this._flags & (~flag); + } + }; + + /** + * Unique pointer id of the event + * + * @readonly + * @private + * @member {number} + */ + prototypeAccessors$1.pointerId.get = function () + { + return this._pointerId; + }; + + /** + * State of the tracking data, expressed as bit flags + * + * @private + * @member {number} + */ + prototypeAccessors$1.flags.get = function () + { + return this._flags; + }; + + prototypeAccessors$1.flags.set = function (flags) // eslint-disable-line require-jsdoc + { + this._flags = flags; + }; + + /** + * Is the tracked event inactive (not over or down)? + * + * @private + * @member {number} + */ + prototypeAccessors$1.none.get = function () + { + return this._flags === this.constructor.FLAGS.NONE; + }; + + /** + * Is the tracked event over the DisplayObject? + * + * @private + * @member {boolean} + */ + prototypeAccessors$1.over.get = function () + { + return (this._flags & this.constructor.FLAGS.OVER) !== 0; + }; + + prototypeAccessors$1.over.set = function (yn) // eslint-disable-line require-jsdoc + { + this._doSet(this.constructor.FLAGS.OVER, yn); + }; + + /** + * Did the right mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + prototypeAccessors$1.rightDown.get = function () + { + return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; + }; + + prototypeAccessors$1.rightDown.set = function (yn) // eslint-disable-line require-jsdoc + { + this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); + }; + + /** + * Did the left mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + prototypeAccessors$1.leftDown.get = function () + { + return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; + }; + + prototypeAccessors$1.leftDown.set = function (yn) // eslint-disable-line require-jsdoc + { + this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); + }; + + Object.defineProperties( InteractionTrackingData.prototype, prototypeAccessors$1 ); + + InteractionTrackingData.FLAGS = Object.freeze({ + NONE: 0, + OVER: 1 << 0, + LEFT_DOWN: 1 << 1, + RIGHT_DOWN: 1 << 2, + }); + + /** + * Strategy how to search through stage tree for interactive objects + * + * @private + * @class + * @memberof PIXI.interaction + */ + var TreeSearch = function TreeSearch() + { + this._tempPoint = new Point(); + }; + + /** + * Recursive implementation for findHit + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @param {boolean} [interactive] - Whether the displayObject is interactive + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.recursiveFindHit = function recursiveFindHit (interactionEvent, displayObject, func, hitTest, interactive) + { + if (!displayObject || !displayObject.visible) + { + return false; + } + + var point = interactionEvent.data.global; + + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ + // + // This function will now loop through all objects and then only hit test the objects it HAS + // to, not all of them. MUCH faster.. + // An object will be hit test if the following is true: + // + // 1: It is interactive. + // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. + // + // As another little optimization once an interactive object has been hit we can carry on + // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests + // A final optimization is that an object is not hit test directly if a child has already been hit. + + interactive = displayObject.interactive || interactive; + + var hit = false; + var interactiveParent = interactive; + + // Flag here can set to false if the event is outside the parents hitArea or mask + var hitTestChildren = true; + + // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea + // There is also no longer a need to hitTest children. + if (displayObject.hitArea) + { + if (hitTest) + { + displayObject.worldTransform.applyInverse(point, this._tempPoint); + if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) + { + hitTest = false; + hitTestChildren = false; + } + else + { + hit = true; + } + } + interactiveParent = false; + } + // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. + // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. + // https://github.com/pixijs/pixi.js/issues/5135 + else if (displayObject._mask) + { + if (hitTest) + { + if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) + { + hitTest = false; + } + } + } + + // ** FREE TIP **! If an object is not interactive or has no buttons in it + // (such as a game scene!) set interactiveChildren to false for that displayObject. + // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. + if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) + { + var children = displayObject.children; + + for (var i = children.length - 1; i >= 0; i--) + { + var child = children[i]; + + // time to get recursive.. if this function will return if something is hit.. + var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); + + if (childHit) + { + // its a good idea to check if a child has lost its parent. + // this means it has been removed whilst looping so its best + if (!child.parent) + { + continue; + } + + // we no longer need to hit test any more objects in this container as we we + // now know the parent has been hit + interactiveParent = false; + + // If the child is interactive , that means that the object hit was actually + // interactive and not just the child of an interactive object. + // This means we no longer need to hit test anything else. We still need to run + // through all objects, but we don't need to perform any hit tests. + + if (childHit) + { + if (interactionEvent.target) + { + hitTest = false; + } + hit = true; + } + } + } + } + + // no point running this if the item is not interactive or does not have an interactive parent. + if (interactive) + { + // if we are hit testing (as in we have no hit any objects yet) + // We also don't need to worry about hit testing if once of the displayObjects children + // has already been hit - but only if it was interactive, otherwise we need to keep + // looking for an interactive child, just in case we hit one + if (hitTest && !interactionEvent.target) + { + // already tested against hitArea if it is defined + if (!displayObject.hitArea && displayObject.containsPoint) + { + if (displayObject.containsPoint(point)) + { + hit = true; + } + } + } + + if (displayObject.interactive) + { + if (hit && !interactionEvent.target) + { + interactionEvent.target = displayObject; + } + + if (func) + { + func(interactionEvent, displayObject, !!hit); + } + } + } + + return hit; + }; + + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.findHit = function findHit (interactionEvent, displayObject, func, hitTest) + { + this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); + }; + + /** + * Interface for classes that represent a hit area. + * + * It is implemented by the following classes: + * - {@link PIXI.Circle} + * - {@link PIXI.Ellipse} + * - {@link PIXI.Polygon} + * - {@link PIXI.RoundedRectangle} + * + * @interface IHitArea + * @memberof PIXI + */ + + /** + * Checks whether the x and y coordinates given are contained within this area + * + * @method + * @name contains + * @memberof PIXI.IHitArea# + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this area + */ + + /** + * Default property values of interactive objects + * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties + * + * @private + * @name interactiveTarget + * @type {Object} + * @memberof PIXI.interaction + * @example + * function MyObject() {} + * + * Object.assign( + * DisplayObject.prototype, + * PIXI.interaction.interactiveTarget + * ); + */ + var interactiveTarget = { + + /** + * Enable interaction events for the DisplayObject. Touch, pointer and mouse + * events will not be emitted unless `interactive` is set to `true`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.on('tap', (event) => { + * //handle event + * }); + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + interactive: false, + + /** + * Determines if the children to the displayObject can be clicked/touched + * Setting this to false allows PixiJS to bypass a recursive `hitTest` function + * + * @member {boolean} + * @memberof PIXI.Container# + */ + interactiveChildren: true, + + /** + * Interaction shape. Children will be hit first, then this shape will be checked. + * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); + * @member {PIXI.IHitArea} + * @memberof PIXI.DisplayObject# + */ + hitArea: null, + + /** + * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive + * Setting this changes the 'cursor' property to `'pointer'`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.buttonMode = true; + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + get buttonMode() + { + return this.cursor === 'pointer'; + }, + set buttonMode(value) + { + if (value) + { + this.cursor = 'pointer'; + } + else if (this.cursor === 'pointer') + { + this.cursor = null; + } + }, + + /** + * This defines what cursor mode is used when the mouse cursor + * is hovered over the displayObject. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.cursor = 'wait'; + * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor + * + * @member {string} + * @memberof PIXI.DisplayObject# + */ + cursor: null, + + /** + * Internal set of all active pointers, by identifier + * + * @member {Map} + * @memberof PIXI.DisplayObject# + * @private + */ + get trackedPointers() + { + if (this._trackedPointers === undefined) { this._trackedPointers = {}; } + + return this._trackedPointers; + }, + + /** + * Map of all tracked pointers, by identifier. Use trackedPointers to access. + * + * @private + * @type {Map} + */ + _trackedPointers: undefined, + }; + + // Mix interactiveTarget into DisplayObject.prototype, + // after deprecation has been handled + DisplayObject.mixin(interactiveTarget); + + var MOUSE_POINTER_ID = 1; + + // helpers for hitTest() - only used inside hitTest() + var hitTestEvent = { + target: null, + data: { + global: null, + }, + }; + + /** + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * + * This manager also supports multitouch. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` + * + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI.interaction + */ + var InteractionManager = /*@__PURE__*/(function (EventEmitter) { + function InteractionManager(renderer, options) + { + EventEmitter.call(this); + + options = options || {}; + + /** + * The renderer this interaction manager works for. + * + * @member {PIXI.AbstractRenderer} + */ + this.renderer = renderer; + + /** + * Should default browser actions automatically be prevented. + * Does not apply to pointer events for backwards compatibility + * preventDefault on pointer events stops mouse events from firing + * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. + * + * @member {boolean} + * @default true + */ + this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; + + /** + * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}. + * + * @member {number} + * @default 10 + */ + this.interactionFrequency = options.interactionFrequency || 10; + + /** + * The mouse data + * + * @member {PIXI.interaction.InteractionData} + */ + this.mouse = new InteractionData(); + this.mouse.identifier = MOUSE_POINTER_ID; + + // setting the mouse to start off far off screen will mean that mouse over does + // not get called before we even move the mouse. + this.mouse.global.set(-999999); + + /** + * Actively tracked InteractionData + * + * @private + * @member {Object.} + */ + this.activeInteractionData = {}; + this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; + + /** + * Pool of unused InteractionData + * + * @private + * @member {PIXI.interaction.InteractionData[]} + */ + this.interactionDataPool = []; + + /** + * An event data object to handle all the event tracking/dispatching + * + * @member {object} + */ + this.eventData = new InteractionEvent(); + + /** + * The DOM element to bind to. + * + * @protected + * @member {HTMLElement} + */ + this.interactionDOMElement = null; + + /** + * This property determines if mousemove and touchmove events are fired only when the cursor + * is over the object. + * Setting to true will make things work more in line with how the DOM version works. + * Setting to false can make things easier for things like dragging + * It is currently set to false as this is how PixiJS used to work. This will be set to true in + * future versions of pixi. + * + * @member {boolean} + * @default false + */ + this.moveWhenInside = false; + + /** + * Have events been attached to the dom element? + * + * @protected + * @member {boolean} + */ + this.eventsAdded = false; + + /** + * Has the system ticker been added? + * + * @protected + * @member {boolean} + */ + this.tickerAdded = false; + + /** + * Is the mouse hovering over the renderer? + * + * @protected + * @member {boolean} + */ + this.mouseOverRenderer = false; + + /** + * Does the device support touch events + * https://www.w3.org/TR/touch-events/ + * + * @readonly + * @member {boolean} + */ + this.supportsTouchEvents = 'ontouchstart' in window; + + /** + * Does the device support pointer events + * https://www.w3.org/Submission/pointer-events/ + * + * @readonly + * @member {boolean} + */ + this.supportsPointerEvents = !!window.PointerEvent; + + // this will make it so that you don't have to call bind all the time + + /** + * @private + * @member {Function} + */ + this.onPointerUp = this.onPointerUp.bind(this); + this.processPointerUp = this.processPointerUp.bind(this); + + /** + * @private + * @member {Function} + */ + this.onPointerCancel = this.onPointerCancel.bind(this); + this.processPointerCancel = this.processPointerCancel.bind(this); + + /** + * @private + * @member {Function} + */ + this.onPointerDown = this.onPointerDown.bind(this); + this.processPointerDown = this.processPointerDown.bind(this); + + /** + * @private + * @member {Function} + */ + this.onPointerMove = this.onPointerMove.bind(this); + this.processPointerMove = this.processPointerMove.bind(this); + + /** + * @private + * @member {Function} + */ + this.onPointerOut = this.onPointerOut.bind(this); + this.processPointerOverOut = this.processPointerOverOut.bind(this); + + /** + * @private + * @member {Function} + */ + this.onPointerOver = this.onPointerOver.bind(this); + + /** + * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor + * values, objects are handled as dictionaries of CSS values for interactionDOMElement, + * and functions are called instead of changing the CSS. + * Default CSS cursor values are provided for 'default' and 'pointer' modes. + * @member {Object.} + */ + this.cursorStyles = { + default: 'inherit', + pointer: 'pointer', + }; + + /** + * The mode of the cursor that is being used. + * The value of this is a key from the cursorStyles dictionary. + * + * @member {string} + */ + this.currentCursorMode = null; + + /** + * Internal cached let. + * + * @private + * @member {string} + */ + this.cursor = null; + + /** + * The current resolution / device pixel ratio. + * + * @member {number} + * @default 1 + */ + this.resolution = 1; + + /** + * Delayed pointer events. Used to guarantee correct ordering of over/out events. + * + * @private + * @member {Array} + */ + this.delayedEvents = []; + + /** + * TreeSearch component that is used to hitTest stage tree + * + * @private + * @member {PIXI.interaction.TreeSearch} + */ + this.search = new TreeSearch(); + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display + * object. + * + * @event PIXI.interaction.InteractionManager#mousedown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. + * + * @event PIXI.interaction.InteractionManager#rightdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. + * + * @event PIXI.interaction.InteractionManager#mouseup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. + * + * @event PIXI.interaction.InteractionManager#rightup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. + * + * @event PIXI.interaction.InteractionManager#click + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. + * + * @event PIXI.interaction.InteractionManager#rightclick + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}. + * + * @event PIXI.interaction.InteractionManager#mouseupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}. + * + * @event PIXI.interaction.InteractionManager#rightupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object + * + * @event PIXI.interaction.InteractionManager#mousemove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object + * + * @event PIXI.interaction.InteractionManager#mouseover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved off the display object + * + * @event PIXI.interaction.InteractionManager#mouseout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed on the display object. + * + * @event PIXI.interaction.InteractionManager#pointerdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released over the display object. + * Not always fired when some buttons are held down while others are released. In those cases, + * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and + * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead. + * + * @event PIXI.interaction.InteractionManager#pointerup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a pointer event + * + * @event PIXI.interaction.InteractionManager#pointercancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed and released on the display object. + * + * @event PIXI.interaction.InteractionManager#pointertap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}. + * + * @event PIXI.interaction.InteractionManager#pointerupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved while over the display object + * + * @event PIXI.interaction.InteractionManager#pointermove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved onto the display object + * + * @event PIXI.interaction.InteractionManager#pointerover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved off the display object + * + * @event PIXI.interaction.InteractionManager#pointerout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed on the display object. + * + * @event PIXI.interaction.InteractionManager#touchstart + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed from the display object. + * + * @event PIXI.interaction.InteractionManager#touchend + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a touch + * + * @event PIXI.interaction.InteractionManager#touchcancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed and removed from the display object. + * + * @event PIXI.interaction.InteractionManager#tap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}. + * + * @event PIXI.interaction.InteractionManager#touchendoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is moved along the display object. + * + * @event PIXI.interaction.InteractionManager#touchmove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousedown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#click + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightclick + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousemove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a pointer event. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointercancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed and released on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointertap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointermove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchstart + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchend + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a touch. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchcancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed and removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#tap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchendoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is moved along the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchmove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; + + this.setTargetElement(this.renderer.view, this.renderer.resolution); + } + + if ( EventEmitter ) { InteractionManager.__proto__ = EventEmitter; } + InteractionManager.prototype = Object.create( EventEmitter && EventEmitter.prototype ); + InteractionManager.prototype.constructor = InteractionManager; + + var prototypeAccessors = { useSystemTicker: { configurable: true } }; + + /** + * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. + * + * @member {boolean} + * @default true + */ + prototypeAccessors.useSystemTicker.get = function () + { + return this._useSystemTicker; + }; + prototypeAccessors.useSystemTicker.set = function (useSystemTicker) + { + this._useSystemTicker = useSystemTicker; + + if (useSystemTicker) + { + this.addTickerListener(); + } + else + { + this.removeTickerListener(); + } + }; + + /** + * Hit tests a point against the display tree, returning the first interactive object that is hit. + * + * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. + * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults + * to the last rendered root of the associated renderer. + * @return {PIXI.DisplayObject} The hit display object, if any. + */ + InteractionManager.prototype.hitTest = function hitTest (globalPoint, root) + { + // clear the target for our hit test + hitTestEvent.target = null; + // assign the global point + hitTestEvent.data.global = globalPoint; + // ensure safety of the root + if (!root) + { + root = this.renderer._lastObjectRendered; + } + // run the hit test + this.processInteractive(hitTestEvent, root, null, true); + // return our found object - it'll be null if we didn't hit anything + + return hitTestEvent.target; + }; + + /** + * Sets the DOM element which will receive mouse/touch events. This is useful for when you have + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate + * another DOM element to receive those events. + * + * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. + * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). + */ + InteractionManager.prototype.setTargetElement = function setTargetElement (element, resolution) + { + if ( resolution === void 0 ) { resolution = 1; } + + this.removeTickerListener(); + + this.removeEvents(); + + this.interactionDOMElement = element; + + this.resolution = resolution; + + this.addEvents(); + + this.addTickerListener(); + }; + + /** + * Add the ticker listener + * + * @private + */ + InteractionManager.prototype.addTickerListener = function addTickerListener () + { + if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) + { + return; + } + + Ticker.system.add(this.tickerUpdate, this, exports.UPDATE_PRIORITY.INTERACTION); + + this.tickerAdded = true; + }; + + /** + * Remove the ticker listener + * + * @private + */ + InteractionManager.prototype.removeTickerListener = function removeTickerListener () + { + if (!this.tickerAdded) + { + return; + } + + Ticker.system.remove(this.tickerUpdate, this); + + this.tickerAdded = false; + }; + + /** + * Registers all the DOM events + * + * @private + */ + InteractionManager.prototype.addEvents = function addEvents () + { + if (this.eventsAdded || !this.interactionDOMElement) + { + return; + } + + if (window.navigator.msPointerEnabled) + { + this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; + this.interactionDOMElement.style['-ms-touch-action'] = 'none'; + } + else if (this.supportsPointerEvents) + { + this.interactionDOMElement.style['touch-action'] = 'none'; + } + + /** + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd + */ + if (this.supportsPointerEvents) + { + window.document.addEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); + // pointerout is fired in addition to pointerup (for touch events) and pointercancel + // we already handle those, so for the purposes of what we do in onPointerOut, we only + // care about the pointerleave event + this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); + window.addEventListener('pointercancel', this.onPointerCancel, true); + window.addEventListener('pointerup', this.onPointerUp, true); + } + else + { + window.document.addEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); + window.addEventListener('mouseup', this.onPointerUp, true); + } + + // always look directly for touch events so that we can provide original data + // In a future version we should change this to being just a fallback and rely solely on + // PointerEvents whenever available + if (this.supportsTouchEvents) + { + this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); + } + + this.eventsAdded = true; + }; + + /** + * Removes all the DOM events that were previously registered + * + * @private + */ + InteractionManager.prototype.removeEvents = function removeEvents () + { + if (!this.eventsAdded || !this.interactionDOMElement) + { + return; + } + + if (window.navigator.msPointerEnabled) + { + this.interactionDOMElement.style['-ms-content-zooming'] = ''; + this.interactionDOMElement.style['-ms-touch-action'] = ''; + } + else if (this.supportsPointerEvents) + { + this.interactionDOMElement.style['touch-action'] = ''; + } + + if (this.supportsPointerEvents) + { + window.document.removeEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); + window.removeEventListener('pointercancel', this.onPointerCancel, true); + window.removeEventListener('pointerup', this.onPointerUp, true); + } + else + { + window.document.removeEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); + window.removeEventListener('mouseup', this.onPointerUp, true); + } + + if (this.supportsTouchEvents) + { + this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); + } + + this.interactionDOMElement = null; + + this.eventsAdded = false; + }; + + /** + * Updates the state of interactive objects if at least {@link interactionFrequency} + * milliseconds have passed since the last invocation. + * + * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}. + * + * @param {number} deltaTime - time delta since the last call + */ + InteractionManager.prototype.tickerUpdate = function tickerUpdate (deltaTime) + { + this._deltaTime += deltaTime; + + if (this._deltaTime < this.interactionFrequency) + { + return; + } + + this._deltaTime = 0; + + this.update(); + }; + + /** + * Updates the state of interactive objects. + */ + InteractionManager.prototype.update = function update () + { + if (!this.interactionDOMElement) + { + return; + } + + // if the user move the mouse this check has already been done using the mouse move! + if (this.didMove) + { + this.didMove = false; + + return; + } + + this.cursor = null; + + // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, + // but there was a scenario of a display object moving under a static mouse cursor. + // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function + for (var k in this.activeInteractionData) + { + // eslint-disable-next-line no-prototype-builtins + if (this.activeInteractionData.hasOwnProperty(k)) + { + var interactionData = this.activeInteractionData[k]; + + if (interactionData.originalEvent && interactionData.pointerType !== 'touch') + { + var interactionEvent = this.configureInteractionEventForDOMEvent( + this.eventData, + interactionData.originalEvent, + interactionData + ); + + this.processInteractive( + interactionEvent, + this.renderer._lastObjectRendered, + this.processPointerOverOut, + true + ); + } + } + } + + this.setCursorMode(this.cursor); + }; + + /** + * Sets the current cursor mode, handling any callbacks or CSS style changes. + * + * @param {string} mode - cursor mode, a key from the cursorStyles dictionary + */ + InteractionManager.prototype.setCursorMode = function setCursorMode (mode) + { + mode = mode || 'default'; + // if the mode didn't actually change, bail early + if (this.currentCursorMode === mode) + { + return; + } + this.currentCursorMode = mode; + var style = this.cursorStyles[mode]; + + // only do things if there is a cursor style for it + if (style) + { + switch (typeof style) + { + case 'string': + // string styles are handled as cursor CSS + this.interactionDOMElement.style.cursor = style; + break; + case 'function': + // functions are just called, and passed the cursor mode + style(mode); + break; + case 'object': + // if it is an object, assume that it is a dictionary of CSS styles, + // apply it to the interactionDOMElement + Object.assign(this.interactionDOMElement.style, style); + break; + } + } + else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) + { + // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry + // for the mode, then assume that the dev wants it to be CSS for the cursor. + this.interactionDOMElement.style.cursor = mode; + } + }; + + /** + * Dispatches an event on the display object that was interacted with + * + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question + * @param {string} eventString - the name of the event (e.g, mousedown) + * @param {object} eventData - the event data object + * @private + */ + InteractionManager.prototype.dispatchEvent = function dispatchEvent (displayObject, eventString, eventData) + { + // Even if the event was stopped, at least dispatch any remaining events + // for the same display object. + if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) + { + eventData.currentTarget = displayObject; + eventData.type = eventString; + + displayObject.emit(eventString, eventData); + + if (displayObject[eventString]) + { + displayObject[eventString](eventData); + } + } + }; + + /** + * Puts a event on a queue to be dispatched later. This is used to guarantee correct + * ordering of over/out events. + * + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question + * @param {string} eventString - the name of the event (e.g, mousedown) + * @param {object} eventData - the event data object + * @private + */ + InteractionManager.prototype.delayDispatchEvent = function delayDispatchEvent (displayObject, eventString, eventData) + { + this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); + }; + + /** + * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The + * resulting value is stored in the point. This takes into account the fact that the DOM + * element could be scaled and positioned anywhere on the screen. + * + * @param {PIXI.Point} point - the point that the result will be stored in + * @param {number} x - the x coord of the position to map + * @param {number} y - the y coord of the position to map + */ + InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint (point, x, y) + { + var rect; + + // IE 11 fix + if (!this.interactionDOMElement.parentElement) + { + rect = { x: 0, y: 0, width: 0, height: 0 }; + } + else + { + rect = this.interactionDOMElement.getBoundingClientRect(); + } + + var resolutionMultiplier = 1.0 / this.resolution; + + point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; + point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; + }; + + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @protected + * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - indicates whether we want to calculate hits + * or just iterate through all interactive objects + */ + InteractionManager.prototype.processInteractive = function processInteractive (interactionEvent, displayObject, func, hitTest) + { + var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); + + var delayedEvents = this.delayedEvents; + + if (!delayedEvents.length) + { + return hit; + } + // Reset the propagation hint, because we start deeper in the tree again. + interactionEvent.stopPropagationHint = false; + + var delayedLen = delayedEvents.length; + + this.delayedEvents = []; + + for (var i = 0; i < delayedLen; i++) + { + var ref = delayedEvents[i]; + var displayObject$1 = ref.displayObject; + var eventString = ref.eventString; + var eventData = ref.eventData; + + // When we reach the object we wanted to stop propagating at, + // set the propagation hint. + if (eventData.stopsPropagatingAt === displayObject$1) + { + eventData.stopPropagationHint = true; + } + + this.dispatchEvent(displayObject$1, eventString, eventData); + } + + return hit; + }; + + /** + * Is called when the pointer button is pressed down on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down + */ + InteractionManager.prototype.onPointerDown = function onPointerDown (originalEvent) + { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } + + var events = this.normalizeToPointerData(originalEvent); + + /** + * No need to prevent default on natural pointer events, as there are no side effects + * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, + * so still need to be prevented. + */ + + // Guaranteed that there will be at least one event in events, and all events must have the same pointer type + + if (this.autoPreventDefault && events[0].isNormalized) + { + var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); + + if (cancelable) + { + originalEvent.preventDefault(); + } + } + + var eventLen = events.length; + + for (var i = 0; i < eventLen; i++) + { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true); + + this.emit('pointerdown', interactionEvent); + if (event.pointerType === 'touch') + { + this.emit('touchstart', interactionEvent); + } + // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event + else if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { + var isRightButton = event.button === 2; + + this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); + } + } + }; + + /** + * Processes the result of the pointer down check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerDown = function processPointerDown (interactionEvent, displayObject, hit) + { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + + if (hit) + { + if (!displayObject.trackedPointers[id]) + { + displayObject.trackedPointers[id] = new InteractionTrackingData(id); + } + this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); + + if (data.pointerType === 'touch') + { + this.dispatchEvent(displayObject, 'touchstart', interactionEvent); + } + else if (data.pointerType === 'mouse' || data.pointerType === 'pen') + { + var isRightButton = data.button === 2; + + if (isRightButton) + { + displayObject.trackedPointers[id].rightDown = true; + } + else + { + displayObject.trackedPointers[id].leftDown = true; + } + + this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); + } + } + }; + + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released + * @param {boolean} cancelled - true if the pointer is cancelled + * @param {Function} func - Function passed to {@link processInteractive} + */ + InteractionManager.prototype.onPointerComplete = function onPointerComplete (originalEvent, cancelled, func) + { + var events = this.normalizeToPointerData(originalEvent); + + var eventLen = events.length; + + // if the event wasn't targeting our canvas, then consider it to be pointerupoutside + // in all cases (unless it was a pointercancel) + var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; + + for (var i = 0; i < eventLen; i++) + { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + // perform hit testing for events targeting our canvas or cancel events + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend); + + this.emit(cancelled ? 'pointercancel' : ("pointerup" + eventAppend), interactionEvent); + + if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { + var isRightButton = event.button === 2; + + this.emit(isRightButton ? ("rightup" + eventAppend) : ("mouseup" + eventAppend), interactionEvent); + } + else if (event.pointerType === 'touch') + { + this.emit(cancelled ? 'touchcancel' : ("touchend" + eventAppend), interactionEvent); + this.releaseInteractionDataForPointerId(event.pointerId, interactionData); + } + } + }; + + /** + * Is called when the pointer button is cancelled + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + InteractionManager.prototype.onPointerCancel = function onPointerCancel (event) + { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } + + this.onPointerComplete(event, true, this.processPointerCancel); + }; + + /** + * Processes the result of the pointer cancel check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + */ + InteractionManager.prototype.processPointerCancel = function processPointerCancel (interactionEvent, displayObject) + { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + if (displayObject.trackedPointers[id] !== undefined) + { + delete displayObject.trackedPointers[id]; + this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); + + if (data.pointerType === 'touch') + { + this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); + } + } + }; + + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + InteractionManager.prototype.onPointerUp = function onPointerUp (event) + { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } + + this.onPointerComplete(event, false, this.processPointerUp); + }; + + /** + * Processes the result of the pointer up check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerUp = function processPointerUp (interactionEvent, displayObject, hit) + { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + var trackingData = displayObject.trackedPointers[id]; + + var isTouch = data.pointerType === 'touch'; + + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + // need to track mouse down status in the mouse block so that we can emit + // event in a later block + var isMouseTap = false; + + // Mouse only + if (isMouse) + { + var isRightButton = data.button === 2; + + var flags = InteractionTrackingData.FLAGS; + + var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; + + var isDown = trackingData !== undefined && (trackingData.flags & test); + + if (hit) + { + this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); + + if (isDown) + { + this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); + // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap + isMouseTap = true; + } + } + else if (isDown) + { + this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); + } + // update the down state of the tracking data + if (trackingData) + { + if (isRightButton) + { + trackingData.rightDown = false; + } + else + { + trackingData.leftDown = false; + } + } + } + + // Pointers and Touches, and Mouse + if (hit) + { + this.dispatchEvent(displayObject, 'pointerup', interactionEvent); + if (isTouch) { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } + + if (trackingData) + { + // emit pointertap if not a mouse, or if the mouse block decided it was a tap + if (!isMouse || isMouseTap) + { + this.dispatchEvent(displayObject, 'pointertap', interactionEvent); + } + if (isTouch) + { + this.dispatchEvent(displayObject, 'tap', interactionEvent); + // touches are no longer over (if they ever were) when we get the touchend + // so we should ensure that we don't keep pretending that they are + trackingData.over = false; + } + } + } + else if (trackingData) + { + this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); + if (isTouch) { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } + } + // Only remove the tracking data if there is no over/down state still associated with it + if (trackingData && trackingData.none) + { + delete displayObject.trackedPointers[id]; + } + }; + + /** + * Is called when the pointer moves across the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer moving + */ + InteractionManager.prototype.onPointerMove = function onPointerMove (originalEvent) + { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } + + var events = this.normalizeToPointerData(originalEvent); + + if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') + { + this.didMove = true; + + this.cursor = null; + } + + var eventLen = events.length; + + for (var i = 0; i < eventLen; i++) + { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, true); + + this.emit('pointermove', interactionEvent); + if (event.pointerType === 'touch') { this.emit('touchmove', interactionEvent); } + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mousemove', interactionEvent); } + } + + if (events[0].pointerType === 'mouse') + { + this.setCursorMode(this.cursor); + + // TODO BUG for parents interactive object (border order issue) + } + }; + + /** + * Processes the result of the pointer move check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerMove = function processPointerMove (interactionEvent, displayObject, hit) + { + var data = interactionEvent.data; + + var isTouch = data.pointerType === 'touch'; + + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + + if (isMouse) + { + this.processPointerOverOut(interactionEvent, displayObject, hit); + } + + if (!this.moveWhenInside || hit) + { + this.dispatchEvent(displayObject, 'pointermove', interactionEvent); + if (isTouch) { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } + if (isMouse) { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } + } + }; + + /** + * Is called when the pointer is moved out of the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out + */ + InteractionManager.prototype.onPointerOut = function onPointerOut (originalEvent) + { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } + + var events = this.normalizeToPointerData(originalEvent); + + // Only mouse and pointer can call onPointerOut, so events will always be length 1 + var event = events[0]; + + if (event.pointerType === 'mouse') + { + this.mouseOverRenderer = false; + this.setCursorMode(null); + } + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = event; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false); + + this.emit('pointerout', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { + this.emit('mouseout', interactionEvent); + } + else + { + // we can get touchleave events after touchend, so we want to make sure we don't + // introduce memory leaks + this.releaseInteractionDataForPointerId(interactionData.identifier); + } + }; + + /** + * Processes the result of the pointer over/out check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerOverOut = function processPointerOverOut (interactionEvent, displayObject, hit) + { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + + var trackingData = displayObject.trackedPointers[id]; + + // if we just moused over the display object, then we need to track that state + if (hit && !trackingData) + { + trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); + } + + if (trackingData === undefined) { return; } + + if (hit && this.mouseOverRenderer) + { + if (!trackingData.over) + { + trackingData.over = true; + this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); + if (isMouse) + { + this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); + } + } + + // only change the cursor if it has not already been changed (by something deeper in the + // display tree) + if (isMouse && this.cursor === null) + { + this.cursor = displayObject.cursor; + } + } + else if (trackingData.over) + { + trackingData.over = false; + this.dispatchEvent(displayObject, 'pointerout', this.eventData); + if (isMouse) + { + this.dispatchEvent(displayObject, 'mouseout', interactionEvent); + } + // if there is no mouse down information for the pointer, then it is safe to delete + if (trackingData.none) + { + delete displayObject.trackedPointers[id]; + } + } + }; + + /** + * Is called when the pointer is moved into the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view + */ + InteractionManager.prototype.onPointerOver = function onPointerOver (originalEvent) + { + var events = this.normalizeToPointerData(originalEvent); + + // Only mouse and pointer can call onPointerOver, so events will always be length 1 + var event = events[0]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = event; + + if (event.pointerType === 'mouse') + { + this.mouseOverRenderer = true; + } + + this.emit('pointerover', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { + this.emit('mouseover', interactionEvent); + } + }; + + /** + * Get InteractionData for a given pointerId. Store that data as well + * + * @private + * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData + * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier + */ + InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId (event) + { + var pointerId = event.pointerId; + + var interactionData; + + if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') + { + interactionData = this.mouse; + } + else if (this.activeInteractionData[pointerId]) + { + interactionData = this.activeInteractionData[pointerId]; + } + else + { + interactionData = this.interactionDataPool.pop() || new InteractionData(); + interactionData.identifier = pointerId; + this.activeInteractionData[pointerId] = interactionData; + } + // copy properties from the event, so that we can make sure that touch/pointer specific + // data is available + interactionData.copyEvent(event); + + return interactionData; + }; + + /** + * Return unused InteractionData to the pool, for a given pointerId + * + * @private + * @param {number} pointerId - Identifier from a pointer event + */ + InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId (pointerId) + { + var interactionData = this.activeInteractionData[pointerId]; + + if (interactionData) + { + delete this.activeInteractionData[pointerId]; + interactionData.reset(); + this.interactionDataPool.push(interactionData); + } + }; + + /** + * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured + * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent + * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired + * with the InteractionEvent + * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in + */ + InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent (interactionEvent, pointerEvent, interactionData) + { + interactionEvent.data = interactionData; + + this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); + + // Not really sure why this is happening, but it's how a previous version handled things + if (pointerEvent.pointerType === 'touch') + { + pointerEvent.globalX = interactionData.global.x; + pointerEvent.globalY = interactionData.global.y; + } + + interactionData.originalEvent = pointerEvent; + interactionEvent.reset(); + + return interactionEvent; + }; + + /** + * Ensures that the original event object contains all data that a regular pointer event would have + * + * @private + * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event + * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer + * or mouse event, or a multiple normalized pointer events if there are multiple changed touches + */ + InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData (event) + { + var normalizedEvents = []; + + if (this.supportsTouchEvents && event instanceof TouchEvent) + { + for (var i = 0, li = event.changedTouches.length; i < li; i++) + { + var touch = event.changedTouches[i]; + + if (typeof touch.button === 'undefined') { touch.button = event.touches.length ? 1 : 0; } + if (typeof touch.buttons === 'undefined') { touch.buttons = event.touches.length ? 1 : 0; } + if (typeof touch.isPrimary === 'undefined') + { + touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; + } + if (typeof touch.width === 'undefined') { touch.width = touch.radiusX || 1; } + if (typeof touch.height === 'undefined') { touch.height = touch.radiusY || 1; } + if (typeof touch.tiltX === 'undefined') { touch.tiltX = 0; } + if (typeof touch.tiltY === 'undefined') { touch.tiltY = 0; } + if (typeof touch.pointerType === 'undefined') { touch.pointerType = 'touch'; } + if (typeof touch.pointerId === 'undefined') { touch.pointerId = touch.identifier || 0; } + if (typeof touch.pressure === 'undefined') { touch.pressure = touch.force || 0.5; } + if (typeof touch.twist === 'undefined') { touch.twist = 0; } + if (typeof touch.tangentialPressure === 'undefined') { touch.tangentialPressure = 0; } + // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven + // support, and the fill ins are not quite the same + // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top + // left is not 0,0 on the page + if (typeof touch.layerX === 'undefined') { touch.layerX = touch.offsetX = touch.clientX; } + if (typeof touch.layerY === 'undefined') { touch.layerY = touch.offsetY = touch.clientY; } + + // mark the touch as normalized, just so that we know we did it + touch.isNormalized = true; + + normalizedEvents.push(touch); + } + } + // apparently PointerEvent subclasses MouseEvent, so yay + else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) + { + if (typeof event.isPrimary === 'undefined') { event.isPrimary = true; } + if (typeof event.width === 'undefined') { event.width = 1; } + if (typeof event.height === 'undefined') { event.height = 1; } + if (typeof event.tiltX === 'undefined') { event.tiltX = 0; } + if (typeof event.tiltY === 'undefined') { event.tiltY = 0; } + if (typeof event.pointerType === 'undefined') { event.pointerType = 'mouse'; } + if (typeof event.pointerId === 'undefined') { event.pointerId = MOUSE_POINTER_ID; } + if (typeof event.pressure === 'undefined') { event.pressure = 0.5; } + if (typeof event.twist === 'undefined') { event.twist = 0; } + if (typeof event.tangentialPressure === 'undefined') { event.tangentialPressure = 0; } + + // mark the mouse event as normalized, just so that we know we did it + event.isNormalized = true; + + normalizedEvents.push(event); + } + else + { + normalizedEvents.push(event); + } + + return normalizedEvents; + }; + + /** + * Destroys the interaction manager + * + */ + InteractionManager.prototype.destroy = function destroy () + { + this.removeEvents(); + + this.removeTickerListener(); + + this.removeAllListeners(); + + this.renderer = null; + + this.mouse = null; + + this.eventData = null; + + this.interactionDOMElement = null; + + this.onPointerDown = null; + this.processPointerDown = null; + + this.onPointerUp = null; + this.processPointerUp = null; + + this.onPointerCancel = null; + this.processPointerCancel = null; + + this.onPointerMove = null; + this.processPointerMove = null; + + this.onPointerOut = null; + this.processPointerOverOut = null; + + this.onPointerOver = null; + + this.search = null; + }; + + Object.defineProperties( InteractionManager.prototype, prototypeAccessors ); + + return InteractionManager; + }(eventemitter3)); + + var interaction_es = ({ + InteractionData: InteractionData, + InteractionEvent: InteractionEvent, + InteractionManager: InteractionManager, + InteractionTrackingData: InteractionTrackingData, + interactiveTarget: interactiveTarget + }); + + /*! + * @pixi/runner - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + /** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.update.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject1); + * + * myGame.update.emit(time); + * ``` + * @class + * @memberof PIXI + */ + var Runner = /** @class */ (function () { + /** + * @param {string} name the function name that will be executed on the listeners added to this Runner. + */ + function Runner(name) { + this.items = []; + this._name = name; + this._aliasCount = 0; + } + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - optional parameters to pass to each listener + * @return {PIXI.Runner} + */ + Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { + if (arguments.length > 8) { + throw new Error('max arguments reached'); + } + var _a = this, name = _a.name, items = _a.items; + this._aliasCount++; + for (var i = 0, len = items.length; i < len; i++) { + items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); + } + if (items === this.items) { + this._aliasCount--; + } + return this; + }; + Runner.prototype.ensureNonAliasedItems = function () { + if (this._aliasCount > 0 && this.items.length > 1) { + this._aliasCount = 0; + this.items = this.items.slice(0); + } + }; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * + * @param {any} item - The object that will be listening. + * @return {PIXI.Runner} + */ + Runner.prototype.add = function (item) { + if (item[this._name]) { + this.ensureNonAliasedItems(); + this.remove(item); + this.items.push(item); + } + return this; + }; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listenr that you would like to remove. + * @return {PIXI.Runner} + */ + Runner.prototype.remove = function (item) { + var index = this.items.indexOf(item); + if (index !== -1) { + this.ensureNonAliasedItems(); + this.items.splice(index, 1); + } + return this; + }; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + Runner.prototype.contains = function (item) { + return this.items.indexOf(item) !== -1; + }; + /** + * Remove all listeners from the Runner + * @return {PIXI.Runner} + */ + Runner.prototype.removeAll = function () { + this.ensureNonAliasedItems(); + this.items.length = 0; + return this; + }; + /** + * Remove all references, don't use after this. + */ + Runner.prototype.destroy = function () { + this.removeAll(); + this.items = null; + this._name = null; + }; + Object.defineProperty(Runner.prototype, "empty", { + /** + * `true` if there are no this Runner contains no listeners + * + * @member {boolean} + * @readonly + */ + get: function () { + return this.items.length === 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Runner.prototype, "name", { + /** + * The name of the runner. + * + * @member {string} + * @readonly + */ + get: function () { + return this._name; + }, + enumerable: true, + configurable: true + }); + return Runner; + }()); + Object.defineProperties(Runner.prototype, { + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method dispatch + * @see PIXI.Runner#emit + */ + dispatch: { value: Runner.prototype.emit }, + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method run + * @see PIXI.Runner#emit + */ + run: { value: Runner.prototype.emit }, + }); + + /*! + * @pixi/core - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/core is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -14724,7 +17356,7 @@ var PIXI = (function (exports) { this.onError = new Runner('onError', 1); }; - var prototypeAccessors$1 = { valid: { configurable: true },width: { configurable: true },height: { configurable: true } }; + var prototypeAccessors$2 = { valid: { configurable: true },width: { configurable: true },height: { configurable: true } }; /** * Bind to a parent BaseTexture @@ -14777,7 +17409,7 @@ var PIXI = (function (exports) { * @readonly * @member {boolean} */ - prototypeAccessors$1.valid.get = function () + prototypeAccessors$2.valid.get = function () { return !!this._width && !!this._height; }; @@ -14810,7 +17442,7 @@ var PIXI = (function (exports) { * @member {number} * @readonly */ - prototypeAccessors$1.width.get = function () + prototypeAccessors$2.width.get = function () { return this._width; }; @@ -14821,7 +17453,7 @@ var PIXI = (function (exports) { * @member {number} * @readonly */ - prototypeAccessors$1.height.get = function () + prototypeAccessors$2.height.get = function () { return this._height; }; @@ -14882,7 +17514,7 @@ var PIXI = (function (exports) { } }; - Object.defineProperties( Resource.prototype, prototypeAccessors$1 ); + Object.defineProperties( Resource.prototype, prototypeAccessors$2 ); /** * Base for all the image/canvas resources @@ -18939,7 +21571,7 @@ var PIXI = (function (exports) { return new Buffer(data); }; - function getBufferType(array) + function getBufferType$1(array) { if (array.BYTES_PER_ELEMENT === 4) { @@ -18974,14 +21606,14 @@ var PIXI = (function (exports) { } /* eslint-disable object-shorthand */ - var map = { + var map$1 = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array, }; - function interleaveTypedArrays(arrays, sizes) + function interleaveTypedArrays$1(arrays, sizes) { var outSize = 0; var stride = 0; @@ -19003,11 +21635,11 @@ var PIXI = (function (exports) { var size = sizes[i$1]; var array = arrays[i$1]; - var type = getBufferType(array); + var type = getBufferType$1(array); if (!views[type]) { - views[type] = new map[type](buffer); + views[type] = new map$1[type](buffer); } out = views[type]; @@ -19030,7 +21662,7 @@ var PIXI = (function (exports) { var UID$1 = 0; /* eslint-disable object-shorthand */ - var map$1 = { + var map$1$1 = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, @@ -19256,7 +21888,7 @@ var PIXI = (function (exports) { attribute.buffer = 0; } - interleavedBuffer.data = interleaveTypedArrays(arrays, sizes); + interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); for (i = 0; i < this.buffers.length; i++) { @@ -19384,7 +22016,7 @@ var PIXI = (function (exports) { for (var i$1 = 0; i$1 < geometry.buffers.length; i$1++) { // TODO types! - arrays[i$1] = new map$1[getBufferType(geometry.buffers[i$1].data)](sizes[i$1]); + arrays[i$1] = new map$1$1[getBufferType$1(geometry.buffers[i$1].data)](sizes[i$1]); geometryOut.buffers[i$1] = new Buffer(arrays[i$1]); } @@ -20340,7 +22972,7 @@ var PIXI = (function (exports) { * @type {number} * @default PIXI.ENV.WEBGL2 */ - settings.PREFER_ENV = isMobile_min.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; + settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; /** * If set to `true`, Textures and BaseTexture objects stored @@ -21896,6 +24528,18 @@ var PIXI = (function (exports) { // if linking fails, then log and cleanup if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) + { + console.warn(vertexSrc); + console.error(gl.getShaderInfoLog(glVertShader)); + } + + if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) + { + console.warn(fragmentSrc); + console.error(gl.getShaderInfoLog(glFragShader)); + } + console.error('Pixi.js Error: Could not initialize shader.'); console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); console.error('gl.getError()', gl.getError()); @@ -21931,14 +24575,6 @@ var PIXI = (function (exports) { gl.shaderSource(shader, src); gl.compileShader(shader); - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - console.warn(src); - console.error(gl.getShaderInfoLog(shader)); - - return null; - } - return shader; } @@ -22271,8 +24907,7 @@ var PIXI = (function (exports) { function generateUniformsSync(group, uniformData) { - var textureCount = 0; - var func = "var v = null;\n var cv = null\n var gl = renderer.gl"; + var func = "var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "; for (var i in group.uniforms) { @@ -22282,7 +24917,7 @@ var PIXI = (function (exports) { { if (group.uniforms[i].group) { - func += "\n renderer.shader.syncUniformGroup(uv." + i + ");\n "; + func += "\n renderer.shader.syncUniformGroup(uv." + i + ", syncData);\n "; } continue; @@ -22297,9 +24932,7 @@ var PIXI = (function (exports) { else if ((data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray) /* eslint-disable max-len */ { - func += "\n renderer.texture.bind(uv." + i + ", " + textureCount + ");\n\n if(ud." + i + ".value !== " + textureCount + ")\n {\n ud." + i + ".value = " + textureCount + ";\n gl.uniform1i(ud." + i + ".location, " + textureCount + ");\n; // eslint-disable-line max-len\n }\n"; - - textureCount++; + func += "\n\n t = syncData.textureCount++;\n\n renderer.texture.bind(uv." + i + ", t);\n \n if(ud." + i + ".value !== t)\n {\n ud." + i + ".value = t;\n gl.uniform1i(ud." + i + ".location, t);\n; // eslint-disable-line max-len\n }\n"; } else if (data.type === 'mat3' && data.size === 1) { @@ -22349,7 +24982,13 @@ var PIXI = (function (exports) { } } - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func + /** + * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly + * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used + * no matter which group is being used + * + */ + return new Function('ud', 'uv', 'renderer', 'syncData', func); // eslint-disable-line no-new-func } var fragTemplate = [ @@ -22721,7 +25360,7 @@ var PIXI = (function (exports) { } }; - var prototypeAccessors$2 = { uniforms: { configurable: true } }; + var prototypeAccessors$2$1 = { uniforms: { configurable: true } }; // TODO move to shader system.. Shader.prototype.checkUniformExists = function checkUniformExists (name, group) @@ -22759,7 +25398,7 @@ var PIXI = (function (exports) { * @readonly * @member {object} */ - prototypeAccessors$2.uniforms.get = function () + prototypeAccessors$2$1.uniforms.get = function () { return this.uniformGroup.uniforms; }; @@ -22780,7 +25419,7 @@ var PIXI = (function (exports) { return new Shader(program, uniforms); }; - Object.defineProperties( Shader.prototype, prototypeAccessors$2 ); + Object.defineProperties( Shader.prototype, prototypeAccessors$2$1 ); /* eslint-disable max-len */ @@ -24402,6 +27041,8 @@ var PIXI = (function (exports) { }; var UID$4 = 0; + // defualt sync data so we don't create a new one each time! + var defaultSyncData = { textureCount: 0 }; /** * System plugin to the renderer to manage shaders. @@ -24488,7 +27129,9 @@ var PIXI = (function (exports) { if (!dontSync) { - this.syncUniformGroup(shader.uniformGroup); + defaultSyncData.textureCount = 0; + + this.syncUniformGroup(shader.uniformGroup, defaultSyncData); } return glProgram; @@ -24507,7 +27150,13 @@ var PIXI = (function (exports) { shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); }; - ShaderSystem.prototype.syncUniformGroup = function syncUniformGroup (group) + /** + * + * syncs uniforms on the group + * @param {*} group the uniform group to sync + * @param {*} syncData this is data that is passed to the sync function and any nested sync functions + */ + ShaderSystem.prototype.syncUniformGroup = function syncUniformGroup (group, syncData) { var glProgram = this.getglProgram(); @@ -24515,7 +27164,7 @@ var PIXI = (function (exports) { { glProgram.uniformGroups[group.id] = group.dirtyId; - this.syncUniforms(group, glProgram); + this.syncUniforms(group, glProgram, syncData); } }; @@ -24525,11 +27174,11 @@ var PIXI = (function (exports) { * * @private */ - ShaderSystem.prototype.syncUniforms = function syncUniforms (group, glProgram) + ShaderSystem.prototype.syncUniforms = function syncUniforms (group, glProgram, syncData) { var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); - syncFunc(glProgram.uniformData, group.uniforms, this.renderer); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); }; ShaderSystem.prototype.createSyncGroups = function createSyncGroups (group) @@ -26429,9 +29078,9 @@ var PIXI = (function (exports) { * @type {object} * @readonly * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.extract.Extract} extract Extract image data from renderer. + * @property {PIXI.Extract} extract Extract image data from renderer. * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.prepare.Prepare} prepare Pre-render display objects. + * @property {PIXI.Prepare} prepare Pre-render display objects. */ /** @@ -27252,7 +29901,8 @@ var PIXI = (function (exports) { this.bindAndClearTexArray(texArray); } - stateSystem.setBlendMode(blend); + this.state.blendMode = blend; + stateSystem.set(this.state); gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); } }; @@ -27687,8 +30337,233 @@ var PIXI = (function (exports) { var BatchRenderer = BatchPluginFactory.create(); /*! - * @pixi/extract - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/app - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * + * @pixi/app is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Convenience class to create a new PIXI application. + * + * This class automatically creates the renderer, ticker and root container. + * + * @example + * // Create the application + * const app = new PIXI.Application(); + * + * // Add the view to the DOM + * document.body.appendChild(app.view); + * + * // ex, add display objects + * app.stage.addChild(PIXI.Sprite.from('something.png')); + * + * @class + * @memberof PIXI + */ + var Application = function Application(options) + { + var this$1 = this; + + // The default options + options = Object.assign({ + forceCanvas: false, + }, options); + + /** + * WebGL renderer if available, otherwise CanvasRenderer. + * @member {PIXI.Renderer|PIXI.CanvasRenderer} + */ + this.renderer = autoDetectRenderer(options); + + /** + * The root display container that's rendered. + * @member {PIXI.Container} + */ + this.stage = new Container(); + + // install plugins here + Application._plugins.forEach(function (plugin) { + plugin.init.call(this$1, options); + }); + }; + + var prototypeAccessors$6 = { view: { configurable: true },screen: { configurable: true } }; + + /** + * Register a middleware plugin for the application + * @static + * @param {PIXI.Application.Plugin} plugin - Plugin being installed + */ + Application.registerPlugin = function registerPlugin (plugin) + { + Application._plugins.push(plugin); + }; + + /** + * Render the current stage. + */ + Application.prototype.render = function render () + { + this.renderer.render(this.stage); + }; + + /** + * Reference to the renderer's canvas element. + * @member {HTMLCanvasElement} + * @readonly + */ + prototypeAccessors$6.view.get = function () + { + return this.renderer.view; + }; + + /** + * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. + * @member {PIXI.Rectangle} + * @readonly + */ + prototypeAccessors$6.screen.get = function () + { + return this.renderer.screen; + }; + + /** + * Destroy and don't use after this. + * @param {Boolean} [removeView=false] Automatically remove canvas from DOM. + * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy + * method called as well. 'stageOptions' will be passed on to those calls. + * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the texture of the child sprite + * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the base texture of the child sprite + */ + Application.prototype.destroy = function destroy (removeView, stageOptions) + { + var this$1 = this; + + // Destroy plugins in the opposite order + // which they were constructed + var plugins = Application._plugins.slice(0); + + plugins.reverse(); + plugins.forEach(function (plugin) { + plugin.destroy.call(this$1); + }); + + this.stage.destroy(stageOptions); + this.stage = null; + + this.renderer.destroy(removeView); + this.renderer = null; + + this._options = null; + }; + + Object.defineProperties( Application.prototype, prototypeAccessors$6 ); + + /** + * @memberof PIXI.Application + * @typedef {object} Plugin + * @property {function} init - Called when Application is constructed, scoped to Application instance. + * Passes in `options` as the only argument, which are Application constructor options. + * @property {function} destroy - Called when destroying Application, scoped to Application instance + */ + + /** + * Collection of installed plugins. + * @static + * @private + * @type {PIXI.Application.Plugin[]} + */ + Application._plugins = []; + + /** + * Middleware for for Application's resize functionality + * @private + * @class + */ + var ResizePlugin = function ResizePlugin () {}; + + ResizePlugin.init = function init (options) + { + var this$1 = this; + + /** + * The element or window to resize the application to. + * @type {Window|HTMLElement} + * @name resizeTo + * @memberof PIXI.Application# + */ + Object.defineProperty(this, 'resizeTo', + { + set: function set(dom) + { + window.removeEventListener('resize', this.resize); + this._resizeTo = dom; + if (dom) + { + window.addEventListener('resize', this.resize); + this.resize(); + } + }, + get: function get() + { + return this._resizeTo; + }, + }); + + /** + * If `resizeTo` is set, calling this function + * will resize to the width and height of that element. + * @method PIXI.Application#resize + */ + this.resize = function () { + if (this$1._resizeTo) + { + // Resize to the window + if (this$1._resizeTo === window) + { + this$1.renderer.resize( + window.innerWidth, + window.innerHeight + ); + } + // Resize to other HTML entities + else + { + this$1.renderer.resize( + this$1._resizeTo.clientWidth, + this$1._resizeTo.clientHeight + ); + } + } + }; + + // On resize + this._resizeTo = null; + this.resizeTo = options.resizeTo || null; + }; + + /** + * Clean up the ticker, scoped to application + * @static + * @private + */ + ResizePlugin.destroy = function destroy () + { + this.resizeTo = null; + this.resize = null; + }; + + Application.registerPlugin(ResizePlugin); + + /*! + * @pixi/extract - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/extract is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -27698,12 +30573,25 @@ var PIXI = (function (exports) { var BYTES_PER_PIXEL = 4; /** - * The extract manager provides functionality to export content from the renderers. + * This class provides renderer-specific plugins for exporting content from a renderer. + * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels). * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` + * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. + * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); * @class - * @memberof PIXI.extract + * @memberof PIXI */ var Extract = function Extract(renderer) { @@ -27711,9 +30599,9 @@ var PIXI = (function (exports) { /** * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture * - * @member {PIXI.extract.Extract} extract + * @member {PIXI.Extract} extract * @memberof PIXI.Renderer# - * @see PIXI.extract.Extract + * @see PIXI.Extract */ renderer.extract = this; }; @@ -27957,2526 +30845,3825 @@ var PIXI = (function (exports) { } }; - var extract_es = ({ - Extract: Extract + 'use strict'; + + var parseUri = function parseURI (str, opts) { + opts = opts || {}; + + var o = { + key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ + } + }; + + var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); + var uri = {}; + var i = 14; + + while (i--) { uri[o.key[i]] = m[i] || ''; } + + uri[o.q.name] = {}; + uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { + if ($1) { uri[o.q.name][$1] = $2; } + }); + + return uri + }; + + var miniSignals = createCommonjsModule(function (module, exports) { + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true }); + 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'); } } + + var MiniSignalBinding = (function () { + function MiniSignalBinding(fn, once, thisArg) { + if (once === undefined) { once = false; } + + _classCallCheck(this, MiniSignalBinding); + + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + + _createClass(MiniSignalBinding, [{ + key: 'detach', + value: function detach() { + if (this._owner === null) { return false; } + this._owner.detach(this); + return true; + } + }]); + + return MiniSignalBinding; + })(); + + function _addMiniSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + + node._owner = self; + + return node; + } + + var MiniSignal = (function () { + function MiniSignal() { + _classCallCheck(this, MiniSignal); + + this._head = this._tail = undefined; + } + + _createClass(MiniSignal, [{ + key: 'handlers', + value: function handlers() { + var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var node = this._head; + + if (exists) { return !!node; } + + var ee = []; + + while (node) { + ee.push(node); + node = node._next; + } + + return ee; + } + }, { + key: 'has', + value: function has(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); + } + + return node._owner === this; + } + }, { + key: 'dispatch', + value: function dispatch() { + var arguments$1 = arguments; + + var node = this._head; + + if (!node) { return false; } + + while (node) { + if (node._once) { this.detach(node); } + node._fn.apply(node._thisArg, arguments$1); + node = node._next; + } + + return true; + } + }, { + key: 'add', + value: function add(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); + } + }, { + key: 'once', + value: function once(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); + } + }, { + key: 'detach', + value: function detach(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); + } + if (node._owner !== this) { return this; } + + if (node._prev) { node._prev._next = node._next; } + if (node._next) { node._next._prev = node._prev; } + + if (node === this._head) { + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } else if (node === this._tail) { + this._tail = node._prev; + this._tail._next = null; + } + + node._owner = null; + return this; + } + }, { + key: 'detachAll', + value: function detachAll() { + var node = this._head; + if (!node) { return this; } + + this._head = this._tail = null; + + while (node) { + node._owner = null; + node = node._next; + } + return this; + } + }]); + + return MiniSignal; + })(); + + MiniSignal.MiniSignalBinding = MiniSignalBinding; + + exports['default'] = MiniSignal; + module.exports = exports['default']; + }); + + var Signal = unwrapExports(miniSignals); + /*! - * @pixi/interaction - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * resource-loader - v3.0.1 + * https://github.com/pixijs/pixi-sound + * Compiled Tue, 02 Jul 2019 14:06:18 UTC * - * @pixi/interaction is licensed under the MIT License. + * resource-loader is licensed under the MIT license. * http://www.opensource.org/licenses/mit-license */ /** - * Holds all information related to an Interaction event + * Smaller version of the async library constructs. + * + * @namespace async + */ + + /** + * Noop function + * + * @ignore + * @function + * @memberof async + */ + function _noop() {} + /* empty */ + + /** + * Iterates an array in series. + * + * @memberof async + * @function eachSeries + * @param {Array.<*>} array - Array to iterate. + * @param {function} iterator - Function to call for each element. + * @param {function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + + + function eachSeries(array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + + (function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + + return; + } + + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } else { + iterator(array[i++], next); + } + })(); + } + /** + * Ensures a function is only called once. + * + * @ignore + * @memberof async + * @param {function} fn - The function to wrap. + * @return {function} The wrapping function. + */ + + function onlyOnce(fn) { + return function onceWrapper() { + if (fn === null) { + throw new Error('Callback was already called.'); + } + + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; + } + /** + * Async queue implementation, + * + * @memberof async + * @function queue + * @param {function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @return {*} The async queue object. + */ + + + function queue(worker, concurrency) { + if (concurrency == null) { + // eslint-disable-line no-eq-null,eqeqeq + concurrency = 1; + } else if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var workers = 0; + var q = { + _tasks: [], + concurrency: concurrency, + saturated: _noop, + unsaturated: _noop, + buffer: concurrency / 4, + empty: _noop, + drain: _noop, + error: _noop, + started: false, + paused: false, + push: function push(data, callback) { + _insert(data, false, callback); + }, + kill: function kill() { + workers = 0; + q.drain = _noop; + q.started = false; + q._tasks = []; + }, + unshift: function unshift(data, callback) { + _insert(data, true, callback); + }, + process: function process() { + while (!q.paused && workers < q.concurrency && q._tasks.length) { + var task = q._tasks.shift(); + + if (q._tasks.length === 0) { + q.empty(); + } + + workers += 1; + + if (workers === q.concurrency) { + q.saturated(); + } + + worker(task.data, onlyOnce(_next(task))); + } + }, + length: function length() { + return q._tasks.length; + }, + running: function running() { + return workers; + }, + idle: function idle() { + return q._tasks.length + workers === 0; + }, + pause: function pause() { + if (q.paused === true) { + return; + } + + q.paused = true; + }, + resume: function resume() { + if (q.paused === false) { + return; + } + + q.paused = false; // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + + for (var w = 1; w <= q.concurrency; w++) { + q.process(); + } + } + }; + + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + // eslint-disable-line no-eq-null,eqeqeq + throw new Error('task callback must be a function'); + } + + q.started = true; + + if (data == null && q.idle()) { + // eslint-disable-line no-eq-null,eqeqeq + // call drain immediately if there are no tasks + setTimeout(function () { + return q.drain(); + }, 1); + return; + } + + var item = { + data: data, + callback: typeof callback === 'function' ? callback : _noop + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + + setTimeout(function () { + return q.process(); + }, 1); + } + + function _next(task) { + return function next() { + workers -= 1; + task.callback.apply(task, arguments); + + if (arguments[0] != null) { + // eslint-disable-line no-eq-null,eqeqeq + q.error(arguments[0], task.data); + } + + if (workers <= q.concurrency - q.buffer) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + + q.process(); + }; + } + + return q; + } + + var async = ({ + eachSeries: eachSeries, + queue: queue + }); + + // a simple in-memory cache for resources + var cache = {}; + /** + * A simple in-memory cache for resource. + * + * @memberof middleware + * @function caching + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.caching); + * @param {Resource} resource - Current Resource + * @param {function} next - Callback when complete + */ + + function caching(resource, next) { + var _this = this; + + // if cached, then set data and complete the resource + if (cache[resource.url]) { + resource.data = cache[resource.url]; + resource.complete(); // marks resource load complete and stops processing before middlewares + } // if not cached, wait for complete and store it in the cache. + else { + resource.onComplete.once(function () { + return cache[_this.url] = _this.data; + }); + } + + next(); + } + + 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); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } + if (staticProps) { _defineProperties(Constructor, staticProps); } + return Constructor; + } + + var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); + var tempAnchor$1 = null; // some status constants + + var STATUS_NONE = 0; + var STATUS_OK = 200; + var STATUS_EMPTY = 204; + var STATUS_IE_BUG_EMPTY = 1223; + var STATUS_TYPE_OK = 2; // noop + + function _noop$1() {} + /* empty */ + + /** + * Manages the state and loading of a resource and all child resources. * * @class - * @memberof PIXI.interaction */ - var InteractionData = function InteractionData() - { - /** - * This point stores the global coords of where the touch/mouse event happened - * - * @member {PIXI.Point} - */ - this.global = new Point(); - /** - * The target Sprite that was interacted with - * - * @member {PIXI.Sprite} - */ - this.target = null; - /** - * When passed to an event handler, this will be the original DOM Event that was captured - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent - * @member {MouseEvent|TouchEvent|PointerEvent} - */ - this.originalEvent = null; + var Resource$1 = + /*#__PURE__*/ + function () { + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. + */ + Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { + setExtMap(Resource._loadTypeMap, extname, loadType); + } + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + ; + Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { + setExtMap(Resource._xhrTypeMap, extname, xhrType); + } + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. + */ + ; + + function Resource(name, url, options) { + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + + options = options || {}; /** - * Unique identifier for this interaction + * The state flags of this resource. + * + * @private + * @member {number} + */ + + this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work. + + this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + /** + * The name of this resource. + * + * @readonly + * @member {string} + */ + + + this.name = name; + /** + * The url used to load this resource. + * + * @readonly + * @member {string} + */ + + this.url = url; + /** + * The extension used to load this resource. + * + * @readonly + * @member {string} + */ + + this.extension = this._getExtension(); + /** + * The data that was loaded by the resource. + * + * @member {any} + */ + + this.data = null; + /** + * Is this request cross-origin? If unset, determined automatically. + * + * @member {string} + */ + + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + /** + * A timeout in milliseconds for the load. If the load takes longer than this time + * it is cancelled and the load is considered a failure. If this value is set to `0` + * then there is no explicit timeout. * * @member {number} */ - this.identifier = null; + this.timeout = options.timeout || 0; /** - * Indicates whether or not the pointer device that created the event is the primary pointer. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary - * @type {Boolean} - */ - this.isPrimary = false; - - /** - * Indicates which button was pressed on the mouse or pointer device to trigger the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - * @type {number} - */ - this.button = 0; - - /** - * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons - * @type {number} - */ - this.buttons = 0; - - /** - * The width of the pointer's contact along the x-axis, measured in CSS pixels. - * radiusX of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width - * @type {number} - */ - this.width = 0; - - /** - * The height of the pointer's contact along the y-axis, measured in CSS pixels. - * radiusY of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height - * @type {number} - */ - this.height = 0; - - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX - * @type {number} - */ - this.tiltX = 0; - - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY - * @type {number} - */ - this.tiltY = 0; - - /** - * The type of pointer that triggered the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType - * @type {string} - */ - this.pointerType = null; - - /** - * Pressure applied by the pointing device during the event. A Touch's force property - * will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure - * @type {number} - */ - this.pressure = 0; - - /** - * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. - * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle - * @type {number} - */ - this.rotationAngle = 0; - - /** - * Twist of a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.twist = 0; - - /** - * Barrel pressure on a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.tangentialPressure = 0; - }; - - var prototypeAccessors$6 = { pointerId: { configurable: true } }; - - /** - * The unique identifier of the pointer. It will be the same as `identifier`. - * @readonly - * @member {number} - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId - */ - prototypeAccessors$6.pointerId.get = function () - { - return this.identifier; - }; - - /** - * This will return the local coordinates of the specified displayObject for this InteractionData - * - * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local - * coords off - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise - * will create a new point) - * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional - * (otherwise will use the current global coords) - * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative - * to the DisplayObject - */ - InteractionData.prototype.getLocalPosition = function getLocalPosition (displayObject, point, globalPos) - { - return displayObject.worldTransform.applyInverse(globalPos || this.global, point); - }; - - /** - * Copies properties from normalized event data. - * - * @param {Touch|MouseEvent|PointerEvent} event The normalized event data - */ - InteractionData.prototype.copyEvent = function copyEvent (event) - { - // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite - // it with "false" on later events when our shim for it on touch events might not be - // accurate - if (event.isPrimary) - { - this.isPrimary = true; - } - this.button = event.button; - // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard - // event.which property instead, which conveys the same information. - this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which; - this.width = event.width; - this.height = event.height; - this.tiltX = event.tiltX; - this.tiltY = event.tiltY; - this.pointerType = event.pointerType; - this.pressure = event.pressure; - this.rotationAngle = event.rotationAngle; - this.twist = event.twist || 0; - this.tangentialPressure = event.tangentialPressure || 0; - }; - - /** - * Resets the data for pooling. - */ - InteractionData.prototype.reset = function reset () - { - // isPrimary is the only property that we really need to reset - everything else is - // guaranteed to be overwritten - this.isPrimary = false; - }; - - Object.defineProperties( InteractionData.prototype, prototypeAccessors$6 ); - - /** - * Event class that mimics native DOM events. - * - * @class - * @memberof PIXI.interaction - */ - var InteractionEvent = function InteractionEvent() - { - /** - * Whether this event will continue propagating in the tree. + * The method of loading to use for this resource. * - * Remaining events for the {@link stopsPropagatingAt} object - * will still be dispatched. - * - * @member {boolean} + * @member {Resource.LOAD_TYPE} */ - this.stopped = false; + this.loadType = options.loadType || this._determineLoadType(); /** - * At which object this event stops propagating. - * - * @private - * @member {PIXI.DisplayObject} - */ - this.stopsPropagatingAt = null; - - /** - * Whether we already reached the element we want to - * stop propagating at. This is important for delayed events, - * where we start over deeper in the tree again. - * - * @private - * @member {boolean} - */ - this.stopPropagationHint = false; - - /** - * The object which caused this event to be dispatched. - * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}. - * - * @member {PIXI.DisplayObject} - */ - this.target = null; - - /** - * The object whose event listener’s callback is currently being invoked. - * - * @member {PIXI.DisplayObject} - */ - this.currentTarget = null; - - /** - * Type of the event + * The type used to load the resource via XHR. If unset, determined automatically. * * @member {string} */ - this.type = null; + this.xhrType = options.xhrType; /** - * InteractionData related to this event + * Extra info for middleware, and controlling specifics about how the resource loads. * - * @member {PIXI.interaction.InteractionData} + * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + * Meaning it will modify it as it sees fit. + * + * @member {Resource.IMetadata} */ - this.data = null; - }; - /** - * Prevents event from reaching any objects other than the current object. - * - */ - InteractionEvent.prototype.stopPropagation = function stopPropagation () - { - this.stopped = true; - this.stopPropagationHint = true; - this.stopsPropagatingAt = this.currentTarget; - }; + this.metadata = options.metadata || {}; + /** + * The error that occurred while loading (if any). + * + * @readonly + * @member {Error} + */ - /** - * Resets the event. - */ - InteractionEvent.prototype.reset = function reset () - { - this.stopped = false; - this.stopsPropagatingAt = null; - this.stopPropagationHint = false; - this.currentTarget = null; - this.target = null; - }; + this.error = null; + /** + * The XHR object that was used to load this resource. This is only set + * when `loadType` is `Resource.LOAD_TYPE.XHR`. + * + * @readonly + * @member {XMLHttpRequest} + */ - /** - * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions - * - * @class - * @private - * @memberof PIXI.interaction - */ - var InteractionTrackingData = function InteractionTrackingData(pointerId) - { - this._pointerId = pointerId; - this._flags = InteractionTrackingData.FLAGS.NONE; - }; + this.xhr = null; + /** + * The child resources this resource owns. + * + * @readonly + * @member {Resource[]} + */ - var prototypeAccessors$1$2 = { pointerId: { configurable: true },flags: { configurable: true },none: { configurable: true },over: { configurable: true },rightDown: { configurable: true },leftDown: { configurable: true } }; + this.children = []; + /** + * The resource type. + * + * @readonly + * @member {Resource.TYPE} + */ - /** - * - * @private - * @param {number} flag - The interaction flag to set - * @param {boolean} yn - Should the flag be set or unset - */ - InteractionTrackingData.prototype._doSet = function _doSet (flag, yn) - { - if (yn) - { - this._flags = this._flags | flag; + this.type = Resource.TYPE.UNKNOWN; + /** + * The progress chunk owned by this resource. + * + * @readonly + * @member {number} + */ + + this.progressChunk = 0; + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * + * @private + * @member {function} + */ + + this._dequeue = _noop$1; + /** + * Used a storage place for the on load binding used privately by the loader. + * + * @private + * @member {function} + */ + + this._onLoadBinding = null; + /** + * The timer for element loads to check if they timeout. + * + * @private + * @member {number} + */ + + this._elementTimer = 0; + /** + * The `complete` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundComplete = this.complete.bind(this); + /** + * The `_onError` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnError = this._onError.bind(this); + /** + * The `_onProgress` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnProgress = this._onProgress.bind(this); + /** + * The `_onTimeout` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks + + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + /** + * Dispatched when the resource beings to load. + * + * The callback looks like {@link Resource.OnStartSignal}. + * + * @member {Signal} + */ + + this.onStart = new Signal(); + /** + * Dispatched each time progress of this resource load updates. + * Not all resources types and loader systems can support this event + * so sometimes it may not be available. If the resource + * is being loaded on a modern browser, using XHR, and the remote server + * properly sets Content-Length headers, then this will be available. + * + * The callback looks like {@link Resource.OnProgressSignal}. + * + * @member {Signal} + */ + + this.onProgress = new Signal(); + /** + * Dispatched once this resource has loaded, if there was an error it will + * be in the `error` property. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onComplete = new Signal(); + /** + * Dispatched after this resource has had all the *after* middleware run on it. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onAfterMiddleware = new Signal(); + } + /** + * When the resource starts to load. + * + * @memberof Resource + * @callback OnStartSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * When the resource reports loading progress. + * + * @memberof Resource + * @callback OnProgressSignal + * @param {Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + + /** + * When the resource finishes loading. + * + * @memberof Resource + * @callback OnCompleteSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * @memberof Resource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + + /** + * Stores whether or not this url is a data url. + * + * @readonly + * @member {boolean} + */ + + + var _proto = Resource.prototype; + + /** + * Marks the resource as complete. + * + */ + _proto.complete = function complete() { + this._clearEvents(); + + this._finish(); + } + /** + * Aborts the loading of this resource, with an optional message. + * + * @param {string} message - The message to use for the error + */ + ; + + _proto.abort = function abort(message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } // store error + + + this.error = new Error(message); // clear events before calling aborts + + this._clearEvents(); // abort the actual loading + + + if (this.xhr) { + this.xhr.abort(); + } else if (this.xdr) { + this.xdr.abort(); + } else if (this.data) { + // single source + if (this.data.src) { + this.data.src = Resource.EMPTY_GIF; + } // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } // done now. + + + this._finish(); + } + /** + * Kicks off loading of this resource. This method is asynchronous. + * + * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + ; + + _proto.load = function load(cb) { + var _this = this; + + if (this.isLoading) { + return; } - else - { - this._flags = this._flags & (~flag); - } - }; + if (this.isComplete) { + if (cb) { + setTimeout(function () { + return cb(_this); + }, 1); + } + + return; + } else if (cb) { + this.onComplete.once(cb); + } + + this._setFlag(Resource.STATUS_FLAGS.LOADING, true); + + this.onStart.dispatch(this); // if unset, determine the value + + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + + switch (this.loadType) { + case Resource.LOAD_TYPE.IMAGE: + this.type = Resource.TYPE.IMAGE; + + this._loadElement('image'); + + break; + + case Resource.LOAD_TYPE.AUDIO: + this.type = Resource.TYPE.AUDIO; + + this._loadSourceElement('audio'); + + break; + + case Resource.LOAD_TYPE.VIDEO: + this.type = Resource.TYPE.VIDEO; + + this._loadSourceElement('video'); + + break; + + case Resource.LOAD_TYPE.XHR: + /* falls through */ + + default: + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } else { + this._loadXhr(); + } + + break; + } + } + /** + * Checks if the flag is set. + * + * @private + * @param {number} flag - The flag to check. + * @return {boolean} True if the flag is set. + */ + ; + + _proto._hasFlag = function _hasFlag(flag) { + return (this._flags & flag) !== 0; + } + /** + * (Un)Sets the flag. + * + * @private + * @param {number} flag - The flag to (un)set. + * @param {boolean} value - Whether to set or (un)set the flag. + */ + ; + + _proto._setFlag = function _setFlag(flag, value) { + this._flags = value ? this._flags | flag : this._flags & ~flag; + } + /** + * Clears all the events from the underlying loading source. + * + * @private + */ + ; + + _proto._clearEvents = function _clearEvents() { + clearTimeout(this._elementTimer); + + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + } + /** + * Finalizes the load. + * + * @private + */ + ; + + _proto._finish = function _finish() { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + + this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); + + this._setFlag(Resource.STATUS_FLAGS.LOADING, false); + + this.onComplete.dispatch(this); + } + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * + * @private + * @param {string} type - The type of element to use. + */ + ; + + _proto._loadElement = function _loadElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'image' && typeof window.Image !== 'undefined') { + this.data = new Image(); + } else { + this.data = document.createElement(type); + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + } + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * + * @private + * @param {string} type - The type of element to use. + */ + ; + + _proto._loadSourceElement = function _loadSourceElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'audio' && typeof window.Audio !== 'undefined') { + this.data = new Audio(); + } else { + this.data = document.createElement(type); + } + + if (this.data === null) { + this.abort("Unsupported element: " + type); + return; + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } else { + var _mimeTypes = this.metadata.mimeType; + this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); + } + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + this.data.load(); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + } + /** + * Loads this resources using an XMLHttpRequest. + * + * @private + */ + ; + + _proto._loadXhr = function _loadXhr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url + + xhr.open('GET', this.url, true); + xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; + } else { + xhr.responseType = this.xhrType; + } + + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + xhr.send(); + } + /** + * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). + * + * @private + */ + ; + + _proto._loadXdr = function _loadXdr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + + setTimeout(function () { + return xdr.send(); + }, 1); + } + /** + * Creates a source used in loading via an element. + * + * @private + * @param {string} type - The element type (video or audio). + * @param {string} url - The source URL to load from. + * @param {string} [mime] - The mime type of the video + * @return {HTMLSourceElement} The source element. + */ + ; + + _proto._createSource = function _createSource(type, url, mime) { + if (!mime) { + mime = type + "/" + this._getExtension(url); + } + + var source = document.createElement('source'); + source.src = url; + source.type = mime; + return source; + } + /** + * Called if a load errors out. + * + * @param {Event} event - The error event from the element that emits it. + * @private + */ + ; + + _proto._onError = function _onError(event) { + this.abort("Failed to load element using: " + event.target.nodeName); + } + /** + * Called if a load progress event fires for an element or xhr/xdr. + * + * @private + * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. + */ + ; + + _proto._onProgress = function _onProgress(event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + } + /** + * Called if a timeout event fires for an element. + * + * @private + */ + ; + + _proto._onTimeout = function _onTimeout() { + this.abort("Load timed out."); + } + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnError = function _xhrOnError() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); + } + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnTimeout = function _xhrOnTimeout() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request timed out."); + } + /** + * Called if an abort event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnAbort = function _xhrOnAbort() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request was aborted by the user."); + } + /** + * Called when data successfully loads from an xhr/xdr request. + * + * @private + * @param {XMLHttpRequestLoadEvent|Event} event - Load event + */ + ; + + _proto._xhrOnLoad = function _xhrOnLoad() { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + // responseText is accessible only if responseType is '' or 'text' and on older browsers + + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + + + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + + var statusType = status / 100 | 0; + + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = Resource.TYPE.TEXT; + } // if json, parse into json object + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = Resource.TYPE.JSON; + } catch (e) { + this.abort("Error trying to parse loaded json: " + e); + return; + } + } // if xml, parse into an xml document or div element + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (window.DOMParser) { + var domparser = new DOMParser(); + this.data = domparser.parseFromString(text, 'text/xml'); + } else { + var div = document.createElement('div'); + div.innerHTML = text; + this.data = div; + } + + this.type = Resource.TYPE.XML; + } catch (e) { + this.abort("Error trying to parse loaded xml: " + e); + return; + } + } // other types just return the response + else { + this.data = xhr.response || text; + } + } else { + this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); + return; + } + + this.complete(); + } + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * + * @private + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @return {string} The crossOrigin value to use (or empty string for none). + */ + ; + + _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match window.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + + + if (window.origin !== window.location.origin) { + return 'anonymous'; + } // default is window.location + + + loc = loc || window.location; + + if (!tempAnchor$1) { + tempAnchor$1 = document.createElement('a'); + } // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + + + tempAnchor$1.href = url; + url = parseUri(tempAnchor$1.href, { + strictMode: true + }); + var samePort = !url.port && loc.port === '' || url.port === loc.port; + var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin + + if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + + return ''; + } + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. + */ + ; + + _proto._determineXhrType = function _determineXhrType() { + return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; + } + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.LOAD_TYPE} The loadType to use. + */ + ; + + _proto._determineLoadType = function _determineLoadType() { + return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; + } + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * + * @private + * @return {string} The extension. + */ + ; + + _proto._getExtension = function _getExtension() { + var url = this.url; + var ext = ''; + + if (this.isDataUrl) { + var slashIndex = url.indexOf('/'); + ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); + } else { + var queryStart = url.indexOf('?'); + var hashStart = url.indexOf('#'); + var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); + url = url.substring(0, index); + ext = url.substring(url.lastIndexOf('.') + 1); + } + + return ext.toLowerCase(); + } + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * + * @private + * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. + * @return {string} The mime type to use. + */ + ; + + _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) { + switch (type) { + case Resource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + + case Resource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + + case Resource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + + case Resource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + + case Resource.XHR_RESPONSE_TYPE.DEFAULT: + case Resource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + + default: + return 'text/plain'; + } + }; + + _createClass(Resource, [{ + key: "isDataUrl", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); + } + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * + * @readonly + * @member {boolean} + */ + + }, { + key: "isComplete", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); + } + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * + * @readonly + * @member {boolean} + */ + + }, { + key: "isLoading", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.LOADING); + } + }]); + + return Resource; + }(); /** - * Unique pointer id of the event + * The types of resources a resource could represent. * + * @static * @readonly - * @private - * @member {number} + * @enum {number} */ - prototypeAccessors$1$2.pointerId.get = function () - { - return this._pointerId; + + + Resource$1.STATUS_FLAGS = { + NONE: 0, + DATA_URL: 1 << 0, + COMPLETE: 1 << 1, + LOADING: 1 << 2 }; + /** + * The types of resources a resource could represent. + * + * @static + * @readonly + * @enum {number} + */ + + Resource$1.TYPE = { + UNKNOWN: 0, + JSON: 1, + XML: 2, + IMAGE: 3, + AUDIO: 4, + VIDEO: 5, + TEXT: 6 + }; + /** + * The types of loading a resource can use. + * + * @static + * @readonly + * @enum {number} + */ + + Resource$1.LOAD_TYPE = { + /** Uses XMLHttpRequest to load the resource. */ + XHR: 1, + + /** Uses an `Image` object to load the resource. */ + IMAGE: 2, + + /** Uses an `Audio` object to load the resource. */ + AUDIO: 3, + + /** Uses a `Video` object to load the resource. */ + VIDEO: 4 + }; + /** + * The XHR ready states, used internally. + * + * @static + * @readonly + * @enum {string} + */ + + Resource$1.XHR_RESPONSE_TYPE = { + /** string */ + DEFAULT: 'text', + + /** ArrayBuffer */ + BUFFER: 'arraybuffer', + + /** Blob */ + BLOB: 'blob', + + /** Document */ + DOCUMENT: 'document', + + /** Object */ + JSON: 'json', + + /** String */ + TEXT: 'text' + }; + Resource$1._loadTypeMap = { + // images + gif: Resource$1.LOAD_TYPE.IMAGE, + png: Resource$1.LOAD_TYPE.IMAGE, + bmp: Resource$1.LOAD_TYPE.IMAGE, + jpg: Resource$1.LOAD_TYPE.IMAGE, + jpeg: Resource$1.LOAD_TYPE.IMAGE, + tif: Resource$1.LOAD_TYPE.IMAGE, + tiff: Resource$1.LOAD_TYPE.IMAGE, + webp: Resource$1.LOAD_TYPE.IMAGE, + tga: Resource$1.LOAD_TYPE.IMAGE, + svg: Resource$1.LOAD_TYPE.IMAGE, + 'svg+xml': Resource$1.LOAD_TYPE.IMAGE, + // for SVG data urls + // audio + mp3: Resource$1.LOAD_TYPE.AUDIO, + ogg: Resource$1.LOAD_TYPE.AUDIO, + wav: Resource$1.LOAD_TYPE.AUDIO, + // videos + mp4: Resource$1.LOAD_TYPE.VIDEO, + webm: Resource$1.LOAD_TYPE.VIDEO + }; + Resource$1._xhrTypeMap = { + // xml + xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + // images + gif: Resource$1.XHR_RESPONSE_TYPE.BLOB, + png: Resource$1.XHR_RESPONSE_TYPE.BLOB, + bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB, + jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB, + jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tif: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB, + webp: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tga: Resource$1.XHR_RESPONSE_TYPE.BLOB, + // json + json: Resource$1.XHR_RESPONSE_TYPE.JSON, + // text + text: Resource$1.XHR_RESPONSE_TYPE.TEXT, + txt: Resource$1.XHR_RESPONSE_TYPE.TEXT, + // fonts + ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER, + otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER + }; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + + Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; + /** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * + * @ignore + * @param {object} map - The map to set on. + * @param {string} extname - The extension (or key) to set. + * @param {number} val - The value to set. + */ + + function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + + if (!extname) { + return; + } + + map[extname] = val; + } + /** + * Quick helper to get string xhr type. + * + * @ignore + * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. + * @return {string} The type. + */ + + + function reqType(xhr) { + return xhr.toString().replace('object ', ''); + } + + var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + /** + * Encodes binary into base64. + * + * @function encodeBinary + * @param {string} input The input data to encode. + * @returns {string} The encoded base64 string + */ + + function encodeBinary(input) { + var output = ''; + var inx = 0; + + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } else { + bytebuffer[jnx] = 0; + } + } // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + + + encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + + encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + + encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3) + + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly + + var paddingBytes = inx - (input.length - 1); + + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + + default: + break; + // No padding - proceed + } // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + + + for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { + output += _keyStr.charAt(encodedCharIndexes[_jnx]); + } + } + + return output; + } + + var Url$1 = window.URL || window.webkitURL; + /** + * A middleware for transforming XHR loaded Blobs into more useful objects + * + * @memberof middleware + * @function parsing + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.parsing); + * @param {Resource} resource - Current Resource + * @param {function} next - Callback when complete + */ + + function parsing(resource, next) { + if (!resource.data) { + next(); + return; + } // if this was an XHR load of a blob + + + if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!window.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url + + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); + resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback + + resource.data.onload = function () { + resource.data.onload = null; + next(); + }; // next will be called on load + + + return; + } + } // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var src = Url$1.createObjectURL(resource.data); + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src; + resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + + resource.data.onload = function () { + Url$1.revokeObjectURL(src); + resource.data.onload = null; + next(); + }; // next will be called on load. + + + return; + } + } + + next(); + } /** - * State of the tracking data, expressed as bit flags - * - * @private - * @member {number} + * @namespace middleware */ - prototypeAccessors$1$2.flags.get = function () - { - return this._flags; - }; - prototypeAccessors$1$2.flags.set = function (flags) // eslint-disable-line require-jsdoc - { - this._flags = flags; - }; - - /** - * Is the tracked event inactive (not over or down)? - * - * @private - * @member {number} - */ - prototypeAccessors$1$2.none.get = function () - { - return this._flags === this.constructor.FLAGS.NONE; - }; - - /** - * Is the tracked event over the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1$2.over.get = function () - { - return (this._flags & this.constructor.FLAGS.OVER) !== 0; - }; - - prototypeAccessors$1$2.over.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.OVER, yn); - }; - - /** - * Did the right mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1$2.rightDown.get = function () - { - return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; - }; - - prototypeAccessors$1$2.rightDown.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); - }; - - /** - * Did the left mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1$2.leftDown.get = function () - { - return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; - }; - - prototypeAccessors$1$2.leftDown.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); - }; - - Object.defineProperties( InteractionTrackingData.prototype, prototypeAccessors$1$2 ); - - InteractionTrackingData.FLAGS = Object.freeze({ - NONE: 0, - OVER: 1 << 0, - LEFT_DOWN: 1 << 1, - RIGHT_DOWN: 1 << 2, + var index$1 = ({ + caching: caching, + parsing: parsing }); + var MAX_PROGRESS = 100; + var rgxExtractUrlHash = /(#[\w-]+)?$/; /** - * Strategy how to search through stage tree for interactive objects + * Manages the state and loading of multiple resources to load. * - * @private * @class - * @memberof PIXI.interaction */ - var TreeSearch = function TreeSearch() - { - this._tempPoint = new Point(); - }; - /** - * Recursive implementation for findHit - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @param {boolean} [interactive] - Whether the displayObject is interactive - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.recursiveFindHit = function recursiveFindHit (interactionEvent, displayObject, func, hitTest, interactive) - { - if (!displayObject || !displayObject.visible) - { - return false; + var Loader = + /*#__PURE__*/ + function () { + /** + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + var _this = this; + + if (baseUrl === void 0) { + baseUrl = ''; } - var point = interactionEvent.data.global; - - // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ - // - // This function will now loop through all objects and then only hit test the objects it HAS - // to, not all of them. MUCH faster.. - // An object will be hit test if the following is true: - // - // 1: It is interactive. - // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // - // As another little optimization once an interactive object has been hit we can carry on - // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimization is that an object is not hit test directly if a child has already been hit. - - interactive = displayObject.interactive || interactive; - - var hit = false; - var interactiveParent = interactive; - - // Flag here can set to false if the event is outside the parents hitArea or mask - var hitTestChildren = true; - - // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea - // There is also no longer a need to hitTest children. - if (displayObject.hitArea) - { - if (hitTest) - { - displayObject.worldTransform.applyInverse(point, this._tempPoint); - if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) - { - hitTest = false; - hitTestChildren = false; - } - else - { - hit = true; - } - } - interactiveParent = false; - } - // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. - // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. - // https://github.com/pixijs/pixi.js/issues/5135 - else if (displayObject._mask) - { - if (hitTest) - { - if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) - { - hitTest = false; - } - } + if (concurrency === void 0) { + concurrency = 10; } - // ** FREE TIP **! If an object is not interactive or has no buttons in it - // (such as a game scene!) set interactiveChildren to false for that displayObject. - // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. - if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) - { - var children = displayObject.children; - - for (var i = children.length - 1; i >= 0; i--) - { - var child = children[i]; - - // time to get recursive.. if this function will return if something is hit.. - var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); - - if (childHit) - { - // its a good idea to check if a child has lost its parent. - // this means it has been removed whilst looping so its best - if (!child.parent) - { - continue; - } - - // we no longer need to hit test any more objects in this container as we we - // now know the parent has been hit - interactiveParent = false; - - // If the child is interactive , that means that the object hit was actually - // interactive and not just the child of an interactive object. - // This means we no longer need to hit test anything else. We still need to run - // through all objects, but we don't need to perform any hit tests. - - if (childHit) - { - if (interactionEvent.target) - { - hitTest = false; - } - hit = true; - } - } - } - } - - // no point running this if the item is not interactive or does not have an interactive parent. - if (interactive) - { - // if we are hit testing (as in we have no hit any objects yet) - // We also don't need to worry about hit testing if once of the displayObjects children - // has already been hit - but only if it was interactive, otherwise we need to keep - // looking for an interactive child, just in case we hit one - if (hitTest && !interactionEvent.target) - { - // already tested against hitArea if it is defined - if (!displayObject.hitArea && displayObject.containsPoint) - { - if (displayObject.containsPoint(point)) - { - hit = true; - } - } - } - - if (displayObject.interactive) - { - if (hit && !interactionEvent.target) - { - interactionEvent.target = displayObject; - } - - if (func) - { - func(interactionEvent, displayObject, !!hit); - } - } - } - - return hit; - }; - - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.findHit = function findHit (interactionEvent, displayObject, func, hitTest) - { - this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); - }; - - /** - * Interface for classes that represent a hit area. - * - * It is implemented by the following classes: - * - {@link PIXI.Circle} - * - {@link PIXI.Ellipse} - * - {@link PIXI.Polygon} - * - {@link PIXI.RoundedRectangle} - * - * @interface IHitArea - * @memberof PIXI - */ - - /** - * Checks whether the x and y coordinates given are contained within this area - * - * @method - * @name contains - * @memberof PIXI.IHitArea# - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this area - */ - - /** - * Default property values of interactive objects - * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties - * - * @private - * @name interactiveTarget - * @type {Object} - * @memberof PIXI.interaction - * @example - * function MyObject() {} - * - * Object.assign( - * DisplayObject.prototype, - * PIXI.interaction.interactiveTarget - * ); - */ - var interactiveTarget = { - /** - * Enable interaction events for the DisplayObject. Touch, pointer and mouse - * events will not be emitted unless `interactive` is set to `true`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.on('tap', (event) => { - * //handle event - * }); - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - interactive: false, - - /** - * Determines if the children to the displayObject can be clicked/touched - * Setting this to false allows PixiJS to bypass a recursive `hitTest` function - * - * @member {boolean} - * @memberof PIXI.Container# - */ - interactiveChildren: true, - - /** - * Interaction shape. Children will be hit first, then this shape will be checked. - * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); - * @member {PIXI.IHitArea} - * @memberof PIXI.DisplayObject# - */ - hitArea: null, - - /** - * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive - * Setting this changes the 'cursor' property to `'pointer'`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.buttonMode = true; - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - get buttonMode() - { - return this.cursor === 'pointer'; - }, - set buttonMode(value) - { - if (value) - { - this.cursor = 'pointer'; - } - else if (this.cursor === 'pointer') - { - this.cursor = null; - } - }, - - /** - * This defines what cursor mode is used when the mouse cursor - * is hovered over the displayObject. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.cursor = 'wait'; - * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor + * The base url for all resources loaded by this loader. * * @member {string} - * @memberof PIXI.DisplayObject# */ - cursor: null, - + this.baseUrl = baseUrl; /** - * Internal set of all active pointers, by identifier + * The progress percent of the loader going through the queue. * - * @member {Map} - * @memberof PIXI.DisplayObject# - * @private + * @member {number} + * @default 0 */ - get trackedPointers() - { - if (this._trackedPointers === undefined) { this._trackedPointers = {}; } - - return this._trackedPointers; - }, + this.progress = 0; /** - * Map of all tracked pointers, by identifier. Use trackedPointers to access. + * Loading state of the loader, true if it is currently loading resources. + * + * @member {boolean} + * @default false + */ + + this.loading = false; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + * + * @member {string} + * @default '' + */ + + this.defaultQueryString = ''; + /** + * The middleware to run before loading each resource. * * @private - * @type {Map} + * @member {function[]} */ - _trackedPointers: undefined, + + this._beforeMiddleware = []; + /** + * The middleware to run after loading each resource. + * + * @private + * @member {function[]} + */ + + this._afterMiddleware = []; + /** + * The tracks the resources we are currently completing parsing for. + * + * @private + * @member {Resource[]} + */ + + this._resourcesParsing = []; + /** + * The `_loadResource` function bound with this object context. + * + * @private + * @member {function} + * @param {Resource} r - The resource to load + * @param {Function} d - The dequeue function + * @return {undefined} + */ + + this._boundLoadResource = function (r, d) { + return _this._loadResource(r, d); + }; + /** + * The resources waiting to be loaded. + * + * @private + * @member {Resource[]} + */ + + + this._queue = queue(this._boundLoadResource, concurrency); + + this._queue.pause(); + /** + * All the resources for this loader keyed by name. + * + * @member {object} + */ + + + this.resources = {}; + /** + * Dispatched once per loaded or errored resource. + * + * The callback looks like {@link Loader.OnProgressSignal}. + * + * @member {Signal} + */ + + this.onProgress = new Signal(); + /** + * Dispatched once per errored resource. + * + * The callback looks like {@link Loader.OnErrorSignal}. + * + * @member {Signal} + */ + + this.onError = new Signal(); + /** + * Dispatched once per loaded resource. + * + * The callback looks like {@link Loader.OnLoadSignal}. + * + * @member {Signal} + */ + + this.onLoad = new Signal(); + /** + * Dispatched when the loader begins to process the queue. + * + * The callback looks like {@link Loader.OnStartSignal}. + * + * @member {Signal} + */ + + this.onStart = new Signal(); + /** + * Dispatched when the queued resources all load. + * + * The callback looks like {@link Loader.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onComplete = new Signal(); // Add default before middleware + + for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { + this.pre(Loader._defaultBeforeMiddleware[i]); + } // Add default after middleware + + + for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { + this.use(Loader._defaultAfterMiddleware[_i]); + } + } + /** + * When the progress changes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnProgressSignal + * @param {Loader} loader - The loader the progress is advancing on. + * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. + */ + + /** + * When an error occurrs the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnErrorSignal + * @param {Loader} loader - The loader the error happened in. + * @param {Resource} resource - The resource that caused the error. + */ + + /** + * When a load completes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnLoadSignal + * @param {Loader} loader - The loader that laoded the resource. + * @param {Resource} resource - The resource that has completed loading. + */ + + /** + * When the loader starts loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnStartSignal + * @param {Loader} loader - The loader that has started loading resources. + */ + + /** + * When the loader completes loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnCompleteSignal + * @param {Loader} loader - The loader that has finished loading resources. + */ + + /** + * Options for a call to `.add()`. + * + * @see Loader#add + * + * @typedef {object} IAddOptions + * @property {string} [name] - The name of the resource to load, if not passed the url is used. + * @property {string} [key] - Alias for `name`. + * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. + * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. + * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`. + * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. + */ + + /* eslint-disable require-jsdoc,valid-jsdoc */ + + /** + * Adds a resource (or multiple resources) to the loader queue. + * + * This function can take a wide variety of different parameters. The only thing that is always + * required the url to load. All the following will work: + * + * ```js + * loader + * // normal param syntax + * .add('key', 'http://...', function () {}) + * .add('http://...', function () {}) + * .add('http://...') + * + * // object syntax + * .add({ + * name: 'key2', + * url: 'http://...' + * }, function () {}) + * .add({ + * url: 'http://...' + * }, function () {}) + * .add({ + * name: 'key3', + * url: 'http://...' + * onComplete: function () {} + * }) + * .add({ + * url: 'https://...', + * onComplete: function () {}, + * crossOrigin: true + * }) + * + * // you can also pass an array of objects or urls or both + * .add([ + * { name: 'key4', url: 'http://...', onComplete: function () {} }, + * { url: 'http://...', onComplete: function () {} }, + * 'http://...' + * ]) + * + * // and you can use both params and options + * .add('key', 'http://...', { crossOrigin: true }, function () {}) + * .add('http://...', { crossOrigin: true }, function () {}); + * ``` + * + * @function + * @variation 1 + * @param {string} name - The name of the resource to load. + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 2 + * @param {string} name - The name of the resource to load. + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {IAddOptions} [options] - The options for the load. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 3 + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 4 + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {IAddOptions} [options] - The options for the load. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 5 + * @param {IAddOptions} options - The options for the load. This object must contain a `url` property. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 6 + * @param {Array} resources - An array of resources to load, where each is + * either an object with the options or a string url. If you pass an object, it must contain a `url` property. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + + var _proto = Loader.prototype; + + _proto.add = function add(name, url, options, cb) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + + return this; + } // if an object is passed instead of params + + + if (typeof name === 'object') { + cb = url || name.callback || name.onComplete; + options = name; + url = name.url; + name = name.name || name.key || name.url; + } // case where no name is passed shift all args over by one. + + + if (typeof url !== 'string') { + cb = options; + options = url; + url = name; + } // now that we shifted make sure we have a proper url. + + + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } // options are optional so people might pass a function and no options + + + if (typeof options === 'function') { + cb = options; + options = null; + } // if loading already you can only add resources that have a parent. + + + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } // check if resource already exists. + + + if (this.resources[name]) { + throw new Error("Resource named \"" + name + "\" already exists."); + } // add base url if this isn't an absolute url + + + url = this._prepareUrl(url); // create the store the resource + + this.resources[name] = new Resource$1(name, url, options); + + if (typeof cb === 'function') { + this.resources[name].onAfterMiddleware.once(cb); + } // if actively loading, make sure to adjust progress chunks for that parent and its children + + + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + + for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { + if (!parent.children[_i2].isComplete) { + incompleteChildren.push(parent.children[_i2]); + } + } + + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + + for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { + incompleteChildren[_i3].progressChunk = eachChunk; + } + + this.resources[name].progressChunk = eachChunk; + } // add the resource to the queue + + + this._queue.push(this.resources[name]); + + return this; + } + /* eslint-enable require-jsdoc,valid-jsdoc */ + + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + ; + + _proto.pre = function pre(fn) { + this._beforeMiddleware.push(fn); + + return this; + } + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + ; + + _proto.use = function use(fn) { + this._afterMiddleware.push(fn); + + return this; + } + /** + * Resets the queue of the loader to prepare for a new load. + * + * @return {this} Returns itself. + */ + ; + + _proto.reset = function reset() { + this.progress = 0; + this.loading = false; + + this._queue.kill(); + + this._queue.pause(); // abort all resource loads + + + for (var k in this.resources) { + var res = this.resources[k]; + + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + + if (res.isLoading) { + res.abort(); + } + } + + this.resources = {}; + return this; + } + /** + * Starts loading the queued resources. + * + * @param {function} [cb] - Optional callback that will be bound to the `complete` event. + * @return {this} Returns itself. + */ + ; + + _proto.load = function load(cb) { + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } // if the queue has already started we are done here + + + if (this.loading) { + return this; + } + + if (this._queue.idle()) { + this._onStart(); + + this._onComplete(); + } else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } // notify we are starting + + + this._onStart(); // start loading + + + this._queue.resume(); + } + + return this; + } + /** + * The number of resources to load concurrently. + * + * @member {number} + * @default 10 + */ + ; + + /** + * Prepares a url for usage based on the configuration of this object + * + * @private + * @param {string} url - The url to prepare. + * @return {string} The prepared url. + */ + _proto._prepareUrl = function _prepareUrl(url) { + var parsedUrl = parseUri(url, { + strictMode: true + }); + var result; // absolute url, just use it as is. + + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { + result = this.baseUrl + "/" + url; + } else { + result = this.baseUrl + url; + } // if we need to add a default querystring, there is a bit more work + + + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + result = result.substr(0, result.length - hash.length); + + if (result.indexOf('?') !== -1) { + result += "&" + this.defaultQueryString; + } else { + result += "?" + this.defaultQueryString; + } + + result += hash; + } + + return result; + } + /** + * Loads a single resource. + * + * @private + * @param {Resource} resource - The resource to load. + * @param {function} dequeue - The function to call when we need to dequeue this item. + */ + ; + + _proto._loadResource = function _loadResource(resource, dequeue) { + var _this2 = this; + + resource._dequeue = dequeue; // run before middleware + + eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this2, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this2._onLoad(resource); + } else { + resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); + resource.load(); + } + }, true); + } + /** + * Called once loading has started. + * + * @private + */ + ; + + _proto._onStart = function _onStart() { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + } + /** + * Called once each resource has loaded. + * + * @private + */ + ; + + _proto._onComplete = function _onComplete() { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + } + /** + * Called each time a resources is loaded. + * + * @private + * @param {Resource} resource - The resource that was loaded + */ + ; + + _proto._onLoad = function _onLoad(resource) { + var _this3 = this; + + resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed + + this._resourcesParsing.push(resource); + + resource._dequeue(); // run all the after middleware for this resource + + + eachSeries(this._afterMiddleware, function (fn, next) { + fn.call(_this3, resource, next); + }, function () { + resource.onAfterMiddleware.dispatch(resource); + _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); + + _this3.onProgress.dispatch(_this3, resource); + + if (resource.error) { + _this3.onError.dispatch(resource.error, _this3, resource); + } else { + _this3.onLoad.dispatch(_this3, resource); + } + + _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check + + + if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { + _this3._onComplete(); + } + }, true); + }; + + _createClass(Loader, [{ + key: "concurrency", + get: function get() { + return this._queue.concurrency; + } // eslint-disable-next-line require-jsdoc + , + set: function set(concurrency) { + this._queue.concurrency = concurrency; + } + }]); + + return Loader; + }(); + /** + * A default array of middleware to run before loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + + + Loader._defaultBeforeMiddleware = []; + /** + * A default array of middleware to run after loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + + Loader._defaultAfterMiddleware = []; + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + + Loader.pre = function LoaderPreStatic(fn) { + Loader._defaultBeforeMiddleware.push(fn); + + return Loader; + }; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + + + Loader.use = function LoaderUseStatic(fn) { + Loader._defaultAfterMiddleware.push(fn); + + return Loader; }; - // Mix interactiveTarget into DisplayObject.prototype, - // after deprecation has been handled - DisplayObject.mixin(interactiveTarget); + /*! + * @pixi/loaders - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ - var MOUSE_POINTER_ID = 1; + /** + * Loader plugin for handling Texture resources. + * @class + * @memberof PIXI + * @implements PIXI.ILoaderPlugin + */ + var TextureLoader = function TextureLoader () {}; - // helpers for hitTest() - only used inside hitTest() - var hitTestEvent = { - target: null, - data: { - global: null, - }, + TextureLoader.use = function use (resource, next) + { + // create a new texture if the data is an Image object + if (resource.data && resource.type === Resource$1.TYPE.IMAGE) + { + resource.texture = Texture.fromLoader( + resource.data, + resource.url, + resource.name + ); + } + next(); }; /** - * The interaction manager deals with mouse, touch and pointer events. + * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * - * Any DisplayObject can be interactive if its `interactive` property is set to true. + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * //or + * const loader = new PIXI.Loader(); // you can also create your own if you want * - * This manager also supports multitouch. + * const sprites = {}; * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * + * @see https://github.com/englercj/resource-loader + * + * @class Loader + * @memberof PIXI + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + var Loader$1 = /*@__PURE__*/(function (ResourceLoader) { + function Loader(baseUrl, concurrency) + { + var this$1 = this; + + ResourceLoader.call(this, baseUrl, concurrency); + eventemitter3.call(this); + + for (var i = 0; i < Loader._plugins.length; ++i) + { + var plugin = Loader._plugins[i]; + var pre = plugin.pre; + var use = plugin.use; + + if (pre) + { + this.pre(pre); + } + + if (use) + { + this.use(use); + } + } + + // Compat layer, translate the new v2 signals into old v1 events. + this.onStart.add(function (l) { return this$1.emit('start', l); }); + this.onProgress.add(function (l, r) { return this$1.emit('progress', l, r); }); + this.onError.add(function (e, l, r) { return this$1.emit('error', e, l, r); }); + this.onLoad.add(function (l, r) { return this$1.emit('load', l, r); }); + this.onComplete.add(function (l, r) { return this$1.emit('complete', l, r); }); + + /** + * If this loader cannot be destroyed. + * @member {boolean} + * @default false + * @private + */ + this._protected = false; + } + + if ( ResourceLoader ) { Loader.__proto__ = ResourceLoader; } + Loader.prototype = Object.create( ResourceLoader && ResourceLoader.prototype ); + Loader.prototype.constructor = Loader; + + var staticAccessors = { shared: { configurable: true } }; + + /** + * Destroy the loader, removes references. + * @private + */ + Loader.prototype.destroy = function destroy () + { + if (!this._protected) + { + this.removeAllListeners(); + this.reset(); + } + }; + + /** + * A premade instance of the loader that can be used to load resources. + * @name shared + * @type {PIXI.Loader} + * @static + * @memberof PIXI.Loader + */ + staticAccessors.shared.get = function () + { + var shared = Loader._shared; + + if (!shared) + { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + + return shared; + }; + + Object.defineProperties( Loader, staticAccessors ); + + return Loader; + }(Loader)); + + // Copy EE3 prototype (mixin) + Object.assign(Loader$1.prototype, eventemitter3.prototype); + + /** + * Collection of all installed `use` middleware for Loader. + * + * @static + * @member {Array} _plugins + * @memberof PIXI.Loader + * @private + */ + Loader$1._plugins = []; + + /** + * Adds a Loader plugin for the global shared loader and all + * new Loader instances created. + * + * @static + * @method registerPlugin + * @memberof PIXI.Loader + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add + * @return {PIXI.Loader} Reference to PIXI.Loader for chaining + */ + Loader$1.registerPlugin = function registerPlugin(plugin) + { + Loader$1._plugins.push(plugin); + + if (plugin.add) + { + plugin.add(); + } + + return Loader$1; + }; + + // parse any blob into more usable objects (e.g. Image) + Loader$1.registerPlugin({ use: index$1.parsing }); + + // parse any Image objects into textures + Loader$1.registerPlugin(TextureLoader); + + /** + * Plugin to be installed for handling specific Loader resources. + * + * @memberof PIXI + * @typedef ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the + * arguments for this are `(resource, next)` + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the + * arguments for this are `(resource, next)` + */ + + /** + * @memberof PIXI.Loader + * @callback loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + + /** + * @memberof PIXI.Loader# + * @member {object} onStart + */ + + /** + * @memberof PIXI.Loader# + * @member {object} onProgress + */ + + /** + * @memberof PIXI.Loader# + * @member {object} onError + */ + + /** + * @memberof PIXI.Loader# + * @member {object} onLoad + */ + + /** + * @memberof PIXI.Loader# + * @member {object} onComplete + */ + + /** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ + var AppLoaderPlugin = function AppLoaderPlugin () {}; + + AppLoaderPlugin.init = function init (options) + { + options = Object.assign({ + sharedLoader: false, + }, options); + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); + }; + + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function destroy () + { + if (this.loader) + { + this.loader.destroy(); + this.loader = null; + } + }; + + /** + * Reference to **{@link https://github.com/englercj/resource-loader + * resource-loader}**'s Resource class. + * @see http://englercj.github.io/resource-loader/Resource.html + * @class LoaderResource + * @memberof PIXI + */ + var LoaderResource = Resource$1; + + /*! + * @pixi/particles - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * + * @pixi/particles is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * The ParticleContainer class is a really fast version of the Container built solely for speed, + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) + * and some advanced functionality like tint (as of v4.5.6). + * + * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. + * + * It's extremely easy to use: + * ```js + * let container = new ParticleContainer(); + * + * for (let i = 0; i < 100; ++i) + * { + * let sprite = PIXI.Sprite.from("myImage.png"); + * container.addChild(sprite); + * } + * ``` + * + * And here you have a hundred sprites that will be rendered at the speed of light. * * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI.interaction + * @extends PIXI.Container + * @memberof PIXI */ - var InteractionManager = /*@__PURE__*/(function (EventEmitter) { - function InteractionManager(renderer, options) + var ParticleContainer = /*@__PURE__*/(function (Container) { + function ParticleContainer(maxSize, properties, batchSize, autoResize) { - EventEmitter.call(this); + if ( maxSize === void 0 ) { maxSize = 1500; } + if ( batchSize === void 0 ) { batchSize = 16384; } + if ( autoResize === void 0 ) { autoResize = false; } - options = options || {}; + Container.call(this); + + // Making sure the batch size is valid + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + var maxBatchSize = 16384; + + if (batchSize > maxBatchSize) + { + batchSize = maxBatchSize; + } /** - * The renderer this interaction manager works for. + * Set properties to be dynamic (true) / static (false) * - * @member {PIXI.AbstractRenderer} + * @member {boolean[]} + * @private */ - this.renderer = renderer; + this._properties = [false, true, false, false, false]; /** - * Should default browser actions automatically be prevented. - * Does not apply to pointer events for backwards compatibility - * preventDefault on pointer events stops mouse events from firing - * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. + * @member {number} + * @private + */ + this._maxSize = maxSize; + + /** + * @member {number} + * @private + */ + this._batchSize = batchSize; + + /** + * @member {Array} + * @private + */ + this._buffers = null; + + /** + * for every batch stores _updateID corresponding to the last change in that batch + * @member {number[]} + * @private + */ + this._bufferUpdateIDs = []; + + /** + * when child inserted, removed or changes position this number goes up + * @member {number[]} + * @private + */ + this._updateID = 0; + + /** + * @member {boolean} + * + */ + this.interactiveChildren = false; + + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` + * to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + this.blendMode = exports.BLEND_MODES.NORMAL; + + /** + * If true, container allocates more batches in case there are more than `maxSize` particles. + * @member {boolean} + * @default false + */ + this.autoResize = autoResize; + + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * Default to true here as performance is usually the priority for particles. * * @member {boolean} * @default true */ - this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; + this.roundPixels = true; /** - * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. - * - * @member {number} - * @default 10 - */ - this.interactionFrequency = options.interactionFrequency || 10; - - /** - * The mouse data - * - * @member {PIXI.interaction.InteractionData} - */ - this.mouse = new InteractionData(); - this.mouse.identifier = MOUSE_POINTER_ID; - - // setting the mouse to start off far off screen will mean that mouse over does - // not get called before we even move the mouse. - this.mouse.global.set(-999999); - - /** - * Actively tracked InteractionData - * - * @private - * @member {Object.} - */ - this.activeInteractionData = {}; - this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; - - /** - * Pool of unused InteractionData - * - * @private - * @member {PIXI.interaction.InteractionData[]} - */ - this.interactionDataPool = []; - - /** - * An event data object to handle all the event tracking/dispatching - * - * @member {object} - */ - this.eventData = new InteractionEvent(); - - /** - * The DOM element to bind to. - * - * @protected - * @member {HTMLElement} - */ - this.interactionDOMElement = null; - - /** - * This property determines if mousemove and touchmove events are fired only when the cursor - * is over the object. - * Setting to true will make things work more in line with how the DOM version works. - * Setting to false can make things easier for things like dragging - * It is currently set to false as this is how PixiJS used to work. This will be set to true in - * future versions of pixi. - * - * @member {boolean} - * @default false - */ - this.moveWhenInside = false; - - /** - * Have events been attached to the dom element? - * - * @protected - * @member {boolean} - */ - this.eventsAdded = false; - - /** - * Is the mouse hovering over the renderer? - * - * @protected - * @member {boolean} - */ - this.mouseOverRenderer = false; - - /** - * Does the device support touch events - * https://www.w3.org/TR/touch-events/ + * The texture used to render the children. * * @readonly - * @member {boolean} + * @member {PIXI.BaseTexture} */ - this.supportsTouchEvents = 'ontouchstart' in window; + this.baseTexture = null; + + this.setProperties(properties); /** - * Does the device support pointer events - * https://www.w3.org/Submission/pointer-events/ - * - * @readonly - * @member {boolean} - */ - this.supportsPointerEvents = !!window.PointerEvent; - - // this will make it so that you don't have to call bind all the time - - /** - * @private - * @member {Function} - */ - this.onPointerUp = this.onPointerUp.bind(this); - this.processPointerUp = this.processPointerUp.bind(this); - - /** - * @private - * @member {Function} - */ - this.onPointerCancel = this.onPointerCancel.bind(this); - this.processPointerCancel = this.processPointerCancel.bind(this); - - /** - * @private - * @member {Function} - */ - this.onPointerDown = this.onPointerDown.bind(this); - this.processPointerDown = this.processPointerDown.bind(this); - - /** - * @private - * @member {Function} - */ - this.onPointerMove = this.onPointerMove.bind(this); - this.processPointerMove = this.processPointerMove.bind(this); - - /** - * @private - * @member {Function} - */ - this.onPointerOut = this.onPointerOut.bind(this); - this.processPointerOverOut = this.processPointerOverOut.bind(this); - - /** - * @private - * @member {Function} - */ - this.onPointerOver = this.onPointerOver.bind(this); - - /** - * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor - * values, objects are handled as dictionaries of CSS values for interactionDOMElement, - * and functions are called instead of changing the CSS. - * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.} - */ - this.cursorStyles = { - default: 'inherit', - pointer: 'pointer', - }; - - /** - * The mode of the cursor that is being used. - * The value of this is a key from the cursorStyles dictionary. - * - * @member {string} - */ - this.currentCursorMode = null; - - /** - * Internal cached let. + * The tint applied to the container. + * This is a hex value. A value of 0xFFFFFF will remove any tint effect. * * @private - * @member {string} - */ - this.cursor = null; - - /** - * The current resolution / device pixel ratio. - * * @member {number} - * @default 1 + * @default 0xFFFFFF */ - this.resolution = 1; - - /** - * Delayed pointer events. Used to guarantee correct ordering of over/out events. - * - * @private - * @member {Array} - */ - this.delayedEvents = []; - - /** - * TreeSearch component that is used to hitTest stage tree - * - * @private - * @member {PIXI.interaction.TreeSearch} - */ - this.search = new TreeSearch(); - - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display - * object. - * - * @event PIXI.interaction.InteractionManager#mousedown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. - * - * @event PIXI.interaction.InteractionManager#rightdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. - * - * @event PIXI.interaction.InteractionManager#mouseup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. - * - * @event PIXI.interaction.InteractionManager#rightup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. - * - * @event PIXI.interaction.InteractionManager#click - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. - * - * @event PIXI.interaction.InteractionManager#rightclick - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}. - * - * @event PIXI.interaction.InteractionManager#mouseupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}. - * - * @event PIXI.interaction.InteractionManager#rightupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object - * - * @event PIXI.interaction.InteractionManager#mousemove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object - * - * @event PIXI.interaction.InteractionManager#mouseover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved off the display object - * - * @event PIXI.interaction.InteractionManager#mouseout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is pressed on the display object. - * - * @event PIXI.interaction.InteractionManager#pointerdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is released over the display object. - * Not always fired when some buttons are held down while others are released. In those cases, - * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and - * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead. - * - * @event PIXI.interaction.InteractionManager#pointerup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when the operating system cancels a pointer event - * - * @event PIXI.interaction.InteractionManager#pointercancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is pressed and released on the display object. - * - * @event PIXI.interaction.InteractionManager#pointertap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}. - * - * @event PIXI.interaction.InteractionManager#pointerupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved while over the display object - * - * @event PIXI.interaction.InteractionManager#pointermove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved onto the display object - * - * @event PIXI.interaction.InteractionManager#pointerover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved off the display object - * - * @event PIXI.interaction.InteractionManager#pointerout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is placed on the display object. - * - * @event PIXI.interaction.InteractionManager#touchstart - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is removed from the display object. - * - * @event PIXI.interaction.InteractionManager#touchend - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when the operating system cancels a touch - * - * @event PIXI.interaction.InteractionManager#touchcancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is placed and removed from the display object. - * - * @event PIXI.interaction.InteractionManager#tap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}. - * - * @event PIXI.interaction.InteractionManager#touchendoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is moved along the display object. - * - * @event PIXI.interaction.InteractionManager#touchmove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousedown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#click - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightclick - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousemove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device (usually a mouse) is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is pressed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is released over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when the operating system cancels a pointer event. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointercancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is pressed and released on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointertap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointermove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a pointer device is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is placed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchstart - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchend - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when the operating system cancels a touch. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchcancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is placed and removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#tap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchendoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - /** - * Fired when a touch point is moved along the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchmove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event - */ - - this.setTargetElement(this.renderer.view, this.renderer.resolution); + this._tint = 0; + this.tintRgb = new Float32Array(4); + this.tint = 0xFFFFFF; } - if ( EventEmitter ) { InteractionManager.__proto__ = EventEmitter; } - InteractionManager.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - InteractionManager.prototype.constructor = InteractionManager; + if ( Container ) { ParticleContainer.__proto__ = Container; } + ParticleContainer.prototype = Object.create( Container && Container.prototype ); + ParticleContainer.prototype.constructor = ParticleContainer; + + var prototypeAccessors = { tint: { configurable: true } }; /** - * Hit tests a point against the display tree, returning the first interactive object that is hit. + * Sets the private properties array to dynamic / static based on the passed properties object * - * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. - * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults - * to the last rendered root of the associated renderer. - * @return {PIXI.DisplayObject} The hit display object, if any. + * @param {object} properties - The properties to be uploaded */ - InteractionManager.prototype.hitTest = function hitTest (globalPoint, root) + ParticleContainer.prototype.setProperties = function setProperties (properties) { - // clear the target for our hit test - hitTestEvent.target = null; - // assign the global point - hitTestEvent.data.global = globalPoint; - // ensure safety of the root - if (!root) + if (properties) { - root = this.renderer._lastObjectRendered; + this._properties[0] = 'vertices' in properties || 'scale' in properties + ? !!properties.vertices || !!properties.scale : this._properties[0]; + this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; + this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; + this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; + this._properties[4] = 'tint' in properties || 'alpha' in properties + ? !!properties.tint || !!properties.alpha : this._properties[4]; } - // run the hit test - this.processInteractive(hitTestEvent, root, null, true); - // return our found object - it'll be null if we didn't hit anything - - return hitTestEvent.target; }; /** - * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate - * another DOM element to receive those events. - * - * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. - * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). - */ - InteractionManager.prototype.setTargetElement = function setTargetElement (element, resolution) - { - if ( resolution === void 0 ) { resolution = 1; } - - this.removeEvents(); - - this.interactionDOMElement = element; - - this.resolution = resolution; - - this.addEvents(); - }; - - /** - * Registers all the DOM events + * Updates the object transform for rendering * * @private */ - InteractionManager.prototype.addEvents = function addEvents () + ParticleContainer.prototype.updateTransform = function updateTransform () { - if (!this.interactionDOMElement) + // TODO don't need to! + this.displayObjectUpdateTransform(); + // PIXI.Container.prototype.updateTransform.call( this ); + }; + + /** + * The tint applied to the container. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. + * @member {number} + * @default 0xFFFFFF + */ + prototypeAccessors.tint.get = function () + { + return this._tint; + }; + + prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc + { + this._tint = value; + hex2rgb(value, this.tintRgb); + }; + + /** + * Renders the container using the WebGL renderer + * + * @private + * @param {PIXI.Renderer} renderer - The webgl renderer + */ + ParticleContainer.prototype.render = function render (renderer) + { + var this$1 = this; + + if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { return; } - Ticker.system.add(this.update, this, exports.UPDATE_PRIORITY.INTERACTION); + if (!this.baseTexture) + { + this.baseTexture = this.children[0]._texture.baseTexture; + if (!this.baseTexture.valid) + { + this.baseTexture.once('update', function () { return this$1.onChildrenChange(0); }); + } + } - if (window.navigator.msPointerEnabled) + renderer.batch.setObjectRenderer(renderer.plugins.particle); + renderer.plugins.particle.render(this); + }; + + /** + * Set the flag that static data should be updated to true + * + * @private + * @param {number} smallestChildIndex - The smallest child index + */ + ParticleContainer.prototype.onChildrenChange = function onChildrenChange (smallestChildIndex) + { + var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); + + while (this._bufferUpdateIDs.length < bufferIndex) { - this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; - this.interactionDOMElement.style['-ms-touch-action'] = 'none'; + this._bufferUpdateIDs.push(0); } - else if (this.supportsPointerEvents) + this._bufferUpdateIDs[bufferIndex] = ++this._updateID; + }; + + ParticleContainer.prototype.dispose = function dispose () + { + if (this._buffers) { - this.interactionDOMElement.style['touch-action'] = 'none'; + for (var i = 0; i < this._buffers.length; ++i) + { + this._buffers[i].destroy(); + } + + this._buffers = null; } + }; + + /** + * Destroys the container + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their + * destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + ParticleContainer.prototype.destroy = function destroy (options) + { + Container.prototype.destroy.call(this, options); + + this.dispose(); + + this._properties = null; + this._buffers = null; + this._bufferUpdateIDs = null; + }; + + Object.defineProperties( ParticleContainer.prototype, prototypeAccessors ); + + return ParticleContainer; + }(Container)); + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that + * they now share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleBuffer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java + */ + + /** + * The particle buffer manages the static and dynamic buffers for a particle container. + * + * @class + * @private + * @memberof PIXI + */ + var ParticleBuffer = function ParticleBuffer(properties, dynamicPropertyFlags, size) + { + this.geometry = new Geometry(); + + this.indexBuffer = null; + + /** + * The number of particles the buffer can hold + * + * @private + * @member {number} + */ + this.size = size; + + /** + * A list of the properties that are dynamic. + * + * @private + * @member {object[]} + */ + this.dynamicProperties = []; + + /** + * A list of the properties that are static. + * + * @private + * @member {object[]} + */ + this.staticProperties = []; + + for (var i = 0; i < properties.length; ++i) + { + var property = properties[i]; + + // Make copy of properties object so that when we edit the offset it doesn't + // change all other instances of the object literal + property = { + attributeName: property.attributeName, + size: property.size, + uploadFunction: property.uploadFunction, + type: property.type || exports.TYPES.FLOAT, + offset: property.offset, + }; + + if (dynamicPropertyFlags[i]) + { + this.dynamicProperties.push(property); + } + else + { + this.staticProperties.push(property); + } + } + + this.staticStride = 0; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + + this.dynamicStride = 0; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + + this._updateID = 0; + + this.initBuffers(); + }; + + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + ParticleBuffer.prototype.initBuffers = function initBuffers () + { + var geometry = this.geometry; + + var dynamicOffset = 0; + + /** + * Holds the indices of the geometry (quads) to draw + * + * @member {Uint16Array} + * @private + */ + this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); + geometry.addIndex(this.indexBuffer); + + this.dynamicStride = 0; + + for (var i = 0; i < this.dynamicProperties.length; ++i) + { + var property = this.dynamicProperties[i]; + + property.offset = dynamicOffset; + dynamicOffset += property.size; + this.dynamicStride += property.size; + } + + var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); + + this.dynamicData = new Float32Array(dynBuffer); + this.dynamicDataUint32 = new Uint32Array(dynBuffer); + this.dynamicBuffer = new Buffer(this.dynamicData, false, false); + + // static // + var staticOffset = 0; + + this.staticStride = 0; + + for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1) + { + var property$1 = this.staticProperties[i$1]; + + property$1.offset = staticOffset; + staticOffset += property$1.size; + this.staticStride += property$1.size; + } + + var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); + + this.staticData = new Float32Array(statBuffer); + this.staticDataUint32 = new Uint32Array(statBuffer); + this.staticBuffer = new Buffer(this.staticData, true, false); + + for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2) + { + var property$2 = this.dynamicProperties[i$2]; + + geometry.addAttribute( + property$2.attributeName, + this.dynamicBuffer, + 0, + property$2.type === exports.TYPES.UNSIGNED_BYTE, + property$2.type, + this.dynamicStride * 4, + property$2.offset * 4 + ); + } + + for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3) + { + var property$3 = this.staticProperties[i$3]; + + geometry.addAttribute( + property$3.attributeName, + this.staticBuffer, + 0, + property$3.type === exports.TYPES.UNSIGNED_BYTE, + property$3.type, + this.staticStride * 4, + property$3.offset * 4 + ); + } + }; + + /** + * Uploads the dynamic properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadDynamic = function uploadDynamic (children, startIndex, amount) + { + for (var i = 0; i < this.dynamicProperties.length; i++) + { + var property = this.dynamicProperties[i]; + + property.uploadFunction(children, startIndex, amount, + property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, + this.dynamicStride, property.offset); + } + + this.dynamicBuffer._updateID++; + }; + + /** + * Uploads the static properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadStatic = function uploadStatic (children, startIndex, amount) + { + for (var i = 0; i < this.staticProperties.length; i++) + { + var property = this.staticProperties[i]; + + property.uploadFunction(children, startIndex, amount, + property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, + this.staticStride, property.offset); + } + + this.staticBuffer._updateID++; + }; + + /** + * Destroys the ParticleBuffer. + * + * @private + */ + ParticleBuffer.prototype.destroy = function destroy () + { + this.indexBuffer = null; + + this.dynamicProperties = null; + // this.dynamicBuffer.destroy(); + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + + this.staticProperties = null; + // this.staticBuffer.destroy(); + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + // all buffers are destroyed inside geometry + this.geometry.destroy(); + }; + + var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; + + var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now + * share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleRenderer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java + */ + + /** + * Renderer for Particles that is designer for speed over feature set. + * + * @class + * @memberof PIXI + */ + var ParticleRenderer = /*@__PURE__*/(function (ObjectRenderer) { + function ParticleRenderer(renderer) + { + ObjectRenderer.call(this, renderer); + + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + // and max number of element in the index buffer is 16384 * 6 = 98304 + // Creating a full index buffer, overhead is 98304 * 2 = 196Ko + // let numIndices = 98304; /** - * These events are added first, so that if pointer events are normalized, they are fired - * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd + * The default shader that is used if a sprite doesn't have a more specific one. + * + * @member {PIXI.Shader} */ - if (this.supportsPointerEvents) - { - window.document.addEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); - // pointerout is fired in addition to pointerup (for touch events) and pointercancel - // we already handle those, so for the purposes of what we do in onPointerOut, we only - // care about the pointerleave event - this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); - window.addEventListener('pointercancel', this.onPointerCancel, true); - window.addEventListener('pointerup', this.onPointerUp, true); - } - else - { - window.document.addEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); - window.addEventListener('mouseup', this.onPointerUp, true); - } + this.shader = null; - // always look directly for touch events so that we can provide original data - // In a future version we should change this to being just a fallback and rely solely on - // PointerEvents whenever available - if (this.supportsTouchEvents) - { - this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); - } + this.properties = null; - this.eventsAdded = true; - }; + this.tempMatrix = new Matrix(); - /** - * Removes all the DOM events that were previously registered - * - * @private - */ - InteractionManager.prototype.removeEvents = function removeEvents () - { - if (!this.interactionDOMElement) - { - return; - } - - Ticker.system.remove(this.update, this); - - if (window.navigator.msPointerEnabled) - { - this.interactionDOMElement.style['-ms-content-zooming'] = ''; - this.interactionDOMElement.style['-ms-touch-action'] = ''; - } - else if (this.supportsPointerEvents) - { - this.interactionDOMElement.style['touch-action'] = ''; - } - - if (this.supportsPointerEvents) - { - window.document.removeEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); - window.removeEventListener('pointercancel', this.onPointerCancel, true); - window.removeEventListener('pointerup', this.onPointerUp, true); - } - else - { - window.document.removeEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); - window.removeEventListener('mouseup', this.onPointerUp, true); - } - - if (this.supportsTouchEvents) - { - this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); - } - - this.interactionDOMElement = null; - - this.eventsAdded = false; - }; - - /** - * Updates the state of interactive objects. - * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}. - * - * @param {number} deltaTime - time delta since last tick - */ - InteractionManager.prototype.update = function update (deltaTime) - { - this._deltaTime += deltaTime; - - if (this._deltaTime < this.interactionFrequency) - { - return; - } - - this._deltaTime = 0; - - if (!this.interactionDOMElement) - { - return; - } - - // if the user move the mouse this check has already been done using the mouse move! - if (this.didMove) - { - this.didMove = false; - - return; - } - - this.cursor = null; - - // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, - // but there was a scenario of a display object moving under a static mouse cursor. - // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function - for (var k in this.activeInteractionData) - { - // eslint-disable-next-line no-prototype-builtins - if (this.activeInteractionData.hasOwnProperty(k)) + this.properties = [ + // verticesData { - var interactionData = this.activeInteractionData[k]; - - if (interactionData.originalEvent && interactionData.pointerType !== 'touch') - { - var interactionEvent = this.configureInteractionEventForDOMEvent( - this.eventData, - interactionData.originalEvent, - interactionData - ); - - this.processInteractive( - interactionEvent, - this.renderer._lastObjectRendered, - this.processPointerOverOut, - true - ); - } - } - } - - this.setCursorMode(this.cursor); - }; - - /** - * Sets the current cursor mode, handling any callbacks or CSS style changes. - * - * @param {string} mode - cursor mode, a key from the cursorStyles dictionary - */ - InteractionManager.prototype.setCursorMode = function setCursorMode (mode) - { - mode = mode || 'default'; - // if the mode didn't actually change, bail early - if (this.currentCursorMode === mode) - { - return; - } - this.currentCursorMode = mode; - var style = this.cursorStyles[mode]; - - // only do things if there is a cursor style for it - if (style) - { - switch (typeof style) + attributeName: 'aVertexPosition', + size: 2, + uploadFunction: this.uploadVertices, + offset: 0, + }, + // positionData { - case 'string': - // string styles are handled as cursor CSS - this.interactionDOMElement.style.cursor = style; - break; - case 'function': - // functions are just called, and passed the cursor mode - style(mode); - break; - case 'object': - // if it is an object, assume that it is a dictionary of CSS styles, - // apply it to the interactionDOMElement - Object.assign(this.interactionDOMElement.style, style); - break; - } - } - else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) - { - // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry - // for the mode, then assume that the dev wants it to be CSS for the cursor. - this.interactionDOMElement.style.cursor = mode; - } - }; - - /** - * Dispatches an event on the display object that was interacted with - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {object} eventData - the event data object - * @private - */ - InteractionManager.prototype.dispatchEvent = function dispatchEvent (displayObject, eventString, eventData) - { - // Even if the event was stopped, at least dispatch any remaining events - // for the same display object. - if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) - { - eventData.currentTarget = displayObject; - eventData.type = eventString; - - displayObject.emit(eventString, eventData); - - if (displayObject[eventString]) + attributeName: 'aPositionCoord', + size: 2, + uploadFunction: this.uploadPosition, + offset: 0, + }, + // rotationData { - displayObject[eventString](eventData); - } - } - }; - - /** - * Puts a event on a queue to be dispatched later. This is used to guarantee correct - * ordering of over/out events. - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {object} eventData - the event data object - * @private - */ - InteractionManager.prototype.delayDispatchEvent = function delayDispatchEvent (displayObject, eventString, eventData) - { - this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); - }; - - /** - * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The - * resulting value is stored in the point. This takes into account the fact that the DOM - * element could be scaled and positioned anywhere on the screen. - * - * @param {PIXI.Point} point - the point that the result will be stored in - * @param {number} x - the x coord of the position to map - * @param {number} y - the y coord of the position to map - */ - InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint (point, x, y) - { - var rect; - - // IE 11 fix - if (!this.interactionDOMElement.parentElement) - { - rect = { x: 0, y: 0, width: 0, height: 0 }; - } - else - { - rect = this.interactionDOMElement.getBoundingClientRect(); - } - - var resolutionMultiplier = 1.0 / this.resolution; - - point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; - point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; - }; - - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @protected - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - indicates whether we want to calculate hits - * or just iterate through all interactive objects - */ - InteractionManager.prototype.processInteractive = function processInteractive (interactionEvent, displayObject, func, hitTest) - { - var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); - - var delayedEvents = this.delayedEvents; - - if (!delayedEvents.length) - { - return hit; - } - // Reset the propagation hint, because we start deeper in the tree again. - interactionEvent.stopPropagationHint = false; - - var delayedLen = delayedEvents.length; - - this.delayedEvents = []; - - for (var i = 0; i < delayedLen; i++) - { - var ref = delayedEvents[i]; - var displayObject$1 = ref.displayObject; - var eventString = ref.eventString; - var eventData = ref.eventData; - - // When we reach the object we wanted to stop propagating at, - // set the propagation hint. - if (eventData.stopsPropagatingAt === displayObject$1) + attributeName: 'aRotation', + size: 1, + uploadFunction: this.uploadRotation, + offset: 0, + }, + // uvsData { - eventData.stopPropagationHint = true; - } + attributeName: 'aTextureCoord', + size: 2, + uploadFunction: this.uploadUvs, + offset: 0, + }, + // tintData + { + attributeName: 'aColor', + size: 1, + type: exports.TYPES.UNSIGNED_BYTE, + uploadFunction: this.uploadTint, + offset: 0, + } ]; - this.dispatchEvent(displayObject$1, eventString, eventData); - } - - return hit; - }; - - /** - * Is called when the pointer button is pressed down on the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down - */ - InteractionManager.prototype.onPointerDown = function onPointerDown (originalEvent) - { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - - var events = this.normalizeToPointerData(originalEvent); + this.shader = Shader.from(vertex$1, fragment$1, {}); /** - * No need to prevent default on natural pointer events, as there are no side effects - * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, - * so still need to be prevented. + * The WebGL state in which this renderer will work. + * + * @member {PIXI.State} + * @readonly */ + this.state = State.for2d(); + } - // Guaranteed that there will be at least one event in events, and all events must have the same pointer type + if ( ObjectRenderer ) { ParticleRenderer.__proto__ = ObjectRenderer; } + ParticleRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype ); + ParticleRenderer.prototype.constructor = ParticleRenderer; - if (this.autoPreventDefault && events[0].isNormalized) + /** + * Renders the particle container object. + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + */ + ParticleRenderer.prototype.render = function render (container) + { + var children = container.children; + var maxSize = container._maxSize; + var batchSize = container._batchSize; + var renderer = this.renderer; + var totalChildren = children.length; + + if (totalChildren === 0) { - var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); - - if (cancelable) - { - originalEvent.preventDefault(); - } + return; + } + else if (totalChildren > maxSize && !container.autoResize) + { + totalChildren = maxSize; } - var eventLen = events.length; + var buffers = container._buffers; - for (var i = 0; i < eventLen; i++) + if (!buffers) { - var event = events[i]; + buffers = container._buffers = this.generateBuffers(container); + } - var interactionData = this.getInteractionDataForPointerId(event); + var baseTexture = children[0]._texture.baseTexture; - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + // if the uvs have not updated then no point rendering just yet! + this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); + renderer.state.set(this.state); - interactionEvent.data.originalEvent = originalEvent; + var gl = renderer.gl; - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true); + var m = container.worldTransform.copyTo(this.tempMatrix); - this.emit('pointerdown', interactionEvent); - if (event.pointerType === 'touch') + m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); + + this.shader.uniforms.translationMatrix = m.toArray(true); + + this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, + container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); + + this.shader.uniforms.uSampler = baseTexture; + + this.renderer.shader.bind(this.shader); + + var updateStatic = false; + + // now lets upload and render the buffers.. + for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) + { + var amount = (totalChildren - i); + + if (amount > batchSize) { - this.emit('touchstart', interactionEvent); + amount = batchSize; } - // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event - else if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { - var isRightButton = event.button === 2; - this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); + if (j >= buffers.length) + { + buffers.push(this._generateOneMoreBuffer(container)); } + + var buffer = buffers[j]; + + // we always upload the dynamic + buffer.uploadDynamic(children, i, amount); + + var bid = container._bufferUpdateIDs[j] || 0; + + updateStatic = updateStatic || (buffer._updateID < bid); + // we only upload the static content when we have to! + if (updateStatic) + { + buffer._updateID = container._updateID; + buffer.uploadStatic(children, i, amount); + } + + // bind the buffer + renderer.geometry.bind(buffer.geometry); + gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); } }; /** - * Processes the result of the pointer down check and dispatches the event if need be + * Creates one particle buffer for each child in the container we want to render and updates internal properties * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer[]} The buffers * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object */ - InteractionManager.prototype.processPointerDown = function processPointerDown (interactionEvent, displayObject, hit) + ParticleRenderer.prototype.generateBuffers = function generateBuffers (container) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; + var buffers = []; + var size = container._maxSize; + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; - if (hit) + for (var i = 0; i < size; i += batchSize) { - if (!displayObject.trackedPointers[id]) - { - displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); - - if (data.pointerType === 'touch') - { - this.dispatchEvent(displayObject, 'touchstart', interactionEvent); - } - else if (data.pointerType === 'mouse' || data.pointerType === 'pen') - { - var isRightButton = data.button === 2; - - if (isRightButton) - { - displayObject.trackedPointers[id].rightDown = true; - } - else - { - displayObject.trackedPointers[id].leftDown = true; - } - - this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); - } + buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); } + + return buffers; }; /** - * Is called when the pointer button is released on the renderer element + * Creates one more particle buffer, because container has autoResize feature * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer} generated buffer * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released - * @param {boolean} cancelled - true if the pointer is cancelled - * @param {Function} func - Function passed to {@link processInteractive} */ - InteractionManager.prototype.onPointerComplete = function onPointerComplete (originalEvent, cancelled, func) + ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer (container) { - var events = this.normalizeToPointerData(originalEvent); + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; - var eventLen = events.length; + return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); + }; - // if the event wasn't targeting our canvas, then consider it to be pointerupoutside - // in all cases (unless it was a pointercancel) - var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; + /** + * Uploads the vertices. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their vertices uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadVertices = function uploadVertices (children, startIndex, amount, array, stride, offset) + { + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; - for (var i = 0; i < eventLen; i++) + for (var i = 0; i < amount; ++i) { - var event = events[i]; + var sprite = children[startIndex + i]; + var texture = sprite._texture; + var sx = sprite.scale.x; + var sy = sprite.scale.y; + var trim = texture.trim; + var orig = texture.orig; - var interactionData = this.getInteractionDataForPointerId(event); - - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - - interactionEvent.data.originalEvent = originalEvent; - - // perform hit testing for events targeting our canvas or cancel events - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend); - - this.emit(cancelled ? 'pointercancel' : ("pointerup" + eventAppend), interactionEvent); - - if (event.pointerType === 'mouse' || event.pointerType === 'pen') + if (trim) { - var isRightButton = event.button === 2; + // if the sprite is trimmed and is not a tilingsprite then we need to add the + // extra space before transforming the sprite coords.. + w1 = trim.x - (sprite.anchor.x * orig.width); + w0 = w1 + trim.width; - this.emit(isRightButton ? ("rightup" + eventAppend) : ("mouseup" + eventAppend), interactionEvent); + h1 = trim.y - (sprite.anchor.y * orig.height); + h0 = h1 + trim.height; } - else if (event.pointerType === 'touch') + else { - this.emit(cancelled ? 'touchcancel' : ("touchend" + eventAppend), interactionEvent); - this.releaseInteractionDataForPointerId(event.pointerId, interactionData); + w0 = (orig.width) * (1 - sprite.anchor.x); + w1 = (orig.width) * -sprite.anchor.x; + + h0 = orig.height * (1 - sprite.anchor.y); + h1 = orig.height * -sprite.anchor.y; + } + + array[offset] = w1 * sx; + array[offset + 1] = h1 * sy; + + array[offset + stride] = w0 * sx; + array[offset + stride + 1] = h1 * sy; + + array[offset + (stride * 2)] = w0 * sx; + array[offset + (stride * 2) + 1] = h0 * sy; + + array[offset + (stride * 3)] = w1 * sx; + array[offset + (stride * 3) + 1] = h0 * sy; + + offset += stride * 4; + } + }; + + /** + * Uploads the position. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their positions uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadPosition = function uploadPosition (children, startIndex, amount, array, stride, offset) + { + for (var i = 0; i < amount; i++) + { + var spritePosition = children[startIndex + i].position; + + array[offset] = spritePosition.x; + array[offset + 1] = spritePosition.y; + + array[offset + stride] = spritePosition.x; + array[offset + stride + 1] = spritePosition.y; + + array[offset + (stride * 2)] = spritePosition.x; + array[offset + (stride * 2) + 1] = spritePosition.y; + + array[offset + (stride * 3)] = spritePosition.x; + array[offset + (stride * 3) + 1] = spritePosition.y; + + offset += stride * 4; + } + }; + + /** + * Uploads the rotiation. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadRotation = function uploadRotation (children, startIndex, amount, array, stride, offset) + { + for (var i = 0; i < amount; i++) + { + var spriteRotation = children[startIndex + i].rotation; + + array[offset] = spriteRotation; + array[offset + stride] = spriteRotation; + array[offset + (stride * 2)] = spriteRotation; + array[offset + (stride * 3)] = spriteRotation; + + offset += stride * 4; + } + }; + + /** + * Uploads the Uvs + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadUvs = function uploadUvs (children, startIndex, amount, array, stride, offset) + { + for (var i = 0; i < amount; ++i) + { + var textureUvs = children[startIndex + i]._texture._uvs; + + if (textureUvs) + { + array[offset] = textureUvs.x0; + array[offset + 1] = textureUvs.y0; + + array[offset + stride] = textureUvs.x1; + array[offset + stride + 1] = textureUvs.y1; + + array[offset + (stride * 2)] = textureUvs.x2; + array[offset + (stride * 2) + 1] = textureUvs.y2; + + array[offset + (stride * 3)] = textureUvs.x3; + array[offset + (stride * 3) + 1] = textureUvs.y3; + + offset += stride * 4; + } + else + { + // TODO you know this can be easier! + array[offset] = 0; + array[offset + 1] = 0; + + array[offset + stride] = 0; + array[offset + stride + 1] = 0; + + array[offset + (stride * 2)] = 0; + array[offset + (stride * 2) + 1] = 0; + + array[offset + (stride * 3)] = 0; + array[offset + (stride * 3) + 1] = 0; + + offset += stride * 4; } } }; /** - * Is called when the pointer button is cancelled + * Uploads the tint. * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. */ - InteractionManager.prototype.onPointerCancel = function onPointerCancel (event) + ParticleRenderer.prototype.uploadTint = function uploadTint (children, startIndex, amount, array, stride, offset) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } - - this.onPointerComplete(event, true, this.processPointerCancel); - }; - - /** - * Processes the result of the pointer cancel check and dispatches the event if need be - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - */ - InteractionManager.prototype.processPointerCancel = function processPointerCancel (interactionEvent, displayObject) - { - var data = interactionEvent.data; - - var id = interactionEvent.data.identifier; - - if (displayObject.trackedPointers[id] !== undefined) + for (var i = 0; i < amount; ++i) { - delete displayObject.trackedPointers[id]; - this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); + var sprite = children[startIndex + i]; + var premultiplied = sprite._texture.baseTexture.alphaMode > 0; + var alpha = sprite.alpha; + // we dont call extra function if alpha is 1.0, that's faster + var argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) + : sprite._tintRGB + (alpha * 255 << 24); - if (data.pointerType === 'touch') - { - this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); - } + array[offset] = argb; + array[offset + stride] = argb; + array[offset + (stride * 2)] = argb; + array[offset + (stride * 3)] = argb; + + offset += stride * 4; } }; /** - * Is called when the pointer button is released on the renderer element - * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released + * Destroys the ParticleRenderer. */ - InteractionManager.prototype.onPointerUp = function onPointerUp (event) + ParticleRenderer.prototype.destroy = function destroy () { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } + ObjectRenderer.prototype.destroy.call(this); - this.onPointerComplete(event, false, this.processPointerUp); + if (this.shader) + { + this.shader.destroy(); + this.shader = null; + } + + this.tempMatrix = null; }; - /** - * Processes the result of the pointer up check and dispatches the event if need be - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerUp = function processPointerUp (interactionEvent, displayObject, hit) - { - var data = interactionEvent.data; - - var id = interactionEvent.data.identifier; - - var trackingData = displayObject.trackedPointers[id]; - - var isTouch = data.pointerType === 'touch'; - - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - // need to track mouse down status in the mouse block so that we can emit - // event in a later block - var isMouseTap = false; - - // Mouse only - if (isMouse) - { - var isRightButton = data.button === 2; - - var flags = InteractionTrackingData.FLAGS; - - var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; - - var isDown = trackingData !== undefined && (trackingData.flags & test); - - if (hit) - { - this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); - - if (isDown) - { - this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); - // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap - isMouseTap = true; - } - } - else if (isDown) - { - this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); - } - // update the down state of the tracking data - if (trackingData) - { - if (isRightButton) - { - trackingData.rightDown = false; - } - else - { - trackingData.leftDown = false; - } - } - } - - // Pointers and Touches, and Mouse - if (hit) - { - this.dispatchEvent(displayObject, 'pointerup', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } - - if (trackingData) - { - // emit pointertap if not a mouse, or if the mouse block decided it was a tap - if (!isMouse || isMouseTap) - { - this.dispatchEvent(displayObject, 'pointertap', interactionEvent); - } - if (isTouch) - { - this.dispatchEvent(displayObject, 'tap', interactionEvent); - // touches are no longer over (if they ever were) when we get the touchend - // so we should ensure that we don't keep pretending that they are - trackingData.over = false; - } - } - } - else if (trackingData) - { - this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } - } - // Only remove the tracking data if there is no over/down state still associated with it - if (trackingData && trackingData.none) - { - delete displayObject.trackedPointers[id]; - } - }; - - /** - * Is called when the pointer moves across the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer moving - */ - InteractionManager.prototype.onPointerMove = function onPointerMove (originalEvent) - { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - - var events = this.normalizeToPointerData(originalEvent); - - if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') - { - this.didMove = true; - - this.cursor = null; - } - - var eventLen = events.length; - - for (var i = 0; i < eventLen; i++) - { - var event = events[i]; - - var interactionData = this.getInteractionDataForPointerId(event); - - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - - interactionEvent.data.originalEvent = originalEvent; - - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, true); - - this.emit('pointermove', interactionEvent); - if (event.pointerType === 'touch') { this.emit('touchmove', interactionEvent); } - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mousemove', interactionEvent); } - } - - if (events[0].pointerType === 'mouse') - { - this.setCursorMode(this.cursor); - - // TODO BUG for parents interactive object (border order issue) - } - }; - - /** - * Processes the result of the pointer move check and dispatches the event if need be - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerMove = function processPointerMove (interactionEvent, displayObject, hit) - { - var data = interactionEvent.data; - - var isTouch = data.pointerType === 'touch'; - - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - - if (isMouse) - { - this.processPointerOverOut(interactionEvent, displayObject, hit); - } - - if (!this.moveWhenInside || hit) - { - this.dispatchEvent(displayObject, 'pointermove', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } - if (isMouse) { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } - } - }; - - /** - * Is called when the pointer is moved out of the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out - */ - InteractionManager.prototype.onPointerOut = function onPointerOut (originalEvent) - { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - - var events = this.normalizeToPointerData(originalEvent); - - // Only mouse and pointer can call onPointerOut, so events will always be length 1 - var event = events[0]; - - if (event.pointerType === 'mouse') - { - this.mouseOverRenderer = false; - this.setCursorMode(null); - } - - var interactionData = this.getInteractionDataForPointerId(event); - - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - - interactionEvent.data.originalEvent = event; - - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false); - - this.emit('pointerout', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { - this.emit('mouseout', interactionEvent); - } - else - { - // we can get touchleave events after touchend, so we want to make sure we don't - // introduce memory leaks - this.releaseInteractionDataForPointerId(interactionData.identifier); - } - }; - - /** - * Processes the result of the pointer over/out check and dispatches the event if need be - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerOverOut = function processPointerOverOut (interactionEvent, displayObject, hit) - { - var data = interactionEvent.data; - - var id = interactionEvent.data.identifier; - - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - - var trackingData = displayObject.trackedPointers[id]; - - // if we just moused over the display object, then we need to track that state - if (hit && !trackingData) - { - trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - - if (trackingData === undefined) { return; } - - if (hit && this.mouseOverRenderer) - { - if (!trackingData.over) - { - trackingData.over = true; - this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); - if (isMouse) - { - this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); - } - } - - // only change the cursor if it has not already been changed (by something deeper in the - // display tree) - if (isMouse && this.cursor === null) - { - this.cursor = displayObject.cursor; - } - } - else if (trackingData.over) - { - trackingData.over = false; - this.dispatchEvent(displayObject, 'pointerout', this.eventData); - if (isMouse) - { - this.dispatchEvent(displayObject, 'mouseout', interactionEvent); - } - // if there is no mouse down information for the pointer, then it is safe to delete - if (trackingData.none) - { - delete displayObject.trackedPointers[id]; - } - } - }; - - /** - * Is called when the pointer is moved into the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view - */ - InteractionManager.prototype.onPointerOver = function onPointerOver (originalEvent) - { - var events = this.normalizeToPointerData(originalEvent); - - // Only mouse and pointer can call onPointerOver, so events will always be length 1 - var event = events[0]; - - var interactionData = this.getInteractionDataForPointerId(event); - - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - - interactionEvent.data.originalEvent = event; - - if (event.pointerType === 'mouse') - { - this.mouseOverRenderer = true; - } - - this.emit('pointerover', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { - this.emit('mouseover', interactionEvent); - } - }; - - /** - * Get InteractionData for a given pointerId. Store that data as well - * - * @private - * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData - * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier - */ - InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId (event) - { - var pointerId = event.pointerId; - - var interactionData; - - if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') - { - interactionData = this.mouse; - } - else if (this.activeInteractionData[pointerId]) - { - interactionData = this.activeInteractionData[pointerId]; - } - else - { - interactionData = this.interactionDataPool.pop() || new InteractionData(); - interactionData.identifier = pointerId; - this.activeInteractionData[pointerId] = interactionData; - } - // copy properties from the event, so that we can make sure that touch/pointer specific - // data is available - interactionData.copyEvent(event); - - return interactionData; - }; - - /** - * Return unused InteractionData to the pool, for a given pointerId - * - * @private - * @param {number} pointerId - Identifier from a pointer event - */ - InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId (pointerId) - { - var interactionData = this.activeInteractionData[pointerId]; - - if (interactionData) - { - delete this.activeInteractionData[pointerId]; - interactionData.reset(); - this.interactionDataPool.push(interactionData); - } - }; - - /** - * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured - * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent - * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired - * with the InteractionEvent - * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in - */ - InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent (interactionEvent, pointerEvent, interactionData) - { - interactionEvent.data = interactionData; - - this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); - - // Not really sure why this is happening, but it's how a previous version handled things - if (pointerEvent.pointerType === 'touch') - { - pointerEvent.globalX = interactionData.global.x; - pointerEvent.globalY = interactionData.global.y; - } - - interactionData.originalEvent = pointerEvent; - interactionEvent.reset(); - - return interactionEvent; - }; - - /** - * Ensures that the original event object contains all data that a regular pointer event would have - * - * @private - * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event - * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer - * or mouse event, or a multiple normalized pointer events if there are multiple changed touches - */ - InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData (event) - { - var normalizedEvents = []; - - if (this.supportsTouchEvents && event instanceof TouchEvent) - { - for (var i = 0, li = event.changedTouches.length; i < li; i++) - { - var touch = event.changedTouches[i]; - - if (typeof touch.button === 'undefined') { touch.button = event.touches.length ? 1 : 0; } - if (typeof touch.buttons === 'undefined') { touch.buttons = event.touches.length ? 1 : 0; } - if (typeof touch.isPrimary === 'undefined') - { - touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; - } - if (typeof touch.width === 'undefined') { touch.width = touch.radiusX || 1; } - if (typeof touch.height === 'undefined') { touch.height = touch.radiusY || 1; } - if (typeof touch.tiltX === 'undefined') { touch.tiltX = 0; } - if (typeof touch.tiltY === 'undefined') { touch.tiltY = 0; } - if (typeof touch.pointerType === 'undefined') { touch.pointerType = 'touch'; } - if (typeof touch.pointerId === 'undefined') { touch.pointerId = touch.identifier || 0; } - if (typeof touch.pressure === 'undefined') { touch.pressure = touch.force || 0.5; } - if (typeof touch.twist === 'undefined') { touch.twist = 0; } - if (typeof touch.tangentialPressure === 'undefined') { touch.tangentialPressure = 0; } - // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven - // support, and the fill ins are not quite the same - // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top - // left is not 0,0 on the page - if (typeof touch.layerX === 'undefined') { touch.layerX = touch.offsetX = touch.clientX; } - if (typeof touch.layerY === 'undefined') { touch.layerY = touch.offsetY = touch.clientY; } - - // mark the touch as normalized, just so that we know we did it - touch.isNormalized = true; - - normalizedEvents.push(touch); - } - } - // apparently PointerEvent subclasses MouseEvent, so yay - else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) - { - if (typeof event.isPrimary === 'undefined') { event.isPrimary = true; } - if (typeof event.width === 'undefined') { event.width = 1; } - if (typeof event.height === 'undefined') { event.height = 1; } - if (typeof event.tiltX === 'undefined') { event.tiltX = 0; } - if (typeof event.tiltY === 'undefined') { event.tiltY = 0; } - if (typeof event.pointerType === 'undefined') { event.pointerType = 'mouse'; } - if (typeof event.pointerId === 'undefined') { event.pointerId = MOUSE_POINTER_ID; } - if (typeof event.pressure === 'undefined') { event.pressure = 0.5; } - if (typeof event.twist === 'undefined') { event.twist = 0; } - if (typeof event.tangentialPressure === 'undefined') { event.tangentialPressure = 0; } - - // mark the mouse event as normalized, just so that we know we did it - event.isNormalized = true; - - normalizedEvents.push(event); - } - else - { - normalizedEvents.push(event); - } - - return normalizedEvents; - }; - - /** - * Destroys the interaction manager - * - */ - InteractionManager.prototype.destroy = function destroy () - { - this.removeEvents(); - - this.removeAllListeners(); - - this.renderer = null; - - this.mouse = null; - - this.eventData = null; - - this.interactionDOMElement = null; - - this.onPointerDown = null; - this.processPointerDown = null; - - this.onPointerUp = null; - this.processPointerUp = null; - - this.onPointerCancel = null; - this.processPointerCancel = null; - - this.onPointerMove = null; - this.processPointerMove = null; - - this.onPointerOut = null; - this.processPointerOverOut = null; - - this.onPointerOver = null; - - this.search = null; - }; - - return InteractionManager; - }(eventemitter3)); - - var interaction_es = ({ - InteractionData: InteractionData, - InteractionEvent: InteractionEvent, - InteractionManager: InteractionManager, - InteractionTrackingData: InteractionTrackingData, - interactiveTarget: interactiveTarget - }); + return ParticleRenderer; + }(ObjectRenderer)); /*! - * @pixi/graphics - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/graphics - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/graphics is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -30506,7 +34693,7 @@ var PIXI = (function (exports) { { if ( defaultSegments === void 0 ) { defaultSegments = 20; } - if (!this.adaptive) + if (!this.adaptive || !length || Number.isNaN(length)) { return defaultSegments; } @@ -30722,7 +34909,7 @@ var PIXI = (function (exports) { var seg = (Math.PI * 2) / totalSegs; - for (var i = 0; i < totalSegs; i++) + for (var i = 0; i < totalSegs - 0.5; i++) { points.push( x + (Math.sin(-seg * i) * width), @@ -31663,8 +35850,9 @@ var PIXI = (function (exports) { }; /** - * A structure to hold interim batch objects. - * + * A structure to hold interim batch objects for Graphics. + * @class + * @memberof PIXI.graphicsUtils */ var BatchPart = function BatchPart() { @@ -31716,6 +35904,7 @@ var PIXI = (function (exports) { /** * Map of fill commands for each shape type. * + * @memberof PIXI.graphicsUtils * @member {Object} */ var FILL_COMMANDS = {}; @@ -31728,18 +35917,20 @@ var PIXI = (function (exports) { /** * Batch pool, stores unused batches for preventing allocations. * - * @type {Array} + * @memberof PIXI.graphicsUtils + * @type {Array} */ var BATCH_POOL = []; /** * Draw call pool, stores unused draw calls for preventing allocations. * + * @memberof PIXI.graphicsUtils * @type {Array} */ var DRAW_CALL_POOL = []; - var index$1 = ({ + var index$2 = ({ buildPoly: buildPoly, buildCircle: buildCircle, buildRectangle: buildRectangle, @@ -31953,7 +36144,7 @@ var PIXI = (function (exports) { * Intermediate abstract format sent to batch system. * Can be converted to drawCalls or to batchable objects. * - * @member {BatchPart[]} + * @member {PIXI.graphicsUtils.BatchPart[]} * @protected */ this.batches = []; @@ -32055,12 +36246,10 @@ var PIXI = (function (exports) { for (var i$1 = 0; i$1 < this.batches.length; i$1++) { - var batch = this.batches[i$1]; + var batchPart = this.batches[i$1]; - batch.start = 0; - batch.attribStart = 0; - batch.style = null; - BATCH_POOL.push(batch); + batchPart.reset(); + BATCH_POOL.push(batchPart); } this.batches.length = 0; @@ -32287,33 +36476,11 @@ var PIXI = (function (exports) { if (!style.visible) { continue; } var nextTexture = style.texture.baseTexture; - var index$1 = this.indices.length; + var index = this.indices.length; var attribIndex = this.points.length / 2; nextTexture.wrapMode = exports.WRAP_MODES.REPEAT; - // close batch if style is different - if (batchPart && !this._compareStyles(currentStyle, style)) - { - batchPart.end(index$1, attribIndex); - - if (batchPart.size > 0) - { - batchPart = null; - } - } - // spawn new batch if its first batch or previous was closed - if (!batchPart) - { - batchPart = BATCH_POOL.pop() || new BatchPart(); - batchPart.begin(style, index$1, attribIndex); - this.batches.push(batchPart); - - currentStyle = style; - } - - var start = this.points.length / 2; - if (j === 0) { this.processFill(data); @@ -32323,13 +36490,37 @@ var PIXI = (function (exports) { this.processLine(data); } - var size = (this.points.length / 2) - start; + var size = (this.points.length / 2) - attribIndex; - this.addUvs(this.points, uvs, style.texture, start, size, style.matrix); + if (size === 0) { continue; } + // close batch if style is different + if (batchPart && !this._compareStyles(currentStyle, style)) + { + batchPart.end(index, attribIndex); + batchPart = null; + } + // spawn new batch if its first batch or previous was closed + if (!batchPart) + { + batchPart = BATCH_POOL.pop() || new BatchPart(); + batchPart.begin(style, index, attribIndex); + this.batches.push(batchPart); + currentStyle = style; + } + + this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix); } } - if (!batchPart) + if (batchPart) + { + var index$1 = this.indices.length; + var attrib = this.points.length / 2; + + batchPart.end(index$1, attrib); + } + + if (this.batches.length === 0) { // there are no visible styles in GraphicsData // its possible that someone wants Graphics just for the bounds @@ -32338,11 +36529,6 @@ var PIXI = (function (exports) { return; } - var index = this.indices.length; - var attrib = this.points.length / 2; - - batchPart.end(index, attrib); - this.indicesUint16 = new Uint16Array(this.indices); // TODO make this a const.. @@ -34281,8 +38467,8 @@ var PIXI = (function (exports) { Graphics._TEMP_POINT = new Point(); /*! - * @pixi/sprite - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/sprite - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/sprite is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -34589,9 +38775,11 @@ var PIXI = (function (exports) { if (this._roundPixels) { - for (var i = 0; i < 8; i++) + var resolution = settings.RESOLUTION; + + for (var i = 0; i < vertexData.length; ++i) { - vertexData[i] = Math.round(vertexData[i]); + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); } } }; @@ -34790,7 +38978,7 @@ var PIXI = (function (exports) { * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. * @return {PIXI.Sprite} The newly created sprite */ @@ -34956,8 +39144,8 @@ var PIXI = (function (exports) { }(Container)); /*! - * @pixi/text - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/text - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/text is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -35986,7 +40174,7 @@ var PIXI = (function (exports) { if (TextMetrics.canBreakWords(token, style.breakWords)) { // break word into characters - var characters = token.split(''); + var characters = TextMetrics.wordWrapSplit(token); // loop the characters for (var j = 0; j < characters.length; j++) @@ -36267,12 +40455,12 @@ var PIXI = (function (exports) { }; /** - * This method exists to be easily overridden + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * * It allows one to customise which words should break * Examples are if the token is CJK or numbers. * It must return a boolean. * - * @private * @param {string} token The token * @param {boolean} breakWords The style attr break words * @return {boolean} whether to break word or not @@ -36283,13 +40471,13 @@ var PIXI = (function (exports) { }; /** - * This method exists to be easily overridden + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * * It allows one to determine whether a pair of characters * should be broken by newlines * For example certain characters in CJK langs or numbers. * It must return a boolean. * - * @private * @param {string} char The character * @param {string} nextChar The next character * @param {string} token The token/word the characters are from @@ -36302,6 +40490,25 @@ var PIXI = (function (exports) { return true; }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It is called when a token (usually a word) has to be split into separate pieces + * in order to determine the point to break a word. + * It must return an array of characters. + * + * @example + * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. + * TextMetrics.wordWrapSplit = (token) => [...token]; + * + * @param {string} token The token to split + * @return {string[]} The characters of the token + */ + TextMetrics.wordWrapSplit = function wordWrapSplit (token) + { + return token.split(''); + }; + /** * Calculates the ascent, descent and fontSize of a given font-style * @@ -36443,8 +40650,14 @@ var PIXI = (function (exports) { { // OffscreenCanvas2D measureText can be up to 40% faster. var c = new OffscreenCanvas(0, 0); + var context = c.getContext('2d'); - return c.getContext('2d') ? c : document.createElement('canvas'); + if (context && context.measureText) + { + return c; + } + + return document.createElement('canvas'); } catch (ex) { @@ -36992,8 +41205,12 @@ var PIXI = (function (exports) { var currentIteration; var stop; - var width = Math.ceil(this.canvas.width / this._resolution); - var height = Math.ceil(this.canvas.height / this._resolution); + // a dropshadow will enlarge the canvas and result in the gradient being + // generated with the incorrect dimensions + var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; + + var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection; + var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection; // make a copy of the style settings, so we can manipulate them later var fill = style.fill.slice(); @@ -37227,8 +41444,8 @@ var PIXI = (function (exports) { }(Sprite)); /*! - * @pixi/prepare - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/prepare - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/prepare is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -37246,11 +41463,11 @@ var PIXI = (function (exports) { settings.UPLOADS_PER_FRAME = 4; /** - * CountLimiter limits the number of items handled by a {@link PIXI.prepare.BasePrepare} to a specified + * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified * number of items per frame. * * @class - * @memberof PIXI.prepare + * @memberof PIXI */ var CountLimiter = function CountLimiter(maxItemsPerFrame) { @@ -37289,7 +41506,7 @@ var PIXI = (function (exports) { * The prepare manager provides functionality to upload content to the GPU. * * BasePrepare handles basic queuing functionality and is extended by - * {@link PIXI.prepare.Prepare} and {@link PIXI.prepare.CanvasPrepare} + * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare} * to provide preparation capabilities specific to their respective renderers. * * @example @@ -37306,7 +41523,7 @@ var PIXI = (function (exports) { * * @abstract * @class - * @memberof PIXI.prepare + * @memberof PIXI */ var BasePrepare = function BasePrepare(renderer) { @@ -37314,7 +41531,7 @@ var PIXI = (function (exports) { /** * The limiter to be used to control how quickly items are prepared. - * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter} + * @type {PIXI.CountLimiter|PIXI.TimeLimiter} */ this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); @@ -37328,7 +41545,7 @@ var PIXI = (function (exports) { /** * The only real difference between CanvasPrepare and Prepare is what they pass * to upload hooks. That different parameter is stored here. - * @type {PIXI.prepare.CanvasPrepare|PIXI.Renderer} + * @type {object} * @protected */ this.uploadHookHelper = null; @@ -37507,7 +41724,7 @@ var PIXI = (function (exports) { * * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` * function must return `true` if it was able to add item to the queue. - * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. + * @return {this} Instance of plugin for chaining. */ BasePrepare.prototype.registerFindHook = function registerFindHook (addHook) { @@ -37524,7 +41741,7 @@ var PIXI = (function (exports) { * * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and * function must return `true` if it was able to handle upload of item. - * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. + * @return {this} Instance of plugin for chaining. */ BasePrepare.prototype.registerUploadHook = function registerUploadHook (uploadHook) { @@ -37541,7 +41758,7 @@ var PIXI = (function (exports) { * * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to * add to the queue - * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining. + * @return {this} Instance of plugin for chaining. */ BasePrepare.prototype.add = function add (item) { @@ -37773,13 +41990,35 @@ var PIXI = (function (exports) { } /** - * The prepare manager provides functionality to upload content to the GPU. + * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for + * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed. * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` + * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. + * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * document.body.appendChild(app.view); + * + * // Don't start rendering right away + * app.stop(); + * + * // create a display object + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add to the stage + * app.stage.addChild(rect); + * + * // Don't start rendering until the graphic is uploaded to the GPU + * app.renderer.plugins.prepare.upload(app.stage, () => { + * app.start(); + * }); * * @class - * @extends PIXI.prepare.BasePrepare - * @memberof PIXI.prepare + * @extends PIXI.BasePrepare + * @memberof PIXI */ var Prepare = /*@__PURE__*/(function (BasePrepare) { function Prepare(renderer) @@ -37895,7 +42134,7 @@ var PIXI = (function (exports) { * number of milliseconds per frame. * * @class - * @memberof PIXI.prepare + * @memberof PIXI */ var TimeLimiter = function TimeLimiter(maxMilliseconds) { @@ -37930,4048 +42169,9 @@ var PIXI = (function (exports) { return Date.now() - this.frameStart < this.maxMilliseconds; }; - var prepare_es = ({ - BasePrepare: BasePrepare, - CountLimiter: CountLimiter, - Prepare: Prepare, - TimeLimiter: TimeLimiter - }); - /*! - * @pixi/app - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC - * - * @pixi/app is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Convenience class to create a new PIXI application. - * - * This class automatically creates the renderer, ticker and root container. - * - * @example - * // Create the application - * const app = new PIXI.Application(); - * - * // Add the view to the DOM - * document.body.appendChild(app.view); - * - * // ex, add display objects - * app.stage.addChild(PIXI.Sprite.from('something.png')); - * - * @class - * @memberof PIXI - */ - var Application = function Application(options) - { - var this$1 = this; - - // The default options - options = Object.assign({ - forceCanvas: false, - }, options); - - /** - * WebGL renderer if available, otherwise CanvasRenderer. - * @member {PIXI.Renderer|PIXI.CanvasRenderer} - */ - this.renderer = autoDetectRenderer(options); - - /** - * The root display container that's rendered. - * @member {PIXI.Container} - */ - this.stage = new Container(); - - // install plugins here - Application._plugins.forEach(function (plugin) { - plugin.init.call(this$1, options); - }); - }; - - var prototypeAccessors$8 = { view: { configurable: true },screen: { configurable: true } }; - - /** - * Register a middleware plugin for the application - * @static - * @param {PIXI.Application.Plugin} plugin - Plugin being installed - */ - Application.registerPlugin = function registerPlugin (plugin) - { - Application._plugins.push(plugin); - }; - - /** - * Render the current stage. - */ - Application.prototype.render = function render () - { - this.renderer.render(this.stage); - }; - - /** - * Reference to the renderer's canvas element. - * @member {HTMLCanvasElement} - * @readonly - */ - prototypeAccessors$8.view.get = function () - { - return this.renderer.view; - }; - - /** - * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. - * @member {PIXI.Rectangle} - * @readonly - */ - prototypeAccessors$8.screen.get = function () - { - return this.renderer.screen; - }; - - /** - * Destroy and don't use after this. - * @param {Boolean} [removeView=false] Automatically remove canvas from DOM. - * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy - * method called as well. 'stageOptions' will be passed on to those calls. - * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the texture of the child sprite - * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the base texture of the child sprite - */ - Application.prototype.destroy = function destroy (removeView, stageOptions) - { - var this$1 = this; - - // Destroy plugins in the opposite order - // which they were constructed - var plugins = Application._plugins.slice(0); - - plugins.reverse(); - plugins.forEach(function (plugin) { - plugin.destroy.call(this$1); - }); - - this.stage.destroy(stageOptions); - this.stage = null; - - this.renderer.destroy(removeView); - this.renderer = null; - - this._options = null; - }; - - Object.defineProperties( Application.prototype, prototypeAccessors$8 ); - - /** - * @memberof PIXI.Application - * @typedef {object} Plugin - * @property {function} init - Called when Application is constructed, scoped to Application instance. - * Passes in `options` as the only argument, which are Application constructor options. - * @property {function} destroy - Called when destroying Application, scoped to Application instance - */ - - /** - * Collection of installed plugins. - * @static - * @private - * @type {PIXI.Application.Plugin[]} - */ - Application._plugins = []; - - /** - * Middleware for for Application's resize functionality - * @private - * @class - */ - var ResizePlugin = function ResizePlugin () {}; - - ResizePlugin.init = function init (options) - { - var this$1 = this; - - /** - * The element or window to resize the application to. - * @type {Window|HTMLElement} - * @name resizeTo - * @memberof PIXI.Application# - */ - Object.defineProperty(this, 'resizeTo', - { - set: function set(dom) - { - window.removeEventListener('resize', this.resize); - this._resizeTo = dom; - if (dom) - { - window.addEventListener('resize', this.resize); - this.resize(); - } - }, - get: function get() - { - return this._resizeTo; - }, - }); - - /** - * If `resizeTo` is set, calling this function - * will resize to the width and height of that element. - * @method PIXI.Application#resize - */ - this.resize = function () { - if (this$1._resizeTo) - { - // Resize to the window - if (this$1._resizeTo === window) - { - this$1.renderer.resize( - window.innerWidth, - window.innerHeight - ); - } - // Resize to other HTML entities - else - { - this$1.renderer.resize( - this$1._resizeTo.clientWidth, - this$1._resizeTo.clientHeight - ); - } - } - }; - - // On resize - this._resizeTo = null; - this.resizeTo = options.resizeTo || null; - }; - - /** - * Clean up the ticker, scoped to application - * @static - * @private - */ - ResizePlugin.destroy = function destroy () - { - this.resizeTo = null; - this.resize = null; - }; - - Application.registerPlugin(ResizePlugin); - - 'use strict'; - - var parseUri = function parseURI (str, opts) { - opts = opts || {}; - - var o = { - key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], - q: { - name: 'queryKey', - parser: /(?:^|&)([^&=]*)=?([^&]*)/g - }, - parser: { - strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, - loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ - } - }; - - var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); - var uri = {}; - var i = 14; - - while (i--) { uri[o.key[i]] = m[i] || ''; } - - uri[o.q.name] = {}; - uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { - if ($1) { uri[o.q.name][$1] = $2; } - }); - - return uri - }; - - var miniSignals = createCommonjsModule(function (module, exports) { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - 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'); } } - - var MiniSignalBinding = (function () { - function MiniSignalBinding(fn, once, thisArg) { - if (once === undefined) { once = false; } - - _classCallCheck(this, MiniSignalBinding); - - this._fn = fn; - this._once = once; - this._thisArg = thisArg; - this._next = this._prev = this._owner = null; - } - - _createClass(MiniSignalBinding, [{ - key: 'detach', - value: function detach() { - if (this._owner === null) { return false; } - this._owner.detach(this); - return true; - } - }]); - - return MiniSignalBinding; - })(); - - function _addMiniSignalBinding(self, node) { - if (!self._head) { - self._head = node; - self._tail = node; - } else { - self._tail._next = node; - node._prev = self._tail; - self._tail = node; - } - - node._owner = self; - - return node; - } - - var MiniSignal = (function () { - function MiniSignal() { - _classCallCheck(this, MiniSignal); - - this._head = this._tail = undefined; - } - - _createClass(MiniSignal, [{ - key: 'handlers', - value: function handlers() { - var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var node = this._head; - - if (exists) { return !!node; } - - var ee = []; - - while (node) { - ee.push(node); - node = node._next; - } - - return ee; - } - }, { - key: 'has', - value: function has(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); - } - - return node._owner === this; - } - }, { - key: 'dispatch', - value: function dispatch() { - var arguments$1 = arguments; - - var node = this._head; - - if (!node) { return false; } - - while (node) { - if (node._once) { this.detach(node); } - node._fn.apply(node._thisArg, arguments$1); - node = node._next; - } - - return true; - } - }, { - key: 'add', - value: function add(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#add(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); - } - }, { - key: 'once', - value: function once(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#once(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); - } - }, { - key: 'detach', - value: function detach(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); - } - if (node._owner !== this) { return this; } - - if (node._prev) { node._prev._next = node._next; } - if (node._next) { node._next._prev = node._prev; } - - if (node === this._head) { - this._head = node._next; - if (node._next === null) { - this._tail = null; - } - } else if (node === this._tail) { - this._tail = node._prev; - this._tail._next = null; - } - - node._owner = null; - return this; - } - }, { - key: 'detachAll', - value: function detachAll() { - var node = this._head; - if (!node) { return this; } - - this._head = this._tail = null; - - while (node) { - node._owner = null; - node = node._next; - } - return this; - } - }]); - - return MiniSignal; - })(); - - MiniSignal.MiniSignalBinding = MiniSignalBinding; - - exports['default'] = MiniSignal; - module.exports = exports['default']; - }); - - var Signal = unwrapExports(miniSignals); - - /*! - * resource-loader - v3.0.1 - * https://github.com/pixijs/pixi-sound - * Compiled Tue, 02 Jul 2019 14:06:18 UTC - * - * resource-loader is licensed under the MIT license. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Smaller version of the async library constructs. - * - * @namespace async - */ - - /** - * Noop function - * - * @ignore - * @function - * @memberof async - */ - function _noop() {} - /* empty */ - - /** - * Iterates an array in series. - * - * @memberof async - * @function eachSeries - * @param {Array.<*>} array - Array to iterate. - * @param {function} iterator - Function to call for each element. - * @param {function} callback - Function to call when done, or on error. - * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. - */ - - - function eachSeries(array, iterator, callback, deferNext) { - var i = 0; - var len = array.length; - - (function next(err) { - if (err || i === len) { - if (callback) { - callback(err); - } - - return; - } - - if (deferNext) { - setTimeout(function () { - iterator(array[i++], next); - }, 1); - } else { - iterator(array[i++], next); - } - })(); - } - /** - * Ensures a function is only called once. - * - * @ignore - * @memberof async - * @param {function} fn - The function to wrap. - * @return {function} The wrapping function. - */ - - function onlyOnce(fn) { - return function onceWrapper() { - if (fn === null) { - throw new Error('Callback was already called.'); - } - - var callFn = fn; - fn = null; - callFn.apply(this, arguments); - }; - } - /** - * Async queue implementation, - * - * @memberof async - * @function queue - * @param {function} worker - The worker function to call for each task. - * @param {number} concurrency - How many workers to run in parrallel. - * @return {*} The async queue object. - */ - - - function queue(worker, concurrency) { - if (concurrency == null) { - // eslint-disable-line no-eq-null,eqeqeq - concurrency = 1; - } else if (concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - - var workers = 0; - var q = { - _tasks: [], - concurrency: concurrency, - saturated: _noop, - unsaturated: _noop, - buffer: concurrency / 4, - empty: _noop, - drain: _noop, - error: _noop, - started: false, - paused: false, - push: function push(data, callback) { - _insert(data, false, callback); - }, - kill: function kill() { - workers = 0; - q.drain = _noop; - q.started = false; - q._tasks = []; - }, - unshift: function unshift(data, callback) { - _insert(data, true, callback); - }, - process: function process() { - while (!q.paused && workers < q.concurrency && q._tasks.length) { - var task = q._tasks.shift(); - - if (q._tasks.length === 0) { - q.empty(); - } - - workers += 1; - - if (workers === q.concurrency) { - q.saturated(); - } - - worker(task.data, onlyOnce(_next(task))); - } - }, - length: function length() { - return q._tasks.length; - }, - running: function running() { - return workers; - }, - idle: function idle() { - return q._tasks.length + workers === 0; - }, - pause: function pause() { - if (q.paused === true) { - return; - } - - q.paused = true; - }, - resume: function resume() { - if (q.paused === false) { - return; - } - - q.paused = false; // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - - for (var w = 1; w <= q.concurrency; w++) { - q.process(); - } - } - }; - - function _insert(data, insertAtFront, callback) { - if (callback != null && typeof callback !== 'function') { - // eslint-disable-line no-eq-null,eqeqeq - throw new Error('task callback must be a function'); - } - - q.started = true; - - if (data == null && q.idle()) { - // eslint-disable-line no-eq-null,eqeqeq - // call drain immediately if there are no tasks - setTimeout(function () { - return q.drain(); - }, 1); - return; - } - - var item = { - data: data, - callback: typeof callback === 'function' ? callback : _noop - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - setTimeout(function () { - return q.process(); - }, 1); - } - - function _next(task) { - return function next() { - workers -= 1; - task.callback.apply(task, arguments); - - if (arguments[0] != null) { - // eslint-disable-line no-eq-null,eqeqeq - q.error(arguments[0], task.data); - } - - if (workers <= q.concurrency - q.buffer) { - q.unsaturated(); - } - - if (q.idle()) { - q.drain(); - } - - q.process(); - }; - } - - return q; - } - - var async = ({ - eachSeries: eachSeries, - queue: queue - }); - - // a simple in-memory cache for resources - var cache = {}; - /** - * A simple in-memory cache for resource. - * - * @memberof middleware - * @function caching - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.caching); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function caching(resource, next) { - var _this = this; - - // if cached, then set data and complete the resource - if (cache[resource.url]) { - resource.data = cache[resource.url]; - resource.complete(); // marks resource load complete and stops processing before middlewares - } // if not cached, wait for complete and store it in the cache. - else { - resource.onComplete.once(function () { - return cache[_this.url] = _this.data; - }); - } - - next(); - } - - 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); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } - if (staticProps) { _defineProperties(Constructor, staticProps); } - return Constructor; - } - - var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); - var tempAnchor$1 = null; // some status constants - - var STATUS_NONE = 0; - var STATUS_OK = 200; - var STATUS_EMPTY = 204; - var STATUS_IE_BUG_EMPTY = 1223; - var STATUS_TYPE_OK = 2; // noop - - function _noop$1() {} - /* empty */ - - /** - * Manages the state and loading of a resource and all child resources. - * - * @class - */ - - - var Resource$1 = - /*#__PURE__*/ - function () { - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. - */ - Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { - setExtMap(Resource._loadTypeMap, extname, loadType); - } - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. - */ - ; - - Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { - setExtMap(Resource._xhrTypeMap, extname, xhrType); - } - /** - * @param {string} name - The name of the resource to load. - * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass - * an array of sources. - * @param {object} [options] - The options for the load. - * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. - */ - ; - - function Resource(name, url, options) { - if (typeof name !== 'string' || typeof url !== 'string') { - throw new Error('Both name and url are required for constructing a resource.'); - } - - options = options || {}; - /** - * The state flags of this resource. - * - * @private - * @member {number} - */ - - this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work. - - this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); - /** - * The name of this resource. - * - * @readonly - * @member {string} - */ - - - this.name = name; - /** - * The url used to load this resource. - * - * @readonly - * @member {string} - */ - - this.url = url; - /** - * The extension used to load this resource. - * - * @readonly - * @member {string} - */ - - this.extension = this._getExtension(); - /** - * The data that was loaded by the resource. - * - * @member {any} - */ - - this.data = null; - /** - * Is this request cross-origin? If unset, determined automatically. - * - * @member {string} - */ - - this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; - /** - * A timeout in milliseconds for the load. If the load takes longer than this time - * it is cancelled and the load is considered a failure. If this value is set to `0` - * then there is no explicit timeout. - * - * @member {number} - */ - - this.timeout = options.timeout || 0; - /** - * The method of loading to use for this resource. - * - * @member {Resource.LOAD_TYPE} - */ - - this.loadType = options.loadType || this._determineLoadType(); - /** - * The type used to load the resource via XHR. If unset, determined automatically. - * - * @member {string} - */ - - this.xhrType = options.xhrType; - /** - * Extra info for middleware, and controlling specifics about how the resource loads. - * - * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. - * Meaning it will modify it as it sees fit. - * - * @member {Resource.IMetadata} - */ - - this.metadata = options.metadata || {}; - /** - * The error that occurred while loading (if any). - * - * @readonly - * @member {Error} - */ - - this.error = null; - /** - * The XHR object that was used to load this resource. This is only set - * when `loadType` is `Resource.LOAD_TYPE.XHR`. - * - * @readonly - * @member {XMLHttpRequest} - */ - - this.xhr = null; - /** - * The child resources this resource owns. - * - * @readonly - * @member {Resource[]} - */ - - this.children = []; - /** - * The resource type. - * - * @readonly - * @member {Resource.TYPE} - */ - - this.type = Resource.TYPE.UNKNOWN; - /** - * The progress chunk owned by this resource. - * - * @readonly - * @member {number} - */ - - this.progressChunk = 0; - /** - * The `dequeue` method that will be used a storage place for the async queue dequeue method - * used privately by the loader. - * - * @private - * @member {function} - */ - - this._dequeue = _noop$1; - /** - * Used a storage place for the on load binding used privately by the loader. - * - * @private - * @member {function} - */ - - this._onLoadBinding = null; - /** - * The timer for element loads to check if they timeout. - * - * @private - * @member {number} - */ - - this._elementTimer = 0; - /** - * The `complete` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundComplete = this.complete.bind(this); - /** - * The `_onError` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnError = this._onError.bind(this); - /** - * The `_onProgress` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnProgress = this._onProgress.bind(this); - /** - * The `_onTimeout` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks - - this._boundXhrOnError = this._xhrOnError.bind(this); - this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); - this._boundXhrOnAbort = this._xhrOnAbort.bind(this); - this._boundXhrOnLoad = this._xhrOnLoad.bind(this); - /** - * Dispatched when the resource beings to load. - * - * The callback looks like {@link Resource.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched each time progress of this resource load updates. - * Not all resources types and loader systems can support this event - * so sometimes it may not be available. If the resource - * is being loaded on a modern browser, using XHR, and the remote server - * properly sets Content-Length headers, then this will be available. - * - * The callback looks like {@link Resource.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once this resource has loaded, if there was an error it will - * be in the `error` property. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); - /** - * Dispatched after this resource has had all the *after* middleware run on it. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onAfterMiddleware = new Signal(); - } - /** - * When the resource starts to load. - * - * @memberof Resource - * @callback OnStartSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * When the resource reports loading progress. - * - * @memberof Resource - * @callback OnProgressSignal - * @param {Resource} resource - The resource that the event happened on. - * @param {number} percentage - The progress of the load in the range [0, 1]. - */ - - /** - * When the resource finishes loading. - * - * @memberof Resource - * @callback OnCompleteSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * @memberof Resource - * @typedef {object} IMetadata - * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The - * element to use for loading, instead of creating one. - * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This - * is useful if you want to pass in a `loadElement` that you already added load sources to. - * @property {string|string[]} [mimeType] - The mime type to use for the source element - * of a video/audio elment. If the urls are an array, you can pass this as an array as well - * where each index is the mime type to use for the corresponding url index. - */ - - /** - * Stores whether or not this url is a data url. - * - * @readonly - * @member {boolean} - */ - - - var _proto = Resource.prototype; - - /** - * Marks the resource as complete. - * - */ - _proto.complete = function complete() { - this._clearEvents(); - - this._finish(); - } - /** - * Aborts the loading of this resource, with an optional message. - * - * @param {string} message - The message to use for the error - */ - ; - - _proto.abort = function abort(message) { - // abort can be called multiple times, ignore subsequent calls. - if (this.error) { - return; - } // store error - - - this.error = new Error(message); // clear events before calling aborts - - this._clearEvents(); // abort the actual loading - - - if (this.xhr) { - this.xhr.abort(); - } else if (this.xdr) { - this.xdr.abort(); - } else if (this.data) { - // single source - if (this.data.src) { - this.data.src = Resource.EMPTY_GIF; - } // multi-source - else { - while (this.data.firstChild) { - this.data.removeChild(this.data.firstChild); - } - } - } // done now. - - - this._finish(); - } - /** - * Kicks off loading of this resource. This method is asynchronous. - * - * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. - */ - ; - - _proto.load = function load(cb) { - var _this = this; - - if (this.isLoading) { - return; - } - - if (this.isComplete) { - if (cb) { - setTimeout(function () { - return cb(_this); - }, 1); - } - - return; - } else if (cb) { - this.onComplete.once(cb); - } - - this._setFlag(Resource.STATUS_FLAGS.LOADING, true); - - this.onStart.dispatch(this); // if unset, determine the value - - if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { - this.crossOrigin = this._determineCrossOrigin(this.url); - } - - switch (this.loadType) { - case Resource.LOAD_TYPE.IMAGE: - this.type = Resource.TYPE.IMAGE; - - this._loadElement('image'); - - break; - - case Resource.LOAD_TYPE.AUDIO: - this.type = Resource.TYPE.AUDIO; - - this._loadSourceElement('audio'); - - break; - - case Resource.LOAD_TYPE.VIDEO: - this.type = Resource.TYPE.VIDEO; - - this._loadSourceElement('video'); - - break; - - case Resource.LOAD_TYPE.XHR: - /* falls through */ - - default: - if (useXdr && this.crossOrigin) { - this._loadXdr(); - } else { - this._loadXhr(); - } - - break; - } - } - /** - * Checks if the flag is set. - * - * @private - * @param {number} flag - The flag to check. - * @return {boolean} True if the flag is set. - */ - ; - - _proto._hasFlag = function _hasFlag(flag) { - return (this._flags & flag) !== 0; - } - /** - * (Un)Sets the flag. - * - * @private - * @param {number} flag - The flag to (un)set. - * @param {boolean} value - Whether to set or (un)set the flag. - */ - ; - - _proto._setFlag = function _setFlag(flag, value) { - this._flags = value ? this._flags | flag : this._flags & ~flag; - } - /** - * Clears all the events from the underlying loading source. - * - * @private - */ - ; - - _proto._clearEvents = function _clearEvents() { - clearTimeout(this._elementTimer); - - if (this.data && this.data.removeEventListener) { - this.data.removeEventListener('error', this._boundOnError, false); - this.data.removeEventListener('load', this._boundComplete, false); - this.data.removeEventListener('progress', this._boundOnProgress, false); - this.data.removeEventListener('canplaythrough', this._boundComplete, false); - } - - if (this.xhr) { - if (this.xhr.removeEventListener) { - this.xhr.removeEventListener('error', this._boundXhrOnError, false); - this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); - this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); - this.xhr.removeEventListener('progress', this._boundOnProgress, false); - this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); - } else { - this.xhr.onerror = null; - this.xhr.ontimeout = null; - this.xhr.onprogress = null; - this.xhr.onload = null; - } - } - } - /** - * Finalizes the load. - * - * @private - */ - ; - - _proto._finish = function _finish() { - if (this.isComplete) { - throw new Error('Complete called again for an already completed resource.'); - } - - this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); - - this._setFlag(Resource.STATUS_FLAGS.LOADING, false); - - this.onComplete.dispatch(this); - } - /** - * Loads this resources using an element that has a single source, - * like an HTMLImageElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadElement = function _loadElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'image' && typeof window.Image !== 'undefined') { - this.data = new Image(); - } else { - this.data = document.createElement(type); - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - this.data.src = this.url; - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an element that has multiple sources, - * like an HTMLAudioElement or HTMLVideoElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadSourceElement = function _loadSourceElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'audio' && typeof window.Audio !== 'undefined') { - this.data = new Audio(); - } else { - this.data = document.createElement(type); - } - - if (this.data === null) { - this.abort("Unsupported element: " + type); - return; - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') - if (navigator.isCocoonJS) { - this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; - } else if (Array.isArray(this.url)) { - var mimeTypes = this.metadata.mimeType; - - for (var i = 0; i < this.url.length; ++i) { - this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); - } - } else { - var _mimeTypes = this.metadata.mimeType; - this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); - } - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - this.data.addEventListener('canplaythrough', this._boundComplete, false); - this.data.load(); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an XMLHttpRequest. - * - * @private - */ - ; - - _proto._loadXhr = function _loadXhr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url - - xhr.open('GET', this.url, true); - xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers - // *cough* safari *cough* can't deal with it. - - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; - } else { - xhr.responseType = this.xhrType; - } - - xhr.addEventListener('error', this._boundXhrOnError, false); - xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); - xhr.addEventListener('abort', this._boundXhrOnAbort, false); - xhr.addEventListener('progress', this._boundOnProgress, false); - xhr.addEventListener('load', this._boundXhrOnLoad, false); - xhr.send(); - } - /** - * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). - * - * @private - */ - ; - - _proto._loadXdr = function _loadXdr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef - // XDomainRequest has a few quirks. Occasionally it will abort requests - // A way to avoid this is to make sure ALL callbacks are set even if not used - // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 - - xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 - - xdr.onerror = this._boundXhrOnError; - xdr.ontimeout = this._boundXhrOnTimeout; - xdr.onprogress = this._boundOnProgress; - xdr.onload = this._boundXhrOnLoad; - xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an - // issue with the interface where some requests are lost if multiple - // XDomainRequests are being sent at the same time. - // Some info here: https://github.com/photonstorm/phaser/issues/1248 - - setTimeout(function () { - return xdr.send(); - }, 1); - } - /** - * Creates a source used in loading via an element. - * - * @private - * @param {string} type - The element type (video or audio). - * @param {string} url - The source URL to load from. - * @param {string} [mime] - The mime type of the video - * @return {HTMLSourceElement} The source element. - */ - ; - - _proto._createSource = function _createSource(type, url, mime) { - if (!mime) { - mime = type + "/" + this._getExtension(url); - } - - var source = document.createElement('source'); - source.src = url; - source.type = mime; - return source; - } - /** - * Called if a load errors out. - * - * @param {Event} event - The error event from the element that emits it. - * @private - */ - ; - - _proto._onError = function _onError(event) { - this.abort("Failed to load element using: " + event.target.nodeName); - } - /** - * Called if a load progress event fires for an element or xhr/xdr. - * - * @private - * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. - */ - ; - - _proto._onProgress = function _onProgress(event) { - if (event && event.lengthComputable) { - this.onProgress.dispatch(this, event.loaded / event.total); - } - } - /** - * Called if a timeout event fires for an element. - * - * @private - */ - ; - - _proto._onTimeout = function _onTimeout() { - this.abort("Load timed out."); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnError = function _xhrOnError() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnTimeout = function _xhrOnTimeout() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request timed out."); - } - /** - * Called if an abort event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnAbort = function _xhrOnAbort() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request was aborted by the user."); - } - /** - * Called when data successfully loads from an xhr/xdr request. - * - * @private - * @param {XMLHttpRequestLoadEvent|Event} event - Load event - */ - ; - - _proto._xhrOnLoad = function _xhrOnLoad() { - var xhr = this.xhr; - var text = ''; - var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. - // responseText is accessible only if responseType is '' or 'text' and on older browsers - - if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { - text = xhr.responseText; - } // status can be 0 when using the `file://` protocol so we also check if a response is set. - // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. - - - if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { - status = STATUS_OK; - } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - else if (status === STATUS_IE_BUG_EMPTY) { - status = STATUS_EMPTY; - } - - var statusType = status / 100 | 0; - - if (statusType === STATUS_TYPE_OK) { - // if text, just return it - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { - this.data = text; - this.type = Resource.TYPE.TEXT; - } // if json, parse into json object - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { - try { - this.data = JSON.parse(text); - this.type = Resource.TYPE.JSON; - } catch (e) { - this.abort("Error trying to parse loaded json: " + e); - return; - } - } // if xml, parse into an xml document or div element - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - try { - if (window.DOMParser) { - var domparser = new DOMParser(); - this.data = domparser.parseFromString(text, 'text/xml'); - } else { - var div = document.createElement('div'); - div.innerHTML = text; - this.data = div; - } - - this.type = Resource.TYPE.XML; - } catch (e) { - this.abort("Error trying to parse loaded xml: " + e); - return; - } - } // other types just return the response - else { - this.data = xhr.response || text; - } - } else { - this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); - return; - } - - this.complete(); - } - /** - * Sets the `crossOrigin` property for this resource based on if the url - * for this resource is cross-origin. If crossOrigin was manually set, this - * function does nothing. - * - * @private - * @param {string} url - The url to test. - * @param {object} [loc=window.location] - The location object to test against. - * @return {string} The crossOrigin value to use (or empty string for none). - */ - ; - - _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) { - // data: and javascript: urls are considered same-origin - if (url.indexOf('data:') === 0) { - return ''; - } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special - // origin designed not to match window.location.origin, and will always require - // crossOrigin requests regardless of whether the location matches. - - - if (window.origin !== window.location.origin) { - return 'anonymous'; - } // default is window.location - - - loc = loc || window.location; - - if (!tempAnchor$1) { - tempAnchor$1 = document.createElement('a'); - } // let the browser determine the full href for the url of this resource and then - // parse with the node url lib, we can't use the properties of the anchor element - // because they don't work in IE9 :( - - - tempAnchor$1.href = url; - url = parseUri(tempAnchor$1.href, { - strictMode: true - }); - var samePort = !url.port && loc.port === '' || url.port === loc.port; - var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin - - if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { - return 'anonymous'; - } - - return ''; - } - /** - * Determines the responseType of an XHR request based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. - */ - ; - - _proto._determineXhrType = function _determineXhrType() { - return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; - } - /** - * Determines the loadType of a resource based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.LOAD_TYPE} The loadType to use. - */ - ; - - _proto._determineLoadType = function _determineLoadType() { - return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; - } - /** - * Extracts the extension (sans '.') of the file being loaded by the resource. - * - * @private - * @return {string} The extension. - */ - ; - - _proto._getExtension = function _getExtension() { - var url = this.url; - var ext = ''; - - if (this.isDataUrl) { - var slashIndex = url.indexOf('/'); - ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); - } else { - var queryStart = url.indexOf('?'); - var hashStart = url.indexOf('#'); - var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); - url = url.substring(0, index); - ext = url.substring(url.lastIndexOf('.') + 1); - } - - return ext.toLowerCase(); - } - /** - * Determines the mime type of an XHR request based on the responseType of - * resource being loaded. - * - * @private - * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. - * @return {string} The mime type to use. - */ - ; - - _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) { - switch (type) { - case Resource.XHR_RESPONSE_TYPE.BUFFER: - return 'application/octet-binary'; - - case Resource.XHR_RESPONSE_TYPE.BLOB: - return 'application/blob'; - - case Resource.XHR_RESPONSE_TYPE.DOCUMENT: - return 'application/xml'; - - case Resource.XHR_RESPONSE_TYPE.JSON: - return 'application/json'; - - case Resource.XHR_RESPONSE_TYPE.DEFAULT: - case Resource.XHR_RESPONSE_TYPE.TEXT: - /* falls through */ - - default: - return 'text/plain'; - } - }; - - _createClass(Resource, [{ - key: "isDataUrl", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); - } - /** - * Describes if this resource has finished loading. Is true when the resource has completely - * loaded. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isComplete", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); - } - /** - * Describes if this resource is currently loading. Is true when the resource starts loading, - * and is false again when complete. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isLoading", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.LOADING); - } - }]); - - return Resource; - }(); - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - - Resource$1.STATUS_FLAGS = { - NONE: 0, - DATA_URL: 1 << 0, - COMPLETE: 1 << 1, - LOADING: 1 << 2 - }; - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.TYPE = { - UNKNOWN: 0, - JSON: 1, - XML: 2, - IMAGE: 3, - AUDIO: 4, - VIDEO: 5, - TEXT: 6 - }; - /** - * The types of loading a resource can use. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.LOAD_TYPE = { - /** Uses XMLHttpRequest to load the resource. */ - XHR: 1, - - /** Uses an `Image` object to load the resource. */ - IMAGE: 2, - - /** Uses an `Audio` object to load the resource. */ - AUDIO: 3, - - /** Uses a `Video` object to load the resource. */ - VIDEO: 4 - }; - /** - * The XHR ready states, used internally. - * - * @static - * @readonly - * @enum {string} - */ - - Resource$1.XHR_RESPONSE_TYPE = { - /** string */ - DEFAULT: 'text', - - /** ArrayBuffer */ - BUFFER: 'arraybuffer', - - /** Blob */ - BLOB: 'blob', - - /** Document */ - DOCUMENT: 'document', - - /** Object */ - JSON: 'json', - - /** String */ - TEXT: 'text' - }; - Resource$1._loadTypeMap = { - // images - gif: Resource$1.LOAD_TYPE.IMAGE, - png: Resource$1.LOAD_TYPE.IMAGE, - bmp: Resource$1.LOAD_TYPE.IMAGE, - jpg: Resource$1.LOAD_TYPE.IMAGE, - jpeg: Resource$1.LOAD_TYPE.IMAGE, - tif: Resource$1.LOAD_TYPE.IMAGE, - tiff: Resource$1.LOAD_TYPE.IMAGE, - webp: Resource$1.LOAD_TYPE.IMAGE, - tga: Resource$1.LOAD_TYPE.IMAGE, - svg: Resource$1.LOAD_TYPE.IMAGE, - 'svg+xml': Resource$1.LOAD_TYPE.IMAGE, - // for SVG data urls - // audio - mp3: Resource$1.LOAD_TYPE.AUDIO, - ogg: Resource$1.LOAD_TYPE.AUDIO, - wav: Resource$1.LOAD_TYPE.AUDIO, - // videos - mp4: Resource$1.LOAD_TYPE.VIDEO, - webm: Resource$1.LOAD_TYPE.VIDEO - }; - Resource$1._xhrTypeMap = { - // xml - xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. - // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, - // this should probably be fine. - tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // images - gif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - png: Resource$1.XHR_RESPONSE_TYPE.BLOB, - bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB, - webp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tga: Resource$1.XHR_RESPONSE_TYPE.BLOB, - // json - json: Resource$1.XHR_RESPONSE_TYPE.JSON, - // text - text: Resource$1.XHR_RESPONSE_TYPE.TEXT, - txt: Resource$1.XHR_RESPONSE_TYPE.TEXT, - // fonts - ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER, - otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER - }; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif - - Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; - /** - * Quick helper to set a value on one of the extension maps. Ensures there is no - * dot at the start of the extension. - * - * @ignore - * @param {object} map - The map to set on. - * @param {string} extname - The extension (or key) to set. - * @param {number} val - The value to set. - */ - - function setExtMap(map, extname, val) { - if (extname && extname.indexOf('.') === 0) { - extname = extname.substring(1); - } - - if (!extname) { - return; - } - - map[extname] = val; - } - /** - * Quick helper to get string xhr type. - * - * @ignore - * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. - * @return {string} The type. - */ - - - function reqType(xhr) { - return xhr.toString().replace('object ', ''); - } - - var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - /** - * Encodes binary into base64. - * - * @function encodeBinary - * @param {string} input The input data to encode. - * @returns {string} The encoded base64 string - */ - - function encodeBinary(input) { - var output = ''; - var inx = 0; - - while (inx < input.length) { - // Fill byte buffer array - var bytebuffer = [0, 0, 0]; - var encodedCharIndexes = [0, 0, 0, 0]; - - for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { - if (inx < input.length) { - // throw away high-order byte, as documented at: - // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data - bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; - } else { - bytebuffer[jnx] = 0; - } - } // Get each encoded character, 6 bits at a time - // index 1: first 6 bits - - - encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) - - encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) - - encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3) - - encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly - - var paddingBytes = inx - (input.length - 1); - - switch (paddingBytes) { - case 2: - // Set last 2 characters to padding char - encodedCharIndexes[3] = 64; - encodedCharIndexes[2] = 64; - break; - - case 1: - // Set last character to padding char - encodedCharIndexes[3] = 64; - break; - - default: - break; - // No padding - proceed - } // Now we will grab each appropriate character out of our keystring - // based on our index array and append it to the output string - - - for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { - output += _keyStr.charAt(encodedCharIndexes[_jnx]); - } - } - - return output; - } - - var Url$1 = window.URL || window.webkitURL; - /** - * A middleware for transforming XHR loaded Blobs into more useful objects - * - * @memberof middleware - * @function parsing - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.parsing); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function parsing(resource, next) { - if (!resource.data) { - next(); - return; - } // if this was an XHR load of a blob - - - if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) { - // if there is no blob support we probably got a binary string back - if (!window.Blob || typeof resource.data === 'string') { - var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url - - if (type && type.indexOf('image') === 0) { - resource.data = new Image(); - resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); - resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback - - resource.data.onload = function () { - resource.data.onload = null; - next(); - }; // next will be called on load - - - return; - } - } // if content type says this is an image, then we should transform the blob into an Image object - else if (resource.data.type.indexOf('image') === 0) { - var src = Url$1.createObjectURL(resource.data); - resource.blob = resource.data; - resource.data = new Image(); - resource.data.src = src; - resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads - // TODO: Is this correct? Will the image be invalid after revoking? - - resource.data.onload = function () { - Url$1.revokeObjectURL(src); - resource.data.onload = null; - next(); - }; // next will be called on load. - - - return; - } - } - - next(); - } - - /** - * @namespace middleware - */ - - var index$2 = ({ - caching: caching, - parsing: parsing - }); - - var MAX_PROGRESS = 100; - var rgxExtractUrlHash = /(#[\w-]+)?$/; - /** - * Manages the state and loading of multiple resources to load. - * - * @class - */ - - var Loader = - /*#__PURE__*/ - function () { - /** - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - function Loader(baseUrl, concurrency) { - var _this = this; - - if (baseUrl === void 0) { - baseUrl = ''; - } - - if (concurrency === void 0) { - concurrency = 10; - } - - /** - * The base url for all resources loaded by this loader. - * - * @member {string} - */ - this.baseUrl = baseUrl; - /** - * The progress percent of the loader going through the queue. - * - * @member {number} - * @default 0 - */ - - this.progress = 0; - /** - * Loading state of the loader, true if it is currently loading resources. - * - * @member {boolean} - * @default false - */ - - this.loading = false; - /** - * A querystring to append to every URL added to the loader. - * - * This should be a valid query string *without* the question-mark (`?`). The loader will - * also *not* escape values for you. Make sure to escape your parameters with - * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. - * - * @example - * const loader = new Loader(); - * - * loader.defaultQueryString = 'user=me&password=secret'; - * - * // This will request 'image.png?user=me&password=secret' - * loader.add('image.png').load(); - * - * loader.reset(); - * - * // This will request 'image.png?v=1&user=me&password=secret' - * loader.add('iamge.png?v=1').load(); - * - * @member {string} - * @default '' - */ - - this.defaultQueryString = ''; - /** - * The middleware to run before loading each resource. - * - * @private - * @member {function[]} - */ - - this._beforeMiddleware = []; - /** - * The middleware to run after loading each resource. - * - * @private - * @member {function[]} - */ - - this._afterMiddleware = []; - /** - * The tracks the resources we are currently completing parsing for. - * - * @private - * @member {Resource[]} - */ - - this._resourcesParsing = []; - /** - * The `_loadResource` function bound with this object context. - * - * @private - * @member {function} - * @param {Resource} r - The resource to load - * @param {Function} d - The dequeue function - * @return {undefined} - */ - - this._boundLoadResource = function (r, d) { - return _this._loadResource(r, d); - }; - /** - * The resources waiting to be loaded. - * - * @private - * @member {Resource[]} - */ - - - this._queue = queue(this._boundLoadResource, concurrency); - - this._queue.pause(); - /** - * All the resources for this loader keyed by name. - * - * @member {object} - */ - - - this.resources = {}; - /** - * Dispatched once per loaded or errored resource. - * - * The callback looks like {@link Loader.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once per errored resource. - * - * The callback looks like {@link Loader.OnErrorSignal}. - * - * @member {Signal} - */ - - this.onError = new Signal(); - /** - * Dispatched once per loaded resource. - * - * The callback looks like {@link Loader.OnLoadSignal}. - * - * @member {Signal} - */ - - this.onLoad = new Signal(); - /** - * Dispatched when the loader begins to process the queue. - * - * The callback looks like {@link Loader.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched when the queued resources all load. - * - * The callback looks like {@link Loader.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); // Add default before middleware - - for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { - this.pre(Loader._defaultBeforeMiddleware[i]); - } // Add default after middleware - - - for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { - this.use(Loader._defaultAfterMiddleware[_i]); - } - } - /** - * When the progress changes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnProgressSignal - * @param {Loader} loader - The loader the progress is advancing on. - * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. - */ - - /** - * When an error occurrs the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnErrorSignal - * @param {Loader} loader - The loader the error happened in. - * @param {Resource} resource - The resource that caused the error. - */ - - /** - * When a load completes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnLoadSignal - * @param {Loader} loader - The loader that laoded the resource. - * @param {Resource} resource - The resource that has completed loading. - */ - - /** - * When the loader starts loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnStartSignal - * @param {Loader} loader - The loader that has started loading resources. - */ - - /** - * When the loader completes loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnCompleteSignal - * @param {Loader} loader - The loader that has finished loading resources. - */ - - /** - * Options for a call to `.add()`. - * - * @see Loader#add - * - * @typedef {object} IAddOptions - * @property {string} [name] - The name of the resource to load, if not passed the url is used. - * @property {string} [key] - Alias for `name`. - * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. - * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. - * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`. - * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. - */ - - /* eslint-disable require-jsdoc,valid-jsdoc */ - - /** - * Adds a resource (or multiple resources) to the loader queue. - * - * This function can take a wide variety of different parameters. The only thing that is always - * required the url to load. All the following will work: - * - * ```js - * loader - * // normal param syntax - * .add('key', 'http://...', function () {}) - * .add('http://...', function () {}) - * .add('http://...') - * - * // object syntax - * .add({ - * name: 'key2', - * url: 'http://...' - * }, function () {}) - * .add({ - * url: 'http://...' - * }, function () {}) - * .add({ - * name: 'key3', - * url: 'http://...' - * onComplete: function () {} - * }) - * .add({ - * url: 'https://...', - * onComplete: function () {}, - * crossOrigin: true - * }) - * - * // you can also pass an array of objects or urls or both - * .add([ - * { name: 'key4', url: 'http://...', onComplete: function () {} }, - * { url: 'http://...', onComplete: function () {} }, - * 'http://...' - * ]) - * - * // and you can use both params and options - * .add('key', 'http://...', { crossOrigin: true }, function () {}) - * .add('http://...', { crossOrigin: true }, function () {}); - * ``` - * - * @function - * @variation 1 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 2 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 3 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 4 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 5 - * @param {IAddOptions} options - The options for the load. This object must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 6 - * @param {Array} resources - An array of resources to load, where each is - * either an object with the options or a string url. If you pass an object, it must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - - var _proto = Loader.prototype; - - _proto.add = function add(name, url, options, cb) { - // special case of an array of objects or urls - if (Array.isArray(name)) { - for (var i = 0; i < name.length; ++i) { - this.add(name[i]); - } - - return this; - } // if an object is passed instead of params - - - if (typeof name === 'object') { - cb = url || name.callback || name.onComplete; - options = name; - url = name.url; - name = name.name || name.key || name.url; - } // case where no name is passed shift all args over by one. - - - if (typeof url !== 'string') { - cb = options; - options = url; - url = name; - } // now that we shifted make sure we have a proper url. - - - if (typeof url !== 'string') { - throw new Error('No url passed to add resource to loader.'); - } // options are optional so people might pass a function and no options - - - if (typeof options === 'function') { - cb = options; - options = null; - } // if loading already you can only add resources that have a parent. - - - if (this.loading && (!options || !options.parentResource)) { - throw new Error('Cannot add resources while the loader is running.'); - } // check if resource already exists. - - - if (this.resources[name]) { - throw new Error("Resource named \"" + name + "\" already exists."); - } // add base url if this isn't an absolute url - - - url = this._prepareUrl(url); // create the store the resource - - this.resources[name] = new Resource$1(name, url, options); - - if (typeof cb === 'function') { - this.resources[name].onAfterMiddleware.once(cb); - } // if actively loading, make sure to adjust progress chunks for that parent and its children - - - if (this.loading) { - var parent = options.parentResource; - var incompleteChildren = []; - - for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { - if (!parent.children[_i2].isComplete) { - incompleteChildren.push(parent.children[_i2]); - } - } - - var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent - - var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child - - parent.children.push(this.resources[name]); - parent.progressChunk = eachChunk; - - for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { - incompleteChildren[_i3].progressChunk = eachChunk; - } - - this.resources[name].progressChunk = eachChunk; - } // add the resource to the queue - - - this._queue.push(this.resources[name]); - - return this; - } - /* eslint-enable require-jsdoc,valid-jsdoc */ - - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; - - _proto.pre = function pre(fn) { - this._beforeMiddleware.push(fn); - - return this; - } - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; - - _proto.use = function use(fn) { - this._afterMiddleware.push(fn); - - return this; - } - /** - * Resets the queue of the loader to prepare for a new load. - * - * @return {this} Returns itself. - */ - ; - - _proto.reset = function reset() { - this.progress = 0; - this.loading = false; - - this._queue.kill(); - - this._queue.pause(); // abort all resource loads - - - for (var k in this.resources) { - var res = this.resources[k]; - - if (res._onLoadBinding) { - res._onLoadBinding.detach(); - } - - if (res.isLoading) { - res.abort(); - } - } - - this.resources = {}; - return this; - } - /** - * Starts loading the queued resources. - * - * @param {function} [cb] - Optional callback that will be bound to the `complete` event. - * @return {this} Returns itself. - */ - ; - - _proto.load = function load(cb) { - // register complete callback if they pass one - if (typeof cb === 'function') { - this.onComplete.once(cb); - } // if the queue has already started we are done here - - - if (this.loading) { - return this; - } - - if (this._queue.idle()) { - this._onStart(); - - this._onComplete(); - } else { - // distribute progress chunks - var numTasks = this._queue._tasks.length; - var chunk = MAX_PROGRESS / numTasks; - - for (var i = 0; i < this._queue._tasks.length; ++i) { - this._queue._tasks[i].data.progressChunk = chunk; - } // notify we are starting - - - this._onStart(); // start loading - - - this._queue.resume(); - } - - return this; - } - /** - * The number of resources to load concurrently. - * - * @member {number} - * @default 10 - */ - ; - - /** - * Prepares a url for usage based on the configuration of this object - * - * @private - * @param {string} url - The url to prepare. - * @return {string} The prepared url. - */ - _proto._prepareUrl = function _prepareUrl(url) { - var parsedUrl = parseUri(url, { - strictMode: true - }); - var result; // absolute url, just use it as is. - - if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { - result = url; - } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween - else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { - result = this.baseUrl + "/" + url; - } else { - result = this.baseUrl + url; - } // if we need to add a default querystring, there is a bit more work - - - if (this.defaultQueryString) { - var hash = rgxExtractUrlHash.exec(result)[0]; - result = result.substr(0, result.length - hash.length); - - if (result.indexOf('?') !== -1) { - result += "&" + this.defaultQueryString; - } else { - result += "?" + this.defaultQueryString; - } - - result += hash; - } - - return result; - } - /** - * Loads a single resource. - * - * @private - * @param {Resource} resource - The resource to load. - * @param {function} dequeue - The function to call when we need to dequeue this item. - */ - ; - - _proto._loadResource = function _loadResource(resource, dequeue) { - var _this2 = this; - - resource._dequeue = dequeue; // run before middleware - - eachSeries(this._beforeMiddleware, function (fn, next) { - fn.call(_this2, resource, function () { - // if the before middleware marks the resource as complete, - // break and don't process any more before middleware - next(resource.isComplete ? {} : null); - }); - }, function () { - if (resource.isComplete) { - _this2._onLoad(resource); - } else { - resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); - resource.load(); - } - }, true); - } - /** - * Called once loading has started. - * - * @private - */ - ; - - _proto._onStart = function _onStart() { - this.progress = 0; - this.loading = true; - this.onStart.dispatch(this); - } - /** - * Called once each resource has loaded. - * - * @private - */ - ; - - _proto._onComplete = function _onComplete() { - this.progress = MAX_PROGRESS; - this.loading = false; - this.onComplete.dispatch(this, this.resources); - } - /** - * Called each time a resources is loaded. - * - * @private - * @param {Resource} resource - The resource that was loaded - */ - ; - - _proto._onLoad = function _onLoad(resource) { - var _this3 = this; - - resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed - - this._resourcesParsing.push(resource); - - resource._dequeue(); // run all the after middleware for this resource - - - eachSeries(this._afterMiddleware, function (fn, next) { - fn.call(_this3, resource, next); - }, function () { - resource.onAfterMiddleware.dispatch(resource); - _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); - - _this3.onProgress.dispatch(_this3, resource); - - if (resource.error) { - _this3.onError.dispatch(resource.error, _this3, resource); - } else { - _this3.onLoad.dispatch(_this3, resource); - } - - _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check - - - if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { - _this3._onComplete(); - } - }, true); - }; - - _createClass(Loader, [{ - key: "concurrency", - get: function get() { - return this._queue.concurrency; - } // eslint-disable-next-line require-jsdoc - , - set: function set(concurrency) { - this._queue.concurrency = concurrency; - } - }]); - - return Loader; - }(); - /** - * A default array of middleware to run before loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - - Loader._defaultBeforeMiddleware = []; - /** - * A default array of middleware to run after loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - Loader._defaultAfterMiddleware = []; - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - Loader.pre = function LoaderPreStatic(fn) { - Loader._defaultBeforeMiddleware.push(fn); - - return Loader; - }; - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - - Loader.use = function LoaderUseStatic(fn) { - Loader._defaultAfterMiddleware.push(fn); - - return Loader; - }; - - /*! - * @pixi/loaders - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC - * - * @pixi/loaders is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Loader plugin for handling Texture resources. - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var TextureLoader = function TextureLoader () {}; - - TextureLoader.use = function use (resource, next) - { - // create a new texture if the data is an Image object - if (resource.data && resource.type === Resource$1.TYPE.IMAGE) - { - resource.texture = Texture.fromLoader( - resource.data, - resource.url, - resource.name - ); - } - next(); - }; - - /** - * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader - * - * ```js - * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. - * //or - * const loader = new PIXI.Loader(); // you can also create your own if you want - * - * const sprites = {}; - * - * // Chainable `add` to enqueue a resource - * loader.add('bunny', 'data/bunny.png') - * .add('spaceship', 'assets/spritesheet.json'); - * loader.add('scoreFont', 'assets/score.fnt'); - * - * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. - * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). - * loader.pre(cachingMiddleware); - * - * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. - * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). - * loader.use(parsingMiddleware); - * - * // The `load` method loads the queue of resources, and calls the passed in callback called once all - * // resources have loaded. - * loader.load((loader, resources) => { - * // resources is an object where the key is the name of the resource loaded and the value is the resource object. - * // They have a couple default properties: - * // - `url`: The URL that the resource was loaded from - * // - `error`: The error that happened when trying to load (if any) - * // - `data`: The raw data that was loaded - * // also may contain other properties based on the middleware that runs. - * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); - * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); - * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); - * }); - * - * // throughout the process multiple signals can be dispatched. - * loader.onProgress.add(() => {}); // called once per loaded/errored file - * loader.onError.add(() => {}); // called once per errored file - * loader.onLoad.add(() => {}); // called once per loaded file - * loader.onComplete.add(() => {}); // called once when the queued resources all load. - * ``` - * - * @see https://github.com/englercj/resource-loader - * - * @class Loader - * @memberof PIXI - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - var Loader$1 = /*@__PURE__*/(function (ResourceLoader) { - function Loader(baseUrl, concurrency) - { - var this$1 = this; - - ResourceLoader.call(this, baseUrl, concurrency); - eventemitter3.call(this); - - for (var i = 0; i < Loader._plugins.length; ++i) - { - var plugin = Loader._plugins[i]; - var pre = plugin.pre; - var use = plugin.use; - - if (pre) - { - this.pre(pre); - } - - if (use) - { - this.use(use); - } - } - - // Compat layer, translate the new v2 signals into old v1 events. - this.onStart.add(function (l) { return this$1.emit('start', l); }); - this.onProgress.add(function (l, r) { return this$1.emit('progress', l, r); }); - this.onError.add(function (e, l, r) { return this$1.emit('error', e, l, r); }); - this.onLoad.add(function (l, r) { return this$1.emit('load', l, r); }); - this.onComplete.add(function (l, r) { return this$1.emit('complete', l, r); }); - - /** - * If this loader cannot be destroyed. - * @member {boolean} - * @default false - * @private - */ - this._protected = false; - } - - if ( ResourceLoader ) { Loader.__proto__ = ResourceLoader; } - Loader.prototype = Object.create( ResourceLoader && ResourceLoader.prototype ); - Loader.prototype.constructor = Loader; - - var staticAccessors = { shared: { configurable: true } }; - - /** - * Destroy the loader, removes references. - * @private - */ - Loader.prototype.destroy = function destroy () - { - if (!this._protected) - { - this.removeAllListeners(); - this.reset(); - } - }; - - /** - * A premade instance of the loader that can be used to load resources. - * @name shared - * @type {PIXI.Loader} - * @static - * @memberof PIXI.Loader - */ - staticAccessors.shared.get = function () - { - var shared = Loader._shared; - - if (!shared) - { - shared = new Loader(); - shared._protected = true; - Loader._shared = shared; - } - - return shared; - }; - - Object.defineProperties( Loader, staticAccessors ); - - return Loader; - }(Loader)); - - // Copy EE3 prototype (mixin) - Object.assign(Loader$1.prototype, eventemitter3.prototype); - - /** - * Collection of all installed `use` middleware for Loader. - * - * @static - * @member {Array} _plugins - * @memberof PIXI.Loader - * @private - */ - Loader$1._plugins = []; - - /** - * Adds a Loader plugin for the global shared loader and all - * new Loader instances created. - * - * @static - * @method registerPlugin - * @memberof PIXI.Loader - * @param {PIXI.ILoaderPlugin} plugin - The plugin to add - * @return {PIXI.Loader} Reference to PIXI.Loader for chaining - */ - Loader$1.registerPlugin = function registerPlugin(plugin) - { - Loader$1._plugins.push(plugin); - - if (plugin.add) - { - plugin.add(); - } - - return Loader$1; - }; - - // parse any blob into more usable objects (e.g. Image) - Loader$1.registerPlugin({ use: index$2.parsing }); - - // parse any Image objects into textures - Loader$1.registerPlugin(TextureLoader); - - /** - * Plugin to be installed for handling specific Loader resources. - * - * @memberof PIXI - * @typedef ILoaderPlugin - * @property {function} [add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the - * arguments for this are `(resource, next)` - * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the - * arguments for this are `(resource, next)` - */ - - /** - * @memberof PIXI.Loader - * @callback loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - - /** - * @memberof PIXI.Loader# - * @member {object} onStart - */ - - /** - * @memberof PIXI.Loader# - * @member {object} onProgress - */ - - /** - * @memberof PIXI.Loader# - * @member {object} onError - */ - - /** - * @memberof PIXI.Loader# - * @member {object} onLoad - */ - - /** - * @memberof PIXI.Loader# - * @member {object} onComplete - */ - - /** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {AppLoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(AppLoaderPlugin); - * @class - * @memberof PIXI - */ - var AppLoaderPlugin = function AppLoaderPlugin () {}; - - AppLoaderPlugin.init = function init (options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); - }; - - /** - * Called when application destroyed - * @private - */ - AppLoaderPlugin.destroy = function destroy () - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; - } - }; - - /** - * Reference to **{@link https://github.com/englercj/resource-loader - * resource-loader}**'s Resource class. - * @see http://englercj.github.io/resource-loader/Resource.html - * @class LoaderResource - * @memberof PIXI - */ - var LoaderResource = Resource$1; - - /*! - * @pixi/particles - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC - * - * @pixi/particles is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. - * - * The tradeoff of the ParticleContainer is that most advanced functionality will not work. - * ParticleContainer implements the basic object transform (position, scale, rotation) - * and some advanced functionality like tint (as of v4.5.6). - * - * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. - * - * It's extremely easy to use: - * ```js - * let container = new ParticleContainer(); - * - * for (let i = 0; i < 100; ++i) - * { - * let sprite = PIXI.Sprite.from("myImage.png"); - * container.addChild(sprite); - * } - * ``` - * - * And here you have a hundred sprites that will be rendered at the speed of light. - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var ParticleContainer = /*@__PURE__*/(function (Container) { - function ParticleContainer(maxSize, properties, batchSize, autoResize) - { - if ( maxSize === void 0 ) { maxSize = 1500; } - if ( batchSize === void 0 ) { batchSize = 16384; } - if ( autoResize === void 0 ) { autoResize = false; } - - Container.call(this); - - // Making sure the batch size is valid - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - var maxBatchSize = 16384; - - if (batchSize > maxBatchSize) - { - batchSize = maxBatchSize; - } - - /** - * Set properties to be dynamic (true) / static (false) - * - * @member {boolean[]} - * @private - */ - this._properties = [false, true, false, false, false]; - - /** - * @member {number} - * @private - */ - this._maxSize = maxSize; - - /** - * @member {number} - * @private - */ - this._batchSize = batchSize; - - /** - * @member {Array} - * @private - */ - this._buffers = null; - - /** - * for every batch stores _updateID corresponding to the last change in that batch - * @member {number[]} - * @private - */ - this._bufferUpdateIDs = []; - - /** - * when child inserted, removed or changes position this number goes up - * @member {number[]} - * @private - */ - this._updateID = 0; - - /** - * @member {boolean} - * - */ - this.interactiveChildren = false; - - /** - * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` - * to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - this.blendMode = exports.BLEND_MODES.NORMAL; - - /** - * If true, container allocates more batches in case there are more than `maxSize` particles. - * @member {boolean} - * @default false - */ - this.autoResize = autoResize; - - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * Default to true here as performance is usually the priority for particles. - * - * @member {boolean} - * @default true - */ - this.roundPixels = true; - - /** - * The texture used to render the children. - * - * @readonly - * @member {PIXI.BaseTexture} - */ - this.baseTexture = null; - - this.setProperties(properties); - - /** - * The tint applied to the container. - * This is a hex value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 0xFFFFFF - */ - this._tint = 0; - this.tintRgb = new Float32Array(4); - this.tint = 0xFFFFFF; - } - - if ( Container ) { ParticleContainer.__proto__ = Container; } - ParticleContainer.prototype = Object.create( Container && Container.prototype ); - ParticleContainer.prototype.constructor = ParticleContainer; - - var prototypeAccessors = { tint: { configurable: true } }; - - /** - * Sets the private properties array to dynamic / static based on the passed properties object - * - * @param {object} properties - The properties to be uploaded - */ - ParticleContainer.prototype.setProperties = function setProperties (properties) - { - if (properties) - { - this._properties[0] = 'vertices' in properties || 'scale' in properties - ? !!properties.vertices || !!properties.scale : this._properties[0]; - this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; - this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; - this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; - this._properties[4] = 'tint' in properties || 'alpha' in properties - ? !!properties.tint || !!properties.alpha : this._properties[4]; - } - }; - - /** - * Updates the object transform for rendering - * - * @private - */ - ParticleContainer.prototype.updateTransform = function updateTransform () - { - // TODO don't need to! - this.displayObjectUpdateTransform(); - // PIXI.Container.prototype.updateTransform.call( this ); - }; - - /** - * The tint applied to the container. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.get = function () - { - return this._tint; - }; - - prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc - { - this._tint = value; - hex2rgb(value, this.tintRgb); - }; - - /** - * Renders the container using the WebGL renderer - * - * @private - * @param {PIXI.Renderer} renderer - The webgl renderer - */ - ParticleContainer.prototype.render = function render (renderer) - { - var this$1 = this; - - if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) - { - return; - } - - if (!this.baseTexture) - { - this.baseTexture = this.children[0]._texture.baseTexture; - if (!this.baseTexture.valid) - { - this.baseTexture.once('update', function () { return this$1.onChildrenChange(0); }); - } - } - - renderer.batch.setObjectRenderer(renderer.plugins.particle); - renderer.plugins.particle.render(this); - }; - - /** - * Set the flag that static data should be updated to true - * - * @private - * @param {number} smallestChildIndex - The smallest child index - */ - ParticleContainer.prototype.onChildrenChange = function onChildrenChange (smallestChildIndex) - { - var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); - - while (this._bufferUpdateIDs.length < bufferIndex) - { - this._bufferUpdateIDs.push(0); - } - this._bufferUpdateIDs[bufferIndex] = ++this._updateID; - }; - - ParticleContainer.prototype.dispose = function dispose () - { - if (this._buffers) - { - for (var i = 0; i < this._buffers.length; ++i) - { - this._buffers[i].destroy(); - } - - this._buffers = null; - } - }; - - /** - * Destroys the container - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their - * destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - ParticleContainer.prototype.destroy = function destroy (options) - { - Container.prototype.destroy.call(this, options); - - this.dispose(); - - this._properties = null; - this._buffers = null; - this._bufferUpdateIDs = null; - }; - - Object.defineProperties( ParticleContainer.prototype, prototypeAccessors ); - - return ParticleContainer; - }(Container)); - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that - * they now share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleBuffer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java - */ - - /** - * The particle buffer manages the static and dynamic buffers for a particle container. - * - * @class - * @private - * @memberof PIXI - */ - var ParticleBuffer = function ParticleBuffer(properties, dynamicPropertyFlags, size) - { - this.geometry = new Geometry(); - - this.indexBuffer = null; - - /** - * The number of particles the buffer can hold - * - * @private - * @member {number} - */ - this.size = size; - - /** - * A list of the properties that are dynamic. - * - * @private - * @member {object[]} - */ - this.dynamicProperties = []; - - /** - * A list of the properties that are static. - * - * @private - * @member {object[]} - */ - this.staticProperties = []; - - for (var i = 0; i < properties.length; ++i) - { - var property = properties[i]; - - // Make copy of properties object so that when we edit the offset it doesn't - // change all other instances of the object literal - property = { - attributeName: property.attributeName, - size: property.size, - uploadFunction: property.uploadFunction, - type: property.type || exports.TYPES.FLOAT, - offset: property.offset, - }; - - if (dynamicPropertyFlags[i]) - { - this.dynamicProperties.push(property); - } - else - { - this.staticProperties.push(property); - } - } - - this.staticStride = 0; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - - this.dynamicStride = 0; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - - this._updateID = 0; - - this.initBuffers(); - }; - - /** - * Sets up the renderer context and necessary buffers. - * - * @private - */ - ParticleBuffer.prototype.initBuffers = function initBuffers () - { - var geometry = this.geometry; - - var dynamicOffset = 0; - - /** - * Holds the indices of the geometry (quads) to draw - * - * @member {Uint16Array} - * @private - */ - this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); - geometry.addIndex(this.indexBuffer); - - this.dynamicStride = 0; - - for (var i = 0; i < this.dynamicProperties.length; ++i) - { - var property = this.dynamicProperties[i]; - - property.offset = dynamicOffset; - dynamicOffset += property.size; - this.dynamicStride += property.size; - } - - var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); - - this.dynamicData = new Float32Array(dynBuffer); - this.dynamicDataUint32 = new Uint32Array(dynBuffer); - this.dynamicBuffer = new Buffer(this.dynamicData, false, false); - - // static // - var staticOffset = 0; - - this.staticStride = 0; - - for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1) - { - var property$1 = this.staticProperties[i$1]; - - property$1.offset = staticOffset; - staticOffset += property$1.size; - this.staticStride += property$1.size; - } - - var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); - - this.staticData = new Float32Array(statBuffer); - this.staticDataUint32 = new Uint32Array(statBuffer); - this.staticBuffer = new Buffer(this.staticData, true, false); - - for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2) - { - var property$2 = this.dynamicProperties[i$2]; - - geometry.addAttribute( - property$2.attributeName, - this.dynamicBuffer, - 0, - property$2.type === exports.TYPES.UNSIGNED_BYTE, - property$2.type, - this.dynamicStride * 4, - property$2.offset * 4 - ); - } - - for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3) - { - var property$3 = this.staticProperties[i$3]; - - geometry.addAttribute( - property$3.attributeName, - this.staticBuffer, - 0, - property$3.type === exports.TYPES.UNSIGNED_BYTE, - property$3.type, - this.staticStride * 4, - property$3.offset * 4 - ); - } - }; - - /** - * Uploads the dynamic properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadDynamic = function uploadDynamic (children, startIndex, amount) - { - for (var i = 0; i < this.dynamicProperties.length; i++) - { - var property = this.dynamicProperties[i]; - - property.uploadFunction(children, startIndex, amount, - property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, - this.dynamicStride, property.offset); - } - - this.dynamicBuffer._updateID++; - }; - - /** - * Uploads the static properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadStatic = function uploadStatic (children, startIndex, amount) - { - for (var i = 0; i < this.staticProperties.length; i++) - { - var property = this.staticProperties[i]; - - property.uploadFunction(children, startIndex, amount, - property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, - this.staticStride, property.offset); - } - - this.staticBuffer._updateID++; - }; - - /** - * Destroys the ParticleBuffer. - * - * @private - */ - ParticleBuffer.prototype.destroy = function destroy () - { - this.indexBuffer = null; - - this.dynamicProperties = null; - // this.dynamicBuffer.destroy(); - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - - this.staticProperties = null; - // this.staticBuffer.destroy(); - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - // all buffers are destroyed inside geometry - this.geometry.destroy(); - }; - - var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; - - var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now - * share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleRenderer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java - */ - - /** - * Renderer for Particles that is designer for speed over feature set. - * - * @class - * @memberof PIXI - */ - var ParticleRenderer = /*@__PURE__*/(function (ObjectRenderer) { - function ParticleRenderer(renderer) - { - ObjectRenderer.call(this, renderer); - - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - // and max number of element in the index buffer is 16384 * 6 = 98304 - // Creating a full index buffer, overhead is 98304 * 2 = 196Ko - // let numIndices = 98304; - - /** - * The default shader that is used if a sprite doesn't have a more specific one. - * - * @member {PIXI.Shader} - */ - this.shader = null; - - this.properties = null; - - this.tempMatrix = new Matrix(); - - this.properties = [ - // verticesData - { - attributeName: 'aVertexPosition', - size: 2, - uploadFunction: this.uploadVertices, - offset: 0, - }, - // positionData - { - attributeName: 'aPositionCoord', - size: 2, - uploadFunction: this.uploadPosition, - offset: 0, - }, - // rotationData - { - attributeName: 'aRotation', - size: 1, - uploadFunction: this.uploadRotation, - offset: 0, - }, - // uvsData - { - attributeName: 'aTextureCoord', - size: 2, - uploadFunction: this.uploadUvs, - offset: 0, - }, - // tintData - { - attributeName: 'aColor', - size: 1, - type: exports.TYPES.UNSIGNED_BYTE, - uploadFunction: this.uploadTint, - offset: 0, - } ]; - - this.shader = Shader.from(vertex$1, fragment$1, {}); - } - - if ( ObjectRenderer ) { ParticleRenderer.__proto__ = ObjectRenderer; } - ParticleRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype ); - ParticleRenderer.prototype.constructor = ParticleRenderer; - - /** - * Renders the particle container object. - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - */ - ParticleRenderer.prototype.render = function render (container) - { - var children = container.children; - var maxSize = container._maxSize; - var batchSize = container._batchSize; - var renderer = this.renderer; - var totalChildren = children.length; - - if (totalChildren === 0) - { - return; - } - else if (totalChildren > maxSize && !container.autoResize) - { - totalChildren = maxSize; - } - - var buffers = container._buffers; - - if (!buffers) - { - buffers = container._buffers = this.generateBuffers(container); - } - - var baseTexture = children[0]._texture.baseTexture; - - // if the uvs have not updated then no point rendering just yet! - this.renderer.state.setBlendMode(correctBlendMode(container.blendMode, baseTexture.alphaMode)); - - var gl = renderer.gl; - - var m = container.worldTransform.copyTo(this.tempMatrix); - - m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); - - this.shader.uniforms.translationMatrix = m.toArray(true); - - this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, - container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); - - this.shader.uniforms.uSampler = baseTexture; - - this.renderer.shader.bind(this.shader); - - var updateStatic = false; - - // now lets upload and render the buffers.. - for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) - { - var amount = (totalChildren - i); - - if (amount > batchSize) - { - amount = batchSize; - } - - if (j >= buffers.length) - { - buffers.push(this._generateOneMoreBuffer(container)); - } - - var buffer = buffers[j]; - - // we always upload the dynamic - buffer.uploadDynamic(children, i, amount); - - var bid = container._bufferUpdateIDs[j] || 0; - - updateStatic = updateStatic || (buffer._updateID < bid); - // we only upload the static content when we have to! - if (updateStatic) - { - buffer._updateID = container._updateID; - buffer.uploadStatic(children, i, amount); - } - - // bind the buffer - renderer.geometry.bind(buffer.geometry); - gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); - } - }; - - /** - * Creates one particle buffer for each child in the container we want to render and updates internal properties - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer[]} The buffers - * @private - */ - ParticleRenderer.prototype.generateBuffers = function generateBuffers (container) - { - var buffers = []; - var size = container._maxSize; - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - - for (var i = 0; i < size; i += batchSize) - { - buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); - } - - return buffers; - }; - - /** - * Creates one more particle buffer, because container has autoResize feature - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer} generated buffer - * @private - */ - ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer (container) - { - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - - return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); - }; - - /** - * Uploads the vertices. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their vertices uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadVertices = function uploadVertices (children, startIndex, amount, array, stride, offset) - { - var w0 = 0; - var w1 = 0; - var h0 = 0; - var h1 = 0; - - for (var i = 0; i < amount; ++i) - { - var sprite = children[startIndex + i]; - var texture = sprite._texture; - var sx = sprite.scale.x; - var sy = sprite.scale.y; - var trim = texture.trim; - var orig = texture.orig; - - if (trim) - { - // if the sprite is trimmed and is not a tilingsprite then we need to add the - // extra space before transforming the sprite coords.. - w1 = trim.x - (sprite.anchor.x * orig.width); - w0 = w1 + trim.width; - - h1 = trim.y - (sprite.anchor.y * orig.height); - h0 = h1 + trim.height; - } - else - { - w0 = (orig.width) * (1 - sprite.anchor.x); - w1 = (orig.width) * -sprite.anchor.x; - - h0 = orig.height * (1 - sprite.anchor.y); - h1 = orig.height * -sprite.anchor.y; - } - - array[offset] = w1 * sx; - array[offset + 1] = h1 * sy; - - array[offset + stride] = w0 * sx; - array[offset + stride + 1] = h1 * sy; - - array[offset + (stride * 2)] = w0 * sx; - array[offset + (stride * 2) + 1] = h0 * sy; - - array[offset + (stride * 3)] = w1 * sx; - array[offset + (stride * 3) + 1] = h0 * sy; - - offset += stride * 4; - } - }; - - /** - * Uploads the position. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their positions uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadPosition = function uploadPosition (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; i++) - { - var spritePosition = children[startIndex + i].position; - - array[offset] = spritePosition.x; - array[offset + 1] = spritePosition.y; - - array[offset + stride] = spritePosition.x; - array[offset + stride + 1] = spritePosition.y; - - array[offset + (stride * 2)] = spritePosition.x; - array[offset + (stride * 2) + 1] = spritePosition.y; - - array[offset + (stride * 3)] = spritePosition.x; - array[offset + (stride * 3) + 1] = spritePosition.y; - - offset += stride * 4; - } - }; - - /** - * Uploads the rotiation. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadRotation = function uploadRotation (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; i++) - { - var spriteRotation = children[startIndex + i].rotation; - - array[offset] = spriteRotation; - array[offset + stride] = spriteRotation; - array[offset + (stride * 2)] = spriteRotation; - array[offset + (stride * 3)] = spriteRotation; - - offset += stride * 4; - } - }; - - /** - * Uploads the Uvs - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadUvs = function uploadUvs (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; ++i) - { - var textureUvs = children[startIndex + i]._texture._uvs; - - if (textureUvs) - { - array[offset] = textureUvs.x0; - array[offset + 1] = textureUvs.y0; - - array[offset + stride] = textureUvs.x1; - array[offset + stride + 1] = textureUvs.y1; - - array[offset + (stride * 2)] = textureUvs.x2; - array[offset + (stride * 2) + 1] = textureUvs.y2; - - array[offset + (stride * 3)] = textureUvs.x3; - array[offset + (stride * 3) + 1] = textureUvs.y3; - - offset += stride * 4; - } - else - { - // TODO you know this can be easier! - array[offset] = 0; - array[offset + 1] = 0; - - array[offset + stride] = 0; - array[offset + stride + 1] = 0; - - array[offset + (stride * 2)] = 0; - array[offset + (stride * 2) + 1] = 0; - - array[offset + (stride * 3)] = 0; - array[offset + (stride * 3) + 1] = 0; - - offset += stride * 4; - } - } - }; - - /** - * Uploads the tint. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadTint = function uploadTint (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; ++i) - { - var sprite = children[startIndex + i]; - var premultiplied = sprite._texture.baseTexture.alphaMode > 0; - var alpha = sprite.alpha; - // we dont call extra function if alpha is 1.0, that's faster - var argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) - : sprite._tintRGB + (alpha * 255 << 24); - - array[offset] = argb; - array[offset + stride] = argb; - array[offset + (stride * 2)] = argb; - array[offset + (stride * 3)] = argb; - - offset += stride * 4; - } - }; - - /** - * Destroys the ParticleRenderer. - */ - ParticleRenderer.prototype.destroy = function destroy () - { - ObjectRenderer.prototype.destroy.call(this); - - if (this.shader) - { - this.shader.destroy(); - this.shader = null; - } - - this.tempMatrix = null; - }; - - return ParticleRenderer; - }(ObjectRenderer)); - - /*! - * @pixi/spritesheet - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/spritesheet - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/spritesheet is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -42378,8 +42578,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/sprite-tiling - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/sprite-tiling - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/sprite-tiling is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -42645,7 +42845,7 @@ var PIXI = (function (exports) { * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from * @param {number} width - the width of the tiling sprite * @param {number} height - the height of the tiling sprite * @return {PIXI.TilingSprite} The newly created texture @@ -42766,6 +42966,14 @@ var PIXI = (function (exports) { this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); this.quad = new QuadUv(); + + /** + * The WebGL state in which this renderer will work. + * + * @member {PIXI.State} + * @readonly + */ + this.state = State.for2d(); } if ( ObjectRenderer ) { TilingSpriteRenderer.__proto__ = ObjectRenderer; } @@ -42866,7 +43074,8 @@ var PIXI = (function (exports) { renderer.shader.bind(shader); renderer.geometry.bind(quad);// , renderer.shader.getGLShader()); - renderer.state.setBlendMode(correctBlendMode(ts.blendMode, baseTex.alphaMode)); + this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode); + renderer.state.set(this.state); renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0); }; @@ -42874,8 +43083,8 @@ var PIXI = (function (exports) { }(ObjectRenderer)); /*! - * @pixi/text-bitmap - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/text-bitmap - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/text-bitmap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -43563,6 +43772,7 @@ var PIXI = (function (exports) { BitmapFontLoader.dirname = function dirname (url) { var dir = url + .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character .replace(/\/$/, '') // replace trailing slash .replace(/\/[^\/]*$/, ''); // remove everything after the last @@ -43699,8 +43909,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/filter-alpha - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-alpha - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-alpha is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -43763,8 +43973,8 @@ var PIXI = (function (exports) { }(Filter)); /*! - * @pixi/filter-blur - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-blur - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-blur is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -43947,7 +44157,7 @@ var PIXI = (function (exports) { var flop = renderTarget; this.state.blend = false; - filterManager.applyFilter(this, flip, flop, false); + filterManager.applyFilter(this, flip, flop, true); for (var i = 1; i < this.passes - 1; i++) { @@ -44188,8 +44398,8 @@ var PIXI = (function (exports) { }(Filter)); /*! - * @pixi/filter-color-matrix - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-color-matrix - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-color-matrix is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -44786,8 +44996,8 @@ var PIXI = (function (exports) { ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; /*! - * @pixi/filter-displacement - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-displacement - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-displacement is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -44903,8 +45113,8 @@ var PIXI = (function (exports) { }(Filter)); /*! - * @pixi/filter-fxaa - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-fxaa - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-fxaa is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -44940,8 +45150,8 @@ var PIXI = (function (exports) { }(Filter)); /*! - * @pixi/filter-noise - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/filter-noise - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/filter-noise is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45019,8 +45229,8 @@ var PIXI = (function (exports) { }(Filter)); /*! - * @pixi/mixin-cache-as-bitmap - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/mixin-cache-as-bitmap - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/mixin-cache-as-bitmap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45444,8 +45654,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/mixin-get-child-by-name - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/mixin-get-child-by-name - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/mixin-get-child-by-name is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45481,8 +45691,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/mixin-get-global-position - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/mixin-get-global-position - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/mixin-get-global-position is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45685,6 +45895,91 @@ var PIXI = (function (exports) { }, }); + /** + * @namespace PIXI.prepare + * @see PIXI + * @deprecated since 5.2.1 + */ + PIXI.prepare = {}; + + Object.defineProperties(PIXI.prepare, { + /** + * @class PIXI.prepare.BasePrepare + * @deprecated since 5.2.1 + * @see PIXI.BasePrepare + */ + BasePrepare: { + get: function get() + { + deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare'); + + return PIXI.BasePrepare; + }, + }, + /** + * @class PIXI.prepare.Prepare + * @deprecated since 5.2.1 + * @see PIXI.Prepare + */ + Prepare: { + get: function get() + { + deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare'); + + return PIXI.Prepare; + }, + }, + /** + * @class PIXI.prepare.CanvasPrepare + * @deprecated since 5.2.1 + * @see PIXI.CanvasPrepare + */ + CanvasPrepare: { + get: function get() + { + deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare'); + + return PIXI.CanvasPrepare; + }, + }, + }); + + /** + * @namespace PIXI.extract + * @see PIXI + * @deprecated since 5.2.1 + */ + PIXI.extract = {}; + + Object.defineProperties(PIXI.extract, { + /** + * @class PIXI.extract.Extract + * @deprecated since 5.2.1 + * @see PIXI.Extract + */ + Extract: { + get: function get() + { + deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract'); + + return PIXI.Extract; + }, + }, + /** + * @class PIXI.extract.CanvasExtract + * @deprecated since 5.2.1 + * @see PIXI.CanvasExtract + */ + CanvasExtract: { + get: function get() + { + deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract'); + + return PIXI.CanvasExtract; + }, + }, + }); + /** * This namespace has been removed. All classes previous nested * under this namespace have been moved to the top-level `PIXI` object. @@ -46046,28 +46341,28 @@ var PIXI = (function (exports) { /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 - * @see PIXI.extract.Extract + * @see PIXI.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { get: function get() { - deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.extract.Extract'); + deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract'); - return PIXI.extract.Extract; + return PIXI.Extract; }, }); /** * @class PIXI.prepare.WebGLPrepare * @deprecated since 5.0.0 - * @see PIXI.prepare.Prepare + * @see PIXI.Prepare */ Object.defineProperty(PIXI.prepare, 'WebGLPrepare', { get: function get() { - deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.prepare.Prepare'); + deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare'); - return PIXI.prepare.Prepare; + return PIXI.Prepare; }, }); @@ -46602,6 +46897,28 @@ var PIXI = (function (exports) { }, }); + /** + * @deprecated since 5.0.0 + * @member {PIXI.Point[]} PIXI.SimpleRope#points + * @see PIXI.Mesh#geometry + */ + Object.defineProperty(PIXI.SimpleRope.prototype, 'points', { + get: function get() + { + deprecation(v5, 'PIXI.SimpleRope.points property is deprecated, ' + + 'use PIXI.SimpleRope.geometry.points'); + + return this.geometry.points; + }, + set: function set(value) + { + deprecation(v5, 'PIXI.SimpleRope.points property is deprecated, ' + + 'use PIXI.SimpleRope.geometry.points'); + + this.geometry.points = value; + }, + }); + // Use these to deprecate all the Sprite from* methods function spriteFrom(name, source, crossorigin, scaleMode) { @@ -46780,8 +47097,8 @@ var PIXI = (function (exports) { } /*! - * @pixi/mesh - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/mesh - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/mesh is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -47215,9 +47532,11 @@ var PIXI = (function (exports) { if (this._roundPixels) { - for (var i$1 = 0; i$1 < vertexData.length; i$1++) + var resolution = settings.RESOLUTION; + + for (var i$1 = 0; i$1 < vertexData.length; ++i$1) { - vertexData[i$1] = Math.round(vertexData[i$1]); + vertexData[i$1] = Math.round((vertexData[i$1] * resolution | 0) / resolution); } } @@ -47558,8 +47877,8 @@ var PIXI = (function (exports) { }(Geometry)); /*! - * @pixi/mesh-extras - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/mesh-extras - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/mesh-extras is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -48190,8 +48509,7 @@ var PIXI = (function (exports) { { var vertices = this.vertices; - var h = this._topHeight + this._bottomHeight; - var scale = this._height > h ? 1.0 : this._height / h; + var scale = this._getMinScale(); vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale); @@ -48206,14 +48524,32 @@ var PIXI = (function (exports) { { var vertices = this.vertices; - var w = this._leftWidth + this._rightWidth; - var scale = this._width > w ? 1.0 : this._width / w; + var scale = this._getMinScale(); vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale); vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; }; + /** + * Returns the smaller of a set of vertical and horizontal scale of nine slice corners. + * + * @return {number} Smaller number of vertical and horizontal scale. + * @private + */ + NineSlicePlane.prototype._getMinScale = function _getMinScale () + { + var w = this._leftWidth + this._rightWidth; + var scaleW = this._width > w ? 1.0 : this._width / w; + + var h = this._topHeight + this._bottomHeight; + var scaleH = this._height > h ? 1.0 : this._height / h; + + var scale = Math.min(scaleW, scaleH); + + return scale; + }; + /** * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * @@ -48348,8 +48684,8 @@ var PIXI = (function (exports) { }(SimplePlane)); /*! - * @pixi/sprite-animated - v5.2.0 - * Compiled Wed, 06 Nov 2019 02:32:43 UTC + * @pixi/sprite-animated - v5.2.1 + * Compiled Tue, 28 Jan 2020 23:33:11 UTC * * @pixi/sprite-animated is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -48605,7 +48941,8 @@ var PIXI = (function (exports) { if (this._currentTime < 0 && !this.loop) { - this.gotoAndStop(0); + this._currentTime = 0; + this.stop(); if (this.onComplete) { @@ -48614,7 +48951,8 @@ var PIXI = (function (exports) { } else if (this._currentTime >= this._textures.length && !this.loop) { - this.gotoAndStop(this._textures.length - 1); + this._currentTime = this._textures.length - 1; + this.stop(); if (this.onComplete) { @@ -48813,7 +49151,7 @@ var PIXI = (function (exports) { * @name VERSION * @type {string} */ - var VERSION$1 = '5.2.0'; + var VERSION$1 = '5.2.1'; /** * @namespace PIXI @@ -48862,6 +49200,7 @@ var PIXI = (function (exports) { exports.AppLoaderPlugin = AppLoaderPlugin; exports.Application = Application; exports.Attribute = Attribute; + exports.BasePrepare = BasePrepare; exports.BaseRenderTexture = BaseRenderTexture; exports.BaseTexture = BaseTexture; exports.BatchDrawCall = BatchDrawCall; @@ -48876,10 +49215,12 @@ var PIXI = (function (exports) { exports.Buffer = Buffer; exports.Circle = Circle; exports.Container = Container; + exports.CountLimiter = CountLimiter; exports.CubeTexture = CubeTexture; exports.DEG_TO_RAD = DEG_TO_RAD; exports.DisplayObject = DisplayObject; exports.Ellipse = Ellipse; + exports.Extract = Extract; exports.FillStyle = FillStyle; exports.Filter = Filter; exports.Framebuffer = Framebuffer; @@ -48908,6 +49249,7 @@ var PIXI = (function (exports) { exports.PlaneGeometry = PlaneGeometry; exports.Point = Point; exports.Polygon = Polygon; + exports.Prepare = Prepare; exports.Program = Program; exports.Quad = Quad; exports.QuadUv = QuadUv; @@ -48941,6 +49283,7 @@ var PIXI = (function (exports) { exports.TickerPlugin = TickerPlugin; exports.TilingSprite = TilingSprite; exports.TilingSpriteRenderer = TilingSpriteRenderer; + exports.TimeLimiter = TimeLimiter; exports.Transform = Transform; exports.UniformGroup = UniformGroup; exports.VERSION = VERSION$1; @@ -48950,13 +49293,11 @@ var PIXI = (function (exports) { exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; exports.defaultFilterVertex = defaultFilter; exports.defaultVertex = _default; - exports.extract = extract_es; exports.filters = filters; - exports.graphicsUtils = index$1; + exports.graphicsUtils = index$2; exports.groupD8 = groupD8; exports.interaction = interaction_es; - exports.isMobile = isMobile_min; - exports.prepare = prepare_es; + exports.isMobile = isMobile$1; exports.resources = index; exports.settings = settings; exports.systems = systems; diff --git a/dist/iwmlib.3rdparty.min.js b/dist/iwmlib.3rdparty.min.js index 23fabe8..7ab66e2 100644 --- a/dist/iwmlib.3rdparty.min.js +++ b/dist/iwmlib.3rdparty.min.js @@ -1 +1 @@ -!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 function(r){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=i,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([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){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);var n=[i.pop()];for(;1/g,"> ").trim()};var i,n=r(3),h=(i=n)&&i.__esModule?i:{default:i},c=r(0);function f(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(g(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[l];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,g(document.querySelectorAll(a),o)&&(i=e),"break"}},l=0,u=s.length;l/.test(i)){var h=i.replace(/>/,"");a=""+r+h+n;g(document.querySelectorAll(a),o)&&(i=h)}if(/:nth-child/.test(i)){var c=i.replace(/nth-child/g,"nth-of-type");a=""+r+c+n;g(document.querySelectorAll(a),o)&&(i=c)}if(/\.\S+\.\S+/.test(i)){for(var f=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var p=i.replace(f.shift(),"").trim();if(!(a=(""+r+p+n).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;g(document.querySelectorAll(a),o)&&(i=p)}if((f=i&&i.match(/\./g))&&2/.test(s):u=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");l=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=i.shift(),n=i.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,n,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===c||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 A(e,t){for(var r,i,n=t[0].toUpperCase()+t.slice(1),o=0;of(u.y)?u.x:u.y,t.scale=a?function(e,t){return ie(t[0],t[1],J)/ie(e[0],e[1],J)}(a.pointers,i):1,t.rotation=a?function(e,t){return ne(t[1],t[0],J)+ne(e[1],e[0],J)}(a.pointers,i):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,i,n,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=B&&(Lf(h.y)?h.x:h.y,o=re(l,u),e.lastInterval=t}else r=a.velocity,i=a.velocityX,n=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=i,t.velocityY=n,t.direction=o}(r,t);var h=e.element;T(t.srcEvent.target,h)&&(h=t.srcEvent.target);t.target=h}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function $(e){for(var t=[],r=0;r=f(t)?e<0?X:H:t<0?W:q}function ie(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return Math.sqrt(i*i+n*n)}function ne(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return 180*Math.atan2(n,i)/Math.PI}K.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:j,mousemove:2,mouseup:N},ae="mousedown",se="mousemove mouseup";function le(){this.evEl=ae,this.evWin=se,this.pressed=!1,K.apply(this,arguments)}v(le,K,{handler:function(e){var t=oe[e.type];t&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var ue={pointerdown:j,pointermove:2,pointerup:N,pointercancel:B,pointerout:B},he={2:z,3:"pen",4:F,5:"kinect"},ce="pointerdown",fe="pointermove pointerup pointercancel";function pe(){this.evEl=ce,this.evWin=fe,K.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ce="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),v(pe,K,{handler:function(e){var t=this.store,r=!1,i=e.type.toLowerCase().replace("ms",""),n=ue[i],o=he[e.pointerType]||e.pointerType,a=o==z,s=P(t,e.pointerId,"pointerId");n&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):n&(N|B)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var de={touchstart:j,touchmove:2,touchend:N,touchcancel:B};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,K.apply(this,arguments)}v(me,K,{handler:function(e){var t=de[e.type];if(t===j&&(this.started=!0),this.started){var r=function(e,t){var r=E(e.touches),i=E(e.changedTouches);t&(N|B)&&(r=C(r.concat(i),"identifier",!0));return[r,i]}.call(this,e,t);t&(N|B)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:z,srcEvent:e})}}});var ge={touchstart:j,touchmove:2,touchend:N,touchcancel:B},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},K.apply(this,arguments)}v(_e,K,{handler:function(e){var t=ge[e.type],r=function(e,t){var r=E(e.touches),i=this.targetIds;if(t&(2|j)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,a=E(e.changedTouches),s=[],l=this.target;if(o=r.filter(function(e){return T(e.target,l)}),t===j)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return Fe.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=Re(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(je,Fe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Ne,Me,{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&(N|B)&&!n)this.reset();else if(e.eventType&j)this.reset(),this._timer=u(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&N)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}}),v(Be,Fe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Fe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|V,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(G|V)?t=e.overallVelocity:r&G?t=e.overallVelocityX:r&V&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&f(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Re(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Me,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Se]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distance80*r){i=o=e[0],n=a=e[1];for(var d=r;do.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,h=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,c=C(s,l,t,r,i),f=C(u,h,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=c&&d&&d.z<=f;){if(p!==e.prev&&p!==e.next&&I(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=O(p.prev,p,p.next))return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&I(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=O(d.prev,d,d.next))return!1;d=d.nextZ}for(;p&&p.z>=c;){if(p!==e.prev&&p!==e.next&&I(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=O(p.prev,p,p.next))return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==e.prev&&d!==e.next&&I(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=O(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function k(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!M(n,o)&&R(n,i,i.next,o)&&L(n,o)&&L(o,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(o.i/r),B(i),B(i.next),i=e=o),i=i.next}while(i!==e);return y(i)}function S(e,t,r,i,n,o){var a,s,l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&(s=u,(a=l).next.i!==s.i&&a.prev.i!==s.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&&R(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&(L(a,s)&&L(s,a)&&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}(a,s)&&(O(a.prev,a,s.prev)||O(a,s.prev,s))||M(a,s)&&0=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&&I(or.x||i.x===r.x&&(d=i,O((p=r).prev,p,d.prev)<0&&O(d.next,p,p.next)<0)))&&(r=i,f=l)),i=i.next,i!==u;);var p,d;return r}(e,t)){var r=j(t,e);y(r,r.next)}}function C(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function A(e){for(var t=e,r=e;(t.x=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function F(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=_-y,k=Math.floor,S=String.fromCharCode;function P(e){throw RangeError(c[e])}function p(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function d(e,t){var r=e.split("@"),i="";return 1>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var i=0;for(e=r?k(e/s):e>>1,e+=k(e/t);f*b>>1k((v-d)/a))&&P("overflow"),d+=l*a,!(l<(u=s<=g?y:g+b<=s?b:s-g));s+=_)a>k(v/(h=_-u))&&P("overflow"),a*=h;g=I(d-o,t=f.length+1,0==o),k(d/t)>v-m&&P("overflow"),m+=k(d/t),d%=t,f.splice(d++,0,m)}return C(f)}function g(e){var t,r,i,n,o,a,s,l,u,h,c,f,p,d,m,g=[];for(f=(e=E(e)).length,t=w,o=x,a=r=0;ak((v-r)/(p=i+1))&&P("overflow"),r+=(s-t)*p,t=s,a=0;av&&P("overflow"),c==t){for(l=r,u=_;!(l<(h=u<=o?y:o+b<=u?b:u-o));u+=_)m=l-h,d=_-h,g.push(S(A(h+m%d,0))),l=k(m/d);g.push(S(A(l,0))),o=I(r,p,i==n),r=0,++i}++r,++t}return g.join("")}if(n={version:"1.3.2",ucs2:{decode:E,encode:C},decode:m,encode:g,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return d(e,function(e){return l.test(e)?m(e.slice(4).toLowerCase()):e})}},t&&r)if(O.exports==t)r.exports=n;else for(o in n)n.hasOwnProperty(o)&&(t[o]=n[o]);else e.punycode=n}(D)}),W={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};W.isString,W.isObject,W.isNull,W.isNullOrUndefined;var q=function(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var s,l,u=e.length;0",'"',"`"," ","\r","\n","\t"]),ae=["'"].concat(oe),se=["%","/","?",";","#"].concat(ae),le=["/","?","#"],ue=/^[+a-z0-9A-Z_-]{0,63}$/,he=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ce={javascript:!0,"javascript:":!0},fe={javascript:!0,"javascript:":!0},pe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function de(e,t,r){if(e&&W.isObject(e)&&e instanceof te)return e;var i=new te;return i.parse(e,t,r),i}te.prototype.parse=function(e,t,r){if(!W.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=-1!==i&&i>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function Fe(e){return e=e.toString(16),"#"+(e="000000".substr(0,6-e.length)+e)}function Le(e){return"string"==typeof e&&"#"===e[0]&&(e=e.substr(1)),parseInt(e,16)}var je=function(){for(var e=[],t=[],r=0;r<32;r++)t[e[r]=r]=r;e[G.BLEND_MODES.NORMAL_NPM]=G.BLEND_MODES.NORMAL,e[G.BLEND_MODES.ADD_NPM]=G.BLEND_MODES.ADD,e[G.BLEND_MODES.SCREEN_NPM]=G.BLEND_MODES.SCREEN,t[G.BLEND_MODES.NORMAL]=G.BLEND_MODES.NORMAL_NPM,t[G.BLEND_MODES.ADD]=G.BLEND_MODES.ADD_NPM,t[G.BLEND_MODES.SCREEN]=G.BLEND_MODES.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function Ne(e,t){return je[t?1:0][e]}function Be(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 Ue(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,i=e>>8&255,n=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((i=i*t+.5|0)<<8)+(n=n*t+.5|0)}function Xe(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 He(e,t){void 0===t&&(t=null);var r=6*e;if((t=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|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function Ze(e){return!(e&e-1||!e)}function Je(e){var t=(65535>>=t))<<3;return t|=r,t|=r=(15<(e>>>=r))<<2,(t|=r=(3<(e>>>=r))<<1)|(e>>>=r)>>1}var Ke={},Qe=Object.create(null),$e=Object.create(null);function et(e){var t,r,i,n=e.width,o=e.height,a=e.getContext("2d"),s=a.getImageData(0,0,n,o).data,l=s.length,u={top:null,left:null,right:null,bottom:null},h=null;for(t=0;t=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),i=t-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=e-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=t-(this.y+this.height-this.radius))*i<=n)return!0;if((r=e-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}();T.SORTABLE_CHILDREN=!1;var Ot=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null};Ot.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Ot.prototype.clear=function(){this.updateID++,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Ot.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Pt.EMPTY:((e=e||new Pt(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},Ot.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)},Ot.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},Ot.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,n=e.maxXt.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,n=e.maxXr?this.maxX:r,this.minY=this.minYi?this.maxY:i};var Mt=function(e){function n(){e.call(this),this.tempDisplayObjectParent=null,this.transform=new St,this.alpha=1,this.visible=!0,this.renderable=!0,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ot,this._boundsID=0,this._lastBoundsID=-1,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}e&&(n.__proto__=e);var t={_tempDisplayObjectParent:{configurable:!0},x:{configurable:!0},y:{configurable:!0},worldTransform:{configurable:!0},localTransform:{configurable:!0},position:{configurable:!0},scale:{configurable:!0},pivot:{configurable:!0},skew:{configurable:!0},rotation:{configurable:!0},angle:{configurable:!0},zIndex:{configurable:!0},worldVisible:{configurable:!0},mask:{configurable:!0}};return((n.prototype=Object.create(e&&e.prototype)).constructor=n).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},e.prototype.swapChildren=function(e,t){if(e!==t){var 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);We(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},e.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},e.prototype.removeChild=function(e){var t=arguments,r=arguments.length;if(1 title : "+e.title+"
tabIndex: "+e.tabIndex},Ft.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},Ft.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,t.style.borderStyle="none",-1t.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},t.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},t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.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}},t.prototype.update=function(e){var t;if(void 0===e&&(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(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var rr=function(h){function r(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){var r=document.createElement("video");r.setAttribute("preload","auto"),r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]),h.crossOrigin(r,e[0].src||e[0],t.crossorigin);for(var i=0;ithis.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",l="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+l+" "+s+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},e.rotate.get=function(){return this._rotate},e.rotate.set=function(e){this._rotate=e,this.valid&&this.updateUvs()},e.width.get=function(){return this.orig.width},e.height.get=function(){return this.orig.height},Object.defineProperties(s.prototype,e),s}(d);function pr(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}fr.EMPTY=new fr(new Kt),pr(fr.EMPTY),pr(fr.EMPTY.baseTexture),fr.WHITE=function(){var e=document.createElement("canvas");e.width=16,e.height=16;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,16,16),new fr(new Kt(new $t(e)))}(),pr(fr.WHITE),pr(fr.WHITE.baseTexture);var dr=function(s){function t(e,t){var r=null;if(!(e instanceof ur)){var i=arguments[1],n=arguments[2],o=arguments[3],a=arguments[4];console.warn("Please use RenderTexture.create("+i+", "+n+") instead of the ctor directly."),r=arguments[0],t=null,e=new ur({width:i,height:n,scaleMode:o,resolution:a})}s.call(this,e,t),this.legacyRenderer=r,this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.resize=function(e,t,r){void 0===r&&(r=!0),e=Math.ceil(e),t=Math.ceil(t),this.valid=0=G.ENV.WEBGL2&&(r=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(),r},e.prototype.getExtensions=function(){var e=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBKIT_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"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),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,{anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:e.getExtension("EXT_color_buffer_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear")})},e.prototype.handleContextLost=function(e){e.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.run(this.gl)},e.prototype.destroy=function(){var e=this.renderer.view;e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(e){e.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly")},Object.defineProperties(e.prototype,r),e}(or),zr=function(t){function e(e){t.call(this,e),this.managedFramebuffers=[],this.unknownFramebuffer=new sr(10,10)}t&&(e.__proto__=t);var r={size:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;T.PREFER_ENV===G.ENV.WEBGL_LEGACY&&(r=t=null),t?e.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),r||(this.writeDepthTexture=!1)}},e.prototype.bind=function(e,t){var r=this.gl;if(e){var i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat!==e.dirtyFormat?(i.dirtyFormat=e.dirtyFormat,this.updateFramebuffer(e)):i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var n=0;n=i.data.byteLength)t.bufferSubData(o,0,i.data);else{var a=i.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,t.bufferData(o,i.data,a)}}}},e.prototype.checkCompatibility=function(e,t){var r=e.attributes,i=t.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},e.prototype.getSignature=function(e,t){var r=e.attributes,i=t.attributeData,n=["g",e.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},e.prototype.initGeometryVao=function(e,t){this.checkCompatibility(e,t);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(e,t),o=e.glVertexArrayObjects[this.CONTEXT_UID],a=o[n];if(a)return o[t.id]=a;var s=e.buffers,l=e.attributes,u={},h={};for(var c in s)u[c]=0,h[c]=0;for(var f in l)!l[f].size&&t.attributeData[f]?l[f].size=t.attributeData[f].size:l[f].size||console.warn("PIXI Geometry attribute '"+f+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[l[f].buffer]+=l[f].size*Lr[l[f].type];for(var p in l){var d=l[p],m=d.size;void 0===d.stride&&(u[d.buffer]===m*Lr[d.type]?d.stride=0:d.stride=u[d.buffer]),void 0===d.start&&(d.start=h[d.buffer],h[d.buffer]+=m*Lr[d.type])}a=r.createVertexArray(),r.bindVertexArray(a);for(var g=0;g=G.ENV.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),Gr=e}return Gr}function Yr(e,t,r){if("precision"===e.substring(0,9))return r!==G.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e;var i=t;return t===G.PRECISION.HIGH&&r!==G.PRECISION.HIGH&&(i=G.PRECISION.MEDIUM),"precision "+i+" float;\n"+e}var Zr={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};var Jr=null,Kr={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray"};function Qr(e,t){if(!Jr){var r=Object.keys(Kr);Jr={};for(var i=0;it.name?1:-1});for(var h=0;h>=1,r++;this.stateId=e.data}for(var i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},e.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,a=0;athis.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)},g.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=g._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++Kt._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)}0this.maxSegments&&(r=this.maxSegments),r}},pn=function(){this.reset()};pn.prototype.clone=function(){var e=new pn;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},pn.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=fr.WHITE,this.matrix=null,this.visible=!1},pn.prototype.destroy=function(){this.texture=null,this.matrix=null};var dn={build:function(e){e.points=e.shape.points.slice()},triangulate:function(e,t){var r=e.points,i=e.holes,n=t.points,o=t.indices;if(6<=r.length){for(var a=[],s=0;s>16)+(65280&t)+((255&t)<<16),r);0>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&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;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=i&&jn.x=n&&jn.y>16)+(65280&e)+((255&e)<<16)},e.texture.get=function(){return this._texture},e.texture.set=function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||fr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},Object.defineProperties(i.prototype,e),i}(Rt),Un={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},Xn={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Un.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},Hn=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Wn=function(e){this.styleID=0,this.reset(),Yn(this,e,e)},qn={align:{configurable:!0},breakWords:{configurable:!0},dropShadow:{configurable:!0},dropShadowAlpha:{configurable:!0},dropShadowAngle:{configurable:!0},dropShadowBlur:{configurable:!0},dropShadowColor:{configurable:!0},dropShadowDistance:{configurable:!0},fill:{configurable:!0},fillGradientType:{configurable:!0},fillGradientStops:{configurable:!0},fontFamily:{configurable:!0},fontSize:{configurable:!0},fontStyle:{configurable:!0},fontVariant:{configurable:!0},fontWeight:{configurable:!0},letterSpacing:{configurable:!0},lineHeight:{configurable:!0},leading:{configurable:!0},lineJoin:{configurable:!0},miterLimit:{configurable:!0},padding:{configurable:!0},stroke:{configurable:!0},strokeThickness:{configurable:!0},textBaseline:{configurable:!0},trim:{configurable:!0},whiteSpace:{configurable:!0},wordWrap:{configurable:!0},wordWrapWidth:{configurable:!0}};function Gn(e){return"number"==typeof e?Fe(e):("string"==typeof e&&0===e.indexOf("0x")&&(e=e.replace("0x","#")),e)}function Vn(e){if(Array.isArray(e)){for(var t=0;t>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(var a=0;a=a.length&&a.push(this._generateOneMoreBuffer(e));var d=a[f];d.uploadDynamic(t,c,p);var m=e._bufferUpdateIDs[f]||0;(h=h||d._updateID=i&&Jo.x=n&&Jo.ys&&(We(i,1+f-++d,1+g-f),g=f,f=-1,n.push(p),h=Math.max(h,p),c++,r.x=0,r.y+=e.lineHeight,l=null))}else n.push(u),h=Math.max(h,u),++c,++d,r.x=0,r.y+=e.lineHeight,l=null}var b=o.charAt(o.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(u=p),n.push(u),h=Math.max(h,u));for(var x=[],w=0;w<=c;w++){var T=0;"right"===this._font.align?T=h-n[w]:"center"===this._font.align&&(T=(h-n[w])/2),x.push(T)}for(var k=i.length,S=this.tint,P=0;P 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",e),this.alpha=1}t&&(e.__proto__=t);var r={matrix:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._loadMatrix=function(e,t){void 0===t&&(t=!1);var r=e;t&&(this._multiply(r,this.uniforms.m,e),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(e,t,r){return e[0]=t[0]*r[0]+t[1]*r[5]+t[2]*r[10]+t[3]*r[15],e[1]=t[0]*r[1]+t[1]*r[6]+t[2]*r[11]+t[3]*r[16],e[2]=t[0]*r[2]+t[1]*r[7]+t[2]*r[12]+t[3]*r[17],e[3]=t[0]*r[3]+t[1]*r[8]+t[2]*r[13]+t[3]*r[18],e[4]=t[0]*r[4]+t[1]*r[9]+t[2]*r[14]+t[3]*r[19]+t[4],e[5]=t[5]*r[0]+t[6]*r[5]+t[7]*r[10]+t[8]*r[15],e[6]=t[5]*r[1]+t[6]*r[6]+t[7]*r[11]+t[8]*r[16],e[7]=t[5]*r[2]+t[6]*r[7]+t[7]*r[12]+t[8]*r[17],e[8]=t[5]*r[3]+t[6]*r[8]+t[7]*r[13]+t[8]*r[18],e[9]=t[5]*r[4]+t[6]*r[9]+t[7]*r[14]+t[8]*r[19]+t[9],e[10]=t[10]*r[0]+t[11]*r[5]+t[12]*r[10]+t[13]*r[15],e[11]=t[10]*r[1]+t[11]*r[6]+t[12]*r[11]+t[13]*r[16],e[12]=t[10]*r[2]+t[11]*r[7]+t[12]*r[12]+t[13]*r[17],e[13]=t[10]*r[3]+t[11]*r[8]+t[12]*r[13]+t[13]*r[18],e[14]=t[10]*r[4]+t[11]*r[9]+t[12]*r[14]+t[13]*r[19]+t[14],e[15]=t[15]*r[0]+t[16]*r[5]+t[17]*r[10]+t[18]*r[15],e[16]=t[15]*r[1]+t[16]*r[6]+t[17]*r[11]+t[18]*r[16],e[17]=t[15]*r[2]+t[16]*r[7]+t[17]*r[12]+t[18]*r[17],e[18]=t[15]*r[3]+t[16]*r[8]+t[17]*r[13]+t[18]*r[18],e[19]=t[15]*r[4]+t[16]*r[9]+t[17]*r[14]+t[18]*r[19]+t[19],e},e.prototype._colorMatrix=function(e){var t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t},e.prototype.brightness=function(e,t){var r=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.greyscale=function(e,t){var r=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(r,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),i=Math.sin(e),n=(0,Math.sqrt)(1/3),o=[r+1/3*(1-r),1/3*(1-r)-n*i,1/3*(1-r)+n*i,0,0,1/3*(1-r)+n*i,r+1/3*(1-r),1/3*(1-r)-n*i,0,0,1/3*(1-r)-n*i,1/3*(1-r)+n*i,r+1/3*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,t)},e.prototype.contrast=function(e,t){var r=(e||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,t)},e.prototype.saturate=function(e,t){void 0===e&&(e=0);var r=2*e/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,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,s=(255&r)/255,l=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,h=(255&i)/255,c=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,l,u,h,t=t||.15,0,o-l,a-u,s-h,0,0];this._loadMatrix(c,n)},e.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.predator=function(e,t){var r=[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];this._loadMatrix(r,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)},r.matrix.get=function(){return this.uniforms.m},r.matrix.set=function(e){this.uniforms.m=e},r.alpha.get=function(){return this.uniforms.uAlpha},r.alpha.set=function(e){this.uniforms.uAlpha=e},Object.defineProperties(e.prototype,r),e}(pi);ua.prototype.grayscale=ua.prototype.greyscale;var ha=function(i){function e(e,t){var r=new gt;e.renderable=!1,i.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,this.maskMatrix=r,null==t&&(t=20),this.scale=new ct(t,t)}i&&(e.__proto__=i);var t={map:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).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.transform.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)},t.map.get=function(){return this.uniforms.mapSampler},t.map.set=function(e){this.uniforms.mapSampler=e},Object.defineProperties(e.prototype,t),e}(pi),ca=function(e){function t(){e.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 inputPixel;\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, inputPixel.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 inputPixel;\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, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(pi),fa=function(r){function e(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random()),r.call(this,ji,"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.noise=e,this.seed=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={noise:{configurable:!0},seed:{configurable:!0}};return t.noise.get=function(){return this.uniforms.uNoise},t.noise.set=function(e){this.uniforms.uNoise=e},t.seed.get=function(){return this.uniforms.uSeed},t.seed.set=function(e){this.uniforms.uSeed=e},Object.defineProperties(e.prototype,t),e}(pi),pa=new gt;Mt.prototype._cacheAsBitmap=!1,Mt.prototype._cacheData=!1;var da=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalHitTest=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.sprite=null};Object.defineProperties(Mt.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new da),(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))}}}),Mt.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))},Mt.prototype._initCachedDisplayObject=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.alpha;this.alpha=1,e.batch.flush();var r=this.getLocalBounds().clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(T.RESOLUTION);var n=e.renderTexture.current,o=e.renderTexture.sourceFrame,a=e.projection.transform,s=dr.create(r.width,r.height),l="cacheAsBitmap_"+Ge();this._cacheData.textureCacheId=l,Kt.addToCache(s.baseTexture,l),fr.addToCache(s,l);var u=pa;u.tx=-r.x,u.ty=-r.y,this.transform.worldTransform.identity(),this.render=this._cacheData.originalRender,e.render(this,s,!0,u,!0),e.projection.transform=a,e.renderTexture.bind(n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var h=new Bn(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-r.x/r.width,h.anchor.y=-r.y/r.height,h.alpha=t,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},Mt.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))},Mt.prototype._initCachedDisplayObjectCanvas=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.getLocalBounds(),r=this.alpha;this.alpha=1;var i=e.context;t.ceil(T.RESOLUTION);var n=dr.create(t.width,t.height),o="cacheAsBitmap_"+Ge();this._cacheData.textureCacheId=o,Kt.addToCache(n.baseTexture,o),fr.addToCache(n,o);var a=pa;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=t.x,a.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,n,!0,a,!1),e.context=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var s=new Bn(n);s.transform.worldTransform=this.transform.worldTransform,s.anchor.x=-t.x/t.width,s.anchor.y=-t.y/t.height,s.alpha=r,s._bounds=this._bounds,this._cacheData.sprite=s,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=s.containsPoint.bind(s)}},Mt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._lastBoundsID=this._boundsID},Mt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds()},Mt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Kt.removeFromCache(this._cacheData.textureCacheId),fr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Mt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},Mt.prototype.name=null,Rt.prototype.getChildByName=function(e){for(var t=0;t>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},t.tint.get=function(){return this._tint},e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;Xe(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},Object.defineProperties(e.prototype,t),e}(ui),xa=function(a){function e(e,t,r){a.call(this);var i=new _r(e),n=new _r(t,!0),o=new _r(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,G.TYPES.FLOAT).addAttribute("aTextureCoord",n,2,!1,G.TYPES.FLOAT).addIndex(o),this._updateId=-1}a&&(e.__proto__=a),(e.prototype=Object.create(a&&a.prototype)).constructor=e;var t={vertexDirtyId:{configurable:!0}};return t.vertexDirtyId.get=function(){return this.buffers[0]._updateID},Object.defineProperties(e.prototype,t),e}(kr),wa=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=100),void 0===r&&(r=10),void 0===i&&(i=10),n.call(this),this.segWidth=r,this.segHeight=i,this.width=e,this.height=t,this.build()}return n&&(e.__proto__=n),((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.build=function(){for(var e=this.segWidth*this.segHeight,t=[],r=[],i=[],n=this.segWidth-1,o=this.segHeight-1,a=this.width/n,s=this.height/o,l=0;lt?1:this._height/t;e[9]=e[11]=e[13]=e[15]=this._topHeight*r,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*r,e[25]=e[27]=e[29]=e[31]=this._height},e.prototype.updateVerticalVertices=function(){var e=this.vertices,t=this._leftWidth+this._rightWidth,r=this._width>t?1:this._width/t;e[2]=e[10]=e[18]=e[26]=this._leftWidth*r,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*r,e[6]=e[14]=e[22]=e[30]=this._width},t.width.get=function(){return this._width},t.width.set=function(e){this._width=e,this._refresh()},t.height.get=function(){return this._height},t.height.set=function(e){this._height=e,this._refresh()},t.leftWidth.get=function(){return this._leftWidth},t.leftWidth.set=function(e){this._leftWidth=e,this._refresh()},t.rightWidth.get=function(){return this._rightWidth},t.rightWidth.set=function(e){this._rightWidth=e,this._refresh()},t.topHeight.get=function(){return this._topHeight},t.topHeight.set=function(e){this._topHeight=e,this._refresh()},t.bottomHeight.get=function(){return this._bottomHeight},t.bottomHeight.set=function(e){this._bottomHeight=e,this._refresh()},e.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var r=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]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*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()},Object.defineProperties(e.prototype,t),e}(Sa),Ca=function(r){function i(e,t){r.call(this,e[0]instanceof fr?e[0]:e[0].texture),this._textures=null,this._durations=null,this.textures=e,this._autoUpdate=!1!==t,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this.playing=!1}r&&(i.__proto__=r);var e={totalFrames:{configurable:!0},textures:{configurable:!0},currentFrame:{configurable:!0}};return((i.prototype=Object.create(r&&r.prototype)).constructor=i).prototype.stop=function(){this.playing&&(this.playing=!1,this._autoUpdate&&Ut.shared.remove(this.update,this))},i.prototype.play=function(){this.playing||(this.playing=!0,this._autoUpdate&&Ut.shared.add(this.update,this,G.UPDATE_PRIORITY.HIGH))},i.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},i.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},i.prototype.update=function(e){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())},i.prototype.updateTexture=function(){this._texture=this._textures[this.currentFrame],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)},i.prototype.destroy=function(e){this.stop(),r.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},i.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.splice||(i=Array.prototype.slice.call(i)),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};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!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(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="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,(oa=t,1<=+xa(oa)?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||"i8").charAt(t.length-1)&&(t="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;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,l,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(a,u?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===u)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;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(void 0===r&&(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(void 0===r&&(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(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var 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--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),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?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?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=0,o=0;oe.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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}},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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},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 e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},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){e||(e=this),this.parent=e,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?0:(-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:[]};var o=e.A(n);(o.A=n).root=o,i?Pb=o: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)throw new L(J.I);return i.k.T(i,e,t,r)}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 i=Bb(t),n=ac(r,i);if(n)throw new L(n);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,i,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var i,n,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(n=$b[r]))throw Error("Unknown file open mode: "+r)}else n=r;if(i=64&(r=n)?4095&(void 0===i?438:i)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(n=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,i,0),n=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!n&&(i=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(i=["r","w","rw"][3&r],512&r&&(i+="w"),Yb(o,i)):J.F))throw new L(i);if(512&r){var a;if(!(a="string"==typeof(i=o)?S(i,{la:!0}).g:i).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(i=Yb(a,"w"))throw new L(i);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in 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 o}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;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}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){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var 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"}return 0}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(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),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;cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var a=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;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var 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=r,o=i;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return 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 t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=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;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(n=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,i,n);default:x("bad ioctl syscall "+i)}}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){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(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};var Z=function(e,t,r){"use asm";var i=e.Int8Array;var n=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var l=e.Uint32Array;var u=e.Float32Array;var h=e.Float64Array;var pe=new i(r);var $=new n(r);var de=new o(r);var me=new a(r);var ge=new s(r);var c=new l(r);var f=new u(r);var ee=new h(r);var p=e.byteLength;var ve=t.STACKTOP|0;var d=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var m=t.ABORT|0;var g=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,k=0,S=0,P=0,E=0.0,C=0,A=0,I=0,O=0.0;var re=0;var M=0;var D=0;var R=0;var z=0;var F=0;var L=0;var j=0;var N=0;var B=0;var U=e.Math.floor;var X=e.Math.abs;var H=e.Math.sqrt;var W=e.Math.pow;var q=e.Math.cos;var G=e.Math.sin;var V=e.Math.tan;var Y=e.Math.acos;var Z=e.Math.asin;var J=e.Math.atan;var K=e.Math.atan2;var Q=e.Math.exp;var ie=e.Math.log;var ne=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var le=t.assert;var ue=t.invoke_iiii;var he=t.invoke_viiiii;var ce=t.invoke_vi;var fe=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var ke=t._pthread_cleanup_pop;var Se=t.___syscall54;var Pe=t.___syscall6;var Ee=t._emscripten_set_main_loop_timing;var Ce=t.__ZSt18uncaught_exceptionv;var Ae=t.___setErrNo;var Ie=t._sbrk;var Oe=t.___cxa_begin_catch;var Me=t._emscripten_memcpy_big;var De=t._sysconf;var Re=t._pthread_getspecific;var ze=t._pthread_self;var Fe=t._pthread_once;var Le=t._pthread_key_create;var je=t.___unlock;var Ne=t._emscripten_set_main_loop;var Be=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var He=t._pthread_cleanup_push;var We=t._time;var qe=t.___syscall140;var Ge=t.___syscall146;var Ve=0.0;function Ye(e){if(p(e)&16777215||p(e)<=16777215||p(e)>2147483648)return false;pe=new i(e);$=new n(e);de=new o(e);me=new a(e);ge=new s(e);c=new l(e);f=new u(e);ee=new h(e);r=e;return true}function Ze(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Je(){return ve|0}function Ke(e){e=e|0;ve=e}function Qe(e,t){e=e|0;t=t|0;ve=e;d=t}function $e(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(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 tt(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 rt(e){e=e|0;re=e}function it(){return re|0}function nt(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=ve;ve=ve+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;br(h,1100,o)|0;yr(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;br(h,1100,a)|0;yr(h,m+40|0)|0}a=de[d>>2]|0;if(a>>>0>=t>>>0){d=1;ve=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;br(h,1100,s)|0;yr(h,l)|0}r=_e(t,i)|0;do{if(!n){o=ot(de[e>>2]|0,r,p,1)|0;if(!o){d=0;ve=m;return d|0}else{de[e>>2]=o;break}}else{a=at(r,p)|0;if(!a){d=0;ve=m;return d|0}Ii[n&0](a,de[e>>2]|0,de[u>>2]|0);o=de[e>>2]|0;do{if(o)if(!(o&7)){Di[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;br(h,1100,c)|0;yr(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;ve=m;return d|0}function ot(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=ve;ve=ve+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;br(s,1100,n)|0;yr(s,u+16|0)|0;l=0;ve=u;return l|0}if(t>>>0>2147418112){de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1387;br(s,1100,o)|0;yr(s,u+40|0)|0;l=0;ve=u;return l|0}de[a>>2]=t;i=Di[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;ve=u;return l|0}de[l>>2]=1154;de[l+4>>2]=2551;de[l+8>>2]=1440;br(s,1100,l)|0;yr(s,u+64|0)|0;l=i;ve=u;return l|0}function at(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+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;br(o,1100,r)|0;yr(o,l+16|0)|0;s=0;ve=l;return s|0}de[n>>2]=i;r=Di[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;br(o,1100,s)|0;yr(o,l+40|0)|0;s=0;ve=l;return s|0}if(!(r&7)){s=r;ve=l;return s|0}de[a>>2]=1154;de[a+4>>2]=2526;de[a+8>>2]=1440;br(o,1100,a)|0;yr(o,l+64|0)|0;s=r;ve=l;return s|0}function st(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0;j=ve;ve=ve+960|0;z=j+232|0;R=j+216|0;D=j+208|0;M=j+192|0;O=j+184|0;I=j+168|0;A=j+160|0;C=j+144|0;S=j+136|0;k=j+120|0;T=j+112|0;w=j+96|0;y=j+88|0;_=j+72|0;v=j+64|0;g=j+48|0;c=j+40|0;p=j+24|0;f=j+16|0;h=j;E=j+440|0;F=j+376|0;L=j+304|0;m=j+236|0;if((t|0)==0|i>>>0>11){e=0;ve=j;return e|0}de[e>>2]=t;n=L;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){P=L+((n&255)<<2)|0;de[P>>2]=(de[P>>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[L+(u<<2)>>2]|0;if(!n)de[e+28+(u+-1<<2)>>2]=0;else{P=u+-1|0;de[F+(P<<2)>>2]=o;o=n+o|0;x=16-u|0;de[e+28+(P<<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){P=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;br(E,1100,h)|0;yr(E,f)|0}if(!(n&7)){Di[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;br(E,1100,p)|0;yr(E,c)|0;break}}}while(0);o=de[o>>2]|0;o=(o|0)!=0?o:1;n=at((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]=P;o=e+176|0;a=0;do{b=pe[r+a>>0]|0;n=b&255;if(b<<24>>24){if(!(de[L+(n<<2)>>2]|0)){de[g>>2]=1154;de[g+4>>2]=2273;de[g+8>>2]=1261;br(E,1100,g)|0;yr(E,v)|0}b=m+(n<<2)|0;n=de[b>>2]|0;de[b>>2]=n+1;if(n>>>0>=l>>>0){de[_>>2]=1154;de[_+4>>2]=2277;de[_+8>>2]=1274;br(E,1100,_)|0;yr(E,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;_=(y|0)!=0;if(_){v=1<>>0>(de[n>>2]|0)>>>0){de[n>>2]=v;a=e+168|0;n=de[a>>2]|0;do{if(n){g=de[n+-4>>2]|0;n=n+-8|0;if(!((g|0)!=0?(g|0)==(~de[n>>2]|0):0)){de[w>>2]=1154;de[w+4>>2]=644;de[w+8>>2]=1863;br(E,1100,w)|0;yr(E,T)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[k>>2]=1154;de[k+4>>2]=2499;de[k+8>>2]=1516;br(E,1100,k)|0;yr(E,S)|0;break}}}while(0);n=v<<2;o=at(n+8|0,0)|0;if(!o){de[a>>2]=0;n=0;break e}else{S=o+8|0;de[o+4>>2]=v;de[o>>2]=~v;de[a>>2]=S;o=S;break}}else{o=e+168|0;n=v<<2;a=o;o=de[o>>2]|0}}while(0);Yr(o|0,-1,n|0)|0;d=e+176|0;g=1;do{if(de[L+(g<<2)>>2]|0){t=y-g|0;m=1<>2]|0;if(o>>>0>=16){de[C>>2]=1154;de[C+4>>2]=1953;de[C+8>>2]=1737;br(E,1100,C)|0;yr(E,A)|0}n=de[e+28+(o<<2)>>2]|0;if(!n)p=-1;else p=(n+-1|0)>>>(16-g|0);if(s>>>0<=p>>>0){c=(de[e+96+(o<<2)>>2]|0)-s|0;f=g<<16;do{n=ge[(de[d>>2]|0)+(c+s<<1)>>1]|0;if((me[r+n>>0]|0|0)!=(g|0)){de[I>>2]=1154;de[I+4>>2]=2319;de[I+8>>2]=1303;br(E,1100,I)|0;yr(E,O)|0}h=s<>>0>=v>>>0){de[M>>2]=1154;de[M+4>>2]=2325;de[M+8>>2]=1337;br(E,1100,M)|0;yr(E,D)|0}n=de[a>>2]|0;if((de[n+(l<<2)>>2]|0)!=-1){de[R>>2]=1154;de[R+4>>2]=2327;de[R+8>>2]=1360;br(E,1100,R)|0;yr(E,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)}}g=g+1|0}while(y>>>0>=g>>>0);n=pe[x>>0]|0}o=e+96|0;de[o>>2]=(de[o>>2]|0)-(de[F>>2]|0);o=e+100|0;de[o>>2]=(de[o>>2]|0)-(de[F+4>>2]|0);o=e+104|0;de[o>>2]=(de[o>>2]|0)-(de[F+8>>2]|0);o=e+108|0;de[o>>2]=(de[o>>2]|0)-(de[F+12>>2]|0);o=e+112|0;de[o>>2]=(de[o>>2]|0)-(de[F+16>>2]|0);o=e+116|0;de[o>>2]=(de[o>>2]|0)-(de[F+20>>2]|0);o=e+120|0;de[o>>2]=(de[o>>2]|0)-(de[F+24>>2]|0);o=e+124|0;de[o>>2]=(de[o>>2]|0)-(de[F+28>>2]|0);o=e+128|0;de[o>>2]=(de[o>>2]|0)-(de[F+32>>2]|0);o=e+132|0;de[o>>2]=(de[o>>2]|0)-(de[F+36>>2]|0);o=e+136|0;de[o>>2]=(de[o>>2]|0)-(de[F+40>>2]|0);o=e+140|0;de[o>>2]=(de[o>>2]|0)-(de[F+44>>2]|0);o=e+144|0;de[o>>2]=(de[o>>2]|0)-(de[F+48>>2]|0);o=e+148|0;de[o>>2]=(de[o>>2]|0)-(de[F+52>>2]|0);o=e+152|0;de[o>>2]=(de[o>>2]|0)-(de[F+56>>2]|0);o=e+156|0;de[o>>2]=(de[o>>2]|0)-(de[F+60>>2]|0);o=e+16|0;de[o>>2]=0;a=e+20|0;de[a>>2]=n&255;t:do{if(_){while(1){if(!i)break t;n=i+-1|0;if(!(de[L+(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<=P>>>0){while(1){if(de[L+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>P>>>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;ve=j;return e|0}function lt(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=Br(t)|0;if(!r){r=n;return r|0}if(!n)o=0;else o=Hr(n)|0;de[r>>2]=o;r=n;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}de[r>>2]=0;r=0;return r|0}n=Xr(e,t)|0;o=(n|0)!=0;if(o|i^1)o=o?n:e;else{n=Xr(e,t)|0;o=(n|0)==0?e:n}if(!r){r=n;return r|0}t=Hr(o)|0;de[r>>2]=t;r=n;return r|0}function ut(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 ht(e){e=e|0;Oe(e|0)|0;Ut()}function ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0;o=ve;ve=ve+544|0;n=o;i=o+24|0;t=de[e+20>>2]|0;if(t)ft(t);t=e+4|0;r=de[t>>2]|0;if(!r){n=e+16|0;pe[n>>0]=0;ve=o;return}if(!(r&7))Di[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;br(i,1100,n)|0;yr(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;ve=o;return}function ft(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=ve;ve=ve+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){ve=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;br(a,1100,r)|0;yr(a,n)|0}if(!(t&7)){Di[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;br(a,1100,o)|0;yr(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;br(a,1100,s)|0;yr(a,l)|0}if(!(t&7)){Di[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;br(a,1100,u)|0;yr(a,h)|0;break}}}while(0);if(!(e&7)){Di[de[104>>2]&1](e,0,0,1,de[27]|0)|0;ve=p;return}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(a,1100,c)|0;yr(a,f)|0;ve=p;return}}function pt(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=ve;ve=ve+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;br(o,1100,t)|0;yr(o,h+16|0)|0}de[e>>2]=r;i=e+20|0;t=de[i>>2]|0;if(!t){t=at(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;br(o,1100,s)|0;yr(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=st(u,l,n,e)|0;ve=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=st(u,l,n,e)|0;ve=h;return u|0}function dt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0;z=ve;ve=ve+800|0;I=z+256|0;A=z+240|0;C=z+232|0;E=z+216|0;P=z+208|0;S=z+192|0;k=z+184|0;T=z+168|0;w=z+160|0;x=z+144|0;b=z+136|0;y=z+120|0;_=z+112|0;v=z+96|0;g=z+88|0;m=z+72|0;c=z+64|0;h=z+48|0;s=z+40|0;l=z+24|0;o=z+16|0;n=z;D=z+288|0;R=z+264|0;O=mt(e,14)|0;if(!O){de[t>>2]=0;r=t+4|0;i=de[r>>2]|0;if(i){if(!(i&7))Di[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;br(D,1100,n)|0;yr(D,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;ve=z;return t|0}ft(i);de[r>>2]=0;t=1;ve=z;return t|0}p=t+4|0;d=t+8|0;r=de[d>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((de[t+12>>2]|0)>>>0>>0){if(nt(p,O,(r+1|0)==(O|0),1,0)|0){r=de[d>>2]|0;break}pe[t+16>>0]=1;t=0;ve=z;return t|0}}while(0);Yr((de[p>>2]|0)+r|0,0,O-r|0)|0}de[d>>2]=O}Yr(de[p>>2]|0,0,O|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;br(D,1100,l)|0;yr(D,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;ve=z;return t|0}de[R+20>>2]=0;de[R>>2]=0;de[R+4>>2]=0;de[R+8>>2]=0;de[R+12>>2]=0;pe[R+16>>0]=0;r=R+4|0;i=R+8|0;e:do{if(nt(r,21,0,1,0)|0){s=de[i>>2]|0;l=de[r>>2]|0;Yr(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;br(D,1100,h)|0;yr(D,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(pt(R)|0){s=e+4|0;l=e+8|0;u=e+16|0;i=0;t:while(1){a=O-i|0;r=gt(e,R)|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;br(D,1100,m)|0;yr(D,g)|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[v>>2]=1154;de[v+4>>2]=3199;de[v+8>>2]=1650;br(D,1100,v)|0;yr(D,_)|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;br(D,1100,y)|0;yr(D,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;br(D,1100,x)|0;yr(D,w)|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[T>>2]=1154;de[T+4>>2]=3199;de[T+8>>2]=1650;br(D,1100,T)|0;yr(D,k)|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;br(D,1100,S)|0;yr(D,P)|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[E>>2]=1154;de[E+4>>2]=903;de[E+8>>2]=1781;br(D,1100,E)|0;yr(D,C)|0}pe[(de[p>>2]|0)+i>>0]=n;i=i+1|0}while((i|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)i=r;else break}if((M|0)==90){de[A>>2]=1154;de[A+4>>2]=3140;de[A+8>>2]=1632;br(D,1100,A)|0;yr(D,I)|0;r=0;break}if((O|0)==(r|0))r=pt(t)|0;else r=0}else r=0}else{pe[R+16>>0]=1;r=0}}while(0);ct(R);t=r;ve=z;return t|0}function mt(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=ve;ve=ve+544|0;s=h+16|0;a=h;o=h+24|0;if(!t){u=0;ve=h;return u|0}if(t>>>0<=16){u=vt(e,t)|0;ve=h;return u|0}l=vt(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;br(o,1100,a)|0;yr(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;ve=h;return u|0}function gt(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,g=0,v=0,_=0,y=0;y=ve;ve=ve+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;v=y+96|0;g=de[t+20>>2]|0;_=e+20|0;s=de[_>>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[_>>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[_>>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[g+16>>2]|0)>>>0){i=de[(de[g+168>>2]|0)+(o>>>(32-(de[g+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;br(v,1100,l)|0;yr(v,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;br(v,1100,p)|0;yr(v,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;br(v,1100,c)|0;yr(v,f)|0}}else{i=de[g+20>>2]|0;while(1){r=i+-1|0;if(n>>>0>(de[g+28+(r<<2)>>2]|0)>>>0)i=i+1|0;else break}r=(o>>>(32-i|0))+(de[g+96+(r<<2)>>2]|0)|0;if(r>>>0<(de[t>>2]|0)>>>0){r=ge[(de[g+176>>2]|0)+(r<<1)>>1]|0;break}de[d>>2]=1154;de[d+4>>2]=3266;de[d+8>>2]=1632;br(v,1100,d)|0;yr(v,m)|0;_=0;ve=y;return _|0}}while(0);de[a>>2]=de[a>>2]<>2]=(de[_>>2]|0)-i;_=r;ve=y;return _|0}function vt(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=ve;ve=ve+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;br(a,1100,r)|0;yr(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;ve=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;br(a,1100,l)|0;yr(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;ve=h;return l|0}function _t(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,g=0;d=ve;ve=ve+544|0;f=d+16|0;c=d;h=d+24|0;if((e|0)==0|t>>>0<62){p=0;ve=d;return p|0}u=at(300,0)|0;if(!u){p=0;ve=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;g=u+252|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+268|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+284|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+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(Et(u)|0){r=de[l>>2]|0;if((me[r+39>>0]|0)<<8|(me[r+40>>0]|0)){if(!(Ct(u)|0))break;if(!(At(u)|0))break;r=de[l>>2]|0}if(!((me[r+55>>0]|0)<<8|(me[r+56>>0]|0))){g=u;ve=d;return g|0}if(It(u)|0?Ot(u)|0:0){g=u;ve=d;return g|0}}}else p=7}while(0);if((p|0)==7)de[l>>2]=0;Ft(u);if(!(u&7)){Di[de[104>>2]&1](u,0,0,1,de[27]|0)|0;g=0;ve=d;return g|0}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;g=0;ve=d;return g|0}return 0}function yt(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=ve;ve=ve+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=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}de[u>>2]=1154;de[u+4>>2]=3704;de[u+8>>2]=1792;br(l,1100,u)|0;yr(l,h+16|0)|0;l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}function bt(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=_e(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((_e(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:{Mt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Dt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 9:{Rt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 8:case 7:{zt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+12>>2]|0}function kt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+32>>2]|0}function St(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=ve;ve=ve+576|0;a=l+56|0;o=l+40|0;n=l+64|0;u=l;de[u>>2]=40;ut(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;br(n,1100,o)|0;yr(n,a)|0;e=0}u=_e(_e(t,i)|0,e)|0;ve=l;return u|0}function Pt(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=ve;ve=ve+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;ut(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;br(h,1100,a)|0;yr(h,s)|0;o=0}s=_e(o,l)|0;a=_t(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)yt(a,c,i,s,n)|0;if(o){ve=d;return}if((de[a>>2]|0)!=519686845){ve=d;return}Ft(a);if(!(a&7)){Di[de[104>>2]&1](a,0,0,1,de[27]|0)|0;ve=d;return}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(h,1100,p)|0;yr(h,f)|0;ve=d;return}}function Et(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(!(dt(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(!(dt(a,e+140|0)|0)){e=0;return e|0}if(dt(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(!(dt(a,e+164|0)|0)){e=0;return e|0}if(!(dt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function Ct(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=ve;ve=ve+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(nt(h,f,(r+1|0)==(f|0),4,0)|0){t=de[o>>2]|0;break}pe[e+248>>0]=1;p=0;ve=d;return p|0}else t=r}while(0);Yr((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;ve=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(dt(u,p)|0?(c=p+24|0,dt(u,c)|0):0){if(!(de[o>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(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=(gt(u,p)|0)+i&31;n=(gt(u,c)|0)+n&63;o=(gt(u,p)|0)+o&31;t=(gt(u,p)|0)+t|0;a=(gt(u,c)|0)+a&63;e=(gt(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;ct(p+24|0);ct(p);p=t;ve=d;return p|0}function At(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+1024|0;s=S+16|0;a=S;o=S+504|0;k=S+480|0;w=S+284|0;T=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){k=0;ve=S;return k|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[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-3;n=-3;while(1){de[w+(r<<2)>>2]=i;de[T+(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));_=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(nt(_,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);Yr((de[_>>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;br(o,1100,a)|0;yr(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;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<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[g>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function It(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=ve;ve=ve+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;ve=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(dt(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(nt(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);Yr((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;br(a,1100,s)|0;yr(a,l)|0;t=1;break}r=0;i=0;n=0;t=de[o>>2]|0;while(1){l=gt(u,c)|0;r=l+r&255;i=(gt(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);ct(c);c=t;ve=f;return c|0}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,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+2432|0;s=S+16|0;a=S;o=S+1912|0;k=S+1888|0;w=S+988|0;T=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){k=0;ve=S;return k|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[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-7;n=-7;while(1){de[w+(r<<2)>>2]=i;de[T+(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));_=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(nt(_,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);Yr((de[_>>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;br(o,1100,a)|0;yr(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;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=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|P<<15;E=me[1729+(de[c>>2]|0)>>0]|0;$[r+2>>1]=(me[1729+(de[s>>2]|0)>>0]|0)<<2|P>>>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|E<<14;$[r+4>>1]=(me[1729+(de[f>>2]|0)>>0]|0)<<1|E>>>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[g>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function Mt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;he=ve;ve=ve+720|0;ue=he+184|0;se=he+168|0;ae=he+160|0;oe=he+144|0;ne=he+136|0;ie=he+120|0;re=he+112|0;ee=he+96|0;$=he+88|0;Q=he+72|0;K=he+64|0;J=he+48|0;Z=he+40|0;le=he+24|0;te=he+16|0;Y=he;G=he+208|0;V=he+192|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;W=de[H>>2]|0;r=pe[(de[e+88>>2]|0)+17>>0]|0;q=i>>>2;if(!(r<<24>>24)){ve=he;return 1}U=(s|0)==0;X=s+-1|0;M=(o&1|0)!=0;D=i<<1;R=e+92|0;z=e+116|0;F=e+140|0;L=e+236|0;j=a+-1|0;O=(n&1|0)!=0;I=e+188|0;S=e+252|0;P=q+1|0;E=q+2|0;C=q+3|0;A=j<<4;T=r&255;r=0;o=0;n=1;k=0;do{if(!U){x=de[t+(k<<2)>>2]|0;w=0;while(1){_=w&1;l=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=l?a:-1;u=l?0:j;e=(w|0)==(X|0);y=M&e;if((u|0)!=(b|0)){g=M&e^1;m=l?x:x+A|0;while(1){if((n|0)==1)n=gt(R,z)|0|512;d=n&7;n=n>>>3;l=me[1823+d>>0]|0;e=0;do{f=(gt(R,F)|0)+o|0;p=f-B|0;o=p>>31;o=o&f|p&~o;if((de[N>>2]|0)>>>0<=o>>>0){de[Y>>2]=1154;de[Y+4>>2]=903;de[Y+8>>2]=1781;br(G,1100,Y)|0;yr(G,te)|0}de[V+(e<<2)>>2]=de[(de[L>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);p=O&(u|0)==(j|0);if(y|p){f=0;do{h=_e(f,i)|0;e=m+h|0;l=(f|0)==0|g;c=f<<1;fe=(gt(R,I)|0)+r|0;ce=fe-W|0;r=ce>>31;r=r&fe|ce&~r;do{if(p){if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r}else{if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(G,1100,ie)|0;yr(G,ne)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;de[m+(h+8)>>2]=de[V+((me[(c|1)+(1831+(d<<2))>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(G,1100,se)|0;yr(G,ue)|0}de[m+(h+12)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}}while(0);f=f+1|0}while((f|0)!=2)}else{de[m>>2]=de[V+((me[1831+(d<<2)>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[le>>2]=1154;de[le+4>>2]=903;de[le+8>>2]=1781;br(G,1100,le)|0;yr(G,Z)|0}de[m+4>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+8>>2]=de[V+((me[1831+(d<<2)+1>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(G,1100,J)|0;yr(G,K)|0}de[m+12>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(q<<2)>>2]=de[V+((me[1831+(d<<2)+2>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(G,1100,Q)|0;yr(G,$)|0}de[m+(P<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(E<<2)>>2]=de[V+((me[1831+(d<<2)+3>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}de[m+(C<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}u=u+_|0;if((u|0)==(b|0))break;else m=m+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+D|0}}k=k+1|0}while((k|0)!=(T|0));ve=he;return 1}function Dt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;ce=ve;ve=ve+640|0;le=ce+88|0;se=ce+72|0;ae=ce+64|0;oe=ce+48|0;ne=ce+40|0;he=ce+24|0;ue=ce+16|0;ie=ce;te=ce+128|0;re=ce+112|0;ee=ce+96|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;K=de[H>>2]|0;Q=e+272|0;$=de[Q>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ce;return 1}X=(s|0)==0;W=s+-1|0;q=i<<1;G=e+92|0;V=e+116|0;Y=a+-1|0;Z=e+212|0;J=e+188|0;j=(n&1|0)==0;L=(o&1|0)==0;O=e+288|0;M=e+284|0;D=e+252|0;R=e+140|0;z=e+236|0;F=e+164|0;A=e+268|0;I=Y<<5;E=r&255;r=0;n=0;o=0;e=0;l=1;C=0;do{if(!X){S=de[t+(C<<2)>>2]|0;P=0;while(1){T=P&1;u=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;k=u?a:-1;h=u?0:Y;if((h|0)!=(k|0)){x=L|(P|0)!=(W|0);b=u?S:S+I|0;while(1){if((l|0)==1)l=gt(G,V)|0|512;y=l&7;l=l>>>3;c=me[1823+y>>0]|0;u=0;do{v=(gt(G,F)|0)+n|0;_=v-$|0;n=_>>31;n=n&v|_&~n;if((de[Q>>2]|0)>>>0<=n>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(te,1100,ie)|0;yr(te,ue)|0}de[ee+(u<<2)>>2]=ge[(de[A>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(gt(G,R)|0)+e|0;_=v-B|0;e=_>>31;e=e&v|_&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[he>>2]=1154;de[he+4>>2]=903;de[he+8>>2]=1781;br(te,1100,he)|0;yr(te,ne)|0}de[re+(u<<2)>>2]=de[(de[z>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=j|(h|0)!=(Y|0);g=0;v=b;while(1){m=x|(g|0)==0;d=g<<1;f=0;p=v;while(1){c=(gt(G,Z)|0)+r|0;u=c-U|0;r=u>>31;r=r&c|u&~r;u=(gt(G,J)|0)+o|0;c=u-K|0;o=c>>31;o=o&u|c&~o;if((_|(f|0)==0)&m){u=me[f+d+(1831+(y<<2))>>0]|0;c=r*3|0;if((de[O>>2]|0)>>>0<=c>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}fe=de[M>>2]|0;de[p>>2]=(ge[fe+(c<<1)>>1]|0)<<16|de[ee+(u<<2)>>2];de[p+4>>2]=(ge[fe+(c+2<<1)>>1]|0)<<16|(ge[fe+(c+1<<1)>>1]|0);de[p+8>>2]=de[re+(u<<2)>>2];if((de[H>>2]|0)>>>0<=o>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(te,1100,se)|0;yr(te,le)|0}de[p+12>>2]=de[(de[D>>2]|0)+(o<<2)>>2]}f=f+1|0;if((f|0)==2)break;else p=p+16|0}g=g+1|0;if((g|0)==2)break;else v=v+i|0}h=h+T|0;if((h|0)==(k|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else S=S+q|0}}C=C+1|0}while((C|0)!=(E|0));ve=ce;return 1}function Rt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0;K=ve;ve=ve+608|0;Y=K+64|0;V=K+48|0;G=K+40|0;J=K+24|0;Z=K+16|0;q=K;W=K+88|0;H=K+72|0;D=e+272|0;R=de[D>>2]|0;r=de[e+88>>2]|0;z=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=K;return 1}F=(s|0)==0;L=s+-1|0;j=i<<1;N=e+92|0;B=e+116|0;U=a+-1|0;X=e+212|0;M=(o&1|0)==0;A=e+288|0;I=e+284|0;O=e+164|0;E=e+268|0;C=U<<4;P=r&255;S=(n&1|0)!=0;r=0;o=0;e=1;k=0;do{if(!F){w=de[t+(k<<2)>>2]|0;T=0;while(1){b=T&1;n=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=n?a:-1;l=n?0:U;if((l|0)!=(x|0)){_=M|(T|0)!=(L|0);v=n?w:w+C|0;while(1){if((e|0)==1)e=gt(N,B)|0|512;g=e&7;e=e>>>3;u=me[1823+g>>0]|0;n=0;do{d=(gt(N,O)|0)+o|0;m=d-R|0;o=m>>31;o=o&d|m&~o;if((de[D>>2]|0)>>>0<=o>>>0){de[q>>2]=1154;de[q+4>>2]=903;de[q+8>>2]=1781;br(W,1100,q)|0;yr(W,Z)|0}de[H+(n<<2)>>2]=ge[(de[E>>2]|0)+(o<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(U|0)&S;p=0;d=v;while(1){f=_|(p|0)==0;c=p<<1;n=(gt(N,X)|0)+r|0;h=n-z|0;u=h>>31;u=u&n|h&~u;if(f){r=me[1831+(g<<2)+c>>0]|0;n=u*3|0;if((de[A>>2]|0)>>>0<=n>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(W,1100,J)|0;yr(W,G)|0}h=de[I>>2]|0;de[d>>2]=(ge[h+(n<<1)>>1]|0)<<16|de[H+(r<<2)>>2];de[d+4>>2]=(ge[h+(n+2<<1)>>1]|0)<<16|(ge[h+(n+1<<1)>>1]|0)}h=d+8|0;n=(gt(N,X)|0)+u|0;u=n-z|0;r=u>>31;r=r&n|u&~r;if(!(m|f^1)){n=me[(c|1)+(1831+(g<<2))>>0]|0;u=r*3|0;if((de[A>>2]|0)>>>0<=u>>>0){de[V>>2]=1154;de[V+4>>2]=903;de[V+8>>2]=1781;br(W,1100,V)|0;yr(W,Y)|0}f=de[I>>2]|0;de[h>>2]=(ge[f+(u<<1)>>1]|0)<<16|de[H+(n<<2)>>2];de[d+12>>2]=(ge[f+(u+2<<1)>>1]|0)<<16|(ge[f+(u+1<<1)>>1]|0)}p=p+1|0;if((p|0)==2)break;else d=d+i|0}l=l+b|0;if((l|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+j|0}}k=k+1|0}while((k|0)!=(P|0));ve=K;return 1}function zt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ie=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;$=ae+40|0;oe=ae+24|0;ne=ae+16|0;Q=ae;K=ae+128|0;Z=ae+112|0;J=ae+96|0;N=e+272|0;B=de[N>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;H=s+-1|0;W=i<<1;q=e+92|0;G=e+116|0;V=a+-1|0;Y=e+212|0;j=(n&1|0)==0;L=(o&1|0)==0;R=e+288|0;z=e+284|0;F=e+164|0;M=e+268|0;D=V<<5;I=r&255;r=0;n=0;o=0;e=0;l=1;O=0;do{if(!X){C=de[t+(O<<2)>>2]|0;A=0;while(1){P=A&1;u=(P|0)==0;S=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;E=u?a:-1;h=u?0:V;if((h|0)!=(E|0)){k=L|(A|0)!=(H|0);T=u?C:C+D|0;while(1){if((l|0)==1)l=gt(q,G)|0|512;w=l&7;l=l>>>3;c=me[1823+w>>0]|0;u=0;do{b=(gt(q,F)|0)+e|0;x=b-B|0;e=x>>31;e=e&b|x&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(K,1100,Q)|0;yr(K,ne)|0}de[Z+(u<<2)>>2]=ge[(de[M>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{b=(gt(q,F)|0)+n|0;x=b-B|0;n=x>>31;n=n&b|x&~n;if((de[N>>2]|0)>>>0<=n>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(K,1100,oe)|0;yr(K,$)|0}de[J+(u<<2)>>2]=ge[(de[M>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);x=j|(h|0)!=(V|0);y=0;b=T;while(1){_=k|(y|0)==0;v=y<<1;m=0;g=b;while(1){d=(gt(q,Y)|0)+o|0;p=d-U|0;o=p>>31;o=o&d|p&~o;p=(gt(q,Y)|0)+r|0;d=p-U|0;r=d>>31;r=r&p|d&~r;if((x|(m|0)==0)&_){p=me[m+v+(1831+(w<<2))>>0]|0;d=o*3|0;u=de[R>>2]|0;if(u>>>0<=d>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(K,1100,ee)|0;yr(K,te)|0;u=de[R>>2]|0}c=de[z>>2]|0;f=r*3|0;if(u>>>0>f>>>0)u=c;else{de[re>>2]=1154;de[re+4>>2]=903;de[re+8>>2]=1781;br(K,1100,re)|0;yr(K,ie)|0;u=de[z>>2]|0}de[g>>2]=(ge[c+(d<<1)>>1]|0)<<16|de[Z+(p<<2)>>2];de[g+4>>2]=(ge[c+(d+2<<1)>>1]|0)<<16|(ge[c+(d+1<<1)>>1]|0);de[g+8>>2]=(ge[u+(f<<1)>>1]|0)<<16|de[J+(p<<2)>>2];de[g+12>>2]=(ge[u+(f+2<<1)>>1]|0)<<16|(ge[u+(f+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else g=g+16|0}y=y+1|0;if((y|0)==2)break;else b=b+i|0}h=h+P|0;if((h|0)==(E|0))break;else T=T+S|0}}A=A+1|0;if((A|0)==(s|0))break;else C=C+W|0}}O=O+1|0}while((O|0)!=(I|0));ve=ae;return 1}function Ft(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=ve;ve=ve+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))Di[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;br(u,1100,i)|0;yr(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))Di[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;br(u,1100,a)|0;yr(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))Di[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;br(u,1100,s)|0;yr(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;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}if(!(r&7))Di[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;br(u,1100,h)|0;yr(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;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}function Lt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;de[r>>2]=t;t=de[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function jt(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Fe(200,2)|0)){t=Re(de[49]|0)|0;ve=e;return t|0}else Lt(2090,e);return 0}function Nt(e){e=e|0;Ur(e);return}function Bt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Oi[e&3]();Lt(2139,t)}function Ut(){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)Bt(de[t+12>>2]|0);t=de[28]|0;de[28]=t+0;Bt(t)}function Xt(e){e=e|0;return}function Ht(e){e=e|0;return}function Wt(e){e=e|0;return}function qt(e){e=e|0;return}function Gt(e){e=e|0;Nt(e);return}function Vt(e){e=e|0;Nt(e);return}function Yt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(n=Qt(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;Ri[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;ve=a;return t|0}function Zt(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);return}function Jt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);return}function Kt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);else{e=de[e+8>>2]|0;Ri[de[(de[e>>2]|0)+28>>2]&3](e,t,r,i)}return}function Qt(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=ve;ve=ve+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;Mi[de[(de[r>>2]|0)+20>>2]&3](r,f,h,h,1,0);i=(de[t>>2]|0)==1?h:0}else{Ei[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);ve=p;return i|0}function $t(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);return}function er(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;Ei[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;Mi[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 tr(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 rr(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))$t(0,t,r,i,n);else{e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,i,n,o)}return}function ir(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))$t(0,t,r,i,n);return}function nr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+16|0;i=n;de[i>>2]=de[r>>2];e=Pi[de[(de[e>>2]|0)+16>>2]&7](e,t,i)|0;if(e)de[r>>2]=de[i>>2];ve=n;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=(Qt(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,i=0,n=0,o=0,a=0,s=0;n=ve;ve=ve+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];Lt(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(Pi[de[(de[8>>2]|0)+16>>2]&7](8,i,n)|0){s=de[n>>2]|0;n=de[51]|0;s=Ai[de[(de[s>>2]|0)+8>>2]&1](s)|0;de[o>>2]=n;de[o+4>>2]=e;de[o+8>>2]=s;Lt(2282,o)}else{de[s>>2]=de[51];de[s+4>>2]=e;Lt(2327,s)}}Lt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(Le(196,6)|0)){ve=e;return}else Lt(2179,e)}function lr(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(Be(de[49]|0,0)|0)){ve=t;return}else Lt(2229,t)}function ur(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 hr(){var e=0;if(!(de[52]|0))e=264;else{e=(ze()|0)+60|0;e=de[e>>2]|0}return e|0}function cr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=hr()|0;de[t>>2]=0-e;e=-1}return e|0}function fr(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=+fr(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 pr(e,t){e=+e;t=t|0;return+ +fr(e,t)}function dr(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=hr()|0;de[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function mr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=dr(e,t,0)|0;return e|0}function gr(e){e=e|0;var t=0,r=0;do{if(e){if((de[e+76>>2]|0)<=-1){t=Dr(e)|0;break}r=(kr(e)|0)==0;t=Dr(e)|0;if(!r)Sr(e)}else{if(!(de[65]|0))t=0;else t=gr(de[65]|0)|0;Ue(236);e=de[58]|0;if(e)do{if((de[e+76>>2]|0)>-1)r=kr(e)|0;else r=0;if((de[e+20>>2]|0)>>>0>(de[e+28>>2]|0)>>>0)t=Dr(e)|0|t;if(r)Sr(e);e=de[e+56>>2]|0}while((e|0)!=0);je(236)}}while(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;if((de[t+76>>2]|0)>=0?(kr(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=Pr(t,e)|0;Sr(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=Pr(t,e)|0}}while(0);return r|0}function _r(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(!(Or(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=Pi[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((Pi[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);Qr(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 yr(e,t){e=e|0;t=t|0;var r=0,i=0;r=ve;ve=ve+16|0;i=r;de[i>>2]=t;t=xr(de[64]|0,e,i)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=ve;ve=ve+16|0;n=i;de[n>>2]=r;r=Tr(e,t,n)|0;ve=i;return r|0}function xr(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=ve;ve=ve+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((Rr(0,t,c,p,d)|0)<0)r=-1;else{if((de[e+76>>2]|0)>-1)u=kr(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=Rr(e,t,c,p,d)|0;if(o){Pi[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=Rr(e,t,c,p,d)|0;r=de[e>>2]|0;de[e>>2]=r|h;if(u)Sr(e);r=(r&32|0)==0?i:-1}ve=m;return r|0}function wr(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=ve;ve=ve+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=hr()|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=xr(u,r,i)|0;if(l){r=de[e>>2]|0;pe[r+(((r|0)==(de[n>>2]|0))<<31>>31)>>0]=0}}ve=h;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function kr(e){e=e|0;return 0}function Sr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+16|0;s=l;a=t&255;pe[s>>0]=a;i=e+16|0;n=de[i>>2]|0;if(!n)if(!(Or(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((Pi[de[e+36>>2]&7](e,s,1)|0)==1)r=me[s>>0]|0;else r=-1}}while(0);ve=l;return r|0}function Er(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;de[r>>2]=de[e+60>>2];e=cr(Pe(6,r|0)|0)|0;ve=t;return e|0}function Cr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0;n=ve;ve=ve+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((cr(qe(140,o|0)|0)|0)<0){de[i>>2]=-1;e=-1}else e=de[i>>2]|0;ve=n;return e|0}function Ar(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=ve;ve=ve+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=cr(Ge(146,c|0)|0)|0}else{He(7,e|0);de[h>>2]=de[l>>2];de[h+4>>2]=i;de[h+8>>2]=t;a=cr(Ge(146,h|0)|0)|0;ke(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}ve=d;return r|0}function Ir(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+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,(Se(54,i|0)|0)!=0):0)pe[e+75>>0]=-1;i=Ar(e,t,r)|0;ve=n;return i|0}function Or(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 Mr(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=_e(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 Dr(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?(Pi[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)Pi[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 Rr(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0;Q=ve;ve=ve+624|0;V=Q+24|0;Z=Q+16|0;Y=Q+588|0;X=Q+576|0;G=Q;N=Q+536|0;K=Q+8|0;J=Q+528|0;I=(e|0)!=0;O=N+40|0;j=O;N=N+39|0;B=K+4|0;U=X+12|0;X=X+11|0;H=Y;W=U;q=W-H|0;M=-2-H|0;D=W+2|0;R=V+288|0;z=Y+9|0;F=z;L=Y+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=hr()|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)){A=245;break}else s=m;t:while(1){switch(a<<24>>24){case 37:{a=s;A=9;break t}case 0:{a=s;break t}default:{}}C=s+1|0;a=pe[C>>0]|0;s=C}t:do{if((A|0)==9)while(1){A=0;if((pe[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((pe[a>>0]|0)==37)A=9;else break}}while(0);v=s-m|0;if(I?(de[e>>2]&32|0)==0:0)_r(m,v,e)|0;if((s|0)!=(m|0)){m=a;a=v;continue}h=a+1|0;s=pe[h>>0]|0;l=(s<<24>>24)+-48|0;if(l>>>0<10){C=(pe[a+2>>0]|0)==36;h=C?a+3|0:h;s=pe[h>>0]|0;p=C?l:-1;t=C?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(!I){g=c;a=l;t=0;C=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){g=c|8192;C=0-s|0}else{g=c;C=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{g=c;C=s}}else{g=c;C=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(I){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{E=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 A=52;else{if(l){de[n+(p<<2)>>2]=c;S=i+(p<<3)|0;P=de[S+4>>2]|0;A=G;de[A>>2]=de[S>>2];de[A+4>>2]=P;A=52;break}if(!I){o=0;break e}Lr(G,c,r)}}while(0);if((A|0)==52?(A=0,!I):0){m=E;a=v;continue}p=pe[a>>0]|0;p=(f|0)!=0&(p&15|0)==3?p&-33:p;l=g&-65537;P=(g&8192|0)==0?g:l;t:do{switch(p|0){case 110:switch(f|0){case 0:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 1:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 2:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}case 3:{$[de[G>>2]>>1]=o;m=E;a=v;continue e}case 4:{pe[de[G>>2]>>0]=o;m=E;a=v;continue e}case 6:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 7:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}default:{m=E;a=v;continue e}}case 112:{f=P|8;h=h>>>0>8?h:8;p=120;A=64;break}case 88:case 120:{f=P;A=64;break}case 111:{l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;if((s|0)==0&(l|0)==0)a=O;else{a=O;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(!(P&8)){s=P;f=0;c=5839;A=77}else{f=j-a+1|0;s=P;h=(h|0)<(f|0)?f:h;f=0;c=5839;A=77}break}case 105:case 100:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;if((s|0)<0){a=Vr(0,0,a|0,s|0)|0;s=re;l=G;de[l>>2]=a;de[l+4>>2]=s;l=1;c=5839;A=76;break t}if(!(P&2048)){c=P&1;l=c;c=(c|0)==0?5839:5841;A=76}else{l=1;c=5840;A=76}break}case 117:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;l=0;c=5839;A=76;break}case 99:{pe[N>>0]=de[G>>2];m=N;s=1;f=0;p=5839;a=O;break}case 109:{a=hr()|0;a=ur(de[a>>2]|0)|0;A=82;break}case 115:{a=de[G>>2]|0;a=(a|0)!=0?a:5849;A=82;break}case 67:{de[K>>2]=de[G>>2];de[B>>2]=0;de[G>>2]=K;h=-1;A=86;break}case 83:{if(!h){Nr(e,32,C,0,P);a=0;A=98}else A=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[G>>3];de[Z>>2]=0;ee[te>>3]=u;if((de[te+4>>2]|0)>=0)if(!(P&2048)){S=P&1;k=S;S=(S|0)==0?5857:5862}else{k=1;S=5859}else{u=-u;k=1;S=5856}ee[te>>3]=u;T=de[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){d=+pr(u,Z)*2.0;s=d!=0.0;if(s)de[Z>>2]=(de[Z>>2]|0)+-1;x=p|32;if((x|0)==97){m=p&32;v=(m|0)==0?S:S+9|0;g=k|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[v>>0]|0)==45){u=-(u+(-d-u));break}else{u=d+u-u;break}}else u=d}while(0);s=de[Z>>2]|0;a=(s|0)<0?0-s|0:s;a=jr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){pe[X>>0]=48;a=X}pe[a+-1>>0]=(s>>31&2)+43;f=a+-2|0;pe[f>>0]=p+15;c=(h|0)<1;l=(P&8|0)==0;s=Y;while(1){S=~~u;a=s+1|0;pe[s>>0]=me[5823+S>>0]|m;u=(u-+(S|0))*16.0;do{if((a-H|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&(M+a|0)<(h|0)?D+h-f|0:q-f+a|0;l=h+g|0;Nr(e,32,C,l,P);if(!(de[e>>2]&32))_r(v,g,e)|0;Nr(e,48,C,l,P^65536);a=a-H|0;if(!(de[e>>2]&32))_r(Y,a,e)|0;s=W-f|0;Nr(e,48,h-(a+s)|0,0,0);if(!(de[e>>2]&32))_r(f,s,e)|0;Nr(e,32,C,l,P^8192);a=(l|0)<(C|0)?C:l;break}a=(h|0)<0?6:h;if(s){s=(de[Z>>2]|0)+-28|0;de[Z>>2]=s;u=d*268435456.0}else{u=d;s=de[Z>>2]|0}T=(s|0)<0?V:R;w=T;s=T;do{b=~~u>>>0;de[s>>2]=b;s=s+4|0;u=(u-+(b>>>0))*1.0e9}while(u!=0.0);l=s;s=de[Z>>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{b=Jr(de[h>>2]|0,0,f|0)|0;b=Kr(b|0,re|0,s|0,0)|0;s=re;y=ai(b|0,s|0,1e9,0)|0;de[h>>2]=y;s=oi(b|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[Z>>2]|0)-f|0;de[Z>>2]=s;if((s|0)>0)c=h;else break}}else h=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;m=h;while(1){g=0-s|0;g=(g|0)>9?9:g;do{if(m>>>0>>0){s=(1<>>g;h=0;f=m;do{b=de[f>>2]|0;de[f>>2]=(b>>>g)+h;h=_e(b&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=_?T:h;l=(l-s>>2|0)>(v|0)?s+(v<<2)|0:l;s=(de[Z>>2]|0)+g|0;de[Z>>2]=s;if((s|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){s=(w-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);y=(x|0)==103;b=(a|0)!=0;h=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((h|0)<(((l-w>>2)*9|0)+-9|0)){f=h+9216|0;_=(f|0)/9|0;h=T+(_+-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;g=de[h>>2]|0;v=(g>>>0)%(c>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(l|0):0)c=m;else A=163;do{if((A|0)==163){A=0;d=(((g>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;f=(c|0)/2|0;do{if(v>>>0>>0)u=.5;else{if((v|0)==(f|0)?(T+(_+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(k){if((pe[S>>0]|0)!=45)break;d=-d;u=-u}}while(0);f=g-v|0;de[h>>2]=f;if(!(d+u!=d)){c=m;break}x=f+c|0;de[h>>2]=x;if(x>>>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}x=(de[c>>2]|0)+1|0;de[c>>2]=x;if(x>>>0>999999999)h=c;else{m=s;h=c;break}}}s=(w-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);x=h+4|0;m=c;l=l>>>0>x>>>0?x:l}v=0-s|0;while(1){if(l>>>0<=m>>>0){_=0;x=l;break}h=l+-4|0;if(!(de[h>>2]|0))l=h;else{_=1;x=l;break}}do{if(y){a=(b&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=P&8;if(l)break;do{if(_){l=de[x+-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=((x-w>>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=P&8}while(0);g=a|l;c=(g|0)!=0&1;f=(p|32|0)==102;if(f){s=(s|0)>0?s:0;p=0}else{h=(s|0)<0?v:s;h=jr(h,((h|0)<0)<<31>>31,U)|0;if((W-h|0)<2)do{h=h+-1|0;pe[h>>0]=48}while((W-h|0)<2);pe[h+-1>>0]=(s>>31&2)+43;w=h+-2|0;pe[w>>0]=p;s=W-w|0;p=w}v=k+1+a+c+s|0;Nr(e,32,C,v,P);if(!(de[e>>2]&32))_r(S,k,e)|0;Nr(e,48,C,v,P^65536);do{if(f){h=m>>>0>T>>>0?T:m;s=h;do{l=jr(de[s>>2]|0,0,z)|0;do{if((s|0)==(h|0)){if((l|0)!=(z|0))break;pe[L>>0]=48;l=L}else{if(l>>>0<=Y>>>0)break;do{l=l+-1|0;pe[l>>0]=48}while(l>>>0>Y>>>0)}}while(0);if(!(de[e>>2]&32))_r(l,F-l|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(g){if(de[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){l=s;while(1){s=jr(de[l>>2]|0,0,z)|0;if(s>>>0>Y>>>0)do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0);if(!(de[e>>2]&32))_r(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}}Nr(e,48,a+9|0,9,0)}else{f=_?x:m+4|0;if((a|0)>-1){c=(l|0)==0;h=m;do{s=jr(de[h>>2]|0,0,z)|0;if((s|0)==(z|0)){pe[L>>0]=48;s=L}do{if((h|0)==(m|0)){l=s+1|0;if(!(de[e>>2]&32))_r(s,1,e)|0;if(c&(a|0)<1){s=l;break}if(de[e>>2]&32){s=l;break}_r(5891,1,e)|0;s=l}else{if(s>>>0<=Y>>>0)break;do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0)}}while(0);l=F-s|0;if(!(de[e>>2]&32))_r(s,(a|0)>(l|0)?l:a,e)|0;a=a-l|0;h=h+4|0}while(h>>>0>>0&(a|0)>-1)}Nr(e,48,a+18|0,18,0);if(de[e>>2]&32)break;_r(p,W-p|0,e)|0}}while(0);Nr(e,32,C,v,P^8192);a=(v|0)<(C|0)?C:v}else{f=(p&32|0)!=0;c=u!=u|0.0!=0.0;s=c?0:k;h=s+3|0;Nr(e,32,C,h,l);a=de[e>>2]|0;if(!(a&32)){_r(S,s,e)|0;a=de[e>>2]|0}if(!(a&32))_r(c?f?5883:5887:f?5875:5879,3,e)|0;Nr(e,32,C,h,P^8192);a=(h|0)<(C|0)?C:h}}while(0);m=E;continue e}default:{l=P;s=h;f=0;p=5839;a=O}}}while(0);t:do{if((A|0)==64){l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;c=p&32;if(!((s|0)==0&(l|0)==0)){a=O;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));A=G;if((f&8|0)==0|(de[A>>2]|0)==0&(de[A+4>>2]|0)==0){s=f;f=0;c=5839;A=77}else{s=f;f=2;c=5839+(p>>4)|0;A=77}}else{a=O;s=f;f=0;c=5839;A=77}}else if((A|0)==76){a=jr(a,s,O)|0;s=P;f=l;A=77}else if((A|0)==82){A=0;P=Mr(a,0,h)|0;S=(P|0)==0;m=a;s=S?h:P-a|0;f=0;p=5839;a=S?a+h|0:P}else if((A|0)==86){A=0;s=0;a=0;c=de[G>>2]|0;while(1){l=de[c>>2]|0;if(!l)break;a=mr(J,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}Nr(e,32,C,s,P);if(!s){a=0;A=98}else{l=0;h=de[G>>2]|0;while(1){a=de[h>>2]|0;if(!a){a=s;A=98;break t}a=mr(J,a)|0;l=a+l|0;if((l|0)>(s|0)){a=s;A=98;break t}if(!(de[e>>2]&32))_r(J,a,e)|0;if(l>>>0>=s>>>0){a=s;A=98;break}else h=h+4|0}}}}while(0);if((A|0)==98){A=0;Nr(e,32,C,a,P^8192);m=E;a=(C|0)>(a|0)?C:a;continue}if((A|0)==77){A=0;l=(h|0)>-1?s&-65537:s;s=G;s=(de[s>>2]|0)!=0|(de[s+4>>2]|0)!=0;if((h|0)!=0|s){s=(s&1^1)+(j-a)|0;m=a;s=(h|0)>(s|0)?h:s;p=c;a=O}else{m=O;s=0;p=c;a=O}}c=a-m|0;s=(s|0)<(c|0)?c:s;h=f+s|0;a=(C|0)<(h|0)?h:C;Nr(e,32,a,h,l);if(!(de[e>>2]&32))_r(p,f,e)|0;Nr(e,48,a,h,l^65536);Nr(e,48,s,c,0);if(!(de[e>>2]&32))_r(m,c,e)|0;Nr(e,32,a,h,l^8192);m=E}e:do{if((A|0)==245)if(!e)if(t){o=1;while(1){t=de[n+(o<<2)>>2]|0;if(!t)break;Lr(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);ve=Q;return o|0}function zr(e){e=e|0;if(!(de[e+68>>2]|0))Sr(e);return}function Fr(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;Qr(n|0,t|0,e|0)|0;de[i>>2]=(de[i>>2]|0)+e;return r|0}function Lr(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);return}function jr(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=ai(e|0,t|0,10,0)|0;r=r+-1|0;pe[r>>0]=i|48;i=oi(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 Nr(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=ve;ve=ve+256|0;a=s;do{if((r|0)>(i|0)&(n&73728|0)==0){n=r-i|0;Yr(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){_r(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;_r(a,n,e)|0}}while(0);ve=s;return}function Br(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=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)Xe();t=a+12|0;if((de[t>>2]|0)==(n|0)){de[t>>2]=r;de[i>>2]=a;break}else Xe()}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)Xe();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 Xe()}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)Xe();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;F=r>>>12&16;r=r>>>F;z=r>>>5&8;r=r>>>z;L=r>>>2&4;r=r>>>L;e=r>>>1&2;r=r>>>e;i=r>>>1&1;i=de[908+((z|F|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)Xe();s=i+p|0;if(i>>>0>=s>>>0)Xe();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)Xe();else{de[e>>2]=0;f=t;break}}else{n=de[i+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(i|0))Xe();e=r+8|0;if((de[e>>2]|0)==(i|0)){de[t>>2]=r;de[e>>2]=n;f=r;break}else Xe()}}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)Xe();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)Xe();de[f+24>>2]=a;t=de[i+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();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)Xe();a=l+c|0;if(l>>>0>=a>>>0)Xe();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)Xe();else{de[e>>2]=0;p=t;break}}else{i=de[l+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((de[t>>2]|0)!=(l|0))Xe();e=r+8|0;if((de[e>>2]|0)==(l|0)){de[t>>2]=r;de[e>>2]=i;p=r;break}else Xe()}}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)Xe();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)Xe();de[p+24>>2]=o;t=de[l+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();else{v=t;_=e}}else{de[151]=r|t;v=644+(e+2<<2)|0;_=i}de[v>>2]=a;de[_+12>>2]=a;de[l+(c+8)>>2]=_;de[l+(c+12)>>2]=i;break}t=s>>>8;if(t)if(s>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|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)){T=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();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 T=t}while(0);t=T+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&T>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[l+(c+8)>>2]=e;de[l+(c+12)>>2]=T;de[l+(c+24)>>2]=0;break}else Xe()}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){F=e-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}do{if(!(de[269]|0)){e=De(30)|0;if(!(e+-1&e)){de[271]=e;de[270]=e;de[272]=-1;de[273]=-1;de[274]=0;de[262]=0;T=(We(0)|0)&-16^1431655768;de[269]=T;break}else Xe()}}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?(_=de[259]|0,T=_+h|0,T>>>0<=_>>>0|T>>>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?(g=n+4|0,(r+(de[g>>2]|0)|0)>>>0>e>>>0):0){o=n;e=g;break}n=de[n+8>>2]|0;if(!n){b=174;break t}}r=a-(de[154]|0)&s;if(r>>>0<2147483647){n=Ie(r|0)|0;T=(n|0)==((de[o>>2]|0)+(de[e>>2]|0)|0);e=T?r:0;if(T){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=Ie(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){T=de[261]|0;if((T|0)!=0?n>>>0<=e>>>0|n>>>0>T>>>0:0){e=0;break}n=Ie(r|0)|0;T=(n|0)==(o|0);e=T?r:0;if(T){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((Ie(y|0)|0)==(-1|0)){Ie(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=Ie(h|0)|0,w=Ie(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(k=w-x|0,S=k>>>0>(m+40|0)>>>0,S):0){d=S?k: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)){P=e;E=r;C=n;A=o;b=204;break}o=de[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(de[A+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){de[E>>2]=C+d;L=(de[154]|0)+d|0;F=a+8|0;F=(F&7|0)==0?0:0-F&7;z=L-F|0;de[157]=a+F;de[154]=z;de[a+(F+4)>>2]=z|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){R=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)Xe();else{de[i>>2]=0;R=r;break}}else{n=de[x+((u|8)+d)>>2]|0;if(n>>>0>>0)Xe();e=n+12|0;if((de[e>>2]|0)!=(t|0))Xe();r=i+8|0;if((de[r>>2]|0)==(t|0)){de[e>>2]=i;de[r>>2]=n;R=i;break}else Xe()}}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)Xe();e=a+16|0;if((de[e>>2]|0)==(t|0))de[e>>2]=R;else de[a+20>>2]=R;if(!R)break r}else{de[r>>2]=R;if(R)break;de[152]=de[152]&~(1<>>0>>0)Xe();de[R+24>>2]=a;t=u|16;e=de[x+(t+d)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{de[R+16>>2]=e;de[e+24>>2]=R;break}}while(0);t=de[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(de[155]|0)>>>0)Xe();else{de[R+20>>2]=t;de[t+24>>2]=R;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)Xe();if((de[i+12>>2]|0)==(t|0))break;Xe()}}while(0);if((n|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();e=n+8|0;if((de[e>>2]|0)==(t|0)){I=e;break}Xe()}}while(0);de[i+12>>2]=n;de[I>>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){z=t;F=e;break}Xe()}}while(0);de[z>>2]=p;de[F+12>>2]=p;de[x+(c+8)>>2]=F;de[x+(c+12)>>2]=i;break}t=n>>>8;do{if(!t)i=0;else{if(n>>>0>16777215){i=31;break}z=(t+1048320|0)>>>16&8;F=t<>>16&4;F=F<>>16&2;i=14-(R|z|i)+(F<>>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)Xe();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;F=de[155]|0;if(e>>>0>=F>>>0&L>>>0>=F>>>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 Xe()}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)Xe();else{O=t;M=e}}else{de[151]=r|t;O=644+(e+2<<2)|0;M=i}de[O>>2]=a;de[M+12>>2]=a;de[a+8>>2]=M;de[a+12>>2]=i;break}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|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)){D=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[a+24>>2]=t;de[a+12>>2]=a;de[a+8>>2]=a;break e}}else D=t}while(0);t=D+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&D>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[a+8>>2]=e;de[a+12>>2]=D;de[a+24>>2]=0;break}else Xe()}}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;F=644+(L<<2)|0;de[644+(L+3<<2)>>2]=F;de[644+(L+2<<2)>>2]=F;t=t+1|0}while((t|0)!=32);L=x+8|0;L=(L&7|0)==0?0:0-L&7;F=d+-40-L|0;de[157]=x+L;de[154]=F;de[x+(L+4)>>2]=F|1;de[x+(d+-36)>>2]=40;de[158]=de[273]}}while(0);t=de[154]|0;if(t>>>0>m>>>0){F=t-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}}L=hr()|0;de[L>>2]=12;L=0;return L|0}function Ur(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,g=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=de[155]|0;if(t>>>0>>0)Xe();r=de[e+-4>>2]|0;i=r&3;if((i|0)==1)Xe();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)Xe();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)Xe();if((de[i+12>>2]|0)!=(h|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(h|0))a=t;else Xe()}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)Xe();else{de[r>>2]=0;u=t;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(h|0))Xe();r=i+8|0;if((de[r>>2]|0)==(h|0)){de[t>>2]=i;de[r>>2]=n;u=i;break}else Xe()}}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)Xe();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)Xe();de[u+24>>2]=a;t=de[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();t=e+(p+-4)|0;r=de[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((m|0)==(de[157]|0)){_=(de[154]|0)+o|0;de[154]=_;de[157]=y;de[y+4>>2]=_|1;if((y|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){_=(de[153]|0)+o|0;de[153]=_;de[156]=y;de[y+4>>2]=_|1;de[y+_>>2]=_;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)Xe();else{de[r>>2]=0;d=t;break}}else{r=de[e+p>>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();i=r+12|0;if((de[i>>2]|0)!=(m|0))Xe();n=t+8|0;if((de[n>>2]|0)==(m|0)){de[i>>2]=t;de[n>>2]=r;d=t;break}else Xe()}}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)Xe();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)Xe();de[d+24>>2]=a;t=de[e+(p+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();if((de[i+12>>2]|0)!=(m|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0<(de[155]|0)>>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(m|0))f=t;else Xe()}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)Xe();else{g=t;v=r}}else{de[151]=i|t;g=644+(r+2<<2)|0;v=n}de[g>>2]=y;de[v+12>>2]=y;de[y+8>>2]=v;de[y+12>>2]=n;return}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{g=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;n=14-(m|g|n)+(v<>>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)){_=i;break t}else{n=n<<1;t=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=de[t>>2]|0;v=de[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){de[r+12>>2]=y;de[t>>2]=y;de[y+8>>2]=r;de[y+12>>2]=_;de[y+24>>2]=0;break}else Xe()}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 Xr(e,t){e=e|0;t=t|0;var r=0,i=0;if(!e){e=Br(t)|0;return e|0}if(t>>>0>4294967231){e=hr()|0;de[e>>2]=12;e=0;return e|0}r=Wr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=Br(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;Qr(r|0,e|0,(i>>>0>>0?i:t)|0)|0;Ur(e);e=r;return e|0}function Hr(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 Wr(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))Xe();i=e+(l|4)|0;n=de[i>>2]|0;if(!(n&1))Xe();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;qr(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)Xe();else{de[i>>2]=0;u=r;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();r=n+12|0;if((de[r>>2]|0)!=(h|0))Xe();i=o+8|0;if((de[i>>2]|0)==(h|0)){de[r>>2]=o;de[i>>2]=n;u=o;break}else Xe()}}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)Xe();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)Xe();de[u+24>>2]=a;r=de[e+(l+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();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)Xe();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)Xe();if((de[n+12>>2]|0)!=(h|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(h|0))a=r;else Xe()}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;qr(e+t|0,f);return e|0}return 0}function qr(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,g=0,v=0,_=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)Xe();if((f|0)==(de[156]|0)){i=e+(t+4)|0;r=de[i>>2]|0;if((r&3|0)!=3){_=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)Xe();if((de[n+12>>2]|0)!=(f|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(f|0))s=r;else Xe()}else s=i+8|0;de[n+12>>2]=i;de[s>>2]=n;_=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)Xe();else{de[i>>2]=0;h=r;break}}else{o=de[e+(8-u)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(f|0))Xe();i=n+8|0;if((de[i>>2]|0)==(f|0)){de[r>>2]=n;de[i>>2]=o;h=n;break}else Xe()}}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)Xe();r=s+16|0;if((de[r>>2]|0)==(f|0))de[r>>2]=h;else de[s+20>>2]=h;if(!h){_=f;a=c;break}}n=de[155]|0;if(h>>>0>>0)Xe();de[h+24>>2]=s;r=16-u|0;i=de[e+r>>2]|0;do{if(i)if(i>>>0>>0)Xe();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)Xe();else{de[h+20>>2]=r;de[r+24>>2]=h;_=f;a=c;break}else{_=f;a=c}}else{_=f;a=c}}else{_=e;a=t}}while(0);l=de[155]|0;if(m>>>0>>0)Xe();r=e+(t+4)|0;i=de[r>>2]|0;if(!(i&2)){if((m|0)==(de[157]|0)){v=(de[154]|0)+a|0;de[154]=v;de[157]=_;de[_+4>>2]=v|1;if((_|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){v=(de[153]|0)+a|0;de[153]=v;de[156]=_;de[_+4>>2]=v|1;de[_+v>>2]=v;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)Xe();else{de[i>>2]=0;d=r;break}}else{o=de[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(m|0))Xe();i=n+8|0;if((de[i>>2]|0)==(m|0)){de[r>>2]=n;de[i>>2]=o;d=n;break}else Xe()}}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)Xe();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)Xe();de[d+24>>2]=s;r=de[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();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)Xe();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)Xe();if((de[n+12>>2]|0)!=(m|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(m|0))p=r;else Xe()}else p=i+8|0;de[n+12>>2]=i;de[p>>2]=n}}while(0);de[_+4>>2]=a|1;de[_+a>>2]=a;if((_|0)==(de[156]|0)){de[153]=a;return}}else{de[r>>2]=i&-2;de[_+4>>2]=a|1;de[_+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)Xe();else{g=r;v=i}}else{de[151]=n|r;g=644+(i+2<<2)|0;v=o}de[g>>2]=_;de[v+12>>2]=_;de[_+8>>2]=v;de[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{g=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(m|g|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;de[_+28>>2]=o;de[_+20>>2]=0;de[_+16>>2]=0;i=de[152]|0;n=1<>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;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)Xe();de[i>>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}}while(0);i=r+8|0;n=de[i>>2]|0;v=de[155]|0;if(!(n>>>0>=v>>>0&r>>>0>=v>>>0))Xe();de[n+12>>2]=_;de[i>>2]=_;de[_+8>>2]=n;de[_+12>>2]=r;de[_+24>>2]=0;return}function Gr(){}function Vr(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 Yr(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 Jr(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 Qr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if((r|0)>=4096)return Me(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 $r(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 ei(e){e=e|0;var t=0;t=pe[g+(e&255)>>0]|0;if((t|0)<8)return t|0;t=pe[g+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=pe[g+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(pe[g+(e>>>24)>>0]|0)+24|0}function ti(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0;o=e&65535;n=t&65535;r=_e(n,o)|0;i=e>>>16;e=(r>>>16)+(_e(n,i)|0)|0;n=t>>>16;t=_e(n,o)|0;return(re=(e>>>16)+(_e(n,i)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function ri(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=Vr(u^e,l^t,u,l)|0;a=re;e=o^u;t=n^l;return Vr((si(s,a,Vr(o^r,n^i,o,n)|0,re,0)|0)^e,re^t,e,t)|0}function ii(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=ve;ve=ve+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=Vr(a^e,o^t,a,o)|0;t=re;si(e,t,Vr(u^r,l^i,u,l)|0,re,s)|0;i=Vr(de[s>>2]^a,de[s+4>>2]^o,a,o)|0;r=re;ve=n;return(re=r,i)|0}function ni(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=ti(n,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(i,n)|0)+e|e&0,r|0|0)|0}function oi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return si(e,t,r,i,0)|0}function ai(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;o=ve;ve=ve+16|0;n=o|0;si(e,t,r,i,n)|0;ve=o;return(re=de[n+4>>2]|0,de[n>>2]|0)|0}function si(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=(ae(s|0)|0)-(ae(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=(ae(a|0)|0)+33-(ae(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=ei(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>>>((ei(s|0)|0)>>>0);return(re=p,d)|0}o=(ae(s|0)|0)-(ae(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=Kr(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;Vr(u,r,i,f)|0;d=re;p=d>>31|((d|0)<0?-1:0)<<1;s=p&1;e=Vr(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 li(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return Pi[e&7](t|0,r|0,i|0)|0}function ui(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;Ei[e&3](t|0,r|0,i|0,n|0,o|0)}function hi(e,t){e=e|0;t=t|0;Ci[e&7](t|0)}function ci(e,t){e=e|0;t=t|0;return Ai[e&1](t|0)|0}function fi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;Ii[e&0](t|0,r|0,i|0)}function pi(e){e=e|0;Oi[e&3]()}function di(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;Mi[e&3](t|0,r|0,i|0,n|0,o|0,a|0)}function mi(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 Di[e&1](t|0,r|0,i|0,n|0,o|0)|0}function gi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;Ri[e&3](t|0,r|0,i|0,n|0)}function vi(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function _i(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(1)}function yi(e){e=e|0;se(2)}function bi(e){e=e|0;se(3);return 0}function xi(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function wi(){se(5)}function Ti(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;se(6)}function ki(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(7);return 0}function Si(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;se(8)}var Pi=[vi,Yt,Fr,Ar,Cr,Ir,vi,vi];var Ei=[_i,tr,er,_i];var Ci=[yi,Ht,Gt,Wt,qt,Vt,lr,zr];var Ai=[bi,Er];var Ii=[xi];var Oi=[wi,ar,sr,wi];var Mi=[Ti,ir,rr,Ti];var Di=[ki,lt];var Ri=[Si,Jt,Kt,Si];return{___cxa_can_catch:nr,_crn_get_levels:Tt,_crn_get_uncompressed_size:St,_crn_decompress:Pt,_i64Add:Kr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Vr,_memset:Yr,_malloc:Br,_free:Ur,_memcpy:Qr,_bitshift64Lshr:Zr,_fflush:gr,_bitshift64Shl:Jr,_crn_get_height:wt,___errno_location:hr,_crn_get_dxt_format:kt,runPostSets:Gr,_emscripten_replace_memory:Ye,stackAlloc:Ze,stackSave:Je,stackRestore:Ke,establishStackSpace:Qe,setThrew:$e,setTempRet0:rt,getTempRet0:it,dynCall_iiii:li,dynCall_viiiii:ui,dynCall_vi:hi,dynCall_ii:ci,dynCall_viii:fi,dynCall_v:pi,dynCall_viiiiii:di,dynCall_iiiiii:mi,dynCall_viiii:gi}}(e.Ya,e.Za,buffer);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;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=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;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=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)};var i=function(l){function e(e,t,r,i,n,o,a){var s=l.call(this)||this;return s.complete=!1,s.isCompressedImage=!0,s.preserveSource=!0,s.onload=null,s.baseTexture=null,s.init(e,t,r,i,n,o,a),s}return __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;var s=this.complete;return this.complete=!!t,!s&&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 i=e.state.gl,n=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}(e.AbstractInternalLoader);e.DDSLoader=l}(pixi_compressed_textures||(pixi_compressed_textures={})),function(e){var t,c=((t={})[0]=35841,t[1]=35843,t[2]=35840,t[3]=35842,t[6]=36196,t[7]=33776,t[9]=33778,t[5]=33779,t),r=function(t){function h(e){return t.call(this,e)||this}return __extends(h,t),h.prototype.load=function(e){if(!h.test(e))throw"Invalid magic number in PVR header";var t=new Int32Array(e,0,13),r=t[2],i=c[r]||-1,n=t[7],o=t[6],a=t[11],s=t[12]+52,l=new Uint8Array(e,s),u=this._image;return this._format=i,u.init(u.src,l,"PVR",n,o,a,i),u},h.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},h.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}},h.type="PVR",h}(e.AbstractInternalLoader);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,c=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),h=((t={})[u]=-1,t[r]=36196,t[i]=33776,t[n]=33779,t[o]=35840,t[a]=35842,t[s]=37808,t),f=Object.keys(h).reduce(function(e,t){return e[h[+t]]=+t,e},{}),p=function(r){function h(e){var t=r.call(this,e)||this;return t.type="BASIS",t._file=void 0,t}return __extends(h,r),h.test=function(e){var t=1262195===new Uint32Array(e,0,1)[0]&&!!h.BASIS_BINDING,r=h.RGB_FORMAT&&h.RGBA_FORMAT;return!t&&r&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),r&&t},h.bindTranscoder=function(e,i){if(!e||!i)throw"Invalid state! undef fileCtr or ext invalid!";var t=Object.keys(i).reduce(function(e,t){var r=i[t];return r?Object.assign(e,r.__proto__):e},{}),r=void 0,n=void 0;for(var o in t){var a=t[o];if(void 0!==f[a]){var s=f[a];c[s]?n={native:a,name:o,basis:s}:r={native:a,name:o,basis:s}}}h.RGB_FORMAT=r||n,h.RGBA_FORMAT=n||r,h.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+h.RGB_FORMAT.name+"\nRGBA:"+h.RGBA_FORMAT.name),l.RegisterCompressedLoader(h),l.RegisterCompressedExtensions("basis")},h.prototype.load=function(e){if(!h.test(e))throw"BASIS Transcoder not binded or transcoding not supported =(!";return this._loadAsync(e),this._image},h.prototype._loadAsync=function(e){var t=performance.now(),r=new h.BASIS_BINDING(new Uint8Array(e)),i=r.getImageWidth(0,0),n=r.getImageHeight(0,0),o=r.getHasAlpha(),a=this._image;if(!r.startTranscoding())throw"Transcoding error!";var s=o?h.RGBA_FORMAT:h.RGB_FORMAT;console.log("Grats! BASIS will be transcoded to:",s);var l=new Uint8Array(r.getImageTranscodedSizeInBytes(0,0,s.basis));if(!r.transcodeImage(l,0,0,s.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=s.native,this._file=r;var u=s.name.replace("COMPRESSED_","");return Promise.resolve(a.init(a.src,l,"BASIS|"+u,i,n,1,s.native))},h.prototype.levelBufferSize=function(e,t,r){return this._file?this._file.getImageTranscodedSizeInBytes(0,r,f[this._format]):void 0},h.BASIS_BINDING=void 0,h}(l.AbstractInternalLoader);l.BASISLoader=p}(pixi_compressed_textures||(pixi_compressed_textures={})),function(i){var p=window.CRN_Module;var d=[33776,33778,33779],e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.load=function(e){var t=e.byteLength,r=new Uint8Array(e),i=p._malloc(t);!function(e,t,r,i){for(var n=r/4,o=i%4,a=new Uint32Array(e.buffer,0,(i-o)/4),s=new Uint32Array(t.buffer),l=0;li.count)){var e=new a;return i.workers.push(e),e.init(t,r).then(function(){r=e.binary,o()})}};return o().then(function(){return i})},e.prototype.transcode=function(t,r){if(!this.workers||!this.workers.length)throw"[TranscoderWorkerPool] Pool empty, populate before!";var n=this.workers,o=void 0,a=0,s=function(e){for(var t=0,r=n;t 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"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,i)},e}(n.Filter),d=function(i){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),i.call(this,"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}",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.uniforms.uOffset=new Float32Array(2),this._pixelSize=new f.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}i&&(e.__proto__=i);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n,o=this.pixelSize.x/t._frame.width,a=this.pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)n=this._kernels[0]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,e.applyFilter(this,t,r,i);else{for(var s,l=e.getFilterTexture(),u=t,h=l,c=this._quality-1,f=0;f threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(n.Filter),i=function(a){function e(e){a.call(this,c,"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"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:p.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._extractFilter=new m(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,i,n){var o=e.getFilterTexture();this._extractFilter.apply(e,t,o,!0,n);var a=e.getFilterTexture();this._blurFilter.apply(e,o,a,!0,n),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,i),e.returnFilterTexture(a),e.returnFilterTexture(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),o=function(t){function e(e){void 0===e&&(e=8),t.call(this,"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}","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.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(n.Filter),a=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","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.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/f.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*f.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return l.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){l.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return l.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){l.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(n.Filter),g=function(a){function e(e,t,r,i){var n,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=p.settings.RESOLUTION),void 0===i&&(i=5),a.call(this),"number"==typeof e?o=n=e:e instanceof f.Point?(n=e.x,o=e.y):Array.isArray(e)&&(n=e[0],o=e[1]),this.blurXFilter=new h.BlurFilterPass(!0,n,t,r,i),this.blurYFilter=new h.BlurFilterPass(!1,o,t,r,i),this.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,this.defaultFilter=new u.AlphaFilter}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,i),this.blurYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(n.Filter),v=function(i){function e(e,t,r){i.call(this,"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}","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.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}i&&(e.__proto__=i);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(n.Filter),_=function(i){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),i.call(this,"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}","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._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}i&&(e.__proto__=i);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,i)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof n.Texture||(e=n.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),i.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(n.Filter),y=function(i){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),i.call(this,"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}","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.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(l.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=l.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(l.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=l.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(n.Filter),b=function(i){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),i.call(this,"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}","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.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(n.Filter),x=function(e){function t(){e.call(this,"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}","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")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(n.Filter),w=function(t){function e(e){t.call(this,"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}","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 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\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 gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\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 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.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(n.Filter),T=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"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}","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.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),k=function(c){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:p.settings.RESOLUTION},e),c.call(this);var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._tintFilter=new c("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}","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 // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new f.Point,this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o;var a=e.shadowOnly,s=e.rotation,l=e.distance,u=e.alpha,h=e.color;this.shadowOnly=a,this.rotation=s,this.distance=l,this.alpha=u,this.color=h,this._updatePadding()}c&&(e.__proto__=c);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(c&&c.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=e.getFilterTexture();this._tintFilter.apply(e,t,n,!0),this._blurFilter.apply(e,n,r,i),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnFilterTexture(n)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateShift()},t.rotation.get=function(){return this.angle/f.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*f.DEG_TO_RAD,this._updateShift()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return l.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){l.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),S=function(t){function e(e){void 0===e&&(e=5),t.call(this,"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}","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.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(n.Filter),P=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","// 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.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=n.Texture.from(this._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=t.filterFrame.width,o=t.filterFrame.height;this.uniforms.dimensions[0]=n,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/n,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,i)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,i=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var n=this._slices,o=1,a=0;a>0,i=e[t];e[t]=e[r],e[r]=i}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),n+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")";t[3*i]=-1;for(var n=0;n 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.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,i)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(n.Filter),M=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var i=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),n=(2*Math.PI/i).toFixed(7);o.call(this,"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}","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\}/,n)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,i){this.uniforms.thickness[0]=this.thickness/t._frame.width,this.uniforms.thickness[1]=this.thickness/t._frame.height,e.applyFilter(this,t,r,i)},e.color.get=function(){return l.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){l.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(n.Filter);M.MIN_SAMPLES=1,M.MAX_SAMPLES=100;var D=function(t){function e(e){void 0===e&&(e=10),t.call(this,"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}","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.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(n.Filter),R=function(n){function e(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),n.call(this,"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}","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._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=i}n&&(e.__proto__=n);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,i)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),z=function(t){function e(e){t.call(this,"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}","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.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(n.Filter),F=function(i){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),i.call(this,"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}","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.red=e,this.green=t,this.blue=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(n.Filter),L=function(i){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),i.call(this,"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}","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.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}i&&(e.__proto__=i);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),j=function(i){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),i.call(this,"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}","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.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}i&&(e.__proto__=i);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(l.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=l.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(n.Filter),N=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this,"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}","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.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new f.Point(0,window.innerHeight/2),this.uniforms.end=i||new f.Point(600,window.innerHeight/2),this.uniforms.delta=new f.Point(30,30),this.uniforms.texSize=new f.Point(window.innerWidth,window.innerHeight),this.updateDelta()}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(n.Filter),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(N),U=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(N),X=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this),this.tiltShiftXFilter=new B(e,t,r,i),this.tiltShiftYFilter=new U(e,t,r,i)}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture();this.tiltShiftXFilter.apply(e,t,i),this.tiltShiftYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(n.Filter),H=function(i){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),i.call(this,"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}","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.radius=e,this.angle=t,this.padding=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),W=function(n){function e(e,t,r,i){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 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"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=i}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=i,e.AsciiFilter=o,e.BevelFilter=a,e.BloomFilter=g,e.BulgePinchFilter=v,e.CRTFilter=w,e.ColorMapFilter=_,e.ColorReplaceFilter=y,e.ConvolutionFilter=b,e.CrossHatchFilter=x,e.DotFilter=T,e.DropShadowFilter=k,e.EmbossFilter=S,e.GlitchFilter=P,e.GlowFilter=E,e.GodrayFilter=C,e.KawaseBlurFilter=d,e.MotionBlurFilter=A,e.MultiColorReplaceFilter=I,e.OldFilmFilter=O,e.OutlineFilter=M,e.PixelateFilter=D,e.RGBSplitFilter=F,e.RadialBlurFilter=R,e.ReflectionFilter=z,e.ShockwaveFilter=L,e.SimpleLightmapFilter=j,e.TiltShiftAxisFilter=N,e.TiltShiftFilter=X,e.TiltShiftXFilter=B,e.TiltShiftYFilter=U,e.TwistFilter=H,e.ZoomBlurFilter=W,e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),pixi_projection,pixi_projection;Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},function(p,v){"use strict";var t,f,d=function(){function f(e,t,r){this.value=e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:p.ParticleUtils.generateEase(r):null}return f.createList=function(e){if("list"in e){var t=e.list,r=void 0,i=void 0,n=t[0],o=n.value,a=n.time;if(i=r=new f("string"==typeof o?p.ParticleUtils.hexToRGB(o):o,a,e.ease),2a.time;)n=a,a=e[++o];l=(l-n.time)/(a.time-n.time);var u=f.hexToRGB(n.value),h=f.hexToRGB(a.value),c={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 d(c,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 n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?a:r:e.isStepped?this.interpolate=this.isColor?c:u:this.interpolate=this.isColor?l:s,this.ease=this.current.ease},e}();function r(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function a(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,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function s(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 l(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,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function u(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 c(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 p.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}var m,g=function(r){function i(e){var t=r.call(this)||this;return t.emitter=e,t.anchor.x=t.anchor.y=.5,t.velocity=new v.Point,t.rotationSpeed=0,t.rotationAcceleration=0,t.maxLife=0,t.age=0,t.ease=null,t.extraData=null,t.alphaList=new o,t.speedList=new o,t.speedMultiplier=1,t.acceleration=new v.Point,t.maxSpeed=NaN,t.scaleList=new o,t.scaleMultiplier=1,t.colorList=new o(!0),t._doAlpha=!1,t._doScale=!1,t._doSpeed=!1,t._doAcceleration=!1,t._doColor=!1,t._doNormalMovement=!1,t._oneOverLife=0,t.next=null,t.prev=null,t.init=t.init,t.Particle_init=i.prototype.init,t.update=t.update,t.Particle_update=i.prototype.update,t.Sprite_destroy=r.prototype.destroy,t.Particle_destroy=i.prototype.destroy,t.applyArt=t.applyArt,t.kill=t.kill,t}return n(i,r),i.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,p.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=p.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=p.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=p.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=p.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},i.prototype.applyArt=function(e){this.texture=e||v.Texture.EMPTY},i.prototype.update=function(e){if(this.age+=e,this.age>=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(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){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){var i=void 0,n=void 0;if(this._doSpeed){var o=this.speedList.interpolate(t)*this.speedMultiplier;p.ParticleUtils.normalize(this.velocity),p.ParticleUtils.scaleBy(this.velocity,o),i=this.velocity.x*e,n=this.velocity.y*e}else if(this._doAcceleration){var a=this.velocity.x,s=this.velocity.y;if(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed){var l=p.ParticleUtils.length(this.velocity);l>this.maxSpeed&&p.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/l)}i=(a+this.velocity.x)/2*e,n=(s+this.velocity.y)/2*e}else i=this.velocity.x*e,n=this.velocity.y*e;this.position.x+=i,this.position.y+=n}if(this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration){var u=this.rotationSpeed+this.rotationAcceleration*e;this.rotation+=(this.rotationSpeed+u)/2*e,this.rotationSpeed=u}else 0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x));return t},i.prototype.kill=function(){this.emitter.recycle(this)},i.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},i.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(p.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles)this._spawnTimer+=this._frequency;else{var l=void 0;if(l=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var p=void 0;if(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,u,h,t),p.init(),p.update(-this._spawnTimer),p.parent){var d=this._parent.children;if(d[0]==p)d.shift();else if(d[d.length-1]==p)d.pop();else{var m=d.indexOf(p);d.splice(m,1)}this.addAtBack?d.unshift(p):d.push(p)}else 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}}this._spawnTimer+=this._frequency}}if(this._posChanged&&(this._prevEmitterPos.x=a,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){var g=this._completeCallback;this._completeCallback=null,g()}this._destroyWhenComplete&&this.destroy()}}},e.prototype.applyAdditionalProperties=function(e){},e.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},e.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,b.x=Math.random()*this.spawnRect.width+this.spawnRect.x,b.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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,b.x=Math.random()*this.spawnCircle.radius,b.y=0,p.ParticleUtils.rotatePoint(360*Math.random(),b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnRing=function(e,t,r){var i=this.spawnCircle;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?b.x=Math.random()*(i.radius-i.minRadius)+i.minRadius:b.x=i.radius,b.y=0;var n=360*Math.random();e.rotation+=n,p.ParticleUtils.rotatePoint(n,b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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(b),0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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},e.prototype.cleanup=function(){var e,t;for(e=this._activeParticlesFirst;e;e=t)t=e.next,this.recycle(e),e.parent&&e.parent.removeChild(e);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},e.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},e}(),w=new v.Point,T=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],k=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(T).join("|"),"g"),S=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new v.Point,t.movement=0,t}return n(e,r),e.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},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,w.x=this.movement,w.y=this.path(this.movement),p.ParticleUtils.rotatePoint(this.initialRotation,w),this.position.x=this.initialPosition.x+w.x,this.position.y=this.initialPosition.y+w.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return g.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(k),r=t.length-1;0<=r;--r)0<=T.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){p.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else p.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(g),P=function(r){function e(e){var t=r.call(this,e)||this;return t.textures=null,t.duration=0,t.framerate=0,t.elapsed=0,t.loop=!1,t}return n(e,r),e.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},e.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t){this.elapsed+=e,this.elapsed>this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||v.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,i,n,o,a=[],s=0;st[s]&&(i=t[s]),ot[s+1]&&(n=t[s+1]),af[u]){l=c[s];c[s]=c[u],c[u]=l;var h=f[s];f[s]=f[u],f[u]=h}if(t[0]=c[0].x,t[1]=c[0].y,t[2]=c[1].x,t[3]=c[1].y,t[4]=c[2].x,t[5]=c[2].y,t[6]=c[3].x,t[7]=c[3].y,(c[3].x-c[2].x)*(c[1].y-c[2].y)-(c[1].x-c[2].x)*(c[3].y-c[2].y)<0)return t[4]=c[3].x,void(t[5]=c[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var k=new PIXI.Matrix,n=new PIXI.Rectangle,S=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.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},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,i=e.y,n=this.distortion.x,o=this.distortion.y;if(0==n)t.x=r,t.y=i/(1+o*r);else if(0==o)t.y=i,t.x=r/(1+n*i);else{var a=.5*(i*n-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * vSamplerSize;\n \n// if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n// pixels.y < vFrame.y || pixels.y > vFrame.w) {\n// discard;\n// }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n//gl_FragColor = color * rColor;\n}",geometryClass:s,vertexSize:16},e),i=t.vertex,n=t.fragment,o=t.vertexSize,a=t.geometryClass;return function(r){function e(e){var t=r.call(this,e)||this;return t.defUniforms={translationMatrix:new PIXI.Matrix,distortion:new Float32Array([0,0])},t.size=1e3,t.forceMaxTextures=1,t.shaderGenerator=new PIXI.BatchShaderGenerator(i,n),t.geometryClass=a,t.vertexSize=o,t}return __extends(e,r),e.prototype.getUniforms=function(e){var t=e.proj;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.packInterleavedGeometry=function(e,t,r,i,n){for(var o=t.uint32View,a=t.float32View,s=i/this.vertexSize,l=e.indices,u=e.vertexData,h=e._texture._frame,c=e.aTrans,f=e._texture.baseTexture,p=f._batchLocation,d=f.realWidth,m=f.realHeight,g=f.resolution,v=Math.min(e.worldAlpha,1),_=v<1&&e._texture.baseTexture.alphaMode?b(e._tintRGB,v):e._tintRGB+(255*v<<24),y=0;y=o.TRANSFORM_STEP.PROJ?(i||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(e,r):this.proj.world.applyInverse(e,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copyFrom(e),n===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var l,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=l=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT",t[t.AXIS_XR=5]="AXIS_XR";var i=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,i,n,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=i,a[5]=0,a[6]=n,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,i=this.mat3;return e?(r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7]):(r[0]=i[0],r[1]=i[3],r[2]=i[6],r[3]=i[1],r[4]=i[4],r[5]=i[7],r[6]=i[2],r[7]=i[5]),r[8]=i[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,i=e.x,n=e.y,o=1/(r[2]*i+r[5]*n+r[8]);return t.x=o*(r[0]*i+r[3]*n+r[6]),t.y=o*(r[1]*i+r[4]*n+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,i){var n=this.mat3;n[0]=e*n[0]+r*n[2],n[1]=t*n[1]+i*n[2],n[3]=e*n[3]+r*n[5],n[4]=t*n[4]+i*n[5],n[6]=e*n[6]+r*n[8],n[7]=t*n[7]+i*n[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,i=e.x,n=e.y,o=r[0],a=r[3],s=r[6],l=r[1],u=r[4],h=r[7],c=r[2],f=r[5],p=r[8],d=(p*u-h*f)*i+(-p*a+s*f)*n+(h*a-s*u),m=(-p*l+h*c)*i+(p*o-s*c)*n+(-h*o+s*l),g=(f*l-u*c)*i+(-f*o+a*c)*n+(u*o-a*l);return t.x=d/g,t.y=m/g,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=u*o-a*l,c=-u*n+a*s,f=l*n-o*s,p=t*h+r*c+i*f;return p&&(p=1/p,e[0]=h*p,e[1]=(-u*r+i*l)*p,e[2]=(a*r-i*o)*p,e[3]=c*p,e[4]=(u*t-i*s)*p,e[5]=(-a*t+i*n)*p,e[6]=f*p,e[7]=(-l*t+r*s)*p,e[8]=(o*t-r*n)*p),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo2dOr3d=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copyTo=function(e,t,r){var i=this.mat3,n=1/i[8],o=i[6]*n,a=i[7]*n;if(e.a=(i[0]-i[2]*o)*n,e.b=(i[1]-i[2]*a)*n,e.c=(i[3]-i[5]*o)*n,e.d=(i[4]-i[5]*a)*n,e.tx=o,e.ty=a,2<=t){var s=e.a*e.d-e.b*e.c;r||(s=Math.abs(s)),t===l.POINT?(s=0>0,0!==f._cycle&&f._cycle===f._totalTime/a&&m<=e&&f._cycle--,f._time=f._totalTime-f._cycle*a,f._yoyo&&0!=(1&f._cycle)&&(f._time=v-f._time,(c=f._yoyoEase||f.vars.yoyoEase)&&(f._yoyoEase||(!0!==c||f._initted?f._yoyoEase=c=!0===c?f._ease:c instanceof Ease?c:Ease.map[c]:(c=f.vars.ease,f._yoyoEase=c=c?c instanceof Ease?c:"function"==typeof c?new Ease(c,f.vars.easeParams):Ease.map[c]||y.defaultEase:y.defaultEase)),f.ratio=c?1-c.getRatio((v-f._time)/v):0)),f._time>v?f._time=v:f._time<0&&(f._time=0)),f._easeType&&!c?(s=f._time/v,(1===(l=f._easeType)||3===l&&.5<=s)&&(s=1-s),3===l&&(s*=2),1===(u=f._easePower)?s*=s:2===u?s*=s*s:3===u?s*=s*s*s:4===u&&(s*=s*s*s*s),f.ratio=1===l?1-s:2===l?s:f._time/v<.5?s/2:1-s/2):c||(f.ratio=f._ease.getRatio(f._time/v))),d!==f._time||r||g!==f._cycle){if(!f._initted){if(f._init(),!f._initted||f._gc)return;if(!r&&f._firstPT&&(!1!==f.vars.lazy&&f._duration||f.vars.lazy&&!f._duration))return f._time=d,f._totalTime=m,f._rawPrevTime=_,f._cycle=g,x.lazyTweens.push(f),void(f._lazy=[e,t]);!f._time||i||c?i&&this._ease._calcEnd&&!c&&(f.ratio=f._ease.getRatio(0===f._time?0:1)):f.ratio=f._ease.getRatio(f._time/v)}for(!1!==f._lazy&&(f._lazy=!1),f._active||!f._paused&&f._time!==d&&0<=e&&(f._active=!0),0===m&&(2===f._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},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return 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)},r._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},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._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||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.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)},r._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},r.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)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._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)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.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},r.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)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}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}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.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)d(e[r],a,t);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=f.length,this._lengths=f.lengths,this._segments=f.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}if(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,f=this._segCount,p=this._func,d=this._target,m=e!==this._startRatio;if(this._timeRes){if(u=this._lengths,h=this._curSeg,c=e*this._length,i=this._li,c>this._l2&&i=c;);0===i&&cthis._s2&&i=c;);0===i&&c>0)*(1/f))*f;for(r=1-a,i=this._props.length;-1<--i;)n=this._props[i],s=(a*a*(o=this._beziers[n][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s;if(this._autoRotate){var g,v,_,y,b,x,w,T=this._autoRotate;for(i=T.length;-1<--i;)n=T[i][2],x=T[i][3]||0,w=!0===T[i][4]?1:k,o=this._beziers[T[i][0]],g=this._beziers[T[i][1]],o&&g&&(o=o[t],g=g[t],v=o.a+(o.b-o.a)*a,v+=((y=o.b+(o.c-o.b)*a)-v)*a,y+=(o.c+(o.d-o.c)*a-y)*a,_=g.a+(g.b-g.a)*a,_+=((b=g.b+(g.c-g.b)*a)-_)*a,b+=(g.c+(g.d-g.c)*a-b)*a,s=m?Math.atan2(b-_,y-v)*w+x:this._initialRotations[i],this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s)}}}),e=g.prototype,g.bezierThrough=p,g.cubicToQuadratic=S,g._autoCSS=!0,g.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},g._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,p=t._parseToProxy,d=t._setPluginRatio,m=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,i,n,o){t instanceof Array&&(t={values:t}),o=new g;var a,s,l,u=t.values,h=u.length-1,c=[],f={};if(h<0)return n;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];return 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),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(o,B){var d,k,S,m,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},u=_gsScope._gsDefine.globals,g={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.3",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var E,v,_,L,y,P,C,A,t,r,I=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,n=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi,h=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,M=/(?:\d|\-|\+|=|#|\.)*/g,D=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,l=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,c=function(e,t){return t.toUpperCase()},p=/(?:Left|Right|Width)/i,f=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,R=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,z=/,(?=[^\)]*(?:\(|$))/gi,F=/[\s,\(]/i,j=Math.PI/180,X=180/Math.PI,N={},i={style:{}},H=_gsScope.document||{createElement:function(){return i}},W=function(e,t){var r=H.createElementNS?H.createElementNS(t||"http://www.w3.org/1999/xhtml",e):H.createElement(e);return r.style?r:H.createElement(e)},q=W("div"),G=W("img"),V=U._internals={_specialProps:g},Y=(_gsScope.navigator||{}).userAgent||"",Z=(t=Y.indexOf("Android"),r=W("a"),_=-1!==Y.indexOf("Safari")&&-1===Y.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),me[e])r=me[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=f=e.match(I),t){if(-1!==e.indexOf("="))return e.match(O)}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)}},we=(V._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.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:l)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:l=o,o=u}this._firstPT=s}return!0},e.parse=function(e,t,r,i){var n,o,a,s,l,u,h,c,f,p,d=e.style;for(n in t){if(u=t[n],o=g[n],"function"!=typeof u||o&&o.allowFunc||(u=u(A,C)),o)r=o.parse(e,u,n,this,r,i,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",re(e).getPropertyValue(n)+"",u+"",n,!1,n);continue}l=ie(e,n,S)+"",f="string"==typeof u,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||f&&w.test(u)?(f||(u=(3<(u=ve(u)).length?"rgba(":"rgb(")+u.join(",")+")"),r=Se(d,n,l,u,!0,"transparent",r,0,i)):f&&F.test(u)?r=Se(d,n,l,u,!0,null,r,0,i):(h=(a=parseFloat(l))||0===a?l.substr((a+"").length):"",""!==l&&"auto"!==l||(h="width"===n||"height"===n?(a=he(e,n,S),"px"):"left"===n||"top"===n?(a=oe(e,n,S),"px"):(a="opacity"!==n?0:1,"")),""===(c=(p=f&&"="===u.charAt(1))?(s=parseInt(u.charAt(0)+"1",10),u=u.substr(2),s*=parseFloat(u),u.replace(M,"")):(s=parseFloat(u),f?u.replace(M,""):""))&&(c=n in k?k[n]:h),u=s||0===s?(p?s+a:s)+c:t[n],h!==c&&(""===c&&"lineHeight"!==n||(s||0===s)&&a&&(a=ne(e,n,a,h),"%"===c?(a/=ne(e,n,100,"%")/100,!0!==t.strictUnits&&(l=a+"%")):"em"===c||"rem"===c||"vw"===c||"vh"===c?a/=ne(e,n,1,c):"px"!==c&&(s=ne(e,n,s,c),c="px"),p&&(s||0===s)&&(u=s+a+c))),p&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==d[n]&&(u||u+""!="NaN"&&null!=u)?(r=new Te(d,n,s||a||0,0,r,-1,n,!1,0,l,u)).xs0="none"!==u||"display"!==n&&-1===n.indexOf("Style")?u:l:K("invalid "+n+" tween value: "+t[n]):(r=new Te(d,n,a,s-a,r,0,n,!1!==E&&("px"===c||"zIndex"===n),0,l,u)).xs0=c)}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},d.ease=new d(.7,.7),m.config=d.config=function(e,t,r){return new d(e,t,r)},(m=(r=l("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new g).constructor=r,m.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},m.config=r.config=function(e,t){return new r(e,t)},(m=(i=l("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 g).constructor=i,m.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},m.config=i.config=function(e,t,r){return new i(e,t,r)},(m=(t=l("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 g?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},m.config=function(e){return new t(e)},t.ease=new t,c("Bounce",u("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}),u("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)}),u("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})),c("Circ",u("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),u("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),u("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),c("Elastic",(e=function(e,t,r){var i=l("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),n=i.prototype=new g;return n.constructor=i,n.getRatio=t,n.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),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),c("Expo",u("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),u("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),u("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),c("Sine",u("SineOut",function(e){return Math.sin(e*s)}),u("SineIn",function(e){return 1-Math.cos(e*s)}),u("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),l("easing.EaseLookup",{find:function(e){return g.map[e]}},!0),h(n.SlowMo,"SlowMo","ease,"),h(t,"RoughEase","ease,"),h(r,"SteppedEase","ease,"),p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(f,p){"use strict";var d={},i=f.document,m=f.GreenSockGlobals=f.GreenSockGlobals||f,e=m[p];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,n,g,v,o,a,_=function(e){var t,r=e.split("."),i=m;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,r){if(v||g.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 v||g.wake(),this._totalTime};var z=k("TweenLite",function(e,t,r){if(M.call(this,t,r),this.render=z.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:z.selector(e)||e;var i,n,o,a=e.jquery||e.length&&e!==f&&e[0]&&(e[0]===f||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?J[z.defaultOverwrite]:"number"==typeof s?s>>0:J[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=l(e),this._propLookup=[],this._siblings=[],i=0;i=$){for(r in $=g.frame+(parseInt(z.autoSleep,10)||120),V){for(e=(t=V[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete V[r]}if((!(r=Q._first)||r._paused)&&z.autoSleep&&!K._first&&1===g._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||g.sleep()}}},g.addEventListener("tick",M._updateRoot);var te=function(e,t,r){var i,n,o=e._gsTweenID;if(V[o||(e._gsTweenID=o="t"+Y++)]||(V[o]={target:e,tweens:[]}),t&&((i=V[o].tweens)[n=i.length]=t,r))for(;-1<--n;)i[n]===t&&i.splice(n,1);return V[o].tweens},re=function(e,t,r,i){var n,o,a=e.vars.onOverwrite;return a&&(n=a(e,t,r,i)),(a=z.onOverwrite)&&(o=a(e,t,r,i)),!1!==n&&!1!==o},ie=function(e,t,r,i,n){var o,a,s,l;if(1===i||4<=i){for(l=n.length,o=0;oh&&((p||!s._initted)&&h-s._startTime<=2e-8||(c[f++]=s)));for(o=f;-1<--o;)if(l=(s=c[o])._firstPT,2===i&&s._kill(r,e,t)&&(a=!0),2!==i||!s._firstPT&&s._initted&&l){if(2!==i&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},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?y:(o+=e.totalDuration()/e._timeScale/n)>t+y?0:o-t-y};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=z.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},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.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=k("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,i),this._overwriteProps=n||[]},!0===e.global),s=a.prototype=new oe(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,oe.activate([a]),a},t=f._gsQueue){for(r=0;r>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}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}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.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},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return 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)},r._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},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._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||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.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)},r._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},r.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)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._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)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.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},r.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)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0+~]|"+F+")"+F+"*"),W=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),q=new RegExp(N),G=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+z+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/[+~]/,$=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig"),ee=function(e,t,r){var i="0x"+t-65536;return i!=i||r?t:i<0?String.fromCharCode(65536+i):String.fromCharCode(i>>10|55296,1023&i|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){w()},ne=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{M.apply(t=D.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){O.apply(e,D.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}function oe(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:_)!==T&&w(t),t=t||T,k)){if(11!==f&&(l=K.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))&&v(t,a)&&a.id===n)return r.push(a),r}else{if(l[2])return M.apply(r,t.getElementsByTagName(e)),r;if((n=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return M.apply(r,t.getElementsByClassName(n)),r}if(p.qsa&&!E[e+" "]&&(!g||!g.test(e))){if(1!==f)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=S),o=(u=d(e)).length;o--;)u[o]="#"+s+" "+ve(u[o]);h=u.join(","),c=Q.test(e)&&me(t.parentNode)||t}if(h)try{return M.apply(r,c.querySelectorAll(h)),r}catch(e){}finally{s===S&&t.removeAttribute("id")}}}return m(e.replace(U,"$1"),t,r,i)}function ae(){var i=[];return function e(t,r){return i.push(t+" ")>b.cacheLength&&delete e[i.shift()],e[t+" "]=r}}function se(e){return e[S]=!0,e}function le(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function he(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 ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function pe(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&&ne(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function de(a){return se(function(o){return o=+o,se(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=oe.support={},n=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,i=e?e.ownerDocument||e:_;return i!==T&&9===i.nodeType&&i.documentElement&&(a=(T=i).documentElement,k=!n(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ie,!1):r.attachEvent&&r.attachEvent("onunload",ie)),p.attributes=le(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=le(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=J.test(T.getElementsByClassName),p.getById=le(function(e){return a.appendChild(e).id=S,!T.getElementsByName||!T.getElementsByName(S).length}),p.getById?(b.filter.ID=function(e){var t=e.replace($,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace($,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){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&&k)return t.getElementsByClassName(e)},s=[],g=[],(p.qsa=J.test(T.querySelectorAll))&&(le(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+F+"*(?:value|"+z+")"),e.querySelectorAll("[id~="+S+"-]").length||g.push("~="),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||g.push(".#.+[+~]")}),le(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+F+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(p.matchesSelector=J.test(h=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&le(function(e){p.disconnectedMatch=h.call(e,"*"),h.call(e,"[s!='']:x"),s.push("!=",N)}),g=g.length&&new RegExp(g.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(a.compareDocumentPosition),v=t||J.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},C=t?function(e,t){if(e===t)return u=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:l?R(l,e)-R(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===T?-1:t===T?1:n?-1:o?1:l?R(l,e)-R(l,t):0;if(n===o)return he(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?he(a[i],s[i]):a[i]===_?-1:s[i]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(W,"='$1']"),p.matchesSelector&&k&&!E[t+" "]&&(!s||!s.test(t))&&(!g||!g.test(t)))try{var r=h.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($,ee),e[3]=(e[3]||e[4]||e[5]||"").replace($,ee),"~="===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]||oe.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]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&q.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($,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=f[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&f(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,i,n){return function(e){var t=oe.attr(e,r);return null==t?"!="===i:!i||(t+="","="===i?t===n:"!="===i?t!==n:"^="===i?n&&0===t.indexOf(n):"*="===i?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function A(e,r,i){return _(r)?S.grep(e,function(e,t){return!!r.call(e,t,e)!==i}):r.nodeType?S.grep(e,function(e){return e===r!==i}):"string"!=typeof r?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,r){var i,n;if(!e)return this;if(r=r||I,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(S):S.makeArray(e,this);if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!i[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:k,!0)),C.test(i[1])&&S.isPlainObject(t))for(i in t)_(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(n=k.getElementById(i[2]))&&(this[0]=n,this.length=1),this}).prototype=S.fn,I=S(k);var M=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};function R(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ce={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function fe(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?S.merge([e],r):r}function pe(e,t){for(var r=0,i=e.length;rx",v.noCloneChecked=!!de.cloneNode(!0).lastChild.defaultValue;var _e=k.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function ke(){try{return k.activeElement}catch(e){}}function Se(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)Se(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=Te;else if(!n)return e;return 1===o&&(a=n,(n=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,n,i,r)})}S.event={global:{},add:function(t,e,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.get(t);if(g)for(r.handler&&(r=(o=r).handler,n=o.selector),n&&S.find.matchesSelector(_e,n),r.guid||(r.guid=S.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(z)||[""]).length;u--;)p=m=(s=xe.exec(e[u])||[])[1],d=(s[2]||"").split(".").sort(),p&&(c=S.event.special[p]||{},p=(n?c.delegateType:c.bindType)||p,c=S.event.special[p]||{},h=S.extend({type:p,origType:m,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&S.expr.match.needsContext.test(n),namespace:d.join(".")},o),(f=l[p])||((f=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(t,i,d,a)||t.addEventListener&&t.addEventListener(p,a)),c.add&&(c.add.call(t,h),h.handler.guid||(h.handler.guid=r.guid)),n?f.splice(f.delegateCount++,0,h):f.push(h),S.event.global[p]=!0)},remove:function(e,t,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(u=(t=(t||"").match(z)||[""]).length;u--;)if(p=m=(s=xe.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),p){for(c=S.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,g.handle)||S.removeEvent(e,p,g.handle),delete l[p])}else for(p in l)S.event.remove(e,p+t[u],r,i,!0);S.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,r,i,n,o,a,s=S.event.fix(e),l=new Array(arguments.length),u=(Z.get(this,"events")||{})[s.type]||[],h=S.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ee=/\s*$/g;function Ie(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var r,i,n,o,a,s,l,u;if(1===t.nodeType){if(Z.hasData(e)&&(o=Z.access(e),a=Z.set(t,o),u=o.events))for(n in delete a.handle,a.events={},u)for(r=0,i=u[n].length;r")},clone:function(e,t,r){var i,n,o,a,s,l,u,h=e.cloneNode(!0),c=S.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=fe(h),i=0,n=(o=fe(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)}),k.head.appendChild(i[0])},abort:function(){n&&n()}}});var Xt,Ht=[],Wt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Ht.pop()||S.expando+"_"+bt++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,r){var i,n,o,a=!1!==e.jsonp&&(Wt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Wt,"$1"+i):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||S.error(i+" was not called"),o[0]},e.dataTypes[0]="json",n=T[i],T[i]=function(){o=arguments},r.always(function(){void 0===n?S(T).removeProp(i):T[i]=n,e[i]&&(e.jsonpCallback=t.jsonpCallback,Ht.push(i)),o&&_(n)&&n(o[0]),o=n=void 0}),"script"}),v.createHTMLDocument=((Xt=k.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),S.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((i=(t=k.implementation.createHTMLDocument("")).createElement("base")).href=k.location.href,t.head.appendChild(i)):t=k),o=!r&&[],(n=C.exec(e))?[t.createElement(n[1])]:(n=ve([e],t,o),o&&o.length&&S(o).remove(),S.merge([],n.childNodes)));var i,n,o},S.fn.load=function(e,t,r){var i,n,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(i):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,r){var i,n,o,a,s,l,u=S.css(e,"position"),h=S(e),c={};"static"===u&&(e.style.position="relative"),s=h.offset(),o=S.css(e,"top"),l=S.css(e,"left"),n=("absolute"===u||"fixed"===u)&&-1<(o+l).indexOf("auto")?(a=(i=h.position()).top,i.left):(a=parseFloat(o)||0,parseFloat(l)||0),_(t)&&(t=t.call(e,r,S.extend({},s))),null!=t.top&&(c.top=t.top-s.top+a),null!=t.left&&(c.left=t.left-s.left+n),"using"in t?t.using.call(e,c):h.css(c)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,r,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),r=i.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"===S.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"===S.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((n=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),n.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-S.css(i,"marginTop",!0),left:t.left-n.left-S.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===S.css(e,"position");)e=e.offsetParent;return e||_e})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var o="pageYOffset"===n;S.fn[t]=function(e){return X(this,function(e,t,r){var i;if(y(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)}}),S.each(["top","left"],function(e,r){S.cssHooks[r]=Be(v.pixelPosition,function(e,t){if(t)return t=Ne(e,r),Fe.test(t)?S(e).position()[r]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(i,o){S.fn[o]=function(e,t){var r=arguments.length&&(i||"boolean"!=typeof e),n=i||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var i;return y(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?S.css(e,t,n):S.style(e,t,r,n)},s,r?e:void 0,r)}})}),S.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){S.fn[r]=function(e,t){return 0>>0,i=(r*=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),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var r=new o(e),i=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.alea=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],16:[function(e,t,r){!function(e,t,r){function o(e){var n=this,t="";n.next=function(){var e=n.b,t=n.c,r=n.d,i=n.a;return e=e<<25^e>>>7^t,t=t-r|0,r=r<<24^r>>>8^i,i=i-e|0,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};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.tychei=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],17:[function(e,t,r){!function(e,t,r){function o(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};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor128=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],18:[function(e,t,r){!function(e,t,r){function o(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^=t<<13,e^=e<<17,t^=t>>>15,e^=e>>>12,t=i[n]=t^e,o.i=n,t+(r^r>>>16)|0},function(e,t){var r,i,n,o,a,s=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(r=s[127&o]^=i+a)?n+1:0);for(128<=n&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;0>>15,r^=r>>>12,s[n]=i^r;e.w=a,e.X=s,e.i=n}(o,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.X&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor4096=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],19:[function(e,t,r){!function(e,t,r){function o(e){var n=this;n.next=function(){var e,t,r=n.x,i=n.i;return e=r[i],t=(e^=e>>>7)^e<<24,t^=(e=r[i+1&7])^e>>>10,t^=(e=r[i+3&7])^e>>>3,t^=(e=r[i+4&7])^e<<7,e=r[i+7&7],t^=(e^=e<<13)^e<<9,r[i]=t,n.i=i+1&7,t},function(e,t){var r,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.x&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorshift7=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],20:[function(e,t,r){!function(e,t,r){function o(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 a(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 i(e,t){var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorwow=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],21:[function(t,r,e){!function(s,l){var u,h=this,c=256,f=6,p="random",d=l.pow(c,f),m=l.pow(2,52),g=2*m,v=c-1;function e(e,t,r){var i=[],n=b(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,x(s)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(c):(e=new Uint8Array(c),(h.crypto||h.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=h.navigator,r=t&&t.plugins;return[+new Date,h,r,h.screen,x(s)]}}():e,3),i),o=new _(i),a=function(){for(var e=o.g(f),t=d,r=0;e>>=1;return(e+r)/t};return a.int32=function(){return 0|o.g(4)},a.quick=function(){return o.g(4)/4294967296},a.double=a,b(x(o.S),s),(t.pass||r||function(e,t,r,i){return i&&(i.S&&y(i,o),e.state=function(){return y(o,{})}),r?(l[p]=e,t):e})(a,n,"global"in t?t.global:this==l,t.state)}function _(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?c-r:r}function g(e){return e-c*Math.floor(e/c)}t.exports={UP:o,DOWN:a,LEFT:s,RIGHT:0,NORTH:l,SOUTH:u,WEST:h,EAST:0,PI_2:c,PI_QUARTER:f,PI_HALF:p,toDegrees:function(e){return e*i},toRadians:function(e){return e*n},isAngleBetween:function(e,t,r){if(((r-t)%c+c)%c>=Math.PI){var i=t;t=r,r=i}return t<=r?t<=e&&e<=r:t<=e||e<=r},differenceAnglesSign:d,differenceAngles:m,shortestAngle:function(e,t){return m(t,e)*d(t,e)+e},normalize:g,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=m(e,s),r=m(e,0),i=m(e,o),n=m(e,a);return t<=r&&t<=i&&t<=n?s:r<=i&&r<=n?0:i<=n?o:a},equals:function(e,t,r){return r?m(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 s.range(e,t)}var i=s.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){var a={h:s.range(e,t),s:s.range(r,i,!0),l:s.range(n,o,!0)};return this.hslToHex(a)},randomGoldenRatioHSL:function(e,t,r){for(var i=s.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}if(this.toY){var r=this.toY;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),r.time>=this.time?(this.parent.y=r.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(r.time,r.start,r.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(){if(!this.paused){var e=void 0,t=this.parent.plugins.decelerate;t&&(t.x||t.y)&&(t.x&&t.percentChangeX===t.friction||t.y&&t.percentChangeY===t.friction)&&(((e=this.parent.OOB()).left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.friction));var r=this.parent.plugins.drag||{},i=this.parent.plugins.pinch||{};if(t=t||{},!(r.active||i.active||this.toX&&this.toY||t.x&&t.y)){var n=(e=e||this.parent.OOB()).cornerPoint;if(!this.toX&&!t.x){var o=null;e.left&&this.left?o=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"}))}}}]),i}()},{"./plugin":9}],3:[function(e,t,r){"use strict";var n=function(){function i(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"})}}}}]),i}()},{"./plugin":9,"./utils":12}],4:[function(e,t,r){"use strict";var n=function(){function i(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){if(!this.paused){var 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}}]),i}()},{"./plugin":9,"./utils":12}],6:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.radius))return;var i=Math.atan2(this.target.y-e.y,this.target.x-e.x);t=this.target.x-Math.cos(i)*this.radius,r=this.target.y-Math.sin(i)*this.radius}if(this.speed){var n=t-e.x,o=r-e.y;if(n||o){var a=Math.atan2(r-e.y,t-e.x),s=Math.cos(a)*this.speed,l=Math.sin(a)*this.speed,u=Math.abs(s)>Math.abs(n)?t:e.x+s,h=Math.abs(l)>Math.abs(o)?r:e.y+l;this.parent.moveCenter(u,h),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else this.parent.moveCenter(t,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}}]),n}()},{"./plugin":9}],7:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.radiusSquared){var n=Math.atan2(i.y-r,i.x-t);this.linear?(this.horizontal=Math.round(Math.cos(n))*this.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(n))*this.speed*this.reverse*.06):(this.horizontal=Math.cos(n)*this.speed*this.reverse*.06,this.vertical=Math.sin(n)*this.speed*this.reverse*.06)}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else o.exists(this.left)&&tthis.right?this.horizontal=-1*this.reverse*this.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),o.exists(this.top)&&rthis.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(){if(!this.paused&&(this.horizontal||this.vertical)){var 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"})}}}]),i}()},{"./plugin":9,"./utils":12}],8:[function(e,t,r){"use strict";var n=function(){function i(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;else{var i=this.snapping;this.parent.scale.x=this.ease(i.time,i.startX,i.deltaX,this.time),this.parent.scale.y=this.ease(i.time,i.startY,i.deltaY,this.time)}var n=this.parent.plugins["clamp-zoom"];n&&n.clamp(),this.noMove||(this.center?this.parent.moveCenter(this.center):this.parent.moveCenter(t))}}else this.parent.scale.x===this.x_scale&&this.parent.scale.y===this.y_scale||this.createSnapping()}}},{key:"resume",value:function(){this.snapping=null,function e(t,r,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,r);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,i)}if("value"in n)return n.value;var a=n.get;return void 0!==a?a.call(i):void 0}(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(){function i(e,t){for(var r=0;rthis.time)r=!0,i=this.startX+this.deltaX,n=this.startY+this.deltaY;else{var o=this.ease(t.time,0,1,this.time);i=this.startX+this.deltaX*o,n=this.startY+this.deltaY*o}this.topLeft?this.parent.moveCorner(i,n):this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),r&&(this.removeOnComplete&&this.parent.removePlugin("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{var a=this.topLeft?this.parent.corner:this.parent.center;a.x===this.x&&a.y===this.y||this.snapStart()}}}]),o}()},{"./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(){function i(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}}if(this.clickedAvailable){var a=e.data.global.x-this.last.x,s=e.data.global.y-this.last.y;(this.checkThreshold(a)||this.checkThreshold(s))&&(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=this.trackedPointers;for(var r in t){var i=t[r];-1!==this.touches.indexOf(i.pointerId)&&e.push(i)}return e}},{key:"getPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t)e.push(t[r]);return e}},{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=g[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 o(this,e),this.pluginsSort(),this}},{key:"clamp",value:function(e){return this.plugins.clamp=new s(this,e),this.pluginsSort(),this}},{key:"decelerate",value:function(e){return this.plugins.decelerate=new u(this,e),this.pluginsSort(),this}},{key:"bounce",value:function(e){return this.plugins.bounce=new h(this,e),this.pluginsSort(),this}},{key:"pinch",value:function(e){return this.plugins.pinch=new a(this,e),this.pluginsSort(),this}},{key:"snap",value:function(e,t,r){return this.plugins.snap=new c(this,e,t,r),this.pluginsSort(),this}},{key:"follow",value:function(e,t){return this.plugins.follow=new p(this,e,t),this.pluginsSort(),this}},{key:"wheel",value:function(e){return this.plugins.wheel=new d(this,e),this.pluginsSort(),this}},{key:"clampZoom",value:function(e){return this.plugins["clamp-zoom"]=new l(this,e),this.pluginsSort(),this}},{key:"mouseEdges",value:function(e){return this.plugins["mouse-edges"]=new m(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._worldWidth:this.width},set:function(e){this._worldWidth=e,this.resizePlugins()}},{key:"worldHeight",get:function(){return this._worldHeight?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.extras.Viewport=v,t.exports=v},{"./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 n=function(){function i(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&&i@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);var n=[i.pop()];for(;1/g,"> ").trim()};var i,n=r(3),h=(i=n)&&i.__esModule?i:{default:i},c=r(0);function f(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(g(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[l];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,g(document.querySelectorAll(a),o)&&(i=e),"break"}},l=0,u=s.length;l/.test(i)){var h=i.replace(/>/,"");a=""+r+h+n;g(document.querySelectorAll(a),o)&&(i=h)}if(/:nth-child/.test(i)){var c=i.replace(/nth-child/g,"nth-of-type");a=""+r+c+n;g(document.querySelectorAll(a),o)&&(i=c)}if(/\.\S+\.\S+/.test(i)){for(var f=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var p=i.replace(f.shift(),"").trim();if(!(a=(""+r+p+n).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;g(document.querySelectorAll(a),o)&&(i=p)}if((f=i&&i.match(/\./g))&&2/.test(s):u=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");l=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=i.shift(),n=i.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,n,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===c||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 A(e,t){for(var r,i,n=t[0].toUpperCase()+t.slice(1),o=0;of(u.y)?u.x:u.y,t.scale=a?function(e,t){return ie(t[0],t[1],J)/ie(e[0],e[1],J)}(a.pointers,i):1,t.rotation=a?function(e,t){return ne(t[1],t[0],J)+ne(e[1],e[0],J)}(a.pointers,i):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,i,n,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=B&&(Lf(h.y)?h.x:h.y,o=re(l,u),e.lastInterval=t}else r=a.velocity,i=a.velocityX,n=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=i,t.velocityY=n,t.direction=o}(r,t);var h=e.element;T(t.srcEvent.target,h)&&(h=t.srcEvent.target);t.target=h}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function $(e){for(var t=[],r=0;r=f(t)?e<0?X:H:t<0?W:q}function ie(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return Math.sqrt(i*i+n*n)}function ne(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return 180*Math.atan2(n,i)/Math.PI}K.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:j,mousemove:2,mouseup:N},ae="mousedown",se="mousemove mouseup";function le(){this.evEl=ae,this.evWin=se,this.pressed=!1,K.apply(this,arguments)}v(le,K,{handler:function(e){var t=oe[e.type];t&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var ue={pointerdown:j,pointermove:2,pointerup:N,pointercancel:B,pointerout:B},he={2:z,3:"pen",4:F,5:"kinect"},ce="pointerdown",fe="pointermove pointerup pointercancel";function pe(){this.evEl=ce,this.evWin=fe,K.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ce="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),v(pe,K,{handler:function(e){var t=this.store,r=!1,i=e.type.toLowerCase().replace("ms",""),n=ue[i],o=he[e.pointerType]||e.pointerType,a=o==z,s=P(t,e.pointerId,"pointerId");n&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):n&(N|B)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var de={touchstart:j,touchmove:2,touchend:N,touchcancel:B};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,K.apply(this,arguments)}v(me,K,{handler:function(e){var t=de[e.type];if(t===j&&(this.started=!0),this.started){var r=function(e,t){var r=E(e.touches),i=E(e.changedTouches);t&(N|B)&&(r=C(r.concat(i),"identifier",!0));return[r,i]}.call(this,e,t);t&(N|B)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:z,srcEvent:e})}}});var ge={touchstart:j,touchmove:2,touchend:N,touchcancel:B},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},K.apply(this,arguments)}v(_e,K,{handler:function(e){var t=ge[e.type],r=function(e,t){var r=E(e.touches),i=this.targetIds;if(t&(2|j)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,a=E(e.changedTouches),s=[],l=this.target;if(o=r.filter(function(e){return T(e.target,l)}),t===j)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return Fe.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=Re(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(je,Fe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Ne,Me,{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&(N|B)&&!n)this.reset();else if(e.eventType&j)this.reset(),this._timer=u(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&N)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}}),v(Be,Fe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Fe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|V,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(G|V)?t=e.overallVelocity:r&G?t=e.overallVelocityX:r&V&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&f(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Re(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Me,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Se]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distance80*r){i=o=e[0],n=a=e[1];for(var d=r;do.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,h=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,c=W(s,l,t,r,i),f=W(u,h,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=c&&d&&d.z<=f;){if(p!==e.prev&&p!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=Y(p.prev,p,p.next))return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Y(d.prev,d,d.next))return!1;d=d.nextZ}for(;p&&p.z>=c;){if(p!==e.prev&&p!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=Y(p.prev,p,p.next))return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==e.prev&&d!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Y(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function B(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!Z(n,o)&&J(n,i,i.next,o)&&$(n,o)&&$(o,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(o.i/r),re(i),re(i.next),i=e=o),i=i.next}while(i!==e);return F(i)}function U(e,t,r,i,n,o){var a,s,l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&(s=u,(a=l).next.i!==s.i&&a.prev.i!==s.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&&J(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&($(a,s)&&$(s,a)&&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}(a,s)&&(Y(a.prev,a,s.prev)||Y(a,s.prev,s))||Z(a,s)&&0=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&&V(or.x||i.x===r.x&&(d=i,Y((p=r).prev,p,d.prev)<0&&Y(d.next,p,p.next)<0)))&&(r=i,f=l)),i=i.next,i!==u;);var p,d;return r}(e,t)){var r=ee(t,e);F(t,t.next),F(r,r.next)}}function W(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function q(e){for(var t=e,r=e;(t.x=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Q(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=_-y,k=Math.floor,S=String.fromCharCode;function P(e){throw RangeError(c[e])}function p(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function d(e,t){var r=e.split("@"),i="";return 1>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var i=0;for(e=r?k(e/s):e>>1,e+=k(e/t);f*b>>1k((v-d)/a))&&P("overflow"),d+=l*a,!(l<(u=s<=g?y:g+b<=s?b:s-g));s+=_)a>k(v/(h=_-u))&&P("overflow"),a*=h;g=I(d-o,t=f.length+1,0==o),k(d/t)>v-m&&P("overflow"),m+=k(d/t),d%=t,f.splice(d++,0,m)}return C(f)}function g(e){var t,r,i,n,o,a,s,l,u,h,c,f,p,d,m,g=[];for(f=(e=E(e)).length,t=w,o=x,a=r=0;ak((v-r)/(p=i+1))&&P("overflow"),r+=(s-t)*p,t=s,a=0;av&&P("overflow"),c==t){for(l=r,u=_;!(l<(h=u<=o?y:o+b<=u?b:u-o));u+=_)m=l-h,d=_-h,g.push(S(A(h+m%d,0))),l=k(m/d);g.push(S(A(l,0))),o=I(r,p,i==n),r=0,++i}++r,++t}return g.join("")}if(n={version:"1.3.2",ucs2:{decode:E,encode:C},decode:m,encode:g,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return d(e,function(e){return l.test(e)?m(e.slice(4).toLowerCase()):e})}},t&&r)if(O.exports==t)r.exports=n;else for(o in n)n.hasOwnProperty(o)&&(t[o]=n[o]);else e.punycode=n}(D)}),ae={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};ae.isString,ae.isObject,ae.isNull,ae.isNullOrUndefined;var se=function(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var s,l,u=e.length;0",'"',"`"," ","\r","\n","\t"]),xe=["'"].concat(be),we=["%","/","?",";","#"].concat(xe),Te=["/","?","#"],ke=/^[+a-z0-9A-Z_-]{0,63}$/,Se=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Pe={javascript:!0,"javascript:":!0},Ee={javascript:!0,"javascript:":!0},Ce={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ae(e,t,r){if(e&&ae.isObject(e)&&e instanceof ge)return e;var i=new ge;return i.parse(e,t,r),i}ge.prototype.parse=function(e,t,r){if(!ae.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=-1!==i&&i>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function Ke(e){var t=e.toString(16);return"#"+(t="000000".substr(0,6-t.length)+t)}function Qe(e){return"string"==typeof e&&"#"===e[0]&&(e=e.substr(1)),parseInt(e,16)}var $e=function(){for(var e=[],t=[],r=0;r<32;r++)t[e[r]=r]=r;e[G.BLEND_MODES.NORMAL_NPM]=G.BLEND_MODES.NORMAL,e[G.BLEND_MODES.ADD_NPM]=G.BLEND_MODES.ADD,e[G.BLEND_MODES.SCREEN_NPM]=G.BLEND_MODES.SCREEN,t[G.BLEND_MODES.NORMAL]=G.BLEND_MODES.NORMAL_NPM,t[G.BLEND_MODES.ADD]=G.BLEND_MODES.ADD_NPM,t[G.BLEND_MODES.SCREEN]=G.BLEND_MODES.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function et(e,t){return $e[t?1:0][e]}function tt(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 rt(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,i=e>>8&255,n=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((i=i*t+.5|0)<<8)+(n=n*t+.5|0)}function it(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 nt(e,t){void 0===t&&(t=null);var r=6*e;if((t=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|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function lt(e){return!(e&e-1||!e)}function ut(e){var t=(65535>>=t)?1:0)<<3;return t|=r,t|=r=(15<(e>>>=r)?1:0)<<2,(t|=r=(3<(e>>>=r)?1:0)<<1)|(e>>>=r)>>1}function ht(e,t,r){var i,n=e.length;if(!(n<=t||0===r)){var o=n-(r=n=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),i=t-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=e-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=t-(this.y+this.height-this.radius))*i<=n)return!0;if((r=e-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}();A.SORTABLE_CHILDREN=!1;var Vt=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null};Vt.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Vt.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Vt.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Xt.EMPTY:((e=e||new Xt(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},Vt.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)},Vt.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},Vt.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,n=e.maxXt.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,n=e.maxXr?this.maxX:r,this.minY=this.minYi?this.maxY:i};var Yt=function(e){function n(){e.call(this),this.tempDisplayObjectParent=null,this.transform=new Ut,this.alpha=1,this.visible=!0,this.renderable=!0,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Vt,this._boundsID=0,this._lastBoundsID=-1,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}e&&(n.__proto__=e);var t={_tempDisplayObjectParent:{configurable:!0},x:{configurable:!0},y:{configurable:!0},worldTransform:{configurable:!0},localTransform:{configurable:!0},position:{configurable:!0},scale:{configurable:!0},pivot:{configurable:!0},skew:{configurable:!0},rotation:{configurable:!0},angle:{configurable:!0},zIndex:{configurable:!0},worldVisible:{configurable:!0},mask:{configurable:!0}};return((n.prototype=Object.create(e&&e.prototype)).constructor=n).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},e.prototype.swapChildren=function(e,t){if(e!==t){var 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);ht(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},e.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},e.prototype.removeChild=function(e){var t=arguments,r=arguments.length;if(1 title : "+e.title+"
tabIndex: "+e.tabIndex},Qt.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},Qt.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,t.style.borderStyle="none",-1t.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},t.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(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.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}},t.prototype.update=function(e){var t;if(void 0===e&&(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(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Cr=function(h){function r(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){var r=document.createElement("video");r.setAttribute("preload","auto"),r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]),h.crossOrigin(r,e[0].src||e[0],t.crossorigin);for(var i=0;ithis.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",l="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+l+" "+s+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},e.rotate.get=function(){return this._rotate},e.rotate.set=function(e){this._rotate=e,this.valid&&this.updateUvs()},e.width.get=function(){return this.orig.width},e.height.get=function(){return this.orig.height},Object.defineProperties(s.prototype,e),s}(I);function Nr(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}jr.EMPTY=new jr(new Tr),Nr(jr.EMPTY),Nr(jr.EMPTY.baseTexture),jr.WHITE=function(){var e=document.createElement("canvas");e.width=16,e.height=16;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,16,16),new jr(new Tr(new Sr(e)))}(),Nr(jr.WHITE),Nr(jr.WHITE.baseTexture);var Br=function(s){function t(e,t){var r=null;if(!(e instanceof zr)){var i=arguments[1],n=arguments[2],o=arguments[3],a=arguments[4];console.warn("Please use RenderTexture.create("+i+", "+n+") instead of the ctor directly."),r=arguments[0],t=null,e=new zr({width:i,height:n,scaleMode:o,resolution:a})}s.call(this,e,t),this.legacyRenderer=r,this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.resize=function(e,t,r){void 0===r&&(r=!0),e=Math.ceil(e),t=Math.ceil(t),this.valid=0=G.ENV.WEBGL2&&(r=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(),r},e.prototype.getExtensions=function(){var e=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBKIT_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"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),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,{anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:e.getExtension("EXT_color_buffer_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear")})},e.prototype.handleContextLost=function(e){e.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.run(this.gl)},e.prototype.destroy=function(){var e=this.renderer.view;e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(e){e.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly")},Object.defineProperties(e.prototype,r),e}(Or),si=function(t){function e(e){t.call(this,e),this.managedFramebuffers=[],this.unknownFramebuffer=new Dr(10,10)}t&&(e.__proto__=t);var r={size:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Xt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;A.PREFER_ENV===G.ENV.WEBGL_LEGACY&&(r=t=null),t?e.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),r||(this.writeDepthTexture=!1)}},e.prototype.bind=function(e,t){var r=this.gl;if(e){var i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat!==e.dirtyFormat?(i.dirtyFormat=e.dirtyFormat,this.updateFramebuffer(e)):i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var n=0;n=i.data.byteLength)t.bufferSubData(o,0,i.data);else{var a=i.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,t.bufferData(o,i.data,a)}}}},e.prototype.checkCompatibility=function(e,t){var r=e.attributes,i=t.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},e.prototype.getSignature=function(e,t){var r=e.attributes,i=t.attributeData,n=["g",e.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},e.prototype.initGeometryVao=function(e,t){this.checkCompatibility(e,t);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(e,t),o=e.glVertexArrayObjects[this.CONTEXT_UID],a=o[n];if(a)return o[t.id]=a;var s=e.buffers,l=e.attributes,u={},h={};for(var c in s)u[c]=0,h[c]=0;for(var f in l)!l[f].size&&t.attributeData[f]?l[f].size=t.attributeData[f].size:l[f].size||console.warn("PIXI Geometry attribute '"+f+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[l[f].buffer]+=l[f].size*ui[l[f].type];for(var p in l){var d=l[p],m=d.size;void 0===d.stride&&(u[d.buffer]===m*ui[d.type]?d.stride=0:d.stride=u[d.buffer]),void 0===d.start&&(d.start=h[d.buffer],h[d.buffer]+=m*ui[d.type])}a=r.createVertexArray(),r.bindVertexArray(a);for(var g=0;g=G.ENV.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),_i=e}return _i}function bi(e,t,r){if("precision"===e.substring(0,9))return r!==G.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e;var i=t;return t===G.PRECISION.HIGH&&r!==G.PRECISION.HIGH&&(i=G.PRECISION.MEDIUM),"precision "+i+" float;\n"+e}var xi={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};var wi=null,Ti={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray"};function ki(e,t){if(!wi){var r=Object.keys(Ti);wi={};for(var i=0;it.name?1:-1});for(var h=0;h>=1,r++;this.stateId=e.data}for(var i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},e.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,a=0;athis.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)},g.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=g._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++Tr._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>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(var a=0;a=a.length&&a.push(this._generateOneMoreBuffer(e));var d=a[f];d.uploadDynamic(t,c,p);var m=e._bufferUpdateIDs[f]||0;(h=h||d._updateIDthis.maxSegments&&(r=this.maxSegments),r}},so=function(){this.reset()};so.prototype.clone=function(){var e=new so;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},so.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=jr.WHITE,this.matrix=null,this.visible=!1},so.prototype.destroy=function(){this.texture=null,this.matrix=null};var lo={build:function(e){e.points=e.shape.points.slice()},triangulate:function(e,t){var r=e.points,i=e.holes,n=t.points,o=t.indices;if(6<=r.length){for(var a=[],s=0;s>16)+(65280&t)+((255&t)<<16),r);0>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&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;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=i&&Do.x=n&&Do.y>16)+(65280&e)+((255&e)<<16)},e.texture.get=function(){return this._texture},e.texture.set=function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||jr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},Object.defineProperties(i.prototype,e),i}(Jt),Fo={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},Lo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Fo.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},jo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],No=function(e){this.styleID=0,this.reset(),Ho(this,e,e)},Bo={align:{configurable:!0},breakWords:{configurable:!0},dropShadow:{configurable:!0},dropShadowAlpha:{configurable:!0},dropShadowAngle:{configurable:!0},dropShadowBlur:{configurable:!0},dropShadowColor:{configurable:!0},dropShadowDistance:{configurable:!0},fill:{configurable:!0},fillGradientType:{configurable:!0},fillGradientStops:{configurable:!0},fontFamily:{configurable:!0},fontSize:{configurable:!0},fontStyle:{configurable:!0},fontVariant:{configurable:!0},fontWeight:{configurable:!0},letterSpacing:{configurable:!0},lineHeight:{configurable:!0},leading:{configurable:!0},lineJoin:{configurable:!0},miterLimit:{configurable:!0},padding:{configurable:!0},stroke:{configurable:!0},strokeThickness:{configurable:!0},textBaseline:{configurable:!0},trim:{configurable:!0},whiteSpace:{configurable:!0},wordWrap:{configurable:!0},wordWrapWidth:{configurable:!0}};function Uo(e){return"number"==typeof e?Ke(e):("string"==typeof e&&0===e.indexOf("0x")&&(e=e.replace("0x","#")),e)}function Xo(e){if(Array.isArray(e)){for(var t=0;t=i&&ca.x=n&&ca.ys&&(ht(i,1+f-++d,1+g-f),g=f,f=-1,n.push(p),h=Math.max(h,p),c++,r.x=0,r.y+=e.lineHeight,l=null))}else n.push(u),h=Math.max(h,u),++c,++d,r.x=0,r.y+=e.lineHeight,l=null}var b=o.charAt(o.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(u=p),n.push(u),h=Math.max(h,u));for(var x=[],w=0;w<=c;w++){var T=0;"right"===this._font.align?T=h-n[w]:"center"===this._font.align&&(T=(h-n[w])/2),x.push(T)}for(var k=i.length,S=this.tint,P=0;P 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",e),this.alpha=1}t&&(e.__proto__=t);var r={matrix:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._loadMatrix=function(e,t){void 0===t&&(t=!1);var r=e;t&&(this._multiply(r,this.uniforms.m,e),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(e,t,r){return e[0]=t[0]*r[0]+t[1]*r[5]+t[2]*r[10]+t[3]*r[15],e[1]=t[0]*r[1]+t[1]*r[6]+t[2]*r[11]+t[3]*r[16],e[2]=t[0]*r[2]+t[1]*r[7]+t[2]*r[12]+t[3]*r[17],e[3]=t[0]*r[3]+t[1]*r[8]+t[2]*r[13]+t[3]*r[18],e[4]=t[0]*r[4]+t[1]*r[9]+t[2]*r[14]+t[3]*r[19]+t[4],e[5]=t[5]*r[0]+t[6]*r[5]+t[7]*r[10]+t[8]*r[15],e[6]=t[5]*r[1]+t[6]*r[6]+t[7]*r[11]+t[8]*r[16],e[7]=t[5]*r[2]+t[6]*r[7]+t[7]*r[12]+t[8]*r[17],e[8]=t[5]*r[3]+t[6]*r[8]+t[7]*r[13]+t[8]*r[18],e[9]=t[5]*r[4]+t[6]*r[9]+t[7]*r[14]+t[8]*r[19]+t[9],e[10]=t[10]*r[0]+t[11]*r[5]+t[12]*r[10]+t[13]*r[15],e[11]=t[10]*r[1]+t[11]*r[6]+t[12]*r[11]+t[13]*r[16],e[12]=t[10]*r[2]+t[11]*r[7]+t[12]*r[12]+t[13]*r[17],e[13]=t[10]*r[3]+t[11]*r[8]+t[12]*r[13]+t[13]*r[18],e[14]=t[10]*r[4]+t[11]*r[9]+t[12]*r[14]+t[13]*r[19]+t[14],e[15]=t[15]*r[0]+t[16]*r[5]+t[17]*r[10]+t[18]*r[15],e[16]=t[15]*r[1]+t[16]*r[6]+t[17]*r[11]+t[18]*r[16],e[17]=t[15]*r[2]+t[16]*r[7]+t[17]*r[12]+t[18]*r[17],e[18]=t[15]*r[3]+t[16]*r[8]+t[17]*r[13]+t[18]*r[18],e[19]=t[15]*r[4]+t[16]*r[9]+t[17]*r[14]+t[18]*r[19]+t[19],e},e.prototype._colorMatrix=function(e){var t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t},e.prototype.brightness=function(e,t){var r=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.greyscale=function(e,t){var r=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(r,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),i=Math.sin(e),n=(0,Math.sqrt)(1/3),o=[r+1/3*(1-r),1/3*(1-r)-n*i,1/3*(1-r)+n*i,0,0,1/3*(1-r)+n*i,r+1/3*(1-r),1/3*(1-r)-n*i,0,0,1/3*(1-r)-n*i,1/3*(1-r)+n*i,r+1/3*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,t)},e.prototype.contrast=function(e,t){var r=(e||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,t)},e.prototype.saturate=function(e,t){void 0===e&&(e=0);var r=2*e/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,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,s=(255&r)/255,l=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,h=(255&i)/255,c=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,l,u,h,t=t||.15,0,o-l,a-u,s-h,0,0];this._loadMatrix(c,n)},e.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.predator=function(e,t){var r=[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];this._loadMatrix(r,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)},r.matrix.get=function(){return this.uniforms.m},r.matrix.set=function(e){this.uniforms.m=e},r.alpha.get=function(){return this.uniforms.uAlpha},r.alpha.set=function(e){this.uniforms.uAlpha=e},Object.defineProperties(e.prototype,r),e}(Ni);ka.prototype.grayscale=ka.prototype.greyscale;var Sa=function(i){function e(e,t){var r=new Mt;e.renderable=!1,i.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,this.maskMatrix=r,null==t&&(t=20),this.scale=new Et(t,t)}i&&(e.__proto__=i);var t={map:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).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.transform.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)},t.map.get=function(){return this.uniforms.mapSampler},t.map.set=function(e){this.uniforms.mapSampler=e},Object.defineProperties(e.prototype,t),e}(Ni),Pa=function(e){function t(){e.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 inputPixel;\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, inputPixel.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 inputPixel;\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, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(Ni),Ea=function(r){function e(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random()),r.call(this,fn,"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.noise=e,this.seed=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={noise:{configurable:!0},seed:{configurable:!0}};return t.noise.get=function(){return this.uniforms.uNoise},t.noise.set=function(e){this.uniforms.uNoise=e},t.seed.get=function(){return this.uniforms.uSeed},t.seed.set=function(e){this.uniforms.uSeed=e},Object.defineProperties(e.prototype,t),e}(Ni),Ca=new Mt;Yt.prototype._cacheAsBitmap=!1,Yt.prototype._cacheData=!1;var Aa=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalHitTest=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.sprite=null};Object.defineProperties(Yt.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new Aa),(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))}}}),Yt.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))},Yt.prototype._initCachedDisplayObject=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.alpha;this.alpha=1,e.batch.flush();var r=this.getLocalBounds().clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(A.RESOLUTION);var n=e.renderTexture.current,o=e.renderTexture.sourceFrame,a=e.projection.transform,s=Br.create(r.width,r.height),l="cacheAsBitmap_"+pt();this._cacheData.textureCacheId=l,Tr.addToCache(s.baseTexture,l),jr.addToCache(s,l);var u=Ca;u.tx=-r.x,u.ty=-r.y,this.transform.worldTransform.identity(),this.render=this._cacheData.originalRender,e.render(this,s,!0,u,!0),e.projection.transform=a,e.renderTexture.bind(n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var h=new zo(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-r.x/r.width,h.anchor.y=-r.y/r.height,h.alpha=t,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},Yt.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))},Yt.prototype._initCachedDisplayObjectCanvas=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.getLocalBounds(),r=this.alpha;this.alpha=1;var i=e.context;t.ceil(A.RESOLUTION);var n=Br.create(t.width,t.height),o="cacheAsBitmap_"+pt();this._cacheData.textureCacheId=o,Tr.addToCache(n.baseTexture,o),jr.addToCache(n,o);var a=Ca;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=t.x,a.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,n,!0,a,!1),e.context=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var s=new zo(n);s.transform.worldTransform=this.transform.worldTransform,s.anchor.x=-t.x/t.width,s.anchor.y=-t.y/t.height,s.alpha=r,s._bounds=this._bounds,this._cacheData.sprite=s,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=s.containsPoint.bind(s)}},Yt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._lastBoundsID=this._boundsID},Yt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds()},Yt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Tr.removeFromCache(this._cacheData.textureCacheId),jr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Yt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},Yt.prototype.name=null,Jt.prototype.getChildByName=function(e){for(var t=0;t>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},t.tint.get=function(){return this._tint},e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;it(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},Object.defineProperties(e.prototype,t),e}(zi),Fa=function(a){function e(e,t,r){a.call(this);var i=new Wr(e),n=new Wr(t,!0),o=new Wr(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,G.TYPES.FLOAT).addAttribute("aTextureCoord",n,2,!1,G.TYPES.FLOAT).addIndex(o),this._updateId=-1}a&&(e.__proto__=a),(e.prototype=Object.create(a&&a.prototype)).constructor=e;var t={vertexDirtyId:{configurable:!0}};return t.vertexDirtyId.get=function(){return this.buffers[0]._updateID},Object.defineProperties(e.prototype,t),e}(Jr),La=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=100),void 0===r&&(r=10),void 0===i&&(i=10),n.call(this),this.segWidth=r,this.segHeight=i,this.width=e,this.height=t,this.build()}return n&&(e.__proto__=n),((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.build=function(){for(var e=this.segWidth*this.segHeight,t=[],r=[],i=[],n=this.segWidth-1,o=this.segHeight-1,a=this.width/n,s=this.height/o,l=0;le?1:this._width/e,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(t,i)},t.width.get=function(){return this._width},t.width.set=function(e){this._width=e,this._refresh()},t.height.get=function(){return this._height},t.height.set=function(e){this._height=e,this._refresh()},t.leftWidth.get=function(){return this._leftWidth},t.leftWidth.set=function(e){this._leftWidth=e,this._refresh()},t.rightWidth.get=function(){return this._rightWidth},t.rightWidth.set=function(e){this._rightWidth=e,this._refresh()},t.topHeight.get=function(){return this._topHeight},t.topHeight.set=function(e){this._topHeight=e,this._refresh()},t.bottomHeight.get=function(){return this._bottomHeight},t.bottomHeight.set=function(e){this._bottomHeight=e,this._refresh()},e.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var r=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]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*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()},Object.defineProperties(e.prototype,t),e}(Ba),Ha=function(r){function i(e,t){r.call(this,e[0]instanceof jr?e[0]:e[0].texture),this._textures=null,this._durations=null,this.textures=e,this._autoUpdate=!1!==t,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this.playing=!1}r&&(i.__proto__=r);var e={totalFrames:{configurable:!0},textures:{configurable:!0},currentFrame:{configurable:!0}};return((i.prototype=Object.create(r&&r.prototype)).constructor=i).prototype.stop=function(){this.playing&&(this.playing=!1,this._autoUpdate&&rr.shared.remove(this.update,this))},i.prototype.play=function(){this.playing||(this.playing=!0,this._autoUpdate&&rr.shared.add(this.update,this,G.UPDATE_PRIORITY.HIGH))},i.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},i.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},i.prototype.update=function(e){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._currentTime=0,this.stop(),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this._currentTime=this._textures.length-1,this.stop(),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0r&&this.onLoop()),this.updateTexture())},i.prototype.updateTexture=function(){this._texture=this._textures[this.currentFrame],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)},i.prototype.destroy=function(e){this.stop(),r.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},i.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.splice||(i=Array.prototype.slice.call(i)),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};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!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(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="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,(oa=t,1<=+xa(oa)?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||"i8").charAt(t.length-1)&&(t="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;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,l,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(a,u?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===u)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;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(void 0===r&&(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(void 0===r&&(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(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var 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--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),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?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?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=0,o=0;oe.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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}},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 e;throw new L(J[e.code])}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 e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},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 e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},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){e||(e=this),this.parent=e,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?0:(-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:[]};var o=e.A(n);(o.A=n).root=o,i?Pb=o: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)throw new L(J.I);return i.k.T(i,e,t,r)}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 i=Bb(t),n=ac(r,i);if(n)throw new L(n);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,i,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var i,n,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(n=$b[r]))throw Error("Unknown file open mode: "+r)}else n=r;if(i=64&(r=n)?4095&(void 0===i?438:i)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(n=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,i,0),n=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!n&&(i=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(i=["r","w","rw"][3&r],512&r&&(i+="w"),Yb(o,i)):J.F))throw new L(i);if(512&r){var a;if(!(a="string"==typeof(i=o)?S(i,{la:!0}).g:i).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(i=Yb(a,"w"))throw new L(i);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in 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 o}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;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}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){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var 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"}return 0}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(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),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;cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var a=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;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var 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=r,o=i;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return 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 t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=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;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(n=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,i,n);default:x("bad ioctl syscall "+i)}}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){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(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};var Z=function(e,t,r){"use asm";var i=e.Int8Array;var n=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var l=e.Uint32Array;var u=e.Float32Array;var h=e.Float64Array;var pe=new i(r);var $=new n(r);var de=new o(r);var me=new a(r);var ge=new s(r);var c=new l(r);var f=new u(r);var ee=new h(r);var p=e.byteLength;var ve=t.STACKTOP|0;var d=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var m=t.ABORT|0;var g=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,k=0,S=0,P=0,E=0.0,C=0,A=0,I=0,O=0.0;var re=0;var M=0;var D=0;var R=0;var z=0;var F=0;var L=0;var j=0;var N=0;var B=0;var U=e.Math.floor;var X=e.Math.abs;var H=e.Math.sqrt;var W=e.Math.pow;var q=e.Math.cos;var G=e.Math.sin;var V=e.Math.tan;var Y=e.Math.acos;var Z=e.Math.asin;var J=e.Math.atan;var K=e.Math.atan2;var Q=e.Math.exp;var ie=e.Math.log;var ne=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var le=t.assert;var ue=t.invoke_iiii;var he=t.invoke_viiiii;var ce=t.invoke_vi;var fe=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var ke=t._pthread_cleanup_pop;var Se=t.___syscall54;var Pe=t.___syscall6;var Ee=t._emscripten_set_main_loop_timing;var Ce=t.__ZSt18uncaught_exceptionv;var Ae=t.___setErrNo;var Ie=t._sbrk;var Oe=t.___cxa_begin_catch;var Me=t._emscripten_memcpy_big;var De=t._sysconf;var Re=t._pthread_getspecific;var ze=t._pthread_self;var Fe=t._pthread_once;var Le=t._pthread_key_create;var je=t.___unlock;var Ne=t._emscripten_set_main_loop;var Be=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var He=t._pthread_cleanup_push;var We=t._time;var qe=t.___syscall140;var Ge=t.___syscall146;var Ve=0.0;function Ye(e){if(p(e)&16777215||p(e)<=16777215||p(e)>2147483648)return false;pe=new i(e);$=new n(e);de=new o(e);me=new a(e);ge=new s(e);c=new l(e);f=new u(e);ee=new h(e);r=e;return true}function Ze(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Je(){return ve|0}function Ke(e){e=e|0;ve=e}function Qe(e,t){e=e|0;t=t|0;ve=e;d=t}function $e(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(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 tt(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 rt(e){e=e|0;re=e}function it(){return re|0}function nt(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=ve;ve=ve+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;br(h,1100,o)|0;yr(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;br(h,1100,a)|0;yr(h,m+40|0)|0}a=de[d>>2]|0;if(a>>>0>=t>>>0){d=1;ve=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;br(h,1100,s)|0;yr(h,l)|0}r=_e(t,i)|0;do{if(!n){o=ot(de[e>>2]|0,r,p,1)|0;if(!o){d=0;ve=m;return d|0}else{de[e>>2]=o;break}}else{a=at(r,p)|0;if(!a){d=0;ve=m;return d|0}Ii[n&0](a,de[e>>2]|0,de[u>>2]|0);o=de[e>>2]|0;do{if(o)if(!(o&7)){Di[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;br(h,1100,c)|0;yr(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;ve=m;return d|0}function ot(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=ve;ve=ve+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;br(s,1100,n)|0;yr(s,u+16|0)|0;l=0;ve=u;return l|0}if(t>>>0>2147418112){de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1387;br(s,1100,o)|0;yr(s,u+40|0)|0;l=0;ve=u;return l|0}de[a>>2]=t;i=Di[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;ve=u;return l|0}de[l>>2]=1154;de[l+4>>2]=2551;de[l+8>>2]=1440;br(s,1100,l)|0;yr(s,u+64|0)|0;l=i;ve=u;return l|0}function at(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+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;br(o,1100,r)|0;yr(o,l+16|0)|0;s=0;ve=l;return s|0}de[n>>2]=i;r=Di[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;br(o,1100,s)|0;yr(o,l+40|0)|0;s=0;ve=l;return s|0}if(!(r&7)){s=r;ve=l;return s|0}de[a>>2]=1154;de[a+4>>2]=2526;de[a+8>>2]=1440;br(o,1100,a)|0;yr(o,l+64|0)|0;s=r;ve=l;return s|0}function st(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0;j=ve;ve=ve+960|0;z=j+232|0;R=j+216|0;D=j+208|0;M=j+192|0;O=j+184|0;I=j+168|0;A=j+160|0;C=j+144|0;S=j+136|0;k=j+120|0;T=j+112|0;w=j+96|0;y=j+88|0;_=j+72|0;v=j+64|0;g=j+48|0;c=j+40|0;p=j+24|0;f=j+16|0;h=j;E=j+440|0;F=j+376|0;L=j+304|0;m=j+236|0;if((t|0)==0|i>>>0>11){e=0;ve=j;return e|0}de[e>>2]=t;n=L;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){P=L+((n&255)<<2)|0;de[P>>2]=(de[P>>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[L+(u<<2)>>2]|0;if(!n)de[e+28+(u+-1<<2)>>2]=0;else{P=u+-1|0;de[F+(P<<2)>>2]=o;o=n+o|0;x=16-u|0;de[e+28+(P<<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){P=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;br(E,1100,h)|0;yr(E,f)|0}if(!(n&7)){Di[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;br(E,1100,p)|0;yr(E,c)|0;break}}}while(0);o=de[o>>2]|0;o=(o|0)!=0?o:1;n=at((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]=P;o=e+176|0;a=0;do{b=pe[r+a>>0]|0;n=b&255;if(b<<24>>24){if(!(de[L+(n<<2)>>2]|0)){de[g>>2]=1154;de[g+4>>2]=2273;de[g+8>>2]=1261;br(E,1100,g)|0;yr(E,v)|0}b=m+(n<<2)|0;n=de[b>>2]|0;de[b>>2]=n+1;if(n>>>0>=l>>>0){de[_>>2]=1154;de[_+4>>2]=2277;de[_+8>>2]=1274;br(E,1100,_)|0;yr(E,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;_=(y|0)!=0;if(_){v=1<>>0>(de[n>>2]|0)>>>0){de[n>>2]=v;a=e+168|0;n=de[a>>2]|0;do{if(n){g=de[n+-4>>2]|0;n=n+-8|0;if(!((g|0)!=0?(g|0)==(~de[n>>2]|0):0)){de[w>>2]=1154;de[w+4>>2]=644;de[w+8>>2]=1863;br(E,1100,w)|0;yr(E,T)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[k>>2]=1154;de[k+4>>2]=2499;de[k+8>>2]=1516;br(E,1100,k)|0;yr(E,S)|0;break}}}while(0);n=v<<2;o=at(n+8|0,0)|0;if(!o){de[a>>2]=0;n=0;break e}else{S=o+8|0;de[o+4>>2]=v;de[o>>2]=~v;de[a>>2]=S;o=S;break}}else{o=e+168|0;n=v<<2;a=o;o=de[o>>2]|0}}while(0);Yr(o|0,-1,n|0)|0;d=e+176|0;g=1;do{if(de[L+(g<<2)>>2]|0){t=y-g|0;m=1<>2]|0;if(o>>>0>=16){de[C>>2]=1154;de[C+4>>2]=1953;de[C+8>>2]=1737;br(E,1100,C)|0;yr(E,A)|0}n=de[e+28+(o<<2)>>2]|0;if(!n)p=-1;else p=(n+-1|0)>>>(16-g|0);if(s>>>0<=p>>>0){c=(de[e+96+(o<<2)>>2]|0)-s|0;f=g<<16;do{n=ge[(de[d>>2]|0)+(c+s<<1)>>1]|0;if((me[r+n>>0]|0|0)!=(g|0)){de[I>>2]=1154;de[I+4>>2]=2319;de[I+8>>2]=1303;br(E,1100,I)|0;yr(E,O)|0}h=s<>>0>=v>>>0){de[M>>2]=1154;de[M+4>>2]=2325;de[M+8>>2]=1337;br(E,1100,M)|0;yr(E,D)|0}n=de[a>>2]|0;if((de[n+(l<<2)>>2]|0)!=-1){de[R>>2]=1154;de[R+4>>2]=2327;de[R+8>>2]=1360;br(E,1100,R)|0;yr(E,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)}}g=g+1|0}while(y>>>0>=g>>>0);n=pe[x>>0]|0}o=e+96|0;de[o>>2]=(de[o>>2]|0)-(de[F>>2]|0);o=e+100|0;de[o>>2]=(de[o>>2]|0)-(de[F+4>>2]|0);o=e+104|0;de[o>>2]=(de[o>>2]|0)-(de[F+8>>2]|0);o=e+108|0;de[o>>2]=(de[o>>2]|0)-(de[F+12>>2]|0);o=e+112|0;de[o>>2]=(de[o>>2]|0)-(de[F+16>>2]|0);o=e+116|0;de[o>>2]=(de[o>>2]|0)-(de[F+20>>2]|0);o=e+120|0;de[o>>2]=(de[o>>2]|0)-(de[F+24>>2]|0);o=e+124|0;de[o>>2]=(de[o>>2]|0)-(de[F+28>>2]|0);o=e+128|0;de[o>>2]=(de[o>>2]|0)-(de[F+32>>2]|0);o=e+132|0;de[o>>2]=(de[o>>2]|0)-(de[F+36>>2]|0);o=e+136|0;de[o>>2]=(de[o>>2]|0)-(de[F+40>>2]|0);o=e+140|0;de[o>>2]=(de[o>>2]|0)-(de[F+44>>2]|0);o=e+144|0;de[o>>2]=(de[o>>2]|0)-(de[F+48>>2]|0);o=e+148|0;de[o>>2]=(de[o>>2]|0)-(de[F+52>>2]|0);o=e+152|0;de[o>>2]=(de[o>>2]|0)-(de[F+56>>2]|0);o=e+156|0;de[o>>2]=(de[o>>2]|0)-(de[F+60>>2]|0);o=e+16|0;de[o>>2]=0;a=e+20|0;de[a>>2]=n&255;t:do{if(_){while(1){if(!i)break t;n=i+-1|0;if(!(de[L+(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<=P>>>0){while(1){if(de[L+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>P>>>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;ve=j;return e|0}function lt(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=Br(t)|0;if(!r){r=n;return r|0}if(!n)o=0;else o=Hr(n)|0;de[r>>2]=o;r=n;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}de[r>>2]=0;r=0;return r|0}n=Xr(e,t)|0;o=(n|0)!=0;if(o|i^1)o=o?n:e;else{n=Xr(e,t)|0;o=(n|0)==0?e:n}if(!r){r=n;return r|0}t=Hr(o)|0;de[r>>2]=t;r=n;return r|0}function ut(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 ht(e){e=e|0;Oe(e|0)|0;Ut()}function ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0;o=ve;ve=ve+544|0;n=o;i=o+24|0;t=de[e+20>>2]|0;if(t)ft(t);t=e+4|0;r=de[t>>2]|0;if(!r){n=e+16|0;pe[n>>0]=0;ve=o;return}if(!(r&7))Di[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;br(i,1100,n)|0;yr(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;ve=o;return}function ft(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=ve;ve=ve+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){ve=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;br(a,1100,r)|0;yr(a,n)|0}if(!(t&7)){Di[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;br(a,1100,o)|0;yr(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;br(a,1100,s)|0;yr(a,l)|0}if(!(t&7)){Di[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;br(a,1100,u)|0;yr(a,h)|0;break}}}while(0);if(!(e&7)){Di[de[104>>2]&1](e,0,0,1,de[27]|0)|0;ve=p;return}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(a,1100,c)|0;yr(a,f)|0;ve=p;return}}function pt(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=ve;ve=ve+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;br(o,1100,t)|0;yr(o,h+16|0)|0}de[e>>2]=r;i=e+20|0;t=de[i>>2]|0;if(!t){t=at(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;br(o,1100,s)|0;yr(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=st(u,l,n,e)|0;ve=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=st(u,l,n,e)|0;ve=h;return u|0}function dt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0;z=ve;ve=ve+800|0;I=z+256|0;A=z+240|0;C=z+232|0;E=z+216|0;P=z+208|0;S=z+192|0;k=z+184|0;T=z+168|0;w=z+160|0;x=z+144|0;b=z+136|0;y=z+120|0;_=z+112|0;v=z+96|0;g=z+88|0;m=z+72|0;c=z+64|0;h=z+48|0;s=z+40|0;l=z+24|0;o=z+16|0;n=z;D=z+288|0;R=z+264|0;O=mt(e,14)|0;if(!O){de[t>>2]=0;r=t+4|0;i=de[r>>2]|0;if(i){if(!(i&7))Di[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;br(D,1100,n)|0;yr(D,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;ve=z;return t|0}ft(i);de[r>>2]=0;t=1;ve=z;return t|0}p=t+4|0;d=t+8|0;r=de[d>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((de[t+12>>2]|0)>>>0>>0){if(nt(p,O,(r+1|0)==(O|0),1,0)|0){r=de[d>>2]|0;break}pe[t+16>>0]=1;t=0;ve=z;return t|0}}while(0);Yr((de[p>>2]|0)+r|0,0,O-r|0)|0}de[d>>2]=O}Yr(de[p>>2]|0,0,O|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;br(D,1100,l)|0;yr(D,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;ve=z;return t|0}de[R+20>>2]=0;de[R>>2]=0;de[R+4>>2]=0;de[R+8>>2]=0;de[R+12>>2]=0;pe[R+16>>0]=0;r=R+4|0;i=R+8|0;e:do{if(nt(r,21,0,1,0)|0){s=de[i>>2]|0;l=de[r>>2]|0;Yr(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;br(D,1100,h)|0;yr(D,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(pt(R)|0){s=e+4|0;l=e+8|0;u=e+16|0;i=0;t:while(1){a=O-i|0;r=gt(e,R)|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;br(D,1100,m)|0;yr(D,g)|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[v>>2]=1154;de[v+4>>2]=3199;de[v+8>>2]=1650;br(D,1100,v)|0;yr(D,_)|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;br(D,1100,y)|0;yr(D,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;br(D,1100,x)|0;yr(D,w)|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[T>>2]=1154;de[T+4>>2]=3199;de[T+8>>2]=1650;br(D,1100,T)|0;yr(D,k)|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;br(D,1100,S)|0;yr(D,P)|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[E>>2]=1154;de[E+4>>2]=903;de[E+8>>2]=1781;br(D,1100,E)|0;yr(D,C)|0}pe[(de[p>>2]|0)+i>>0]=n;i=i+1|0}while((i|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)i=r;else break}if((M|0)==90){de[A>>2]=1154;de[A+4>>2]=3140;de[A+8>>2]=1632;br(D,1100,A)|0;yr(D,I)|0;r=0;break}if((O|0)==(r|0))r=pt(t)|0;else r=0}else r=0}else{pe[R+16>>0]=1;r=0}}while(0);ct(R);t=r;ve=z;return t|0}function mt(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=ve;ve=ve+544|0;s=h+16|0;a=h;o=h+24|0;if(!t){u=0;ve=h;return u|0}if(t>>>0<=16){u=vt(e,t)|0;ve=h;return u|0}l=vt(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;br(o,1100,a)|0;yr(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;ve=h;return u|0}function gt(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,g=0,v=0,_=0,y=0;y=ve;ve=ve+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;v=y+96|0;g=de[t+20>>2]|0;_=e+20|0;s=de[_>>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[_>>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[_>>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[g+16>>2]|0)>>>0){i=de[(de[g+168>>2]|0)+(o>>>(32-(de[g+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;br(v,1100,l)|0;yr(v,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;br(v,1100,p)|0;yr(v,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;br(v,1100,c)|0;yr(v,f)|0}}else{i=de[g+20>>2]|0;while(1){r=i+-1|0;if(n>>>0>(de[g+28+(r<<2)>>2]|0)>>>0)i=i+1|0;else break}r=(o>>>(32-i|0))+(de[g+96+(r<<2)>>2]|0)|0;if(r>>>0<(de[t>>2]|0)>>>0){r=ge[(de[g+176>>2]|0)+(r<<1)>>1]|0;break}de[d>>2]=1154;de[d+4>>2]=3266;de[d+8>>2]=1632;br(v,1100,d)|0;yr(v,m)|0;_=0;ve=y;return _|0}}while(0);de[a>>2]=de[a>>2]<>2]=(de[_>>2]|0)-i;_=r;ve=y;return _|0}function vt(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=ve;ve=ve+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;br(a,1100,r)|0;yr(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;ve=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;br(a,1100,l)|0;yr(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;ve=h;return l|0}function _t(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,g=0;d=ve;ve=ve+544|0;f=d+16|0;c=d;h=d+24|0;if((e|0)==0|t>>>0<62){p=0;ve=d;return p|0}u=at(300,0)|0;if(!u){p=0;ve=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;g=u+252|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+268|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+284|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+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(Et(u)|0){r=de[l>>2]|0;if((me[r+39>>0]|0)<<8|(me[r+40>>0]|0)){if(!(Ct(u)|0))break;if(!(At(u)|0))break;r=de[l>>2]|0}if(!((me[r+55>>0]|0)<<8|(me[r+56>>0]|0))){g=u;ve=d;return g|0}if(It(u)|0?Ot(u)|0:0){g=u;ve=d;return g|0}}}else p=7}while(0);if((p|0)==7)de[l>>2]=0;Ft(u);if(!(u&7)){Di[de[104>>2]&1](u,0,0,1,de[27]|0)|0;g=0;ve=d;return g|0}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;g=0;ve=d;return g|0}return 0}function yt(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=ve;ve=ve+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=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}de[u>>2]=1154;de[u+4>>2]=3704;de[u+8>>2]=1792;br(l,1100,u)|0;yr(l,h+16|0)|0;l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}function bt(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=_e(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((_e(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:{Mt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Dt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 9:{Rt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 8:case 7:{zt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+12>>2]|0}function kt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+32>>2]|0}function St(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=ve;ve=ve+576|0;a=l+56|0;o=l+40|0;n=l+64|0;u=l;de[u>>2]=40;ut(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;br(n,1100,o)|0;yr(n,a)|0;e=0}u=_e(_e(t,i)|0,e)|0;ve=l;return u|0}function Pt(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=ve;ve=ve+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;ut(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;br(h,1100,a)|0;yr(h,s)|0;o=0}s=_e(o,l)|0;a=_t(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)yt(a,c,i,s,n)|0;if(o){ve=d;return}if((de[a>>2]|0)!=519686845){ve=d;return}Ft(a);if(!(a&7)){Di[de[104>>2]&1](a,0,0,1,de[27]|0)|0;ve=d;return}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(h,1100,p)|0;yr(h,f)|0;ve=d;return}}function Et(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(!(dt(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(!(dt(a,e+140|0)|0)){e=0;return e|0}if(dt(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(!(dt(a,e+164|0)|0)){e=0;return e|0}if(!(dt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function Ct(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=ve;ve=ve+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(nt(h,f,(r+1|0)==(f|0),4,0)|0){t=de[o>>2]|0;break}pe[e+248>>0]=1;p=0;ve=d;return p|0}else t=r}while(0);Yr((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;ve=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(dt(u,p)|0?(c=p+24|0,dt(u,c)|0):0){if(!(de[o>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(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=(gt(u,p)|0)+i&31;n=(gt(u,c)|0)+n&63;o=(gt(u,p)|0)+o&31;t=(gt(u,p)|0)+t|0;a=(gt(u,c)|0)+a&63;e=(gt(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;ct(p+24|0);ct(p);p=t;ve=d;return p|0}function At(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+1024|0;s=S+16|0;a=S;o=S+504|0;k=S+480|0;w=S+284|0;T=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){k=0;ve=S;return k|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[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-3;n=-3;while(1){de[w+(r<<2)>>2]=i;de[T+(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));_=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(nt(_,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);Yr((de[_>>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;br(o,1100,a)|0;yr(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;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<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[g>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function It(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=ve;ve=ve+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;ve=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(dt(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(nt(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);Yr((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;br(a,1100,s)|0;yr(a,l)|0;t=1;break}r=0;i=0;n=0;t=de[o>>2]|0;while(1){l=gt(u,c)|0;r=l+r&255;i=(gt(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);ct(c);c=t;ve=f;return c|0}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,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+2432|0;s=S+16|0;a=S;o=S+1912|0;k=S+1888|0;w=S+988|0;T=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){k=0;ve=S;return k|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[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-7;n=-7;while(1){de[w+(r<<2)>>2]=i;de[T+(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));_=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(nt(_,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);Yr((de[_>>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;br(o,1100,a)|0;yr(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;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=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|P<<15;E=me[1729+(de[c>>2]|0)>>0]|0;$[r+2>>1]=(me[1729+(de[s>>2]|0)>>0]|0)<<2|P>>>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|E<<14;$[r+4>>1]=(me[1729+(de[f>>2]|0)>>0]|0)<<1|E>>>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[g>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function Mt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;he=ve;ve=ve+720|0;ue=he+184|0;se=he+168|0;ae=he+160|0;oe=he+144|0;ne=he+136|0;ie=he+120|0;re=he+112|0;ee=he+96|0;$=he+88|0;Q=he+72|0;K=he+64|0;J=he+48|0;Z=he+40|0;le=he+24|0;te=he+16|0;Y=he;G=he+208|0;V=he+192|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;W=de[H>>2]|0;r=pe[(de[e+88>>2]|0)+17>>0]|0;q=i>>>2;if(!(r<<24>>24)){ve=he;return 1}U=(s|0)==0;X=s+-1|0;M=(o&1|0)!=0;D=i<<1;R=e+92|0;z=e+116|0;F=e+140|0;L=e+236|0;j=a+-1|0;O=(n&1|0)!=0;I=e+188|0;S=e+252|0;P=q+1|0;E=q+2|0;C=q+3|0;A=j<<4;T=r&255;r=0;o=0;n=1;k=0;do{if(!U){x=de[t+(k<<2)>>2]|0;w=0;while(1){_=w&1;l=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=l?a:-1;u=l?0:j;e=(w|0)==(X|0);y=M&e;if((u|0)!=(b|0)){g=M&e^1;m=l?x:x+A|0;while(1){if((n|0)==1)n=gt(R,z)|0|512;d=n&7;n=n>>>3;l=me[1823+d>>0]|0;e=0;do{f=(gt(R,F)|0)+o|0;p=f-B|0;o=p>>31;o=o&f|p&~o;if((de[N>>2]|0)>>>0<=o>>>0){de[Y>>2]=1154;de[Y+4>>2]=903;de[Y+8>>2]=1781;br(G,1100,Y)|0;yr(G,te)|0}de[V+(e<<2)>>2]=de[(de[L>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);p=O&(u|0)==(j|0);if(y|p){f=0;do{h=_e(f,i)|0;e=m+h|0;l=(f|0)==0|g;c=f<<1;fe=(gt(R,I)|0)+r|0;ce=fe-W|0;r=ce>>31;r=r&fe|ce&~r;do{if(p){if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r}else{if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(G,1100,ie)|0;yr(G,ne)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;de[m+(h+8)>>2]=de[V+((me[(c|1)+(1831+(d<<2))>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(G,1100,se)|0;yr(G,ue)|0}de[m+(h+12)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}}while(0);f=f+1|0}while((f|0)!=2)}else{de[m>>2]=de[V+((me[1831+(d<<2)>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[le>>2]=1154;de[le+4>>2]=903;de[le+8>>2]=1781;br(G,1100,le)|0;yr(G,Z)|0}de[m+4>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+8>>2]=de[V+((me[1831+(d<<2)+1>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(G,1100,J)|0;yr(G,K)|0}de[m+12>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(q<<2)>>2]=de[V+((me[1831+(d<<2)+2>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(G,1100,Q)|0;yr(G,$)|0}de[m+(P<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(E<<2)>>2]=de[V+((me[1831+(d<<2)+3>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}de[m+(C<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}u=u+_|0;if((u|0)==(b|0))break;else m=m+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+D|0}}k=k+1|0}while((k|0)!=(T|0));ve=he;return 1}function Dt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;ce=ve;ve=ve+640|0;le=ce+88|0;se=ce+72|0;ae=ce+64|0;oe=ce+48|0;ne=ce+40|0;he=ce+24|0;ue=ce+16|0;ie=ce;te=ce+128|0;re=ce+112|0;ee=ce+96|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;K=de[H>>2]|0;Q=e+272|0;$=de[Q>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ce;return 1}X=(s|0)==0;W=s+-1|0;q=i<<1;G=e+92|0;V=e+116|0;Y=a+-1|0;Z=e+212|0;J=e+188|0;j=(n&1|0)==0;L=(o&1|0)==0;O=e+288|0;M=e+284|0;D=e+252|0;R=e+140|0;z=e+236|0;F=e+164|0;A=e+268|0;I=Y<<5;E=r&255;r=0;n=0;o=0;e=0;l=1;C=0;do{if(!X){S=de[t+(C<<2)>>2]|0;P=0;while(1){T=P&1;u=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;k=u?a:-1;h=u?0:Y;if((h|0)!=(k|0)){x=L|(P|0)!=(W|0);b=u?S:S+I|0;while(1){if((l|0)==1)l=gt(G,V)|0|512;y=l&7;l=l>>>3;c=me[1823+y>>0]|0;u=0;do{v=(gt(G,F)|0)+n|0;_=v-$|0;n=_>>31;n=n&v|_&~n;if((de[Q>>2]|0)>>>0<=n>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(te,1100,ie)|0;yr(te,ue)|0}de[ee+(u<<2)>>2]=ge[(de[A>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(gt(G,R)|0)+e|0;_=v-B|0;e=_>>31;e=e&v|_&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[he>>2]=1154;de[he+4>>2]=903;de[he+8>>2]=1781;br(te,1100,he)|0;yr(te,ne)|0}de[re+(u<<2)>>2]=de[(de[z>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=j|(h|0)!=(Y|0);g=0;v=b;while(1){m=x|(g|0)==0;d=g<<1;f=0;p=v;while(1){c=(gt(G,Z)|0)+r|0;u=c-U|0;r=u>>31;r=r&c|u&~r;u=(gt(G,J)|0)+o|0;c=u-K|0;o=c>>31;o=o&u|c&~o;if((_|(f|0)==0)&m){u=me[f+d+(1831+(y<<2))>>0]|0;c=r*3|0;if((de[O>>2]|0)>>>0<=c>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}fe=de[M>>2]|0;de[p>>2]=(ge[fe+(c<<1)>>1]|0)<<16|de[ee+(u<<2)>>2];de[p+4>>2]=(ge[fe+(c+2<<1)>>1]|0)<<16|(ge[fe+(c+1<<1)>>1]|0);de[p+8>>2]=de[re+(u<<2)>>2];if((de[H>>2]|0)>>>0<=o>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(te,1100,se)|0;yr(te,le)|0}de[p+12>>2]=de[(de[D>>2]|0)+(o<<2)>>2]}f=f+1|0;if((f|0)==2)break;else p=p+16|0}g=g+1|0;if((g|0)==2)break;else v=v+i|0}h=h+T|0;if((h|0)==(k|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else S=S+q|0}}C=C+1|0}while((C|0)!=(E|0));ve=ce;return 1}function Rt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0;K=ve;ve=ve+608|0;Y=K+64|0;V=K+48|0;G=K+40|0;J=K+24|0;Z=K+16|0;q=K;W=K+88|0;H=K+72|0;D=e+272|0;R=de[D>>2]|0;r=de[e+88>>2]|0;z=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=K;return 1}F=(s|0)==0;L=s+-1|0;j=i<<1;N=e+92|0;B=e+116|0;U=a+-1|0;X=e+212|0;M=(o&1|0)==0;A=e+288|0;I=e+284|0;O=e+164|0;E=e+268|0;C=U<<4;P=r&255;S=(n&1|0)!=0;r=0;o=0;e=1;k=0;do{if(!F){w=de[t+(k<<2)>>2]|0;T=0;while(1){b=T&1;n=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=n?a:-1;l=n?0:U;if((l|0)!=(x|0)){_=M|(T|0)!=(L|0);v=n?w:w+C|0;while(1){if((e|0)==1)e=gt(N,B)|0|512;g=e&7;e=e>>>3;u=me[1823+g>>0]|0;n=0;do{d=(gt(N,O)|0)+o|0;m=d-R|0;o=m>>31;o=o&d|m&~o;if((de[D>>2]|0)>>>0<=o>>>0){de[q>>2]=1154;de[q+4>>2]=903;de[q+8>>2]=1781;br(W,1100,q)|0;yr(W,Z)|0}de[H+(n<<2)>>2]=ge[(de[E>>2]|0)+(o<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(U|0)&S;p=0;d=v;while(1){f=_|(p|0)==0;c=p<<1;n=(gt(N,X)|0)+r|0;h=n-z|0;u=h>>31;u=u&n|h&~u;if(f){r=me[1831+(g<<2)+c>>0]|0;n=u*3|0;if((de[A>>2]|0)>>>0<=n>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(W,1100,J)|0;yr(W,G)|0}h=de[I>>2]|0;de[d>>2]=(ge[h+(n<<1)>>1]|0)<<16|de[H+(r<<2)>>2];de[d+4>>2]=(ge[h+(n+2<<1)>>1]|0)<<16|(ge[h+(n+1<<1)>>1]|0)}h=d+8|0;n=(gt(N,X)|0)+u|0;u=n-z|0;r=u>>31;r=r&n|u&~r;if(!(m|f^1)){n=me[(c|1)+(1831+(g<<2))>>0]|0;u=r*3|0;if((de[A>>2]|0)>>>0<=u>>>0){de[V>>2]=1154;de[V+4>>2]=903;de[V+8>>2]=1781;br(W,1100,V)|0;yr(W,Y)|0}f=de[I>>2]|0;de[h>>2]=(ge[f+(u<<1)>>1]|0)<<16|de[H+(n<<2)>>2];de[d+12>>2]=(ge[f+(u+2<<1)>>1]|0)<<16|(ge[f+(u+1<<1)>>1]|0)}p=p+1|0;if((p|0)==2)break;else d=d+i|0}l=l+b|0;if((l|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+j|0}}k=k+1|0}while((k|0)!=(P|0));ve=K;return 1}function zt(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ie=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;$=ae+40|0;oe=ae+24|0;ne=ae+16|0;Q=ae;K=ae+128|0;Z=ae+112|0;J=ae+96|0;N=e+272|0;B=de[N>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;H=s+-1|0;W=i<<1;q=e+92|0;G=e+116|0;V=a+-1|0;Y=e+212|0;j=(n&1|0)==0;L=(o&1|0)==0;R=e+288|0;z=e+284|0;F=e+164|0;M=e+268|0;D=V<<5;I=r&255;r=0;n=0;o=0;e=0;l=1;O=0;do{if(!X){C=de[t+(O<<2)>>2]|0;A=0;while(1){P=A&1;u=(P|0)==0;S=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;E=u?a:-1;h=u?0:V;if((h|0)!=(E|0)){k=L|(A|0)!=(H|0);T=u?C:C+D|0;while(1){if((l|0)==1)l=gt(q,G)|0|512;w=l&7;l=l>>>3;c=me[1823+w>>0]|0;u=0;do{b=(gt(q,F)|0)+e|0;x=b-B|0;e=x>>31;e=e&b|x&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(K,1100,Q)|0;yr(K,ne)|0}de[Z+(u<<2)>>2]=ge[(de[M>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{b=(gt(q,F)|0)+n|0;x=b-B|0;n=x>>31;n=n&b|x&~n;if((de[N>>2]|0)>>>0<=n>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(K,1100,oe)|0;yr(K,$)|0}de[J+(u<<2)>>2]=ge[(de[M>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);x=j|(h|0)!=(V|0);y=0;b=T;while(1){_=k|(y|0)==0;v=y<<1;m=0;g=b;while(1){d=(gt(q,Y)|0)+o|0;p=d-U|0;o=p>>31;o=o&d|p&~o;p=(gt(q,Y)|0)+r|0;d=p-U|0;r=d>>31;r=r&p|d&~r;if((x|(m|0)==0)&_){p=me[m+v+(1831+(w<<2))>>0]|0;d=o*3|0;u=de[R>>2]|0;if(u>>>0<=d>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(K,1100,ee)|0;yr(K,te)|0;u=de[R>>2]|0}c=de[z>>2]|0;f=r*3|0;if(u>>>0>f>>>0)u=c;else{de[re>>2]=1154;de[re+4>>2]=903;de[re+8>>2]=1781;br(K,1100,re)|0;yr(K,ie)|0;u=de[z>>2]|0}de[g>>2]=(ge[c+(d<<1)>>1]|0)<<16|de[Z+(p<<2)>>2];de[g+4>>2]=(ge[c+(d+2<<1)>>1]|0)<<16|(ge[c+(d+1<<1)>>1]|0);de[g+8>>2]=(ge[u+(f<<1)>>1]|0)<<16|de[J+(p<<2)>>2];de[g+12>>2]=(ge[u+(f+2<<1)>>1]|0)<<16|(ge[u+(f+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else g=g+16|0}y=y+1|0;if((y|0)==2)break;else b=b+i|0}h=h+P|0;if((h|0)==(E|0))break;else T=T+S|0}}A=A+1|0;if((A|0)==(s|0))break;else C=C+W|0}}O=O+1|0}while((O|0)!=(I|0));ve=ae;return 1}function Ft(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=ve;ve=ve+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))Di[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;br(u,1100,i)|0;yr(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))Di[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;br(u,1100,a)|0;yr(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))Di[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;br(u,1100,s)|0;yr(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;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}if(!(r&7))Di[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;br(u,1100,h)|0;yr(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;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}function Lt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;de[r>>2]=t;t=de[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function jt(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Fe(200,2)|0)){t=Re(de[49]|0)|0;ve=e;return t|0}else Lt(2090,e);return 0}function Nt(e){e=e|0;Ur(e);return}function Bt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Oi[e&3]();Lt(2139,t)}function Ut(){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)Bt(de[t+12>>2]|0);t=de[28]|0;de[28]=t+0;Bt(t)}function Xt(e){e=e|0;return}function Ht(e){e=e|0;return}function Wt(e){e=e|0;return}function qt(e){e=e|0;return}function Gt(e){e=e|0;Nt(e);return}function Vt(e){e=e|0;Nt(e);return}function Yt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(n=Qt(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;Ri[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;ve=a;return t|0}function Zt(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);return}function Jt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);return}function Kt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);else{e=de[e+8>>2]|0;Ri[de[(de[e>>2]|0)+28>>2]&3](e,t,r,i)}return}function Qt(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=ve;ve=ve+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;Mi[de[(de[r>>2]|0)+20>>2]&3](r,f,h,h,1,0);i=(de[t>>2]|0)==1?h:0}else{Ei[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);ve=p;return i|0}function $t(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);return}function er(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;Ei[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;Mi[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 tr(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 rr(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))$t(0,t,r,i,n);else{e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,i,n,o)}return}function ir(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))$t(0,t,r,i,n);return}function nr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+16|0;i=n;de[i>>2]=de[r>>2];e=Pi[de[(de[e>>2]|0)+16>>2]&7](e,t,i)|0;if(e)de[r>>2]=de[i>>2];ve=n;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=(Qt(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,i=0,n=0,o=0,a=0,s=0;n=ve;ve=ve+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];Lt(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(Pi[de[(de[8>>2]|0)+16>>2]&7](8,i,n)|0){s=de[n>>2]|0;n=de[51]|0;s=Ai[de[(de[s>>2]|0)+8>>2]&1](s)|0;de[o>>2]=n;de[o+4>>2]=e;de[o+8>>2]=s;Lt(2282,o)}else{de[s>>2]=de[51];de[s+4>>2]=e;Lt(2327,s)}}Lt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(Le(196,6)|0)){ve=e;return}else Lt(2179,e)}function lr(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(Be(de[49]|0,0)|0)){ve=t;return}else Lt(2229,t)}function ur(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 hr(){var e=0;if(!(de[52]|0))e=264;else{e=(ze()|0)+60|0;e=de[e>>2]|0}return e|0}function cr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=hr()|0;de[t>>2]=0-e;e=-1}return e|0}function fr(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=+fr(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 pr(e,t){e=+e;t=t|0;return+ +fr(e,t)}function dr(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=hr()|0;de[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function mr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=dr(e,t,0)|0;return e|0}function gr(e){e=e|0;var t=0,r=0;do{if(e){if((de[e+76>>2]|0)<=-1){t=Dr(e)|0;break}r=(kr(e)|0)==0;t=Dr(e)|0;if(!r)Sr(e)}else{if(!(de[65]|0))t=0;else t=gr(de[65]|0)|0;Ue(236);e=de[58]|0;if(e)do{if((de[e+76>>2]|0)>-1)r=kr(e)|0;else r=0;if((de[e+20>>2]|0)>>>0>(de[e+28>>2]|0)>>>0)t=Dr(e)|0|t;if(r)Sr(e);e=de[e+56>>2]|0}while((e|0)!=0);je(236)}}while(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;if((de[t+76>>2]|0)>=0?(kr(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=Pr(t,e)|0;Sr(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=Pr(t,e)|0}}while(0);return r|0}function _r(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(!(Or(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=Pi[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((Pi[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);Qr(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 yr(e,t){e=e|0;t=t|0;var r=0,i=0;r=ve;ve=ve+16|0;i=r;de[i>>2]=t;t=xr(de[64]|0,e,i)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=ve;ve=ve+16|0;n=i;de[n>>2]=r;r=Tr(e,t,n)|0;ve=i;return r|0}function xr(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=ve;ve=ve+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((Rr(0,t,c,p,d)|0)<0)r=-1;else{if((de[e+76>>2]|0)>-1)u=kr(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=Rr(e,t,c,p,d)|0;if(o){Pi[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=Rr(e,t,c,p,d)|0;r=de[e>>2]|0;de[e>>2]=r|h;if(u)Sr(e);r=(r&32|0)==0?i:-1}ve=m;return r|0}function wr(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=ve;ve=ve+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=hr()|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=xr(u,r,i)|0;if(l){r=de[e>>2]|0;pe[r+(((r|0)==(de[n>>2]|0))<<31>>31)>>0]=0}}ve=h;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function kr(e){e=e|0;return 0}function Sr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+16|0;s=l;a=t&255;pe[s>>0]=a;i=e+16|0;n=de[i>>2]|0;if(!n)if(!(Or(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((Pi[de[e+36>>2]&7](e,s,1)|0)==1)r=me[s>>0]|0;else r=-1}}while(0);ve=l;return r|0}function Er(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;de[r>>2]=de[e+60>>2];e=cr(Pe(6,r|0)|0)|0;ve=t;return e|0}function Cr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0;n=ve;ve=ve+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((cr(qe(140,o|0)|0)|0)<0){de[i>>2]=-1;e=-1}else e=de[i>>2]|0;ve=n;return e|0}function Ar(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=ve;ve=ve+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=cr(Ge(146,c|0)|0)|0}else{He(7,e|0);de[h>>2]=de[l>>2];de[h+4>>2]=i;de[h+8>>2]=t;a=cr(Ge(146,h|0)|0)|0;ke(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}ve=d;return r|0}function Ir(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+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,(Se(54,i|0)|0)!=0):0)pe[e+75>>0]=-1;i=Ar(e,t,r)|0;ve=n;return i|0}function Or(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 Mr(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=_e(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 Dr(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?(Pi[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)Pi[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 Rr(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0;Q=ve;ve=ve+624|0;V=Q+24|0;Z=Q+16|0;Y=Q+588|0;X=Q+576|0;G=Q;N=Q+536|0;K=Q+8|0;J=Q+528|0;I=(e|0)!=0;O=N+40|0;j=O;N=N+39|0;B=K+4|0;U=X+12|0;X=X+11|0;H=Y;W=U;q=W-H|0;M=-2-H|0;D=W+2|0;R=V+288|0;z=Y+9|0;F=z;L=Y+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=hr()|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)){A=245;break}else s=m;t:while(1){switch(a<<24>>24){case 37:{a=s;A=9;break t}case 0:{a=s;break t}default:{}}C=s+1|0;a=pe[C>>0]|0;s=C}t:do{if((A|0)==9)while(1){A=0;if((pe[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((pe[a>>0]|0)==37)A=9;else break}}while(0);v=s-m|0;if(I?(de[e>>2]&32|0)==0:0)_r(m,v,e)|0;if((s|0)!=(m|0)){m=a;a=v;continue}h=a+1|0;s=pe[h>>0]|0;l=(s<<24>>24)+-48|0;if(l>>>0<10){C=(pe[a+2>>0]|0)==36;h=C?a+3|0:h;s=pe[h>>0]|0;p=C?l:-1;t=C?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(!I){g=c;a=l;t=0;C=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){g=c|8192;C=0-s|0}else{g=c;C=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{g=c;C=s}}else{g=c;C=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(I){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{E=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 A=52;else{if(l){de[n+(p<<2)>>2]=c;S=i+(p<<3)|0;P=de[S+4>>2]|0;A=G;de[A>>2]=de[S>>2];de[A+4>>2]=P;A=52;break}if(!I){o=0;break e}Lr(G,c,r)}}while(0);if((A|0)==52?(A=0,!I):0){m=E;a=v;continue}p=pe[a>>0]|0;p=(f|0)!=0&(p&15|0)==3?p&-33:p;l=g&-65537;P=(g&8192|0)==0?g:l;t:do{switch(p|0){case 110:switch(f|0){case 0:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 1:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 2:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}case 3:{$[de[G>>2]>>1]=o;m=E;a=v;continue e}case 4:{pe[de[G>>2]>>0]=o;m=E;a=v;continue e}case 6:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 7:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}default:{m=E;a=v;continue e}}case 112:{f=P|8;h=h>>>0>8?h:8;p=120;A=64;break}case 88:case 120:{f=P;A=64;break}case 111:{l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;if((s|0)==0&(l|0)==0)a=O;else{a=O;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(!(P&8)){s=P;f=0;c=5839;A=77}else{f=j-a+1|0;s=P;h=(h|0)<(f|0)?f:h;f=0;c=5839;A=77}break}case 105:case 100:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;if((s|0)<0){a=Vr(0,0,a|0,s|0)|0;s=re;l=G;de[l>>2]=a;de[l+4>>2]=s;l=1;c=5839;A=76;break t}if(!(P&2048)){c=P&1;l=c;c=(c|0)==0?5839:5841;A=76}else{l=1;c=5840;A=76}break}case 117:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;l=0;c=5839;A=76;break}case 99:{pe[N>>0]=de[G>>2];m=N;s=1;f=0;p=5839;a=O;break}case 109:{a=hr()|0;a=ur(de[a>>2]|0)|0;A=82;break}case 115:{a=de[G>>2]|0;a=(a|0)!=0?a:5849;A=82;break}case 67:{de[K>>2]=de[G>>2];de[B>>2]=0;de[G>>2]=K;h=-1;A=86;break}case 83:{if(!h){Nr(e,32,C,0,P);a=0;A=98}else A=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[G>>3];de[Z>>2]=0;ee[te>>3]=u;if((de[te+4>>2]|0)>=0)if(!(P&2048)){S=P&1;k=S;S=(S|0)==0?5857:5862}else{k=1;S=5859}else{u=-u;k=1;S=5856}ee[te>>3]=u;T=de[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){d=+pr(u,Z)*2.0;s=d!=0.0;if(s)de[Z>>2]=(de[Z>>2]|0)+-1;x=p|32;if((x|0)==97){m=p&32;v=(m|0)==0?S:S+9|0;g=k|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[v>>0]|0)==45){u=-(u+(-d-u));break}else{u=d+u-u;break}}else u=d}while(0);s=de[Z>>2]|0;a=(s|0)<0?0-s|0:s;a=jr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){pe[X>>0]=48;a=X}pe[a+-1>>0]=(s>>31&2)+43;f=a+-2|0;pe[f>>0]=p+15;c=(h|0)<1;l=(P&8|0)==0;s=Y;while(1){S=~~u;a=s+1|0;pe[s>>0]=me[5823+S>>0]|m;u=(u-+(S|0))*16.0;do{if((a-H|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&(M+a|0)<(h|0)?D+h-f|0:q-f+a|0;l=h+g|0;Nr(e,32,C,l,P);if(!(de[e>>2]&32))_r(v,g,e)|0;Nr(e,48,C,l,P^65536);a=a-H|0;if(!(de[e>>2]&32))_r(Y,a,e)|0;s=W-f|0;Nr(e,48,h-(a+s)|0,0,0);if(!(de[e>>2]&32))_r(f,s,e)|0;Nr(e,32,C,l,P^8192);a=(l|0)<(C|0)?C:l;break}a=(h|0)<0?6:h;if(s){s=(de[Z>>2]|0)+-28|0;de[Z>>2]=s;u=d*268435456.0}else{u=d;s=de[Z>>2]|0}T=(s|0)<0?V:R;w=T;s=T;do{b=~~u>>>0;de[s>>2]=b;s=s+4|0;u=(u-+(b>>>0))*1.0e9}while(u!=0.0);l=s;s=de[Z>>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{b=Jr(de[h>>2]|0,0,f|0)|0;b=Kr(b|0,re|0,s|0,0)|0;s=re;y=ai(b|0,s|0,1e9,0)|0;de[h>>2]=y;s=oi(b|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[Z>>2]|0)-f|0;de[Z>>2]=s;if((s|0)>0)c=h;else break}}else h=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;m=h;while(1){g=0-s|0;g=(g|0)>9?9:g;do{if(m>>>0>>0){s=(1<>>g;h=0;f=m;do{b=de[f>>2]|0;de[f>>2]=(b>>>g)+h;h=_e(b&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=_?T:h;l=(l-s>>2|0)>(v|0)?s+(v<<2)|0:l;s=(de[Z>>2]|0)+g|0;de[Z>>2]=s;if((s|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){s=(w-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);y=(x|0)==103;b=(a|0)!=0;h=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((h|0)<(((l-w>>2)*9|0)+-9|0)){f=h+9216|0;_=(f|0)/9|0;h=T+(_+-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;g=de[h>>2]|0;v=(g>>>0)%(c>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(l|0):0)c=m;else A=163;do{if((A|0)==163){A=0;d=(((g>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;f=(c|0)/2|0;do{if(v>>>0>>0)u=.5;else{if((v|0)==(f|0)?(T+(_+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(k){if((pe[S>>0]|0)!=45)break;d=-d;u=-u}}while(0);f=g-v|0;de[h>>2]=f;if(!(d+u!=d)){c=m;break}x=f+c|0;de[h>>2]=x;if(x>>>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}x=(de[c>>2]|0)+1|0;de[c>>2]=x;if(x>>>0>999999999)h=c;else{m=s;h=c;break}}}s=(w-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);x=h+4|0;m=c;l=l>>>0>x>>>0?x:l}v=0-s|0;while(1){if(l>>>0<=m>>>0){_=0;x=l;break}h=l+-4|0;if(!(de[h>>2]|0))l=h;else{_=1;x=l;break}}do{if(y){a=(b&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=P&8;if(l)break;do{if(_){l=de[x+-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=((x-w>>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=P&8}while(0);g=a|l;c=(g|0)!=0&1;f=(p|32|0)==102;if(f){s=(s|0)>0?s:0;p=0}else{h=(s|0)<0?v:s;h=jr(h,((h|0)<0)<<31>>31,U)|0;if((W-h|0)<2)do{h=h+-1|0;pe[h>>0]=48}while((W-h|0)<2);pe[h+-1>>0]=(s>>31&2)+43;w=h+-2|0;pe[w>>0]=p;s=W-w|0;p=w}v=k+1+a+c+s|0;Nr(e,32,C,v,P);if(!(de[e>>2]&32))_r(S,k,e)|0;Nr(e,48,C,v,P^65536);do{if(f){h=m>>>0>T>>>0?T:m;s=h;do{l=jr(de[s>>2]|0,0,z)|0;do{if((s|0)==(h|0)){if((l|0)!=(z|0))break;pe[L>>0]=48;l=L}else{if(l>>>0<=Y>>>0)break;do{l=l+-1|0;pe[l>>0]=48}while(l>>>0>Y>>>0)}}while(0);if(!(de[e>>2]&32))_r(l,F-l|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(g){if(de[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){l=s;while(1){s=jr(de[l>>2]|0,0,z)|0;if(s>>>0>Y>>>0)do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0);if(!(de[e>>2]&32))_r(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}}Nr(e,48,a+9|0,9,0)}else{f=_?x:m+4|0;if((a|0)>-1){c=(l|0)==0;h=m;do{s=jr(de[h>>2]|0,0,z)|0;if((s|0)==(z|0)){pe[L>>0]=48;s=L}do{if((h|0)==(m|0)){l=s+1|0;if(!(de[e>>2]&32))_r(s,1,e)|0;if(c&(a|0)<1){s=l;break}if(de[e>>2]&32){s=l;break}_r(5891,1,e)|0;s=l}else{if(s>>>0<=Y>>>0)break;do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0)}}while(0);l=F-s|0;if(!(de[e>>2]&32))_r(s,(a|0)>(l|0)?l:a,e)|0;a=a-l|0;h=h+4|0}while(h>>>0>>0&(a|0)>-1)}Nr(e,48,a+18|0,18,0);if(de[e>>2]&32)break;_r(p,W-p|0,e)|0}}while(0);Nr(e,32,C,v,P^8192);a=(v|0)<(C|0)?C:v}else{f=(p&32|0)!=0;c=u!=u|0.0!=0.0;s=c?0:k;h=s+3|0;Nr(e,32,C,h,l);a=de[e>>2]|0;if(!(a&32)){_r(S,s,e)|0;a=de[e>>2]|0}if(!(a&32))_r(c?f?5883:5887:f?5875:5879,3,e)|0;Nr(e,32,C,h,P^8192);a=(h|0)<(C|0)?C:h}}while(0);m=E;continue e}default:{l=P;s=h;f=0;p=5839;a=O}}}while(0);t:do{if((A|0)==64){l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;c=p&32;if(!((s|0)==0&(l|0)==0)){a=O;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));A=G;if((f&8|0)==0|(de[A>>2]|0)==0&(de[A+4>>2]|0)==0){s=f;f=0;c=5839;A=77}else{s=f;f=2;c=5839+(p>>4)|0;A=77}}else{a=O;s=f;f=0;c=5839;A=77}}else if((A|0)==76){a=jr(a,s,O)|0;s=P;f=l;A=77}else if((A|0)==82){A=0;P=Mr(a,0,h)|0;S=(P|0)==0;m=a;s=S?h:P-a|0;f=0;p=5839;a=S?a+h|0:P}else if((A|0)==86){A=0;s=0;a=0;c=de[G>>2]|0;while(1){l=de[c>>2]|0;if(!l)break;a=mr(J,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}Nr(e,32,C,s,P);if(!s){a=0;A=98}else{l=0;h=de[G>>2]|0;while(1){a=de[h>>2]|0;if(!a){a=s;A=98;break t}a=mr(J,a)|0;l=a+l|0;if((l|0)>(s|0)){a=s;A=98;break t}if(!(de[e>>2]&32))_r(J,a,e)|0;if(l>>>0>=s>>>0){a=s;A=98;break}else h=h+4|0}}}}while(0);if((A|0)==98){A=0;Nr(e,32,C,a,P^8192);m=E;a=(C|0)>(a|0)?C:a;continue}if((A|0)==77){A=0;l=(h|0)>-1?s&-65537:s;s=G;s=(de[s>>2]|0)!=0|(de[s+4>>2]|0)!=0;if((h|0)!=0|s){s=(s&1^1)+(j-a)|0;m=a;s=(h|0)>(s|0)?h:s;p=c;a=O}else{m=O;s=0;p=c;a=O}}c=a-m|0;s=(s|0)<(c|0)?c:s;h=f+s|0;a=(C|0)<(h|0)?h:C;Nr(e,32,a,h,l);if(!(de[e>>2]&32))_r(p,f,e)|0;Nr(e,48,a,h,l^65536);Nr(e,48,s,c,0);if(!(de[e>>2]&32))_r(m,c,e)|0;Nr(e,32,a,h,l^8192);m=E}e:do{if((A|0)==245)if(!e)if(t){o=1;while(1){t=de[n+(o<<2)>>2]|0;if(!t)break;Lr(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);ve=Q;return o|0}function zr(e){e=e|0;if(!(de[e+68>>2]|0))Sr(e);return}function Fr(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;Qr(n|0,t|0,e|0)|0;de[i>>2]=(de[i>>2]|0)+e;return r|0}function Lr(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);return}function jr(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=ai(e|0,t|0,10,0)|0;r=r+-1|0;pe[r>>0]=i|48;i=oi(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 Nr(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=ve;ve=ve+256|0;a=s;do{if((r|0)>(i|0)&(n&73728|0)==0){n=r-i|0;Yr(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){_r(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;_r(a,n,e)|0}}while(0);ve=s;return}function Br(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,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=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)Xe();t=a+12|0;if((de[t>>2]|0)==(n|0)){de[t>>2]=r;de[i>>2]=a;break}else Xe()}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)Xe();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 Xe()}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)Xe();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;F=r>>>12&16;r=r>>>F;z=r>>>5&8;r=r>>>z;L=r>>>2&4;r=r>>>L;e=r>>>1&2;r=r>>>e;i=r>>>1&1;i=de[908+((z|F|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)Xe();s=i+p|0;if(i>>>0>=s>>>0)Xe();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)Xe();else{de[e>>2]=0;f=t;break}}else{n=de[i+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(i|0))Xe();e=r+8|0;if((de[e>>2]|0)==(i|0)){de[t>>2]=r;de[e>>2]=n;f=r;break}else Xe()}}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)Xe();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)Xe();de[f+24>>2]=a;t=de[i+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();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)Xe();a=l+c|0;if(l>>>0>=a>>>0)Xe();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)Xe();else{de[e>>2]=0;p=t;break}}else{i=de[l+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((de[t>>2]|0)!=(l|0))Xe();e=r+8|0;if((de[e>>2]|0)==(l|0)){de[t>>2]=r;de[e>>2]=i;p=r;break}else Xe()}}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)Xe();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)Xe();de[p+24>>2]=o;t=de[l+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();else{v=t;_=e}}else{de[151]=r|t;v=644+(e+2<<2)|0;_=i}de[v>>2]=a;de[_+12>>2]=a;de[l+(c+8)>>2]=_;de[l+(c+12)>>2]=i;break}t=s>>>8;if(t)if(s>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|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)){T=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();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 T=t}while(0);t=T+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&T>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[l+(c+8)>>2]=e;de[l+(c+12)>>2]=T;de[l+(c+24)>>2]=0;break}else Xe()}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){F=e-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}do{if(!(de[269]|0)){e=De(30)|0;if(!(e+-1&e)){de[271]=e;de[270]=e;de[272]=-1;de[273]=-1;de[274]=0;de[262]=0;T=(We(0)|0)&-16^1431655768;de[269]=T;break}else Xe()}}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?(_=de[259]|0,T=_+h|0,T>>>0<=_>>>0|T>>>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?(g=n+4|0,(r+(de[g>>2]|0)|0)>>>0>e>>>0):0){o=n;e=g;break}n=de[n+8>>2]|0;if(!n){b=174;break t}}r=a-(de[154]|0)&s;if(r>>>0<2147483647){n=Ie(r|0)|0;T=(n|0)==((de[o>>2]|0)+(de[e>>2]|0)|0);e=T?r:0;if(T){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=Ie(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){T=de[261]|0;if((T|0)!=0?n>>>0<=e>>>0|n>>>0>T>>>0:0){e=0;break}n=Ie(r|0)|0;T=(n|0)==(o|0);e=T?r:0;if(T){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((Ie(y|0)|0)==(-1|0)){Ie(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=Ie(h|0)|0,w=Ie(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(k=w-x|0,S=k>>>0>(m+40|0)>>>0,S):0){d=S?k: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)){P=e;E=r;C=n;A=o;b=204;break}o=de[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(de[A+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){de[E>>2]=C+d;L=(de[154]|0)+d|0;F=a+8|0;F=(F&7|0)==0?0:0-F&7;z=L-F|0;de[157]=a+F;de[154]=z;de[a+(F+4)>>2]=z|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){R=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)Xe();else{de[i>>2]=0;R=r;break}}else{n=de[x+((u|8)+d)>>2]|0;if(n>>>0>>0)Xe();e=n+12|0;if((de[e>>2]|0)!=(t|0))Xe();r=i+8|0;if((de[r>>2]|0)==(t|0)){de[e>>2]=i;de[r>>2]=n;R=i;break}else Xe()}}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)Xe();e=a+16|0;if((de[e>>2]|0)==(t|0))de[e>>2]=R;else de[a+20>>2]=R;if(!R)break r}else{de[r>>2]=R;if(R)break;de[152]=de[152]&~(1<>>0>>0)Xe();de[R+24>>2]=a;t=u|16;e=de[x+(t+d)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{de[R+16>>2]=e;de[e+24>>2]=R;break}}while(0);t=de[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(de[155]|0)>>>0)Xe();else{de[R+20>>2]=t;de[t+24>>2]=R;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)Xe();if((de[i+12>>2]|0)==(t|0))break;Xe()}}while(0);if((n|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();e=n+8|0;if((de[e>>2]|0)==(t|0)){I=e;break}Xe()}}while(0);de[i+12>>2]=n;de[I>>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){z=t;F=e;break}Xe()}}while(0);de[z>>2]=p;de[F+12>>2]=p;de[x+(c+8)>>2]=F;de[x+(c+12)>>2]=i;break}t=n>>>8;do{if(!t)i=0;else{if(n>>>0>16777215){i=31;break}z=(t+1048320|0)>>>16&8;F=t<>>16&4;F=F<>>16&2;i=14-(R|z|i)+(F<>>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)Xe();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;F=de[155]|0;if(e>>>0>=F>>>0&L>>>0>=F>>>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 Xe()}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)Xe();else{O=t;M=e}}else{de[151]=r|t;O=644+(e+2<<2)|0;M=i}de[O>>2]=a;de[M+12>>2]=a;de[a+8>>2]=M;de[a+12>>2]=i;break}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|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)){D=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[a+24>>2]=t;de[a+12>>2]=a;de[a+8>>2]=a;break e}}else D=t}while(0);t=D+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&D>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[a+8>>2]=e;de[a+12>>2]=D;de[a+24>>2]=0;break}else Xe()}}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;F=644+(L<<2)|0;de[644+(L+3<<2)>>2]=F;de[644+(L+2<<2)>>2]=F;t=t+1|0}while((t|0)!=32);L=x+8|0;L=(L&7|0)==0?0:0-L&7;F=d+-40-L|0;de[157]=x+L;de[154]=F;de[x+(L+4)>>2]=F|1;de[x+(d+-36)>>2]=40;de[158]=de[273]}}while(0);t=de[154]|0;if(t>>>0>m>>>0){F=t-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}}L=hr()|0;de[L>>2]=12;L=0;return L|0}function Ur(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,g=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=de[155]|0;if(t>>>0>>0)Xe();r=de[e+-4>>2]|0;i=r&3;if((i|0)==1)Xe();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)Xe();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)Xe();if((de[i+12>>2]|0)!=(h|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(h|0))a=t;else Xe()}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)Xe();else{de[r>>2]=0;u=t;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(h|0))Xe();r=i+8|0;if((de[r>>2]|0)==(h|0)){de[t>>2]=i;de[r>>2]=n;u=i;break}else Xe()}}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)Xe();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)Xe();de[u+24>>2]=a;t=de[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();t=e+(p+-4)|0;r=de[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((m|0)==(de[157]|0)){_=(de[154]|0)+o|0;de[154]=_;de[157]=y;de[y+4>>2]=_|1;if((y|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){_=(de[153]|0)+o|0;de[153]=_;de[156]=y;de[y+4>>2]=_|1;de[y+_>>2]=_;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)Xe();else{de[r>>2]=0;d=t;break}}else{r=de[e+p>>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();i=r+12|0;if((de[i>>2]|0)!=(m|0))Xe();n=t+8|0;if((de[n>>2]|0)==(m|0)){de[i>>2]=t;de[n>>2]=r;d=t;break}else Xe()}}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)Xe();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)Xe();de[d+24>>2]=a;t=de[e+(p+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();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)Xe();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)Xe();if((de[i+12>>2]|0)!=(m|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0<(de[155]|0)>>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(m|0))f=t;else Xe()}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)Xe();else{g=t;v=r}}else{de[151]=i|t;g=644+(r+2<<2)|0;v=n}de[g>>2]=y;de[v+12>>2]=y;de[y+8>>2]=v;de[y+12>>2]=n;return}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{g=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;n=14-(m|g|n)+(v<>>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)){_=i;break t}else{n=n<<1;t=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=de[t>>2]|0;v=de[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){de[r+12>>2]=y;de[t>>2]=y;de[y+8>>2]=r;de[y+12>>2]=_;de[y+24>>2]=0;break}else Xe()}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 Xr(e,t){e=e|0;t=t|0;var r=0,i=0;if(!e){e=Br(t)|0;return e|0}if(t>>>0>4294967231){e=hr()|0;de[e>>2]=12;e=0;return e|0}r=Wr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=Br(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;Qr(r|0,e|0,(i>>>0>>0?i:t)|0)|0;Ur(e);e=r;return e|0}function Hr(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 Wr(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))Xe();i=e+(l|4)|0;n=de[i>>2]|0;if(!(n&1))Xe();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;qr(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)Xe();else{de[i>>2]=0;u=r;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();r=n+12|0;if((de[r>>2]|0)!=(h|0))Xe();i=o+8|0;if((de[i>>2]|0)==(h|0)){de[r>>2]=o;de[i>>2]=n;u=o;break}else Xe()}}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)Xe();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)Xe();de[u+24>>2]=a;r=de[e+(l+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();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)Xe();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)Xe();if((de[n+12>>2]|0)!=(h|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(h|0))a=r;else Xe()}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;qr(e+t|0,f);return e|0}return 0}function qr(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,g=0,v=0,_=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)Xe();if((f|0)==(de[156]|0)){i=e+(t+4)|0;r=de[i>>2]|0;if((r&3|0)!=3){_=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)Xe();if((de[n+12>>2]|0)!=(f|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(f|0))s=r;else Xe()}else s=i+8|0;de[n+12>>2]=i;de[s>>2]=n;_=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)Xe();else{de[i>>2]=0;h=r;break}}else{o=de[e+(8-u)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(f|0))Xe();i=n+8|0;if((de[i>>2]|0)==(f|0)){de[r>>2]=n;de[i>>2]=o;h=n;break}else Xe()}}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)Xe();r=s+16|0;if((de[r>>2]|0)==(f|0))de[r>>2]=h;else de[s+20>>2]=h;if(!h){_=f;a=c;break}}n=de[155]|0;if(h>>>0>>0)Xe();de[h+24>>2]=s;r=16-u|0;i=de[e+r>>2]|0;do{if(i)if(i>>>0>>0)Xe();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)Xe();else{de[h+20>>2]=r;de[r+24>>2]=h;_=f;a=c;break}else{_=f;a=c}}else{_=f;a=c}}else{_=e;a=t}}while(0);l=de[155]|0;if(m>>>0>>0)Xe();r=e+(t+4)|0;i=de[r>>2]|0;if(!(i&2)){if((m|0)==(de[157]|0)){v=(de[154]|0)+a|0;de[154]=v;de[157]=_;de[_+4>>2]=v|1;if((_|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){v=(de[153]|0)+a|0;de[153]=v;de[156]=_;de[_+4>>2]=v|1;de[_+v>>2]=v;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)Xe();else{de[i>>2]=0;d=r;break}}else{o=de[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(m|0))Xe();i=n+8|0;if((de[i>>2]|0)==(m|0)){de[r>>2]=n;de[i>>2]=o;d=n;break}else Xe()}}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)Xe();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)Xe();de[d+24>>2]=s;r=de[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();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)Xe();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)Xe();if((de[n+12>>2]|0)!=(m|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(m|0))p=r;else Xe()}else p=i+8|0;de[n+12>>2]=i;de[p>>2]=n}}while(0);de[_+4>>2]=a|1;de[_+a>>2]=a;if((_|0)==(de[156]|0)){de[153]=a;return}}else{de[r>>2]=i&-2;de[_+4>>2]=a|1;de[_+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)Xe();else{g=r;v=i}}else{de[151]=n|r;g=644+(i+2<<2)|0;v=o}de[g>>2]=_;de[v+12>>2]=_;de[_+8>>2]=v;de[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{g=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(m|g|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;de[_+28>>2]=o;de[_+20>>2]=0;de[_+16>>2]=0;i=de[152]|0;n=1<>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;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)Xe();de[i>>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}}while(0);i=r+8|0;n=de[i>>2]|0;v=de[155]|0;if(!(n>>>0>=v>>>0&r>>>0>=v>>>0))Xe();de[n+12>>2]=_;de[i>>2]=_;de[_+8>>2]=n;de[_+12>>2]=r;de[_+24>>2]=0;return}function Gr(){}function Vr(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 Yr(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 Jr(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 Qr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if((r|0)>=4096)return Me(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 $r(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 ei(e){e=e|0;var t=0;t=pe[g+(e&255)>>0]|0;if((t|0)<8)return t|0;t=pe[g+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=pe[g+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(pe[g+(e>>>24)>>0]|0)+24|0}function ti(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0;o=e&65535;n=t&65535;r=_e(n,o)|0;i=e>>>16;e=(r>>>16)+(_e(n,i)|0)|0;n=t>>>16;t=_e(n,o)|0;return(re=(e>>>16)+(_e(n,i)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function ri(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=Vr(u^e,l^t,u,l)|0;a=re;e=o^u;t=n^l;return Vr((si(s,a,Vr(o^r,n^i,o,n)|0,re,0)|0)^e,re^t,e,t)|0}function ii(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=ve;ve=ve+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=Vr(a^e,o^t,a,o)|0;t=re;si(e,t,Vr(u^r,l^i,u,l)|0,re,s)|0;i=Vr(de[s>>2]^a,de[s+4>>2]^o,a,o)|0;r=re;ve=n;return(re=r,i)|0}function ni(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=ti(n,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(i,n)|0)+e|e&0,r|0|0)|0}function oi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return si(e,t,r,i,0)|0}function ai(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;o=ve;ve=ve+16|0;n=o|0;si(e,t,r,i,n)|0;ve=o;return(re=de[n+4>>2]|0,de[n>>2]|0)|0}function si(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=(ae(s|0)|0)-(ae(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=(ae(a|0)|0)+33-(ae(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=ei(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>>>((ei(s|0)|0)>>>0);return(re=p,d)|0}o=(ae(s|0)|0)-(ae(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=Kr(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;Vr(u,r,i,f)|0;d=re;p=d>>31|((d|0)<0?-1:0)<<1;s=p&1;e=Vr(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 li(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return Pi[e&7](t|0,r|0,i|0)|0}function ui(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;Ei[e&3](t|0,r|0,i|0,n|0,o|0)}function hi(e,t){e=e|0;t=t|0;Ci[e&7](t|0)}function ci(e,t){e=e|0;t=t|0;return Ai[e&1](t|0)|0}function fi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;Ii[e&0](t|0,r|0,i|0)}function pi(e){e=e|0;Oi[e&3]()}function di(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;Mi[e&3](t|0,r|0,i|0,n|0,o|0,a|0)}function mi(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 Di[e&1](t|0,r|0,i|0,n|0,o|0)|0}function gi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;Ri[e&3](t|0,r|0,i|0,n|0)}function vi(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function _i(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(1)}function yi(e){e=e|0;se(2)}function bi(e){e=e|0;se(3);return 0}function xi(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function wi(){se(5)}function Ti(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;se(6)}function ki(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(7);return 0}function Si(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;se(8)}var Pi=[vi,Yt,Fr,Ar,Cr,Ir,vi,vi];var Ei=[_i,tr,er,_i];var Ci=[yi,Ht,Gt,Wt,qt,Vt,lr,zr];var Ai=[bi,Er];var Ii=[xi];var Oi=[wi,ar,sr,wi];var Mi=[Ti,ir,rr,Ti];var Di=[ki,lt];var Ri=[Si,Jt,Kt,Si];return{___cxa_can_catch:nr,_crn_get_levels:Tt,_crn_get_uncompressed_size:St,_crn_decompress:Pt,_i64Add:Kr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Vr,_memset:Yr,_malloc:Br,_free:Ur,_memcpy:Qr,_bitshift64Lshr:Zr,_fflush:gr,_bitshift64Shl:Jr,_crn_get_height:wt,___errno_location:hr,_crn_get_dxt_format:kt,runPostSets:Gr,_emscripten_replace_memory:Ye,stackAlloc:Ze,stackSave:Je,stackRestore:Ke,establishStackSpace:Qe,setThrew:$e,setTempRet0:rt,getTempRet0:it,dynCall_iiii:li,dynCall_viiiii:ui,dynCall_vi:hi,dynCall_ii:ci,dynCall_viii:fi,dynCall_v:pi,dynCall_viiiiii:di,dynCall_iiiiii:mi,dynCall_viiii:gi}}(e.Ya,e.Za,buffer);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;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=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;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=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)};var i=function(l){function e(e,t,r,i,n,o,a){var s=l.call(this)||this;return s.complete=!1,s.isCompressedImage=!0,s.preserveSource=!0,s.onload=null,s.baseTexture=null,s.init(e,t,r,i,n,o,a),s}return __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;var s=this.complete;return this.complete=!!t,!s&&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 i=e.state.gl,n=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}(e.AbstractInternalLoader);e.DDSLoader=l}(pixi_compressed_textures||(pixi_compressed_textures={})),function(e){var t,c=((t={})[0]=35841,t[1]=35843,t[2]=35840,t[3]=35842,t[6]=36196,t[7]=33776,t[9]=33778,t[5]=33779,t),r=function(t){function h(e){return t.call(this,e)||this}return __extends(h,t),h.prototype.load=function(e){if(!h.test(e))throw"Invalid magic number in PVR header";var t=new Int32Array(e,0,13),r=t[2],i=c[r]||-1,n=t[7],o=t[6],a=t[11],s=t[12]+52,l=new Uint8Array(e,s),u=this._image;return this._format=i,u.init(u.src,l,"PVR",n,o,a,i),u},h.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},h.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}},h.type="PVR",h}(e.AbstractInternalLoader);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,c=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),h=((t={})[u]=-1,t[r]=36196,t[i]=33776,t[n]=33779,t[o]=35840,t[a]=35842,t[s]=37808,t),f=Object.keys(h).reduce(function(e,t){return e[h[+t]]=+t,e},{}),p=function(r){function h(e){var t=r.call(this,e)||this;return t.type="BASIS",t._file=void 0,t}return __extends(h,r),h.test=function(e){var t=1262195===new Uint32Array(e,0,1)[0]&&!!h.BASIS_BINDING,r=h.RGB_FORMAT&&h.RGBA_FORMAT;return!t&&r&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),r&&t},h.bindTranscoder=function(e,i){if(!e||!i)throw"Invalid state! undef fileCtr or ext invalid!";var t=Object.keys(i).reduce(function(e,t){var r=i[t];return r?Object.assign(e,r.__proto__):e},{}),r=void 0,n=void 0;for(var o in t){var a=t[o];if(void 0!==f[a]){var s=f[a];c[s]?n={native:a,name:o,basis:s}:r={native:a,name:o,basis:s}}}h.RGB_FORMAT=r||n,h.RGBA_FORMAT=n||r,h.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+h.RGB_FORMAT.name+"\nRGBA:"+h.RGBA_FORMAT.name),l.RegisterCompressedLoader(h),l.RegisterCompressedExtensions("basis")},h.prototype.load=function(e){if(!h.test(e))throw"BASIS Transcoder not binded or transcoding not supported =(!";return this._loadAsync(e),this._image},h.prototype._loadAsync=function(e){var t=performance.now(),r=new h.BASIS_BINDING(new Uint8Array(e)),i=r.getImageWidth(0,0),n=r.getImageHeight(0,0),o=r.getHasAlpha(),a=this._image;if(!r.startTranscoding())throw"Transcoding error!";var s=o?h.RGBA_FORMAT:h.RGB_FORMAT;console.log("Grats! BASIS will be transcoded to:",s);var l=new Uint8Array(r.getImageTranscodedSizeInBytes(0,0,s.basis));if(!r.transcodeImage(l,0,0,s.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=s.native,this._file=r;var u=s.name.replace("COMPRESSED_","");return Promise.resolve(a.init(a.src,l,"BASIS|"+u,i,n,1,s.native))},h.prototype.levelBufferSize=function(e,t,r){return this._file?this._file.getImageTranscodedSizeInBytes(0,r,f[this._format]):void 0},h.BASIS_BINDING=void 0,h}(l.AbstractInternalLoader);l.BASISLoader=p}(pixi_compressed_textures||(pixi_compressed_textures={})),function(i){var p=window.CRN_Module;var d=[33776,33778,33779],e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.load=function(e){var t=e.byteLength,r=new Uint8Array(e),i=p._malloc(t);!function(e,t,r,i){for(var n=r/4,o=i%4,a=new Uint32Array(e.buffer,0,(i-o)/4),s=new Uint32Array(t.buffer),l=0;li.count)){var e=new a;return i.workers.push(e),e.init(t,r).then(function(){r=e.binary,o()})}};return o().then(function(){return i})},e.prototype.transcode=function(t,r){if(!this.workers||!this.workers.length)throw"[TranscoderWorkerPool] Pool empty, populate before!";var n=this.workers,o=void 0,a=0,s=function(e){for(var t=0,r=n;t 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"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,i)},e}(n.Filter),d=function(i){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),i.call(this,"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}",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.uniforms.uOffset=new Float32Array(2),this._pixelSize=new f.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}i&&(e.__proto__=i);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n,o=this.pixelSize.x/t._frame.width,a=this.pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)n=this._kernels[0]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,e.applyFilter(this,t,r,i);else{for(var s,l=e.getFilterTexture(),u=t,h=l,c=this._quality-1,f=0;f threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(n.Filter),i=function(a){function e(e){a.call(this,c,"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"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:p.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._extractFilter=new m(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,i,n){var o=e.getFilterTexture();this._extractFilter.apply(e,t,o,!0,n);var a=e.getFilterTexture();this._blurFilter.apply(e,o,a,!0,n),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,i),e.returnFilterTexture(a),e.returnFilterTexture(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),o=function(t){function e(e){void 0===e&&(e=8),t.call(this,"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}","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.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(n.Filter),a=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","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.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/f.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*f.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return l.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){l.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return l.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){l.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(n.Filter),g=function(a){function e(e,t,r,i){var n,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=p.settings.RESOLUTION),void 0===i&&(i=5),a.call(this),"number"==typeof e?o=n=e:e instanceof f.Point?(n=e.x,o=e.y):Array.isArray(e)&&(n=e[0],o=e[1]),this.blurXFilter=new h.BlurFilterPass(!0,n,t,r,i),this.blurYFilter=new h.BlurFilterPass(!1,o,t,r,i),this.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,this.defaultFilter=new u.AlphaFilter}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,i),this.blurYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(n.Filter),v=function(i){function e(e,t,r){i.call(this,"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}","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.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}i&&(e.__proto__=i);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(n.Filter),_=function(i){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),i.call(this,"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}","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._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}i&&(e.__proto__=i);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,i)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof n.Texture||(e=n.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),i.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(n.Filter),y=function(i){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),i.call(this,"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}","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.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(l.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=l.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(l.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=l.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(n.Filter),b=function(i){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),i.call(this,"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}","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.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(n.Filter),x=function(e){function t(){e.call(this,"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}","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")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(n.Filter),w=function(t){function e(e){t.call(this,"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}","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 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\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 gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\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 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.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(n.Filter),T=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"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}","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.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),k=function(c){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:p.settings.RESOLUTION},e),c.call(this);var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._tintFilter=new c("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}","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 // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new f.Point,this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o;var a=e.shadowOnly,s=e.rotation,l=e.distance,u=e.alpha,h=e.color;this.shadowOnly=a,this.rotation=s,this.distance=l,this.alpha=u,this.color=h,this._updatePadding()}c&&(e.__proto__=c);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(c&&c.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=e.getFilterTexture();this._tintFilter.apply(e,t,n,!0),this._blurFilter.apply(e,n,r,i),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnFilterTexture(n)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateShift()},t.rotation.get=function(){return this.angle/f.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*f.DEG_TO_RAD,this._updateShift()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return l.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){l.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),S=function(t){function e(e){void 0===e&&(e=5),t.call(this,"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}","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.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(n.Filter),P=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","// 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.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=n.Texture.from(this._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=t.filterFrame.width,o=t.filterFrame.height;this.uniforms.dimensions[0]=n,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/n,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,i)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,i=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var n=this._slices,o=1,a=0;a>0,i=e[t];e[t]=e[r],e[r]=i}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),n+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")";t[3*i]=-1;for(var n=0;n 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.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,i)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(n.Filter),M=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var i=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),n=(2*Math.PI/i).toFixed(7);o.call(this,"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}","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\}/,n)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,i){this.uniforms.thickness[0]=this.thickness/t._frame.width,this.uniforms.thickness[1]=this.thickness/t._frame.height,e.applyFilter(this,t,r,i)},e.color.get=function(){return l.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){l.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(n.Filter);M.MIN_SAMPLES=1,M.MAX_SAMPLES=100;var D=function(t){function e(e){void 0===e&&(e=10),t.call(this,"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}","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.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(n.Filter),R=function(n){function e(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),n.call(this,"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}","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._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=i}n&&(e.__proto__=n);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,i)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),z=function(t){function e(e){t.call(this,"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}","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.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(n.Filter),F=function(i){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),i.call(this,"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}","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.red=e,this.green=t,this.blue=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(n.Filter),L=function(i){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),i.call(this,"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}","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.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}i&&(e.__proto__=i);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),j=function(i){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),i.call(this,"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}","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.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}i&&(e.__proto__=i);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(l.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=l.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(n.Filter),N=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this,"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}","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.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new f.Point(0,window.innerHeight/2),this.uniforms.end=i||new f.Point(600,window.innerHeight/2),this.uniforms.delta=new f.Point(30,30),this.uniforms.texSize=new f.Point(window.innerWidth,window.innerHeight),this.updateDelta()}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(n.Filter),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(N),U=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(N),X=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this),this.tiltShiftXFilter=new B(e,t,r,i),this.tiltShiftYFilter=new U(e,t,r,i)}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture();this.tiltShiftXFilter.apply(e,t,i),this.tiltShiftYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(n.Filter),H=function(i){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),i.call(this,"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}","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.radius=e,this.angle=t,this.padding=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),W=function(n){function e(e,t,r,i){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 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"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=i}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=i,e.AsciiFilter=o,e.BevelFilter=a,e.BloomFilter=g,e.BulgePinchFilter=v,e.CRTFilter=w,e.ColorMapFilter=_,e.ColorReplaceFilter=y,e.ConvolutionFilter=b,e.CrossHatchFilter=x,e.DotFilter=T,e.DropShadowFilter=k,e.EmbossFilter=S,e.GlitchFilter=P,e.GlowFilter=E,e.GodrayFilter=C,e.KawaseBlurFilter=d,e.MotionBlurFilter=A,e.MultiColorReplaceFilter=I,e.OldFilmFilter=O,e.OutlineFilter=M,e.PixelateFilter=D,e.RGBSplitFilter=F,e.RadialBlurFilter=R,e.ReflectionFilter=z,e.ShockwaveFilter=L,e.SimpleLightmapFilter=j,e.TiltShiftAxisFilter=N,e.TiltShiftFilter=X,e.TiltShiftXFilter=B,e.TiltShiftYFilter=U,e.TwistFilter=H,e.ZoomBlurFilter=W,e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),pixi_projection,pixi_projection;Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},function(p,v){"use strict";var t,f,d=function(){function f(e,t,r){this.value=e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:p.ParticleUtils.generateEase(r):null}return f.createList=function(e){if("list"in e){var t=e.list,r=void 0,i=void 0,n=t[0],o=n.value,a=n.time;if(i=r=new f("string"==typeof o?p.ParticleUtils.hexToRGB(o):o,a,e.ease),2a.time;)n=a,a=e[++o];l=(l-n.time)/(a.time-n.time);var u=f.hexToRGB(n.value),h=f.hexToRGB(a.value),c={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 d(c,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 n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?a:r:e.isStepped?this.interpolate=this.isColor?c:u:this.interpolate=this.isColor?l:s,this.ease=this.current.ease},e}();function r(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function a(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,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function s(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 l(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,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function u(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 c(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 p.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}var m,g=function(r){function i(e){var t=r.call(this)||this;return t.emitter=e,t.anchor.x=t.anchor.y=.5,t.velocity=new v.Point,t.rotationSpeed=0,t.rotationAcceleration=0,t.maxLife=0,t.age=0,t.ease=null,t.extraData=null,t.alphaList=new o,t.speedList=new o,t.speedMultiplier=1,t.acceleration=new v.Point,t.maxSpeed=NaN,t.scaleList=new o,t.scaleMultiplier=1,t.colorList=new o(!0),t._doAlpha=!1,t._doScale=!1,t._doSpeed=!1,t._doAcceleration=!1,t._doColor=!1,t._doNormalMovement=!1,t._oneOverLife=0,t.next=null,t.prev=null,t.init=t.init,t.Particle_init=i.prototype.init,t.update=t.update,t.Particle_update=i.prototype.update,t.Sprite_destroy=r.prototype.destroy,t.Particle_destroy=i.prototype.destroy,t.applyArt=t.applyArt,t.kill=t.kill,t}return n(i,r),i.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,p.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=p.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=p.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=p.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=p.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},i.prototype.applyArt=function(e){this.texture=e||v.Texture.EMPTY},i.prototype.update=function(e){if(this.age+=e,this.age>=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(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){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){var i=void 0,n=void 0;if(this._doSpeed){var o=this.speedList.interpolate(t)*this.speedMultiplier;p.ParticleUtils.normalize(this.velocity),p.ParticleUtils.scaleBy(this.velocity,o),i=this.velocity.x*e,n=this.velocity.y*e}else if(this._doAcceleration){var a=this.velocity.x,s=this.velocity.y;if(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed){var l=p.ParticleUtils.length(this.velocity);l>this.maxSpeed&&p.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/l)}i=(a+this.velocity.x)/2*e,n=(s+this.velocity.y)/2*e}else i=this.velocity.x*e,n=this.velocity.y*e;this.position.x+=i,this.position.y+=n}if(this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration){var u=this.rotationSpeed+this.rotationAcceleration*e;this.rotation+=(this.rotationSpeed+u)/2*e,this.rotationSpeed=u}else 0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x));return t},i.prototype.kill=function(){this.emitter.recycle(this)},i.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},i.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(p.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles)this._spawnTimer+=this._frequency;else{var l=void 0;if(l=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var p=void 0;if(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,u,h,t),p.init(),p.update(-this._spawnTimer),p.parent){var d=this._parent.children;if(d[0]==p)d.shift();else if(d[d.length-1]==p)d.pop();else{var m=d.indexOf(p);d.splice(m,1)}this.addAtBack?d.unshift(p):d.push(p)}else 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}}this._spawnTimer+=this._frequency}}if(this._posChanged&&(this._prevEmitterPos.x=a,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){var g=this._completeCallback;this._completeCallback=null,g()}this._destroyWhenComplete&&this.destroy()}}},e.prototype.applyAdditionalProperties=function(e){},e.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},e.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,b.x=Math.random()*this.spawnRect.width+this.spawnRect.x,b.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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,b.x=Math.random()*this.spawnCircle.radius,b.y=0,p.ParticleUtils.rotatePoint(360*Math.random(),b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnRing=function(e,t,r){var i=this.spawnCircle;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?b.x=Math.random()*(i.radius-i.minRadius)+i.minRadius:b.x=i.radius,b.y=0;var n=360*Math.random();e.rotation+=n,p.ParticleUtils.rotatePoint(n,b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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(b),0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.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},e.prototype.cleanup=function(){var e,t;for(e=this._activeParticlesFirst;e;e=t)t=e.next,this.recycle(e),e.parent&&e.parent.removeChild(e);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},e.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},e}(),w=new v.Point,T=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],k=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(T).join("|"),"g"),S=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new v.Point,t.movement=0,t}return n(e,r),e.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},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,w.x=this.movement,w.y=this.path(this.movement),p.ParticleUtils.rotatePoint(this.initialRotation,w),this.position.x=this.initialPosition.x+w.x,this.position.y=this.initialPosition.y+w.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return g.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(k),r=t.length-1;0<=r;--r)0<=T.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){p.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else p.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(g),P=function(r){function e(e){var t=r.call(this,e)||this;return t.textures=null,t.duration=0,t.framerate=0,t.elapsed=0,t.loop=!1,t}return n(e,r),e.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},e.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t){this.elapsed+=e,this.elapsed>this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||v.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,i,n,o,a=[],s=0;st[s]&&(i=t[s]),ot[s+1]&&(n=t[s+1]),af[u]){l=c[s];c[s]=c[u],c[u]=l;var h=f[s];f[s]=f[u],f[u]=h}if(t[0]=c[0].x,t[1]=c[0].y,t[2]=c[1].x,t[3]=c[1].y,t[4]=c[2].x,t[5]=c[2].y,t[6]=c[3].x,t[7]=c[3].y,(c[3].x-c[2].x)*(c[1].y-c[2].y)-(c[1].x-c[2].x)*(c[3].y-c[2].y)<0)return t[4]=c[3].x,void(t[5]=c[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var k=new PIXI.Matrix,n=new PIXI.Rectangle,S=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.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},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,i=e.y,n=this.distortion.x,o=this.distortion.y;if(0==n)t.x=r,t.y=i/(1+o*r);else if(0==o)t.y=i,t.x=r/(1+n*i);else{var a=.5*(i*n-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * vSamplerSize;\n \n// if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n// pixels.y < vFrame.y || pixels.y > vFrame.w) {\n// discard;\n// }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n//gl_FragColor = color * rColor;\n}",geometryClass:s,vertexSize:16},e),i=t.vertex,n=t.fragment,o=t.vertexSize,a=t.geometryClass;return function(r){function e(e){var t=r.call(this,e)||this;return t.defUniforms={translationMatrix:new PIXI.Matrix,distortion:new Float32Array([0,0])},t.size=1e3,t.forceMaxTextures=1,t.shaderGenerator=new PIXI.BatchShaderGenerator(i,n),t.geometryClass=a,t.vertexSize=o,t}return __extends(e,r),e.prototype.getUniforms=function(e){var t=e.proj;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.packInterleavedGeometry=function(e,t,r,i,n){for(var o=t.uint32View,a=t.float32View,s=i/this.vertexSize,l=e.indices,u=e.vertexData,h=e._texture._frame,c=e.aTrans,f=e._texture.baseTexture,p=f._batchLocation,d=f.realWidth,m=f.realHeight,g=f.resolution,v=Math.min(e.worldAlpha,1),_=v<1&&e._texture.baseTexture.alphaMode?b(e._tintRGB,v):e._tintRGB+(255*v<<24),y=0;y=o.TRANSFORM_STEP.PROJ?(i||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(e,r):this.proj.world.applyInverse(e,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copyFrom(e),n===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var l,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=l=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT",t[t.AXIS_XR=5]="AXIS_XR";var i=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,i,n,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=i,a[5]=0,a[6]=n,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,i=this.mat3;return e?(r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7]):(r[0]=i[0],r[1]=i[3],r[2]=i[6],r[3]=i[1],r[4]=i[4],r[5]=i[7],r[6]=i[2],r[7]=i[5]),r[8]=i[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,i=e.x,n=e.y,o=1/(r[2]*i+r[5]*n+r[8]);return t.x=o*(r[0]*i+r[3]*n+r[6]),t.y=o*(r[1]*i+r[4]*n+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,i){var n=this.mat3;n[0]=e*n[0]+r*n[2],n[1]=t*n[1]+i*n[2],n[3]=e*n[3]+r*n[5],n[4]=t*n[4]+i*n[5],n[6]=e*n[6]+r*n[8],n[7]=t*n[7]+i*n[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,i=e.x,n=e.y,o=r[0],a=r[3],s=r[6],l=r[1],u=r[4],h=r[7],c=r[2],f=r[5],p=r[8],d=(p*u-h*f)*i+(-p*a+s*f)*n+(h*a-s*u),m=(-p*l+h*c)*i+(p*o-s*c)*n+(-h*o+s*l),g=(f*l-u*c)*i+(-f*o+a*c)*n+(u*o-a*l);return t.x=d/g,t.y=m/g,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=u*o-a*l,c=-u*n+a*s,f=l*n-o*s,p=t*h+r*c+i*f;return p&&(p=1/p,e[0]=h*p,e[1]=(-u*r+i*l)*p,e[2]=(a*r-i*o)*p,e[3]=c*p,e[4]=(u*t-i*s)*p,e[5]=(-a*t+i*n)*p,e[6]=f*p,e[7]=(-l*t+r*s)*p,e[8]=(o*t-r*n)*p),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo2dOr3d=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copyTo=function(e,t,r){var i=this.mat3,n=1/i[8],o=i[6]*n,a=i[7]*n;if(e.a=(i[0]-i[2]*o)*n,e.b=(i[1]-i[2]*a)*n,e.c=(i[3]-i[5]*o)*n,e.d=(i[4]-i[5]*a)*n,e.tx=o,e.ty=a,2<=t){var s=e.a*e.d-e.b*e.c;r||(s=Math.abs(s)),t===l.POINT?(s=0>0,0!==f._cycle&&f._cycle===f._totalTime/a&&m<=e&&f._cycle--,f._time=f._totalTime-f._cycle*a,f._yoyo&&0!=(1&f._cycle)&&(f._time=v-f._time,(c=f._yoyoEase||f.vars.yoyoEase)&&(f._yoyoEase||(!0!==c||f._initted?f._yoyoEase=c=!0===c?f._ease:c instanceof Ease?c:Ease.map[c]:(c=f.vars.ease,f._yoyoEase=c=c?c instanceof Ease?c:"function"==typeof c?new Ease(c,f.vars.easeParams):Ease.map[c]||y.defaultEase:y.defaultEase)),f.ratio=c?1-c.getRatio((v-f._time)/v):0)),f._time>v?f._time=v:f._time<0&&(f._time=0)),f._easeType&&!c?(s=f._time/v,(1===(l=f._easeType)||3===l&&.5<=s)&&(s=1-s),3===l&&(s*=2),1===(u=f._easePower)?s*=s:2===u?s*=s*s:3===u?s*=s*s*s:4===u&&(s*=s*s*s*s),f.ratio=1===l?1-s:2===l?s:f._time/v<.5?s/2:1-s/2):c||(f.ratio=f._ease.getRatio(f._time/v))),d!==f._time||r||g!==f._cycle){if(!f._initted){if(f._init(),!f._initted||f._gc)return;if(!r&&f._firstPT&&(!1!==f.vars.lazy&&f._duration||f.vars.lazy&&!f._duration))return f._time=d,f._totalTime=m,f._rawPrevTime=_,f._cycle=g,x.lazyTweens.push(f),void(f._lazy=[e,t]);!f._time||i||c?i&&this._ease._calcEnd&&!c&&(f.ratio=f._ease.getRatio(0===f._time?0:1)):f.ratio=f._ease.getRatio(f._time/v)}for(!1!==f._lazy&&(f._lazy=!1),f._active||!f._paused&&f._time!==d&&0<=e&&(f._active=!0),0===m&&(2===f._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},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return 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)},r._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},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._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||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.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)},r._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},r.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)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._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)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.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},r.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)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}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}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.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)d(e[r],a,t);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=f.length,this._lengths=f.lengths,this._segments=f.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}if(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,f=this._segCount,p=this._func,d=this._target,m=e!==this._startRatio;if(this._timeRes){if(u=this._lengths,h=this._curSeg,c=e*this._length,i=this._li,c>this._l2&&i=c;);0===i&&cthis._s2&&i=c;);0===i&&c>0)*(1/f))*f;for(r=1-a,i=this._props.length;-1<--i;)n=this._props[i],s=(a*a*(o=this._beziers[n][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s;if(this._autoRotate){var g,v,_,y,b,x,w,T=this._autoRotate;for(i=T.length;-1<--i;)n=T[i][2],x=T[i][3]||0,w=!0===T[i][4]?1:k,o=this._beziers[T[i][0]],g=this._beziers[T[i][1]],o&&g&&(o=o[t],g=g[t],v=o.a+(o.b-o.a)*a,v+=((y=o.b+(o.c-o.b)*a)-v)*a,y+=(o.c+(o.d-o.c)*a-y)*a,_=g.a+(g.b-g.a)*a,_+=((b=g.b+(g.c-g.b)*a)-_)*a,b+=(g.c+(g.d-g.c)*a-b)*a,s=m?Math.atan2(b-_,y-v)*w+x:this._initialRotations[i],this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s)}}}),e=g.prototype,g.bezierThrough=p,g.cubicToQuadratic=S,g._autoCSS=!0,g.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},g._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,p=t._parseToProxy,d=t._setPluginRatio,m=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,i,n,o){t instanceof Array&&(t={values:t}),o=new g;var a,s,l,u=t.values,h=u.length-1,c=[],f={};if(h<0)return n;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];return 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),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(o,B){var d,k,S,m,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},u=_gsScope._gsDefine.globals,g={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.3",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var E,v,_,L,y,P,C,A,t,r,I=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,n=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi,h=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,M=/(?:\d|\-|\+|=|#|\.)*/g,D=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,l=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,c=function(e,t){return t.toUpperCase()},p=/(?:Left|Right|Width)/i,f=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,R=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,z=/,(?=[^\)]*(?:\(|$))/gi,F=/[\s,\(]/i,j=Math.PI/180,X=180/Math.PI,N={},i={style:{}},H=_gsScope.document||{createElement:function(){return i}},W=function(e,t){var r=H.createElementNS?H.createElementNS(t||"http://www.w3.org/1999/xhtml",e):H.createElement(e);return r.style?r:H.createElement(e)},q=W("div"),G=W("img"),V=U._internals={_specialProps:g},Y=(_gsScope.navigator||{}).userAgent||"",Z=(t=Y.indexOf("Android"),r=W("a"),_=-1!==Y.indexOf("Safari")&&-1===Y.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),me[e])r=me[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=f=e.match(I),t){if(-1!==e.indexOf("="))return e.match(O)}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)}},we=(V._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.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:l)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:l=o,o=u}this._firstPT=s}return!0},e.parse=function(e,t,r,i){var n,o,a,s,l,u,h,c,f,p,d=e.style;for(n in t){if(u=t[n],o=g[n],"function"!=typeof u||o&&o.allowFunc||(u=u(A,C)),o)r=o.parse(e,u,n,this,r,i,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",re(e).getPropertyValue(n)+"",u+"",n,!1,n);continue}l=ie(e,n,S)+"",f="string"==typeof u,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||f&&w.test(u)?(f||(u=(3<(u=ve(u)).length?"rgba(":"rgb(")+u.join(",")+")"),r=Se(d,n,l,u,!0,"transparent",r,0,i)):f&&F.test(u)?r=Se(d,n,l,u,!0,null,r,0,i):(h=(a=parseFloat(l))||0===a?l.substr((a+"").length):"",""!==l&&"auto"!==l||(h="width"===n||"height"===n?(a=he(e,n,S),"px"):"left"===n||"top"===n?(a=oe(e,n,S),"px"):(a="opacity"!==n?0:1,"")),""===(c=(p=f&&"="===u.charAt(1))?(s=parseInt(u.charAt(0)+"1",10),u=u.substr(2),s*=parseFloat(u),u.replace(M,"")):(s=parseFloat(u),f?u.replace(M,""):""))&&(c=n in k?k[n]:h),u=s||0===s?(p?s+a:s)+c:t[n],h!==c&&(""===c&&"lineHeight"!==n||(s||0===s)&&a&&(a=ne(e,n,a,h),"%"===c?(a/=ne(e,n,100,"%")/100,!0!==t.strictUnits&&(l=a+"%")):"em"===c||"rem"===c||"vw"===c||"vh"===c?a/=ne(e,n,1,c):"px"!==c&&(s=ne(e,n,s,c),c="px"),p&&(s||0===s)&&(u=s+a+c))),p&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==d[n]&&(u||u+""!="NaN"&&null!=u)?(r=new Te(d,n,s||a||0,0,r,-1,n,!1,0,l,u)).xs0="none"!==u||"display"!==n&&-1===n.indexOf("Style")?u:l:K("invalid "+n+" tween value: "+t[n]):(r=new Te(d,n,a,s-a,r,0,n,!1!==E&&("px"===c||"zIndex"===n),0,l,u)).xs0=c)}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},d.ease=new d(.7,.7),m.config=d.config=function(e,t,r){return new d(e,t,r)},(m=(r=l("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new g).constructor=r,m.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},m.config=r.config=function(e,t){return new r(e,t)},(m=(i=l("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 g).constructor=i,m.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},m.config=i.config=function(e,t,r){return new i(e,t,r)},(m=(t=l("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 g?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},m.config=function(e){return new t(e)},t.ease=new t,c("Bounce",u("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}),u("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)}),u("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})),c("Circ",u("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),u("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),u("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),c("Elastic",(e=function(e,t,r){var i=l("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),n=i.prototype=new g;return n.constructor=i,n.getRatio=t,n.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),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),c("Expo",u("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),u("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),u("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),c("Sine",u("SineOut",function(e){return Math.sin(e*s)}),u("SineIn",function(e){return 1-Math.cos(e*s)}),u("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),l("easing.EaseLookup",{find:function(e){return g.map[e]}},!0),h(n.SlowMo,"SlowMo","ease,"),h(t,"RoughEase","ease,"),h(r,"SteppedEase","ease,"),p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(f,p){"use strict";var d={},i=f.document,m=f.GreenSockGlobals=f.GreenSockGlobals||f,e=m[p];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,n,g,v,o,a,_=function(e){var t,r=e.split("."),i=m;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,r){if(v||g.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 v||g.wake(),this._totalTime};var z=k("TweenLite",function(e,t,r){if(M.call(this,t,r),this.render=z.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:z.selector(e)||e;var i,n,o,a=e.jquery||e.length&&e!==f&&e[0]&&(e[0]===f||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?J[z.defaultOverwrite]:"number"==typeof s?s>>0:J[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=l(e),this._propLookup=[],this._siblings=[],i=0;i=$){for(r in $=g.frame+(parseInt(z.autoSleep,10)||120),V){for(e=(t=V[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete V[r]}if((!(r=Q._first)||r._paused)&&z.autoSleep&&!K._first&&1===g._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||g.sleep()}}},g.addEventListener("tick",M._updateRoot);var te=function(e,t,r){var i,n,o=e._gsTweenID;if(V[o||(e._gsTweenID=o="t"+Y++)]||(V[o]={target:e,tweens:[]}),t&&((i=V[o].tweens)[n=i.length]=t,r))for(;-1<--n;)i[n]===t&&i.splice(n,1);return V[o].tweens},re=function(e,t,r,i){var n,o,a=e.vars.onOverwrite;return a&&(n=a(e,t,r,i)),(a=z.onOverwrite)&&(o=a(e,t,r,i)),!1!==n&&!1!==o},ie=function(e,t,r,i,n){var o,a,s,l;if(1===i||4<=i){for(l=n.length,o=0;oh&&((p||!s._initted)&&h-s._startTime<=2e-8||(c[f++]=s)));for(o=f;-1<--o;)if(l=(s=c[o])._firstPT,2===i&&s._kill(r,e,t)&&(a=!0),2!==i||!s._firstPT&&s._initted&&l){if(2!==i&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},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?y:(o+=e.totalDuration()/e._timeScale/n)>t+y?0:o-t-y};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=z.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},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.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=k("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,i),this._overwriteProps=n||[]},!0===e.global),s=a.prototype=new oe(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,oe.activate([a]),a},t=f._gsQueue){for(r=0;r>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}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}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.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},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return 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)},r._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},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._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||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.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)},r._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},r.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)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._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)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.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},r.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)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0+~]|"+F+")"+F+"*"),W=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),q=new RegExp(N),G=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+z+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/[+~]/,$=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig"),ee=function(e,t,r){var i="0x"+t-65536;return i!=i||r?t:i<0?String.fromCharCode(65536+i):String.fromCharCode(i>>10|55296,1023&i|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){w()},ne=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{M.apply(t=D.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){O.apply(e,D.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}function oe(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:_)!==T&&w(t),t=t||T,k)){if(11!==f&&(l=K.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))&&v(t,a)&&a.id===n)return r.push(a),r}else{if(l[2])return M.apply(r,t.getElementsByTagName(e)),r;if((n=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return M.apply(r,t.getElementsByClassName(n)),r}if(p.qsa&&!E[e+" "]&&(!g||!g.test(e))){if(1!==f)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=S),o=(u=d(e)).length;o--;)u[o]="#"+s+" "+ve(u[o]);h=u.join(","),c=Q.test(e)&&me(t.parentNode)||t}if(h)try{return M.apply(r,c.querySelectorAll(h)),r}catch(e){}finally{s===S&&t.removeAttribute("id")}}}return m(e.replace(U,"$1"),t,r,i)}function ae(){var i=[];return function e(t,r){return i.push(t+" ")>b.cacheLength&&delete e[i.shift()],e[t+" "]=r}}function se(e){return e[S]=!0,e}function le(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function he(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 ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function pe(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&&ne(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function de(a){return se(function(o){return o=+o,se(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=oe.support={},n=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,i=e?e.ownerDocument||e:_;return i!==T&&9===i.nodeType&&i.documentElement&&(a=(T=i).documentElement,k=!n(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ie,!1):r.attachEvent&&r.attachEvent("onunload",ie)),p.attributes=le(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=le(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=J.test(T.getElementsByClassName),p.getById=le(function(e){return a.appendChild(e).id=S,!T.getElementsByName||!T.getElementsByName(S).length}),p.getById?(b.filter.ID=function(e){var t=e.replace($,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace($,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){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&&k)return t.getElementsByClassName(e)},s=[],g=[],(p.qsa=J.test(T.querySelectorAll))&&(le(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+F+"*(?:value|"+z+")"),e.querySelectorAll("[id~="+S+"-]").length||g.push("~="),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||g.push(".#.+[+~]")}),le(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+F+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(p.matchesSelector=J.test(h=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&le(function(e){p.disconnectedMatch=h.call(e,"*"),h.call(e,"[s!='']:x"),s.push("!=",N)}),g=g.length&&new RegExp(g.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(a.compareDocumentPosition),v=t||J.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},C=t?function(e,t){if(e===t)return u=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:l?R(l,e)-R(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===T?-1:t===T?1:n?-1:o?1:l?R(l,e)-R(l,t):0;if(n===o)return he(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?he(a[i],s[i]):a[i]===_?-1:s[i]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(W,"='$1']"),p.matchesSelector&&k&&!E[t+" "]&&(!s||!s.test(t))&&(!g||!g.test(t)))try{var r=h.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($,ee),e[3]=(e[3]||e[4]||e[5]||"").replace($,ee),"~="===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]||oe.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]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&q.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($,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=f[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&f(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,i,n){return function(e){var t=oe.attr(e,r);return null==t?"!="===i:!i||(t+="","="===i?t===n:"!="===i?t!==n:"^="===i?n&&0===t.indexOf(n):"*="===i?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function A(e,r,i){return _(r)?S.grep(e,function(e,t){return!!r.call(e,t,e)!==i}):r.nodeType?S.grep(e,function(e){return e===r!==i}):"string"!=typeof r?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,r){var i,n;if(!e)return this;if(r=r||I,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(S):S.makeArray(e,this);if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!i[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:k,!0)),C.test(i[1])&&S.isPlainObject(t))for(i in t)_(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(n=k.getElementById(i[2]))&&(this[0]=n,this.length=1),this}).prototype=S.fn,I=S(k);var M=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};function R(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ce={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function fe(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?S.merge([e],r):r}function pe(e,t){for(var r=0,i=e.length;rx",v.noCloneChecked=!!de.cloneNode(!0).lastChild.defaultValue;var _e=k.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function ke(){try{return k.activeElement}catch(e){}}function Se(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)Se(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=Te;else if(!n)return e;return 1===o&&(a=n,(n=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,n,i,r)})}S.event={global:{},add:function(t,e,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.get(t);if(g)for(r.handler&&(r=(o=r).handler,n=o.selector),n&&S.find.matchesSelector(_e,n),r.guid||(r.guid=S.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(z)||[""]).length;u--;)p=m=(s=xe.exec(e[u])||[])[1],d=(s[2]||"").split(".").sort(),p&&(c=S.event.special[p]||{},p=(n?c.delegateType:c.bindType)||p,c=S.event.special[p]||{},h=S.extend({type:p,origType:m,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&S.expr.match.needsContext.test(n),namespace:d.join(".")},o),(f=l[p])||((f=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(t,i,d,a)||t.addEventListener&&t.addEventListener(p,a)),c.add&&(c.add.call(t,h),h.handler.guid||(h.handler.guid=r.guid)),n?f.splice(f.delegateCount++,0,h):f.push(h),S.event.global[p]=!0)},remove:function(e,t,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(u=(t=(t||"").match(z)||[""]).length;u--;)if(p=m=(s=xe.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),p){for(c=S.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,g.handle)||S.removeEvent(e,p,g.handle),delete l[p])}else for(p in l)S.event.remove(e,p+t[u],r,i,!0);S.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,r,i,n,o,a,s=S.event.fix(e),l=new Array(arguments.length),u=(Z.get(this,"events")||{})[s.type]||[],h=S.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ee=/\s*$/g;function Ie(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var r,i,n,o,a,s,l,u;if(1===t.nodeType){if(Z.hasData(e)&&(o=Z.access(e),a=Z.set(t,o),u=o.events))for(n in delete a.handle,a.events={},u)for(r=0,i=u[n].length;r")},clone:function(e,t,r){var i,n,o,a,s,l,u,h=e.cloneNode(!0),c=S.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=fe(h),i=0,n=(o=fe(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)}),k.head.appendChild(i[0])},abort:function(){n&&n()}}});var Xt,Ht=[],Wt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Ht.pop()||S.expando+"_"+bt++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,r){var i,n,o,a=!1!==e.jsonp&&(Wt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Wt,"$1"+i):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||S.error(i+" was not called"),o[0]},e.dataTypes[0]="json",n=T[i],T[i]=function(){o=arguments},r.always(function(){void 0===n?S(T).removeProp(i):T[i]=n,e[i]&&(e.jsonpCallback=t.jsonpCallback,Ht.push(i)),o&&_(n)&&n(o[0]),o=n=void 0}),"script"}),v.createHTMLDocument=((Xt=k.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),S.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((i=(t=k.implementation.createHTMLDocument("")).createElement("base")).href=k.location.href,t.head.appendChild(i)):t=k),o=!r&&[],(n=C.exec(e))?[t.createElement(n[1])]:(n=ve([e],t,o),o&&o.length&&S(o).remove(),S.merge([],n.childNodes)));var i,n,o},S.fn.load=function(e,t,r){var i,n,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(i):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,r){var i,n,o,a,s,l,u=S.css(e,"position"),h=S(e),c={};"static"===u&&(e.style.position="relative"),s=h.offset(),o=S.css(e,"top"),l=S.css(e,"left"),n=("absolute"===u||"fixed"===u)&&-1<(o+l).indexOf("auto")?(a=(i=h.position()).top,i.left):(a=parseFloat(o)||0,parseFloat(l)||0),_(t)&&(t=t.call(e,r,S.extend({},s))),null!=t.top&&(c.top=t.top-s.top+a),null!=t.left&&(c.left=t.left-s.left+n),"using"in t?t.using.call(e,c):h.css(c)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,r,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),r=i.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"===S.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"===S.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((n=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),n.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-S.css(i,"marginTop",!0),left:t.left-n.left-S.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===S.css(e,"position");)e=e.offsetParent;return e||_e})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var o="pageYOffset"===n;S.fn[t]=function(e){return X(this,function(e,t,r){var i;if(y(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)}}),S.each(["top","left"],function(e,r){S.cssHooks[r]=Be(v.pixelPosition,function(e,t){if(t)return t=Ne(e,r),Fe.test(t)?S(e).position()[r]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(i,o){S.fn[o]=function(e,t){var r=arguments.length&&(i||"boolean"!=typeof e),n=i||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var i;return y(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?S.css(e,t,n):S.style(e,t,r,n)},s,r?e:void 0,r)}})}),S.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){S.fn[r]=function(e,t){return 0>>0,i=(r*=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),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var r=new o(e),i=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.alea=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],16:[function(e,t,r){!function(e,t,r){function o(e){var n=this,t="";n.next=function(){var e=n.b,t=n.c,r=n.d,i=n.a;return e=e<<25^e>>>7^t,t=t-r|0,r=r<<24^r>>>8^i,i=i-e|0,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};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.tychei=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],17:[function(e,t,r){!function(e,t,r){function o(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};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor128=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],18:[function(e,t,r){!function(e,t,r){function o(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^=t<<13,e^=e<<17,t^=t>>>15,e^=e>>>12,t=i[n]=t^e,o.i=n,t+(r^r>>>16)|0},function(e,t){var r,i,n,o,a,s=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(r=s[127&o]^=i+a)?n+1:0);for(128<=n&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;0>>15,r^=r>>>12,s[n]=i^r;e.w=a,e.X=s,e.i=n}(o,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.X&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor4096=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],19:[function(e,t,r){!function(e,t,r){function o(e){var n=this;n.next=function(){var e,t,r=n.x,i=n.i;return e=r[i],t=(e^=e>>>7)^e<<24,t^=(e=r[i+1&7])^e>>>10,t^=(e=r[i+3&7])^e>>>3,t^=(e=r[i+4&7])^e<<7,e=r[i+7&7],t^=(e^=e<<13)^e<<9,r[i]=t,n.i=i+1&7,t},function(e,t){var r,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.x&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorshift7=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],20:[function(e,t,r){!function(e,t,r){function o(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 a(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 i(e,t){var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorwow=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],21:[function(t,r,e){!function(s,l){var u,h=this,c=256,f=6,p="random",d=l.pow(c,f),m=l.pow(2,52),g=2*m,v=c-1;function e(e,t,r){var i=[],n=b(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,x(s)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(c):(e=new Uint8Array(c),(h.crypto||h.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=h.navigator,r=t&&t.plugins;return[+new Date,h,r,h.screen,x(s)]}}():e,3),i),o=new _(i),a=function(){for(var e=o.g(f),t=d,r=0;e>>=1;return(e+r)/t};return a.int32=function(){return 0|o.g(4)},a.quick=function(){return o.g(4)/4294967296},a.double=a,b(x(o.S),s),(t.pass||r||function(e,t,r,i){return i&&(i.S&&y(i,o),e.state=function(){return y(o,{})}),r?(l[p]=e,t):e})(a,n,"global"in t?t.global:this==l,t.state)}function _(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?c-r:r}function g(e){return e-c*Math.floor(e/c)}t.exports={UP:o,DOWN:a,LEFT:s,RIGHT:0,NORTH:l,SOUTH:u,WEST:h,EAST:0,PI_2:c,PI_QUARTER:f,PI_HALF:p,toDegrees:function(e){return e*i},toRadians:function(e){return e*n},isAngleBetween:function(e,t,r){if(((r-t)%c+c)%c>=Math.PI){var i=t;t=r,r=i}return t<=r?t<=e&&e<=r:t<=e||e<=r},differenceAnglesSign:d,differenceAngles:m,shortestAngle:function(e,t){return m(t,e)*d(t,e)+e},normalize:g,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=m(e,s),r=m(e,0),i=m(e,o),n=m(e,a);return t<=r&&t<=i&&t<=n?s:r<=i&&r<=n?0:i<=n?o:a},equals:function(e,t,r){return r?m(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 s.range(e,t)}var i=s.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){var a={h:s.range(e,t),s:s.range(r,i,!0),l:s.range(n,o,!0)};return this.hslToHex(a)},randomGoldenRatioHSL:function(e,t,r){for(var i=s.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}if(this.toY){var r=this.toY;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),r.time>=this.time?(this.parent.y=r.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(r.time,r.start,r.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(){if(!this.paused){var e=void 0,t=this.parent.plugins.decelerate;t&&(t.x||t.y)&&(t.x&&t.percentChangeX===t.friction||t.y&&t.percentChangeY===t.friction)&&(((e=this.parent.OOB()).left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.friction));var r=this.parent.plugins.drag||{},i=this.parent.plugins.pinch||{};if(t=t||{},!(r.active||i.active||this.toX&&this.toY||t.x&&t.y)){var n=(e=e||this.parent.OOB()).cornerPoint;if(!this.toX&&!t.x){var o=null;e.left&&this.left?o=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"}))}}}]),i}()},{"./plugin":9}],3:[function(e,t,r){"use strict";var n=function(){function i(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"})}}}}]),i}()},{"./plugin":9,"./utils":12}],4:[function(e,t,r){"use strict";var n=function(){function i(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){if(!this.paused){var 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}}]),i}()},{"./plugin":9,"./utils":12}],6:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.radius))return;var i=Math.atan2(this.target.y-e.y,this.target.x-e.x);t=this.target.x-Math.cos(i)*this.radius,r=this.target.y-Math.sin(i)*this.radius}if(this.speed){var n=t-e.x,o=r-e.y;if(n||o){var a=Math.atan2(r-e.y,t-e.x),s=Math.cos(a)*this.speed,l=Math.sin(a)*this.speed,u=Math.abs(s)>Math.abs(n)?t:e.x+s,h=Math.abs(l)>Math.abs(o)?r:e.y+l;this.parent.moveCenter(u,h),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else this.parent.moveCenter(t,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}}]),n}()},{"./plugin":9}],7:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.radiusSquared){var n=Math.atan2(i.y-r,i.x-t);this.linear?(this.horizontal=Math.round(Math.cos(n))*this.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(n))*this.speed*this.reverse*.06):(this.horizontal=Math.cos(n)*this.speed*this.reverse*.06,this.vertical=Math.sin(n)*this.speed*this.reverse*.06)}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else o.exists(this.left)&&tthis.right?this.horizontal=-1*this.reverse*this.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),o.exists(this.top)&&rthis.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(){if(!this.paused&&(this.horizontal||this.vertical)){var 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"})}}}]),i}()},{"./plugin":9,"./utils":12}],8:[function(e,t,r){"use strict";var n=function(){function i(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;else{var i=this.snapping;this.parent.scale.x=this.ease(i.time,i.startX,i.deltaX,this.time),this.parent.scale.y=this.ease(i.time,i.startY,i.deltaY,this.time)}var n=this.parent.plugins["clamp-zoom"];n&&n.clamp(),this.noMove||(this.center?this.parent.moveCenter(this.center):this.parent.moveCenter(t))}}else this.parent.scale.x===this.x_scale&&this.parent.scale.y===this.y_scale||this.createSnapping()}}},{key:"resume",value:function(){this.snapping=null,function e(t,r,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,r);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,i)}if("value"in n)return n.value;var a=n.get;return void 0!==a?a.call(i):void 0}(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(){function i(e,t){for(var r=0;rthis.time)r=!0,i=this.startX+this.deltaX,n=this.startY+this.deltaY;else{var o=this.ease(t.time,0,1,this.time);i=this.startX+this.deltaX*o,n=this.startY+this.deltaY*o}this.topLeft?this.parent.moveCorner(i,n):this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),r&&(this.removeOnComplete&&this.parent.removePlugin("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{var a=this.topLeft?this.parent.corner:this.parent.center;a.x===this.x&&a.y===this.y||this.snapStart()}}}]),o}()},{"./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(){function i(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}}if(this.clickedAvailable){var a=e.data.global.x-this.last.x,s=e.data.global.y-this.last.y;(this.checkThreshold(a)||this.checkThreshold(s))&&(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=this.trackedPointers;for(var r in t){var i=t[r];-1!==this.touches.indexOf(i.pointerId)&&e.push(i)}return e}},{key:"getPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t)e.push(t[r]);return e}},{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=g[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 o(this,e),this.pluginsSort(),this}},{key:"clamp",value:function(e){return this.plugins.clamp=new s(this,e),this.pluginsSort(),this}},{key:"decelerate",value:function(e){return this.plugins.decelerate=new u(this,e),this.pluginsSort(),this}},{key:"bounce",value:function(e){return this.plugins.bounce=new h(this,e),this.pluginsSort(),this}},{key:"pinch",value:function(e){return this.plugins.pinch=new a(this,e),this.pluginsSort(),this}},{key:"snap",value:function(e,t,r){return this.plugins.snap=new c(this,e,t,r),this.pluginsSort(),this}},{key:"follow",value:function(e,t){return this.plugins.follow=new p(this,e,t),this.pluginsSort(),this}},{key:"wheel",value:function(e){return this.plugins.wheel=new d(this,e),this.pluginsSort(),this}},{key:"clampZoom",value:function(e){return this.plugins["clamp-zoom"]=new l(this,e),this.pluginsSort(),this}},{key:"mouseEdges",value:function(e){return this.plugins["mouse-edges"]=new m(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._worldWidth:this.width},set:function(e){this._worldWidth=e,this.resizePlugins()}},{key:"worldHeight",get:function(){return this._worldHeight?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.extras.Viewport=v,t.exports=v},{"./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 n=function(){function i(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&&i