From d03145e2d1576cb71d2d50c9e7c585d07703dd6d Mon Sep 17 00:00:00 2001 From: liabru Date: Fri, 22 May 2015 00:32:39 +0100 Subject: [PATCH] upgraded pixi.js to v3.0.6 --- demo/js/lib/pixi.js | 12480 +++++++++++++++++++------------------ demo/js/lib/pixi.js.map | 2 +- src/render/RenderPixi.js | 1 + 3 files changed, 6284 insertions(+), 6199 deletions(-) diff --git a/demo/js/lib/pixi.js b/demo/js/lib/pixi.js index 00a1287f..199a3295 100644 --- a/demo/js/lib/pixi.js +++ b/demo/js/lib/pixi.js @@ -11,9 +11,15 @@ core.filters = require('./filters'); core.interaction = require('./interaction'); core.loaders = require('./loaders'); core.mesh = require('./mesh'); -core.ticker = require('./ticker'); // export a premade loader instance +/** + * A premade instance of the loader that can be used to loader resources. + * + * @name loader + * @memberof PIXI + * @property {PIXI.loaders.Loader} + */ core.loader = new core.loaders.Loader(); // mixin the deprecation features. @@ -24,7 +30,7 @@ global.PIXI = core; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./core":29,"./deprecation":76,"./extras":83,"./filters":100,"./interaction":115,"./loaders":118,"./mesh":124,"./polyfill":128,"./ticker":131}],2:[function(require,module,exports){ +},{"./core":29,"./deprecation":78,"./extras":85,"./filters":102,"./interaction":117,"./loaders":120,"./mesh":126,"./polyfill":130}],2:[function(require,module,exports){ (function (process){ /*! * async @@ -1446,508 +1452,508 @@ process.umask = function() { return 0; }; /*! http://mths.be/punycode v1.2.4 by @mathias */ ;(function(root) { - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports; - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - while (length--) { - array[length] = fn(array[length]); - } - return array; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings. - * @private - * @param {String} domain The domain name. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - return map(string.split(regexSeparators), fn).join('.'); - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * http://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols to a Punycode string of ASCII-only - * symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name to Unicode. Only the - * Punycoded parts of the domain name will be converted, i.e. it doesn't - * matter if you call it on a string that has already been converted to - * Unicode. - * @memberOf punycode - * @param {String} domain The Punycode domain name to convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(domain) { - return mapDomain(domain, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name to Punycode. Only the - * non-ASCII parts of the domain name will be converted, i.e. it doesn't - * matter if you call it with a domain that's already in ASCII. - * @memberOf punycode - * @param {String} domain The domain name to convert, as a Unicode string. - * @returns {String} The Punycode representation of the given domain name. - */ - function toASCII(domain) { - return mapDomain(domain, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.2.4', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { // in Rhino or a web browser - root.punycode = punycode; - } + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports; + var freeModule = typeof module == 'object' && module && + module.exports == freeExports && module; + var freeGlobal = typeof global == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + while (length--) { + array[length] = fn(array[length]); + } + return array; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings. + * @private + * @param {String} domain The domain name. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + return map(string.split(regexSeparators), fn).join('.'); + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * http://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols to a Punycode string of ASCII-only + * symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name to Unicode. Only the + * Punycoded parts of the domain name will be converted, i.e. it doesn't + * matter if you call it on a string that has already been converted to + * Unicode. + * @memberOf punycode + * @param {String} domain The Punycode domain name to convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(domain) { + return mapDomain(domain, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name to Punycode. Only the + * non-ASCII parts of the domain name will be converted, i.e. it doesn't + * matter if you call it with a domain that's already in ASCII. + * @memberOf punycode + * @param {String} domain The domain name to convert, as a Unicode string. + * @returns {String} The Punycode representation of the given domain name. + */ + function toASCII(domain) { + return mapDomain(domain, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.2.4', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { // in Rhino or a web browser + root.punycode = punycode; + } }(this)); @@ -3503,6 +3509,16 @@ function Node(i) { },{}],11:[function(require,module,exports){ 'use strict'; +// +// We store our EE objects in a plain object whose properties are event names. +// If `Object.create(null)` is not supported we prefix the event names with a +// `~` to make sure that the built-in object properties are not overridden or +// used as an attack vector. +// We also assume that `Object.create(null)` is available when the event name +// is an ES6 Symbol. +// +var prefix = typeof Object.create !== 'function' ? '~' : false; + /** * Representation of a single EventEmitter function. * @@ -3543,15 +3559,15 @@ EventEmitter.prototype._events = undefined; * @api public */ EventEmitter.prototype.listeners = function listeners(event, exists) { - var prefix = '~'+ event - , available = this._events && this._events[prefix]; + var evt = prefix ? prefix + event : event + , available = this._events && this._events[evt]; if (exists) return !!available; if (!available) return []; - if (this._events[prefix].fn) return [this._events[prefix].fn]; + if (this._events[evt].fn) return [this._events[evt].fn]; - for (var i = 0, l = this._events[prefix].length, ee = new Array(l); i < l; i++) { - ee[i] = this._events[prefix][i].fn; + for (var i = 0, l = this._events[evt].length, ee = new Array(l); i < l; i++) { + ee[i] = this._events[evt][i].fn; } return ee; @@ -3565,11 +3581,11 @@ EventEmitter.prototype.listeners = function listeners(event, exists) { * @api public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var prefix = '~'+ event; + var evt = prefix ? prefix + event : event; - if (!this._events || !this._events[prefix]) return false; + if (!this._events || !this._events[evt]) return false; - var listeners = this._events[prefix] + var listeners = this._events[evt] , len = arguments.length , args , i; @@ -3625,14 +3641,14 @@ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { */ EventEmitter.prototype.on = function on(event, fn, context) { var listener = new EE(fn, context || this) - , prefix = '~'+ event; + , evt = prefix ? prefix + event : event; - if (!this._events) this._events = {}; - if (!this._events[prefix]) this._events[prefix] = listener; + if (!this._events) this._events = prefix ? {} : Object.create(null); + if (!this._events[evt]) this._events[evt] = listener; else { - if (!this._events[prefix].fn) this._events[prefix].push(listener); - else this._events[prefix] = [ - this._events[prefix], listener + if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [ + this._events[evt], listener ]; } @@ -3649,14 +3665,14 @@ EventEmitter.prototype.on = function on(event, fn, context) { */ EventEmitter.prototype.once = function once(event, fn, context) { var listener = new EE(fn, context || this, true) - , prefix = '~'+ event; + , evt = prefix ? prefix + event : event; - if (!this._events) this._events = {}; - if (!this._events[prefix]) this._events[prefix] = listener; + if (!this._events) this._events = prefix ? {} : Object.create(null); + if (!this._events[evt]) this._events[evt] = listener; else { - if (!this._events[prefix].fn) this._events[prefix].push(listener); - else this._events[prefix] = [ - this._events[prefix], listener + if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [ + this._events[evt], listener ]; } @@ -3673,11 +3689,11 @@ EventEmitter.prototype.once = function once(event, fn, context) { * @api public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var prefix = '~'+ event; + var evt = prefix ? prefix + event : event; - if (!this._events || !this._events[prefix]) return this; + if (!this._events || !this._events[evt]) return this; - var listeners = this._events[prefix] + var listeners = this._events[evt] , events = []; if (fn) { @@ -3706,9 +3722,9 @@ EventEmitter.prototype.removeListener = function removeListener(event, fn, conte // Reset the array, or remove it completely if we have no more listeners. // if (events.length) { - this._events[prefix] = events.length === 1 ? events[0] : events; + this._events[evt] = events.length === 1 ? events[0] : events; } else { - delete this._events[prefix]; + delete this._events[evt]; } return this; @@ -3723,8 +3739,8 @@ EventEmitter.prototype.removeListener = function removeListener(event, fn, conte EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { if (!this._events) return this; - if (event) delete this._events['~'+ event]; - else this._events = {}; + if (event) delete this._events[prefix ? prefix + event : event]; + else this._events = prefix ? {} : Object.create(null); return this; }; @@ -3742,6 +3758,11 @@ EventEmitter.prototype.setMaxListeners = function setMaxListeners() { return this; }; +// +// Expose the prefix. +// +EventEmitter.prefixed = prefix; + // // Expose the module. // @@ -3751,28 +3772,28 @@ module.exports = EventEmitter; 'use strict'; function ToObject(val) { - if (val == null) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } + if (val == null) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } - return Object(val); + return Object(val); } module.exports = Object.assign || function (target, source) { - var from; - var keys; - var to = ToObject(target); + var from; + var keys; + var to = ToObject(target); - for (var s = 1; s < arguments.length; s++) { - from = arguments[s]; - keys = Object.keys(Object(from)); + for (var s = 1; s < arguments.length; s++) { + from = arguments[s]; + keys = Object.keys(Object(from)); - for (var i = 0; i < keys.length; i++) { - to[keys[i]] = from[keys[i]]; - } - } + for (var i = 0; i < keys.length; i++) { + to[keys[i]] = from[keys[i]]; + } + } - return to; + return to; }; },{}],13:[function(require,module,exports){ @@ -5405,6 +5426,14 @@ function Resource(name, url, options) { */ this.url = url; + /** + * Stores whether or not this url is a data url. + * + * @member {boolean} + * @readonly + */ + this.isDataUrl = this.url.indexOf('data:') === 0; + /** * The data that was loaded by the resource. * @@ -5937,15 +5966,26 @@ Resource.prototype._determineCrossOrigin = function (url, loc) { * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. */ Resource.prototype._determineXhrType = function () { - var ext = this.url.substr(this.url.lastIndexOf('.') + 1); - - return Resource._xhrTypeMap[ext] || Resource.XHR_RESPONSE_TYPE.TEXT; + return Resource._xhrTypeMap[this._getExtension()] || Resource.XHR_RESPONSE_TYPE.TEXT; }; Resource.prototype._determineLoadType = function () { - var ext = this.url.substr(this.url.lastIndexOf('.') + 1); + return Resource._loadTypeMap[this._getExtension()] || Resource.LOAD_TYPE.XHR; +}; + +Resource.prototype._getExtension = function () { + var url = this.url, + ext; + + if (this.isDataUrl) { + var slashIndex = url.indexOf('/'); + ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); + } + else { + ext = url.substring(url.lastIndexOf('.') + 1); + } - return Resource._loadTypeMap[ext] || Resource.LOAD_TYPE.XHR; + return ext; }; /** @@ -6278,7 +6318,7 @@ module.exports = function () { },{"../../Resource":16,"../../b64":17}],21:[function(require,module,exports){ module.exports={ "name": "pixi.js", - "version": "3.0.5", + "version": "3.0.6", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -6301,9 +6341,9 @@ module.exports={ "async": "^0.9.0", "brfs": "^1.4.0", "earcut": "^2.0.0", - "eventemitter3": "^1.0.1", + "eventemitter3": "^1.1.0", "object-assign": "^2.0.0", - "resource-loader": "^1.5.6" + "resource-loader": "^1.6.0" }, "devDependencies": { "browserify": "^9.0.8", @@ -6320,7 +6360,7 @@ module.exports={ "gulp-sourcemaps": "^1.5.2", "gulp-uglify": "^1.2.0", "gulp-util": "^3.0.4", - "ink-docstrap": "git+https://github.com/Pilatch/docstrap.git", + "jaguarjs-jsdoc": "git+https://github.com/davidshimjs/jaguarjs-jsdoc.git", "jsdoc": "^3.3.0-beta3", "jshint-summary": "^0.4.0", "minimist": "^1.1.1", @@ -6342,8 +6382,8 @@ module.exports={ },{}],22:[function(require,module,exports){ /** * Constant values used in pixi - * @class - * @memberof PIXI + * + * @lends PIXI */ var CONST = { /** @@ -7576,7 +7616,6 @@ DisplayObject.prototype.destroy = function () },{"../const":22,"../math":32,"../textures/RenderTexture":70,"eventemitter3":11}],25:[function(require,module,exports){ var Container = require('../display/Container'), - Sprite = require('../sprites/Sprite'), Texture = require('../textures/Texture'), CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'), CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'), @@ -8357,6 +8396,9 @@ Graphics.prototype._renderCanvas = function (renderer) this._prevTint = this.tint; } + // this code may still be needed so leaving for now.. + // + /* if (this._cacheAsBitmap) { if (this.dirty || this.cachedSpriteDirty) @@ -8376,29 +8418,27 @@ Graphics.prototype._renderCanvas = function (renderer) return; } - else - { - var context = renderer.context; - var transform = this.worldTransform; + */ + var context = renderer.context; + var transform = this.worldTransform; - if (this.blendMode !== renderer.currentBlendMode) - { - renderer.currentBlendMode = this.blendMode; - context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode]; - } + if (this.blendMode !== renderer.currentBlendMode) + { + renderer.currentBlendMode = this.blendMode; + context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode]; + } - var resolution = renderer.resolution; - context.setTransform( - transform.a * resolution, - transform.b * resolution, - transform.c * resolution, - transform.d * resolution, - transform.tx * resolution, - transform.ty * resolution - ); + var resolution = renderer.resolution; + context.setTransform( + transform.a * resolution, + transform.b * resolution, + transform.c * resolution, + transform.d * resolution, + transform.tx * resolution, + transform.ty * resolution + ); - CanvasGraphics.renderGraphics(this, context); - } + CanvasGraphics.renderGraphics(this, context); }; /** @@ -8756,7 +8796,7 @@ Graphics.prototype.destroy = function () { this._localBounds = null; }; -},{"../const":22,"../display/Container":23,"../math":32,"../renderers/canvas/utils/CanvasBuffer":44,"../renderers/canvas/utils/CanvasGraphics":45,"../sprites/Sprite":66,"../textures/Texture":71,"./GraphicsData":26}],26:[function(require,module,exports){ +},{"../const":22,"../display/Container":23,"../math":32,"../renderers/canvas/utils/CanvasBuffer":44,"../renderers/canvas/utils/CanvasGraphics":45,"../textures/Texture":71,"./GraphicsData":26}],26:[function(require,module,exports){ /** * A GraphicsData object. * @@ -9746,7 +9786,7 @@ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData) return true; }; -},{"../../const":22,"../../math":32,"../../renderers/webgl/WebGLRenderer":48,"../../renderers/webgl/utils/ObjectRenderer":62,"../../utils":74,"./WebGLGraphicsData":28,"earcut":10}],28:[function(require,module,exports){ +},{"../../const":22,"../../math":32,"../../renderers/webgl/WebGLRenderer":48,"../../renderers/webgl/utils/ObjectRenderer":62,"../../utils":76,"./WebGLGraphicsData":28,"earcut":10}],28:[function(require,module,exports){ /** * An object containing WebGL specific properties to be used by the WebGL renderer * @@ -9879,6 +9919,7 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), // utils utils: require('./utils'), math: require('./math'), + ticker: require('./ticker'), // display DisplayObject: require('./display/DisplayObject'), @@ -9953,7 +9994,7 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), } }); -},{"./const":22,"./display/Container":23,"./display/DisplayObject":24,"./graphics/Graphics":25,"./graphics/GraphicsData":26,"./graphics/webgl/GraphicsRenderer":27,"./math":32,"./particles/ParticleContainer":38,"./particles/webgl/ParticleRenderer":40,"./renderers/canvas/CanvasRenderer":43,"./renderers/canvas/utils/CanvasBuffer":44,"./renderers/canvas/utils/CanvasGraphics":45,"./renderers/webgl/WebGLRenderer":48,"./renderers/webgl/filters/AbstractFilter":49,"./renderers/webgl/managers/ShaderManager":55,"./renderers/webgl/shaders/Shader":60,"./renderers/webgl/utils/ObjectRenderer":62,"./renderers/webgl/utils/RenderTarget":64,"./sprites/Sprite":66,"./sprites/webgl/SpriteRenderer":67,"./text/Text":68,"./textures/BaseTexture":69,"./textures/RenderTexture":70,"./textures/Texture":71,"./textures/TextureUvs":72,"./textures/VideoBaseTexture":73,"./utils":74}],30:[function(require,module,exports){ +},{"./const":22,"./display/Container":23,"./display/DisplayObject":24,"./graphics/Graphics":25,"./graphics/GraphicsData":26,"./graphics/webgl/GraphicsRenderer":27,"./math":32,"./particles/ParticleContainer":38,"./particles/webgl/ParticleRenderer":40,"./renderers/canvas/CanvasRenderer":43,"./renderers/canvas/utils/CanvasBuffer":44,"./renderers/canvas/utils/CanvasGraphics":45,"./renderers/webgl/WebGLRenderer":48,"./renderers/webgl/filters/AbstractFilter":49,"./renderers/webgl/managers/ShaderManager":55,"./renderers/webgl/shaders/Shader":60,"./renderers/webgl/utils/ObjectRenderer":62,"./renderers/webgl/utils/RenderTarget":64,"./sprites/Sprite":66,"./sprites/webgl/SpriteRenderer":67,"./text/Text":68,"./textures/BaseTexture":69,"./textures/RenderTexture":70,"./textures/Texture":71,"./textures/TextureUvs":72,"./textures/VideoBaseTexture":73,"./ticker":75,"./utils":76}],30:[function(require,module,exports){ var Point = require('./Point'); /** @@ -12224,7 +12265,7 @@ SystemRenderer.prototype.destroy = function (removeView) { this._backgroundColorString = null; }; -},{"../const":22,"../math":32,"../utils":74,"eventemitter3":11}],43:[function(require,module,exports){ +},{"../const":22,"../math":32,"../utils":76,"eventemitter3":11}],43:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), CanvasMaskManager = require('./utils/CanvasMaskManager'), utils = require('../../utils'), @@ -12494,7 +12535,7 @@ CanvasRenderer.prototype._mapBlendModes = function () } }; -},{"../../const":22,"../../math":32,"../../utils":74,"../SystemRenderer":42,"./utils/CanvasMaskManager":46}],44:[function(require,module,exports){ +},{"../../const":22,"../../math":32,"../../utils":76,"../SystemRenderer":42,"./utils/CanvasMaskManager":46}],44:[function(require,module,exports){ /** * Creates a Canvas element of the given size. * @@ -13243,7 +13284,7 @@ CanvasTinter.canUseMultiply = utils.canUseNewCanvasBlendModes(); */ CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -},{"../../../utils":74}],48:[function(require,module,exports){ +},{"../../../utils":76}],48:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), ShaderManager = require('./managers/ShaderManager'), MaskManager = require('./managers/MaskManager'), @@ -13775,7 +13816,7 @@ WebGLRenderer.prototype._mapBlendModes = function () } }; -},{"../../const":22,"../../utils":74,"../SystemRenderer":42,"./filters/FXAAFilter":50,"./managers/BlendModeManager":52,"./managers/FilterManager":53,"./managers/MaskManager":54,"./managers/ShaderManager":55,"./managers/StencilManager":56,"./utils/ObjectRenderer":62,"./utils/RenderTarget":64}],49:[function(require,module,exports){ +},{"../../const":22,"../../utils":76,"../SystemRenderer":42,"./filters/FXAAFilter":50,"./managers/BlendModeManager":52,"./managers/FilterManager":53,"./managers/MaskManager":54,"./managers/ShaderManager":55,"./managers/StencilManager":56,"./utils/ObjectRenderer":62,"./utils/RenderTarget":64}],49:[function(require,module,exports){ var DefaultShader = require('../shaders/TextureShader'); /** @@ -14798,7 +14839,7 @@ ShaderManager.prototype.destroy = function () this.tempAttribState = null; }; -},{"../../../utils":74,"../shaders/ComplexPrimitiveShader":58,"../shaders/PrimitiveShader":59,"../shaders/TextureShader":61,"./WebGLManager":57}],56:[function(require,module,exports){ +},{"../../../utils":76,"../shaders/ComplexPrimitiveShader":58,"../shaders/PrimitiveShader":59,"../shaders/TextureShader":61,"./WebGLManager":57}],56:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'), utils = require('../../../utils'); @@ -15142,7 +15183,7 @@ WebGLMaskManager.prototype.popMask = function (maskData) }; -},{"../../../utils":74,"./WebGLManager":57}],57:[function(require,module,exports){ +},{"../../../utils":76,"./WebGLManager":57}],57:[function(require,module,exports){ /** * @class * @memberof PIXI @@ -15169,7 +15210,7 @@ module.exports = WebGLManager; */ WebGLManager.prototype.onContextChange = function () { - // do some codes init! + // do some codes init! }; /** @@ -15856,7 +15897,7 @@ Shader.prototype._glCompile = function (type, src) return shader; }; -},{"../../../utils":74}],61:[function(require,module,exports){ +},{"../../../utils":76}],61:[function(require,module,exports){ var Shader = require('./Shader'); /** @@ -15874,9 +15915,9 @@ function TextureShader(shaderManager, vertexSrc, fragmentSrc, customUniforms, cu var uniforms = { uSampler: { type: 'sampler2D', value: 0 }, - projectionMatrix: { type: 'mat3', value: new Float32Array(1, 0, 0, - 0, 1, 0, - 0, 0, 1) } + projectionMatrix: { type: 'mat3', value: new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]) } }; if (customUniforms) @@ -16462,7 +16503,7 @@ RenderTarget.prototype.destroy = function() this.texture = null; }; -},{"../../../const":22,"../../../math":32,"../../../utils":74,"./StencilMaskStack":65}],65:[function(require,module,exports){ +},{"../../../const":22,"../../../math":32,"../../../utils":76,"./StencilMaskStack":65}],65:[function(require,module,exports){ /** * Generic Mask Stack data structure * @class @@ -16471,7 +16512,7 @@ RenderTarget.prototype.destroy = function() */ function StencilMaskStack() { - /** + /** * The actual stack * * @member {Array} @@ -17060,7 +17101,7 @@ Sprite.fromImage = function (imageId, crossorigin, scaleMode) return new Sprite(Texture.fromImage(imageId, crossorigin, scaleMode)); }; -},{"../const":22,"../display/Container":23,"../math":32,"../renderers/canvas/utils/CanvasTinter":47,"../textures/Texture":71,"../utils":74}],67:[function(require,module,exports){ +},{"../const":22,"../display/Container":23,"../math":32,"../renderers/canvas/utils/CanvasTinter":47,"../textures/Texture":71,"../utils":76}],67:[function(require,module,exports){ var ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'), WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'), CONST = require('../../const'); @@ -18190,7 +18231,7 @@ Text.prototype.destroy = function (destroyBaseTexture) this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture); }; -},{"../const":22,"../math":32,"../sprites/Sprite":66,"../textures/Texture":71,"../utils":74}],69:[function(require,module,exports){ +},{"../const":22,"../math":32,"../sprites/Sprite":66,"../textures/Texture":71,"../utils":76}],69:[function(require,module,exports){ var utils = require('../utils'), CONST = require('../const'), EventEmitter = require('eventemitter3'); @@ -18623,7 +18664,7 @@ BaseTexture.fromCanvas = function (canvas, scaleMode) return baseTexture; }; -},{"../const":22,"../utils":74,"eventemitter3":11}],70:[function(require,module,exports){ +},{"../const":22,"../utils":76,"eventemitter3":11}],70:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), Texture = require('./Texture'), RenderTarget = require('../renderers/webgl/utils/RenderTarget'), @@ -19307,7 +19348,7 @@ Object.defineProperties(Texture.prototype, { this.crop = frame; } - if (this.valid) + if (this.valid) { this._updateUvs(); } @@ -19341,7 +19382,7 @@ Texture.prototype.onBaseTextureLoaded = function (baseTexture) this.frame = this._frame; } - this.emit( 'update', this ); + this.emit('update', this); }; Texture.prototype.onBaseTextureUpdated = function (baseTexture) @@ -19349,7 +19390,7 @@ Texture.prototype.onBaseTextureUpdated = function (baseTexture) this._frame.width = baseTexture.width; this._frame.height = baseTexture.height; - this.emit( 'update', this ); + this.emit('update', this); }; /** @@ -19520,7 +19561,7 @@ Texture.removeTextureFromCache = function (id) Texture.EMPTY = new Texture(new BaseTexture()); -},{"../math":32,"../utils":74,"./BaseTexture":69,"./TextureUvs":72,"./VideoBaseTexture":73,"eventemitter3":11}],72:[function(require,module,exports){ +},{"../math":32,"../utils":76,"./BaseTexture":69,"./TextureUvs":72,"./VideoBaseTexture":73,"eventemitter3":11}],72:[function(require,module,exports){ /** * A standard object to store the Uvs of a texture @@ -19821,7388 +19862,7431 @@ function createSource(path, type) return source; } -},{"../utils":74,"./BaseTexture":69}],74:[function(require,module,exports){ -var CONST = require('../const'); +},{"../utils":76,"./BaseTexture":69}],74:[function(require,module,exports){ +var CONST = require('../const'), + EventEmitter = require('eventemitter3'), + // Internal event used by composed emitter + TICK = 'tick'; /** - * @namespace PIXI.utils + * A Ticker class that runs an update loop that other objects listen to. + * This class is composed around an EventEmitter object to add listeners + * meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, + * e.g. When the ticker is started and the emitter has listeners. + * + * @class + * @memberof PIXI.ticker */ -var utils = module.exports = { - _uid: 0, - _saidHello: false, - - pluginTarget: require('./pluginTarget'), - async: require('async'), - +function Ticker() +{ + var _this = this; /** - * Gets the next uuid + * Internal tick method bound to ticker instance. + * This is because in early 2015, Function.bind + * is still 60% slower in high performance scenarios. + * Also separating frame requests from update method + * so listeners may be called at any time and with + * any animation API, just invoke ticker.update(time). * - * @return {number} The next uuid to use. + * @private */ - uuid: function () - { - return ++utils._uid; - }, + this._tick = function _tick(time) { + _this._requestId = null; + + if (_this.started) + { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._emitter.listeners(TICK, true)) + { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; /** - * Converts a hex color number to an [R, G, B] array - * - * @param hex {number} - * @return {number[]} An array representing the [R, G, B] of the color. + * Internal emitter used to fire 'tick' event + * @private */ - hex2rgb: function (hex, out) - { - out = out || []; - - out[0] = (hex >> 16 & 0xFF) / 255; - out[1] = (hex >> 8 & 0xFF) / 255; - out[2] = (hex & 0xFF) / 255; - - return out; - }, - + this._emitter = new EventEmitter(); /** - * Converts a hex color number to a string. - * - * @param hex {number} - * @return {string} The string color. + * Internal current frame request ID + * @private */ - hex2string: function (hex) - { - hex = hex.toString(16); - hex = '000000'.substr(0, 6 - hex.length) + hex; - - return '#' + hex; - }, - + this._requestId = null; /** - * Converts a color as an [R, G, B] array to a hex number - * - * @param rgb {number[]} - * @return {number} The color number + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + * @private */ - rgb2hex: function (rgb) - { - return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255); - }, + this._maxElapsedMS = 100; /** - * Checks whether the Canvas BlendModes are supported by the current browser - * - * @return {boolean} whether they are supported + * Whether or not this ticker should invoke the method + * {@link PIXI.ticker.Ticker#start} automatically + * when a listener is added. + * + * @member {boolean} + * @default false */ - canUseNewCanvasBlendModes: function () - { - if (typeof document === 'undefined') - { - return false; - } - - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - - var magenta = new Image(); - magenta.src = pngHead + 'AP804Oa6' + pngEnd; - - var yellow = new Image(); - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - - var canvas = document.createElement('canvas'); - canvas.width = 6; - canvas.height = 1; - - var context = canvas.getContext('2d'); - context.globalCompositeOperation = 'multiply'; - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); - - var data = context.getImageData(2,0,1,1).data; - - return (data[0] === 255 && data[1] === 0 && data[2] === 0); - }, + this.autoStart = false; /** - * Given a number, this function returns the closest number that is a power of two - * this function is taken from Starling Framework as its pretty neat ;) + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.ticker.Ticker#minFPS} + * and is scaled with {@link PIXI.ticker.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. * - * @param number {number} - * @return {number} the closest number that is a power of two + * @member {number} + * @default 1 */ - getNextPowerOfTwo: function (number) - { - // see: http://en.wikipedia.org/wiki/Power_of_two#Fast_algorithm_to_check_if_a_positive_number_is_a_power_of_two - if (number > 0 && (number & (number - 1)) === 0) - { - return number; - } - else - { - var result = 1; - - while (result < number) - { - result <<= 1; - } - - return result; - } - }, + this.deltaTime = 1; /** - * checks if the given width and height make a power of two rectangle + * Time elapsed in milliseconds from last frame to this frame. + * Opposed to what the scalar {@link PIXI.ticker.Ticker#deltaTime} + * is based, this value is neither capped nor scaled. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. * - * @param width {number} - * @param height {number} - * @return {boolean} + * @member {DOMHighResTimeStamp|number} + * @default 1 / TARGET_FPMS */ - isPowerOfTwo: function (width, height) - { - return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); - }, + this.elapsedMS = 1 / CONST.TARGET_FPMS; // default to target frame time /** - * get the resolution of an asset by looking for the prefix - * used by spritesheets and image urls + * The last time {@link PIXI.ticker.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. * - * @param url {string} the image path - * @return {boolean} + * @member {DOMHighResTimeStamp|number} + * @default 0 */ - getResolutionOfUrl: function (url) - { - var resolution = CONST.RETINA_PREFIX.exec(url); - - if (resolution) - { - return parseFloat(resolution[1]); - } - - return 1; - }, + this.lastTime = 0; /** - * Logs out the version and renderer information for this running instance of PIXI. - * If you don't want to see this message you can set `PIXI.utils._saidHello = true;` - * so the library thinks it already said it. Keep in mind that doing that will forever - * makes you a jerk face. + * Factor of current {@link PIXI.ticker.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; * - * @param {string} type - The string renderer type to log. - * @constant - * @static + * @member {number} + * @default 1 */ - sayHello: function (type) - { - if (utils._saidHello) - { - return; - } + this.speed = 1; - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) - { - var args = [ - '\n %c %c %c Pixi.js ' + CONST.VERSION + ' - ✰ ' + type + ' ✰ %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n', - 'background: #ff66a5; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff66a5; background: #030307; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'background: #ffc3dc; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - ]; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.ticker.Ticker#start} has been called. + * `false` if {@link PIXI.ticker.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.ticker.Ticker#autoStart} being `true` + * and a listener is added. + * + * @member {boolean} + * @default false + */ + this.started = false; +} - window.console.log.apply(console, args); //jshint ignore:line - } - else if (window.console) +Object.defineProperties(Ticker.prototype, { + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.ticker.Ticker#speed}, which is specific + * to scaling {@link PIXI.ticker.Ticker#deltaTime}. + * + * @member + * @memberof PIXI.ticker.Ticker# + * @readonly + */ + FPS: { + get: function() { - window.console.log('Pixi.js ' + CONST.VERSION + ' - ' + type + ' - http://www.pixijs.com/'); //jshint ignore:line + return 1000 / this.elapsedMS; } - - utils._saidHello = true; }, /** - * Helper for checking for webgl support + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.ticker.Ticker#update}. + * This value is used to cap {@link PIXI.ticker.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.ticker.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.TARGET_FPMS * 1000`. * - * @return {boolean} + * @member + * @memberof PIXI.ticker.Ticker# + * @default 10 */ - isWebGLSupported: function () - { - var contextOptions = { stencil: true }; - try + minFPS: { + get: function() { - if (!window.WebGLRenderingContext) - { - return false; - } - - var canvas = document.createElement('canvas'), - gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions); - - return !!(gl && gl.getContextAttributes().stencil); - } - catch (e) + return 1000 / this._maxElapsedMS; + }, + set: function(fps) { - return false; + // Clamp: 0 to TARGET_FPMS + var minFPMS = Math.min(Math.max(0, fps) / 1000, CONST.TARGET_FPMS); + this._maxElapsedMS = 1 / minFPMS; } - }, + } +}); - TextureCache: {}, - BaseTextureCache: {} +/** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * + * @private + */ +Ticker.prototype._requestIfNeeded = function _requestIfNeeded() +{ + if (this._requestId === null && this._emitter.listeners(TICK, true)) + { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._requestId = requestAnimationFrame(this._tick); + } }; -},{"../const":22,"./pluginTarget":75,"async":2}],75:[function(require,module,exports){ /** - * Mixins functionality to make an object have "plugins". - * - * @mixin - * @memberof PIXI.utils - * @param obj {object} The object to mix into. - * @example - * function MyObject() {} + * Conditionally cancels a pending animation frame. * - * pluginTarget.mixin(MyObject); + * @private */ -function pluginTarget(obj) +Ticker.prototype._cancelIfNeeded = function _cancelIfNeeded() { - obj.__plugins = {}; - - /** - * Adds a plugin to an object - * - * @param pluginName {string} The events that should be listed. - * @param ctor {Object} ?? @alvin - */ - obj.registerPlugin = function (pluginName, ctor) + if (this._requestId !== null) { - obj.__plugins[pluginName] = ctor; - }; + cancelAnimationFrame(this._requestId); + this._requestId = null; + } +}; - /** - * Instantiates all the plugins of this object - * - */ - obj.prototype.initPlugins = function () +/** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * + * @private + */ +Ticker.prototype._startIfPossible = function _startIfPossible() +{ + if (this.started) { - this.plugins = this.plugins || {}; + this._requestIfNeeded(); + } + else if (this.autoStart) + { + this.start(); + } +}; - for (var o in obj.__plugins) - { - this.plugins[o] = new (obj.__plugins[o])(this); - } - }; +/** + * Calls {@link module:eventemitter3.EventEmitter#on} internally for the + * internal 'tick' event. It checks if the emitter has listeners, + * and if so it requests a new animation frame at this point. + * + * @param fn {Function} The listener function to be added for updates + * @param [context] {Function} The listener context + * @returns {PIXI.ticker.Ticker} this + */ +Ticker.prototype.add = function add(fn, context) +{ + this._emitter.on(TICK, fn, context); - /** - * Removes all the plugins of this object - * - */ - obj.prototype.destroyPlugins = function () - { - for (var o in this.plugins) - { - this.plugins[o].destroy(); - this.plugins[o] = null; - } + this._startIfPossible(); - this.plugins = null; - }; -} + return this; +}; + +/** + * Calls {@link module:eventemitter3.EventEmitter#once} internally for the + * internal 'tick' event. It checks if the emitter has listeners, + * and if so it requests a new animation frame at this point. + * + * @param fn {Function} The listener function to be added for one update + * @param [context] {Function} The listener context + * @returns {PIXI.ticker.Ticker} this + */ +Ticker.prototype.addOnce = function addOnce(fn, context) +{ + this._emitter.once(TICK, fn, context); + this._startIfPossible(); -module.exports = { - /** - * Mixes in the properties of the pluginTarget into another object - * - * @param object {object} The obj to mix into - */ - mixin: function mixin(obj) + return this; +}; + +/** + * Calls {@link module:eventemitter3.EventEmitter#off} internally for 'tick' event. + * It checks if the emitter has listeners for 'tick' event. + * If it does, then it cancels the animation frame. + * + * @param [fn] {Function} The listener function to be removed + * @param [context] {Function} The listener context to be removed + * @returns {PIXI.ticker.Ticker} this + */ +Ticker.prototype.remove = function remove(fn, context) +{ + this._emitter.off(TICK, fn, context); + + if (!this._emitter.listeners(TICK, true)) { - pluginTarget(obj); + this._cancelIfNeeded(); } -}; -},{}],76:[function(require,module,exports){ -/*global console */ -var core = require('./core'), - mesh = require('./mesh'), - extras = require('./extras'), - utils = require('./core/utils'); + return this; +}; /** - * @class - * @private - * @name PIXI.SpriteBatch - * @see {@link PIXI.ParticleContainer} - * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. + * Starts the ticker. If the ticker has listeners + * a new animation frame is requested at this point. */ -core.SpriteBatch = function() { - throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); +Ticker.prototype.start = function start() +{ + if (!this.started) + { + this.started = true; + this._requestIfNeeded(); + } }; /** - * @class - * @private - * @name PIXI.AssetLoader - * @see {@link PIXI.loaders.Loader} - * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. + * Stops the ticker. If the ticker has requested + * an animation frame it is canceled at this point. */ -core.AssetLoader = function() { - throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); +Ticker.prototype.stop = function stop() +{ + if (this.started) + { + this.started = false; + this._cancelIfNeeded(); + } }; -Object.defineProperties(core, { +/** + * Triggers an update. An update entails setting the + * current {@link PIXI.ticker.Ticker#elapsedMS}, + * the current {@link PIXI.ticker.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.ticker.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * + * @param [currentTime=performance.now()] {DOMHighResTimeStamp|number} the current time of execution + */ +Ticker.prototype.update = function update(currentTime) +{ + var elapsedMS; - /** - * @class - * @private - * @name PIXI.Stage - * @see {@link PIXI.Container} - * @deprecated since version 3.0 - */ - Stage: { - get: function() { - console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); - return core.Container; - } - }, + // Allow calling update directly with default currentTime. + currentTime = currentTime || performance.now(); + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; - /** - * @class - * @private - * @name PIXI.DisplayObjectContainer - * @see {@link PIXI.Container} - * @deprecated since version 3.0 - */ - DisplayObjectContainer: { - get: function() { - console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); - return core.Container; - } - }, + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) + { + elapsedMS = this._maxElapsedMS; + } - /** - * @class - * @private - * @name PIXI.Strip - * @see {@link PIXI.mesh.Mesh} - * @deprecated since version 3.0 - */ - Strip: { - get: function() { - console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); - return mesh.Mesh; - } - }, + this.deltaTime = elapsedMS * CONST.TARGET_FPMS * this.speed; - /** - * @class - * @private - * @name PIXI.Rope - * @see {@link PIXI.mesh.Rope} - * @deprecated since version 3.0 - */ - Rope: { - get: function() { - console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); - return mesh.Rope; - } - }, + // Invoke listeners added to internal emitter + this._emitter.emit(TICK, this.deltaTime); - /** - * @class - * @private - * @name PIXI.MovieClip - * @see {@link PIXI.MovieClip} - * @deprecated since version 3.0 - */ - MovieClip: { - get: function() { - console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); - return extras.MovieClip; - } - }, - /** - * @class - * @private - * @name PIXI.TilingSprite - * @see {@link PIXI.TilingSprite} - * @deprecated since version 3.0 - */ - TilingSprite: { - get: function() { - console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); - return extras.TilingSprite; - } - }, - /** - * @class - * @private - * @name PIXI.BitmapText - * @see {@link PIXI.extras.BitmapText} - * @deprecated since version 3.0 - */ - BitmapText: { - get: function() { - console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); - return extras.BitmapText; - } - }, - /** - * @class - * @private - * @name PIXI.blendModes - * @see {@link PIXI.BLEND_MODES} - * @deprecated since version 3.0 - */ - blendModes: { - get: function() { - console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); - return core.BLEND_MODES; - } - }, - /** - * @class - * @private - * @name PIXI.scaleModes - * @see {@link PIXI.SCALE_MODES} - * @deprecated since version 3.0 - */ - scaleModes: { - get: function() { - console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); - return core.SCALE_MODES; - } - }, - /** - * @class - * @private - * @name PIXI.BaseTextureCache - * @see {@link PIXI.utils.BaseTextureCache} - * @deprecated since version 3.0 - */ - BaseTextureCache: { - get: function () { - console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; - } - }, - /** - * @class - * @private - * @name PIXI.TextureCache - * @see {@link PIXI.utils.TextureCache} - * @deprecated since version 3.0 - */ - TextureCache: { - get: function () { - console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; - } - } -}); - -/** - * @method - * @private - * @name PIXI.Sprite#setTexture - * @see {@link PIXI.Sprite#texture} - * @deprecated since version 3.0 - */ -core.Sprite.prototype.setTexture = function(texture) { - this.texture = texture; - console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); + this.lastTime = currentTime; }; -/** - * @method - * @name PIXI.extras.BitmapText#setText - * @see {@link PIXI.BitmapText#text} - * @deprecated since version 3.0 - */ -extras.BitmapText.prototype.setText = function(text) { - this.text = text; - console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); -}; +module.exports = Ticker; +},{"../const":22,"eventemitter3":11}],75:[function(require,module,exports){ /** - * @method - * @name PIXI.Text#setText - * @see {@link PIXI.Text#text} - * @deprecated since version 3.0 + * @file Main export of the PIXI extras library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} */ -core.Text.prototype.setText = function(text) { - this.text = text; - console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); -}; +var Ticker = require('./Ticker'); /** - * @method - * @name PIXI.Text#setStyle - * @see {@link PIXI.Text#style} - * @deprecated since version 3.0 + * The shared ticker instance used by {@link PIXI.extras.MovieClip}. + * and by {@link PIXI.interaction.InteractionManager}. + * The property {@link PIXI.ticker.Ticker#autoStart} is set to `true` + * for this instance. Please follow the examples for usage, including + * how to opt-out of auto-starting the shared ticker. + * + * @example + * var ticker = PIXI.ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * + * @example + * // You may use the shared ticker to render... + * var renderer = PIXI.autoDetectRenderer(800, 600); + * var stage = new PIXI.Container(); + * var interactionManager = PIXI.interaction.InteractionManager(renderer); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * + * @type {PIXI.ticker.Ticker} + * @memberof PIXI.ticker */ -core.Text.prototype.setStyle = function(style) { - this.style = style; - console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); -}; +var shared = new Ticker(); +shared.autoStart = true; /** - * @method - * @name PIXI.Texture#setFrame - * @see {@link PIXI.Texture#setFrame} - * @deprecated since version 3.0 + * @namespace PIXI.ticker */ -core.Texture.prototype.setFrame = function(frame) { - this.frame = frame; - console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); +module.exports = { + shared: shared, + Ticker: Ticker }; -},{"./core":29,"./core/utils":74,"./extras":83,"./mesh":124}],77:[function(require,module,exports){ -var core = require('../core'); +},{"./Ticker":74}],76:[function(require,module,exports){ +var CONST = require('../const'); /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: - * - * A BitmapText can only be created when the font is loaded - * - * ```js - * // in this case the font is in a file called 'desyrel.fnt' - * var bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); - * ``` - * - * - * http://www.angelcode.com/products/bmfont/ for windows or - * http://www.bmglyph.com/ for mac. - * - * @class - * @extends PIXI.Container - * @memberof PIXI.extras - * @param text {string} The copy that you would like the text to display - * @param style {object} The style parameters - * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form - * "24px FontName" or "FontName" or as an object with explicit name/size properties. - * @param [style.font.name] {string} The bitmap font id - * @param [style.font.size] {number} The size of the font in pixels, e.g. 24 - * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect - * single line text - * @param [style.tint=0xFFFFFF] {number} The tint color + * @namespace PIXI.utils */ -function BitmapText(text, style) -{ - core.Container.call(this); +var utils = module.exports = { + _uid: 0, + _saidHello: false, - style = style || {}; + pluginTarget: require('./pluginTarget'), + async: require('async'), /** - * The width of the overall text, different from fontSize, - * which is defined in the style object + * Gets the next uuid * - * @member {number} - * @readOnly + * @return {number} The next uuid to use. */ - this.textWidth = 0; + uuid: function () + { + return ++utils._uid; + }, /** - * The height of the overall text, different from fontSize, - * which is defined in the style object + * Converts a hex color number to an [R, G, B] array * - * @member {number} - * @readOnly + * @param hex {number} + * @return {number[]} An array representing the [R, G, B] of the color. */ - this.textHeight = 0; + hex2rgb: function (hex, out) + { + out = out || []; + + out[0] = (hex >> 16 & 0xFF) / 255; + out[1] = (hex >> 8 & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + + return out; + }, /** - * Private tracker for the letter sprite pool. + * Converts a hex color number to a string. * - * @member {Sprite[]} - * @private + * @param hex {number} + * @return {string} The string color. */ - this._glyphs = []; + hex2string: function (hex) + { + hex = hex.toString(16); + hex = '000000'.substr(0, 6 - hex.length) + hex; + + return '#' + hex; + }, /** - * Private tracker for the current style. + * Converts a color as an [R, G, B] array to a hex number * - * @member {object} - * @private + * @param rgb {number[]} + * @return {number} The color number */ - this._font = { - tint: style.tint !== undefined ? style.tint : 0xFFFFFF, - align: style.align || 'left', - name: null, - size: 0 - }; + rgb2hex: function (rgb) + { + return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255); + }, /** - * Private tracker for the current font. + * Checks whether the Canvas BlendModes are supported by the current browser * - * @member {object} - * @private + * @return {boolean} whether they are supported */ - this.font = style.font; // run font setter - - /** - * Private tracker for the current text. - * - * @member {string} - * @private - */ - this._text = text; + canUseNewCanvasBlendModes: function () + { + if (typeof document === 'undefined') + { + return false; + } - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting value to 0 - * - * @member {number} - */ - this.maxWidth = 0; + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - /** - * The dirty state of this object. - * - * @member {boolean} - */ - this.dirty = false; + var magenta = new Image(); + magenta.src = pngHead + 'AP804Oa6' + pngEnd; - this.updateText(); -} + var yellow = new Image(); + yellow.src = pngHead + '/wCKxvRF' + pngEnd; -// constructor -BitmapText.prototype = Object.create(core.Container.prototype); -BitmapText.prototype.constructor = BitmapText; -module.exports = BitmapText; + var canvas = document.createElement('canvas'); + canvas.width = 6; + canvas.height = 1; + + var context = canvas.getContext('2d'); + context.globalCompositeOperation = 'multiply'; + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + var data = context.getImageData(2,0,1,1).data; + + return (data[0] === 255 && data[1] === 0 && data[2] === 0); + }, -Object.defineProperties(BitmapText.prototype, { /** - * The tint of the BitmapText object + * Given a number, this function returns the closest number that is a power of two + * this function is taken from Starling Framework as its pretty neat ;) * - * @member {number} - * @memberof BitmapText# + * @param number {number} + * @return {number} the closest number that is a power of two */ - tint: { - get: function () + getNextPowerOfTwo: function (number) + { + // see: http://en.wikipedia.org/wiki/Power_of_two#Fast_algorithm_to_check_if_a_positive_number_is_a_power_of_two + if (number > 0 && (number & (number - 1)) === 0) { - return this._font.tint; - }, - set: function (value) + return number; + } + else { - this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; + var result = 1; - this.dirty = true; + while (result < number) + { + result <<= 1; + } + + return result; } }, /** - * The alignment of the BitmapText object + * checks if the given width and height make a power of two rectangle * - * @member {string} - * @default 'left' - * @memberof BitmapText# + * @param width {number} + * @param height {number} + * @return {boolean} */ - align: { - get: function () - { - return this._font.align; - }, - set: function (value) - { - this._font.align = value || 'left'; + isPowerOfTwo: function (width, height) + { + return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); + }, - this.dirty = true; + /** + * get the resolution of an asset by looking for the prefix + * used by spritesheets and image urls + * + * @param url {string} the image path + * @return {boolean} + */ + getResolutionOfUrl: function (url) + { + var resolution = CONST.RETINA_PREFIX.exec(url); + + if (resolution) + { + return parseFloat(resolution[1]); } + + return 1; }, /** - * The font descriptor of the BitmapText object + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can set `PIXI.utils._saidHello = true;` + * so the library thinks it already said it. Keep in mind that doing that will forever + * makes you a jerk face. * - * @member {Font} - * @memberof BitmapText# + * @param {string} type - The string renderer type to log. + * @constant + * @static */ - font: { - get: function () - { - return this._font; - }, - set: function (value) + sayHello: function (type) + { + if (utils._saidHello) { - if (!value) { - return; - } - - if (typeof value === 'string') { - value = value.split(' '); + return; + } - this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); - this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; - } - else { - this._font.name = value.name; - this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); - } + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) + { + var args = [ + '\n %c %c %c Pixi.js ' + CONST.VERSION + ' - ✰ ' + type + ' ✰ %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n', + 'background: #ff66a5; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff66a5; background: #030307; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'background: #ffc3dc; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + ]; - this.dirty = true; + window.console.log.apply(console, args); //jshint ignore:line + } + else if (window.console) + { + window.console.log('Pixi.js ' + CONST.VERSION + ' - ' + type + ' - http://www.pixijs.com/'); //jshint ignore:line } + + utils._saidHello = true; }, /** - * The text of the BitmapText object + * Helper for checking for webgl support * - * @member {string} - * @memberof BitmapText# + * @return {boolean} */ - text: { - get: function () - { - return this._text; - }, - set: function (value) + isWebGLSupported: function () + { + var contextOptions = { stencil: true }; + try { - value = value.toString() || ' '; - if (this._text === value) + if (!window.WebGLRenderingContext) { - return; + return false; } - this._text = value; - this.dirty = true; + + var canvas = document.createElement('canvas'), + gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions); + + return !!(gl && gl.getContextAttributes().stencil); } - } -}); + catch (e) + { + return false; + } + }, + + TextureCache: {}, + BaseTextureCache: {} +}; +},{"../const":22,"./pluginTarget":77,"async":2}],77:[function(require,module,exports){ /** - * Renders text and updates it when needed + * Mixins functionality to make an object have "plugins". * - * @private + * @mixin + * @memberof PIXI.utils + * @param obj {object} The object to mix into. + * @example + * function MyObject() {} + * + * pluginTarget.mixin(MyObject); */ -BitmapText.prototype.updateText = function () +function pluginTarget(obj) { - var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); - var prevCharCode = null; - var chars = []; - var lastLineWidth = 0; - var maxLineWidth = 0; - var lineWidths = []; - var line = 0; - var scale = this._font.size / data.size; - var lastSpace = -1; + obj.__plugins = {}; - for (var i = 0; i < this.text.length; i++) + /** + * Adds a plugin to an object + * + * @param pluginName {string} The events that should be listed. + * @param ctor {Object} ?? @alvin + */ + obj.registerPlugin = function (pluginName, ctor) { - var charCode = this.text.charCodeAt(i); - lastSpace = /(\s)/.test(this.text.charAt(i)) ? i : lastSpace; + obj.__plugins[pluginName] = ctor; + }; - if (/(?:\r\n|\r|\n)/.test(this.text.charAt(i))) + /** + * Instantiates all the plugins of this object + * + */ + obj.prototype.initPlugins = function () + { + this.plugins = this.plugins || {}; + + for (var o in obj.__plugins) { - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - line++; - - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - continue; - } - - if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth) - { - chars.splice(lastSpace, i - lastSpace); - i = lastSpace; - lastSpace = -1; - - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - line++; - - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - continue; - } - - var charData = data.chars[charCode]; - - if (!charData) - { - continue; - } - - if (prevCharCode && charData.kerning[prevCharCode]) - { - pos.x += charData.kerning[prevCharCode]; - } - - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); - lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); - pos.x += charData.xAdvance; - - prevCharCode = charCode; - } - - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - - var lineAlignOffsets = []; - - for (i = 0; i <= line; i++) - { - var alignOffset = 0; - - if (this._font.align === 'right') - { - alignOffset = maxLineWidth - lineWidths[i]; - } - else if (this._font.align === 'center') - { - alignOffset = (maxLineWidth - lineWidths[i]) / 2; + this.plugins[o] = new (obj.__plugins[o])(this); } + }; - lineAlignOffsets.push(alignOffset); - } - - var lenChars = chars.length; - var tint = this.tint; - - for (i = 0; i < lenChars; i++) + /** + * Removes all the plugins of this object + * + */ + obj.prototype.destroyPlugins = function () { - var c = this._glyphs[i]; // get the next glyph sprite - - if (c) - { - c.texture = chars[i].texture; - } - else + for (var o in this.plugins) { - c = new core.Sprite(chars[i].texture); - this._glyphs.push(c); + this.plugins[o].destroy(); + this.plugins[o] = null; } - c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale; - c.position.y = chars[i].position.y * scale; - c.scale.x = c.scale.y = scale; - c.tint = tint; + this.plugins = null; + }; +} - if (!c.parent) - { - this.addChild(c); - } - } - // remove unnecessary children. - for (i = lenChars; i < this._glyphs.length; ++i) +module.exports = { + /** + * Mixes in the properties of the pluginTarget into another object + * + * @param object {object} The obj to mix into + */ + mixin: function mixin(obj) { - this.removeChild(this._glyphs[i]); + pluginTarget(obj); } - - this.textWidth = maxLineWidth * scale; - this.textHeight = (pos.y + data.lineHeight) * scale; }; -/** - * Updates the transform of this object - * - * @private - */ -BitmapText.prototype.updateTransform = function () -{ - this.validate(); - this.containerUpdateTransform(); -}; +},{}],78:[function(require,module,exports){ +/*global console */ +var core = require('./core'), + mesh = require('./mesh'), + extras = require('./extras'), + utils = require('./core/utils'); /** - * Validates text before calling parent's getLocalBounds - * - * @return {Rectangle} The rectangular bounding area + * @class + * @private + * @name PIXI.SpriteBatch + * @see {@link PIXI.ParticleContainer} + * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ - -BitmapText.prototype.getLocalBounds = function() -{ - this.validate(); - return core.Container.prototype.getLocalBounds.call(this); +core.SpriteBatch = function() { + throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; /** - * Updates text when needed - * + * @class * @private + * @name PIXI.AssetLoader + * @see {@link PIXI.loaders.Loader} + * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -BitmapText.prototype.validate = function() -{ - if (this.dirty) - { - this.updateText(); - this.dirty = false; - } +core.AssetLoader = function() { + throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; -BitmapText.fonts = {}; - -},{"../core":29}],78:[function(require,module,exports){ -var core = require('../core'), - ticker = require('../ticker'); - -/** - * A MovieClip is a simple way to display an animation depicted by a list of textures. - * - * ```js - * var alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; - * var textureArray = []; - * - * for (var i=0; i < 4; i++) - * { - * var texture = PIXI.Texture.fromImage(alienImages[i]); - * textureArray.push(texture); - * }; - * - * var mc = new PIXI.MovieClip(textureArray); - * ``` - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI.extras - * @param textures {Texture[]} an array of {Texture} objects that make up the animation - */ -function MovieClip(textures) -{ - core.Sprite.call(this, textures[0]); +Object.defineProperties(core, { /** + * @class * @private + * @name PIXI.Stage + * @see {@link PIXI.Container} + * @deprecated since version 3.0 */ - this._textures = textures; + Stage: { + get: function() { + console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); + return core.Container; + } + }, /** - * The speed that the MovieClip will play at. Higher is faster, lower is slower - * - * @member {number} - * @default 1 + * @class + * @private + * @name PIXI.DisplayObjectContainer + * @see {@link PIXI.Container} + * @deprecated since version 3.0 */ - this.animationSpeed = 1; + DisplayObjectContainer: { + get: function() { + console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); + return core.Container; + } + }, /** - * Whether or not the movie clip repeats after playing. - * - * @member {boolean} - * @default true + * @class + * @private + * @name PIXI.Strip + * @see {@link PIXI.mesh.Mesh} + * @deprecated since version 3.0 */ - this.loop = true; + Strip: { + get: function() { + console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); + return mesh.Mesh; + } + }, /** - * Function to call when a MovieClip finishes playing - * - * @method - * @memberof MovieClip# + * @class + * @private + * @name PIXI.Rope + * @see {@link PIXI.mesh.Rope} + * @deprecated since version 3.0 */ - this.onComplete = null; + Rope: { + get: function() { + console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); + return mesh.Rope; + } + }, /** - * Elapsed time since animation has been started, used internally to display current texture - * - * @member {number} + * @class * @private + * @name PIXI.MovieClip + * @see {@link PIXI.MovieClip} + * @deprecated since version 3.0 */ - this._currentTime = 0; - - /** - * Indicates if the MovieClip is currently playing - * - * @member {boolean} - * @readonly + MovieClip: { + get: function() { + console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); + return extras.MovieClip; + } + }, + /** + * @class + * @private + * @name PIXI.TilingSprite + * @see {@link PIXI.TilingSprite} + * @deprecated since version 3.0 */ - this.playing = false; -} - -// constructor -MovieClip.prototype = Object.create(core.Sprite.prototype); -MovieClip.prototype.constructor = MovieClip; -module.exports = MovieClip; - -Object.defineProperties(MovieClip.prototype, { + TilingSprite: { + get: function() { + console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); + return extras.TilingSprite; + } + }, /** - * totalFrames is the total number of frames in the MovieClip. This is the same as number of textures - * assigned to the MovieClip. - * - * @member {number} - * @memberof PIXI.MovieClip# - * @default 0 - * @readonly + * @class + * @private + * @name PIXI.BitmapText + * @see {@link PIXI.extras.BitmapText} + * @deprecated since version 3.0 */ - totalFrames: { - get: function() - { - return this._textures.length; + BitmapText: { + get: function() { + console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); + return extras.BitmapText; } }, - /** - * The array of textures used for this MovieClip - * - * @member {PIXI.Texture[]} - * @memberof PIXI.MovieClip# - * + * @class + * @private + * @name PIXI.blendModes + * @see {@link PIXI.BLEND_MODES} + * @deprecated since version 3.0 */ - textures: { - get: function () - { - return this._textures; - }, - set: function (value) - { - this._textures = value; - - this.texture = this._textures[Math.floor(this._currentTime) % this._textures.length]; + blendModes: { + get: function() { + console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); + return core.BLEND_MODES; } }, - /** - * The MovieClips current frame index - * - * @member {number} - * @memberof PIXI.MovieClip# - * @readonly - */ - currentFrame: { - get: function () - { - return Math.floor(this._currentTime) % this._textures.length; + * @class + * @private + * @name PIXI.scaleModes + * @see {@link PIXI.SCALE_MODES} + * @deprecated since version 3.0 + */ + scaleModes: { + get: function() { + console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); + return core.SCALE_MODES; + } + }, + /** + * @class + * @private + * @name PIXI.BaseTextureCache + * @see {@link PIXI.utils.BaseTextureCache} + * @deprecated since version 3.0 + */ + BaseTextureCache: { + get: function () { + console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); + return utils.BaseTextureCache; + } + }, + /** + * @class + * @private + * @name PIXI.TextureCache + * @see {@link PIXI.utils.TextureCache} + * @deprecated since version 3.0 + */ + TextureCache: { + get: function () { + console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); + return utils.TextureCache; } } - }); /** - * Stops the MovieClip - * + * @method + * @private + * @name PIXI.Sprite#setTexture + * @see {@link PIXI.Sprite#texture} + * @deprecated since version 3.0 */ -MovieClip.prototype.stop = function () -{ - if(!this.playing) - { - return; - } - - this.playing = false; - ticker.shared.remove(this.update, this); +core.Sprite.prototype.setTexture = function(texture) { + this.texture = texture; + console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; /** - * Plays the MovieClip - * + * @method + * @name PIXI.extras.BitmapText#setText + * @see {@link PIXI.BitmapText#text} + * @deprecated since version 3.0 */ -MovieClip.prototype.play = function () -{ - if(this.playing) - { - return; - } - - this.playing = true; - ticker.shared.add(this.update, this); +extras.BitmapText.prototype.setText = function(text) { + this.text = text; + console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; /** - * Stops the MovieClip and goes to a specific frame - * - * @param frameNumber {number} frame index to stop at + * @method + * @name PIXI.Text#setText + * @see {@link PIXI.Text#text} + * @deprecated since version 3.0 */ -MovieClip.prototype.gotoAndStop = function (frameNumber) -{ - this.stop(); - - this._currentTime = frameNumber; - - var round = Math.floor(this._currentTime); - this._texture = this._textures[round % this._textures.length]; +core.Text.prototype.setText = function(text) { + this.text = text; + console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; /** - * Goes to a specific frame and begins playing the MovieClip - * - * @param frameNumber {number} frame index to start at + * @method + * @name PIXI.Text#setStyle + * @see {@link PIXI.Text#style} + * @deprecated since version 3.0 */ -MovieClip.prototype.gotoAndPlay = function (frameNumber) -{ - this._currentTime = frameNumber; - this.play(); +core.Text.prototype.setStyle = function(style) { + this.style = style; + console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; -/* - * Updates the object transform for rendering - * @private +/** + * @method + * @name PIXI.Texture#setFrame + * @see {@link PIXI.Texture#setFrame} + * @deprecated since version 3.0 */ -MovieClip.prototype.update = function (deltaTime) -{ - - this._currentTime += this.animationSpeed * deltaTime; - - var floor = Math.floor(this._currentTime); - - if (floor < 0) - { - if (this.loop) - { - this._currentTime += this._textures.length; - this._texture = this._textures[this._currentTime]; - } - else - { - this.gotoAndStop(0); - - if (this.onComplete) - { - this.onComplete(); - } - } - } - else if (this.loop || floor < this._textures.length) - { - this._texture = this._textures[floor % this._textures.length]; - } - else if (floor >= this._textures.length) - { - this.gotoAndStop(this.textures.length - 1); - - if (this.onComplete) - { - this.onComplete(); - } - } +core.Texture.prototype.setFrame = function(frame) { + this.frame = frame; + console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; -/* - * Stops the MovieClip and destroys it - * - */ -MovieClip.prototype.destroy = function ( ) -{ - this.stop(); - core.Sprite.prototype.destroy.call(this); -}; +},{"./core":29,"./core/utils":76,"./extras":85,"./mesh":126}],79:[function(require,module,exports){ +var core = require('../core'); /** - * A short hand way of creating a movieclip from an array of frame ids + * A BitmapText object will create a line or multiple lines of text using bitmap font. To + * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: * - * @static - * @param frames {string[]} the array of frames ids the movieclip will use as its texture frames - */ -MovieClip.fromFrames = function (frames) -{ - var textures = []; - - for (var i = 0; i < frames.length; ++i) - { - textures.push(new core.Texture.fromFrame(frames[i])); - } - - return new MovieClip(textures); -}; - -/** - * A short hand way of creating a movieclip from an array of image ids + * A BitmapText can only be created when the font is loaded + * + * ```js + * // in this case the font is in a file called 'desyrel.fnt' + * var bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); + * ``` * - * @static - * @param images {string[]} the array of image urls the movieclip will use as its texture frames - */ -MovieClip.fromImages = function (images) -{ - var textures = []; - - for (var i = 0; i < images.length; ++i) - { - textures.push(new core.Texture.fromImage(images[i])); - } - - return new MovieClip(textures); -}; - -},{"../core":29,"../ticker":131}],79:[function(require,module,exports){ -var core = require('../core'), - // a sprite use dfor rendering textures.. - tempPoint = new core.Point(); - -/** - * A tiling sprite is a fast way of rendering a tiling image + * + * http://www.angelcode.com/products/bmfont/ for windows or + * http://www.bmglyph.com/ for mac. * * @class - * @extends PIXI.Sprite + * @extends PIXI.Container * @memberof PIXI.extras - * @param texture {Texture} the texture of the tiling sprite - * @param width {number} the width of the tiling sprite - * @param height {number} the height of the tiling sprite + * @param text {string} The copy that you would like the text to display + * @param style {object} The style parameters + * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form + * "24px FontName" or "FontName" or as an object with explicit name/size properties. + * @param [style.font.name] {string} The bitmap font id + * @param [style.font.size] {number} The size of the font in pixels, e.g. 24 + * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect + * single line text + * @param [style.tint=0xFFFFFF] {number} The tint color */ -function TilingSprite(texture, width, height) +function BitmapText(text, style) { - core.Sprite.call(this, texture); + core.Container.call(this); + + style = style || {}; /** - * The scaling of the image that is being tiled + * The width of the overall text, different from fontSize, + * which is defined in the style object * - * @member {Point} + * @member {number} + * @readOnly */ - this.tileScale = new core.math.Point(1,1); - + this.textWidth = 0; /** - * The offset position of the image that is being tiled + * The height of the overall text, different from fontSize, + * which is defined in the style object * - * @member {Point} + * @member {number} + * @readOnly */ - this.tilePosition = new core.math.Point(0,0); - - ///// private + this.textHeight = 0; /** - * The with of the tiling sprite + * Private tracker for the letter sprite pool. * - * @member {number} + * @member {Sprite[]} * @private */ - this._width = width || 100; + this._glyphs = []; /** - * The height of the tiling sprite + * Private tracker for the current style. * - * @member {number} + * @member {object} * @private */ - this._height = height || 100; + this._font = { + tint: style.tint !== undefined ? style.tint : 0xFFFFFF, + align: style.align || 'left', + name: null, + size: 0 + }; /** - * An internal WebGL UV cache. + * Private tracker for the current font. * - * @member {TextureUvs} + * @member {object} * @private */ - this._uvs = new core.TextureUvs(); - - this._canvasPattern = null; - - //TODO move.. - this.shader = new core.AbstractFilter( - - [ - 'precision lowp float;', - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - 'attribute vec4 aColor;', - - 'uniform mat3 projectionMatrix;', - - 'uniform vec4 uFrame;', - 'uniform vec4 uTransform;', - - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', - - 'void main(void){', - ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - - ' vec2 coord = aTextureCoord;', - ' coord -= uTransform.xy;', - ' coord /= uTransform.zw;', - ' coord /= uFrame.zw;', - ' vTextureCoord = coord;', - - ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', - '}' - ].join('\n'), - [ - 'precision lowp float;', - - 'varying vec2 vTextureCoord;', - 'varying vec4 vColor;', - - 'uniform sampler2D uSampler;', - 'uniform vec4 uFrame;', - - 'void main(void){', + this.font = style.font; // run font setter - ' vec2 coord = fract(vTextureCoord);', - ' coord *= uFrame.zw;', - ' coord += uFrame.xy;', + /** + * Private tracker for the current text. + * + * @member {string} + * @private + */ + this._text = text; - ' gl_FragColor = texture2D(uSampler, coord) * vColor ;', - '}' - ].join('\n'), + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting value to 0 + * + * @member {number} + */ + this.maxWidth = 0; - // set the uniforms - { - uFrame: { type: '4fv', value: [0,0,1,1] }, + /** + * The dirty state of this object. + * + * @member {boolean} + */ + this.dirty = false; - uTransform: { type: '4fv', value: [0,0,1,1] } - } - ); + this.updateText(); } -TilingSprite.prototype = Object.create(core.Sprite.prototype); -TilingSprite.prototype.constructor = TilingSprite; -module.exports = TilingSprite; - +// constructor +BitmapText.prototype = Object.create(core.Container.prototype); +BitmapText.prototype.constructor = BitmapText; +module.exports = BitmapText; -Object.defineProperties(TilingSprite.prototype, { +Object.defineProperties(BitmapText.prototype, { /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set + * The tint of the BitmapText object * * @member {number} - * @memberof TilingSprite# + * @memberof BitmapText# */ - width: { + tint: { get: function () { - return this._width; + return this._font.tint; }, set: function (value) { - this._width = value; + this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; + + this.dirty = true; } }, /** - * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set + * The alignment of the BitmapText object * - * @member {number} - * @memberof TilingSprite# + * @member {string} + * @default 'left' + * @memberof BitmapText# */ - height: { + align: { get: function () { - return this._height; + return this._font.align; }, set: function (value) { - this._height = value; + this._font.align = value || 'left'; + + this.dirty = true; } - } -}); + }, -TilingSprite.prototype._onTextureUpdate = function () -{ - return; -}; + /** + * The font descriptor of the BitmapText object + * + * @member {Font} + * @memberof BitmapText# + */ + font: { + get: function () + { + return this._font; + }, + set: function (value) + { + if (!value) { + return; + } + if (typeof value === 'string') { + value = value.split(' '); -/** - * Renders the object using the WebGL renderer - * - * @param renderer {WebGLRenderer} - * @private - */ -TilingSprite.prototype._renderWebGL = function (renderer) -{ - // tweak our texture temporarily.. - var texture = this._texture; + this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); + this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; + } + else { + this._font.name = value.name; + this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); + } - if(!texture || !texture._uvs) - { - return; - } - - var tempUvs = texture._uvs, - tempWidth = texture._frame.width, - tempHeight = texture._frame.height, - tw = texture.baseTexture.width, - th = texture.baseTexture.height; - - texture._uvs = this._uvs; - texture._frame.width = this.width; - texture._frame.height = this.height; - - //PADDING - - // apply padding to stop gaps in the tile when numbers are not rounded - this.shader.uniforms.uFrame.value[0] = tempUvs.x0; - this.shader.uniforms.uFrame.value[1] = tempUvs.y0; - this.shader.uniforms.uFrame.value[2] = tempUvs.x1 - tempUvs.x0; - this.shader.uniforms.uFrame.value[3] = tempUvs.y2 - tempUvs.y0; - - this.shader.uniforms.uTransform.value[0] = (this.tilePosition.x % tempWidth) / this._width; - this.shader.uniforms.uTransform.value[1] = (this.tilePosition.y % tempHeight) / this._height; - this.shader.uniforms.uTransform.value[2] = ( tw / this._width ) * this.tileScale.x; - this.shader.uniforms.uTransform.value[3] = ( th / this._height ) * this.tileScale.y; - - renderer.setObjectRenderer(renderer.plugins.sprite); - renderer.plugins.sprite.render(this); + this.dirty = true; + } + }, - texture._uvs = tempUvs; - texture._frame.width = tempWidth; - texture._frame.height = tempHeight; -}; + /** + * The text of the BitmapText object + * + * @member {string} + * @memberof BitmapText# + */ + text: { + get: function () + { + return this._text; + }, + set: function (value) + { + value = value.toString() || ' '; + if (this._text === value) + { + return; + } + this._text = value; + this.dirty = true; + } + } +}); /** - * Renders the object using the Canvas renderer + * Renders text and updates it when needed * - * @param renderer {CanvasRenderer} a reference to the canvas renderer * @private */ -TilingSprite.prototype._renderCanvas = function (renderer) +BitmapText.prototype.updateText = function () { - var texture = this._texture; + var data = BitmapText.fonts[this._font.name]; + var pos = new core.math.Point(); + var prevCharCode = null; + var chars = []; + var lastLineWidth = 0; + var maxLineWidth = 0; + var lineWidths = []; + var line = 0; + var scale = this._font.size / data.size; + var lastSpace = -1; - if (!texture.baseTexture.hasLoaded) + for (var i = 0; i < this.text.length; i++) { - return; - } + var charCode = this.text.charCodeAt(i); + lastSpace = /(\s)/.test(this.text.charAt(i)) ? i : lastSpace; - var context = renderer.context, - transform = this.worldTransform, - resolution = renderer.resolution, - baseTexture = texture.baseTexture, - modX = this.tilePosition.x % texture._frame.width, - modY = this.tilePosition.y % texture._frame.height; + if (/(?:\r\n|\r|\n)/.test(this.text.charAt(i))) + { + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + line++; - // create a nice shiny pattern! - // TODO this needs to be refreshed if texture changes.. - if(!this._canvasPattern) - { - // cut an object from a spritesheet.. - var tempCanvas = new core.CanvasBuffer(texture._frame.width, texture._frame.height); - tempCanvas.context.drawImage(baseTexture.source, -texture._frame.x,-texture._frame.y); - this._canvasPattern = tempCanvas.context.createPattern( tempCanvas.canvas, 'repeat' ); - } + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + continue; + } - // set context state.. - context.globalAlpha = this.worldAlpha; - context.setTransform(transform.a * resolution, - transform.b * resolution, - transform.c * resolution, - transform.d * resolution, - transform.tx * resolution, - transform.ty * resolution); + if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth) + { + chars.splice(lastSpace, i - lastSpace); + i = lastSpace; + lastSpace = -1; - // TODO - this should be rolled into the setTransform above.. - context.scale(this.tileScale.x,this.tileScale.y); + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + line++; + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + continue; + } - context.translate(modX + (this.anchor.x * -this._width ), - modY + (this.anchor.y * -this._height)); + var charData = data.chars[charCode]; - // check blend mode - if (this.blendMode !== renderer.currentBlendMode) - { - renderer.currentBlendMode = this.blendMode; - context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode]; - } + if (!charData) + { + continue; + } - // fill the pattern! - context.fillStyle = this._canvasPattern; - context.fillRect(-modX, - -modY, - this._width / this.tileScale.x, - this._height / this.tileScale.y); + if (prevCharCode && charData.kerning[prevCharCode]) + { + pos.x += charData.kerning[prevCharCode]; + } + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); + pos.x += charData.xAdvance; - //TODO - pretty sure this can be deleted... - //context.translate(-this.tilePosition.x + (this.anchor.x * this._width), -this.tilePosition.y + (this.anchor.y * this._height)); - //context.scale(1 / this.tileScale.x, 1 / this.tileScale.y); -}; + prevCharCode = charCode; + } + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); -/** - * Returns the framing rectangle of the sprite as a Rectangle object -* - * @return {Rectangle} the framing rectangle - */ -TilingSprite.prototype.getBounds = function () -{ - var width = this._width; - var height = this._height; + var lineAlignOffsets = []; - var w0 = width * (1-this.anchor.x); - var w1 = width * -this.anchor.x; + for (i = 0; i <= line; i++) + { + var alignOffset = 0; - var h0 = height * (1-this.anchor.y); - var h1 = height * -this.anchor.y; + if (this._font.align === 'right') + { + alignOffset = maxLineWidth - lineWidths[i]; + } + else if (this._font.align === 'center') + { + alignOffset = (maxLineWidth - lineWidths[i]) / 2; + } - var worldTransform = this.worldTransform; + lineAlignOffsets.push(alignOffset); + } - var a = worldTransform.a; - var b = worldTransform.b; - var c = worldTransform.c; - var d = worldTransform.d; - var tx = worldTransform.tx; - var ty = worldTransform.ty; + var lenChars = chars.length; + var tint = this.tint; - var x1 = a * w1 + c * h1 + tx; - var y1 = d * h1 + b * w1 + ty; + for (i = 0; i < lenChars; i++) + { + var c = this._glyphs[i]; // get the next glyph sprite - var x2 = a * w0 + c * h1 + tx; - var y2 = d * h1 + b * w0 + ty; + if (c) + { + c.texture = chars[i].texture; + } + else + { + c = new core.Sprite(chars[i].texture); + this._glyphs.push(c); + } - var x3 = a * w0 + c * h0 + tx; - var y3 = d * h0 + b * w0 + ty; + c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale; + c.position.y = chars[i].position.y * scale; + c.scale.x = c.scale.y = scale; + c.tint = tint; - var x4 = a * w1 + c * h0 + tx; - var y4 = d * h0 + b * w1 + ty; + if (!c.parent) + { + this.addChild(c); + } + } - var minX, - maxX, - minY, - maxY; + // remove unnecessary children. + for (i = lenChars; i < this._glyphs.length; ++i) + { + this.removeChild(this._glyphs[i]); + } - minX = x1; - minX = x2 < minX ? x2 : minX; - minX = x3 < minX ? x3 : minX; - minX = x4 < minX ? x4 : minX; + this.textWidth = maxLineWidth * scale; + this.textHeight = (pos.y + data.lineHeight) * scale; +}; - minY = y1; - minY = y2 < minY ? y2 : minY; - minY = y3 < minY ? y3 : minY; - minY = y4 < minY ? y4 : minY; +/** + * Updates the transform of this object + * + * @private + */ +BitmapText.prototype.updateTransform = function () +{ + this.validate(); + this.containerUpdateTransform(); +}; - maxX = x1; - maxX = x2 > maxX ? x2 : maxX; - maxX = x3 > maxX ? x3 : maxX; - maxX = x4 > maxX ? x4 : maxX; - - maxY = y1; - maxY = y2 > maxY ? y2 : maxY; - maxY = y3 > maxY ? y3 : maxY; - maxY = y4 > maxY ? y4 : maxY; - - var bounds = this._bounds; +/** + * Validates text before calling parent's getLocalBounds + * + * @return {Rectangle} The rectangular bounding area + */ - bounds.x = minX; - bounds.width = maxX - minX; +BitmapText.prototype.getLocalBounds = function() +{ + this.validate(); + return core.Container.prototype.getLocalBounds.call(this); +}; - bounds.y = minY; - bounds.height = maxY - minY; +/** + * Updates text when needed + * + * @private + */ +BitmapText.prototype.validate = function() +{ + if (this.dirty) + { + this.updateText(); + this.dirty = false; + } +}; - // store a reference so that if this function gets called again in the render cycle we do not have to recalculate - this._currentBounds = bounds; +BitmapText.fonts = {}; - return bounds; -}; +},{"../core":29}],80:[function(require,module,exports){ +var core = require('../core'); /** - * Checks if a point is inside this tiling sprite - * @param point {Point} the point to check + * A MovieClip is a simple way to display an animation depicted by a list of textures. + * + * ```js + * var alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; + * var textureArray = []; + * + * for (var i=0; i < 4; i++) + * { + * var texture = PIXI.Texture.fromImage(alienImages[i]); + * textureArray.push(texture); + * }; + * + * var mc = new PIXI.MovieClip(textureArray); + * ``` + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI.extras + * @param textures {Texture[]} an array of {Texture} objects that make up the animation */ -TilingSprite.prototype.containsPoint = function( point ) +function MovieClip(textures) { - this.worldTransform.applyInverse(point, tempPoint); + core.Sprite.call(this, textures[0]); - var width = this._width; - var height = this._height; - var x1 = -width * this.anchor.x; - var y1; + /** + * @private + */ + this._textures = textures; - if ( tempPoint.x > x1 && tempPoint.x < x1 + width ) - { - y1 = -height * this.anchor.y; + /** + * The speed that the MovieClip will play at. Higher is faster, lower is slower + * + * @member {number} + * @default 1 + */ + this.animationSpeed = 1; - if ( tempPoint.y > y1 && tempPoint.y < y1 + height ) + /** + * Whether or not the movie clip repeats after playing. + * + * @member {boolean} + * @default true + */ + this.loop = true; + + /** + * Function to call when a MovieClip finishes playing + * + * @method + * @memberof MovieClip# + */ + this.onComplete = null; + + /** + * Elapsed time since animation has been started, used internally to display current texture + * + * @member {number} + * @private + */ + this._currentTime = 0; + + /** + * Indicates if the MovieClip is currently playing + * + * @member {boolean} + * @readonly + */ + this.playing = false; +} + +// constructor +MovieClip.prototype = Object.create(core.Sprite.prototype); +MovieClip.prototype.constructor = MovieClip; +module.exports = MovieClip; + +Object.defineProperties(MovieClip.prototype, { + /** + * totalFrames is the total number of frames in the MovieClip. This is the same as number of textures + * assigned to the MovieClip. + * + * @member {number} + * @memberof PIXI.MovieClip# + * @default 0 + * @readonly + */ + totalFrames: { + get: function() { - return true; + return this._textures.length; + } + }, + + /** + * The array of textures used for this MovieClip + * + * @member {PIXI.Texture[]} + * @memberof PIXI.MovieClip# + * + */ + textures: { + get: function () + { + return this._textures; + }, + set: function (value) + { + this._textures = value; + + this.texture = this._textures[Math.floor(this._currentTime) % this._textures.length]; + } + }, + + /** + * The MovieClips current frame index + * + * @member {number} + * @memberof PIXI.MovieClip# + * @readonly + */ + currentFrame: { + get: function () + { + return Math.floor(this._currentTime) % this._textures.length; } } - return false; -}; +}); /** - * Destroys this tiling sprite + * Stops the MovieClip * */ -TilingSprite.prototype.destroy = function () { - core.Sprite.prototype.destroy.call(this); - - this.tileScale = null; - this._tileScaleOffset = null; - this.tilePosition = null; +MovieClip.prototype.stop = function () +{ + if(!this.playing) + { + return; + } - this._uvs = null; + this.playing = false; + core.ticker.shared.remove(this.update, this); }; /** - * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId - * The frame ids are created when a Texture packer file has been loaded + * Plays the MovieClip * - * @static - * @param frameId {String} The frame Id of the texture in the cache - * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId - * @param width {number} the width of the tiling sprite - * @param height {number} the height of the tiling sprite */ -TilingSprite.fromFrame = function (frameId,width,height) +MovieClip.prototype.play = function () { - var texture = core.utils.TextureCache[frameId]; - - if (!texture) + if(this.playing) { - throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + return; } - return new TilingSprite(texture,width,height); + this.playing = true; + core.ticker.shared.add(this.update, this); }; /** - * Helper function that creates a sprite that will contain a texture based on an image url - * If the image is not in the texture cache it will be loaded + * Stops the MovieClip and goes to a specific frame * - * @static - * @param imageId {String} The image url of the texture - * @param width {number} the width of the tiling sprite - * @param height {number} the height of the tiling sprite - * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter - * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values - * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + * @param frameNumber {number} frame index to stop at */ -TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) +MovieClip.prototype.gotoAndStop = function (frameNumber) { - return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); -}; - -},{"../core":29}],80:[function(require,module,exports){ -var core = require('../core'), - DisplayObject = core.DisplayObject, - _tempMatrix = new core.Matrix(); + this.stop(); -DisplayObject.prototype._cacheAsBitmap = false; -DisplayObject.prototype._originalRenderWebGL = null; -DisplayObject.prototype._originalRenderCanvas = null; + this._currentTime = frameNumber; -DisplayObject.prototype._originalUpdateTransform = null; -DisplayObject.prototype._originalHitTest = null; -DisplayObject.prototype._originalDestroy = null; -DisplayObject.prototype._cachedSprite = null; + var round = Math.floor(this._currentTime); + this._texture = this._textures[round % this._textures.length]; +}; -Object.defineProperties(DisplayObject.prototype, { +/** + * Goes to a specific frame and begins playing the MovieClip + * + * @param frameNumber {number} frame index to start at + */ +MovieClip.prototype.gotoAndPlay = function (frameNumber) +{ + this._currentTime = frameNumber; + this.play(); +}; - /** - * Set this to true if you want this display object to be cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. - * To remove simply set this property to 'null' - * - * @member {boolean} - * @memberof DisplayObject# - */ - cacheAsBitmap: { - get: function () - { - return this._cacheAsBitmap; - }, - set: function (value) - { - if (this._cacheAsBitmap === value) - { - return; - } - - this._cacheAsBitmap = value; - - if (value) - { - this._originalRenderWebGL = this.renderWebGL; - this._originalRenderCanvas = this.renderCanvas; - - this._originalUpdateTransform = this.updateTransform; - this._originalGetBounds = this.getBounds; - - this._originalDestroy = this.destroy; +/* + * Updates the object transform for rendering + * @private + */ +MovieClip.prototype.update = function (deltaTime) +{ - this._originalContainesPoint = this.containsPoint; + this._currentTime += this.animationSpeed * deltaTime; - this.renderWebGL = this._renderCachedWebGL; - this.renderCanvas = this._renderCachedCanvas; + var floor = Math.floor(this._currentTime); - this.destroy = this._cacheAsBitmapDestroy; + if (floor < 0) + { + if (this.loop) + { + this._texture = this._textures[this._textures.length - 1 + floor % this._textures.length]; + } + else + { + this.gotoAndStop(0); - } - else + if (this.onComplete) { - if (this._cachedSprite) - { - this._destroyCachedDisplayObject(); - } - - this.renderWebGL = this._originalRenderWebGL; - this.renderCanvas = this._originalRenderCanvas; - this.getBounds = this._originalGetBounds; - - this.destroy = this._originalDestroy; - - this.updateTransform = this._originalUpdateTransform; - this.containsPoint = this._originalContainsPoint; + this.onComplete(); } } } -}); -/** -* Renders a cached version of the sprite with WebGL -* -* @param renderer {WebGLRenderer} the WebGL renderer -* @private -*/ -DisplayObject.prototype._renderCachedWebGL = function (renderer) -{ - this._initCachedDisplayObject( renderer ); + else if (this.loop || floor < this._textures.length) + { + this._texture = this._textures[floor % this._textures.length]; + } + else if (floor >= this._textures.length) + { + this.gotoAndStop(this.textures.length - 1); - this._cachedSprite.worldAlpha = this.worldAlpha; + if (this.onComplete) + { + this.onComplete(); + } + } +}; - renderer.setObjectRenderer(renderer.plugins.sprite); - renderer.plugins.sprite.render( this._cachedSprite ); +/* + * Stops the MovieClip and destroys it + * + */ +MovieClip.prototype.destroy = function ( ) +{ + this.stop(); + core.Sprite.prototype.destroy.call(this); }; /** -* Prepares the WebGL renderer to cache the sprite -* -* @param renderer {WebGLRenderer} the WebGL renderer -* @private -*/ -DisplayObject.prototype._initCachedDisplayObject = function (renderer) + * A short hand way of creating a movieclip from an array of frame ids + * + * @static + * @param frames {string[]} the array of frames ids the movieclip will use as its texture frames + */ +MovieClip.fromFrames = function (frames) { - if(this._cachedSprite) + var textures = []; + + for (var i = 0; i < frames.length; ++i) { - return; + textures.push(new core.Texture.fromFrame(frames[i])); } - // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) - renderer.currentRenderer.flush(); - //this.filters= []; - // next we find the dimensions of the untransformed object - // this function also calls updatetransform on all its children as part of the measuring. This means we don't need to update the transform again in this function - // TODO pass an object to clone too? saves having to create a new one each time! - var bounds = this.getLocalBounds().clone(); + return new MovieClip(textures); +}; - // add some padding! - if(this._filters) - { - var padding = this._filters[0].padding; - bounds.x -= padding; - bounds.y -= padding; +/** + * A short hand way of creating a movieclip from an array of image ids + * + * @static + * @param images {string[]} the array of image urls the movieclip will use as its texture frames + */ +MovieClip.fromImages = function (images) +{ + var textures = []; - bounds.width += padding * 2; - bounds.height += padding * 2; + for (var i = 0; i < images.length; ++i) + { + textures.push(new core.Texture.fromImage(images[i])); } - // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. - var cachedRenderTarget = renderer.currentRenderTarget; - // We also store the filter stack - I will definitely look to change how this works a little later down the line. - var stack = renderer.filterManager.filterStack; + return new MovieClip(textures); +}; - // this renderTexture will be used to store the cached DisplayObject - var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0); +},{"../core":29}],81:[function(require,module,exports){ +var core = require('../core'), + // a sprite use dfor rendering textures.. + tempPoint = new core.Point(); - // need to set // - var m = _tempMatrix; +/** + * A tiling sprite is a fast way of rendering a tiling image + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI.extras + * @param texture {Texture} the texture of the tiling sprite + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + */ +function TilingSprite(texture, width, height) +{ + core.Sprite.call(this, texture); - m.tx = -bounds.x; - m.ty = -bounds.y; + /** + * The scaling of the image that is being tiled + * + * @member {Point} + */ + this.tileScale = new core.math.Point(1,1); + /** + * The offset position of the image that is being tiled + * + * @member {Point} + */ + this.tilePosition = new core.math.Point(0,0); - // set all properties to there original so we can render to a texture - this.renderWebGL = this._originalRenderWebGL; + ///// private - renderTexture.render(this, m, true, true); + /** + * The with of the tiling sprite + * + * @member {number} + * @private + */ + this._width = width || 100; - // now restore the state be setting the new properties - renderer.setRenderTarget(cachedRenderTarget); - renderer.filterManager.filterStack = stack; + /** + * The height of the tiling sprite + * + * @member {number} + * @private + */ + this._height = height || 100; - this.renderWebGL = this._renderCachedWebGL; - this.updateTransform = this.displayObjectUpdateTransform; - this.getBounds = this._getCachedBounds; + /** + * An internal WebGL UV cache. + * + * @member {TextureUvs} + * @private + */ + this._uvs = new core.TextureUvs(); + this._canvasPattern = null; - // create our cached sprite - this._cachedSprite = new core.Sprite(renderTexture); - this._cachedSprite.worldTransform = this.worldTransform; - this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); - this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); + //TODO move.. + this.shader = new core.AbstractFilter( - // restore the transform of the cached sprite to avoid the nasty flicker.. - this.updateTransform(); + [ + 'precision lowp float;', + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', + 'attribute vec4 aColor;', - // map the hit test.. - this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite); -}; + 'uniform mat3 projectionMatrix;', -/** -* Renders a cached version of the sprite with canvas -* -* @param renderer {CanvasRenderer} the Canvas renderer -* @private -*/ -DisplayObject.prototype._renderCachedCanvas = function (renderer) -{ - this._initCachedDisplayObjectCanvas( renderer ); + 'uniform vec4 uFrame;', + 'uniform vec4 uTransform;', - this._cachedSprite.worldAlpha = this.worldAlpha; + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - this._cachedSprite.renderCanvas(renderer); -}; + 'void main(void){', + ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', -//TODO this can be the same as the webGL verison.. will need to do a little tweaking first though.. -/** -* Prepares the Canvas renderer to cache the sprite -* -* @param renderer {CanvasRenderer} the Canvas renderer -* @private -*/ -DisplayObject.prototype._initCachedDisplayObjectCanvas = function (renderer) -{ - if(this._cachedSprite) - { - return; - } - - //get bounds actually transforms the object for us already! - var bounds = this.getLocalBounds(); - - var cachedRenderTarget = renderer.context; - - var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0); - - // need to set // - var m = _tempMatrix; + ' vec2 coord = aTextureCoord;', + ' coord -= uTransform.xy;', + ' coord /= uTransform.zw;', + ' coord /= uFrame.zw;', + ' vTextureCoord = coord;', - m.tx = -bounds.x; - m.ty = -bounds.y; + ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', + '}' + ].join('\n'), + [ + 'precision lowp float;', - // set all properties to there original so we can render to a texture - this.renderCanvas = this._originalRenderCanvas; + 'varying vec2 vTextureCoord;', + 'varying vec4 vColor;', - renderTexture.render(this, m, true); + 'uniform sampler2D uSampler;', + 'uniform vec4 uFrame;', - // now restore the state be setting the new properties - renderer.context = cachedRenderTarget; + 'void main(void){', - this.renderCanvas = this._renderCachedCanvas; - this.updateTransform = this.displayObjectUpdateTransform; - this.getBounds = this._getCachedBounds; + ' vec2 coord = fract(vTextureCoord);', + ' coord *= uFrame.zw;', + ' coord += uFrame.xy;', + ' gl_FragColor = texture2D(uSampler, coord) * vColor ;', + '}' + ].join('\n'), - // create our cached sprite - this._cachedSprite = new core.Sprite(renderTexture); - this._cachedSprite.worldTransform = this.worldTransform; - this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); - this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); + // set the uniforms + { + uFrame: { type: '4fv', value: [0,0,1,1] }, - this.updateTransform(); + uTransform: { type: '4fv', value: [0,0,1,1] } + } + ); +} - this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite); -}; +TilingSprite.prototype = Object.create(core.Sprite.prototype); +TilingSprite.prototype.constructor = TilingSprite; +module.exports = TilingSprite; -/** -* Calculates the bounds of the cached sprite -* -* @private -*/ -DisplayObject.prototype._getCachedBounds = function () -{ - this._cachedSprite._currentBounds = null; - return this._cachedSprite.getBounds(); -}; +Object.defineProperties(TilingSprite.prototype, { + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + * @memberof TilingSprite# + */ + width: { + get: function () + { + return this._width; + }, + set: function (value) + { + this._width = value; + } + }, -/** -* Destroys the cached sprite. -* -* @private -*/ -DisplayObject.prototype._destroyCachedDisplayObject = function () -{ - this._cachedSprite._texture.destroy(); - this._cachedSprite = null; -}; + /** + * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + * @memberof TilingSprite# + */ + height: { + get: function () + { + return this._height; + }, + set: function (value) + { + this._height = value; + } + } +}); -DisplayObject.prototype._cacheAsBitmapDestroy = function () +TilingSprite.prototype._onTextureUpdate = function () { - this.cacheAsBitmap = false; - this._originalDestroy(); + return; }; -},{"../core":29}],81:[function(require,module,exports){ -var core = require('../core'); /** - * The instance name of the object. + * Renders the object using the WebGL renderer * - * @member {string} + * @param renderer {WebGLRenderer} + * @private */ -core.DisplayObject.prototype.name = null; - -/** -* Returns the display object in the container -* -* @param name {string} instance name -* @return {DisplayObject} -*/ -core.Container.prototype.getChildByName = function (name) -{ - for (var i = 0; i < this.children.length; i++) - { - if (this.children[i].name === name) - { - return this.children[i]; - } - } - return null; -}; - -},{"../core":29}],82:[function(require,module,exports){ -var core = require('../core'); - -/** -* Returns the global position of the displayObject -* -* @param point {Point} the point to write the global value to. If null a new point will be returned -* @return {Point} -*/ -core.DisplayObject.prototype.getGlobalPosition = function (point) +TilingSprite.prototype._renderWebGL = function (renderer) { - point = point || new core.Point(); - - if(this.parent) - { - this.displayObjectUpdateTransform(); + // tweak our texture temporarily.. + var texture = this._texture; - point.x = this.worldTransform.tx; - point.y = this.worldTransform.ty; - } - else + if(!texture || !texture._uvs) { - point.x = this.position.x; - point.y = this.position.y; + return; } - return point; -}; - -},{"../core":29}],83:[function(require,module,exports){ -/** - * @file Main export of the PIXI extras library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ + var tempUvs = texture._uvs, + tempWidth = texture._frame.width, + tempHeight = texture._frame.height, + tw = texture.baseTexture.width, + th = texture.baseTexture.height; -require('./cacheAsBitmap'); -require('./getChildByName'); -require('./getGlobalPosition'); + texture._uvs = this._uvs; + texture._frame.width = this.width; + texture._frame.height = this.height; -/** - * @namespace PIXI.extras - */ -module.exports = { - MovieClip: require('./MovieClip'), - TilingSprite: require('./TilingSprite'), - BitmapText: require('./BitmapText') -}; + //PADDING -},{"./BitmapText":77,"./MovieClip":78,"./TilingSprite":79,"./cacheAsBitmap":80,"./getChildByName":81,"./getGlobalPosition":82}],84:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + // apply padding to stop gaps in the tile when numbers are not rounded + this.shader.uniforms.uFrame.value[0] = tempUvs.x0; + this.shader.uniforms.uFrame.value[1] = tempUvs.y0; + this.shader.uniforms.uFrame.value[2] = tempUvs.x1 - tempUvs.x0; + this.shader.uniforms.uFrame.value[3] = tempUvs.y2 - tempUvs.y0; + this.shader.uniforms.uTransform.value[0] = (this.tilePosition.x % (tempWidth * this.tileScale.x)) / this._width; + this.shader.uniforms.uTransform.value[1] = (this.tilePosition.y % (tempHeight * this.tileScale.y)) / this._height; + this.shader.uniforms.uTransform.value[2] = ( tw / this._width ) * this.tileScale.x; + this.shader.uniforms.uTransform.value[3] = ( th / this._height ) * this.tileScale.y; -// TODO (cengler) - The Y is flipped in this shader for some reason. + renderer.setObjectRenderer(renderer.plugins.sprite); + renderer.plugins.sprite.render(this); -/** - * @author Vico @vicocotea - * original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h - */ + texture._uvs = tempUvs; + texture._frame.width = tempWidth; + texture._frame.height = tempHeight; +}; /** - * An ASCII filter. + * Renders the object using the Canvas renderer * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param renderer {CanvasRenderer} a reference to the canvas renderer + * @private */ -function AsciiFilter() +TilingSprite.prototype._renderCanvas = function (renderer) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nuniform vec4 dimensions;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && 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 return 0.0;\n}\n\nvoid main()\n{\n vec2 uv = gl_FragCoord.xy;\n\n vec3 col = texture2D(uSampler, floor( uv / pixelSize ) * pixelSize / dimensions.xy).rgb;\n\n float gray = (col.r + col.g + col.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 vec2 p = mod( uv / ( pixelSize * 0.5 ), 2.0) - vec2(1.0);\n col = col * character(n, p);\n\n gl_FragColor = vec4(col, 1.0);\n}\n", - // custom uniforms - { - dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) }, - pixelSize: { type: '1f', value: 8 } - } - ); -} + var texture = this._texture; -AsciiFilter.prototype = Object.create(core.AbstractFilter.prototype); -AsciiFilter.prototype.constructor = AsciiFilter; -module.exports = AsciiFilter; + if (!texture.baseTexture.hasLoaded) + { + return; + } -Object.defineProperties(AsciiFilter.prototype, { - /** - * The pixel size used by the filter. - * - * @member {number} - * @memberof AsciiFilter# - */ - size: { - get: function () - { - return this.uniforms.pixelSize.value; - }, - set: function (value) - { - this.uniforms.pixelSize.value = value; - } + var context = renderer.context, + transform = this.worldTransform, + resolution = renderer.resolution, + baseTexture = texture.baseTexture, + modX = this.tilePosition.x % (texture._frame.width * this.tileScale.x), + modY = this.tilePosition.y % (texture._frame.height * this.tileScale.y); + + // create a nice shiny pattern! + // TODO this needs to be refreshed if texture changes.. + if(!this._canvasPattern) + { + // cut an object from a spritesheet.. + var tempCanvas = new core.CanvasBuffer(texture._frame.width, texture._frame.height); + tempCanvas.context.drawImage(baseTexture.source, -texture._frame.x,-texture._frame.y); + this._canvasPattern = tempCanvas.context.createPattern( tempCanvas.canvas, 'repeat' ); } -}); -},{"../../core":29}],85:[function(require,module,exports){ -var core = require('../../core'), - BlurXFilter = require('../blur/BlurXFilter'), - BlurYFilter = require('../blur/BlurYFilter'); + // set context state.. + context.globalAlpha = this.worldAlpha; + context.setTransform(transform.a * resolution, + transform.b * resolution, + transform.c * resolution, + transform.d * resolution, + transform.tx * resolution, + transform.ty * resolution); + + // TODO - this should be rolled into the setTransform above.. + context.scale(this.tileScale.x,this.tileScale.y); + + + context.translate(modX + (this.anchor.x * -this._width ), + modY + (this.anchor.y * -this._height)); + + // check blend mode + if (this.blendMode !== renderer.currentBlendMode) + { + renderer.currentBlendMode = this.blendMode; + context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode]; + } + + // fill the pattern! + context.fillStyle = this._canvasPattern; + context.fillRect(-modX, + -modY, + this._width / this.tileScale.x, + this._height / this.tileScale.y); + + + //TODO - pretty sure this can be deleted... + //context.translate(-this.tilePosition.x + (this.anchor.x * this._width), -this.tilePosition.y + (this.anchor.y * this._height)); + //context.scale(1 / this.tileScale.x, 1 / this.tileScale.y); +}; + /** - * The BloomFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * Returns the framing rectangle of the sprite as a Rectangle object +* + * @return {Rectangle} the framing rectangle */ -function BloomFilter() +TilingSprite.prototype.getBounds = function () { - core.AbstractFilter.call(this); + var width = this._width; + var height = this._height; - this.blurXFilter = new BlurXFilter(); - this.blurYFilter = new BlurYFilter(); + var w0 = width * (1-this.anchor.x); + var w1 = width * -this.anchor.x; - this.defaultFilter = new core.AbstractFilter(); -} + var h0 = height * (1-this.anchor.y); + var h1 = height * -this.anchor.y; -BloomFilter.prototype = Object.create(core.AbstractFilter.prototype); -BloomFilter.prototype.constructor = BloomFilter; -module.exports = BloomFilter; + var worldTransform = this.worldTransform; -BloomFilter.prototype.applyFilter = function (renderer, input, output) -{ - var renderTarget = renderer.filterManager.getRenderTarget(true); + var a = worldTransform.a; + var b = worldTransform.b; + var c = worldTransform.c; + var d = worldTransform.d; + var tx = worldTransform.tx; + var ty = worldTransform.ty; - //TODO - copyTexSubImage2D could be used here? - this.defaultFilter.applyFilter(renderer, input, output); + var x1 = a * w1 + c * h1 + tx; + var y1 = d * h1 + b * w1 + ty; - this.blurXFilter.applyFilter(renderer, input, renderTarget); + var x2 = a * w0 + c * h1 + tx; + var y2 = d * h1 + b * w0 + ty; - renderer.blendModeManager.setBlendMode(core.BLEND_MODES.SCREEN); + var x3 = a * w0 + c * h0 + tx; + var y3 = d * h0 + b * w0 + ty; - this.blurYFilter.applyFilter(renderer, renderTarget, output); + var x4 = a * w1 + c * h0 + tx; + var y4 = d * h0 + b * w1 + ty; - renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL); + var minX, + maxX, + minY, + maxY; - renderer.filterManager.returnRenderTarget(renderTarget); -}; + minX = x1; + minX = x2 < minX ? x2 : minX; + minX = x3 < minX ? x3 : minX; + minX = x4 < minX ? x4 : minX; -Object.defineProperties(BloomFilter.prototype, { - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @memberOf BloomFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.blurXFilter.blur = this.blurYFilter.blur = value; - } - }, + minY = y1; + minY = y2 < minY ? y2 : minY; + minY = y3 < minY ? y3 : minY; + minY = y4 < minY ? y4 : minY; - /** - * Sets the strength of the blurX property - * - * @member {number} - * @memberOf BloomFilter# - * @default 2 - */ - blurX: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.blurXFilter.blur = value; - } - }, + maxX = x1; + maxX = x2 > maxX ? x2 : maxX; + maxX = x3 > maxX ? x3 : maxX; + maxX = x4 > maxX ? x4 : maxX; - /** - * Sets the strength of the blurY property - * - * @member {number} - * @memberOf BloomFilter# - * @default 2 - */ - blurY: { - get: function () - { - return this.blurYFilter.blur; - }, - set: function (value) - { - this.blurYFilter.blur = value; - } - } -}); + maxY = y1; + maxY = y2 > maxY ? y2 : maxY; + maxY = y3 > maxY ? y3 : maxY; + maxY = y4 > maxY ? y4 : maxY; -},{"../../core":29,"../blur/BlurXFilter":88,"../blur/BlurYFilter":89}],86:[function(require,module,exports){ -var core = require('../../core'); + var bounds = this._bounds; + + bounds.x = minX; + bounds.width = maxX - minX; + + bounds.y = minY; + bounds.height = maxY - minY; + + // store a reference so that if this function gets called again in the render cycle we do not have to recalculate + this._currentBounds = bounds; + return bounds; +}; /** - * The BlurDirFilter applies a Gaussian blur toward a direction to an object. - * - * @class - * @param {number} dirX - * @param {number} dirY - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * Checks if a point is inside this tiling sprite + * @param point {Point} the point to check */ -function BlurDirFilter(dirX, dirY) +TilingSprite.prototype.containsPoint = function( point ) { - core.AbstractFilter.call(this, - // vertex shader - "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform float dirX;\nuniform float dirY;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[3];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[0] = aTextureCoord + vec2( (0.004 * strength) * dirX, (0.004 * strength) * dirY );\n vBlurTexCoords[1] = aTextureCoord + vec2( (0.008 * strength) * dirX, (0.008 * strength) * dirY );\n vBlurTexCoords[2] = aTextureCoord + vec2( (0.012 * strength) * dirX, (0.012 * strength) * dirY );\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", - // fragment shader - "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[3];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vTextureCoord ) * 0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0]) * 0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1]) * 0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2]) * 0.004431848411938341;\n}\n", - // set the uniforms + this.worldTransform.applyInverse(point, tempPoint); + + var width = this._width; + var height = this._height; + var x1 = -width * this.anchor.x; + var y1; + + if ( tempPoint.x > x1 && tempPoint.x < x1 + width ) + { + y1 = -height * this.anchor.y; + + if ( tempPoint.y > y1 && tempPoint.y < y1 + height ) { - strength: { type: '1f', value: 1 }, - dirX: { type: '1f', value: dirX || 0 }, - dirY: { type: '1f', value: dirY || 0 } + return true; } - ); + } - this.defaultFilter = new core.AbstractFilter(); + return false; +}; - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @memberof BlurDirFilter# - * @default 1 - */ - this.passes = 1; - - /** - * Sets the X direction of the blur - * - * @member {number} - * @memberof BlurDirFilter# - * @default 0 - */ - this.dirX = dirX || 0; - - /** - * Sets the Y direction of the blur - * - * @member {number} - * @memberof BlurDirFilter# - * @default 0 - */ - this.dirY = dirY || 0; - - this.strength = 4; -} +/** + * Destroys this tiling sprite + * + */ +TilingSprite.prototype.destroy = function () { + core.Sprite.prototype.destroy.call(this); -BlurDirFilter.prototype = Object.create(core.AbstractFilter.prototype); -BlurDirFilter.prototype.constructor = BlurDirFilter; -module.exports = BlurDirFilter; + this.tileScale = null; + this._tileScaleOffset = null; + this.tilePosition = null; -BlurDirFilter.prototype.applyFilter = function (renderer, input, output, clear) { + this._uvs = null; +}; - var shader = this.getShader(renderer); +/** + * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + */ +TilingSprite.fromFrame = function (frameId,width,height) +{ + var texture = core.utils.TextureCache[frameId]; - this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width); + if (!texture) + { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + } - if (this.passes === 1) { - renderer.filterManager.applyFilter(shader, input, output, clear); - } else { - var renderTarget = renderer.filterManager.getRenderTarget(true); + return new TilingSprite(texture,width,height); +}; - renderer.filterManager.applyFilter(shader, input, renderTarget, clear); +/** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param imageId {String} The image url of the texture + * @param width {number} the width of the tiling sprite + * @param height {number} the height of the tiling sprite + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values + * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + */ +TilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode) +{ + return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); +}; - for(var i = 0; i < this.passes-2; i++) - { - //this.uniforms.strength.value = this.strength / 4 / (this.passes+(i*2)) * (input.frame.width / input.size.width); - renderer.filterManager.applyFilter(shader, renderTarget, renderTarget, clear); - } +},{"../core":29}],82:[function(require,module,exports){ +var core = require('../core'), + DisplayObject = core.DisplayObject, + _tempMatrix = new core.Matrix(); - renderer.filterManager.applyFilter(shader, renderTarget, output, clear); +DisplayObject.prototype._cacheAsBitmap = false; +DisplayObject.prototype._originalRenderWebGL = null; +DisplayObject.prototype._originalRenderCanvas = null; - renderer.filterManager.returnRenderTarget(renderTarget); - } -}; +DisplayObject.prototype._originalUpdateTransform = null; +DisplayObject.prototype._originalHitTest = null; +DisplayObject.prototype._originalDestroy = null; +DisplayObject.prototype._cachedSprite = null; +Object.defineProperties(DisplayObject.prototype, { -Object.defineProperties(BlurDirFilter.prototype, { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @memberof BlurDirFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.strength; - }, - set: function (value) - { - this.padding = value * 0.5; - this.strength = value; - } - }, - /** - * Sets the X direction of the blur. - * - * @member {number} - * @memberof BlurYFilter# - * @default 0 - */ - dirX: { - get: function () - { - return this.dirX; - }, - set: function (value) - { - this.uniforms.dirX.value = value; - } - }, /** - * Sets the Y direction of the blur. + * Set this to true if you want this display object to be cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * - * @member {number} - * @memberof BlurDirFilter# - * @default 0 + * @member {boolean} + * @memberof DisplayObject# */ - dirY: { + cacheAsBitmap: { get: function () { - return this.dirY; + return this._cacheAsBitmap; }, set: function (value) { - this.uniforms.dirY.value = value; + if (this._cacheAsBitmap === value) + { + return; + } + + this._cacheAsBitmap = value; + + if (value) + { + this._originalRenderWebGL = this.renderWebGL; + this._originalRenderCanvas = this.renderCanvas; + + this._originalUpdateTransform = this.updateTransform; + this._originalGetBounds = this.getBounds; + + this._originalDestroy = this.destroy; + + this._originalContainsPoint = this.containsPoint; + + this.renderWebGL = this._renderCachedWebGL; + this.renderCanvas = this._renderCachedCanvas; + + this.destroy = this._cacheAsBitmapDestroy; + + } + else + { + if (this._cachedSprite) + { + this._destroyCachedDisplayObject(); + } + + this.renderWebGL = this._originalRenderWebGL; + this.renderCanvas = this._originalRenderCanvas; + this.getBounds = this._originalGetBounds; + + this.destroy = this._originalDestroy; + + this.updateTransform = this._originalUpdateTransform; + this.containsPoint = this._originalContainsPoint; + } } } }); +/** +* Renders a cached version of the sprite with WebGL +* +* @param renderer {WebGLRenderer} the WebGL renderer +* @private +*/ +DisplayObject.prototype._renderCachedWebGL = function (renderer) +{ + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) + { + return; + } + + this._initCachedDisplayObject( renderer ); -},{"../../core":29}],87:[function(require,module,exports){ -var core = require('../../core'), - BlurXFilter = require('./BlurXFilter'), - BlurYFilter = require('./BlurYFilter'); + renderer.setObjectRenderer(renderer.plugins.sprite); + renderer.plugins.sprite.render( this._cachedSprite ); +}; /** - * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - */ -function BlurFilter() +* Prepares the WebGL renderer to cache the sprite +* +* @param renderer {WebGLRenderer} the WebGL renderer +* @private +*/ +DisplayObject.prototype._initCachedDisplayObject = function (renderer) { - core.AbstractFilter.call(this); + if(this._cachedSprite) + { + return; + } - this.blurXFilter = new BlurXFilter(); - this.blurYFilter = new BlurYFilter(); -} + // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) + renderer.currentRenderer.flush(); + //this.filters= []; + // next we find the dimensions of the untransformed object + // this function also calls updatetransform on all its children as part of the measuring. This means we don't need to update the transform again in this function + // TODO pass an object to clone too? saves having to create a new one each time! + var bounds = this.getLocalBounds().clone(); -BlurFilter.prototype = Object.create(core.AbstractFilter.prototype); -BlurFilter.prototype.constructor = BlurFilter; -module.exports = BlurFilter; + // add some padding! + if(this._filters) + { + var padding = this._filters[0].padding; + bounds.x -= padding; + bounds.y -= padding; -BlurFilter.prototype.applyFilter = function (renderer, input, output) -{ - var renderTarget = renderer.filterManager.getRenderTarget(true); + bounds.width += padding * 2; + bounds.height += padding * 2; + } - this.blurXFilter.applyFilter(renderer, input, renderTarget); - this.blurYFilter.applyFilter(renderer, renderTarget, output); + // for now we cache the current renderTarget that the webGL renderer is currently using. + // this could be more elegent.. + var cachedRenderTarget = renderer.currentRenderTarget; + // We also store the filter stack - I will definitely look to change how this works a little later down the line. + var stack = renderer.filterManager.filterStack; - renderer.filterManager.returnRenderTarget(renderTarget); -}; + // this renderTexture will be used to store the cached DisplayObject + var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0); -Object.defineProperties(BlurFilter.prototype, { - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @memberOf BlurFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.padding = Math.abs(value) * 0.5; - this.blurXFilter.blur = this.blurYFilter.blur = value; - } - }, + // need to set // + var m = _tempMatrix; - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @memberof BlurYFilter# - * @default 1 - */ - passes: { - get: function () - { - return this.blurXFilter.passes; - }, - set: function (value) - { - this.blurXFilter.passes = this.blurYFilter.passes = value; - } - }, + m.tx = -bounds.x; + m.ty = -bounds.y; - /** - * Sets the strength of the blurX property - * - * @member {number} - * @memberOf BlurFilter# - * @default 2 - */ - blurX: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.blurXFilter.blur = value; - } - }, - /** - * Sets the strength of the blurY property - * - * @member {number} - * @memberOf BlurFilter# - * @default 2 - */ - blurY: { - get: function () - { - return this.blurYFilter.blur; - }, - set: function (value) - { - this.blurYFilter.blur = value; - } - } -}); -},{"../../core":29,"./BlurXFilter":88,"./BlurYFilter":89}],88:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + // set all properties to there original so we can render to a texture + this.renderWebGL = this._originalRenderWebGL; + renderTexture.render(this, m, true, true); -/** - * The BlurXFilter applies a horizontal Gaussian blur to an object. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - */ -function BlurXFilter() -{ - core.AbstractFilter.call(this, - // vertex shader - "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(-0.012 * strength, 0.0);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(-0.008 * strength, 0.0);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(-0.004 * strength, 0.0);\n vBlurTexCoords[ 3] = aTextureCoord + vec2( 0.004 * strength, 0.0);\n vBlurTexCoords[ 4] = aTextureCoord + vec2( 0.008 * strength, 0.0);\n vBlurTexCoords[ 5] = aTextureCoord + vec2( 0.012 * strength, 0.0);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", - // fragment shader - "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n}\n", - // set the uniforms - { - strength: { type: '1f', value: 1 } - } - ); + // now restore the state be setting the new properties + renderer.setRenderTarget(cachedRenderTarget); + renderer.filterManager.filterStack = stack; - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @memberof BlurXFilter# - * @default 1 - */ - this.passes = 1; + this.renderWebGL = this._renderCachedWebGL; + this.updateTransform = this.displayObjectUpdateTransform; + this.getBounds = this._getCachedBounds; - this.strength = 4; -} -BlurXFilter.prototype = Object.create(core.AbstractFilter.prototype); -BlurXFilter.prototype.constructor = BlurXFilter; -module.exports = BlurXFilter; + // create our cached sprite + this._cachedSprite = new core.Sprite(renderTexture); + this._cachedSprite.worldTransform = this.worldTransform; + this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); + this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); -BlurXFilter.prototype.applyFilter = function (renderer, input, output, clear) -{ - var shader = this.getShader(renderer); + // restore the transform of the cached sprite to avoid the nasty flicker.. + this.updateTransform(); - this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width); + // map the hit test.. + this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite); +}; - if(this.passes === 1) +/** +* Renders a cached version of the sprite with canvas +* +* @param renderer {CanvasRenderer} the Canvas renderer +* @private +*/ +DisplayObject.prototype._renderCachedCanvas = function (renderer) +{ + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - renderer.filterManager.applyFilter(shader, input, output, clear); + return; } - else - { - var renderTarget = renderer.filterManager.getRenderTarget(true); - var flip = input; - var flop = renderTarget; - - for(var i = 0; i < this.passes-1; i++) - { - renderer.filterManager.applyFilter(shader, flip, flop, true); + + this._initCachedDisplayObjectCanvas( renderer ); - var temp = flop; - flop = flip; - flip = temp; - } + this._cachedSprite.worldAlpha = this.worldAlpha; - renderer.filterManager.applyFilter(shader, flip, output, clear); + this._cachedSprite.renderCanvas(renderer); +}; - renderer.filterManager.returnRenderTarget(renderTarget); +//TODO this can be the same as the webGL verison.. will need to do a little tweaking first though.. +/** +* Prepares the Canvas renderer to cache the sprite +* +* @param renderer {CanvasRenderer} the Canvas renderer +* @private +*/ +DisplayObject.prototype._initCachedDisplayObjectCanvas = function (renderer) +{ + if(this._cachedSprite) + { + return; } -}; + //get bounds actually transforms the object for us already! + var bounds = this.getLocalBounds(); -Object.defineProperties(BlurXFilter.prototype, { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @memberof BlurXFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.strength; - }, - set: function (value) - { - this.padding = Math.abs(value) * 0.5; - this.strength = value; - } - } -}); + var cachedRenderTarget = renderer.context; -},{"../../core":29}],89:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0); + // need to set // + var m = _tempMatrix; -/** - * The BlurYFilter applies a horizontal Gaussian blur to an object. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - */ -function BlurYFilter() -{ - core.AbstractFilter.call(this, - // vertex shader - "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", - // fragment shader - "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n}\n", - // set the uniforms - { - strength: { type: '1f', value: 1 } - } - ); + m.tx = -bounds.x; + m.ty = -bounds.y; - this.passes = 1; - this.strength = 4; -} + // set all properties to there original so we can render to a texture + this.renderCanvas = this._originalRenderCanvas; -BlurYFilter.prototype = Object.create(core.AbstractFilter.prototype); -BlurYFilter.prototype.constructor = BlurYFilter; -module.exports = BlurYFilter; + renderTexture.render(this, m, true); -BlurYFilter.prototype.applyFilter = function (renderer, input, output, clear) -{ - var shader = this.getShader(renderer); + // now restore the state be setting the new properties + renderer.context = cachedRenderTarget; - this.uniforms.strength.value = Math.abs(this.strength) / 4 / this.passes * (input.frame.height / input.size.height); + this.renderCanvas = this._renderCachedCanvas; + this.updateTransform = this.displayObjectUpdateTransform; + this.getBounds = this._getCachedBounds; - if(this.passes === 1) - { - renderer.filterManager.applyFilter(shader, input, output, clear); - } - else - { - var renderTarget = renderer.filterManager.getRenderTarget(true); - var flip = input; - var flop = renderTarget; - for(var i = 0; i < this.passes-1; i++) - { - renderer.filterManager.applyFilter(shader, flip, flop, true); + // create our cached sprite + this._cachedSprite = new core.Sprite(renderTexture); + this._cachedSprite.worldTransform = this.worldTransform; + this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); + this._cachedSprite.anchor.y = -( bounds.y / bounds.height ); - var temp = flop; - flop = flip; - flip = temp; - } + this.updateTransform(); - renderer.filterManager.applyFilter(shader, flip, output, clear); + this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite); +}; - renderer.filterManager.returnRenderTarget(renderTarget); - } +/** +* Calculates the bounds of the cached sprite +* +* @private +*/ +DisplayObject.prototype._getCachedBounds = function () +{ + this._cachedSprite._currentBounds = null; + + return this._cachedSprite.getBounds(); }; +/** +* Destroys the cached sprite. +* +* @private +*/ +DisplayObject.prototype._destroyCachedDisplayObject = function () +{ + this._cachedSprite._texture.destroy(); + this._cachedSprite = null; +}; -Object.defineProperties(BlurYFilter.prototype, { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @memberof BlurYFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.strength; - }, - set: function (value) +DisplayObject.prototype._cacheAsBitmapDestroy = function () +{ + this.cacheAsBitmap = false; + this._originalDestroy(); +}; + +},{"../core":29}],83:[function(require,module,exports){ +var core = require('../core'); + +/** + * The instance name of the object. + * + * @member {string} + */ +core.DisplayObject.prototype.name = null; + +/** +* Returns the display object in the container +* +* @param name {string} instance name +* @return {DisplayObject} +*/ +core.Container.prototype.getChildByName = function (name) +{ + for (var i = 0; i < this.children.length; i++) + { + if (this.children[i].name === name) { - this.padding = Math.abs(value) * 0.5; - this.strength = value; + return this.children[i]; } } -}); + return null; +}; + +},{"../core":29}],84:[function(require,module,exports){ +var core = require('../core'); + +/** +* Returns the global position of the displayObject +* +* @param point {Point} the point to write the global value to. If null a new point will be returned +* @return {Point} +*/ +core.DisplayObject.prototype.getGlobalPosition = function (point) +{ + point = point || new core.Point(); + + if(this.parent) + { + this.displayObjectUpdateTransform(); + + point.x = this.worldTransform.tx; + point.y = this.worldTransform.ty; + } + else + { + point.x = this.position.x; + point.y = this.position.y; + } + + return point; +}; + +},{"../core":29}],85:[function(require,module,exports){ +/** + * @file Main export of the PIXI extras library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} + */ + +require('./cacheAsBitmap'); +require('./getChildByName'); +require('./getGlobalPosition'); + +/** + * @namespace PIXI.extras + */ +module.exports = { + MovieClip: require('./MovieClip'), + TilingSprite: require('./TilingSprite'), + BitmapText: require('./BitmapText') +}; -},{"../../core":29}],90:[function(require,module,exports){ +},{"./BitmapText":79,"./MovieClip":80,"./TilingSprite":81,"./cacheAsBitmap":82,"./getChildByName":83,"./getGlobalPosition":84}],86:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 +// TODO (cengler) - The Y is flipped in this shader for some reason. + +/** + * @author Vico @vicocotea + * original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h + */ + /** - * A Smart Blur Filter. + * An ASCII filter. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function SmartBlurFilter() +function AsciiFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 delta;\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\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 * percent);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n", - // uniforms + "precision mediump float;\n\nuniform vec4 dimensions;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && 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 return 0.0;\n}\n\nvoid main()\n{\n vec2 uv = gl_FragCoord.xy;\n\n vec3 col = texture2D(uSampler, floor( uv / pixelSize ) * pixelSize / dimensions.xy).rgb;\n\n float gray = (col.r + col.g + col.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 vec2 p = mod( uv / ( pixelSize * 0.5 ), 2.0) - vec2(1.0);\n col = col * character(n, p);\n\n gl_FragColor = vec4(col, 1.0);\n}\n", + // custom uniforms { - delta: { type: 'v2', value: { x: 0.1, y: 0.0 } } + dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) }, + pixelSize: { type: '1f', value: 8 } } ); } -SmartBlurFilter.prototype = Object.create(core.AbstractFilter.prototype); -SmartBlurFilter.prototype.constructor = SmartBlurFilter; -module.exports = SmartBlurFilter; +AsciiFilter.prototype = Object.create(core.AbstractFilter.prototype); +AsciiFilter.prototype.constructor = AsciiFilter; +module.exports = AsciiFilter; -},{"../../core":29}],91:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 +Object.defineProperties(AsciiFilter.prototype, { + /** + * The pixel size used by the filter. + * + * @member {number} + * @memberof AsciiFilter# + */ + size: { + get: function () + { + return this.uniforms.pixelSize.value; + }, + set: function (value) + { + this.uniforms.pixelSize.value = value; + } + } +}); +},{"../../core":29}],87:[function(require,module,exports){ +var core = require('../../core'), + BlurXFilter = require('../blur/BlurXFilter'), + BlurYFilter = require('../blur/BlurYFilter'); /** - * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA - * color and alpha values of every pixel on your displayObject to produce a result - * with a new set of RGBA color and alpha values. It's pretty powerful! + * The BloomFilter applies a Gaussian blur to an object. + * The strength of the blur can be set for x- and y-axis separately. * - * ```js - * var colorMatrix = new PIXI.ColorMatrixFilter(); - * container.filters = [colorMatrix]; - * colorMatrix.contrast(2); - * ``` - * @author Clément Chenebault * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function ColorMatrixFilter() +function BloomFilter() { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[25];\n\nvoid main(void)\n{\n\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n gl_FragColor.r = (m[0] * c.r);\n gl_FragColor.r += (m[1] * c.g);\n gl_FragColor.r += (m[2] * c.b);\n gl_FragColor.r += (m[3] * c.a);\n gl_FragColor.r += m[4];\n\n gl_FragColor.g = (m[5] * c.r);\n gl_FragColor.g += (m[6] * c.g);\n gl_FragColor.g += (m[7] * c.b);\n gl_FragColor.g += (m[8] * c.a);\n gl_FragColor.g += m[9];\n\n gl_FragColor.b = (m[10] * c.r);\n gl_FragColor.b += (m[11] * c.g);\n gl_FragColor.b += (m[12] * c.b);\n gl_FragColor.b += (m[13] * c.a);\n gl_FragColor.b += m[14];\n\n gl_FragColor.a = (m[15] * c.r);\n gl_FragColor.a += (m[16] * c.g);\n gl_FragColor.a += (m[17] * c.b);\n gl_FragColor.a += (m[18] * c.a);\n gl_FragColor.a += m[19];\n\n}\n", - // custom uniforms - { - m: { - type: '1fv', value: [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0 - ] - } - } - ); -} + core.AbstractFilter.call(this); -ColorMatrixFilter.prototype = Object.create(core.AbstractFilter.prototype); -ColorMatrixFilter.prototype.constructor = ColorMatrixFilter; -module.exports = ColorMatrixFilter; + this.blurXFilter = new BlurXFilter(); + this.blurYFilter = new BlurYFilter(); + this.defaultFilter = new core.AbstractFilter(); +} -/** - * Transforms current matrix and set the new one - * - * @param matrix {number[]} (mat 5x4) - * @param multiply {boolean} if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix - */ -ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) +BloomFilter.prototype = Object.create(core.AbstractFilter.prototype); +BloomFilter.prototype.constructor = BloomFilter; +module.exports = BloomFilter; + +BloomFilter.prototype.applyFilter = function (renderer, input, output) { - multiply = !!multiply; + var renderTarget = renderer.filterManager.getRenderTarget(true); - var newMatrix = matrix; + //TODO - copyTexSubImage2D could be used here? + this.defaultFilter.applyFilter(renderer, input, output); - if (multiply) { - this._multiply(newMatrix, this.uniforms.m.value, matrix); - newMatrix = this._colorMatrix(newMatrix); - } + this.blurXFilter.applyFilter(renderer, input, renderTarget); - // set the new matrix - this.uniforms.m.value = newMatrix; -}; + renderer.blendModeManager.setBlendMode(core.BLEND_MODES.SCREEN); -/** - * Multiplies two mat5's - * - * @param out {array} (mat 5x4) the receiving matrix - * @param a {array} (mat 5x4) the first operand - * @param b {array} (mat 5x4) the second operand - * @returns out {array} (mat 5x4) - */ -ColorMatrixFilter.prototype._multiply = function (out, a, b) -{ + this.blurYFilter.applyFilter(renderer, renderTarget, output); - // Red Channel - out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); - out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); - out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); - out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); - out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]); + renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL); - // Green Channel - out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); - out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); - out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); - out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); - out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]); + renderer.filterManager.returnRenderTarget(renderTarget); +}; - // Blue Channel - out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); - out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); - out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); - out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); - out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]); +Object.defineProperties(BloomFilter.prototype, { + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * + * @member {number} + * @memberOf BloomFilter# + * @default 2 + */ + blur: { + get: function () + { + return this.blurXFilter.blur; + }, + set: function (value) + { + this.blurXFilter.blur = this.blurYFilter.blur = value; + } + }, - // Alpha Channel - out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); - out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); - out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); - out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); - out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]); + /** + * Sets the strength of the blurX property + * + * @member {number} + * @memberOf BloomFilter# + * @default 2 + */ + blurX: { + get: function () + { + return this.blurXFilter.blur; + }, + set: function (value) + { + this.blurXFilter.blur = value; + } + }, - return out; -}; + /** + * Sets the strength of the blurY property + * + * @member {number} + * @memberOf BloomFilter# + * @default 2 + */ + blurY: { + get: function () + { + return this.blurYFilter.blur; + }, + set: function (value) + { + this.blurYFilter.blur = value; + } + } +}); -/** - * Create a Float32 Array and normalize the offset component to 0-1 - * - * @param matrix {number[]} (mat 5x4) - * @return m {number[]} (mat 5x4) with all values between 0-1 - */ -ColorMatrixFilter.prototype._colorMatrix = function (matrix) -{ - // Create a Float32 Array and normalize the offset component to 0-1 - var m = new Float32Array(matrix); - m[4] /= 255; - m[9] /= 255; - m[14] /= 255; - m[19] /= 255; +},{"../../core":29,"../blur/BlurXFilter":90,"../blur/BlurYFilter":91}],88:[function(require,module,exports){ +var core = require('../../core'); - return m; -}; /** - * Adjusts brightness + * The BlurDirFilter applies a Gaussian blur toward a direction to an object. * - * Multiply the current matrix - * @param b {number} value of the brigthness (0 is black) - * @param multiply {boolean} refer to ._loadMatrix() method + * @class + * @param {number} dirX + * @param {number} dirY + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -ColorMatrixFilter.prototype.brightness = function (b, multiply) +function BlurDirFilter(dirX, dirY) { - var matrix = [ - b, 0, 0, 0, 0, - 0, b, 0, 0, 0, - 0, 0, b, 0, 0, - 0, 0, 0, 1, 0 - ]; + core.AbstractFilter.call(this, + // vertex shader + "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform float dirX;\nuniform float dirY;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[3];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[0] = aTextureCoord + vec2( (0.004 * strength) * dirX, (0.004 * strength) * dirY );\n vBlurTexCoords[1] = aTextureCoord + vec2( (0.008 * strength) * dirX, (0.008 * strength) * dirY );\n vBlurTexCoords[2] = aTextureCoord + vec2( (0.012 * strength) * dirX, (0.012 * strength) * dirY );\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", + // fragment shader + "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[3];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vTextureCoord ) * 0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0]) * 0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1]) * 0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2]) * 0.004431848411938341;\n}\n", + // set the uniforms + { + strength: { type: '1f', value: 1 }, + dirX: { type: '1f', value: dirX || 0 }, + dirY: { type: '1f', value: dirY || 0 } + } + ); - this._loadMatrix(matrix, multiply); -}; + this.defaultFilter = new core.AbstractFilter(); -/** - * Set the matrices in grey scales - * - * Multiply the current matrix - * @param scale {number} value of the grey (0 is black) - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.greyscale = function (scale, multiply) -{ - var matrix = [ - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - 0, 0, 0, 1, 0 - ]; + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @memberof BlurDirFilter# + * @default 1 + */ + this.passes = 1; - this._loadMatrix(matrix, multiply); -}; -//Americanized alias -ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; + /** + * Sets the X direction of the blur + * + * @member {number} + * @memberof BlurDirFilter# + * @default 0 + */ + this.dirX = dirX || 0; -/** - * Set the black and white matrice - * Multiply the current matrix - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.blackAndWhite = function (multiply) -{ - var matrix = [ - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0, 0, 0, 1, 0 - ]; + /** + * Sets the Y direction of the blur + * + * @member {number} + * @memberof BlurDirFilter# + * @default 0 + */ + this.dirY = dirY || 0; - this._loadMatrix(matrix, multiply); -}; + this.strength = 4; +} -/** - * Set the hue property of the color - * - * Multiply the current matrix - * @param rotation {number} in degrees - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.hue = function (rotation, multiply) -{ - rotation = (rotation || 0) / 180 * Math.PI; - var cos = Math.cos(rotation), - sin = Math.sin(rotation); +BlurDirFilter.prototype = Object.create(core.AbstractFilter.prototype); +BlurDirFilter.prototype.constructor = BlurDirFilter; +module.exports = BlurDirFilter; - // luminanceRed, luminanceGreen, luminanceBlue - var lumR = 0.213, // or 0.3086 - lumG = 0.715, // or 0.6094 - lumB = 0.072; // or 0.0820 +BlurDirFilter.prototype.applyFilter = function (renderer, input, output, clear) { - var matrix = [ - lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, - lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0, - lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, - 0, 0, 0, 1, 0 - ]; + var shader = this.getShader(renderer); - this._loadMatrix(matrix, multiply); -}; + this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width); + if (this.passes === 1) { + renderer.filterManager.applyFilter(shader, input, output, clear); + } else { + var renderTarget = renderer.filterManager.getRenderTarget(true); -/** - * Set the contrast matrix, increase the separation between dark and bright - * Increase contrast : shadows darker and highlights brighter - * Decrease contrast : bring the shadows up and the highlights down - * - * @param amount {number} value of the contrast - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.contrast = function (amount, multiply) -{ - var v = (amount || 0) + 1; - var o = -128 * (v - 1); + renderer.filterManager.applyFilter(shader, input, renderTarget, clear); - var matrix = [ - v, 0, 0, 0, o, - 0, v, 0, 0, o, - 0, 0, v, 0, o, - 0, 0, 0, 1, 0 - ]; + for(var i = 0; i < this.passes-2; i++) + { + //this.uniforms.strength.value = this.strength / 4 / (this.passes+(i*2)) * (input.frame.width / input.size.width); + renderer.filterManager.applyFilter(shader, renderTarget, renderTarget, clear); + } - this._loadMatrix(matrix, multiply); + renderer.filterManager.applyFilter(shader, renderTarget, output, clear); + + renderer.filterManager.returnRenderTarget(renderTarget); + } }; -/** - * Set the saturation matrix, increase the separation between colors - * Increase saturation : increase contrast, brightness, and sharpness - * @param amount {number} - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.saturate = function (amount, multiply) -{ - var x = (amount || 0) * 2 / 3 + 1; - var y = ((x - 1) * -0.5); - var matrix = [ - x, y, y, 0, 0, - y, x, y, 0, 0, - y, y, x, 0, 0, - 0, 0, 0, 1, 0 - ]; +Object.defineProperties(BlurDirFilter.prototype, { + /** + * Sets the strength of both the blur. + * + * @member {number} + * @memberof BlurDirFilter# + * @default 2 + */ + blur: { + get: function () + { + return this.strength; + }, + set: function (value) + { + this.padding = value * 0.5; + this.strength = value; + } + }, + /** + * Sets the X direction of the blur. + * + * @member {number} + * @memberof BlurYFilter# + * @default 0 + */ + dirX: { + get: function () + { + return this.dirX; + }, + set: function (value) + { + this.uniforms.dirX.value = value; + } + }, + /** + * Sets the Y direction of the blur. + * + * @member {number} + * @memberof BlurDirFilter# + * @default 0 + */ + dirY: { + get: function () + { + return this.dirY; + }, + set: function (value) + { + this.uniforms.dirY.value = value; + } + } +}); - this._loadMatrix(matrix, multiply); -}; +},{"../../core":29}],89:[function(require,module,exports){ +var core = require('../../core'), + BlurXFilter = require('./BlurXFilter'), + BlurYFilter = require('./BlurYFilter'); /** - * Desaturate image (remove color) - * - * Call the saturate function + * The BlurFilter applies a Gaussian blur to an object. + * The strength of the blur can be set for x- and y-axis separately. * - * @param multiply {boolean} refer to ._loadMatrix() method + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -ColorMatrixFilter.prototype.desaturate = function (multiply) // jshint unused:false +function BlurFilter() { - this.saturate(-1); -}; + core.AbstractFilter.call(this); -/** - * Negative image (inverse of classic rgb matrix) - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.negative = function (multiply) -{ - var matrix = [ - 0, 1, 1, 0, 0, - 1, 0, 1, 0, 0, - 1, 1, 0, 0, 0, - 0, 0, 0, 1, 0 - ]; + this.blurXFilter = new BlurXFilter(); + this.blurYFilter = new BlurYFilter(); +} - this._loadMatrix(matrix, multiply); -}; +BlurFilter.prototype = Object.create(core.AbstractFilter.prototype); +BlurFilter.prototype.constructor = BlurFilter; +module.exports = BlurFilter; -/** - * Sepia image - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.sepia = function (multiply) +BlurFilter.prototype.applyFilter = function (renderer, input, output) { - var matrix = [ - 0.393, 0.7689999, 0.18899999, 0, 0, - 0.349, 0.6859999, 0.16799999, 0, 0, - 0.272, 0.5339999, 0.13099999, 0, 0, - 0, 0, 0, 1, 0 - ]; + var renderTarget = renderer.filterManager.getRenderTarget(true); - this._loadMatrix(matrix, multiply); + this.blurXFilter.applyFilter(renderer, input, renderTarget); + this.blurYFilter.applyFilter(renderer, renderTarget, output); + + renderer.filterManager.returnRenderTarget(renderTarget); }; -/** - * Color motion picture process invented in 1916 (thanks Dominic Szablewski) - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.technicolor = function (multiply) -{ - var matrix = [ - 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, - -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, - -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, - 0, 0, 0, 1, 0 - ]; +Object.defineProperties(BlurFilter.prototype, { + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * + * @member {number} + * @memberOf BlurFilter# + * @default 2 + */ + blur: { + get: function () + { + return this.blurXFilter.blur; + }, + set: function (value) + { + this.padding = Math.abs(value) * 0.5; + this.blurXFilter.blur = this.blurYFilter.blur = value; + } + }, - this._loadMatrix(matrix, multiply); -}; + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @memberof BlurYFilter# + * @default 1 + */ + passes: { + get: function () + { + return this.blurXFilter.passes; + }, + set: function (value) + { + this.blurXFilter.passes = this.blurYFilter.passes = value; + } + }, -/** - * Polaroid filter - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.polaroid = function (multiply) -{ - var matrix = [ - 1.438, -0.062, -0.062, 0, 0, - -0.122, 1.378, -0.122, 0, 0, - -0.016, -0.016, 1.483, 0, 0, - 0, 0, 0, 1, 0 - ]; + /** + * Sets the strength of the blurX property + * + * @member {number} + * @memberOf BlurFilter# + * @default 2 + */ + blurX: { + get: function () + { + return this.blurXFilter.blur; + }, + set: function (value) + { + this.blurXFilter.blur = value; + } + }, + + /** + * Sets the strength of the blurY property + * + * @member {number} + * @memberOf BlurFilter# + * @default 2 + */ + blurY: { + get: function () + { + return this.blurYFilter.blur; + }, + set: function (value) + { + this.blurYFilter.blur = value; + } + } +}); + +},{"../../core":29,"./BlurXFilter":90,"./BlurYFilter":91}],90:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - this._loadMatrix(matrix, multiply); -}; /** - * Filter who transforms : Red -> Blue and Blue -> Red + * The BlurXFilter applies a horizontal Gaussian blur to an object. * - * @param multiply {boolean} refer to ._loadMatrix() method + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -ColorMatrixFilter.prototype.toBGR = function (multiply) +function BlurXFilter() { - var matrix = [ - 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0 - ]; - - this._loadMatrix(matrix, multiply); -}; - -/** - * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.kodachrome = function (multiply) -{ - var matrix = [ - 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, - -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, - -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, - 0, 0, 0, 1, 0 - ]; - - this._loadMatrix(matrix, multiply); -}; - -/** - * Brown delicious browni filter (thanks Dominic Szablewski) - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.browni = function (multiply) -{ - var matrix = [ - 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, - -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, - 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, - 0, 0, 0, 1, 0 - ]; - - this._loadMatrix(matrix, multiply); -}; - -/* - * Vintage filter (thanks Dominic Szablewski) - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.vintage = function (multiply) -{ - var matrix = [ - 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, - 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, - 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, - 0, 0, 0, 1, 0 - ]; - - this._loadMatrix(matrix, multiply); -}; - -/* - * We don't know exactly what it does, kind of gradient map, but funny to play with! - * - * @param desaturation {number} - * @param toned {number} - * @param lightColor {string} (example : "0xFFE580") - * @param darkColor {string} (example : "0xFFE580") - * - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) -{ - desaturation = desaturation || 0.2; - toned = toned || 0.15; - lightColor = lightColor || 0xFFE580; - darkColor = darkColor || 0x338000; - - var lR = ((lightColor >> 16) & 0xFF) / 255; - var lG = ((lightColor >> 8) & 0xFF) / 255; - var lB = (lightColor & 0xFF) / 255; + core.AbstractFilter.call(this, + // vertex shader + "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(-0.012 * strength, 0.0);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(-0.008 * strength, 0.0);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(-0.004 * strength, 0.0);\n vBlurTexCoords[ 3] = aTextureCoord + vec2( 0.004 * strength, 0.0);\n vBlurTexCoords[ 4] = aTextureCoord + vec2( 0.008 * strength, 0.0);\n vBlurTexCoords[ 5] = aTextureCoord + vec2( 0.012 * strength, 0.0);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", + // fragment shader + "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n}\n", + // set the uniforms + { + strength: { type: '1f', value: 1 } + } + ); - var dR = ((darkColor >> 16) & 0xFF) / 255; - var dG = ((darkColor >> 8) & 0xFF) / 255; - var dB = (darkColor & 0xFF) / 255; + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @memberof BlurXFilter# + * @default 1 + */ + this.passes = 1; - var matrix = [ - 0.3, 0.59, 0.11, 0, 0, - lR, lG, lB, desaturation, 0, - dR, dG, dB, toned, 0, - lR - dR, lG - dG, lB - dB, 0, 0 - ]; + this.strength = 4; +} - this._loadMatrix(matrix, multiply); -}; +BlurXFilter.prototype = Object.create(core.AbstractFilter.prototype); +BlurXFilter.prototype.constructor = BlurXFilter; +module.exports = BlurXFilter; -/* - * Night effect - * - * @param intensity {number} - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.night = function (intensity, multiply) +BlurXFilter.prototype.applyFilter = function (renderer, input, output, clear) { - intensity = intensity || 0.1; - var matrix = [ - intensity * ( -2.0), -intensity, 0, 0, 0, - -intensity, 0, intensity, 0, 0, - 0, intensity, intensity * 2.0, 0, 0, - 0, 0, 0, 1, 0 - ]; - - this._loadMatrix(matrix, multiply); -}; - + var shader = this.getShader(renderer); -/* - * Predator effect - * - * Erase the current matrix by setting a new indepent one - * - * @param amount {number} how much the predator feels his future victim - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.predator = function (amount, multiply) -{ - var matrix = [ - 11.224130630493164 * amount, -4.794486999511719 * amount, -2.8746118545532227 * amount, 0 * amount, 0.40342438220977783 * amount, - -3.6330697536468506 * amount, 9.193157196044922 * amount, -2.951810836791992 * amount, 0 * amount, -1.316135048866272 * amount, - -3.2184197902679443 * amount, -4.2375030517578125 * amount, 7.476448059082031 * amount, 0 * amount, 0.8044459223747253 * amount, - 0, 0, 0, 1, 0 - ]; + this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width); - this._loadMatrix(matrix, multiply); -}; + if(this.passes === 1) + { + renderer.filterManager.applyFilter(shader, input, output, clear); + } + else + { + var renderTarget = renderer.filterManager.getRenderTarget(true); + var flip = input; + var flop = renderTarget; -/* - * LSD effect - * - * Multiply the current matrix - * - * @param amount {number} How crazy is your effect - * @param multiply {boolean} refer to ._loadMatrix() method - */ -ColorMatrixFilter.prototype.lsd = function (multiply) -{ - var matrix = [ - 2, -0.4, 0.5, 0, 0, - -0.5, 2, -0.4, 0, 0, - -0.4, -0.5, 3, 0, 0, - 0, 0, 0, 1, 0 - ]; + for(var i = 0; i < this.passes-1; i++) + { + renderer.filterManager.applyFilter(shader, flip, flop, true); - this._loadMatrix(matrix, multiply); -}; + var temp = flop; + flop = flip; + flip = temp; + } -/* - * Reset function - * - * Erase the current matrix by setting the default one - * - */ -ColorMatrixFilter.prototype.reset = function () -{ - var matrix = [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0 - ]; + renderer.filterManager.applyFilter(shader, flip, output, clear); - this._loadMatrix(matrix, false); + renderer.filterManager.returnRenderTarget(renderTarget); + } }; -Object.defineProperties(ColorMatrixFilter.prototype, { +Object.defineProperties(BlurXFilter.prototype, { /** - * Sets the matrix of the color matrix filter + * Sets the strength of both the blur. * - * @member {number[]} - * @memberof ColorMatrixFilter# - * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] + * @member {number} + * @memberof BlurXFilter# + * @default 2 */ - matrix: { + blur: { get: function () { - return this.uniforms.m.value; + return this.strength; }, set: function (value) { - this.uniforms.m.value = value; + this.padding = Math.abs(value) * 0.5; + this.strength = value; } } }); -},{"../../core":29}],92:[function(require,module,exports){ +},{"../../core":29}],91:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * This lowers the color depth of your image by the given amount, producing an image with a smaller palette. + * The BlurYFilter applies a horizontal Gaussian blur to an object. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function ColorStepFilter() +function BlurYFilter() { core.AbstractFilter.call(this, // vertex shader - null, + "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float step;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n color = floor(color * step) / step;\n\n gl_FragColor = color;\n}\n", - // custom uniforms + "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n}\n", + // set the uniforms { - step: { type: '1f', value: 5 } + strength: { type: '1f', value: 1 } } ); + + this.passes = 1; + this.strength = 4; } -ColorStepFilter.prototype = Object.create(core.AbstractFilter.prototype); -ColorStepFilter.prototype.constructor = ColorStepFilter; -module.exports = ColorStepFilter; +BlurYFilter.prototype = Object.create(core.AbstractFilter.prototype); +BlurYFilter.prototype.constructor = BlurYFilter; +module.exports = BlurYFilter; -Object.defineProperties(ColorStepFilter.prototype, { - /** - * The number of steps to reduce the palette by. - * - * @member {number} - * @memberof ColorStepFilter# - */ - step: { - get: function () - { - return this.uniforms.step.value; - }, - set: function (value) - { - this.uniforms.step.value = value; - } - } -}); +BlurYFilter.prototype.applyFilter = function (renderer, input, output, clear) +{ + var shader = this.getShader(renderer); -},{"../../core":29}],93:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + this.uniforms.strength.value = Math.abs(this.strength) / 4 / this.passes * (input.frame.height / input.size.height); + if(this.passes === 1) + { + renderer.filterManager.applyFilter(shader, input, output, clear); + } + else + { + var renderTarget = renderer.filterManager.getRenderTarget(true); + var flip = input; + var flop = renderTarget; -/** - * The ConvolutionFilter class applies a matrix convolution filter effect. - * A convolution combines pixels in the input image with neighboring pixels to produce a new image. - * A wide variety of image effects can be achieved through convolutions, including blurring, edge - * detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. - * See http://docs.gimp.org/en/plug-in-convmatrix.html for more info. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - * @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array. - * @param width {number} Width of the object you are transforming - * @param height {number} Height of the object you are transforming - */ -function ConvolutionFilter(matrix, width, height) -{ - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "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", - // custom uniforms + for(var i = 0; i < this.passes-1; i++) { - matrix: { type: '1fv', value: new Float32Array(matrix) }, - texelSize: { type: '2v', value: { x: 1 / width, y: 1 / height } } + renderer.filterManager.applyFilter(shader, flip, flop, true); + + var temp = flop; + flop = flip; + flip = temp; } - ); -} -ConvolutionFilter.prototype = Object.create(core.AbstractFilter.prototype); -ConvolutionFilter.prototype.constructor = ConvolutionFilter; -module.exports = ConvolutionFilter; + renderer.filterManager.applyFilter(shader, flip, output, clear); -Object.defineProperties(ConvolutionFilter.prototype, { - /** - * An array of values used for matrix transformation. Specified as a 9 point Array. - * - * @member {number[]} - * @memberof ConvolutionFilter# - */ - matrix: { - get: function () - { - return this.uniforms.matrix.value; - }, - set: function (value) - { - this.uniforms.matrix.value = new Float32Array(value); - } - }, + renderer.filterManager.returnRenderTarget(renderTarget); + } +}; - /** - * Width of the object you are transforming - * - * @member {number} - * @memberof ConvolutionFilter# - */ - width: { - get: function () - { - return 1/this.uniforms.texelSize.value.x; - }, - set: function (value) - { - this.uniforms.texelSize.value.x = 1/value; - } - }, +Object.defineProperties(BlurYFilter.prototype, { /** - * Height of the object you are transforming + * Sets the strength of both the blur. * * @member {number} - * @memberof ConvolutionFilter# + * @memberof BlurYFilter# + * @default 2 */ - height: { + blur: { get: function () { - return 1/this.uniforms.texelSize.value.y; + return this.strength; }, set: function (value) { - this.uniforms.texelSize.value.y = 1/value; + this.padding = Math.abs(value) * 0.5; + this.strength = value; } } }); -},{"../../core":29}],94:[function(require,module,exports){ +},{"../../core":29}],92:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * A Cross Hatch effect filter. + * A Smart Blur Filter. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function CrossHatchFilter() +function SmartBlurFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader - "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" + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 delta;\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\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 * percent);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n", + // uniforms + { + delta: { type: 'v2', value: { x: 0.1, y: 0.0 } } + } ); } -CrossHatchFilter.prototype = Object.create(core.AbstractFilter.prototype); -CrossHatchFilter.prototype.constructor = CrossHatchFilter; -module.exports = CrossHatchFilter; +SmartBlurFilter.prototype = Object.create(core.AbstractFilter.prototype); +SmartBlurFilter.prototype.constructor = SmartBlurFilter; +module.exports = SmartBlurFilter; -},{"../../core":29}],95:[function(require,module,exports){ +},{"../../core":29}],93:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * The DisplacementFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object. - * You can use this filter to apply all manor of crazy warping effects - * Currently the r property of the texture is used to offset the x and the g property of the texture is used to offset the y. + * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA + * color and alpha values of every pixel on your displayObject to produce a result + * with a new set of RGBA color and alpha values. It's pretty powerful! * + * ```js + * var colorMatrix = new PIXI.ColorMatrixFilter(); + * container.filters = [colorMatrix]; + * colorMatrix.contrast(2); + * ``` + * @author Clément Chenebault * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters - * @param sprite {Sprite} the sprite used for the displacement map. (make sure its added to the scene!) */ -function DisplacementFilter(sprite) +function ColorMatrixFilter() { - var maskMatrix = new core.math.Matrix(); - sprite.renderable = false; - core.AbstractFilter.call(this, // vertex shader - "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vMapCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", + null, // fragment shader - "precision lowp float;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec2 scale;\n\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nvoid main(void)\n{\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 map = texture2D(mapSampler, vMapCoord);\n\n map -= 0.5;\n map.xy *= scale;\n\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));\n}\n", - // uniforms + "precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[25];\n\nvoid main(void)\n{\n\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n gl_FragColor.r = (m[0] * c.r);\n gl_FragColor.r += (m[1] * c.g);\n gl_FragColor.r += (m[2] * c.b);\n gl_FragColor.r += (m[3] * c.a);\n gl_FragColor.r += m[4];\n\n gl_FragColor.g = (m[5] * c.r);\n gl_FragColor.g += (m[6] * c.g);\n gl_FragColor.g += (m[7] * c.b);\n gl_FragColor.g += (m[8] * c.a);\n gl_FragColor.g += m[9];\n\n gl_FragColor.b = (m[10] * c.r);\n gl_FragColor.b += (m[11] * c.g);\n gl_FragColor.b += (m[12] * c.b);\n gl_FragColor.b += (m[13] * c.a);\n gl_FragColor.b += m[14];\n\n gl_FragColor.a = (m[15] * c.r);\n gl_FragColor.a += (m[16] * c.g);\n gl_FragColor.a += (m[17] * c.b);\n gl_FragColor.a += (m[18] * c.a);\n gl_FragColor.a += m[19];\n\n}\n", + // custom uniforms { - mapSampler: { type: 'sampler2D', value: sprite.texture }, - otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }, - scale: { type: 'v2', value: { x: 1, y: 1 } } + m: { + type: '1fv', value: [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ] + } } ); - - this.maskSprite = sprite; - this.maskMatrix = maskMatrix; - - - this.scale = new core.math.Point(20,20); - } -DisplacementFilter.prototype = Object.create(core.AbstractFilter.prototype); -DisplacementFilter.prototype.constructor = DisplacementFilter; -module.exports = DisplacementFilter; - -DisplacementFilter.prototype.applyFilter = function (renderer, input, output) -{ - var filterManager = renderer.filterManager; - - filterManager.calculateMappedMatrix(input.frame, this.maskSprite, this.maskMatrix); - - this.uniforms.otherMatrix.value = this.maskMatrix.toArray(true); - this.uniforms.scale.value.x = this.scale.x * (1/input.frame.width); - this.uniforms.scale.value.y = this.scale.y * (1/input.frame.height); +ColorMatrixFilter.prototype = Object.create(core.AbstractFilter.prototype); +ColorMatrixFilter.prototype.constructor = ColorMatrixFilter; +module.exports = ColorMatrixFilter; - var shader = this.getShader(renderer); - // draw the filter... - filterManager.applyFilter(shader, input, output); -}; +/** + * Transforms current matrix and set the new one + * + * @param matrix {number[]} (mat 5x4) + * @param multiply {boolean} if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix + */ +ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) +{ + multiply = !!multiply; -Object.defineProperties(DisplacementFilter.prototype, { - /** - * The texture used for the displacement map. Must be power of 2 sized texture. - * - * @member {Texture} - * @memberof DisplacementFilter# - */ - map: { - get: function () - { - return this.uniforms.mapSampler.value; - }, - set: function (value) - { - this.uniforms.mapSampler.value = value; + var newMatrix = matrix; - } + if (multiply) { + this._multiply(newMatrix, this.uniforms.m.value, matrix); + newMatrix = this._colorMatrix(newMatrix); } -}); - -},{"../../core":29}],96:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + // set the new matrix + this.uniforms.m.value = newMatrix; +}; /** - * @author Mat Groves http://matgroves.com/ @Doormat23 - * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js - */ - -/** - * This filter applies a dotscreen effect making display objects appear to be made out of - * black and white halftone dots like an old printer. + * Multiplies two mat5's * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param out {array} (mat 5x4) the receiving matrix + * @param a {array} (mat 5x4) the first operand + * @param b {array} (mat 5x4) the second operand + * @returns out {array} (mat 5x4) */ -function DotScreenFilter() +ColorMatrixFilter.prototype._multiply = function (out, a, b) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 dimensions;\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 * dimensions.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", - // custom uniforms - { - scale: { type: '1f', value: 1 }, - angle: { type: '1f', value: 5 }, - dimensions: { type: '4fv', value: [0, 0, 0, 0] } - } - ); -} -DotScreenFilter.prototype = Object.create(core.AbstractFilter.prototype); -DotScreenFilter.prototype.constructor = DotScreenFilter; -module.exports = DotScreenFilter; - -Object.defineProperties(DotScreenFilter.prototype, { - /** - * The scale of the effect. - * @member {number} - * @memberof DotScreenFilter# - */ - scale: { - get: function () - { - return this.uniforms.scale.value; - }, - set: function (value) - { - this.uniforms.scale.value = value; - } - }, + // Red Channel + out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); + out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); + out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); + out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); + out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]); - /** - * The radius of the effect. - * @member {number} - * @memberof DotScreenFilter# - */ - angle: { - get: function () - { - return this.uniforms.angle.value; - }, - set: function (value) - { - this.uniforms.angle.value = value; - } - } -}); + // Green Channel + out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); + out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); + out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); + out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); + out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]); -},{"../../core":29}],97:[function(require,module,exports){ -var core = require('../../core'); + // Blue Channel + out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); + out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); + out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); + out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); + out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]); -// @see https://github.com/substack/brfs/issues/25 + // Alpha Channel + out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); + out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); + out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); + out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); + out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]); + return out; +}; /** - * The BlurYTintFilter applies a vertical Gaussian blur to an object. + * Create a Float32 Array and normalize the offset component to 0-1 * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param matrix {number[]} (mat 5x4) + * @return m {number[]} (mat 5x4) with all values between 0-1 */ -function BlurYTintFilter() +ColorMatrixFilter.prototype._colorMatrix = function (matrix) { - core.AbstractFilter.call(this, - // vertex shader - "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform vec2 offset;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition+offset), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", - // fragment shader - "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform vec3 color;\nuniform float alpha;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec4 sum = vec4(0.0);\n\n sum += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n sum += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n sum += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n sum += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n sum += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n\n gl_FragColor = vec4( color.rgb * sum.a * alpha, sum.a * alpha );\n}\n", - // set the uniforms - { - blur: { type: '1f', value: 1 / 512 }, - color: { type: 'c', value: [0,0,0]}, - alpha: { type: '1f', value: 0.7 }, - offset: { type: '2f', value:[5, 5]}, - strength: { type: '1f', value:1} - } - ); - - this.passes = 1; - this.strength = 4; -} + // Create a Float32 Array and normalize the offset component to 0-1 + var m = new Float32Array(matrix); + m[4] /= 255; + m[9] /= 255; + m[14] /= 255; + m[19] /= 255; -BlurYTintFilter.prototype = Object.create(core.AbstractFilter.prototype); -BlurYTintFilter.prototype.constructor = BlurYTintFilter; -module.exports = BlurYTintFilter; + return m; +}; -BlurYTintFilter.prototype.applyFilter = function (renderer, input, output, clear) +/** + * Adjusts brightness + * + * Multiply the current matrix + * @param b {number} value of the brigthness (0 is black) + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.brightness = function (b, multiply) { - var shader = this.getShader(renderer); - - this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.height / input.size.height); - - if(this.passes === 1) - { - renderer.filterManager.applyFilter(shader, input, output, clear); - } - else - { - var renderTarget = renderer.filterManager.getRenderTarget(true); - var flip = input; - var flop = renderTarget; - - for(var i = 0; i < this.passes-1; i++) - { - renderer.filterManager.applyFilter(shader, flip, flop, clear); - - var temp = flop; - flop = flip; - flip = temp; - } - - renderer.filterManager.applyFilter(shader, flip, output, clear); + var matrix = [ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0 + ]; - renderer.filterManager.returnRenderTarget(renderTarget); - } + this._loadMatrix(matrix, multiply); }; - -Object.defineProperties(BlurYTintFilter.prototype, { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @memberof BlurYFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.strength; - }, - set: function (value) - { - this.padding = value * 0.5; - this.strength = value; - } - } -}); - -},{"../../core":29}],98:[function(require,module,exports){ -var core = require('../../core'), - BlurXFilter = require('../blur/BlurXFilter'), - BlurYTintFilter = require('./BlurYTintFilter'); - /** - * The DropShadowFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * Set the matrices in grey scales * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * Multiply the current matrix + * @param scale {number} value of the grey (0 is black) + * @param multiply {boolean} refer to ._loadMatrix() method */ -function DropShadowFilter() +ColorMatrixFilter.prototype.greyscale = function (scale, multiply) { - core.AbstractFilter.call(this); - - this.blurXFilter = new BlurXFilter(); - this.blurYTintFilter = new BlurYTintFilter(); - - this.defaultFilter = new core.AbstractFilter(); - - this.padding = 30; - - this._dirtyPosition = true; - this._angle = 45 * Math.PI / 180; - this._distance = 10; - this.alpha = 0.75; - this.hideObject = false; - this.blendMode = core.BLEND_MODES.MULTIPLY; -} + var matrix = [ + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + 0, 0, 0, 1, 0 + ]; -DropShadowFilter.prototype = Object.create(core.AbstractFilter.prototype); -DropShadowFilter.prototype.constructor = DropShadowFilter; -module.exports = DropShadowFilter; + this._loadMatrix(matrix, multiply); +}; +//Americanized alias +ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; -DropShadowFilter.prototype.applyFilter = function (renderer, input, output) +/** + * Set the black and white matrice + * Multiply the current matrix + * + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.blackAndWhite = function (multiply) { - var renderTarget = renderer.filterManager.getRenderTarget(true); - - //TODO - copyTexSubImage2D could be used here? - if(this._dirtyPosition) - { - this._dirtyPosition = false; - - this.blurYTintFilter.uniforms.offset.value[0] = Math.sin(this._angle) * this._distance; - this.blurYTintFilter.uniforms.offset.value[1] = Math.cos(this._angle) * this._distance; - } - - this.blurXFilter.applyFilter(renderer, input, renderTarget); - - renderer.blendModeManager.setBlendMode(this.blendMode); - - this.blurYTintFilter.applyFilter(renderer, renderTarget, output); - - renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL); - - if(!this.hideObject) - { - - this.defaultFilter.applyFilter(renderer, input, output); - } - + var matrix = [ + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0, 0, 0, 1, 0 + ]; - renderer.filterManager.returnRenderTarget(renderTarget); + this._loadMatrix(matrix, multiply); }; -Object.defineProperties(DropShadowFilter.prototype, { - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @memberOf DropShadowFilter# - * @default 2 - */ - blur: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.blurXFilter.blur = this.blurYTintFilter.blur = value; - } - }, - - /** - * Sets the strength of the blurX property - * - * @member {number} - * @memberOf DropShadowFilter# - * @default 2 - */ - blurX: { - get: function () - { - return this.blurXFilter.blur; - }, - set: function (value) - { - this.blurXFilter.blur = value; - } - }, - - /** - * Sets the strength of the blurY property - * - * @member {number} - * @memberOf DropShadowFilter# - * @default 2 - */ - blurY: { - get: function () - { - return this.blurYTintFilter.blur; - }, - set: function (value) - { - this.blurYTintFilter.blur = value; - } - }, - - color: { - get: function () - { - return core.utils.rgb2hex( this.blurYTintFilter.uniforms.color.value ); - }, - set: function (value) - { - this.blurYTintFilter.uniforms.color.value = core.utils.hex2rgb(value); - } - }, - - alpha: { - get: function () - { - return this.blurYTintFilter.uniforms.alpha.value; - }, - set: function (value) - { - this.blurYTintFilter.uniforms.alpha.value = value; - } - }, +/** + * Set the hue property of the color + * + * Multiply the current matrix + * @param rotation {number} in degrees + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.hue = function (rotation, multiply) +{ + rotation = (rotation || 0) / 180 * Math.PI; + var cos = Math.cos(rotation), + sin = Math.sin(rotation); - distance: { - get: function () - { - return this._distance; - }, - set: function (value) - { - this._dirtyPosition = true; - this._distance = value; - } - }, + // luminanceRed, luminanceGreen, luminanceBlue + var lumR = 0.213, // or 0.3086 + lumG = 0.715, // or 0.6094 + lumB = 0.072; // or 0.0820 - angle: { - get: function () - { - return this._angle; - }, - set: function (value) - { - this._dirtyPosition = true; - this._angle = value; - } - } -}); + var matrix = [ + lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, + lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0, + lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, + 0, 0, 0, 1, 0 + ]; -},{"../../core":29,"../blur/BlurXFilter":88,"./BlurYTintFilter":97}],99:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + this._loadMatrix(matrix, multiply); +}; /** - * This greyscales the palette of your Display Objects. + * Set the contrast matrix, increase the separation between dark and bright + * Increase contrast : shadows darker and highlights brighter + * Decrease contrast : bring the shadows up and the highlights down * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param amount {number} value of the contrast + * @param multiply {boolean} refer to ._loadMatrix() method */ -function GrayFilter() +ColorMatrixFilter.prototype.contrast = function (amount, multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\nuniform float gray;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);\n}\n", - // set the uniforms - { - gray: { type: '1f', value: 1 } - } - ); -} + var v = (amount || 0) + 1; + var o = -128 * (v - 1); -GrayFilter.prototype = Object.create(core.AbstractFilter.prototype); -GrayFilter.prototype.constructor = GrayFilter; -module.exports = GrayFilter; + var matrix = [ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0 + ]; -Object.defineProperties(GrayFilter.prototype, { - /** - * The strength of the gray. 1 will make the object black and white, 0 will make the object its normal color. - * - * @member {number} - * @memberof GrayFilter# - */ - gray: { - get: function () - { - return this.uniforms.gray.value; - }, - set: function (value) - { - this.uniforms.gray.value = value; - } - } -}); + this._loadMatrix(matrix, multiply); +}; -},{"../../core":29}],100:[function(require,module,exports){ /** - * @file Main export of the PIXI filters library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} + * Set the saturation matrix, increase the separation between colors + * Increase saturation : increase contrast, brightness, and sharpness + * @param amount {number} + * @param multiply {boolean} refer to ._loadMatrix() method */ +ColorMatrixFilter.prototype.saturate = function (amount, multiply) +{ + var x = (amount || 0) * 2 / 3 + 1; + var y = ((x - 1) * -0.5); + + var matrix = [ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0 + ]; + + this._loadMatrix(matrix, multiply); +}; /** - * @namespace PIXI.filters + * Desaturate image (remove color) + * + * Call the saturate function + * + * @param multiply {boolean} refer to ._loadMatrix() method */ -module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! - AsciiFilter: require('./ascii/AsciiFilter'), - BloomFilter: require('./bloom/BloomFilter'), - BlurFilter: require('./blur/BlurFilter'), - BlurXFilter: require('./blur/BlurXFilter'), - BlurYFilter: require('./blur/BlurYFilter'), - BlurDirFilter: require('./blur/BlurDirFilter'), - ColorMatrixFilter: require('./color/ColorMatrixFilter'), - ColorStepFilter: require('./color/ColorStepFilter'), - ConvolutionFilter: require('./convolution/ConvolutionFilter'), - CrossHatchFilter: require('./crosshatch/CrossHatchFilter'), - DisplacementFilter: require('./displacement/DisplacementFilter'), - DotScreenFilter: require('./dot/DotScreenFilter'), - GrayFilter: require('./gray/GrayFilter'), - DropShadowFilter: require('./dropshadow/DropShadowFilter'), - InvertFilter: require('./invert/InvertFilter'), - NoiseFilter: require('./noise/NoiseFilter'), - NormalMapFilter: require('./normal/NormalMapFilter'), - PixelateFilter: require('./pixelate/PixelateFilter'), - RGBSplitFilter: require('./rgb/RGBSplitFilter'), - ShockwaveFilter: require('./shockwave/ShockwaveFilter'), - SepiaFilter: require('./sepia/SepiaFilter'), - SmartBlurFilter: require('./blur/SmartBlurFilter'), - TiltShiftFilter: require('./tiltshift/TiltShiftFilter'), - TiltShiftXFilter: require('./tiltshift/TiltShiftXFilter'), - TiltShiftYFilter: require('./tiltshift/TiltShiftYFilter'), - TwistFilter: require('./twist/TwistFilter') +ColorMatrixFilter.prototype.desaturate = function (multiply) // jshint unused:false +{ + this.saturate(-1); }; -},{"../core/renderers/webgl/filters/AbstractFilter":49,"../core/renderers/webgl/filters/FXAAFilter":50,"../core/renderers/webgl/filters/SpriteMaskFilter":51,"./ascii/AsciiFilter":84,"./bloom/BloomFilter":85,"./blur/BlurDirFilter":86,"./blur/BlurFilter":87,"./blur/BlurXFilter":88,"./blur/BlurYFilter":89,"./blur/SmartBlurFilter":90,"./color/ColorMatrixFilter":91,"./color/ColorStepFilter":92,"./convolution/ConvolutionFilter":93,"./crosshatch/CrossHatchFilter":94,"./displacement/DisplacementFilter":95,"./dot/DotScreenFilter":96,"./dropshadow/DropShadowFilter":98,"./gray/GrayFilter":99,"./invert/InvertFilter":101,"./noise/NoiseFilter":102,"./normal/NormalMapFilter":103,"./pixelate/PixelateFilter":104,"./rgb/RGBSplitFilter":105,"./sepia/SepiaFilter":106,"./shockwave/ShockwaveFilter":107,"./tiltshift/TiltShiftFilter":109,"./tiltshift/TiltShiftXFilter":110,"./tiltshift/TiltShiftYFilter":111,"./twist/TwistFilter":112}],101:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 - - /** - * This inverts your Display Objects colors. + * Negative image (inverse of classic rgb matrix) * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param multiply {boolean} refer to ._loadMatrix() method */ -function InvertFilter() +ColorMatrixFilter.prototype.negative = function (multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform float invert;\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);\n}\n", - // custom uniforms - { - invert: { type: '1f', value: 1 } - } - ); -} - -InvertFilter.prototype = Object.create(core.AbstractFilter.prototype); -InvertFilter.prototype.constructor = InvertFilter; -module.exports = InvertFilter; + var matrix = [ + 0, 1, 1, 0, 0, + 1, 0, 1, 0, 0, + 1, 1, 0, 0, 0, + 0, 0, 0, 1, 0 + ]; -Object.defineProperties(InvertFilter.prototype, { - /** - * The strength of the invert. `1` will fully invert the colors, and - * `0` will make the object its normal color. - * - * @member {number} - * @memberof InvertFilter# - */ - invert: { - get: function () - { - return this.uniforms.invert.value; - }, - set: function (value) - { - this.uniforms.invert.value = value; - } - } -}); + this._loadMatrix(matrix, multiply); +}; -},{"../../core":29}],102:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 +/** + * Sepia image + * + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.sepia = function (multiply) +{ + var matrix = [ + 0.393, 0.7689999, 0.18899999, 0, 0, + 0.349, 0.6859999, 0.16799999, 0, 0, + 0.272, 0.5339999, 0.13099999, 0, 0, + 0, 0, 0, 1, 0 + ]; + this._loadMatrix(matrix, multiply); +}; /** - * @author Vico @vicocotea - * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js + * Color motion picture process invented in 1916 (thanks Dominic Szablewski) + * + * @param multiply {boolean} refer to ._loadMatrix() method */ +ColorMatrixFilter.prototype.technicolor = function (multiply) +{ + var matrix = [ + 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, + -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, + -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, + 0, 0, 0, 1, 0 + ]; + + this._loadMatrix(matrix, multiply); +}; /** - * A Noise effect filter. + * Polaroid filter * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param multiply {boolean} refer to ._loadMatrix() method */ -function NoiseFilter() +ColorMatrixFilter.prototype.polaroid = function (multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float noise;\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\n float diff = (rand(vTextureCoord) - 0.5) * noise;\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n gl_FragColor = color;\n}\n", - // custom uniforms - { - noise: { type: '1f', value: 0.5 } - } - ); -} - -NoiseFilter.prototype = Object.create(core.AbstractFilter.prototype); -NoiseFilter.prototype.constructor = NoiseFilter; -module.exports = NoiseFilter; + var matrix = [ + 1.438, -0.062, -0.062, 0, 0, + -0.122, 1.378, -0.122, 0, 0, + -0.016, -0.016, 1.483, 0, 0, + 0, 0, 0, 1, 0 + ]; -Object.defineProperties(NoiseFilter.prototype, { - /** - * The amount of noise to apply. - * - * @member {number} - * @memberof NoiseFilter# - * @default 0.5 - */ - noise: { - get: function () - { - return this.uniforms.noise.value; - }, - set: function (value) - { - this.uniforms.noise.value = value; - } - } -}); + this._loadMatrix(matrix, multiply); +}; -},{"../../core":29}],103:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 +/** + * Filter who transforms : Red -> Blue and Blue -> Red + * + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.toBGR = function (multiply) +{ + var matrix = [ + 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ]; + this._loadMatrix(matrix, multiply); +}; /** - * The NormalMapFilter class uses the pixel values from the specified texture (called the normal map) - * to project lighting onto an object. + * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - * @param texture {Texture} The texture used for the normal map, must be power of 2 texture at the moment + * @param multiply {boolean} refer to ._loadMatrix() method */ -function NormalMapFilter(texture) +ColorMatrixFilter.prototype.kodachrome = function (multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying float vColor;\n\nuniform sampler2D displacementMap;\nuniform sampler2D uSampler;\n\nuniform vec4 dimensions;\n\nconst vec2 Resolution = vec2(1.0,1.0); //resolution of screen\nuniform vec3 LightPos; //light position, normalized\nconst vec4 LightColor = vec4(1.0, 1.0, 1.0, 1.0); //light RGBA -- alpha is intensity\nconst vec4 AmbientColor = vec4(1.0, 1.0, 1.0, 0.5); //ambient RGBA -- alpha is intensity\nconst vec3 Falloff = vec3(0.0, 1.0, 0.2); //attenuation coefficients\n\nuniform vec3 LightDir; // = vec3(1.0, 0.0, 1.0);\n\nuniform vec2 mapDimensions; // = vec2(256.0, 256.0);\n\n\nvoid main(void)\n{\n vec2 mapCords = vTextureCoord.xy;\n\n vec4 color = texture2D(uSampler, vTextureCoord.st);\n vec3 nColor = texture2D(displacementMap, vTextureCoord.st).rgb;\n\n\n mapCords *= vec2(dimensions.x/512.0, dimensions.y/512.0);\n\n mapCords.y *= -1.0;\n mapCords.y += 1.0;\n\n // RGBA of our diffuse color\n vec4 DiffuseColor = texture2D(uSampler, vTextureCoord);\n\n // RGB of our normal map\n vec3 NormalMap = texture2D(displacementMap, mapCords).rgb;\n\n // The delta position of light\n // vec3 LightDir = vec3(LightPos.xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);\n vec3 LightDir = vec3(LightPos.xy - (mapCords.xy), LightPos.z);\n\n // Correct for aspect ratio\n // LightDir.x *= Resolution.x / Resolution.y;\n\n // Determine distance (used for attenuation) BEFORE we normalize our LightDir\n float D = length(LightDir);\n\n // normalize our vectors\n vec3 N = normalize(NormalMap * 2.0 - 1.0);\n vec3 L = normalize(LightDir);\n\n // Pre-multiply light color with intensity\n // Then perform 'N dot L' to determine our diffuse term\n vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);\n\n // pre-multiply ambient color with intensity\n vec3 Ambient = AmbientColor.rgb * AmbientColor.a;\n\n // calculate attenuation\n float Attenuation = 1.0 / ( Falloff.x + (Falloff.y*D) + (Falloff.z*D*D) );\n\n // the calculation which brings it all together\n vec3 Intensity = Ambient + Diffuse * Attenuation;\n vec3 FinalColor = DiffuseColor.rgb * Intensity;\n gl_FragColor = vColor * vec4(FinalColor, DiffuseColor.a);\n\n // gl_FragColor = vec4(1.0, 0.0, 0.0, Attenuation); // vColor * vec4(FinalColor, DiffuseColor.a);\n\n/*\n // normalise color\n vec3 normal = normalize(nColor * 2.0 - 1.0);\n\n vec3 deltaPos = vec3( (light.xy - gl_FragCoord.xy) / resolution.xy, light.z );\n\n float lambert = clamp(dot(normal, lightDir), 0.0, 1.0);\n\n float d = sqrt(dot(deltaPos, deltaPos));\n float att = 1.0 / ( attenuation.x + (attenuation.y*d) + (attenuation.z*d*d) );\n\n vec3 result = (ambientColor * ambientIntensity) + (lightColor.rgb * lambert) * att;\n result *= color.rgb;\n\n gl_FragColor = vec4(result, 1.0);\n*/\n}\n", - // custom uniforms - { - displacementMap: { type: 'sampler2D', value: texture }, - scale: { type: '2f', value: { x: 15, y: 15 } }, - offset: { type: '2f', value: { x: 0, y: 0 } }, - mapDimensions: { type: '2f', value: { x: 1, y: 1 } }, - dimensions: { type: '4f', value: [0, 0, 0, 0] }, - // LightDir: { type: 'f3', value: [0, 1, 0] }, - LightPos: { type: '3f', value: [0, 1, 0] } - } - ); + var matrix = [ + 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, + -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, + -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, + 0, 0, 0, 1, 0 + ]; - texture.baseTexture._powerOf2 = true; + this._loadMatrix(matrix, multiply); +}; - if (texture.baseTexture.hasLoaded) - { - this.onTextureLoaded(); - } - else - { - texture.baseTexture.once('loaded', this.onTextureLoaded, this); - } -} +/** + * Brown delicious browni filter (thanks Dominic Szablewski) + * + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.browni = function (multiply) +{ + var matrix = [ + 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, + -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, + 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, + 0, 0, 0, 1, 0 + ]; -NormalMapFilter.prototype = Object.create(core.AbstractFilter.prototype); -NormalMapFilter.prototype.constructor = NormalMapFilter; -module.exports = NormalMapFilter; + this._loadMatrix(matrix, multiply); +}; -/** - * Sets the map dimensions uniforms when the texture becomes available. +/* + * Vintage filter (thanks Dominic Szablewski) * - * @private + * @param multiply {boolean} refer to ._loadMatrix() method */ -NormalMapFilter.prototype.onTextureLoaded = function () +ColorMatrixFilter.prototype.vintage = function (multiply) { - this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width; - this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height; + var matrix = [ + 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, + 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, + 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, + 0, 0, 0, 1, 0 + ]; + + this._loadMatrix(matrix, multiply); }; -Object.defineProperties(NormalMapFilter.prototype, { - /** - * The texture used for the displacement map. Must be power of 2 texture. - * - * @member {Texture} - * @memberof NormalMapFilter# - */ - map: { - get: function () - { - return this.uniforms.displacementMap.value; - }, - set: function (value) - { - this.uniforms.displacementMap.value = value; - } - }, +/* + * We don't know exactly what it does, kind of gradient map, but funny to play with! + * + * @param desaturation {number} + * @param toned {number} + * @param lightColor {string} (example : "0xFFE580") + * @param darkColor {string} (example : "0xFFE580") + * + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) +{ + desaturation = desaturation || 0.2; + toned = toned || 0.15; + lightColor = lightColor || 0xFFE580; + darkColor = darkColor || 0x338000; - /** - * The multiplier used to scale the displacement result from the map calculation. - * - * @member {Point} - * @memberof NormalMapFilter# - */ - scale: { - get: function () - { - return this.uniforms.scale.value; - }, - set: function (value) - { - this.uniforms.scale.value = value; - } - }, + var lR = ((lightColor >> 16) & 0xFF) / 255; + var lG = ((lightColor >> 8) & 0xFF) / 255; + var lB = (lightColor & 0xFF) / 255; - /** - * The offset used to move the displacement map. - * - * @member {Point} - * @memberof NormalMapFilter# - */ - offset: { - get: function () - { - return this.uniforms.offset.value; - }, - set: function (value) - { - this.uniforms.offset.value = value; - } - } -}); + var dR = ((darkColor >> 16) & 0xFF) / 255; + var dG = ((darkColor >> 8) & 0xFF) / 255; + var dB = (darkColor & 0xFF) / 255; -},{"../../core":29}],104:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + var matrix = [ + 0.3, 0.59, 0.11, 0, 0, + lR, lG, lB, desaturation, 0, + dR, dG, dB, toned, 0, + lR - dR, lG - dG, lB - dB, 0, 0 + ]; + this._loadMatrix(matrix, multiply); +}; -/** - * This filter applies a pixelate effect making display objects appear 'blocky'. +/* + * Night effect * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * @param intensity {number} + * @param multiply {boolean} refer to ._loadMatrix() method */ -function PixelateFilter() +ColorMatrixFilter.prototype.night = function (intensity, multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 dimensions;\nuniform vec2 pixelSize;\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord;\n\n vec2 size = dimensions.xy / pixelSize;\n\n vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;\n\n gl_FragColor = texture2D(uSampler, color);\n}\n", - // custom uniforms - { - dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) }, - pixelSize: { type: 'v2', value: { x: 10, y: 10 } } - } - ); -} + intensity = intensity || 0.1; + var matrix = [ + intensity * ( -2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0, 0, 0, 1, 0 + ]; -PixelateFilter.prototype = Object.create(core.AbstractFilter.prototype); -PixelateFilter.prototype.constructor = PixelateFilter; -module.exports = PixelateFilter; + this._loadMatrix(matrix, multiply); +}; -Object.defineProperties(PixelateFilter.prototype, { - /** - * This a point that describes the size of the blocks. - * x is the width of the block and y is the height. - * - * @member {Point} - * @memberof PixelateFilter# - */ - size: { - get: function () - { - return this.uniforms.pixelSize.value; - }, - set: function (value) - { - this.uniforms.pixelSize.value = value; - } - } -}); -},{"../../core":29}],105:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 +/* + * Predator effect + * + * Erase the current matrix by setting a new indepent one + * + * @param amount {number} how much the predator feels his future victim + * @param multiply {boolean} refer to ._loadMatrix() method + */ +ColorMatrixFilter.prototype.predator = function (amount, multiply) +{ + var matrix = [ + 11.224130630493164 * amount, -4.794486999511719 * amount, -2.8746118545532227 * amount, 0 * amount, 0.40342438220977783 * amount, + -3.6330697536468506 * amount, 9.193157196044922 * amount, -2.951810836791992 * amount, 0 * amount, -1.316135048866272 * amount, + -3.2184197902679443 * amount, -4.2375030517578125 * amount, 7.476448059082031 * amount, 0 * amount, 0.8044459223747253 * amount, + 0, 0, 0, 1, 0 + ]; + this._loadMatrix(matrix, multiply); +}; -/** - * An RGB Split Filter. +/* + * LSD effect * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters + * Multiply the current matrix + * + * @param amount {number} How crazy is your effect + * @param multiply {boolean} refer to ._loadMatrix() method */ -function RGBSplitFilter() +ColorMatrixFilter.prototype.lsd = function (multiply) { - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 dimensions;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n", - // custom uniforms - { - red: { type: 'v2', value: { x: 20, y: 20 } }, - green: { type: 'v2', value: { x: -20, y: 20 } }, - blue: { type: 'v2', value: { x: 20, y: -20 } }, - dimensions: { type: '4fv', value: [0, 0, 0, 0] } - } - ); -} + var matrix = [ + 2, -0.4, 0.5, 0, 0, + -0.5, 2, -0.4, 0, 0, + -0.4, -0.5, 3, 0, 0, + 0, 0, 0, 1, 0 + ]; -RGBSplitFilter.prototype = Object.create(core.AbstractFilter.prototype); -RGBSplitFilter.prototype.constructor = RGBSplitFilter; -module.exports = RGBSplitFilter; + this._loadMatrix(matrix, multiply); +}; -Object.defineProperties(RGBSplitFilter.prototype, { - /** - * Red channel offset. - * - * @member {Point} - * @memberof RGBSplitFilter# - */ - red: { - get: function () - { - return this.uniforms.red.value; - }, - set: function (value) - { - this.uniforms.red.value = value; - } - }, +/* + * Reset function + * + * Erase the current matrix by setting the default one + * + */ +ColorMatrixFilter.prototype.reset = function () +{ + var matrix = [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ]; - /** - * Green channel offset. - * - * @member {Point} - * @memberof RGBSplitFilter# - */ - green: { - get: function () - { - return this.uniforms.green.value; - }, - set: function (value) - { - this.uniforms.green.value = value; - } - }, + this._loadMatrix(matrix, false); +}; + +Object.defineProperties(ColorMatrixFilter.prototype, { /** - * Blue offset. + * Sets the matrix of the color matrix filter * - * @member {Point} - * @memberof RGBSplitFilter# + * @member {number[]} + * @memberof ColorMatrixFilter# + * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] */ - blue: { + matrix: { get: function () { - return this.uniforms.blue.value; + return this.uniforms.m.value; }, set: function (value) { - this.uniforms.blue.value = value; + this.uniforms.m.value = value; } } }); -},{"../../core":29}],106:[function(require,module,exports){ +},{"../../core":29}],94:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * This applies a sepia effect to your Display Objects. + * This lowers the color depth of your image by the given amount, producing an image with a smaller palette. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function SepiaFilter() +function ColorStepFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float sepia;\n\nconst mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);\n}\n", + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float step;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n color = floor(color * step) / step;\n\n gl_FragColor = color;\n}\n", // custom uniforms { - sepia: { type: '1f', value: 1 } + step: { type: '1f', value: 5 } } ); } -SepiaFilter.prototype = Object.create(core.AbstractFilter.prototype); -SepiaFilter.prototype.constructor = SepiaFilter; -module.exports = SepiaFilter; +ColorStepFilter.prototype = Object.create(core.AbstractFilter.prototype); +ColorStepFilter.prototype.constructor = ColorStepFilter; +module.exports = ColorStepFilter; -Object.defineProperties(SepiaFilter.prototype, { +Object.defineProperties(ColorStepFilter.prototype, { /** - * The strength of the sepia. `1` will apply the full sepia effect, and - * `0` will make the object its normal color. + * The number of steps to reduce the palette by. * * @member {number} - * @memberof SepiaFilter# + * @memberof ColorStepFilter# */ - sepia: { + step: { get: function () { - return this.uniforms.sepia.value; + return this.uniforms.step.value; }, set: function (value) { - this.uniforms.sepia.value = value; + this.uniforms.step.value = value; } } }); -},{"../../core":29}],107:[function(require,module,exports){ +},{"../../core":29}],95:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * The ColorMatrixFilter class lets you apply a 4x4 matrix transformation on the RGBA - * color and alpha values of every pixel on your displayObject to produce a result - * with a new set of RGBA color and alpha values. It's pretty powerful! + * The ConvolutionFilter class applies a matrix convolution filter effect. + * A convolution combines pixels in the input image with neighboring pixels to produce a new image. + * A wide variety of image effects can be achieved through convolutions, including blurring, edge + * detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. + * See http://docs.gimp.org/en/plug-in-convmatrix.html for more info. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters + * @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array. + * @param width {number} Width of the object you are transforming + * @param height {number} Height of the object you are transforming */ -function ShockwaveFilter() +function ConvolutionFilter(matrix, width, height) { core.AbstractFilter.call(this, // vertex shader null, // fragment shader - "precision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nvoid main()\n{\n vec2 uv = vTextureCoord;\n vec2 texCoord = uv;\n\n float dist = distance(uv, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\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", // custom uniforms { - center: { type: 'v2', value: { x: 0.5, y: 0.5 } }, - params: { type: 'v3', value: { x: 10, y: 0.8, z: 0.1 } }, - time: { type: '1f', value: 0 } + matrix: { type: '1fv', value: new Float32Array(matrix) }, + texelSize: { type: 'v2', value: { x: 1 / width, y: 1 / height } } } ); } -ShockwaveFilter.prototype = Object.create(core.AbstractFilter.prototype); -ShockwaveFilter.prototype.constructor = ShockwaveFilter; -module.exports = ShockwaveFilter; +ConvolutionFilter.prototype = Object.create(core.AbstractFilter.prototype); +ConvolutionFilter.prototype.constructor = ConvolutionFilter; +module.exports = ConvolutionFilter; -Object.defineProperties(ShockwaveFilter.prototype, { +Object.defineProperties(ConvolutionFilter.prototype, { /** - * Sets the center of the shockwave in normalized screen coords. That is - * (0,0) is the top-left and (1,1) is the bottom right. + * An array of values used for matrix transformation. Specified as a 9 point Array. * - * @member {object} - * @memberof ShockwaveFilter# + * @member {number[]} + * @memberof ConvolutionFilter# */ - center: { + matrix: { get: function () { - return this.uniforms.center.value; + return this.uniforms.matrix.value; }, set: function (value) { - this.uniforms.center.value = value; + this.uniforms.matrix.value = new Float32Array(value); } }, + /** - * Sets the params of the shockwave. These modify the look and behavior of - * the shockwave as it ripples out. + * Width of the object you are transforming * - * @member {object} - * @memberof ShockwaveFilter# + * @member {number} + * @memberof ConvolutionFilter# */ - params: { + width: { get: function () { - return this.uniforms.params.value; + return 1/this.uniforms.texelSize.value.x; }, set: function (value) { - this.uniforms.params.value = value; + this.uniforms.texelSize.value.x = 1/value; } }, + /** - * Sets the elapsed time of the shockwave. This controls the speed at which - * the shockwave ripples out. + * Height of the object you are transforming * * @member {number} - * @memberof ShockwaveFilter# + * @memberof ConvolutionFilter# */ - time: { + height: { get: function () { - return this.uniforms.time.value; + return 1/this.uniforms.texelSize.value.y; }, set: function (value) { - this.uniforms.time.value = value; + this.uniforms.texelSize.value.y = 1/value; } } }); -},{"../../core":29}],108:[function(require,module,exports){ +},{"../../core":29}],96:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 /** - * @author Vico @vicocotea - * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ + * A Cross Hatch effect filter. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ +function CrossHatchFilter() +{ + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "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" + ); +} + +CrossHatchFilter.prototype = Object.create(core.AbstractFilter.prototype); +CrossHatchFilter.prototype.constructor = CrossHatchFilter; +module.exports = CrossHatchFilter; + +},{"../../core":29}],97:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 + /** - * A TiltShiftAxisFilter. + * The DisplacementFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object. + * You can use this filter to apply all manor of crazy warping effects + * Currently the r property of the texture is used to offset the x and the g property of the texture is used to offset the y. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters + * @param sprite {Sprite} the sprite used for the displacement map. (make sure its added to the scene!) */ -function TiltShiftAxisFilter() +function DisplacementFilter(sprite) { + var maskMatrix = new core.math.Matrix(); + sprite.renderable = false; + core.AbstractFilter.call(this, // vertex shader - null, + "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vMapCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", // fragment shader - "precision mediump float;\n\nvarying 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 gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n", - // custom uniforms + "precision lowp float;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec2 scale;\n\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nvoid main(void)\n{\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 map = texture2D(mapSampler, vMapCoord);\n\n map -= 0.5;\n map.xy *= scale;\n\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));\n}\n", + // uniforms { - blur: { type: '1f', value: 100 }, - gradientBlur: { type: '1f', value: 600 }, - start: { type: 'v2', value: { x: 0, y: window.innerHeight / 2 } }, - end: { type: 'v2', value: { x: 600, y: window.innerHeight / 2 } }, - delta: { type: 'v2', value: { x: 30, y: 30 } }, - texSize: { type: 'v2', value: { x: window.innerWidth, y: window.innerHeight } } + mapSampler: { type: 'sampler2D', value: sprite.texture }, + otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }, + scale: { type: 'v2', value: { x: 1, y: 1 } } } ); - this.updateDelta(); + this.maskSprite = sprite; + this.maskMatrix = maskMatrix; + + + this.scale = new core.math.Point(20,20); + } -TiltShiftAxisFilter.prototype = Object.create(core.AbstractFilter.prototype); -TiltShiftAxisFilter.prototype.constructor = TiltShiftAxisFilter; -module.exports = TiltShiftAxisFilter; +DisplacementFilter.prototype = Object.create(core.AbstractFilter.prototype); +DisplacementFilter.prototype.constructor = DisplacementFilter; +module.exports = DisplacementFilter; -/** - * Updates the filter delta values. - * This is overridden in the X and Y filters, does nothing for this class. - * - */ -TiltShiftAxisFilter.prototype.updateDelta = function () +DisplacementFilter.prototype.applyFilter = function (renderer, input, output) { - this.uniforms.delta.value.x = 0; - this.uniforms.delta.value.y = 0; + var filterManager = renderer.filterManager; + + filterManager.calculateMappedMatrix(input.frame, this.maskSprite, this.maskMatrix); + + this.uniforms.otherMatrix.value = this.maskMatrix.toArray(true); + this.uniforms.scale.value.x = this.scale.x * (1/input.frame.width); + this.uniforms.scale.value.y = this.scale.y * (1/input.frame.height); + + var shader = this.getShader(renderer); + // draw the filter... + filterManager.applyFilter(shader, input, output); }; -Object.defineProperties(TiltShiftAxisFilter.prototype, { + +Object.defineProperties(DisplacementFilter.prototype, { /** - * The strength of the blur. + * The texture used for the displacement map. Must be power of 2 sized texture. * - * @member {number} - * @memberof TiltShiftAxisFilter# + * @member {Texture} + * @memberof DisplacementFilter# */ - blur: { + map: { get: function () { - return this.uniforms.blur.value; + return this.uniforms.mapSampler.value; }, set: function (value) { - this.uniforms.blur.value = value; + this.uniforms.mapSampler.value = value; + } - }, + } +}); - /** - * The strength of the gradient blur. - * - * @member {number} - * @memberof TiltShiftAxisFilter# - */ - gradientBlur: { - get: function () - { - return this.uniforms.gradientBlur.value; - }, - set: function (value) +},{"../../core":29}],98:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 + + +/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js + */ + +/** + * This filter applies a dotscreen effect making display objects appear to be made out of + * black and white halftone dots like an old printer. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters + */ +function DotScreenFilter() +{ + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 dimensions;\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 * dimensions.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", + // custom uniforms { - this.uniforms.gradientBlur.value = value; + scale: { type: '1f', value: 1 }, + angle: { type: '1f', value: 5 }, + dimensions: { type: '4fv', value: [0, 0, 0, 0] } } - }, + ); +} + +DotScreenFilter.prototype = Object.create(core.AbstractFilter.prototype); +DotScreenFilter.prototype.constructor = DotScreenFilter; +module.exports = DotScreenFilter; +Object.defineProperties(DotScreenFilter.prototype, { /** - * The X value to start the effect at. - * - * @member {Point} - * @memberof TiltShiftAxisFilter# + * The scale of the effect. + * @member {number} + * @memberof DotScreenFilter# */ - start: { + scale: { get: function () { - return this.uniforms.start.value; + return this.uniforms.scale.value; }, set: function (value) { - this.uniforms.start.value = value; - this.updateDelta(); + this.uniforms.scale.value = value; } }, - - /** - * The X value to end the effect at. - * - * @member {Point} - * @memberof TiltShiftAxisFilter# + + /** + * The radius of the effect. + * @member {number} + * @memberof DotScreenFilter# */ - end: { + angle: { get: function () { - return this.uniforms.end.value; + return this.uniforms.angle.value; }, set: function (value) { - this.uniforms.end.value = value; - this.updateDelta(); + this.uniforms.angle.value = value; } } }); -},{"../../core":29}],109:[function(require,module,exports){ -var core = require('../../core'), - TiltShiftXFilter = require('./TiltShiftXFilter'), - TiltShiftYFilter = require('./TiltShiftYFilter'); +},{"../../core":29}],99:[function(require,module,exports){ +var core = require('../../core'); + +// @see https://github.com/substack/brfs/issues/25 -/** - * @author Vico @vicocotea - * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ - */ /** - * A TiltShift Filter. Manages the pass of both a TiltShiftXFilter and TiltShiftYFilter. + * The BlurYTintFilter applies a vertical Gaussian blur to an object. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function TiltShiftFilter() +function BlurYTintFilter() { - core.AbstractFilter.call(this); + core.AbstractFilter.call(this, + // vertex shader + "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform vec2 offset;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition+offset), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n", + // fragment shader + "precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform vec3 color;\nuniform float alpha;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec4 sum = vec4(0.0);\n\n sum += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n sum += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n sum += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n sum += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n sum += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n\n gl_FragColor = vec4( color.rgb * sum.a * alpha, sum.a * alpha );\n}\n", + // set the uniforms + { + blur: { type: '1f', value: 1 / 512 }, + color: { type: 'c', value: [0,0,0]}, + alpha: { type: '1f', value: 0.7 }, + offset: { type: '2f', value:[5, 5]}, + strength: { type: '1f', value:1} + } + ); - this.tiltShiftXFilter = new TiltShiftXFilter(); - this.tiltShiftYFilter = new TiltShiftYFilter(); + this.passes = 1; + this.strength = 4; } -TiltShiftFilter.prototype = Object.create(core.AbstractFilter.prototype); -TiltShiftFilter.prototype.constructor = TiltShiftFilter; -module.exports = TiltShiftFilter; +BlurYTintFilter.prototype = Object.create(core.AbstractFilter.prototype); +BlurYTintFilter.prototype.constructor = BlurYTintFilter; +module.exports = BlurYTintFilter; -TiltShiftFilter.prototype.applyFilter = function (renderer, input, output) +BlurYTintFilter.prototype.applyFilter = function (renderer, input, output, clear) { - var renderTarget = renderer.filterManager.getRenderTarget(true); - - this.tiltShiftXFilter.applyFilter(renderer, input, renderTarget); + var shader = this.getShader(renderer); - this.tiltShiftYFilter.applyFilter(renderer, renderTarget, output); + this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.height / input.size.height); - renderer.filterManager.returnRenderTarget(renderTarget); -}; + if(this.passes === 1) + { + renderer.filterManager.applyFilter(shader, input, output, clear); + } + else + { + var renderTarget = renderer.filterManager.getRenderTarget(true); + var flip = input; + var flop = renderTarget; -Object.defineProperties(TiltShiftFilter.prototype, { - /** - * The strength of the blur. - * - * @member {number} - * @memberof TiltShiftFilter# - */ - blur: { - get: function () - { - return this.tiltShiftXFilter.blur; - }, - set: function (value) + for(var i = 0; i < this.passes-1; i++) { - this.tiltShiftXFilter.blur = this.tiltShiftYFilter.blur = value; - } - }, + renderer.filterManager.applyFilter(shader, flip, flop, clear); - /** - * The strength of the gradient blur. - * - * @member {number} - * @memberof TiltShiftFilter# - */ - gradientBlur: { - get: function () - { - return this.tiltShiftXFilter.gradientBlur; - }, - set: function (value) - { - this.tiltShiftXFilter.gradientBlur = this.tiltShiftYFilter.gradientBlur = value; + var temp = flop; + flop = flip; + flip = temp; } - }, - /** - * The Y value to start the effect at. - * - * @member {number} - * @memberof TiltShiftFilter# - */ - start: { - get: function () - { - return this.tiltShiftXFilter.start; - }, - set: function (value) - { - this.tiltShiftXFilter.start = this.tiltShiftYFilter.start = value; - } - }, + renderer.filterManager.applyFilter(shader, flip, output, clear); + + renderer.filterManager.returnRenderTarget(renderTarget); + } +}; + +Object.defineProperties(BlurYTintFilter.prototype, { /** - * The Y value to end the effect at. + * Sets the strength of both the blur. * * @member {number} - * @memberof TiltShiftFilter# + * @memberof BlurYFilter# + * @default 2 */ - end: { + blur: { get: function () { - return this.tiltShiftXFilter.end; + return this.strength; }, set: function (value) { - this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = value; + this.padding = value * 0.5; + this.strength = value; } } }); -},{"../../core":29,"./TiltShiftXFilter":110,"./TiltShiftYFilter":111}],110:[function(require,module,exports){ -var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); - -/** - * @author Vico @vicocotea - * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ - */ +},{"../../core":29}],100:[function(require,module,exports){ +var core = require('../../core'), + BlurXFilter = require('../blur/BlurXFilter'), + BlurYTintFilter = require('./BlurYTintFilter'); /** - * A TiltShiftXFilter. + * The DropShadowFilter applies a Gaussian blur to an object. + * The strength of the blur can be set for x- and y-axis separately. * * @class - * @extends PIXI.TiltShiftAxisFilter + * @extends PIXI.AbstractFilter * @memberof PIXI.filters */ -function TiltShiftXFilter() -{ - TiltShiftAxisFilter.call(this); -} - -TiltShiftXFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); -TiltShiftXFilter.prototype.constructor = TiltShiftXFilter; -module.exports = TiltShiftXFilter; - -/** - * Updates the filter delta values. - * - */ -TiltShiftXFilter.prototype.updateDelta = function () +function DropShadowFilter() { - var dx = this.uniforms.end.value.x - this.uniforms.start.value.x; - var dy = this.uniforms.end.value.y - this.uniforms.start.value.y; - var d = Math.sqrt(dx * dx + dy * dy); + core.AbstractFilter.call(this); - this.uniforms.delta.value.x = dx / d; - this.uniforms.delta.value.y = dy / d; -}; + this.blurXFilter = new BlurXFilter(); + this.blurYTintFilter = new BlurYTintFilter(); -},{"./TiltShiftAxisFilter":108}],111:[function(require,module,exports){ -var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); + this.defaultFilter = new core.AbstractFilter(); -/** - * @author Vico @vicocotea - * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ - */ + this.padding = 30; -/** - * A TiltShiftYFilter. - * - * @class - * @extends PIXI.TiltShiftAxisFilter - * @memberof PIXI.filters - */ -function TiltShiftYFilter() -{ - TiltShiftAxisFilter.call(this); + this._dirtyPosition = true; + this._angle = 45 * Math.PI / 180; + this._distance = 10; + this.alpha = 0.75; + this.hideObject = false; + this.blendMode = core.BLEND_MODES.MULTIPLY; } -TiltShiftYFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); -TiltShiftYFilter.prototype.constructor = TiltShiftYFilter; -module.exports = TiltShiftYFilter; +DropShadowFilter.prototype = Object.create(core.AbstractFilter.prototype); +DropShadowFilter.prototype.constructor = DropShadowFilter; +module.exports = DropShadowFilter; -/** - * Updates the filter delta values. - * - */ -TiltShiftYFilter.prototype.updateDelta = function () +DropShadowFilter.prototype.applyFilter = function (renderer, input, output) { - var dx = this.uniforms.end.value.x - this.uniforms.start.value.x; - var dy = this.uniforms.end.value.y - this.uniforms.start.value.y; - var d = Math.sqrt(dx * dx + dy * dy); - - this.uniforms.delta.value.x = -dy / d; - this.uniforms.delta.value.y = dx / d; -}; + var renderTarget = renderer.filterManager.getRenderTarget(true); -},{"./TiltShiftAxisFilter":108}],112:[function(require,module,exports){ -var core = require('../../core'); -// @see https://github.com/substack/brfs/issues/25 + //TODO - copyTexSubImage2D could be used here? + if(this._dirtyPosition) + { + this._dirtyPosition = false; + this.blurYTintFilter.uniforms.offset.value[0] = Math.sin(this._angle) * this._distance; + this.blurYTintFilter.uniforms.offset.value[1] = Math.cos(this._angle) * this._distance; + } -/** - * This filter applies a twist effect making display objects appear twisted in the given direction. - * - * @class - * @extends PIXI.AbstractFilter - * @memberof PIXI.filters - */ -function TwistFilter() -{ - core.AbstractFilter.call(this, - // vertex shader - null, - // fragment shader - "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord - offset;\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratio = (radius - dist) / radius;\n float angleMod = ratio * ratio * 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 gl_FragColor = texture2D(uSampler, coord+offset);\n}\n", - // custom uniforms - { - radius: { type: '1f', value: 0.5 }, - angle: { type: '1f', value: 5 }, - offset: { type: 'v2', value: { x: 0.5, y: 0.5 } } - } - ); -} + this.blurXFilter.applyFilter(renderer, input, renderTarget); -TwistFilter.prototype = Object.create(core.AbstractFilter.prototype); -TwistFilter.prototype.constructor = TwistFilter; -module.exports = TwistFilter; + renderer.blendModeManager.setBlendMode(this.blendMode); -Object.defineProperties(TwistFilter.prototype, { + this.blurYTintFilter.applyFilter(renderer, renderTarget, output); + + renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL); + + if(!this.hideObject) + { + + this.defaultFilter.applyFilter(renderer, input, output); + } + + + renderer.filterManager.returnRenderTarget(renderTarget); +}; + +Object.defineProperties(DropShadowFilter.prototype, { /** - * This point describes the the offset of the twist. + * Sets the strength of both the blurX and blurY properties simultaneously * - * @member {Point} - * @memberof TwistFilter# + * @member {number} + * @memberOf DropShadowFilter# + * @default 2 */ - offset: { + blur: { get: function () { - return this.uniforms.offset.value; + return this.blurXFilter.blur; }, set: function (value) { - this.uniforms.offset.value = value; + this.blurXFilter.blur = this.blurYTintFilter.blur = value; } }, /** - * This radius of the twist. + * Sets the strength of the blurX property * * @member {number} - * @memberof TwistFilter# + * @memberOf DropShadowFilter# + * @default 2 */ - radius: { + blurX: { get: function () { - return this.uniforms.radius.value; + return this.blurXFilter.blur; }, set: function (value) { - this.uniforms.radius.value = value; + this.blurXFilter.blur = value; } }, /** - * This angle of the twist. + * Sets the strength of the blurY property * * @member {number} - * @memberof TwistFilter# + * @memberOf DropShadowFilter# + * @default 2 */ + blurY: { + get: function () + { + return this.blurYTintFilter.blur; + }, + set: function (value) + { + this.blurYTintFilter.blur = value; + } + }, + + color: { + get: function () + { + return core.utils.rgb2hex( this.blurYTintFilter.uniforms.color.value ); + }, + set: function (value) + { + this.blurYTintFilter.uniforms.color.value = core.utils.hex2rgb(value); + } + }, + + alpha: { + get: function () + { + return this.blurYTintFilter.uniforms.alpha.value; + }, + set: function (value) + { + this.blurYTintFilter.uniforms.alpha.value = value; + } + }, + + distance: { + get: function () + { + return this._distance; + }, + set: function (value) + { + this._dirtyPosition = true; + this._distance = value; + } + }, + angle: { get: function () { - return this.uniforms.angle.value; + return this._angle; }, set: function (value) { - this.uniforms.angle.value = value; + this._dirtyPosition = true; + this._angle = value; } } }); -},{"../../core":29}],113:[function(require,module,exports){ -var core = require('../core'); +},{"../../core":29,"../blur/BlurXFilter":90,"./BlurYTintFilter":99}],101:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 + /** - * Holds all information related to an Interaction event + * This greyscales the palette of your Display Objects. * * @class - * @memberof PIXI.interaction + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -function InteractionData() +function GrayFilter() { - /** - * This point stores the global coords of where the touch/mouse event happened - * - * @member {Point} - */ - this.global = new core.Point(); + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\nuniform float gray;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);\n}\n", + // set the uniforms + { + gray: { type: '1f', value: 1 } + } + ); +} - /** - * The target Sprite that was interacted with - * - * @member {Sprite} - */ - this.target = null; +GrayFilter.prototype = Object.create(core.AbstractFilter.prototype); +GrayFilter.prototype.constructor = GrayFilter; +module.exports = GrayFilter; +Object.defineProperties(GrayFilter.prototype, { /** - * When passed to an event handler, this will be the original DOM Event that was captured + * The strength of the gray. 1 will make the object black and white, 0 will make the object its normal color. * - * @member {Event} + * @member {number} + * @memberof GrayFilter# */ - this.originalEvent = null; -} - -InteractionData.prototype.constructor = InteractionData; -module.exports = InteractionData; + gray: { + get: function () + { + return this.uniforms.gray.value; + }, + set: function (value) + { + this.uniforms.gray.value = value; + } + } +}); +},{"../../core":29}],102:[function(require,module,exports){ /** - * This will return the local coordinates of the specified displayObject for this InteractionData - * - * @param displayObject {DisplayObject} The DisplayObject that you would like the local coords off - * @param [point] {Point} A Point object in which to store the value, optional (otherwise will create a new point) - * param [globalPos] {Point} A Point object containing your custom global coords, optional (otherwise will use the current global coords) - * @return {Point} A point containing the coordinates of the InteractionData position relative to the DisplayObject + * @file Main export of the PIXI filters library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} */ -InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) -{ - var worldTransform = displayObject.worldTransform; - var global = globalPos ? globalPos : this.global; - - // do a cheeky transform to get the mouse coords; - var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx, - a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, - id = 1 / (a00 * a11 + a01 * -a10); - - point = point || new core.math.Point(); - - point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; - point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; - - // set the mouse coords... - return point; -}; - -},{"../core":29}],114:[function(require,module,exports){ -var core = require('../core'), - InteractionData = require('./InteractionData'); - -// Mix interactiveTarget into core.DisplayObject.prototype -Object.assign( - core.DisplayObject.prototype, - require('./interactiveTarget') -); /** - * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive - * if its interactive parameter is set to true - * This manager also supports multitouch. - * - * @class - * @memberof PIXI.interaction - * @param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer - * @param [options] {object} - * @param [options.autoPreventDefault=true] {boolean} Should the manager automatically prevent default browser actions. - * @param [options.interactionFrequency=10] {number} Frequency increases the interaction events will be checked. + * @namespace PIXI.filters */ -function InteractionManager(renderer, options) -{ - options = options || {}; - - /** - * The renderer this interaction manager works for. - * - * @member {SystemRenderer} - */ - this.renderer = renderer; - - /** - * Should default browser actions automatically be prevented. - * - * @member {boolean} - * @default true - */ - this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; +module.exports = { + // expose some internal filters... + AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), + // add the rest! + AsciiFilter: require('./ascii/AsciiFilter'), + BloomFilter: require('./bloom/BloomFilter'), + BlurFilter: require('./blur/BlurFilter'), + BlurXFilter: require('./blur/BlurXFilter'), + BlurYFilter: require('./blur/BlurYFilter'), + BlurDirFilter: require('./blur/BlurDirFilter'), + ColorMatrixFilter: require('./color/ColorMatrixFilter'), + ColorStepFilter: require('./color/ColorStepFilter'), + ConvolutionFilter: require('./convolution/ConvolutionFilter'), + CrossHatchFilter: require('./crosshatch/CrossHatchFilter'), + DisplacementFilter: require('./displacement/DisplacementFilter'), + DotScreenFilter: require('./dot/DotScreenFilter'), + GrayFilter: require('./gray/GrayFilter'), + DropShadowFilter: require('./dropshadow/DropShadowFilter'), + InvertFilter: require('./invert/InvertFilter'), + NoiseFilter: require('./noise/NoiseFilter'), + NormalMapFilter: require('./normal/NormalMapFilter'), + PixelateFilter: require('./pixelate/PixelateFilter'), + RGBSplitFilter: require('./rgb/RGBSplitFilter'), + ShockwaveFilter: require('./shockwave/ShockwaveFilter'), + SepiaFilter: require('./sepia/SepiaFilter'), + SmartBlurFilter: require('./blur/SmartBlurFilter'), + TiltShiftFilter: require('./tiltshift/TiltShiftFilter'), + TiltShiftXFilter: require('./tiltshift/TiltShiftXFilter'), + TiltShiftYFilter: require('./tiltshift/TiltShiftYFilter'), + TwistFilter: require('./twist/TwistFilter') +}; - /** - * As this frequency increases the interaction events will be checked more often. - * - * @member {number} - * @default 10 - */ - this.interactionFrequency = options.interactionFrequency || 10; +},{"../core/renderers/webgl/filters/AbstractFilter":49,"../core/renderers/webgl/filters/FXAAFilter":50,"../core/renderers/webgl/filters/SpriteMaskFilter":51,"./ascii/AsciiFilter":86,"./bloom/BloomFilter":87,"./blur/BlurDirFilter":88,"./blur/BlurFilter":89,"./blur/BlurXFilter":90,"./blur/BlurYFilter":91,"./blur/SmartBlurFilter":92,"./color/ColorMatrixFilter":93,"./color/ColorStepFilter":94,"./convolution/ConvolutionFilter":95,"./crosshatch/CrossHatchFilter":96,"./displacement/DisplacementFilter":97,"./dot/DotScreenFilter":98,"./dropshadow/DropShadowFilter":100,"./gray/GrayFilter":101,"./invert/InvertFilter":103,"./noise/NoiseFilter":104,"./normal/NormalMapFilter":105,"./pixelate/PixelateFilter":106,"./rgb/RGBSplitFilter":107,"./sepia/SepiaFilter":108,"./shockwave/ShockwaveFilter":109,"./tiltshift/TiltShiftFilter":111,"./tiltshift/TiltShiftXFilter":112,"./tiltshift/TiltShiftYFilter":113,"./twist/TwistFilter":114}],103:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - /** - * The mouse data - * - * @member {InteractionData} - */ - this.mouse = new InteractionData(); - /** - * An event data object to handle all the event tracking/dispatching - * - * @member {EventData} - */ - this.eventData = { - stopped: false, - target: null, - type: null, - data: this.mouse, - stopPropagation:function(){ - this.stopped = true; +/** + * This inverts your Display Objects colors. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters + */ +function InvertFilter() +{ + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform float invert;\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);\n}\n", + // custom uniforms + { + invert: { type: '1f', value: 1 } } - }; + ); +} - /** - * Tiny little interactiveData pool ! - * - * @member {Array} - */ - this.interactiveDataPool = []; +InvertFilter.prototype = Object.create(core.AbstractFilter.prototype); +InvertFilter.prototype.constructor = InvertFilter; +module.exports = InvertFilter; +Object.defineProperties(InvertFilter.prototype, { /** - * The DOM element to bind to. + * The strength of the invert. `1` will fully invert the colors, and + * `0` will make the object its normal color. * - * @member {HTMLElement} - * @private + * @member {number} + * @memberof InvertFilter# */ - this.interactionDOMElement = null; + invert: { + get: function () + { + return this.uniforms.invert.value; + }, + set: function (value) + { + this.uniforms.invert.value = value; + } + } +}); - /** - * Have events been attached to the dom element? - * - * @member {boolean} - * @private - */ - this.eventsAdded = false; +},{"../../core":29}],104:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - //this will make it so that you don't have to call bind all the time - /** - * @member {Function} - */ - this.onMouseUp = this.onMouseUp.bind(this); - this.processMouseUp = this.processMouseUp.bind( this ); +/** + * @author Vico @vicocotea + * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js + */ +/** + * A Noise effect filter. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters + */ +function NoiseFilter() +{ + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float noise;\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\n float diff = (rand(vTextureCoord) - 0.5) * noise;\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n gl_FragColor = color;\n}\n", + // custom uniforms + { + noise: { type: '1f', value: 0.5 } + } + ); +} - /** - * @member {Function} - */ - this.onMouseDown = this.onMouseDown.bind(this); - this.processMouseDown = this.processMouseDown.bind( this ); +NoiseFilter.prototype = Object.create(core.AbstractFilter.prototype); +NoiseFilter.prototype.constructor = NoiseFilter; +module.exports = NoiseFilter; +Object.defineProperties(NoiseFilter.prototype, { /** - * @member {Function} + * The amount of noise to apply. + * + * @member {number} + * @memberof NoiseFilter# + * @default 0.5 */ - this.onMouseMove = this.onMouseMove.bind( this ); - this.processMouseMove = this.processMouseMove.bind( this ); + noise: { + get: function () + { + return this.uniforms.noise.value; + }, + set: function (value) + { + this.uniforms.noise.value = value; + } + } +}); - /** - * @member {Function} - */ - this.onMouseOut = this.onMouseOut.bind(this); - this.processMouseOverOut = this.processMouseOverOut.bind( this ); +},{"../../core":29}],105:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - /** - * @member {Function} - */ - this.onTouchStart = this.onTouchStart.bind(this); - this.processTouchStart = this.processTouchStart.bind(this); +/** + * The NormalMapFilter class uses the pixel values from the specified texture (called the normal map) + * to project lighting onto an object. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters + * @param texture {Texture} The texture used for the normal map, must be power of 2 texture at the moment + */ +function NormalMapFilter(texture) +{ + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D displacementMap;\nuniform sampler2D uSampler;\n\nuniform vec4 dimensions;\n\nconst vec2 Resolution = vec2(1.0,1.0); //resolution of screen\nuniform vec3 LightPos; //light position, normalized\nconst vec4 LightColor = vec4(1.0, 1.0, 1.0, 1.0); //light RGBA -- alpha is intensity\nconst vec4 AmbientColor = vec4(1.0, 1.0, 1.0, 0.5); //ambient RGBA -- alpha is intensity\nconst vec3 Falloff = vec3(0.0, 1.0, 0.2); //attenuation coefficients\n\nuniform vec3 LightDir; // = vec3(1.0, 0.0, 1.0);\n\nuniform vec2 mapDimensions; // = vec2(256.0, 256.0);\n\n\nvoid main(void)\n{\n vec2 mapCords = vTextureCoord.xy;\n\n vec4 color = texture2D(uSampler, vTextureCoord.st);\n vec3 nColor = texture2D(displacementMap, vTextureCoord.st).rgb;\n\n\n mapCords *= vec2(dimensions.x/512.0, dimensions.y/512.0);\n\n mapCords.y *= -1.0;\n mapCords.y += 1.0;\n\n // RGBA of our diffuse color\n vec4 DiffuseColor = texture2D(uSampler, vTextureCoord);\n\n // RGB of our normal map\n vec3 NormalMap = texture2D(displacementMap, mapCords).rgb;\n\n // The delta position of light\n // vec3 LightDir = vec3(LightPos.xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);\n vec3 LightDir = vec3(LightPos.xy - (mapCords.xy), LightPos.z);\n\n // Correct for aspect ratio\n // LightDir.x *= Resolution.x / Resolution.y;\n\n // Determine distance (used for attenuation) BEFORE we normalize our LightDir\n float D = length(LightDir);\n\n // normalize our vectors\n vec3 N = normalize(NormalMap * 2.0 - 1.0);\n vec3 L = normalize(LightDir);\n\n // Pre-multiply light color with intensity\n // Then perform 'N dot L' to determine our diffuse term\n vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);\n\n // pre-multiply ambient color with intensity\n vec3 Ambient = AmbientColor.rgb * AmbientColor.a;\n\n // calculate attenuation\n float Attenuation = 1.0 / ( Falloff.x + (Falloff.y*D) + (Falloff.z*D*D) );\n\n // the calculation which brings it all together\n vec3 Intensity = Ambient + Diffuse * Attenuation;\n vec3 FinalColor = DiffuseColor.rgb * Intensity;\n gl_FragColor = vColor * vec4(FinalColor, DiffuseColor.a);\n\n // gl_FragColor = vec4(1.0, 0.0, 0.0, Attenuation); // vColor * vec4(FinalColor, DiffuseColor.a);\n\n/*\n // normalise color\n vec3 normal = normalize(nColor * 2.0 - 1.0);\n\n vec3 deltaPos = vec3( (light.xy - gl_FragCoord.xy) / resolution.xy, light.z );\n\n float lambert = clamp(dot(normal, lightDir), 0.0, 1.0);\n\n float d = sqrt(dot(deltaPos, deltaPos));\n float att = 1.0 / ( attenuation.x + (attenuation.y*d) + (attenuation.z*d*d) );\n\n vec3 result = (ambientColor * ambientIntensity) + (lightColor.rgb * lambert) * att;\n result *= color.rgb;\n\n gl_FragColor = vec4(result, 1.0);\n*/\n}\n", + // custom uniforms + { + displacementMap: { type: 'sampler2D', value: texture }, + scale: { type: '2f', value: { x: 15, y: 15 } }, + offset: { type: '2f', value: { x: 0, y: 0 } }, + mapDimensions: { type: '2f', value: { x: 1, y: 1 } }, + dimensions: { type: '4f', value: [0, 0, 0, 0] }, + // LightDir: { type: 'f3', value: [0, 1, 0] }, + LightPos: { type: '3f', value: [0, 1, 0] } + } + ); - /** - * @member {Function} - */ - this.onTouchEnd = this.onTouchEnd.bind(this); - this.processTouchEnd = this.processTouchEnd.bind(this); + texture.baseTexture._powerOf2 = true; - /** - * @member {Function} - */ - this.onTouchMove = this.onTouchMove.bind(this); - this.processTouchMove = this.processTouchMove.bind(this); + if (texture.baseTexture.hasLoaded) + { + this.onTextureLoaded(); + } + else + { + texture.baseTexture.once('loaded', this.onTextureLoaded, this); + } +} - /** - * @member {number} - */ - this.last = 0; +NormalMapFilter.prototype = Object.create(core.AbstractFilter.prototype); +NormalMapFilter.prototype.constructor = NormalMapFilter; +module.exports = NormalMapFilter; + +/** + * Sets the map dimensions uniforms when the texture becomes available. + * + * @private + */ +NormalMapFilter.prototype.onTextureLoaded = function () +{ + this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width; + this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height; +}; +Object.defineProperties(NormalMapFilter.prototype, { /** - * The css style of the cursor that is being used - * @member {string} + * The texture used for the displacement map. Must be power of 2 texture. + * + * @member {Texture} + * @memberof NormalMapFilter# */ - this.currentCursorStyle = 'inherit'; + map: { + get: function () + { + return this.uniforms.displacementMap.value; + }, + set: function (value) + { + this.uniforms.displacementMap.value = value; + } + }, /** - * Internal cached var + * The multiplier used to scale the displacement result from the map calculation. + * * @member {Point} - * @private + * @memberof NormalMapFilter# */ - this._tempPoint = new core.Point(); + scale: { + get: function () + { + return this.uniforms.scale.value; + }, + set: function (value) + { + this.uniforms.scale.value = value; + } + }, /** - * The current resolution - * @member {number} + * The offset used to move the displacement map. + * + * @member {Point} + * @memberof NormalMapFilter# */ - this.resolution = 1; + offset: { + get: function () + { + return this.uniforms.offset.value; + }, + set: function (value) + { + this.uniforms.offset.value = value; + } + } +}); - this.setTargetElement(this.renderer.view, this.renderer.resolution); -} +},{"../../core":29}],106:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 -InteractionManager.prototype.constructor = InteractionManager; -module.exports = InteractionManager; /** - * 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 deletegate - * another DOM element to receive those events. + * This filter applies a pixelate effect making display objects appear 'blocky'. * - * @param element {HTMLElement} the DOM element which will receive mouse and touch events. - * @param [resolution=1] {number} THe resolution of the new element (relative to the canvas). - * @private - */ -InteractionManager.prototype.setTargetElement = function (element, resolution) -{ - this.removeEvents(); - - this.interactionDOMElement = element; - - this.resolution = resolution || 1; - - this.addEvents(); -}; - -/** - * Registers all the DOM events - * @private + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.addEvents = function () +function PixelateFilter() { - if (!this.interactionDOMElement) - { - return; - } + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 dimensions;\nuniform vec2 pixelSize;\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord;\n\n vec2 size = dimensions.xy / pixelSize;\n\n vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;\n\n gl_FragColor = texture2D(uSampler, color);\n}\n", + // custom uniforms + { + dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) }, + pixelSize: { type: 'v2', value: { x: 10, y: 10 } } + } + ); +} - core.ticker.shared.add(this.update, this); +PixelateFilter.prototype = Object.create(core.AbstractFilter.prototype); +PixelateFilter.prototype.constructor = PixelateFilter; +module.exports = PixelateFilter; - if (window.navigator.msPointerEnabled) - { - this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; - this.interactionDOMElement.style['-ms-touch-action'] = 'none'; +Object.defineProperties(PixelateFilter.prototype, { + /** + * This a point that describes the size of the blocks. + * x is the width of the block and y is the height. + * + * @member {Point} + * @memberof PixelateFilter# + */ + size: { + get: function () + { + return this.uniforms.pixelSize.value; + }, + set: function (value) + { + this.uniforms.pixelSize.value = value; + } } +}); - window.document.addEventListener('mousemove', this.onMouseMove, true); - this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true); - this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true); - - this.interactionDOMElement.addEventListener('touchstart', this.onTouchStart, true); - this.interactionDOMElement.addEventListener('touchend', this.onTouchEnd, true); - this.interactionDOMElement.addEventListener('touchmove', this.onTouchMove, true); - - window.addEventListener('mouseup', this.onMouseUp, true); +},{"../../core":29}],107:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - this.eventsAdded = true; -}; /** - * Removes all the DOM events that were previously registered - * @private + * An RGB Split Filter. + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.removeEvents = function () +function RGBSplitFilter() { - if (!this.interactionDOMElement) - { - return; - } - - core.ticker.shared.remove(this.update); + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 dimensions;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n", + // custom uniforms + { + red: { type: 'v2', value: { x: 20, y: 20 } }, + green: { type: 'v2', value: { x: -20, y: 20 } }, + blue: { type: 'v2', value: { x: 20, y: -20 } }, + dimensions: { type: '4fv', value: [0, 0, 0, 0] } + } + ); +} - if (window.navigator.msPointerEnabled) - { - this.interactionDOMElement.style['-ms-content-zooming'] = ''; - this.interactionDOMElement.style['-ms-touch-action'] = ''; - } +RGBSplitFilter.prototype = Object.create(core.AbstractFilter.prototype); +RGBSplitFilter.prototype.constructor = RGBSplitFilter; +module.exports = RGBSplitFilter; - window.document.removeEventListener('mousemove', this.onMouseMove, true); - this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true); - this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true); +Object.defineProperties(RGBSplitFilter.prototype, { + /** + * Red channel offset. + * + * @member {Point} + * @memberof RGBSplitFilter# + */ + red: { + get: function () + { + return this.uniforms.red.value; + }, + set: function (value) + { + this.uniforms.red.value = value; + } + }, - this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true); - this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true); - this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true); + /** + * Green channel offset. + * + * @member {Point} + * @memberof RGBSplitFilter# + */ + green: { + get: function () + { + return this.uniforms.green.value; + }, + set: function (value) + { + this.uniforms.green.value = value; + } + }, - this.interactionDOMElement = null; + /** + * Blue offset. + * + * @member {Point} + * @memberof RGBSplitFilter# + */ + blue: { + get: function () + { + return this.uniforms.blue.value; + }, + set: function (value) + { + this.uniforms.blue.value = value; + } + } +}); - window.removeEventListener('mouseup', this.onMouseUp, true); +},{"../../core":29}],108:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - this.eventsAdded = false; -}; /** - * Updates the state of interactive objects. - * Invoked by a throttled ticker update from - * {@link PIXI.ticker.shared}. + * This applies a sepia effect to your Display Objects. * - * @param deltaTime {number} + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.update = function (deltaTime) +function SepiaFilter() { - this._deltaTime += deltaTime; - - if (this._deltaTime < this.interactionFrequency) - { - return; - } - - this._deltaTime = 0; + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float sepia;\n\nconst mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);\n}\n", + // custom uniforms + { + sepia: { type: '1f', value: 1 } + } + ); +} - if (!this.interactionDOMElement) - { - return; - } +SepiaFilter.prototype = Object.create(core.AbstractFilter.prototype); +SepiaFilter.prototype.constructor = SepiaFilter; +module.exports = SepiaFilter; - // if the user move the mouse this check has already been dfone using the mouse move! - if(this.didMove) - { - this.didMove = false; - return; +Object.defineProperties(SepiaFilter.prototype, { + /** + * The strength of the sepia. `1` will apply the full sepia effect, and + * `0` will make the object its normal color. + * + * @member {number} + * @memberof SepiaFilter# + */ + sepia: { + get: function () + { + return this.uniforms.sepia.value; + }, + set: function (value) + { + this.uniforms.sepia.value = value; + } } +}); - this.cursor = 'inherit'; - - this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, true ); - - if (this.currentCursorStyle !== this.cursor) - { - this.currentCursorStyle = this.cursor; - this.interactionDOMElement.style.cursor = this.cursor; - } +},{"../../core":29}],109:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - //TODO -}; /** - * Dispatches an event on the display object that was interacted with - * @param displayObject {Container|Sprite|TilingSprite} the display object in question - * @param eventString {string} the name of the event (e.g, mousedown) - * @param eventData {EventData} the event data object - * @private + * The ColorMatrixFilter class lets you apply a 4x4 matrix transformation on the RGBA + * color and alpha values of every pixel on your displayObject to produce a result + * with a new set of RGBA color and alpha values. It's pretty powerful! + * + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.dispatchEvent = function ( displayObject, eventString, eventData ) +function ShockwaveFilter() { - if(!eventData.stopped) - { - eventData.target = displayObject; - eventData.type = eventString; + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nvoid main()\n{\n vec2 uv = vTextureCoord;\n vec2 texCoord = uv;\n\n float dist = distance(uv, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\n", + // custom uniforms + { + center: { type: 'v2', value: { x: 0.5, y: 0.5 } }, + params: { type: 'v3', value: { x: 10, y: 0.8, z: 0.1 } }, + time: { type: '1f', value: 0 } + } + ); +} - displayObject.emit( eventString, eventData ); +ShockwaveFilter.prototype = Object.create(core.AbstractFilter.prototype); +ShockwaveFilter.prototype.constructor = ShockwaveFilter; +module.exports = ShockwaveFilter; - if( displayObject[eventString] ) +Object.defineProperties(ShockwaveFilter.prototype, { + /** + * Sets the center of the shockwave in normalized screen coords. That is + * (0,0) is the top-left and (1,1) is the bottom right. + * + * @member {object} + * @memberof ShockwaveFilter# + */ + center: { + get: function () { - displayObject[eventString]( eventData ); + return this.uniforms.center.value; + }, + set: function (value) + { + this.uniforms.center.value = value; + } + }, + /** + * Sets the params of the shockwave. These modify the look and behavior of + * the shockwave as it ripples out. + * + * @member {object} + * @memberof ShockwaveFilter# + */ + params: { + get: function () + { + return this.uniforms.params.value; + }, + set: function (value) + { + this.uniforms.params.value = value; + } + }, + /** + * Sets the elapsed time of the shockwave. This controls the speed at which + * the shockwave ripples out. + * + * @member {number} + * @memberof ShockwaveFilter# + */ + time: { + get: function () + { + return this.uniforms.time.value; + }, + set: function (value) + { + this.uniforms.time.value = value; } } -}; +}); + +},{"../../core":29}],110:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 + /** - * Maps x and y coords from a DOM object and maps them correctly to the pixi 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 {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 + * @author Vico @vicocotea + * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ */ -InteractionManager.prototype.mapPositionToPoint = function ( point, x, y ) -{ - var rect = this.interactionDOMElement.getBoundingClientRect(); - point.x = ( ( x - rect.left ) * (this.interactionDOMElement.width / rect.width ) ) / this.resolution; - point.y = ( ( y - rect.top ) * (this.interactionDOMElement.height / rect.height ) ) / this.resolution; -}; /** - * 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. + * A TiltShiftAxisFilter. * - * @param {Point} point the point that is tested for collision - * @param {Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children) - * @param {function} func the function that will be called on each interactive object. The 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 + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive ) +function TiltShiftAxisFilter() { - if(!displayObject.visible) - { - return false; - } - - var children = displayObject.children; + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying 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 gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n", + // custom uniforms + { + blur: { type: '1f', value: 100 }, + gradientBlur: { type: '1f', value: 600 }, + start: { type: 'v2', value: { x: 0, y: window.innerHeight / 2 } }, + end: { type: 'v2', value: { x: 600, y: window.innerHeight / 2 } }, + delta: { type: 'v2', value: { x: 30, y: 30 } }, + texSize: { type: 'v2', value: { x: window.innerWidth, y: window.innerHeight } } + } + ); - var hit = false; + this.updateDelta(); +} - // if the object is interactive we must hit test all its children.. - interactive = interactive || displayObject.interactive; +TiltShiftAxisFilter.prototype = Object.create(core.AbstractFilter.prototype); +TiltShiftAxisFilter.prototype.constructor = TiltShiftAxisFilter; +module.exports = TiltShiftAxisFilter; - if(displayObject.interactiveChildren) - { +/** + * Updates the filter delta values. + * This is overridden in the X and Y filters, does nothing for this class. + * + */ +TiltShiftAxisFilter.prototype.updateDelta = function () +{ + this.uniforms.delta.value.x = 0; + this.uniforms.delta.value.y = 0; +}; - for (var i = children.length-1; i >= 0; i--) +Object.defineProperties(TiltShiftAxisFilter.prototype, { + /** + * The strength of the blur. + * + * @member {number} + * @memberof TiltShiftAxisFilter# + */ + blur: { + get: function () { - if(! hit && hitTest) - { - hit = this.processInteractive(point, children[i], func, true, interactive ); - } - else - { - // now we know we can miss it all! - this.processInteractive(point, children[i], func, false, false ); - } + return this.uniforms.blur.value; + }, + set: function (value) + { + this.uniforms.blur.value = value; } + }, - } + /** + * The strength of the gradient blur. + * + * @member {number} + * @memberof TiltShiftAxisFilter# + */ + gradientBlur: { + get: function () + { + return this.uniforms.gradientBlur.value; + }, + set: function (value) + { + this.uniforms.gradientBlur.value = value; + } + }, - if(interactive) - { - if(hitTest) + /** + * The X value to start the effect at. + * + * @member {Point} + * @memberof TiltShiftAxisFilter# + */ + start: { + get: function () { - if(displayObject.hitArea) - { - // lets use the hit object first! - displayObject.worldTransform.applyInverse(point, this._tempPoint); - hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y ); - } - else if(displayObject.containsPoint) - { - hit = displayObject.containsPoint(point); - } + return this.uniforms.start.value; + }, + set: function (value) + { + this.uniforms.start.value = value; + this.updateDelta(); } + }, - if(displayObject.interactive) + /** + * The X value to end the effect at. + * + * @member {Point} + * @memberof TiltShiftAxisFilter# + */ + end: { + get: function () { - func(displayObject, hit); + return this.uniforms.end.value; + }, + set: function (value) + { + this.uniforms.end.value = value; + this.updateDelta(); } } +}); - return hit; -}; - - - +},{"../../core":29}],111:[function(require,module,exports){ +var core = require('../../core'), + TiltShiftXFilter = require('./TiltShiftXFilter'), + TiltShiftYFilter = require('./TiltShiftYFilter'); /** - * Is called when the mouse button is pressed down on the renderer element - * - * @param event {Event} The DOM event of a mouse button being pressed down - * @private + * @author Vico @vicocotea + * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ */ -InteractionManager.prototype.onMouseDown = function (event) -{ - this.mouse.originalEvent = event; - this.eventData.data = this.mouse; - this.eventData.stopped = false; - - // Update internal mouse reference - this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); - - if (this.autoPreventDefault) - { - this.mouse.originalEvent.preventDefault(); - } - - this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseDown, true ); -}; /** - * Processes the result of the mouse down check and dispatches the event if need be + * A TiltShift Filter. Manages the pass of both a TiltShiftXFilter and TiltShiftYFilter. * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the dispay object - * @private + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.processMouseDown = function ( displayObject, hit ) +function TiltShiftFilter() { - var e = this.mouse.originalEvent; - - var isRightButton = e.button === 2 || e.which === 3; - - if(hit) - { - displayObject[ isRightButton ? '_isRightDown' : '_isLeftDown' ] = true; - this.dispatchEvent( displayObject, isRightButton ? 'rightdown' : 'mousedown', this.eventData ); - } -}; + core.AbstractFilter.call(this); + this.tiltShiftXFilter = new TiltShiftXFilter(); + this.tiltShiftYFilter = new TiltShiftYFilter(); +} +TiltShiftFilter.prototype = Object.create(core.AbstractFilter.prototype); +TiltShiftFilter.prototype.constructor = TiltShiftFilter; +module.exports = TiltShiftFilter; -/** - * Is called when the mouse button is released on the renderer element - * - * @param event {Event} The DOM event of a mouse button being released - * @private - */ -InteractionManager.prototype.onMouseUp = function (event) +TiltShiftFilter.prototype.applyFilter = function (renderer, input, output) { - this.mouse.originalEvent = event; - this.eventData.data = this.mouse; - this.eventData.stopped = false; + var renderTarget = renderer.filterManager.getRenderTarget(true); - // Update internal mouse reference - this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); + this.tiltShiftXFilter.applyFilter(renderer, input, renderTarget); - this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseUp, true ); -}; + this.tiltShiftYFilter.applyFilter(renderer, renderTarget, output); -/** - * Processes the result of the mouse up check and dispatches the event if need be - * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object - * @private - */ -InteractionManager.prototype.processMouseUp = function ( displayObject, hit ) -{ - var e = this.mouse.originalEvent; + renderer.filterManager.returnRenderTarget(renderTarget); +}; - var isRightButton = e.button === 2 || e.which === 3; - var isDown = isRightButton ? '_isRightDown' : '_isLeftDown'; +Object.defineProperties(TiltShiftFilter.prototype, { + /** + * The strength of the blur. + * + * @member {number} + * @memberof TiltShiftFilter# + */ + blur: { + get: function () + { + return this.tiltShiftXFilter.blur; + }, + set: function (value) + { + this.tiltShiftXFilter.blur = this.tiltShiftYFilter.blur = value; + } + }, - if(hit) - { - this.dispatchEvent( displayObject, isRightButton ? 'rightup' : 'mouseup', this.eventData ); + /** + * The strength of the gradient blur. + * + * @member {number} + * @memberof TiltShiftFilter# + */ + gradientBlur: { + get: function () + { + return this.tiltShiftXFilter.gradientBlur; + }, + set: function (value) + { + this.tiltShiftXFilter.gradientBlur = this.tiltShiftYFilter.gradientBlur = value; + } + }, - if( displayObject[ isDown ] ) + /** + * The Y value to start the effect at. + * + * @member {number} + * @memberof TiltShiftFilter# + */ + start: { + get: function () { - displayObject[ isDown ] = false; - this.dispatchEvent( displayObject, isRightButton ? 'rightclick' : 'click', this.eventData ); + return this.tiltShiftXFilter.start; + }, + set: function (value) + { + this.tiltShiftXFilter.start = this.tiltShiftYFilter.start = value; } - } - else - { - if( displayObject[ isDown ] ) + }, + + /** + * The Y value to end the effect at. + * + * @member {number} + * @memberof TiltShiftFilter# + */ + end: { + get: function () { - displayObject[ isDown ] = false; - this.dispatchEvent( displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', this.eventData ); + return this.tiltShiftXFilter.end; + }, + set: function (value) + { + this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = value; } } -}; +}); +},{"../../core":29,"./TiltShiftXFilter":112,"./TiltShiftYFilter":113}],112:[function(require,module,exports){ +var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); /** - * Is called when the mouse moves across the renderer element + * @author Vico @vicocotea + * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ + */ + +/** + * A TiltShiftXFilter. * - * @param event {Event} The DOM event of the mouse moving - * @private + * @class + * @extends PIXI.TiltShiftAxisFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.onMouseMove = function (event) +function TiltShiftXFilter() { - this.mouse.originalEvent = event; - this.eventData.data = this.mouse; - this.eventData.stopped = false; - - this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); + TiltShiftAxisFilter.call(this); +} - this.didMove = true; +TiltShiftXFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); +TiltShiftXFilter.prototype.constructor = TiltShiftXFilter; +module.exports = TiltShiftXFilter; - this.cursor = 'inherit'; +/** + * Updates the filter delta values. + * + */ +TiltShiftXFilter.prototype.updateDelta = function () +{ + var dx = this.uniforms.end.value.x - this.uniforms.start.value.x; + var dy = this.uniforms.end.value.y - this.uniforms.start.value.y; + var d = Math.sqrt(dx * dx + dy * dy); - this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true ); + this.uniforms.delta.value.x = dx / d; + this.uniforms.delta.value.y = dy / d; +}; - if (this.currentCursorStyle !== this.cursor) - { - this.currentCursorStyle = this.cursor; - this.interactionDOMElement.style.cursor = this.cursor; - } +},{"./TiltShiftAxisFilter":110}],113:[function(require,module,exports){ +var TiltShiftAxisFilter = require('./TiltShiftAxisFilter'); - //TODO BUG for parents ineractive object (border order issue) -}; +/** + * @author Vico @vicocotea + * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/ + */ /** - * Processes the result of the mouse move check and dispatches the event if need be + * A TiltShiftYFilter. * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object - * @private + * @class + * @extends PIXI.TiltShiftAxisFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.processMouseMove = function ( displayObject, hit ) +function TiltShiftYFilter() { - this.dispatchEvent( displayObject, 'mousemove', this.eventData); - this.processMouseOverOut(displayObject, hit); -}; + TiltShiftAxisFilter.call(this); +} +TiltShiftYFilter.prototype = Object.create(TiltShiftAxisFilter.prototype); +TiltShiftYFilter.prototype.constructor = TiltShiftYFilter; +module.exports = TiltShiftYFilter; /** - * Is called when the mouse is moved out of the renderer element - * - * @param event {Event} The DOM event of a mouse being moved out - * @private + * Updates the filter delta values. + * */ -InteractionManager.prototype.onMouseOut = function (event) +TiltShiftYFilter.prototype.updateDelta = function () { - this.mouse.originalEvent = event; - this.eventData.stopped = false; - - // Update internal mouse reference - this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); + var dx = this.uniforms.end.value.x - this.uniforms.start.value.x; + var dy = this.uniforms.end.value.y - this.uniforms.start.value.y; + var d = Math.sqrt(dx * dx + dy * dy); - this.interactionDOMElement.style.cursor = 'inherit'; + this.uniforms.delta.value.x = -dy / d; + this.uniforms.delta.value.y = dx / d; +}; - // TODO optimize by not check EVERY TIME! maybe half as often? // - this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY ); +},{"./TiltShiftAxisFilter":110}],114:[function(require,module,exports){ +var core = require('../../core'); +// @see https://github.com/substack/brfs/issues/25 - this.processInteractive( this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, false ); -}; /** - * Processes the result of the mouse over/out check and dispatches the event if need be + * This filter applies a twist effect making display objects appear twisted in the given direction. * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object - * @private + * @class + * @extends PIXI.AbstractFilter + * @memberof PIXI.filters */ -InteractionManager.prototype.processMouseOverOut = function ( displayObject, hit ) +function TwistFilter() { - if(hit) - { - if(!displayObject._over) + core.AbstractFilter.call(this, + // vertex shader + null, + // fragment shader + "precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord - offset;\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratio = (radius - dist) / radius;\n float angleMod = ratio * ratio * 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 gl_FragColor = texture2D(uSampler, coord+offset);\n}\n", + // custom uniforms { - displayObject._over = true; - this.dispatchEvent( displayObject, 'mouseover', this.eventData ); + radius: { type: '1f', value: 0.5 }, + angle: { type: '1f', value: 5 }, + offset: { type: 'v2', value: { x: 0.5, y: 0.5 } } } + ); +} - if (displayObject.buttonMode) +TwistFilter.prototype = Object.create(core.AbstractFilter.prototype); +TwistFilter.prototype.constructor = TwistFilter; +module.exports = TwistFilter; + +Object.defineProperties(TwistFilter.prototype, { + /** + * This point describes the the offset of the twist. + * + * @member {Point} + * @memberof TwistFilter# + */ + offset: { + get: function () { - this.cursor = displayObject.defaultCursor; + return this.uniforms.offset.value; + }, + set: function (value) + { + this.uniforms.offset.value = value; } - } - else - { - if(displayObject._over) + }, + + /** + * This radius of the twist. + * + * @member {number} + * @memberof TwistFilter# + */ + radius: { + get: function () { - displayObject._over = false; - this.dispatchEvent( displayObject, 'mouseout', this.eventData); + return this.uniforms.radius.value; + }, + set: function (value) + { + this.uniforms.radius.value = value; + } + }, + + /** + * This angle of the twist. + * + * @member {number} + * @memberof TwistFilter# + */ + angle: { + get: function () + { + return this.uniforms.angle.value; + }, + set: function (value) + { + this.uniforms.angle.value = value; } } -}; +}); +},{"../../core":29}],115:[function(require,module,exports){ +var core = require('../core'); /** - * Is called when a touch is started on the renderer element + * Holds all information related to an Interaction event * - * @param event {Event} The DOM event of a touch starting on the renderer view - * @private + * @class + * @memberof PIXI.interaction */ -InteractionManager.prototype.onTouchStart = function (event) +function InteractionData() { - if (this.autoPreventDefault) - { - event.preventDefault(); - } - - var changedTouches = event.changedTouches; - var cLength = changedTouches.length; - - for (var i=0; i < cLength; i++) - { - var touchEvent = changedTouches[i]; - //TODO POOL - var touchData = this.getTouchData( touchEvent ); - - touchData.originalEvent = event; + /** + * This point stores the global coords of where the touch/mouse event happened + * + * @member {Point} + */ + this.global = new core.Point(); - this.eventData.data = touchData; - this.eventData.stopped = false; + /** + * The target Sprite that was interacted with + * + * @member {Sprite} + */ + this.target = null; - this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchStart, true ); + /** + * When passed to an event handler, this will be the original DOM Event that was captured + * + * @member {Event} + */ + this.originalEvent = null; +} - this.returnTouchData( touchData ); - } -}; +InteractionData.prototype.constructor = InteractionData; +module.exports = InteractionData; /** - * Processes the result of a touch check and dispatches the event if need be + * This will return the local coordinates of the specified displayObject for this InteractionData * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object - * @private + * @param displayObject {DisplayObject} The DisplayObject that you would like the local coords off + * @param [point] {Point} A Point object in which to store the value, optional (otherwise will create a new point) + * param [globalPos] {Point} A Point object containing your custom global coords, optional (otherwise will use the current global coords) + * @return {Point} A point containing the coordinates of the InteractionData position relative to the DisplayObject */ -InteractionManager.prototype.processTouchStart = function ( displayObject, hit ) +InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) { - //console.log("hit" + hit) - if(hit) - { - displayObject._touchDown = true; - this.dispatchEvent( displayObject, 'touchstart', this.eventData ); - } + var worldTransform = displayObject.worldTransform; + var global = globalPos ? globalPos : this.global; + + // do a cheeky transform to get the mouse coords; + var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx, + a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, + id = 1 / (a00 * a11 + a01 * -a10); + + point = point || new core.math.Point(); + + point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; + point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; + + // set the mouse coords... + return point; }; +},{"../core":29}],116:[function(require,module,exports){ +var core = require('../core'), + InteractionData = require('./InteractionData'); + +// Mix interactiveTarget into core.DisplayObject.prototype +Object.assign( + core.DisplayObject.prototype, + require('./interactiveTarget') +); /** - * Is called when a touch ends on the renderer element - * @param event {Event} The DOM event of a touch ending on the renderer view + * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive + * if its interactive parameter is set to true + * This manager also supports multitouch. * + * @class + * @memberof PIXI.interaction + * @param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer + * @param [options] {object} + * @param [options.autoPreventDefault=true] {boolean} Should the manager automatically prevent default browser actions. + * @param [options.interactionFrequency=10] {number} Frequency increases the interaction events will be checked. */ -InteractionManager.prototype.onTouchEnd = function (event) +function InteractionManager(renderer, options) { - if (this.autoPreventDefault) - { - event.preventDefault(); - } + options = options || {}; + + /** + * The renderer this interaction manager works for. + * + * @member {SystemRenderer} + */ + this.renderer = renderer; + + /** + * Should default browser actions automatically be prevented. + * + * @member {boolean} + * @default true + */ + this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; + + /** + * As this frequency increases the interaction events will be checked more often. + * + * @member {number} + * @default 10 + */ + this.interactionFrequency = options.interactionFrequency || 10; + + /** + * The mouse data + * + * @member {InteractionData} + */ + this.mouse = new InteractionData(); + + /** + * An event data object to handle all the event tracking/dispatching + * + * @member {EventData} + */ + this.eventData = { + stopped: false, + target: null, + type: null, + data: this.mouse, + stopPropagation:function(){ + this.stopped = true; + } + }; - var changedTouches = event.changedTouches; - var cLength = changedTouches.length; + /** + * Tiny little interactiveData pool ! + * + * @member {Array} + */ + this.interactiveDataPool = []; - for (var i=0; i < cLength; i++) - { - var touchEvent = changedTouches[i]; + /** + * The DOM element to bind to. + * + * @member {HTMLElement} + * @private + */ + this.interactionDOMElement = null; - var touchData = this.getTouchData( touchEvent ); + /** + * Have events been attached to the dom element? + * + * @member {boolean} + * @private + */ + this.eventsAdded = false; - touchData.originalEvent = event; + //this will make it so that you don't have to call bind all the time - //TODO this should be passed along.. no set - this.eventData.data = touchData; - this.eventData.stopped = false; + /** + * @member {Function} + */ + this.onMouseUp = this.onMouseUp.bind(this); + this.processMouseUp = this.processMouseUp.bind( this ); - this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchEnd, true ); + /** + * @member {Function} + */ + this.onMouseDown = this.onMouseDown.bind(this); + this.processMouseDown = this.processMouseDown.bind( this ); - this.returnTouchData( touchData ); - } -}; + /** + * @member {Function} + */ + this.onMouseMove = this.onMouseMove.bind( this ); + this.processMouseMove = this.processMouseMove.bind( this ); -/** - * Processes the result of the end of a touch and dispatches the event if need be - * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object - * @private - */ -InteractionManager.prototype.processTouchEnd = function ( displayObject, hit ) -{ - if(hit) - { - this.dispatchEvent( displayObject, 'touchend', this.eventData ); + /** + * @member {Function} + */ + this.onMouseOut = this.onMouseOut.bind(this); + this.processMouseOverOut = this.processMouseOverOut.bind( this ); - if( displayObject._touchDown ) - { - displayObject._touchDown = false; - this.dispatchEvent( displayObject, 'tap', this.eventData ); - } - } - else - { - if( displayObject._touchDown ) - { - displayObject._touchDown = false; - this.dispatchEvent( displayObject, 'touchendoutside', this.eventData ); - } - } -}; -/** - * Is called when a touch is moved across the renderer element - * - * @param event {Event} The DOM event of a touch moving across the renderer view - * @private - */ -InteractionManager.prototype.onTouchMove = function (event) -{ - if (this.autoPreventDefault) - { - event.preventDefault(); - } + /** + * @member {Function} + */ + this.onTouchStart = this.onTouchStart.bind(this); + this.processTouchStart = this.processTouchStart.bind(this); - var changedTouches = event.changedTouches; - var cLength = changedTouches.length; + /** + * @member {Function} + */ + this.onTouchEnd = this.onTouchEnd.bind(this); + this.processTouchEnd = this.processTouchEnd.bind(this); - for (var i=0; i < cLength; i++) - { - var touchEvent = changedTouches[i]; + /** + * @member {Function} + */ + this.onTouchMove = this.onTouchMove.bind(this); + this.processTouchMove = this.processTouchMove.bind(this); - var touchData = this.getTouchData( touchEvent ); + /** + * @member {number} + */ + this.last = 0; - touchData.originalEvent = event; + /** + * The css style of the cursor that is being used + * @member {string} + */ + this.currentCursorStyle = 'inherit'; - this.eventData.data = touchData; - this.eventData.stopped = false; + /** + * Internal cached var + * @member {Point} + * @private + */ + this._tempPoint = new core.Point(); - this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchMove, false ); + /** + * The current resolution + * @member {number} + */ + this.resolution = 1; - this.returnTouchData( touchData ); - } -}; + this.setTargetElement(this.renderer.view, this.renderer.resolution); +} + +InteractionManager.prototype.constructor = InteractionManager; +module.exports = InteractionManager; /** - * Processes the result of a touch move check and dispatches the event if need be + * 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 deletegate + * another DOM element to receive those events. * - * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested - * @param hit {boolean} the result of the hit test on the display object + * @param element {HTMLElement} the DOM element which will receive mouse and touch events. + * @param [resolution=1] {number} THe resolution of the new element (relative to the canvas). * @private */ -InteractionManager.prototype.processTouchMove = function ( displayObject, hit ) +InteractionManager.prototype.setTargetElement = function (element, resolution) { - hit = hit; - this.dispatchEvent( displayObject, 'touchmove', this.eventData); + this.removeEvents(); + + this.interactionDOMElement = element; + + this.resolution = resolution || 1; + + this.addEvents(); }; /** - * Grabs an interaction data object from the internal pool - * - * @param touchEvent {EventData} The touch event we need to pair with an interactionData object - * + * Registers all the DOM events * @private */ -InteractionManager.prototype.getTouchData = function (touchEvent) +InteractionManager.prototype.addEvents = function () { - var touchData = this.interactiveDataPool.pop(); - - if(!touchData) + if (!this.interactionDOMElement) { - touchData = new InteractionData(); + return; } - touchData.identifier = touchEvent.identifier; - this.mapPositionToPoint( touchData.global, touchEvent.clientX, touchEvent.clientY ); + core.ticker.shared.add(this.update, this); - if(navigator.isCocoonJS) + if (window.navigator.msPointerEnabled) { - touchData.global.x = touchData.global.x / this.resolution; - touchData.global.y = touchData.global.y / this.resolution; + this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; + this.interactionDOMElement.style['-ms-touch-action'] = 'none'; } - touchEvent.globalX = touchData.global.x; - touchEvent.globalY = touchData.global.y; + window.document.addEventListener('mousemove', this.onMouseMove, true); + this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true); + this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true); - return touchData; + this.interactionDOMElement.addEventListener('touchstart', this.onTouchStart, true); + this.interactionDOMElement.addEventListener('touchend', this.onTouchEnd, true); + this.interactionDOMElement.addEventListener('touchmove', this.onTouchMove, true); + + window.addEventListener('mouseup', this.onMouseUp, true); + + this.eventsAdded = true; }; /** - * Returns an interaction data object to the internal pool - * - * @param touchData {InteractionData} The touch data object we want to return to the pool - * + * Removes all the DOM events that were previously registered * @private */ -InteractionManager.prototype.returnTouchData = function ( touchData ) +InteractionManager.prototype.removeEvents = function () { - this.interactiveDataPool.push( touchData ); -}; - -/** - * Destroys the interaction manager - */ -InteractionManager.prototype.destroy = function () { - this.removeEvents(); - - this.renderer = null; - - this.mouse = null; - - this.eventData = null; - - this.interactiveDataPool = null; - - this.interactionDOMElement = null; - - this.onMouseUp = null; - this.processMouseUp = null; - - - this.onMouseDown = null; - this.processMouseDown = null; - - this.onMouseMove = null; - this.processMouseMove = null; - - this.onMouseOut = null; - this.processMouseOverOut = null; - + if (!this.interactionDOMElement) + { + return; + } - this.onTouchStart = null; - this.processTouchStart = null; + core.ticker.shared.remove(this.update); - this.onTouchEnd = null; - this.processTouchEnd = null; + if (window.navigator.msPointerEnabled) + { + this.interactionDOMElement.style['-ms-content-zooming'] = ''; + this.interactionDOMElement.style['-ms-touch-action'] = ''; + } - this.onTouchMove = null; - this.processTouchMove = null; + window.document.removeEventListener('mousemove', this.onMouseMove, true); + this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true); + this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true); - this._tempPoint = null; -}; + this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true); + this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true); + this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true); -core.WebGLRenderer.registerPlugin('interaction', InteractionManager); -core.CanvasRenderer.registerPlugin('interaction', InteractionManager); + this.interactionDOMElement = null; -},{"../core":29,"./InteractionData":113,"./interactiveTarget":116}],115:[function(require,module,exports){ -/** - * @file Main export of the PIXI interactions library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ + window.removeEventListener('mouseup', this.onMouseUp, true); -/** - * @namespace PIXI.interaction - */ -module.exports = { - InteractionData: require('./InteractionData'), - InteractionManager: require('./InteractionManager'), - interactiveTarget: require('./interactiveTarget') + this.eventsAdded = false; }; -},{"./InteractionData":113,"./InteractionManager":114,"./interactiveTarget":116}],116:[function(require,module,exports){ /** - * Default property values of interactive objects - * used by {@link PIXI.interaction.InteractionManager}. - * - * @mixin - * @memberof PIXI.interaction - * @example - * function MyObject() {} + * Updates the state of interactive objects. + * Invoked by a throttled ticker update from + * {@link PIXI.ticker.shared}. * - * Object.assign( - * MyObject.prototype, - * PIXI.interaction.interactiveTarget) - * ); + * @param deltaTime {number} */ -var interactiveTarget = { - /** - * @todo Needs docs. - */ - interactive: false, - /** - * @todo Needs docs. - */ - buttonMode: false, - /** - * @todo Needs docs. - */ - interactiveChildren: true, - /** - * @todo Needs docs. - */ - defaultCursor: 'pointer', +InteractionManager.prototype.update = function (deltaTime) +{ + this._deltaTime += deltaTime; - // some internal checks.. + if (this._deltaTime < this.interactionFrequency) + { + return; + } - /** - * @todo Needs docs. - * @private - */ - _over: false, - /** - * @todo Needs docs. - * @private - */ - _touchDown: false -}; + this._deltaTime = 0; -module.exports = interactiveTarget; + if (!this.interactionDOMElement) + { + return; + } -},{}],117:[function(require,module,exports){ -var Resource = require('resource-loader').Resource, - core = require('../core'), - utils = require('../core/utils'), - extras = require('../extras'), - path = require('path'); + // if the user move the mouse this check has already been dfone using the mouse move! + if(this.didMove) + { + this.didMove = false; + return; + } + this.cursor = 'inherit'; -function parse(resource, texture) { - var data = {}; - var info = resource.data.getElementsByTagName('info')[0]; - var common = resource.data.getElementsByTagName('common')[0]; + this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, true ); - data.font = info.getAttribute('face'); - data.size = parseInt(info.getAttribute('size'), 10); - data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10); - data.chars = {}; + if (this.currentCursorStyle !== this.cursor) + { + this.currentCursorStyle = this.cursor; + this.interactionDOMElement.style.cursor = this.cursor; + } - //parse letters - var letters = resource.data.getElementsByTagName('char'); + //TODO +}; - for (var i = 0; i < letters.length; i++) +/** + * Dispatches an event on the display object that was interacted with + * @param displayObject {Container|Sprite|TilingSprite} the display object in question + * @param eventString {string} the name of the event (e.g, mousedown) + * @param eventData {EventData} the event data object + * @private + */ +InteractionManager.prototype.dispatchEvent = function ( displayObject, eventString, eventData ) +{ + if(!eventData.stopped) { - var charCode = parseInt(letters[i].getAttribute('id'), 10); - - var textureRect = new core.math.Rectangle( - parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, - parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, - parseInt(letters[i].getAttribute('width'), 10), - parseInt(letters[i].getAttribute('height'), 10) - ); + eventData.target = displayObject; + eventData.type = eventString; - data.chars[charCode] = { - xOffset: parseInt(letters[i].getAttribute('xoffset'), 10), - yOffset: parseInt(letters[i].getAttribute('yoffset'), 10), - xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10), - kerning: {}, - texture: new core.Texture(texture.baseTexture, textureRect) + displayObject.emit( eventString, eventData ); - }; + if( displayObject[eventString] ) + { + displayObject[eventString]( eventData ); + } } +}; - //parse kernings - var kernings = resource.data.getElementsByTagName('kerning'); - for (i = 0; i < kernings.length; i++) - { - var first = parseInt(kernings[i].getAttribute('first'), 10); - var second = parseInt(kernings[i].getAttribute('second'), 10); - var amount = parseInt(kernings[i].getAttribute('amount'), 10); +/** + * Maps x and y coords from a DOM object and maps them correctly to the pixi 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 {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 ( point, x, y ) +{ + var rect = this.interactionDOMElement.getBoundingClientRect(); + point.x = ( ( x - rect.left ) * (this.interactionDOMElement.width / rect.width ) ) / this.resolution; + point.y = ( ( y - rect.top ) * (this.interactionDOMElement.height / rect.height ) ) / this.resolution; +}; - data.chars[second].kerning[first] = amount; +/** + * 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. + * + * @param {Point} point the point that is tested for collision + * @param {Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children) + * @param {function} func the function that will be called on each interactive object. The 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 + */ +InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive ) +{ + if(!displayObject.visible) + { + return false; } - resource.bitmapFont = data; + var children = displayObject.children; - // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3 - // but it's very likely to change - extras.BitmapText.fonts[data.font] = data; -} + var hit = false; + // if the object is interactive we must hit test all its children.. + interactive = interactive || displayObject.interactive; -module.exports = function () -{ - return function (resource, next) + if(displayObject.interactiveChildren) { - // skip if no data or not xml data - if (!resource.data || !resource.isXml) - { - return next(); - } - // skip if not bitmap font data, using some silly duck-typing - if ( - resource.data.getElementsByTagName('page').length === 0 || - resource.data.getElementsByTagName('info').length === 0 || - resource.data.getElementsByTagName('info')[0].getAttribute('face') === null - ) + for (var i = children.length-1; i >= 0; i--) { - return next(); - } - - var xmlUrl = path.dirname(resource.url); - - if (xmlUrl === '.') { - xmlUrl = ''; - } - - if (this.baseUrl && xmlUrl) { - // if baseurl has a trailing slash then add one to xmlUrl so the replace works below - if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') { - xmlUrl += '/'; + if(! hit && hitTest) + { + hit = this.processInteractive(point, children[i], func, true, interactive ); + } + else + { + // now we know we can miss it all! + this.processInteractive(point, children[i], func, false, false ); } - - // remove baseUrl from xmlUrl - xmlUrl = xmlUrl.replace(this.baseUrl, ''); } - // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. - if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') { - xmlUrl += '/'; - } - var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { - //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); - next(); + } + + if(interactive) + { + if(hitTest) + { + if(displayObject.hitArea) + { + // lets use the hit object first! + displayObject.worldTransform.applyInverse(point, this._tempPoint); + hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y ); + } + else if(displayObject.containsPoint) + { + hit = displayObject.containsPoint(point); + } } - else { - var loadOptions = { - crossOrigin: resource.crossOrigin, - loadType: Resource.LOAD_TYPE.IMAGE - }; - // load the texture for the font - this.add(resource.name + '_image', textureUrl, loadOptions, function (res) { - parse(resource, res.texture); - next(); - }); + + if(displayObject.interactive) + { + func(displayObject, hit); } - }; + } + + return hit; }; -},{"../core":29,"../core/utils":74,"../extras":83,"path":3,"resource-loader":18}],118:[function(require,module,exports){ -/** - * @file Main export of the PIXI loaders library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ + + /** - * @namespace PIXI.loaders + * Is called when the mouse button is pressed down on the renderer element + * + * @param event {Event} The DOM event of a mouse button being pressed down + * @private */ -module.exports = { - Loader: require('./loader'), +InteractionManager.prototype.onMouseDown = function (event) +{ + this.mouse.originalEvent = event; + this.eventData.data = this.mouse; + this.eventData.stopped = false; - // parsers - bitmapFontParser: require('./bitmapFontParser'), - spritesheetParser: require('./spritesheetParser'), - textureParser: require('./textureParser'), - Resource: require('resource-loader').Resource -}; + // Update internal mouse reference + this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); -},{"./bitmapFontParser":117,"./loader":119,"./spritesheetParser":120,"./textureParser":121,"resource-loader":18}],119:[function(require,module,exports){ -var ResourceLoader = require('resource-loader'), - textureParser = require('./textureParser'), - spritesheetParser = require('./spritesheetParser'), - bitmapFontParser = require('./bitmapFontParser'); + if (this.autoPreventDefault) + { + this.mouse.originalEvent.preventDefault(); + } + + this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseDown, true ); +}; /** + * Processes the result of the mouse down check and dispatches the event if need be * - * The new loader, extends Resource Loader by Chad Engler : https://github.com/englercj/resource-loader - * - * ```js - * var loader = PIXI.loader; // pixi exposes a premade instance for you to use. - * //or - * var loader = new PIXI.loaders.Loader(); // you can also create your own if you want - * - * loader.add('bunny',"data/bunny.png"); - * - * loader.once('complete',onAssetsLoaded); - * - * loader.load(); - * ``` - * - * @class - * @extends PIXI.ResourceLoader - * @memberof PIXI.loaders - * @param [baseUrl=''] {string} The base url for all resources loaded by this loader. - * @param [concurrency=10] {number} The number of resources to load concurrently. + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the dispay object + * @private */ -function Loader(baseUrl, concurrency) +InteractionManager.prototype.processMouseDown = function ( displayObject, hit ) { - ResourceLoader.call(this, baseUrl, concurrency); + var e = this.mouse.originalEvent; - for (var i = 0; i < Loader._pixiMiddleware.length; ++i) { - this.use(Loader._pixiMiddleware[i]()); + var isRightButton = e.button === 2 || e.which === 3; + + if(hit) + { + displayObject[ isRightButton ? '_isRightDown' : '_isLeftDown' ] = true; + this.dispatchEvent( displayObject, isRightButton ? 'rightdown' : 'mousedown', this.eventData ); } -} +}; -Loader.prototype = Object.create(ResourceLoader.prototype); -Loader.prototype.constructor = Loader; -module.exports = Loader; -Loader._pixiMiddleware = [ - // parse any blob into more usable objects (e.g. Image) - ResourceLoader.middleware.parsing.blob, - // parse any Image objects into textures - textureParser, - // parse any spritesheet data into multiple textures - spritesheetParser, - // parse any spritesheet data into multiple textures - bitmapFontParser -]; +/** + * Is called when the mouse button is released on the renderer element + * + * @param event {Event} The DOM event of a mouse button being released + * @private + */ +InteractionManager.prototype.onMouseUp = function (event) +{ + this.mouse.originalEvent = event; + this.eventData.data = this.mouse; + this.eventData.stopped = false; -Loader.addPixiMiddleware = function (fn) { - Loader._pixiMiddleware.push(fn); + // Update internal mouse reference + this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); + + this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseUp, true ); }; -// Add custom extentions -var Resource = ResourceLoader.Resource; +/** + * Processes the result of the mouse up check and dispatches the event if need be + * + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object + * @private + */ +InteractionManager.prototype.processMouseUp = function ( displayObject, hit ) +{ + var e = this.mouse.originalEvent; -Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT); + var isRightButton = e.button === 2 || e.which === 3; + var isDown = isRightButton ? '_isRightDown' : '_isLeftDown'; -},{"./bitmapFontParser":117,"./spritesheetParser":120,"./textureParser":121,"resource-loader":18}],120:[function(require,module,exports){ -var Resource = require('resource-loader').Resource, - path = require('path'), - core = require('../core'); + if(hit) + { + this.dispatchEvent( displayObject, isRightButton ? 'rightup' : 'mouseup', this.eventData ); -module.exports = function () -{ - return function (resource, next) + if( displayObject[ isDown ] ) + { + displayObject[ isDown ] = false; + this.dispatchEvent( displayObject, isRightButton ? 'rightclick' : 'click', this.eventData ); + } + } + else { - // skip if no data, its not json, or it isn't spritesheet data - if (!resource.data || !resource.isJson || !resource.data.frames) + if( displayObject[ isDown ] ) { - return next(); + displayObject[ isDown ] = false; + this.dispatchEvent( displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', this.eventData ); } + } +}; - var loadOptions = { - crossOrigin: resource.crossOrigin, - loadType: Resource.LOAD_TYPE.IMAGE - }; - var route = path.dirname(resource.url.replace(this.baseUrl, '')); +/** + * Is called when the mouse moves across the renderer element + * + * @param event {Event} The DOM event of the mouse moving + * @private + */ +InteractionManager.prototype.onMouseMove = function (event) +{ + this.mouse.originalEvent = event; + this.eventData.data = this.mouse; + this.eventData.stopped = false; - var resolution = core.utils.getResolutionOfUrl( resource.url ); + this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); - // load the image for this sheet - this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res) - { - resource.textures = {}; + this.didMove = true; - var frames = resource.data.frames; + this.cursor = 'inherit'; - for (var i in frames) - { - var rect = frames[i].frame; + this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true ); - if (rect) - { - var size = null; - var trim = null; + if (this.currentCursorStyle !== this.cursor) + { + this.currentCursorStyle = this.cursor; + this.interactionDOMElement.style.cursor = this.cursor; + } - if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); - } - else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); - } + //TODO BUG for parents ineractive object (border order issue) +}; - // Check to see if the sprite is trimmed - if (frames[i].trimmed) - { - trim = new core.math.Rectangle( - frames[i].spriteSourceSize.x / resolution, - frames[i].spriteSourceSize.y / resolution, - frames[i].sourceSize.w / resolution, - frames[i].sourceSize.h / resolution - ); - } +/** + * Processes the result of the mouse move check and dispatches the event if need be + * + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object + * @private + */ +InteractionManager.prototype.processMouseMove = function ( displayObject, hit ) +{ + this.dispatchEvent( displayObject, 'mousemove', this.eventData); + this.processMouseOverOut(displayObject, hit); +}; - // flip the width and height! - if (frames[i].rotated) - { - var temp = size.width; - size.width = size.height; - size.height = temp; - } - size.x /= resolution; - size.y /= resolution; - size.width /= resolution; - size.height /= resolution; +/** + * Is called when the mouse is moved out of the renderer element + * + * @param event {Event} The DOM event of a mouse being moved out + * @private + */ +InteractionManager.prototype.onMouseOut = function (event) +{ + this.mouse.originalEvent = event; + this.eventData.stopped = false; - resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated); + // Update internal mouse reference + this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); - // lets also add the frame to pixi's global cache for fromFrame and fromImage functions - core.utils.TextureCache[i] = resource.textures[i]; - } - } + this.interactionDOMElement.style.cursor = 'inherit'; - next(); - }); - }; -}; + // TODO optimize by not check EVERY TIME! maybe half as often? // + this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY ); -},{"../core":29,"path":3,"resource-loader":18}],121:[function(require,module,exports){ -var core = require('../core'); + this.processInteractive( this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, false ); +}; -module.exports = function () +/** + * Processes the result of the mouse over/out check and dispatches the event if need be + * + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object + * @private + */ +InteractionManager.prototype.processMouseOverOut = function ( displayObject, hit ) { - return function (resource, next) + if(hit) { - // create a new texture if the data is an Image object - if (resource.data && resource.isImage) + if(!displayObject._over) { - resource.texture = new core.Texture(new core.BaseTexture(resource.data, null, core.utils.getResolutionOfUrl(resource.url))); - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions - core.utils.TextureCache[resource.url] = resource.texture; + displayObject._over = true; + this.dispatchEvent( displayObject, 'mouseover', this.eventData ); } - next(); - }; + if (displayObject.buttonMode) + { + this.cursor = displayObject.defaultCursor; + } + } + else + { + if(displayObject._over) + { + displayObject._over = false; + this.dispatchEvent( displayObject, 'mouseout', this.eventData); + } + } }; -},{"../core":29}],122:[function(require,module,exports){ -var core = require('../core'); /** - * Base mesh class - * @class - * @extends PIXI.Container - * @memberof PIXI.mesh - * @param texture {Texture} The texture to use - * @param [vertices] {Float32Arrif you want to specify the vertices - * @param [uvs] {Float32Array} if you want to specify the uvs - * @param [indices] {Uint16Array} if you want to specify the indices - * @param [drawMode] {number} the drawMode, can be any of the Mesh.DRAW_MODES consts + * Is called when a touch is started on the renderer element + * + * @param event {Event} The DOM event of a touch starting on the renderer view + * @private */ -function Mesh(texture, vertices, uvs, indices, drawMode) +InteractionManager.prototype.onTouchStart = function (event) { - core.Container.call(this); - - /** - * The texture of the Mesh - * - * @member {Texture} - */ - this.texture = texture; - - /** - * The Uvs of the Mesh - * - * @member {Float32Array} - */ - this.uvs = uvs || new Float32Array([0, 1, - 1, 1, - 1, 0, - 0, 1]); - - /** - * An array of vertices - * - * @member {Float32Array} - */ - this.vertices = vertices || new Float32Array([0, 0, - 100, 0, - 100, 100, - 0, 100]); + if (this.autoPreventDefault) + { + event.preventDefault(); + } - /* - * @member {Uint16Array} An array containing the indices of the vertices - */ - // TODO auto generate this based on draw mode! - this.indices = indices || new Uint16Array([0, 1, 2, 3]); + var changedTouches = event.changedTouches; + var cLength = changedTouches.length; - /** - * Whether the Mesh is dirty or not - * - * @member {boolean} - */ - this.dirty = true; + for (var i=0; i < cLength; i++) + { + var touchEvent = changedTouches[i]; + //TODO POOL + var touchData = this.getTouchData( touchEvent ); - /** - * The blend mode to be applied to the sprite. Set to blendModes.NORMAL to remove any blend mode. - * - * @member {number} - * @default CONST.BLEND_MODES.NORMAL; - */ - this.blendMode = core.BLEND_MODES.NORMAL; + touchData.originalEvent = event; - /** - * Triangles in canvas mode are automatically antialiased, use this value to force triangles to overlap a bit with each other. - * - * @member {number} - */ - this.canvasPadding = 0; + this.eventData.data = touchData; + this.eventData.stopped = false; - /** - * The way the Mesh should be drawn, can be any of the Mesh.DRAW_MODES consts - * - * @member {number} - */ - this.drawMode = drawMode || Mesh.DRAW_MODES.TRIANGLE_MESH; -} + this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchStart, true ); -// constructor -Mesh.prototype = Object.create(core.Container.prototype); -Mesh.prototype.constructor = Mesh; -module.exports = Mesh; + this.returnTouchData( touchData ); + } +}; /** - * Renders the object using the WebGL renderer + * Processes the result of a touch check and dispatches the event if need be * - * @param renderer {WebGLRenderer} a reference to the WebGL renderer + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object * @private */ -Mesh.prototype._renderWebGL = function (renderer) +InteractionManager.prototype.processTouchStart = function ( displayObject, hit ) { - renderer.setObjectRenderer(renderer.plugins.mesh); - renderer.plugins.mesh.render(this); + //console.log("hit" + hit) + if(hit) + { + displayObject._touchDown = true; + this.dispatchEvent( displayObject, 'touchstart', this.eventData ); + } }; + /** - * Renders the object using the Canvas renderer + * Is called when a touch ends on the renderer element + * @param event {Event} The DOM event of a touch ending on the renderer view * - * @param renderer {CanvasRenderer} - * @private */ -Mesh.prototype._renderCanvas = function (renderer) +InteractionManager.prototype.onTouchEnd = function (event) { - var context = renderer.context; - - var transform = this.worldTransform; - - if (renderer.roundPixels) + if (this.autoPreventDefault) { - context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx | 0, transform.ty | 0); + event.preventDefault(); } - else + + var changedTouches = event.changedTouches; + var cLength = changedTouches.length; + + for (var i=0; i < cLength; i++) { - context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); + var touchEvent = changedTouches[i]; + + var touchData = this.getTouchData( touchEvent ); + + touchData.originalEvent = event; + + //TODO this should be passed along.. no set + this.eventData.data = touchData; + this.eventData.stopped = false; + + + this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchEnd, true ); + + this.returnTouchData( touchData ); } +}; - if (this.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH) +/** + * Processes the result of the end of a touch and dispatches the event if need be + * + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object + * @private + */ +InteractionManager.prototype.processTouchEnd = function ( displayObject, hit ) +{ + if(hit) { - this._renderCanvasTriangleMesh(context); + this.dispatchEvent( displayObject, 'touchend', this.eventData ); + + if( displayObject._touchDown ) + { + displayObject._touchDown = false; + this.dispatchEvent( displayObject, 'tap', this.eventData ); + } } else { - this._renderCanvasTriangles(context); + if( displayObject._touchDown ) + { + displayObject._touchDown = false; + this.dispatchEvent( displayObject, 'touchendoutside', this.eventData ); + } } }; /** - * Draws the object in Triangle Mesh mode using canvas + * Is called when a touch is moved across the renderer element * - * @param context {CanvasRenderingContext2D} the current drawing context + * @param event {Event} The DOM event of a touch moving across the renderer view * @private */ -Mesh.prototype._renderCanvasTriangleMesh = function (context) +InteractionManager.prototype.onTouchMove = function (event) { - // draw triangles!! - var vertices = this.vertices; - var uvs = this.uvs; + if (this.autoPreventDefault) + { + event.preventDefault(); + } - var length = vertices.length / 2; - // this.count++; + var changedTouches = event.changedTouches; + var cLength = changedTouches.length; + + for (var i=0; i < cLength; i++) + { + var touchEvent = changedTouches[i]; + + var touchData = this.getTouchData( touchEvent ); + + touchData.originalEvent = event; + + this.eventData.data = touchData; + this.eventData.stopped = false; - for (var i = 0; i < length - 2; i++) - { - // draw some triangles! - var index = i * 2; - this._renderCanvasDrawTriangle(context, vertices, uvs, index, (index + 2), (index + 4)); + this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchMove, false ); + + this.returnTouchData( touchData ); } }; /** - * Draws the object in triangle mode using canvas + * Processes the result of a touch move check and dispatches the event if need be * - * @param context {CanvasRenderingContext2D} the current drawing context + * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested + * @param hit {boolean} the result of the hit test on the display object * @private */ -Mesh.prototype._renderCanvasTriangles = function (context) +InteractionManager.prototype.processTouchMove = function ( displayObject, hit ) { - // draw triangles!! - var vertices = this.vertices; - var uvs = this.uvs; - var indices = this.indices; - - var length = indices.length; - // this.count++; - - for (var i = 0; i < length; i += 3) - { - // draw some triangles! - var index0 = indices[i] * 2, index1 = indices[i + 1] * 2, index2 = indices[i + 2] * 2; - this._renderCanvasDrawTriangle(context, vertices, uvs, index0, index1, index2); - } + hit = hit; + this.dispatchEvent( displayObject, 'touchmove', this.eventData); }; /** - * Draws one of the triangles that form this Mesh + * Grabs an interaction data object from the internal pool + * + * @param touchEvent {EventData} The touch event we need to pair with an interactionData object * - * @param context {CanvasRenderingContext2D} the current drawing context - * @param vertices {Float32Array} a reference to the vertices of the Mesh - * @param uvs {Float32Array} a reference to the uvs of the Mesh - * @param index0 {number} the index of the first vertex - * @param index1 {number} the index of the second vertex - * @param index2 {number} the index of the third vertex * @private */ -Mesh.prototype._renderCanvasDrawTriangle = function (context, vertices, uvs, index0, index1, index2) +InteractionManager.prototype.getTouchData = function (touchEvent) { - var textureSource = this.texture.baseTexture.source; - var textureWidth = this.texture.baseTexture.width; - var textureHeight = this.texture.baseTexture.height; - - var x0 = vertices[index0], x1 = vertices[index1], x2 = vertices[index2]; - var y0 = vertices[index0 + 1], y1 = vertices[index1 + 1], y2 = vertices[index2 + 1]; - - var u0 = uvs[index0] * textureWidth, u1 = uvs[index1] * textureWidth, u2 = uvs[index2] * textureWidth; - var v0 = uvs[index0 + 1] * textureHeight, v1 = uvs[index1 + 1] * textureHeight, v2 = uvs[index2 + 1] * textureHeight; + var touchData = this.interactiveDataPool.pop(); - if (this.canvasPadding > 0) + if(!touchData) { - var paddingX = this.canvasPadding / this.worldTransform.a; - var paddingY = this.canvasPadding / this.worldTransform.d; - var centerX = (x0 + x1 + x2) / 3; - var centerY = (y0 + y1 + y2) / 3; - - var normX = x0 - centerX; - var normY = y0 - centerY; - - var dist = Math.sqrt(normX * normX + normY * normY); - x0 = centerX + (normX / dist) * (dist + paddingX); - y0 = centerY + (normY / dist) * (dist + paddingY); + touchData = new InteractionData(); + } - // + touchData.identifier = touchEvent.identifier; + this.mapPositionToPoint( touchData.global, touchEvent.clientX, touchEvent.clientY ); - normX = x1 - centerX; - normY = y1 - centerY; + if(navigator.isCocoonJS) + { + touchData.global.x = touchData.global.x / this.resolution; + touchData.global.y = touchData.global.y / this.resolution; + } - dist = Math.sqrt(normX * normX + normY * normY); - x1 = centerX + (normX / dist) * (dist + paddingX); - y1 = centerY + (normY / dist) * (dist + paddingY); + touchEvent.globalX = touchData.global.x; + touchEvent.globalY = touchData.global.y; - normX = x2 - centerX; - normY = y2 - centerY; + return touchData; +}; - dist = Math.sqrt(normX * normX + normY * normY); - x2 = centerX + (normX / dist) * (dist + paddingX); - y2 = centerY + (normY / dist) * (dist + paddingY); - } +/** + * Returns an interaction data object to the internal pool + * + * @param touchData {InteractionData} The touch data object we want to return to the pool + * + * @private + */ +InteractionManager.prototype.returnTouchData = function ( touchData ) +{ + this.interactiveDataPool.push( touchData ); +}; - context.save(); - context.beginPath(); +/** + * Destroys the interaction manager + */ +InteractionManager.prototype.destroy = function () { + this.removeEvents(); + this.renderer = null; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); + this.mouse = null; - context.closePath(); + this.eventData = null; - context.clip(); + this.interactiveDataPool = null; - // Compute matrix transform - var delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2); - var deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2); - var deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2); - var deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2); - var deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2); - var deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2); - var deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2); + this.interactionDOMElement = null; - context.transform(deltaA / delta, deltaD / delta, - deltaB / delta, deltaE / delta, - deltaC / delta, deltaF / delta); + this.onMouseUp = null; + this.processMouseUp = null; - context.drawImage(textureSource, 0, 0); - context.restore(); -}; + this.onMouseDown = null; + this.processMouseDown = null; + this.onMouseMove = null; + this.processMouseMove = null; -/** - * Renders a flat Mesh - * - * @param Mesh {Mesh} The Mesh to render - * @private - */ -Mesh.prototype.renderMeshFlat = function (Mesh) -{ - var context = this.context; - var vertices = Mesh.vertices; + this.onMouseOut = null; + this.processMouseOverOut = null; - var length = vertices.length/2; - // this.count++; - context.beginPath(); - for (var i=1; i < length-2; i++) - { - // draw some triangles! - var index = i*2; + this.onTouchStart = null; + this.processTouchStart = null; - var x0 = vertices[index], x1 = vertices[index+2], x2 = vertices[index+4]; - var y0 = vertices[index+1], y1 = vertices[index+3], y2 = vertices[index+5]; + this.onTouchEnd = null; + this.processTouchEnd = null; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - } + this.onTouchMove = null; + this.processTouchMove = null; - context.fillStyle = '#FF0000'; - context.fill(); - context.closePath(); + this._tempPoint = null; }; -/* -Mesh.prototype.setTexture = function (texture) -{ - //TODO SET THE TEXTURES - //TODO VISIBILITY - //TODO SETTER +core.WebGLRenderer.registerPlugin('interaction', InteractionManager); +core.CanvasRenderer.registerPlugin('interaction', InteractionManager); - // stop current texture - this.texture = texture; - this.width = texture.frame.width; - this.height = texture.frame.height; - this.updateFrame = true; -}; +},{"../core":29,"./InteractionData":115,"./interactiveTarget":118}],117:[function(require,module,exports){ +/** + * @file Main export of the PIXI interactions library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} */ /** - * When the texture is updated, this event will fire to update the scale and frame - * - * @param event - * @private + * @namespace PIXI.interaction */ - -Mesh.prototype.onTextureUpdate = function () -{ - this.updateFrame = true; +module.exports = { + InteractionData: require('./InteractionData'), + InteractionManager: require('./InteractionManager'), + interactiveTarget: require('./interactiveTarget') }; +},{"./InteractionData":115,"./InteractionManager":116,"./interactiveTarget":118}],118:[function(require,module,exports){ /** - * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. + * Default property values of interactive objects + * used by {@link PIXI.interaction.InteractionManager}. * - * @param matrix {Matrix} the transformation matrix of the sprite - * @return {Rectangle} the framing rectangle + * @mixin + * @memberof PIXI.interaction + * @example + * function MyObject() {} + * + * Object.assign( + * MyObject.prototype, + * PIXI.interaction.interactiveTarget + * ); */ -Mesh.prototype.getBounds = function (matrix) -{ - var worldTransform = matrix || this.worldTransform; +var interactiveTarget = { + /** + * @todo Needs docs. + */ + interactive: false, + /** + * @todo Needs docs. + */ + buttonMode: false, + /** + * @todo Needs docs. + */ + interactiveChildren: true, + /** + * @todo Needs docs. + */ + defaultCursor: 'pointer', + + // some internal checks.. + + /** + * @todo Needs docs. + * @private + */ + _over: false, + /** + * @todo Needs docs. + * @private + */ + _touchDown: false +}; + +module.exports = interactiveTarget; + +},{}],119:[function(require,module,exports){ +var Resource = require('resource-loader').Resource, + core = require('../core'), + utils = require('../core/utils'), + extras = require('../extras'), + path = require('path'); - var a = worldTransform.a; - var b = worldTransform.b; - var c = worldTransform.c; - var d = worldTransform.d; - var tx = worldTransform.tx; - var ty = worldTransform.ty; - var maxX = -Infinity; - var maxY = -Infinity; +function parse(resource, texture) { + var data = {}; + var info = resource.data.getElementsByTagName('info')[0]; + var common = resource.data.getElementsByTagName('common')[0]; - var minX = Infinity; - var minY = Infinity; + data.font = info.getAttribute('face'); + data.size = parseInt(info.getAttribute('size'), 10); + data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10); + data.chars = {}; - var vertices = this.vertices; - for (var i = 0, n = vertices.length; i < n; i += 2) + //parse letters + var letters = resource.data.getElementsByTagName('char'); + + for (var i = 0; i < letters.length; i++) { - var rawX = vertices[i], rawY = vertices[i + 1]; - var x = (a * rawX) + (c * rawY) + tx; - var y = (d * rawY) + (b * rawX) + ty; + var charCode = parseInt(letters[i].getAttribute('id'), 10); - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; + var textureRect = new core.math.Rectangle( + parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, + parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, + parseInt(letters[i].getAttribute('width'), 10), + parseInt(letters[i].getAttribute('height'), 10) + ); - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; + data.chars[charCode] = { + xOffset: parseInt(letters[i].getAttribute('xoffset'), 10), + yOffset: parseInt(letters[i].getAttribute('yoffset'), 10), + xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10), + kerning: {}, + texture: new core.Texture(texture.baseTexture, textureRect) + + }; } - if (minX === -Infinity || maxY === Infinity) + //parse kernings + var kernings = resource.data.getElementsByTagName('kerning'); + for (i = 0; i < kernings.length; i++) { - return core.math.Rectangle.EMPTY; + var first = parseInt(kernings[i].getAttribute('first'), 10); + var second = parseInt(kernings[i].getAttribute('second'), 10); + var amount = parseInt(kernings[i].getAttribute('amount'), 10); + + data.chars[second].kerning[first] = amount; } - var bounds = this._bounds; + resource.bitmapFont = data; - bounds.x = minX; - bounds.width = maxX - minX; + // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3 + // but it's very likely to change + extras.BitmapText.fonts[data.font] = data; +} - bounds.y = minY; - bounds.height = maxY - minY; - // store a reference so that if this function gets called again in the render cycle we do not have to recalculate - this._currentBounds = bounds; +module.exports = function () +{ + return function (resource, next) + { + // skip if no data or not xml data + if (!resource.data || !resource.isXml) + { + return next(); + } - return bounds; + // skip if not bitmap font data, using some silly duck-typing + if ( + resource.data.getElementsByTagName('page').length === 0 || + resource.data.getElementsByTagName('info').length === 0 || + resource.data.getElementsByTagName('info')[0].getAttribute('face') === null + ) + { + return next(); + } + + var xmlUrl = path.dirname(resource.url); + + if (xmlUrl === '.') { + xmlUrl = ''; + } + + if (this.baseUrl && xmlUrl) { + // if baseurl has a trailing slash then add one to xmlUrl so the replace works below + if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') { + xmlUrl += '/'; + } + + // remove baseUrl from xmlUrl + xmlUrl = xmlUrl.replace(this.baseUrl, ''); + } + + // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. + if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') { + xmlUrl += '/'; + } + var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); + if (utils.TextureCache[textureUrl]) { + //reuse existing texture + parse(resource, utils.TextureCache[textureUrl]); + next(); + } + else { + var loadOptions = { + crossOrigin: resource.crossOrigin, + loadType: Resource.LOAD_TYPE.IMAGE + }; + // load the texture for the font + this.add(resource.name + '_image', textureUrl, loadOptions, function (res) { + parse(resource, res.texture); + next(); + }); + } + }; }; +},{"../core":29,"../core/utils":76,"../extras":85,"path":3,"resource-loader":18}],120:[function(require,module,exports){ /** - * Different drawing buffer modes supported - * - * @static - * @constant - * @property {object} DRAW_MODES - * @property {number} DRAW_MODES.TRIANGLE_MESH - * @property {number} DRAW_MODES.TRIANGLES + * @file Main export of the PIXI loaders library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} */ -Mesh.DRAW_MODES = { - TRIANGLE_MESH: 0, - TRIANGLES: 1 + +/** + * @namespace PIXI.loaders + */ +module.exports = { + Loader: require('./loader'), + + // parsers + bitmapFontParser: require('./bitmapFontParser'), + spritesheetParser: require('./spritesheetParser'), + textureParser: require('./textureParser'), + Resource: require('resource-loader').Resource }; -},{"../core":29}],123:[function(require,module,exports){ -var Mesh = require('./Mesh'); -var core = require('../core'); +},{"./bitmapFontParser":119,"./loader":121,"./spritesheetParser":122,"./textureParser":123,"resource-loader":18}],121:[function(require,module,exports){ +var ResourceLoader = require('resource-loader'), + textureParser = require('./textureParser'), + spritesheetParser = require('./spritesheetParser'), + bitmapFontParser = require('./bitmapFontParser'); /** - * The rope allows you to draw a texture across several points and them manipulate these points * - *```js - * for (var i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * var rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); - * ``` + * The new loader, extends Resource Loader by Chad Engler : https://github.com/englercj/resource-loader * - * @class - * @extends PIXI.Mesh - * @memberof PIXI.mesh - * @param {Texture} texture - The texture to use on the rope. - * @param {Array} points - An array of {Point} objects to construct this rope. + * ```js + * var loader = PIXI.loader; // pixi exposes a premade instance for you to use. + * //or + * var loader = new PIXI.loaders.Loader(); // you can also create your own if you want * + * loader.add('bunny',"data/bunny.png"); + * + * loader.once('complete',onAssetsLoaded); + * + * loader.load(); + * ``` + * + * @class + * @extends PIXI.ResourceLoader + * @memberof PIXI.loaders + * @param [baseUrl=''] {string} The base url for all resources loaded by this loader. + * @param [concurrency=10] {number} The number of resources to load concurrently. */ -function Rope(texture, points) +function Loader(baseUrl, concurrency) { - Mesh.call(this, texture); - - /* - * @member {Array} An array of points that determine the rope - */ - this.points = points; + ResourceLoader.call(this, baseUrl, concurrency); - /* - * @member {Float32Array} An array of vertices used to construct this rope. - */ - this.vertices = new Float32Array(points.length * 4); + for (var i = 0; i < Loader._pixiMiddleware.length; ++i) { + this.use(Loader._pixiMiddleware[i]()); + } +} - /* - * @member {Float32Array} The WebGL Uvs of the rope. - */ - this.uvs = new Float32Array(points.length * 4); +Loader.prototype = Object.create(ResourceLoader.prototype); +Loader.prototype.constructor = Loader; - /* - * @member {Float32Array} An array containing the color components - */ - this.colors = new Float32Array(points.length * 2); +module.exports = Loader; - /* - * @member {Uint16Array} An array containing the indices of the vertices - */ - this.indices = new Uint16Array(points.length * 2); +Loader._pixiMiddleware = [ + // parse any blob into more usable objects (e.g. Image) + ResourceLoader.middleware.parsing.blob, + // parse any Image objects into textures + textureParser, + // parse any spritesheet data into multiple textures + spritesheetParser, + // parse any spritesheet data into multiple textures + bitmapFontParser +]; - /* - * @member {TextureUvs} Current texture uvs - * @private - */ - this._textureUvs = null; +Loader.addPixiMiddleware = function (fn) { + Loader._pixiMiddleware.push(fn); +}; - this.refresh(); -} +// Add custom extentions +var Resource = ResourceLoader.Resource; +Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT); -// constructor -Rope.prototype = Object.create(Mesh.prototype); -Rope.prototype.constructor = Rope; -module.exports = Rope; +},{"./bitmapFontParser":119,"./spritesheetParser":122,"./textureParser":123,"resource-loader":18}],122:[function(require,module,exports){ +var Resource = require('resource-loader').Resource, + path = require('path'), + core = require('../core'); -/** - * Refreshes - * - */ -Rope.prototype.refresh = function () +module.exports = function () { - var points = this.points; - - if (points.length < 1) + return function (resource, next) { - return; - } + // skip if no data, its not json, or it isn't spritesheet data + if (!resource.data || !resource.isJson || !resource.data.frames) + { + return next(); + } - var uvs = this.uvs; + var loadOptions = { + crossOrigin: resource.crossOrigin, + loadType: Resource.LOAD_TYPE.IMAGE + }; - var indices = this.indices; - var colors = this.colors; + var route = path.dirname(resource.url.replace(this.baseUrl, '')); - var textureUvs = this._getTextureUvs(); - var offset = new core.math.Point(textureUvs.x0, textureUvs.y0); - var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); + var resolution = core.utils.getResolutionOfUrl( resource.url ); - uvs[0] = 0 + offset.x; - uvs[1] = 0 + offset.y; - uvs[2] = 0 + offset.x; - uvs[3] = 1 * factor.y + offset.y; + // load the image for this sheet + this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res) + { + resource.textures = {}; - colors[0] = 1; - colors[1] = 1; + var frames = resource.data.frames; - indices[0] = 0; - indices[1] = 1; + for (var i in frames) + { + var rect = frames[i].frame; - var total = points.length, - point, index, amount; + if (rect) + { + var size = null; + var trim = null; - for (var i = 1; i < total; i++) - { - point = points[i]; - index = i * 4; - // time to do some smart drawing! - amount = i / (total-1); + if (frames[i].rotated) { + size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + } + else { + size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + } - uvs[index] = amount * factor.x + offset.x; - uvs[index+1] = 0 + offset.y; + // Check to see if the sprite is trimmed + if (frames[i].trimmed) + { + trim = new core.math.Rectangle( + frames[i].spriteSourceSize.x / resolution, + frames[i].spriteSourceSize.y / resolution, + frames[i].sourceSize.w / resolution, + frames[i].sourceSize.h / resolution + ); + } - uvs[index+2] = amount * factor.x + offset.x; - uvs[index+3] = 1 * factor.y + offset.y; + // flip the width and height! + if (frames[i].rotated) + { + var temp = size.width; + size.width = size.height; + size.height = temp; + } - index = i * 2; - colors[index] = 1; - colors[index+1] = 1; + size.x /= resolution; + size.y /= resolution; + size.width /= resolution; + size.height /= resolution; - index = i * 2; - indices[index] = index; - indices[index + 1] = index + 1; - } -}; + resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated); -/* - * Returns texture UVs - * - * @private - */ + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions + core.utils.TextureCache[i] = resource.textures[i]; + } + } -Rope.prototype._getTextureUvs = function() -{ - if(!this._textureUvs) - { - this._textureUvs = new core.TextureUvs(); - this._textureUvs.set(this.texture.crop, this.texture.baseTexture, this.texture.rotate); - } - return this._textureUvs; + next(); + }); + }; }; -/* - * Clear texture UVs when new texture is set - * - * @private - */ - -Rope.prototype.onTextureUpdate = function () -{ - this._textureUvs = null; - Mesh.prototype.onTextureUpdate.call(this); -}; +},{"../core":29,"path":3,"resource-loader":18}],123:[function(require,module,exports){ +var core = require('../core'); -/* - * Updates the object transform for rendering - * - * @private - */ -Rope.prototype.updateTransform = function () +module.exports = function () { - var points = this.points; - - if (points.length < 1) + return function (resource, next) { - return; - } + // create a new texture if the data is an Image object + if (resource.data && resource.isImage) + { + resource.texture = new core.Texture(new core.BaseTexture(resource.data, null, core.utils.getResolutionOfUrl(resource.url))); + // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + core.utils.TextureCache[resource.url] = resource.texture; + } - var lastPoint = points[0]; - var nextPoint; - var perpX = 0; - var perpY = 0; + next(); + }; +}; - // this.count -= 0.2; +},{"../core":29}],124:[function(require,module,exports){ +var core = require('../core'); - var vertices = this.vertices; - var total = points.length, - point, index, ratio, perpLength, num; +/** + * Base mesh class + * @class + * @extends PIXI.Container + * @memberof PIXI.mesh + * @param texture {Texture} The texture to use + * @param [vertices] {Float32Arrif you want to specify the vertices + * @param [uvs] {Float32Array} if you want to specify the uvs + * @param [indices] {Uint16Array} if you want to specify the indices + * @param [drawMode] {number} the drawMode, can be any of the Mesh.DRAW_MODES consts + */ +function Mesh(texture, vertices, uvs, indices, drawMode) +{ + core.Container.call(this); - for (var i = 0; i < total; i++) - { - point = points[i]; - index = i * 4; + /** + * The texture of the Mesh + * + * @member {Texture} + * @private + */ + this._texture = null; - if (i < points.length-1) - { - nextPoint = points[i+1]; - } - else - { - nextPoint = point; - } + /** + * The Uvs of the Mesh + * + * @member {Float32Array} + */ + this.uvs = uvs || new Float32Array([0, 1, + 1, 1, + 1, 0, + 0, 1]); - perpY = -(nextPoint.x - lastPoint.x); - perpX = nextPoint.y - lastPoint.y; + /** + * An array of vertices + * + * @member {Float32Array} + */ + this.vertices = vertices || new Float32Array([0, 0, + 100, 0, + 100, 100, + 0, 100]); - ratio = (1 - (i / (total-1))) * 10; + /* + * @member {Uint16Array} An array containing the indices of the vertices + */ + // TODO auto generate this based on draw mode! + this.indices = indices || new Uint16Array([0, 1, 2, 3]); - if (ratio > 1) - { - ratio = 1; - } + /** + * Whether the Mesh is dirty or not + * + * @member {boolean} + */ + this.dirty = true; - perpLength = Math.sqrt(perpX * perpX + perpY * perpY); - num = this.texture.height / 2; //(20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio; - perpX /= perpLength; - perpY /= perpLength; + /** + * The blend mode to be applied to the sprite. Set to blendModes.NORMAL to remove any blend mode. + * + * @member {number} + * @default CONST.BLEND_MODES.NORMAL; + */ + this.blendMode = core.BLEND_MODES.NORMAL; - perpX *= num; - perpY *= num; + /** + * Triangles in canvas mode are automatically antialiased, use this value to force triangles to overlap a bit with each other. + * + * @member {number} + */ + this.canvasPadding = 0; - vertices[index] = point.x + perpX; - vertices[index+1] = point.y + perpY; - vertices[index+2] = point.x - perpX; - vertices[index+3] = point.y - perpY; + /** + * The way the Mesh should be drawn, can be any of the Mesh.DRAW_MODES consts + * + * @member {number} + */ + this.drawMode = drawMode || Mesh.DRAW_MODES.TRIANGLE_MESH; - lastPoint = point; - } + // run texture setter; + this.texture = texture; +} - this.containerUpdateTransform(); -}; +// constructor +Mesh.prototype = Object.create(core.Container.prototype); +Mesh.prototype.constructor = Mesh; +module.exports = Mesh; -},{"../core":29,"./Mesh":122}],124:[function(require,module,exports){ -/** - * @file Main export of the PIXI extras library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ +Object.defineProperties(Mesh.prototype, { + /** + * The texture that the sprite is using + * + * @member {PIXI.Texture} + * @memberof PIXI.mesh.Mesh# + */ + texture: { + get: function () + { + return this._texture; + }, + set: function (value) + { + if (this._texture === value) + { + return; + } -/** - * @namespace PIXI.mesh - */ -module.exports = { - Mesh: require('./Mesh'), - Rope: require('./Rope'), - MeshRenderer: require('./webgl/MeshRenderer'), - MeshShader: require('./webgl/MeshShader') -}; + this._texture = value; -},{"./Mesh":122,"./Rope":123,"./webgl/MeshRenderer":125,"./webgl/MeshShader":126}],125:[function(require,module,exports){ -var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'), - WebGLRenderer = require('../../core/renderers/webgl/WebGLRenderer'), - Mesh = require('../Mesh'); + if (value) + { + // wait for the texture to load + if (value.baseTexture.hasLoaded) + { + this._onTextureUpdate(); + } + else + { + value.once('update', this._onTextureUpdate, this); + } + } + } + } +}); /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original pixi 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 + * Renders the object using the WebGL renderer * - * Heavily inspired by LibGDX's MeshRenderer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/MeshRenderer.java + * @param renderer {WebGLRenderer} a reference to the WebGL renderer + * @private */ +Mesh.prototype._renderWebGL = function (renderer) +{ + renderer.setObjectRenderer(renderer.plugins.mesh); + renderer.plugins.mesh.render(this); +}; /** + * Renders the object using the Canvas renderer * - * @class + * @param renderer {CanvasRenderer} * @private - * @memberof PIXI.mesh - * @extends PIXI.ObjectRenderer - * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -function MeshRenderer(renderer) +Mesh.prototype._renderCanvas = function (renderer) { - ObjectRenderer.call(this, renderer); - + var context = renderer.context; - /** - * Holds the indices - * - * @member {Uint16Array} - */ - this.indices = new Uint16Array(15000); + var transform = this.worldTransform; - //TODO this could be a single buffer shared amongst all renderers as we reuse this set up in most renderers - for (var i=0, j=0; i < 15000; i += 6, j += 4) + if (renderer.roundPixels) { - this.indices[i + 0] = j + 0; - this.indices[i + 1] = j + 1; - this.indices[i + 2] = j + 2; - this.indices[i + 3] = j + 0; - this.indices[i + 4] = j + 2; - this.indices[i + 5] = j + 3; + context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx | 0, transform.ty | 0); + } + else + { + context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); } -} - -MeshRenderer.prototype = Object.create(ObjectRenderer.prototype); -MeshRenderer.prototype.constructor = MeshRenderer; -module.exports = MeshRenderer; -WebGLRenderer.registerPlugin('mesh', MeshRenderer); + if (this.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH) + { + this._renderCanvasTriangleMesh(context); + } + else + { + this._renderCanvasTriangles(context); + } +}; /** - * Sets up the renderer context and necessary buffers. + * Draws the object in Triangle Mesh mode using canvas * + * @param context {CanvasRenderingContext2D} the current drawing context * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context */ -MeshRenderer.prototype.onContextChange = function () +Mesh.prototype._renderCanvasTriangleMesh = function (context) { + // draw triangles!! + var vertices = this.vertices; + var uvs = this.uvs; + + var length = vertices.length / 2; + // this.count++; + for (var i = 0; i < length - 2; i++) + { + // draw some triangles! + var index = i * 2; + this._renderCanvasDrawTriangle(context, vertices, uvs, index, (index + 2), (index + 4)); + } }; /** - * Renders the sprite object. + * Draws the object in triangle mode using canvas * - * @param mesh {Mesh} the mesh to render + * @param context {CanvasRenderingContext2D} the current drawing context + * @private */ -MeshRenderer.prototype.render = function (mesh) +Mesh.prototype._renderCanvasTriangles = function (context) { -// return; - if(!mesh._vertexBuffer) - { - this._initWebGL(mesh); - } - - var renderer = this.renderer, - gl = renderer.gl, - texture = mesh.texture.baseTexture, - shader = renderer.shaderManager.plugins.meshShader; + // draw triangles!! + var vertices = this.vertices; + var uvs = this.uvs; + var indices = this.indices; - var drawMode = mesh.drawMode === Mesh.DRAW_MODES.TRIANGLE_STRIP ? gl.TRIANGLE_STRIP : gl.TRIANGLES; + var length = indices.length; + // this.count++; - renderer.blendModeManager.setBlendMode(mesh.blendMode); + for (var i = 0; i < length; i += 3) + { + // draw some triangles! + var index0 = indices[i] * 2, index1 = indices[i + 1] * 2, index2 = indices[i + 2] * 2; + this._renderCanvasDrawTriangle(context, vertices, uvs, index0, index1, index2); + } +}; +/** + * Draws one of the triangles that form this Mesh + * + * @param context {CanvasRenderingContext2D} the current drawing context + * @param vertices {Float32Array} a reference to the vertices of the Mesh + * @param uvs {Float32Array} a reference to the uvs of the Mesh + * @param index0 {number} the index of the first vertex + * @param index1 {number} the index of the second vertex + * @param index2 {number} the index of the third vertex + * @private + */ +Mesh.prototype._renderCanvasDrawTriangle = function (context, vertices, uvs, index0, index1, index2) +{ + var textureSource = this._texture.baseTexture.source; + var textureWidth = this._texture.baseTexture.width; + var textureHeight = this._texture.baseTexture.height; - // set uniforms - gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, mesh.worldTransform.toArray(true)); + var x0 = vertices[index0], x1 = vertices[index1], x2 = vertices[index2]; + var y0 = vertices[index0 + 1], y1 = vertices[index1 + 1], y2 = vertices[index2 + 1]; - gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, renderer.currentRenderTarget.projectionMatrix.toArray(true)); - gl.uniform1f(shader.uniforms.alpha._location, mesh.worldAlpha); + var u0 = uvs[index0] * textureWidth, u1 = uvs[index1] * textureWidth, u2 = uvs[index2] * textureWidth; + var v0 = uvs[index0 + 1] * textureHeight, v1 = uvs[index1 + 1] * textureHeight, v2 = uvs[index2 + 1] * textureHeight; - if (!mesh.dirty) + if (this.canvasPadding > 0) { + var paddingX = this.canvasPadding / this.worldTransform.a; + var paddingY = this.canvasPadding / this.worldTransform.d; + var centerX = (x0 + x1 + x2) / 3; + var centerY = (y0 + y1 + y2) / 3; - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); - gl.bufferSubData(gl.ARRAY_BUFFER, 0, mesh.vertices); - gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0); + var normX = x0 - centerX; + var normY = y0 - centerY; + var dist = Math.sqrt(normX * normX + normY * normY); + x0 = centerX + (normX / dist) * (dist + paddingX); + y0 = centerY + (normY / dist) * (dist + paddingY); - // update the uvs - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); - gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0); + // + normX = x1 - centerX; + normY = y1 - centerY; - gl.activeTexture(gl.TEXTURE0); + dist = Math.sqrt(normX * normX + normY * normY); + x1 = centerX + (normX / dist) * (dist + paddingX); + y1 = centerY + (normY / dist) * (dist + paddingY); - if (!texture._glTextures[gl.id]) - { - this.renderer.updateTexture(texture); - } - else - { - // bind the current texture - gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]); - } - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); + normX = x2 - centerX; + normY = y2 - centerY; + + dist = Math.sqrt(normX * normX + normY * normY); + x2 = centerX + (normX / dist) * (dist + paddingX); + y2 = centerY + (normY / dist) * (dist + paddingY); } - else - { - mesh.dirty = false; - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.STATIC_DRAW); - gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0); + context.save(); + context.beginPath(); - // update the uvs - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); - gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW); - gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0); - gl.activeTexture(gl.TEXTURE0); + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); - if (!texture._glTextures[gl.id]) - { - this.renderer.updateTexture(texture); - } - else - { - // bind the current texture - gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]); - } + context.closePath(); - // dont need to upload! - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW); + context.clip(); - } + // Compute matrix transform + var delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2); + var deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2); + var deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2); + var deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2); + var deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2); + var deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2); + var deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2); - gl.drawElements(drawMode, mesh.indices.length, gl.UNSIGNED_SHORT, 0); + context.transform(deltaA / delta, deltaD / delta, + deltaB / delta, deltaE / delta, + deltaC / delta, deltaF / delta); + context.drawImage(textureSource, 0, 0); + context.restore(); }; + + /** - * Prepares all the buffers to render this mesh - * @param mesh {Mesh} the mesh to render + * Renders a flat Mesh + * + * @param Mesh {Mesh} The Mesh to render + * @private */ -MeshRenderer.prototype._initWebGL = function (mesh) +Mesh.prototype.renderMeshFlat = function (Mesh) { - // build the strip! - var gl = this.renderer.gl; - - mesh._vertexBuffer = gl.createBuffer(); - mesh._indexBuffer = gl.createBuffer(); - mesh._uvBuffer = gl.createBuffer(); - + var context = this.context; + var vertices = Mesh.vertices; + var length = vertices.length/2; + // this.count++; - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.DYNAMIC_DRAW); + context.beginPath(); + for (var i=1; i < length-2; i++) + { + // draw some triangles! + var index = i*2; - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); - gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW); + var x0 = vertices[index], x1 = vertices[index+2], x2 = vertices[index+4]; + var y0 = vertices[index+1], y1 = vertices[index+3], y2 = vertices[index+5]; - if(mesh.colors){ - mesh._colorBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, mesh._colorBuffer); - gl.bufferData(gl.ARRAY_BUFFER, mesh.colors, gl.STATIC_DRAW); + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); } - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW); + context.fillStyle = '#FF0000'; + context.fill(); + context.closePath(); }; +/* +Mesh.prototype.setTexture = function (texture) +{ + //TODO SET THE TEXTURES + //TODO VISIBILITY + //TODO SETTER + + // stop current texture + this.texture = texture; + this.width = texture.frame.width; + this.height = texture.frame.height; + this.updateFrame = true; +}; + */ /** - * Empties the current batch. + * When the texture is updated, this event will fire to update the scale and frame * + * @param event + * @private */ -MeshRenderer.prototype.flush = function () +Mesh.prototype._onTextureUpdate = function () { - + this.updateFrame = true; }; /** - * Starts a new mesh renderer. + * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * + * @param matrix {Matrix} the transformation matrix of the sprite + * @return {Rectangle} the framing rectangle */ -MeshRenderer.prototype.start = function () +Mesh.prototype.getBounds = function (matrix) { - var shader = this.renderer.shaderManager.plugins.meshShader; + var worldTransform = matrix || this.worldTransform; - this.renderer.shaderManager.setShader(shader); + var a = worldTransform.a; + var b = worldTransform.b; + var c = worldTransform.c; + var d = worldTransform.d; + var tx = worldTransform.tx; + var ty = worldTransform.ty; + + var maxX = -Infinity; + var maxY = -Infinity; + + var minX = Infinity; + var minY = Infinity; + + var vertices = this.vertices; + for (var i = 0, n = vertices.length; i < n; i += 2) + { + var rawX = vertices[i], rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + + if (minX === -Infinity || maxY === Infinity) + { + return core.math.Rectangle.EMPTY; + } + + var bounds = this._bounds; + + bounds.x = minX; + bounds.width = maxX - minX; + + bounds.y = minY; + bounds.height = maxY - minY; + + // store a reference so that if this function gets called again in the render cycle we do not have to recalculate + this._currentBounds = bounds; + + return bounds; }; /** - * Destroys the Mesh renderer + * Different drawing buffer modes supported * + * @static + * @constant + * @property {object} DRAW_MODES + * @property {number} DRAW_MODES.TRIANGLE_MESH + * @property {number} DRAW_MODES.TRIANGLES */ -MeshRenderer.prototype.destroy = function () -{ +Mesh.DRAW_MODES = { + TRIANGLE_MESH: 0, + TRIANGLES: 1 }; -},{"../../core/renderers/webgl/WebGLRenderer":48,"../../core/renderers/webgl/utils/ObjectRenderer":62,"../Mesh":122}],126:[function(require,module,exports){ -var core = require('../../core'); +},{"../core":29}],125:[function(require,module,exports){ +var Mesh = require('./Mesh'); +var core = require('../core'); /** + * The rope allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (var i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * var rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); + * ``` + * * @class - * @extends PIXI.Shader + * @extends PIXI.Mesh * @memberof PIXI.mesh - * @param shaderManager {ShaderManager} The WebGL shader manager this shader works for. + * @param {Texture} texture - The texture to use on the rope. + * @param {Array} points - An array of {Point} objects to construct this rope. + * */ -function StripShader(shaderManager) +function Rope(texture, points) { - core.Shader.call(this, - shaderManager, - // vertex shader - [ - 'precision lowp float;', - 'attribute vec2 aVertexPosition;', - 'attribute vec2 aTextureCoord;', - - 'uniform mat3 translationMatrix;', - 'uniform mat3 projectionMatrix;', - - 'varying vec2 vTextureCoord;', - - 'void main(void){', - ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', - ' vTextureCoord = aTextureCoord;', - '}' - ].join('\n'), - [ - 'precision lowp float;', + Mesh.call(this, texture); - 'varying vec2 vTextureCoord;', - 'uniform float alpha;', + /* + * @member {Array} An array of points that determine the rope + */ + this.points = points; - 'uniform sampler2D uSampler;', + /* + * @member {Float32Array} An array of vertices used to construct this rope. + */ + this.vertices = new Float32Array(points.length * 4); - 'void main(void){', - ' gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;', - '}' - ].join('\n'), - // custom uniforms - { - alpha: { type: '1f', value: 0 }, - translationMatrix: { type: 'mat3', value: new Float32Array(9) }, - projectionMatrix: { type: 'mat3', value: new Float32Array(9) } - }, - // custom attributes - { - aVertexPosition:0, - aTextureCoord:0 - } - ); -} + /* + * @member {Float32Array} The WebGL Uvs of the rope. + */ + this.uvs = new Float32Array(points.length * 4); -StripShader.prototype = Object.create(core.Shader.prototype); -StripShader.prototype.constructor = StripShader; -module.exports = StripShader; + /* + * @member {Float32Array} An array containing the color components + */ + this.colors = new Float32Array(points.length * 2); -core.ShaderManager.registerPlugin('meshShader', StripShader); + /* + * @member {Uint16Array} An array containing the indices of the vertices + */ + this.indices = new Uint16Array(points.length * 2); -},{"../../core":29}],127:[function(require,module,exports){ -// References: -// https://github.com/sindresorhus/object-assign -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + /** + * Tracker for if the rope is ready to be drawn. Needed because Mesh ctor can + * call _onTextureUpdated which could call refresh too early. + * + * @member {boolean} + * @private + */ + this._ready = true; -if (!Object.assign) -{ - Object.assign = require('object-assign'); + this.refresh(); } -},{"object-assign":12}],128:[function(require,module,exports){ -require('./Object.assign'); -require('./requestAnimationFrame'); - -},{"./Object.assign":127,"./requestAnimationFrame":129}],129:[function(require,module,exports){ -(function (global){ -// References: -// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -// https://gist.github.com/1579671 -// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision -// https://gist.github.com/timhall/4078614 -// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame -// Expected to be used with Browserfiy -// Browserify automatically detects the use of `global` and passes the -// correct reference of `global`, `self`, and finally `window` +// constructor +Rope.prototype = Object.create(Mesh.prototype); +Rope.prototype.constructor = Rope; +module.exports = Rope; -// Date.now -if (!(Date.now && Date.prototype.getTime)) { - Date.now = function now() { - return new Date().getTime(); - }; -} +/** + * Refreshes + * + */ +Rope.prototype.refresh = function () +{ + var points = this.points; -// performance.now -if (!(global.performance && global.performance.now)) { - var startTime = Date.now(); - if (!global.performance) { - global.performance = {}; + // if too little points, or texture hasn't got UVs set yet just move on. + if (points.length < 1 || !this._texture._uvs) + { + return; } - global.performance.now = function () { - return Date.now() - startTime; - }; -} -// requestAnimationFrame -var lastTime = Date.now(); -var vendors = ['ms', 'moz', 'webkit', 'o']; + var uvs = this.uvs; -for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { - global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; - global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || - global[vendors[x] + 'CancelRequestAnimationFrame']; -} + var indices = this.indices; + var colors = this.colors; -if (!global.requestAnimationFrame) { - global.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') { - throw new TypeError(callback + 'is not a function'); - } + var textureUvs = this._texture._uvs; + var offset = new core.math.Point(textureUvs.x0, textureUvs.y0); + var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); - var currentTime = Date.now(), - delay = 16 + lastTime - currentTime; + uvs[0] = 0 + offset.x; + uvs[1] = 0 + offset.y; + uvs[2] = 0 + offset.x; + uvs[3] = 1 * factor.y + offset.y; - if (delay < 0) { - delay = 0; - } + colors[0] = 1; + colors[1] = 1; - lastTime = currentTime; + indices[0] = 0; + indices[1] = 1; - return setTimeout(function () { - lastTime = Date.now(); - callback(performance.now()); - }, delay); - }; -} + var total = points.length, + point, index, amount; -if (!global.cancelAnimationFrame) { - global.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; -} + for (var i = 1; i < total; i++) + { + point = points[i]; + index = i * 4; + // time to do some smart drawing! + amount = i / (total-1); -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + uvs[index] = amount * factor.x + offset.x; + uvs[index+1] = 0 + offset.y; -},{}],130:[function(require,module,exports){ -var core = require('../core'), - EventEmitter = require('eventemitter3'), - // Internal event used by composed emitter - TICK = 'tick'; + uvs[index+2] = amount * factor.x + offset.x; + uvs[index+3] = 1 * factor.y + offset.y; + + index = i * 2; + colors[index] = 1; + colors[index+1] = 1; + + index = i * 2; + indices[index] = index; + indices[index + 1] = index + 1; + } + + this.dirty = true; +}; /** - * A Ticker class that runs an update loop that other objects listen to. - * This class is composed around an EventEmitter object to add listeners - * meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, - * e.g. When the ticker is started and the emitter has listeners. + * Clear texture UVs when new texture is set * - * @class - * @memberof PIXI.ticker + * @private */ -function Ticker() +Rope.prototype._onTextureUpdate = function () { - var _this = this; - /** - * Internal tick method bound to ticker instance. - * This is because in early 2015, Function.bind - * is still 60% slower in high performance scenarios. - * Also separating frame requests from update method - * so listeners may be called at any time and with - * any animation API, just invoke ticker.update(time). - * - * @private - */ - this._tick = function _tick(time) { - - _this._requestId = null; - - if (_this.started) - { - // Invoke listeners now - _this.update(time); - // Listener side effects may have modified ticker state. - if (_this.started && _this._requestId === null && _this._emitter.listeners(TICK, true)) - { - _this._requestId = requestAnimationFrame(_this._tick); - } - } - }; - /** - * Internal emitter used to fire 'tick' event - * @private - */ - this._emitter = new EventEmitter(); - /** - * Internal current frame request ID - * @private - */ - this._requestId = null; - /** - * Internal value managed by minFPS property setter and getter. - * This is the maximum allowed milliseconds between updates. - * @private - */ - this._maxElapsedMS = 100; - - /** - * Whether or not this ticker should invoke the method - * {@link PIXI.ticker.Ticker#start} automatically - * when a listener is added. - * - * @member {boolean} - * @default false - */ - this.autoStart = false; + Mesh.prototype._onTextureUpdate.call(this); - /** - * Scalar time value from last frame to this frame. - * This value is capped by setting {@link PIXI.ticker.Ticker#minFPS} - * and is scaled with {@link PIXI.ticker.Ticker#speed}. - * **Note:** The cap may be exceeded by scaling. - * - * @member {number} - * @default 1 - */ - this.deltaTime = 1; + // wait for the Rope ctor to finish before calling refresh + if (this._ready) { + this.refresh(); + } +}; - /** - * Time elapsed in milliseconds from last frame to this frame. - * Opposed to what the scalar {@link PIXI.ticker.Ticker#deltaTime} - * is based, this value is neither capped nor scaled. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * - * @member {DOMHighResTimeStamp|number} - * @default 1 / TARGET_FPMS - */ - this.elapsedMS = 1 / core.TARGET_FPMS; // default to target frame time +/** + * Updates the object transform for rendering + * + * @private + */ +Rope.prototype.updateTransform = function () +{ + var points = this.points; - /** - * The last time {@link PIXI.ticker.Ticker#update} was invoked. - * This value is also reset internally outside of invoking - * update, but only when a new animation frame is requested. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * - * @member {DOMHighResTimeStamp|number} - * @default 0 - */ - this.lastTime = 0; + if (points.length < 1) + { + return; + } - /** - * Factor of current {@link PIXI.ticker.Ticker#deltaTime}. - * @example - * // Scales ticker.deltaTime to what would be - * // the equivalent of approximately 120 FPS - * ticker.speed = 2; - * - * @member {number} - * @default 1 - */ - this.speed = 1; + var lastPoint = points[0]; + var nextPoint; + var perpX = 0; + var perpY = 0; - /** - * Whether or not this ticker has been started. - * `true` if {@link PIXI.ticker.Ticker#start} has been called. - * `false` if {@link PIXI.ticker.Ticker#stop} has been called. - * While `false`, this value may change to `true` in the - * event of {@link PIXI.ticker.Ticker#autoStart} being `true` - * and a listener is added. - * - * @member {boolean} - * @default false - */ - this.started = false; -} + // this.count -= 0.2; -Object.defineProperties(Ticker.prototype, { - /** - * The frames per second at which this ticker is running. - * The default is approximately 60 in most modern browsers. - * **Note:** This does not factor in the value of - * {@link PIXI.ticker.Ticker#speed}, which is specific - * to scaling {@link PIXI.ticker.Ticker#deltaTime}. - * - * @member - * @memberof PIXI.ticker.Ticker# - * @readonly - */ - FPS: { - get: function() - { - return 1000 / this.elapsedMS; - } - }, + var vertices = this.vertices; + var total = points.length, + point, index, ratio, perpLength, num; - /** - * Manages the maximum amount of milliseconds allowed to - * elapse between invoking {@link PIXI.ticker.Ticker#update}. - * This value is used to cap {@link PIXI.ticker.Ticker#deltaTime}, - * but does not effect the measured value of {@link PIXI.ticker.Ticker#FPS}. - * When setting this property it is clamped to a value between - * `0` and `PIXI.TARGET_FPMS * 1000`. - * - * @member - * @memberof PIXI.ticker.Ticker# - * @default 10 - */ - minFPS: { - get: function() + for (var i = 0; i < total; i++) + { + point = points[i]; + index = i * 4; + + if (i < points.length-1) { - return 1000 / this._maxElapsedMS; - }, - set: function(fps) + nextPoint = points[i+1]; + } + else { - // Clamp: 0 to TARGET_FPMS - var minFPMS = Math.min(Math.max(0, fps) / 1000, core.TARGET_FPMS); - this._maxElapsedMS = 1 / minFPMS; + nextPoint = point; + } + + perpY = -(nextPoint.x - lastPoint.x); + perpX = nextPoint.y - lastPoint.y; + + ratio = (1 - (i / (total-1))) * 10; + + if (ratio > 1) + { + ratio = 1; } + + perpLength = Math.sqrt(perpX * perpX + perpY * perpY); + num = this._texture.height / 2; //(20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio; + perpX /= perpLength; + perpY /= perpLength; + + perpX *= num; + perpY *= num; + + vertices[index] = point.x + perpX; + vertices[index+1] = point.y + perpY; + vertices[index+2] = point.x - perpX; + vertices[index+3] = point.y - perpY; + + lastPoint = point; } -}); + this.containerUpdateTransform(); +}; + +},{"../core":29,"./Mesh":124}],126:[function(require,module,exports){ /** - * Conditionally requests a new animation frame. - * If a frame has not already been requested, and if the internal - * emitter has listeners, a new frame is requested. + * @file Main export of the PIXI extras library + * @author Mat Groves + * @copyright 2013-2015 GoodBoyDigital + * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} + */ + +/** + * @namespace PIXI.mesh + */ +module.exports = { + Mesh: require('./Mesh'), + Rope: require('./Rope'), + MeshRenderer: require('./webgl/MeshRenderer'), + MeshShader: require('./webgl/MeshShader') +}; + +},{"./Mesh":124,"./Rope":125,"./webgl/MeshRenderer":127,"./webgl/MeshShader":128}],127:[function(require,module,exports){ +var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'), + WebGLRenderer = require('../../core/renderers/webgl/WebGLRenderer'), + Mesh = require('../Mesh'); + +/** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original pixi 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 MeshRenderer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/MeshRenderer.java + */ + +/** + * + * @class * @private + * @memberof PIXI.mesh + * @extends PIXI.ObjectRenderer + * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ -Ticker.prototype._requestIfNeeded = function _requestIfNeeded() +function MeshRenderer(renderer) { - if (this._requestId === null && this._emitter.listeners(TICK, true)) + ObjectRenderer.call(this, renderer); + + + /** + * Holds the indices + * + * @member {Uint16Array} + */ + this.indices = new Uint16Array(15000); + + //TODO this could be a single buffer shared amongst all renderers as we reuse this set up in most renderers + for (var i=0, j=0; i < 15000; i += 6, j += 4) { - // ensure callbacks get correct delta - this.lastTime = performance.now(); - this._requestId = requestAnimationFrame(this._tick); + this.indices[i + 0] = j + 0; + this.indices[i + 1] = j + 1; + this.indices[i + 2] = j + 2; + this.indices[i + 3] = j + 0; + this.indices[i + 4] = j + 2; + this.indices[i + 5] = j + 3; } -}; +} + +MeshRenderer.prototype = Object.create(ObjectRenderer.prototype); +MeshRenderer.prototype.constructor = MeshRenderer; +module.exports = MeshRenderer; + +WebGLRenderer.registerPlugin('mesh', MeshRenderer); /** - * Conditionally cancels a pending animation frame. + * Sets up the renderer context and necessary buffers. * * @private + * @param gl {WebGLRenderingContext} the current WebGL drawing context */ -Ticker.prototype._cancelIfNeeded = function _cancelIfNeeded() +MeshRenderer.prototype.onContextChange = function () { - if (this._requestId !== null) - { - cancelAnimationFrame(this._requestId); - this._requestId = null; - } + }; /** - * Conditionally requests a new animation frame. - * If the ticker has been started it checks if a frame has not already - * been requested, and if the internal emitter has listeners. If these - * conditions are met, a new frame is requested. If the ticker has not - * been started, but autoStart is `true`, then the ticker starts now, - * and continues with the previous conditions to request a new frame. + * Renders the sprite object. * - * @private + * @param mesh {Mesh} the mesh to render */ -Ticker.prototype._startIfPossible = function _startIfPossible() +MeshRenderer.prototype.render = function (mesh) { - if (this.started) +// return; + if(!mesh._vertexBuffer) { - this._requestIfNeeded(); + this._initWebGL(mesh); } - else if (this.autoStart) + + var renderer = this.renderer, + gl = renderer.gl, + texture = mesh._texture.baseTexture, + shader = renderer.shaderManager.plugins.meshShader; + + var drawMode = mesh.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH ? gl.TRIANGLE_STRIP : gl.TRIANGLES; + + renderer.blendModeManager.setBlendMode(mesh.blendMode); + + + // set uniforms + gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, mesh.worldTransform.toArray(true)); + + gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, renderer.currentRenderTarget.projectionMatrix.toArray(true)); + gl.uniform1f(shader.uniforms.alpha._location, mesh.worldAlpha); + + if (!mesh.dirty) { - this.start(); + + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, mesh.vertices); + gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0); + + // update the uvs + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); + gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0); + + + gl.activeTexture(gl.TEXTURE0); + + if (!texture._glTextures[gl.id]) + { + this.renderer.updateTexture(texture); + } + else + { + // bind the current texture + gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]); + } + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); + gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, mesh.indices); } -}; + else + { -/** - * Calls {@link module:eventemitter3.EventEmitter#on} internally for the - * internal 'tick' event. It checks if the emitter has listeners, - * and if so it requests a new animation frame at this point. - * - * @param fn {Function} The listener function to be added for updates - * @param [context] {Function} The listener context - * @returns {PIXI.ticker.Ticker} this - */ -Ticker.prototype.add = function add(fn, context) -{ - this._emitter.on(TICK, fn, context); + mesh.dirty = false; + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.STATIC_DRAW); + gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0); - this._startIfPossible(); + // update the uvs + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); + gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW); + gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0); + + gl.activeTexture(gl.TEXTURE0); + + if (!texture._glTextures[gl.id]) + { + this.renderer.updateTexture(texture); + } + else + { + // bind the current texture + gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]); + } + + // dont need to upload! + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW); + + } + + gl.drawElements(drawMode, mesh.indices.length, gl.UNSIGNED_SHORT, 0); - return this; }; /** - * Calls {@link module:eventemitter3.EventEmitter#once} internally for the - * internal 'tick' event. It checks if the emitter has listeners, - * and if so it requests a new animation frame at this point. - * - * @param fn {Function} The listener function to be added for one update - * @param [context] {Function} The listener context - * @returns {PIXI.ticker.Ticker} this + * Prepares all the buffers to render this mesh + * @param mesh {Mesh} the mesh to render */ -Ticker.prototype.addOnce = function addOnce(fn, context) +MeshRenderer.prototype._initWebGL = function (mesh) { - this._emitter.once(TICK, fn, context); + // build the strip! + var gl = this.renderer.gl; - this._startIfPossible(); + mesh._vertexBuffer = gl.createBuffer(); + mesh._indexBuffer = gl.createBuffer(); + mesh._uvBuffer = gl.createBuffer(); + + + + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.DYNAMIC_DRAW); + + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer); + gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW); + + if(mesh.colors){ + mesh._colorBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, mesh._colorBuffer); + gl.bufferData(gl.ARRAY_BUFFER, mesh.colors, gl.STATIC_DRAW); + } - return this; + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW); }; + /** - * Calls {@link module:eventemitter3.EventEmitter#off} internally for 'tick' event. - * It checks if the emitter has listeners for 'tick' event. - * If it does, then it cancels the animation frame. + * Empties the current batch. * - * @param [fn] {Function} The listener function to be removed - * @param [context] {Function} The listener context to be removed - * @returns {PIXI.ticker.Ticker} this */ -Ticker.prototype.remove = function remove(fn, context) +MeshRenderer.prototype.flush = function () { - this._emitter.off(TICK, fn, context); - if (!this._emitter.listeners(TICK, true)) - { - this._cancelIfNeeded(); - } - - return this; }; /** - * Starts the ticker. If the ticker has listeners - * a new animation frame is requested at this point. + * Starts a new mesh renderer. + * */ -Ticker.prototype.start = function start() +MeshRenderer.prototype.start = function () { - if (!this.started) - { - this.started = true; - this._requestIfNeeded(); - } + var shader = this.renderer.shaderManager.plugins.meshShader; + + this.renderer.shaderManager.setShader(shader); }; /** - * Stops the ticker. If the ticker has requested - * an animation frame it is canceled at this point. + * Destroys the Mesh renderer + * */ -Ticker.prototype.stop = function stop() +MeshRenderer.prototype.destroy = function () { - if (this.started) - { - this.started = false; - this._cancelIfNeeded(); - } }; +},{"../../core/renderers/webgl/WebGLRenderer":48,"../../core/renderers/webgl/utils/ObjectRenderer":62,"../Mesh":124}],128:[function(require,module,exports){ +var core = require('../../core'); + /** - * Triggers an update. An update entails setting the - * current {@link PIXI.ticker.Ticker#elapsedMS}, - * the current {@link PIXI.ticker.Ticker#deltaTime}, - * invoking all listeners with current deltaTime, - * and then finally setting {@link PIXI.ticker.Ticker#lastTime} - * with the value of currentTime that was provided. - * This method will be called automatically by animation - * frame callbacks if the ticker instance has been started - * and listeners are added. - * - * @param [currentTime=performance.now()] {DOMHighResTimeStamp|number} the current time of execution + * @class + * @extends PIXI.Shader + * @memberof PIXI.mesh + * @param shaderManager {ShaderManager} The WebGL shader manager this shader works for. */ -Ticker.prototype.update = function update(currentTime) +function StripShader(shaderManager) { - var elapsedMS; + core.Shader.call(this, + shaderManager, + // vertex shader + [ + 'precision lowp float;', + 'attribute vec2 aVertexPosition;', + 'attribute vec2 aTextureCoord;', - // Allow calling update directly with default currentTime. - currentTime = currentTime || performance.now(); - // Save uncapped elapsedMS for measurement - elapsedMS = this.elapsedMS = currentTime - this.lastTime; + 'uniform mat3 translationMatrix;', + 'uniform mat3 projectionMatrix;', - // cap the milliseconds elapsed used for deltaTime - if (elapsedMS > this._maxElapsedMS) - { - elapsedMS = this._maxElapsedMS; + 'varying vec2 vTextureCoord;', + + 'void main(void){', + ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', + ' vTextureCoord = aTextureCoord;', + '}' + ].join('\n'), + [ + 'precision lowp float;', + + 'varying vec2 vTextureCoord;', + 'uniform float alpha;', + + 'uniform sampler2D uSampler;', + + 'void main(void){', + ' gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;', + '}' + ].join('\n'), + // custom uniforms + { + alpha: { type: '1f', value: 0 }, + translationMatrix: { type: 'mat3', value: new Float32Array(9) }, + projectionMatrix: { type: 'mat3', value: new Float32Array(9) } + }, + // custom attributes + { + aVertexPosition:0, + aTextureCoord:0 + } + ); +} + +StripShader.prototype = Object.create(core.Shader.prototype); +StripShader.prototype.constructor = StripShader; +module.exports = StripShader; + +core.ShaderManager.registerPlugin('meshShader', StripShader); + +},{"../../core":29}],129:[function(require,module,exports){ +// References: +// https://github.com/sindresorhus/object-assign +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + +if (!Object.assign) +{ + Object.assign = require('object-assign'); +} + +},{"object-assign":12}],130:[function(require,module,exports){ +require('./Object.assign'); +require('./requestAnimationFrame'); + +},{"./Object.assign":129,"./requestAnimationFrame":131}],131:[function(require,module,exports){ +(function (global){ +// References: +// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// https://gist.github.com/1579671 +// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision +// https://gist.github.com/timhall/4078614 +// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame + +// Expected to be used with Browserfiy +// Browserify automatically detects the use of `global` and passes the +// correct reference of `global`, `self`, and finally `window` + +// Date.now +if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { + return new Date().getTime(); + }; +} + +// performance.now +if (!(global.performance && global.performance.now)) { + var startTime = Date.now(); + if (!global.performance) { + global.performance = {}; } + global.performance.now = function () { + return Date.now() - startTime; + }; +} - this.deltaTime = elapsedMS * core.TARGET_FPMS * this.speed; +// requestAnimationFrame +var lastTime = Date.now(); +var vendors = ['ms', 'moz', 'webkit', 'o']; - // Invoke listeners added to internal emitter - this._emitter.emit(TICK, this.deltaTime); +for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { + global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; + global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || + global[vendors[x] + 'CancelRequestAnimationFrame']; +} - this.lastTime = currentTime; -}; +if (!global.requestAnimationFrame) { + global.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + 'is not a function'); + } -module.exports = Ticker; + var currentTime = Date.now(), + delay = 16 + lastTime - currentTime; -},{"../core":29,"eventemitter3":11}],131:[function(require,module,exports){ -/** - * @file Main export of the PIXI extras library - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ -var Ticker = require('./Ticker'); + if (delay < 0) { + delay = 0; + } -/** - * The shared ticker instance used by {@link PIXI.extras.MovieClip}. - * and by {@link PIXI.interaction.InteractionManager}. - * The property {@link PIXI.ticker.Ticker#autoStart} is set to `true` - * for this instance. Please follow the examples for usage, including - * how to opt-out of auto-starting the shared ticker. - * - * @example - * var ticker = PIXI.ticker.shared; - * // Set this to prevent starting this ticker when listeners are added. - * // By default this is true only for the PIXI.ticker.shared instance. - * ticker.autoStart = false; - * // FYI, call this to ensure the ticker is stopped. It should be stopped - * // if you have not attempted to render anything yet. - * ticker.stop(); - * // Call this when you are ready for a running shared ticker. - * ticker.start(); - * - * @example - * // You may use the shared ticker to render... - * var renderer = PIXI.autoDetectRenderer(800, 600); - * var stage = new PIXI.Container(); - * var interactionManager = PIXI.interaction.InteractionManager(renderer); - * document.body.appendChild(renderer.view); - * ticker.add(function (time) { - * renderer.render(stage); - * }); - * - * @example - * // Or you can just update it manually. - * ticker.autoStart = false; - * ticker.stop(); - * function animate(time) { - * ticker.update(time); - * renderer.render(stage); - * requestAnimationFrame(animate); - * } - * animate(performance.now()); - * - * @type {PIXI.ticker.Ticker} - * @memberof PIXI.ticker - */ -var shared = new Ticker(); -shared.autoStart = true; + lastTime = currentTime; -module.exports = { - shared: shared, - Ticker: Ticker -}; + return setTimeout(function () { + lastTime = Date.now(); + callback(performance.now()); + }, delay); + }; +} + +if (!global.cancelAnimationFrame) { + global.cancelAnimationFrame = function(id) { + clearTimeout(id); + }; +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Ticker":130}]},{},[1])(1) +},{}]},{},[1])(1) }); diff --git a/demo/js/lib/pixi.js.map b/demo/js/lib/pixi.js.map index 0aa669bb..429eb453 100644 --- a/demo/js/lib/pixi.js.map +++ b/demo/js/lib/pixi.js.map @@ -1 +1 @@ -{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","src/index.js","node_modules/async/lib/async.js","node_modules/browserify/node_modules/path-browserify/index.js","node_modules/browserify/node_modules/process/browser.js","node_modules/browserify/node_modules/punycode/punycode.js","node_modules/browserify/node_modules/querystring-es3/decode.js","node_modules/browserify/node_modules/querystring-es3/encode.js","node_modules/browserify/node_modules/querystring-es3/index.js","node_modules/browserify/node_modules/url/url.js","node_modules/earcut/src/earcut.js","node_modules/eventemitter3/index.js","node_modules/object-assign/index.js","node_modules/resource-loader/node_modules/async/lib/async.js","node_modules/resource-loader/src/Loader.js","node_modules/resource-loader/src/Resource.js","node_modules/resource-loader/src/b64.js","node_modules/resource-loader/src/index.js","node_modules/resource-loader/src/middlewares/caching/memory.js","node_modules/resource-loader/src/middlewares/parsing/blob.js","package.json","src/core/const.js","src/core/display/Container.js","src/core/display/DisplayObject.js","src/core/graphics/Graphics.js","src/core/graphics/GraphicsData.js","src/core/graphics/webgl/GraphicsRenderer.js","src/core/graphics/webgl/WebGLGraphicsData.js","src/core/index.js","src/core/math/Matrix.js","src/core/math/Point.js","src/core/math/index.js","src/core/math/shapes/Circle.js","src/core/math/shapes/Ellipse.js","src/core/math/shapes/Polygon.js","src/core/math/shapes/Rectangle.js","src/core/math/shapes/RoundedRectangle.js","src/core/particles/ParticleContainer.js","src/core/particles/webgl/ParticleBuffer.js","src/core/particles/webgl/ParticleRenderer.js","src/core/particles/webgl/ParticleShader.js","src/core/renderers/SystemRenderer.js","src/core/renderers/canvas/CanvasRenderer.js","src/core/renderers/canvas/utils/CanvasBuffer.js","src/core/renderers/canvas/utils/CanvasGraphics.js","src/core/renderers/canvas/utils/CanvasMaskManager.js","src/core/renderers/canvas/utils/CanvasTinter.js","src/core/renderers/webgl/WebGLRenderer.js","src/core/renderers/webgl/filters/AbstractFilter.js","src/core/renderers/webgl/filters/FXAAFilter.js","src/core/renderers/webgl/filters/SpriteMaskFilter.js","src/core/renderers/webgl/managers/BlendModeManager.js","src/core/renderers/webgl/managers/FilterManager.js","src/core/renderers/webgl/managers/MaskManager.js","src/core/renderers/webgl/managers/ShaderManager.js","src/core/renderers/webgl/managers/StencilManager.js","src/core/renderers/webgl/managers/WebGLManager.js","src/core/renderers/webgl/shaders/ComplexPrimitiveShader.js","src/core/renderers/webgl/shaders/PrimitiveShader.js","src/core/renderers/webgl/shaders/Shader.js","src/core/renderers/webgl/shaders/TextureShader.js","src/core/renderers/webgl/utils/ObjectRenderer.js","src/core/renderers/webgl/utils/Quad.js","src/core/renderers/webgl/utils/RenderTarget.js","src/core/renderers/webgl/utils/StencilMaskStack.js","src/core/sprites/Sprite.js","src/core/sprites/webgl/SpriteRenderer.js","src/core/text/Text.js","src/core/textures/BaseTexture.js","src/core/textures/RenderTexture.js","src/core/textures/Texture.js","src/core/textures/TextureUvs.js","src/core/textures/VideoBaseTexture.js","src/core/utils/index.js","src/core/utils/pluginTarget.js","src/deprecation.js","src/extras/BitmapText.js","src/extras/MovieClip.js","src/extras/TilingSprite.js","src/extras/cacheAsBitmap.js","src/extras/getChildByName.js","src/extras/getGlobalPosition.js","src/extras/index.js","src/filters/ascii/AsciiFilter.js","src/filters/bloom/BloomFilter.js","src/filters/blur/BlurDirFilter.js","src/filters/blur/BlurFilter.js","src/filters/blur/BlurXFilter.js","src/filters/blur/BlurYFilter.js","src/filters/blur/SmartBlurFilter.js","src/filters/color/ColorMatrixFilter.js","src/filters/color/ColorStepFilter.js","src/filters/convolution/ConvolutionFilter.js","src/filters/crosshatch/CrossHatchFilter.js","src/filters/displacement/DisplacementFilter.js","src/filters/dot/DotScreenFilter.js","src/filters/dropshadow/BlurYTintFilter.js","src/filters/dropshadow/DropShadowFilter.js","src/filters/gray/GrayFilter.js","src/filters/index.js","src/filters/invert/InvertFilter.js","src/filters/noise/NoiseFilter.js","src/filters/normal/NormalMapFilter.js","src/filters/pixelate/PixelateFilter.js","src/filters/rgb/RGBSplitFilter.js","src/filters/sepia/SepiaFilter.js","src/filters/shockwave/ShockwaveFilter.js","src/filters/tiltshift/TiltShiftAxisFilter.js","src/filters/tiltshift/TiltShiftFilter.js","src/filters/tiltshift/TiltShiftXFilter.js","src/filters/tiltshift/TiltShiftYFilter.js","src/filters/twist/TwistFilter.js","src/interaction/InteractionData.js","src/interaction/InteractionManager.js","src/interaction/index.js","src/interaction/interactiveTarget.js","src/loaders/bitmapFontParser.js","src/loaders/index.js","src/loaders/loader.js","src/loaders/spritesheetParser.js","src/loaders/textureParser.js","src/mesh/Mesh.js","src/mesh/Rope.js","src/mesh/index.js","src/mesh/webgl/MeshRenderer.js","src/mesh/webgl/MeshShader.js","src/polyfill/Object.assign.js","src/polyfill/index.js","src/polyfill/requestAnimationFrame.js","src/ticker/Ticker.js","src/ticker/index.js"],"names":[],"mappings":"AAAA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACnmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AChOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACnmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/uBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5pCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACl4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7eA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACljBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACngBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACj1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"pixi.js","sourceRoot":"./","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= arr.length) {\n callback();\n }\n }\n }\n };\n async.forEach = async.each;\n\n async.eachSeries = function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length) {\n return callback();\n }\n var completed = 0;\n var iterate = function () {\n iterator(arr[completed], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n iterate();\n }\n }\n });\n };\n iterate();\n };\n async.forEachSeries = async.eachSeries;\n\n async.eachLimit = function (arr, limit, iterator, callback) {\n var fn = _eachLimit(limit);\n fn.apply(null, [arr, iterator, callback]);\n };\n async.forEachLimit = async.eachLimit;\n\n var _eachLimit = function (limit) {\n\n return function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length || limit <= 0) {\n return callback();\n }\n var completed = 0;\n var started = 0;\n var running = 0;\n\n (function replenish () {\n if (completed >= arr.length) {\n return callback();\n }\n\n while (running < limit && started < arr.length) {\n started += 1;\n running += 1;\n iterator(arr[started - 1], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n running -= 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n replenish();\n }\n }\n });\n }\n })();\n };\n };\n\n\n var doParallel = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.each].concat(args));\n };\n };\n var doParallelLimit = function(limit, fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [_eachLimit(limit)].concat(args));\n };\n };\n var doSeries = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.eachSeries].concat(args));\n };\n };\n\n\n var _asyncMap = function (eachfn, arr, iterator, callback) {\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n if (!callback) {\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err) {\n callback(err);\n });\n });\n } else {\n var results = [];\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err, v) {\n results[x.index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n async.map = doParallel(_asyncMap);\n async.mapSeries = doSeries(_asyncMap);\n async.mapLimit = function (arr, limit, iterator, callback) {\n return _mapLimit(limit)(arr, iterator, callback);\n };\n\n var _mapLimit = function(limit) {\n return doParallelLimit(limit, _asyncMap);\n };\n\n // reduce only has a series version, as doing reduce in parallel won't\n // work in many situations.\n async.reduce = function (arr, memo, iterator, callback) {\n async.eachSeries(arr, function (x, callback) {\n iterator(memo, x, function (err, v) {\n memo = v;\n callback(err);\n });\n }, function (err) {\n callback(err, memo);\n });\n };\n // inject alias\n async.inject = async.reduce;\n // foldl alias\n async.foldl = async.reduce;\n\n async.reduceRight = function (arr, memo, iterator, callback) {\n var reversed = _map(arr, function (x) {\n return x;\n }).reverse();\n async.reduce(reversed, memo, iterator, callback);\n };\n // foldr alias\n async.foldr = async.reduceRight;\n\n var _filter = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.filter = doParallel(_filter);\n async.filterSeries = doSeries(_filter);\n // select alias\n async.select = async.filter;\n async.selectSeries = async.filterSeries;\n\n var _reject = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (!v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.reject = doParallel(_reject);\n async.rejectSeries = doSeries(_reject);\n\n var _detect = function (eachfn, arr, iterator, main_callback) {\n eachfn(arr, function (x, callback) {\n iterator(x, function (result) {\n if (result) {\n main_callback(x);\n main_callback = function () {};\n }\n else {\n callback();\n }\n });\n }, function (err) {\n main_callback();\n });\n };\n async.detect = doParallel(_detect);\n async.detectSeries = doSeries(_detect);\n\n async.some = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (v) {\n main_callback(true);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(false);\n });\n };\n // any alias\n async.any = async.some;\n\n async.every = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (!v) {\n main_callback(false);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(true);\n });\n };\n // all alias\n async.all = async.every;\n\n async.sortBy = function (arr, iterator, callback) {\n async.map(arr, function (x, callback) {\n iterator(x, function (err, criteria) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, {value: x, criteria: criteria});\n }\n });\n }, function (err, results) {\n if (err) {\n return callback(err);\n }\n else {\n var fn = function (left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n };\n callback(null, _map(results.sort(fn), function (x) {\n return x.value;\n }));\n }\n });\n };\n\n async.auto = function (tasks, callback) {\n callback = callback || function () {};\n var keys = _keys(tasks);\n var remainingTasks = keys.length\n if (!remainingTasks) {\n return callback();\n }\n\n var results = {};\n\n var listeners = [];\n var addListener = function (fn) {\n listeners.unshift(fn);\n };\n var removeListener = function (fn) {\n for (var i = 0; i < listeners.length; i += 1) {\n if (listeners[i] === fn) {\n listeners.splice(i, 1);\n return;\n }\n }\n };\n var taskComplete = function () {\n remainingTasks--\n _each(listeners.slice(0), function (fn) {\n fn();\n });\n };\n\n addListener(function () {\n if (!remainingTasks) {\n var theCallback = callback;\n // prevent final callback from calling itself if it errors\n callback = function () {};\n\n theCallback(null, results);\n }\n });\n\n _each(keys, function (k) {\n var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];\n var taskCallback = function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n if (err) {\n var safeResults = {};\n _each(_keys(results), function(rkey) {\n safeResults[rkey] = results[rkey];\n });\n safeResults[k] = args;\n callback(err, safeResults);\n // stop subsequent errors hitting callback multiple times\n callback = function () {};\n }\n else {\n results[k] = args;\n async.setImmediate(taskComplete);\n }\n };\n var requires = task.slice(0, Math.abs(task.length - 1)) || [];\n var ready = function () {\n return _reduce(requires, function (a, x) {\n return (a && results.hasOwnProperty(x));\n }, true) && !results.hasOwnProperty(k);\n };\n if (ready()) {\n task[task.length - 1](taskCallback, results);\n }\n else {\n var listener = function () {\n if (ready()) {\n removeListener(listener);\n task[task.length - 1](taskCallback, results);\n }\n };\n addListener(listener);\n }\n });\n };\n\n async.retry = function(times, task, callback) {\n var DEFAULT_TIMES = 5;\n var attempts = [];\n // Use defaults if times not passed\n if (typeof times === 'function') {\n callback = task;\n task = times;\n times = DEFAULT_TIMES;\n }\n // Make sure times is a number\n times = parseInt(times, 10) || DEFAULT_TIMES;\n var wrappedTask = function(wrappedCallback, wrappedResults) {\n var retryAttempt = function(task, finalAttempt) {\n return function(seriesCallback) {\n task(function(err, result){\n seriesCallback(!err || finalAttempt, {err: err, result: result});\n }, wrappedResults);\n };\n };\n while (times) {\n attempts.push(retryAttempt(task, !(times-=1)));\n }\n async.series(attempts, function(done, data){\n data = data[data.length - 1];\n (wrappedCallback || callback)(data.err, data.result);\n });\n }\n // If a callback is passed, run this as a controll flow\n return callback ? wrappedTask() : wrappedTask\n };\n\n async.waterfall = function (tasks, callback) {\n callback = callback || function () {};\n if (!_isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {};\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n };\n\n var _parallel = function(eachfn, tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n eachfn.map(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n eachfn.each(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.parallel = function (tasks, callback) {\n _parallel({ map: async.map, each: async.each }, tasks, callback);\n };\n\n async.parallelLimit = function(tasks, limit, callback) {\n _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);\n };\n\n async.series = function (tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n async.mapSeries(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n async.eachSeries(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n };\n return fn;\n };\n return makeCallback(0);\n };\n\n async.apply = function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function () {\n return fn.apply(\n null, args.concat(Array.prototype.slice.call(arguments))\n );\n };\n };\n\n var _concat = function (eachfn, arr, fn, callback) {\n var r = [];\n eachfn(arr, function (x, cb) {\n fn(x, function (err, y) {\n r = r.concat(y || []);\n cb(err);\n });\n }, function (err) {\n callback(err, r);\n });\n };\n async.concat = doParallel(_concat);\n async.concatSeries = doSeries(_concat);\n\n async.whilst = function (test, iterator, callback) {\n if (test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.whilst(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doWhilst = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (test.apply(null, args)) {\n async.doWhilst(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.until = function (test, iterator, callback) {\n if (!test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.until(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doUntil = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (!test.apply(null, args)) {\n async.doUntil(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.queue = function (worker, concurrency) {\n if (concurrency === undefined) {\n concurrency = 1;\n }\n function _insert(q, data, pos, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n callback: typeof callback === 'function' ? callback : null\n };\n\n if (pos) {\n q.tasks.unshift(item);\n } else {\n q.tasks.push(item);\n }\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n\n var workers = 0;\n var q = {\n tasks: [],\n concurrency: concurrency,\n saturated: null,\n empty: null,\n drain: null,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(q, data, false, callback);\n },\n kill: function () {\n q.drain = null;\n q.tasks = [];\n },\n unshift: function (data, callback) {\n _insert(q, data, true, callback);\n },\n process: function () {\n if (!q.paused && workers < q.concurrency && q.tasks.length) {\n var task = q.tasks.shift();\n if (q.empty && q.tasks.length === 0) {\n q.empty();\n }\n workers += 1;\n var next = function () {\n workers -= 1;\n if (task.callback) {\n task.callback.apply(task, arguments);\n }\n if (q.drain && q.tasks.length + workers === 0) {\n q.drain();\n }\n q.process();\n };\n var cb = only_once(next);\n worker(task.data, cb);\n }\n },\n length: function () {\n return q.tasks.length;\n },\n running: function () {\n return workers;\n },\n idle: function() {\n return q.tasks.length + workers === 0;\n },\n pause: function () {\n if (q.paused === true) { return; }\n q.paused = true;\n q.process();\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n q.process();\n }\n };\n return q;\n };\n \n async.priorityQueue = function (worker, concurrency) {\n \n function _compareTasks(a, b){\n return a.priority - b.priority;\n };\n \n function _binarySearch(sequence, item, compare) {\n var beg = -1,\n end = sequence.length - 1;\n while (beg < end) {\n var mid = beg + ((end - beg + 1) >>> 1);\n if (compare(item, sequence[mid]) >= 0) {\n beg = mid;\n } else {\n end = mid - 1;\n }\n }\n return beg;\n }\n \n function _insert(q, data, priority, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n priority: priority,\n callback: typeof callback === 'function' ? callback : null\n };\n \n q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n \n // Start with a normal queue\n var q = async.queue(worker, concurrency);\n \n // Override push to accept second parameter representing priority\n q.push = function (data, priority, callback) {\n _insert(q, data, priority, callback);\n };\n \n // Remove unshift function\n delete q.unshift;\n\n return q;\n };\n\n async.cargo = function (worker, payload) {\n var working = false,\n tasks = [];\n\n var cargo = {\n tasks: tasks,\n payload: payload,\n saturated: null,\n empty: null,\n drain: null,\n drained: true,\n push: function (data, callback) {\n if (!_isArray(data)) {\n data = [data];\n }\n _each(data, function(task) {\n tasks.push({\n data: task,\n callback: typeof callback === 'function' ? callback : null\n });\n cargo.drained = false;\n if (cargo.saturated && tasks.length === payload) {\n cargo.saturated();\n }\n });\n async.setImmediate(cargo.process);\n },\n process: function process() {\n if (working) return;\n if (tasks.length === 0) {\n if(cargo.drain && !cargo.drained) cargo.drain();\n cargo.drained = true;\n return;\n }\n\n var ts = typeof payload === 'number'\n ? tasks.splice(0, payload)\n : tasks.splice(0, tasks.length);\n\n var ds = _map(ts, function (task) {\n return task.data;\n });\n\n if(cargo.empty) cargo.empty();\n working = true;\n worker(ds, function () {\n working = false;\n\n var args = arguments;\n _each(ts, function (data) {\n if (data.callback) {\n data.callback.apply(null, args);\n }\n });\n\n process();\n });\n },\n length: function () {\n return tasks.length;\n },\n running: function () {\n return working;\n }\n };\n return cargo;\n };\n\n var _console_fn = function (name) {\n return function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n fn.apply(null, args.concat([function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (typeof console !== 'undefined') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n }\n else if (console[name]) {\n _each(args, function (x) {\n console[name](x);\n });\n }\n }\n }]));\n };\n };\n async.log = _console_fn('log');\n async.dir = _console_fn('dir');\n /*async.info = _console_fn('info');\n async.warn = _console_fn('warn');\n async.error = _console_fn('error');*/\n\n async.memoize = function (fn, hasher) {\n var memo = {};\n var queues = {};\n hasher = hasher || function (x) {\n return x;\n };\n var memoized = function () {\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n var key = hasher.apply(null, args);\n if (key in memo) {\n async.nextTick(function () {\n callback.apply(null, memo[key]);\n });\n }\n else if (key in queues) {\n queues[key].push(callback);\n }\n else {\n queues[key] = [callback];\n fn.apply(null, args.concat([function () {\n memo[key] = arguments;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, arguments);\n }\n }]));\n }\n };\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n };\n\n async.unmemoize = function (fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n };\n\n async.times = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.map(counter, iterator, callback);\n };\n\n async.timesSeries = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.mapSeries(counter, iterator, callback);\n };\n\n async.seq = function (/* functions... */) {\n var fns = arguments;\n return function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n async.reduce(fns, args, function (newargs, fn, cb) {\n fn.apply(that, newargs.concat([function () {\n var err = arguments[0];\n var nextargs = Array.prototype.slice.call(arguments, 1);\n cb(err, nextargs);\n }]))\n },\n function (err, results) {\n callback.apply(that, [err].concat(results));\n });\n };\n };\n\n async.compose = function (/* functions... */) {\n return async.seq.apply(null, Array.prototype.reverse.call(arguments));\n };\n\n var _applyEach = function (eachfn, fns /*args...*/) {\n var go = function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n return eachfn(fns, function (fn, cb) {\n fn.apply(that, args.concat([cb]));\n },\n callback);\n };\n if (arguments.length > 2) {\n var args = Array.prototype.slice.call(arguments, 2);\n return go.apply(this, args);\n }\n else {\n return go;\n }\n };\n async.applyEach = doParallel(_applyEach);\n async.applyEachSeries = doSeries(_applyEach);\n\n async.forever = function (fn, callback) {\n function next(err) {\n if (err) {\n if (callback) {\n return callback(err);\n }\n throw err;\n }\n fn(next);\n }\n next();\n };\n\n // Node.js\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = async;\n }\n // AMD / RequireJS\n else if (typeof define !== 'undefined' && define.amd) {\n define([], function () {\n return async;\n });\n }\n // included directly via