(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["OptimalSelect"] = factory();
	else
		root["OptimalSelect"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
/******/
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// identity function for calling harmony imports with the correct context
/******/ 	__webpack_require__.i = function(value) { return value; };
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 6);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.convertNodeList = convertNodeList;
exports.escapeValue = escapeValue;
/**
 * # Utilities
 *
 * Convenience helpers.
 */

/**
 * Create an array with the DOM nodes of the list
 *
 * @param  {NodeList}             nodes - [description]
 * @return {Array.<HTMLElement>}        - [description]
 */
function convertNodeList(nodes) {
  var length = nodes.length;

  var arr = new Array(length);
  for (var i = 0; i < length; i++) {
    arr[i] = nodes[i];
  }
  return arr;
}

/**
 * Escape special characters and line breaks as a simplified version of 'CSS.escape()'
 *
 * Description of valid characters: https://mathiasbynens.be/notes/css-escapes
 *
 * @param  {String?} value - [description]
 * @return {String}        - [description]
 */
function escapeValue(value) {
  return value && value.replace(/['"`\\/:\?&!#$%^()[\]{|}*+;,.<=>@~]/g, '\\$&').replace(/\n/g, '\A');
}

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getCommonAncestor = getCommonAncestor;
exports.getCommonProperties = getCommonProperties;
/**
 * # Common
 *
 * Process collections for similarities.
 */

/**
 * Find the last common ancestor of elements
 *
 * @param  {Array.<HTMLElements>} elements - [description]
 * @return {HTMLElement}                   - [description]
 */
function getCommonAncestor(elements) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var _options$root = options.root,
      root = _options$root === undefined ? document : _options$root;


  var ancestors = [];

  elements.forEach(function (element, index) {
    var parents = [];
    while (element !== root) {
      element = element.parentNode;
      parents.unshift(element);
    }
    ancestors[index] = parents;
  });

  ancestors.sort(function (curr, next) {
    return curr.length - next.length;
  });

  var shallowAncestor = ancestors.shift();

  var ancestor = null;

  var _loop = function _loop() {
    var parent = shallowAncestor[i];
    var missing = ancestors.some(function (otherParents) {
      return !otherParents.some(function (otherParent) {
        return otherParent === parent;
      });
    });

    if (missing) {
      // TODO: find similar sub-parents, not the top root, e.g. sharing a class selector
      return 'break';
    }

    ancestor = parent;
  };

  for (var i = 0, l = shallowAncestor.length; i < l; i++) {
    var _ret = _loop();

    if (_ret === 'break') break;
  }

  return ancestor;
}

/**
 * Get a set of common properties of elements
 *
 * @param  {Array.<HTMLElement>} elements - [description]
 * @return {Object}                       - [description]
 */
function getCommonProperties(elements) {

  var commonProperties = {
    classes: [],
    attributes: {},
    tag: null
  };

  elements.forEach(function (element) {
    var commonClasses = commonProperties.classes,
        commonAttributes = commonProperties.attributes,
        commonTag = commonProperties.tag;

    // ~ classes

    if (commonClasses !== undefined) {
      var classes = element.getAttribute('class');
      if (classes) {
        classes = classes.trim().split(' ');
        if (!commonClasses.length) {
          commonProperties.classes = classes;
        } else {
          commonClasses = commonClasses.filter(function (entry) {
            return classes.some(function (name) {
              return name === entry;
            });
          });
          if (commonClasses.length) {
            commonProperties.classes = commonClasses;
          } else {
            delete commonProperties.classes;
          }
        }
      } else {
        // TODO: restructure removal as 2x set / 2x delete, instead of modify always replacing with new collection
        delete commonProperties.classes;
      }
    }

    // ~ attributes
    if (commonAttributes !== undefined) {
      (function () {
        var elementAttributes = element.attributes;
        var attributes = Object.keys(elementAttributes).reduce(function (attributes, key) {
          var attribute = elementAttributes[key];
          var attributeName = attribute.name;
          // NOTE: workaround detection for non-standard phantomjs NamedNodeMap behaviour
          // (issue: https://github.com/ariya/phantomjs/issues/14634)
          if (attribute && attributeName !== 'class') {
            attributes[attributeName] = attribute.value;
          }
          return attributes;
        }, {});

        var attributesNames = Object.keys(attributes);
        var commonAttributesNames = Object.keys(commonAttributes);

        if (attributesNames.length) {
          if (!commonAttributesNames.length) {
            commonProperties.attributes = attributes;
          } else {
            commonAttributes = commonAttributesNames.reduce(function (nextCommonAttributes, name) {
              var value = commonAttributes[name];
              if (value === attributes[name]) {
                nextCommonAttributes[name] = value;
              }
              return nextCommonAttributes;
            }, {});
            if (Object.keys(commonAttributes).length) {
              commonProperties.attributes = commonAttributes;
            } else {
              delete commonProperties.attributes;
            }
          }
        } else {
          delete commonProperties.attributes;
        }
      })();
    }

    // ~ tag
    if (commonTag !== undefined) {
      var tag = element.tagName.toLowerCase();
      if (!commonTag) {
        commonProperties.tag = tag;
      } else if (tag !== commonTag) {
        delete commonProperties.tag;
      }
    }
  });

  return commonProperties;
}

/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = optimize;

var _adapt = __webpack_require__(3);

var _adapt2 = _interopRequireDefault(_adapt);

var _utilities = __webpack_require__(0);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Apply different optimization techniques
 *
 * @param  {string}                          selector - [description]
 * @param  {HTMLElement|Array.<HTMLElement>} element  - [description]
 * @param  {Object}                          options  - [description]
 * @return {string}                                   - [description]
 */
/**
 * # Optimize
 *
 * 1.) Improve efficiency through shorter selectors by removing redundancy
 * 2.) Improve robustness through selector transformation
 */

function optimize(selector, elements) {
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};


  // convert single entry and NodeList
  if (!Array.isArray(elements)) {
    elements = !elements.length ? [elements] : (0, _utilities.convertNodeList)(elements);
  }

  if (!elements.length || elements.some(function (element) {
    return element.nodeType !== 1;
  })) {
    throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing "elements")');
  }

  var globalModified = (0, _adapt2.default)(elements[0], options);

  // chunk parts outside of quotes (http://stackoverflow.com/a/25663729)
  var path = selector.replace(/> /g, '>').split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);

  if (path.length < 2) {
    return optimizePart('', selector, '', elements);
  }

  var shortened = [path.pop()];
  while (path.length > 1) {
    var current = path.pop();
    var prePart = path.join(' ');
    var postPart = shortened.join(' ');

    var pattern = prePart + ' ' + postPart;
    var matches = document.querySelectorAll(pattern);
    if (matches.length !== elements.length) {
      shortened.unshift(optimizePart(prePart, current, postPart, elements));
    }
  }
  shortened.unshift(path[0]);
  path = shortened;

  // optimize start + end
  path[0] = optimizePart('', path[0], path.slice(1).join(' '), elements);
  path[path.length - 1] = optimizePart(path.slice(0, -1).join(' '), path[path.length - 1], '', elements);

  if (globalModified) {
    delete true;
  }

  return path.join(' ').replace(/>/g, '> ').trim();
}

/**
 * Improve a chunk of the selector
 *
 * @param  {string}              prePart  - [description]
 * @param  {string}              current  - [description]
 * @param  {string}              postPart - [description]
 * @param  {Array.<HTMLElement>} elements - [description]
 * @return {string}                       - [description]
 */
function optimizePart(prePart, current, postPart, elements) {
  if (prePart.length) prePart = prePart + ' ';
  if (postPart.length) postPart = ' ' + postPart;

  // robustness: attribute without value (generalization)
  if (/\[*\]/.test(current)) {
    var key = current.replace(/=.*$/, ']');
    var pattern = '' + prePart + key + postPart;
    var matches = document.querySelectorAll(pattern);
    if (compareResults(matches, elements)) {
      current = key;
    } else {
      // robustness: replace specific key-value with base tag (heuristic)
      var references = document.querySelectorAll('' + prePart + key);

      var _loop = function _loop() {
        var reference = references[i];
        if (elements.some(function (element) {
          return reference.contains(element);
        })) {
          var description = reference.tagName.toLowerCase();
          pattern = '' + prePart + description + postPart;
          matches = document.querySelectorAll(pattern);

          if (compareResults(matches, elements)) {
            current = description;
          }
          return 'break';
        }
      };

      for (var i = 0, l = references.length; i < l; i++) {
        var pattern;
        var matches;

        var _ret = _loop();

        if (_ret === 'break') break;
      }
    }
  }

  // robustness: descendant instead child (heuristic)
  if (/>/.test(current)) {
    var descendant = current.replace(/>/, '');
    var pattern = '' + prePart + descendant + postPart;
    var matches = document.querySelectorAll(pattern);
    if (compareResults(matches, elements)) {
      current = descendant;
    }
  }

  // robustness: 'nth-of-type' instead 'nth-child' (heuristic)
  if (/:nth-child/.test(current)) {
    // TODO: consider complete coverage of 'nth-of-type' replacement
    var type = current.replace(/nth-child/g, 'nth-of-type');
    var pattern = '' + prePart + type + postPart;
    var matches = document.querySelectorAll(pattern);
    if (compareResults(matches, elements)) {
      current = type;
    }
  }

  // efficiency: combinations of classname (partial permutations)
  if (/\.\S+\.\S+/.test(current)) {
    var names = current.trim().split('.').slice(1).map(function (name) {
      return '.' + name;
    }).sort(function (curr, next) {
      return curr.length - next.length;
    });
    while (names.length) {
      var partial = current.replace(names.shift(), '').trim();
      var pattern = ('' + prePart + partial + postPart).trim();
      if (!pattern.length || pattern.charAt(0) === '>' || pattern.charAt(pattern.length - 1) === '>') {
        break;
      }
      var matches = document.querySelectorAll(pattern);
      if (compareResults(matches, elements)) {
        current = partial;
      }
    }

    // robustness: degrade complex classname (heuristic)
    names = current && current.match(/\./g);
    if (names && names.length > 2) {
      var _references = document.querySelectorAll('' + prePart + current);

      var _loop2 = function _loop2() {
        var reference = _references[i];
        if (elements.some(function (element) {
          return reference.contains(element);
        })) {
          // TODO:
          // - check using attributes + regard excludes
          var description = reference.tagName.toLowerCase();
          pattern = '' + prePart + description + postPart;
          matches = document.querySelectorAll(pattern);

          if (compareResults(matches, elements)) {
            current = description;
          }
          return 'break';
        }
      };

      for (var i = 0, l = _references.length; i < l; i++) {
        var pattern;
        var matches;

        var _ret2 = _loop2();

        if (_ret2 === 'break') break;
      }
    }
  }

  return current;
}

/**
 * Evaluate matches with expected elements
 *
 * @param  {Array.<HTMLElement>} matches  - [description]
 * @param  {Array.<HTMLElement>} elements - [description]
 * @return {Boolean}                      - [description]
 */
function compareResults(matches, elements) {
  var length = matches.length;

  return length === elements.length && elements.every(function (element) {
    for (var i = 0; i < length; i++) {
      if (matches[i] === element) {
        return true;
      }
    }
    return false;
  });
}
module.exports = exports['default'];

/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

exports.default = adapt;
/**
 * # Adapt
 *
 * Check and extend the environment for universal usage.
 */

/**
 * Modify the context based on the environment
 *
 * @param  {HTMLELement} element - [description]
 * @param  {Object}      options - [description]
 * @return {boolean}             - [description]
 */
function adapt(element, options) {

  // detect environment setup
  if (true) {
    return false;
  } else {
    global.document = options.context || function () {
      var root = element;
      while (root.parent) {
        root = root.parent;
      }
      return root;
    }();
  }

  // https://github.com/fb55/domhandler/blob/master/index.js#L75
  var ElementPrototype = Object.getPrototypeOf(true);

  // alternative descriptor to access elements with filtering invalid elements (e.g. textnodes)
  if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'childTags')) {
    Object.defineProperty(ElementPrototype, 'childTags', {
      enumerable: true,
      get: function get() {
        return this.children.filter(function (node) {
          // https://github.com/fb55/domelementtype/blob/master/index.js#L12
          return node.type === 'tag' || node.type === 'script' || node.type === 'style';
        });
      }
    });
  }

  if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'attributes')) {
    // https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
    // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap
    Object.defineProperty(ElementPrototype, 'attributes', {
      enumerable: true,
      get: function get() {
        var attribs = this.attribs;

        var attributesNames = Object.keys(attribs);
        var NamedNodeMap = attributesNames.reduce(function (attributes, attributeName, index) {
          attributes[index] = {
            name: attributeName,
            value: attribs[attributeName]
          };
          return attributes;
        }, {});
        Object.defineProperty(NamedNodeMap, 'length', {
          enumerable: false,
          configurable: false,
          value: attributesNames.length
        });
        return NamedNodeMap;
      }
    });
  }

  if (!ElementPrototype.getAttribute) {
    // https://docs.webplatform.org/wiki/dom/Element/getAttribute
    // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
    ElementPrototype.getAttribute = function (name) {
      return this.attribs[name] || null;
    };
  }

  if (!ElementPrototype.getElementsByTagName) {
    // https://docs.webplatform.org/wiki/dom/Document/getElementsByTagName
    // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName
    ElementPrototype.getElementsByTagName = function (tagName) {
      var HTMLCollection = [];
      traverseDescendants(this.childTags, function (descendant) {
        if (descendant.name === tagName || tagName === '*') {
          HTMLCollection.push(descendant);
        }
      });
      return HTMLCollection;
    };
  }

  if (!ElementPrototype.getElementsByClassName) {
    // https://docs.webplatform.org/wiki/dom/Document/getElementsByClassName
    // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName
    ElementPrototype.getElementsByClassName = function (className) {
      var names = className.trim().replace(/\s+/g, ' ').split(' ');
      var HTMLCollection = [];
      traverseDescendants([this], function (descendant) {
        var descendantClassName = descendant.attribs.class;
        if (descendantClassName && names.every(function (name) {
          return descendantClassName.indexOf(name) > -1;
        })) {
          HTMLCollection.push(descendant);
        }
      });
      return HTMLCollection;
    };
  }

  if (!ElementPrototype.querySelectorAll) {
    // https://docs.webplatform.org/wiki/css/selectors_api/querySelectorAll
    // https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll
    ElementPrototype.querySelectorAll = function (selectors) {
      var _this = this;

      selectors = selectors.replace(/(>)(\S)/g, '$1 $2').trim(); // add space for '>' selector

      // using right to left execution => https://github.com/fb55/css-select#how-does-it-work
      var instructions = getInstructions(selectors);
      var discover = instructions.shift();

      var total = instructions.length;
      return discover(this).filter(function (node) {
        var step = 0;
        while (step < total) {
          node = instructions[step](node, _this);
          if (!node) {
            // hierarchy doesn't match
            return false;
          }
          step += 1;
        }
        return true;
      });
    };
  }

  if (!ElementPrototype.contains) {
    // https://developer.mozilla.org/en-US/docs/Web/API/Node/contains
    ElementPrototype.contains = function (element) {
      var inclusive = false;
      traverseDescendants([this], function (descendant, done) {
        if (descendant === element) {
          inclusive = true;
          done();
        }
      });
      return inclusive;
    };
  }

  return true;
}

/**
 * Retrieve transformation steps
 *
 * @param  {Array.<string>}   selectors - [description]
 * @return {Array.<Function>}           - [description]
 */
function getInstructions(selectors) {
  return selectors.split(' ').reverse().map(function (selector, step) {
    var discover = step === 0;

    var _selector$split = selector.split(':'),
        _selector$split2 = _slicedToArray(_selector$split, 2),
        type = _selector$split2[0],
        pseudo = _selector$split2[1];

    var validate = null;
    var instruction = null;

    (function () {
      switch (true) {

        // child: '>'
        case />/.test(type):
          instruction = function checkParent(node) {
            return function (validate) {
              return validate(node.parent) && node.parent;
            };
          };
          break;

        // class: '.'
        case /^\./.test(type):
          var names = type.substr(1).split('.');
          validate = function validate(node) {
            var nodeClassName = node.attribs.class;
            return nodeClassName && names.every(function (name) {
              return nodeClassName.indexOf(name) > -1;
            });
          };
          instruction = function checkClass(node, root) {
            if (discover) {
              return node.getElementsByClassName(names.join(' '));
            }
            return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);
          };
          break;

        // attribute: '[key="value"]'
        case /^\[/.test(type):
          var _type$replace$split = type.replace(/\[|\]|"/g, '').split('='),
              _type$replace$split2 = _slicedToArray(_type$replace$split, 2),
              attributeKey = _type$replace$split2[0],
              attributeValue = _type$replace$split2[1];

          validate = function validate(node) {
            var hasAttribute = Object.keys(node.attribs).indexOf(attributeKey) > -1;
            if (hasAttribute) {
              // regard optional attributeValue
              if (!attributeValue || node.attribs[attributeKey] === attributeValue) {
                return true;
              }
            }
            return false;
          };
          instruction = function checkAttribute(node, root) {
            if (discover) {
              var _ret2 = function () {
                var NodeList = [];
                traverseDescendants([node], function (descendant) {
                  if (validate(descendant)) {
                    NodeList.push(descendant);
                  }
                });
                return {
                  v: NodeList
                };
              }();

              if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
            }
            return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);
          };
          break;

        // id: '#'
        case /^#/.test(type):
          var id = type.substr(1);
          validate = function validate(node) {
            return node.attribs.id === id;
          };
          instruction = function checkId(node, root) {
            if (discover) {
              var _ret3 = function () {
                var NodeList = [];
                traverseDescendants([node], function (descendant, done) {
                  if (validate(descendant)) {
                    NodeList.push(descendant);
                    done();
                  }
                });
                return {
                  v: NodeList
                };
              }();

              if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === "object") return _ret3.v;
            }
            return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);
          };
          break;

        // universal: '*'
        case /\*/.test(type):
          validate = function validate(node) {
            return true;
          };
          instruction = function checkUniversal(node, root) {
            if (discover) {
              var _ret4 = function () {
                var NodeList = [];
                traverseDescendants([node], function (descendant) {
                  return NodeList.push(descendant);
                });
                return {
                  v: NodeList
                };
              }();

              if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === "object") return _ret4.v;
            }
            return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);
          };
          break;

        // tag: '...'
        default:
          validate = function validate(node) {
            return node.name === type;
          };
          instruction = function checkTag(node, root) {
            if (discover) {
              var _ret5 = function () {
                var NodeList = [];
                traverseDescendants([node], function (descendant) {
                  if (validate(descendant)) {
                    NodeList.push(descendant);
                  }
                });
                return {
                  v: NodeList
                };
              }();

              if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === "object") return _ret5.v;
            }
            return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);
          };
      }
    })();

    if (!pseudo) {
      return instruction;
    }

    var rule = pseudo.match(/-(child|type)\((\d+)\)$/);
    var kind = rule[1];
    var index = parseInt(rule[2], 10) - 1;

    var validatePseudo = function validatePseudo(node) {
      if (node) {
        var compareSet = node.parent.childTags;
        if (kind === 'type') {
          compareSet = compareSet.filter(validate);
        }
        var nodeIndex = compareSet.findIndex(function (child) {
          return child === node;
        });
        if (nodeIndex === index) {
          return true;
        }
      }
      return false;
    };

    return function enhanceInstruction(node) {
      var match = instruction(node);
      if (discover) {
        return match.reduce(function (NodeList, matchedNode) {
          if (validatePseudo(matchedNode)) {
            NodeList.push(matchedNode);
          }
          return NodeList;
        }, []);
      }
      return validatePseudo(match) && match;
    };
  });
}

/**
 * Walking recursive to invoke callbacks
 *
 * @param {Array.<HTMLElement>} nodes   - [description]
 * @param {Function}            handler - [description]
 */
function traverseDescendants(nodes, handler) {
  nodes.forEach(function (node) {
    var progress = true;
    handler(node, function () {
      return progress = false;
    });
    if (node.childTags && progress) {
      traverseDescendants(node.childTags, handler);
    }
  });
}

/**
 * Bubble up from bottom to top
 *
 * @param  {HTMLELement} node     - [description]
 * @param  {HTMLELement} root     - [description]
 * @param  {Function}    validate - [description]
 * @return {HTMLELement}          - [description]
 */
function getAncestor(node, root, validate) {
  while (node.parent) {
    node = node.parent;
    if (validate(node)) {
      return node;
    }
    if (node === root) {
      break;
    }
  }
  return null;
}
module.exports = exports['default'];

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
                                                                                                                                                                                                                                                                               * # Select
                                                                                                                                                                                                                                                                               *
                                                                                                                                                                                                                                                                               * Construct a unique CSS query selector to access the selected DOM element(s).
                                                                                                                                                                                                                                                                               * For longevity it applies different matching and optimization strategies.
                                                                                                                                                                                                                                                                               */

exports.getSingleSelector = getSingleSelector;
exports.getMultiSelector = getMultiSelector;
exports.default = getQuerySelector;

var _adapt = __webpack_require__(3);

var _adapt2 = _interopRequireDefault(_adapt);

var _match = __webpack_require__(5);

var _match2 = _interopRequireDefault(_match);

var _optimize = __webpack_require__(2);

var _optimize2 = _interopRequireDefault(_optimize);

var _utilities = __webpack_require__(0);

var _common = __webpack_require__(1);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Get a selector for the provided element
 *
 * @param  {HTMLElement} element - [description]
 * @param  {Object}      options - [description]
 * @return {string}              - [description]
 */
function getSingleSelector(element) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};


  if (element.nodeType === 3) {
    element = element.parentNode;
  }

  if (element.nodeType !== 1) {
    throw new Error('Invalid input - only HTMLElements or representations of them are supported! (not "' + (typeof element === 'undefined' ? 'undefined' : _typeof(element)) + '")');
  }

  var globalModified = (0, _adapt2.default)(element, options);

  var selector = (0, _match2.default)(element, options);
  var optimized = (0, _optimize2.default)(selector, element, options);

  // debug
  // console.log(`
  //   selector:  ${selector}
  //   optimized: ${optimized}
  // `)

  if (globalModified) {
    delete true;
  }

  return optimized;
}

/**
 * Get a selector to match multiple descendants from an ancestor
 *
 * @param  {Array.<HTMLElement>|NodeList} elements - [description]
 * @param  {Object}                       options  - [description]
 * @return {string}                                - [description]
 */
function getMultiSelector(elements) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};


  if (!Array.isArray(elements)) {
    elements = (0, _utilities.convertNodeList)(elements);
  }

  if (elements.some(function (element) {
    return element.nodeType !== 1;
  })) {
    throw new Error('Invalid input - only an Array of HTMLElements or representations of them is supported!');
  }

  var globalModified = (0, _adapt2.default)(elements[0], options);

  var ancestor = (0, _common.getCommonAncestor)(elements, options);
  var ancestorSelector = getSingleSelector(ancestor, options);

  // TODO: consider usage of multiple selectors + parent-child relation + check for part redundancy
  var commonSelectors = getCommonSelectors(elements);
  var descendantSelector = commonSelectors[0];

  var selector = (0, _optimize2.default)(ancestorSelector + ' ' + descendantSelector, elements, options);
  var selectorMatches = (0, _utilities.convertNodeList)(document.querySelectorAll(selector));

  if (!elements.every(function (element) {
    return selectorMatches.some(function (entry) {
      return entry === element;
    });
  })) {
    // TODO: cluster matches to split into similar groups for sub selections
    return console.warn('\n      The selected elements can\'t be efficiently mapped.\n      Its probably best to use multiple single selectors instead!\n    ', elements);
  }

  if (globalModified) {
    delete true;
  }

  return selector;
}

/**
 * Get selectors to describe a set of elements
 *
 * @param  {Array.<HTMLElements>} elements - [description]
 * @return {string}                        - [description]
 */
function getCommonSelectors(elements) {
  var _getCommonProperties = (0, _common.getCommonProperties)(elements),
      classes = _getCommonProperties.classes,
      attributes = _getCommonProperties.attributes,
      tag = _getCommonProperties.tag;

  var selectorPath = [];

  if (tag) {
    selectorPath.push(tag);
  }

  if (classes) {
    var classSelector = classes.map(function (name) {
      return '.' + name;
    }).join('');
    selectorPath.push(classSelector);
  }

  if (attributes) {
    var attributeSelector = Object.keys(attributes).reduce(function (parts, name) {
      parts.push('[' + name + '="' + attributes[name] + '"]');
      return parts;
    }, []).join('');
    selectorPath.push(attributeSelector);
  }

  if (selectorPath.length) {
    // TODO: check for parent-child relation
  }

  return [selectorPath.join('')];
}

/**
 * Choose action depending on the input (multiple/single)
 *
 * NOTE: extended detection is used for special cases like the <select> element with <options>
 *
 * @param  {HTMLElement|NodeList|Array.<HTMLElement>} input   - [description]
 * @param  {Object}                                   options - [description]
 * @return {string}                                           - [description]
 */
function getQuerySelector(input) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  if (input.length && !input.name) {
    return getMultiSelector(input, options);
  }
  return getSingleSelector(input, options);
}

/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = match;

var _utilities = __webpack_require__(0);

var defaultIgnore = {
  attribute: function attribute(attributeName) {
    return ['style', 'data-reactid', 'data-react-checksum'].indexOf(attributeName) > -1;
  }
};

/**
 * Get the path of the element
 *
 * @param  {HTMLElement} node    - [description]
 * @param  {Object}      options - [description]
 * @return {string}              - [description]
 */
/**
 * # Match
 *
 * Retrieve selector for a node.
 */

function match(node, options) {
  var _options$root = options.root,
      root = _options$root === undefined ? document : _options$root,
      _options$skip = options.skip,
      skip = _options$skip === undefined ? null : _options$skip,
      _options$priority = options.priority,
      priority = _options$priority === undefined ? ['id', 'class', 'href', 'src'] : _options$priority,
      _options$ignore = options.ignore,
      ignore = _options$ignore === undefined ? {} : _options$ignore;


  var path = [];
  var element = node;
  var length = path.length;
  var ignoreClass = false;

  var skipCompare = skip && (Array.isArray(skip) ? skip : [skip]).map(function (entry) {
    if (typeof entry !== 'function') {
      return function (element) {
        return element === entry;
      };
    }
    return entry;
  });

  var skipChecks = function skipChecks(element) {
    return skip && skipCompare.some(function (compare) {
      return compare(element);
    });
  };

  Object.keys(ignore).forEach(function (type) {
    if (type === 'class') {
      ignoreClass = true;
    }
    var predicate = ignore[type];
    if (typeof predicate === 'function') return;
    if (typeof predicate === 'number') {
      predicate = predicate.toString();
    }
    if (typeof predicate === 'string') {
      predicate = new RegExp((0, _utilities.escapeValue)(predicate).replace(/\\/g, '\\\\'));
    }
    if (typeof predicate === 'boolean') {
      predicate = predicate ? /(?:)/ : /.^/;
    }
    // check class-/attributename for regex
    ignore[type] = function (name, value) {
      return predicate.test(value);
    };
  });

  if (ignoreClass) {
    (function () {
      var ignoreAttribute = ignore.attribute;
      ignore.attribute = function (name, value, defaultPredicate) {
        return ignore.class(value) || ignoreAttribute && ignoreAttribute(name, value, defaultPredicate);
      };
    })();
  }

  while (element !== root) {
    if (skipChecks(element) !== true) {
      // ~ global
      if (checkAttributes(priority, element, ignore, path, root)) break;
      if (checkTag(element, ignore, path, root)) break;

      // ~ local
      checkAttributes(priority, element, ignore, path);
      if (path.length === length) {
        checkTag(element, ignore, path);
      }

      // define only one part each iteration
      if (path.length === length) {
        checkChilds(priority, element, ignore, path);
      }
    }

    element = element.parentNode;
    length = path.length;
  }

  if (element === root) {
    var pattern = findPattern(priority, element, ignore);
    path.unshift(pattern);
  }

  return path.join(' ');
}

/**
 * Extend path with attribute identifier
 *
 * @param  {Array.<string>} priority - [description]
 * @param  {HTMLElement}    element  - [description]
 * @param  {Object}         ignore   - [description]
 * @param  {Array.<string>} path     - [description]
 * @param  {HTMLElement}    parent   - [description]
 * @return {boolean}                 - [description]
 */
function checkAttributes(priority, element, ignore, path) {
  var parent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : element.parentNode;

  var pattern = findAttributesPattern(priority, element, ignore);
  if (pattern) {
    var matches = parent.querySelectorAll(pattern);
    if (matches.length === 1) {
      path.unshift(pattern);
      return true;
    }
  }
  return false;
}

/**
 * Lookup attribute identifier
 *
 * @param  {Array.<string>} priority - [description]
 * @param  {HTMLElement}    element  - [description]
 * @param  {Object}         ignore   - [description]
 * @return {string?}                 - [description]
 */
function findAttributesPattern(priority, element, ignore) {
  var attributes = element.attributes;
  var sortedKeys = Object.keys(attributes).sort(function (curr, next) {
    var currPos = priority.indexOf(attributes[curr].name);
    var nextPos = priority.indexOf(attributes[next].name);
    if (nextPos === -1) {
      if (currPos === -1) {
        return 0;
      }
      return -1;
    }
    return currPos - nextPos;
  });

  for (var i = 0, l = sortedKeys.length; i < l; i++) {
    var key = sortedKeys[i];
    var attribute = attributes[key];
    var attributeName = attribute.name;
    var attributeValue = (0, _utilities.escapeValue)(attribute.value);

    var currentIgnore = ignore[attributeName] || ignore.attribute;
    var currentDefaultIgnore = defaultIgnore[attributeName] || defaultIgnore.attribute;
    if (checkIgnore(currentIgnore, attributeName, attributeValue, currentDefaultIgnore)) {
      continue;
    }

    var pattern = '[' + attributeName + '="' + attributeValue + '"]';

    if (/\b\d/.test(attributeValue) === false) {
      if (attributeName === 'id') {
        pattern = '#' + attributeValue;
      }

      if (attributeName === 'class') {
        var className = attributeValue.trim().replace(/\s+/g, '.');
        pattern = '.' + className;
      }
    }

    return pattern;
  }
  return null;
}

/**
 * Extend path with tag identifier
 *
 * @param  {HTMLElement}    element - [description]
 * @param  {Object}         ignore  - [description]
 * @param  {Array.<string>} path    - [description]
 * @param  {HTMLElement}    parent  - [description]
 * @return {boolean}                - [description]
 */
function checkTag(element, ignore, path) {
  var parent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : element.parentNode;

  var pattern = findTagPattern(element, ignore);
  if (pattern) {
    var matches = parent.getElementsByTagName(pattern);
    if (matches.length === 1) {
      path.unshift(pattern);
      return true;
    }
  }
  return false;
}

/**
 * Lookup tag identifier
 *
 * @param  {HTMLElement} element - [description]
 * @param  {Object}      ignore  - [description]
 * @return {boolean}             - [description]
 */
function findTagPattern(element, ignore) {
  var tagName = element.tagName.toLowerCase();
  if (checkIgnore(ignore.tag, null, tagName)) {
    return null;
  }
  return tagName;
}

/**
 * Extend path with specific child identifier
 *
 * NOTE: 'childTags' is a custom property to use as a view filter for tags using 'adapter.js'
 *
 * @param  {Array.<string>} priority - [description]
 * @param  {HTMLElement}    element  - [description]
 * @param  {Object}         ignore   - [description]
 * @param  {Array.<string>} path     - [description]
 * @return {boolean}                 - [description]
 */
function checkChilds(priority, element, ignore, path) {
  var parent = element.parentNode;
  var children = parent.childTags || parent.children;
  for (var i = 0, l = children.length; i < l; i++) {
    var child = children[i];
    if (child === element) {
      var childPattern = findPattern(priority, child, ignore);
      if (!childPattern) {
        return console.warn('\n          Element couldn\'t be matched through strict ignore pattern!\n        ', child, ignore, childPattern);
      }
      var pattern = '> ' + childPattern + ':nth-child(' + (i + 1) + ')';
      path.unshift(pattern);
      return true;
    }
  }
  return false;
}

/**
 * Lookup identifier
 *
 * @param  {Array.<string>} priority - [description]
 * @param  {HTMLElement}    element  - [description]
 * @param  {Object}         ignore   - [description]
 * @return {string}                  - [description]
 */
function findPattern(priority, element, ignore) {
  var pattern = findAttributesPattern(priority, element, ignore);
  if (!pattern) {
    pattern = findTagPattern(element, ignore);
  }
  return pattern;
}

/**
 * Validate with custom and default functions
 *
 * @param  {Function} predicate        - [description]
 * @param  {string?}  name             - [description]
 * @param  {string}   value            - [description]
 * @param  {Function} defaultPredicate - [description]
 * @return {boolean}                   - [description]
 */
function checkIgnore(predicate, name, value, defaultPredicate) {
  if (!value) {
    return true;
  }
  var check = predicate || defaultPredicate;
  if (!check) {
    return false;
  }
  return check(name, value, defaultPredicate);
}
module.exports = exports['default'];

/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.common = exports.optimize = exports.getMultiSelector = exports.getSingleSelector = exports.select = undefined;

var _select2 = __webpack_require__(4);

Object.defineProperty(exports, 'getSingleSelector', {
  enumerable: true,
  get: function get() {
    return _select2.getSingleSelector;
  }
});
Object.defineProperty(exports, 'getMultiSelector', {
  enumerable: true,
  get: function get() {
    return _select2.getMultiSelector;
  }
});

var _select3 = _interopRequireDefault(_select2);

var _optimize2 = __webpack_require__(2);

var _optimize3 = _interopRequireDefault(_optimize2);

var _common2 = __webpack_require__(1);

var _common = _interopRequireWildcard(_common2);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.select = _select3.default;
exports.optimize = _optimize3.default;
exports.common = _common;
exports.default = _select3.default;

/***/ }
/******/ ]);
});

/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
(function(window, document, exportName, undefined) {
  'use strict';

var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
var TEST_ELEMENT = document.createElement('div');

var TYPE_FUNCTION = 'function';

var round = Math.round;
var abs = Math.abs;
var now = Date.now;

/**
 * set a timeout with a given scope
 * @param {Function} fn
 * @param {Number} timeout
 * @param {Object} context
 * @returns {number}
 */
function setTimeoutContext(fn, timeout, context) {
    return setTimeout(bindFn(fn, context), timeout);
}

/**
 * if the argument is an array, we want to execute the fn on each entry
 * if it aint an array we don't want to do a thing.
 * this is used by all the methods that accept a single and array argument.
 * @param {*|Array} arg
 * @param {String} fn
 * @param {Object} [context]
 * @returns {Boolean}
 */
function invokeArrayArg(arg, fn, context) {
    if (Array.isArray(arg)) {
        each(arg, context[fn], context);
        return true;
    }
    return false;
}

/**
 * walk objects and arrays
 * @param {Object} obj
 * @param {Function} iterator
 * @param {Object} context
 */
function each(obj, iterator, context) {
    var i;

    if (!obj) {
        return;
    }

    if (obj.forEach) {
        obj.forEach(iterator, context);
    } else if (obj.length !== undefined) {
        i = 0;
        while (i < obj.length) {
            iterator.call(context, obj[i], i, obj);
            i++;
        }
    } else {
        for (i in obj) {
            obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
        }
    }
}

/**
 * wrap a method with a deprecation warning and stack trace
 * @param {Function} method
 * @param {String} name
 * @param {String} message
 * @returns {Function} A new function wrapping the supplied method.
 */
function deprecate(method, name, message) {
    var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
    return function() {
        var e = new Error('get-stack-trace');
        var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
            .replace(/^\s+at\s+/gm, '')
            .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';

        var log = window.console && (window.console.warn || window.console.log);
        if (log) {
            log.call(window.console, deprecationMessage, stack);
        }
        return method.apply(this, arguments);
    };
}

/**
 * extend object.
 * means that properties in dest will be overwritten by the ones in src.
 * @param {Object} target
 * @param {...Object} objects_to_assign
 * @returns {Object} target
 */
var assign;
if (typeof Object.assign !== 'function') {
    assign = function assign(target) {
        if (target === undefined || target === null) {
            throw new TypeError('Cannot convert undefined or null to object');
        }

        var output = Object(target);
        for (var index = 1; index < arguments.length; index++) {
            var source = arguments[index];
            if (source !== undefined && source !== null) {
                for (var nextKey in source) {
                    if (source.hasOwnProperty(nextKey)) {
                        output[nextKey] = source[nextKey];
                    }
                }
            }
        }
        return output;
    };
} else {
    assign = Object.assign;
}

/**
 * extend object.
 * means that properties in dest will be overwritten by the ones in src.
 * @param {Object} dest
 * @param {Object} src
 * @param {Boolean} [merge=false]
 * @returns {Object} dest
 */
var extend = deprecate(function extend(dest, src, merge) {
    var keys = Object.keys(src);
    var i = 0;
    while (i < keys.length) {
        if (!merge || (merge && dest[keys[i]] === undefined)) {
            dest[keys[i]] = src[keys[i]];
        }
        i++;
    }
    return dest;
}, 'extend', 'Use `assign`.');

/**
 * merge the values from src in the dest.
 * means that properties that exist in dest will not be overwritten by src
 * @param {Object} dest
 * @param {Object} src
 * @returns {Object} dest
 */
var merge = deprecate(function merge(dest, src) {
    return extend(dest, src, true);
}, 'merge', 'Use `assign`.');

/**
 * simple class inheritance
 * @param {Function} child
 * @param {Function} base
 * @param {Object} [properties]
 */
function inherit(child, base, properties) {
    var baseP = base.prototype,
        childP;

    childP = child.prototype = Object.create(baseP);
    childP.constructor = child;
    childP._super = baseP;

    if (properties) {
        assign(childP, properties);
    }
}

/**
 * simple function bind
 * @param {Function} fn
 * @param {Object} context
 * @returns {Function}
 */
function bindFn(fn, context) {
    return function boundFn() {
        return fn.apply(context, arguments);
    };
}

/**
 * let a boolean value also be a function that must return a boolean
 * this first item in args will be used as the context
 * @param {Boolean|Function} val
 * @param {Array} [args]
 * @returns {Boolean}
 */
function boolOrFn(val, args) {
    if (typeof val == TYPE_FUNCTION) {
        return val.apply(args ? args[0] || undefined : undefined, args);
    }
    return val;
}

/**
 * use the val2 when val1 is undefined
 * @param {*} val1
 * @param {*} val2
 * @returns {*}
 */
function ifUndefined(val1, val2) {
    return (val1 === undefined) ? val2 : val1;
}

/**
 * addEventListener with multiple events at once
 * @param {EventTarget} target
 * @param {String} types
 * @param {Function} handler
 */
function addEventListeners(target, types, handler) {
    each(splitStr(types), function(type) {
        target.addEventListener(type, handler, false);
    });
}

/**
 * removeEventListener with multiple events at once
 * @param {EventTarget} target
 * @param {String} types
 * @param {Function} handler
 */
function removeEventListeners(target, types, handler) {
    each(splitStr(types), function(type) {
        target.removeEventListener(type, handler, false);
    });
}

/**
 * find if a node is in the given parent
 * @method hasParent
 * @param {HTMLElement} node
 * @param {HTMLElement} parent
 * @return {Boolean} found
 */
function hasParent(node, parent) {
    while (node) {
        if (node == parent) {
            return true;
        }
        node = node.parentNode;
    }
    return false;
}

/**
 * small indexOf wrapper
 * @param {String} str
 * @param {String} find
 * @returns {Boolean} found
 */
function inStr(str, find) {
    return str.indexOf(find) > -1;
}

/**
 * split string on whitespace
 * @param {String} str
 * @returns {Array} words
 */
function splitStr(str) {
    return str.trim().split(/\s+/g);
}

/**
 * find if a array contains the object using indexOf or a simple polyFill
 * @param {Array} src
 * @param {String} find
 * @param {String} [findByKey]
 * @return {Boolean|Number} false when not found, or the index
 */
function inArray(src, find, findByKey) {
    if (src.indexOf && !findByKey) {
        return src.indexOf(find);
    } else {
        var i = 0;
        while (i < src.length) {
            if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
                return i;
            }
            i++;
        }
        return -1;
    }
}

/**
 * convert array-like objects to real arrays
 * @param {Object} obj
 * @returns {Array}
 */
function toArray(obj) {
    return Array.prototype.slice.call(obj, 0);
}

/**
 * unique array with objects based on a key (like 'id') or just by the array's value
 * @param {Array} src [{id:1},{id:2},{id:1}]
 * @param {String} [key]
 * @param {Boolean} [sort=False]
 * @returns {Array} [{id:1},{id:2}]
 */
function uniqueArray(src, key, sort) {
    var results = [];
    var values = [];
    var i = 0;

    while (i < src.length) {
        var val = key ? src[i][key] : src[i];
        if (inArray(values, val) < 0) {
            results.push(src[i]);
        }
        values[i] = val;
        i++;
    }

    if (sort) {
        if (!key) {
            results = results.sort();
        } else {
            results = results.sort(function sortUniqueArray(a, b) {
                return a[key] > b[key];
            });
        }
    }

    return results;
}

/**
 * get the prefixed property
 * @param {Object} obj
 * @param {String} property
 * @returns {String|Undefined} prefixed
 */
function prefixed(obj, property) {
    var prefix, prop;
    var camelProp = property[0].toUpperCase() + property.slice(1);

    var i = 0;
    while (i < VENDOR_PREFIXES.length) {
        prefix = VENDOR_PREFIXES[i];
        prop = (prefix) ? prefix + camelProp : property;

        if (prop in obj) {
            return prop;
        }
        i++;
    }
    return undefined;
}

/**
 * get a unique id
 * @returns {number} uniqueId
 */
var _uniqueId = 1;
function uniqueId() {
    return _uniqueId++;
}

/**
 * get the window object of an element
 * @param {HTMLElement} element
 * @returns {DocumentView|Window}
 */
function getWindowForElement(element) {
    var doc = element.ownerDocument || element;
    return (doc.defaultView || doc.parentWindow || window);
}

var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;

var SUPPORT_TOUCH = ('ontouchstart' in window);
var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);

var INPUT_TYPE_TOUCH = 'touch';
var INPUT_TYPE_PEN = 'pen';
var INPUT_TYPE_MOUSE = 'mouse';
var INPUT_TYPE_KINECT = 'kinect';

var COMPUTE_INTERVAL = 25;

var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;

var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;

var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;

var PROPS_XY = ['x', 'y'];
var PROPS_CLIENT_XY = ['clientX', 'clientY'];

/**
 * create new input type manager
 * @param {Manager} manager
 * @param {Function} callback
 * @returns {Input}
 * @constructor
 */
function Input(manager, callback) {
    var self = this;
    this.manager = manager;
    this.callback = callback;
    this.element = manager.element;
    this.target = manager.options.inputTarget;

    // smaller wrapper around the handler, for the scope and the enabled state of the manager,
    // so when disabled the input events are completely bypassed.
    this.domHandler = function(ev) {
        if (boolOrFn(manager.options.enable, [manager])) {
            self.handler(ev);
        }
    };

    this.init();

}

Input.prototype = {
    /**
     * should handle the inputEvent data and trigger the callback
     * @virtual
     */
    handler: function() { },

    /**
     * bind the events
     */
    init: function() {
        this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
        this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
        this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    },

    /**
     * unbind the events
     */
    destroy: function() {
        this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
        this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
        this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    }
};

/**
 * create new input type manager
 * called by the Manager constructor
 * @param {Hammer} manager
 * @returns {Input}
 */
function createInputInstance(manager) {
    var Type;
    var inputClass = manager.options.inputClass;

    if (inputClass) {
        Type = inputClass;
    } else if (SUPPORT_POINTER_EVENTS) {
        Type = PointerEventInput;
    } else if (SUPPORT_ONLY_TOUCH) {
        Type = TouchInput;
    } else if (!SUPPORT_TOUCH) {
        Type = MouseInput;
    } else {
        Type = TouchMouseInput;
    }
    return new (Type)(manager, inputHandler);
}

/**
 * handle input events
 * @param {Manager} manager
 * @param {String} eventType
 * @param {Object} input
 */
function inputHandler(manager, eventType, input) {
    var pointersLen = input.pointers.length;
    var changedPointersLen = input.changedPointers.length;
    var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
    var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));

    input.isFirst = !!isFirst;
    input.isFinal = !!isFinal;

    if (isFirst) {
        manager.session = {};
    }

    // source event is the normalized value of the domEvents
    // like 'touchstart, mouseup, pointerdown'
    input.eventType = eventType;

    // compute scale, rotation etc
    computeInputData(manager, input);

    // emit secret event
    manager.emit('hammer.input', input);

    manager.recognize(input);
    manager.session.prevInput = input;
}

/**
 * extend the data with some usable properties like scale, rotate, velocity etc
 * @param {Object} manager
 * @param {Object} input
 */
function computeInputData(manager, input) {
    var session = manager.session;
    var pointers = input.pointers;
    var pointersLength = pointers.length;

    // store the first input to calculate the distance and direction
    if (!session.firstInput) {
        session.firstInput = simpleCloneInputData(input);
    }

    // to compute scale and rotation we need to store the multiple touches
    if (pointersLength > 1 && !session.firstMultiple) {
        session.firstMultiple = simpleCloneInputData(input);
    } else if (pointersLength === 1) {
        session.firstMultiple = false;
    }

    var firstInput = session.firstInput;
    var firstMultiple = session.firstMultiple;
    var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;

    var center = input.center = getCenter(pointers);
    input.timeStamp = now();
    input.deltaTime = input.timeStamp - firstInput.timeStamp;

    input.angle = getAngle(offsetCenter, center);
    input.distance = getDistance(offsetCenter, center);

    computeDeltaXY(session, input);
    input.offsetDirection = getDirection(input.deltaX, input.deltaY);

    var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
    input.overallVelocityX = overallVelocity.x;
    input.overallVelocityY = overallVelocity.y;
    input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;

    input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
    input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;

    input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
        session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);

    computeIntervalInputData(session, input);

    // find the correct target
    var target = manager.element;
    if (hasParent(input.srcEvent.target, target)) {
        target = input.srcEvent.target;
    }
    input.target = target;
}

function computeDeltaXY(session, input) {
    var center = input.center;
    var offset = session.offsetDelta || {};
    var prevDelta = session.prevDelta || {};
    var prevInput = session.prevInput || {};

    if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
        prevDelta = session.prevDelta = {
            x: prevInput.deltaX || 0,
            y: prevInput.deltaY || 0
        };

        offset = session.offsetDelta = {
            x: center.x,
            y: center.y
        };
    }

    input.deltaX = prevDelta.x + (center.x - offset.x);
    input.deltaY = prevDelta.y + (center.y - offset.y);
}

/**
 * velocity is calculated every x ms
 * @param {Object} session
 * @param {Object} input
 */
function computeIntervalInputData(session, input) {
    var last = session.lastInterval || input,
        deltaTime = input.timeStamp - last.timeStamp,
        velocity, velocityX, velocityY, direction;

    if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
        var deltaX = input.deltaX - last.deltaX;
        var deltaY = input.deltaY - last.deltaY;

        var v = getVelocity(deltaTime, deltaX, deltaY);
        velocityX = v.x;
        velocityY = v.y;
        velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
        direction = getDirection(deltaX, deltaY);

        session.lastInterval = input;
    } else {
        // use latest velocity info if it doesn't overtake a minimum period
        velocity = last.velocity;
        velocityX = last.velocityX;
        velocityY = last.velocityY;
        direction = last.direction;
    }

    input.velocity = velocity;
    input.velocityX = velocityX;
    input.velocityY = velocityY;
    input.direction = direction;
}

/**
 * create a simple clone from the input used for storage of firstInput and firstMultiple
 * @param {Object} input
 * @returns {Object} clonedInputData
 */
function simpleCloneInputData(input) {
    // make a simple copy of the pointers because we will get a reference if we don't
    // we only need clientXY for the calculations
    var pointers = [];
    var i = 0;
    while (i < input.pointers.length) {
        pointers[i] = {
            clientX: round(input.pointers[i].clientX),
            clientY: round(input.pointers[i].clientY)
        };
        i++;
    }

    return {
        timeStamp: now(),
        pointers: pointers,
        center: getCenter(pointers),
        deltaX: input.deltaX,
        deltaY: input.deltaY
    };
}

/**
 * get the center of all the pointers
 * @param {Array} pointers
 * @return {Object} center contains `x` and `y` properties
 */
function getCenter(pointers) {
    var pointersLength = pointers.length;

    // no need to loop when only one touch
    if (pointersLength === 1) {
        return {
            x: round(pointers[0].clientX),
            y: round(pointers[0].clientY)
        };
    }

    var x = 0, y = 0, i = 0;
    while (i < pointersLength) {
        x += pointers[i].clientX;
        y += pointers[i].clientY;
        i++;
    }

    return {
        x: round(x / pointersLength),
        y: round(y / pointersLength)
    };
}

/**
 * calculate the velocity between two points. unit is in px per ms.
 * @param {Number} deltaTime
 * @param {Number} x
 * @param {Number} y
 * @return {Object} velocity `x` and `y`
 */
function getVelocity(deltaTime, x, y) {
    return {
        x: x / deltaTime || 0,
        y: y / deltaTime || 0
    };
}

/**
 * get the direction between two points
 * @param {Number} x
 * @param {Number} y
 * @return {Number} direction
 */
function getDirection(x, y) {
    if (x === y) {
        return DIRECTION_NONE;
    }

    if (abs(x) >= abs(y)) {
        return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
    }
    return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}

/**
 * calculate the absolute distance between two points
 * @param {Object} p1 {x, y}
 * @param {Object} p2 {x, y}
 * @param {Array} [props] containing x and y keys
 * @return {Number} distance
 */
function getDistance(p1, p2, props) {
    if (!props) {
        props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];

    return Math.sqrt((x * x) + (y * y));
}

/**
 * calculate the angle between two coordinates
 * @param {Object} p1
 * @param {Object} p2
 * @param {Array} [props] containing x and y keys
 * @return {Number} angle
 */
function getAngle(p1, p2, props) {
    if (!props) {
        props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];
    return Math.atan2(y, x) * 180 / Math.PI;
}

/**
 * calculate the rotation degrees between two pointersets
 * @param {Array} start array of pointers
 * @param {Array} end array of pointers
 * @return {Number} rotation
 */
function getRotation(start, end) {
    return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
}

/**
 * calculate the scale factor between two pointersets
 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
 * @param {Array} start array of pointers
 * @param {Array} end array of pointers
 * @return {Number} scale
 */
function getScale(start, end) {
    return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}

var MOUSE_INPUT_MAP = {
    mousedown: INPUT_START,
    mousemove: INPUT_MOVE,
    mouseup: INPUT_END
};

var MOUSE_ELEMENT_EVENTS = 'mousedown';
var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';

/**
 * Mouse events input
 * @constructor
 * @extends Input
 */
function MouseInput() {
    this.evEl = MOUSE_ELEMENT_EVENTS;
    this.evWin = MOUSE_WINDOW_EVENTS;

    this.pressed = false; // mousedown state

    Input.apply(this, arguments);
}

inherit(MouseInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function MEhandler(ev) {
        var eventType = MOUSE_INPUT_MAP[ev.type];

        // on start we want to have the left mouse button down
        if (eventType & INPUT_START && ev.button === 0) {
            this.pressed = true;
        }

        if (eventType & INPUT_MOVE && ev.which !== 1) {
            eventType = INPUT_END;
        }

        // mouse must be down
        if (!this.pressed) {
            return;
        }

        if (eventType & INPUT_END) {
            this.pressed = false;
        }

        this.callback(this.manager, eventType, {
            pointers: [ev],
            changedPointers: [ev],
            pointerType: INPUT_TYPE_MOUSE,
            srcEvent: ev
        });
    }
});

var POINTER_INPUT_MAP = {
    pointerdown: INPUT_START,
    pointermove: INPUT_MOVE,
    pointerup: INPUT_END,
    pointercancel: INPUT_CANCEL,
    pointerout: INPUT_CANCEL
};

// in IE10 the pointer types is defined as an enum
var IE10_POINTER_TYPE_ENUM = {
    2: INPUT_TYPE_TOUCH,
    3: INPUT_TYPE_PEN,
    4: INPUT_TYPE_MOUSE,
    5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
};

var POINTER_ELEMENT_EVENTS = 'pointerdown';
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';

// IE10 has prefixed support, and case-sensitive
if (window.MSPointerEvent && !window.PointerEvent) {
    POINTER_ELEMENT_EVENTS = 'MSPointerDown';
    POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
}

/**
 * Pointer events input
 * @constructor
 * @extends Input
 */
function PointerEventInput() {
    this.evEl = POINTER_ELEMENT_EVENTS;
    this.evWin = POINTER_WINDOW_EVENTS;

    Input.apply(this, arguments);

    this.store = (this.manager.session.pointerEvents = []);
}

inherit(PointerEventInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function PEhandler(ev) {
        var store = this.store;
        var removePointer = false;

        var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
        var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
        var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;

        var isTouch = (pointerType == INPUT_TYPE_TOUCH);

        // get index of the event in the store
        var storeIndex = inArray(store, ev.pointerId, 'pointerId');

        // start and mouse must be down
        if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
            if (storeIndex < 0) {
                store.push(ev);
                storeIndex = store.length - 1;
            }
        } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
            removePointer = true;
        }

        // it not found, so the pointer hasn't been down (so it's probably a hover)
        if (storeIndex < 0) {
            return;
        }

        // update the event in the store
        store[storeIndex] = ev;

        this.callback(this.manager, eventType, {
            pointers: store,
            changedPointers: [ev],
            pointerType: pointerType,
            srcEvent: ev
        });

        if (removePointer) {
            // remove from the store
            store.splice(storeIndex, 1);
        }
    }
});

var SINGLE_TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
};

var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';

/**
 * Touch events input
 * @constructor
 * @extends Input
 */
function SingleTouchInput() {
    this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
    this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
    this.started = false;

    Input.apply(this, arguments);
}

inherit(SingleTouchInput, Input, {
    handler: function TEhandler(ev) {
        var type = SINGLE_TOUCH_INPUT_MAP[ev.type];

        // should we handle the touch events?
        if (type === INPUT_START) {
            this.started = true;
        }

        if (!this.started) {
            return;
        }

        var touches = normalizeSingleTouches.call(this, ev, type);

        // when done, reset the started state
        if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
            this.started = false;
        }

        this.callback(this.manager, type, {
            pointers: touches[0],
            changedPointers: touches[1],
            pointerType: INPUT_TYPE_TOUCH,
            srcEvent: ev
        });
    }
});

/**
 * @this {TouchInput}
 * @param {Object} ev
 * @param {Number} type flag
 * @returns {undefined|Array} [all, changed]
 */
function normalizeSingleTouches(ev, type) {
    var all = toArray(ev.touches);
    var changed = toArray(ev.changedTouches);

    if (type & (INPUT_END | INPUT_CANCEL)) {
        all = uniqueArray(all.concat(changed), 'identifier', true);
    }

    return [all, changed];
}

var TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
};

var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';

/**
 * Multi-user touch events input
 * @constructor
 * @extends Input
 */
function TouchInput() {
    this.evTarget = TOUCH_TARGET_EVENTS;
    this.targetIds = {};

    Input.apply(this, arguments);
}

inherit(TouchInput, Input, {
    handler: function MTEhandler(ev) {
        var type = TOUCH_INPUT_MAP[ev.type];
        var touches = getTouches.call(this, ev, type);
        if (!touches) {
            return;
        }

        this.callback(this.manager, type, {
            pointers: touches[0],
            changedPointers: touches[1],
            pointerType: INPUT_TYPE_TOUCH,
            srcEvent: ev
        });
    }
});

/**
 * @this {TouchInput}
 * @param {Object} ev
 * @param {Number} type flag
 * @returns {undefined|Array} [all, changed]
 */
function getTouches(ev, type) {
    var allTouches = toArray(ev.touches);
    var targetIds = this.targetIds;

    // when there is only one touch, the process can be simplified
    if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
        targetIds[allTouches[0].identifier] = true;
        return [allTouches, allTouches];
    }

    var i,
        targetTouches,
        changedTouches = toArray(ev.changedTouches),
        changedTargetTouches = [],
        target = this.target;

    // get target touches from touches
    targetTouches = allTouches.filter(function(touch) {
        return hasParent(touch.target, target);
    });

    // collect touches
    if (type === INPUT_START) {
        i = 0;
        while (i < targetTouches.length) {
            targetIds[targetTouches[i].identifier] = true;
            i++;
        }
    }

    // filter changed touches to only contain touches that exist in the collected target ids
    i = 0;
    while (i < changedTouches.length) {
        if (targetIds[changedTouches[i].identifier]) {
            changedTargetTouches.push(changedTouches[i]);
        }

        // cleanup removed touches
        if (type & (INPUT_END | INPUT_CANCEL)) {
            delete targetIds[changedTouches[i].identifier];
        }
        i++;
    }

    if (!changedTargetTouches.length) {
        return;
    }

    return [
        // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
        uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
        changedTargetTouches
    ];
}

/**
 * Combined touch and mouse input
 *
 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
 * This because touch devices also emit mouse events while doing a touch.
 *
 * @constructor
 * @extends Input
 */

var DEDUP_TIMEOUT = 2500;
var DEDUP_DISTANCE = 25;

function TouchMouseInput() {
    Input.apply(this, arguments);

    var handler = bindFn(this.handler, this);
    this.touch = new TouchInput(this.manager, handler);
    this.mouse = new MouseInput(this.manager, handler);

    this.primaryTouch = null;
    this.lastTouches = [];
}

inherit(TouchMouseInput, Input, {
    /**
     * handle mouse and touch events
     * @param {Hammer} manager
     * @param {String} inputEvent
     * @param {Object} inputData
     */
    handler: function TMEhandler(manager, inputEvent, inputData) {
        var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
            isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);

        if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
            return;
        }

        // when we're in a touch event, record touches to  de-dupe synthetic mouse event
        if (isTouch) {
            recordTouches.call(this, inputEvent, inputData);
        } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
            return;
        }

        this.callback(manager, inputEvent, inputData);
    },

    /**
     * remove the event listeners
     */
    destroy: function destroy() {
        this.touch.destroy();
        this.mouse.destroy();
    }
});

function recordTouches(eventType, eventData) {
    if (eventType & INPUT_START) {
        this.primaryTouch = eventData.changedPointers[0].identifier;
        setLastTouch.call(this, eventData);
    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
        setLastTouch.call(this, eventData);
    }
}

function setLastTouch(eventData) {
    var touch = eventData.changedPointers[0];

    if (touch.identifier === this.primaryTouch) {
        var lastTouch = {x: touch.clientX, y: touch.clientY};
        this.lastTouches.push(lastTouch);
        var lts = this.lastTouches;
        var removeLastTouch = function() {
            var i = lts.indexOf(lastTouch);
            if (i > -1) {
                lts.splice(i, 1);
            }
        };
        setTimeout(removeLastTouch, DEDUP_TIMEOUT);
    }
}

function isSyntheticEvent(eventData) {
    var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;
    for (var i = 0; i < this.lastTouches.length; i++) {
        var t = this.lastTouches[i];
        var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
        if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
            return true;
        }
    }
    return false;
}

var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;

// magical touchAction value
var TOUCH_ACTION_COMPUTE = 'compute';
var TOUCH_ACTION_AUTO = 'auto';
var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
var TOUCH_ACTION_NONE = 'none';
var TOUCH_ACTION_PAN_X = 'pan-x';
var TOUCH_ACTION_PAN_Y = 'pan-y';
var TOUCH_ACTION_MAP = getTouchActionProps();

/**
 * Touch Action
 * sets the touchAction property or uses the js alternative
 * @param {Manager} manager
 * @param {String} value
 * @constructor
 */
function TouchAction(manager, value) {
    this.manager = manager;
    this.set(value);
}

TouchAction.prototype = {
    /**
     * set the touchAction value on the element or enable the polyfill
     * @param {String} value
     */
    set: function(value) {
        // find out the touch-action by the event handlers
        if (value == TOUCH_ACTION_COMPUTE) {
            value = this.compute();
        }

        if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
            this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
        }
        this.actions = value.toLowerCase().trim();
    },

    /**
     * just re-set the touchAction value
     */
    update: function() {
        this.set(this.manager.options.touchAction);
    },

    /**
     * compute the value for the touchAction property based on the recognizer's settings
     * @returns {String} value
     */
    compute: function() {
        var actions = [];
        each(this.manager.recognizers, function(recognizer) {
            if (boolOrFn(recognizer.options.enable, [recognizer])) {
                actions = actions.concat(recognizer.getTouchAction());
            }
        });
        return cleanTouchActions(actions.join(' '));
    },

    /**
     * this method is called on each input cycle and provides the preventing of the browser behavior
     * @param {Object} input
     */
    preventDefaults: function(input) {
        var srcEvent = input.srcEvent;
        var direction = input.offsetDirection;

        // if the touch action did prevented once this session
        if (this.manager.session.prevented) {
            srcEvent.preventDefault();
            return;
        }

        var actions = this.actions;
        var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
        var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
        var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];

        if (hasNone) {
            //do not prevent defaults if this is a tap gesture

            var isTapPointer = input.pointers.length === 1;
            var isTapMovement = input.distance < 2;
            var isTapTouchTime = input.deltaTime < 250;

            if (isTapPointer && isTapMovement && isTapTouchTime) {
                return;
            }
        }

        if (hasPanX && hasPanY) {
            // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
            return;
        }

        if (hasNone ||
            (hasPanY && direction & DIRECTION_HORIZONTAL) ||
            (hasPanX && direction & DIRECTION_VERTICAL)) {
            return this.preventSrc(srcEvent);
        }
    },

    /**
     * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
     * @param {Object} srcEvent
     */
    preventSrc: function(srcEvent) {
        this.manager.session.prevented = true;
        srcEvent.preventDefault();
    }
};

/**
 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
 * @param {String} actions
 * @returns {*}
 */
function cleanTouchActions(actions) {
    // none
    if (inStr(actions, TOUCH_ACTION_NONE)) {
        return TOUCH_ACTION_NONE;
    }

    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);

    // if both pan-x and pan-y are set (different recognizers
    // for different directions, e.g. horizontal pan but vertical swipe?)
    // we need none (as otherwise with pan-x pan-y combined none of these
    // recognizers will work, since the browser would handle all panning
    if (hasPanX && hasPanY) {
        return TOUCH_ACTION_NONE;
    }

    // pan-x OR pan-y
    if (hasPanX || hasPanY) {
        return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
    }

    // manipulation
    if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
        return TOUCH_ACTION_MANIPULATION;
    }

    return TOUCH_ACTION_AUTO;
}

function getTouchActionProps() {
    if (!NATIVE_TOUCH_ACTION) {
        return false;
    }
    var touchMap = {};
    var cssSupports = window.CSS && window.CSS.supports;
    ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {

        // If css.supports is not supported but there is native touch-action assume it supports
        // all values. This is the case for IE 10 and 11.
        touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
    });
    return touchMap;
}

/**
 * Recognizer flow explained; *
 * All recognizers have the initial state of POSSIBLE when a input session starts.
 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
 * Example session for mouse-input: mousedown -> mousemove -> mouseup
 *
 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
 * which determines with state it should be.
 *
 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
 * POSSIBLE to give it another change on the next cycle.
 *
 *               Possible
 *                  |
 *            +-----+---------------+
 *            |                     |
 *      +-----+-----+               |
 *      |           |               |
 *   Failed      Cancelled          |
 *                          +-------+------+
 *                          |              |
 *                      Recognized       Began
 *                                         |
 *                                      Changed
 *                                         |
 *                                  Ended/Recognized
 */
var STATE_POSSIBLE = 1;
var STATE_BEGAN = 2;
var STATE_CHANGED = 4;
var STATE_ENDED = 8;
var STATE_RECOGNIZED = STATE_ENDED;
var STATE_CANCELLED = 16;
var STATE_FAILED = 32;

/**
 * Recognizer
 * Every recognizer needs to extend from this class.
 * @constructor
 * @param {Object} options
 */
function Recognizer(options) {
    this.options = assign({}, this.defaults, options || {});

    this.id = uniqueId();

    this.manager = null;

    // default is enable true
    this.options.enable = ifUndefined(this.options.enable, true);

    this.state = STATE_POSSIBLE;

    this.simultaneous = {};
    this.requireFail = [];
}

Recognizer.prototype = {
    /**
     * @virtual
     * @type {Object}
     */
    defaults: {},

    /**
     * set options
     * @param {Object} options
     * @return {Recognizer}
     */
    set: function(options) {
        assign(this.options, options);

        // also update the touchAction, in case something changed about the directions/enabled state
        this.manager && this.manager.touchAction.update();
        return this;
    },

    /**
     * recognize simultaneous with an other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    recognizeWith: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
            return this;
        }

        var simultaneous = this.simultaneous;
        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        if (!simultaneous[otherRecognizer.id]) {
            simultaneous[otherRecognizer.id] = otherRecognizer;
            otherRecognizer.recognizeWith(this);
        }
        return this;
    },

    /**
     * drop the simultaneous link. it doesnt remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRecognizeWith: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
            return this;
        }

        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        delete this.simultaneous[otherRecognizer.id];
        return this;
    },

    /**
     * recognizer can only run when an other is failing
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    requireFailure: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
            return this;
        }

        var requireFail = this.requireFail;
        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        if (inArray(requireFail, otherRecognizer) === -1) {
            requireFail.push(otherRecognizer);
            otherRecognizer.requireFailure(this);
        }
        return this;
    },

    /**
     * drop the requireFailure link. it does not remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRequireFailure: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
            return this;
        }

        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        var index = inArray(this.requireFail, otherRecognizer);
        if (index > -1) {
            this.requireFail.splice(index, 1);
        }
        return this;
    },

    /**
     * has require failures boolean
     * @returns {boolean}
     */
    hasRequireFailures: function() {
        return this.requireFail.length > 0;
    },

    /**
     * if the recognizer can recognize simultaneous with an other recognizer
     * @param {Recognizer} otherRecognizer
     * @returns {Boolean}
     */
    canRecognizeWith: function(otherRecognizer) {
        return !!this.simultaneous[otherRecognizer.id];
    },

    /**
     * You should use `tryEmit` instead of `emit` directly to check
     * that all the needed recognizers has failed before emitting.
     * @param {Object} input
     */
    emit: function(input) {
        var self = this;
        var state = this.state;

        function emit(event) {
            self.manager.emit(event, input);
        }

        // 'panstart' and 'panmove'
        if (state < STATE_ENDED) {
            emit(self.options.event + stateStr(state));
        }

        emit(self.options.event); // simple 'eventName' events

        if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
            emit(input.additionalEvent);
        }

        // panend and pancancel
        if (state >= STATE_ENDED) {
            emit(self.options.event + stateStr(state));
        }
    },

    /**
     * Check that all the require failure recognizers has failed,
     * if true, it emits a gesture event,
     * otherwise, setup the state to FAILED.
     * @param {Object} input
     */
    tryEmit: function(input) {
        if (this.canEmit()) {
            return this.emit(input);
        }
        // it's failing anyway
        this.state = STATE_FAILED;
    },

    /**
     * can we emit?
     * @returns {boolean}
     */
    canEmit: function() {
        var i = 0;
        while (i < this.requireFail.length) {
            if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
                return false;
            }
            i++;
        }
        return true;
    },

    /**
     * update the recognizer
     * @param {Object} inputData
     */
    recognize: function(inputData) {
        // make a new copy of the inputData
        // so we can change the inputData without messing up the other recognizers
        var inputDataClone = assign({}, inputData);

        // is is enabled and allow recognizing?
        if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
            this.reset();
            this.state = STATE_FAILED;
            return;
        }

        // reset when we've reached the end
        if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
            this.state = STATE_POSSIBLE;
        }

        this.state = this.process(inputDataClone);

        // the recognizer has recognized a gesture
        // so trigger an event
        if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
            this.tryEmit(inputDataClone);
        }
    },

    /**
     * return the state of the recognizer
     * the actual recognizing happens in this method
     * @virtual
     * @param {Object} inputData
     * @returns {Const} STATE
     */
    process: function(inputData) { }, // jshint ignore:line

    /**
     * return the preferred touch-action
     * @virtual
     * @returns {Array}
     */
    getTouchAction: function() { },

    /**
     * called when the gesture isn't allowed to recognize
     * like when another is being recognized or it is disabled
     * @virtual
     */
    reset: function() { }
};

/**
 * get a usable string, used as event postfix
 * @param {Const} state
 * @returns {String} state
 */
function stateStr(state) {
    if (state & STATE_CANCELLED) {
        return 'cancel';
    } else if (state & STATE_ENDED) {
        return 'end';
    } else if (state & STATE_CHANGED) {
        return 'move';
    } else if (state & STATE_BEGAN) {
        return 'start';
    }
    return '';
}

/**
 * direction cons to string
 * @param {Const} direction
 * @returns {String}
 */
function directionStr(direction) {
    if (direction == DIRECTION_DOWN) {
        return 'down';
    } else if (direction == DIRECTION_UP) {
        return 'up';
    } else if (direction == DIRECTION_LEFT) {
        return 'left';
    } else if (direction == DIRECTION_RIGHT) {
        return 'right';
    }
    return '';
}

/**
 * get a recognizer by name if it is bound to a manager
 * @param {Recognizer|String} otherRecognizer
 * @param {Recognizer} recognizer
 * @returns {Recognizer}
 */
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
    var manager = recognizer.manager;
    if (manager) {
        return manager.get(otherRecognizer);
    }
    return otherRecognizer;
}

/**
 * This recognizer is just used as a base for the simple attribute recognizers.
 * @constructor
 * @extends Recognizer
 */
function AttrRecognizer() {
    Recognizer.apply(this, arguments);
}

inherit(AttrRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof AttrRecognizer
     */
    defaults: {
        /**
         * @type {Number}
         * @default 1
         */
        pointers: 1
    },

    /**
     * Used to check if it the recognizer receives valid input, like input.distance > 10.
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {Boolean} recognized
     */
    attrTest: function(input) {
        var optionPointers = this.options.pointers;
        return optionPointers === 0 || input.pointers.length === optionPointers;
    },

    /**
     * Process the input and return the state for the recognizer
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {*} State
     */
    process: function(input) {
        var state = this.state;
        var eventType = input.eventType;

        var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
        var isValid = this.attrTest(input);

        // on cancel input and we've recognized before, return STATE_CANCELLED
        if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
            return state | STATE_CANCELLED;
        } else if (isRecognized || isValid) {
            if (eventType & INPUT_END) {
                return state | STATE_ENDED;
            } else if (!(state & STATE_BEGAN)) {
                return STATE_BEGAN;
            }
            return state | STATE_CHANGED;
        }
        return STATE_FAILED;
    }
});

/**
 * Pan
 * Recognized when the pointer is down and moved in the allowed direction.
 * @constructor
 * @extends AttrRecognizer
 */
function PanRecognizer() {
    AttrRecognizer.apply(this, arguments);

    this.pX = null;
    this.pY = null;
}

inherit(PanRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PanRecognizer
     */
    defaults: {
        event: 'pan',
        threshold: 10,
        pointers: 1,
        direction: DIRECTION_ALL
    },

    getTouchAction: function() {
        var direction = this.options.direction;
        var actions = [];
        if (direction & DIRECTION_HORIZONTAL) {
            actions.push(TOUCH_ACTION_PAN_Y);
        }
        if (direction & DIRECTION_VERTICAL) {
            actions.push(TOUCH_ACTION_PAN_X);
        }
        return actions;
    },

    directionTest: function(input) {
        var options = this.options;
        var hasMoved = true;
        var distance = input.distance;
        var direction = input.direction;
        var x = input.deltaX;
        var y = input.deltaY;

        // lock to axis?
        if (!(direction & options.direction)) {
            if (options.direction & DIRECTION_HORIZONTAL) {
                direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
                hasMoved = x != this.pX;
                distance = Math.abs(input.deltaX);
            } else {
                direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
                hasMoved = y != this.pY;
                distance = Math.abs(input.deltaY);
            }
        }
        input.direction = direction;
        return hasMoved && distance > options.threshold && direction & options.direction;
    },

    attrTest: function(input) {
        return AttrRecognizer.prototype.attrTest.call(this, input) &&
            (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
    },

    emit: function(input) {

        this.pX = input.deltaX;
        this.pY = input.deltaY;

        var direction = directionStr(input.direction);

        if (direction) {
            input.additionalEvent = this.options.event + direction;
        }
        this._super.emit.call(this, input);
    }
});

/**
 * Pinch
 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
 * @constructor
 * @extends AttrRecognizer
 */
function PinchRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(PinchRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
        event: 'pinch',
        threshold: 0,
        pointers: 2
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_NONE];
    },

    attrTest: function(input) {
        return this._super.attrTest.call(this, input) &&
            (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
    },

    emit: function(input) {
        if (input.scale !== 1) {
            var inOut = input.scale < 1 ? 'in' : 'out';
            input.additionalEvent = this.options.event + inOut;
        }
        this._super.emit.call(this, input);
    }
});

/**
 * Press
 * Recognized when the pointer is down for x ms without any movement.
 * @constructor
 * @extends Recognizer
 */
function PressRecognizer() {
    Recognizer.apply(this, arguments);

    this._timer = null;
    this._input = null;
}

inherit(PressRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PressRecognizer
     */
    defaults: {
        event: 'press',
        pointers: 1,
        time: 251, // minimal time of the pointer to be pressed
        threshold: 9 // a minimal movement is ok, but keep it low
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_AUTO];
    },

    process: function(input) {
        var options = this.options;
        var validPointers = input.pointers.length === options.pointers;
        var validMovement = input.distance < options.threshold;
        var validTime = input.deltaTime > options.time;

        this._input = input;

        // we only allow little movement
        // and we've reached an end event, so a tap is possible
        if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
            this.reset();
        } else if (input.eventType & INPUT_START) {
            this.reset();
            this._timer = setTimeoutContext(function() {
                this.state = STATE_RECOGNIZED;
                this.tryEmit();
            }, options.time, this);
        } else if (input.eventType & INPUT_END) {
            return STATE_RECOGNIZED;
        }
        return STATE_FAILED;
    },

    reset: function() {
        clearTimeout(this._timer);
    },

    emit: function(input) {
        if (this.state !== STATE_RECOGNIZED) {
            return;
        }

        if (input && (input.eventType & INPUT_END)) {
            this.manager.emit(this.options.event + 'up', input);
        } else {
            this._input.timeStamp = now();
            this.manager.emit(this.options.event, this._input);
        }
    }
});

/**
 * Rotate
 * Recognized when two or more pointer are moving in a circular motion.
 * @constructor
 * @extends AttrRecognizer
 */
function RotateRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(RotateRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof RotateRecognizer
     */
    defaults: {
        event: 'rotate',
        threshold: 0,
        pointers: 2
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_NONE];
    },

    attrTest: function(input) {
        return this._super.attrTest.call(this, input) &&
            (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
    }
});

/**
 * Swipe
 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
 * @constructor
 * @extends AttrRecognizer
 */
function SwipeRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(SwipeRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof SwipeRecognizer
     */
    defaults: {
        event: 'swipe',
        threshold: 10,
        velocity: 0.3,
        direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
        pointers: 1
    },

    getTouchAction: function() {
        return PanRecognizer.prototype.getTouchAction.call(this);
    },

    attrTest: function(input) {
        var direction = this.options.direction;
        var velocity;

        if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
            velocity = input.overallVelocity;
        } else if (direction & DIRECTION_HORIZONTAL) {
            velocity = input.overallVelocityX;
        } else if (direction & DIRECTION_VERTICAL) {
            velocity = input.overallVelocityY;
        }

        return this._super.attrTest.call(this, input) &&
            direction & input.offsetDirection &&
            input.distance > this.options.threshold &&
            input.maxPointers == this.options.pointers &&
            abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
    },

    emit: function(input) {
        var direction = directionStr(input.offsetDirection);
        if (direction) {
            this.manager.emit(this.options.event + direction, input);
        }

        this.manager.emit(this.options.event, input);
    }
});

/**
 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
 * a single tap.
 *
 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
 * multi-taps being recognized.
 * @constructor
 * @extends Recognizer
 */
function TapRecognizer() {
    Recognizer.apply(this, arguments);

    // previous time and center,
    // used for tap counting
    this.pTime = false;
    this.pCenter = false;

    this._timer = null;
    this._input = null;
    this.count = 0;
}

inherit(TapRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
        event: 'tap',
        pointers: 1,
        taps: 1,
        interval: 300, // max time between the multi-tap taps
        time: 250, // max time of the pointer to be down (like finger on the screen)
        threshold: 9, // a minimal movement is ok, but keep it low
        posThreshold: 10 // a multi-tap can be a bit off the initial position
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_MANIPULATION];
    },

    process: function(input) {
        var options = this.options;

        var validPointers = input.pointers.length === options.pointers;
        var validMovement = input.distance < options.threshold;
        var validTouchTime = input.deltaTime < options.time;

        this.reset();

        if ((input.eventType & INPUT_START) && (this.count === 0)) {
            return this.failTimeout();
        }

        // we only allow little movement
        // and we've reached an end event, so a tap is possible
        if (validMovement && validTouchTime && validPointers) {
            if (input.eventType != INPUT_END) {
                return this.failTimeout();
            }

            var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
            var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;

            this.pTime = input.timeStamp;
            this.pCenter = input.center;

            if (!validMultiTap || !validInterval) {
                this.count = 1;
            } else {
                this.count += 1;
            }

            this._input = input;

            // if tap count matches we have recognized it,
            // else it has began recognizing...
            var tapCount = this.count % options.taps;
            if (tapCount === 0) {
                // no failing requirements, immediately trigger the tap event
                // or wait as long as the multitap interval to trigger
                if (!this.hasRequireFailures()) {
                    return STATE_RECOGNIZED;
                } else {
                    this._timer = setTimeoutContext(function() {
                        this.state = STATE_RECOGNIZED;
                        this.tryEmit();
                    }, options.interval, this);
                    return STATE_BEGAN;
                }
            }
        }
        return STATE_FAILED;
    },

    failTimeout: function() {
        this._timer = setTimeoutContext(function() {
            this.state = STATE_FAILED;
        }, this.options.interval, this);
        return STATE_FAILED;
    },

    reset: function() {
        clearTimeout(this._timer);
    },

    emit: function() {
        if (this.state == STATE_RECOGNIZED) {
            this._input.tapCount = this.count;
            this.manager.emit(this.options.event, this._input);
        }
    }
});

/**
 * Simple way to create a manager with a default set of recognizers.
 * @param {HTMLElement} element
 * @param {Object} [options]
 * @constructor
 */
function Hammer(element, options) {
    options = options || {};
    options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
    return new Manager(element, options);
}

/**
 * @const {string}
 */
Hammer.VERSION = '2.0.7';

/**
 * default settings
 * @namespace
 */
Hammer.defaults = {
    /**
     * set if DOM events are being triggered.
     * But this is slower and unused by simple implementations, so disabled by default.
     * @type {Boolean}
     * @default false
     */
    domEvents: false,

    /**
     * The value for the touchAction property/fallback.
     * When set to `compute` it will magically set the correct value based on the added recognizers.
     * @type {String}
     * @default compute
     */
    touchAction: TOUCH_ACTION_COMPUTE,

    /**
     * @type {Boolean}
     * @default true
     */
    enable: true,

    /**
     * EXPERIMENTAL FEATURE -- can be removed/changed
     * Change the parent input target element.
     * If Null, then it is being set the to main element.
     * @type {Null|EventTarget}
     * @default null
     */
    inputTarget: null,

    /**
     * force an input class
     * @type {Null|Function}
     * @default null
     */
    inputClass: null,

    /**
     * Default recognizer setup when calling `Hammer()`
     * When creating a new Manager these will be skipped.
     * @type {Array}
     */
    preset: [
        // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
        [RotateRecognizer, {enable: false}],
        [PinchRecognizer, {enable: false}, ['rotate']],
        [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
        [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
        [TapRecognizer],
        [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
        [PressRecognizer]
    ],

    /**
     * Some CSS properties can be used to improve the working of Hammer.
     * Add them to this method and they will be set when creating a new Manager.
     * @namespace
     */
    cssProps: {
        /**
         * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
         * @type {String}
         * @default 'none'
         */
        userSelect: 'none',

        /**
         * Disable the Windows Phone grippers when pressing an element.
         * @type {String}
         * @default 'none'
         */
        touchSelect: 'none',

        /**
         * Disables the default callout shown when you touch and hold a touch target.
         * On iOS, when you touch and hold a touch target such as a link, Safari displays
         * a callout containing information about the link. This property allows you to disable that callout.
         * @type {String}
         * @default 'none'
         */
        touchCallout: 'none',

        /**
         * Specifies whether zooming is enabled. Used by IE10>
         * @type {String}
         * @default 'none'
         */
        contentZooming: 'none',

        /**
         * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
         * @type {String}
         * @default 'none'
         */
        userDrag: 'none',

        /**
         * Overrides the highlight color shown when the user taps a link or a JavaScript
         * clickable element in iOS. This property obeys the alpha value, if specified.
         * @type {String}
         * @default 'rgba(0,0,0,0)'
         */
        tapHighlightColor: 'rgba(0,0,0,0)'
    }
};

var STOP = 1;
var FORCED_STOP = 2;

/**
 * Manager
 * @param {HTMLElement} element
 * @param {Object} [options]
 * @constructor
 */
function Manager(element, options) {
    this.options = assign({}, Hammer.defaults, options || {});

    this.options.inputTarget = this.options.inputTarget || element;

    this.handlers = {};
    this.session = {};
    this.recognizers = [];
    this.oldCssProps = {};

    this.element = element;
    this.input = createInputInstance(this);
    this.touchAction = new TouchAction(this, this.options.touchAction);

    toggleCssProps(this, true);

    each(this.options.recognizers, function(item) {
        var recognizer = this.add(new (item[0])(item[1]));
        item[2] && recognizer.recognizeWith(item[2]);
        item[3] && recognizer.requireFailure(item[3]);
    }, this);
}

Manager.prototype = {
    /**
     * set options
     * @param {Object} options
     * @returns {Manager}
     */
    set: function(options) {
        assign(this.options, options);

        // Options that need a little more setup
        if (options.touchAction) {
            this.touchAction.update();
        }
        if (options.inputTarget) {
            // Clean up existing event listeners and reinitialize
            this.input.destroy();
            this.input.target = options.inputTarget;
            this.input.init();
        }
        return this;
    },

    /**
     * stop recognizing for this session.
     * This session will be discarded, when a new [input]start event is fired.
     * When forced, the recognizer cycle is stopped immediately.
     * @param {Boolean} [force]
     */
    stop: function(force) {
        this.session.stopped = force ? FORCED_STOP : STOP;
    },

    /**
     * run the recognizers!
     * called by the inputHandler function on every movement of the pointers (touches)
     * it walks through all the recognizers and tries to detect the gesture that is being made
     * @param {Object} inputData
     */
    recognize: function(inputData) {
        var session = this.session;
        if (session.stopped) {
            return;
        }

        // run the touch-action polyfill
        this.touchAction.preventDefaults(inputData);

        var recognizer;
        var recognizers = this.recognizers;

        // this holds the recognizer that is being recognized.
        // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
        // if no recognizer is detecting a thing, it is set to `null`
        var curRecognizer = session.curRecognizer;

        // reset when the last recognizer is recognized
        // or when we're in a new session
        if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
            curRecognizer = session.curRecognizer = null;
        }

        var i = 0;
        while (i < recognizers.length) {
            recognizer = recognizers[i];

            // find out if we are allowed try to recognize the input for this one.
            // 1.   allow if the session is NOT forced stopped (see the .stop() method)
            // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
            //      that is being recognized.
            // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
            //      this can be setup with the `recognizeWith()` method on the recognizer.
            if (session.stopped !== FORCED_STOP && ( // 1
                    !curRecognizer || recognizer == curRecognizer || // 2
                    recognizer.canRecognizeWith(curRecognizer))) { // 3
                recognizer.recognize(inputData);
            } else {
                recognizer.reset();
            }

            // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
            // current active recognizer. but only if we don't already have an active recognizer
            if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
                curRecognizer = session.curRecognizer = recognizer;
            }
            i++;
        }
    },

    /**
     * get a recognizer by its event name.
     * @param {Recognizer|String} recognizer
     * @returns {Recognizer|Null}
     */
    get: function(recognizer) {
        if (recognizer instanceof Recognizer) {
            return recognizer;
        }

        var recognizers = this.recognizers;
        for (var i = 0; i < recognizers.length; i++) {
            if (recognizers[i].options.event == recognizer) {
                return recognizers[i];
            }
        }
        return null;
    },

    /**
     * add a recognizer to the manager
     * existing recognizers with the same event name will be removed
     * @param {Recognizer} recognizer
     * @returns {Recognizer|Manager}
     */
    add: function(recognizer) {
        if (invokeArrayArg(recognizer, 'add', this)) {
            return this;
        }

        // remove existing
        var existing = this.get(recognizer.options.event);
        if (existing) {
            this.remove(existing);
        }

        this.recognizers.push(recognizer);
        recognizer.manager = this;

        this.touchAction.update();
        return recognizer;
    },

    /**
     * remove a recognizer by name or instance
     * @param {Recognizer|String} recognizer
     * @returns {Manager}
     */
    remove: function(recognizer) {
        if (invokeArrayArg(recognizer, 'remove', this)) {
            return this;
        }

        recognizer = this.get(recognizer);

        // let's make sure this recognizer exists
        if (recognizer) {
            var recognizers = this.recognizers;
            var index = inArray(recognizers, recognizer);

            if (index !== -1) {
                recognizers.splice(index, 1);
                this.touchAction.update();
            }
        }

        return this;
    },

    /**
     * bind event
     * @param {String} events
     * @param {Function} handler
     * @returns {EventEmitter} this
     */
    on: function(events, handler) {
        if (events === undefined) {
            return;
        }
        if (handler === undefined) {
            return;
        }

        var handlers = this.handlers;
        each(splitStr(events), function(event) {
            handlers[event] = handlers[event] || [];
            handlers[event].push(handler);
        });
        return this;
    },

    /**
     * unbind event, leave emit blank to remove all handlers
     * @param {String} events
     * @param {Function} [handler]
     * @returns {EventEmitter} this
     */
    off: function(events, handler) {
        if (events === undefined) {
            return;
        }

        var handlers = this.handlers;
        each(splitStr(events), function(event) {
            if (!handler) {
                delete handlers[event];
            } else {
                handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
            }
        });
        return this;
    },

    /**
     * emit event to the listeners
     * @param {String} event
     * @param {Object} data
     */
    emit: function(event, data) {
        // we also want to trigger dom events
        if (this.options.domEvents) {
            triggerDomEvent(event, data);
        }

        // no handlers, so skip it all
        var handlers = this.handlers[event] && this.handlers[event].slice();
        if (!handlers || !handlers.length) {
            return;
        }

        data.type = event;
        data.preventDefault = function() {
            data.srcEvent.preventDefault();
        };

        var i = 0;
        while (i < handlers.length) {
            handlers[i](data);
            i++;
        }
    },

    /**
     * destroy the manager and unbinds all events
     * it doesn't unbind dom events, that is the user own responsibility
     */
    destroy: function() {
        this.element && toggleCssProps(this, false);

        this.handlers = {};
        this.session = {};
        this.input.destroy();
        this.element = null;
    }
};

/**
 * add/remove the css properties as defined in manager.options.cssProps
 * @param {Manager} manager
 * @param {Boolean} add
 */
function toggleCssProps(manager, add) {
    var element = manager.element;
    if (!element.style) {
        return;
    }
    var prop;
    each(manager.options.cssProps, function(value, name) {
        prop = prefixed(element.style, name);
        if (add) {
            manager.oldCssProps[prop] = element.style[prop];
            element.style[prop] = value;
        } else {
            element.style[prop] = manager.oldCssProps[prop] || '';
        }
    });
    if (!add) {
        manager.oldCssProps = {};
    }
}

/**
 * trigger dom event
 * @param {String} event
 * @param {Object} data
 */
function triggerDomEvent(event, data) {
    var gestureEvent = document.createEvent('Event');
    gestureEvent.initEvent(event, true, true);
    gestureEvent.gesture = data;
    data.target.dispatchEvent(gestureEvent);
}

assign(Hammer, {
    INPUT_START: INPUT_START,
    INPUT_MOVE: INPUT_MOVE,
    INPUT_END: INPUT_END,
    INPUT_CANCEL: INPUT_CANCEL,

    STATE_POSSIBLE: STATE_POSSIBLE,
    STATE_BEGAN: STATE_BEGAN,
    STATE_CHANGED: STATE_CHANGED,
    STATE_ENDED: STATE_ENDED,
    STATE_RECOGNIZED: STATE_RECOGNIZED,
    STATE_CANCELLED: STATE_CANCELLED,
    STATE_FAILED: STATE_FAILED,

    DIRECTION_NONE: DIRECTION_NONE,
    DIRECTION_LEFT: DIRECTION_LEFT,
    DIRECTION_RIGHT: DIRECTION_RIGHT,
    DIRECTION_UP: DIRECTION_UP,
    DIRECTION_DOWN: DIRECTION_DOWN,
    DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
    DIRECTION_VERTICAL: DIRECTION_VERTICAL,
    DIRECTION_ALL: DIRECTION_ALL,

    Manager: Manager,
    Input: Input,
    TouchAction: TouchAction,

    TouchInput: TouchInput,
    MouseInput: MouseInput,
    PointerEventInput: PointerEventInput,
    TouchMouseInput: TouchMouseInput,
    SingleTouchInput: SingleTouchInput,

    Recognizer: Recognizer,
    AttrRecognizer: AttrRecognizer,
    Tap: TapRecognizer,
    Pan: PanRecognizer,
    Swipe: SwipeRecognizer,
    Pinch: PinchRecognizer,
    Rotate: RotateRecognizer,
    Press: PressRecognizer,

    on: addEventListeners,
    off: removeEventListeners,
    each: each,
    merge: merge,
    extend: extend,
    assign: assign,
    inherit: inherit,
    bindFn: bindFn,
    prefixed: prefixed
});

// this prevents errors when Hammer is loaded in the presence of an AMD
//  style loader but by script tag, not by the loader.
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
freeGlobal.Hammer = Hammer;

if (typeof define === 'function' && define.amd) {
    define(function() {
        return Hammer;
    });
} else if (typeof module != 'undefined' && module.exports) {
    module.exports = Hammer;
} else {
    window[exportName] = Hammer;
}

})(window, document, 'Hammer');

'use strict';

(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define([], factory);
  } else if (typeof exports === 'object') {
    // Node. Does not work with strict CommonJS, but
    // only CommonJS-like environments that support module.exports,
    // like Node.
    module.exports = factory();
  } else {
    // Browser globals (root is window)
    window.propagating = factory();
  }
}(function () {
  var _firstTarget = null; // singleton, will contain the target element where the touch event started

  /**
   * Extend an Hammer.js instance with event propagation.
   *
   * Features:
   * - Events emitted by hammer will propagate in order from child to parent
   *   elements.
   * - Events are extended with a function `event.stopPropagation()` to stop
   *   propagation to parent elements.
   * - An option `preventDefault` to stop all default browser behavior.
   *
   * Usage:
   *   var hammer = propagatingHammer(new Hammer(element));
   *   var hammer = propagatingHammer(new Hammer(element), {preventDefault: true});
   *
   * @param {Hammer.Manager} hammer   An hammer instance.
   * @param {Object} [options]        Available options:
   *                                  - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`.
   *                                    Enforce preventing the default browser behavior.
   *                                    Cannot be set to `false`.
   * @return {Hammer.Manager} Returns the same hammer instance with extended
   *                          functionality
   */
  return function propagating(hammer, options) {
    var _options = options || {
      preventDefault: false
    };

    if (hammer.Manager) {
      // This looks like the Hammer constructor.
      // Overload the constructors with our own.
      var Hammer = hammer;

      var PropagatingHammer = function(element, options) {
        var o = Object.create(_options);
        if (options) Hammer.assign(o, options);
        return propagating(new Hammer(element, o), o);
      };
      Hammer.assign(PropagatingHammer, Hammer);

      PropagatingHammer.Manager = function (element, options) {
        var o = Object.create(_options);
        if (options) Hammer.assign(o, options);
        return propagating(new Hammer.Manager(element, o), o);
      };

      return PropagatingHammer;
    }

    // create a wrapper object which will override the functions
    // `on`, `off`, `destroy`, and `emit` of the hammer instance
    var wrapper = Object.create(hammer);

    // attach to DOM element
    var element = hammer.element;

    if(!element.hammer) element.hammer = [];
    element.hammer.push(wrapper);

    // register an event to catch the start of a gesture and store the
    // target in a singleton
    hammer.on('hammer.input', function (event) {
      if (_options.preventDefault === true || (_options.preventDefault === event.pointerType)) {
        event.preventDefault();
      }
      if (event.isFirst) {
        _firstTarget = event.target;
      }
    });

    /** @type {Object.<String, Array.<function>>} */
    wrapper._handlers = {};

    /**
     * Register a handler for one or multiple events
     * @param {String} events    A space separated string with events
     * @param {function} handler A callback function, called as handler(event)
     * @returns {Hammer.Manager} Returns the hammer instance
     */
    wrapper.on = function (events, handler) {
      // register the handler
      split(events).forEach(function (event) {
        var _handlers = wrapper._handlers[event];
        if (!_handlers) {
          wrapper._handlers[event] = _handlers = [];

          // register the static, propagated handler
          hammer.on(event, propagatedHandler);
        }
        _handlers.push(handler);
      });

      return wrapper;
    };

    /**
     * Unregister a handler for one or multiple events
     * @param {String} events      A space separated string with events
     * @param {function} [handler] Optional. The registered handler. If not
     *                             provided, all handlers for given events
     *                             are removed.
     * @returns {Hammer.Manager}   Returns the hammer instance
     */
    wrapper.off = function (events, handler) {
      // unregister the handler
      split(events).forEach(function (event) {
        var _handlers = wrapper._handlers[event];
        if (_handlers) {
          _handlers = handler ? _handlers.filter(function (h) {
            return h !== handler;
          }) : [];

          if (_handlers.length > 0) {
            wrapper._handlers[event] = _handlers;
          }
          else {
            // remove static, propagated handler
            hammer.off(event, propagatedHandler);
            delete wrapper._handlers[event];
          }
        }
      });

      return wrapper;
    };

    /**
     * Emit to the event listeners
     * @param {string} eventType
     * @param {Event} event
     */
    wrapper.emit = function(eventType, event) {
      _firstTarget = event.target;
      hammer.emit(eventType, event);
    };

    wrapper.destroy = function () {
      // Detach from DOM element
      var hammers = hammer.element.hammer;
      var idx = hammers.indexOf(wrapper);
      if(idx !== -1) hammers.splice(idx,1);
      if(!hammers.length) delete hammer.element.hammer;

      // clear all handlers
      wrapper._handlers = {};

      // call original hammer destroy
      hammer.destroy();
    };

    // split a string with space separated words
    function split(events) {
      return events.match(/[^ ]+/g);
    }

    /**
     * A static event handler, applying event propagation.
     * @param {Object} event
     */
    function propagatedHandler(event) {
      // let only a single hammer instance handle this event
      if (event.type !== 'hammer.input') {
        // it is possible that the same srcEvent is used with multiple hammer events,
        // we keep track on which events are handled in an object _handled
        if (!event.srcEvent._handled) {
          event.srcEvent._handled = {};
        }

        if (event.srcEvent._handled[event.type]) {
          return;
        }
        else {
          event.srcEvent._handled[event.type] = true;
        }
      }

      // attach a stopPropagation function to the event
      var stopped = false;
      event.stopPropagation = function () {
        stopped = true;
      };

      //wrap the srcEvent's stopPropagation to also stop hammer propagation:
      var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent);
      if(typeof srcStop == "function") {
        event.srcEvent.stopPropagation = function(){
          srcStop();
          event.stopPropagation();
        }
      }

      // attach firstTarget property to the event
      event.firstTarget = _firstTarget;

      // propagate over all elements (until stopped)
      var elem = _firstTarget;
      while (elem && !stopped) {
        var elemHammer = elem.hammer;
        if(elemHammer){
          var _handlers;
          for(var k = 0; k < elemHammer.length; k++){
            _handlers = elemHammer[k]._handlers[event.type];
            if(_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) {
              _handlers[i](event);
            }
          }
        }
        elem = elem.parentNode;
      }
    }

    return wrapper;
  };
}));

/*!
 * pixi.js - v5.1.5
 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
 *
 * pixi.js is licensed under the MIT License.
 * http://www.opensource.org/licenses/mit-license
 */
var PIXI = (function (exports) {
	'use strict';

	var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	function commonjsRequire () {
		throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
	}

	function unwrapExports (x) {
		return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
	}

	function createCommonjsModule(fn, module) {
		return module = { exports: {} }, fn(module, module.exports), module.exports;
	}

	function getCjsExportFromNamespace (n) {
		return n && n['default'] || n;
	}

	var promise = createCommonjsModule(function (module, exports) {
	(function(global){

	//
	// Check for native Promise and it has correct interface
	//

	var NativePromise = global['Promise'];
	var nativePromiseSupported =
	  NativePromise &&
	  // Some of these methods are missing from
	  // Firefox/Chrome experimental implementations
	  'resolve' in NativePromise &&
	  'reject' in NativePromise &&
	  'all' in NativePromise &&
	  'race' in NativePromise &&
	  // Older version of the spec had a resolver object
	  // as the arg rather than a function
	  (function(){
	    var resolve;
	    new NativePromise(function(r){ resolve = r; });
	    return typeof resolve === 'function';
	  })();


	//
	// export if necessary
	//

	if ('object' !== 'undefined' && exports)
	{
	  // node.js
	  exports.Promise = nativePromiseSupported ? NativePromise : Promise;
	  exports.Polyfill = Promise;
	}
	else
	{
	  // AMD
	  if (typeof undefined == 'function' && undefined.amd)
	  {
	    undefined(function(){
	      return nativePromiseSupported ? NativePromise : Promise;
	    });
	  }
	  else
	  {
	    // in browser add to global
	    if (!nativePromiseSupported)
	      { global['Promise'] = Promise; }
	  }
	}


	//
	// Polyfill
	//

	var PENDING = 'pending';
	var SEALED = 'sealed';
	var FULFILLED = 'fulfilled';
	var REJECTED = 'rejected';
	var NOOP = function(){};

	function isArray(value) {
	  return Object.prototype.toString.call(value) === '[object Array]';
	}

	// async calls
	var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;
	var asyncQueue = [];
	var asyncTimer;

	function asyncFlush(){
	  // run promise callbacks
	  for (var i = 0; i < asyncQueue.length; i++)
	    { asyncQueue[i][0](asyncQueue[i][1]); }

	  // reset async asyncQueue
	  asyncQueue = [];
	  asyncTimer = false;
	}

	function asyncCall(callback, arg){
	  asyncQueue.push([callback, arg]);

	  if (!asyncTimer)
	  {
	    asyncTimer = true;
	    asyncSetTimer(asyncFlush, 0);
	  }
	}


	function invokeResolver(resolver, promise) {
	  function resolvePromise(value) {
	    resolve(promise, value);
	  }

	  function rejectPromise(reason) {
	    reject(promise, reason);
	  }

	  try {
	    resolver(resolvePromise, rejectPromise);
	  } catch(e) {
	    rejectPromise(e);
	  }
	}

	function invokeCallback(subscriber){
	  var owner = subscriber.owner;
	  var settled = owner.state_;
	  var value = owner.data_;  
	  var callback = subscriber[settled];
	  var promise = subscriber.then;

	  if (typeof callback === 'function')
	  {
	    settled = FULFILLED;
	    try {
	      value = callback(value);
	    } catch(e) {
	      reject(promise, e);
	    }
	  }

	  if (!handleThenable(promise, value))
	  {
	    if (settled === FULFILLED)
	      { resolve(promise, value); }

	    if (settled === REJECTED)
	      { reject(promise, value); }
	  }
	}

	function handleThenable(promise, value) {
	  var resolved;

	  try {
	    if (promise === value)
	      { throw new TypeError('A promises callback cannot return that same promise.'); }

	    if (value && (typeof value === 'function' || typeof value === 'object'))
	    {
	      var then = value.then;  // then should be retrived only once

	      if (typeof then === 'function')
	      {
	        then.call(value, function(val){
	          if (!resolved)
	          {
	            resolved = true;

	            if (value !== val)
	              { resolve(promise, val); }
	            else
	              { fulfill(promise, val); }
	          }
	        }, function(reason){
	          if (!resolved)
	          {
	            resolved = true;

	            reject(promise, reason);
	          }
	        });

	        return true;
	      }
	    }
	  } catch (e) {
	    if (!resolved)
	      { reject(promise, e); }

	    return true;
	  }

	  return false;
	}

	function resolve(promise, value){
	  if (promise === value || !handleThenable(promise, value))
	    { fulfill(promise, value); }
	}

	function fulfill(promise, value){
	  if (promise.state_ === PENDING)
	  {
	    promise.state_ = SEALED;
	    promise.data_ = value;

	    asyncCall(publishFulfillment, promise);
	  }
	}

	function reject(promise, reason){
	  if (promise.state_ === PENDING)
	  {
	    promise.state_ = SEALED;
	    promise.data_ = reason;

	    asyncCall(publishRejection, promise);
	  }
	}

	function publish(promise) {
	  var callbacks = promise.then_;
	  promise.then_ = undefined;

	  for (var i = 0; i < callbacks.length; i++) {
	    invokeCallback(callbacks[i]);
	  }
	}

	function publishFulfillment(promise){
	  promise.state_ = FULFILLED;
	  publish(promise);
	}

	function publishRejection(promise){
	  promise.state_ = REJECTED;
	  publish(promise);
	}

	/**
	* @class
	*/
	function Promise(resolver){
	  if (typeof resolver !== 'function')
	    { throw new TypeError('Promise constructor takes a function argument'); }

	  if (this instanceof Promise === false)
	    { throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); }

	  this.then_ = [];

	  invokeResolver(resolver, this);
	}

	Promise.prototype = {
	  constructor: Promise,

	  state_: PENDING,
	  then_: null,
	  data_: undefined,

	  then: function(onFulfillment, onRejection){
	    var subscriber = {
	      owner: this,
	      then: new this.constructor(NOOP),
	      fulfilled: onFulfillment,
	      rejected: onRejection
	    };

	    if (this.state_ === FULFILLED || this.state_ === REJECTED)
	    {
	      // already resolved, call callback async
	      asyncCall(invokeCallback, subscriber);
	    }
	    else
	    {
	      // subscribe
	      this.then_.push(subscriber);
	    }

	    return subscriber.then;
	  },

	  'catch': function(onRejection) {
	    return this.then(null, onRejection);
	  }
	};

	Promise.all = function(promises){
	  var Class = this;

	  if (!isArray(promises))
	    { throw new TypeError('You must pass an array to Promise.all().'); }

	  return new Class(function(resolve, reject){
	    var results = [];
	    var remaining = 0;

	    function resolver(index){
	      remaining++;
	      return function(value){
	        results[index] = value;
	        if (!--remaining)
	          { resolve(results); }
	      };
	    }

	    for (var i = 0, promise; i < promises.length; i++)
	    {
	      promise = promises[i];

	      if (promise && typeof promise.then === 'function')
	        { promise.then(resolver(i), reject); }
	      else
	        { results[i] = promise; }
	    }

	    if (!remaining)
	      { resolve(results); }
	  });
	};

	Promise.race = function(promises){
	  var Class = this;

	  if (!isArray(promises))
	    { throw new TypeError('You must pass an array to Promise.race().'); }

	  return new Class(function(resolve, reject) {
	    for (var i = 0, promise; i < promises.length; i++)
	    {
	      promise = promises[i];

	      if (promise && typeof promise.then === 'function')
	        { promise.then(resolve, reject); }
	      else
	        { resolve(promise); }
	    }
	  });
	};

	Promise.resolve = function(value){
	  var Class = this;

	  if (value && typeof value === 'object' && value.constructor === Class)
	    { return value; }

	  return new Class(function(resolve){
	    resolve(value);
	  });
	};

	Promise.reject = function(reason){
	  var Class = this;

	  return new Class(function(resolve, reject){
	    reject(reason);
	  });
	};

	})(typeof window != 'undefined' ? window : typeof commonjsGlobal != 'undefined' ? commonjsGlobal : typeof self != 'undefined' ? self : commonjsGlobal);
	});
	var promise_1 = promise.Promise;
	var promise_2 = promise.Polyfill;

	/*
	object-assign
	(c) Sindre Sorhus
	@license MIT
	*/

	'use strict';
	/* eslint-disable no-unused-vars */
	var getOwnPropertySymbols = Object.getOwnPropertySymbols;
	var hasOwnProperty = Object.prototype.hasOwnProperty;
	var propIsEnumerable = Object.prototype.propertyIsEnumerable;

	function toObject(val) {
		if (val === null || val === undefined) {
			throw new TypeError('Object.assign cannot be called with null or undefined');
		}

		return Object(val);
	}

	function shouldUseNative() {
		try {
			if (!Object.assign) {
				return false;
			}

			// Detect buggy property enumeration order in older V8 versions.

			// https://bugs.chromium.org/p/v8/issues/detail?id=4118
			var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
			test1[5] = 'de';
			if (Object.getOwnPropertyNames(test1)[0] === '5') {
				return false;
			}

			// https://bugs.chromium.org/p/v8/issues/detail?id=3056
			var test2 = {};
			for (var i = 0; i < 10; i++) {
				test2['_' + String.fromCharCode(i)] = i;
			}
			var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
				return test2[n];
			});
			if (order2.join('') !== '0123456789') {
				return false;
			}

			// https://bugs.chromium.org/p/v8/issues/detail?id=3056
			var test3 = {};
			'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
				test3[letter] = letter;
			});
			if (Object.keys(Object.assign({}, test3)).join('') !==
					'abcdefghijklmnopqrst') {
				return false;
			}

			return true;
		} catch (err) {
			// We don't expect any of the above to throw, but better to be safe.
			return false;
		}
	}

	var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
		var arguments$1 = arguments;

		var from;
		var to = toObject(target);
		var symbols;

		for (var s = 1; s < arguments.length; s++) {
			from = Object(arguments$1[s]);

			for (var key in from) {
				if (hasOwnProperty.call(from, key)) {
					to[key] = from[key];
				}
			}

			if (getOwnPropertySymbols) {
				symbols = getOwnPropertySymbols(from);
				for (var i = 0; i < symbols.length; i++) {
					if (propIsEnumerable.call(from, symbols[i])) {
						to[symbols[i]] = from[symbols[i]];
					}
				}
			}
		}

		return to;
	};

	/*!
	 * @pixi/polyfill - v5.1.0
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/polyfill is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	// Support for IE 9 - 11 which does not include Promises
	if (!window.Promise)
	{
	    window.Promise = promise_2;
	}

	// References:

	if (!Object.assign)
	{
	    Object.assign = objectAssign;
	}

	var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	// 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`

	var ONE_FRAME_TIME = 16;

	// Date.now
	if (!(Date.now && Date.prototype.getTime))
	{
	    Date.now = function now()
	    {
	        return new Date().getTime();
	    };
	}

	// performance.now
	if (!(commonjsGlobal$1.performance && commonjsGlobal$1.performance.now))
	{
	    var startTime = Date.now();

	    if (!commonjsGlobal$1.performance)
	    {
	        commonjsGlobal$1.performance = {};
	    }

	    commonjsGlobal$1.performance.now = function () { return Date.now() - startTime; };
	}

	// requestAnimationFrame
	var lastTime = Date.now();
	var vendors = ['ms', 'moz', 'webkit', 'o'];

	for (var x = 0; x < vendors.length && !commonjsGlobal$1.requestAnimationFrame; ++x)
	{
	    var p = vendors[x];

	    commonjsGlobal$1.requestAnimationFrame = commonjsGlobal$1[(p + "RequestAnimationFrame")];
	    commonjsGlobal$1.cancelAnimationFrame = commonjsGlobal$1[(p + "CancelAnimationFrame")] || commonjsGlobal$1[(p + "CancelRequestAnimationFrame")];
	}

	if (!commonjsGlobal$1.requestAnimationFrame)
	{
	    commonjsGlobal$1.requestAnimationFrame = function (callback) {
	        if (typeof callback !== 'function')
	        {
	            throw new TypeError((callback + "is not a function"));
	        }

	        var currentTime = Date.now();
	        var delay = ONE_FRAME_TIME + lastTime - currentTime;

	        if (delay < 0)
	        {
	            delay = 0;
	        }

	        lastTime = currentTime;

	        return setTimeout(function () {
	            lastTime = Date.now();
	            callback(performance.now());
	        }, delay);
	    };
	}

	if (!commonjsGlobal$1.cancelAnimationFrame)
	{
	    commonjsGlobal$1.cancelAnimationFrame = function (id) { return clearTimeout(id); };
	}

	// References:
	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign

	if (!Math.sign)
	{
	    Math.sign = function mathSign(x)
	    {
	        x = Number(x);

	        if (x === 0 || isNaN(x))
	        {
	            return x;
	        }

	        return x > 0 ? 1 : -1;
	    };
	}

	// References:
	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger

	if (!Number.isInteger)
	{
	    Number.isInteger = function numberIsInteger(value)
	    {
	        return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
	    };
	}

	if (!window.ArrayBuffer)
	{
	    window.ArrayBuffer = Array;
	}

	if (!window.Float32Array)
	{
	    window.Float32Array = Array;
	}

	if (!window.Uint32Array)
	{
	    window.Uint32Array = Array;
	}

	if (!window.Uint16Array)
	{
	    window.Uint16Array = Array;
	}

	if (!window.Uint8Array)
	{
	    window.Uint8Array = Array;
	}

	if (!window.Int32Array)
	{
	    window.Int32Array = Array;
	}

	var isMobile_min = createCommonjsModule(function (module) {
	!function(e){var n=/iPhone/i,t=/iPod/i,r=/iPad/i,a=/\bAndroid(?:.+)Mobile\b/i,p=/Android/i,b=/\bAndroid(?:.+)SD4930UR\b/i,l=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,f=/Windows Phone/i,s=/\bWindows(?:.+)ARM\b/i,u=/BlackBerry/i,c=/BB10/i,h=/Opera Mini/i,v=/\b(CriOS|Chrome)(?:.+)Mobile/i,w=/Mobile(?:.+)Firefox\b/i;function m(e,i){return e.test(i)}function i(e){var i=e||("undefined"!=typeof navigator?navigator.userAgent:""),o=i.split("[FBAN");void 0!==o[1]&&(i=o[0]),void 0!==(o=i.split("Twitter"))[1]&&(i=o[0]);var d={apple:{phone:m(n,i)&&!m(f,i),ipod:m(t,i),tablet:!m(n,i)&&m(r,i)&&!m(f,i),device:(m(n,i)||m(t,i)||m(r,i))&&!m(f,i)},amazon:{phone:m(b,i),tablet:!m(b,i)&&m(l,i),device:m(b,i)||m(l,i)},android:{phone:!m(f,i)&&m(b,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(b,i)&&!m(a,i)&&(m(l,i)||m(p,i)),device:!m(f,i)&&(m(b,i)||m(l,i)||m(a,i)||m(p,i))||m(/\bokhttp\b/i,i)},windows:{phone:m(f,i),tablet:m(s,i),device:m(f,i)||m(s,i)},other:{blackberry:m(u,i),blackberry10:m(c,i),opera:m(h,i),firefox:m(w,i),chrome:m(v,i),device:m(u,i)||m(c,i)||m(h,i)||m(w,i)||m(v,i)}};return d.any=d.apple.device||d.android.device||d.windows.device||d.other.device,d.phone=d.apple.phone||d.android.phone||d.windows.phone,d.tablet=d.apple.tablet||d.android.tablet||d.windows.tablet,d}"undefined"!='object'&&module.exports&&"undefined"==typeof window?module.exports=i:"undefined"!='object'&&module.exports&&"undefined"!=typeof window?(module.exports=i(),module.exports.isMobile=i):"function"==typeof undefined&&undefined.amd?undefined([],e.isMobile=i()):e.isMobile=i();}(commonjsGlobal);
	});
	var isMobile_min_1 = isMobile_min.isMobile;

	/*!
	 * @pixi/settings - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/settings is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * The maximum recommended texture units to use.
	 * In theory the bigger the better, and for desktop we'll use as many as we can.
	 * But some mobile devices slow down if there is to many branches in the shader.
	 * So in practice there seems to be a sweet spot size that varies depending on the device.
	 *
	 * In v4, all mobile devices were limited to 4 texture units because for this.
	 * In v5, we allow all texture units to be used on modern Apple or Android devices.
	 *
	 * @private
	 * @param {number} max
	 * @returns {number}
	 */
	function maxRecommendedTextures(max)
	{
	    var allowMax = true;

	    if (isMobile_min.tablet || isMobile_min.phone)
	    {
	        allowMax = false;

	        if (isMobile_min.apple.device)
	        {
	            var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/);

	            if (match)
	            {
	                var majorVersion = parseInt(match[1], 10);

	                // All texture units can be used on devices that support ios 11 or above
	                if (majorVersion >= 11)
	                {
	                    allowMax = true;
	                }
	            }
	        }
	        if (isMobile_min.android.device)
	        {
	            var match$1 = (navigator.userAgent).match(/Android\s([0-9.]*)/);

	            if (match$1)
	            {
	                var majorVersion$1 = parseInt(match$1[1], 10);

	                // All texture units can be used on devices that support Android 7 (Nougat) or above
	                if (majorVersion$1 >= 7)
	                {
	                    allowMax = true;
	                }
	            }
	        }
	    }

	    return allowMax ? max : 4;
	}

	/**
	 * Uploading the same buffer multiple times in a single frame can cause performance issues.
	 * Apparent on iOS so only check for that at the moment
	 * This check may become more complex if this issue pops up elsewhere.
	 *
	 * @private
	 * @returns {boolean}
	 */
	function canUploadSameBuffer()
	{
	    return !isMobile_min.apple.device;
	}

	/**
	 * User's customizable globals for overriding the default PIXI settings, such
	 * as a renderer's default resolution, framerate, float precision, etc.
	 * @example
	 * // Use the native window resolution as the default resolution
	 * // will support high-density displays when rendering
	 * PIXI.settings.RESOLUTION = window.devicePixelRatio;
	 *
	 * // Disable interpolation when scaling, will make texture be pixelated
	 * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;
	 * @namespace PIXI.settings
	 */
	var settings = {

	    /**
	     * If set to true WebGL will attempt make textures mimpaped by default.
	     * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.
	     *
	     * @static
	     * @name MIPMAP_TEXTURES
	     * @memberof PIXI.settings
	     * @type {PIXI.MIPMAP_MODES}
	     * @default PIXI.MIPMAP_MODES.POW2
	     */
	    MIPMAP_TEXTURES: 1,

	    /**
	     * Default anisotropic filtering level of textures.
	     * Usually from 0 to 16
	     *
	     * @static
	     * @name ANISOTROPIC_LEVEL
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 0
	     */
	    ANISOTROPIC_LEVEL: 0,

	    /**
	     * Default resolution / device pixel ratio of the renderer.
	     *
	     * @static
	     * @name RESOLUTION
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 1
	     */
	    RESOLUTION: 1,

	    /**
	     * Default filter resolution.
	     *
	     * @static
	     * @name FILTER_RESOLUTION
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 1
	     */
	    FILTER_RESOLUTION: 1,

	    /**
	     * The maximum textures that this device supports.
	     *
	     * @static
	     * @name SPRITE_MAX_TEXTURES
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 32
	     */
	    SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),

	    // TODO: maybe change to SPRITE.BATCH_SIZE: 2000
	    // TODO: maybe add PARTICLE.BATCH_SIZE: 15000

	    /**
	     * The default sprite batch size.
	     *
	     * The default aims to balance desktop and mobile devices.
	     *
	     * @static
	     * @name SPRITE_BATCH_SIZE
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 4096
	     */
	    SPRITE_BATCH_SIZE: 4096,

	    /**
	     * The default render options if none are supplied to {@link PIXI.Renderer}
	     * or {@link PIXI.CanvasRenderer}.
	     *
	     * @static
	     * @name RENDER_OPTIONS
	     * @memberof PIXI.settings
	     * @type {object}
	     * @property {HTMLCanvasElement} view=null
	     * @property {number} resolution=1
	     * @property {boolean} antialias=false
	     * @property {boolean} forceFXAA=false
	     * @property {boolean} autoDensity=false
	     * @property {boolean} transparent=false
	     * @property {number} backgroundColor=0x000000
	     * @property {boolean} clearBeforeRender=true
	     * @property {boolean} preserveDrawingBuffer=false
	     * @property {number} width=800
	     * @property {number} height=600
	     * @property {boolean} legacy=false
	     */
	    RENDER_OPTIONS: {
	        view: null,
	        antialias: false,
	        forceFXAA: false,
	        autoDensity: false,
	        transparent: false,
	        backgroundColor: 0x000000,
	        clearBeforeRender: true,
	        preserveDrawingBuffer: false,
	        width: 800,
	        height: 600,
	        legacy: false,
	    },

	    /**
	     * Default Garbage Collection mode.
	     *
	     * @static
	     * @name GC_MODE
	     * @memberof PIXI.settings
	     * @type {PIXI.GC_MODES}
	     * @default PIXI.GC_MODES.AUTO
	     */
	    GC_MODE: 0,

	    /**
	     * Default Garbage Collection max idle.
	     *
	     * @static
	     * @name GC_MAX_IDLE
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 3600
	     */
	    GC_MAX_IDLE: 60 * 60,

	    /**
	     * Default Garbage Collection maximum check count.
	     *
	     * @static
	     * @name GC_MAX_CHECK_COUNT
	     * @memberof PIXI.settings
	     * @type {number}
	     * @default 600
	     */
	    GC_MAX_CHECK_COUNT: 60 * 10,

	    /**
	     * Default wrap modes that are supported by pixi.
	     *
	     * @static
	     * @name WRAP_MODE
	     * @memberof PIXI.settings
	     * @type {PIXI.WRAP_MODES}
	     * @default PIXI.WRAP_MODES.CLAMP
	     */
	    WRAP_MODE: 33071,

	    /**
	     * Default scale mode for textures.
	     *
	     * @static
	     * @name SCALE_MODE
	     * @memberof PIXI.settings
	     * @type {PIXI.SCALE_MODES}
	     * @default PIXI.SCALE_MODES.LINEAR
	     */
	    SCALE_MODE: 1,

	    /**
	     * Default specify float precision in vertex shader.
	     *
	     * @static
	     * @name PRECISION_VERTEX
	     * @memberof PIXI.settings
	     * @type {PIXI.PRECISION}
	     * @default PIXI.PRECISION.HIGH
	     */
	    PRECISION_VERTEX: 'highp',

	    /**
	     * Default specify float precision in fragment shader.
	     * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742
	     *
	     * @static
	     * @name PRECISION_FRAGMENT
	     * @memberof PIXI.settings
	     * @type {PIXI.PRECISION}
	     * @default PIXI.PRECISION.MEDIUM
	     */
	    PRECISION_FRAGMENT: isMobile_min.apple.device ? 'highp' : 'mediump',

	    /**
	     * Can we upload the same buffer in a single frame?
	     *
	     * @static
	     * @name CAN_UPLOAD_SAME_BUFFER
	     * @memberof PIXI.settings
	     * @type {boolean}
	     */
	    CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),

	    /**
	     * Enables bitmap creation before image load. This feature is experimental.
	     *
	     * @static
	     * @name CREATE_IMAGE_BITMAP
	     * @memberof PIXI.settings
	     * @type {boolean}
	     * @default false
	     */
	    CREATE_IMAGE_BITMAP: false,

	    /**
	     * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
	     * Advantages can include sharper image quality (like text) and faster rendering on canvas.
	     * The main disadvantage is movement of objects may appear less smooth.
	     *
	     * @static
	     * @constant
	     * @memberof PIXI.settings
	     * @type {boolean}
	     * @default false
	     */
	    ROUND_PIXELS: false,
	};

	var eventemitter3 = createCommonjsModule(function (module) {
	'use strict';

	var has = Object.prototype.hasOwnProperty
	  , prefix = '~';

	/**
	 * Constructor to create a storage for our `EE` objects.
	 * An `Events` instance is a plain object whose properties are event names.
	 *
	 * @constructor
	 * @private
	 */
	function Events() {}

	//
	// We try to not inherit from `Object.prototype`. In some engines creating an
	// instance in this way is faster than calling `Object.create(null)` directly.
	// If `Object.create(null)` is not supported we prefix the event names with a
	// character to make sure that the built-in object properties are not
	// overridden or used as an attack vector.
	//
	if (Object.create) {
	  Events.prototype = Object.create(null);

	  //
	  // This hack is needed because the `__proto__` property is still inherited in
	  // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
	  //
	  if (!new Events().__proto__) { prefix = false; }
	}

	/**
	 * Representation of a single event listener.
	 *
	 * @param {Function} fn The listener function.
	 * @param {*} context The context to invoke the listener with.
	 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
	 * @constructor
	 * @private
	 */
	function EE(fn, context, once) {
	  this.fn = fn;
	  this.context = context;
	  this.once = once || false;
	}

	/**
	 * Add a listener for a given event.
	 *
	 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
	 * @param {(String|Symbol)} event The event name.
	 * @param {Function} fn The listener function.
	 * @param {*} context The context to invoke the listener with.
	 * @param {Boolean} once Specify if the listener is a one-time listener.
	 * @returns {EventEmitter}
	 * @private
	 */
	function addListener(emitter, event, fn, context, once) {
	  if (typeof fn !== 'function') {
	    throw new TypeError('The listener must be a function');
	  }

	  var listener = new EE(fn, context || emitter, once)
	    , evt = prefix ? prefix + event : event;

	  if (!emitter._events[evt]) { emitter._events[evt] = listener, emitter._eventsCount++; }
	  else if (!emitter._events[evt].fn) { emitter._events[evt].push(listener); }
	  else { emitter._events[evt] = [emitter._events[evt], listener]; }

	  return emitter;
	}

	/**
	 * Clear event by name.
	 *
	 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
	 * @param {(String|Symbol)} evt The Event name.
	 * @private
	 */
	function clearEvent(emitter, evt) {
	  if (--emitter._eventsCount === 0) { emitter._events = new Events(); }
	  else { delete emitter._events[evt]; }
	}

	/**
	 * Minimal `EventEmitter` interface that is molded against the Node.js
	 * `EventEmitter` interface.
	 *
	 * @constructor
	 * @public
	 */
	function EventEmitter() {
	  this._events = new Events();
	  this._eventsCount = 0;
	}

	/**
	 * Return an array listing the events for which the emitter has registered
	 * listeners.
	 *
	 * @returns {Array}
	 * @public
	 */
	EventEmitter.prototype.eventNames = function eventNames() {
	  var names = []
	    , events
	    , name;

	  if (this._eventsCount === 0) { return names; }

	  for (name in (events = this._events)) {
	    if (has.call(events, name)) { names.push(prefix ? name.slice(1) : name); }
	  }

	  if (Object.getOwnPropertySymbols) {
	    return names.concat(Object.getOwnPropertySymbols(events));
	  }

	  return names;
	};

	/**
	 * Return the listeners registered for a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @returns {Array} The registered listeners.
	 * @public
	 */
	EventEmitter.prototype.listeners = function listeners(event) {
	  var evt = prefix ? prefix + event : event
	    , handlers = this._events[evt];

	  if (!handlers) { return []; }
	  if (handlers.fn) { return [handlers.fn]; }

	  for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
	    ee[i] = handlers[i].fn;
	  }

	  return ee;
	};

	/**
	 * Return the number of listeners listening to a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @returns {Number} The number of listeners.
	 * @public
	 */
	EventEmitter.prototype.listenerCount = function listenerCount(event) {
	  var evt = prefix ? prefix + event : event
	    , listeners = this._events[evt];

	  if (!listeners) { return 0; }
	  if (listeners.fn) { return 1; }
	  return listeners.length;
	};

	/**
	 * Calls each of the listeners registered for a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @returns {Boolean} `true` if the event had listeners, else `false`.
	 * @public
	 */
	EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
	  var arguments$1 = arguments;

	  var evt = prefix ? prefix + event : event;

	  if (!this._events[evt]) { return false; }

	  var listeners = this._events[evt]
	    , len = arguments.length
	    , args
	    , i;

	  if (listeners.fn) {
	    if (listeners.once) { this.removeListener(event, listeners.fn, undefined, true); }

	    switch (len) {
	      case 1: return listeners.fn.call(listeners.context), true;
	      case 2: return listeners.fn.call(listeners.context, a1), true;
	      case 3: return listeners.fn.call(listeners.context, a1, a2), true;
	      case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
	      case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
	      case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
	    }

	    for (i = 1, args = new Array(len -1); i < len; i++) {
	      args[i - 1] = arguments$1[i];
	    }

	    listeners.fn.apply(listeners.context, args);
	  } else {
	    var length = listeners.length
	      , j;

	    for (i = 0; i < length; i++) {
	      if (listeners[i].once) { this.removeListener(event, listeners[i].fn, undefined, true); }

	      switch (len) {
	        case 1: listeners[i].fn.call(listeners[i].context); break;
	        case 2: listeners[i].fn.call(listeners[i].context, a1); break;
	        case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
	        case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
	        default:
	          if (!args) { for (j = 1, args = new Array(len -1); j < len; j++) {
	            args[j - 1] = arguments$1[j];
	          } }

	          listeners[i].fn.apply(listeners[i].context, args);
	      }
	    }
	  }

	  return true;
	};

	/**
	 * Add a listener for a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @param {Function} fn The listener function.
	 * @param {*} [context=this] The context to invoke the listener with.
	 * @returns {EventEmitter} `this`.
	 * @public
	 */
	EventEmitter.prototype.on = function on(event, fn, context) {
	  return addListener(this, event, fn, context, false);
	};

	/**
	 * Add a one-time listener for a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @param {Function} fn The listener function.
	 * @param {*} [context=this] The context to invoke the listener with.
	 * @returns {EventEmitter} `this`.
	 * @public
	 */
	EventEmitter.prototype.once = function once(event, fn, context) {
	  return addListener(this, event, fn, context, true);
	};

	/**
	 * Remove the listeners of a given event.
	 *
	 * @param {(String|Symbol)} event The event name.
	 * @param {Function} fn Only remove the listeners that match this function.
	 * @param {*} context Only remove the listeners that have this context.
	 * @param {Boolean} once Only remove one-time listeners.
	 * @returns {EventEmitter} `this`.
	 * @public
	 */
	EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
	  var evt = prefix ? prefix + event : event;

	  if (!this._events[evt]) { return this; }
	  if (!fn) {
	    clearEvent(this, evt);
	    return this;
	  }

	  var listeners = this._events[evt];

	  if (listeners.fn) {
	    if (
	      listeners.fn === fn &&
	      (!once || listeners.once) &&
	      (!context || listeners.context === context)
	    ) {
	      clearEvent(this, evt);
	    }
	  } else {
	    for (var i = 0, events = [], length = listeners.length; i < length; i++) {
	      if (
	        listeners[i].fn !== fn ||
	        (once && !listeners[i].once) ||
	        (context && listeners[i].context !== context)
	      ) {
	        events.push(listeners[i]);
	      }
	    }

	    //
	    // Reset the array, or remove it completely if we have no more listeners.
	    //
	    if (events.length) { this._events[evt] = events.length === 1 ? events[0] : events; }
	    else { clearEvent(this, evt); }
	  }

	  return this;
	};

	/**
	 * Remove all listeners, or those of the specified event.
	 *
	 * @param {(String|Symbol)} [event] The event name.
	 * @returns {EventEmitter} `this`.
	 * @public
	 */
	EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
	  var evt;

	  if (event) {
	    evt = prefix ? prefix + event : event;
	    if (this._events[evt]) { clearEvent(this, evt); }
	  } else {
	    this._events = new Events();
	    this._eventsCount = 0;
	  }

	  return this;
	};

	//
	// Alias methods names because people roll like that.
	//
	EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
	EventEmitter.prototype.addListener = EventEmitter.prototype.on;

	//
	// Expose the prefix.
	//
	EventEmitter.prefixed = prefix;

	//
	// Allow `EventEmitter` to be imported as module namespace.
	//
	EventEmitter.EventEmitter = EventEmitter;

	//
	// Expose the module.
	//
	if ('undefined' !== 'object') {
	  module.exports = EventEmitter;
	}
	});

	'use strict';

	var earcut_1 = earcut;
	var default_1 = earcut;

	function earcut(data, holeIndices, dim) {

	    dim = dim || 2;

	    var hasHoles = holeIndices && holeIndices.length,
	        outerLen = hasHoles ? holeIndices[0] * dim : data.length,
	        outerNode = linkedList(data, 0, outerLen, dim, true),
	        triangles = [];

	    if (!outerNode || outerNode.next === outerNode.prev) { return triangles; }

	    var minX, minY, maxX, maxY, x, y, invSize;

	    if (hasHoles) { outerNode = eliminateHoles(data, holeIndices, outerNode, dim); }

	    // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
	    if (data.length > 80 * dim) {
	        minX = maxX = data[0];
	        minY = maxY = data[1];

	        for (var i = dim; i < outerLen; i += dim) {
	            x = data[i];
	            y = data[i + 1];
	            if (x < minX) { minX = x; }
	            if (y < minY) { minY = y; }
	            if (x > maxX) { maxX = x; }
	            if (y > maxY) { maxY = y; }
	        }

	        // minX, minY and invSize are later used to transform coords into integers for z-order calculation
	        invSize = Math.max(maxX - minX, maxY - minY);
	        invSize = invSize !== 0 ? 1 / invSize : 0;
	    }

	    earcutLinked(outerNode, triangles, dim, minX, minY, invSize);

	    return triangles;
	}

	// create a circular doubly linked list from polygon points in the specified winding order
	function linkedList(data, start, end, dim, clockwise) {
	    var i, last;

	    if (clockwise === (signedArea(data, start, end, dim) > 0)) {
	        for (i = start; i < end; i += dim) { last = insertNode(i, data[i], data[i + 1], last); }
	    } else {
	        for (i = end - dim; i >= start; i -= dim) { last = insertNode(i, data[i], data[i + 1], last); }
	    }

	    if (last && equals(last, last.next)) {
	        removeNode(last);
	        last = last.next;
	    }

	    return last;
	}

	// eliminate colinear or duplicate points
	function filterPoints(start, end) {
	    if (!start) { return start; }
	    if (!end) { end = start; }

	    var p = start,
	        again;
	    do {
	        again = false;

	        if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
	            removeNode(p);
	            p = end = p.prev;
	            if (p === p.next) { break; }
	            again = true;

	        } else {
	            p = p.next;
	        }
	    } while (again || p !== end);

	    return end;
	}

	// main ear slicing loop which triangulates a polygon (given as a linked list)
	function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
	    if (!ear) { return; }

	    // interlink polygon nodes in z-order
	    if (!pass && invSize) { indexCurve(ear, minX, minY, invSize); }

	    var stop = ear,
	        prev, next;

	    // iterate through ears, slicing them one by one
	    while (ear.prev !== ear.next) {
	        prev = ear.prev;
	        next = ear.next;

	        if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
	            // cut off the triangle
	            triangles.push(prev.i / dim);
	            triangles.push(ear.i / dim);
	            triangles.push(next.i / dim);

	            removeNode(ear);

	            // skipping the next vertex leads to less sliver triangles
	            ear = next.next;
	            stop = next.next;

	            continue;
	        }

	        ear = next;

	        // if we looped through the whole remaining polygon and can't find any more ears
	        if (ear === stop) {
	            // try filtering points and slicing again
	            if (!pass) {
	                earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);

	            // if this didn't work, try curing all small self-intersections locally
	            } else if (pass === 1) {
	                ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
	                earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);

	            // as a last resort, try splitting the remaining polygon into two
	            } else if (pass === 2) {
	                splitEarcut(ear, triangles, dim, minX, minY, invSize);
	            }

	            break;
	        }
	    }
	}

	// check whether a polygon node forms a valid ear with adjacent nodes
	function isEar(ear) {
	    var a = ear.prev,
	        b = ear,
	        c = ear.next;

	    if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear

	    // now make sure we don't have other points inside the potential ear
	    var p = ear.next.next;

	    while (p !== ear.prev) {
	        if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
	            area(p.prev, p, p.next) >= 0) { return false; }
	        p = p.next;
	    }

	    return true;
	}

	function isEarHashed(ear, minX, minY, invSize) {
	    var a = ear.prev,
	        b = ear,
	        c = ear.next;

	    if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear

	    // triangle bbox; min & max are calculated like this for speed
	    var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),
	        minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),
	        maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),
	        maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);

	    // z-order range for the current triangle bbox;
	    var minZ = zOrder(minTX, minTY, minX, minY, invSize),
	        maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);

	    var p = ear.prevZ,
	        n = ear.nextZ;

	    // look for points inside the triangle in both directions
	    while (p && p.z >= minZ && n && n.z <= maxZ) {
	        if (p !== ear.prev && p !== ear.next &&
	            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
	            area(p.prev, p, p.next) >= 0) { return false; }
	        p = p.prevZ;

	        if (n !== ear.prev && n !== ear.next &&
	            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
	            area(n.prev, n, n.next) >= 0) { return false; }
	        n = n.nextZ;
	    }

	    // look for remaining points in decreasing z-order
	    while (p && p.z >= minZ) {
	        if (p !== ear.prev && p !== ear.next &&
	            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
	            area(p.prev, p, p.next) >= 0) { return false; }
	        p = p.prevZ;
	    }

	    // look for remaining points in increasing z-order
	    while (n && n.z <= maxZ) {
	        if (n !== ear.prev && n !== ear.next &&
	            pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
	            area(n.prev, n, n.next) >= 0) { return false; }
	        n = n.nextZ;
	    }

	    return true;
	}

	// go through all polygon nodes and cure small local self-intersections
	function cureLocalIntersections(start, triangles, dim) {
	    var p = start;
	    do {
	        var a = p.prev,
	            b = p.next.next;

	        if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {

	            triangles.push(a.i / dim);
	            triangles.push(p.i / dim);
	            triangles.push(b.i / dim);

	            // remove two nodes involved
	            removeNode(p);
	            removeNode(p.next);

	            p = start = b;
	        }
	        p = p.next;
	    } while (p !== start);

	    return filterPoints(p);
	}

	// try splitting polygon into two and triangulate them independently
	function splitEarcut(start, triangles, dim, minX, minY, invSize) {
	    // look for a valid diagonal that divides the polygon into two
	    var a = start;
	    do {
	        var b = a.next.next;
	        while (b !== a.prev) {
	            if (a.i !== b.i && isValidDiagonal(a, b)) {
	                // split the polygon in two by the diagonal
	                var c = splitPolygon(a, b);

	                // filter colinear points around the cuts
	                a = filterPoints(a, a.next);
	                c = filterPoints(c, c.next);

	                // run earcut on each half
	                earcutLinked(a, triangles, dim, minX, minY, invSize);
	                earcutLinked(c, triangles, dim, minX, minY, invSize);
	                return;
	            }
	            b = b.next;
	        }
	        a = a.next;
	    } while (a !== start);
	}

	// link every hole into the outer loop, producing a single-ring polygon without holes
	function eliminateHoles(data, holeIndices, outerNode, dim) {
	    var queue = [],
	        i, len, start, end, list;

	    for (i = 0, len = holeIndices.length; i < len; i++) {
	        start = holeIndices[i] * dim;
	        end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
	        list = linkedList(data, start, end, dim, false);
	        if (list === list.next) { list.steiner = true; }
	        queue.push(getLeftmost(list));
	    }

	    queue.sort(compareX);

	    // process holes from left to right
	    for (i = 0; i < queue.length; i++) {
	        eliminateHole(queue[i], outerNode);
	        outerNode = filterPoints(outerNode, outerNode.next);
	    }

	    return outerNode;
	}

	function compareX(a, b) {
	    return a.x - b.x;
	}

	// find a bridge between vertices that connects hole with an outer ring and and link it
	function eliminateHole(hole, outerNode) {
	    outerNode = findHoleBridge(hole, outerNode);
	    if (outerNode) {
	        var b = splitPolygon(outerNode, hole);
	        filterPoints(b, b.next);
	    }
	}

	// David Eberly's algorithm for finding a bridge between hole and outer polygon
	function findHoleBridge(hole, outerNode) {
	    var p = outerNode,
	        hx = hole.x,
	        hy = hole.y,
	        qx = -Infinity,
	        m;

	    // find a segment intersected by a ray from the hole's leftmost point to the left;
	    // segment's endpoint with lesser x will be potential connection point
	    do {
	        if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
	            var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
	            if (x <= hx && x > qx) {
	                qx = x;
	                if (x === hx) {
	                    if (hy === p.y) { return p; }
	                    if (hy === p.next.y) { return p.next; }
	                }
	                m = p.x < p.next.x ? p : p.next;
	            }
	        }
	        p = p.next;
	    } while (p !== outerNode);

	    if (!m) { return null; }

	    if (hx === qx) { return m; } // hole touches outer segment; pick leftmost endpoint

	    // look for points inside the triangle of hole point, segment intersection and endpoint;
	    // if there are no points found, we have a valid connection;
	    // otherwise choose the point of the minimum angle with the ray as connection point

	    var stop = m,
	        mx = m.x,
	        my = m.y,
	        tanMin = Infinity,
	        tan;

	    p = m;

	    do {
	        if (hx >= p.x && p.x >= mx && hx !== p.x &&
	                pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {

	            tan = Math.abs(hy - p.y) / (hx - p.x); // tangential

	            if (locallyInside(p, hole) &&
	                (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
	                m = p;
	                tanMin = tan;
	            }
	        }

	        p = p.next;
	    } while (p !== stop);

	    return m;
	}

	// whether sector in vertex m contains sector in vertex p in the same coordinates
	function sectorContainsSector(m, p) {
	    return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
	}

	// interlink polygon nodes in z-order
	function indexCurve(start, minX, minY, invSize) {
	    var p = start;
	    do {
	        if (p.z === null) { p.z = zOrder(p.x, p.y, minX, minY, invSize); }
	        p.prevZ = p.prev;
	        p.nextZ = p.next;
	        p = p.next;
	    } while (p !== start);

	    p.prevZ.nextZ = null;
	    p.prevZ = null;

	    sortLinked(p);
	}

	// Simon Tatham's linked list merge sort algorithm
	// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
	function sortLinked(list) {
	    var i, p, q, e, tail, numMerges, pSize, qSize,
	        inSize = 1;

	    do {
	        p = list;
	        list = null;
	        tail = null;
	        numMerges = 0;

	        while (p) {
	            numMerges++;
	            q = p;
	            pSize = 0;
	            for (i = 0; i < inSize; i++) {
	                pSize++;
	                q = q.nextZ;
	                if (!q) { break; }
	            }
	            qSize = inSize;

	            while (pSize > 0 || (qSize > 0 && q)) {

	                if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
	                    e = p;
	                    p = p.nextZ;
	                    pSize--;
	                } else {
	                    e = q;
	                    q = q.nextZ;
	                    qSize--;
	                }

	                if (tail) { tail.nextZ = e; }
	                else { list = e; }

	                e.prevZ = tail;
	                tail = e;
	            }

	            p = q;
	        }

	        tail.nextZ = null;
	        inSize *= 2;

	    } while (numMerges > 1);

	    return list;
	}

	// z-order of a point given coords and inverse of the longer side of data bbox
	function zOrder(x, y, minX, minY, invSize) {
	    // coords are transformed into non-negative 15-bit integer range
	    x = 32767 * (x - minX) * invSize;
	    y = 32767 * (y - minY) * invSize;

	    x = (x | (x << 8)) & 0x00FF00FF;
	    x = (x | (x << 4)) & 0x0F0F0F0F;
	    x = (x | (x << 2)) & 0x33333333;
	    x = (x | (x << 1)) & 0x55555555;

	    y = (y | (y << 8)) & 0x00FF00FF;
	    y = (y | (y << 4)) & 0x0F0F0F0F;
	    y = (y | (y << 2)) & 0x33333333;
	    y = (y | (y << 1)) & 0x55555555;

	    return x | (y << 1);
	}

	// find the leftmost node of a polygon ring
	function getLeftmost(start) {
	    var p = start,
	        leftmost = start;
	    do {
	        if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) { leftmost = p; }
	        p = p.next;
	    } while (p !== start);

	    return leftmost;
	}

	// check if a point lies within a convex triangle
	function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
	    return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
	           (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
	           (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
	}

	// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
	function isValidDiagonal(a, b) {
	    return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
	           (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
	            (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
	            equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
	}

	// signed area of a triangle
	function area(p, q, r) {
	    return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
	}

	// check if two points are equal
	function equals(p1, p2) {
	    return p1.x === p2.x && p1.y === p2.y;
	}

	// check if two segments intersect
	function intersects(p1, q1, p2, q2) {
	    var o1 = sign(area(p1, q1, p2));
	    var o2 = sign(area(p1, q1, q2));
	    var o3 = sign(area(p2, q2, p1));
	    var o4 = sign(area(p2, q2, q1));

	    if (o1 !== o2 && o3 !== o4) { return true; } // general case

	    if (o1 === 0 && onSegment(p1, p2, q1)) { return true; } // p1, q1 and p2 are collinear and p2 lies on p1q1
	    if (o2 === 0 && onSegment(p1, q2, q1)) { return true; } // p1, q1 and q2 are collinear and q2 lies on p1q1
	    if (o3 === 0 && onSegment(p2, p1, q2)) { return true; } // p2, q2 and p1 are collinear and p1 lies on p2q2
	    if (o4 === 0 && onSegment(p2, q1, q2)) { return true; } // p2, q2 and q1 are collinear and q1 lies on p2q2

	    return false;
	}

	// for collinear points p, q, r, check if point q lies on segment pr
	function onSegment(p, q, r) {
	    return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
	}

	function sign(num) {
	    return num > 0 ? 1 : num < 0 ? -1 : 0;
	}

	// check if a polygon diagonal intersects any polygon segments
	function intersectsPolygon(a, b) {
	    var p = a;
	    do {
	        if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
	                intersects(p, p.next, a, b)) { return true; }
	        p = p.next;
	    } while (p !== a);

	    return false;
	}

	// check if a polygon diagonal is locally inside the polygon
	function locallyInside(a, b) {
	    return area(a.prev, a, a.next) < 0 ?
	        area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
	        area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
	}

	// check if the middle point of a polygon diagonal is inside the polygon
	function middleInside(a, b) {
	    var p = a,
	        inside = false,
	        px = (a.x + b.x) / 2,
	        py = (a.y + b.y) / 2;
	    do {
	        if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
	                (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
	            { inside = !inside; }
	        p = p.next;
	    } while (p !== a);

	    return inside;
	}

	// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
	// if one belongs to the outer ring and another to a hole, it merges it into a single ring
	function splitPolygon(a, b) {
	    var a2 = new Node(a.i, a.x, a.y),
	        b2 = new Node(b.i, b.x, b.y),
	        an = a.next,
	        bp = b.prev;

	    a.next = b;
	    b.prev = a;

	    a2.next = an;
	    an.prev = a2;

	    b2.next = a2;
	    a2.prev = b2;

	    bp.next = b2;
	    b2.prev = bp;

	    return b2;
	}

	// create a node and optionally link it with previous one (in a circular doubly linked list)
	function insertNode(i, x, y, last) {
	    var p = new Node(i, x, y);

	    if (!last) {
	        p.prev = p;
	        p.next = p;

	    } else {
	        p.next = last.next;
	        p.prev = last;
	        last.next.prev = p;
	        last.next = p;
	    }
	    return p;
	}

	function removeNode(p) {
	    p.next.prev = p.prev;
	    p.prev.next = p.next;

	    if (p.prevZ) { p.prevZ.nextZ = p.nextZ; }
	    if (p.nextZ) { p.nextZ.prevZ = p.prevZ; }
	}

	function Node(i, x, y) {
	    // vertex index in coordinates array
	    this.i = i;

	    // vertex coordinates
	    this.x = x;
	    this.y = y;

	    // previous and next vertex nodes in a polygon ring
	    this.prev = null;
	    this.next = null;

	    // z-order curve value
	    this.z = null;

	    // previous and next nodes in z-order
	    this.prevZ = null;
	    this.nextZ = null;

	    // indicates whether this is a steiner point
	    this.steiner = false;
	}

	// return a percentage difference between the polygon area and its triangulation area;
	// used to verify correctness of triangulation
	earcut.deviation = function (data, holeIndices, dim, triangles) {
	    var hasHoles = holeIndices && holeIndices.length;
	    var outerLen = hasHoles ? holeIndices[0] * dim : data.length;

	    var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
	    if (hasHoles) {
	        for (var i = 0, len = holeIndices.length; i < len; i++) {
	            var start = holeIndices[i] * dim;
	            var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
	            polygonArea -= Math.abs(signedArea(data, start, end, dim));
	        }
	    }

	    var trianglesArea = 0;
	    for (i = 0; i < triangles.length; i += 3) {
	        var a = triangles[i] * dim;
	        var b = triangles[i + 1] * dim;
	        var c = triangles[i + 2] * dim;
	        trianglesArea += Math.abs(
	            (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -
	            (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
	    }

	    return polygonArea === 0 && trianglesArea === 0 ? 0 :
	        Math.abs((trianglesArea - polygonArea) / polygonArea);
	};

	function signedArea(data, start, end, dim) {
	    var sum = 0;
	    for (var i = start, j = end - dim; i < end; i += dim) {
	        sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
	        j = i;
	    }
	    return sum;
	}

	// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
	earcut.flatten = function (data) {
	    var dim = data[0][0].length,
	        result = {vertices: [], holes: [], dimensions: dim},
	        holeIndex = 0;

	    for (var i = 0; i < data.length; i++) {
	        for (var j = 0; j < data[i].length; j++) {
	            for (var d = 0; d < dim; d++) { result.vertices.push(data[i][j][d]); }
	        }
	        if (i > 0) {
	            holeIndex += data[i - 1].length;
	            result.holes.push(holeIndex);
	        }
	    }
	    return result;
	};
	earcut_1.default = default_1;

	var punycode = createCommonjsModule(function (module, exports) {
	/*! https://mths.be/punycode v1.3.2 by @mathias */
	;(function(root) {

		/** Detect free variables */
		var freeExports = 'object' == 'object' && exports &&
			!exports.nodeType && exports;
		var freeModule = 'object' == 'object' && module &&
			!module.nodeType && module;
		var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
		if (
			freeGlobal.global === freeGlobal ||
			freeGlobal.window === freeGlobal ||
			freeGlobal.self === freeGlobal
		) {
			root = freeGlobal;
		}

		/**
		 * The `punycode` object.
		 * @name punycode
		 * @type Object
		 */
		var punycode,

		/** Highest positive signed 32-bit float value */
		maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1

		/** Bootstring parameters */
		base = 36,
		tMin = 1,
		tMax = 26,
		skew = 38,
		damp = 700,
		initialBias = 72,
		initialN = 128, // 0x80
		delimiter = '-', // '\x2D'

		/** Regular expressions */
		regexPunycode = /^xn--/,
		regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
		regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators

		/** Error messages */
		errors = {
			'overflow': 'Overflow: input needs wider integers to process',
			'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
			'invalid-input': 'Invalid input'
		},

		/** Convenience shortcuts */
		baseMinusTMin = base - tMin,
		floor = Math.floor,
		stringFromCharCode = String.fromCharCode,

		/** Temporary variable */
		key;

		/*--------------------------------------------------------------------------*/

		/**
		 * A generic error utility function.
		 * @private
		 * @param {String} type The error type.
		 * @returns {Error} Throws a `RangeError` with the applicable error message.
		 */
		function error(type) {
			throw RangeError(errors[type]);
		}

		/**
		 * A generic `Array#map` utility function.
		 * @private
		 * @param {Array} array The array to iterate over.
		 * @param {Function} callback The function that gets called for every array
		 * item.
		 * @returns {Array} A new array of values returned by the callback function.
		 */
		function map(array, fn) {
			var length = array.length;
			var result = [];
			while (length--) {
				result[length] = fn(array[length]);
			}
			return result;
		}

		/**
		 * A simple `Array#map`-like wrapper to work with domain name strings or email
		 * addresses.
		 * @private
		 * @param {String} domain The domain name or email address.
		 * @param {Function} callback The function that gets called for every
		 * character.
		 * @returns {Array} A new string of characters returned by the callback
		 * function.
		 */
		function mapDomain(string, fn) {
			var parts = string.split('@');
			var result = '';
			if (parts.length > 1) {
				// In email addresses, only the domain name should be punycoded. Leave
				// the local part (i.e. everything up to `@`) intact.
				result = parts[0] + '@';
				string = parts[1];
			}
			// Avoid `split(regex)` for IE8 compatibility. See #17.
			string = string.replace(regexSeparators, '\x2E');
			var labels = string.split('.');
			var encoded = map(labels, fn).join('.');
			return result + encoded;
		}

		/**
		 * Creates an array containing the numeric code points of each Unicode
		 * character in the string. While JavaScript uses UCS-2 internally,
		 * this function will convert a pair of surrogate halves (each of which
		 * UCS-2 exposes as separate characters) into a single code point,
		 * matching UTF-16.
		 * @see `punycode.ucs2.encode`
		 * @see <https://mathiasbynens.be/notes/javascript-encoding>
		 * @memberOf punycode.ucs2
		 * @name decode
		 * @param {String} string The Unicode input string (UCS-2).
		 * @returns {Array} The new array of code points.
		 */
		function ucs2decode(string) {
			var output = [],
			    counter = 0,
			    length = string.length,
			    value,
			    extra;
			while (counter < length) {
				value = string.charCodeAt(counter++);
				if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
					// high surrogate, and there is a next character
					extra = string.charCodeAt(counter++);
					if ((extra & 0xFC00) == 0xDC00) { // low surrogate
						output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
					} else {
						// unmatched surrogate; only append this code unit, in case the next
						// code unit is the high surrogate of a surrogate pair
						output.push(value);
						counter--;
					}
				} else {
					output.push(value);
				}
			}
			return output;
		}

		/**
		 * Creates a string based on an array of numeric code points.
		 * @see `punycode.ucs2.decode`
		 * @memberOf punycode.ucs2
		 * @name encode
		 * @param {Array} codePoints The array of numeric code points.
		 * @returns {String} The new Unicode string (UCS-2).
		 */
		function ucs2encode(array) {
			return map(array, function(value) {
				var output = '';
				if (value > 0xFFFF) {
					value -= 0x10000;
					output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
					value = 0xDC00 | value & 0x3FF;
				}
				output += stringFromCharCode(value);
				return output;
			}).join('');
		}

		/**
		 * Converts a basic code point into a digit/integer.
		 * @see `digitToBasic()`
		 * @private
		 * @param {Number} codePoint The basic numeric code point value.
		 * @returns {Number} The numeric value of a basic code point (for use in
		 * representing integers) in the range `0` to `base - 1`, or `base` if
		 * the code point does not represent a value.
		 */
		function basicToDigit(codePoint) {
			if (codePoint - 48 < 10) {
				return codePoint - 22;
			}
			if (codePoint - 65 < 26) {
				return codePoint - 65;
			}
			if (codePoint - 97 < 26) {
				return codePoint - 97;
			}
			return base;
		}

		/**
		 * Converts a digit/integer into a basic code point.
		 * @see `basicToDigit()`
		 * @private
		 * @param {Number} digit The numeric value of a basic code point.
		 * @returns {Number} The basic code point whose value (when used for
		 * representing integers) is `digit`, which needs to be in the range
		 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
		 * used; else, the lowercase form is used. The behavior is undefined
		 * if `flag` is non-zero and `digit` has no uppercase form.
		 */
		function digitToBasic(digit, flag) {
			//  0..25 map to ASCII a..z or A..Z
			// 26..35 map to ASCII 0..9
			return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
		}

		/**
		 * Bias adaptation function as per section 3.4 of RFC 3492.
		 * http://tools.ietf.org/html/rfc3492#section-3.4
		 * @private
		 */
		function adapt(delta, numPoints, firstTime) {
			var k = 0;
			delta = firstTime ? floor(delta / damp) : delta >> 1;
			delta += floor(delta / numPoints);
			for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
				delta = floor(delta / baseMinusTMin);
			}
			return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
		}

		/**
		 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
		 * symbols.
		 * @memberOf punycode
		 * @param {String} input The Punycode string of ASCII-only symbols.
		 * @returns {String} The resulting string of Unicode symbols.
		 */
		function decode(input) {
			// Don't use UCS-2
			var output = [],
			    inputLength = input.length,
			    out,
			    i = 0,
			    n = initialN,
			    bias = initialBias,
			    basic,
			    j,
			    index,
			    oldi,
			    w,
			    k,
			    digit,
			    t,
			    /** Cached calculation results */
			    baseMinusT;

			// Handle the basic code points: let `basic` be the number of input code
			// points before the last delimiter, or `0` if there is none, then copy
			// the first basic code points to the output.

			basic = input.lastIndexOf(delimiter);
			if (basic < 0) {
				basic = 0;
			}

			for (j = 0; j < basic; ++j) {
				// if it's not a basic code point
				if (input.charCodeAt(j) >= 0x80) {
					error('not-basic');
				}
				output.push(input.charCodeAt(j));
			}

			// Main decoding loop: start just after the last delimiter if any basic code
			// points were copied; start at the beginning otherwise.

			for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

				// `index` is the index of the next character to be consumed.
				// Decode a generalized variable-length integer into `delta`,
				// which gets added to `i`. The overflow checking is easier
				// if we increase `i` as we go, then subtract off its starting
				// value at the end to obtain `delta`.
				for (oldi = i, w = 1, k = base; /* no condition */; k += base) {

					if (index >= inputLength) {
						error('invalid-input');
					}

					digit = basicToDigit(input.charCodeAt(index++));

					if (digit >= base || digit > floor((maxInt - i) / w)) {
						error('overflow');
					}

					i += digit * w;
					t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);

					if (digit < t) {
						break;
					}

					baseMinusT = base - t;
					if (w > floor(maxInt / baseMinusT)) {
						error('overflow');
					}

					w *= baseMinusT;

				}

				out = output.length + 1;
				bias = adapt(i - oldi, out, oldi == 0);

				// `i` was supposed to wrap around from `out` to `0`,
				// incrementing `n` each time, so we'll fix that now:
				if (floor(i / out) > maxInt - n) {
					error('overflow');
				}

				n += floor(i / out);
				i %= out;

				// Insert `n` at position `i` of the output
				output.splice(i++, 0, n);

			}

			return ucs2encode(output);
		}

		/**
		 * Converts a string of Unicode symbols (e.g. a domain name label) to a
		 * Punycode string of ASCII-only symbols.
		 * @memberOf punycode
		 * @param {String} input The string of Unicode symbols.
		 * @returns {String} The resulting Punycode string of ASCII-only symbols.
		 */
		function encode(input) {
			var n,
			    delta,
			    handledCPCount,
			    basicLength,
			    bias,
			    j,
			    m,
			    q,
			    k,
			    t,
			    currentValue,
			    output = [],
			    /** `inputLength` will hold the number of code points in `input`. */
			    inputLength,
			    /** Cached calculation results */
			    handledCPCountPlusOne,
			    baseMinusT,
			    qMinusT;

			// Convert the input in UCS-2 to Unicode
			input = ucs2decode(input);

			// Cache the length
			inputLength = input.length;

			// Initialize the state
			n = initialN;
			delta = 0;
			bias = initialBias;

			// Handle the basic code points
			for (j = 0; j < inputLength; ++j) {
				currentValue = input[j];
				if (currentValue < 0x80) {
					output.push(stringFromCharCode(currentValue));
				}
			}

			handledCPCount = basicLength = output.length;

			// `handledCPCount` is the number of code points that have been handled;
			// `basicLength` is the number of basic code points.

			// Finish the basic string - if it is not empty - with a delimiter
			if (basicLength) {
				output.push(delimiter);
			}

			// Main encoding loop:
			while (handledCPCount < inputLength) {

				// All non-basic code points < n have been handled already. Find the next
				// larger one:
				for (m = maxInt, j = 0; j < inputLength; ++j) {
					currentValue = input[j];
					if (currentValue >= n && currentValue < m) {
						m = currentValue;
					}
				}

				// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
				// but guard against overflow
				handledCPCountPlusOne = handledCPCount + 1;
				if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
					error('overflow');
				}

				delta += (m - n) * handledCPCountPlusOne;
				n = m;

				for (j = 0; j < inputLength; ++j) {
					currentValue = input[j];

					if (currentValue < n && ++delta > maxInt) {
						error('overflow');
					}

					if (currentValue == n) {
						// Represent delta as a generalized variable-length integer
						for (q = delta, k = base; /* no condition */; k += base) {
							t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
							if (q < t) {
								break;
							}
							qMinusT = q - t;
							baseMinusT = base - t;
							output.push(
								stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
							);
							q = floor(qMinusT / baseMinusT);
						}

						output.push(stringFromCharCode(digitToBasic(q, 0)));
						bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
						delta = 0;
						++handledCPCount;
					}
				}

				++delta;
				++n;

			}
			return output.join('');
		}

		/**
		 * Converts a Punycode string representing a domain name or an email address
		 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
		 * it doesn't matter if you call it on a string that has already been
		 * converted to Unicode.
		 * @memberOf punycode
		 * @param {String} input The Punycoded domain name or email address to
		 * convert to Unicode.
		 * @returns {String} The Unicode representation of the given Punycode
		 * string.
		 */
		function toUnicode(input) {
			return mapDomain(input, function(string) {
				return regexPunycode.test(string)
					? decode(string.slice(4).toLowerCase())
					: string;
			});
		}

		/**
		 * Converts a Unicode string representing a domain name or an email address to
		 * Punycode. Only the non-ASCII parts of the domain name will be converted,
		 * i.e. it doesn't matter if you call it with a domain that's already in
		 * ASCII.
		 * @memberOf punycode
		 * @param {String} input The domain name or email address to convert, as a
		 * Unicode string.
		 * @returns {String} The Punycode representation of the given domain name or
		 * email address.
		 */
		function toASCII(input) {
			return mapDomain(input, function(string) {
				return regexNonASCII.test(string)
					? 'xn--' + encode(string)
					: string;
			});
		}

		/*--------------------------------------------------------------------------*/

		/** Define the public API */
		punycode = {
			/**
			 * A string representing the current Punycode.js version number.
			 * @memberOf punycode
			 * @type String
			 */
			'version': '1.3.2',
			/**
			 * An object of methods to convert from JavaScript's internal character
			 * representation (UCS-2) to Unicode code points, and back.
			 * @see <https://mathiasbynens.be/notes/javascript-encoding>
			 * @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 undefined == 'function' &&
			typeof undefined.amd == 'object' &&
			undefined.amd
		) {
			undefined('punycode', function() {
				return punycode;
			});
		} else if (freeExports && freeModule) {
			if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
				freeModule.exports = punycode;
			} else { // in Narwhal or RingoJS v0.7.0-
				for (key in punycode) {
					punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
				}
			}
		} else { // in Rhino or a web browser
			root.punycode = punycode;
		}

	}(commonjsGlobal));
	});

	'use strict';

	var util = {
	  isString: function(arg) {
	    return typeof(arg) === 'string';
	  },
	  isObject: function(arg) {
	    return typeof(arg) === 'object' && arg !== null;
	  },
	  isNull: function(arg) {
	    return arg === null;
	  },
	  isNullOrUndefined: function(arg) {
	    return arg == null;
	  }
	};
	var util_1 = util.isString;
	var util_2 = util.isObject;
	var util_3 = util.isNull;
	var util_4 = util.isNullOrUndefined;

	// Copyright Joyent, Inc. and other Node contributors.
	//
	// Permission is hereby granted, free of charge, to any person obtaining a
	// copy of this software and associated documentation files (the
	// "Software"), to deal in the Software without restriction, including
	// without limitation the rights to use, copy, modify, merge, publish,
	// distribute, sublicense, and/or sell copies of the Software, and to permit
	// persons to whom the Software is furnished to do so, subject to the
	// following conditions:
	//
	// The above copyright notice and this permission notice shall be included
	// in all copies or substantial portions of the Software.
	//
	// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
	// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
	// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
	// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
	// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
	// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
	// USE OR OTHER DEALINGS IN THE SOFTWARE.

	'use strict';

	// If obj.hasOwnProperty has been overridden, then calling
	// obj.hasOwnProperty(prop) will break.
	// See: https://github.com/joyent/node/issues/1707
	function hasOwnProperty$1(obj, prop) {
	  return Object.prototype.hasOwnProperty.call(obj, prop);
	}

	var decode = function(qs, sep, eq, options) {
	  sep = sep || '&';
	  eq = eq || '=';
	  var obj = {};

	  if (typeof qs !== 'string' || qs.length === 0) {
	    return obj;
	  }

	  var regexp = /\+/g;
	  qs = qs.split(sep);

	  var maxKeys = 1000;
	  if (options && typeof options.maxKeys === 'number') {
	    maxKeys = options.maxKeys;
	  }

	  var len = qs.length;
	  // maxKeys <= 0 means that we should not limit keys count
	  if (maxKeys > 0 && len > maxKeys) {
	    len = maxKeys;
	  }

	  for (var i = 0; i < len; ++i) {
	    var x = qs[i].replace(regexp, '%20'),
	        idx = x.indexOf(eq),
	        kstr, vstr, k, v;

	    if (idx >= 0) {
	      kstr = x.substr(0, idx);
	      vstr = x.substr(idx + 1);
	    } else {
	      kstr = x;
	      vstr = '';
	    }

	    k = decodeURIComponent(kstr);
	    v = decodeURIComponent(vstr);

	    if (!hasOwnProperty$1(obj, k)) {
	      obj[k] = v;
	    } else if (Array.isArray(obj[k])) {
	      obj[k].push(v);
	    } else {
	      obj[k] = [obj[k], v];
	    }
	  }

	  return obj;
	};

	// Copyright Joyent, Inc. and other Node contributors.
	//
	// Permission is hereby granted, free of charge, to any person obtaining a
	// copy of this software and associated documentation files (the
	// "Software"), to deal in the Software without restriction, including
	// without limitation the rights to use, copy, modify, merge, publish,
	// distribute, sublicense, and/or sell copies of the Software, and to permit
	// persons to whom the Software is furnished to do so, subject to the
	// following conditions:
	//
	// The above copyright notice and this permission notice shall be included
	// in all copies or substantial portions of the Software.
	//
	// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
	// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
	// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
	// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
	// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
	// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
	// USE OR OTHER DEALINGS IN THE SOFTWARE.

	'use strict';

	var stringifyPrimitive = function(v) {
	  switch (typeof v) {
	    case 'string':
	      return v;

	    case 'boolean':
	      return v ? 'true' : 'false';

	    case 'number':
	      return isFinite(v) ? v : '';

	    default:
	      return '';
	  }
	};

	var encode = function(obj, sep, eq, name) {
	  sep = sep || '&';
	  eq = eq || '=';
	  if (obj === null) {
	    obj = undefined;
	  }

	  if (typeof obj === 'object') {
	    return Object.keys(obj).map(function(k) {
	      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
	      if (Array.isArray(obj[k])) {
	        return obj[k].map(function(v) {
	          return ks + encodeURIComponent(stringifyPrimitive(v));
	        }).join(sep);
	      } else {
	        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
	      }
	    }).join(sep);

	  }

	  if (!name) { return ''; }
	  return encodeURIComponent(stringifyPrimitive(name)) + eq +
	         encodeURIComponent(stringifyPrimitive(obj));
	};

	var querystring = createCommonjsModule(function (module, exports) {
	'use strict';

	exports.decode = exports.parse = decode;
	exports.encode = exports.stringify = encode;
	});
	var querystring_1 = querystring.decode;
	var querystring_2 = querystring.parse;
	var querystring_3 = querystring.encode;
	var querystring_4 = querystring.stringify;

	// Copyright Joyent, Inc. and other Node contributors.
	//
	// Permission is hereby granted, free of charge, to any person obtaining a
	// copy of this software and associated documentation files (the
	// "Software"), to deal in the Software without restriction, including
	// without limitation the rights to use, copy, modify, merge, publish,
	// distribute, sublicense, and/or sell copies of the Software, and to permit
	// persons to whom the Software is furnished to do so, subject to the
	// following conditions:
	//
	// The above copyright notice and this permission notice shall be included
	// in all copies or substantial portions of the Software.
	//
	// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
	// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
	// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
	// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
	// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
	// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
	// USE OR OTHER DEALINGS IN THE SOFTWARE.

	'use strict';




	var parse = urlParse;
	var resolve = urlResolve;
	var resolveObject = urlResolveObject;
	var format = urlFormat;

	var Url_1 = Url;

	function Url() {
	  this.protocol = null;
	  this.slashes = null;
	  this.auth = null;
	  this.host = null;
	  this.port = null;
	  this.hostname = null;
	  this.hash = null;
	  this.search = null;
	  this.query = null;
	  this.pathname = null;
	  this.path = null;
	  this.href = null;
	}

	// Reference: RFC 3986, RFC 1808, RFC 2396

	// define these here so at least they only have to be
	// compiled once on the first module load.
	var protocolPattern = /^([a-z0-9.+-]+:)/i,
	    portPattern = /:[0-9]*$/,

	    // Special case for a simple path URL
	    simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,

	    // RFC 2396: characters reserved for delimiting URLs.
	    // We actually just auto-escape these.
	    delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],

	    // RFC 2396: characters not allowed for various reasons.
	    unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),

	    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
	    autoEscape = ['\''].concat(unwise),
	    // Characters that are never ever allowed in a hostname.
	    // Note that any invalid chars are also handled, but these
	    // are the ones that are *expected* to be seen, so we fast-path
	    // them.
	    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
	    hostEndingChars = ['/', '?', '#'],
	    hostnameMaxLen = 255,
	    hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
	    hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
	    // protocols that can allow "unsafe" and "unwise" chars.
	    unsafeProtocol = {
	      'javascript': true,
	      'javascript:': true
	    },
	    // protocols that never have a hostname.
	    hostlessProtocol = {
	      'javascript': true,
	      'javascript:': true
	    },
	    // protocols that always contain a // bit.
	    slashedProtocol = {
	      'http': true,
	      'https': true,
	      'ftp': true,
	      'gopher': true,
	      'file': true,
	      'http:': true,
	      'https:': true,
	      'ftp:': true,
	      'gopher:': true,
	      'file:': true
	    };

	function urlParse(url, parseQueryString, slashesDenoteHost) {
	  if (url && util.isObject(url) && url instanceof Url) { return url; }

	  var u = new Url;
	  u.parse(url, parseQueryString, slashesDenoteHost);
	  return u;
	}

	Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
	  if (!util.isString(url)) {
	    throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
	  }

	  // Copy chrome, IE, opera backslash-handling behavior.
	  // Back slashes before the query string get converted to forward slashes
	  // See: https://code.google.com/p/chromium/issues/detail?id=25916
	  var queryIndex = url.indexOf('?'),
	      splitter =
	          (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
	      uSplit = url.split(splitter),
	      slashRegex = /\\/g;
	  uSplit[0] = uSplit[0].replace(slashRegex, '/');
	  url = uSplit.join(splitter);

	  var rest = url;

	  // trim before proceeding.
	  // This is to support parse stuff like "  http://foo.com  \n"
	  rest = rest.trim();

	  if (!slashesDenoteHost && url.split('#').length === 1) {
	    // Try fast path regexp
	    var simplePath = simplePathPattern.exec(rest);
	    if (simplePath) {
	      this.path = rest;
	      this.href = rest;
	      this.pathname = simplePath[1];
	      if (simplePath[2]) {
	        this.search = simplePath[2];
	        if (parseQueryString) {
	          this.query = querystring.parse(this.search.substr(1));
	        } else {
	          this.query = this.search.substr(1);
	        }
	      } else if (parseQueryString) {
	        this.search = '';
	        this.query = {};
	      }
	      return this;
	    }
	  }

	  var proto = protocolPattern.exec(rest);
	  if (proto) {
	    proto = proto[0];
	    var lowerProto = proto.toLowerCase();
	    this.protocol = lowerProto;
	    rest = rest.substr(proto.length);
	  }

	  // figure out if it's got a host
	  // user@server is *always* interpreted as a hostname, and url
	  // resolution will treat //foo/bar as host=foo,path=bar because that's
	  // how the browser resolves relative URLs.
	  if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
	    var slashes = rest.substr(0, 2) === '//';
	    if (slashes && !(proto && hostlessProtocol[proto])) {
	      rest = rest.substr(2);
	      this.slashes = true;
	    }
	  }

	  if (!hostlessProtocol[proto] &&
	      (slashes || (proto && !slashedProtocol[proto]))) {

	    // there's a hostname.
	    // the first instance of /, ?, ;, or # ends the host.
	    //
	    // If there is an @ in the hostname, then non-host chars *are* allowed
	    // to the left of the last @ sign, unless some host-ending character
	    // comes *before* the @-sign.
	    // URLs are obnoxious.
	    //
	    // ex:
	    // http://a@b@c/ => user:a@b host:c
	    // http://a@b?@c => user:a host:c path:/?@c

	    // v0.12 TODO(isaacs): This is not quite how Chrome does things.
	    // Review our test case against browsers more comprehensively.

	    // find the first instance of any hostEndingChars
	    var hostEnd = -1;
	    for (var i = 0; i < hostEndingChars.length; i++) {
	      var hec = rest.indexOf(hostEndingChars[i]);
	      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
	        { hostEnd = hec; }
	    }

	    // at this point, either we have an explicit point where the
	    // auth portion cannot go past, or the last @ char is the decider.
	    var auth, atSign;
	    if (hostEnd === -1) {
	      // atSign can be anywhere.
	      atSign = rest.lastIndexOf('@');
	    } else {
	      // atSign must be in auth portion.
	      // http://a@b/c@d => host:b auth:a path:/c@d
	      atSign = rest.lastIndexOf('@', hostEnd);
	    }

	    // Now we have a portion which is definitely the auth.
	    // Pull that off.
	    if (atSign !== -1) {
	      auth = rest.slice(0, atSign);
	      rest = rest.slice(atSign + 1);
	      this.auth = decodeURIComponent(auth);
	    }

	    // the host is the remaining to the left of the first non-host char
	    hostEnd = -1;
	    for (var i = 0; i < nonHostChars.length; i++) {
	      var hec = rest.indexOf(nonHostChars[i]);
	      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
	        { hostEnd = hec; }
	    }
	    // if we still have not hit it, then the entire thing is a host.
	    if (hostEnd === -1)
	      { hostEnd = rest.length; }

	    this.host = rest.slice(0, hostEnd);
	    rest = rest.slice(hostEnd);

	    // pull out port.
	    this.parseHost();

	    // we've indicated that there is a hostname,
	    // so even if it's empty, it has to be present.
	    this.hostname = this.hostname || '';

	    // if hostname begins with [ and ends with ]
	    // assume that it's an IPv6 address.
	    var ipv6Hostname = this.hostname[0] === '[' &&
	        this.hostname[this.hostname.length - 1] === ']';

	    // validate a little.
	    if (!ipv6Hostname) {
	      var hostparts = this.hostname.split(/\./);
	      for (var i = 0, l = hostparts.length; i < l; i++) {
	        var part = hostparts[i];
	        if (!part) { continue; }
	        if (!part.match(hostnamePartPattern)) {
	          var newpart = '';
	          for (var j = 0, k = part.length; j < k; j++) {
	            if (part.charCodeAt(j) > 127) {
	              // we replace non-ASCII char with a temporary placeholder
	              // we need this to make sure size of hostname is not
	              // broken by replacing non-ASCII by nothing
	              newpart += 'x';
	            } else {
	              newpart += part[j];
	            }
	          }
	          // we test again with ASCII char only
	          if (!newpart.match(hostnamePartPattern)) {
	            var validParts = hostparts.slice(0, i);
	            var notHost = hostparts.slice(i + 1);
	            var bit = part.match(hostnamePartStart);
	            if (bit) {
	              validParts.push(bit[1]);
	              notHost.unshift(bit[2]);
	            }
	            if (notHost.length) {
	              rest = '/' + notHost.join('.') + rest;
	            }
	            this.hostname = validParts.join('.');
	            break;
	          }
	        }
	      }
	    }

	    if (this.hostname.length > hostnameMaxLen) {
	      this.hostname = '';
	    } else {
	      // hostnames are always lower case.
	      this.hostname = this.hostname.toLowerCase();
	    }

	    if (!ipv6Hostname) {
	      // IDNA Support: Returns a punycoded representation of "domain".
	      // It only converts parts of the domain name that
	      // have non-ASCII characters, i.e. it doesn't matter if
	      // you call it with a domain that already is ASCII-only.
	      this.hostname = punycode.toASCII(this.hostname);
	    }

	    var p = this.port ? ':' + this.port : '';
	    var h = this.hostname || '';
	    this.host = h + p;
	    this.href += this.host;

	    // strip [ and ] from the hostname
	    // the host field still retains them, though
	    if (ipv6Hostname) {
	      this.hostname = this.hostname.substr(1, this.hostname.length - 2);
	      if (rest[0] !== '/') {
	        rest = '/' + rest;
	      }
	    }
	  }

	  // now rest is set to the post-host stuff.
	  // chop off any delim chars.
	  if (!unsafeProtocol[lowerProto]) {

	    // First, make 100% sure that any "autoEscape" chars get
	    // escaped, even if encodeURIComponent doesn't think they
	    // need to be.
	    for (var i = 0, l = autoEscape.length; i < l; i++) {
	      var ae = autoEscape[i];
	      if (rest.indexOf(ae) === -1)
	        { continue; }
	      var esc = encodeURIComponent(ae);
	      if (esc === ae) {
	        esc = escape(ae);
	      }
	      rest = rest.split(ae).join(esc);
	    }
	  }


	  // chop off from the tail first.
	  var hash = rest.indexOf('#');
	  if (hash !== -1) {
	    // got a fragment string.
	    this.hash = rest.substr(hash);
	    rest = rest.slice(0, hash);
	  }
	  var qm = rest.indexOf('?');
	  if (qm !== -1) {
	    this.search = rest.substr(qm);
	    this.query = rest.substr(qm + 1);
	    if (parseQueryString) {
	      this.query = querystring.parse(this.query);
	    }
	    rest = rest.slice(0, qm);
	  } else if (parseQueryString) {
	    // no query string, but parseQueryString still requested
	    this.search = '';
	    this.query = {};
	  }
	  if (rest) { this.pathname = rest; }
	  if (slashedProtocol[lowerProto] &&
	      this.hostname && !this.pathname) {
	    this.pathname = '/';
	  }

	  //to support http.request
	  if (this.pathname || this.search) {
	    var p = this.pathname || '';
	    var s = this.search || '';
	    this.path = p + s;
	  }

	  // finally, reconstruct the href based on what has been validated.
	  this.href = this.format();
	  return this;
	};

	// format a parsed object into a url string
	function urlFormat(obj) {
	  // ensure it's an object, and not a string url.
	  // If it's an obj, this is a no-op.
	  // this way, you can call url_format() on strings
	  // to clean up potentially wonky urls.
	  if (util.isString(obj)) { obj = urlParse(obj); }
	  if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }
	  return obj.format();
	}

	Url.prototype.format = function() {
	  var auth = this.auth || '';
	  if (auth) {
	    auth = encodeURIComponent(auth);
	    auth = auth.replace(/%3A/i, ':');
	    auth += '@';
	  }

	  var protocol = this.protocol || '',
	      pathname = this.pathname || '',
	      hash = this.hash || '',
	      host = false,
	      query = '';

	  if (this.host) {
	    host = auth + this.host;
	  } else if (this.hostname) {
	    host = auth + (this.hostname.indexOf(':') === -1 ?
	        this.hostname :
	        '[' + this.hostname + ']');
	    if (this.port) {
	      host += ':' + this.port;
	    }
	  }

	  if (this.query &&
	      util.isObject(this.query) &&
	      Object.keys(this.query).length) {
	    query = querystring.stringify(this.query);
	  }

	  var search = this.search || (query && ('?' + query)) || '';

	  if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; }

	  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.
	  // unless they had them to begin with.
	  if (this.slashes ||
	      (!protocol || slashedProtocol[protocol]) && host !== false) {
	    host = '//' + (host || '');
	    if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; }
	  } else if (!host) {
	    host = '';
	  }

	  if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; }
	  if (search && search.charAt(0) !== '?') { search = '?' + search; }

	  pathname = pathname.replace(/[?#]/g, function(match) {
	    return encodeURIComponent(match);
	  });
	  search = search.replace('#', '%23');

	  return protocol + host + pathname + search + hash;
	};

	function urlResolve(source, relative) {
	  return urlParse(source, false, true).resolve(relative);
	}

	Url.prototype.resolve = function(relative) {
	  return this.resolveObject(urlParse(relative, false, true)).format();
	};

	function urlResolveObject(source, relative) {
	  if (!source) { return relative; }
	  return urlParse(source, false, true).resolveObject(relative);
	}

	Url.prototype.resolveObject = function(relative) {
	  if (util.isString(relative)) {
	    var rel = new Url();
	    rel.parse(relative, false, true);
	    relative = rel;
	  }

	  var result = new Url();
	  var tkeys = Object.keys(this);
	  for (var tk = 0; tk < tkeys.length; tk++) {
	    var tkey = tkeys[tk];
	    result[tkey] = this[tkey];
	  }

	  // hash is always overridden, no matter what.
	  // even href="" will remove it.
	  result.hash = relative.hash;

	  // if the relative url is empty, then there's nothing left to do here.
	  if (relative.href === '') {
	    result.href = result.format();
	    return result;
	  }

	  // hrefs like //foo/bar always cut to the protocol.
	  if (relative.slashes && !relative.protocol) {
	    // take everything except the protocol from relative
	    var rkeys = Object.keys(relative);
	    for (var rk = 0; rk < rkeys.length; rk++) {
	      var rkey = rkeys[rk];
	      if (rkey !== 'protocol')
	        { result[rkey] = relative[rkey]; }
	    }

	    //urlParse appends trailing / to urls like http://www.example.com
	    if (slashedProtocol[result.protocol] &&
	        result.hostname && !result.pathname) {
	      result.path = result.pathname = '/';
	    }

	    result.href = result.format();
	    return result;
	  }

	  if (relative.protocol && relative.protocol !== result.protocol) {
	    // if it's a known url protocol, then changing
	    // the protocol does weird things
	    // first, if it's not file:, then we MUST have a host,
	    // and if there was a path
	    // to begin with, then we MUST have a path.
	    // if it is file:, then the host is dropped,
	    // because that's known to be hostless.
	    // anything else is assumed to be absolute.
	    if (!slashedProtocol[relative.protocol]) {
	      var keys = Object.keys(relative);
	      for (var v = 0; v < keys.length; v++) {
	        var k = keys[v];
	        result[k] = relative[k];
	      }
	      result.href = result.format();
	      return result;
	    }

	    result.protocol = relative.protocol;
	    if (!relative.host && !hostlessProtocol[relative.protocol]) {
	      var relPath = (relative.pathname || '').split('/');
	      while (relPath.length && !(relative.host = relPath.shift())){ ; }
	      if (!relative.host) { relative.host = ''; }
	      if (!relative.hostname) { relative.hostname = ''; }
	      if (relPath[0] !== '') { relPath.unshift(''); }
	      if (relPath.length < 2) { relPath.unshift(''); }
	      result.pathname = relPath.join('/');
	    } else {
	      result.pathname = relative.pathname;
	    }
	    result.search = relative.search;
	    result.query = relative.query;
	    result.host = relative.host || '';
	    result.auth = relative.auth;
	    result.hostname = relative.hostname || relative.host;
	    result.port = relative.port;
	    // to support http.request
	    if (result.pathname || result.search) {
	      var p = result.pathname || '';
	      var s = result.search || '';
	      result.path = p + s;
	    }
	    result.slashes = result.slashes || relative.slashes;
	    result.href = result.format();
	    return result;
	  }

	  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
	      isRelAbs = (
	          relative.host ||
	          relative.pathname && relative.pathname.charAt(0) === '/'
	      ),
	      mustEndAbs = (isRelAbs || isSourceAbs ||
	                    (result.host && relative.pathname)),
	      removeAllDots = mustEndAbs,
	      srcPath = result.pathname && result.pathname.split('/') || [],
	      relPath = relative.pathname && relative.pathname.split('/') || [],
	      psychotic = result.protocol && !slashedProtocol[result.protocol];

	  // if the url is a non-slashed url, then relative
	  // links like ../.. should be able
	  // to crawl up to the hostname, as well.  This is strange.
	  // result.protocol has already been set by now.
	  // Later on, put the first path part into the host field.
	  if (psychotic) {
	    result.hostname = '';
	    result.port = null;
	    if (result.host) {
	      if (srcPath[0] === '') { srcPath[0] = result.host; }
	      else { srcPath.unshift(result.host); }
	    }
	    result.host = '';
	    if (relative.protocol) {
	      relative.hostname = null;
	      relative.port = null;
	      if (relative.host) {
	        if (relPath[0] === '') { relPath[0] = relative.host; }
	        else { relPath.unshift(relative.host); }
	      }
	      relative.host = null;
	    }
	    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
	  }

	  if (isRelAbs) {
	    // it's absolute.
	    result.host = (relative.host || relative.host === '') ?
	                  relative.host : result.host;
	    result.hostname = (relative.hostname || relative.hostname === '') ?
	                      relative.hostname : result.hostname;
	    result.search = relative.search;
	    result.query = relative.query;
	    srcPath = relPath;
	    // fall through to the dot-handling below.
	  } else if (relPath.length) {
	    // it's relative
	    // throw away the existing file, and take the new path instead.
	    if (!srcPath) { srcPath = []; }
	    srcPath.pop();
	    srcPath = srcPath.concat(relPath);
	    result.search = relative.search;
	    result.query = relative.query;
	  } else if (!util.isNullOrUndefined(relative.search)) {
	    // just pull out the search.
	    // like href='?foo'.
	    // Put this after the other two cases because it simplifies the booleans
	    if (psychotic) {
	      result.hostname = result.host = srcPath.shift();
	      //occationaly the auth can get stuck only in host
	      //this especially happens in cases like
	      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
	      var authInHost = result.host && result.host.indexOf('@') > 0 ?
	                       result.host.split('@') : false;
	      if (authInHost) {
	        result.auth = authInHost.shift();
	        result.host = result.hostname = authInHost.shift();
	      }
	    }
	    result.search = relative.search;
	    result.query = relative.query;
	    //to support http.request
	    if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
	      result.path = (result.pathname ? result.pathname : '') +
	                    (result.search ? result.search : '');
	    }
	    result.href = result.format();
	    return result;
	  }

	  if (!srcPath.length) {
	    // no path at all.  easy.
	    // we've already handled the other stuff above.
	    result.pathname = null;
	    //to support http.request
	    if (result.search) {
	      result.path = '/' + result.search;
	    } else {
	      result.path = null;
	    }
	    result.href = result.format();
	    return result;
	  }

	  // if a url ENDs in . or .., then it must get a trailing slash.
	  // however, if it ends in anything else non-slashy,
	  // then it must NOT get a trailing slash.
	  var last = srcPath.slice(-1)[0];
	  var hasTrailingSlash = (
	      (result.host || relative.host || srcPath.length > 1) &&
	      (last === '.' || last === '..') || last === '');

	  // strip single dots, resolve double dots to parent dir
	  // if the path tries to go above the root, `up` ends up > 0
	  var up = 0;
	  for (var i = srcPath.length; i >= 0; i--) {
	    last = srcPath[i];
	    if (last === '.') {
	      srcPath.splice(i, 1);
	    } else if (last === '..') {
	      srcPath.splice(i, 1);
	      up++;
	    } else if (up) {
	      srcPath.splice(i, 1);
	      up--;
	    }
	  }

	  // if the path is allowed to go above the root, restore leading ..s
	  if (!mustEndAbs && !removeAllDots) {
	    for (; up--; up) {
	      srcPath.unshift('..');
	    }
	  }

	  if (mustEndAbs && srcPath[0] !== '' &&
	      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
	    srcPath.unshift('');
	  }

	  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
	    srcPath.push('');
	  }

	  var isAbsolute = srcPath[0] === '' ||
	      (srcPath[0] && srcPath[0].charAt(0) === '/');

	  // put the host back
	  if (psychotic) {
	    result.hostname = result.host = isAbsolute ? '' :
	                                    srcPath.length ? srcPath.shift() : '';
	    //occationaly the auth can get stuck only in host
	    //this especially happens in cases like
	    //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
	    var authInHost = result.host && result.host.indexOf('@') > 0 ?
	                     result.host.split('@') : false;
	    if (authInHost) {
	      result.auth = authInHost.shift();
	      result.host = result.hostname = authInHost.shift();
	    }
	  }

	  mustEndAbs = mustEndAbs || (result.host && srcPath.length);

	  if (mustEndAbs && !isAbsolute) {
	    srcPath.unshift('');
	  }

	  if (!srcPath.length) {
	    result.pathname = null;
	    result.path = null;
	  } else {
	    result.pathname = srcPath.join('/');
	  }

	  //to support request.http
	  if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
	    result.path = (result.pathname ? result.pathname : '') +
	                  (result.search ? result.search : '');
	  }
	  result.auth = relative.auth || result.auth;
	  result.slashes = result.slashes || relative.slashes;
	  result.href = result.format();
	  return result;
	};

	Url.prototype.parseHost = function() {
	  var host = this.host;
	  var port = portPattern.exec(host);
	  if (port) {
	    port = port[0];
	    if (port !== ':') {
	      this.port = port.substr(1);
	    }
	    host = host.substr(0, host.length - port.length);
	  }
	  if (host) { this.hostname = host; }
	};

	var url = {
		parse: parse,
		resolve: resolve,
		resolveObject: resolveObject,
		format: format,
		Url: Url_1
	};

	/*!
	 * @pixi/constants - v5.1.0
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/constants is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */
	/**
	 * Different types of environments for WebGL.
	 *
	 * @static
	 * @memberof PIXI
	 * @name ENV
	 * @enum {number}
	 * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility
	 *  with older / less advanced devices. If you experience unexplained flickering prefer this environment.
	 * @property {number} WEBGL - Version 1 of WebGL
	 * @property {number} WEBGL2 - Version 2 of WebGL
	 */
	var ENV = {
	    WEBGL_LEGACY: 0,
	    WEBGL: 1,
	    WEBGL2: 2,
	};

	/**
	 * Constant to identify the Renderer Type.
	 *
	 * @static
	 * @memberof PIXI
	 * @name RENDERER_TYPE
	 * @enum {number}
	 * @property {number} UNKNOWN - Unknown render type.
	 * @property {number} WEBGL - WebGL render type.
	 * @property {number} CANVAS - Canvas render type.
	 */
	var RENDERER_TYPE = {
	    UNKNOWN:    0,
	    WEBGL:      1,
	    CANVAS:     2,
	};

	/**
	 * Various blend modes supported by PIXI.
	 *
	 * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.
	 * Anything else will silently act like NORMAL.
	 *
	 * @memberof PIXI
	 * @name BLEND_MODES
	 * @enum {number}
	 * @property {number} NORMAL
	 * @property {number} ADD
	 * @property {number} MULTIPLY
	 * @property {number} SCREEN
	 * @property {number} OVERLAY
	 * @property {number} DARKEN
	 * @property {number} LIGHTEN
	 * @property {number} COLOR_DODGE
	 * @property {number} COLOR_BURN
	 * @property {number} HARD_LIGHT
	 * @property {number} SOFT_LIGHT
	 * @property {number} DIFFERENCE
	 * @property {number} EXCLUSION
	 * @property {number} HUE
	 * @property {number} SATURATION
	 * @property {number} COLOR
	 * @property {number} LUMINOSITY
	 * @property {number} NORMAL_NPM
	 * @property {number} ADD_NPM
	 * @property {number} SCREEN_NPM
	 * @property {number} NONE
	 * @property {number} SRC_IN
	 * @property {number} SRC_OUT
	 * @property {number} SRC_ATOP
	 * @property {number} DST_OVER
	 * @property {number} DST_IN
	 * @property {number} DST_OUT
	 * @property {number} DST_ATOP
	 * @property {number} SUBTRACT
	 * @property {number} SRC_OVER
	 * @property {number} ERASE
	 */
	var BLEND_MODES = {
	    NORMAL:         0,
	    ADD:            1,
	    MULTIPLY:       2,
	    SCREEN:         3,
	    OVERLAY:        4,
	    DARKEN:         5,
	    LIGHTEN:        6,
	    COLOR_DODGE:    7,
	    COLOR_BURN:     8,
	    HARD_LIGHT:     9,
	    SOFT_LIGHT:     10,
	    DIFFERENCE:     11,
	    EXCLUSION:      12,
	    HUE:            13,
	    SATURATION:     14,
	    COLOR:          15,
	    LUMINOSITY:     16,
	    NORMAL_NPM:     17,
	    ADD_NPM:        18,
	    SCREEN_NPM:     19,
	    NONE:           20,

	    SRC_OVER:       0,
	    SRC_IN:         21,
	    SRC_OUT:        22,
	    SRC_ATOP:       23,
	    DST_OVER:       24,
	    DST_IN:         25,
	    DST_OUT:        26,
	    DST_ATOP:       27,
	    ERASE:          26,
	    SUBTRACT:       28,
	};

	/**
	 * Various webgl draw modes. These can be used to specify which GL drawMode to use
	 * under certain situations and renderers.
	 *
	 * @memberof PIXI
	 * @static
	 * @name DRAW_MODES
	 * @enum {number}
	 * @property {number} POINTS
	 * @property {number} LINES
	 * @property {number} LINE_LOOP
	 * @property {number} LINE_STRIP
	 * @property {number} TRIANGLES
	 * @property {number} TRIANGLE_STRIP
	 * @property {number} TRIANGLE_FAN
	 */
	var DRAW_MODES = {
	    POINTS:         0,
	    LINES:          1,
	    LINE_LOOP:      2,
	    LINE_STRIP:     3,
	    TRIANGLES:      4,
	    TRIANGLE_STRIP: 5,
	    TRIANGLE_FAN:   6,
	};

	/**
	 * Various GL texture/resources formats.
	 *
	 * @memberof PIXI
	 * @static
	 * @name FORMATS
	 * @enum {number}
	 * @property {number} RGBA=6408
	 * @property {number} RGB=6407
	 * @property {number} ALPHA=6406
	 * @property {number} LUMINANCE=6409
	 * @property {number} LUMINANCE_ALPHA=6410
	 * @property {number} DEPTH_COMPONENT=6402
	 * @property {number} DEPTH_STENCIL=34041
	 */
	var FORMATS = {
	    RGBA:             6408,
	    RGB:              6407,
	    ALPHA:            6406,
	    LUMINANCE:        6409,
	    LUMINANCE_ALPHA:  6410,
	    DEPTH_COMPONENT:  6402,
	    DEPTH_STENCIL:    34041,
	};

	/**
	 * Various GL target types.
	 *
	 * @memberof PIXI
	 * @static
	 * @name TARGETS
	 * @enum {number}
	 * @property {number} TEXTURE_2D=3553
	 * @property {number} TEXTURE_CUBE_MAP=34067
	 * @property {number} TEXTURE_2D_ARRAY=35866
	 * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069
	 * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070
	 * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071
	 * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072
	 * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073
	 * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074
	 */
	var TARGETS = {
	    TEXTURE_2D: 3553,
	    TEXTURE_CUBE_MAP: 34067,
	    TEXTURE_2D_ARRAY: 35866,
	    TEXTURE_CUBE_MAP_POSITIVE_X: 34069,
	    TEXTURE_CUBE_MAP_NEGATIVE_X: 34070,
	    TEXTURE_CUBE_MAP_POSITIVE_Y: 34071,
	    TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072,
	    TEXTURE_CUBE_MAP_POSITIVE_Z: 34073,
	    TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074,
	};

	/**
	 * Various GL data format types.
	 *
	 * @memberof PIXI
	 * @static
	 * @name TYPES
	 * @enum {number}
	 * @property {number} UNSIGNED_BYTE=5121
	 * @property {number} UNSIGNED_SHORT=5123
	 * @property {number} UNSIGNED_SHORT_5_6_5=33635
	 * @property {number} UNSIGNED_SHORT_4_4_4_4=32819
	 * @property {number} UNSIGNED_SHORT_5_5_5_1=32820
	 * @property {number} FLOAT=5126
	 * @property {number} HALF_FLOAT=36193
	 */
	var TYPES = {
	    UNSIGNED_BYTE: 5121,
	    UNSIGNED_SHORT: 5123,
	    UNSIGNED_SHORT_5_6_5: 33635,
	    UNSIGNED_SHORT_4_4_4_4: 32819,
	    UNSIGNED_SHORT_5_5_5_1: 32820,
	    FLOAT: 5126,
	    HALF_FLOAT: 36193,
	};

	/**
	 * The scale modes that are supported by pixi.
	 *
	 * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.
	 * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.
	 *
	 * @memberof PIXI
	 * @static
	 * @name SCALE_MODES
	 * @enum {number}
	 * @property {number} LINEAR Smooth scaling
	 * @property {number} NEAREST Pixelating scaling
	 */
	var SCALE_MODES = {
	    LINEAR:     1,
	    NEAREST:    0,
	};

	/**
	 * The wrap modes that are supported by pixi.
	 *
	 * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.
	 * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.
	 * If the texture is non power of two then clamp will be used regardless as WebGL can
	 * only use REPEAT if the texture is po2.
	 *
	 * This property only affects WebGL.
	 *
	 * @name WRAP_MODES
	 * @memberof PIXI
	 * @static
	 * @enum {number}
	 * @property {number} CLAMP - The textures uvs are clamped
	 * @property {number} REPEAT - The texture uvs tile and repeat
	 * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring
	 */
	var WRAP_MODES = {
	    CLAMP:           33071,
	    REPEAT:          10497,
	    MIRRORED_REPEAT: 33648,
	};

	/**
	 * Mipmap filtering modes that are supported by pixi.
	 *
	 * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.
	 * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,
	 * or its `POW2` and texture dimensions are powers of 2.
	 * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.
	 *
	 * This property only affects WebGL.
	 *
	 * @name MIPMAP_MODES
	 * @memberof PIXI
	 * @static
	 * @enum {number}
	 * @property {number} OFF - No mipmaps
	 * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2
	 * @property {number} ON - Always generate mipmaps
	 */
	var MIPMAP_MODES = {
	    OFF: 0,
	    POW2: 1,
	    ON: 2,
	};

	/**
	 * The gc modes that are supported by pixi.
	 *
	 * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO
	 * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not
	 * used for a specified period of time they will be removed from the GPU. They will of course
	 * be uploaded again when they are required. This is a silent behind the scenes process that
	 * should ensure that the GPU does not  get filled up.
	 *
	 * Handy for mobile devices!
	 * This property only affects WebGL.
	 *
	 * @name GC_MODES
	 * @enum {number}
	 * @static
	 * @memberof PIXI
	 * @property {number} AUTO - Garbage collection will happen periodically automatically
	 * @property {number} MANUAL - Garbage collection will need to be called manually
	 */
	var GC_MODES = {
	    AUTO:           0,
	    MANUAL:         1,
	};

	/**
	 * Constants that specify float precision in shaders.
	 *
	 * @name PRECISION
	 * @memberof PIXI
	 * @static
	 * @enum {string}
	 * @constant
	 * @property {string} LOW='lowp'
	 * @property {string} MEDIUM='mediump'
	 * @property {string} HIGH='highp'
	 */
	var PRECISION = {
	    LOW: 'lowp',
	    MEDIUM: 'mediump',
	    HIGH: 'highp',
	};

	/*!
	 * @pixi/utils - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/utils is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * The prefix that denotes a URL is for a retina asset.
	 *
	 * @static
	 * @name RETINA_PREFIX
	 * @memberof PIXI.settings
	 * @type {RegExp}
	 * @default /@([0-9\.]+)x/
	 * @example `@2x`
	 */
	settings.RETINA_PREFIX = /@([0-9\.]+)x/;

	/**
	 * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.
	 * For most scenarios this should be left as true, as otherwise the user may have a poor experience.
	 * However, it can be useful to disable under certain scenarios, such as headless unit tests.
	 *
	 * @static
	 * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT
	 * @memberof PIXI.settings
	 * @type {boolean}
	 * @default true
	 */
	settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;

	var saidHello = false;
	var VERSION = '5.1.5';

	/**
	 * Skips the hello message of renderers that are created after this is run.
	 *
	 * @function skipHello
	 * @memberof PIXI.utils
	 */
	function skipHello()
	{
	    saidHello = true;
	}

	/**
	 * Logs out the version and renderer information for this running instance of PIXI.
	 * If you don't want to see this message you can run `PIXI.utils.skipHello()` before
	 * creating your renderer. Keep in mind that doing that will forever make you a jerk face.
	 *
	 * @static
	 * @function sayHello
	 * @memberof PIXI.utils
	 * @param {string} type - The string renderer type to log.
	 */
	function sayHello(type)
	{
	    if (saidHello)
	    {
	        return;
	    }

	    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
	    {
	        var args = [
	            ("\n %c %c %c PixiJS " + VERSION + " - ✰ " + type + " ✰  %c  %c  http://www.pixijs.com/  %c %c ♥%c♥%c♥ \n\n"),
	            '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;' ];

	        window.console.log.apply(console, args);
	    }
	    else if (window.console)
	    {
	        window.console.log(("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"));
	    }

	    saidHello = true;
	}

	var supported;

	/**
	 * Helper for checking for WebGL support.
	 *
	 * @memberof PIXI.utils
	 * @function isWebGLSupported
	 * @return {boolean} Is WebGL supported.
	 */
	function isWebGLSupported()
	{
	    if (typeof supported === 'undefined')
	    {
	        supported = (function supported()
	        {
	            var contextOptions = {
	                stencil: true,
	                failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,
	            };

	            try
	            {
	                if (!window.WebGLRenderingContext)
	                {
	                    return false;
	                }

	                var canvas = document.createElement('canvas');
	                var gl = canvas.getContext('webgl', contextOptions)
	                    || canvas.getContext('experimental-webgl', contextOptions);

	                var success = !!(gl && gl.getContextAttributes().stencil);

	                if (gl)
	                {
	                    var loseContext = gl.getExtension('WEBGL_lose_context');

	                    if (loseContext)
	                    {
	                        loseContext.loseContext();
	                    }
	                }

	                gl = null;

	                return success;
	            }
	            catch (e)
	            {
	                return false;
	            }
	        })();
	    }

	    return supported;
	}

	/**
	 * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).
	 *
	 * @example
	 * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]
	 * @memberof PIXI.utils
	 * @function hex2rgb
	 * @param {number} hex - The hexadecimal number to convert
	 * @param  {number[]} [out=[]] If supplied, this array will be used rather than returning a new one
	 * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.
	 */
	function hex2rgb(hex, out)
	{
	    out = out || [];

	    out[0] = ((hex >> 16) & 0xFF) / 255;
	    out[1] = ((hex >> 8) & 0xFF) / 255;
	    out[2] = (hex & 0xFF) / 255;

	    return out;
	}

	/**
	 * Converts a hexadecimal color number to a string.
	 *
	 * @example
	 * PIXI.utils.hex2string(0xffffff); // returns "#ffffff"
	 * @memberof PIXI.utils
	 * @function hex2string
	 * @param {number} hex - Number in hex (e.g., `0xffffff`)
	 * @return {string} The string color (e.g., `"#ffffff"`).
	 */
	function hex2string(hex)
	{
	    hex = hex.toString(16);
	    hex = '000000'.substr(0, 6 - hex.length) + hex;

	    return ("#" + hex);
	}

	/**
	 * Converts a hexadecimal string to a hexadecimal color number.
	 *
	 * @example
	 * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff
	 * @memberof PIXI.utils
	 * @function string2hex
	 * @param {string} The string color (e.g., `"#ffffff"`)
	 * @return {number} Number in hexadecimal.
	 */
	function string2hex(string)
	{
	    if (typeof string === 'string' && string[0] === '#')
	    {
	        string = string.substr(1);
	    }

	    return parseInt(string, 16);
	}

	/**
	 * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.
	 *
	 * @example
	 * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff
	 * @memberof PIXI.utils
	 * @function rgb2hex
	 * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.
	 * @return {number} Number in hexadecimal.
	 */
	function rgb2hex(rgb)
	{
	    return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));
	}

	/**
	 * Corrects PixiJS blend, takes premultiplied alpha into account
	 *
	 * @memberof PIXI.utils
	 * @function mapPremultipliedBlendModes
	 * @private
	 * @param {Array<number[]>} [array] - The array to output into.
	 * @return {Array<number[]>} Mapped modes.
	 */
	function mapPremultipliedBlendModes()
	{
	    var pm = [];
	    var npm = [];

	    for (var i = 0; i < 32; i++)
	    {
	        pm[i] = i;
	        npm[i] = i;
	    }

	    pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;
	    pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;
	    pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;

	    npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;
	    npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;
	    npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;

	    var array = [];

	    array.push(npm);
	    array.push(pm);

	    return array;
	}

	/**
	 * maps premultiply flag and blendMode to adjusted blendMode
	 * @memberof PIXI.utils
	 * @const premultiplyBlendMode
	 * @type {Array<number[]>}
	 */
	var premultiplyBlendMode = mapPremultipliedBlendModes();

	/**
	 * changes blendMode according to texture format
	 *
	 * @memberof PIXI.utils
	 * @function correctBlendMode
	 * @param {number} blendMode supposed blend mode
	 * @param {boolean} premultiplied  whether source is premultiplied
	 * @returns {number} true blend mode for this texture
	 */
	function correctBlendMode(blendMode, premultiplied)
	{
	    return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];
	}

	/**
	 * combines rgb and alpha to out array
	 *
	 * @memberof PIXI.utils
	 * @function premultiplyRgba
	 * @param {Float32Array|number[]} rgb input rgb
	 * @param {number} alpha alpha param
	 * @param {Float32Array} [out] output
	 * @param {boolean} [premultiply=true] do premultiply it
	 * @returns {Float32Array} vec4 rgba
	 */
	function premultiplyRgba(rgb, alpha, out, premultiply)
	{
	    out = out || new Float32Array(4);
	    if (premultiply || premultiply === undefined)
	    {
	        out[0] = rgb[0] * alpha;
	        out[1] = rgb[1] * alpha;
	        out[2] = rgb[2] * alpha;
	    }
	    else
	    {
	        out[0] = rgb[0];
	        out[1] = rgb[1];
	        out[2] = rgb[2];
	    }
	    out[3] = alpha;

	    return out;
	}

	/**
	 * premultiplies tint
	 *
	 * @memberof PIXI.utils
	 * @function premultiplyTint
	 * @param {number} tint integer RGB
	 * @param {number} alpha floating point alpha (0.0-1.0)
	 * @returns {number} tint multiplied by alpha
	 */
	function premultiplyTint(tint, alpha)
	{
	    if (alpha === 1.0)
	    {
	        return (alpha * 255 << 24) + tint;
	    }
	    if (alpha === 0.0)
	    {
	        return 0;
	    }
	    var R = ((tint >> 16) & 0xFF);
	    var G = ((tint >> 8) & 0xFF);
	    var B = (tint & 0xFF);

	    R = ((R * alpha) + 0.5) | 0;
	    G = ((G * alpha) + 0.5) | 0;
	    B = ((B * alpha) + 0.5) | 0;

	    return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;
	}

	/**
	 * converts integer tint and float alpha to vec4 form, premultiplies by default
	 *
	 * @memberof PIXI.utils
	 * @function premultiplyTintToRgba
	 * @param {number} tint input tint
	 * @param {number} alpha alpha param
	 * @param {Float32Array} [out] output
	 * @param {boolean} [premultiply=true] do premultiply it
	 * @returns {Float32Array} vec4 rgba
	 */
	function premultiplyTintToRgba(tint, alpha, out, premultiply)
	{
	    out = out || new Float32Array(4);
	    out[0] = ((tint >> 16) & 0xFF) / 255.0;
	    out[1] = ((tint >> 8) & 0xFF) / 255.0;
	    out[2] = (tint & 0xFF) / 255.0;
	    if (premultiply || premultiply === undefined)
	    {
	        out[0] *= alpha;
	        out[1] *= alpha;
	        out[2] *= alpha;
	    }
	    out[3] = alpha;

	    return out;
	}

	/**
	 * Generic Mask Stack data structure
	 *
	 * @memberof PIXI.utils
	 * @function createIndicesForQuads
	 * @param {number} size - Number of quads
	 * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`
	 * @return {Uint16Array|Uint32Array} - Resulting index buffer
	 */
	function createIndicesForQuads(size, outBuffer)
	{
	    if ( outBuffer === void 0 ) { outBuffer = null; }

	    // the total number of indices in our array, there are 6 points per quad.
	    var totalIndices = size * 6;

	    outBuffer = outBuffer || new Uint16Array(totalIndices);

	    if (outBuffer.length !== totalIndices)
	    {
	        throw new Error(("Out buffer length is incorrect, got " + (outBuffer.length) + " and expected " + totalIndices));
	    }

	    // fill the indices with the quads to draw
	    for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4)
	    {
	        outBuffer[i + 0] = j + 0;
	        outBuffer[i + 1] = j + 1;
	        outBuffer[i + 2] = j + 2;
	        outBuffer[i + 3] = j + 0;
	        outBuffer[i + 4] = j + 2;
	        outBuffer[i + 5] = j + 3;
	    }

	    return outBuffer;
	}

	/**
	 * Remove items from a javascript array without generating garbage
	 *
	 * @function removeItems
	 * @memberof PIXI.utils
	 * @param {Array<any>} arr Array to remove elements from
	 * @param {number} startIdx starting index
	 * @param {number} removeCount how many to remove
	 */
	function removeItems(arr, startIdx, removeCount)
	{
	    var length = arr.length;
	    var i;

	    if (startIdx >= length || removeCount === 0)
	    {
	        return;
	    }

	    removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);

	    var len = length - removeCount;

	    for (i = startIdx; i < len; ++i)
	    {
	        arr[i] = arr[i + removeCount];
	    }

	    arr.length = len;
	}

	var nextUid = 0;

	/**
	 * Gets the next unique identifier
	 *
	 * @memberof PIXI.utils
	 * @function uid
	 * @return {number} The next unique identifier to use.
	 */
	function uid()
	{
	    return ++nextUid;
	}

	/**
	 * Returns sign of number
	 *
	 * @memberof PIXI.utils
	 * @function sign
	 * @param {number} n - the number to check the sign of
	 * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive
	 */
	function sign$1(n)
	{
	    if (n === 0) { return 0; }

	    return n < 0 ? -1 : 1;
	}

	// Taken from the bit-twiddle package

	/**
	 * Rounds to next power of two.
	 *
	 * @function nextPow2
	 * @memberof PIXI.utils
	 * @param {number} v input value
	 * @return {number}
	 */
	function nextPow2(v)
	{
	    v += v === 0;
	    --v;
	    v |= v >>> 1;
	    v |= v >>> 2;
	    v |= v >>> 4;
	    v |= v >>> 8;
	    v |= v >>> 16;

	    return v + 1;
	}

	/**
	 * Checks if a number is a power of two.
	 *
	 * @function isPow2
	 * @memberof PIXI.utils
	 * @param {number} v input value
	 * @return {boolean} `true` if value is power of two
	 */
	function isPow2(v)
	{
	    return !(v & (v - 1)) && (!!v);
	}

	/**
	 * Computes ceil of log base 2
	 *
	 * @function log2
	 * @memberof PIXI.utils
	 * @param {number} v input value
	 * @return {number} logarithm base 2
	 */
	function log2(v)
	{
	    var r = (v > 0xFFFF) << 4;

	    v >>>= r;

	    var shift = (v > 0xFF) << 3;

	    v >>>= shift; r |= shift;
	    shift = (v > 0xF) << 2;
	    v >>>= shift; r |= shift;
	    shift = (v > 0x3) << 1;
	    v >>>= shift; r |= shift;

	    return r | (v >> 1);
	}

	/**
	 * @todo Describe property usage
	 *
	 * @static
	 * @name ProgramCache
	 * @memberof PIXI.utils
	 * @type {Object}
	 */
	var ProgramCache = {};

	/**
	 * @todo Describe property usage
	 *
	 * @static
	 * @name TextureCache
	 * @memberof PIXI.utils
	 * @type {Object}
	 */
	var TextureCache = Object.create(null);

	/**
	 * @todo Describe property usage
	 *
	 * @static
	 * @name BaseTextureCache
	 * @memberof PIXI.utils
	 * @type {Object}
	 */

	var BaseTextureCache = Object.create(null);
	/**
	 * Destroys all texture in the cache
	 *
	 * @memberof PIXI.utils
	 * @function destroyTextureCache
	 */
	function destroyTextureCache()
	{
	    var key;

	    for (key in TextureCache)
	    {
	        TextureCache[key].destroy();
	    }
	    for (key in BaseTextureCache)
	    {
	        BaseTextureCache[key].destroy();
	    }
	}

	/**
	 * Removes all textures from cache, but does not destroy them
	 *
	 * @memberof PIXI.utils
	 * @function clearTextureCache
	 */
	function clearTextureCache()
	{
	    var key;

	    for (key in TextureCache)
	    {
	        delete TextureCache[key];
	    }
	    for (key in BaseTextureCache)
	    {
	        delete BaseTextureCache[key];
	    }
	}

	/**
	 * Trim transparent borders from a canvas
	 *
	 * @memberof PIXI.utils
	 * @function trimCanvas
	 * @param {HTMLCanvasElement} canvas - the canvas to trim
	 * @returns {object} Trim data
	 */
	function trimCanvas(canvas)
	{
	    // https://gist.github.com/remy/784508

	    var width = canvas.width;
	    var height = canvas.height;

	    var context = canvas.getContext('2d');
	    var imageData = context.getImageData(0, 0, width, height);
	    var pixels = imageData.data;
	    var len = pixels.length;

	    var bound = {
	        top: null,
	        left: null,
	        right: null,
	        bottom: null,
	    };
	    var data = null;
	    var i;
	    var x;
	    var y;

	    for (i = 0; i < len; i += 4)
	    {
	        if (pixels[i + 3] !== 0)
	        {
	            x = (i / 4) % width;
	            y = ~~((i / 4) / width);

	            if (bound.top === null)
	            {
	                bound.top = y;
	            }

	            if (bound.left === null)
	            {
	                bound.left = x;
	            }
	            else if (x < bound.left)
	            {
	                bound.left = x;
	            }

	            if (bound.right === null)
	            {
	                bound.right = x + 1;
	            }
	            else if (bound.right < x)
	            {
	                bound.right = x + 1;
	            }

	            if (bound.bottom === null)
	            {
	                bound.bottom = y;
	            }
	            else if (bound.bottom < y)
	            {
	                bound.bottom = y;
	            }
	        }
	    }

	    if (bound.top !== null)
	    {
	        width = bound.right - bound.left;
	        height = bound.bottom - bound.top + 1;
	        data = context.getImageData(bound.left, bound.top, width, height);
	    }

	    return {
	        height: height,
	        width: width,
	        data: data,
	    };
	}

	/**
	 * Creates a Canvas element of the given size to be used as a target for rendering to.
	 *
	 * @class
	 * @memberof PIXI.utils
	 */
	var CanvasRenderTarget = function CanvasRenderTarget(width, height, resolution)
	{
	    /**
	     * The Canvas object that belongs to this CanvasRenderTarget.
	     *
	     * @member {HTMLCanvasElement}
	     */
	    this.canvas = document.createElement('canvas');

	    /**
	     * A CanvasRenderingContext2D object representing a two-dimensional rendering context.
	     *
	     * @member {CanvasRenderingContext2D}
	     */
	    this.context = this.canvas.getContext('2d');

	    this.resolution = resolution || settings.RESOLUTION;

	    this.resize(width, height);
	};

	var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };

	/**
	 * Clears the canvas that was created by the CanvasRenderTarget class.
	 *
	 * @private
	 */
	CanvasRenderTarget.prototype.clear = function clear ()
	{
	    this.context.setTransform(1, 0, 0, 1, 0, 0);
	    this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
	};

	/**
	 * Resizes the canvas to the specified width and height.
	 *
	 * @param {number} width - the new width of the canvas
	 * @param {number} height - the new height of the canvas
	 */
	CanvasRenderTarget.prototype.resize = function resize (width, height)
	{
	    this.canvas.width = width * this.resolution;
	    this.canvas.height = height * this.resolution;
	};

	/**
	 * Destroys this canvas.
	 *
	 */
	CanvasRenderTarget.prototype.destroy = function destroy ()
	{
	    this.context = null;
	    this.canvas = null;
	};

	/**
	 * The width of the canvas buffer in pixels.
	 *
	 * @member {number}
	 */
	prototypeAccessors.width.get = function ()
	{
	    return this.canvas.width;
	};

	prototypeAccessors.width.set = function (val) // eslint-disable-line require-jsdoc
	{
	    this.canvas.width = val;
	};

	/**
	 * The height of the canvas buffer in pixels.
	 *
	 * @member {number}
	 */
	prototypeAccessors.height.get = function ()
	{
	    return this.canvas.height;
	};

	prototypeAccessors.height.set = function (val) // eslint-disable-line require-jsdoc
	{
	    this.canvas.height = val;
	};

	Object.defineProperties( CanvasRenderTarget.prototype, prototypeAccessors );

	/**
	 * Regexp for data URI.
	 * Based on: {@link https://github.com/ragingwind/data-uri-regex}
	 *
	 * @static
	 * @constant {RegExp|string} DATA_URI
	 * @memberof PIXI
	 * @example data:image/png;base64
	 */
	var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;

	/**
	 * Typedef for decomposeDataUri return object.
	 *
	 * @memberof PIXI.utils
	 * @typedef {object} DecomposedDataUri
	 * @property {string} mediaType Media type, eg. `image`
	 * @property {string} subType Sub type, eg. `png`
	 * @property {string} encoding Data encoding, eg. `base64`
	 * @property {string} data The actual data
	 */

	/**
	 * Split a data URI into components. Returns undefined if
	 * parameter `dataUri` is not a valid data URI.
	 *
	 * @memberof PIXI.utils
	 * @function decomposeDataUri
	 * @param {string} dataUri - the data URI to check
	 * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined
	 */
	function decomposeDataUri(dataUri)
	{
	    var dataUriMatch = DATA_URI.exec(dataUri);

	    if (dataUriMatch)
	    {
	        return {
	            mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,
	            subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,
	            charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,
	            encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,
	            data: dataUriMatch[5],
	        };
	    }

	    return undefined;
	}

	var tempAnchor;

	/**
	 * Sets the `crossOrigin` property for this resource based on if the url
	 * for this resource is cross-origin. If crossOrigin was manually set, this
	 * function does nothing.
	 * Nipped from the resource loader!
	 *
	 * @ignore
	 * @param {string} url - The url to test.
	 * @param {object} [loc=window.location] - The location object to test against.
	 * @return {string} The crossOrigin value to use (or empty string for none).
	 */
	function determineCrossOrigin(url$1, loc)
	{
	    if ( loc === void 0 ) { loc = window.location; }

	    // data: and javascript: urls are considered same-origin
	    if (url$1.indexOf('data:') === 0)
	    {
	        return '';
	    }

	    // default is window.location
	    loc = loc || window.location;

	    if (!tempAnchor)
	    {
	        tempAnchor = document.createElement('a');
	    }

	    // let the browser determine the full href for the url of this resource and then
	    // parse with the node url lib, we can't use the properties of the anchor element
	    // because they don't work in IE9 :(
	    tempAnchor.href = url$1;
	    url$1 = url.parse(tempAnchor.href);

	    var samePort = (!url$1.port && loc.port === '') || (url$1.port === loc.port);

	    // if cross origin
	    if (url$1.hostname !== loc.hostname || !samePort || url$1.protocol !== loc.protocol)
	    {
	        return 'anonymous';
	    }

	    return '';
	}

	/**
	 * get the resolution / device pixel ratio of an asset by looking for the prefix
	 * used by spritesheets and image urls
	 *
	 * @memberof PIXI.utils
	 * @function getResolutionOfUrl
	 * @param {string} url - the image path
	 * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.
	 * @return {number} resolution / device pixel ratio of an asset
	 */
	function getResolutionOfUrl(url, defaultValue)
	{
	    var resolution = settings.RETINA_PREFIX.exec(url);

	    if (resolution)
	    {
	        return parseFloat(resolution[1]);
	    }

	    return defaultValue !== undefined ? defaultValue : 1;
	}

	// A map of warning messages already fired
	var warnings = {};

	/**
	 * Helper for warning developers about deprecated features & settings.
	 * A stack track for warnings is given; useful for tracking-down where
	 * deprecated methods/properties/classes are being used within the code.
	 *
	 * @memberof PIXI.utils
	 * @function deprecation
	 * @param {string} version - The version where the feature became deprecated
	 * @param {string} message - Message should include what is deprecated, where, and the new solution
	 * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack
	 *        this is mostly to ignore internal deprecation calls.
	 */
	function deprecation(version, message, ignoreDepth)
	{
	    if ( ignoreDepth === void 0 ) { ignoreDepth = 3; }

	    // Ignore duplicat
	    if (warnings[message])
	    {
	        return;
	    }

	    /* eslint-disable no-console */
	    var stack = new Error().stack;

	    // Handle IE < 10 and Safari < 6
	    if (typeof stack === 'undefined')
	    {
	        console.warn('PixiJS Deprecation Warning: ', (message + "\nDeprecated since v" + version));
	    }
	    else
	    {
	        // chop off the stack trace which includes PixiJS internal calls
	        stack = stack.split('\n').splice(ignoreDepth).join('\n');

	        if (console.groupCollapsed)
	        {
	            console.groupCollapsed(
	                '%cPixiJS Deprecation Warning: %c%s',
	                'color:#614108;background:#fffbe6',
	                'font-weight:normal;color:#614108;background:#fffbe6',
	                (message + "\nDeprecated since v" + version)
	            );
	            console.warn(stack);
	            console.groupEnd();
	        }
	        else
	        {
	            console.warn('PixiJS Deprecation Warning: ', (message + "\nDeprecated since v" + version));
	            console.warn(stack);
	        }
	    }
	    /* eslint-enable no-console */

	    warnings[message] = true;
	}

	var utils_es = ({
		BaseTextureCache: BaseTextureCache,
		CanvasRenderTarget: CanvasRenderTarget,
		DATA_URI: DATA_URI,
		ProgramCache: ProgramCache,
		TextureCache: TextureCache,
		clearTextureCache: clearTextureCache,
		correctBlendMode: correctBlendMode,
		createIndicesForQuads: createIndicesForQuads,
		decomposeDataUri: decomposeDataUri,
		deprecation: deprecation,
		destroyTextureCache: destroyTextureCache,
		determineCrossOrigin: determineCrossOrigin,
		getResolutionOfUrl: getResolutionOfUrl,
		hex2rgb: hex2rgb,
		hex2string: hex2string,
		isPow2: isPow2,
		isWebGLSupported: isWebGLSupported,
		log2: log2,
		nextPow2: nextPow2,
		premultiplyBlendMode: premultiplyBlendMode,
		premultiplyRgba: premultiplyRgba,
		premultiplyTint: premultiplyTint,
		premultiplyTintToRgba: premultiplyTintToRgba,
		removeItems: removeItems,
		rgb2hex: rgb2hex,
		sayHello: sayHello,
		sign: sign$1,
		skipHello: skipHello,
		string2hex: string2hex,
		trimCanvas: trimCanvas,
		uid: uid,
		isMobile: isMobile_min,
		EventEmitter: eventemitter3,
		earcut: earcut_1,
		url: url
	});

	/*!
	 * @pixi/math - v5.1.0
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/math is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */
	/**
	 * The Point object represents a location in a two-dimensional coordinate system, where x represents
	 * the horizontal axis and y represents the vertical axis.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Point = function Point(x, y)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.x = x;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.y = y;
	};

	/**
	 * Creates a clone of this point
	 *
	 * @return {PIXI.Point} a copy of the point
	 */
	Point.prototype.clone = function clone ()
	{
	    return new Point(this.x, this.y);
	};

	/**
	 * Copies x and y from the given point
	 *
	 * @param {PIXI.IPoint} p - The point to copy from
	 * @returns {PIXI.IPoint} Returns itself.
	 */
	Point.prototype.copyFrom = function copyFrom (p)
	{
	    this.set(p.x, p.y);

	    return this;
	};

	/**
	 * Copies x and y into the given point
	 *
	 * @param {PIXI.IPoint} p - The point to copy.
	 * @returns {PIXI.IPoint} Given point with values updated
	 */
	Point.prototype.copyTo = function copyTo (p)
	{
	    p.set(this.x, this.y);

	    return p;
	};

	/**
	 * Returns true if the given point is equal to this point
	 *
	 * @param {PIXI.IPoint} p - The point to check
	 * @returns {boolean} Whether the given point equal to this point
	 */
	Point.prototype.equals = function equals (p)
	{
	    return (p.x === this.x) && (p.y === this.y);
	};

	/**
	 * Sets the point to a new x and y position.
	 * If y is omitted, both x and y will be set to x.
	 *
	 * @param {number} [x=0] - position of the point on the x axis
	 * @param {number} [y=0] - position of the point on the y axis
	 */
	Point.prototype.set = function set (x, y)
	{
	    this.x = x || 0;
	    this.y = y || ((y !== 0) ? this.x : 0);
	};

	/**
	 * The Point object represents a location in a two-dimensional coordinate system, where x represents
	 * the horizontal axis and y represents the vertical axis.
	 *
	 * An ObservablePoint is a point that triggers a callback when the point's position is changed.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var ObservablePoint = function ObservablePoint(cb, scope, x, y)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }

	    this._x = x;
	    this._y = y;

	    this.cb = cb;
	    this.scope = scope;
	};

	var prototypeAccessors$1 = { x: { configurable: true },y: { configurable: true } };

	/**
	 * Creates a clone of this point.
	 * The callback and scope params can be overidden otherwise they will default
	 * to the clone object's values.
	 *
	 * @override
	 * @param {Function} [cb=null] - callback when changed
	 * @param {object} [scope=null] - owner of callback
	 * @return {PIXI.ObservablePoint} a copy of the point
	 */
	ObservablePoint.prototype.clone = function clone (cb, scope)
	{
	        if ( cb === void 0 ) { cb = null; }
	        if ( scope === void 0 ) { scope = null; }

	    var _cb = cb || this.cb;
	    var _scope = scope || this.scope;

	    return new ObservablePoint(_cb, _scope, this._x, this._y);
	};

	/**
	 * Sets the point to a new x and y position.
	 * If y is omitted, both x and y will be set to x.
	 *
	 * @param {number} [x=0] - position of the point on the x axis
	 * @param {number} [y=0] - position of the point on the y axis
	 */
	ObservablePoint.prototype.set = function set (x, y)
	{
	    var _x = x || 0;
	    var _y = y || ((y !== 0) ? _x : 0);

	    if (this._x !== _x || this._y !== _y)
	    {
	        this._x = _x;
	        this._y = _y;
	        this.cb.call(this.scope);
	    }
	};

	/**
	 * Copies x and y from the given point
	 *
	 * @param {PIXI.IPoint} p - The point to copy from.
	 * @returns {PIXI.IPoint} Returns itself.
	 */
	ObservablePoint.prototype.copyFrom = function copyFrom (p)
	{
	    if (this._x !== p.x || this._y !== p.y)
	    {
	        this._x = p.x;
	        this._y = p.y;
	        this.cb.call(this.scope);
	    }

	    return this;
	};

	/**
	 * Copies x and y into the given point
	 *
	 * @param {PIXI.IPoint} p - The point to copy.
	 * @returns {PIXI.IPoint} Given point with values updated
	 */
	ObservablePoint.prototype.copyTo = function copyTo (p)
	{
	    p.set(this._x, this._y);

	    return p;
	};

	/**
	 * Returns true if the given point is equal to this point
	 *
	 * @param {PIXI.IPoint} p - The point to check
	 * @returns {boolean} Whether the given point equal to this point
	 */
	ObservablePoint.prototype.equals = function equals (p)
	{
	    return (p.x === this._x) && (p.y === this._y);
	};

	/**
	 * The position of the displayObject on the x axis relative to the local coordinates of the parent.
	 *
	 * @member {number}
	 */
	prototypeAccessors$1.x.get = function ()
	{
	    return this._x;
	};

	prototypeAccessors$1.x.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (this._x !== value)
	    {
	        this._x = value;
	        this.cb.call(this.scope);
	    }
	};

	/**
	 * The position of the displayObject on the x axis relative to the local coordinates of the parent.
	 *
	 * @member {number}
	 */
	prototypeAccessors$1.y.get = function ()
	{
	    return this._y;
	};

	prototypeAccessors$1.y.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (this._y !== value)
	    {
	        this._y = value;
	        this.cb.call(this.scope);
	    }
	};

	Object.defineProperties( ObservablePoint.prototype, prototypeAccessors$1 );

	/**
	 * A number, or a string containing a number.
	 * @memberof PIXI
	 * @typedef {(PIXI.Point|PIXI.ObservablePoint)} IPoint
	 */

	/**
	 * Two Pi.
	 *
	 * @static
	 * @constant {number} PI_2
	 * @memberof PIXI
	 */
	var PI_2 = Math.PI * 2;

	/**
	 * Conversion factor for converting radians to degrees.
	 *
	 * @static
	 * @constant {number} RAD_TO_DEG
	 * @memberof PIXI
	 */
	var RAD_TO_DEG = 180 / Math.PI;

	/**
	 * Conversion factor for converting degrees to radians.
	 *
	 * @static
	 * @constant {number} DEG_TO_RAD
	 * @memberof PIXI
	 */
	var DEG_TO_RAD = Math.PI / 180;

	/**
	 * Constants that identify shapes, mainly to prevent `instanceof` calls.
	 *
	 * @static
	 * @constant
	 * @name SHAPES
	 * @memberof PIXI
	 * @type {object}
	 * @property {number} POLY Polygon
	 * @property {number} RECT Rectangle
	 * @property {number} CIRC Circle
	 * @property {number} ELIP Ellipse
	 * @property {number} RREC Rounded Rectangle
	 */
	var SHAPES = {
	    POLY: 0,
	    RECT: 1,
	    CIRC: 2,
	    ELIP: 3,
	    RREC: 4,
	};

	/**
	 * The PixiJS Matrix as a class makes it a lot faster.
	 *
	 * Here is a representation of it:
	 * ```js
	 * | a | c | tx|
	 * | b | d | ty|
	 * | 0 | 0 | 1 |
	 * ```
	 * @class
	 * @memberof PIXI
	 */
	var Matrix = function Matrix(a, b, c, d, tx, ty)
	{
	    if ( a === void 0 ) { a = 1; }
	    if ( b === void 0 ) { b = 0; }
	    if ( c === void 0 ) { c = 0; }
	    if ( d === void 0 ) { d = 1; }
	    if ( tx === void 0 ) { tx = 0; }
	    if ( ty === void 0 ) { ty = 0; }

	    /**
	     * @member {number}
	     * @default 1
	     */
	    this.a = a;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.b = b;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.c = c;

	    /**
	     * @member {number}
	     * @default 1
	     */
	    this.d = d;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.tx = tx;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.ty = ty;

	    this.array = null;
	};

	var staticAccessors = { IDENTITY: { configurable: true },TEMP_MATRIX: { configurable: true } };

	/**
	 * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:
	 *
	 * a = array[0]
	 * b = array[1]
	 * c = array[3]
	 * d = array[4]
	 * tx = array[2]
	 * ty = array[5]
	 *
	 * @param {number[]} array - The array that the matrix will be populated from.
	 */
	Matrix.prototype.fromArray = function fromArray (array)
	{
	    this.a = array[0];
	    this.b = array[1];
	    this.c = array[3];
	    this.d = array[4];
	    this.tx = array[2];
	    this.ty = array[5];
	};

	/**
	 * sets the matrix properties
	 *
	 * @param {number} a - Matrix component
	 * @param {number} b - Matrix component
	 * @param {number} c - Matrix component
	 * @param {number} d - Matrix component
	 * @param {number} tx - Matrix component
	 * @param {number} ty - Matrix component
	 *
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.set = function set (a, b, c, d, tx, ty)
	{
	    this.a = a;
	    this.b = b;
	    this.c = c;
	    this.d = d;
	    this.tx = tx;
	    this.ty = ty;

	    return this;
	};

	/**
	 * Creates an array from the current Matrix object.
	 *
	 * @param {boolean} transpose - Whether we need to transpose the matrix or not
	 * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out
	 * @return {number[]} the newly created array which contains the matrix
	 */
	Matrix.prototype.toArray = function toArray (transpose, out)
	{
	    if (!this.array)
	    {
	        this.array = new Float32Array(9);
	    }

	    var array = out || this.array;

	    if (transpose)
	    {
	        array[0] = this.a;
	        array[1] = this.b;
	        array[2] = 0;
	        array[3] = this.c;
	        array[4] = this.d;
	        array[5] = 0;
	        array[6] = this.tx;
	        array[7] = this.ty;
	        array[8] = 1;
	    }
	    else
	    {
	        array[0] = this.a;
	        array[1] = this.c;
	        array[2] = this.tx;
	        array[3] = this.b;
	        array[4] = this.d;
	        array[5] = this.ty;
	        array[6] = 0;
	        array[7] = 0;
	        array[8] = 1;
	    }

	    return array;
	};

	/**
	 * Get a new position with the current transformation applied.
	 * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
	 *
	 * @param {PIXI.Point} pos - The origin
	 * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
	 * @return {PIXI.Point} The new point, transformed through this matrix
	 */
	Matrix.prototype.apply = function apply (pos, newPos)
	{
	    newPos = newPos || new Point();

	    var x = pos.x;
	    var y = pos.y;

	    newPos.x = (this.a * x) + (this.c * y) + this.tx;
	    newPos.y = (this.b * x) + (this.d * y) + this.ty;

	    return newPos;
	};

	/**
	 * Get a new position with the inverse of the current transformation applied.
	 * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
	 *
	 * @param {PIXI.Point} pos - The origin
	 * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)
	 * @return {PIXI.Point} The new point, inverse-transformed through this matrix
	 */
	Matrix.prototype.applyInverse = function applyInverse (pos, newPos)
	{
	    newPos = newPos || new Point();

	    var id = 1 / ((this.a * this.d) + (this.c * -this.b));

	    var x = pos.x;
	    var y = pos.y;

	    newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);
	    newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);

	    return newPos;
	};

	/**
	 * Translates the matrix on the x and y.
	 *
	 * @param {number} x How much to translate x by
	 * @param {number} y How much to translate y by
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.translate = function translate (x, y)
	{
	    this.tx += x;
	    this.ty += y;

	    return this;
	};

	/**
	 * Applies a scale transformation to the matrix.
	 *
	 * @param {number} x The amount to scale horizontally
	 * @param {number} y The amount to scale vertically
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.scale = function scale (x, y)
	{
	    this.a *= x;
	    this.d *= y;
	    this.c *= x;
	    this.b *= y;
	    this.tx *= x;
	    this.ty *= y;

	    return this;
	};

	/**
	 * Applies a rotation transformation to the matrix.
	 *
	 * @param {number} angle - The angle in radians.
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.rotate = function rotate (angle)
	{
	    var cos = Math.cos(angle);
	    var sin = Math.sin(angle);

	    var a1 = this.a;
	    var c1 = this.c;
	    var tx1 = this.tx;

	    this.a = (a1 * cos) - (this.b * sin);
	    this.b = (a1 * sin) + (this.b * cos);
	    this.c = (c1 * cos) - (this.d * sin);
	    this.d = (c1 * sin) + (this.d * cos);
	    this.tx = (tx1 * cos) - (this.ty * sin);
	    this.ty = (tx1 * sin) + (this.ty * cos);

	    return this;
	};

	/**
	 * Appends the given Matrix to this Matrix.
	 *
	 * @param {PIXI.Matrix} matrix - The matrix to append.
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.append = function append (matrix)
	{
	    var a1 = this.a;
	    var b1 = this.b;
	    var c1 = this.c;
	    var d1 = this.d;

	    this.a = (matrix.a * a1) + (matrix.b * c1);
	    this.b = (matrix.a * b1) + (matrix.b * d1);
	    this.c = (matrix.c * a1) + (matrix.d * c1);
	    this.d = (matrix.c * b1) + (matrix.d * d1);

	    this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;
	    this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;

	    return this;
	};

	/**
	 * Sets the matrix based on all the available properties
	 *
	 * @param {number} x - Position on the x axis
	 * @param {number} y - Position on the y axis
	 * @param {number} pivotX - Pivot on the x axis
	 * @param {number} pivotY - Pivot on the y axis
	 * @param {number} scaleX - Scale on the x axis
	 * @param {number} scaleY - Scale on the y axis
	 * @param {number} rotation - Rotation in radians
	 * @param {number} skewX - Skew on the x axis
	 * @param {number} skewY - Skew on the y axis
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.setTransform = function setTransform (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY)
	{
	    this.a = Math.cos(rotation + skewY) * scaleX;
	    this.b = Math.sin(rotation + skewY) * scaleX;
	    this.c = -Math.sin(rotation - skewX) * scaleY;
	    this.d = Math.cos(rotation - skewX) * scaleY;

	    this.tx = x - ((pivotX * this.a) + (pivotY * this.c));
	    this.ty = y - ((pivotX * this.b) + (pivotY * this.d));

	    return this;
	};

	/**
	 * Prepends the given Matrix to this Matrix.
	 *
	 * @param {PIXI.Matrix} matrix - The matrix to prepend
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.prepend = function prepend (matrix)
	{
	    var tx1 = this.tx;

	    if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)
	    {
	        var a1 = this.a;
	        var c1 = this.c;

	        this.a = (a1 * matrix.a) + (this.b * matrix.c);
	        this.b = (a1 * matrix.b) + (this.b * matrix.d);
	        this.c = (c1 * matrix.a) + (this.d * matrix.c);
	        this.d = (c1 * matrix.b) + (this.d * matrix.d);
	    }

	    this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;
	    this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;

	    return this;
	};

	/**
	 * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
	 *
	 * @param {PIXI.Transform} transform - The transform to apply the properties to.
	 * @return {PIXI.Transform} The transform with the newly applied properties
	 */
	Matrix.prototype.decompose = function decompose (transform)
	{
	    // sort out rotation / skew..
	    var a = this.a;
	    var b = this.b;
	    var c = this.c;
	    var d = this.d;

	    var skewX = -Math.atan2(-c, d);
	    var skewY = Math.atan2(b, a);

	    var delta = Math.abs(skewX + skewY);

	    if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)
	    {
	        transform.rotation = skewY;
	        transform.skew.x = transform.skew.y = 0;
	    }
	    else
	    {
	        transform.rotation = 0;
	        transform.skew.x = skewX;
	        transform.skew.y = skewY;
	    }

	    // next set scale
	    transform.scale.x = Math.sqrt((a * a) + (b * b));
	    transform.scale.y = Math.sqrt((c * c) + (d * d));

	    // next set position
	    transform.position.x = this.tx;
	    transform.position.y = this.ty;

	    return transform;
	};

	/**
	 * Inverts this matrix
	 *
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.invert = function invert ()
	{
	    var a1 = this.a;
	    var b1 = this.b;
	    var c1 = this.c;
	    var d1 = this.d;
	    var tx1 = this.tx;
	    var n = (a1 * d1) - (b1 * c1);

	    this.a = d1 / n;
	    this.b = -b1 / n;
	    this.c = -c1 / n;
	    this.d = a1 / n;
	    this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;
	    this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;

	    return this;
	};

	/**
	 * Resets this Matrix to an identity (default) matrix.
	 *
	 * @return {PIXI.Matrix} This matrix. Good for chaining method calls.
	 */
	Matrix.prototype.identity = function identity ()
	{
	    this.a = 1;
	    this.b = 0;
	    this.c = 0;
	    this.d = 1;
	    this.tx = 0;
	    this.ty = 0;

	    return this;
	};

	/**
	 * Creates a new Matrix object with the same values as this one.
	 *
	 * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.
	 */
	Matrix.prototype.clone = function clone ()
	{
	    var matrix = new Matrix();

	    matrix.a = this.a;
	    matrix.b = this.b;
	    matrix.c = this.c;
	    matrix.d = this.d;
	    matrix.tx = this.tx;
	    matrix.ty = this.ty;

	    return matrix;
	};

	/**
	 * Changes the values of the given matrix to be the same as the ones in this matrix
	 *
	 * @param {PIXI.Matrix} matrix - The matrix to copy to.
	 * @return {PIXI.Matrix} The matrix given in parameter with its values updated.
	 */
	Matrix.prototype.copyTo = function copyTo (matrix)
	{
	    matrix.a = this.a;
	    matrix.b = this.b;
	    matrix.c = this.c;
	    matrix.d = this.d;
	    matrix.tx = this.tx;
	    matrix.ty = this.ty;

	    return matrix;
	};

	/**
	 * Changes the values of the matrix to be the same as the ones in given matrix
	 *
	 * @param {PIXI.Matrix} matrix - The matrix to copy from.
	 * @return {PIXI.Matrix} this
	 */
	Matrix.prototype.copyFrom = function copyFrom (matrix)
	{
	    this.a = matrix.a;
	    this.b = matrix.b;
	    this.c = matrix.c;
	    this.d = matrix.d;
	    this.tx = matrix.tx;
	    this.ty = matrix.ty;

	    return this;
	};

	/**
	 * A default (identity) matrix
	 *
	 * @static
	 * @const
	 * @member {PIXI.Matrix}
	 */
	staticAccessors.IDENTITY.get = function ()
	{
	    return new Matrix();
	};

	/**
	 * A temp matrix
	 *
	 * @static
	 * @const
	 * @member {PIXI.Matrix}
	 */
	staticAccessors.TEMP_MATRIX.get = function ()
	{
	    return new Matrix();
	};

	Object.defineProperties( Matrix, staticAccessors );

	// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group

	/*
	 * Transform matrix for operation n is:
	 * | ux | vx |
	 * | uy | vy |
	 */

	var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];
	var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];
	var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];
	var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];

	/**
	 * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}
	 * for the composition of each rotation in the dihederal group D8.
	 *
	 * @type number[][]
	 * @private
	 */
	var rotationCayley = [];

	/**
	 * Matrices for each `GD8Symmetry` rotation.
	 *
	 * @type Matrix[]
	 * @private
	 */
	var rotationMatrices = [];

	/*
	 * Alias for {@code Math.sign}.
	 */
	var signum = Math.sign;

	/*
	 * Initializes `rotationCayley` and `rotationMatrices`. It is called
	 * only once below.
	 */
	function init()
	{
	    for (var i = 0; i < 16; i++)
	    {
	        var row = [];

	        rotationCayley.push(row);

	        for (var j = 0; j < 16; j++)
	        {
	            /* Multiplies rotation matrices i and j. */
	            var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));
	            var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));
	            var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));
	            var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));

	            /* Finds rotation matrix matching the product and pushes it. */
	            for (var k = 0; k < 16; k++)
	            {
	                if (ux[k] === _ux && uy[k] === _uy
	                      && vx[k] === _vx && vy[k] === _vy)
	                {
	                    row.push(k);
	                    break;
	                }
	            }
	        }
	    }

	    for (var i$1 = 0; i$1 < 16; i$1++)
	    {
	        var mat = new Matrix();

	        mat.set(ux[i$1], uy[i$1], vx[i$1], vy[i$1], 0, 0);
	        rotationMatrices.push(mat);
	    }
	}

	init();

	/**
	 * @memberof PIXI
	 * @typedef {number} GD8Symmetry
	 * @see PIXI.GroupD8
	 */

	/**
	 * Implements the dihedral group D8, which is similar to
	 * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};
	 * D8 is the same but with diagonals, and it is used for texture
	 * rotations.
	 *
	 * The directions the U- and V- axes after rotation
	 * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`
	 * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.
	 *
	 * **Origin:**<br>
	 *  This is the small part of gameofbombs.com portal system. It works.
	 *
	 * @see PIXI.GroupD8.E
	 * @see PIXI.GroupD8.SE
	 * @see PIXI.GroupD8.S
	 * @see PIXI.GroupD8.SW
	 * @see PIXI.GroupD8.W
	 * @see PIXI.GroupD8.NW
	 * @see PIXI.GroupD8.N
	 * @see PIXI.GroupD8.NE
	 * @author Ivan @ivanpopelyshev
	 * @class
	 * @memberof PIXI
	 */
	var GroupD8 = {
	    /**
	     * | Rotation | Direction |
	     * |----------|-----------|
	     * | 0°       | East      |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    E: 0,

	    /**
	     * | Rotation | Direction |
	     * |----------|-----------|
	     * | 45°↻     | Southeast |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    SE: 1,

	    /**
	     * | Rotation | Direction |
	     * |----------|-----------|
	     * | 90°↻     | South     |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    S: 2,

	    /**
	     * | Rotation | Direction |
	     * |----------|-----------|
	     * | 135°↻    | Southwest |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    SW: 3,

	    /**
	     * | Rotation | Direction |
	     * |----------|-----------|
	     * | 180°     | West      |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    W: 4,

	    /**
	     * | Rotation    | Direction    |
	     * |-------------|--------------|
	     * | -135°/225°↻ | Northwest    |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    NW: 5,

	    /**
	     * | Rotation    | Direction    |
	     * |-------------|--------------|
	     * | -90°/270°↻  | North        |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    N: 6,

	    /**
	     * | Rotation    | Direction    |
	     * |-------------|--------------|
	     * | -45°/315°↻  | Northeast    |
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    NE: 7,

	    /**
	     * Reflection about Y-axis.
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    MIRROR_VERTICAL: 8,

	    /**
	     * Reflection about the main diagonal.
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    MAIN_DIAGONAL: 10,

	    /**
	     * Reflection about X-axis.
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    MIRROR_HORIZONTAL: 12,

	    /**
	     * Reflection about reverse diagonal.
	     *
	     * @constant {PIXI.GD8Symmetry}
	     */
	    REVERSE_DIAGONAL: 14,

	    /**
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.
	     * @return {PIXI.GD8Symmetry} The X-component of the U-axis
	     *    after rotating the axes.
	     */
	    uX: function (ind) { return ux[ind]; },

	    /**
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.
	     * @return {PIXI.GD8Symmetry} The Y-component of the U-axis
	     *    after rotating the axes.
	     */
	    uY: function (ind) { return uy[ind]; },

	    /**
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.
	     * @return {PIXI.GD8Symmetry} The X-component of the V-axis
	     *    after rotating the axes.
	     */
	    vX: function (ind) { return vx[ind]; },

	    /**
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.
	     * @return {PIXI.GD8Symmetry} The Y-component of the V-axis
	     *    after rotating the axes.
	     */
	    vY: function (ind) { return vy[ind]; },

	    /**
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite
	     *   is needed. Only rotations have opposite symmetries while
	     *   reflections don't.
	     * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`
	     */
	    inv: function (rotation) {
	        if (rotation & 8)// true only if between 8 & 15 (reflections)
	        {
	            return rotation & 15;// or rotation % 16
	        }

	        return (-rotation) & 7;// or (8 - rotation) % 8
	    },

	    /**
	     * Composes the two D8 operations.
	     *
	     * Taking `^` as reflection:
	     *
	     * |       | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |
	     * |-------|-----|-----|-----|-----|------|-------|-------|-------|
	     * | E=0   | E   | S   | W   | N   | E^   | S^    | W^    | N^    |
	     * | S=2   | S   | W   | N   | E   | S^   | W^    | N^    | E^    |
	     * | W=4   | W   | N   | E   | S   | W^   | N^    | E^    | S^    |
	     * | N=6   | N   | E   | S   | W   | N^   | E^    | S^    | W^    |
	     * | E^=8  | E^  | N^  | W^  | S^  | E    | N     | W     | S     |
	     * | S^=10 | S^  | E^  | N^  | W^  | S    | E     | N     | W     |
	     * | W^=12 | W^  | S^  | E^  | N^  | W    | S     | E     | N     |
	     * | N^=14 | N^  | W^  | S^  | E^  | N    | W     | S     | E     |
	     *
	     * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which
	     *   is the row in the above cayley table.
	     * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which
	     *   is the column in the above cayley table.
	     * @return {PIXI.GD8Symmetry} Composed operation
	     */
	    add: function (rotationSecond, rotationFirst) { return (
	        rotationCayley[rotationSecond][rotationFirst]
	    ); },

	    /**
	     * Reverse of `add`.
	     *
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} rotationSecond - Second operation
	     * @param {PIXI.GD8Symmetry} rotationFirst - First operation
	     * @return {PIXI.GD8Symmetry} Result
	     */
	    sub: function (rotationSecond, rotationFirst) { return (
	        rotationCayley[rotationSecond][GroupD8.inv(rotationFirst)]
	    ); },

	    /**
	     * Adds 180 degrees to rotation, which is a commutative
	     * operation.
	     *
	     * @memberof PIXI.GroupD8
	     * @param {number} rotation - The number to rotate.
	     * @returns {number} Rotated number
	     */
	    rotate180: function (rotation) { return rotation ^ 4; },

	    /**
	     * Checks if the rotation angle is vertical, i.e. south
	     * or north. It doesn't work for reflections.
	     *
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.GD8Symmetry} rotation - The number to check.
	     * @returns {boolean} Whether or not the direction is vertical
	     */
	    isVertical: function (rotation) { return (rotation & 3) === 2; }, // rotation % 4 === 2

	    /**
	     * Approximates the vector `V(dx,dy)` into one of the
	     * eight directions provided by `GroupD8`.
	     *
	     * @memberof PIXI.GroupD8
	     * @param {number} dx - X-component of the vector
	     * @param {number} dy - Y-component of the vector
	     * @return {PIXI.GD8Symmetry} Approximation of the vector into
	     *  one of the eight symmetries.
	     */
	    byDirection: function (dx, dy) {
	        if (Math.abs(dx) * 2 <= Math.abs(dy))
	        {
	            if (dy >= 0)
	            {
	                return GroupD8.S;
	            }

	            return GroupD8.N;
	        }
	        else if (Math.abs(dy) * 2 <= Math.abs(dx))
	        {
	            if (dx > 0)
	            {
	                return GroupD8.E;
	            }

	            return GroupD8.W;
	        }
	        else if (dy > 0)
	        {
	            if (dx > 0)
	            {
	                return GroupD8.SE;
	            }

	            return GroupD8.SW;
	        }
	        else if (dx > 0)
	        {
	            return GroupD8.NE;
	        }

	        return GroupD8.NW;
	    },

	    /**
	     * Helps sprite to compensate texture packer rotation.
	     *
	     * @memberof PIXI.GroupD8
	     * @param {PIXI.Matrix} matrix - sprite world matrix
	     * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.
	     * @param {number} tx - sprite anchoring
	     * @param {number} ty - sprite anchoring
	     */
	    matrixAppendRotationInv: function (matrix, rotation, tx, ty) {
	        if ( tx === void 0 ) { tx = 0; }
	        if ( ty === void 0 ) { ty = 0; }

	        // Packer used "rotation", we use "inv(rotation)"
	        var mat = rotationMatrices[GroupD8.inv(rotation)];

	        mat.tx = tx;
	        mat.ty = ty;
	        matrix.append(mat);
	    },
	};

	/**
	 * Transform that takes care about its versions
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Transform = function Transform()
	{
	    /**
	     * The world transformation matrix.
	     *
	     * @member {PIXI.Matrix}
	     */
	    this.worldTransform = new Matrix();

	    /**
	     * The local transformation matrix.
	     *
	     * @member {PIXI.Matrix}
	     */
	    this.localTransform = new Matrix();

	    /**
	     * The coordinate of the object relative to the local coordinates of the parent.
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    this.position = new ObservablePoint(this.onChange, this, 0, 0);

	    /**
	     * The scale factor of the object.
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    this.scale = new ObservablePoint(this.onChange, this, 1, 1);

	    /**
	     * The pivot point of the displayObject that it rotates around.
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    this.pivot = new ObservablePoint(this.onChange, this, 0, 0);

	    /**
	     * The skew amount, on the x and y axis.
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);

	    /**
	     * The rotation amount.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._rotation = 0;

	    /**
	     * The X-coordinate value of the normalized local X axis,
	     * the first column of the local transformation matrix without a scale.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._cx = 1;

	    /**
	     * The Y-coordinate value of the normalized local X axis,
	     * the first column of the local transformation matrix without a scale.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._sx = 0;

	    /**
	     * The X-coordinate value of the normalized local Y axis,
	     * the second column of the local transformation matrix without a scale.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._cy = 0;

	    /**
	     * The Y-coordinate value of the normalized local Y axis,
	     * the second column of the local transformation matrix without a scale.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._sy = 1;

	    /**
	     * The locally unique ID of the local transform.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._localID = 0;

	    /**
	     * The locally unique ID of the local transform
	     * used to calculate the current local transformation matrix.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._currentLocalID = 0;

	    /**
	     * The locally unique ID of the world transform.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._worldID = 0;

	    /**
	     * The locally unique ID of the parent's world transform
	     * used to calculate the current world transformation matrix.
	     *
	     * @protected
	     * @member {number}
	     */
	    this._parentID = 0;
	};

	var prototypeAccessors$1$1 = { rotation: { configurable: true } };

	/**
	 * Called when a value changes.
	 *
	 * @protected
	 */
	Transform.prototype.onChange = function onChange ()
	{
	    this._localID++;
	};

	/**
	 * Called when the skew or the rotation changes.
	 *
	 * @protected
	 */
	Transform.prototype.updateSkew = function updateSkew ()
	{
	    this._cx = Math.cos(this._rotation + this.skew._y);
	    this._sx = Math.sin(this._rotation + this.skew._y);
	    this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2
	    this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2

	    this._localID++;
	};

	/**
	 * Updates the local transformation matrix.
	 */
	Transform.prototype.updateLocalTransform = function updateLocalTransform ()
	{
	    var lt = this.localTransform;

	    if (this._localID !== this._currentLocalID)
	    {
	        // get the matrix values of the displayobject based on its transform properties..
	        lt.a = this._cx * this.scale._x;
	        lt.b = this._sx * this.scale._x;
	        lt.c = this._cy * this.scale._y;
	        lt.d = this._sy * this.scale._y;

	        lt.tx = this.position._x - ((this.pivot._x * lt.a) + (this.pivot._y * lt.c));
	        lt.ty = this.position._y - ((this.pivot._x * lt.b) + (this.pivot._y * lt.d));
	        this._currentLocalID = this._localID;

	        // force an update..
	        this._parentID = -1;
	    }
	};

	/**
	 * Updates the local and the world transformation matrices.
	 *
	 * @param {PIXI.Transform} parentTransform - The parent transform
	 */
	Transform.prototype.updateTransform = function updateTransform (parentTransform)
	{
	    var lt = this.localTransform;

	    if (this._localID !== this._currentLocalID)
	    {
	        // get the matrix values of the displayobject based on its transform properties..
	        lt.a = this._cx * this.scale._x;
	        lt.b = this._sx * this.scale._x;
	        lt.c = this._cy * this.scale._y;
	        lt.d = this._sy * this.scale._y;

	        lt.tx = this.position._x - ((this.pivot._x * lt.a) + (this.pivot._y * lt.c));
	        lt.ty = this.position._y - ((this.pivot._x * lt.b) + (this.pivot._y * lt.d));
	        this._currentLocalID = this._localID;

	        // force an update..
	        this._parentID = -1;
	    }

	    if (this._parentID !== parentTransform._worldID)
	    {
	        // concat the parent matrix with the objects transform.
	        var pt = parentTransform.worldTransform;
	        var wt = this.worldTransform;

	        wt.a = (lt.a * pt.a) + (lt.b * pt.c);
	        wt.b = (lt.a * pt.b) + (lt.b * pt.d);
	        wt.c = (lt.c * pt.a) + (lt.d * pt.c);
	        wt.d = (lt.c * pt.b) + (lt.d * pt.d);
	        wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;
	        wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;

	        this._parentID = parentTransform._worldID;

	        // update the id of the transform..
	        this._worldID++;
	    }
	};

	/**
	 * Decomposes a matrix and sets the transforms properties based on it.
	 *
	 * @param {PIXI.Matrix} matrix - The matrix to decompose
	 */
	Transform.prototype.setFromMatrix = function setFromMatrix (matrix)
	{
	    matrix.decompose(this);
	    this._localID++;
	};

	/**
	 * The rotation of the object in radians.
	 *
	 * @member {number}
	 */
	prototypeAccessors$1$1.rotation.get = function ()
	{
	    return this._rotation;
	};

	prototypeAccessors$1$1.rotation.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (this._rotation !== value)
	    {
	        this._rotation = value;
	        this.updateSkew();
	    }
	};

	Object.defineProperties( Transform.prototype, prototypeAccessors$1$1 );

	/**
	 * A default (identity) transform
	 *
	 * @static
	 * @constant
	 * @member {PIXI.Transform}
	 */
	Transform.IDENTITY = new Transform();

	/**
	 * Size object, contains width and height
	 *
	 * @memberof PIXI
	 * @typedef {object} ISize
	 * @property {number} width - Width component
	 * @property {number} height - Height component
	 */

	/**
	 * Rectangle object is an area defined by its position, as indicated by its top-left corner
	 * point (x, y) and by its width and its height.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Rectangle = function Rectangle(x, y, width, height)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }
	    if ( width === void 0 ) { width = 0; }
	    if ( height === void 0 ) { height = 0; }

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.x = Number(x);

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.y = Number(y);

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.width = Number(width);

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.height = Number(height);

	    /**
	     * The type of the object, mainly used to avoid `instanceof` checks
	     *
	     * @member {number}
	     * @readOnly
	     * @default PIXI.SHAPES.RECT
	     * @see PIXI.SHAPES
	     */
	    this.type = SHAPES.RECT;
	};

	var prototypeAccessors$2 = { left: { configurable: true },right: { configurable: true },top: { configurable: true },bottom: { configurable: true } };
	var staticAccessors$1 = { EMPTY: { configurable: true } };

	/**
	 * returns the left edge of the rectangle
	 *
	 * @member {number}
	 */
	prototypeAccessors$2.left.get = function ()
	{
	    return this.x;
	};

	/**
	 * returns the right edge of the rectangle
	 *
	 * @member {number}
	 */
	prototypeAccessors$2.right.get = function ()
	{
	    return this.x + this.width;
	};

	/**
	 * returns the top edge of the rectangle
	 *
	 * @member {number}
	 */
	prototypeAccessors$2.top.get = function ()
	{
	    return this.y;
	};

	/**
	 * returns the bottom edge of the rectangle
	 *
	 * @member {number}
	 */
	prototypeAccessors$2.bottom.get = function ()
	{
	    return this.y + this.height;
	};

	/**
	 * A constant empty rectangle.
	 *
	 * @static
	 * @constant
	 * @member {PIXI.Rectangle}
	 */
	staticAccessors$1.EMPTY.get = function ()
	{
	    return new Rectangle(0, 0, 0, 0);
	};

	/**
	 * Creates a clone of this Rectangle
	 *
	 * @return {PIXI.Rectangle} a copy of the rectangle
	 */
	Rectangle.prototype.clone = function clone ()
	{
	    return new Rectangle(this.x, this.y, this.width, this.height);
	};

	/**
	 * Copies another rectangle to this one.
	 *
	 * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.
	 * @return {PIXI.Rectangle} Returns itself.
	 */
	Rectangle.prototype.copyFrom = function copyFrom (rectangle)
	{
	    this.x = rectangle.x;
	    this.y = rectangle.y;
	    this.width = rectangle.width;
	    this.height = rectangle.height;

	    return this;
	};

	/**
	 * Copies this rectangle to another one.
	 *
	 * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.
	 * @return {PIXI.Rectangle} Returns given parameter.
	 */
	Rectangle.prototype.copyTo = function copyTo (rectangle)
	{
	    rectangle.x = this.x;
	    rectangle.y = this.y;
	    rectangle.width = this.width;
	    rectangle.height = this.height;

	    return rectangle;
	};

	/**
	 * Checks whether the x and y coordinates given are contained within this Rectangle
	 *
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coordinates are within this Rectangle
	 */
	Rectangle.prototype.contains = function contains (x, y)
	{
	    if (this.width <= 0 || this.height <= 0)
	    {
	        return false;
	    }

	    if (x >= this.x && x < this.x + this.width)
	    {
	        if (y >= this.y && y < this.y + this.height)
	        {
	            return true;
	        }
	    }

	    return false;
	};

	/**
	 * Pads the rectangle making it grow in all directions.
	 *
	 * @param {number} paddingX - The horizontal padding amount.
	 * @param {number} paddingY - The vertical padding amount.
	 */
	Rectangle.prototype.pad = function pad (paddingX, paddingY)
	{
	    paddingX = paddingX || 0;
	    paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0);

	    this.x -= paddingX;
	    this.y -= paddingY;

	    this.width += paddingX * 2;
	    this.height += paddingY * 2;
	};

	/**
	 * Fits this rectangle around the passed one.
	 *
	 * @param {PIXI.Rectangle} rectangle - The rectangle to fit.
	 */
	Rectangle.prototype.fit = function fit (rectangle)
	{
	    var x1 = Math.max(this.x, rectangle.x);
	    var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
	    var y1 = Math.max(this.y, rectangle.y);
	    var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);

	    this.x = x1;
	    this.width = Math.max(x2 - x1, 0);
	    this.y = y1;
	    this.height = Math.max(y2 - y1, 0);
	};

	/**
	 * Enlarges rectangle that way its corners lie on grid
	 *
	 * @param {number} [resolution=1] resolution
	 * @param {number} [eps=0.001] precision
	 */
	Rectangle.prototype.ceil = function ceil (resolution, eps)
	{
	        if ( resolution === void 0 ) { resolution = 1; }
	        if ( eps === void 0 ) { eps = 0.001; }

	    var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
	    var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;

	    this.x = Math.floor((this.x + eps) * resolution) / resolution;
	    this.y = Math.floor((this.y + eps) * resolution) / resolution;

	    this.width = x2 - this.x;
	    this.height = y2 - this.y;
	};

	/**
	 * Enlarges this rectangle to include the passed rectangle.
	 *
	 * @param {PIXI.Rectangle} rectangle - The rectangle to include.
	 */
	Rectangle.prototype.enlarge = function enlarge (rectangle)
	{
	    var x1 = Math.min(this.x, rectangle.x);
	    var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
	    var y1 = Math.min(this.y, rectangle.y);
	    var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);

	    this.x = x1;
	    this.width = x2 - x1;
	    this.y = y1;
	    this.height = y2 - y1;
	};

	Object.defineProperties( Rectangle.prototype, prototypeAccessors$2 );
	Object.defineProperties( Rectangle, staticAccessors$1 );

	/**
	 * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Circle = function Circle(x, y, radius)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }
	    if ( radius === void 0 ) { radius = 0; }

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.x = x;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.y = y;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.radius = radius;

	    /**
	     * The type of the object, mainly used to avoid `instanceof` checks
	     *
	     * @member {number}
	     * @readOnly
	     * @default PIXI.SHAPES.CIRC
	     * @see PIXI.SHAPES
	     */
	    this.type = SHAPES.CIRC;
	};

	/**
	 * Creates a clone of this Circle instance
	 *
	 * @return {PIXI.Circle} a copy of the Circle
	 */
	Circle.prototype.clone = function clone ()
	{
	    return new Circle(this.x, this.y, this.radius);
	};

	/**
	 * Checks whether the x and y coordinates given are contained within this circle
	 *
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coordinates are within this Circle
	 */
	Circle.prototype.contains = function contains (x, y)
	{
	    if (this.radius <= 0)
	    {
	        return false;
	    }

	    var r2 = this.radius * this.radius;
	    var dx = (this.x - x);
	    var dy = (this.y - y);

	    dx *= dx;
	    dy *= dy;

	    return (dx + dy <= r2);
	};

	/**
	* Returns the framing rectangle of the circle as a Rectangle object
	*
	* @return {PIXI.Rectangle} the framing rectangle
	*/
	Circle.prototype.getBounds = function getBounds ()
	{
	    return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);
	};

	/**
	 * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Ellipse = function Ellipse(x, y, halfWidth, halfHeight)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }
	    if ( halfWidth === void 0 ) { halfWidth = 0; }
	    if ( halfHeight === void 0 ) { halfHeight = 0; }

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.x = x;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.y = y;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.width = halfWidth;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.height = halfHeight;

	    /**
	     * The type of the object, mainly used to avoid `instanceof` checks
	     *
	     * @member {number}
	     * @readOnly
	     * @default PIXI.SHAPES.ELIP
	     * @see PIXI.SHAPES
	     */
	    this.type = SHAPES.ELIP;
	};

	/**
	 * Creates a clone of this Ellipse instance
	 *
	 * @return {PIXI.Ellipse} a copy of the ellipse
	 */
	Ellipse.prototype.clone = function clone ()
	{
	    return new Ellipse(this.x, this.y, this.width, this.height);
	};

	/**
	 * Checks whether the x and y coordinates given are contained within this ellipse
	 *
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coords are within this ellipse
	 */
	Ellipse.prototype.contains = function contains (x, y)
	{
	    if (this.width <= 0 || this.height <= 0)
	    {
	        return false;
	    }

	    // normalize the coords to an ellipse with center 0,0
	    var normx = ((x - this.x) / this.width);
	    var normy = ((y - this.y) / this.height);

	    normx *= normx;
	    normy *= normy;

	    return (normx + normy <= 1);
	};

	/**
	 * Returns the framing rectangle of the ellipse as a Rectangle object
	 *
	 * @return {PIXI.Rectangle} the framing rectangle
	 */
	Ellipse.prototype.getBounds = function getBounds ()
	{
	    return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);
	};

	/**
	 * A class to define a shape via user defined co-orinates.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Polygon = function Polygon()
	{
	    var arguments$1 = arguments;

	    var points = [], len = arguments.length;
	    while ( len-- ) { points[ len ] = arguments$1[ len ]; }

	    if (Array.isArray(points[0]))
	    {
	        points = points[0];
	    }

	    // if this is an array of points, convert it to a flat array of numbers
	    if (points[0] instanceof Point)
	    {
	        var p = [];

	        for (var i = 0, il = points.length; i < il; i++)
	        {
	            p.push(points[i].x, points[i].y);
	        }

	        points = p;
	    }

	    /**
	     * An array of the points of this polygon
	     *
	     * @member {number[]}
	     */
	    this.points = points;

	    /**
	     * The type of the object, mainly used to avoid `instanceof` checks
	     *
	     * @member {number}
	     * @readOnly
	     * @default PIXI.SHAPES.POLY
	     * @see PIXI.SHAPES
	     */
	    this.type = SHAPES.POLY;

	    /**
	     * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.
	     * @member {boolean}
	     * @default true
	     */
	    this.closeStroke = true;
	};

	/**
	 * Creates a clone of this polygon
	 *
	 * @return {PIXI.Polygon} a copy of the polygon
	 */
	Polygon.prototype.clone = function clone ()
	{
	    var polygon = new Polygon(this.points.slice());

	    polygon.closeStroke = this.closeStroke;

	    return polygon;
	};

	/**
	 * Checks whether the x and y coordinates passed to this function are contained within this polygon
	 *
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coordinates are within this polygon
	 */
	Polygon.prototype.contains = function contains (x, y)
	{
	    var inside = false;

	    // use some raycasting to test hits
	    // https://github.com/substack/point-in-polygon/blob/master/index.js
	    var length = this.points.length / 2;

	    for (var i = 0, j = length - 1; i < length; j = i++)
	    {
	        var xi = this.points[i * 2];
	        var yi = this.points[(i * 2) + 1];
	        var xj = this.points[j * 2];
	        var yj = this.points[(j * 2) + 1];
	        var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);

	        if (intersect)
	        {
	            inside = !inside;
	        }
	    }

	    return inside;
	};

	/**
	 * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its
	 * top-left corner point (x, y) and by its width and its height and its radius.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var RoundedRectangle = function RoundedRectangle(x, y, width, height, radius)
	{
	    if ( x === void 0 ) { x = 0; }
	    if ( y === void 0 ) { y = 0; }
	    if ( width === void 0 ) { width = 0; }
	    if ( height === void 0 ) { height = 0; }
	    if ( radius === void 0 ) { radius = 20; }

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.x = x;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.y = y;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.width = width;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.height = height;

	    /**
	     * @member {number}
	     * @default 20
	     */
	    this.radius = radius;

	    /**
	     * The type of the object, mainly used to avoid `instanceof` checks
	     *
	     * @member {number}
	     * @readonly
	     * @default PIXI.SHAPES.RREC
	     * @see PIXI.SHAPES
	     */
	    this.type = SHAPES.RREC;
	};

	/**
	 * Creates a clone of this Rounded Rectangle
	 *
	 * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle
	 */
	RoundedRectangle.prototype.clone = function clone ()
	{
	    return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
	};

	/**
	 * Checks whether the x and y coordinates given are contained within this Rounded Rectangle
	 *
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle
	 */
	RoundedRectangle.prototype.contains = function contains (x, y)
	{
	    if (this.width <= 0 || this.height <= 0)
	    {
	        return false;
	    }
	    if (x >= this.x && x <= this.x + this.width)
	    {
	        if (y >= this.y && y <= this.y + this.height)
	        {
	            if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)
	            || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))
	            {
	                return true;
	            }
	            var dx = x - (this.x + this.radius);
	            var dy = y - (this.y + this.radius);
	            var radius2 = this.radius * this.radius;

	            if ((dx * dx) + (dy * dy) <= radius2)
	            {
	                return true;
	            }
	            dx = x - (this.x + this.width - this.radius);
	            if ((dx * dx) + (dy * dy) <= radius2)
	            {
	                return true;
	            }
	            dy = y - (this.y + this.height - this.radius);
	            if ((dx * dx) + (dy * dy) <= radius2)
	            {
	                return true;
	            }
	            dx = x - (this.x + this.radius);
	            if ((dx * dx) + (dy * dy) <= radius2)
	            {
	                return true;
	            }
	        }
	    }

	    return false;
	};

	/*!
	 * @pixi/display - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/display is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Sets the default value for the container property 'sortableChildren'.
	 * If set to true, the container will sort its children by zIndex value
	 * when updateTransform() is called, or manually if sortChildren() is called.
	 *
	 * This actually changes the order of elements in the array, so should be treated
	 * as a basic solution that is not performant compared to other solutions,
	 * such as @link https://github.com/pixijs/pixi-display
	 *
	 * Also be aware of that this may not work nicely with the addChildAt() function,
	 * as the zIndex sorting may cause the child to automatically sorted to another position.
	 *
	 * @static
	 * @constant
	 * @name SORTABLE_CHILDREN
	 * @memberof PIXI.settings
	 * @type {boolean}
	 * @default false
	 */
	settings.SORTABLE_CHILDREN = false;

	/**
	 * 'Builder' pattern for bounds rectangles.
	 *
	 * This could be called an Axis-Aligned Bounding Box.
	 * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Bounds = function Bounds()
	{
	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.minX = Infinity;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.minY = Infinity;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.maxX = -Infinity;

	    /**
	     * @member {number}
	     * @default 0
	     */
	    this.maxY = -Infinity;

	    this.rect = null;
	};

	/**
	 * Checks if bounds are empty.
	 *
	 * @return {boolean} True if empty.
	 */
	Bounds.prototype.isEmpty = function isEmpty ()
	{
	    return this.minX > this.maxX || this.minY > this.maxY;
	};

	/**
	 * Clears the bounds and resets.
	 *
	 */
	Bounds.prototype.clear = function clear ()
	{
	    this.updateID++;

	    this.minX = Infinity;
	    this.minY = Infinity;
	    this.maxX = -Infinity;
	    this.maxY = -Infinity;
	};

	/**
	 * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
	 * It is not guaranteed that it will return tempRect
	 *
	 * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty
	 * @returns {PIXI.Rectangle} A rectangle of the bounds
	 */
	Bounds.prototype.getRectangle = function getRectangle (rect)
	{
	    if (this.minX > this.maxX || this.minY > this.maxY)
	    {
	        return Rectangle.EMPTY;
	    }

	    rect = rect || new Rectangle(0, 0, 1, 1);

	    rect.x = this.minX;
	    rect.y = this.minY;
	    rect.width = this.maxX - this.minX;
	    rect.height = this.maxY - this.minY;

	    return rect;
	};

	/**
	 * This function should be inlined when its possible.
	 *
	 * @param {PIXI.Point} point - The point to add.
	 */
	Bounds.prototype.addPoint = function addPoint (point)
	{
	    this.minX = Math.min(this.minX, point.x);
	    this.maxX = Math.max(this.maxX, point.x);
	    this.minY = Math.min(this.minY, point.y);
	    this.maxY = Math.max(this.maxY, point.y);
	};

	/**
	 * Adds a quad, not transformed
	 *
	 * @param {Float32Array} vertices - The verts to add.
	 */
	Bounds.prototype.addQuad = function addQuad (vertices)
	{
	    var minX = this.minX;
	    var minY = this.minY;
	    var maxX = this.maxX;
	    var maxY = this.maxY;

	    var x = vertices[0];
	    var y = vertices[1];

	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = vertices[2];
	    y = vertices[3];
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = vertices[4];
	    y = vertices[5];
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = vertices[6];
	    y = vertices[7];
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    this.minX = minX;
	    this.minY = minY;
	    this.maxX = maxX;
	    this.maxY = maxY;
	};

	/**
	 * Adds sprite frame, transformed.
	 *
	 * @param {PIXI.Transform} transform - TODO
	 * @param {number} x0 - TODO
	 * @param {number} y0 - TODO
	 * @param {number} x1 - TODO
	 * @param {number} y1 - TODO
	 */
	Bounds.prototype.addFrame = function addFrame (transform, x0, y0, x1, y1)
	{
	    var matrix = transform.worldTransform;
	    var a = matrix.a;
	    var b = matrix.b;
	    var c = matrix.c;
	    var d = matrix.d;
	    var tx = matrix.tx;
	    var ty = matrix.ty;

	    var minX = this.minX;
	    var minY = this.minY;
	    var maxX = this.maxX;
	    var maxY = this.maxY;

	    var x = (a * x0) + (c * y0) + tx;
	    var y = (b * x0) + (d * y0) + ty;

	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = (a * x1) + (c * y0) + tx;
	    y = (b * x1) + (d * y0) + ty;
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = (a * x0) + (c * y1) + tx;
	    y = (b * x0) + (d * y1) + ty;
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    x = (a * x1) + (c * y1) + tx;
	    y = (b * x1) + (d * y1) + ty;
	    minX = x < minX ? x : minX;
	    minY = y < minY ? y : minY;
	    maxX = x > maxX ? x : maxX;
	    maxY = y > maxY ? y : maxY;

	    this.minX = minX;
	    this.minY = minY;
	    this.maxX = maxX;
	    this.maxY = maxY;
	};

	/**
	 * Adds screen vertices from array
	 *
	 * @param {Float32Array} vertexData - calculated vertices
	 * @param {number} beginOffset - begin offset
	 * @param {number} endOffset - end offset, excluded
	 */
	Bounds.prototype.addVertexData = function addVertexData (vertexData, beginOffset, endOffset)
	{
	    var minX = this.minX;
	    var minY = this.minY;
	    var maxX = this.maxX;
	    var maxY = this.maxY;

	    for (var i = beginOffset; i < endOffset; i += 2)
	    {
	        var x = vertexData[i];
	        var y = vertexData[i + 1];

	        minX = x < minX ? x : minX;
	        minY = y < minY ? y : minY;
	        maxX = x > maxX ? x : maxX;
	        maxY = y > maxY ? y : maxY;
	    }

	    this.minX = minX;
	    this.minY = minY;
	    this.maxX = maxX;
	    this.maxY = maxY;
	};

	/**
	 * Add an array of mesh vertices
	 *
	 * @param {PIXI.Transform} transform - mesh transform
	 * @param {Float32Array} vertices - mesh coordinates in array
	 * @param {number} beginOffset - begin offset
	 * @param {number} endOffset - end offset, excluded
	 */
	Bounds.prototype.addVertices = function addVertices (transform, vertices, beginOffset, endOffset)
	{
	    var matrix = transform.worldTransform;
	    var a = matrix.a;
	    var b = matrix.b;
	    var c = matrix.c;
	    var d = matrix.d;
	    var tx = matrix.tx;
	    var ty = matrix.ty;

	    var minX = this.minX;
	    var minY = this.minY;
	    var maxX = this.maxX;
	    var maxY = this.maxY;

	    for (var i = beginOffset; i < endOffset; i += 2)
	    {
	        var rawX = vertices[i];
	        var 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;
	    }

	    this.minX = minX;
	    this.minY = minY;
	    this.maxX = maxX;
	    this.maxY = maxY;
	};

	/**
	 * Adds other Bounds
	 *
	 * @param {PIXI.Bounds} bounds - TODO
	 */
	Bounds.prototype.addBounds = function addBounds (bounds)
	{
	    var minX = this.minX;
	    var minY = this.minY;
	    var maxX = this.maxX;
	    var maxY = this.maxY;

	    this.minX = bounds.minX < minX ? bounds.minX : minX;
	    this.minY = bounds.minY < minY ? bounds.minY : minY;
	    this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;
	    this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
	};

	/**
	 * Adds other Bounds, masked with Bounds
	 *
	 * @param {PIXI.Bounds} bounds - TODO
	 * @param {PIXI.Bounds} mask - TODO
	 */
	Bounds.prototype.addBoundsMask = function addBoundsMask (bounds, mask)
	{
	    var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;
	    var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;
	    var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;
	    var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;

	    if (_minX <= _maxX && _minY <= _maxY)
	    {
	        var minX = this.minX;
	        var minY = this.minY;
	        var maxX = this.maxX;
	        var maxY = this.maxY;

	        this.minX = _minX < minX ? _minX : minX;
	        this.minY = _minY < minY ? _minY : minY;
	        this.maxX = _maxX > maxX ? _maxX : maxX;
	        this.maxY = _maxY > maxY ? _maxY : maxY;
	    }
	};

	/**
	 * Adds other Bounds, masked with Rectangle
	 *
	 * @param {PIXI.Bounds} bounds - TODO
	 * @param {PIXI.Rectangle} area - TODO
	 */
	Bounds.prototype.addBoundsArea = function addBoundsArea (bounds, area)
	{
	    var _minX = bounds.minX > area.x ? bounds.minX : area.x;
	    var _minY = bounds.minY > area.y ? bounds.minY : area.y;
	    var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);
	    var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);

	    if (_minX <= _maxX && _minY <= _maxY)
	    {
	        var minX = this.minX;
	        var minY = this.minY;
	        var maxX = this.maxX;
	        var maxY = this.maxY;

	        this.minX = _minX < minX ? _minX : minX;
	        this.minY = _minY < minY ? _minY : minY;
	        this.maxX = _maxX > maxX ? _maxX : maxX;
	        this.maxY = _maxY > maxY ? _maxY : maxY;
	    }
	};

	// _tempDisplayObjectParent = new DisplayObject();

	/**
	 * The base class for all objects that are rendered on the screen.
	 *
	 * This is an abstract class and should not be used on its own; rather it should be extended.
	 *
	 * @class
	 * @extends PIXI.utils.EventEmitter
	 * @memberof PIXI
	 */
	var DisplayObject = /*@__PURE__*/(function (EventEmitter) {
	    function DisplayObject()
	    {
	        EventEmitter.call(this);

	        this.tempDisplayObjectParent = null;

	        // TODO: need to create Transform from factory
	        /**
	         * World transform and local transform of this object.
	         * This will become read-only later, please do not assign anything there unless you know what are you doing.
	         *
	         * @member {PIXI.Transform}
	         */
	        this.transform = new Transform();

	        /**
	         * The opacity of the object.
	         *
	         * @member {number}
	         */
	        this.alpha = 1;

	        /**
	         * The visibility of the object. If false the object will not be drawn, and
	         * the updateTransform function will not be called.
	         *
	         * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.
	         *
	         * @member {boolean}
	         */
	        this.visible = true;

	        /**
	         * Can this object be rendered, if false the object will not be drawn but the updateTransform
	         * methods will still be called.
	         *
	         * Only affects recursive calls from parent. You can ask for bounds manually.
	         *
	         * @member {boolean}
	         */
	        this.renderable = true;

	        /**
	         * The display object container that contains this display object.
	         *
	         * @member {PIXI.Container}
	         * @readonly
	         */
	        this.parent = null;

	        /**
	         * The multiplied alpha of the displayObject.
	         *
	         * @member {number}
	         * @readonly
	         */
	        this.worldAlpha = 1;

	        /**
	         * Which index in the children array the display component was before the previous zIndex sort.
	         * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.
	         *
	         * @member {number}
	         * @protected
	         */
	        this._lastSortedIndex = 0;

	        /**
	         * The zIndex of the displayObject.
	         * A higher value will mean it will be rendered on top of other displayObjects within the same container.
	         *
	         * @member {number}
	         * @protected
	         */
	        this._zIndex = 0;

	        /**
	         * The area the filter is applied to. This is used as more of an optimization
	         * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.
	         *
	         * Also works as an interaction mask.
	         *
	         * @member {?PIXI.Rectangle}
	         */
	        this.filterArea = null;

	        /**
	         * Sets the filters for the displayObject.
	         * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.
	         * To remove filters simply set this property to `'null'`.
	         *
	         * @member {?PIXI.Filter[]}
	         */
	        this.filters = null;
	        this._enabledFilters = null;

	        /**
	         * The bounds object, this is used to calculate and store the bounds of the displayObject.
	         *
	         * @member {PIXI.Bounds}
	         * @protected
	         */
	        this._bounds = new Bounds();
	        this._boundsID = 0;
	        this._lastBoundsID = -1;
	        this._boundsRect = null;
	        this._localBoundsRect = null;

	        /**
	         * The original, cached mask of the object.
	         *
	         * @member {PIXI.Graphics|PIXI.Sprite|null}
	         * @protected
	         */
	        this._mask = null;

	        /**
	         * Fired when this DisplayObject is added to a Container.
	         *
	         * @event PIXI.DisplayObject#added
	         * @param {PIXI.Container} container - The container added to.
	         */

	        /**
	         * Fired when this DisplayObject is removed from a Container.
	         *
	         * @event PIXI.DisplayObject#removed
	         * @param {PIXI.Container} container - The container removed from.
	         */

	        /**
	         * If the object has been destroyed via destroy(). If true, it should not be used.
	         *
	         * @member {boolean}
	         * @protected
	         */
	        this._destroyed = false;

	        /**
	         * used to fast check if a sprite is.. a sprite!
	         * @member {boolean}
	         */
	        this.isSprite = false;
	    }

	    if ( EventEmitter ) { DisplayObject.__proto__ = EventEmitter; }
	    DisplayObject.prototype = Object.create( EventEmitter && EventEmitter.prototype );
	    DisplayObject.prototype.constructor = DisplayObject;

	    var prototypeAccessors = { _tempDisplayObjectParent: { configurable: true },x: { configurable: true },y: { configurable: true },worldTransform: { configurable: true },localTransform: { configurable: true },position: { configurable: true },scale: { configurable: true },pivot: { configurable: true },skew: { configurable: true },rotation: { configurable: true },angle: { configurable: true },zIndex: { configurable: true },worldVisible: { configurable: true },mask: { configurable: true } };

	    /**
	     * @protected
	     * @member {PIXI.DisplayObject}
	     */
	    DisplayObject.mixin = function mixin (source)
	    {
	        // in ES8/ES2017, this would be really easy:
	        // Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));

	        // get all the enumerable property keys
	        var keys = Object.keys(source);

	        // loop through properties
	        for (var i = 0; i < keys.length; ++i)
	        {
	            var propertyName = keys[i];

	            // Set the property using the property descriptor - this works for accessors and normal value properties
	            Object.defineProperty(
	                DisplayObject.prototype,
	                propertyName,
	                Object.getOwnPropertyDescriptor(source, propertyName)
	            );
	        }
	    };

	    prototypeAccessors._tempDisplayObjectParent.get = function ()
	    {
	        if (this.tempDisplayObjectParent === null)
	        {
	            this.tempDisplayObjectParent = new DisplayObject();
	        }

	        return this.tempDisplayObjectParent;
	    };

	    /**
	     * Updates the object transform for rendering.
	     *
	     * TODO - Optimization pass!
	     */
	    DisplayObject.prototype.updateTransform = function updateTransform ()
	    {
	        this.transform.updateTransform(this.parent.transform);
	        // multiply the alphas..
	        this.worldAlpha = this.alpha * this.parent.worldAlpha;

	        this._bounds.updateID++;
	    };

	    /**
	     * Recursively updates transform of all objects from the root to this one
	     * internal function for toLocal()
	     */
	    DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform ()
	    {
	        if (this.parent)
	        {
	            this.parent._recursivePostUpdateTransform();
	            this.transform.updateTransform(this.parent.transform);
	        }
	        else
	        {
	            this.transform.updateTransform(this._tempDisplayObjectParent.transform);
	        }
	    };

	    /**
	     * Retrieves the bounds of the displayObject as a rectangle object.
	     *
	     * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from
	     *  being updated. This means the calculation returned MAY be out of date BUT will give you a
	     *  nice performance boost.
	     * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.
	     * @return {PIXI.Rectangle} The rectangular bounding area.
	     */
	    DisplayObject.prototype.getBounds = function getBounds (skipUpdate, rect)
	    {
	        if (!skipUpdate)
	        {
	            if (!this.parent)
	            {
	                this.parent = this._tempDisplayObjectParent;
	                this.updateTransform();
	                this.parent = null;
	            }
	            else
	            {
	                this._recursivePostUpdateTransform();
	                this.updateTransform();
	            }
	        }

	        if (this._boundsID !== this._lastBoundsID)
	        {
	            this.calculateBounds();
	            this._lastBoundsID = this._boundsID;
	        }

	        if (!rect)
	        {
	            if (!this._boundsRect)
	            {
	                this._boundsRect = new Rectangle();
	            }

	            rect = this._boundsRect;
	        }

	        return this._bounds.getRectangle(rect);
	    };

	    /**
	     * Retrieves the local bounds of the displayObject as a rectangle object.
	     *
	     * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.
	     * @return {PIXI.Rectangle} The rectangular bounding area.
	     */
	    DisplayObject.prototype.getLocalBounds = function getLocalBounds (rect)
	    {
	        var transformRef = this.transform;
	        var parentRef = this.parent;

	        this.parent = null;
	        this.transform = this._tempDisplayObjectParent.transform;

	        if (!rect)
	        {
	            if (!this._localBoundsRect)
	            {
	                this._localBoundsRect = new Rectangle();
	            }

	            rect = this._localBoundsRect;
	        }

	        var bounds = this.getBounds(false, rect);

	        this.parent = parentRef;
	        this.transform = transformRef;

	        return bounds;
	    };

	    /**
	     * Calculates the global position of the display object.
	     *
	     * @param {PIXI.IPoint} position - The world origin to calculate from.
	     * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
	     *  (otherwise will create a new Point).
	     * @param {boolean} [skipUpdate=false] - Should we skip the update transform.
	     * @return {PIXI.IPoint} A point object representing the position of this object.
	     */
	    DisplayObject.prototype.toGlobal = function toGlobal (position, point, skipUpdate)
	    {
	        if ( skipUpdate === void 0 ) { skipUpdate = false; }

	        if (!skipUpdate)
	        {
	            this._recursivePostUpdateTransform();

	            // this parent check is for just in case the item is a root object.
	            // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
	            // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
	            if (!this.parent)
	            {
	                this.parent = this._tempDisplayObjectParent;
	                this.displayObjectUpdateTransform();
	                this.parent = null;
	            }
	            else
	            {
	                this.displayObjectUpdateTransform();
	            }
	        }

	        // don't need to update the lot
	        return this.worldTransform.apply(position, point);
	    };

	    /**
	     * Calculates the local position of the display object relative to another point.
	     *
	     * @param {PIXI.IPoint} position - The world origin to calculate from.
	     * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.
	     * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
	     *  (otherwise will create a new Point).
	     * @param {boolean} [skipUpdate=false] - Should we skip the update transform
	     * @return {PIXI.IPoint} A point object representing the position of this object
	     */
	    DisplayObject.prototype.toLocal = function toLocal (position, from, point, skipUpdate)
	    {
	        if (from)
	        {
	            position = from.toGlobal(position, point, skipUpdate);
	        }

	        if (!skipUpdate)
	        {
	            this._recursivePostUpdateTransform();

	            // this parent check is for just in case the item is a root object.
	            // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
	            // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
	            if (!this.parent)
	            {
	                this.parent = this._tempDisplayObjectParent;
	                this.displayObjectUpdateTransform();
	                this.parent = null;
	            }
	            else
	            {
	                this.displayObjectUpdateTransform();
	            }
	        }

	        // simply apply the matrix..
	        return this.worldTransform.applyInverse(position, point);
	    };

	    /**
	     * Renders the object using the WebGL renderer.
	     *
	     * @param {PIXI.Renderer} renderer - The renderer.
	     */
	    DisplayObject.prototype.render = function render (renderer) // eslint-disable-line no-unused-vars
	    {
	        // OVERWRITE;
	    };

	    /**
	     * Set the parent Container of this DisplayObject.
	     *
	     * @param {PIXI.Container} container - The Container to add this DisplayObject to.
	     * @return {PIXI.Container} The Container that this DisplayObject was added to.
	     */
	    DisplayObject.prototype.setParent = function setParent (container)
	    {
	        if (!container || !container.addChild)
	        {
	            throw new Error('setParent: Argument must be a Container');
	        }

	        container.addChild(this);

	        return container;
	    };

	    /**
	     * Convenience function to set the position, scale, skew and pivot at once.
	     *
	     * @param {number} [x=0] - The X position
	     * @param {number} [y=0] - The Y position
	     * @param {number} [scaleX=1] - The X scale value
	     * @param {number} [scaleY=1] - The Y scale value
	     * @param {number} [rotation=0] - The rotation
	     * @param {number} [skewX=0] - The X skew value
	     * @param {number} [skewY=0] - The Y skew value
	     * @param {number} [pivotX=0] - The X pivot value
	     * @param {number} [pivotY=0] - The Y pivot value
	     * @return {PIXI.DisplayObject} The DisplayObject instance
	     */
	    DisplayObject.prototype.setTransform = function setTransform (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY)
	    {
	        if ( x === void 0 ) { x = 0; }
	        if ( y === void 0 ) { y = 0; }
	        if ( scaleX === void 0 ) { scaleX = 1; }
	        if ( scaleY === void 0 ) { scaleY = 1; }
	        if ( rotation === void 0 ) { rotation = 0; }
	        if ( skewX === void 0 ) { skewX = 0; }
	        if ( skewY === void 0 ) { skewY = 0; }
	        if ( pivotX === void 0 ) { pivotX = 0; }
	        if ( pivotY === void 0 ) { pivotY = 0; }

	        this.position.x = x;
	        this.position.y = y;
	        this.scale.x = !scaleX ? 1 : scaleX;
	        this.scale.y = !scaleY ? 1 : scaleY;
	        this.rotation = rotation;
	        this.skew.x = skewX;
	        this.skew.y = skewY;
	        this.pivot.x = pivotX;
	        this.pivot.y = pivotY;

	        return this;
	    };

	    /**
	     * Base destroy method for generic display objects. This will automatically
	     * remove the display object from its parent Container as well as remove
	     * all current event listeners and internal references. Do not use a DisplayObject
	     * after calling `destroy()`.
	     *
	     */
	    DisplayObject.prototype.destroy = function destroy ()
	    {
	        this.removeAllListeners();
	        if (this.parent)
	        {
	            this.parent.removeChild(this);
	        }
	        this.transform = null;

	        this.parent = null;

	        this._bounds = null;
	        this._currentBounds = null;
	        this._mask = null;

	        this.filterArea = null;

	        this.interactive = false;
	        this.interactiveChildren = false;

	        this._destroyed = true;
	    };

	    /**
	     * The position of the displayObject on the x axis relative to the local coordinates of the parent.
	     * An alias to position.x
	     *
	     * @member {number}
	     */
	    prototypeAccessors.x.get = function ()
	    {
	        return this.position.x;
	    };

	    prototypeAccessors.x.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.position.x = value;
	    };

	    /**
	     * The position of the displayObject on the y axis relative to the local coordinates of the parent.
	     * An alias to position.y
	     *
	     * @member {number}
	     */
	    prototypeAccessors.y.get = function ()
	    {
	        return this.position.y;
	    };

	    prototypeAccessors.y.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.position.y = value;
	    };

	    /**
	     * Current transform of the object based on world (parent) factors.
	     *
	     * @member {PIXI.Matrix}
	     * @readonly
	     */
	    prototypeAccessors.worldTransform.get = function ()
	    {
	        return this.transform.worldTransform;
	    };

	    /**
	     * Current transform of the object based on local factors: position, scale, other stuff.
	     *
	     * @member {PIXI.Matrix}
	     * @readonly
	     */
	    prototypeAccessors.localTransform.get = function ()
	    {
	        return this.transform.localTransform;
	    };

	    /**
	     * The coordinate of the object relative to the local coordinates of the parent.
	     * Assignment by value since pixi-v4.
	     *
	     * @member {PIXI.IPoint}
	     */
	    prototypeAccessors.position.get = function ()
	    {
	        return this.transform.position;
	    };

	    prototypeAccessors.position.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.position.copyFrom(value);
	    };

	    /**
	     * The scale factor of the object.
	     * Assignment by value since pixi-v4.
	     *
	     * @member {PIXI.IPoint}
	     */
	    prototypeAccessors.scale.get = function ()
	    {
	        return this.transform.scale;
	    };

	    prototypeAccessors.scale.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.scale.copyFrom(value);
	    };

	    /**
	     * The pivot point of the displayObject that it rotates around.
	     * Assignment by value since pixi-v4.
	     *
	     * @member {PIXI.IPoint}
	     */
	    prototypeAccessors.pivot.get = function ()
	    {
	        return this.transform.pivot;
	    };

	    prototypeAccessors.pivot.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.pivot.copyFrom(value);
	    };

	    /**
	     * The skew factor for the object in radians.
	     * Assignment by value since pixi-v4.
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    prototypeAccessors.skew.get = function ()
	    {
	        return this.transform.skew;
	    };

	    prototypeAccessors.skew.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.skew.copyFrom(value);
	    };

	    /**
	     * The rotation of the object in radians.
	     * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.rotation.get = function ()
	    {
	        return this.transform.rotation;
	    };

	    prototypeAccessors.rotation.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.rotation = value;
	    };

	    /**
	     * The angle of the object in degrees.
	     * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.angle.get = function ()
	    {
	        return this.transform.rotation * RAD_TO_DEG;
	    };

	    prototypeAccessors.angle.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.transform.rotation = value * DEG_TO_RAD;
	    };

	    /**
	     * The zIndex of the displayObject.
	     * If a container has the sortableChildren property set to true, children will be automatically
	     * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
	     * and thus rendered on top of other displayObjects within the same container.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.zIndex.get = function ()
	    {
	        return this._zIndex;
	    };

	    prototypeAccessors.zIndex.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._zIndex = value;
	        if (this.parent)
	        {
	            this.parent.sortDirty = true;
	        }
	    };

	    /**
	     * Indicates if the object is globally visible.
	     *
	     * @member {boolean}
	     * @readonly
	     */
	    prototypeAccessors.worldVisible.get = function ()
	    {
	        var item = this;

	        do
	        {
	            if (!item.visible)
	            {
	                return false;
	            }

	            item = item.parent;
	        } while (item);

	        return true;
	    };

	    /**
	     * Sets a mask for the displayObject. A mask is an object that limits the visibility of an
	     * object to the shape of the mask applied to it. In PixiJS a regular mask must be a
	     * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it
	     * utilities shape clipping. To remove a mask, set this property to `null`.
	     *
	     * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
	     * @example
	     * const graphics = new PIXI.Graphics();
	     * graphics.beginFill(0xFF3300);
	     * graphics.drawRect(50, 250, 100, 100);
	     * graphics.endFill();
	     *
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.mask = graphics;
	     * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
	     *
	     * @member {PIXI.Graphics|PIXI.Sprite|null}
	     */
	    prototypeAccessors.mask.get = function ()
	    {
	        return this._mask;
	    };

	    prototypeAccessors.mask.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (this._mask)
	        {
	            this._mask.renderable = true;
	            this._mask.isMask = false;
	        }

	        this._mask = value;

	        if (this._mask)
	        {
	            this._mask.renderable = false;
	            this._mask.isMask = true;
	        }
	    };

	    Object.defineProperties( DisplayObject.prototype, prototypeAccessors );

	    return DisplayObject;
	}(eventemitter3));

	/**
	 * DisplayObject default updateTransform, does not update children of container.
	 * Will crash if there's no parent element.
	 *
	 * @memberof PIXI.DisplayObject#
	 * @function displayObjectUpdateTransform
	 */
	DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;

	function sortChildren(a, b)
	{
	    if (a.zIndex === b.zIndex)
	    {
	        return a._lastSortedIndex - b._lastSortedIndex;
	    }

	    return a.zIndex - b.zIndex;
	}

	/**
	 * A Container represents a collection of display objects.
	 *
	 * It is the base class of all display objects that act as a container for other objects (like Sprites).
	 *
	 *```js
	 * let container = new PIXI.Container();
	 * container.addChild(sprite);
	 * ```
	 *
	 * @class
	 * @extends PIXI.DisplayObject
	 * @memberof PIXI
	 */
	var Container = /*@__PURE__*/(function (DisplayObject) {
	    function Container()
	    {
	        DisplayObject.call(this);

	        /**
	         * The array of children of this container.
	         *
	         * @member {PIXI.DisplayObject[]}
	         * @readonly
	         */
	        this.children = [];

	        /**
	         * If set to true, the container will sort its children by zIndex value
	         * when updateTransform() is called, or manually if sortChildren() is called.
	         *
	         * This actually changes the order of elements in the array, so should be treated
	         * as a basic solution that is not performant compared to other solutions,
	         * such as @link https://github.com/pixijs/pixi-display
	         *
	         * Also be aware of that this may not work nicely with the addChildAt() function,
	         * as the zIndex sorting may cause the child to automatically sorted to another position.
	         *
	         * @see PIXI.settings.SORTABLE_CHILDREN
	         *
	         * @member {boolean}
	         */
	        this.sortableChildren = settings.SORTABLE_CHILDREN;

	        /**
	         * Should children be sorted by zIndex at the next updateTransform call.
	         * Will get automatically set to true if a new child is added, or if a child's zIndex changes.
	         *
	         * @member {boolean}
	         */
	        this.sortDirty = false;

	        /**
	         * Fired when a DisplayObject is added to this Container.
	         *
	         * @event PIXI.Container#childAdded
	         * @param {PIXI.DisplayObject} child - The child added to the Container.
	         * @param {PIXI.Container} container - The container that added the child.
	         * @param {number} index - The children's index of the added child.
	         */

	        /**
	         * Fired when a DisplayObject is removed from this Container.
	         *
	         * @event PIXI.DisplayObject#removedFrom
	         * @param {PIXI.DisplayObject} child - The child removed from the Container.
	         * @param {PIXI.Container} container - The container that removed removed the child.
	         * @param {number} index - The former children's index of the removed child
	         */
	    }

	    if ( DisplayObject ) { Container.__proto__ = DisplayObject; }
	    Container.prototype = Object.create( DisplayObject && DisplayObject.prototype );
	    Container.prototype.constructor = Container;

	    var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };

	    /**
	     * Overridable method that can be used by Container subclasses whenever the children array is modified
	     *
	     * @protected
	     */
	    Container.prototype.onChildrenChange = function onChildrenChange ()
	    {
	        /* empty */
	    };

	    /**
	     * Adds one or more children to the container.
	     *
	     * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
	     *
	     * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container
	     * @return {PIXI.DisplayObject} The first child that was added.
	     */
	    Container.prototype.addChild = function addChild (child)
	    {
	        var arguments$1 = arguments;

	        var argumentsLength = arguments.length;

	        // if there is only one argument we can bypass looping through the them
	        if (argumentsLength > 1)
	        {
	            // loop through the arguments property and add all children
	            // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
	            for (var i = 0; i < argumentsLength; i++)
	            {
	                this.addChild(arguments$1[i]);
	            }
	        }
	        else
	        {
	            // if the child has a parent then lets remove it as PixiJS objects can only exist in one place
	            if (child.parent)
	            {
	                child.parent.removeChild(child);
	            }

	            child.parent = this;
	            this.sortDirty = true;

	            // ensure child transform will be recalculated
	            child.transform._parentID = -1;

	            this.children.push(child);

	            // ensure bounds will be recalculated
	            this._boundsID++;

	            // TODO - lets either do all callbacks or all events.. not both!
	            this.onChildrenChange(this.children.length - 1);
	            this.emit('childAdded', child, this, this.children.length - 1);
	            child.emit('added', this);
	        }

	        return child;
	    };

	    /**
	     * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown
	     *
	     * @param {PIXI.DisplayObject} child - The child to add
	     * @param {number} index - The index to place the child in
	     * @return {PIXI.DisplayObject} The child that was added.
	     */
	    Container.prototype.addChildAt = function addChildAt (child, index)
	    {
	        if (index < 0 || index > this.children.length)
	        {
	            throw new Error((child + "addChildAt: The index " + index + " supplied is out of bounds " + (this.children.length)));
	        }

	        if (child.parent)
	        {
	            child.parent.removeChild(child);
	        }

	        child.parent = this;
	        this.sortDirty = true;

	        // ensure child transform will be recalculated
	        child.transform._parentID = -1;

	        this.children.splice(index, 0, child);

	        // ensure bounds will be recalculated
	        this._boundsID++;

	        // TODO - lets either do all callbacks or all events.. not both!
	        this.onChildrenChange(index);
	        child.emit('added', this);
	        this.emit('childAdded', child, this, index);

	        return child;
	    };

	    /**
	     * Swaps the position of 2 Display Objects within this container.
	     *
	     * @param {PIXI.DisplayObject} child - First display object to swap
	     * @param {PIXI.DisplayObject} child2 - Second display object to swap
	     */
	    Container.prototype.swapChildren = function swapChildren (child, child2)
	    {
	        if (child === child2)
	        {
	            return;
	        }

	        var index1 = this.getChildIndex(child);
	        var index2 = this.getChildIndex(child2);

	        this.children[index1] = child2;
	        this.children[index2] = child;
	        this.onChildrenChange(index1 < index2 ? index1 : index2);
	    };

	    /**
	     * Returns the index position of a child DisplayObject instance
	     *
	     * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify
	     * @return {number} The index position of the child display object to identify
	     */
	    Container.prototype.getChildIndex = function getChildIndex (child)
	    {
	        var index = this.children.indexOf(child);

	        if (index === -1)
	        {
	            throw new Error('The supplied DisplayObject must be a child of the caller');
	        }

	        return index;
	    };

	    /**
	     * Changes the position of an existing child in the display object container
	     *
	     * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number
	     * @param {number} index - The resulting index number for the child display object
	     */
	    Container.prototype.setChildIndex = function setChildIndex (child, index)
	    {
	        if (index < 0 || index >= this.children.length)
	        {
	            throw new Error(("The index " + index + " supplied is out of bounds " + (this.children.length)));
	        }

	        var currentIndex = this.getChildIndex(child);

	        removeItems(this.children, currentIndex, 1); // remove from old position
	        this.children.splice(index, 0, child); // add at new position

	        this.onChildrenChange(index);
	    };

	    /**
	     * Returns the child at the specified index
	     *
	     * @param {number} index - The index to get the child at
	     * @return {PIXI.DisplayObject} The child at the given index, if any.
	     */
	    Container.prototype.getChildAt = function getChildAt (index)
	    {
	        if (index < 0 || index >= this.children.length)
	        {
	            throw new Error(("getChildAt: Index (" + index + ") does not exist."));
	        }

	        return this.children[index];
	    };

	    /**
	     * Removes one or more children from the container.
	     *
	     * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove
	     * @return {PIXI.DisplayObject} The first child that was removed.
	     */
	    Container.prototype.removeChild = function removeChild (child)
	    {
	        var arguments$1 = arguments;

	        var argumentsLength = arguments.length;

	        // if there is only one argument we can bypass looping through the them
	        if (argumentsLength > 1)
	        {
	            // loop through the arguments property and add all children
	            // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
	            for (var i = 0; i < argumentsLength; i++)
	            {
	                this.removeChild(arguments$1[i]);
	            }
	        }
	        else
	        {
	            var index = this.children.indexOf(child);

	            if (index === -1) { return null; }

	            child.parent = null;
	            // ensure child transform will be recalculated
	            child.transform._parentID = -1;
	            removeItems(this.children, index, 1);

	            // ensure bounds will be recalculated
	            this._boundsID++;

	            // TODO - lets either do all callbacks or all events.. not both!
	            this.onChildrenChange(index);
	            child.emit('removed', this);
	            this.emit('childRemoved', child, this, index);
	        }

	        return child;
	    };

	    /**
	     * Removes a child from the specified index position.
	     *
	     * @param {number} index - The index to get the child from
	     * @return {PIXI.DisplayObject} The child that was removed.
	     */
	    Container.prototype.removeChildAt = function removeChildAt (index)
	    {
	        var child = this.getChildAt(index);

	        // ensure child transform will be recalculated..
	        child.parent = null;
	        child.transform._parentID = -1;
	        removeItems(this.children, index, 1);

	        // ensure bounds will be recalculated
	        this._boundsID++;

	        // TODO - lets either do all callbacks or all events.. not both!
	        this.onChildrenChange(index);
	        child.emit('removed', this);
	        this.emit('childRemoved', child, this, index);

	        return child;
	    };

	    /**
	     * Removes all children from this container that are within the begin and end indexes.
	     *
	     * @param {number} [beginIndex=0] - The beginning position.
	     * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.
	     * @returns {PIXI.DisplayObject[]} List of removed children
	     */
	    Container.prototype.removeChildren = function removeChildren (beginIndex, endIndex)
	    {
	        if ( beginIndex === void 0 ) { beginIndex = 0; }

	        var begin = beginIndex;
	        var end = typeof endIndex === 'number' ? endIndex : this.children.length;
	        var range = end - begin;
	        var removed;

	        if (range > 0 && range <= end)
	        {
	            removed = this.children.splice(begin, range);

	            for (var i = 0; i < removed.length; ++i)
	            {
	                removed[i].parent = null;
	                if (removed[i].transform)
	                {
	                    removed[i].transform._parentID = -1;
	                }
	            }

	            this._boundsID++;

	            this.onChildrenChange(beginIndex);

	            for (var i$1 = 0; i$1 < removed.length; ++i$1)
	            {
	                removed[i$1].emit('removed', this);
	                this.emit('childRemoved', removed[i$1], this, i$1);
	            }

	            return removed;
	        }
	        else if (range === 0 && this.children.length === 0)
	        {
	            return [];
	        }

	        throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
	    };

	    /**
	     * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.
	     */
	    Container.prototype.sortChildren = function sortChildren$1 ()
	    {
	        var sortRequired = false;

	        for (var i = 0, j = this.children.length; i < j; ++i)
	        {
	            var child = this.children[i];

	            child._lastSortedIndex = i;

	            if (!sortRequired && child.zIndex !== 0)
	            {
	                sortRequired = true;
	            }
	        }

	        if (sortRequired && this.children.length > 1)
	        {
	            this.children.sort(sortChildren);
	        }

	        this.sortDirty = false;
	    };

	    /**
	     * Updates the transform on all children of this container for rendering
	     */
	    Container.prototype.updateTransform = function updateTransform ()
	    {
	        if (this.sortableChildren && this.sortDirty)
	        {
	            this.sortChildren();
	        }

	        this._boundsID++;

	        this.transform.updateTransform(this.parent.transform);

	        // TODO: check render flags, how to process stuff here
	        this.worldAlpha = this.alpha * this.parent.worldAlpha;

	        for (var i = 0, j = this.children.length; i < j; ++i)
	        {
	            var child = this.children[i];

	            if (child.visible)
	            {
	                child.updateTransform();
	            }
	        }
	    };

	    /**
	     * Recalculates the bounds of the container.
	     *
	     */
	    Container.prototype.calculateBounds = function calculateBounds ()
	    {
	        this._bounds.clear();

	        this._calculateBounds();

	        for (var i = 0; i < this.children.length; i++)
	        {
	            var child = this.children[i];

	            if (!child.visible || !child.renderable)
	            {
	                continue;
	            }

	            child.calculateBounds();

	            // TODO: filter+mask, need to mask both somehow
	            if (child._mask)
	            {
	                child._mask.calculateBounds();
	                this._bounds.addBoundsMask(child._bounds, child._mask._bounds);
	            }
	            else if (child.filterArea)
	            {
	                this._bounds.addBoundsArea(child._bounds, child.filterArea);
	            }
	            else
	            {
	                this._bounds.addBounds(child._bounds);
	            }
	        }

	        this._lastBoundsID = this._boundsID;
	    };

	    /**
	     * Recalculates the bounds of the object. Override this to
	     * calculate the bounds of the specific object (not including children).
	     *
	     * @protected
	     */
	    Container.prototype._calculateBounds = function _calculateBounds ()
	    {
	        // FILL IN//
	    };

	    /**
	     * Renders the object using the WebGL renderer
	     *
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Container.prototype.render = function render (renderer)
	    {
	        // if the object is not visible or the alpha is 0 then no need to render this element
	        if (!this.visible || this.worldAlpha <= 0 || !this.renderable)
	        {
	            return;
	        }

	        // do a quick check to see if this element has a mask or a filter.
	        if (this._mask || (this.filters && this.filters.length))
	        {
	            this.renderAdvanced(renderer);
	        }
	        else
	        {
	            this._render(renderer);

	            // simple render children!
	            for (var i = 0, j = this.children.length; i < j; ++i)
	            {
	                this.children[i].render(renderer);
	            }
	        }
	    };

	    /**
	     * Render the object using the WebGL renderer and advanced features.
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Container.prototype.renderAdvanced = function renderAdvanced (renderer)
	    {
	        renderer.batch.flush();

	        var filters = this.filters;
	        var mask = this._mask;

	        // push filter first as we need to ensure the stencil buffer is correct for any masking
	        if (filters)
	        {
	            if (!this._enabledFilters)
	            {
	                this._enabledFilters = [];
	            }

	            this._enabledFilters.length = 0;

	            for (var i = 0; i < filters.length; i++)
	            {
	                if (filters[i].enabled)
	                {
	                    this._enabledFilters.push(filters[i]);
	                }
	            }

	            if (this._enabledFilters.length)
	            {
	                renderer.filter.push(this, this._enabledFilters);
	            }
	        }

	        if (mask)
	        {
	            renderer.mask.push(this, this._mask);
	        }

	        // add this object to the batch, only rendered if it has a texture.
	        this._render(renderer);

	        // now loop through the children and make sure they get rendered
	        for (var i$1 = 0, j = this.children.length; i$1 < j; i$1++)
	        {
	            this.children[i$1].render(renderer);
	        }

	        renderer.batch.flush();

	        if (mask)
	        {
	            renderer.mask.pop(this, this._mask);
	        }

	        if (filters && this._enabledFilters && this._enabledFilters.length)
	        {
	            renderer.filter.pop();
	        }
	    };

	    /**
	     * To be overridden by the subclasses.
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Container.prototype._render = function _render (renderer) // eslint-disable-line no-unused-vars
	    {
	        // this is where content itself gets rendered...
	    };

	    /**
	     * Removes all internal references and listeners as well as removes children from the display list.
	     * Do not use a Container after calling `destroy`.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
	     *  method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the texture of the child sprite
	     * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the base texture of the child sprite
	     */
	    Container.prototype.destroy = function destroy (options)
	    {
	        DisplayObject.prototype.destroy.call(this);

	        this.sortDirty = false;

	        var destroyChildren = typeof options === 'boolean' ? options : options && options.children;

	        var oldChildren = this.removeChildren(0, this.children.length);

	        if (destroyChildren)
	        {
	            for (var i = 0; i < oldChildren.length; ++i)
	            {
	                oldChildren[i].destroy(options);
	            }
	        }
	    };

	    /**
	     * The width of the Container, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return this.scale.x * this.getLocalBounds().width;
	    };

	    prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        var width = this.getLocalBounds().width;

	        if (width !== 0)
	        {
	            this.scale.x = value / width;
	        }
	        else
	        {
	            this.scale.x = 1;
	        }

	        this._width = value;
	    };

	    /**
	     * The height of the Container, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return this.scale.y * this.getLocalBounds().height;
	    };

	    prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        var height = this.getLocalBounds().height;

	        if (height !== 0)
	        {
	            this.scale.y = value / height;
	        }
	        else
	        {
	            this.scale.y = 1;
	        }

	        this._height = value;
	    };

	    Object.defineProperties( Container.prototype, prototypeAccessors );

	    return Container;
	}(DisplayObject));

	// performance increase to avoid using call.. (10x faster)
	Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;

	/*!
	 * @pixi/accessibility - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/accessibility is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Default property values of accessible objects
	 * used by {@link PIXI.accessibility.AccessibilityManager}.
	 *
	 * @private
	 * @function accessibleTarget
	 * @memberof PIXI.accessibility
	 * @type {Object}
	 * @example
	 *      function MyObject() {}
	 *
	 *      Object.assign(
	 *          MyObject.prototype,
	 *          PIXI.accessibility.accessibleTarget
	 *      );
	 */
	var accessibleTarget = {
	    /**
	     *  Flag for if the object is accessible. If true AccessibilityManager will overlay a
	     *   shadow div with attributes set
	     *
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     */
	    accessible: false,

	    /**
	     * Sets the title attribute of the shadow div
	     * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
	     *
	     * @member {?string}
	     * @memberof PIXI.DisplayObject#
	     */
	    accessibleTitle: null,

	    /**
	     * Sets the aria-label attribute of the shadow div
	     *
	     * @member {string}
	     * @memberof PIXI.DisplayObject#
	     */
	    accessibleHint: null,

	    /**
	     * @member {number}
	     * @memberof PIXI.DisplayObject#
	     * @private
	     * @todo Needs docs.
	     */
	    tabIndex: 0,

	    /**
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     * @todo Needs docs.
	     */
	    _accessibleActive: false,

	    /**
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     * @todo Needs docs.
	     */
	    _accessibleDiv: false,
	};

	// add some extra variables to the container..
	DisplayObject.mixin(accessibleTarget);

	var KEY_CODE_TAB = 9;

	var DIV_TOUCH_SIZE = 100;
	var DIV_TOUCH_POS_X = 0;
	var DIV_TOUCH_POS_Y = 0;
	var DIV_TOUCH_ZINDEX = 2;

	var DIV_HOOK_SIZE = 1;
	var DIV_HOOK_POS_X = -1000;
	var DIV_HOOK_POS_Y = -1000;
	var DIV_HOOK_ZINDEX = 2;

	/**
	 * The Accessibility manager recreates the ability to tab and have content read by screen readers.
	 * This is very important as it can possibly help people with disabilities access PixiJS content.
	 *
	 * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the
	 * events as if the mouse was being used, minimizing the effort required to implement.
	 *
	 * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`
	 *
	 * @class
	 * @memberof PIXI.accessibility
	 */
	var AccessibilityManager = function AccessibilityManager(renderer)
	{
	    /**
	     * @type {?HTMLElement}
	     * @private
	     */
	    this._hookDiv = null;
	    if (isMobile_min.tablet || isMobile_min.phone)
	    {
	        this.createTouchHook();
	    }

	    // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.
	    var div = document.createElement('div');

	    div.style.width = DIV_TOUCH_SIZE + "px";
	    div.style.height = DIV_TOUCH_SIZE + "px";
	    div.style.position = 'absolute';
	    div.style.top = DIV_TOUCH_POS_X + "px";
	    div.style.left = DIV_TOUCH_POS_Y + "px";
	    div.style.zIndex = DIV_TOUCH_ZINDEX;

	    /**
	     * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.
	     *
	     * @type {HTMLElement}
	     * @private
	     */
	    this.div = div;

	    /**
	     * A simple pool for storing divs.
	     *
	     * @type {*}
	     * @private
	     */
	    this.pool = [];

	    /**
	     * This is a tick used to check if an object is no longer being rendered.
	     *
	     * @type {Number}
	     * @private
	     */
	    this.renderId = 0;

	    /**
	     * Setting this to true will visually show the divs.
	     *
	     * @type {boolean}
	     */
	    this.debug = false;

	    /**
	     * The renderer this accessibility manager works for.
	     *
	     * @member {PIXI.AbstractRenderer}
	     */
	    this.renderer = renderer;

	    /**
	     * The array of currently active accessible items.
	     *
	     * @member {Array<*>}
	     * @private
	     */
	    this.children = [];

	    /**
	     * pre-bind the functions
	     *
	     * @type {Function}
	     * @private
	     */
	    this._onKeyDown = this._onKeyDown.bind(this);

	    /**
	     * pre-bind the functions
	     *
	     * @type {Function}
	     * @private
	     */
	    this._onMouseMove = this._onMouseMove.bind(this);

	    /**
	     * A flag
	     * @type {boolean}
	     * @readonly
	     */
	    this.isActive = false;

	    /**
	     * A flag
	     * @type {boolean}
	     * @readonly
	     */
	    this.isMobileAccessibility = false;

	    // let listen for tab.. once pressed we can fire up and show the accessibility layer
	    window.addEventListener('keydown', this._onKeyDown, false);
	};

	/**
	 * Creates the touch hooks.
	 *
	 * @private
	 */
	AccessibilityManager.prototype.createTouchHook = function createTouchHook ()
	{
	        var this$1 = this;

	    var hookDiv = document.createElement('button');

	    hookDiv.style.width = DIV_HOOK_SIZE + "px";
	    hookDiv.style.height = DIV_HOOK_SIZE + "px";
	    hookDiv.style.position = 'absolute';
	    hookDiv.style.top = DIV_HOOK_POS_X + "px";
	    hookDiv.style.left = DIV_HOOK_POS_Y + "px";
	    hookDiv.style.zIndex = DIV_HOOK_ZINDEX;
	    hookDiv.style.backgroundColor = '#FF0000';
	    hookDiv.title = 'HOOK DIV';

	    hookDiv.addEventListener('focus', function () {
	        this$1.isMobileAccessibility = true;
	        this$1.activate();
	        this$1.destroyTouchHook();
	    });

	    document.body.appendChild(hookDiv);
	    this._hookDiv = hookDiv;
	};

	/**
	 * Destroys the touch hooks.
	 *
	 * @private
	 */
	AccessibilityManager.prototype.destroyTouchHook = function destroyTouchHook ()
	{
	    if (!this._hookDiv)
	    {
	        return;
	    }
	    document.body.removeChild(this._hookDiv);
	    this._hookDiv = null;
	};

	/**
	 * Activating will cause the Accessibility layer to be shown.
	 * This is called when a user presses the tab key.
	 *
	 * @private
	 */
	AccessibilityManager.prototype.activate = function activate ()
	{
	    if (this.isActive)
	    {
	        return;
	    }

	    this.isActive = true;

	    window.document.addEventListener('mousemove', this._onMouseMove, true);
	    window.removeEventListener('keydown', this._onKeyDown, false);

	    this.renderer.on('postrender', this.update, this);

	    if (this.renderer.view.parentNode)
	    {
	        this.renderer.view.parentNode.appendChild(this.div);
	    }
	};

	/**
	 * Deactivating will cause the Accessibility layer to be hidden.
	 * This is called when a user moves the mouse.
	 *
	 * @private
	 */
	AccessibilityManager.prototype.deactivate = function deactivate ()
	{
	    if (!this.isActive || this.isMobileAccessibility)
	    {
	        return;
	    }

	    this.isActive = false;

	    window.document.removeEventListener('mousemove', this._onMouseMove, true);
	    window.addEventListener('keydown', this._onKeyDown, false);

	    this.renderer.off('postrender', this.update);

	    if (this.div.parentNode)
	    {
	        this.div.parentNode.removeChild(this.div);
	    }
	};

	/**
	 * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
	 *
	 * @private
	 * @param {PIXI.Container} displayObject - The DisplayObject to check.
	 */
	AccessibilityManager.prototype.updateAccessibleObjects = function updateAccessibleObjects (displayObject)
	{
	    if (!displayObject.visible)
	    {
	        return;
	    }

	    if (displayObject.accessible && displayObject.interactive)
	    {
	        if (!displayObject._accessibleActive)
	        {
	            this.addChild(displayObject);
	        }

	        displayObject.renderId = this.renderId;
	    }

	    var children = displayObject.children;

	    for (var i = 0; i < children.length; i++)
	    {
	        this.updateAccessibleObjects(children[i]);
	    }
	};

	/**
	 * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.
	 *
	 * @private
	 */
	AccessibilityManager.prototype.update = function update ()
	{
	    if (!this.renderer.renderingToScreen)
	    {
	        return;
	    }

	    // update children...
	    this.updateAccessibleObjects(this.renderer._lastObjectRendered);

	    var rect = this.renderer.view.getBoundingClientRect();
	    var sx = rect.width / this.renderer.width;
	    var sy = rect.height / this.renderer.height;

	    var div = this.div;

	    div.style.left = (rect.left) + "px";
	    div.style.top = (rect.top) + "px";
	    div.style.width = (this.renderer.width) + "px";
	    div.style.height = (this.renderer.height) + "px";

	    for (var i = 0; i < this.children.length; i++)
	    {
	        var child = this.children[i];

	        if (child.renderId !== this.renderId)
	        {
	            child._accessibleActive = false;

	            removeItems(this.children, i, 1);
	            this.div.removeChild(child._accessibleDiv);
	            this.pool.push(child._accessibleDiv);
	            child._accessibleDiv = null;

	            i--;

	            if (this.children.length === 0)
	            {
	                this.deactivate();
	            }
	        }
	        else
	        {
	            // map div to display..
	            div = child._accessibleDiv;
	            var hitArea = child.hitArea;
	            var wt = child.worldTransform;

	            if (child.hitArea)
	            {
	                div.style.left = ((wt.tx + (hitArea.x * wt.a)) * sx) + "px";
	                div.style.top = ((wt.ty + (hitArea.y * wt.d)) * sy) + "px";

	                div.style.width = (hitArea.width * wt.a * sx) + "px";
	                div.style.height = (hitArea.height * wt.d * sy) + "px";
	            }
	            else
	            {
	                hitArea = child.getBounds();

	                this.capHitArea(hitArea);

	                div.style.left = (hitArea.x * sx) + "px";
	                div.style.top = (hitArea.y * sy) + "px";

	                div.style.width = (hitArea.width * sx) + "px";
	                div.style.height = (hitArea.height * sy) + "px";

	                // update button titles and hints if they exist and they've changed
	                if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)
	                {
	                    div.title = child.accessibleTitle;
	                }
	                if (div.getAttribute('aria-label') !== child.accessibleHint
	                    && child.accessibleHint !== null)
	                {
	                    div.setAttribute('aria-label', child.accessibleHint);
	                }
	            }
	        }
	    }

	    // increment the render id..
	    this.renderId++;
	};

	/**
	 * Adjust the hit area based on the bounds of a display object
	 *
	 * @param {PIXI.Rectangle} hitArea - Bounds of the child
	 */
	AccessibilityManager.prototype.capHitArea = function capHitArea (hitArea)
	{
	    if (hitArea.x < 0)
	    {
	        hitArea.width += hitArea.x;
	        hitArea.x = 0;
	    }

	    if (hitArea.y < 0)
	    {
	        hitArea.height += hitArea.y;
	        hitArea.y = 0;
	    }

	    if (hitArea.x + hitArea.width > this.renderer.width)
	    {
	        hitArea.width = this.renderer.width - hitArea.x;
	    }

	    if (hitArea.y + hitArea.height > this.renderer.height)
	    {
	        hitArea.height = this.renderer.height - hitArea.y;
	    }
	};

	/**
	 * Adds a DisplayObject to the accessibility manager
	 *
	 * @private
	 * @param {PIXI.DisplayObject} displayObject - The child to make accessible.
	 */
	AccessibilityManager.prototype.addChild = function addChild (displayObject)
	{
	    //this.activate();

	    var div = this.pool.pop();

	    if (!div)
	    {
	        div = document.createElement('button');

	        div.style.width = DIV_TOUCH_SIZE + "px";
	        div.style.height = DIV_TOUCH_SIZE + "px";
	        div.style.backgroundColor = this.debug ? 'rgba(255,0,0,0.5)' : 'transparent';
	        div.style.position = 'absolute';
	        div.style.zIndex = DIV_TOUCH_ZINDEX;
	        div.style.borderStyle = 'none';

	        // ARIA attributes ensure that button title and hint updates are announced properly
	        if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
	        {
	            // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.
	            div.setAttribute('aria-live', 'off');
	        }
	        else
	        {
	            div.setAttribute('aria-live', 'polite');
	        }

	        if (navigator.userAgent.match(/rv:.*Gecko\//))
	        {
	            // FireFox needs this to announce only the new button name
	            div.setAttribute('aria-relevant', 'additions');
	        }
	        else
	        {
	            // required by IE, other browsers don't much care
	            div.setAttribute('aria-relevant', 'text');
	        }

	        div.addEventListener('click', this._onClick.bind(this));
	        div.addEventListener('focus', this._onFocus.bind(this));
	        div.addEventListener('focusout', this._onFocusOut.bind(this));
	    }

	    if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)
	    {
	        div.title = displayObject.accessibleTitle;
	    }
	    else if (!displayObject.accessibleHint
	             || displayObject.accessibleHint === null)
	    {
	        div.title = "displayObject " + (displayObject.tabIndex);
	    }

	    if (displayObject.accessibleHint
	        && displayObject.accessibleHint !== null)
	    {
	        div.setAttribute('aria-label', displayObject.accessibleHint);
	    }

	    //

	    displayObject._accessibleActive = true;
	    displayObject._accessibleDiv = div;
	    div.displayObject = displayObject;

	    this.children.push(displayObject);
	    this.div.appendChild(displayObject._accessibleDiv);
	    displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;
	};

	/**
	 * Maps the div button press to pixi's InteractionManager (click)
	 *
	 * @private
	 * @param {MouseEvent} e - The click event.
	 */
	AccessibilityManager.prototype._onClick = function _onClick (e)
	{
	    var interactionManager = this.renderer.plugins.interaction;

	    interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
	    interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
	    interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
	};

	/**
	 * Maps the div focus events to pixi's InteractionManager (mouseover)
	 *
	 * @private
	 * @param {FocusEvent} e - The focus event.
	 */
	AccessibilityManager.prototype._onFocus = function _onFocus (e)
	{
	    if (!e.target.getAttribute('aria-live', 'off'))
	    {
	        e.target.setAttribute('aria-live', 'assertive');
	    }
	    var interactionManager = this.renderer.plugins.interaction;

	    interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);
	};

	/**
	 * Maps the div focus events to pixi's InteractionManager (mouseout)
	 *
	 * @private
	 * @param {FocusEvent} e - The focusout event.
	 */
	AccessibilityManager.prototype._onFocusOut = function _onFocusOut (e)
	{
	    if (!e.target.getAttribute('aria-live', 'off'))
	    {
	        e.target.setAttribute('aria-live', 'polite');
	    }
	    var interactionManager = this.renderer.plugins.interaction;

	    interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);
	};

	/**
	 * Is called when a key is pressed
	 *
	 * @private
	 * @param {KeyboardEvent} e - The keydown event.
	 */
	AccessibilityManager.prototype._onKeyDown = function _onKeyDown (e)
	{
	    if (e.keyCode !== KEY_CODE_TAB)
	    {
	        return;
	    }

	    this.activate();
	};

	/**
	 * Is called when the mouse moves across the renderer element
	 *
	 * @private
	 * @param {MouseEvent} e - The mouse event.
	 */
	AccessibilityManager.prototype._onMouseMove = function _onMouseMove (e)
	{
	    if (e.movementX === 0 && e.movementY === 0)
	    {
	        return;
	    }

	    this.deactivate();
	};

	/**
	 * Destroys the accessibility manager
	 *
	 */
	AccessibilityManager.prototype.destroy = function destroy ()
	{
	    this.destroyTouchHook();
	    this.div = null;

	    for (var i = 0; i < this.children.length; i++)
	    {
	        this.children[i].div = null;
	    }

	    window.document.removeEventListener('mousemove', this._onMouseMove, true);
	    window.removeEventListener('keydown', this._onKeyDown);

	    this.pool = null;
	    this.children = null;
	    this.renderer = null;
	};

	var accessibility_es = ({
		AccessibilityManager: AccessibilityManager,
		accessibleTarget: accessibleTarget
	});

	/*!
	 * @pixi/runner - v5.1.1
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/runner is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */
	/**
	 * A Runner is a highly performant and simple alternative to signals. Best used in situations
	 * where events are dispatched to many objects at high frequency (say every frame!)
	 *
	 *
	 * like a signal..
	 * ```
	 * const myObject = {
	 *     loaded: new PIXI.Runner('loaded')
	 * }
	 *
	 * const listener = {
	 *     loaded: function(){
	 *         // thin
	 *     }
	 * }
	 *
	 * myObject.update.add(listener);
	 *
	 * myObject.loaded.emit();
	 * ```
	 *
	 * Or for handling calling the same function on many items
	 * ```
	 * const myGame = {
	 *     update: new PIXI.Runner('update')
	 * }
	 *
	 * const gameObject = {
	 *     update: function(time){
	 *         // update my gamey state
	 *     }
	 * }
	 *
	 * myGame.update.add(gameObject1);
	 *
	 * myGame.update.emit(time);
	 * ```
	 * @class
	 * @memberof PIXI
	 */
	var Runner = function Runner(name)
	{
	    this.items = [];
	    this._name = name;
	    this._aliasCount = 0;
	};

	var prototypeAccessors$3 = { empty: { configurable: true },name: { configurable: true } };

	/**
	 * Dispatch/Broadcast Runner to all listeners added to the queue.
	 * @param {...any} params - optional parameters to pass to each listener
	 */
	Runner.prototype.emit = function emit (a0, a1, a2, a3, a4, a5, a6, a7)
	{
	    if (arguments.length > 8)
	    {
	        throw new Error('max arguments reached');
	    }

	    var ref = this;
	        var name = ref.name;
	        var items = ref.items;

	    this._aliasCount++;

	    for (var i = 0, len = items.length; i < len; i++)
	    {
	        items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);
	    }

	    if (items === this.items)
	    {
	        this._aliasCount--;
	    }

	    return this;
	};

	Runner.prototype.ensureNonAliasedItems = function ensureNonAliasedItems ()
	{
	    if (this._aliasCount > 0 && this.items.length > 1)
	    {
	        this._aliasCount = 0;
	        this.items = this.items.slice(0);
	    }
	};

	/**
	 * Add a listener to the Runner
	 *
	 * Runners do not need to have scope or functions passed to them.
	 * All that is required is to pass the listening object and ensure that it has contains a function that has the same name
	 * as the name provided to the Runner when it was created.
	 *
	 * Eg A listener passed to this Runner will require a 'complete' function.
	 *
	 * ```
	 * const complete = new PIXI.Runner('complete');
	 * ```
	 *
	 * The scope used will be the object itself.
	 *
	 * @param {any} item - The object that will be listening.
	 */
	Runner.prototype.add = function add (item)
	{
	    if (item[this._name])
	    {
	        this.ensureNonAliasedItems();
	        this.remove(item);
	        this.items.push(item);
	    }

	    return this;
	};

	/**
	 * Remove a single listener from the dispatch queue.
	 * @param {any} item - The listenr that you would like to remove.
	 */
	Runner.prototype.remove = function remove (item)
	{
	    var index = this.items.indexOf(item);

	    if (index !== -1)
	    {
	        this.ensureNonAliasedItems();
	        this.items.splice(index, 1);
	    }

	    return this;
	};

	/**
	 * Check to see if the listener is already in the Runner
	 * @param {any} item - The listener that you would like to check.
	 */
	Runner.prototype.contains = function contains (item)
	{
	    return this.items.indexOf(item) !== -1;
	};

	/**
	 * Remove all listeners from the Runner
	 */
	Runner.prototype.removeAll = function removeAll ()
	{
	    this.ensureNonAliasedItems();
	    this.items.length = 0;

	    return this;
	};

	/**
	 * Remove all references, don't use after this.
	 */
	Runner.prototype.destroy = function destroy ()
	{
	    this.removeAll();
	    this.items = null;
	    this._name = null;
	};

	/**
	 * `true` if there are no this Runner contains no listeners
	 *
	 * @member {boolean}
	 * @readonly
	 */
	prototypeAccessors$3.empty.get = function ()
	{
	    return this.items.length === 0;
	};

	/**
	 * The name of the runner.
	 *
	 * @member {string}
	 * @readonly
	 */
	prototypeAccessors$3.name.get = function ()
	{
	    return this._name;
	};

	Object.defineProperties( Runner.prototype, prototypeAccessors$3 );

	/**
	 * Alias for `emit`
	 * @memberof PIXI.Runner#
	 * @method dispatch
	 * @see PIXI.Runner#emit
	 */
	Runner.prototype.dispatch = Runner.prototype.emit;

	/**
	 * Alias for `emit`
	 * @memberof PIXI.Runner#
	 * @method run
	 * @see PIXI.Runner#emit
	 */
	Runner.prototype.run = Runner.prototype.emit;

	/*!
	 * @pixi/ticker - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/ticker is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Target frames per millisecond.
	 *
	 * @static
	 * @name TARGET_FPMS
	 * @memberof PIXI.settings
	 * @type {number}
	 * @default 0.06
	 */
	settings.TARGET_FPMS = 0.06;

	/**
	 * Represents the update priorities used by internal PIXI classes when registered with
	 * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower
	 * priority items, such as render, should go later.
	 *
	 * @static
	 * @constant
	 * @name UPDATE_PRIORITY
	 * @memberof PIXI
	 * @type {object}
	 * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.interaction.InteractionManager}
	 * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}
	 * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.
	 * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.
	 * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.prepare.BasePrepare} utility.
	 */
	var UPDATE_PRIORITY = {
	    INTERACTION: 50,
	    HIGH: 25,
	    NORMAL: 0,
	    LOW: -25,
	    UTILITY: -50,
	};

	/**
	 * Internal class for handling the priority sorting of ticker handlers.
	 *
	 * @private
	 * @class
	 * @memberof PIXI
	 */
	var TickerListener = function TickerListener(fn, context, priority, once)
	{
	    if ( context === void 0 ) { context = null; }
	    if ( priority === void 0 ) { priority = 0; }
	    if ( once === void 0 ) { once = false; }

	    /**
	     * The handler function to execute.
	     * @private
	     * @member {Function}
	     */
	    this.fn = fn;

	    /**
	     * The calling to execute.
	     * @private
	     * @member {*}
	     */
	    this.context = context;

	    /**
	     * The current priority.
	     * @private
	     * @member {number}
	     */
	    this.priority = priority;

	    /**
	     * If this should only execute once.
	     * @private
	     * @member {boolean}
	     */
	    this.once = once;

	    /**
	     * The next item in chain.
	     * @private
	     * @member {TickerListener}
	     */
	    this.next = null;

	    /**
	     * The previous item in chain.
	     * @private
	     * @member {TickerListener}
	     */
	    this.previous = null;

	    /**
	     * `true` if this listener has been destroyed already.
	     * @member {boolean}
	     * @private
	     */
	    this._destroyed = false;
	};

	/**
	 * Simple compare function to figure out if a function and context match.
	 * @private
	 * @param {Function} fn - The listener function to be added for one update
	 * @param {Function} context - The listener context
	 * @return {boolean} `true` if the listener match the arguments
	 */
	TickerListener.prototype.match = function match (fn, context)
	{
	    context = context || null;

	    return this.fn === fn && this.context === context;
	};

	/**
	 * Emit by calling the current function.
	 * @private
	 * @param {number} deltaTime - time since the last emit.
	 * @return {TickerListener} Next ticker
	 */
	TickerListener.prototype.emit = function emit (deltaTime)
	{
	    if (this.fn)
	    {
	        if (this.context)
	        {
	            this.fn.call(this.context, deltaTime);
	        }
	        else
	        {
	            this.fn(deltaTime);
	        }
	    }

	    var redirect = this.next;

	    if (this.once)
	    {
	        this.destroy(true);
	    }

	    // Soft-destroying should remove
	    // the next reference
	    if (this._destroyed)
	    {
	        this.next = null;
	    }

	    return redirect;
	};

	/**
	 * Connect to the list.
	 * @private
	 * @param {TickerListener} previous - Input node, previous listener
	 */
	TickerListener.prototype.connect = function connect (previous)
	{
	    this.previous = previous;
	    if (previous.next)
	    {
	        previous.next.previous = this;
	    }
	    this.next = previous.next;
	    previous.next = this;
	};

	/**
	 * Destroy and don't use after this.
	 * @private
	 * @param {boolean} [hard = false] `true` to remove the `next` reference, this
	 *    is considered a hard destroy. Soft destroy maintains the next reference.
	 * @return {TickerListener} The listener to redirect while emitting or removing.
	 */
	TickerListener.prototype.destroy = function destroy (hard)
	{
	        if ( hard === void 0 ) { hard = false; }

	    this._destroyed = true;
	    this.fn = null;
	    this.context = null;

	    // Disconnect, hook up next and previous
	    if (this.previous)
	    {
	        this.previous.next = this.next;
	    }

	    if (this.next)
	    {
	        this.next.previous = this.previous;
	    }

	    // Redirect to the next item
	    var redirect = this.next;

	    // Remove references
	    this.next = hard ? null : redirect;
	    this.previous = null;

	    return redirect;
	};

	/**
	 * A Ticker class that runs an update loop that other objects listen to.
	 *
	 * This class is composed around 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
	 */
	var Ticker = function Ticker()
	{
	    var this$1 = this;

	    /**
	     * The first listener. All new listeners added are chained on this.
	     * @private
	     * @type {TickerListener}
	     */
	    this._head = new TickerListener(null, null, Infinity);

	    /**
	     * Internal current frame request ID
	     * @type {?number}
	     * @private
	     */
	    this._requestId = null;

	    /**
	     * Internal value managed by minFPS property setter and getter.
	     * This is the maximum allowed milliseconds between updates.
	     * @type {number}
	     * @private
	     */
	    this._maxElapsedMS = 100;

	    /**
	     * Internal value managed by maxFPS property setter and getter.
	     * This is the minimum allowed milliseconds between updates.
	     * @private
	     */
	    this._minElapsedMS = 0;

	    /**
	     * Whether or not this ticker should invoke the method
	     * {@link PIXI.Ticker#start} automatically
	     * when a listener is added.
	     *
	     * @member {boolean}
	     * @default false
	     */
	    this.autoStart = false;

	    /**
	     * Scalar time value from last frame to this frame.
	     * This value is capped by setting {@link PIXI.Ticker#minFPS}
	     * and is scaled with {@link PIXI.Ticker#speed}.
	     * **Note:** The cap may be exceeded by scaling.
	     *
	     * @member {number}
	     * @default 1
	     */
	    this.deltaTime = 1;

	    /**
	     * Scaler time elapsed in milliseconds from last frame to this frame.
	     * This value is capped by setting {@link PIXI.Ticker#minFPS}
	     * and is scaled with {@link PIXI.Ticker#speed}.
	     * **Note:** The cap may be exceeded by scaling.
	     * If the platform supports DOMHighResTimeStamp,
	     * this value will have a precision of 1 µs.
	     * Defaults to target frame time
	     *
	     * @member {number}
	     * @default 16.66
	     */
	    this.deltaMS = 1 / settings.TARGET_FPMS;

	    /**
	     * Time elapsed in milliseconds from last frame to this frame.
	     * Opposed to what the scalar {@link PIXI.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.
	     * Defaults to target frame time
	     *
	     * @member {number}
	     * @default 16.66
	     */
	    this.elapsedMS = 1 / settings.TARGET_FPMS;

	    /**
	     * The last time {@link PIXI.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 {number}
	     * @default -1
	     */
	    this.lastTime = -1;

	    /**
	     * Factor of current {@link PIXI.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;

	    /**
	     * Whether or not this ticker has been started.
	     * `true` if {@link PIXI.Ticker#start} has been called.
	     * `false` if {@link PIXI.Ticker#stop} has been called.
	     * While `false`, this value may change to `true` in the
	     * event of {@link PIXI.Ticker#autoStart} being `true`
	     * and a listener is added.
	     *
	     * @member {boolean}
	     * @default false
	     */
	    this.started = false;

	    /**
	     * If enabled, deleting is disabled.
	     * @member {boolean}
	     * @default false
	     * @private
	     */
	    this._protected = false;

	    /**
	     * The last time keyframe was executed.
	     * Maintains a relatively fixed interval with the previous value.
	     * @member {number}
	     * @default -1
	     * @private
	     */
	    this._lastFrame = -1;

	    /**
	     * 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
	     * @param {number} time - Time since last tick.
	     */
	    this._tick = function (time) {
	        this$1._requestId = null;

	        if (this$1.started)
	        {
	            // Invoke listeners now
	            this$1.update(time);
	            // Listener side effects may have modified ticker state.
	            if (this$1.started && this$1._requestId === null && this$1._head.next)
	            {
	                this$1._requestId = requestAnimationFrame(this$1._tick);
	            }
	        }
	    };
	};

	var prototypeAccessors$4 = { FPS: { configurable: true },minFPS: { configurable: true },maxFPS: { configurable: true } };
	var staticAccessors$2 = { shared: { configurable: true },system: { configurable: true } };

	/**
	 * 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._head.next)
	    {
	        // ensure callbacks get correct delta
	        this.lastTime = performance.now();
	        this._lastFrame = this.lastTime;
	        this._requestId = requestAnimationFrame(this._tick);
	    }
	};

	/**
	 * Conditionally cancels a pending animation frame.
	 *
	 * @private
	 */
	Ticker.prototype._cancelIfNeeded = function _cancelIfNeeded ()
	{
	    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.
	 *
	 * @private
	 */
	Ticker.prototype._startIfPossible = function _startIfPossible ()
	{
	    if (this.started)
	    {
	        this._requestIfNeeded();
	    }
	    else if (this.autoStart)
	    {
	        this.start();
	    }
	};

	/**
	 * Register a handler for tick events. Calls continuously unless
	 * it is removed or the ticker is stopped.
	 *
	 * @param {Function} fn - The listener function to be added for updates
	 * @param {*} [context] - The listener context
	 * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting
	 * @returns {PIXI.Ticker} This instance of a ticker
	 */
	Ticker.prototype.add = function add (fn, context, priority)
	{
	        if ( priority === void 0 ) { priority = UPDATE_PRIORITY.NORMAL; }

	    return this._addListener(new TickerListener(fn, context, priority));
	};

	/**
	 * Add a handler for the tick event which is only execute once.
	 *
	 * @param {Function} fn - The listener function to be added for one update
	 * @param {*} [context] - The listener context
	 * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting
	 * @returns {PIXI.Ticker} This instance of a ticker
	 */
	Ticker.prototype.addOnce = function addOnce (fn, context, priority)
	{
	        if ( priority === void 0 ) { priority = UPDATE_PRIORITY.NORMAL; }

	    return this._addListener(new TickerListener(fn, context, priority, true));
	};

	/**
	 * Internally adds the event handler so that it can be sorted by priority.
	 * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run
	 * before the rendering.
	 *
	 * @private
	 * @param {TickerListener} listener - Current listener being added.
	 * @returns {PIXI.Ticker} This instance of a ticker
	 */
	Ticker.prototype._addListener = function _addListener (listener)
	{
	    // For attaching to head
	    var current = this._head.next;
	    var previous = this._head;

	    // Add the first item
	    if (!current)
	    {
	        listener.connect(previous);
	    }
	    else
	    {
	        // Go from highest to lowest priority
	        while (current)
	        {
	            if (listener.priority > current.priority)
	            {
	                listener.connect(previous);
	                break;
	            }
	            previous = current;
	            current = current.next;
	        }

	        // Not yet connected
	        if (!listener.previous)
	        {
	            listener.connect(previous);
	        }
	    }

	    this._startIfPossible();

	    return this;
	};

	/**
	 * Removes any handlers matching the function and context parameters.
	 * If no handlers are left after removing, then it cancels the animation frame.
	 *
	 * @param {Function} fn - The listener function to be removed
	 * @param {*} [context] - The listener context to be removed
	 * @returns {PIXI.Ticker} This instance of a ticker
	 */
	Ticker.prototype.remove = function remove (fn, context)
	{
	    var listener = this._head.next;

	    while (listener)
	    {
	        // We found a match, lets remove it
	        // no break to delete all possible matches
	        // incase a listener was added 2+ times
	        if (listener.match(fn, context))
	        {
	            listener = listener.destroy();
	        }
	        else
	        {
	            listener = listener.next;
	        }
	    }

	    if (!this._head.next)
	    {
	        this._cancelIfNeeded();
	    }

	    return this;
	};

	/**
	 * Starts the ticker. If the ticker has listeners
	 * a new animation frame is requested at this point.
	 */
	Ticker.prototype.start = function start ()
	{
	    if (!this.started)
	    {
	        this.started = true;
	        this._requestIfNeeded();
	    }
	};

	/**
	 * Stops the ticker. If the ticker has requested
	 * an animation frame it is canceled at this point.
	 */
	Ticker.prototype.stop = function stop ()
	{
	    if (this.started)
	    {
	        this.started = false;
	        this._cancelIfNeeded();
	    }
	};

	/**
	 * Destroy the ticker and don't use after this. Calling
	 * this method removes all references to internal events.
	 */
	Ticker.prototype.destroy = function destroy ()
	{
	    if (!this._protected)
	    {
	        this.stop();

	        var listener = this._head.next;

	        while (listener)
	        {
	            listener = listener.destroy(true);
	        }

	        this._head.destroy();
	        this._head = null;
	    }
	};

	/**
	 * Triggers an update. An update entails setting the
	 * current {@link PIXI.Ticker#elapsedMS},
	 * the current {@link PIXI.Ticker#deltaTime},
	 * invoking all listeners with current deltaTime,
	 * and then finally setting {@link PIXI.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 {number} [currentTime=performance.now()] - the current time of execution
	 */
	Ticker.prototype.update = function update (currentTime)
	{
	        if ( currentTime === void 0 ) { currentTime = performance.now(); }

	    var elapsedMS;

	    // If the difference in time is zero or negative, we ignore most of the work done here.
	    // If there is no valid difference, then should be no reason to let anyone know about it.
	    // A zero delta, is exactly that, nothing should update.
	    //
	    // The difference in time can be negative, and no this does not mean time traveling.
	    // This can be the result of a race condition between when an animation frame is requested
	    // on the current JavaScript engine event loop, and when the ticker's start method is invoked
	    // (which invokes the internal _requestIfNeeded method). If a frame is requested before
	    // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,
	    // can receive a time argument that can be less than the lastTime value that was set within
	    // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.
	    //
	    // This check covers this browser engine timing issue, as well as if consumers pass an invalid
	    // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.

	    if (currentTime > this.lastTime)
	    {
	        // Save uncapped elapsedMS for measurement
	        elapsedMS = this.elapsedMS = currentTime - this.lastTime;

	        // cap the milliseconds elapsed used for deltaTime
	        if (elapsedMS > this._maxElapsedMS)
	        {
	            elapsedMS = this._maxElapsedMS;
	        }

	        elapsedMS *= this.speed;

	        // If not enough time has passed, exit the function.
	        // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS
	        // adjustment to ensure a relatively stable interval.
	        if (this._minElapsedMS)
	        {
	            var delta = currentTime - this._lastFrame | 0;

	            if (delta < this._minElapsedMS)
	            {
	                return;
	            }

	            this._lastFrame = currentTime - (delta % this._minElapsedMS);
	        }

	        this.deltaMS = elapsedMS;
	        this.deltaTime = this.deltaMS * settings.TARGET_FPMS;

	        // Cache a local reference, in-case ticker is destroyed
	        // during the emit, we can still check for head.next
	        var head = this._head;

	        // Invoke listeners added to internal emitter
	        var listener = head.next;

	        while (listener)
	        {
	            listener = listener.emit(this.deltaTime);
	        }

	        if (!head.next)
	        {
	            this._cancelIfNeeded();
	        }
	    }
	    else
	    {
	        this.deltaTime = this.deltaMS = this.elapsedMS = 0;
	    }

	    this.lastTime = currentTime;
	};

	/**
	 * 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#speed}, which is specific
	 * to scaling {@link PIXI.Ticker#deltaTime}.
	 *
	 * @member {number}
	 * @readonly
	 */
	prototypeAccessors$4.FPS.get = function ()
	{
	    return 1000 / this.elapsedMS;
	};

	/**
	 * Manages the maximum amount of milliseconds allowed to
	 * elapse between invoking {@link PIXI.Ticker#update}.
	 * This value is used to cap {@link PIXI.Ticker#deltaTime},
	 * but does not effect the measured value of {@link PIXI.Ticker#FPS}.
	 * When setting this property it is clamped to a value between
	 * `0` and `PIXI.settings.TARGET_FPMS * 1000`.
	 *
	 * @member {number}
	 * @default 10
	 */
	prototypeAccessors$4.minFPS.get = function ()
	{
	    return 1000 / this._maxElapsedMS;
	};

	prototypeAccessors$4.minFPS.set = function (fps) // eslint-disable-line require-jsdoc
	{
	    // Minimum must be below the maxFPS
	    var minFPS = Math.min(this.maxFPS, fps);

	    // Must be at least 0, but below 1 / settings.TARGET_FPMS
	    var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);

	    this._maxElapsedMS = 1 / minFPMS;
	};

	/**
	 * Manages the minimum amount of milliseconds required to
	 * elapse between invoking {@link PIXI.Ticker#update}.
	 * This will effect the measured value of {@link PIXI.Ticker#FPS}.
	 * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.
	 * Otherwise it will be at least `minFPS`
	 *
	 * @member {number}
	 * @default 0
	 */
	prototypeAccessors$4.maxFPS.get = function ()
	{
	    if (this._minElapsedMS)
	    {
	        return Math.round(1000 / this._minElapsedMS);
	    }

	    return 0;
	};

	prototypeAccessors$4.maxFPS.set = function (fps)
	{
	    if (fps === 0)
	    {
	        this._minElapsedMS = 0;
	    }
	    else
	    {
	        // Max must be at least the minFPS
	        var maxFPS = Math.max(this.minFPS, fps);

	        this._minElapsedMS = 1 / (maxFPS / 1000);
	    }
	};

	/**
	 * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by
	 * {@link PIXI.VideoResource} to update animation frames / video textures.
	 *
	 * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.
	 *
	 * The property {@link PIXI.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
	 * let 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...
	 * let renderer = PIXI.autoDetectRenderer();
	 * let stage = new PIXI.Container();
	 * 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());
	 *
	 * @member {PIXI.Ticker}
	 * @static
	 */
	staticAccessors$2.shared.get = function ()
	{
	    if (!Ticker._shared)
	    {
	        var shared = Ticker._shared = new Ticker();

	        shared.autoStart = true;
	        shared._protected = true;
	    }

	    return Ticker._shared;
	};

	/**
	 * The system ticker instance used by {@link PIXI.interaction.InteractionManager} and by
	 * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,
	 * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.
	 *
	 * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.
	 *
	 * @member {PIXI.Ticker}
	 * @static
	 */
	staticAccessors$2.system.get = function ()
	{
	    if (!Ticker._system)
	    {
	        var system = Ticker._system = new Ticker();

	        system.autoStart = true;
	        system._protected = true;
	    }

	    return Ticker._system;
	};

	Object.defineProperties( Ticker.prototype, prototypeAccessors$4 );
	Object.defineProperties( Ticker, staticAccessors$2 );

	/**
	 * Middleware for for Application Ticker.
	 *
	 * @example
	 * import {TickerPlugin} from '@pixi/ticker';
	 * import {Application} from '@pixi/app';
	 * Application.registerPlugin(TickerPlugin);
	 *
	 * @class
	 * @memberof PIXI
	 */
	var TickerPlugin = function TickerPlugin () {};

	TickerPlugin.init = function init (options)
	{
	        var this$1 = this;

	    // Set default
	    options = Object.assign({
	        autoStart: true,
	        sharedTicker: false,
	    }, options);

	    // Create ticker setter
	    Object.defineProperty(this, 'ticker',
	        {
	            set: function set(ticker)
	            {
	                if (this._ticker)
	                {
	                    this._ticker.remove(this.render, this);
	                }
	                this._ticker = ticker;
	                if (ticker)
	                {
	                    ticker.add(this.render, this, UPDATE_PRIORITY.LOW);
	                }
	            },
	            get: function get()
	            {
	                return this._ticker;
	            },
	        });

	    /**
	     * Convenience method for stopping the render.
	     *
	     * @method PIXI.Application#stop
	     */
	    this.stop = function () {
	        this$1._ticker.stop();
	    };

	    /**
	     * Convenience method for starting the render.
	     *
	     * @method PIXI.Application#start
	     */
	    this.start = function () {
	        this$1._ticker.start();
	    };

	    /**
	     * Internal reference to the ticker.
	     *
	     * @type {PIXI.Ticker}
	     * @name _ticker
	     * @memberof PIXI.Application#
	     * @private
	     */
	    this._ticker = null;

	    /**
	     * Ticker for doing render updates.
	     *
	     * @type {PIXI.Ticker}
	     * @name ticker
	     * @memberof PIXI.Application#
	     * @default PIXI.Ticker.shared
	     */
	    this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();

	    // Start the rendering
	    if (options.autoStart)
	    {
	        this.start();
	    }
	};

	/**
	 * Clean up the ticker, scoped to application.
	 *
	 * @static
	 * @private
	 */
	TickerPlugin.destroy = function destroy ()
	{
	    if (this._ticker)
	    {
	        var oldTicker = this._ticker;

	        this.ticker = null;
	        oldTicker.destroy();
	    }
	};

	/*!
	 * @pixi/core - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/core is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Base resource class for textures that manages validation and uploading, depending on its type.
	 *
	 * Uploading of a base texture to the GPU is required.
	 *
	 * @class
	 * @memberof PIXI.resources
	 */
	var Resource = function Resource(width, height)
	{
	    if ( width === void 0 ) { width = 0; }
	    if ( height === void 0 ) { height = 0; }

	    /**
	     * Internal width of the resource
	     * @member {number}
	     * @protected
	     */
	    this._width = width;

	    /**
	     * Internal height of the resource
	     * @member {number}
	     * @protected
	     */
	    this._height = height;

	    /**
	     * If resource has been destroyed
	     * @member {boolean}
	     * @readonly
	     * @default false
	     */
	    this.destroyed = false;

	    /**
	     * `true` if resource is created by BaseTexture
	     * useful for doing cleanup with BaseTexture destroy
	     * and not cleaning up resources that were created
	     * externally.
	     * @member {boolean}
	     * @protected
	     */
	    this.internal = false;

	    /**
	     * Mini-runner for handling resize events
	     *
	     * @member {Runner}
	     * @private
	     */
	    this.onResize = new Runner('setRealSize', 2);

	    /**
	     * Mini-runner for handling update events
	     *
	     * @member {Runner}
	     * @private
	     */
	    this.onUpdate = new Runner('update');

	    /**
	     * Handle internal errors, such as loading errors
	     *
	     * @member {Runner}
	     * @private
	     */
	    this.onError = new Runner('onError', 1);
	};

	var prototypeAccessors$5 = { valid: { configurable: true },width: { configurable: true },height: { configurable: true } };

	/**
	 * Bind to a parent BaseTexture
	 *
	 * @param {PIXI.BaseTexture} baseTexture - Parent texture
	 */
	Resource.prototype.bind = function bind (baseTexture)
	{
	    this.onResize.add(baseTexture);
	    this.onUpdate.add(baseTexture);
	    this.onError.add(baseTexture);

	    // Call a resize immediate if we already
	    // have the width and height of the resource
	    if (this._width || this._height)
	    {
	        this.onResize.run(this._width, this._height);
	    }
	};

	/**
	 * Unbind to a parent BaseTexture
	 *
	 * @param {PIXI.BaseTexture} baseTexture - Parent texture
	 */
	Resource.prototype.unbind = function unbind (baseTexture)
	{
	    this.onResize.remove(baseTexture);
	    this.onUpdate.remove(baseTexture);
	    this.onError.remove(baseTexture);
	};

	/**
	 * Trigger a resize event
	 * @param {number} width X dimension
	 * @param {number} height Y dimension
	 */
	Resource.prototype.resize = function resize (width, height)
	{
	    if (width !== this._width || height !== this._height)
	    {
	        this._width = width;
	        this._height = height;
	        this.onResize.run(width, height);
	    }
	};

	/**
	 * Has been validated
	 * @readonly
	 * @member {boolean}
	 */
	prototypeAccessors$5.valid.get = function ()
	{
	    return !!this._width && !!this._height;
	};

	/**
	 * Has been updated trigger event
	 */
	Resource.prototype.update = function update ()
	{
	    if (!this.destroyed)
	    {
	        this.onUpdate.run();
	    }
	};

	/**
	 * This can be overridden to start preloading a resource
	 * or do any other prepare step.
	 * @protected
	 * @return {Promise<void>} Handle the validate event
	 */
	Resource.prototype.load = function load ()
	{
	    return Promise.resolve();
	};

	/**
	 * The width of the resource.
	 *
	 * @member {number}
	 * @readonly
	 */
	prototypeAccessors$5.width.get = function ()
	{
	    return this._width;
	};

	/**
	 * The height of the resource.
	 *
	 * @member {number}
	 * @readonly
	 */
	prototypeAccessors$5.height.get = function ()
	{
	    return this._height;
	};

	/**
	 * Uploads the texture or returns false if it cant for some reason. Override this.
	 *
	 * @param {PIXI.Renderer} renderer - yeah, renderer!
	 * @param {PIXI.BaseTexture} baseTexture - the texture
	 * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context
	 * @returns {boolean} true is success
	 */
	Resource.prototype.upload = function upload (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars
	{
	    return false;
	};

	/**
	 * Set the style, optional to override
	 *
	 * @param {PIXI.Renderer} renderer - yeah, renderer!
	 * @param {PIXI.BaseTexture} baseTexture - the texture
	 * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context
	 * @returns {boolean} `true` is success
	 */
	Resource.prototype.style = function style (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars
	{
	    return false;
	};

	/**
	 * Clean up anything, this happens when destroying is ready.
	 *
	 * @protected
	 */
	Resource.prototype.dispose = function dispose ()
	{
	    // override
	};

	/**
	 * Call when destroying resource, unbind any BaseTexture object
	 * before calling this method, as reference counts are maintained
	 * internally.
	 */
	Resource.prototype.destroy = function destroy ()
	{
	    if (!this.destroyed)
	    {
	        this.destroyed = true;
	        this.dispose();
	        this.onError.removeAll();
	        this.onError = null;
	        this.onResize.removeAll();
	        this.onResize = null;
	        this.onUpdate.removeAll();
	        this.onUpdate = null;
	    }
	};

	Object.defineProperties( Resource.prototype, prototypeAccessors$5 );

	/**
	 * Base for all the image/canvas resources
	 * @class
	 * @extends PIXI.resources.Resource
	 * @memberof PIXI.resources
	 */
	var BaseImageResource = /*@__PURE__*/(function (Resource) {
	    function BaseImageResource(source)
	    {
	        var width = source.naturalWidth || source.videoWidth || source.width;
	        var height = source.naturalHeight || source.videoHeight || source.height;

	        Resource.call(this, width, height);

	        /**
	         * The source element
	         * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}
	         * @readonly
	         */
	        this.source = source;

	        /**
	         * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.
	         * Certain types of media (e.g. video) using `texImage2D` is more performant.
	         * @member {boolean}
	         * @default false
	         * @private
	         */
	        this.noSubImage = false;
	    }

	    if ( Resource ) { BaseImageResource.__proto__ = Resource; }
	    BaseImageResource.prototype = Object.create( Resource && Resource.prototype );
	    BaseImageResource.prototype.constructor = BaseImageResource;

	    /**
	     * Set cross origin based detecting the url and the crossorigin
	     * @protected
	     * @param {HTMLElement} element - Element to apply crossOrigin
	     * @param {string} url - URL to check
	     * @param {boolean|string} [crossorigin=true] - Cross origin value to use
	     */
	    BaseImageResource.crossOrigin = function crossOrigin (element, url, crossorigin)
	    {
	        if (crossorigin === undefined && url.indexOf('data:') !== 0)
	        {
	            element.crossOrigin = determineCrossOrigin(url);
	        }
	        else if (crossorigin !== false)
	        {
	            element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';
	        }
	    };

	    /**
	     * Upload the texture to the GPU.
	     * @param {PIXI.Renderer} renderer Upload to the renderer
	     * @param {PIXI.BaseTexture} baseTexture Reference to parent texture
	     * @param {PIXI.GLTexture} glTexture
	     * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)
	     * @returns {boolean} true is success
	     */
	    BaseImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture, source)
	    {
	        var gl = renderer.gl;
	        var width = baseTexture.realWidth;
	        var height = baseTexture.realHeight;

	        source = source || this.source;

	        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.premultiplyAlpha);

	        if (!this.noSubImage
	            && baseTexture.target === gl.TEXTURE_2D
	            && glTexture.width === width
	            && glTexture.height === height)
	        {
	            gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);
	        }
	        else
	        {
	            glTexture.width = width;
	            glTexture.height = height;

	            gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);
	        }

	        return true;
	    };

	    /**
	     * Checks if source width/height was changed, resize can cause extra baseTexture update.
	     * Triggers one update in any case.
	     */
	    BaseImageResource.prototype.update = function update ()
	    {
	        if (this.destroyed)
	        {
	            return;
	        }

	        var width = this.source.naturalWidth || this.source.videoWidth || this.source.width;
	        var height = this.source.naturalHeight || this.source.videoHeight || this.source.height;

	        this.resize(width, height);

	        Resource.prototype.update.call(this);
	    };

	    /**
	     * Destroy this BaseImageResource
	     * @override
	     * @param {PIXI.BaseTexture} [fromTexture] Optional base texture
	     * @return {boolean} Destroy was successful
	     */
	    BaseImageResource.prototype.dispose = function dispose ()
	    {
	        this.source = null;
	    };

	    return BaseImageResource;
	}(Resource));

	/**
	 * Resource type for HTMLImageElement.
	 * @class
	 * @extends PIXI.resources.BaseImageResource
	 * @memberof PIXI.resources
	 */
	var ImageResource = /*@__PURE__*/(function (BaseImageResource) {
	    function ImageResource(source, options)
	    {
	        options = options || {};

	        if (!(source instanceof HTMLImageElement))
	        {
	            var imageElement = new Image();

	            BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);

	            imageElement.src = source;
	            source = imageElement;
	        }

	        BaseImageResource.call(this, source);

	        // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height
	        // to non-zero values before its loading completes if images are in a cache.
	        // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.
	        // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).
	        if (!source.complete && !!this._width && !!this._height)
	        {
	            this._width = 0;
	            this._height = 0;
	        }

	        /**
	         * URL of the image source
	         * @member {string}
	         */
	        this.url = source.src;

	        /**
	         * When process is completed
	         * @member {Promise<void>}
	         * @private
	         */
	        this._process = null;

	        /**
	         * If the image should be disposed after upload
	         * @member {boolean}
	         * @default false
	         */
	        this.preserveBitmap = false;

	        /**
	         * If capable, convert the image using createImageBitmap API
	         * @member {boolean}
	         * @default PIXI.settings.CREATE_IMAGE_BITMAP
	         */
	        this.createBitmap = (options.createBitmap !== undefined
	            ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;

	        /**
	         * Controls texture premultiplyAlpha field
	         * Copies from options
	         * @member {boolean|null}
	         * @readonly
	         */
	        this.premultiplyAlpha = options.premultiplyAlpha !== false;

	        /**
	         * The ImageBitmap element created for HTMLImageElement
	         * @member {ImageBitmap}
	         * @default null
	         */
	        this.bitmap = null;

	        /**
	         * Promise when loading
	         * @member {Promise<void>}
	         * @private
	         * @default null
	         */
	        this._load = null;

	        if (options.autoLoad !== false)
	        {
	            this.load();
	        }
	    }

	    if ( BaseImageResource ) { ImageResource.__proto__ = BaseImageResource; }
	    ImageResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );
	    ImageResource.prototype.constructor = ImageResource;

	    /**
	     * returns a promise when image will be loaded and processed
	     *
	     * @param {boolean} [createBitmap=true] whether process image into bitmap
	     * @returns {Promise<void>}
	     */
	    ImageResource.prototype.load = function load (createBitmap)
	    {
	        var this$1 = this;

	        if (createBitmap !== undefined)
	        {
	            this.createBitmap = createBitmap;
	        }

	        if (this._load)
	        {
	            return this._load;
	        }

	        this._load = new Promise(function (resolve) {
	            this$1.url = this$1.source.src;
	            var ref = this$1;
	            var source = ref.source;

	            var completed = function () {
	                if (this$1.destroyed)
	                {
	                    return;
	                }
	                source.onload = null;
	                source.onerror = null;

	                this$1.resize(source.width, source.height);
	                this$1._load = null;

	                if (this$1.createBitmap)
	                {
	                    resolve(this$1.process());
	                }
	                else
	                {
	                    resolve(this$1);
	                }
	            };

	            if (source.complete && source.src)
	            {
	                completed();
	            }
	            else
	            {
	                source.onload = completed;
	                source.onerror = function (event) { return this$1.onError.run(event); };
	            }
	        });

	        return this._load;
	    };

	    /**
	     * Called when we need to convert image into BitmapImage.
	     * Can be called multiple times, real promise is cached inside.
	     *
	     * @returns {Promise<void>} cached promise to fill that bitmap
	     */
	    ImageResource.prototype.process = function process ()
	    {
	        var this$1 = this;

	        if (this._process !== null)
	        {
	            return this._process;
	        }
	        if (this.bitmap !== null || !window.createImageBitmap)
	        {
	            return Promise.resolve(this);
	        }

	        this._process = window.createImageBitmap(this.source,
	            0, 0, this.source.width, this.source.height,
	            {
	                premultiplyAlpha: this.premultiplyAlpha ? 'premultiply' : 'none',
	            })
	            .then(function (bitmap) {
	                if (this$1.destroyed)
	                {
	                    return Promise.reject();
	                }
	                this$1.bitmap = bitmap;
	                this$1.update();
	                this$1._process = null;

	                return Promise.resolve(this$1);
	            });

	        return this._process;
	    };

	    /**
	     * Upload the image resource to GPU.
	     *
	     * @param {PIXI.Renderer} renderer - Renderer to upload to
	     * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource
	     * @param {PIXI.GLTexture} glTexture - GLTexture to use
	     * @returns {boolean} true is success
	     */
	    ImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture)
	    {
	        baseTexture.premultiplyAlpha = this.premultiplyAlpha;

	        if (!this.createBitmap)
	        {
	            return BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture);
	        }
	        if (!this.bitmap)
	        {
	            // yeah, ignore the output
	            this.process();
	            if (!this.bitmap)
	            {
	                return false;
	            }
	        }

	        BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap);

	        if (!this.preserveBitmap)
	        {
	            // checks if there are other renderers that possibly need this bitmap

	            var flag = true;

	            for (var key in baseTexture._glTextures)
	            {
	                var otherTex = baseTexture._glTextures[key];

	                if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)
	                {
	                    flag = false;
	                    break;
	                }
	            }

	            if (flag)
	            {
	                if (this.bitmap.close)
	                {
	                    this.bitmap.close();
	                }

	                this.bitmap = null;
	            }
	        }

	        return true;
	    };

	    /**
	     * Destroys this texture
	     * @override
	     */
	    ImageResource.prototype.dispose = function dispose ()
	    {
	        this.source.onload = null;
	        this.source.onerror = null;

	        BaseImageResource.prototype.dispose.call(this);

	        if (this.bitmap)
	        {
	            this.bitmap.close();
	            this.bitmap = null;
	        }
	        this._process = null;
	        this._load = null;
	    };

	    return ImageResource;
	}(BaseImageResource));

	/**
	 * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.
	 * @example
	 * class CustomResource extends PIXI.resources.Resource {
	 *   // MUST have source, options constructor signature
	 *   // for auto-detected resources to be created.
	 *   constructor(source, options) {
	 *     super();
	 *   }
	 *   upload(renderer, baseTexture, glTexture) {
	 *     // upload with GL
	 *     return true;
	 *   }
	 *   // used to auto-detect resource
	 *   static test(source, extension) {
	 *     return extension === 'xyz'|| source instanceof SomeClass;
	 *   }
	 * }
	 * // Install the new resource type
	 * PIXI.resources.INSTALLED.push(CustomResource);
	 *
	 * @name PIXI.resources.INSTALLED
	 * @type {Array<*>}
	 * @static
	 * @readonly
	 */
	var INSTALLED = [];

	/**
	 * Create a resource element from a single source element. This
	 * auto-detects which type of resource to create. All resources that
	 * are auto-detectable must have a static `test` method and a constructor
	 * with the arguments `(source, options?)`. Currently, the supported
	 * resources for auto-detection include:
	 *  - {@link PIXI.resources.ImageResource}
	 *  - {@link PIXI.resources.CanvasResource}
	 *  - {@link PIXI.resources.VideoResource}
	 *  - {@link PIXI.resources.SVGResource}
	 *  - {@link PIXI.resources.BufferResource}
	 * @static
	 * @function PIXI.resources.autoDetectResource
	 * @param {string|*} source - Resource source, this can be the URL to the resource,
	 *        a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri
	 *        or any other resource that can be auto-detected. If not resource is
	 *        detected, it's assumed to be an ImageResource.
	 * @param {object} [options] - Pass-through options to use for Resource
	 * @param {number} [options.width] - Width of BufferResource or SVG rasterization
	 * @param {number} [options.height] - Height of BufferResource or SVG rasterization
	 * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading
	 * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height
	 * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object
	 * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin
	 * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately
	 * @param {number} [options.updateFPS=0] - Video option to update how many times a second the
	 *        texture should be updated from the video. Leave at 0 to update at every render
	 * @return {PIXI.resources.Resource} The created resource.
	 */
	function autoDetectResource(source, options)
	{
	    if (!source)
	    {
	        return null;
	    }

	    var extension = '';

	    if (typeof source === 'string')
	    {
	        // search for file extension: period, 3-4 chars, then ?, # or EOL
	        var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source);

	        if (result)
	        {
	            extension = result[1].toLowerCase();
	        }
	    }

	    for (var i = INSTALLED.length - 1; i >= 0; --i)
	    {
	        var ResourcePlugin = INSTALLED[i];

	        if (ResourcePlugin.test && ResourcePlugin.test(source, extension))
	        {
	            return new ResourcePlugin(source, options);
	        }
	    }

	    // When in doubt: probably an image
	    // might be appropriate to throw an error or return null
	    return new ImageResource(source, options);
	}

	/**
	 * @interface SharedArrayBuffer
	 */

	/**
	 * Buffer resource with data of typed array.
	 * @class
	 * @extends PIXI.resources.Resource
	 * @memberof PIXI.resources
	 */
	var BufferResource = /*@__PURE__*/(function (Resource) {
	    function BufferResource(source, options)
	    {
	        var ref = options || {};
	        var width = ref.width;
	        var height = ref.height;

	        if (!width || !height)
	        {
	            throw new Error('BufferResource width or height invalid');
	        }

	        Resource.call(this, width, height);

	        /**
	         * Source array
	         * Cannot be ClampedUint8Array because it cant be uploaded to WebGL
	         *
	         * @member {Float32Array|Uint8Array|Uint32Array}
	         */
	        this.data = source;
	    }

	    if ( Resource ) { BufferResource.__proto__ = Resource; }
	    BufferResource.prototype = Object.create( Resource && Resource.prototype );
	    BufferResource.prototype.constructor = BufferResource;

	    /**
	     * Upload the texture to the GPU.
	     * @param {PIXI.Renderer} renderer Upload to the renderer
	     * @param {PIXI.BaseTexture} baseTexture Reference to parent texture
	     * @param {PIXI.GLTexture} glTexture glTexture
	     * @returns {boolean} true is success
	     */
	    BufferResource.prototype.upload = function upload (renderer, baseTexture, glTexture)
	    {
	        var gl = renderer.gl;

	        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.premultiplyAlpha);

	        if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)
	        {
	            gl.texSubImage2D(
	                baseTexture.target,
	                0,
	                0,
	                0,
	                baseTexture.width,
	                baseTexture.height,
	                baseTexture.format,
	                baseTexture.type,
	                this.data
	            );
	        }
	        else
	        {
	            glTexture.width = baseTexture.width;
	            glTexture.height = baseTexture.height;

	            gl.texImage2D(
	                baseTexture.target,
	                0,
	                glTexture.internalFormat,
	                baseTexture.width,
	                baseTexture.height,
	                0,
	                baseTexture.format,
	                glTexture.type,
	                this.data
	            );
	        }

	        return true;
	    };

	    /**
	     * Destroy and don't use after this
	     * @override
	     */
	    BufferResource.prototype.dispose = function dispose ()
	    {
	        this.data = null;
	    };

	    /**
	     * Used to auto-detect the type of resource.
	     *
	     * @static
	     * @param {*} source - The source object
	     * @return {boolean} `true` if <canvas>
	     */
	    BufferResource.test = function test (source)
	    {
	        return source instanceof Float32Array
	            || source instanceof Uint8Array
	            || source instanceof Uint32Array;
	    };

	    return BufferResource;
	}(Resource));

	var defaultBufferOptions = {
	    scaleMode: SCALE_MODES.NEAREST,
	    format: FORMATS.RGBA,
	    premultiplyAlpha: false,
	};

	/**
	 * A Texture stores the information that represents an image.
	 * All textures have a base texture, which contains information about the source.
	 * Therefore you can have many textures all using a single BaseTexture
	 *
	 * @class
	 * @extends PIXI.utils.EventEmitter
	 * @memberof PIXI
	 * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]
	 *        The current resource to use, for things that aren't Resource objects, will be converted
	 *        into a Resource.
	 * @param {Object} [options] - Collection of options
	 * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture
	 * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture
	 * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures
	 * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest
	 * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type
	 * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type
	 * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target
	 * @param {boolean} [options.premultiplyAlpha=true] - Pre multiply the image alpha
	 * @param {number} [options.width=0] - Width of the texture
	 * @param {number} [options.height=0] - Height of the texture
	 * @param {number} [options.resolution] - Resolution of the base texture
	 * @param {object} [options.resourceOptions] - Optional resource options,
	 *        see {@link PIXI.resources.autoDetectResource autoDetectResource}
	 */
	var BaseTexture = /*@__PURE__*/(function (EventEmitter) {
	    function BaseTexture(resource, options)
	    {
	        if ( resource === void 0 ) { resource = null; }
	        if ( options === void 0 ) { options = null; }

	        EventEmitter.call(this);

	        options = options || {};

	        var premultiplyAlpha = options.premultiplyAlpha;
	        var mipmap = options.mipmap;
	        var anisotropicLevel = options.anisotropicLevel;
	        var scaleMode = options.scaleMode;
	        var width = options.width;
	        var height = options.height;
	        var wrapMode = options.wrapMode;
	        var format = options.format;
	        var type = options.type;
	        var target = options.target;
	        var resolution = options.resolution;
	        var resourceOptions = options.resourceOptions;

	        // Convert the resource to a Resource object
	        if (resource && !(resource instanceof Resource))
	        {
	            resource = autoDetectResource(resource, resourceOptions);
	            resource.internal = true;
	        }

	        /**
	         * The width of the base texture set when the image has loaded
	         *
	         * @readonly
	         * @member {number}
	         */
	        this.width = width || 0;

	        /**
	         * The height of the base texture set when the image has loaded
	         *
	         * @readonly
	         * @member {number}
	         */
	        this.height = height || 0;

	        /**
	         * The resolution / device pixel ratio of the texture
	         *
	         * @member {number}
	         * @default PIXI.settings.RESOLUTION
	         */
	        this.resolution = resolution || settings.RESOLUTION;

	        /**
	         * Mipmap mode of the texture, affects downscaled images
	         *
	         * @member {PIXI.MIPMAP_MODES}
	         * @default PIXI.settings.MIPMAP_TEXTURES
	         */
	        this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;

	        /**
	         * Anisotropic filtering level of texture
	         *
	         * @member {number}
	         * @default PIXI.settings.ANISOTROPIC_LEVEL
	         */
	        this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;

	        /**
	         * How the texture wraps
	         * @member {number}
	         */
	        this.wrapMode = wrapMode || settings.WRAP_MODE;

	        /**
	         * The scale mode to apply when scaling this texture
	         *
	         * @member {PIXI.SCALE_MODES}
	         * @default PIXI.settings.SCALE_MODE
	         */
	        this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;

	        /**
	         * The pixel format of the texture
	         *
	         * @member {PIXI.FORMATS}
	         * @default PIXI.FORMATS.RGBA
	         */
	        this.format = format || FORMATS.RGBA;

	        /**
	         * The type of resource data
	         *
	         * @member {PIXI.TYPES}
	         * @default PIXI.TYPES.UNSIGNED_BYTE
	         */
	        this.type = type || TYPES.UNSIGNED_BYTE;

	        /**
	         * The target type
	         *
	         * @member {PIXI.TARGETS}
	         * @default PIXI.TARGETS.TEXTURE_2D
	         */
	        this.target = target || TARGETS.TEXTURE_2D;

	        /**
	         * Set to true to enable pre-multiplied alpha
	         *
	         * @member {boolean}
	         * @default true
	         */
	        this.premultiplyAlpha = premultiplyAlpha !== false;

	        /**
	         * Global unique identifier for this BaseTexture
	         *
	         * @member {string}
	         * @protected
	         */
	        this.uid = uid();

	        /**
	         * Used by automatic texture Garbage Collection, stores last GC tick when it was bound
	         *
	         * @member {number}
	         * @protected
	         */
	        this.touched = 0;

	        /**
	         * Whether or not the texture is a power of two, try to use power of two textures as much
	         * as you can
	         *
	         * @readonly
	         * @member {boolean}
	         * @default false
	         */
	        this.isPowerOfTwo = false;
	        this._refreshPOT();

	        /**
	         * The map of render context textures where this is bound
	         *
	         * @member {Object}
	         * @private
	         */
	        this._glTextures = {};

	        /**
	         * Used by TextureSystem to only update texture to the GPU when needed.
	         * Please call `update()` to increment it.
	         *
	         * @readonly
	         * @member {number}
	         */
	        this.dirtyId = 0;

	        /**
	         * Used by TextureSystem to only update texture style when needed.
	         *
	         * @protected
	         * @member {number}
	         */
	        this.dirtyStyleId = 0;

	        /**
	         * Currently default cache ID.
	         *
	         * @member {string}
	         */
	        this.cacheId = null;

	        /**
	         * Generally speaking means when resource is loaded.
	         * @readonly
	         * @member {boolean}
	         */
	        this.valid = width > 0 && height > 0;

	        /**
	         * The collection of alternative cache ids, since some BaseTextures
	         * can have more than one ID, short name and longer full URL
	         *
	         * @member {Array<string>}
	         * @readonly
	         */
	        this.textureCacheIds = [];

	        /**
	         * Flag if BaseTexture has been destroyed.
	         *
	         * @member {boolean}
	         * @readonly
	         */
	        this.destroyed = false;

	        /**
	         * The resource used by this BaseTexture, there can only
	         * be one resource per BaseTexture, but textures can share
	         * resources.
	         *
	         * @member {PIXI.resources.Resource}
	         * @readonly
	         */
	        this.resource = null;

	        /**
	         * Number of the texture batch, used by multi-texture renderers
	         *
	         * @member {number}
	         */
	        this._batchEnabled = 0;

	        /**
	         * Fired when a not-immediately-available source finishes loading.
	         *
	         * @protected
	         * @event PIXI.BaseTexture#loaded
	         * @param {PIXI.BaseTexture} baseTexture - Resource loaded.
	         */

	        /**
	         * Fired when a not-immediately-available source fails to load.
	         *
	         * @protected
	         * @event PIXI.BaseTexture#error
	         * @param {PIXI.BaseTexture} baseTexture - Resource errored.
	         * @param {ErrorEvent} event - Load error event.
	         */

	        /**
	         * Fired when BaseTexture is updated.
	         *
	         * @protected
	         * @event PIXI.BaseTexture#loaded
	         * @param {PIXI.BaseTexture} baseTexture - Resource loaded.
	         */

	        /**
	         * Fired when BaseTexture is updated.
	         *
	         * @protected
	         * @event PIXI.BaseTexture#update
	         * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.
	         */

	        /**
	         * Fired when BaseTexture is destroyed.
	         *
	         * @protected
	         * @event PIXI.BaseTexture#dispose
	         * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.
	         */

	        // Set the resource
	        this.setResource(resource);
	    }

	    if ( EventEmitter ) { BaseTexture.__proto__ = EventEmitter; }
	    BaseTexture.prototype = Object.create( EventEmitter && EventEmitter.prototype );
	    BaseTexture.prototype.constructor = BaseTexture;

	    var prototypeAccessors = { realWidth: { configurable: true },realHeight: { configurable: true } };

	    /**
	     * Pixel width of the source of this texture
	     *
	     * @readonly
	     * @member {number}
	     */
	    prototypeAccessors.realWidth.get = function ()
	    {
	        return Math.ceil((this.width * this.resolution) - 1e-4);
	    };

	    /**
	     * Pixel height of the source of this texture
	     *
	     * @readonly
	     * @member {number}
	     */
	    prototypeAccessors.realHeight.get = function ()
	    {
	        return Math.ceil((this.height * this.resolution) - 1e-4);
	    };

	    /**
	     * Changes style options of BaseTexture
	     *
	     * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode
	     * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps
	     * @returns {PIXI.BaseTexture} this
	     */
	    BaseTexture.prototype.setStyle = function setStyle (scaleMode, mipmap)
	    {
	        var dirty;

	        if (scaleMode !== undefined && scaleMode !== this.scaleMode)
	        {
	            this.scaleMode = scaleMode;
	            dirty = true;
	        }

	        if (mipmap !== undefined && mipmap !== this.mipmap)
	        {
	            this.mipmap = mipmap;
	            dirty = true;
	        }

	        if (dirty)
	        {
	            this.dirtyStyleId++;
	        }

	        return this;
	    };

	    /**
	     * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.
	     *
	     * @param {number} width Visual width
	     * @param {number} height Visual height
	     * @param {number} [resolution] Optionally set resolution
	     * @returns {PIXI.BaseTexture} this
	     */
	    BaseTexture.prototype.setSize = function setSize (width, height, resolution)
	    {
	        this.resolution = resolution || this.resolution;
	        this.width = width;
	        this.height = height;
	        this._refreshPOT();
	        this.update();

	        return this;
	    };

	    /**
	     * Sets real size of baseTexture, preserves current resolution.
	     *
	     * @param {number} realWidth Full rendered width
	     * @param {number} realHeight Full rendered height
	     * @param {number} [resolution] Optionally set resolution
	     * @returns {PIXI.BaseTexture} this
	     */
	    BaseTexture.prototype.setRealSize = function setRealSize (realWidth, realHeight, resolution)
	    {
	        this.resolution = resolution || this.resolution;
	        this.width = realWidth / this.resolution;
	        this.height = realHeight / this.resolution;
	        this._refreshPOT();
	        this.update();

	        return this;
	    };

	    /**
	     * Refresh check for isPowerOfTwo texture based on size
	     *
	     * @private
	     */
	    BaseTexture.prototype._refreshPOT = function _refreshPOT ()
	    {
	        this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);
	    };

	    /**
	     * Changes resolution
	     *
	     * @param {number} [resolution] res
	     * @returns {PIXI.BaseTexture} this
	     */
	    BaseTexture.prototype.setResolution = function setResolution (resolution)
	    {
	        var oldResolution = this.resolution;

	        if (oldResolution === resolution)
	        {
	            return this;
	        }

	        this.resolution = resolution;

	        if (this.valid)
	        {
	            this.width = this.width * oldResolution / resolution;
	            this.height = this.height * oldResolution / resolution;
	            this.emit('update', this);
	        }

	        this._refreshPOT();

	        return this;
	    };

	    /**
	     * Sets the resource if it wasn't set. Throws error if resource already present
	     *
	     * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture
	     * @returns {PIXI.BaseTexture} this
	     */
	    BaseTexture.prototype.setResource = function setResource (resource)
	    {
	        if (this.resource === resource)
	        {
	            return this;
	        }

	        if (this.resource)
	        {
	            throw new Error('Resource can be set only once');
	        }

	        resource.bind(this);

	        this.resource = resource;

	        return this;
	    };

	    /**
	     * Invalidates the object. Texture becomes valid if width and height are greater than zero.
	     */
	    BaseTexture.prototype.update = function update ()
	    {
	        if (!this.valid)
	        {
	            if (this.width > 0 && this.height > 0)
	            {
	                this.valid = true;
	                this.emit('loaded', this);
	                this.emit('update', this);
	            }
	        }
	        else
	        {
	            this.dirtyId++;
	            this.dirtyStyleId++;
	            this.emit('update', this);
	        }
	    };

	    /**
	     * Handle errors with resources.
	     * @private
	     * @param {ErrorEvent} event - Error event emitted.
	     */
	    BaseTexture.prototype.onError = function onError (event)
	    {
	        this.emit('error', this, event);
	    };

	    /**
	     * Destroys this base texture.
	     * The method stops if resource doesn't want this texture to be destroyed.
	     * Removes texture from all caches.
	     */
	    BaseTexture.prototype.destroy = function destroy ()
	    {
	        // remove and destroy the resource
	        if (this.resource)
	        {
	            this.resource.unbind(this);
	            // only destroy resourced created internally
	            if (this.resource.internal)
	            {
	                this.resource.destroy();
	            }
	            this.resource = null;
	        }

	        if (this.cacheId)
	        {
	            delete BaseTextureCache[this.cacheId];
	            delete TextureCache[this.cacheId];

	            this.cacheId = null;
	        }

	        // finally let the WebGL renderer know..
	        this.dispose();

	        BaseTexture.removeFromCache(this);
	        this.textureCacheIds = null;

	        this.destroyed = true;
	    };

	    /**
	     * Frees the texture from WebGL memory without destroying this texture object.
	     * This means you can still use the texture later which will upload it to GPU
	     * memory again.
	     *
	     * @fires PIXI.BaseTexture#dispose
	     */
	    BaseTexture.prototype.dispose = function dispose ()
	    {
	        this.emit('dispose', this);
	    };

	    /**
	     * Helper function that creates a base texture based on the source you provide.
	     * The source can be - image url, image element, canvas element. If the
	     * source is an image url or an image element and not in the base texture
	     * cache, it will be created and loaded.
	     *
	     * @static
	     * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The
	     *        source to create base texture from.
	     * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.
	     * @returns {PIXI.BaseTexture} The new base texture.
	     */
	    BaseTexture.from = function from (source, options)
	    {
	        var cacheId = null;

	        if (typeof source === 'string')
	        {
	            cacheId = source;
	        }
	        else
	        {
	            if (!source._pixiId)
	            {
	                source._pixiId = "pixiid_" + (uid());
	            }

	            cacheId = source._pixiId;
	        }

	        var baseTexture = BaseTextureCache[cacheId];

	        if (!baseTexture)
	        {
	            baseTexture = new BaseTexture(source, options);
	            baseTexture.cacheId = cacheId;
	            BaseTexture.addToCache(baseTexture, cacheId);
	        }

	        return baseTexture;
	    };

	    /**
	     * Create a new BaseTexture with a BufferResource from a Float32Array.
	     * RGBA values are floats from 0 to 1.
	     * @static
	     * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data
	     *        is provided, a new Float32Array is created.
	     * @param {number} width - Width of the resource
	     * @param {number} height - Height of the resource
	     * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.
	     * @return {PIXI.BaseTexture} The resulting new BaseTexture
	     */
	    BaseTexture.fromBuffer = function fromBuffer (buffer, width, height, options)
	    {
	        buffer = buffer || new Float32Array(width * height * 4);

	        var resource = new BufferResource(buffer, { width: width, height: height });
	        var type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;

	        return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type }));
	    };

	    /**
	     * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.
	     *
	     * @static
	     * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.
	     * @param {string} id - The id that the BaseTexture will be stored against.
	     */
	    BaseTexture.addToCache = function addToCache (baseTexture, id)
	    {
	        if (id)
	        {
	            if (baseTexture.textureCacheIds.indexOf(id) === -1)
	            {
	                baseTexture.textureCacheIds.push(id);
	            }

	            if (BaseTextureCache[id])
	            {
	                // eslint-disable-next-line no-console
	                console.warn(("BaseTexture added to the cache with an id [" + id + "] that already had an entry"));
	            }

	            BaseTextureCache[id] = baseTexture;
	        }
	    };

	    /**
	     * Remove a BaseTexture from the global BaseTextureCache.
	     *
	     * @static
	     * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.
	     * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.
	     */
	    BaseTexture.removeFromCache = function removeFromCache (baseTexture)
	    {
	        if (typeof baseTexture === 'string')
	        {
	            var baseTextureFromCache = BaseTextureCache[baseTexture];

	            if (baseTextureFromCache)
	            {
	                var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);

	                if (index > -1)
	                {
	                    baseTextureFromCache.textureCacheIds.splice(index, 1);
	                }

	                delete BaseTextureCache[baseTexture];

	                return baseTextureFromCache;
	            }
	        }
	        else if (baseTexture && baseTexture.textureCacheIds)
	        {
	            for (var i = 0; i < baseTexture.textureCacheIds.length; ++i)
	            {
	                delete BaseTextureCache[baseTexture.textureCacheIds[i]];
	            }

	            baseTexture.textureCacheIds.length = 0;

	            return baseTexture;
	        }

	        return null;
	    };

	    Object.defineProperties( BaseTexture.prototype, prototypeAccessors );

	    return BaseTexture;
	}(eventemitter3));

	/**
	 * Global number of the texture batch, used by multi-texture renderers
	 *
	 * @static
	 * @member {number}
	 */
	BaseTexture._globalBatch = 0;

	/**
	 * A resource that contains a number of sources.
	 *
	 * @class
	 * @extends PIXI.resources.Resource
	 * @memberof PIXI.resources
	 * @param {number|Array<*>} source - Number of items in array or the collection
	 *        of image URLs to use. Can also be resources, image elements, canvas, etc.
	 * @param {object} [options] Options to apply to {@link PIXI.resources.autoDetectResource}
	 * @param {number} [options.width] - Width of the resource
	 * @param {number} [options.height] - Height of the resource
	 */
	var ArrayResource = /*@__PURE__*/(function (Resource) {
	    function ArrayResource(source, options)
	    {
	        options = options || {};

	        var urls;
	        var length = source;

	        if (Array.isArray(source))
	        {
	            urls = source;
	            length = source.length;
	        }

	        Resource.call(this, options.width, options.height);

	        /**
	         * Collection of resources.
	         * @member {Array<PIXI.BaseTexture>}
	         * @readonly
	         */
	        this.items = [];

	        /**
	         * Dirty IDs for each part
	         * @member {Array<number>}
	         * @readonly
	         */
	        this.itemDirtyIds = [];

	        for (var i = 0; i < length; i++)
	        {
	            var partTexture = new BaseTexture();

	            this.items.push(partTexture);
	            this.itemDirtyIds.push(-1);
	        }

	        /**
	         * Number of elements in array
	         *
	         * @member {number}
	         * @readonly
	         */
	        this.length = length;

	        /**
	         * Promise when loading
	         * @member {Promise}
	         * @private
	         * @default null
	         */
	        this._load = null;

	        if (urls)
	        {
	            for (var i$1 = 0; i$1 < length; i$1++)
	            {
	                this.addResourceAt(autoDetectResource(urls[i$1], options), i$1);
	            }
	        }
	    }

	    if ( Resource ) { ArrayResource.__proto__ = Resource; }
	    ArrayResource.prototype = Object.create( Resource && Resource.prototype );
	    ArrayResource.prototype.constructor = ArrayResource;

	    /**
	     * Destroy this BaseImageResource
	     * @override
	     */
	    ArrayResource.prototype.dispose = function dispose ()
	    {
	        for (var i = 0, len = this.length; i < len; i++)
	        {
	            this.items[i].destroy();
	        }
	        this.items = null;
	        this.itemDirtyIds = null;
	        this._load = null;
	    };

	    /**
	     * Set a resource by ID
	     *
	     * @param {PIXI.resources.Resource} resource
	     * @param {number} index - Zero-based index of resource to set
	     * @return {PIXI.resources.ArrayResource} Instance for chaining
	     */
	    ArrayResource.prototype.addResourceAt = function addResourceAt (resource, index)
	    {
	        var baseTexture = this.items[index];

	        if (!baseTexture)
	        {
	            throw new Error(("Index " + index + " is out of bounds"));
	        }

	        // Inherit the first resource dimensions
	        if (resource.valid && !this.valid)
	        {
	            this.resize(resource.width, resource.height);
	        }

	        this.items[index].setResource(resource);

	        return this;
	    };

	    /**
	     * Set the parent base texture
	     * @member {PIXI.BaseTexture}
	     * @override
	     */
	    ArrayResource.prototype.bind = function bind (baseTexture)
	    {
	        Resource.prototype.bind.call(this, baseTexture);

	        baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;

	        for (var i = 0; i < this.length; i++)
	        {
	            this.items[i].on('update', baseTexture.update, baseTexture);
	        }
	    };

	    /**
	     * Unset the parent base texture
	     * @member {PIXI.BaseTexture}
	     * @override
	     */
	    ArrayResource.prototype.unbind = function unbind (baseTexture)
	    {
	        Resource.prototype.unbind.call(this, baseTexture);

	        for (var i = 0; i < this.length; i++)
	        {
	            this.items[i].off('update', baseTexture.update, baseTexture);
	        }
	    };

	    /**
	     * Load all the resources simultaneously
	     * @override
	     * @return {Promise<void>} When load is resolved
	     */
	    ArrayResource.prototype.load = function load ()
	    {
	        var this$1 = this;

	        if (this._load)
	        {
	            return this._load;
	        }

	        var resources = this.items.map(function (item) { return item.resource; });

	        // TODO: also implement load part-by-part strategy
	        var promises = resources.map(function (item) { return item.load(); });

	        this._load = Promise.all(promises)
	            .then(function () {
	                var ref = resources[0];
	                var width = ref.width;
	                var height = ref.height;

	                this$1.resize(width, height);

	                return Promise.resolve(this$1);
	            }
	            );

	        return this._load;
	    };

	    /**
	     * Upload the resources to the GPU.
	     * @param {PIXI.Renderer} renderer
	     * @param {PIXI.BaseTexture} texture
	     * @param {PIXI.GLTexture} glTexture
	     * @returns {boolean} whether texture was uploaded
	     */
	    ArrayResource.prototype.upload = function upload (renderer, texture, glTexture)
	    {
	        var ref = this;
	        var length = ref.length;
	        var itemDirtyIds = ref.itemDirtyIds;
	        var items = ref.items;
	        var gl = renderer.gl;

	        if (glTexture.dirtyId < 0)
	        {
	            gl.texImage3D(
	                gl.TEXTURE_2D_ARRAY,
	                0,
	                texture.format,
	                this._width,
	                this._height,
	                length,
	                0,
	                texture.format,
	                texture.type,
	                null
	            );
	        }

	        for (var i = 0; i < length; i++)
	        {
	            var item = items[i];

	            if (itemDirtyIds[i] < item.dirtyId)
	            {
	                itemDirtyIds[i] = item.dirtyId;
	                if (item.valid)
	                {
	                    gl.texSubImage3D(
	                        gl.TEXTURE_2D_ARRAY,
	                        0,
	                        0, // xoffset
	                        0, // yoffset
	                        i, // zoffset
	                        item.resource.width,
	                        item.resource.height,
	                        1,
	                        texture.format,
	                        texture.type,
	                        item.resource.source
	                    );
	                }
	            }
	        }

	        return true;
	    };

	    return ArrayResource;
	}(Resource));

	/**
	 * @interface OffscreenCanvas
	 */

	/**
	 * Resource type for HTMLCanvasElement.
	 * @class
	 * @extends PIXI.resources.BaseImageResource
	 * @memberof PIXI.resources
	 * @param {HTMLCanvasElement} source - Canvas element to use
	 */
	var CanvasResource = /*@__PURE__*/(function (BaseImageResource) {
	    function CanvasResource () {
	        BaseImageResource.apply(this, arguments);
	    }

	    if ( BaseImageResource ) { CanvasResource.__proto__ = BaseImageResource; }
	    CanvasResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );
	    CanvasResource.prototype.constructor = CanvasResource;

	    CanvasResource.test = function test (source)
	    {
	        var OffscreenCanvas = window.OffscreenCanvas;

	        // Check for browsers that don't yet support OffscreenCanvas
	        if (OffscreenCanvas && source instanceof OffscreenCanvas)
	        {
	            return true;
	        }

	        return source instanceof HTMLCanvasElement;
	    };

	    return CanvasResource;
	}(BaseImageResource));

	/**
	 * Resource for a CubeTexture which contains six resources.
	 *
	 * @class
	 * @extends PIXI.resources.ArrayResource
	 * @memberof PIXI.resources
	 * @param {Array<string|PIXI.resources.Resource>} [source] Collection of URLs or resources
	 *        to use as the sides of the cube.
	 * @param {object} [options] - ImageResource options
	 * @param {number} [options.width] - Width of resource
	 * @param {number} [options.height] - Height of resource
	 */
	var CubeResource = /*@__PURE__*/(function (ArrayResource) {
	    function CubeResource(source, options)
	    {
	        options = options || {};

	        ArrayResource.call(this, source, options);

	        if (this.length !== CubeResource.SIDES)
	        {
	            throw new Error(("Invalid length. Got " + (this.length) + ", expected 6"));
	        }

	        for (var i = 0; i < CubeResource.SIDES; i++)
	        {
	            this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;
	        }

	        if (options.autoLoad !== false)
	        {
	            this.load();
	        }
	    }

	    if ( ArrayResource ) { CubeResource.__proto__ = ArrayResource; }
	    CubeResource.prototype = Object.create( ArrayResource && ArrayResource.prototype );
	    CubeResource.prototype.constructor = CubeResource;

	    /**
	     * Add binding
	     *
	     * @override
	     * @param {PIXI.BaseTexture} baseTexture - parent base texture
	     */
	    CubeResource.prototype.bind = function bind (baseTexture)
	    {
	        ArrayResource.prototype.bind.call(this, baseTexture);

	        baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;
	    };

	    /**
	     * Upload the resource
	     *
	     * @returns {boolean} true is success
	     */
	    CubeResource.prototype.upload = function upload (renderer, baseTexture, glTexture)
	    {
	        var dirty = this.itemDirtyIds;

	        for (var i = 0; i < CubeResource.SIDES; i++)
	        {
	            var side = this.items[i];

	            if (dirty[i] < side.dirtyId)
	            {
	                dirty[i] = side.dirtyId;
	                if (side.valid)
	                {
	                    side.resource.upload(renderer, side, glTexture);
	                }
	            }
	        }

	        return true;
	    };

	    return CubeResource;
	}(ArrayResource));

	/**
	 * Number of texture sides to store for CubeResources
	 *
	 * @name PIXI.resources.CubeResource.SIDES
	 * @static
	 * @member {number}
	 * @default 6
	 */
	CubeResource.SIDES = 6;

	/**
	 * Resource type for SVG elements and graphics.
	 * @class
	 * @extends PIXI.resources.BaseImageResource
	 * @memberof PIXI.resources
	 * @param {string} source - Base64 encoded SVG element or URL for SVG file.
	 * @param {object} [options] - Options to use
	 * @param {number} [options.scale=1] Scale to apply to SVG. Overridden by...
	 * @param {number} [options.width] Rasterize SVG this wide. Aspect ratio preserved if height not specified.
	 * @param {number} [options.height] Rasterize SVG this high. Aspect ratio preserved if width not specified.
	 * @param {boolean} [options.autoLoad=true] Start loading right away.
	 */
	var SVGResource = /*@__PURE__*/(function (BaseImageResource) {
	    function SVGResource(source, options)
	    {
	        options = options || {};

	        BaseImageResource.call(this, document.createElement('canvas'));
	        this._width = 0;
	        this._height = 0;

	        /**
	         * Base64 encoded SVG element or URL for SVG file
	         * @readonly
	         * @member {string}
	         */
	        this.svg = source;

	        /**
	         * The source scale to apply when rasterizing on load
	         * @readonly
	         * @member {number}
	         */
	        this.scale = options.scale || 1;

	        /**
	         * A width override for rasterization on load
	         * @readonly
	         * @member {number}
	         */
	        this._overrideWidth = options.width;

	        /**
	         * A height override for rasterization on load
	         * @readonly
	         * @member {number}
	         */
	        this._overrideHeight = options.height;

	        /**
	         * Call when completely loaded
	         * @private
	         * @member {function}
	         */
	        this._resolve = null;

	        /**
	         * Cross origin value to use
	         * @private
	         * @member {boolean|string}
	         */
	        this._crossorigin = options.crossorigin;

	        /**
	         * Promise when loading
	         * @member {Promise<void>}
	         * @private
	         * @default null
	         */
	        this._load = null;

	        if (options.autoLoad !== false)
	        {
	            this.load();
	        }
	    }

	    if ( BaseImageResource ) { SVGResource.__proto__ = BaseImageResource; }
	    SVGResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );
	    SVGResource.prototype.constructor = SVGResource;

	    SVGResource.prototype.load = function load ()
	    {
	        var this$1 = this;

	        if (this._load)
	        {
	            return this._load;
	        }

	        this._load = new Promise(function (resolve) {
	            // Save this until after load is finished
	            this$1._resolve = function () {
	                this$1.resize(this$1.source.width, this$1.source.height);
	                resolve(this$1);
	            };

	            // Convert SVG inline string to data-uri
	            if ((/^\<svg/).test(this$1.svg.trim()))
	            {
	                if (!btoa)
	                {
	                    throw new Error('Your browser doesn\'t support base64 conversions.');
	                }
	                this$1.svg = "data:image/svg+xml;base64," + (btoa(unescape(encodeURIComponent(this$1.svg))));
	            }

	            this$1._loadSvg();
	        });

	        return this._load;
	    };

	    /**
	     * Loads an SVG image from `imageUrl` or `data URL`.
	     *
	     * @private
	     */
	    SVGResource.prototype._loadSvg = function _loadSvg ()
	    {
	        var this$1 = this;

	        var tempImage = new Image();

	        BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);
	        tempImage.src = this.svg;

	        tempImage.onerror = function (event) {
	            tempImage.onerror = null;
	            this$1.onError.run(event);
	        };

	        tempImage.onload = function () {
	            var svgWidth = tempImage.width;
	            var svgHeight = tempImage.height;

	            if (!svgWidth || !svgHeight)
	            {
	                throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');
	            }

	            // Set render size
	            var width = svgWidth * this$1.scale;
	            var height = svgHeight * this$1.scale;

	            if (this$1._overrideWidth || this$1._overrideHeight)
	            {
	                width = this$1._overrideWidth || this$1._overrideHeight / svgHeight * svgWidth;
	                height = this$1._overrideHeight || this$1._overrideWidth / svgWidth * svgHeight;
	            }
	            width = Math.round(width);
	            height = Math.round(height);

	            // Create a canvas element
	            var canvas = this$1.source;

	            canvas.width = width;
	            canvas.height = height;
	            canvas._pixiId = "canvas_" + (uid());

	            // Draw the Svg to the canvas
	            canvas
	                .getContext('2d')
	                .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);

	            this$1._resolve();
	            this$1._resolve = null;
	        };
	    };

	    /**
	     * Get size from an svg string using regexp.
	     *
	     * @method
	     * @param {string} svgString - a serialized svg element
	     * @return {PIXI.ISize} image extension
	     */
	    SVGResource.getSize = function getSize (svgString)
	    {
	        var sizeMatch = SVGResource.SVG_SIZE.exec(svgString);
	        var size = {};

	        if (sizeMatch)
	        {
	            size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));
	            size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));
	        }

	        return size;
	    };

	    /**
	     * Destroys this texture
	     * @override
	     */
	    SVGResource.prototype.dispose = function dispose ()
	    {
	        BaseImageResource.prototype.dispose.call(this);
	        this._resolve = null;
	        this._crossorigin = null;
	    };

	    /**
	     * Used to auto-detect the type of resource.
	     *
	     * @static
	     * @param {*} source - The source object
	     * @param {string} extension - The extension of source, if set
	     */
	    SVGResource.test = function test (source, extension)
	    {
	        // url file extension is SVG
	        return extension === 'svg'
	            // source is SVG data-uri
	            || (typeof source === 'string' && source.indexOf('data:image/svg+xml;base64') === 0)
	            // source is SVG inline
	            || (typeof source === 'string' && source.indexOf('<svg') === 0);
	    };

	    return SVGResource;
	}(BaseImageResource));

	/**
	 * RegExp for SVG size.
	 *
	 * @static
	 * @constant {RegExp|string} SVG_SIZE
	 * @memberof PIXI.resources.SVGResource
	 * @example &lt;svg width="100" height="100"&gt;&lt;/svg&gt;
	 */
	SVGResource.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len

	/**
	 * Resource type for HTMLVideoElement.
	 * @class
	 * @extends PIXI.resources.BaseImageResource
	 * @memberof PIXI.resources
	 * @param {HTMLVideoElement|object|string|Array<string|object>} source - Video element to use.
	 * @param {object} [options] - Options to use
	 * @param {boolean} [options.autoLoad=true] - Start loading the video immediately
	 * @param {boolean} [options.autoPlay=true] - Start playing video immediately
	 * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.
	 * Leave at 0 to update at every render.
	 * @param {boolean} [options.crossorigin=true] - Load image using cross origin
	 */
	var VideoResource = /*@__PURE__*/(function (BaseImageResource) {
	    function VideoResource(source, options)
	    {
	        options = options || {};

	        if (!(source instanceof HTMLVideoElement))
	        {
	            var videoElement = document.createElement('video');

	            // workaround for https://github.com/pixijs/pixi.js/issues/5996
	            videoElement.setAttribute('preload', 'auto');
	            videoElement.setAttribute('webkit-playsinline', '');
	            videoElement.setAttribute('playsinline', '');

	            if (typeof source === 'string')
	            {
	                source = [source];
	            }

	            BaseImageResource.crossOrigin(videoElement, (source[0].src || source[0]), options.crossorigin);

	            // array of objects or strings
	            for (var i = 0; i < source.length; ++i)
	            {
	                var sourceElement = document.createElement('source');

	                var ref = source[i];
	                var src = ref.src;
	                var mime = ref.mime;

	                src = src || source[i];

	                var baseSrc = src.split('?').shift().toLowerCase();
	                var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);

	                mime = mime || ("video/" + ext);

	                sourceElement.src = src;
	                sourceElement.type = mime;

	                videoElement.appendChild(sourceElement);
	            }

	            // Override the source
	            source = videoElement;
	        }

	        BaseImageResource.call(this, source);

	        this.noSubImage = true;
	        this._autoUpdate = true;
	        this._isAutoUpdating = false;
	        this._updateFPS = options.updateFPS || 0;
	        this._msToNextUpdate = 0;

	        /**
	         * When set to true will automatically play videos used by this texture once
	         * they are loaded. If false, it will not modify the playing state.
	         *
	         * @member {boolean}
	         * @default true
	         */
	        this.autoPlay = options.autoPlay !== false;

	        /**
	         * Promise when loading
	         * @member {Promise<void>}
	         * @private
	         * @default null
	         */
	        this._load = null;

	        /**
	         * Callback when completed with load.
	         * @member {function}
	         * @private
	         */
	        this._resolve = null;

	        // Bind for listeners
	        this._onCanPlay = this._onCanPlay.bind(this);
	        this._onError = this._onError.bind(this);

	        if (options.autoLoad !== false)
	        {
	            this.load();
	        }
	    }

	    if ( BaseImageResource ) { VideoResource.__proto__ = BaseImageResource; }
	    VideoResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );
	    VideoResource.prototype.constructor = VideoResource;

	    var prototypeAccessors = { autoUpdate: { configurable: true },updateFPS: { configurable: true } };

	    /**
	     * Trigger updating of the texture
	     *
	     * @param {number} [deltaTime=0] - time delta since last tick
	     */
	    VideoResource.prototype.update = function update (deltaTime)
	    {
	        if ( deltaTime === void 0 ) { deltaTime = 0; }

	        if (!this.destroyed)
	        {
	            // account for if video has had its playbackRate changed
	            var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate;

	            this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);
	            if (!this._updateFPS || this._msToNextUpdate <= 0)
	            {
	                BaseImageResource.prototype.update.call(this, deltaTime);
	                this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;
	            }
	        }
	    };

	    /**
	     * Start preloading the video resource.
	     *
	     * @protected
	     * @return {Promise<void>} Handle the validate event
	     */
	    VideoResource.prototype.load = function load ()
	    {
	        var this$1 = this;

	        if (this._load)
	        {
	            return this._load;
	        }

	        var source = this.source;

	        if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)
	            && source.width && source.height)
	        {
	            source.complete = true;
	        }

	        source.addEventListener('play', this._onPlayStart.bind(this));
	        source.addEventListener('pause', this._onPlayStop.bind(this));

	        if (!this._isSourceReady())
	        {
	            source.addEventListener('canplay', this._onCanPlay);
	            source.addEventListener('canplaythrough', this._onCanPlay);
	            source.addEventListener('error', this._onError, true);
	        }
	        else
	        {
	            this._onCanPlay();
	        }

	        this._load = new Promise(function (resolve) {
	            if (this$1.valid)
	            {
	                resolve(this$1);
	            }
	            else
	            {
	                this$1._resolve = resolve;

	                source.load();
	            }
	        });

	        return this._load;
	    };

	    /**
	     * Handle video error events.
	     *
	     * @private
	     */
	    VideoResource.prototype._onError = function _onError ()
	    {
	        this.source.removeEventListener('error', this._onError, true);
	        this.onError.run(event);
	    };

	    /**
	     * Returns true if the underlying source is playing.
	     *
	     * @private
	     * @return {boolean} True if playing.
	     */
	    VideoResource.prototype._isSourcePlaying = function _isSourcePlaying ()
	    {
	        var source = this.source;

	        return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);
	    };

	    /**
	     * Returns true if the underlying source is ready for playing.
	     *
	     * @private
	     * @return {boolean} True if ready.
	     */
	    VideoResource.prototype._isSourceReady = function _isSourceReady ()
	    {
	        return this.source.readyState === 3 || this.source.readyState === 4;
	    };

	    /**
	     * Runs the update loop when the video is ready to play
	     *
	     * @private
	     */
	    VideoResource.prototype._onPlayStart = function _onPlayStart ()
	    {
	        // Just in case the video has not received its can play even yet..
	        if (!this.valid)
	        {
	            this._onCanPlay();
	        }

	        if (!this._isAutoUpdating && this.autoUpdate)
	        {
	            Ticker.shared.add(this.update, this);
	            this._isAutoUpdating = true;
	        }
	    };

	    /**
	     * Fired when a pause event is triggered, stops the update loop
	     *
	     * @private
	     */
	    VideoResource.prototype._onPlayStop = function _onPlayStop ()
	    {
	        if (this._isAutoUpdating)
	        {
	            Ticker.shared.remove(this.update, this);
	            this._isAutoUpdating = false;
	        }
	    };

	    /**
	     * Fired when the video is loaded and ready to play
	     *
	     * @private
	     */
	    VideoResource.prototype._onCanPlay = function _onCanPlay ()
	    {
	        var ref = this;
	        var source = ref.source;

	        source.removeEventListener('canplay', this._onCanPlay);
	        source.removeEventListener('canplaythrough', this._onCanPlay);

	        var valid = this.valid;

	        this.resize(source.videoWidth, source.videoHeight);

	        // prevent multiple loaded dispatches..
	        if (!valid && this._resolve)
	        {
	            this._resolve(this);
	            this._resolve = null;
	        }

	        if (this._isSourcePlaying())
	        {
	            this._onPlayStart();
	        }
	        else if (this.autoPlay)
	        {
	            source.play();
	        }
	    };

	    /**
	     * Destroys this texture
	     * @override
	     */
	    VideoResource.prototype.dispose = function dispose ()
	    {
	        if (this._isAutoUpdating)
	        {
	            Ticker.shared.remove(this.update, this);
	        }

	        if (this.source)
	        {
	            this.source.removeEventListener('error', this._onError, true);
	            this.source.pause();
	            this.source.src = '';
	            this.source.load();
	        }
	        BaseImageResource.prototype.dispose.call(this);
	    };

	    /**
	     * Should the base texture automatically update itself, set to true by default
	     *
	     * @member {boolean}
	     */
	    prototypeAccessors.autoUpdate.get = function ()
	    {
	        return this._autoUpdate;
	    };

	    prototypeAccessors.autoUpdate.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (value !== this._autoUpdate)
	        {
	            this._autoUpdate = value;

	            if (!this._autoUpdate && this._isAutoUpdating)
	            {
	                Ticker.shared.remove(this.update, this);
	                this._isAutoUpdating = false;
	            }
	            else if (this._autoUpdate && !this._isAutoUpdating)
	            {
	                Ticker.shared.add(this.update, this);
	                this._isAutoUpdating = true;
	            }
	        }
	    };

	    /**
	     * How many times a second to update the texture from the video. Leave at 0 to update at every render.
	     * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.updateFPS.get = function ()
	    {
	        return this._updateFPS;
	    };

	    prototypeAccessors.updateFPS.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (value !== this._updateFPS)
	        {
	            this._updateFPS = value;
	        }
	    };

	    /**
	     * Used to auto-detect the type of resource.
	     *
	     * @static
	     * @param {*} source - The source object
	     * @param {string} extension - The extension of source, if set
	     * @return {boolean} `true` if video source
	     */
	    VideoResource.test = function test (source, extension)
	    {
	        return (source instanceof HTMLVideoElement)
	            || VideoResource.TYPES.indexOf(extension) > -1;
	    };

	    Object.defineProperties( VideoResource.prototype, prototypeAccessors );

	    return VideoResource;
	}(BaseImageResource));

	/**
	 * List of common video file extensions supported by VideoResource.
	 * @constant
	 * @member {Array<string>}
	 * @static
	 * @readonly
	 */
	VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];

	/**
	 * Resource type for ImageBitmap.
	 * @class
	 * @extends PIXI.resources.BaseImageResource
	 * @memberof PIXI.resources
	 * @param {ImageBitmap} source - Image element to use
	 */
	var ImageBitmapResource = /*@__PURE__*/(function (BaseImageResource) {
	    function ImageBitmapResource () {
	        BaseImageResource.apply(this, arguments);
	    }

	    if ( BaseImageResource ) { ImageBitmapResource.__proto__ = BaseImageResource; }
	    ImageBitmapResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );
	    ImageBitmapResource.prototype.constructor = ImageBitmapResource;

	    ImageBitmapResource.test = function test (source)
	    {
	        return !!window.createImageBitmap && source instanceof ImageBitmap;
	    };

	    return ImageBitmapResource;
	}(BaseImageResource));

	INSTALLED.push(
	    ImageResource,
	    ImageBitmapResource,
	    CanvasResource,
	    VideoResource,
	    SVGResource,
	    BufferResource,
	    CubeResource,
	    ArrayResource
	);

	var index = ({
	    INSTALLED: INSTALLED,
	    autoDetectResource: autoDetectResource,
	    ArrayResource: ArrayResource,
	    BufferResource: BufferResource,
	    CanvasResource: CanvasResource,
	    CubeResource: CubeResource,
	    ImageResource: ImageResource,
	    ImageBitmapResource: ImageBitmapResource,
	    SVGResource: SVGResource,
	    VideoResource: VideoResource,
	    Resource: Resource,
	    BaseImageResource: BaseImageResource
	});

	/**
	 * System is a base class used for extending systems used by the {@link PIXI.Renderer}
	 *
	 * @see PIXI.Renderer#addSystem
	 * @class
	 * @memberof PIXI
	 */
	var System = function System(renderer)
	{
	    /**
	     * The renderer this manager works for.
	     *
	     * @member {PIXI.Renderer}
	     */
	    this.renderer = renderer;
	};

	/**
	 * Generic destroy methods to be overridden by the subclass
	 */
	System.prototype.destroy = function destroy ()
	{
	    this.renderer = null;
	};

	/**
	 * Resource type for DepthTexture.
	 * @class
	 * @extends PIXI.resources.BufferResource
	 * @memberof PIXI.resources
	 */
	var DepthResource = /*@__PURE__*/(function (BufferResource) {
	    function DepthResource () {
	        BufferResource.apply(this, arguments);
	    }

	    if ( BufferResource ) { DepthResource.__proto__ = BufferResource; }
	    DepthResource.prototype = Object.create( BufferResource && BufferResource.prototype );
	    DepthResource.prototype.constructor = DepthResource;

	    DepthResource.prototype.upload = function upload (renderer, baseTexture, glTexture)
	    {
	        var gl = renderer.gl;

	        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.premultiplyAlpha);

	        if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)
	        {
	            gl.texSubImage2D(
	                baseTexture.target,
	                0,
	                0,
	                0,
	                baseTexture.width,
	                baseTexture.height,
	                baseTexture.format,
	                baseTexture.type,
	                this.data
	            );
	        }
	        else
	        {
	            glTexture.width = baseTexture.width;
	            glTexture.height = baseTexture.height;

	            gl.texImage2D(
	                baseTexture.target,
	                0,
	                gl.DEPTH_COMPONENT16, // Needed for depth to render properly in webgl2.0
	                baseTexture.width,
	                baseTexture.height,
	                0,
	                baseTexture.format,
	                baseTexture.type,
	                this.data
	            );
	        }

	        return true;
	    };

	    return DepthResource;
	}(BufferResource));

	/**
	 * Frame buffer used by the BaseRenderTexture
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Framebuffer = function Framebuffer(width, height)
	{
	    this.width = Math.ceil(width || 100);
	    this.height = Math.ceil(height || 100);

	    this.stencil = false;
	    this.depth = false;

	    this.dirtyId = 0;
	    this.dirtyFormat = 0;
	    this.dirtySize = 0;

	    this.depthTexture = null;
	    this.colorTextures = [];

	    this.glFramebuffers = {};

	    this.disposeRunner = new Runner('disposeFramebuffer', 2);
	};

	var prototypeAccessors$1$2 = { colorTexture: { configurable: true } };

	/**
	 * Reference to the colorTexture.
	 *
	 * @member {PIXI.Texture[]}
	 * @readonly
	 */
	prototypeAccessors$1$2.colorTexture.get = function ()
	{
	    return this.colorTextures[0];
	};

	/**
	 * Add texture to the colorTexture array
	 *
	 * @param {number} [index=0] - Index of the array to add the texture to
	 * @param {PIXI.Texture} [texture] - Texture to add to the array
	 */
	Framebuffer.prototype.addColorTexture = function addColorTexture (index, texture)
	{
	        if ( index === void 0 ) { index = 0; }

	    // TODO add some validation to the texture - same width / height etc?
	    this.colorTextures[index] = texture || new BaseTexture(null, { scaleMode: 0,
	        resolution: 1,
	        mipmap: false,
	        width: this.width,
	        height: this.height });// || new Texture();

	    this.dirtyId++;
	    this.dirtyFormat++;

	    return this;
	};

	/**
	 * Add a depth texture to the frame buffer
	 *
	 * @param {PIXI.Texture} [texture] - Texture to add
	 */
	Framebuffer.prototype.addDepthTexture = function addDepthTexture (texture)
	{
	    /* eslint-disable max-len */
	    this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { scaleMode: 0,
	        resolution: 1,
	        width: this.width,
	        height: this.height,
	        mipmap: false,
	        format: FORMATS.DEPTH_COMPONENT,
	        type: TYPES.UNSIGNED_SHORT });// UNSIGNED_SHORT;
	    /* eslint-disable max-len */
	    this.dirtyId++;
	    this.dirtyFormat++;

	    return this;
	};

	/**
	 * Enable depth on the frame buffer
	 */
	Framebuffer.prototype.enableDepth = function enableDepth ()
	{
	    this.depth = true;

	    this.dirtyId++;
	    this.dirtyFormat++;

	    return this;
	};

	/**
	 * Enable stencil on the frame buffer
	 */
	Framebuffer.prototype.enableStencil = function enableStencil ()
	{
	    this.stencil = true;

	    this.dirtyId++;
	    this.dirtyFormat++;

	    return this;
	};

	/**
	 * Resize the frame buffer
	 *
	 * @param {number} width - Width of the frame buffer to resize to
	 * @param {number} height - Height of the frame buffer to resize to
	 */
	Framebuffer.prototype.resize = function resize (width, height)
	{
	    width = Math.ceil(width);
	    height = Math.ceil(height);

	    if (width === this.width && height === this.height) { return; }

	    this.width = width;
	    this.height = height;

	    this.dirtyId++;
	    this.dirtySize++;

	    for (var i = 0; i < this.colorTextures.length; i++)
	    {
	        var texture = this.colorTextures[i];
	        var resolution = texture.resolution;

	        // take into acount the fact the texture may have a different resolution..
	        texture.setSize(width / resolution, height / resolution);
	    }

	    if (this.depthTexture)
	    {
	        var resolution$1 = this.depthTexture.resolution;

	        this.depthTexture.setSize(width / resolution$1, height / resolution$1);
	    }
	};

	/**
	 * disposes WebGL resources that are connected to this geometry
	 */
	Framebuffer.prototype.dispose = function dispose ()
	{
	    this.disposeRunner.run(this, false);
	};

	Object.defineProperties( Framebuffer.prototype, prototypeAccessors$1$2 );

	/**
	 * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.
	 *
	 * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded
	 * otherwise black rectangles will be drawn instead.
	 *
	 * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position
	 * and rotation of the given Display Objects is ignored. For example:
	 *
	 * ```js
	 * let renderer = PIXI.autoDetectRenderer();
	 * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });
	 * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);
	 * let sprite = PIXI.Sprite.from("spinObj_01.png");
	 *
	 * sprite.position.x = 800/2;
	 * sprite.position.y = 600/2;
	 * sprite.anchor.x = 0.5;
	 * sprite.anchor.y = 0.5;
	 *
	 * renderer.render(sprite, renderTexture);
	 * ```
	 *
	 * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0
	 * you can clear the transform
	 *
	 * ```js
	 *
	 * sprite.setTransform()
	 *
	 * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });
	 * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);
	 *
	 * renderer.render(sprite, renderTexture);  // Renders to center of RenderTexture
	 * ```
	 *
	 * @class
	 * @extends PIXI.BaseTexture
	 * @memberof PIXI
	 */
	var BaseRenderTexture = /*@__PURE__*/(function (BaseTexture) {
	    function BaseRenderTexture(options)
	    {
	        if (typeof options === 'number')
	        {
	            /* eslint-disable prefer-rest-params */
	            // Backward compatibility of signature
	            var width$1 = arguments[0];
	            var height$1 = arguments[1];
	            var scaleMode = arguments[2];
	            var resolution = arguments[3];

	            options = { width: width$1, height: height$1, scaleMode: scaleMode, resolution: resolution };
	            /* eslint-enable prefer-rest-params */
	        }

	        BaseTexture.call(this, null, options);

	        var ref = options || {};
	        var width = ref.width;
	        var height = ref.height;

	        // Set defaults
	        this.mipmap = false;
	        this.width = Math.ceil(width) || 100;
	        this.height = Math.ceil(height) || 100;
	        this.valid = true;

	        /**
	         * A reference to the canvas render target (we only need one as this can be shared across renderers)
	         *
	         * @protected
	         * @member {object}
	         */
	        this._canvasRenderTarget = null;

	        this.clearColor = [0, 0, 0, 0];

	        this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)
	            .addColorTexture(0, this);

	        // TODO - could this be added the systems?

	        /**
	         * The data structure for the stencil masks.
	         *
	         * @member {PIXI.Graphics[]}
	         */
	        this.stencilMaskStack = [];

	        /**
	         * The data structure for the filters.
	         *
	         * @member {PIXI.Graphics[]}
	         */
	        this.filterStack = [{}];
	    }

	    if ( BaseTexture ) { BaseRenderTexture.__proto__ = BaseTexture; }
	    BaseRenderTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype );
	    BaseRenderTexture.prototype.constructor = BaseRenderTexture;

	    /**
	     * Resizes the BaseRenderTexture.
	     *
	     * @param {number} width - The width to resize to.
	     * @param {number} height - The height to resize to.
	     */
	    BaseRenderTexture.prototype.resize = function resize (width, height)
	    {
	        width = Math.ceil(width);
	        height = Math.ceil(height);
	        this.framebuffer.resize(width * this.resolution, height * this.resolution);
	    };

	    /**
	     * Frees the texture and framebuffer from WebGL memory without destroying this texture object.
	     * This means you can still use the texture later which will upload it to GPU
	     * memory again.
	     *
	     * @fires PIXI.BaseTexture#dispose
	     */
	    BaseRenderTexture.prototype.dispose = function dispose ()
	    {
	        this.framebuffer.dispose();

	        BaseTexture.prototype.dispose.call(this);
	    };

	    /**
	     * Destroys this texture.
	     *
	     */
	    BaseRenderTexture.prototype.destroy = function destroy ()
	    {
	        BaseTexture.prototype.destroy.call(this, true);

	        this.framebuffer = null;
	    };

	    return BaseRenderTexture;
	}(BaseTexture));

	/**
	 * Stores a texture's frame in UV coordinates, in
	 * which everything lies in the rectangle `[(0,0), (1,0),
	 * (1,1), (0,1)]`.
	 *
	 * | Corner       | Coordinates |
	 * |--------------|-------------|
	 * | Top-Left     | `(x0,y0)`   |
	 * | Top-Right    | `(x1,y1)`   |
	 * | Bottom-Right | `(x2,y2)`   |
	 * | Bottom-Left  | `(x3,y3)`   |
	 *
	 * @class
	 * @protected
	 * @memberof PIXI
	 */
	var TextureUvs = function TextureUvs()
	{
	    /**
	     * X-component of top-left corner `(x0,y0)`.
	     *
	     * @member {number}
	     */
	    this.x0 = 0;

	    /**
	     * Y-component of top-left corner `(x0,y0)`.
	     *
	     * @member {number}
	     */
	    this.y0 = 0;

	    /**
	     * X-component of top-right corner `(x1,y1)`.
	     *
	     * @member {number}
	     */
	    this.x1 = 1;

	    /**
	     * Y-component of top-right corner `(x1,y1)`.
	     *
	     * @member {number}
	     */
	    this.y1 = 0;

	    /**
	     * X-component of bottom-right corner `(x2,y2)`.
	     *
	     * @member {number}
	     */
	    this.x2 = 1;

	    /**
	     * Y-component of bottom-right corner `(x2,y2)`.
	     *
	     * @member {number}
	     */
	    this.y2 = 1;

	    /**
	     * X-component of bottom-left corner `(x3,y3)`.
	     *
	     * @member {number}
	     */
	    this.x3 = 0;

	    /**
	     * Y-component of bottom-right corner `(x3,y3)`.
	     *
	     * @member {number}
	     */
	    this.y3 = 1;

	    this.uvsFloat32 = new Float32Array(8);
	};

	/**
	 * Sets the texture Uvs based on the given frame information.
	 *
	 * @protected
	 * @param {PIXI.Rectangle} frame - The frame of the texture
	 * @param {PIXI.Rectangle} baseFrame - The base frame of the texture
	 * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8}
	 */
	TextureUvs.prototype.set = function set (frame, baseFrame, rotate)
	{
	    var tw = baseFrame.width;
	    var th = baseFrame.height;

	    if (rotate)
	    {
	        // width and height div 2 div baseFrame size
	        var w2 = frame.width / 2 / tw;
	        var h2 = frame.height / 2 / th;

	        // coordinates of center
	        var cX = (frame.x / tw) + w2;
	        var cY = (frame.y / th) + h2;

	        rotate = GroupD8.add(rotate, GroupD8.NW); // NW is top-left corner
	        this.x0 = cX + (w2 * GroupD8.uX(rotate));
	        this.y0 = cY + (h2 * GroupD8.uY(rotate));

	        rotate = GroupD8.add(rotate, 2); // rotate 90 degrees clockwise
	        this.x1 = cX + (w2 * GroupD8.uX(rotate));
	        this.y1 = cY + (h2 * GroupD8.uY(rotate));

	        rotate = GroupD8.add(rotate, 2);
	        this.x2 = cX + (w2 * GroupD8.uX(rotate));
	        this.y2 = cY + (h2 * GroupD8.uY(rotate));

	        rotate = GroupD8.add(rotate, 2);
	        this.x3 = cX + (w2 * GroupD8.uX(rotate));
	        this.y3 = cY + (h2 * GroupD8.uY(rotate));
	    }
	    else
	    {
	        this.x0 = frame.x / tw;
	        this.y0 = frame.y / th;

	        this.x1 = (frame.x + frame.width) / tw;
	        this.y1 = frame.y / th;

	        this.x2 = (frame.x + frame.width) / tw;
	        this.y2 = (frame.y + frame.height) / th;

	        this.x3 = frame.x / tw;
	        this.y3 = (frame.y + frame.height) / th;
	    }

	    this.uvsFloat32[0] = this.x0;
	    this.uvsFloat32[1] = this.y0;
	    this.uvsFloat32[2] = this.x1;
	    this.uvsFloat32[3] = this.y1;
	    this.uvsFloat32[4] = this.x2;
	    this.uvsFloat32[5] = this.y2;
	    this.uvsFloat32[6] = this.x3;
	    this.uvsFloat32[7] = this.y3;
	};

	var DEFAULT_UVS = new TextureUvs();

	/**
	 * A texture stores the information that represents an image or part of an image.
	 *
	 * It cannot be added to the display list directly; instead use it as the texture for a Sprite.
	 * If no frame is provided for a texture, then the whole image is used.
	 *
	 * You can directly create a texture from an image and then reuse it multiple times like this :
	 *
	 * ```js
	 * let texture = PIXI.Texture.from('assets/image.png');
	 * let sprite1 = new PIXI.Sprite(texture);
	 * let sprite2 = new PIXI.Sprite(texture);
	 * ```
	 *
	 * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:
	 * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.
	 *
	 * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.
	 * You can check for this by checking the sprite's _textureID property.
	 * ```js
	 * var texture = PIXI.Texture.from('assets/image.svg');
	 * var sprite1 = new PIXI.Sprite(texture);
	 * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file
	 * ```
	 * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.
	 *
	 * @class
	 * @extends PIXI.utils.EventEmitter
	 * @memberof PIXI
	 */
	var Texture = /*@__PURE__*/(function (EventEmitter) {
	    function Texture(baseTexture, frame, orig, trim, rotate, anchor)
	    {
	        EventEmitter.call(this);

	        /**
	         * Does this Texture have any frame data assigned to it?
	         *
	         * This mode is enabled automatically if no frame was passed inside constructor.
	         *
	         * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.
	         *
	         * Beware, after loading or resize of baseTexture event can fired two times!
	         * If you want more control, subscribe on baseTexture itself.
	         *
	         * ```js
	         * texture.on('update', () => {});
	         * ```
	         *
	         * Any assignment of `frame` switches off `noFrame` mode.
	         *
	         * @member {boolean}
	         */
	        this.noFrame = false;

	        if (!frame)
	        {
	            this.noFrame = true;
	            frame = new Rectangle(0, 0, 1, 1);
	        }

	        if (baseTexture instanceof Texture)
	        {
	            baseTexture = baseTexture.baseTexture;
	        }

	        /**
	         * The base texture that this texture uses.
	         *
	         * @member {PIXI.BaseTexture}
	         */
	        this.baseTexture = baseTexture;

	        /**
	         * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,
	         * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)
	         *
	         * @member {PIXI.Rectangle}
	         */
	        this._frame = frame;

	        /**
	         * This is the trimmed area of original texture, before it was put in atlas
	         * Please call `updateUvs()` after you change coordinates of `trim` manually.
	         *
	         * @member {PIXI.Rectangle}
	         */
	        this.trim = trim;

	        /**
	         * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
	         *
	         * @member {boolean}
	         */
	        this.valid = false;

	        /**
	         * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates)
	         *
	         * @member {boolean}
	         */
	        this.requiresUpdate = false;

	        /**
	         * The WebGL UV data cache. Can be used as quad UV
	         *
	         * @member {PIXI.TextureUvs}
	         * @protected
	         */
	        this._uvs = DEFAULT_UVS;

	        /**
	         * Default TextureMatrix instance for this texture
	         * By default that object is not created because its heavy
	         *
	         * @member {PIXI.TextureMatrix}
	         */
	        this.uvMatrix = null;

	        /**
	         * This is the area of original texture, before it was put in atlas
	         *
	         * @member {PIXI.Rectangle}
	         */
	        this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);

	        this._rotate = Number(rotate || 0);

	        if (rotate === true)
	        {
	            // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures
	            this._rotate = 2;
	        }
	        else if (this._rotate % 2 !== 0)
	        {
	            throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');
	        }

	        /**
	         * Anchor point that is used as default if sprite is created with this texture.
	         * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.
	         * @member {PIXI.Point}
	         * @default {0,0}
	         */
	        this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);

	        /**
	         * Update ID is observed by sprites and TextureMatrix instances.
	         * Call updateUvs() to increment it.
	         *
	         * @member {number}
	         * @protected
	         */

	        this._updateID = 0;

	        /**
	         * The ids under which this Texture has been added to the texture cache. This is
	         * automatically set as long as Texture.addToCache is used, but may not be set if a
	         * Texture is added directly to the TextureCache array.
	         *
	         * @member {string[]}
	         */
	        this.textureCacheIds = [];

	        if (!baseTexture.valid)
	        {
	            baseTexture.once('loaded', this.onBaseTextureUpdated, this);
	        }
	        else if (this.noFrame)
	        {
	            // if there is no frame we should monitor for any base texture changes..
	            if (baseTexture.valid)
	            {
	                this.onBaseTextureUpdated(baseTexture);
	            }
	        }
	        else
	        {
	            this.frame = frame;
	        }

	        if (this.noFrame)
	        {
	            baseTexture.on('update', this.onBaseTextureUpdated, this);
	        }
	    }

	    if ( EventEmitter ) { Texture.__proto__ = EventEmitter; }
	    Texture.prototype = Object.create( EventEmitter && EventEmitter.prototype );
	    Texture.prototype.constructor = Texture;

	    var prototypeAccessors = { resolution: { configurable: true },frame: { configurable: true },rotate: { configurable: true },width: { configurable: true },height: { configurable: true } };

	    /**
	     * Updates this texture on the gpu.
	     *
	     * Calls the TextureResource update.
	     *
	     * If you adjusted `frame` manually, please call `updateUvs()` instead.
	     *
	     */
	    Texture.prototype.update = function update ()
	    {
	        if (this.baseTexture.resource)
	        {
	            this.baseTexture.resource.update();
	        }
	    };

	    /**
	     * Called when the base texture is updated
	     *
	     * @protected
	     * @param {PIXI.BaseTexture} baseTexture - The base texture.
	     */
	    Texture.prototype.onBaseTextureUpdated = function onBaseTextureUpdated (baseTexture)
	    {
	        if (this.noFrame)
	        {
	            if (!this.baseTexture.valid)
	            {
	                return;
	            }

	            this._frame.width = baseTexture.width;
	            this._frame.height = baseTexture.height;
	            this.valid = true;
	            this.updateUvs();
	        }
	        else
	        {
	            // TODO this code looks confusing.. boo to abusing getters and setters!
	            // if user gave us frame that has bigger size than resized texture it can be a problem
	            this.frame = this._frame;
	        }

	        this.emit('update', this);
	    };

	    /**
	     * Destroys this texture
	     *
	     * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well
	     */
	    Texture.prototype.destroy = function destroy (destroyBase)
	    {
	        if (this.baseTexture)
	        {
	            if (destroyBase)
	            {
	                var ref = this.baseTexture;
	                var resource = ref.resource;

	                // delete the texture if it exists in the texture cache..
	                // this only needs to be removed if the base texture is actually destroyed too..
	                if (resource && TextureCache[resource.url])
	                {
	                    Texture.removeFromCache(resource.url);
	                }

	                this.baseTexture.destroy();
	            }

	            this.baseTexture.off('update', this.onBaseTextureUpdated, this);

	            this.baseTexture = null;
	        }

	        this._frame = null;
	        this._uvs = null;
	        this.trim = null;
	        this.orig = null;

	        this.valid = false;

	        Texture.removeFromCache(this);
	        this.textureCacheIds = null;
	    };

	    /**
	     * Creates a new texture object that acts the same as this one.
	     *
	     * @return {PIXI.Texture} The new texture
	     */
	    Texture.prototype.clone = function clone ()
	    {
	        return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor);
	    };

	    /**
	     * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.
	     * Call it after changing the frame
	     */
	    Texture.prototype.updateUvs = function updateUvs ()
	    {
	        if (this._uvs === DEFAULT_UVS)
	        {
	            this._uvs = new TextureUvs();
	        }

	        this._uvs.set(this._frame, this.baseTexture, this.rotate);

	        this._updateID++;
	    };

	    /**
	     * Helper function that creates a new Texture based on the source you provide.
	     * The source can be - frame id, image url, video url, canvas element, video element, base texture
	     *
	     * @static
	     * @param {number|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source
	     *        Source to create texture from
	     * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.
	     * @return {PIXI.Texture} The newly created texture
	     */
	    Texture.from = function from (source, options)
	    {
	        if ( options === void 0 ) { options = {}; }

	        var cacheId = null;

	        if (typeof source === 'string')
	        {
	            cacheId = source;
	        }
	        else
	        {
	            if (!source._pixiId)
	            {
	                source._pixiId = "pixiid_" + (uid());
	            }

	            cacheId = source._pixiId;
	        }

	        var texture = TextureCache[cacheId];

	        if (!texture)
	        {
	            if (!options.resolution)
	            {
	                options.resolution = getResolutionOfUrl(source);
	            }

	            texture = new Texture(new BaseTexture(source, options));
	            texture.baseTexture.cacheId = cacheId;

	            BaseTexture.addToCache(texture.baseTexture, cacheId);
	            Texture.addToCache(texture, cacheId);
	        }

	        // lets assume its a base texture!
	        return texture;
	    };

	    /**
	     * Create a new Texture with a BufferResource from a Float32Array.
	     * RGBA values are floats from 0 to 1.
	     * @static
	     * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data
	     *        is provided, a new Float32Array is created.
	     * @param {number} width - Width of the resource
	     * @param {number} height - Height of the resource
	     * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.
	     * @return {PIXI.Texture} The resulting new BaseTexture
	     */
	    Texture.fromBuffer = function fromBuffer (buffer, width, height, options)
	    {
	        return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));
	    };

	    /**
	     * Create a texture from a source and add to the cache.
	     *
	     * @static
	     * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.
	     * @param {String} imageUrl - File name of texture, for cache and resolving resolution.
	     * @param {String} [name] - Human readable name for the texture cache. If no name is
	     *        specified, only `imageUrl` will be used as the cache ID.
	     * @return {PIXI.Texture} Output texture
	     */
	    Texture.fromLoader = function fromLoader (source, imageUrl, name)
	    {
	        var resource = new ImageResource(source);

	        resource.url = imageUrl;

	        var baseTexture = new BaseTexture(resource, {
	            scaleMode: settings.SCALE_MODE,
	            resolution: getResolutionOfUrl(imageUrl),
	        });

	        var texture = new Texture(baseTexture);

	        // No name, use imageUrl instead
	        if (!name)
	        {
	            name = imageUrl;
	        }

	        // lets also add the frame to pixi's global cache for 'fromLoader' function
	        BaseTexture.addToCache(texture.baseTexture, name);
	        Texture.addToCache(texture, name);

	        // also add references by url if they are different.
	        if (name !== imageUrl)
	        {
	            BaseTexture.addToCache(texture.baseTexture, imageUrl);
	            Texture.addToCache(texture, imageUrl);
	        }

	        return texture;
	    };

	    /**
	     * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.
	     *
	     * @static
	     * @param {PIXI.Texture} texture - The Texture to add to the cache.
	     * @param {string} id - The id that the Texture will be stored against.
	     */
	    Texture.addToCache = function addToCache (texture, id)
	    {
	        if (id)
	        {
	            if (texture.textureCacheIds.indexOf(id) === -1)
	            {
	                texture.textureCacheIds.push(id);
	            }

	            if (TextureCache[id])
	            {
	                // eslint-disable-next-line no-console
	                console.warn(("Texture added to the cache with an id [" + id + "] that already had an entry"));
	            }

	            TextureCache[id] = texture;
	        }
	    };

	    /**
	     * Remove a Texture from the global TextureCache.
	     *
	     * @static
	     * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself
	     * @return {PIXI.Texture|null} The Texture that was removed
	     */
	    Texture.removeFromCache = function removeFromCache (texture)
	    {
	        if (typeof texture === 'string')
	        {
	            var textureFromCache = TextureCache[texture];

	            if (textureFromCache)
	            {
	                var index = textureFromCache.textureCacheIds.indexOf(texture);

	                if (index > -1)
	                {
	                    textureFromCache.textureCacheIds.splice(index, 1);
	                }

	                delete TextureCache[texture];

	                return textureFromCache;
	            }
	        }
	        else if (texture && texture.textureCacheIds)
	        {
	            for (var i = 0; i < texture.textureCacheIds.length; ++i)
	            {
	                // Check that texture matches the one being passed in before deleting it from the cache.
	                if (TextureCache[texture.textureCacheIds[i]] === texture)
	                {
	                    delete TextureCache[texture.textureCacheIds[i]];
	                }
	            }

	            texture.textureCacheIds.length = 0;

	            return texture;
	        }

	        return null;
	    };

	    /**
	     * Returns resolution of baseTexture
	     *
	     * @member {number}
	     * @readonly
	     */
	    prototypeAccessors.resolution.get = function ()
	    {
	        return this.baseTexture.resolution;
	    };

	    /**
	     * The frame specifies the region of the base texture that this texture uses.
	     * Please call `updateUvs()` after you change coordinates of `frame` manually.
	     *
	     * @member {PIXI.Rectangle}
	     */
	    prototypeAccessors.frame.get = function ()
	    {
	        return this._frame;
	    };

	    prototypeAccessors.frame.set = function (frame) // eslint-disable-line require-jsdoc
	    {
	        this._frame = frame;

	        this.noFrame = false;

	        var x = frame.x;
	        var y = frame.y;
	        var width = frame.width;
	        var height = frame.height;
	        var xNotFit = x + width > this.baseTexture.width;
	        var yNotFit = y + height > this.baseTexture.height;

	        if (xNotFit || yNotFit)
	        {
	            var relationship = xNotFit && yNotFit ? 'and' : 'or';
	            var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + (this.baseTexture.width);
	            var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + (this.baseTexture.height);

	            throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '
	                + errorX + " " + relationship + " " + errorY);
	        }

	        this.valid = width && height && this.baseTexture.valid;

	        if (!this.trim && !this.rotate)
	        {
	            this.orig = frame;
	        }

	        if (this.valid)
	        {
	            this.updateUvs();
	        }
	    };

	    /**
	     * Indicates whether the texture is rotated inside the atlas
	     * set to 2 to compensate for texture packer rotation
	     * set to 6 to compensate for spine packer rotation
	     * can be used to rotate or mirror sprites
	     * See {@link PIXI.GroupD8} for explanation
	     *
	     * @member {number}
	     */
	    prototypeAccessors.rotate.get = function ()
	    {
	        return this._rotate;
	    };

	    prototypeAccessors.rotate.set = function (rotate) // eslint-disable-line require-jsdoc
	    {
	        this._rotate = rotate;
	        if (this.valid)
	        {
	            this.updateUvs();
	        }
	    };

	    /**
	     * The width of the Texture in pixels.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return this.orig.width;
	    };

	    /**
	     * The height of the Texture in pixels.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return this.orig.height;
	    };

	    Object.defineProperties( Texture.prototype, prototypeAccessors );

	    return Texture;
	}(eventemitter3));

	function createWhiteTexture()
	{
	    var canvas = document.createElement('canvas');

	    canvas.width = 16;
	    canvas.height = 16;

	    var context = canvas.getContext('2d');

	    context.fillStyle = 'white';
	    context.fillRect(0, 0, 16, 16);

	    return new Texture(new BaseTexture(new CanvasResource(canvas)));
	}

	function removeAllHandlers(tex)
	{
	    tex.destroy = function _emptyDestroy() { /* empty */ };
	    tex.on = function _emptyOn() { /* empty */ };
	    tex.once = function _emptyOnce() { /* empty */ };
	    tex.emit = function _emptyEmit() { /* empty */ };
	}

	/**
	 * An empty texture, used often to not have to create multiple empty textures.
	 * Can not be destroyed.
	 *
	 * @static
	 * @constant
	 * @member {PIXI.Texture}
	 */
	Texture.EMPTY = new Texture(new BaseTexture());
	removeAllHandlers(Texture.EMPTY);
	removeAllHandlers(Texture.EMPTY.baseTexture);

	/**
	 * A white texture of 16x16 size, used for graphics and other things
	 * Can not be destroyed.
	 *
	 * @static
	 * @constant
	 * @member {PIXI.Texture}
	 */
	Texture.WHITE = createWhiteTexture();
	removeAllHandlers(Texture.WHITE);
	removeAllHandlers(Texture.WHITE.baseTexture);

	/**
	 * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.
	 *
	 * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded
	 * otherwise black rectangles will be drawn instead.
	 *
	 * __Hint-2__: The actual memory allocation will happen on first render.
	 * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.
	 *
	 * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:
	 *
	 * ```js
	 * let renderer = PIXI.autoDetectRenderer();
	 * let renderTexture = PIXI.RenderTexture.create(800, 600);
	 * let sprite = PIXI.Sprite.from("spinObj_01.png");
	 *
	 * sprite.position.x = 800/2;
	 * sprite.position.y = 600/2;
	 * sprite.anchor.x = 0.5;
	 * sprite.anchor.y = 0.5;
	 *
	 * renderer.render(sprite, renderTexture);
	 * ```
	 *
	 * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0
	 * you can clear the transform
	 *
	 * ```js
	 *
	 * sprite.setTransform()
	 *
	 * let renderTexture = new PIXI.RenderTexture.create(100, 100);
	 *
	 * renderer.render(sprite, renderTexture);  // Renders to center of RenderTexture
	 * ```
	 *
	 * @class
	 * @extends PIXI.Texture
	 * @memberof PIXI
	 */
	var RenderTexture = /*@__PURE__*/(function (Texture) {
	    function RenderTexture(baseRenderTexture, frame)
	    {
	        // support for legacy..
	        var _legacyRenderer = null;

	        if (!(baseRenderTexture instanceof BaseRenderTexture))
	        {
	            /* eslint-disable prefer-rest-params, no-console */
	            var width = arguments[1];
	            var height = arguments[2];
	            var scaleMode = arguments[3];
	            var resolution = arguments[4];

	            // we have an old render texture..
	            console.warn(("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly."));
	            _legacyRenderer = arguments[0];
	            /* eslint-enable prefer-rest-params, no-console */

	            frame = null;
	            baseRenderTexture = new BaseRenderTexture({
	                width: width,
	                height: height,
	                scaleMode: scaleMode,
	                resolution: resolution,
	            });
	        }

	        /**
	         * The base texture object that this texture uses
	         *
	         * @member {PIXI.BaseTexture}
	         */
	        Texture.call(this, baseRenderTexture, frame);

	        this.legacyRenderer = _legacyRenderer;

	        /**
	         * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
	         *
	         * @member {boolean}
	         */
	        this.valid = true;

	        /**
	         * Stores `sourceFrame` when this texture is inside current filter stack.
	         * You can read it inside filters.
	         *
	         * @readonly
	         * @member {PIXI.Rectangle}
	         */
	        this.filterFrame = null;

	        /**
	         * The key for pooled texture of FilterSystem
	         * @protected
	         * @member {string}
	         */
	        this.filterPoolKey = null;

	        this.updateUvs();
	    }

	    if ( Texture ) { RenderTexture.__proto__ = Texture; }
	    RenderTexture.prototype = Object.create( Texture && Texture.prototype );
	    RenderTexture.prototype.constructor = RenderTexture;

	    /**
	     * Resizes the RenderTexture.
	     *
	     * @param {number} width - The width to resize to.
	     * @param {number} height - The height to resize to.
	     * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?
	     */
	    RenderTexture.prototype.resize = function resize (width, height, resizeBaseTexture)
	    {
	        if ( resizeBaseTexture === void 0 ) { resizeBaseTexture = true; }

	        width = Math.ceil(width);
	        height = Math.ceil(height);

	        // TODO - could be not required..
	        this.valid = (width > 0 && height > 0);

	        this._frame.width = this.orig.width = width;
	        this._frame.height = this.orig.height = height;

	        if (resizeBaseTexture)
	        {
	            this.baseTexture.resize(width, height);
	        }

	        this.updateUvs();
	    };

	    /**
	     * Changes the resolution of baseTexture, but does not change framebuffer size.
	     *
	     * @param {number} resolution - The new resolution to apply to RenderTexture
	     */
	    RenderTexture.prototype.setResolution = function setResolution (resolution)
	    {
	        var ref = this;
	        var baseTexture = ref.baseTexture;

	        if (baseTexture.resolution === resolution)
	        {
	            return;
	        }

	        baseTexture.setResolution(resolution);
	        this.resize(baseTexture.width, baseTexture.height, false);
	    };

	    /**
	     * A short hand way of creating a render texture.
	     *
	     * @param {object} [options] - Options
	     * @param {number} [options.width=100] - The width of the render texture
	     * @param {number} [options.height=100] - The height of the render texture
	     * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values
	     * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated
	     * @return {PIXI.RenderTexture} The new render texture
	     */
	    RenderTexture.create = function create (options)
	    {
	        // fallback, old-style: create(width, height, scaleMode, resolution)
	        if (typeof options === 'number')
	        {
	            /* eslint-disable prefer-rest-params */
	            options = {
	                width: options,
	                height: arguments[1],
	                scaleMode: arguments[2],
	                resolution: arguments[3],
	            };
	            /* eslint-enable prefer-rest-params */
	        }

	        return new RenderTexture(new BaseRenderTexture(options));
	    };

	    return RenderTexture;
	}(Texture));

	/**
	 * Experimental!
	 *
	 * Texture pool, used by FilterSystem and plugins
	 * Stores collection of temporary pow2 or screen-sized renderTextures
	 *
	 * If you use custom RenderTexturePool for your filters, you can use methods
	 * `getFilterTexture` and `returnFilterTexture` same as in
	 *
	 * @class
	 * @memberof PIXI
	 */
	var RenderTexturePool = function RenderTexturePool(textureOptions)
	{
	    this.texturePool = {};
	    this.textureOptions = textureOptions || {};
	    /**
	     * Allow renderTextures of the same size as screen, not just pow2
	     *
	     * Automatically sets to true after `setScreenSize`
	     *
	     * @member {boolean}
	     * @default false
	     */
	    this.enableFullScreen = false;

	    this._pixelsWidth = 0;
	    this._pixelsHeight = 0;
	};

	/**
	 * creates of texture with params that were specified in pool constructor
	 *
	 * @param {number} realWidth width of texture in pixels
	 * @param {number} realHeight height of texture in pixels
	 * @returns {RenderTexture}
	 */
	RenderTexturePool.prototype.createTexture = function createTexture (realWidth, realHeight)
	{
	    var baseRenderTexture = new BaseRenderTexture(Object.assign({
	        width: realWidth,
	        height: realHeight,
	        resolution: 1,
	    }, this.textureOptions));

	    return new RenderTexture(baseRenderTexture);
	};

	/**
	 * Gets a Power-of-Two render texture or fullScreen texture
	 *
	 * @protected
	 * @param {number} minWidth - The minimum width of the render texture in real pixels.
	 * @param {number} minHeight - The minimum height of the render texture in real pixels.
	 * @param {number} [resolution=1] - The resolution of the render texture.
	 * @return {PIXI.RenderTexture} The new render texture.
	 */
	RenderTexturePool.prototype.getOptimalTexture = function getOptimalTexture (minWidth, minHeight, resolution)
	{
	        if ( resolution === void 0 ) { resolution = 1; }

	    var key = RenderTexturePool.SCREEN_KEY;

	    minWidth *= resolution;
	    minHeight *= resolution;

	    if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)
	    {
	        minWidth = nextPow2(minWidth);
	        minHeight = nextPow2(minHeight);
	        key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);
	    }

	    if (!this.texturePool[key])
	    {
	        this.texturePool[key] = [];
	    }

	    var renderTexture = this.texturePool[key].pop();

	    if (!renderTexture)
	    {
	        renderTexture = this.createTexture(minWidth, minHeight);
	    }

	    renderTexture.filterPoolKey = key;
	    renderTexture.setResolution(resolution);

	    return renderTexture;
	};

	/**
	 * Gets extra texture of the same size as input renderTexture
	 *
	 * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`
	 *
	 * @param {PIXI.RenderTexture} input renderTexture from which size and resolution will be copied
	 * @param {number} [resolution] override resolution of the renderTexture
	 *  It overrides, it does not multiply
	 * @returns {PIXI.RenderTexture}
	 */
	RenderTexturePool.prototype.getFilterTexture = function getFilterTexture (input, resolution)
	{
	    var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);

	    filterTexture.filterFrame = input.filterFrame;

	    return filterTexture;
	};

	/**
	 * Place a render texture back into the pool.
	 * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free
	 */
	RenderTexturePool.prototype.returnTexture = function returnTexture (renderTexture)
	{
	    var key = renderTexture.filterPoolKey;

	    renderTexture.filterFrame = null;
	    this.texturePool[key].push(renderTexture);
	};

	/**
	 * Alias for returnTexture, to be compliant with FilterSystem interface
	 * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free
	 */
	RenderTexturePool.prototype.returnFilterTexture = function returnFilterTexture (renderTexture)
	{
	    this.returnTexture(renderTexture);
	};

	/**
	 * Clears the pool
	 *
	 * @param {boolean} [destroyTextures=true] destroy all stored textures
	 */
	RenderTexturePool.prototype.clear = function clear (destroyTextures)
	{
	    destroyTextures = destroyTextures !== false;
	    if (destroyTextures)
	    {
	        for (var i in this.texturePool)
	        {
	            var textures = this.texturePool[i];

	            if (textures)
	            {
	                for (var j = 0; j < textures.length; j++)
	                {
	                    textures[j].destroy(true);
	                }
	            }
	        }
	    }

	    this.texturePool = {};
	};

	/**
	 * If screen size was changed, drops all screen-sized textures,
	 * sets new screen size, sets `enableFullScreen` to true
	 *
	 * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`
	 *
	 * @param {PIXI.ISize} size - Initial size of screen
	 */
	RenderTexturePool.prototype.setScreenSize = function setScreenSize (size)
	{
	    if (size.width === this._pixelsWidth
	        && size.height === this._pixelsHeight)
	    {
	        return;
	    }

	    var screenKey = RenderTexturePool.SCREEN_KEY;
	    var textures = this.texturePool[screenKey];

	    this.enableFullScreen = size.width > 0 && size.height > 0;

	    if (textures)
	    {
	        for (var j = 0; j < textures.length; j++)
	        {
	            textures[j].destroy(true);
	        }
	    }
	    this.texturePool[screenKey] = [];

	    this._pixelsWidth = size.width;
	    this._pixelsHeight = size.height;
	};

	/**
	 * Key that is used to store fullscreen renderTextures in a pool
	 *
	 * @static
	 * @const {string}
	 */
	RenderTexturePool.SCREEN_KEY = 'screen';

	/* eslint-disable max-len */

	/**
	 * Holds the information for a single attribute structure required to render geometry.
	 *
	 * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}
	 * This can include anything from positions, uvs, normals, colors etc.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Attribute = function Attribute(buffer, size, normalized, type, stride, start, instance)
	{
	    if ( normalized === void 0 ) { normalized = false; }
	    if ( type === void 0 ) { type = 5126; }

	    this.buffer = buffer;
	    this.size = size;
	    this.normalized = normalized;
	    this.type = type;
	    this.stride = stride;
	    this.start = start;
	    this.instance = instance;
	};

	/**
	 * Destroys the Attribute.
	 */
	Attribute.prototype.destroy = function destroy ()
	{
	    this.buffer = null;
	};

	/**
	 * Helper function that creates an Attribute based on the information provided
	 *
	 * @static
	 * @param {string} buffer  the id of the buffer that this attribute will look for
	 * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2
	 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data)
	 * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data)
	 * @param {Boolean} [normalized=false] should the data be normalized.
	 *
	 * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided
	 */
	Attribute.from = function from (buffer, size, normalized, type, stride)
	{
	    return new Attribute(buffer, size, normalized, type, stride);
	};

	var UID = 0;
	/* eslint-disable max-len */

	/**
	 * A wrapper for data so that it can be used and uploaded by WebGL
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Buffer = function Buffer(data, _static, index)
	{
	    if ( _static === void 0 ) { _static = true; }
	    if ( index === void 0 ) { index = false; }

	    /**
	     * The data in the buffer, as a typed array
	     *
	     * @member {ArrayBuffer| SharedArrayBuffer|ArrayBufferView}
	     */
	    this.data = data || new Float32Array(1);

	    /**
	     * A map of renderer IDs to webgl buffer
	     *
	     * @private
	     * @member {object<number, GLBuffer>}
	     */
	    this._glBuffers = {};

	    this._updateID = 0;

	    this.index = index;

	    this.static = _static;

	    this.id = UID++;

	    this.disposeRunner = new Runner('disposeBuffer', 2);
	};

	// TODO could explore flagging only a partial upload?
	/**
	 * flags this buffer as requiring an upload to the GPU
	 * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] the data to update in the buffer.
	 */
	Buffer.prototype.update = function update (data)
	{
	    this.data = data || this.data;
	    this._updateID++;
	};

	/**
	 * disposes WebGL resources that are connected to this geometry
	 */
	Buffer.prototype.dispose = function dispose ()
	{
	    this.disposeRunner.run(this, false);
	};

	/**
	 * Destroys the buffer
	 */
	Buffer.prototype.destroy = function destroy ()
	{
	    this.dispose();

	    this.data = null;
	};

	/**
	 * Helper function that creates a buffer based on an array or TypedArray
	 *
	 * @static
	 * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.
	 * @return {PIXI.Buffer} A new Buffer based on the data provided.
	 */
	Buffer.from = function from (data)
	{
	    if (data instanceof Array)
	    {
	        data = new Float32Array(data);
	    }

	    return new Buffer(data);
	};

	function getBufferType(array)
	{
	    if (array.BYTES_PER_ELEMENT === 4)
	    {
	        if (array instanceof Float32Array)
	        {
	            return 'Float32Array';
	        }
	        else if (array instanceof Uint32Array)
	        {
	            return 'Uint32Array';
	        }

	        return 'Int32Array';
	    }
	    else if (array.BYTES_PER_ELEMENT === 2)
	    {
	        if (array instanceof Uint16Array)
	        {
	            return 'Uint16Array';
	        }
	    }
	    else if (array.BYTES_PER_ELEMENT === 1)
	    {
	        if (array instanceof Uint8Array)
	        {
	            return 'Uint8Array';
	        }
	    }

	    // TODO map out the rest of the array elements!
	    return null;
	}

	/* eslint-disable object-shorthand */
	var map = {
	    Float32Array: Float32Array,
	    Uint32Array: Uint32Array,
	    Int32Array: Int32Array,
	    Uint8Array: Uint8Array,
	};

	function interleaveTypedArrays(arrays, sizes)
	{
	    var outSize = 0;
	    var stride = 0;
	    var views = {};

	    for (var i = 0; i < arrays.length; i++)
	    {
	        stride += sizes[i];
	        outSize += arrays[i].length;
	    }

	    var buffer = new ArrayBuffer(outSize * 4);

	    var out = null;
	    var littleOffset = 0;

	    for (var i$1 = 0; i$1 < arrays.length; i$1++)
	    {
	        var size = sizes[i$1];
	        var array = arrays[i$1];

	        var type = getBufferType(array);

	        if (!views[type])
	        {
	            views[type] = new map[type](buffer);
	        }

	        out = views[type];

	        for (var j = 0; j < array.length; j++)
	        {
	            var indexStart = ((j / size | 0) * stride) + littleOffset;
	            var index = j % size;

	            out[indexStart + index] = array[j];
	        }

	        littleOffset += size;
	    }

	    return new Float32Array(buffer);
	}

	var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 };
	var UID$1 = 0;

	/* eslint-disable object-shorthand */
	var map$1 = {
	    Float32Array: Float32Array,
	    Uint32Array: Uint32Array,
	    Int32Array: Int32Array,
	    Uint8Array: Uint8Array,
	    Uint16Array: Uint16Array,
	};

	/* eslint-disable max-len */

	/**
	 * The Geometry represents a model. It consists of two components:
	 * - GeometryStyle - The structure of the model such as the attributes layout
	 * - GeometryData - the data of the model - this consists of buffers.
	 * This can include anything from positions, uvs, normals, colors etc.
	 *
	 * Geometry can be defined without passing in a style or data if required (thats how I prefer!)
	 *
	 * ```js
	 * let geometry = new PIXI.Geometry();
	 *
	 * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);
	 * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)
	 * geometry.addIndex([0,1,2,1,3,2])
	 *
	 * ```
	 * @class
	 * @memberof PIXI
	 */
	var Geometry = function Geometry(buffers, attributes)
	{
	    if ( buffers === void 0 ) { buffers = []; }
	    if ( attributes === void 0 ) { attributes = {}; }

	    this.buffers = buffers;

	    this.indexBuffer = null;

	    this.attributes = attributes;

	    /**
	     * A map of renderer IDs to webgl VAOs
	     *
	     * @protected
	     * @type {object}
	     */
	    this.glVertexArrayObjects = {};

	    this.id = UID$1++;

	    this.instanced = false;

	    /**
	     * Number of instances in this geometry, pass it to `GeometrySystem.draw()`
	     * @member {number}
	     * @default 1
	     */
	    this.instanceCount = 1;

	    this.disposeRunner = new Runner('disposeGeometry', 2);

	    /**
	     * Count of existing (not destroyed) meshes that reference this geometry
	     * @member {number}
	     */
	    this.refCount = 0;
	};

	/**
	*
	* Adds an attribute to the geometry
	*
	* @param {String} id - the name of the attribute (matching up to a shader)
	* @param {PIXI.Buffer|number[]} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.
	* @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2
	* @param {Boolean} [normalized=false] should the data be normalized.
	* @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available
	* @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data)
	* @param {Number} [start=0] How far into the array to start reading values (used for interleaving data)
	*
	* @return {PIXI.Geometry} returns self, useful for chaining.
	*/
	Geometry.prototype.addAttribute = function addAttribute (id, buffer, size, normalized, type, stride, start, instance)
	{
	        if ( normalized === void 0 ) { normalized = false; }
	        if ( instance === void 0 ) { instance = false; }

	    if (!buffer)
	    {
	        throw new Error('You must pass a buffer when creating an attribute');
	    }

	    // check if this is a buffer!
	    if (!buffer.data)
	    {
	        // its an array!
	        if (buffer instanceof Array)
	        {
	            buffer = new Float32Array(buffer);
	        }

	        buffer = new Buffer(buffer);
	    }

	    var ids = id.split('|');

	    if (ids.length > 1)
	    {
	        for (var i = 0; i < ids.length; i++)
	        {
	            this.addAttribute(ids[i], buffer, size, normalized, type);
	        }

	        return this;
	    }

	    var bufferIndex = this.buffers.indexOf(buffer);

	    if (bufferIndex === -1)
	    {
	        this.buffers.push(buffer);
	        bufferIndex = this.buffers.length - 1;
	    }

	    this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);

	    // assuming that if there is instanced data then this will be drawn with instancing!
	    this.instanced = this.instanced || instance;

	    return this;
	};

	/**
	 * returns the requested attribute
	 *
	 * @param {String} id  the name of the attribute required
	 * @return {PIXI.Attribute} the attribute requested.
	 */
	Geometry.prototype.getAttribute = function getAttribute (id)
	{
	    return this.attributes[id];
	};

	/**
	 * returns the requested buffer
	 *
	 * @param {String} id  the name of the buffer required
	 * @return {PIXI.Buffer} the buffer requested.
	 */
	Geometry.prototype.getBuffer = function getBuffer (id)
	{
	    return this.buffers[this.getAttribute(id).buffer];
	};

	/**
	*
	* Adds an index buffer to the geometry
	* The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.
	*
	* @param {PIXI.Buffer|number[]} [buffer] the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.
	* @return {PIXI.Geometry} returns self, useful for chaining.
	*/
	Geometry.prototype.addIndex = function addIndex (buffer)
	{
	    if (!buffer.data)
	    {
	        // its an array!
	        if (buffer instanceof Array)
	        {
	            buffer = new Uint16Array(buffer);
	        }

	        buffer = new Buffer(buffer);
	    }

	    buffer.index = true;
	    this.indexBuffer = buffer;

	    if (this.buffers.indexOf(buffer) === -1)
	    {
	        this.buffers.push(buffer);
	    }

	    return this;
	};

	/**
	 * returns the index buffer
	 *
	 * @return {PIXI.Buffer} the index buffer.
	 */
	Geometry.prototype.getIndex = function getIndex ()
	{
	    return this.indexBuffer;
	};

	/**
	 * this function modifies the structure so that all current attributes become interleaved into a single buffer
	 * This can be useful if your model remains static as it offers a little performance boost
	 *
	 * @return {PIXI.Geometry} returns self, useful for chaining.
	 */
	Geometry.prototype.interleave = function interleave ()
	{
	    // a simple check to see if buffers are already interleaved..
	    if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) { return this; }

	    // assume already that no buffers are interleaved
	    var arrays = [];
	    var sizes = [];
	    var interleavedBuffer = new Buffer();
	    var i;

	    for (i in this.attributes)
	    {
	        var attribute = this.attributes[i];

	        var buffer = this.buffers[attribute.buffer];

	        arrays.push(buffer.data);

	        sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);

	        attribute.buffer = 0;
	    }

	    interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);

	    for (i = 0; i < this.buffers.length; i++)
	    {
	        if (this.buffers[i] !== this.indexBuffer)
	        {
	            this.buffers[i].destroy();
	        }
	    }

	    this.buffers = [interleavedBuffer];

	    if (this.indexBuffer)
	    {
	        this.buffers.push(this.indexBuffer);
	    }

	    return this;
	};

	Geometry.prototype.getSize = function getSize ()
	{
	    for (var i in this.attributes)
	    {
	        var attribute = this.attributes[i];
	        var buffer = this.buffers[attribute.buffer];

	        return buffer.data.length / ((attribute.stride / 4) || attribute.size);
	    }

	    return 0;
	};

	/**
	 * disposes WebGL resources that are connected to this geometry
	 */
	Geometry.prototype.dispose = function dispose ()
	{
	    this.disposeRunner.run(this, false);
	};

	/**
	 * Destroys the geometry.
	 */
	Geometry.prototype.destroy = function destroy ()
	{
	    this.dispose();

	    this.buffers = null;
	    this.indexBuffer.destroy();

	    this.attributes = null;
	};

	/**
	 * returns a clone of the geometry
	 *
	 * @returns {PIXI.Geometry} a new clone of this geometry
	 */
	Geometry.prototype.clone = function clone ()
	{
	    var geometry = new Geometry();

	    for (var i = 0; i < this.buffers.length; i++)
	    {
	        geometry.buffers[i] = new Buffer(this.buffers[i].data.slice());
	    }

	    for (var i$1 in this.attributes)
	    {
	        var attrib = this.attributes[i$1];

	        geometry.attributes[i$1] = new Attribute(
	            attrib.buffer,
	            attrib.size,
	            attrib.normalized,
	            attrib.type,
	            attrib.stride,
	            attrib.start,
	            attrib.instance
	        );
	    }

	    if (this.indexBuffer)
	    {
	        geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];
	        geometry.indexBuffer.index = true;
	    }

	    return geometry;
	};

	/**
	 * merges an array of geometries into a new single one
	 * geometry attribute styles must match for this operation to work
	 *
	 * @param {PIXI.Geometry[]} geometries array of geometries to merge
	 * @returns {PIXI.Geometry} shiny new geometry!
	 */
	Geometry.merge = function merge (geometries)
	{
	    // todo add a geometry check!
	    // also a size check.. cant be too big!]

	    var geometryOut = new Geometry();

	    var arrays = [];
	    var sizes = [];
	    var offsets = [];

	    var geometry;

	    // pass one.. get sizes..
	    for (var i = 0; i < geometries.length; i++)
	    {
	        geometry = geometries[i];

	        for (var j = 0; j < geometry.buffers.length; j++)
	        {
	            sizes[j] = sizes[j] || 0;
	            sizes[j] += geometry.buffers[j].data.length;
	            offsets[j] = 0;
	        }
	    }

	    // build the correct size arrays..
	    for (var i$1 = 0; i$1 < geometry.buffers.length; i$1++)
	    {
	        // TODO types!
	        arrays[i$1] = new map$1[getBufferType(geometry.buffers[i$1].data)](sizes[i$1]);
	        geometryOut.buffers[i$1] = new Buffer(arrays[i$1]);
	    }

	    // pass to set data..
	    for (var i$2 = 0; i$2 < geometries.length; i$2++)
	    {
	        geometry = geometries[i$2];

	        for (var j$1 = 0; j$1 < geometry.buffers.length; j$1++)
	        {
	            arrays[j$1].set(geometry.buffers[j$1].data, offsets[j$1]);
	            offsets[j$1] += geometry.buffers[j$1].data.length;
	        }
	    }

	    geometryOut.attributes = geometry.attributes;

	    if (geometry.indexBuffer)
	    {
	        geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];
	        geometryOut.indexBuffer.index = true;

	        var offset = 0;
	        var stride = 0;
	        var offset2 = 0;
	        var bufferIndexToCount = 0;

	        // get a buffer
	        for (var i$3 = 0; i$3 < geometry.buffers.length; i$3++)
	        {
	            if (geometry.buffers[i$3] !== geometry.indexBuffer)
	            {
	                bufferIndexToCount = i$3;
	                break;
	            }
	        }

	        // figure out the stride of one buffer..
	        for (var i$4 in geometry.attributes)
	        {
	            var attribute = geometry.attributes[i$4];

	            if ((attribute.buffer | 0) === bufferIndexToCount)
	            {
	                stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);
	            }
	        }

	        // time to off set all indexes..
	        for (var i$5 = 0; i$5 < geometries.length; i$5++)
	        {
	            var indexBufferData = geometries[i$5].indexBuffer.data;

	            for (var j$2 = 0; j$2 < indexBufferData.length; j$2++)
	            {
	                geometryOut.indexBuffer.data[j$2 + offset2] += offset;
	            }

	            offset += geometry.buffers[bufferIndexToCount].data.length / (stride);
	            offset2 += indexBufferData.length;
	        }
	    }

	    return geometryOut;
	};

	/**
	 * Helper class to create a quad
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Quad = /*@__PURE__*/(function (Geometry) {
	    function Quad()
	    {
	        Geometry.call(this);

	        this.addAttribute('aVertexPosition', [
	            0, 0,
	            1, 0,
	            1, 1,
	            0, 1 ])
	            .addIndex([0, 1, 3, 2]);
	    }

	    if ( Geometry ) { Quad.__proto__ = Geometry; }
	    Quad.prototype = Object.create( Geometry && Geometry.prototype );
	    Quad.prototype.constructor = Quad;

	    return Quad;
	}(Geometry));

	/**
	 * Helper class to create a quad with uvs like in v4
	 *
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.Geometry
	 */
	var QuadUv = /*@__PURE__*/(function (Geometry) {
	    function QuadUv()
	    {
	        Geometry.call(this);

	        /**
	         * An array of vertices
	         *
	         * @member {Float32Array}
	         */
	        this.vertices = new Float32Array([
	            -1, -1,
	            1, -1,
	            1, 1,
	            -1, 1 ]);

	        /**
	         * The Uvs of the quad
	         *
	         * @member {Float32Array}
	         */
	        this.uvs = new Float32Array([
	            0, 0,
	            1, 0,
	            1, 1,
	            0, 1 ]);

	        this.vertexBuffer = new Buffer(this.vertices);
	        this.uvBuffer = new Buffer(this.uvs);

	        this.addAttribute('aVertexPosition', this.vertexBuffer)
	            .addAttribute('aTextureCoord', this.uvBuffer)
	            .addIndex([0, 1, 2, 0, 2, 3]);
	    }

	    if ( Geometry ) { QuadUv.__proto__ = Geometry; }
	    QuadUv.prototype = Object.create( Geometry && Geometry.prototype );
	    QuadUv.prototype.constructor = QuadUv;

	    /**
	     * Maps two Rectangle to the quad.
	     *
	     * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle
	     * @param {PIXI.Rectangle} destinationFrame - the second rectangle
	     * @return {PIXI.Quad} Returns itself.
	     */
	    QuadUv.prototype.map = function map (targetTextureFrame, destinationFrame)
	    {
	        var x = 0; // destinationFrame.x / targetTextureFrame.width;
	        var y = 0; // destinationFrame.y / targetTextureFrame.height;

	        this.uvs[0] = x;
	        this.uvs[1] = y;

	        this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);
	        this.uvs[3] = y;

	        this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);
	        this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);

	        this.uvs[6] = x;
	        this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);

	        x = destinationFrame.x;
	        y = destinationFrame.y;

	        this.vertices[0] = x;
	        this.vertices[1] = y;

	        this.vertices[2] = x + destinationFrame.width;
	        this.vertices[3] = y;

	        this.vertices[4] = x + destinationFrame.width;
	        this.vertices[5] = y + destinationFrame.height;

	        this.vertices[6] = x;
	        this.vertices[7] = y + destinationFrame.height;

	        this.invalidate();

	        return this;
	    };

	    /**
	     * legacy upload method, just marks buffers dirty
	     * @returns {PIXI.QuadUv} Returns itself.
	     */
	    QuadUv.prototype.invalidate = function invalidate ()
	    {
	        this.vertexBuffer._updateID++;
	        this.uvBuffer._updateID++;

	        return this;
	    };

	    return QuadUv;
	}(Geometry));

	var UID$2 = 0;

	/**
	 * Uniform group holds uniform map and some ID's for work
	 *
	 * @class
	 * @memberof PIXI
	 */
	var UniformGroup = function UniformGroup(uniforms, _static)
	{
	    /**
	     * uniform values
	     * @member {object}
	     * @readonly
	     */
	    this.uniforms = uniforms;

	    /**
	     * Its a group and not a single uniforms
	     * @member {boolean}
	     * @readonly
	     * @default true
	     */
	    this.group = true;

	    // lets generate this when the shader ?
	    this.syncUniforms = {};

	    /**
	     * dirty version
	     * @protected
	     * @member {number}
	     */
	    this.dirtyId = 0;

	    /**
	     * unique id
	     * @protected
	     * @member {number}
	     */
	    this.id = UID$2++;

	    /**
	     * Uniforms wont be changed after creation
	     * @member {boolean}
	     */
	    this.static = !!_static;
	};

	UniformGroup.prototype.update = function update ()
	{
	    this.dirtyId++;
	};

	UniformGroup.prototype.add = function add (name, uniforms, _static)
	{
	    this.uniforms[name] = new UniformGroup(uniforms, _static);
	};

	UniformGroup.from = function from (uniforms, _static)
	{
	    return new UniformGroup(uniforms, _static);
	};

	/**
	 * System plugin to the renderer to manage filter states.
	 *
	 * @class
	 * @private
	 */
	var FilterState = function FilterState()
	{
	    this.renderTexture = null;

	    /**
	     * Target of the filters
	     * We store for case when custom filter wants to know the element it was applied on
	     * @member {PIXI.DisplayObject}
	     * @private
	     */
	    this.target = null;

	    /**
	     * Compatibility with PixiJS v4 filters
	     * @member {boolean}
	     * @default false
	     * @private
	     */
	    this.legacy = false;

	    /**
	     * Resolution of filters
	     * @member {number}
	     * @default 1
	     * @private
	     */
	    this.resolution = 1;

	    // next three fields are created only for root
	    // re-assigned for everything else

	    /**
	     * Source frame
	     * @member {PIXI.Rectangle}
	     * @private
	     */
	    this.sourceFrame = new Rectangle();

	    /**
	     * Destination frame
	     * @member {PIXI.Rectangle}
	     * @private
	     */
	    this.destinationFrame = new Rectangle();

	    /**
	     * Collection of filters
	     * @member {PIXI.Filter[]}
	     * @private
	     */
	    this.filters = [];
	};

	/**
	 * clears the state
	 * @private
	 */
	FilterState.prototype.clear = function clear ()
	{
	    this.target = null;
	    this.filters = null;
	    this.renderTexture = null;
	};

	/**
	 * System plugin to the renderer to manage the filters.
	 *
	 * @class
	 * @memberof PIXI.systems
	 * @extends PIXI.System
	 */
	var FilterSystem = /*@__PURE__*/(function (System) {
	    function FilterSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * List of filters for the FilterSystem
	         * @member {Object[]}
	         * @readonly
	         */
	        this.defaultFilterStack = [{}];

	        /**
	         * stores a bunch of PO2 textures used for filtering
	         * @member {Object}
	         */
	        this.texturePool = new RenderTexturePool();

	        this.texturePool.setScreenSize(renderer.view);

	        /**
	         * a pool for storing filter states, save us creating new ones each tick
	         * @member {Object[]}
	         */
	        this.statePool = [];

	        /**
	         * A very simple geometry used when drawing a filter effect to the screen
	         * @member {PIXI.Quad}
	         */
	        this.quad = new Quad();

	        /**
	         * Quad UVs
	         * @member {PIXI.QuadUv}
	         */
	        this.quadUv = new QuadUv();

	        /**
	         * Temporary rect for maths
	         * @type {PIXI.Rectangle}
	         */
	        this.tempRect = new Rectangle();

	        /**
	         * Active state
	         * @member {object}
	         */
	        this.activeState = {};

	        /**
	         * This uniform group is attached to filter uniforms when used
	         * @member {PIXI.UniformGroup}
	         * @property {PIXI.Rectangle} outputFrame
	         * @property {Float32Array} inputSize
	         * @property {Float32Array} inputPixel
	         * @property {Float32Array} inputClamp
	         * @property {Number} resolution
	         * @property {Float32Array} filterArea
	         * @property {Fload32Array} filterClamp
	         */
	        this.globalUniforms = new UniformGroup({
	            outputFrame: this.tempRect,
	            inputSize: new Float32Array(4),
	            inputPixel: new Float32Array(4),
	            inputClamp: new Float32Array(4),
	            resolution: 1,

	            // legacy variables
	            filterArea: new Float32Array(4),
	            filterClamp: new Float32Array(4),
	        }, true);

	        this._pixelsWidth = renderer.view.width;
	        this._pixelsHeight = renderer.view.height;
	    }

	    if ( System ) { FilterSystem.__proto__ = System; }
	    FilterSystem.prototype = Object.create( System && System.prototype );
	    FilterSystem.prototype.constructor = FilterSystem;

	    /**
	     * Adds a new filter to the System.
	     *
	     * @param {PIXI.DisplayObject} target - The target of the filter to render.
	     * @param {PIXI.Filter[]} filters - The filters to apply.
	     */
	    FilterSystem.prototype.push = function push (target, filters)
	    {
	        var renderer = this.renderer;
	        var filterStack = this.defaultFilterStack;
	        var state = this.statePool.pop() || new FilterState();

	        var resolution = filters[0].resolution;
	        var padding = filters[0].padding;
	        var autoFit = filters[0].autoFit;
	        var legacy = filters[0].legacy;

	        for (var i = 1; i < filters.length; i++)
	        {
	            var filter =  filters[i];

	            // lets use the lowest resolution..
	            resolution = Math.min(resolution, filter.resolution);
	            // and the largest amount of padding!
	            padding = Math.max(padding, filter.padding);
	            // only auto fit if all filters are autofit
	            autoFit = autoFit || filter.autoFit;

	            legacy = legacy || filter.legacy;
	        }

	        if (filterStack.length === 1)
	        {
	            this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;
	        }

	        filterStack.push(state);

	        state.resolution = resolution;

	        state.legacy = legacy;

	        state.target = target;

	        state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));

	        state.sourceFrame.pad(padding);
	        if (autoFit)
	        {
	            state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);
	        }

	        // round to whole number based on resolution
	        state.sourceFrame.ceil(resolution);

	        state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);
	        state.filters = filters;

	        state.destinationFrame.width = state.renderTexture.width;
	        state.destinationFrame.height = state.renderTexture.height;

	        state.renderTexture.filterFrame = state.sourceFrame;

	        renderer.renderTexture.bind(state.renderTexture, state.sourceFrame);// /, state.destinationFrame);
	        renderer.renderTexture.clear();
	    };

	    /**
	     * Pops off the filter and applies it.
	     *
	     */
	    FilterSystem.prototype.pop = function pop ()
	    {
	        var filterStack = this.defaultFilterStack;
	        var state = filterStack.pop();
	        var filters = state.filters;

	        this.activeState = state;

	        var globalUniforms = this.globalUniforms.uniforms;

	        globalUniforms.outputFrame = state.sourceFrame;
	        globalUniforms.resolution = state.resolution;

	        var inputSize = globalUniforms.inputSize;
	        var inputPixel = globalUniforms.inputPixel;
	        var inputClamp = globalUniforms.inputClamp;

	        inputSize[0] = state.destinationFrame.width;
	        inputSize[1] = state.destinationFrame.height;
	        inputSize[2] = 1.0 / inputSize[0];
	        inputSize[3] = 1.0 / inputSize[1];

	        inputPixel[0] = inputSize[0] * state.resolution;
	        inputPixel[1] = inputSize[1] * state.resolution;
	        inputPixel[2] = 1.0 / inputPixel[0];
	        inputPixel[3] = 1.0 / inputPixel[1];

	        inputClamp[0] = 0.5 * inputPixel[2];
	        inputClamp[1] = 0.5 * inputPixel[3];
	        inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);
	        inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);

	        // only update the rect if its legacy..
	        if (state.legacy)
	        {
	            var filterArea = globalUniforms.filterArea;

	            filterArea[0] = state.destinationFrame.width;
	            filterArea[1] = state.destinationFrame.height;
	            filterArea[2] = state.sourceFrame.x;
	            filterArea[3] = state.sourceFrame.y;

	            globalUniforms.filterClamp = globalUniforms.inputClamp;
	        }

	        this.globalUniforms.update();

	        var lastState = filterStack[filterStack.length - 1];

	        if (filters.length === 1)
	        {
	            filters[0].apply(this, state.renderTexture, lastState.renderTexture, false, state);

	            this.returnFilterTexture(state.renderTexture);
	        }
	        else
	        {
	            var flip = state.renderTexture;
	            var flop = this.getOptimalFilterTexture(
	                flip.width,
	                flip.height,
	                state.resolution
	            );

	            flop.filterFrame = flip.filterFrame;

	            var i = 0;

	            for (i = 0; i < filters.length - 1; ++i)
	            {
	                filters[i].apply(this, flip, flop, true, state);

	                var t = flip;

	                flip = flop;
	                flop = t;
	            }

	            filters[i].apply(this, flip, lastState.renderTexture, false, state);

	            this.returnFilterTexture(flip);
	            this.returnFilterTexture(flop);
	        }

	        state.clear();
	        this.statePool.push(state);
	    };

	    /**
	     * Draws a filter.
	     *
	     * @param {PIXI.Filter} filter - The filter to draw.
	     * @param {PIXI.RenderTexture} input - The input render target.
	     * @param {PIXI.RenderTexture} output - The target to output to.
	     * @param {boolean} clear - Should the output be cleared before rendering to it
	     */
	    FilterSystem.prototype.applyFilter = function applyFilter (filter, input, output, clear)
	    {
	        var renderer = this.renderer;

	        renderer.renderTexture.bind(output, output ? output.filterFrame : null);

	        if (clear)
	        {
	            // gl.disable(gl.SCISSOR_TEST);
	            renderer.renderTexture.clear();
	            // gl.enable(gl.SCISSOR_TEST);
	        }

	        // set the uniforms..
	        filter.uniforms.uSampler = input;
	        filter.uniforms.filterGlobals = this.globalUniforms;

	        // TODO make it so that the order of this does not matter..
	        // because it does at the moment cos of global uniforms.
	        // they need to get resynced

	        renderer.state.set(filter.state);
	        renderer.shader.bind(filter);

	        if (filter.legacy)
	        {
	            this.quadUv.map(input._frame, input.filterFrame);

	            renderer.geometry.bind(this.quadUv);
	            renderer.geometry.draw(DRAW_MODES.TRIANGLES);
	        }
	        else
	        {
	            renderer.geometry.bind(this.quad);
	            renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);
	        }
	    };

	    /**
	     * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.
	     *
	     * Use `outputMatrix * vTextureCoord` in the shader.
	     *
	     * @param {PIXI.Matrix} outputMatrix - The matrix to output to.
	     * @param {PIXI.Sprite} sprite - The sprite to map to.
	     * @return {PIXI.Matrix} The mapped matrix.
	     */
	    FilterSystem.prototype.calculateSpriteMatrix = function calculateSpriteMatrix (outputMatrix, sprite)
	    {
	        var ref = this.activeState;
	        var sourceFrame = ref.sourceFrame;
	        var destinationFrame = ref.destinationFrame;
	        var ref$1 = sprite._texture;
	        var orig = ref$1.orig;
	        var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,
	            destinationFrame.height, sourceFrame.x, sourceFrame.y);
	        var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);

	        worldTransform.invert();
	        mappedMatrix.prepend(worldTransform);
	        mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);
	        mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);

	        return mappedMatrix;
	    };

	    /**
	     * Destroys this Filter System.
	     */
	    FilterSystem.prototype.destroy = function destroy ()
	    {
	        // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem
	        this.texturePool.clear(false);
	    };

	    /**
	     * Gets a Power-of-Two render texture or fullScreen texture
	     *
	     * @protected
	     * @param {number} minWidth - The minimum width of the render texture in real pixels.
	     * @param {number} minHeight - The minimum height of the render texture in real pixels.
	     * @param {number} [resolution=1] - The resolution of the render texture.
	     * @return {PIXI.RenderTexture} The new render texture.
	     */
	    FilterSystem.prototype.getOptimalFilterTexture = function getOptimalFilterTexture (minWidth, minHeight, resolution)
	    {
	        if ( resolution === void 0 ) { resolution = 1; }

	        return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);
	    };

	    /**
	     * Gets extra render texture to use inside current filter
	     * To be compliant with older filters, you can use params in any order
	     *
	     * @param {PIXI.RenderTexture} [input] renderTexture from which size and resolution will be copied
	     * @param {number} [resolution] override resolution of the renderTexture
	     * @returns {PIXI.RenderTexture}
	     */
	    FilterSystem.prototype.getFilterTexture = function getFilterTexture (input, resolution)
	    {
	        if (typeof input === 'number')
	        {
	            var swap = input;

	            input = resolution;
	            resolution = swap;
	        }

	        input = input || this.activeState.renderTexture;

	        var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);

	        filterTexture.filterFrame = input.filterFrame;

	        return filterTexture;
	    };

	    /**
	     * Frees a render texture back into the pool.
	     *
	     * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free
	     */
	    FilterSystem.prototype.returnFilterTexture = function returnFilterTexture (renderTexture)
	    {
	        this.texturePool.returnTexture(renderTexture);
	    };

	    /**
	     * Empties the texture pool.
	     */
	    FilterSystem.prototype.emptyPool = function emptyPool ()
	    {
	        this.texturePool.clear(true);
	    };

	    /**
	     * calls `texturePool.resize()`, affects fullScreen renderTextures
	     */
	    FilterSystem.prototype.resize = function resize ()
	    {
	        this.texturePool.setScreenSize(this.renderer.view);
	    };

	    return FilterSystem;
	}(System));

	/**
	 * Base for a common object renderer that can be used as a
	 * system renderer plugin.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI
	 */
	var ObjectRenderer = function ObjectRenderer(renderer)
	{
	    /**
	     * The renderer this manager works for.
	     *
	     * @member {PIXI.Renderer}
	     */
	    this.renderer = renderer;
	};

	/**
	 * Stub method that should be used to empty the current
	 * batch by rendering objects now.
	 */
	ObjectRenderer.prototype.flush = function flush ()
	{
	    // flush!
	};

	/**
	 * Generic destruction method that frees all resources. This
	 * should be called by subclasses.
	 */
	ObjectRenderer.prototype.destroy = function destroy ()
	{
	    this.renderer = null;
	};

	/**
	 * Stub method that initializes any state required before
	 * rendering starts. It is different from the `prerender`
	 * signal, which occurs every frame, in that it is called
	 * whenever an object requests _this_ renderer specifically.
	 */
	ObjectRenderer.prototype.start = function start ()
	{
	    // set the shader..
	};

	/**
	 * Stops the renderer. It should free up any state and
	 * become dormant.
	 */
	ObjectRenderer.prototype.stop = function stop ()
	{
	    this.flush();
	};

	/**
	 * Keeps the object to render. It doesn't have to be
	 * rendered immediately.
	 *
	 * @param {PIXI.DisplayObject} object - The object to render.
	 */
	ObjectRenderer.prototype.render = function render (object) // eslint-disable-line no-unused-vars
	{
	    // render the object
	};

	/**
	 * System plugin to the renderer to manage batching.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var BatchSystem = /*@__PURE__*/(function (System) {
	    function BatchSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * An empty renderer.
	         *
	         * @member {PIXI.ObjectRenderer}
	         */
	        this.emptyRenderer = new ObjectRenderer(renderer);

	        /**
	         * The currently active ObjectRenderer.
	         *
	         * @member {PIXI.ObjectRenderer}
	         */
	        this.currentRenderer = this.emptyRenderer;
	    }

	    if ( System ) { BatchSystem.__proto__ = System; }
	    BatchSystem.prototype = Object.create( System && System.prototype );
	    BatchSystem.prototype.constructor = BatchSystem;

	    /**
	     * Changes the current renderer to the one given in parameter
	     *
	     * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.
	     */
	    BatchSystem.prototype.setObjectRenderer = function setObjectRenderer (objectRenderer)
	    {
	        if (this.currentRenderer === objectRenderer)
	        {
	            return;
	        }

	        this.currentRenderer.stop();
	        this.currentRenderer = objectRenderer;

	        this.currentRenderer.start();
	    };

	    /**
	     * This should be called if you wish to do some custom rendering
	     * It will basically render anything that may be batched up such as sprites
	     */
	    BatchSystem.prototype.flush = function flush ()
	    {
	        this.setObjectRenderer(this.emptyRenderer);
	    };

	    /**
	     * Reset the system to an empty renderer
	     */
	    BatchSystem.prototype.reset = function reset ()
	    {
	        this.setObjectRenderer(this.emptyRenderer);
	    };

	    return BatchSystem;
	}(System));

	/**
	 * The maximum support for using WebGL. If a device does not
	 * support WebGL version, for instance WebGL 2, it will still
	 * attempt to fallback support to WebGL 1. If you want to
	 * explicitly remove feature support to target a more stable
	 * baseline, prefer a lower environment.
	 *
	 * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}
	 * we disable webgl2 by default for all non-apple mobile devices.
	 *
	 * @static
	 * @name PREFER_ENV
	 * @memberof PIXI.settings
	 * @type {number}
	 * @default PIXI.ENV.WEBGL2
	 */
	settings.PREFER_ENV = isMobile_min.any ? ENV.WEBGL : ENV.WEBGL2;

	var CONTEXT_UID = 0;

	/**
	 * System plugin to the renderer to manage the context.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var ContextSystem = /*@__PURE__*/(function (System) {
	    function ContextSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * Either 1 or 2 to reflect the WebGL version being used
	         * @member {number}
	         * @readonly
	         */
	        this.webGLVersion = 1;

	        /**
	         * Extensions being used
	         * @member {object}
	         * @readonly
	         * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension
	         * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension
	         * @property {OES_texture_float} floatTexture - WebGL v1 extension
	         * @property {WEBGL_lose_context} loseContext - WebGL v1 extension
	         * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension
	         * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension
	         */
	        this.extensions = {};

	        // Bind functions
	        this.handleContextLost = this.handleContextLost.bind(this);
	        this.handleContextRestored = this.handleContextRestored.bind(this);

	        renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false);
	        renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);
	    }

	    if ( System ) { ContextSystem.__proto__ = System; }
	    ContextSystem.prototype = Object.create( System && System.prototype );
	    ContextSystem.prototype.constructor = ContextSystem;

	    var prototypeAccessors = { isLost: { configurable: true } };

	    /**
	     * `true` if the context is lost
	     * @member {boolean}
	     * @readonly
	     */
	    prototypeAccessors.isLost.get = function ()
	    {
	        return (!this.gl || this.gl.isContextLost());
	    };

	    /**
	     * Handle the context change event
	     * @param {WebGLRenderingContext} gl new webgl context
	     */
	    ContextSystem.prototype.contextChange = function contextChange (gl)
	    {
	        this.gl = gl;
	        this.renderer.gl = gl;
	        this.renderer.CONTEXT_UID = CONTEXT_UID++;

	        // restore a context if it was previously lost
	        if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))
	        {
	            gl.getExtension('WEBGL_lose_context').restoreContext();
	        }
	    };

	    /**
	     * Initialize the context
	     *
	     * @protected
	     * @param {WebGLRenderingContext} gl - WebGL context
	     */
	    ContextSystem.prototype.initFromContext = function initFromContext (gl)
	    {
	        this.gl = gl;
	        this.validateContext(gl);
	        this.renderer.gl = gl;
	        this.renderer.CONTEXT_UID = CONTEXT_UID++;
	        this.renderer.runners.contextChange.run(gl);
	    };

	    /**
	     * Initialize from context options
	     *
	     * @protected
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
	     * @param {object} options - context attributes
	     */
	    ContextSystem.prototype.initFromOptions = function initFromOptions (options)
	    {
	        var gl = this.createContext(this.renderer.view, options);

	        this.initFromContext(gl);
	    };

	    /**
	     * Helper class to create a WebGL Context
	     *
	     * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from
	     * @param options {object} An options object that gets passed in to the canvas element containing the context attributes
	     * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext
	     * @return {WebGLRenderingContext} the WebGL context
	     */
	    ContextSystem.prototype.createContext = function createContext (canvas, options)
	    {
	        var gl;

	        if (settings.PREFER_ENV >= ENV.WEBGL2)
	        {
	            gl = canvas.getContext('webgl2', options);
	        }

	        if (gl)
	        {
	            this.webGLVersion = 2;
	        }
	        else
	        {
	            this.webGLVersion = 1;

	            gl = canvas.getContext('webgl', options)
	            || canvas.getContext('experimental-webgl', options);

	            if (!gl)
	            {
	                // fail, not able to get a context
	                throw new Error('This browser does not support WebGL. Try using the canvas renderer');
	            }
	        }

	        this.gl = gl;

	        this.getExtensions();

	        return gl;
	    };

	    /**
	     * Auto-populate the extensions
	     *
	     * @protected
	     */
	    ContextSystem.prototype.getExtensions = function getExtensions ()
	    {
	        // time to set up default extensions that Pixi uses.
	        var ref = this;
	        var gl = ref.gl;

	        if (this.webGLVersion === 1)
	        {
	            Object.assign(this.extensions, {
	                drawBuffers: gl.getExtension('WEBGL_draw_buffers'),
	                depthTexture: gl.getExtension('WEBKIT_WEBGL_depth_texture'),
	                loseContext: gl.getExtension('WEBGL_lose_context'),
	                vertexArrayObject: gl.getExtension('OES_vertex_array_object')
	                    || gl.getExtension('MOZ_OES_vertex_array_object')
	                    || gl.getExtension('WEBKIT_OES_vertex_array_object'),
	                anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),
	                uint32ElementIndex: gl.getExtension('OES_element_index_uint'),
	                // Floats and half-floats
	                floatTexture: gl.getExtension('OES_texture_float'),
	                floatTextureLinear: gl.getExtension('OES_texture_float_linear'),
	                textureHalfFloat: gl.getExtension('OES_texture_half_float'),
	                textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),
	            });
	        }
	        else if (this.webGLVersion === 2)
	        {
	            Object.assign(this.extensions, {
	                anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),
	                // Floats and half-floats
	                colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),
	                floatTextureLinear: gl.getExtension('OES_texture_float_linear'),
	            });
	        }
	    };

	    /**
	     * Handles a lost webgl context
	     *
	     * @protected
	     * @param {WebGLContextEvent} event - The context lost event.
	     */
	    ContextSystem.prototype.handleContextLost = function handleContextLost (event)
	    {
	        event.preventDefault();
	    };

	    /**
	     * Handles a restored webgl context
	     *
	     * @protected
	     */
	    ContextSystem.prototype.handleContextRestored = function handleContextRestored ()
	    {
	        this.renderer.runners.contextChange.run(this.gl);
	    };

	    ContextSystem.prototype.destroy = function destroy ()
	    {
	        var view = this.renderer.view;

	        // remove listeners
	        view.removeEventListener('webglcontextlost', this.handleContextLost);
	        view.removeEventListener('webglcontextrestored', this.handleContextRestored);

	        this.gl.useProgram(null);

	        if (this.extensions.loseContext)
	        {
	            this.extensions.loseContext.loseContext();
	        }
	    };

	    /**
	     * Handle the post-render runner event
	     *
	     * @protected
	     */
	    ContextSystem.prototype.postrender = function postrender ()
	    {
	        this.gl.flush();
	    };

	    /**
	     * Validate context
	     *
	     * @protected
	     * @param {WebGLRenderingContext} gl - Render context
	     */
	    ContextSystem.prototype.validateContext = function validateContext (gl)
	    {
	        var attributes = gl.getContextAttributes();

	        // this is going to be fairly simple for now.. but at least we have room to grow!
	        if (!attributes.stencil)
	        {
	            /* eslint-disable max-len */

	            /* eslint-disable no-console */
	            console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');
	            /* eslint-enable no-console */

	            /* eslint-enable max-len */
	        }
	    };

	    Object.defineProperties( ContextSystem.prototype, prototypeAccessors );

	    return ContextSystem;
	}(System));

	/**
	 * System plugin to the renderer to manage framebuffers.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var FramebufferSystem = /*@__PURE__*/(function (System) {
	    function FramebufferSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * A list of managed framebuffers
	         * @member {PIXI.Framebuffer[]}
	         * @readonly
	         */
	        this.managedFramebuffers = [];

	        /**
	         * Framebuffer value that shows that we don't know what is bound
	         * @member {Framebuffer}
	         * @readonly
	         */
	        this.unknownFramebuffer = new Framebuffer(10, 10);
	    }

	    if ( System ) { FramebufferSystem.__proto__ = System; }
	    FramebufferSystem.prototype = Object.create( System && System.prototype );
	    FramebufferSystem.prototype.constructor = FramebufferSystem;

	    var prototypeAccessors = { size: { configurable: true } };

	    /**
	     * Sets up the renderer context and necessary buffers.
	     */
	    FramebufferSystem.prototype.contextChange = function contextChange ()
	    {
	        var gl = this.gl = this.renderer.gl;

	        this.CONTEXT_UID = this.renderer.CONTEXT_UID;
	        this.current = this.unknownFramebuffer;
	        this.viewport = new Rectangle();
	        this.hasMRT = true;
	        this.writeDepthTexture = true;

	        this.disposeAll(true);

	        // webgl2
	        if (this.renderer.context.webGLVersion === 1)
	        {
	            // webgl 1!
	            var nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;
	            var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;

	            if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)
	            {
	                nativeDrawBuffersExtension = null;
	                nativeDepthTextureExtension = null;
	            }

	            if (nativeDrawBuffersExtension)
	            {
	                gl.drawBuffers = function (activeTextures) { return nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures); };
	            }
	            else
	            {
	                this.hasMRT = false;
	                gl.drawBuffers = function () {
	                    // empty
	                };
	            }

	            if (!nativeDepthTextureExtension)
	            {
	                this.writeDepthTexture = false;
	            }
	        }
	    };

	    /**
	     * Bind a framebuffer
	     *
	     * @param {PIXI.Framebuffer} framebuffer
	     * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size
	     */
	    FramebufferSystem.prototype.bind = function bind (framebuffer, frame)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        if (framebuffer)
	        {
	            // TODO caching layer!

	            var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);

	            if (this.current !== framebuffer)
	            {
	                this.current = framebuffer;
	                gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);
	            }
	            // make sure all textures are unbound..

	            // now check for updates...
	            if (fbo.dirtyId !== framebuffer.dirtyId)
	            {
	                fbo.dirtyId = framebuffer.dirtyId;

	                if (fbo.dirtyFormat !== framebuffer.dirtyFormat)
	                {
	                    fbo.dirtyFormat = framebuffer.dirtyFormat;
	                    this.updateFramebuffer(framebuffer);
	                }
	                else if (fbo.dirtySize !== framebuffer.dirtySize)
	                {
	                    fbo.dirtySize = framebuffer.dirtySize;
	                    this.resizeFramebuffer(framebuffer);
	                }
	            }

	            for (var i = 0; i < framebuffer.colorTextures.length; i++)
	            {
	                if (framebuffer.colorTextures[i].texturePart)
	                {
	                    this.renderer.texture.unbind(framebuffer.colorTextures[i].texture);
	                }
	                else
	                {
	                    this.renderer.texture.unbind(framebuffer.colorTextures[i]);
	                }
	            }

	            if (framebuffer.depthTexture)
	            {
	                this.renderer.texture.unbind(framebuffer.depthTexture);
	            }

	            if (frame)
	            {
	                this.setViewport(frame.x, frame.y, frame.width, frame.height);
	            }
	            else
	            {
	                this.setViewport(0, 0, framebuffer.width, framebuffer.height);
	            }
	        }
	        else
	        {
	            if (this.current)
	            {
	                this.current = null;
	                gl.bindFramebuffer(gl.FRAMEBUFFER, null);
	            }

	            if (frame)
	            {
	                this.setViewport(frame.x, frame.y, frame.width, frame.height);
	            }
	            else
	            {
	                this.setViewport(0, 0, this.renderer.width, this.renderer.height);
	            }
	        }
	    };

	    /**
	     * Set the WebGLRenderingContext's viewport.
	     *
	     * @param {Number} x - X position of viewport
	     * @param {Number} y - Y position of viewport
	     * @param {Number} width - Width of viewport
	     * @param {Number} height - Height of viewport
	     */
	    FramebufferSystem.prototype.setViewport = function setViewport (x, y, width, height)
	    {
	        var v = this.viewport;

	        if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)
	        {
	            v.x = x;
	            v.y = y;
	            v.width = width;
	            v.height = height;

	            this.gl.viewport(x, y, width, height);
	        }
	    };

	    /**
	     * Get the size of the current width and height. Returns object with `width` and `height` values.
	     *
	     * @member {object}
	     * @readonly
	     */
	    prototypeAccessors.size.get = function ()
	    {
	        if (this.current)
	        {
	            // TODO store temp
	            return { x: 0, y: 0, width: this.current.width, height: this.current.height };
	        }

	        return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };
	    };

	    /**
	     * Clear the color of the context
	     *
	     * @param {Number} r - Red value from 0 to 1
	     * @param {Number} g - Green value from 0 to 1
	     * @param {Number} b - Blue value from 0 to 1
	     * @param {Number} a - Alpha value from 0 to 1
	     */
	    FramebufferSystem.prototype.clear = function clear (r, g, b, a)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        // TODO clear color can be set only one right?
	        gl.clearColor(r, g, b, a);
	        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
	    };

	    /**
	     * Initialize framebuffer
	     *
	     * @protected
	     * @param {PIXI.Framebuffer} framebuffer
	     */
	    FramebufferSystem.prototype.initFramebuffer = function initFramebuffer (framebuffer)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        // TODO - make this a class?
	        var fbo = {
	            framebuffer: gl.createFramebuffer(),
	            stencil: null,
	            dirtyId: 0,
	            dirtyFormat: 0,
	            dirtySize: 0,
	        };

	        framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;

	        this.managedFramebuffers.push(framebuffer);
	        framebuffer.disposeRunner.add(this);

	        return fbo;
	    };

	    /**
	     * Resize the framebuffer
	     *
	     * @protected
	     * @param {PIXI.Framebuffer} framebuffer
	     */
	    FramebufferSystem.prototype.resizeFramebuffer = function resizeFramebuffer (framebuffer)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];

	        if (fbo.stencil)
	        {
	            gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);
	            gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);
	        }

	        var colorTextures = framebuffer.colorTextures;

	        for (var i = 0; i < colorTextures.length; i++)
	        {
	            this.renderer.texture.bind(colorTextures[i], 0);
	        }

	        if (framebuffer.depthTexture)
	        {
	            this.renderer.texture.bind(framebuffer.depthTexture, 0);
	        }
	    };

	    /**
	     * Update the framebuffer
	     *
	     * @protected
	     * @param {PIXI.Framebuffer} framebuffer
	     */
	    FramebufferSystem.prototype.updateFramebuffer = function updateFramebuffer (framebuffer)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];

	        // bind the color texture
	        var colorTextures = framebuffer.colorTextures;

	        var count = colorTextures.length;

	        if (!gl.drawBuffers)
	        {
	            count = Math.min(count, 1);
	        }

	        var activeTextures = [];

	        for (var i = 0; i < count; i++)
	        {
	            var texture = framebuffer.colorTextures[i];

	            if (texture.texturePart)
	            {
	                this.renderer.texture.bind(texture.texture, 0);

	                gl.framebufferTexture2D(gl.FRAMEBUFFER,
	                    gl.COLOR_ATTACHMENT0 + i,
	                    gl.TEXTURE_CUBE_MAP_NEGATIVE_X + texture.side,
	                    texture.texture._glTextures[this.CONTEXT_UID].texture,
	                    0);
	            }
	            else
	            {
	                this.renderer.texture.bind(texture, 0);

	                gl.framebufferTexture2D(gl.FRAMEBUFFER,
	                    gl.COLOR_ATTACHMENT0 + i,
	                    gl.TEXTURE_2D,
	                    texture._glTextures[this.CONTEXT_UID].texture,
	                    0);
	            }

	            activeTextures.push(gl.COLOR_ATTACHMENT0 + i);
	        }

	        if (activeTextures.length > 1)
	        {
	            gl.drawBuffers(activeTextures);
	        }

	        if (framebuffer.depthTexture)
	        {
	            var writeDepthTexture = this.writeDepthTexture;

	            if (writeDepthTexture)
	            {
	                var depthTexture = framebuffer.depthTexture;

	                this.renderer.texture.bind(depthTexture, 0);

	                gl.framebufferTexture2D(gl.FRAMEBUFFER,
	                    gl.DEPTH_ATTACHMENT,
	                    gl.TEXTURE_2D,
	                    depthTexture._glTextures[this.CONTEXT_UID].texture,
	                    0);
	            }
	        }

	        if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))
	        {
	            fbo.stencil = gl.createRenderbuffer();

	            gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);

	            gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);
	            // TODO.. this is depth AND stencil?
	            if (!framebuffer.depthTexture)
	            { // you can't have both, so one should take priority if enabled
	                gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);
	            }
	        }
	    };

	    /**
	     * Disposes framebuffer
	     * @param {PIXI.Framebuffer} framebuffer framebuffer that has to be disposed of
	     * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls
	     */
	    FramebufferSystem.prototype.disposeFramebuffer = function disposeFramebuffer (framebuffer, contextLost)
	    {
	        var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];
	        var gl = this.gl;

	        if (!fbo)
	        {
	            return;
	        }

	        delete framebuffer.glFramebuffers[this.CONTEXT_UID];

	        var index = this.managedFramebuffers.indexOf(framebuffer);

	        if (index >= 0)
	        {
	            this.managedFramebuffers.splice(index, 1);
	        }

	        framebuffer.disposeRunner.remove(this);

	        if (!contextLost)
	        {
	            gl.deleteFramebuffer(fbo.framebuffer);
	            if (fbo.stencil)
	            {
	                gl.deleteRenderbuffer(fbo.stencil);
	            }
	        }
	    };

	    /**
	     * Disposes all framebuffers, but not textures bound to them
	     * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls
	     */
	    FramebufferSystem.prototype.disposeAll = function disposeAll (contextLost)
	    {
	        var list = this.managedFramebuffers;

	        this.managedFramebuffers = [];

	        for (var i = 0; i < list.length; i++)
	        {
	            this.disposeFramebuffer(list[i], contextLost);
	        }
	    };

	    /**
	     * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.
	     * Used by MaskSystem, when its time to use stencil mask for Graphics element.
	     *
	     * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.
	     *
	     * @private
	     */
	    FramebufferSystem.prototype.forceStencil = function forceStencil ()
	    {
	        var framebuffer = this.current;

	        if (!framebuffer)
	        {
	            return;
	        }

	        var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];

	        if (!fbo || fbo.stencil)
	        {
	            return;
	        }
	        framebuffer.enableStencil();

	        var w = framebuffer.width;
	        var h = framebuffer.height;
	        var gl = this.gl;
	        var stencil = gl.createRenderbuffer();

	        gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);
	        gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);

	        fbo.stencil = stencil;
	        gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);
	    };

	    /**
	     * resets framebuffer stored state, binds screen framebuffer
	     *
	     * should be called before renderTexture reset()
	     */
	    FramebufferSystem.prototype.reset = function reset ()
	    {
	        this.current = this.unknownFramebuffer;
	        this.viewport = new Rectangle();
	    };

	    Object.defineProperties( FramebufferSystem.prototype, prototypeAccessors );

	    return FramebufferSystem;
	}(System));

	var GLBuffer = function GLBuffer(buffer)
	{
	    this.buffer = buffer;
	    this.updateID = -1;
	    this.byteLength = -1;
	    this.refCount = 0;
	};

	var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 };

	/**
	 * System plugin to the renderer to manage geometry.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var GeometrySystem = /*@__PURE__*/(function (System) {
	    function GeometrySystem(renderer)
	    {
	        System.call(this, renderer);

	        this._activeGeometry = null;
	        this._activeVao = null;

	        /**
	         * `true` if we has `*_vertex_array_object` extension
	         * @member {boolean}
	         * @readonly
	         */
	        this.hasVao = true;

	        /**
	         * `true` if has `ANGLE_instanced_arrays` extension
	         * @member {boolean}
	         * @readonly
	         */
	        this.hasInstance = true;

	        /**
	         * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`
	         * @member {boolean}
	         * @readonly
	         */
	        this.canUseUInt32ElementIndex = false;

	        /**
	         * A cache of currently bound buffer,
	         * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER
	         * @member {Object.<number, PIXI.Buffer>}
	         * @readonly
	         */
	        this.boundBuffers = {};

	        /**
	         * Cache for all geometries by id, used in case renderer gets destroyed or for profiling
	         * @member {object}
	         * @readonly
	         */
	        this.managedGeometries = {};

	        /**
	         * Cache for all buffers by id, used in case renderer gets destroyed or for profiling
	         * @member {object}
	         * @readonly
	         */
	        this.managedBuffers = {};
	    }

	    if ( System ) { GeometrySystem.__proto__ = System; }
	    GeometrySystem.prototype = Object.create( System && System.prototype );
	    GeometrySystem.prototype.constructor = GeometrySystem;

	    /**
	     * Sets up the renderer context and necessary buffers.
	     */
	    GeometrySystem.prototype.contextChange = function contextChange ()
	    {
	        this.disposeAll(true);

	        var gl = this.gl = this.renderer.gl;
	        var context = this.renderer.context;

	        this.CONTEXT_UID = this.renderer.CONTEXT_UID;

	        // webgl2
	        if (!gl.createVertexArray)
	        {
	            // webgl 1!
	            var nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;

	            if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)
	            {
	                nativeVaoExtension = null;
	            }

	            if (nativeVaoExtension)
	            {
	                gl.createVertexArray = function () { return nativeVaoExtension.createVertexArrayOES(); };

	                gl.bindVertexArray = function (vao) { return nativeVaoExtension.bindVertexArrayOES(vao); };

	                gl.deleteVertexArray = function (vao) { return nativeVaoExtension.deleteVertexArrayOES(vao); };
	            }
	            else
	            {
	                this.hasVao = false;
	                gl.createVertexArray = function () {
	                    // empty
	                };

	                gl.bindVertexArray = function () {
	                    // empty
	                };

	                gl.deleteVertexArray = function () {
	                    // empty
	                };
	            }
	        }

	        if (!gl.vertexAttribDivisor)
	        {
	            var instanceExt = gl.getExtension('ANGLE_instanced_arrays');

	            if (instanceExt)
	            {
	                gl.vertexAttribDivisor = function (a, b) { return instanceExt.vertexAttribDivisorANGLE(a, b); };

	                gl.drawElementsInstanced = function (a, b, c, d, e) { return instanceExt.drawElementsInstancedANGLE(a, b, c, d, e); };

	                gl.drawArraysInstanced = function (a, b, c, d) { return instanceExt.drawArraysInstancedANGLE(a, b, c, d); };
	            }
	            else
	            {
	                this.hasInstance = false;
	            }
	        }

	        this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;
	    };

	    /**
	     * Binds geometry so that is can be drawn. Creating a Vao if required
	     *
	     * @param {PIXI.Geometry} geometry instance of geometry to bind
	     * @param {PIXI.Shader} [shader] instance of shader to use vao for
	     */
	    GeometrySystem.prototype.bind = function bind (geometry, shader)
	    {
	        shader = shader || this.renderer.shader.shader;

	        var ref = this;
	        var gl = ref.gl;

	        // not sure the best way to address this..
	        // currently different shaders require different VAOs for the same geometry
	        // Still mulling over the best way to solve this one..
	        // will likely need to modify the shader attribute locations at run time!
	        var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];

	        if (!vaos)
	        {
	            this.managedGeometries[geometry.id] = geometry;
	            geometry.disposeRunner.add(this);
	            geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};
	        }

	        var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program);

	        this._activeGeometry = geometry;

	        if (this._activeVao !== vao)
	        {
	            this._activeVao = vao;

	            if (this.hasVao)
	            {
	                gl.bindVertexArray(vao);
	            }
	            else
	            {
	                this.activateVao(geometry, shader.program);
	            }
	        }

	        // TODO - optimise later!
	        // don't need to loop through if nothing changed!
	        // maybe look to add an 'autoupdate' to geometry?
	        this.updateBuffers();
	    };

	    /**
	     * Reset and unbind any active VAO and geometry
	     */
	    GeometrySystem.prototype.reset = function reset ()
	    {
	        this.unbind();
	    };

	    /**
	     * Update buffers
	     * @protected
	     */
	    GeometrySystem.prototype.updateBuffers = function updateBuffers ()
	    {
	        var geometry = this._activeGeometry;
	        var ref = this;
	        var gl = ref.gl;

	        for (var i = 0; i < geometry.buffers.length; i++)
	        {
	            var buffer = geometry.buffers[i];

	            var glBuffer = buffer._glBuffers[this.CONTEXT_UID];

	            if (buffer._updateID !== glBuffer.updateID)
	            {
	                glBuffer.updateID = buffer._updateID;

	                // TODO can cache this on buffer! maybe added a getter / setter?
	                var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;

	                // TODO this could change if the VAO changes...
	                // need to come up with a better way to cache..
	                // if (this.boundBuffers[type] !== glBuffer)
	                // {
	                // this.boundBuffers[type] = glBuffer;
	                gl.bindBuffer(type, glBuffer.buffer);
	                // }

	                this._boundBuffer = glBuffer;

	                if (glBuffer.byteLength >= buffer.data.byteLength)
	                {
	                    // offset is always zero for now!
	                    gl.bufferSubData(type, 0, buffer.data);
	                }
	                else
	                {
	                    var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;

	                    glBuffer.byteLength = buffer.data.byteLength;
	                    gl.bufferData(type, buffer.data, drawType);
	                }
	            }
	        }
	    };

	    /**
	     * Check compability between a geometry and a program
	     * @protected
	     * @param {PIXI.Geometry} geometry - Geometry instance
	     * @param {PIXI.Program} program - Program instance
	     */
	    GeometrySystem.prototype.checkCompatibility = function checkCompatibility (geometry, program)
	    {
	        // geometry must have at least all the attributes that the shader requires.
	        var geometryAttributes = geometry.attributes;
	        var shaderAttributes = program.attributeData;

	        for (var j in shaderAttributes)
	        {
	            if (!geometryAttributes[j])
	            {
	                throw new Error(("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"));
	            }
	        }
	    };

	    /**
	     * Takes a geometry and program and generates a unique signature for them.
	     *
	     * @param {PIXI.Geometry} geometry to get signature from
	     * @param {PIXI.Program} program to test geometry against
	     * @returns {String} Unique signature of the geometry and program
	     * @protected
	     */
	    GeometrySystem.prototype.getSignature = function getSignature (geometry, program)
	    {
	        var attribs = geometry.attributes;
	        var shaderAttributes = program.attributeData;

	        var strings = ['g', geometry.id];

	        for (var i in attribs)
	        {
	            if (shaderAttributes[i])
	            {
	                strings.push(i);
	            }
	        }

	        return strings.join('-');
	    };

	    /**
	     * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.
	     * If vao is created, it is bound automatically.
	     *
	     * @protected
	     * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for
	     * @param {PIXI.Program} program - Instance of program
	     */
	    GeometrySystem.prototype.initGeometryVao = function initGeometryVao (geometry, program)
	    {
	        this.checkCompatibility(geometry, program);

	        var gl = this.gl;
	        var CONTEXT_UID = this.CONTEXT_UID;

	        var signature = this.getSignature(geometry, program);

	        var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];

	        var vao = vaoObjectHash[signature];

	        if (vao)
	        {
	            // this will give us easy access to the vao
	            vaoObjectHash[program.id] = vao;

	            return vao;
	        }

	        var buffers = geometry.buffers;
	        var attributes = geometry.attributes;
	        var tempStride = {};
	        var tempStart = {};

	        for (var j in buffers)
	        {
	            tempStride[j] = 0;
	            tempStart[j] = 0;
	        }

	        for (var j$1 in attributes)
	        {
	            if (!attributes[j$1].size && program.attributeData[j$1])
	            {
	                attributes[j$1].size = program.attributeData[j$1].size;
	            }
	            else if (!attributes[j$1].size)
	            {
	                console.warn(("PIXI Geometry attribute '" + j$1 + "' size cannot be determined (likely the bound shader does not have the attribute)"));  // eslint-disable-line
	            }

	            tempStride[attributes[j$1].buffer] += attributes[j$1].size * byteSizeMap$1[attributes[j$1].type];
	        }

	        for (var j$2 in attributes)
	        {
	            var attribute = attributes[j$2];
	            var attribSize = attribute.size;

	            if (attribute.stride === undefined)
	            {
	                if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type])
	                {
	                    attribute.stride = 0;
	                }
	                else
	                {
	                    attribute.stride = tempStride[attribute.buffer];
	                }
	            }

	            if (attribute.start === undefined)
	            {
	                attribute.start = tempStart[attribute.buffer];

	                tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type];
	            }
	        }

	        vao = gl.createVertexArray();

	        gl.bindVertexArray(vao);

	        // first update - and create the buffers!
	        // only create a gl buffer if it actually gets
	        for (var i = 0; i < buffers.length; i++)
	        {
	            var buffer = buffers[i];

	            if (!buffer._glBuffers[CONTEXT_UID])
	            {
	                buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());
	                this.managedBuffers[buffer.id] = buffer;
	                buffer.disposeRunner.add(this);
	            }

	            buffer._glBuffers[CONTEXT_UID].refCount++;
	        }

	        // TODO - maybe make this a data object?
	        // lets wait to see if we need to first!

	        this.activateVao(geometry, program);

	        this._activeVao = vao;

	        // add it to the cache!
	        vaoObjectHash[program.id] = vao;
	        vaoObjectHash[signature] = vao;

	        return vao;
	    };

	    /**
	     * Disposes buffer
	     * @param {PIXI.Buffer} buffer buffer with data
	     * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray
	     */
	    GeometrySystem.prototype.disposeBuffer = function disposeBuffer (buffer, contextLost)
	    {
	        if (!this.managedBuffers[buffer.id])
	        {
	            return;
	        }

	        delete this.managedBuffers[buffer.id];

	        var glBuffer = buffer._glBuffers[this.CONTEXT_UID];
	        var gl = this.gl;

	        buffer.disposeRunner.remove(this);

	        if (!glBuffer)
	        {
	            return;
	        }

	        if (!contextLost)
	        {
	            gl.deleteBuffer(glBuffer.buffer);
	        }

	        delete buffer._glBuffers[this.CONTEXT_UID];
	    };

	    /**
	     * Disposes geometry
	     * @param {PIXI.Geometry} geometry Geometry with buffers. Only VAO will be disposed
	     * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray
	     */
	    GeometrySystem.prototype.disposeGeometry = function disposeGeometry (geometry, contextLost)
	    {
	        if (!this.managedGeometries[geometry.id])
	        {
	            return;
	        }

	        delete this.managedGeometries[geometry.id];

	        var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];
	        var gl = this.gl;
	        var buffers = geometry.buffers;

	        geometry.disposeRunner.remove(this);

	        if (!vaos)
	        {
	            return;
	        }

	        for (var i = 0; i < buffers.length; i++)
	        {
	            var buf = buffers[i]._glBuffers[this.CONTEXT_UID];

	            buf.refCount--;
	            if (buf.refCount === 0 && !contextLost)
	            {
	                this.disposeBuffer(buffers[i], contextLost);
	            }
	        }

	        if (!contextLost)
	        {
	            for (var vaoId in vaos)
	            {
	                // delete only signatures, everything else are copies
	                if (vaoId[0] === 'g')
	                {
	                    var vao = vaos[vaoId];

	                    if (this._activeVao === vao)
	                    {
	                        this.unbind();
	                    }
	                    gl.deleteVertexArray(vao);
	                }
	            }
	        }

	        delete geometry.glVertexArrayObjects[this.CONTEXT_UID];
	    };

	    /**
	     * dispose all WebGL resources of all managed geometries and buffers
	     * @param {boolean} [contextLost=false] If context was lost, we suppress `gl.delete` calls
	     */
	    GeometrySystem.prototype.disposeAll = function disposeAll (contextLost)
	    {
	        var all = Object.keys(this.managedGeometries);

	        for (var i = 0; i < all.length; i++)
	        {
	            this.disposeGeometry(this.managedGeometries[all[i]], contextLost);
	        }
	        all = Object.keys(this.managedBuffers);
	        for (var i$1 = 0; i$1 < all.length; i$1++)
	        {
	            this.disposeBuffer(this.managedBuffers[all[i$1]], contextLost);
	        }
	    };

	    /**
	     * Activate vertex array object
	     *
	     * @protected
	     * @param {PIXI.Geometry} geometry - Geometry instance
	     * @param {PIXI.Program} program - Shader program instance
	     */
	    GeometrySystem.prototype.activateVao = function activateVao (geometry, program)
	    {
	        var gl = this.gl;
	        var CONTEXT_UID = this.CONTEXT_UID;
	        var buffers = geometry.buffers;
	        var attributes = geometry.attributes;

	        if (geometry.indexBuffer)
	        {
	            // first update the index buffer if we have one..
	            gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);
	        }

	        var lastBuffer = null;

	        // add a new one!
	        for (var j in attributes)
	        {
	            var attribute = attributes[j];
	            var buffer = buffers[attribute.buffer];
	            var glBuffer = buffer._glBuffers[CONTEXT_UID];

	            if (program.attributeData[j])
	            {
	                if (lastBuffer !== glBuffer)
	                {
	                    gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);

	                    lastBuffer = glBuffer;
	                }

	                var location = program.attributeData[j].location;

	                // TODO introduce state again
	                // we can optimise this for older devices that have no VAOs
	                gl.enableVertexAttribArray(location);

	                gl.vertexAttribPointer(location,
	                    attribute.size,
	                    attribute.type || gl.FLOAT,
	                    attribute.normalized,
	                    attribute.stride,
	                    attribute.start);

	                if (attribute.instance)
	                {
	                    // TODO calculate instance count based of this...
	                    if (this.hasInstance)
	                    {
	                        gl.vertexAttribDivisor(location, 1);
	                    }
	                    else
	                    {
	                        throw new Error('geometry error, GPU Instancing is not supported on this device');
	                    }
	                }
	            }
	        }
	    };

	    /**
	     * Draw the geometry
	     *
	     * @param {Number} type - the type primitive to render
	     * @param {Number} [size] - the number of elements to be rendered
	     * @param {Number} [start] - Starting index
	     * @param {Number} [instanceCount] - the number of instances of the set of elements to execute
	     */
	    GeometrySystem.prototype.draw = function draw (type, size, start, instanceCount)
	    {
	        var ref = this;
	        var gl = ref.gl;
	        var geometry = this._activeGeometry;

	        // TODO.. this should not change so maybe cache the function?

	        if (geometry.indexBuffer)
	        {
	            var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;
	            var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;

	            if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))
	            {
	                if (geometry.instanced)
	                {
	                    /* eslint-disable max-len */
	                    gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);
	                    /* eslint-enable max-len */
	                }
	                else
	                {
	                    /* eslint-disable max-len */
	                    gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);
	                    /* eslint-enable max-len */
	                }
	            }
	            else
	            {
	                console.warn('unsupported index buffer type: uint32');
	            }
	        }
	        else if (geometry.instanced)
	        {
	            // TODO need a better way to calculate size..
	            gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);
	        }
	        else
	        {
	            gl.drawArrays(type, start, size || geometry.getSize());
	        }

	        return this;
	    };

	    /**
	     * Unbind/reset everything
	     * @protected
	     */
	    GeometrySystem.prototype.unbind = function unbind ()
	    {
	        this.gl.bindVertexArray(null);
	        this._activeVao = null;
	        this._activeGeometry = null;
	    };

	    return GeometrySystem;
	}(System));

	/**
	 * @method compileProgram
	 * @private
	 * @memberof PIXI.glCore.shader
	 * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}
	 * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.
	 * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.
	 * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations
	 * @return {WebGLProgram} the shader program
	 */
	function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations)
	{
	    var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);
	    var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);

	    var program = gl.createProgram();

	    gl.attachShader(program, glVertShader);
	    gl.attachShader(program, glFragShader);

	    // optionally, set the attributes manually for the program rather than letting WebGL decide..
	    if (attributeLocations)
	    {
	        for (var i in attributeLocations)
	        {
	            gl.bindAttribLocation(program, attributeLocations[i], i);
	        }
	    }

	    gl.linkProgram(program);

	    // if linking fails, then log and cleanup
	    if (!gl.getProgramParameter(program, gl.LINK_STATUS))
	    {
	        console.error('Pixi.js Error: Could not initialize shader.');
	        console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));
	        console.error('gl.getError()', gl.getError());

	        // if there is a program info log, log it
	        if (gl.getProgramInfoLog(program) !== '')
	        {
	            console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));
	        }

	        gl.deleteProgram(program);
	        program = null;
	    }

	    // clean up some shaders
	    gl.deleteShader(glVertShader);
	    gl.deleteShader(glFragShader);

	    return program;
	}

	/**
	 * @private
	 * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}
	 * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER
	 * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.
	 * @return {WebGLShader} the shader
	 */
	function compileShader(gl, type, src)
	{
	    var shader = gl.createShader(type);

	    gl.shaderSource(shader, src);
	    gl.compileShader(shader);

	    if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
	    {
	        console.warn(src);
	        console.error(gl.getShaderInfoLog(shader));

	        return null;
	    }

	    return shader;
	}

	/**
	 * @method defaultValue
	 * @memberof PIXI.glCore.shader
	 * @param type {String} Type of value
	 * @param size {Number}
	 * @private
	 */
	function defaultValue(type, size)
	{
	    switch (type)
	    {
	        case 'float':
	            return 0;

	        case 'vec2':
	            return new Float32Array(2 * size);

	        case 'vec3':
	            return new Float32Array(3 * size);

	        case 'vec4':
	            return new Float32Array(4 * size);

	        case 'int':
	        case 'sampler2D':
	        case 'sampler2DArray':
	            return 0;

	        case 'ivec2':
	            return new Int32Array(2 * size);

	        case 'ivec3':
	            return new Int32Array(3 * size);

	        case 'ivec4':
	            return new Int32Array(4 * size);

	        case 'bool':
	            return false;

	        case 'bvec2':

	            return booleanArray(2 * size);

	        case 'bvec3':
	            return booleanArray(3 * size);

	        case 'bvec4':
	            return booleanArray(4 * size);

	        case 'mat2':
	            return new Float32Array([1, 0,
	                0, 1]);

	        case 'mat3':
	            return new Float32Array([1, 0, 0,
	                0, 1, 0,
	                0, 0, 1]);

	        case 'mat4':
	            return new Float32Array([1, 0, 0, 0,
	                0, 1, 0, 0,
	                0, 0, 1, 0,
	                0, 0, 0, 1]);
	    }

	    return null;
	}

	function booleanArray(size)
	{
	    var array = new Array(size);

	    for (var i = 0; i < array.length; i++)
	    {
	        array[i] = false;
	    }

	    return array;
	}

	var unknownContext = {};
	var context = unknownContext;

	/**
	 * returns a little WebGL context to use for program inspection.
	 *
	 * @static
	 * @private
	 * @returns {webGL-context} a gl context to test with
	 */
	function getTestContext()
	{
	    if (context === unknownContext || context.isContextLost())
	    {
	        var canvas = document.createElement('canvas');

	        var gl;

	        if (settings.PREFER_ENV >= ENV.WEBGL2)
	        {
	            gl = canvas.getContext('webgl2', {});
	        }

	        if (!gl)
	        {
	            gl = canvas.getContext('webgl', {})
	            || canvas.getContext('experimental-webgl', {});

	            if (!gl)
	            {
	                // fail, not able to get a context
	                gl = null;
	            }
	            else
	            {
	                // for shader testing..
	                gl.getExtension('WEBGL_draw_buffers');
	            }
	        }

	        context = gl;
	    }

	    return context;
	}

	var maxFragmentPrecision;

	function getMaxFragmentPrecision()
	{
	    if (!maxFragmentPrecision)
	    {
	        maxFragmentPrecision = PRECISION.MEDIUM;
	        var gl = getTestContext();

	        if (gl)
	        {
	            if (gl.getShaderPrecisionFormat)
	            {
	                var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);

	                maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;
	            }
	        }
	    }

	    return maxFragmentPrecision;
	}

	/**
	 * Sets the float precision on the shader, ensuring the device supports the request precision.
	 * If the precision is already present, it just ensures that the device is able to handle it.
	 *
	 * @private
	 * @param {string} src - The shader source
	 * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.
	 * @param {string} maxSupportedPrecision - The maximum precision the shader supports.
	 *
	 * @return {string} modified shader source
	 */
	function setPrecision(src, requestedPrecision, maxSupportedPrecision)
	{
	    if (src.substring(0, 9) !== 'precision')
	    {
	        // no precision supplied, so PixiJS will add the requested level.
	        var precision = requestedPrecision;

	        // If highp is requested but not supported, downgrade precision to a level all devices support.
	        if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)
	        {
	            precision = PRECISION.MEDIUM;
	        }

	        return ("precision " + precision + " float;\n" + src);
	    }
	    else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')
	    {
	        // precision was supplied, but at a level this device does not support, so downgrading to mediump.
	        return src.replace('precision highp', 'precision mediump');
	    }

	    return src;
	}

	var GLSL_TO_SIZE = {
	    float:    1,
	    vec2:     2,
	    vec3:     3,
	    vec4:     4,

	    int:      1,
	    ivec2:    2,
	    ivec3:    3,
	    ivec4:    4,

	    bool:     1,
	    bvec2:    2,
	    bvec3:    3,
	    bvec4:    4,

	    mat2:     4,
	    mat3:     9,
	    mat4:     16,

	    sampler2D:  1,
	};

	/**
	 * @private
	 * @method mapSize
	 * @memberof PIXI.glCore.shader
	 * @param type {String}
	 * @return {Number}
	 */
	function mapSize(type)
	{
	    return GLSL_TO_SIZE[type];
	}

	var GL_TABLE = null;

	var GL_TO_GLSL_TYPES = {
	    FLOAT:       'float',
	    FLOAT_VEC2:  'vec2',
	    FLOAT_VEC3:  'vec3',
	    FLOAT_VEC4:  'vec4',

	    INT:         'int',
	    INT_VEC2:    'ivec2',
	    INT_VEC3:    'ivec3',
	    INT_VEC4:    'ivec4',

	    BOOL:        'bool',
	    BOOL_VEC2:   'bvec2',
	    BOOL_VEC3:   'bvec3',
	    BOOL_VEC4:   'bvec4',

	    FLOAT_MAT2:  'mat2',
	    FLOAT_MAT3:  'mat3',
	    FLOAT_MAT4:  'mat4',

	    SAMPLER_2D:  'sampler2D',
	    SAMPLER_CUBE:  'samplerCube',
	    SAMPLER_2D_ARRAY:  'sampler2DArray',
	};

	function mapType(gl, type)
	{
	    if (!GL_TABLE)
	    {
	        var typeNames = Object.keys(GL_TO_GLSL_TYPES);

	        GL_TABLE = {};

	        for (var i = 0; i < typeNames.length; ++i)
	        {
	            var tn = typeNames[i];

	            GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];
	        }
	    }

	    return GL_TABLE[type];
	}

	// cv = CachedValue
	// v = value
	// ud = uniformData
	// uv = uniformValue
	// l = location
	var GLSL_TO_SINGLE_SETTERS_CACHED = {

	    float: "\n    if(cv !== v)\n    {\n        cv.v = v;\n        gl.uniform1f(location, v)\n    }",

	    vec2: "\n    if(cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        gl.uniform2f(location, v[0], v[1])\n    }",

	    vec3: "\n    if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3f(location, v[0], v[1], v[2])\n    }",

	    vec4:     'gl.uniform4f(location, v[0], v[1], v[2], v[3])',

	    int:      'gl.uniform1i(location, v)',
	    ivec2:    'gl.uniform2i(location, v[0], v[1])',
	    ivec3:    'gl.uniform3i(location, v[0], v[1], v[2])',
	    ivec4:    'gl.uniform4i(location, v[0], v[1], v[2], v[3])',

	    bool:     'gl.uniform1i(location, v)',
	    bvec2:    'gl.uniform2i(location, v[0], v[1])',
	    bvec3:    'gl.uniform3i(location, v[0], v[1], v[2])',
	    bvec4:    'gl.uniform4i(location, v[0], v[1], v[2], v[3])',

	    mat2:     'gl.uniformMatrix2fv(location, false, v)',
	    mat3:     'gl.uniformMatrix3fv(location, false, v)',
	    mat4:     'gl.uniformMatrix4fv(location, false, v)',

	    sampler2D:      'gl.uniform1i(location, v)',
	    samplerCube:    'gl.uniform1i(location, v)',
	    sampler2DArray: 'gl.uniform1i(location, v)',
	};

	var GLSL_TO_ARRAY_SETTERS = {

	    float:    "gl.uniform1fv(location, v)",

	    vec2:     "gl.uniform2fv(location, v)",
	    vec3:     "gl.uniform3fv(location, v)",
	    vec4:     'gl.uniform4fv(location, v)',

	    mat4:     'gl.uniformMatrix4fv(location, false, v)',
	    mat3:     'gl.uniformMatrix3fv(location, false, v)',
	    mat2:     'gl.uniformMatrix2fv(location, false, v)',

	    int:      'gl.uniform1iv(location, v)',
	    ivec2:    'gl.uniform2iv(location, v)',
	    ivec3:    'gl.uniform3iv(location, v)',
	    ivec4:    'gl.uniform4iv(location, v)',

	    bool:     'gl.uniform1iv(location, v)',
	    bvec2:    'gl.uniform2iv(location, v)',
	    bvec3:    'gl.uniform3iv(location, v)',
	    bvec4:    'gl.uniform4iv(location, v)',

	    sampler2D:      'gl.uniform1iv(location, v)',
	    samplerCube:    'gl.uniform1iv(location, v)',
	    sampler2DArray: 'gl.uniform1iv(location, v)',
	};

	function generateUniformsSync(group, uniformData)
	{
	    var textureCount = 0;
	    var func = "var v = null;\n    var cv = null\n    var gl = renderer.gl";

	    for (var i in group.uniforms)
	    {
	        var data = uniformData[i];

	        if (!data)
	        {
	            if (group.uniforms[i].group)
	            {
	                func += "\n                    renderer.shader.syncUniformGroup(uv." + i + ");\n                ";
	            }

	            continue;
	        }

	        // TODO && uniformData[i].value !== 0 <-- do we still need this?
	        if (data.type === 'float' && data.size === 1)
	        {
	            func += "\n            if(uv." + i + " !== ud." + i + ".value)\n            {\n                ud." + i + ".value = uv." + i + "\n                gl.uniform1f(ud." + i + ".location, uv." + i + ")\n            }\n";
	        }
	        /* eslint-disable max-len */
	        else if ((data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray)
	        /* eslint-disable max-len */
	        {
	            func += "\n            renderer.texture.bind(uv." + i + ", " + textureCount + ");\n\n            if(ud." + i + ".value !== " + textureCount + ")\n            {\n                ud." + i + ".value = " + textureCount + ";\n                gl.uniform1i(ud." + i + ".location, " + textureCount + ");\n; // eslint-disable-line max-len\n            }\n";

	            textureCount++;
	        }
	        else if (data.type === 'mat3' && data.size === 1)
	        {
	            if (group.uniforms[i].a !== undefined)
	            {
	                // TODO and some smart caching dirty ids here!
	                func += "\n                gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ".toArray(true));\n                \n";
	            }
	            else
	            {
	                func += "\n                gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ");\n                \n";
	            }
	        }
	        else if (data.type === 'vec2' && data.size === 1)
	        {
	            // TODO - do we need both here?
	            // maybe we can get away with only using points?
	            if (group.uniforms[i].x !== undefined)
	            {
	                func += "\n                cv = ud." + i + ".value;\n                v = uv." + i + ";\n\n                if(cv[0] !== v.x || cv[1] !== v.y)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    gl.uniform2f(ud." + i + ".location, v.x, v.y);\n                }\n";
	            }
	            else
	            {
	                func += "\n                cv = ud." + i + ".value;\n                v = uv." + i + ";\n\n                if(cv[0] !== v[0] || cv[1] !== v[1])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    gl.uniform2f(ud." + i + ".location, v[0], v[1]);\n                }\n                \n";
	            }
	        }
	        else if (data.type === 'vec4' && data.size === 1)
	        {
	            // TODO - do we need both here?
	            // maybe we can get away with only using points?
	            if (group.uniforms[i].width !== undefined)
	            {
	                func += "\n                cv = ud." + i + ".value;\n                v = uv." + i + ";\n\n                if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    cv[2] = v.width;\n                    cv[3] = v.height;\n                    gl.uniform4f(ud." + i + ".location, v.x, v.y, v.width, v.height)\n                }\n";
	            }
	            else
	            {
	                func += "\n                cv = ud." + i + ".value;\n                v = uv." + i + ";\n\n                if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    cv[2] = v[2];\n                    cv[3] = v[3];\n\n                    gl.uniform4f(ud." + i + ".location, v[0], v[1], v[2], v[3])\n                }\n                \n";
	            }
	        }
	        else
	        {
	            var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;

	            var template =  templateType[data.type].replace('location', ("ud." + i + ".location"));

	            func += "\n            cv = ud." + i + ".value;\n            v = uv." + i + ";\n            " + template + ";\n";
	        }
	    }

	    return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func
	}

	var fragTemplate = [
	    'precision mediump float;',
	    'void main(void){',
	    'float test = 0.1;',
	    '%forloop%',
	    'gl_FragColor = vec4(0.0);',
	    '}' ].join('\n');

	function checkMaxIfStatementsInShader(maxIfs, gl)
	{
	    if (maxIfs === 0)
	    {
	        throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');
	    }

	    var shader = gl.createShader(gl.FRAGMENT_SHADER);

	    while (true) // eslint-disable-line no-constant-condition
	    {
	        var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));

	        gl.shaderSource(shader, fragmentSrc);
	        gl.compileShader(shader);

	        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
	        {
	            maxIfs = (maxIfs / 2) | 0;
	        }
	        else
	        {
	            // valid!
	            break;
	        }
	    }

	    return maxIfs;
	}

	function generateIfTestSrc(maxIfs)
	{
	    var src = '';

	    for (var i = 0; i < maxIfs; ++i)
	    {
	        if (i > 0)
	        {
	            src += '\nelse ';
	        }

	        if (i < maxIfs - 1)
	        {
	            src += "if(test == " + i + ".0){}";
	        }
	    }

	    return src;
	}

	// Cache the result to prevent running this over and over
	var unsafeEval;

	/**
	 * Not all platforms allow to generate function code (e.g., `new Function`).
	 * this provides the platform-level detection.
	 *
	 * @private
	 * @returns {boolean}
	 */
	function unsafeEvalSupported()
	{
	    if (typeof unsafeEval === 'boolean')
	    {
	        return unsafeEval;
	    }

	    try
	    {
	        /* eslint-disable no-new-func */
	        var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');
	        /* eslint-enable no-new-func */

	        unsafeEval = func({ a: 'b' }, 'a', 'b') === true;
	    }
	    catch (e)
	    {
	        unsafeEval = false;
	    }

	    return unsafeEval;
	}

	var defaultFragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}";

	var defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n   vTextureCoord = aTextureCoord;\n}\n";

	// import * as from '../systems/shader/shader';

	var UID$3 = 0;

	var nameCache = {};

	/**
	 * Helper class to create a shader program.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Program = function Program(vertexSrc, fragmentSrc, name)
	{
	    if ( name === void 0 ) { name = 'pixi-shader'; }

	    this.id = UID$3++;

	    /**
	     * The vertex shader.
	     *
	     * @member {string}
	     */
	    this.vertexSrc = vertexSrc || Program.defaultVertexSrc;

	    /**
	     * The fragment shader.
	     *
	     * @member {string}
	     */
	    this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;

	    this.vertexSrc = this.vertexSrc.trim();
	    this.fragmentSrc = this.fragmentSrc.trim();

	    if (this.vertexSrc.substring(0, 8) !== '#version')
	    {
	        name = name.replace(/\s+/g, '-');

	        if (nameCache[name])
	        {
	            nameCache[name]++;
	            name += "-" + (nameCache[name]);
	        }
	        else
	        {
	            nameCache[name] = 1;
	        }

	        this.vertexSrc = "#define SHADER_NAME " + name + "\n" + (this.vertexSrc);
	        this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + (this.fragmentSrc);

	        this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);
	        this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());
	    }

	    // currently this does not extract structs only default types
	    this.extractData(this.vertexSrc, this.fragmentSrc);

	    // this is where we store shader references..
	    this.glPrograms = {};

	    this.syncUniforms = null;
	};

	var staticAccessors$3 = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } };

	/**
	 * Extracts the data for a buy creating a small test program
	 * or reading the src directly.
	 * @protected
	 *
	 * @param {string} [vertexSrc] - The source of the vertex shader.
	 * @param {string} [fragmentSrc] - The source of the fragment shader.
	 */
	Program.prototype.extractData = function extractData (vertexSrc, fragmentSrc)
	{
	    var gl = getTestContext();

	    if (gl)
	    {
	        var program = compileProgram(gl, vertexSrc, fragmentSrc);

	        this.attributeData = this.getAttributeData(program, gl);
	        this.uniformData = this.getUniformData(program, gl);

	        gl.deleteProgram(program);
	    }
	    else
	    {
	        this.uniformData = {};
	        this.attributeData = {};
	    }
	};

	/**
	 * returns the attribute data from the program
	 * @private
	 *
	 * @param {WebGLProgram} [program] - the WebGL program
	 * @param {WebGLRenderingContext} [gl] - the WebGL context
	 *
	 * @returns {object} the attribute data for this program
	 */
	Program.prototype.getAttributeData = function getAttributeData (program, gl)
	{
	    var attributes = {};
	    var attributesArray = [];

	    var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);

	    for (var i = 0; i < totalAttributes; i++)
	    {
	        var attribData = gl.getActiveAttrib(program, i);
	        var type = mapType(gl, attribData.type);

	        /*eslint-disable */
	        var data = {
	            type: type,
	            name: attribData.name,
	            size: mapSize(type),
	            location: 0,
	        };
	        /* eslint-enable */

	        attributes[attribData.name] = data;
	        attributesArray.push(data);
	    }

	    attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow

	    for (var i$1 = 0; i$1 < attributesArray.length; i$1++)
	    {
	        attributesArray[i$1].location = i$1;
	    }

	    return attributes;
	};

	/**
	 * returns the uniform data from the program
	 * @private
	 *
	 * @param {webGL-program} [program] - the webgl program
	 * @param {context} [gl] - the WebGL context
	 *
	 * @returns {object} the uniform data for this program
	 */
	Program.prototype.getUniformData = function getUniformData (program, gl)
	{
	    var uniforms = {};

	    var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);

	    // TODO expose this as a prop?
	    // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');
	    // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');

	    for (var i = 0; i < totalUniforms; i++)
	    {
	        var uniformData = gl.getActiveUniform(program, i);
	        var name = uniformData.name.replace(/\[.*?\]/, '');

	        var isArray = uniformData.name.match(/\[.*?\]/, '');
	        var type = mapType(gl, uniformData.type);

	        /*eslint-disable */
	        uniforms[name] = {
	            type: type,
	            size: uniformData.size,
	            isArray:isArray,
	            value: defaultValue(type, uniformData.size),
	        };
	        /* eslint-enable */
	    }

	    return uniforms;
	};

	/**
	 * The default vertex shader source
	 *
	 * @static
	 * @constant
	 * @member {string}
	 */
	staticAccessors$3.defaultVertexSrc.get = function ()
	{
	    return defaultVertex;
	};

	/**
	 * The default fragment shader source
	 *
	 * @static
	 * @constant
	 * @member {string}
	 */
	staticAccessors$3.defaultFragmentSrc.get = function ()
	{
	    return defaultFragment;
	};

	/**
	 * A short hand function to create a program based of a vertex and fragment shader
	 * this method will also check to see if there is a cached program.
	 *
	 * @param {string} [vertexSrc] - The source of the vertex shader.
	 * @param {string} [fragmentSrc] - The source of the fragment shader.
	 * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.
	 *
	 * @returns {PIXI.Program} an shiny new Pixi shader!
	 */
	Program.from = function from (vertexSrc, fragmentSrc, name)
	{
	    var key = vertexSrc + fragmentSrc;

	    var program = ProgramCache[key];

	    if (!program)
	    {
	        ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);
	    }

	    return program;
	};

	Object.defineProperties( Program, staticAccessors$3 );

	/**
	 * A helper class for shaders
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Shader = function Shader(program, uniforms)
	{
	    /**
	     * Program that the shader uses
	     *
	     * @member {PIXI.Program}
	     */
	    this.program = program;

	    // lets see whats been passed in
	    // uniforms should be converted to a uniform group
	    if (uniforms)
	    {
	        if (uniforms instanceof UniformGroup)
	        {
	            this.uniformGroup = uniforms;
	        }
	        else
	        {
	            this.uniformGroup = new UniformGroup(uniforms);
	        }
	    }
	    else
	    {
	        this.uniformGroup = new UniformGroup({});
	    }

	    // time to build some getters and setters!
	    // I guess down the line this could sort of generate an instruction list rather than use dirty ids?
	    // does the trick for now though!
	    for (var i in program.uniformData)
	    {
	        if (this.uniformGroup.uniforms[i] instanceof Array)
	        {
	            this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);
	        }
	    }
	};

	var prototypeAccessors$2$1 = { uniforms: { configurable: true } };

	// TODO move to shader system..
	Shader.prototype.checkUniformExists = function checkUniformExists (name, group)
	{
	    if (group.uniforms[name])
	    {
	        return true;
	    }

	    for (var i in group.uniforms)
	    {
	        var uniform = group.uniforms[i];

	        if (uniform.group)
	        {
	            if (this.checkUniformExists(name, uniform))
	            {
	                return true;
	            }
	        }
	    }

	    return false;
	};

	Shader.prototype.destroy = function destroy ()
	{
	    // usage count on programs?
	    // remove if not used!
	    this.uniformGroup = null;
	};

	/**
	 * Shader uniform values, shortcut for `uniformGroup.uniforms`
	 * @readonly
	 * @member {object}
	 */
	prototypeAccessors$2$1.uniforms.get = function ()
	{
	    return this.uniformGroup.uniforms;
	};

	/**
	 * A short hand function to create a shader based of a vertex and fragment shader
	 *
	 * @param {string} [vertexSrc] - The source of the vertex shader.
	 * @param {string} [fragmentSrc] - The source of the fragment shader.
	 * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.
	 *
	 * @returns {PIXI.Shader} an shiny new Pixi shader!
	 */
	Shader.from = function from (vertexSrc, fragmentSrc, uniforms)
	{
	    var program = Program.from(vertexSrc, fragmentSrc);

	    return new Shader(program, uniforms);
	};

	Object.defineProperties( Shader.prototype, prototypeAccessors$2$1 );

	/* eslint-disable max-len */

	var BLEND = 0;
	var OFFSET = 1;
	var CULLING = 2;
	var DEPTH_TEST = 3;
	var WINDING = 4;

	/**
	 * This is a WebGL state, and is is passed The WebGL StateManager.
	 *
	 * Each mesh rendered may require WebGL to be in a different state.
	 * For example you may want different blend mode or to enable polygon offsets
	 *
	 * @class
	 * @memberof PIXI
	 */
	var State = function State()
	{
	    this.data = 0;

	    this.blendMode = BLEND_MODES.NORMAL;
	    this.polygonOffset = 0;

	    this.blend = true;
	    //  this.depthTest = true;
	};

	var prototypeAccessors$3$1 = { blend: { configurable: true },offsets: { configurable: true },culling: { configurable: true },depthTest: { configurable: true },clockwiseFrontFace: { configurable: true },blendMode: { configurable: true },polygonOffset: { configurable: true } };

	/**
	 * Activates blending of the computed fragment color values
	 *
	 * @member {boolean}
	 */
	prototypeAccessors$3$1.blend.get = function ()
	{
	    return !!(this.data & (1 << BLEND));
	};

	prototypeAccessors$3$1.blend.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (!!(this.data & (1 << BLEND)) !== value)
	    {
	        this.data ^= (1 << BLEND);
	    }
	};

	/**
	 * Activates adding an offset to depth values of polygon's fragments
	 *
	 * @member {boolean}
	 * @default false
	 */
	prototypeAccessors$3$1.offsets.get = function ()
	{
	    return !!(this.data & (1 << OFFSET));
	};

	prototypeAccessors$3$1.offsets.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (!!(this.data & (1 << OFFSET)) !== value)
	    {
	        this.data ^= (1 << OFFSET);
	    }
	};

	/**
	 * Activates culling of polygons.
	 *
	 * @member {boolean}
	 * @default false
	 */
	prototypeAccessors$3$1.culling.get = function ()
	{
	    return !!(this.data & (1 << CULLING));
	};

	prototypeAccessors$3$1.culling.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (!!(this.data & (1 << CULLING)) !== value)
	    {
	        this.data ^= (1 << CULLING);
	    }
	};

	/**
	 * Activates depth comparisons and updates to the depth buffer.
	 *
	 * @member {boolean}
	 * @default false
	 */
	prototypeAccessors$3$1.depthTest.get = function ()
	{
	    return !!(this.data & (1 << DEPTH_TEST));
	};

	prototypeAccessors$3$1.depthTest.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (!!(this.data & (1 << DEPTH_TEST)) !== value)
	    {
	        this.data ^= (1 << DEPTH_TEST);
	    }
	};

	/**
	 * Specifies whether or not front or back-facing polygons can be culled.
	 * @member {boolean}
	 * @default false
	 */
	prototypeAccessors$3$1.clockwiseFrontFace.get = function ()
	{
	    return !!(this.data & (1 << WINDING));
	};

	prototypeAccessors$3$1.clockwiseFrontFace.set = function (value) // eslint-disable-line require-jsdoc
	{
	    if (!!(this.data & (1 << WINDING)) !== value)
	    {
	        this.data ^= (1 << WINDING);
	    }
	};

	/**
	 * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.
	 * Setting this mode to anything other than NO_BLEND will automatically switch blending on.
	 *
	 * @member {number}
	 * @default PIXI.BLEND_MODES.NORMAL
	 * @see PIXI.BLEND_MODES
	 */
	prototypeAccessors$3$1.blendMode.get = function ()
	{
	    return this._blendMode;
	};

	prototypeAccessors$3$1.blendMode.set = function (value) // eslint-disable-line require-jsdoc
	{
	    this.blend = (value !== BLEND_MODES.NONE);
	    this._blendMode = value;
	};

	/**
	 * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.
	 *
	 * @member {number}
	 * @default 0
	 */
	prototypeAccessors$3$1.polygonOffset.get = function ()
	{
	    return this._polygonOffset;
	};

	prototypeAccessors$3$1.polygonOffset.set = function (value) // eslint-disable-line require-jsdoc
	{
	    this.offsets = !!value;
	    this._polygonOffset = value;
	};

	State.for2d = function for2d ()
	{
	    var state = new State();

	    state.depthTest = false;
	    state.blend = true;

	    return state;
	};

	Object.defineProperties( State.prototype, prototypeAccessors$3$1 );

	var defaultVertex$1 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n";

	var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n";

	/**
	 * Filter is a special type of WebGL shader that is applied to the screen.
	 *
	 * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the
	 * {@link PIXI.filters.BlurFilter BlurFilter}.
	 *
	 * ### Usage
	 * Filters can be applied to any DisplayObject or Container.
	 * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,
	 * then filter renders it to the screen.
	 * Multiple filters can be added to the `filters` array property and stacked on each other.
	 *
	 * ```
	 * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });
	 * const container = new PIXI.Container();
	 * container.filters = [filter];
	 * ```
	 *
	 * ### Previous Version Differences
	 *
	 * In PixiJS **v3**, a filter was always applied to _whole screen_.
	 *
	 * In PixiJS **v4**, a filter can be applied _only part of the screen_.
	 * Developers had to create a set of uniforms to deal with coordinates.
	 *
	 * In PixiJS **v5** combines _both approaches_.
	 * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,
	 * bringing those extra uniforms into account.
	 *
	 * Also be aware that we have changed default vertex shader, please consult
	 * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.
	 *
	 * ### Built-in Uniforms
	 *
	 * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,
	 * and `projectionMatrix` uniform maps it to the gl viewport.
	 *
	 * **uSampler**
	 *
	 * The most important uniform is the input texture that container was rendered into.
	 * _Important note: as with all Framebuffers in PixiJS, both input and output are
	 * premultiplied by alpha._
	 *
	 * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.
	 * Use it to sample the input.
	 *
	 * ```
	 * const fragment = `
	 * varying vec2 vTextureCoord;
	 * uniform sampler2D uSampler;
	 * void main(void)
	 * {
	 *    gl_FragColor = texture2D(uSampler, vTextureCoord);
	 * }
	 * `;
	 *
	 * const myFilter = new PIXI.Filter(null, fragment);
	 * ```
	 *
	 * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.
	 *
	 * **outputFrame**
	 *
	 * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.
	 * It's the same as `renderer.screen` for a fullscreen filter.
	 * Only a part of  `outputFrame.zw` size of temporary Framebuffer is used,
	 * `(0, 0, outputFrame.width, outputFrame.height)`,
	 *
	 * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.
	 * To calculate vertex position in screen space using normalized (0-1) space:
	 *
	 * ```
	 * vec4 filterVertexPosition( void )
	 * {
	 *     vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
	 *     return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
	 * }
	 * ```
	 *
	 * **inputSize**
	 *
	 * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.
	 * The `inputSize.xy` are size of temporary framebuffer that holds input.
	 * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.
	 *
	 * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.
	 *
	 * To calculate input normalized coordinate, you have to map it to filter normalized space.
	 * Multiply by `outputFrame.zw` to get input coordinate.
	 * Divide by `inputSize.xy` to get input normalized coordinate.
	 *
	 * ```
	 * vec2 filterTextureCoord( void )
	 * {
	 *     return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy
	 * }
	 * ```
	 * **resolution**
	 *
	 * The `resolution` is the ratio of screen (CSS) pixels to real pixels.
	 *
	 * **inputPixel**
	 *
	 * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`
	 * `inputPixel.zw` is inverted `inputPixel.xy`.
	 *
	 * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.
	 *
	 * **inputClamp**
	 *
	 * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.
	 * For displacements, coordinates has to be clamped.
	 *
	 * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer
	 * `inputClamp.zw` is bottom-right pixel center.
	 *
	 * ```
	 * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))
	 * ```
	 * OR
	 * ```
	 * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))
	 * ```
	 *
	 * ### Additional Information
	 *
	 * Complete documentation on Filter usage is located in the
	 * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.
	 *
	 * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded
	 * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.
	 *
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.Shader
	 */
	var Filter = /*@__PURE__*/(function (Shader) {
	    function Filter(vertexSrc, fragmentSrc, uniforms)
	    {
	        var program = Program.from(vertexSrc || Filter.defaultVertexSrc,
	            fragmentSrc || Filter.defaultFragmentSrc);

	        Shader.call(this, program, uniforms);

	        /**
	         * The padding of the filter. Some filters require extra space to breath such as a blur.
	         * Increasing this will add extra width and height to the bounds of the object that the
	         * filter is applied to.
	         *
	         * @member {number}
	         */
	        this.padding = 0;

	        /**
	         * The resolution of the filter. Setting this to be lower will lower the quality but
	         * increase the performance of the filter.
	         *
	         * @member {number}
	         */
	        this.resolution = settings.FILTER_RESOLUTION;

	        /**
	         * If enabled is true the filter is applied, if false it will not.
	         *
	         * @member {boolean}
	         */
	        this.enabled = true;

	        /**
	         * If enabled, PixiJS will fit the filter area into boundaries for better performance.
	         * Switch it off if it does not work for specific shader.
	         *
	         * @member {boolean}
	         */
	        this.autoFit = true;

	        /**
	         * Legacy filters use position and uvs from attributes
	         * @member {boolean}
	         * @readonly
	         */
	        this.legacy = !!this.program.attributeData.aTextureCoord;

	        /**
	         * The WebGL state the filter requires to render
	         * @member {PIXI.State}
	         */
	        this.state = new State();
	    }

	    if ( Shader ) { Filter.__proto__ = Shader; }
	    Filter.prototype = Object.create( Shader && Shader.prototype );
	    Filter.prototype.constructor = Filter;

	    var prototypeAccessors = { blendMode: { configurable: true } };
	    var staticAccessors = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } };

	    /**
	     * Applies the filter
	     *
	     * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from
	     * @param {PIXI.RenderTexture} input - The input render target.
	     * @param {PIXI.RenderTexture} output - The target to output to.
	     * @param {boolean} clear - Should the output be cleared before rendering to it
	     * @param {object} [currentState] - It's current state of filter.
	     *        There are some useful properties in the currentState :
	     *        target, filters, sourceFrame, destinationFrame, renderTarget, resolution
	     */
	    Filter.prototype.apply = function apply (filterManager, input, output, clear, currentState)
	    {
	        // do as you please!

	        filterManager.applyFilter(this, input, output, clear, currentState);

	        // or just do a regular render..
	    };

	    /**
	     * Sets the blendmode of the filter
	     *
	     * @member {number}
	     * @default PIXI.BLEND_MODES.NORMAL
	     */
	    prototypeAccessors.blendMode.get = function ()
	    {
	        return this.state.blendMode;
	    };

	    prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.state.blendMode = value;
	    };

	    /**
	     * The default vertex shader source
	     *
	     * @static
	     * @type {string}
	     * @constant
	     */
	    staticAccessors.defaultVertexSrc.get = function ()
	    {
	        return defaultVertex$1;
	    };

	    /**
	     * The default fragment shader source
	     *
	     * @static
	     * @type {string}
	     * @constant
	     */
	    staticAccessors.defaultFragmentSrc.get = function ()
	    {
	        return defaultFragment$1;
	    };

	    Object.defineProperties( Filter.prototype, prototypeAccessors );
	    Object.defineProperties( Filter, staticAccessors );

	    return Filter;
	}(Shader));

	/**
	 * Used for caching shader IDs
	 *
	 * @static
	 * @type {object}
	 * @protected
	 */
	Filter.SOURCE_KEY_MAP = {};

	var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0)  ).xy;\n}\n";

	var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n    float clip = step(3.5,\n        step(maskClamp.x, vMaskCoord.x) +\n        step(maskClamp.y, vMaskCoord.y) +\n        step(vMaskCoord.x, maskClamp.z) +\n        step(vMaskCoord.y, maskClamp.w));\n\n    vec4 original = texture2D(uSampler, vTextureCoord);\n    vec4 masky = texture2D(mask, vMaskCoord);\n    float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n    original *= (alphaMul * masky.r * alpha * clip);\n\n    gl_FragColor = original;\n}\n";

	var tempMat = new Matrix();

	/**
	 * Class controls uv mapping from Texture normal space to BaseTexture normal space.
	 *
	 * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.
	 *
	 * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.
	 * If you want to add support for texture region of certain feature or filter, that's what you're looking for.
	 *
	 * Takes track of Texture changes through `_lastTextureID` private field.
	 * Use `update()` method call to track it from outside.
	 *
	 * @see PIXI.Texture
	 * @see PIXI.Mesh
	 * @see PIXI.TilingSprite
	 * @class
	 * @memberof PIXI
	 */
	var TextureMatrix = function TextureMatrix(texture, clampMargin)
	{
	    this._texture = texture;

	    /**
	     * Matrix operation that converts texture region coords to texture coords
	     * @member {PIXI.Matrix}
	     * @readonly
	     */
	    this.mapCoord = new Matrix();

	    /**
	     * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.
	     * Calculated based on clampOffset.
	     * @member {Float32Array}
	     * @readonly
	     */
	    this.uClampFrame = new Float32Array(4);

	    /**
	     * Normalized clamp offset.
	     * Calculated based on clampOffset.
	     * @member {Float32Array}
	     * @readonly
	     */
	    this.uClampOffset = new Float32Array(2);

	    /**
	     * Tracks Texture frame changes
	     * @member {number}
	     * @protected
	     */
	    this._updateID = -1;

	    /**
	     * Changes frame clamping
	     * Works with TilingSprite and Mesh
	     * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders
	     *
	     * @default 0
	     * @member {number}
	     */
	    this.clampOffset = 0;

	    /**
	     * Changes frame clamping
	     * Works with TilingSprite and Mesh
	     * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
	     *
	     * @default 0.5
	     * @member {number}
	     */
	    this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;

	    /**
	     * If texture size is the same as baseTexture
	     * @member {boolean}
	     * @default false
	     * @readonly
	     */
	    this.isSimple = false;
	};

	var prototypeAccessors$4$1 = { texture: { configurable: true } };

	/**
	 * texture property
	 * @member {PIXI.Texture}
	 */
	prototypeAccessors$4$1.texture.get = function ()
	{
	    return this._texture;
	};

	prototypeAccessors$4$1.texture.set = function (value) // eslint-disable-line require-jsdoc
	{
	    this._texture = value;
	    this._updateID = -1;
	};

	/**
	 * Multiplies uvs array to transform
	 * @param {Float32Array} uvs mesh uvs
	 * @param {Float32Array} [out=uvs] output
	 * @returns {Float32Array} output
	 */
	TextureMatrix.prototype.multiplyUvs = function multiplyUvs (uvs, out)
	{
	    if (out === undefined)
	    {
	        out = uvs;
	    }

	    var mat = this.mapCoord;

	    for (var i = 0; i < uvs.length; i += 2)
	    {
	        var x = uvs[i];
	        var y = uvs[i + 1];

	        out[i] = (x * mat.a) + (y * mat.c) + mat.tx;
	        out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;
	    }

	    return out;
	};

	/**
	 * updates matrices if texture was changed
	 * @param {boolean} [forceUpdate=false] if true, matrices will be updated any case
	 * @returns {boolean} whether or not it was updated
	 */
	TextureMatrix.prototype.update = function update (forceUpdate)
	{
	    var tex = this._texture;

	    if (!tex || !tex.valid)
	    {
	        return false;
	    }

	    if (!forceUpdate
	        && this._updateID === tex._updateID)
	    {
	        return false;
	    }

	    this._updateID = tex._updateID;

	    var uvs = tex._uvs;

	    this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);

	    var orig = tex.orig;
	    var trim = tex.trim;

	    if (trim)
	    {
	        tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,
	            -trim.x / trim.width, -trim.y / trim.height);
	        this.mapCoord.append(tempMat);
	    }

	    var texBase = tex.baseTexture;
	    var frame = this.uClampFrame;
	    var margin = this.clampMargin / texBase.resolution;
	    var offset = this.clampOffset;

	    frame[0] = (tex._frame.x + margin + offset) / texBase.width;
	    frame[1] = (tex._frame.y + margin + offset) / texBase.height;
	    frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;
	    frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;
	    this.uClampOffset[0] = offset / texBase.realWidth;
	    this.uClampOffset[1] = offset / texBase.realHeight;

	    this.isSimple = tex._frame.width === texBase.width
	        && tex._frame.height === texBase.height
	        && tex.rotate === 0;

	    return true;
	};

	Object.defineProperties( TextureMatrix.prototype, prototypeAccessors$4$1 );

	/**
	 * This handles a Sprite acting as a mask, as opposed to a Graphic.
	 *
	 * WebGL only.
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI
	 */
	var SpriteMaskFilter = /*@__PURE__*/(function (Filter) {
	    function SpriteMaskFilter(sprite)
	    {
	        var maskMatrix = new Matrix();

	        Filter.call(this, vertex, fragment);

	        sprite.renderable = false;

	        /**
	         * Sprite mask
	         * @member {PIXI.Sprite}
	         */
	        this.maskSprite = sprite;

	        /**
	         * Mask matrix
	         * @member {PIXI.Matrix}
	         */
	        this.maskMatrix = maskMatrix;
	    }

	    if ( Filter ) { SpriteMaskFilter.__proto__ = Filter; }
	    SpriteMaskFilter.prototype = Object.create( Filter && Filter.prototype );
	    SpriteMaskFilter.prototype.constructor = SpriteMaskFilter;

	    /**
	     * Applies the filter
	     *
	     * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from
	     * @param {PIXI.RenderTexture} input - The input render target.
	     * @param {PIXI.RenderTexture} output - The target to output to.
	     * @param {boolean} clear - Should the output be cleared before rendering to it.
	     */
	    SpriteMaskFilter.prototype.apply = function apply (filterManager, input, output, clear)
	    {
	        var maskSprite = this.maskSprite;
	        var tex = this.maskSprite.texture;

	        if (!tex.valid)
	        {
	            return;
	        }
	        if (!tex.transform)
	        {
	            // margin = 0.0, let it bleed a bit, shader code becomes easier
	            // assuming that atlas textures were made with 1-pixel padding
	            tex.transform = new TextureMatrix(tex, 0.0);
	        }
	        tex.transform.update();

	        this.uniforms.npmAlpha = tex.baseTexture.premultiplyAlpha ? 0.0 : 1.0;
	        this.uniforms.mask = tex;
	        // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`
	        this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)
	            .prepend(tex.transform.mapCoord);
	        this.uniforms.alpha = maskSprite.worldAlpha;
	        this.uniforms.maskClamp = tex.transform.uClampFrame;

	        filterManager.applyFilter(this, input, output, clear);
	    };

	    return SpriteMaskFilter;
	}(Filter));

	/**
	 * System plugin to the renderer to manage masks.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var MaskSystem = /*@__PURE__*/(function (System) {
	    function MaskSystem(renderer)
	    {
	        System.call(this, renderer);

	        // TODO - we don't need both!
	        /**
	         * `true` if current pushed masked is scissor
	         * @member {boolean}
	         * @readonly
	         */
	        this.scissor = false;

	        /**
	         * Mask data
	         * @member {PIXI.Graphics}
	         * @readonly
	         */
	        this.scissorData = null;

	        /**
	         * Target to mask
	         * @member {PIXI.DisplayObject}
	         * @readonly
	         */
	        this.scissorRenderTarget = null;

	        /**
	         * Enable scissor
	         * @member {boolean}
	         * @readonly
	         */
	        this.enableScissor = false;

	        /**
	         * Pool of used sprite mask filters
	         * @member {PIXI.SpriteMaskFilter[]}
	         * @readonly
	         */
	        this.alphaMaskPool = [];

	        /**
	         * Current index of alpha mask pool
	         * @member {number}
	         * @default 0
	         * @readonly
	         */
	        this.alphaMaskIndex = 0;
	    }

	    if ( System ) { MaskSystem.__proto__ = System; }
	    MaskSystem.prototype = Object.create( System && System.prototype );
	    MaskSystem.prototype.constructor = MaskSystem;

	    /**
	     * Applies the Mask and adds it to the current filter stack.
	     *
	     * @param {PIXI.DisplayObject} target - Display Object to push the mask to
	     * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.
	     */
	    MaskSystem.prototype.push = function push (target, maskData)
	    {
	        // TODO the root check means scissor rect will not
	        // be used on render textures more info here:
	        // https://github.com/pixijs/pixi.js/pull/3545

	        if (maskData.isSprite)
	        {
	            this.pushSpriteMask(target, maskData);
	        }
	        else if (this.enableScissor
	            && !this.scissor
	            && this.renderer._activeRenderTarget.root
	            && !this.renderer.stencil.stencilMaskStack.length
	            && maskData.isFastRect())
	        {
	            var matrix = maskData.worldTransform;

	            var rot = Math.atan2(matrix.b, matrix.a);

	            // use the nearest degree!
	            rot = Math.round(rot * (180 / Math.PI));

	            if (rot % 90)
	            {
	                this.pushStencilMask(maskData);
	            }
	            else
	            {
	                this.pushScissorMask(target, maskData);
	            }
	        }
	        else
	        {
	            this.pushStencilMask(maskData);
	        }
	    };

	    /**
	     * Removes the last mask from the mask stack and doesn't return it.
	     *
	     * @param {PIXI.DisplayObject} target - Display Object to pop the mask from
	     * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.
	     */
	    MaskSystem.prototype.pop = function pop (target, maskData)
	    {
	        if (maskData.isSprite)
	        {
	            this.popSpriteMask(target, maskData);
	        }
	        else if (this.enableScissor && !this.renderer.stencil.stencilMaskStack.length)
	        {
	            this.popScissorMask(target, maskData);
	        }
	        else
	        {
	            this.popStencilMask(target, maskData);
	        }
	    };

	    /**
	     * Applies the Mask and adds it to the current filter stack.
	     *
	     * @param {PIXI.RenderTexture} target - Display Object to push the sprite mask to
	     * @param {PIXI.Sprite} maskData - Sprite to be used as the mask
	     */
	    MaskSystem.prototype.pushSpriteMask = function pushSpriteMask (target, maskData)
	    {
	        var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];

	        if (!alphaMaskFilter)
	        {
	            alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskData)];
	        }

	        alphaMaskFilter[0].resolution = this.renderer.resolution;
	        alphaMaskFilter[0].maskSprite = maskData;

	        var stashFilterArea = target.filterArea;

	        target.filterArea = maskData.getBounds(true);
	        this.renderer.filter.push(target, alphaMaskFilter);
	        target.filterArea = stashFilterArea;

	        this.alphaMaskIndex++;
	    };

	    /**
	     * Removes the last filter from the filter stack and doesn't return it.
	     *
	     */
	    MaskSystem.prototype.popSpriteMask = function popSpriteMask ()
	    {
	        this.renderer.filter.pop();
	        this.alphaMaskIndex--;
	    };

	    /**
	     * Applies the Mask and adds it to the current filter stack.
	     *
	     * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.
	     */
	    MaskSystem.prototype.pushStencilMask = function pushStencilMask (maskData)
	    {
	        this.renderer.batch.flush();
	        this.renderer.stencil.pushStencil(maskData);
	    };

	    /**
	     * Removes the last filter from the filter stack and doesn't return it.
	     *
	     */
	    MaskSystem.prototype.popStencilMask = function popStencilMask ()
	    {
	        // this.renderer.currentRenderer.stop();
	        this.renderer.stencil.popStencil();
	    };

	    /**
	     *
	     * @param {PIXI.DisplayObject} target - Display Object to push the mask to
	     * @param {PIXI.Graphics} maskData - The masking data.
	     */
	    MaskSystem.prototype.pushScissorMask = function pushScissorMask (target, maskData)
	    {
	        maskData.renderable = true;

	        var renderTarget = this.renderer._activeRenderTarget;

	        var bounds = maskData.getBounds();

	        bounds.fit(renderTarget.size);
	        maskData.renderable = false;

	        this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);

	        var resolution = this.renderer.resolution;

	        this.renderer.gl.scissor(
	            bounds.x * resolution,
	            (renderTarget.root ? renderTarget.size.height - bounds.y - bounds.height : bounds.y) * resolution,
	            bounds.width * resolution,
	            bounds.height * resolution
	        );

	        this.scissorRenderTarget = renderTarget;
	        this.scissorData = maskData;
	        this.scissor = true;
	    };

	    /**
	     * Pop scissor mask
	     *
	     */
	    MaskSystem.prototype.popScissorMask = function popScissorMask ()
	    {
	        this.scissorRenderTarget = null;
	        this.scissorData = null;
	        this.scissor = false;

	        // must be scissor!
	        var ref = this.renderer;
	        var gl = ref.gl;

	        gl.disable(gl.SCISSOR_TEST);
	    };

	    return MaskSystem;
	}(System));

	/**
	 * System plugin to the renderer to manage stencils (used for masks).
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var StencilSystem = /*@__PURE__*/(function (System) {
	    function StencilSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * The mask stack
	         * @member {PIXI.Graphics[]}
	         */
	        this.stencilMaskStack = [];
	    }

	    if ( System ) { StencilSystem.__proto__ = System; }
	    StencilSystem.prototype = Object.create( System && System.prototype );
	    StencilSystem.prototype.constructor = StencilSystem;

	    /**
	     * Changes the mask stack that is used by this System.
	     *
	     * @param {PIXI.Graphics[]} stencilMaskStack - The mask stack
	     */
	    StencilSystem.prototype.setMaskStack = function setMaskStack (stencilMaskStack)
	    {
	        var gl = this.renderer.gl;
	        var curStackLen = this.stencilMaskStack.length;

	        this.stencilMaskStack = stencilMaskStack;
	        if (stencilMaskStack.length !== curStackLen)
	        {
	            if (stencilMaskStack.length === 0)
	            {
	                gl.disable(gl.STENCIL_TEST);
	            }
	            else
	            {
	                gl.enable(gl.STENCIL_TEST);
	                this._useCurrent();
	            }
	        }
	    };

	    /**
	     * Applies the Mask and adds it to the current stencil stack. @alvin
	     *
	     * @param {PIXI.Graphics} graphics - The mask
	     */
	    StencilSystem.prototype.pushStencil = function pushStencil (graphics)
	    {
	        var gl = this.renderer.gl;
	        var prevMaskCount = this.stencilMaskStack.length;

	        if (prevMaskCount === 0)
	        {
	            // force use stencil texture in current framebuffer
	            this.renderer.framebuffer.forceStencil();
	            gl.enable(gl.STENCIL_TEST);
	        }

	        this.stencilMaskStack.push(graphics);

	        // Increment the reference stencil value where the new mask overlaps with the old ones.
	        gl.colorMask(false, false, false, false);
	        gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());
	        gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);

	        graphics.renderable = true;
	        graphics.render(this.renderer);
	        this.renderer.batch.flush();
	        graphics.renderable = false;

	        this._useCurrent();
	    };

	    /**
	     * Removes the last mask from the stencil stack. @alvin
	     */
	    StencilSystem.prototype.popStencil = function popStencil ()
	    {
	        var gl = this.renderer.gl;
	        var graphics = this.stencilMaskStack.pop();

	        if (this.stencilMaskStack.length === 0)
	        {
	            // the stack is empty!
	            gl.disable(gl.STENCIL_TEST);
	            gl.clear(gl.STENCIL_BUFFER_BIT);
	            gl.clearStencil(0);
	        }
	        else
	        {
	            // Decrement the reference stencil value where the popped mask overlaps with the other ones
	            gl.colorMask(false, false, false, false);
	            gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);

	            graphics.renderable = true;
	            graphics.render(this.renderer);
	            this.renderer.batch.flush();
	            graphics.renderable = false;

	            this._useCurrent();
	        }
	    };

	    /**
	     * Setup renderer to use the current stencil data.
	     * @private
	     */
	    StencilSystem.prototype._useCurrent = function _useCurrent ()
	    {
	        var gl = this.renderer.gl;

	        gl.colorMask(true, true, true, true);
	        gl.stencilFunc(gl.EQUAL, this.stencilMaskStack.length, this._getBitwiseMask());
	        gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
	    };

	    /**
	     * Fill 1s equal to the number of acitve stencil masks.
	     * @private
	     * @return {number} The bitwise mask.
	     */
	    StencilSystem.prototype._getBitwiseMask = function _getBitwiseMask ()
	    {
	        return (1 << this.stencilMaskStack.length) - 1;
	    };

	    /**
	     * Destroys the mask stack.
	     *
	     */
	    StencilSystem.prototype.destroy = function destroy ()
	    {
	        System.prototype.destroy.call(this, this);

	        this.stencilMaskStack = null;
	    };

	    return StencilSystem;
	}(System));

	/**
	 * System plugin to the renderer to manage the projection matrix.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */

	var ProjectionSystem = /*@__PURE__*/(function (System) {
	    function ProjectionSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * Destination frame
	         * @member {PIXI.Rectangle}
	         * @readonly
	         */
	        this.destinationFrame = null;

	        /**
	         * Source frame
	         * @member {PIXI.Rectangle}
	         * @readonly
	         */
	        this.sourceFrame = null;

	        /**
	         * Default destination frame
	         * @member {PIXI.Rectangle}
	         * @readonly
	         */
	        this.defaultFrame = null;

	        /**
	         * Project matrix
	         * @member {PIXI.Matrix}
	         * @readonly
	         */
	        this.projectionMatrix = new Matrix();

	        /**
	         * A transform that will be appended to the projection matrix
	         * if null, nothing will be applied
	         * @member {PIXI.Matrix}
	         */
	        this.transform = null;
	    }

	    if ( System ) { ProjectionSystem.__proto__ = System; }
	    ProjectionSystem.prototype = Object.create( System && System.prototype );
	    ProjectionSystem.prototype.constructor = ProjectionSystem;

	    /**
	     * Updates the projection matrix based on a projection frame (which is a rectangle)
	     *
	     * @param {PIXI.Rectangle} destinationFrame - The destination frame.
	     * @param {PIXI.Rectangle} sourceFrame - The source frame.
	     * @param {Number} resolution - Resolution
	     * @param {boolean} root - If is root
	     */
	    ProjectionSystem.prototype.update = function update (destinationFrame, sourceFrame, resolution, root)
	    {
	        this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;
	        this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;

	        this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);

	        if (this.transform)
	        {
	            this.projectionMatrix.append(this.transform);
	        }

	        var renderer =  this.renderer;

	        renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;
	        renderer.globalUniforms.update();

	        // this will work for now
	        // but would be sweet to stick and even on the global uniforms..
	        if (renderer.shader.shader)
	        {
	            renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);
	        }
	    };

	    /**
	     * Updates the projection matrix based on a projection frame (which is a rectangle)
	     *
	     * @param {PIXI.Rectangle} destinationFrame - The destination frame.
	     * @param {PIXI.Rectangle} sourceFrame - The source frame.
	     * @param {Number} resolution - Resolution
	     * @param {boolean} root - If is root
	     */
	    ProjectionSystem.prototype.calculateProjection = function calculateProjection (destinationFrame, sourceFrame, resolution, root)
	    {
	        var pm = this.projectionMatrix;

	        // I don't think we will need this line..
	        // pm.identity();

	        if (!root)
	        {
	            pm.a = (1 / destinationFrame.width * 2) * resolution;
	            pm.d = (1 / destinationFrame.height * 2) * resolution;

	            pm.tx = -1 - (sourceFrame.x * pm.a);
	            pm.ty = -1 - (sourceFrame.y * pm.d);
	        }
	        else
	        {
	            pm.a = (1 / destinationFrame.width * 2) * resolution;
	            pm.d = (-1 / destinationFrame.height * 2) * resolution;

	            pm.tx = -1 - (sourceFrame.x * pm.a);
	            pm.ty = 1 - (sourceFrame.y * pm.d);
	        }
	    };

	    /**
	     * Sets the transform of the active render target to the given matrix
	     *
	     * @param {PIXI.Matrix} matrix - The transformation matrix
	     */
	    ProjectionSystem.prototype.setTransform = function setTransform ()// matrix)
	    {
	        // this._activeRenderTarget.transform = matrix;
	    };

	    return ProjectionSystem;
	}(System));

	var tempRect = new Rectangle();

	/**
	 * System plugin to the renderer to manage render textures.
	 *
	 * Should be added after FramebufferSystem
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */

	var RenderTextureSystem = /*@__PURE__*/(function (System) {
	    function RenderTextureSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * The clear background color as rgba
	         * @member {number[]}
	         */
	        this.clearColor = renderer._backgroundColorRgba;

	        // TODO move this property somewhere else!
	        /**
	         * List of masks for the StencilSystem
	         * @member {PIXI.Graphics[]}
	         * @readonly
	         */
	        this.defaultMaskStack = [];

	        // empty render texture?
	        /**
	         * Render texture
	         * @member {PIXI.RenderTexture}
	         * @readonly
	         */
	        this.current = null;

	        /**
	         * Source frame
	         * @member {PIXI.Rectangle}
	         * @readonly
	         */
	        this.sourceFrame = new Rectangle();

	        /**
	         * Destination frame
	         * @member {PIXI.Rectangle}
	         * @readonly
	         */
	        this.destinationFrame = new Rectangle();
	    }

	    if ( System ) { RenderTextureSystem.__proto__ = System; }
	    RenderTextureSystem.prototype = Object.create( System && System.prototype );
	    RenderTextureSystem.prototype.constructor = RenderTextureSystem;

	    /**
	     * Bind the current render texture
	     * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen
	     * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture
	     * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame
	     */
	    RenderTextureSystem.prototype.bind = function bind (renderTexture, sourceFrame, destinationFrame)
	    {
	        if ( renderTexture === void 0 ) { renderTexture = null; }

	        this.current = renderTexture;

	        var renderer = this.renderer;

	        var resolution;

	        if (renderTexture)
	        {
	            var baseTexture = renderTexture.baseTexture;

	            resolution = baseTexture.resolution;

	            if (!destinationFrame)
	            {
	                tempRect.width = baseTexture.realWidth;
	                tempRect.height = baseTexture.realHeight;

	                destinationFrame = tempRect;
	            }

	            if (!sourceFrame)
	            {
	                sourceFrame = destinationFrame;
	            }

	            this.renderer.framebuffer.bind(baseTexture.framebuffer, destinationFrame);

	            this.renderer.projection.update(destinationFrame, sourceFrame, resolution, false);
	            this.renderer.stencil.setMaskStack(baseTexture.stencilMaskStack);
	        }
	        else
	        {
	            resolution = this.renderer.resolution;

	            // TODO these validation checks happen deeper down..
	            // thing they can be avoided..
	            if (!destinationFrame)
	            {
	                tempRect.width = renderer.width;
	                tempRect.height = renderer.height;

	                destinationFrame = tempRect;
	            }

	            if (!sourceFrame)
	            {
	                sourceFrame = destinationFrame;
	            }

	            renderer.framebuffer.bind(null, destinationFrame);

	            // TODO store this..
	            this.renderer.projection.update(destinationFrame, sourceFrame, resolution, true);
	            this.renderer.stencil.setMaskStack(this.defaultMaskStack);
	        }

	        this.sourceFrame.copyFrom(sourceFrame);

	        this.destinationFrame.x = destinationFrame.x / resolution;
	        this.destinationFrame.y = destinationFrame.y / resolution;

	        this.destinationFrame.width = destinationFrame.width / resolution;
	        this.destinationFrame.height = destinationFrame.height / resolution;

	        if (sourceFrame === destinationFrame)
	        {
	            this.sourceFrame.copyFrom(this.destinationFrame);
	        }
	    };

	    /**
	     * Erases the render texture and fills the drawing area with a colour
	     *
	     * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor
	     * @return {PIXI.Renderer} Returns itself.
	     */
	    RenderTextureSystem.prototype.clear = function clear (clearColor)
	    {
	        if (this.current)
	        {
	            clearColor = clearColor || this.current.baseTexture.clearColor;
	        }
	        else
	        {
	            clearColor = clearColor || this.clearColor;
	        }

	        this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
	    };

	    RenderTextureSystem.prototype.resize = function resize ()// screenWidth, screenHeight)
	    {
	        // resize the root only!
	        this.bind(null);
	    };

	    /**
	     * Resets renderTexture state
	     */
	    RenderTextureSystem.prototype.reset = function reset ()
	    {
	        this.bind(null);
	    };

	    return RenderTextureSystem;
	}(System));

	/**
	 * Helper class to create a WebGL Program
	 *
	 * @class
	 * @memberof PIXI
	 */
	var GLProgram = function GLProgram(program, uniformData)
	{
	    /**
	     * The shader program
	     *
	     * @member {WebGLProgram}
	     */
	    this.program = program;

	    /**
	     * holds the uniform data which contains uniform locations
	     * and current uniform values used for caching and preventing unneeded GPU commands
	     * @member {Object}
	     */
	    this.uniformData = uniformData;

	    /**
	     * uniformGroups holds the various upload functions for the shader. Each uniform group
	     * and program have a unique upload function generated.
	     * @member {Object}
	     */
	    this.uniformGroups = {};
	};

	/**
	 * Destroys this program
	 */
	GLProgram.prototype.destroy = function destroy ()
	{
	    this.uniformData = null;
	    this.uniformGroups = null;
	    this.program = null;
	};

	var UID$4 = 0;

	/**
	 * System plugin to the renderer to manage shaders.
	 *
	 * @class
	 * @memberof PIXI.systems
	 * @extends PIXI.System
	 */
	var ShaderSystem = /*@__PURE__*/(function (System) {
	    function ShaderSystem(renderer)
	    {
	        System.call(this, renderer);

	        // Validation check that this environment support `new Function`
	        this.systemCheck();

	        /**
	         * The current WebGL rendering context
	         *
	         * @member {WebGLRenderingContext}
	         */
	        this.gl = null;

	        this.shader = null;
	        this.program = null;

	        /**
	         * Cache to holds the generated functions. Stored against UniformObjects unique signature
	         * @type {Object}
	         * @private
	         */
	        this.cache = {};

	        this.id = UID$4++;
	    }

	    if ( System ) { ShaderSystem.__proto__ = System; }
	    ShaderSystem.prototype = Object.create( System && System.prototype );
	    ShaderSystem.prototype.constructor = ShaderSystem;

	    /**
	     * Overrideable function by `@pixi/unsafe-eval` to silence
	     * throwing an error if platform doesn't support unsafe-evals.
	     *
	     * @private
	     */
	    ShaderSystem.prototype.systemCheck = function systemCheck ()
	    {
	        if (!unsafeEvalSupported())
	        {
	            throw new Error('Current environment does not allow unsafe-eval, '
	                + 'please use @pixi/unsafe-eval module to enable support.');
	        }
	    };

	    ShaderSystem.prototype.contextChange = function contextChange (gl)
	    {
	        this.gl = gl;
	        this.reset();
	    };

	    /**
	     * Changes the current shader to the one given in parameter
	     *
	     * @param {PIXI.Shader} shader - the new shader
	     * @param {boolean} dontSync - false if the shader should automatically sync its uniforms.
	     * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.
	     */
	    ShaderSystem.prototype.bind = function bind (shader, dontSync)
	    {
	        shader.uniforms.globals = this.renderer.globalUniforms;

	        var program = shader.program;
	        var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);

	        this.shader = shader;

	        // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..
	        if (this.program !== program)
	        {
	            this.program = program;
	            this.gl.useProgram(glProgram.program);
	        }

	        if (!dontSync)
	        {
	            this.syncUniformGroup(shader.uniformGroup);
	        }

	        return glProgram;
	    };

	    /**
	     * Uploads the uniforms values to the currently bound shader.
	     *
	     * @param {object} uniforms - the uniforms values that be applied to the current shader
	     */
	    ShaderSystem.prototype.setUniforms = function setUniforms (uniforms)
	    {
	        var shader = this.shader.program;
	        var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];

	        shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);
	    };

	    ShaderSystem.prototype.syncUniformGroup = function syncUniformGroup (group)
	    {
	        var glProgram = this.getglProgram();

	        if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])
	        {
	            glProgram.uniformGroups[group.id] = group.dirtyId;

	            this.syncUniforms(group, glProgram);
	        }
	    };

	    /**
	     * Overrideable by the @pixi/unsafe-eval package to use static
	     * syncUnforms instead.
	     *
	     * @private
	     */
	    ShaderSystem.prototype.syncUniforms = function syncUniforms (group, glProgram)
	    {
	        var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);

	        syncFunc(glProgram.uniformData, group.uniforms, this.renderer);
	    };

	    ShaderSystem.prototype.createSyncGroups = function createSyncGroups (group)
	    {
	        var id = this.getSignature(group, this.shader.program.uniformData);

	        if (!this.cache[id])
	        {
	            this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);
	        }

	        group.syncUniforms[this.shader.program.id] = this.cache[id];

	        return group.syncUniforms[this.shader.program.id];
	    };

	    /**
	     * Takes a uniform group and data and generates a unique signature for them.
	     *
	     * @param {PIXI.UniformGroup} group the uniform group to get signature of
	     * @param {Object} uniformData uniform information generated by the shader
	     * @returns {String} Unique signature of the uniform group
	     * @private
	     */
	    ShaderSystem.prototype.getSignature = function getSignature (group, uniformData)
	    {
	        var uniforms = group.uniforms;

	        var strings = [];

	        for (var i in uniforms)
	        {
	            strings.push(i);

	            if (uniformData[i])
	            {
	                strings.push(uniformData[i].type);
	            }
	        }

	        return strings.join('-');
	    };

	    /**
	     * Returns the underlying GLShade rof the currently bound shader.
	     * This can be handy for when you to have a little more control over the setting of your uniforms.
	     *
	     * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context
	     */
	    ShaderSystem.prototype.getglProgram = function getglProgram ()
	    {
	        if (this.shader)
	        {
	            return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];
	        }

	        return null;
	    };

	    /**
	     * Generates a glProgram version of the Shader provided.
	     *
	     * @private
	     * @param {PIXI.Shader} shader the shader that the glProgram will be based on.
	     * @return {PIXI.GLProgram} A shiny new glProgram!
	     */
	    ShaderSystem.prototype.generateShader = function generateShader (shader)
	    {
	        var gl = this.gl;

	        var program = shader.program;

	        var attribMap = {};

	        for (var i in program.attributeData)
	        {
	            attribMap[i] = program.attributeData[i].location;
	        }

	        var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);
	        var uniformData = {};

	        for (var i$1 in program.uniformData)
	        {
	            var data = program.uniformData[i$1];

	            uniformData[i$1] = {
	                location: gl.getUniformLocation(shaderProgram, i$1),
	                value: defaultValue(data.type, data.size),
	            };
	        }

	        var glProgram = new GLProgram(shaderProgram, uniformData);

	        program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;

	        return glProgram;
	    };

	    /**
	     * Resets ShaderSystem state, does not affect WebGL state
	     */
	    ShaderSystem.prototype.reset = function reset ()
	    {
	        this.program = null;
	        this.shader = null;
	    };

	    /**
	     * Destroys this System and removes all its textures
	     */
	    ShaderSystem.prototype.destroy = function destroy ()
	    {
	        // TODO implement destroy method for ShaderSystem
	        this.destroyed = true;
	    };

	    return ShaderSystem;
	}(System));

	/**
	 * Maps gl blend combinations to WebGL.
	 *
	 * @memberof PIXI
	 * @function mapWebGLBlendModesToPixi
	 * @private
	 * @param {WebGLRenderingContext} gl - The rendering context.
	 * @param {number[][]} [array=[]] - The array to output into.
	 * @return {number[][]} Mapped modes.
	 */
	function mapWebGLBlendModesToPixi(gl, array)
	{
	    if ( array === void 0 ) { array = []; }

	    // TODO - premultiply alpha would be different.
	    // add a boolean for that!
	    array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];
	    array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.NONE] = [0, 0];

	    // not-premultiplied blend modes
	    array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];
	    array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];

	    // composite operations
	    array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];
	    array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];
	    array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];
	    array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];
	    array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];
	    array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];

	    // SUBTRACT from flash
	    array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];

	    return array;
	}

	var BLEND$1 = 0;
	var OFFSET$1 = 1;
	var CULLING$1 = 2;
	var DEPTH_TEST$1 = 3;
	var WINDING$1 = 4;

	/**
	 * System plugin to the renderer to manage WebGL state machines.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var StateSystem = /*@__PURE__*/(function (System) {
	    function StateSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * GL context
	         * @member {WebGLRenderingContext}
	         * @readonly
	         */
	        this.gl = null;

	        /**
	         * State ID
	         * @member {number}
	         * @readonly
	         */
	        this.stateId = 0;

	        /**
	         * Polygon offset
	         * @member {number}
	         * @readonly
	         */
	        this.polygonOffset = 0;

	        /**
	         * Blend mode
	         * @member {number}
	         * @default PIXI.BLEND_MODES.NONE
	         * @readonly
	         */
	        this.blendMode = BLEND_MODES.NONE;

	        /**
	         * Whether current blend equation is different
	         * @member {boolean}
	         * @protected
	         */
	        this._blendEq = false;

	        /**
	         * Collection of calls
	         * @member {function[]}
	         * @readonly
	         */
	        this.map = [];

	        // map functions for when we set state..
	        this.map[BLEND$1] = this.setBlend;
	        this.map[OFFSET$1] = this.setOffset;
	        this.map[CULLING$1] = this.setCullFace;
	        this.map[DEPTH_TEST$1] = this.setDepthTest;
	        this.map[WINDING$1] = this.setFrontFace;

	        /**
	         * Collection of check calls
	         * @member {function[]}
	         * @readonly
	         */
	        this.checks = [];

	        /**
	         * Default WebGL State
	         * @member {PIXI.State}
	         * @readonly
	         */
	        this.defaultState = new State();
	        this.defaultState.blend = true;
	        this.defaultState.depth = true;
	    }

	    if ( System ) { StateSystem.__proto__ = System; }
	    StateSystem.prototype = Object.create( System && System.prototype );
	    StateSystem.prototype.constructor = StateSystem;

	    StateSystem.prototype.contextChange = function contextChange (gl)
	    {
	        this.gl = gl;

	        this.blendModes = mapWebGLBlendModesToPixi(gl);

	        this.set(this.defaultState);

	        this.reset();
	    };

	    /**
	     * Sets the current state
	     *
	     * @param {*} state - The state to set.
	     */
	    StateSystem.prototype.set = function set (state)
	    {
	        state = state || this.defaultState;

	        // TODO maybe to an object check? ( this.state === state )?
	        if (this.stateId !== state.data)
	        {
	            var diff = this.stateId ^ state.data;
	            var i = 0;

	            // order from least to most common
	            while (diff)
	            {
	                if (diff & 1)
	                {
	                    // state change!
	                    this.map[i].call(this, !!(state.data & (1 << i)));
	                }

	                diff = diff >> 1;
	                i++;
	            }

	            this.stateId = state.data;
	        }

	        // based on the above settings we check for specific modes..
	        // for example if blend is active we check and set the blend modes
	        // or of polygon offset is active we check the poly depth.
	        for (var i$1 = 0; i$1 < this.checks.length; i$1++)
	        {
	            this.checks[i$1](this, state);
	        }
	    };

	    /**
	     * Sets the state, when previous state is unknown
	     *
	     * @param {*} state - The state to set
	     */
	    StateSystem.prototype.forceState = function forceState (state)
	    {
	        state = state || this.defaultState;
	        for (var i = 0; i < this.map.length; i++)
	        {
	            this.map[i].call(this, !!(state.data & (1 << i)));
	        }
	        for (var i$1 = 0; i$1 < this.checks.length; i$1++)
	        {
	            this.checks[i$1](this, state);
	        }

	        this.stateId = state.data;
	    };

	    /**
	     * Enables or disabled blending.
	     *
	     * @param {boolean} value - Turn on or off webgl blending.
	     */
	    StateSystem.prototype.setBlend = function setBlend (value)
	    {
	        this.updateCheck(StateSystem.checkBlendMode, value);

	        this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);
	    };

	    /**
	     * Enables or disable polygon offset fill
	     *
	     * @param {boolean} value - Turn on or off webgl polygon offset testing.
	     */
	    StateSystem.prototype.setOffset = function setOffset (value)
	    {
	        this.updateCheck(StateSystem.checkPolygonOffset, value);

	        this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);
	    };

	    /**
	     * Sets whether to enable or disable depth test.
	     *
	     * @param {boolean} value - Turn on or off webgl depth testing.
	     */
	    StateSystem.prototype.setDepthTest = function setDepthTest (value)
	    {
	        this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);
	    };

	    /**
	     * Sets whether to enable or disable cull face.
	     *
	     * @param {boolean} value - Turn on or off webgl cull face.
	     */
	    StateSystem.prototype.setCullFace = function setCullFace (value)
	    {
	        this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);
	    };

	    /**
	     * Sets the gl front face.
	     *
	     * @param {boolean} value - true is clockwise and false is counter-clockwise
	     */
	    StateSystem.prototype.setFrontFace = function setFrontFace (value)
	    {
	        this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);
	    };

	    /**
	     * Sets the blend mode.
	     *
	     * @param {number} value - The blend mode to set to.
	     */
	    StateSystem.prototype.setBlendMode = function setBlendMode (value)
	    {
	        if (value === this.blendMode)
	        {
	            return;
	        }

	        this.blendMode = value;

	        var mode = this.blendModes[value];
	        var gl = this.gl;

	        if (mode.length === 2)
	        {
	            gl.blendFunc(mode[0], mode[1]);
	        }
	        else
	        {
	            gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);
	        }
	        if (mode.length === 6)
	        {
	            this._blendEq = true;
	            gl.blendEquationSeparate(mode[4], mode[5]);
	        }
	        else if (this._blendEq)
	        {
	            this._blendEq = false;
	            gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
	        }
	    };

	    /**
	     * Sets the polygon offset.
	     *
	     * @param {number} value - the polygon offset
	     * @param {number} scale - the polygon offset scale
	     */
	    StateSystem.prototype.setPolygonOffset = function setPolygonOffset (value, scale)
	    {
	        this.gl.polygonOffset(value, scale);
	    };

	    // used
	    /**
	     * Resets all the logic and disables the vaos
	     */
	    StateSystem.prototype.reset = function reset ()
	    {
	        this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);

	        this.forceState(0);

	        this._blendEq = true;
	        this.blendMode = -1;
	        this.setBlendMode(0);
	    };

	    /**
	     * checks to see which updates should be checked based on which settings have been activated.
	     * For example, if blend is enabled then we should check the blend modes each time the state is changed
	     * or if polygon fill is activated then we need to check if the polygon offset changes.
	     * The idea is that we only check what we have too.
	     *
	     * @param {Function} func  the checking function to add or remove
	     * @param {boolean} value  should the check function be added or removed.
	     */
	    StateSystem.prototype.updateCheck = function updateCheck (func, value)
	    {
	        var index = this.checks.indexOf(func);

	        if (value && index === -1)
	        {
	            this.checks.push(func);
	        }
	        else if (!value && index !== -1)
	        {
	            this.checks.splice(index, 1);
	        }
	    };

	    /**
	     * A private little wrapper function that we call to check the blend mode.
	     *
	     * @static
	     * @private
	     * @param {PIXI.StateSystem} System  the System to perform the state check on
	     * @param {PIXI.State} state  the state that the blendMode will pulled from
	     */
	    StateSystem.checkBlendMode = function checkBlendMode (system, state)
	    {
	        system.setBlendMode(state.blendMode);
	    };

	    /**
	     * A private little wrapper function that we call to check the polygon offset.
	     *
	     * @static
	     * @private
	     * @param {PIXI.StateSystem} System  the System to perform the state check on
	     * @param {PIXI.State} state  the state that the blendMode will pulled from
	     */
	    StateSystem.checkPolygonOffset = function checkPolygonOffset (system, state)
	    {
	        system.setPolygonOffset(state.polygonOffset, 0);
	    };

	    return StateSystem;
	}(System));

	/**
	 * System plugin to the renderer to manage texture garbage collection on the GPU,
	 * ensuring that it does not get clogged up with textures that are no longer being used.
	 *
	 * @class
	 * @memberof PIXI.systems
	 * @extends PIXI.System
	 */
	var TextureGCSystem = /*@__PURE__*/(function (System) {
	    function TextureGCSystem(renderer)
	    {
	        System.call(this, renderer);

	        /**
	         * Count
	         * @member {number}
	         * @readonly
	         */
	        this.count = 0;

	        /**
	         * Check count
	         * @member {number}
	         * @readonly
	         */
	        this.checkCount = 0;

	        /**
	         * Maximum idle time, in seconds
	         * @member {number}
	         * @see PIXI.settings.GC_MAX_IDLE
	         */
	        this.maxIdle = settings.GC_MAX_IDLE;

	        /**
	         * Maximum number of item to check
	         * @member {number}
	         * @see PIXI.settings.GC_MAX_CHECK_COUNT
	         */
	        this.checkCountMax = settings.GC_MAX_CHECK_COUNT;

	        /**
	         * Current garabage collection mode
	         * @member {PIXI.GC_MODES}
	         * @see PIXI.settings.GC_MODE
	         */
	        this.mode = settings.GC_MODE;
	    }

	    if ( System ) { TextureGCSystem.__proto__ = System; }
	    TextureGCSystem.prototype = Object.create( System && System.prototype );
	    TextureGCSystem.prototype.constructor = TextureGCSystem;

	    /**
	     * Checks to see when the last time a texture was used
	     * if the texture has not been used for a specified amount of time it will be removed from the GPU
	     */
	    TextureGCSystem.prototype.postrender = function postrender ()
	    {
	        this.count++;

	        if (this.mode === GC_MODES.MANUAL)
	        {
	            return;
	        }

	        this.checkCount++;

	        if (this.checkCount > this.checkCountMax)
	        {
	            this.checkCount = 0;

	            this.run();
	        }
	    };

	    /**
	     * Checks to see when the last time a texture was used
	     * if the texture has not been used for a specified amount of time it will be removed from the GPU
	     */
	    TextureGCSystem.prototype.run = function run ()
	    {
	        var tm = this.renderer.texture;
	        var managedTextures =  tm.managedTextures;
	        var wasRemoved = false;

	        for (var i = 0; i < managedTextures.length; i++)
	        {
	            var texture = managedTextures[i];

	            // only supports non generated textures at the moment!
	            if (!texture.framebuffer && this.count - texture.touched > this.maxIdle)
	            {
	                tm.destroyTexture(texture, true);
	                managedTextures[i] = null;
	                wasRemoved = true;
	            }
	        }

	        if (wasRemoved)
	        {
	            var j = 0;

	            for (var i$1 = 0; i$1 < managedTextures.length; i$1++)
	            {
	                if (managedTextures[i$1] !== null)
	                {
	                    managedTextures[j++] = managedTextures[i$1];
	                }
	            }

	            managedTextures.length = j;
	        }
	    };

	    /**
	     * Removes all the textures within the specified displayObject and its children from the GPU
	     *
	     * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.
	     */
	    TextureGCSystem.prototype.unload = function unload (displayObject)
	    {
	        var tm = this.renderer.textureSystem;

	        // only destroy non generated textures
	        if (displayObject._texture && displayObject._texture._glRenderTargets)
	        {
	            tm.destroyTexture(displayObject._texture);
	        }

	        for (var i = displayObject.children.length - 1; i >= 0; i--)
	        {
	            this.unload(displayObject.children[i]);
	        }
	    };

	    return TextureGCSystem;
	}(System));

	/**
	 * Internal texture for WebGL context
	 * @class
	 * @memberof PIXI
	 */
	var GLTexture = function GLTexture(texture)
	{
	    /**
	     * The WebGL texture
	     * @member {WebGLTexture}
	     */
	    this.texture = texture;

	    /**
	     * Width of texture that was used in texImage2D
	     * @member {number}
	     */
	    this.width = -1;

	    /**
	     * Height of texture that was used in texImage2D
	     * @member {number}
	     */
	    this.height = -1;

	    /**
	     * Texture contents dirty flag
	     * @member {number}
	     */
	    this.dirtyId = -1;

	    /**
	     * Texture style dirty flag
	     * @member {number}
	     */
	    this.dirtyStyleId = -1;

	    /**
	     * Whether mip levels has to be generated
	     * @member {boolean}
	     */
	    this.mipmap = false;

	    /**
	     * WrapMode copied from baseTexture
	     * @member {number}
	     */
	    this.wrapMode = 33071;

	    /**
	     * Type copied from baseTexture
	     * @member {number}
	     */
	    this.type = 6408;

	    /**
	     * Type copied from baseTexture
	     * @member {number}
	     */
	    this.internalFormat = 5121;
	};

	/**
	 * System plugin to the renderer to manage textures.
	 *
	 * @class
	 * @extends PIXI.System
	 * @memberof PIXI.systems
	 */
	var TextureSystem = /*@__PURE__*/(function (System) {
	    function TextureSystem(renderer)
	    {
	        System.call(this, renderer);

	        // TODO set to max textures...
	        /**
	         * Bound textures
	         * @member {PIXI.BaseTexture[]}
	         * @readonly
	         */
	        this.boundTextures = [];
	        /**
	         * Current location
	         * @member {number}
	         * @readonly
	         */
	        this.currentLocation = -1;

	        /**
	         * List of managed textures
	         * @member {PIXI.BaseTexture[]}
	         * @readonly
	         */
	        this.managedTextures = [];

	        /**
	         * Did someone temper with textures state? We'll overwrite them when we need to unbind something.
	         * @member {boolean}
	         * @private
	         */
	        this._unknownBoundTextures = false;

	        /**
	         * BaseTexture value that shows that we don't know what is bound
	         * @member {PIXI.BaseTexture}
	         * @readonly
	         */
	        this.unknownTexture = new BaseTexture();
	    }

	    if ( System ) { TextureSystem.__proto__ = System; }
	    TextureSystem.prototype = Object.create( System && System.prototype );
	    TextureSystem.prototype.constructor = TextureSystem;

	    /**
	     * Sets up the renderer context and necessary buffers.
	     */
	    TextureSystem.prototype.contextChange = function contextChange ()
	    {
	        var gl = this.gl = this.renderer.gl;

	        this.CONTEXT_UID = this.renderer.CONTEXT_UID;

	        this.webGLVersion = this.renderer.context.webGLVersion;

	        var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);

	        this.boundTextures.length = maxTextures;

	        for (var i = 0; i < maxTextures; i++)
	        {
	            this.boundTextures[i] = null;
	        }

	        // TODO move this.. to a nice make empty textures class..
	        this.emptyTextures = {};

	        var emptyTexture2D = new GLTexture(gl.createTexture());

	        gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);
	        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));

	        this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;
	        this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());

	        gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);

	        for (var i$1 = 0; i$1 < 6; i$1++)
	        {
	            gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i$1, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
	        }

	        gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
	        gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);

	        for (var i$2 = 0; i$2 < this.boundTextures.length; i$2++)
	        {
	            this.bind(null, i$2);
	        }
	    };

	    /**
	     * Bind a texture to a specific location
	     *
	     * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`
	     *
	     * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind
	     * @param {number} [location=0] - Location to bind at
	     */
	    TextureSystem.prototype.bind = function bind (texture, location)
	    {
	        if ( location === void 0 ) { location = 0; }

	        var ref = this;
	        var gl = ref.gl;

	        if (texture)
	        {
	            texture = texture.baseTexture || texture;

	            if (texture.valid)
	            {
	                texture.touched = this.renderer.textureGC.count;

	                var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);

	                if (this.currentLocation !== location)
	                {
	                    this.currentLocation = location;
	                    gl.activeTexture(gl.TEXTURE0 + location);
	                }

	                if (this.boundTextures[location] !== texture)
	                {
	                    gl.bindTexture(texture.target, glTexture.texture);
	                }

	                if (glTexture.dirtyId !== texture.dirtyId)
	                {
	                    this.updateTexture(texture);
	                }

	                this.boundTextures[location] = texture;
	            }
	        }
	        else
	        {
	            if (this.currentLocation !== location)
	            {
	                this.currentLocation = location;
	                gl.activeTexture(gl.TEXTURE0 + location);
	            }

	            gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);
	            this.boundTextures[location] = null;
	        }
	    };

	    /**
	     * Resets texture location and bound textures
	     *
	     * Actual `bind(null, i)` calls will be performed at next `unbind()` call
	     */
	    TextureSystem.prototype.reset = function reset ()
	    {
	        this._unknownBoundTextures = true;
	        this.currentLocation = -1;

	        for (var i = 0; i < this.boundTextures.length; i++)
	        {
	            this.boundTextures[i] = this.unknownTexture;
	        }
	    };

	    /**
	     * Unbind a texture
	     * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind
	     */
	    TextureSystem.prototype.unbind = function unbind (texture)
	    {
	        var ref = this;
	        var gl = ref.gl;
	        var boundTextures = ref.boundTextures;

	        if (this._unknownBoundTextures)
	        {
	            this._unknownBoundTextures = false;
	            // someone changed webGL state,
	            // we have to be sure that our texture does not appear in multi-texture renderer samplers
	            for (var i = 0; i < boundTextures.length; i++)
	            {
	                if (boundTextures[i] === this.unknownTexture)
	                {
	                    this.bind(null, i);
	                }
	            }
	        }

	        for (var i$1 = 0; i$1 < boundTextures.length; i$1++)
	        {
	            if (boundTextures[i$1] === texture)
	            {
	                if (this.currentLocation !== i$1)
	                {
	                    gl.activeTexture(gl.TEXTURE0 + i$1);
	                    this.currentLocation = i$1;
	                }

	                gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[texture.target].texture);
	                boundTextures[i$1] = null;
	            }
	        }
	    };

	    /**
	     * Initialize a texture
	     *
	     * @private
	     * @param {PIXI.BaseTexture} texture - Texture to initialize
	     */
	    TextureSystem.prototype.initTexture = function initTexture (texture)
	    {
	        var glTexture = new GLTexture(this.gl.createTexture());

	        // guarantee an update..
	        glTexture.dirtyId = -1;

	        texture._glTextures[this.CONTEXT_UID] = glTexture;

	        this.managedTextures.push(texture);
	        texture.on('dispose', this.destroyTexture, this);

	        return glTexture;
	    };

	    TextureSystem.prototype.initTextureType = function initTextureType (texture, glTexture)
	    {
	        glTexture.internalFormat = texture.format;
	        glTexture.type = texture.type;
	        if (this.webGLVersion !== 2)
	        {
	            return;
	        }
	        var gl = this.renderer.gl;

	        if (texture.type === gl.FLOAT
	            && texture.format === gl.RGBA)
	        {
	            glTexture.internalFormat = gl.RGBA32F;
	        }
	        // that's WebGL1 HALF_FLOAT_OES
	        // we have to convert it to WebGL HALF_FLOAT
	        if (texture.type === TYPES.HALF_FLOAT)
	        {
	            glTexture.type = gl.HALF_FLOAT;
	        }
	        if (glTexture.type === gl.HALF_FLOAT
	            && texture.format === gl.RGBA)
	        {
	            glTexture.internalFormat = gl.RGBA16F;
	        }
	    };

	    /**
	     * Update a texture
	     *
	     * @private
	     * @param {PIXI.BaseTexture} texture - Texture to initialize
	     */
	    TextureSystem.prototype.updateTexture = function updateTexture (texture)
	    {
	        var glTexture = texture._glTextures[this.CONTEXT_UID];

	        if (!glTexture)
	        {
	            return;
	        }

	        var renderer = this.renderer;

	        this.initTextureType(texture, glTexture);

	        if (texture.resource && texture.resource.upload(renderer, texture, glTexture))
	        { ; }
	        else
	        {
	            // default, renderTexture-like logic
	            var width = texture.realWidth;
	            var height = texture.realHeight;
	            var gl = renderer.gl;

	            if (glTexture.width !== width
	                || glTexture.height !== height
	                || glTexture.dirtyId < 0)
	            {
	                glTexture.width = width;
	                glTexture.height = height;

	                gl.texImage2D(texture.target, 0,
	                    glTexture.internalFormat,
	                    width,
	                    height,
	                    0,
	                    texture.format,
	                    glTexture.type,
	                    null);
	            }
	        }

	        // lets only update what changes..
	        if (texture.dirtyStyleId !== glTexture.dirtyStyleId)
	        {
	            this.updateTextureStyle(texture);
	        }
	        glTexture.dirtyId = texture.dirtyId;
	    };

	    /**
	     * Deletes the texture from WebGL
	     *
	     * @private
	     * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to destroy
	     * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.
	     */
	    TextureSystem.prototype.destroyTexture = function destroyTexture (texture, skipRemove)
	    {
	        var ref = this;
	        var gl = ref.gl;

	        texture = texture.baseTexture || texture;

	        if (texture._glTextures[this.CONTEXT_UID])
	        {
	            this.unbind(texture);

	            gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);
	            texture.off('dispose', this.destroyTexture, this);

	            delete texture._glTextures[this.CONTEXT_UID];

	            if (!skipRemove)
	            {
	                var i = this.managedTextures.indexOf(texture);

	                if (i !== -1)
	                {
	                    removeItems(this.managedTextures, i, 1);
	                }
	            }
	        }
	    };

	    /**
	     * Update texture style such as mipmap flag
	     *
	     * @private
	     * @param {PIXI.BaseTexture} texture - Texture to update
	     */
	    TextureSystem.prototype.updateTextureStyle = function updateTextureStyle (texture)
	    {
	        var glTexture = texture._glTextures[this.CONTEXT_UID];

	        if (!glTexture)
	        {
	            return;
	        }

	        if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)
	        {
	            glTexture.mipmap = 0;
	            glTexture.wrapMode = WRAP_MODES.CLAMP;
	        }
	        else
	        {
	            glTexture.mipmap = texture.mipmap >= 1;
	            glTexture.wrapMode = texture.wrapMode;
	        }

	        if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))
	        { ; }
	        else
	        {
	            this.setStyle(texture, glTexture);
	        }

	        glTexture.dirtyStyleId = texture.dirtyStyleId;
	    };

	    /**
	     * Set style for texture
	     *
	     * @private
	     * @param {PIXI.BaseTexture} texture - Texture to update
	     * @param {PIXI.GLTexture} glTexture
	     */
	    TextureSystem.prototype.setStyle = function setStyle (texture, glTexture)
	    {
	        var gl = this.gl;

	        if (glTexture.mipmap)
	        {
	            gl.generateMipmap(texture.target);
	        }

	        gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);
	        gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);

	        if (glTexture.mipmap)
	        {
	            /* eslint-disable max-len */
	            gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);
	            /* eslint-disable max-len */

	            var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;

	            if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)
	            {
	                var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));

	                gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);
	            }
	        }
	        else
	        {
	            gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST);
	        }

	        gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST);
	    };

	    return TextureSystem;
	}(System));

	/**
	 * Systems are individual components to the Renderer pipeline.
	 * @namespace PIXI.systems
	 */

	var systems = ({
	    FilterSystem: FilterSystem,
	    BatchSystem: BatchSystem,
	    ContextSystem: ContextSystem,
	    FramebufferSystem: FramebufferSystem,
	    GeometrySystem: GeometrySystem,
	    MaskSystem: MaskSystem,
	    StencilSystem: StencilSystem,
	    ProjectionSystem: ProjectionSystem,
	    RenderTextureSystem: RenderTextureSystem,
	    ShaderSystem: ShaderSystem,
	    StateSystem: StateSystem,
	    TextureGCSystem: TextureGCSystem,
	    TextureSystem: TextureSystem
	});

	var tempMatrix = new Matrix();

	/**
	 * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}
	 * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.
	 *
	 * @abstract
	 * @class
	 * @extends PIXI.utils.EventEmitter
	 * @memberof PIXI
	 */
	var AbstractRenderer = /*@__PURE__*/(function (EventEmitter) {
	    function AbstractRenderer(system, options)
	    {
	        EventEmitter.call(this);

	        // Add the default render options
	        options = Object.assign({}, settings.RENDER_OPTIONS, options);

	        // Deprecation notice for renderer roundPixels option
	        if (options.roundPixels)
	        {
	            settings.ROUND_PIXELS = options.roundPixels;
	            deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);
	        }

	        /**
	         * The supplied constructor options.
	         *
	         * @member {Object}
	         * @readOnly
	         */
	        this.options = options;

	        /**
	         * The type of the renderer.
	         *
	         * @member {number}
	         * @default PIXI.RENDERER_TYPE.UNKNOWN
	         * @see PIXI.RENDERER_TYPE
	         */
	        this.type = RENDERER_TYPE.UNKNOWN;

	        /**
	         * Measurements of the screen. (0, 0, screenWidth, screenHeight).
	         *
	         * Its safe to use as filterArea or hitArea for the whole stage.
	         *
	         * @member {PIXI.Rectangle}
	         */
	        this.screen = new Rectangle(0, 0, options.width, options.height);

	        /**
	         * The canvas element that everything is drawn to.
	         *
	         * @member {HTMLCanvasElement}
	         */
	        this.view = options.view || document.createElement('canvas');

	        /**
	         * The resolution / device pixel ratio of the renderer.
	         *
	         * @member {number}
	         * @default 1
	         */
	        this.resolution = options.resolution || settings.RESOLUTION;

	        /**
	         * Whether the render view is transparent.
	         *
	         * @member {boolean}
	         */
	        this.transparent = options.transparent;

	        /**
	         * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
	         *
	         * @member {boolean}
	         */
	        this.autoDensity = options.autoDensity || options.autoResize || false;
	        // autoResize is deprecated, provides fallback support

	        /**
	         * The value of the preserveDrawingBuffer flag affects whether or not the contents of
	         * the stencil buffer is retained after rendering.
	         *
	         * @member {boolean}
	         */
	        this.preserveDrawingBuffer = options.preserveDrawingBuffer;

	        /**
	         * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
	         * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every
	         * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect
	         * to clear the canvas every frame. Disable this by setting this to false. For example, if
	         * your game has a canvas filling background image you often don't need this set.
	         *
	         * @member {boolean}
	         * @default
	         */
	        this.clearBeforeRender = options.clearBeforeRender;

	        /**
	         * The background color as a number.
	         *
	         * @member {number}
	         * @protected
	         */
	        this._backgroundColor = 0x000000;

	        /**
	         * The background color as an [R, G, B] array.
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this._backgroundColorRgba = [0, 0, 0, 0];

	        /**
	         * The background color as a string.
	         *
	         * @member {string}
	         * @protected
	         */
	        this._backgroundColorString = '#000000';

	        this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter

	        /**
	         * This temporary display object used as the parent of the currently being rendered item.
	         *
	         * @member {PIXI.DisplayObject}
	         * @protected
	         */
	        this._tempDisplayObjectParent = new Container();

	        /**
	         * The last root object that the renderer tried to render.
	         *
	         * @member {PIXI.DisplayObject}
	         * @protected
	         */
	        this._lastObjectRendered = this._tempDisplayObjectParent;

	        /**
	         * Collection of plugins.
	         * @readonly
	         * @member {object}
	         */
	        this.plugins = {};
	    }

	    if ( EventEmitter ) { AbstractRenderer.__proto__ = EventEmitter; }
	    AbstractRenderer.prototype = Object.create( EventEmitter && EventEmitter.prototype );
	    AbstractRenderer.prototype.constructor = AbstractRenderer;

	    var prototypeAccessors = { width: { configurable: true },height: { configurable: true },backgroundColor: { configurable: true } };

	    /**
	     * Initialize the plugins.
	     *
	     * @protected
	     * @param {object} staticMap - The dictionary of statically saved plugins.
	     */
	    AbstractRenderer.prototype.initPlugins = function initPlugins (staticMap)
	    {
	        for (var o in staticMap)
	        {
	            this.plugins[o] = new (staticMap[o])(this);
	        }
	    };

	    /**
	     * Same as view.width, actual number of pixels in the canvas by horizontal.
	     *
	     * @member {number}
	     * @readonly
	     * @default 800
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return this.view.width;
	    };

	    /**
	     * Same as view.height, actual number of pixels in the canvas by vertical.
	     *
	     * @member {number}
	     * @readonly
	     * @default 600
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return this.view.height;
	    };

	    /**
	     * Resizes the screen and canvas to the specified width and height.
	     * Canvas dimensions are multiplied by resolution.
	     *
	     * @param {number} screenWidth - The new width of the screen.
	     * @param {number} screenHeight - The new height of the screen.
	     */
	    AbstractRenderer.prototype.resize = function resize (screenWidth, screenHeight)
	    {
	        this.screen.width = screenWidth;
	        this.screen.height = screenHeight;

	        this.view.width = screenWidth * this.resolution;
	        this.view.height = screenHeight * this.resolution;

	        if (this.autoDensity)
	        {
	            this.view.style.width = screenWidth + "px";
	            this.view.style.height = screenHeight + "px";
	        }
	    };

	    /**
	     * Useful function that returns a texture of the display object that can then be used to create sprites
	     * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.
	     *
	     * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.
	     * @param {number} scaleMode - Should be one of the scaleMode consts.
	     * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.
	     * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,
	     *        if no region is specified, defaults to the local bounds of the displayObject.
	     * @return {PIXI.RenderTexture} A texture of the graphics object.
	     */
	    AbstractRenderer.prototype.generateTexture = function generateTexture (displayObject, scaleMode, resolution, region)
	    {
	        region = region || displayObject.getLocalBounds();

	        // minimum texture size is 1x1, 0x0 will throw an error
	        if (region.width === 0) { region.width = 1; }
	        if (region.height === 0) { region.height = 1; }

	        var renderTexture = RenderTexture.create(region.width | 0, region.height | 0, scaleMode, resolution);

	        tempMatrix.tx = -region.x;
	        tempMatrix.ty = -region.y;

	        this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);

	        return renderTexture;
	    };

	    /**
	     * Removes everything from the renderer and optionally removes the Canvas DOM element.
	     *
	     * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.
	     */
	    AbstractRenderer.prototype.destroy = function destroy (removeView)
	    {
	        for (var o in this.plugins)
	        {
	            this.plugins[o].destroy();
	            this.plugins[o] = null;
	        }

	        if (removeView && this.view.parentNode)
	        {
	            this.view.parentNode.removeChild(this.view);
	        }

	        this.plugins = null;

	        this.type = RENDERER_TYPE.UNKNOWN;

	        this.view = null;

	        this.screen = null;

	        this.resolution = 0;

	        this.transparent = false;

	        this.autoDensity = false;

	        this.blendModes = null;

	        this.options = null;

	        this.preserveDrawingBuffer = false;
	        this.clearBeforeRender = false;

	        this._backgroundColor = 0;
	        this._backgroundColorRgba = null;
	        this._backgroundColorString = null;

	        this._tempDisplayObjectParent = null;
	        this._lastObjectRendered = null;
	    };

	    /**
	     * The background color to fill if not transparent
	     *
	     * @member {number}
	     */
	    prototypeAccessors.backgroundColor.get = function ()
	    {
	        return this._backgroundColor;
	    };

	    prototypeAccessors.backgroundColor.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._backgroundColor = value;
	        this._backgroundColorString = hex2string(value);
	        hex2rgb(value, this._backgroundColorRgba);
	    };

	    Object.defineProperties( AbstractRenderer.prototype, prototypeAccessors );

	    return AbstractRenderer;
	}(eventemitter3));

	/**
	 * The Renderer draws the scene and all its content onto a WebGL enabled canvas.
	 *
	 * This renderer should be used for browsers that support WebGL.
	 *
	 * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.
	 * Don't forget to add the view to your DOM or you will not see anything!
	 *
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.AbstractRenderer
	 */
	var Renderer = /*@__PURE__*/(function (AbstractRenderer) {
	    function Renderer(options)
	    {
	        if ( options === void 0 ) { options = {}; }

	        AbstractRenderer.call(this, 'WebGL', options);

	        // the options will have been modified here in the super constructor with pixi's default settings..
	        options = this.options;

	        /**
	         * The type of this renderer as a standardized const
	         *
	         * @member {number}
	         * @see PIXI.RENDERER_TYPE
	         */
	        this.type = RENDERER_TYPE.WEBGL;

	        /**
	         * WebGL context, set by the contextSystem (this.context)
	         *
	         * @readonly
	         * @member {WebGLRenderingContext}
	         */
	        this.gl = null;

	        this.CONTEXT_UID = 0;

	        // TODO legacy!

	        /**
	         * Internal signal instances of **runner**, these
	         * are assigned to each system created.
	         * @see PIXI.Runner
	         * @name PIXI.Renderer#runners
	         * @private
	         * @type {object}
	         * @readonly
	         * @property {PIXI.Runner} destroy - Destroy runner
	         * @property {PIXI.Runner} contextChange - Context change runner
	         * @property {PIXI.Runner} reset - Reset runner
	         * @property {PIXI.Runner} update - Update runner
	         * @property {PIXI.Runner} postrender - Post-render runner
	         * @property {PIXI.Runner} prerender - Pre-render runner
	         * @property {PIXI.Runner} resize - Resize runner
	         */
	        this.runners = {
	            destroy: new Runner('destroy'),
	            contextChange: new Runner('contextChange', 1),
	            reset: new Runner('reset'),
	            update: new Runner('update'),
	            postrender: new Runner('postrender'),
	            prerender: new Runner('prerender'),
	            resize: new Runner('resize', 2),
	        };

	        /**
	         * Global uniforms
	         * @member {PIXI.UniformGroup}
	         */
	        this.globalUniforms = new UniformGroup({
	            projectionMatrix: new Matrix(),
	        }, true);

	        /**
	         * Mask system instance
	         * @member {PIXI.systems.MaskSystem} mask
	         * @memberof PIXI.Renderer#
	         * @readonly
	         */
	        this.addSystem(MaskSystem, 'mask')
	            /**
	             * Context system instance
	             * @member {PIXI.systems.ContextSystem} context
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(ContextSystem, 'context')
	            /**
	             * State system instance
	             * @member {PIXI.systems.StateSystem} state
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(StateSystem, 'state')
	            /**
	             * Shader system instance
	             * @member {PIXI.systems.ShaderSystem} shader
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(ShaderSystem, 'shader')
	            /**
	             * Texture system instance
	             * @member {PIXI.systems.TextureSystem} texture
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(TextureSystem, 'texture')
	            /**
	             * Geometry system instance
	             * @member {PIXI.systems.GeometrySystem} geometry
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(GeometrySystem, 'geometry')
	            /**
	             * Framebuffer system instance
	             * @member {PIXI.systems.FramebufferSystem} framebuffer
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(FramebufferSystem, 'framebuffer')
	            /**
	             * Stencil system instance
	             * @member {PIXI.systems.StencilSystem} stencil
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(StencilSystem, 'stencil')
	            /**
	             * Projection system instance
	             * @member {PIXI.systems.ProjectionSystem} projection
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(ProjectionSystem, 'projection')
	            /**
	             * Texture garbage collector system instance
	             * @member {PIXI.systems.TextureGCSystem} textureGC
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(TextureGCSystem, 'textureGC')
	            /**
	             * Filter system instance
	             * @member {PIXI.systems.FilterSystem} filter
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(FilterSystem, 'filter')
	            /**
	             * RenderTexture system instance
	             * @member {PIXI.systems.RenderTextureSystem} renderTexture
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(RenderTextureSystem, 'renderTexture')

	            /**
	             * Batch system instance
	             * @member {PIXI.systems.BatchSystem} batch
	             * @memberof PIXI.Renderer#
	             * @readonly
	             */
	            .addSystem(BatchSystem, 'batch');

	        this.initPlugins(Renderer.__plugins);

	        /**
	         * The options passed in to create a new WebGL context.
	         */
	        if (options.context)
	        {
	            this.context.initFromContext(options.context);
	        }
	        else
	        {
	            this.context.initFromOptions({
	                alpha: this.transparent,
	                antialias: options.antialias,
	                premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',
	                stencil: true,
	                preserveDrawingBuffer: options.preserveDrawingBuffer,
	                powerPreference: this.options.powerPreference,
	            });
	        }

	        /**
	         * Flag if we are rendering to the screen vs renderTexture
	         * @member {boolean}
	         * @readonly
	         * @default true
	         */
	        this.renderingToScreen = true;

	        sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');

	        this.resize(this.options.width, this.options.height);
	    }

	    if ( AbstractRenderer ) { Renderer.__proto__ = AbstractRenderer; }
	    Renderer.prototype = Object.create( AbstractRenderer && AbstractRenderer.prototype );
	    Renderer.prototype.constructor = Renderer;

	    /**
	     * Add a new system to the renderer.
	     * @param {Function} ClassRef - Class reference
	     * @param {string} [name] - Property name for system, if not specified
	     *        will use a static `name` property on the class itself. This
	     *        name will be assigned as s property on the Renderer so make
	     *        sure it doesn't collide with properties on Renderer.
	     * @return {PIXI.Renderer} Return instance of renderer
	     */
	    Renderer.create = function create (options)
	    {
	        if (isWebGLSupported())
	        {
	            return new Renderer(options);
	        }

	        throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.');
	    };

	    Renderer.prototype.addSystem = function addSystem (ClassRef, name)
	    {
	        if (!name)
	        {
	            name = ClassRef.name;
	        }

	        var system = new ClassRef(this);

	        if (this[name])
	        {
	            throw new Error(("Whoops! The name \"" + name + "\" is already in use"));
	        }

	        this[name] = system;

	        for (var i in this.runners)
	        {
	            this.runners[i].add(system);
	        }

	        /**
	         * Fired after rendering finishes.
	         *
	         * @event PIXI.Renderer#postrender
	         */

	        /**
	         * Fired before rendering starts.
	         *
	         * @event PIXI.Renderer#prerender
	         */

	        /**
	         * Fired when the WebGL context is set.
	         *
	         * @event PIXI.Renderer#context
	         * @param {WebGLRenderingContext} gl - WebGL context.
	         */

	        return this;
	    };

	    /**
	     * Renders the object to its WebGL view
	     *
	     * @param {PIXI.DisplayObject} displayObject - The object to be rendered.
	     * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.
	     * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.
	     * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.
	     * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?
	     */
	    Renderer.prototype.render = function render (displayObject, renderTexture, clear, transform, skipUpdateTransform)
	    {
	        // can be handy to know!
	        this.renderingToScreen = !renderTexture;

	        this.runners.prerender.run();
	        this.emit('prerender');

	        // apply a transform at a GPU level
	        this.projection.transform = transform;

	        // no point rendering if our context has been blown up!
	        if (this.context.isLost)
	        {
	            return;
	        }

	        if (!renderTexture)
	        {
	            this._lastObjectRendered = displayObject;
	        }

	        if (!skipUpdateTransform)
	        {
	            // update the scene graph
	            var cacheParent = displayObject.parent;

	            displayObject.parent = this._tempDisplayObjectParent;
	            displayObject.updateTransform();
	            displayObject.parent = cacheParent;
	            // displayObject.hitArea = //TODO add a temp hit area
	        }

	        this.renderTexture.bind(renderTexture);
	        this.batch.currentRenderer.start();

	        if (clear !== undefined ? clear : this.clearBeforeRender)
	        {
	            this.renderTexture.clear();
	        }

	        displayObject.render(this);

	        // apply transform..
	        this.batch.currentRenderer.flush();

	        if (renderTexture)
	        {
	            renderTexture.baseTexture.update();
	        }

	        this.runners.postrender.run();

	        // reset transform after render
	        this.projection.transform = null;

	        this.emit('postrender');
	    };

	    /**
	     * Resizes the WebGL view to the specified width and height.
	     *
	     * @param {number} screenWidth - The new width of the screen.
	     * @param {number} screenHeight - The new height of the screen.
	     */
	    Renderer.prototype.resize = function resize (screenWidth, screenHeight)
	    {
	        AbstractRenderer.prototype.resize.call(this, screenWidth, screenHeight);

	        this.runners.resize.run(screenWidth, screenHeight);
	    };

	    /**
	     * Resets the WebGL state so you can render things however you fancy!
	     *
	     * @return {PIXI.Renderer} Returns itself.
	     */
	    Renderer.prototype.reset = function reset ()
	    {
	        this.runners.reset.run();

	        return this;
	    };

	    /**
	     * Clear the frame buffer
	     */
	    Renderer.prototype.clear = function clear ()
	    {
	        this.framebuffer.bind();
	        this.framebuffer.clear();
	    };

	    /**
	     * Removes everything from the renderer (event listeners, spritebatch, etc...)
	     *
	     * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.
	     *  See: https://github.com/pixijs/pixi.js/issues/2233
	     */
	    Renderer.prototype.destroy = function destroy (removeView)
	    {
	        this.runners.destroy.run();

	        for (var r in this.runners)
	        {
	            this.runners[r].destroy();
	        }

	        // call base destroy
	        AbstractRenderer.prototype.destroy.call(this, removeView);

	        // TODO nullify all the managers..
	        this.gl = null;
	    };

	    /**
	     * Collection of installed plugins. These are included by default in PIXI, but can be excluded
	     * by creating a custom build. Consult the README for more information about creating custom
	     * builds and excluding plugins.
	     * @name PIXI.Renderer#plugins
	     * @type {object}
	     * @readonly
	     * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements.
	     * @property {PIXI.extract.Extract} extract Extract image data from renderer.
	     * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events.
	     * @property {PIXI.prepare.Prepare} prepare Pre-render display objects.
	     */

	    /**
	     * Adds a plugin to the renderer.
	     *
	     * @method
	     * @param {string} pluginName - The name of the plugin.
	     * @param {Function} ctor - The constructor function or class for the plugin.
	     */
	    Renderer.registerPlugin = function registerPlugin (pluginName, ctor)
	    {
	        Renderer.__plugins = Renderer.__plugins || {};
	        Renderer.__plugins[pluginName] = ctor;
	    };

	    return Renderer;
	}(AbstractRenderer));

	/**
	 * This helper function will automatically detect which renderer you should be using.
	 * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by
	 * the browser then this function will return a canvas renderer
	 *
	 * @memberof PIXI
	 * @function autoDetectRenderer
	 * @param {object} [options] - The optional renderer parameters
	 * @param {number} [options.width=800] - the width of the renderers view
	 * @param {number} [options.height=600] - the height of the renderers view
	 * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional
	 * @param {boolean} [options.transparent=false] - If the render view is transparent, default false
	 * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for
	 *   resolutions other than 1
	 * @param {boolean} [options.antialias=false] - sets antialias
	 * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you
	 *  need to call toDataUrl on the webgl context
	 * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area
	 *  (shown if not transparent).
	 * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or
	 *   not before the new render pass.
	 * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2
	 * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this
	 *   option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise
	 *   it is ignored.
	 * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native.
	 *  FXAA is faster, but may not always look as great **webgl only**
	 * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance"
	 *  for devices with dual graphics card **webgl only**
	 * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer
	 */
	function autoDetectRenderer(options)
	{
	    return Renderer.create(options);
	}

	var _default = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}";

	var defaultFilter = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n";

	/**
	 * A Texture that depends on six other resources.
	 *
	 * @class
	 * @extends PIXI.BaseTexture
	 * @memberof PIXI
	 */
	var CubeTexture = /*@__PURE__*/(function (BaseTexture) {
	    function CubeTexture () {
	        BaseTexture.apply(this, arguments);
	    }

	    if ( BaseTexture ) { CubeTexture.__proto__ = BaseTexture; }
	    CubeTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype );
	    CubeTexture.prototype.constructor = CubeTexture;

	    CubeTexture.from = function from (resources, options)
	    {
	        return new CubeTexture(new CubeResource(resources, options));
	    };

	    return CubeTexture;
	}(BaseTexture));

	/**
	 * Used by the batcher to draw batches.
	 * Each one of these contains all information required to draw a bound geometry.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var BatchDrawCall = function BatchDrawCall()
	{
	    this.textures = [];
	    this.ids = [];
	    this.blend = 0;
	    this.textureCount = 0;
	    this.start = 0;
	    this.size = 0;
	    this.type = 4;
	};

	/**
	 * Flexible wrapper around `ArrayBuffer` that also provides
	 * typed array views on demand.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var ViewableBuffer = function ViewableBuffer(size)
	{
	    /**
	     * Underlying `ArrayBuffer` that holds all the data
	     * and is of capacity `size`.
	     *
	     * @member {ArrayBuffer}
	     */
	    this.rawBinaryData = new ArrayBuffer(size);

	    /**
	     * View on the raw binary data as a `Uint32Array`.
	     *
	     * @member {Uint32Array}
	     */
	    this.uint32View = new Uint32Array(this.rawBinaryData);

	    /**
	     * View on the raw binary data as a `Float32Array`.
	     *
	     * @member {Float32Array}
	     */
	    this.float32View = new Float32Array(this.rawBinaryData);
	};

	var prototypeAccessors$5$1 = { int8View: { configurable: true },uint8View: { configurable: true },int16View: { configurable: true },uint16View: { configurable: true },int32View: { configurable: true } };

	/**
	 * View on the raw binary data as a `Int8Array`.
	 *
	 * @member {Int8Array}
	 */
	prototypeAccessors$5$1.int8View.get = function ()
	{
	    if (!this._int8View)
	    {
	        this._int8View = new Int8Array(this.rawBinaryData);
	    }

	    return this._int8View;
	};

	/**
	 * View on the raw binary data as a `Uint8Array`.
	 *
	 * @member {Uint8Array}
	 */
	prototypeAccessors$5$1.uint8View.get = function ()
	{
	    if (!this._uint8View)
	    {
	        this._uint8View = new Uint8Array(this.rawBinaryData);
	    }

	    return this._uint8View;
	};

	/**
	 * View on the raw binary data as a `Int16Array`.
	 *
	 * @member {Int16Array}
	 */
	prototypeAccessors$5$1.int16View.get = function ()
	{
	    if (!this._int16View)
	    {
	        this._int16View = new Int16Array(this.rawBinaryData);
	    }

	    return this._int16View;
	};

	/**
	 * View on the raw binary data as a `Uint16Array`.
	 *
	 * @member {Uint16Array}
	 */
	prototypeAccessors$5$1.uint16View.get = function ()
	{
	    if (!this._uint16View)
	    {
	        this._uint16View = new Uint16Array(this.rawBinaryData);
	    }

	    return this._uint16View;
	};

	/**
	 * View on the raw binary data as a `Int32Array`.
	 *
	 * @member {Int32Array}
	 */
	prototypeAccessors$5$1.int32View.get = function ()
	{
	    if (!this._int32View)
	    {
	        this._int32View = new Int32Array(this.rawBinaryData);
	    }

	    return this._int32View;
	};

	/**
	 * Returns the view of the given type.
	 *
	 * @param {string} type - One of `int8`, `uint8`, `int16`,
	 *`uint16`, `int32`, `uint32`, and `float32`.
	 * @return {object} typed array of given type
	 */
	ViewableBuffer.prototype.view = function view (type)
	{
	    return this[(type + "View")];
	};

	/**
	 * Destroys all buffer references. Do not use after calling
	 * this.
	 */
	ViewableBuffer.prototype.destroy = function destroy ()
	{
	    this.rawBinaryData = null;
	    this._int8View = null;
	    this._uint8View = null;
	    this._int16View = null;
	    this._uint16View = null;
	    this._int32View = null;
	    this.uint32View = null;
	    this.float32View = null;
	};

	ViewableBuffer.sizeOf = function sizeOf (type)
	{
	    switch (type)
	    {
	        case 'int8':
	        case 'uint8':
	            return 1;
	        case 'int16':
	        case 'uint16':
	            return 2;
	        case 'int32':
	        case 'uint32':
	        case 'float32':
	            return 4;
	        default:
	            throw new Error((type + " isn't a valid view type"));
	    }
	};

	Object.defineProperties( ViewableBuffer.prototype, prototypeAccessors$5$1 );

	/**
	 * Renderer dedicated to drawing and batching sprites.
	 *
	 * This is the default batch renderer. It buffers objects
	 * with texture-based geometries and renders them in
	 * batches. It uploads multiple textures to the GPU to
	 * reduce to the number of draw calls.
	 *
	 * @class
	 * @protected
	 * @memberof PIXI
	 * @extends PIXI.ObjectRenderer
	 */
	var AbstractBatchRenderer = /*@__PURE__*/(function (ObjectRenderer) {
	    function AbstractBatchRenderer(renderer)
	    {
	        ObjectRenderer.call(this, renderer);

	        /**
	         * This is used to generate a shader that can
	         * color each vertex based on a `aTextureId`
	         * attribute that points to an texture in `uSampler`.
	         *
	         * This enables the objects with different textures
	         * to be drawn in the same draw call.
	         *
	         * You can customize your shader by creating your
	         * custom shader generator.
	         *
	         * @member {PIXI.BatchShaderGenerator}
	         * @protected
	         */
	        this.shaderGenerator = null;

	        /**
	         * The class that represents the geometry of objects
	         * that are going to be batched with this.
	         *
	         * @member {object}
	         * @default PIXI.BatchGeometry
	         * @protected
	         */
	        this.geometryClass = null;

	        /**
	         * Size of data being buffered per vertex in the
	         * attribute buffers (in floats). By default, the
	         * batch-renderer plugin uses 6:
	         *
	         * | aVertexPosition | 2 |
	         * |-----------------|---|
	         * | aTextureCoords  | 2 |
	         * | aColor          | 1 |
	         * | aTextureId      | 1 |
	         *
	         * @member {number}
	         * @readonly
	         */
	        this.vertexSize = null;

	        /**
	         * The WebGL state in which this renderer will work.
	         *
	         * @member {PIXI.State}
	         * @readonly
	         */
	        this.state = State.for2d();

	        /**
	         * The number of bufferable objects before a flush
	         * occurs automatically.
	         *
	         * @member {number}
	         * @default settings.SPRITE_MAX_TEXTURES
	         */
	        this.size = 2000 * 4;// settings.SPRITE_BATCH_SIZE, 2000 is a nice balance between mobile/desktop

	        /**
	         * Total count of all vertices used by the currently
	         * buffered objects.
	         *
	         * @member {number}
	         * @private
	         */
	        this._vertexCount = 0;

	        /**
	         * Total count of all indices used by the currently
	         * buffered objects.
	         *
	         * @member {number}
	         * @private
	         */
	        this._indexCount = 0;

	        /**
	         * Buffer of objects that are yet to be rendered.
	         *
	         * @member {PIXI.DisplayObject[]}
	         * @private
	         */
	        this._bufferedElements = [];

	        /**
	         * Number of elements that are buffered and are
	         * waiting to be flushed.
	         *
	         * @member {number}
	         * @private
	         */
	        this._bufferSize = 0;

	        /**
	         * This shader is generated by `this.shaderGenerator`.
	         *
	         * It is generated specifically to handle the required
	         * number of textures being batched together.
	         *
	         * @member {PIXI.Shader}
	         * @protected
	         */
	        this._shader = null;

	        /**
	         * Pool of `this.geometryClass` geometry objects
	         * that store buffers. They are used to pass data
	         * to the shader on each draw call.
	         *
	         * These are never re-allocated again, unless a
	         * context change occurs; however, the pool may
	         * be expanded if required.
	         *
	         * @member {PIXI.Geometry[]}
	         * @private
	         * @see PIXI.AbstractBatchRenderer.contextChange
	         */
	        this._packedGeometries = [];

	        /**
	         * Size of `this._packedGeometries`. It can be expanded
	         * if more than `this._packedGeometryPoolSize` flushes
	         * occur in a single frame.
	         *
	         * @member {number}
	         * @private
	         */
	        this._packedGeometryPoolSize = 2;

	        /**
	         * A flush may occur multiple times in a single
	         * frame. On iOS devices or when
	         * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the
	         * batch renderer does not upload data to the same
	         * `WebGLBuffer` for performance reasons.
	         *
	         * This is the index into `packedGeometries` that points to
	         * geometry holding the most recent buffers.
	         *
	         * @member {number}
	         * @private
	         */
	        this._flushId = 0;

	        /**
	         * Pool of `BatchDrawCall` objects that `flush` used
	         * to create "batches" of the objects being rendered.
	         *
	         * These are never re-allocated again.
	         *
	         * @member BatchDrawCall[]
	         * @private
	         */
	        this._drawCalls = [];

	        for (var k = 0; k < this.size / 4; k++)
	        { // initialize the draw-calls pool to max size.
	            this._drawCalls[k] = new BatchDrawCall();
	        }

	        /**
	         * Pool of `ViewableBuffer` objects that are sorted in
	         * order of increasing size. The flush method uses
	         * the buffer with the least size above the amount
	         * it requires. These are used for passing attributes.
	         *
	         * The first buffer has a size of 8; each subsequent
	         * buffer has double capacity of its previous.
	         *
	         * @member {PIXI.ViewableBuffer}
	         * @private
	         * @see PIXI.AbstractBatchRenderer#getAttributeBuffer
	         */
	        this._aBuffers = {};

	        /**
	         * Pool of `Uint16Array` objects that are sorted in
	         * order of increasing size. The flush method uses
	         * the buffer with the least size above the amount
	         * it requires. These are used for passing indices.
	         *
	         * The first buffer has a size of 12; each subsequent
	         * buffer has double capacity of its previous.
	         *
	         * @member {Uint16Array[]}
	         * @private
	         * @see PIXI.AbstractBatchRenderer#getIndexBuffer
	         */
	        this._iBuffers = {};

	        /**
	         * Maximum number of textures that can be uploaded to
	         * the GPU under the current context. It is initialized
	         * properly in `this.contextChange`.
	         *
	         * @member {number}
	         * @see PIXI.AbstractBatchRenderer#contextChange
	         * @readonly
	         */
	        this.MAX_TEXTURES = 1;

	        this.renderer.on('prerender', this.onPrerender, this);
	        renderer.runners.contextChange.add(this);
	    }

	    if ( ObjectRenderer ) { AbstractBatchRenderer.__proto__ = ObjectRenderer; }
	    AbstractBatchRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );
	    AbstractBatchRenderer.prototype.constructor = AbstractBatchRenderer;

	    /**
	     * Handles the `contextChange` signal.
	     *
	     * It calculates `this.MAX_TEXTURES` and allocating the
	     * packed-geometry object pool.
	     */
	    AbstractBatchRenderer.prototype.contextChange = function contextChange ()
	    {
	        var gl = this.renderer.gl;

	        if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)
	        {
	            this.MAX_TEXTURES = 1;
	        }
	        else
	        {
	            // step 1: first check max textures the GPU can handle.
	            this.MAX_TEXTURES = Math.min(
	                gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),
	                settings.SPRITE_MAX_TEXTURES);

	            // step 2: check the maximum number of if statements the shader can have too..
	            this.MAX_TEXTURES = checkMaxIfStatementsInShader(
	                this.MAX_TEXTURES, gl);
	        }

	        this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);

	        // we use the second shader as the first one depending on your browser
	        // may omit aTextureId as it is not used by the shader so is optimized out.
	        for (var i = 0; i < this._packedGeometryPoolSize; i++)
	        {
	            /* eslint-disable max-len */
	            this._packedGeometries[i] = new (this.geometryClass)();
	        }
	    };

	    /**
	     * Handles the `prerender` signal.
	     *
	     * It ensures that flushes start from the first geometry
	     * object again.
	     */
	    AbstractBatchRenderer.prototype.onPrerender = function onPrerender ()
	    {
	        this._flushId = 0;
	    };

	    /**
	     * Buffers the "batchable" object. It need not be rendered
	     * immediately.
	     *
	     * @param {PIXI.Sprite} sprite - the sprite to render when
	     *    using this spritebatch
	     */
	    AbstractBatchRenderer.prototype.render = function render (element)
	    {
	        if (!element._texture.valid)
	        {
	            return;
	        }

	        if (this._vertexCount + (element.vertexData.length / 2) > this.size)
	        {
	            this.flush();
	        }

	        this._vertexCount += element.vertexData.length / 2;
	        this._indexCount += element.indices.length;
	        this._bufferedElements[this._bufferSize++] = element;
	    };

	    /**
	     * Renders the content _now_ and empties the current batch.
	     */
	    AbstractBatchRenderer.prototype.flush = function flush ()
	    {
	        if (this._vertexCount === 0)
	        {
	            return;
	        }

	        var attributeBuffer = this.getAttributeBuffer(this._vertexCount);
	        var indexBuffer = this.getIndexBuffer(this._indexCount);
	        var gl = this.renderer.gl;

	        var ref = this;
	        var elements = ref._bufferedElements;
	        var drawCalls = ref._drawCalls;
	        var MAX_TEXTURES = ref.MAX_TEXTURES;
	        var packedGeometries = ref._packedGeometries;
	        var vertexSize = ref.vertexSize;

	        var touch = this.renderer.textureGC.count;

	        var index = 0;
	        var _indexCount = 0;

	        var nextTexture;
	        var currentTexture;
	        var textureCount = 0;

	        var currentGroup = drawCalls[0];
	        var groupCount = 0;

	        var blendMode = -1;// blend-mode of previous element/sprite/object!

	        currentGroup.textureCount = 0;
	        currentGroup.start = 0;
	        currentGroup.blend = blendMode;

	        var TICK = ++BaseTexture._globalBatch;
	        var i;

	        for (i = 0; i < this._bufferSize; ++i)
	        {
	            var sprite = elements[i];

	            elements[i] = null;
	            nextTexture = sprite._texture.baseTexture;

	            var spriteBlendMode = premultiplyBlendMode[
	                nextTexture.premultiplyAlpha ? 1 : 0][sprite.blendMode];

	            if (blendMode !== spriteBlendMode)
	            {
	                blendMode = spriteBlendMode;

	                // force the batch to break!
	                currentTexture = null;
	                textureCount = MAX_TEXTURES;
	                TICK++;
	            }

	            if (currentTexture !== nextTexture)
	            {
	                currentTexture = nextTexture;

	                if (nextTexture._batchEnabled !== TICK)
	                {
	                    if (textureCount === MAX_TEXTURES)
	                    {
	                        TICK++;

	                        textureCount = 0;

	                        currentGroup.size = _indexCount - currentGroup.start;

	                        currentGroup = drawCalls[groupCount++];
	                        currentGroup.textureCount = 0;
	                        currentGroup.blend = blendMode;
	                        currentGroup.start = _indexCount;
	                    }

	                    nextTexture.touched = touch;
	                    nextTexture._batchEnabled = TICK;
	                    nextTexture._id = textureCount;

	                    currentGroup.textures[currentGroup.textureCount++] = nextTexture;
	                    textureCount++;
	                }
	            }

	            this.packInterleavedGeometry(sprite, attributeBuffer,
	                indexBuffer, index, _indexCount);

	            // push a graphics..
	            index += (sprite.vertexData.length / 2) * vertexSize;
	            _indexCount += sprite.indices.length;
	        }

	        BaseTexture._globalBatch = TICK;
	        currentGroup.size = _indexCount - currentGroup.start;

	        if (!settings.CAN_UPLOAD_SAME_BUFFER)
	        { /* Usually on iOS devices, where the browser doesn't
	            like uploads to the same buffer in a single frame. */
	            if (this._packedGeometryPoolSize <= this._flushId)
	            {
	                this._packedGeometryPoolSize++;
	                packedGeometries[this._flushId] = new (this.geometryClass)();
	            }

	            packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData, 0);
	            packedGeometries[this._flushId]._indexBuffer.update(indexBuffer, 0);

	            this.renderer.geometry.bind(packedGeometries[this._flushId]);
	            this.renderer.geometry.updateBuffers();
	            this._flushId++;
	        }
	        else
	        {
	            // lets use the faster option, always use buffer number 0
	            packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData, 0);
	            packedGeometries[this._flushId]._indexBuffer.update(indexBuffer, 0);

	            this.renderer.geometry.updateBuffers();
	        }

	        var textureSystem = this.renderer.texture;
	        var stateSystem = this.renderer.state;

	        // Upload textures and do the draw calls
	        for (i = 0; i < groupCount; i++)
	        {
	            var group = drawCalls[i];
	            var groupTextureCount = group.textureCount;

	            for (var j = 0; j < groupTextureCount; j++)
	            {
	                textureSystem.bind(group.textures[j], j);
	                group.textures[j] = null;
	            }

	            stateSystem.setBlendMode(group.blend);
	            gl.drawElements(group.type, group.size, gl.UNSIGNED_SHORT, group.start * 2);
	        }

	        // reset elements for the next flush
	        this._bufferSize = 0;
	        this._vertexCount = 0;
	        this._indexCount = 0;
	    };

	    /**
	     * Starts a new sprite batch.
	     */
	    AbstractBatchRenderer.prototype.start = function start ()
	    {
	        this.renderer.state.set(this.state);

	        this.renderer.shader.bind(this._shader);

	        if (settings.CAN_UPLOAD_SAME_BUFFER)
	        {
	            // bind buffer #0, we don't need others
	            this.renderer.geometry.bind(this._packedGeometries[this._flushId]);
	        }
	    };

	    /**
	     * Stops and flushes the current batch.
	     */
	    AbstractBatchRenderer.prototype.stop = function stop ()
	    {
	        this.flush();
	    };

	    /**
	     * Destroys this `AbstractBatchRenderer`. It cannot be used again.
	     */
	    AbstractBatchRenderer.prototype.destroy = function destroy ()
	    {
	        for (var i = 0; i < this._packedGeometryPoolSize; i++)
	        {
	            if (this._packedGeometries[i])
	            {
	                this._packedGeometries[i].destroy();
	            }
	        }

	        this.renderer.off('prerender', this.onPrerender, this);

	        this._aBuffers = null;
	        this._iBuffers = null;
	        this._packedGeometries = null;
	        this._drawCalls = null;

	        if (this._shader)
	        {
	            this._shader.destroy();
	            this._shader = null;
	        }

	        ObjectRenderer.prototype.destroy.call(this);
	    };

	    /**
	     * Fetches an attribute buffer from `this._aBuffers` that
	     * can hold atleast `size` floats.
	     *
	     * @param {number} size - minimum capacity required
	     * @return {ViewableBuffer} - buffer than can hold atleast `size` floats
	     * @private
	     */
	    AbstractBatchRenderer.prototype.getAttributeBuffer = function getAttributeBuffer (size)
	    {
	        // 8 vertices is enough for 2 quads
	        var roundedP2 = nextPow2(Math.ceil(size / 8));
	        var roundedSizeIndex = log2(roundedP2);
	        var roundedSize = roundedP2 * 8;

	        if (this._aBuffers.length <= roundedSizeIndex)
	        {
	            this._iBuffers.length = roundedSizeIndex + 1;
	        }

	        var buffer = this._aBuffers[roundedSize];

	        if (!buffer)
	        {
	            this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);
	        }

	        return buffer;
	    };

	    /**
	     * Fetches an index buffer from `this._iBuffers` that can
	     * has atleast `size` capacity.
	     *
	     * @param {number} size - minimum required capacity
	     * @return {Uint16Array} - buffer that can fit `size`
	     *    indices.
	     * @private
	     */
	    AbstractBatchRenderer.prototype.getIndexBuffer = function getIndexBuffer (size)
	    {
	        // 12 indices is enough for 2 quads
	        var roundedP2 = nextPow2(Math.ceil(size / 12));
	        var roundedSizeIndex = log2(roundedP2);
	        var roundedSize = roundedP2 * 12;

	        if (this._iBuffers.length <= roundedSizeIndex)
	        {
	            this._iBuffers.length = roundedSizeIndex + 1;
	        }

	        var buffer = this._iBuffers[roundedSizeIndex];

	        if (!buffer)
	        {
	            this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);
	        }

	        return buffer;
	    };

	    /**
	     * Takes the four batching parameters of `element`, interleaves
	     * and pushes them into the batching attribute/index buffers given.
	     *
	     * It uses these properties: `vertexData` `uvs`, `textureId` and
	     * `indicies`. It also uses the "tint" of the base-texture, if
	     * present.
	     *
	     * @param {PIXI.Sprite} element - element being rendered
	     * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.
	     * @param {Uint16Array} indexBuffer - index buffer
	     * @param {number} aIndex - number of floats already in the attribute buffer
	     * @param {number} iIndex - number of indices already in `indexBuffer`
	     */
	    AbstractBatchRenderer.prototype.packInterleavedGeometry = function packInterleavedGeometry (element, attributeBuffer, indexBuffer, aIndex, iIndex)
	    {
	        var uint32View = attributeBuffer.uint32View;
	        var float32View = attributeBuffer.float32View;

	        var packedVertices = aIndex / this.vertexSize;
	        var uvs = element.uvs;
	        var indicies = element.indices;
	        var vertexData = element.vertexData;
	        var textureId = element._texture.baseTexture._id;

	        var alpha = Math.min(element.worldAlpha, 1.0);
	        var argb = (alpha < 1.0
	          && element._texture.baseTexture.premultiplyAlpha)
	            ? premultiplyTint(element._tintRGB, alpha)
	            : element._tintRGB + (alpha * 255 << 24);

	        // lets not worry about tint! for now..
	        for (var i = 0; i < vertexData.length; i += 2)
	        {
	            float32View[aIndex++] = vertexData[i];
	            float32View[aIndex++] = vertexData[i + 1];
	            float32View[aIndex++] = uvs[i];
	            float32View[aIndex++] = uvs[i + 1];
	            uint32View[aIndex++] = argb;
	            float32View[aIndex++] = textureId;
	        }

	        for (var i$1 = 0; i$1 < indicies.length; i$1++)
	        {
	            indexBuffer[iIndex++] = packedVertices + indicies[i$1];
	        }
	    };

	    return AbstractBatchRenderer;
	}(ObjectRenderer));

	/**
	 * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer
	 *
	 * @class
	 * @memberof PIXI
	 */
	var BatchShaderGenerator = function BatchShaderGenerator(vertexSrc, fragTemplate)
	{
	    /**
	     * Reference to the vertex shader source.
	     *
	     * @member {string}
	     */
	    this.vertexSrc = vertexSrc;

	    /**
	     * Reference to the fragement shader template. Must contain "%count%" and "%forloop%".
	     *
	     * @member {string}
	     */
	    this.fragTemplate = fragTemplate;

	    this.programCache = {};
	    this.defaultGroupCache = {};

	    if (fragTemplate.indexOf('%count%') < 0)
	    {
	        throw new Error('Fragment template must contain "%count%".');
	    }

	    if (fragTemplate.indexOf('%forloop%') < 0)
	    {
	        throw new Error('Fragment template must contain "%forloop%".');
	    }
	};

	BatchShaderGenerator.prototype.generateShader = function generateShader (maxTextures)
	{
	    if (!this.programCache[maxTextures])
	    {
	        var sampleValues = new Int32Array(maxTextures);

	        for (var i = 0; i < maxTextures; i++)
	        {
	            sampleValues[i] = i;
	        }

	        this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);

	        var fragmentSrc = this.fragTemplate;

	        fragmentSrc = fragmentSrc.replace(/%count%/gi, ("" + maxTextures));
	        fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));

	        this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);
	    }

	    var uniforms = {
	        tint: new Float32Array([1, 1, 1, 1]),
	        translationMatrix: new Matrix(),
	        default: this.defaultGroupCache[maxTextures],
	    };

	    return new Shader(this.programCache[maxTextures], uniforms);
	};

	BatchShaderGenerator.prototype.generateSampleSrc = function generateSampleSrc (maxTextures)
	{
	    var src = '';

	    src += '\n';
	    src += '\n';

	    for (var i = 0; i < maxTextures; i++)
	    {
	        if (i > 0)
	        {
	            src += '\nelse ';
	        }

	        if (i < maxTextures - 1)
	        {
	            src += "if(vTextureId < " + i + ".5)";
	        }

	        src += '\n{';
	        src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);";
	        src += '\n}';
	    }

	    src += '\n';
	    src += '\n';

	    return src;
	};

	/**
	 * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).
	 *
	 * @class
	 * @memberof PIXI
	 */
	var BatchGeometry = /*@__PURE__*/(function (Geometry) {
	    function BatchGeometry(_static)
	    {
	        if ( _static === void 0 ) { _static = false; }

	        Geometry.call(this);

	        /**
	         * Buffer used for position, color, texture IDs
	         *
	         * @member {PIXI.Buffer}
	         * @protected
	         */
	        this._buffer = new Buffer(null, _static, false);

	        /**
	         * Index buffer data
	         *
	         * @member {PIXI.Buffer}
	         * @protected
	         */
	        this._indexBuffer = new Buffer(null, _static, true);

	        this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)
	            .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)
	            .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)
	            .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)
	            .addIndex(this._indexBuffer);
	    }

	    if ( Geometry ) { BatchGeometry.__proto__ = Geometry; }
	    BatchGeometry.prototype = Object.create( Geometry && Geometry.prototype );
	    BatchGeometry.prototype.constructor = BatchGeometry;

	    return BatchGeometry;
	}(Geometry));

	var defaultVertex$2 = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vTextureId = aTextureId;\n    vColor = aColor * tint;\n}\n";

	var defaultFragment$2 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n    vec4 color;\n    %forloop%\n    gl_FragColor = color * vColor;\n}\n";

	/**
	 * @class
	 * @memberof PIXI
	 * @hideconstructor
	 */
	var BatchPluginFactory = function BatchPluginFactory () {};

	var staticAccessors$1$1 = { defaultVertexSrc: { configurable: true },defaultFragmentTemplate: { configurable: true } };

	BatchPluginFactory.create = function create (options)
	{
	    var ref = Object.assign({
	        vertex: defaultVertex$2,
	        fragment: defaultFragment$2,
	        geometryClass: BatchGeometry,
	        vertexSize: 6,
	    }, options);
	        var vertex = ref.vertex;
	        var fragment = ref.fragment;
	        var vertexSize = ref.vertexSize;
	        var geometryClass = ref.geometryClass;

	    return /*@__PURE__*/(function (AbstractBatchRenderer) {
	            function BatchPlugin(renderer)
	        {
	            AbstractBatchRenderer.call(this, renderer);

	            this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);
	            this.geometryClass = geometryClass;
	            this.vertexSize = vertexSize;
	        }

	            if ( AbstractBatchRenderer ) { BatchPlugin.__proto__ = AbstractBatchRenderer; }
	            BatchPlugin.prototype = Object.create( AbstractBatchRenderer && AbstractBatchRenderer.prototype );
	            BatchPlugin.prototype.constructor = BatchPlugin;

	            return BatchPlugin;
	        }(AbstractBatchRenderer));
	};

	/**
	 * The default vertex shader source
	 *
	 * @static
	 * @type {string}
	 * @constant
	 */
	staticAccessors$1$1.defaultVertexSrc.get = function ()
	{
	    return defaultVertex$2;
	};

	/**
	 * The default fragment shader source
	 *
	 * @static
	 * @type {string}
	 * @constant
	 */
	staticAccessors$1$1.defaultFragmentTemplate.get = function ()
	{
	    return defaultFragment$2;
	};

	Object.defineProperties( BatchPluginFactory, staticAccessors$1$1 );

	// Setup the default BatchRenderer plugin, this is what
	// we'll actually export at the root level
	var BatchRenderer = BatchPluginFactory.create();

	/*!
	 * @pixi/extract - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/extract is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var TEMP_RECT = new Rectangle();
	var BYTES_PER_PIXEL = 4;

	/**
	 * The extract manager provides functionality to export content from the renderers.
	 *
	 * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`
	 *
	 * @class
	 * @memberof PIXI.extract
	 */
	var Extract = function Extract(renderer)
	{
	    this.renderer = renderer;
	    /**
	     * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture
	     *
	     * @member {PIXI.extract.Extract} extract
	     * @memberof PIXI.Renderer#
	     * @see PIXI.extract.Extract
	     */
	    renderer.extract = this;
	};

	/**
	 * Will return a HTML Image of the target
	 *
	 * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture
	 *  to convert. If left empty will use the main renderer
	 * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp".
	 * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.
	 * @return {HTMLImageElement} HTML Image of the target
	 */
	Extract.prototype.image = function image (target, format, quality)
	{
	    var image = new Image();

	    image.src = this.base64(target, format, quality);

	    return image;
	};

	/**
	 * Will return a a base64 encoded string of this target. It works by calling
	 *  `Extract.getCanvas` and then running toDataURL on that.
	 *
	 * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture
	 *  to convert. If left empty will use the main renderer
	 * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp".
	 * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.
	 * @return {string} A base64 encoded string of the texture.
	 */
	Extract.prototype.base64 = function base64 (target, format, quality)
	{
	    return this.canvas(target).toDataURL(format, quality);
	};

	/**
	 * Creates a Canvas element, renders this target to it and then returns it.
	 *
	 * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture
	 *  to convert. If left empty will use the main renderer
	 * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.
	 */
	Extract.prototype.canvas = function canvas (target)
	{
	    var renderer = this.renderer;
	    var resolution;
	    var frame;
	    var flipY = false;
	    var renderTexture;
	    var generated = false;

	    if (target)
	    {
	        if (target instanceof RenderTexture)
	        {
	            renderTexture = target;
	        }
	        else
	        {
	            renderTexture = this.renderer.generateTexture(target);
	            generated = true;
	        }
	    }

	    if (renderTexture)
	    {
	        resolution = renderTexture.baseTexture.resolution;
	        frame = renderTexture.frame;
	        flipY = false;
	        renderer.renderTexture.bind(renderTexture);
	    }
	    else
	    {
	        resolution = this.renderer.resolution;

	        flipY = true;

	        frame = TEMP_RECT;
	        frame.width = this.renderer.width;
	        frame.height = this.renderer.height;

	        renderer.renderTexture.bind(null);
	    }

	    var width = Math.floor(frame.width * resolution);
	    var height = Math.floor(frame.height * resolution);

	    var canvasBuffer = new CanvasRenderTarget(width, height, 1);

	    var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);

	    // read pixels to the array
	    var gl = renderer.gl;

	    gl.readPixels(
	        frame.x * resolution,
	        frame.y * resolution,
	        width,
	        height,
	        gl.RGBA,
	        gl.UNSIGNED_BYTE,
	        webglPixels
	    );

	    // add the pixels to the canvas
	    var canvasData = canvasBuffer.context.getImageData(0, 0, width, height);

	    Extract.arrayPostDivide(webglPixels, canvasData.data);

	    canvasBuffer.context.putImageData(canvasData, 0, 0);

	    // pulling pixels
	    if (flipY)
	    {
	        canvasBuffer.context.scale(1, -1);
	        canvasBuffer.context.drawImage(canvasBuffer.canvas, 0, -height);
	    }

	    if (generated)
	    {
	        renderTexture.destroy(true);
	    }

	    // send the canvas back..
	    return canvasBuffer.canvas;
	};

	/**
	 * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA
	 * order, with integer values between 0 and 255 (included).
	 *
	 * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture
	 *  to convert. If left empty will use the main renderer
	 * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture
	 */
	Extract.prototype.pixels = function pixels (target)
	{
	    var renderer = this.renderer;
	    var resolution;
	    var frame;
	    var renderTexture;
	    var generated = false;

	    if (target)
	    {
	        if (target instanceof RenderTexture)
	        {
	            renderTexture = target;
	        }
	        else
	        {
	            renderTexture = this.renderer.generateTexture(target);
	            generated = true;
	        }
	    }

	    if (renderTexture)
	    {
	        resolution = renderTexture.baseTexture.resolution;
	        frame = renderTexture.frame;

	        // bind the buffer
	        renderer.renderTexture.bind(renderTexture);
	    }
	    else
	    {
	        resolution = renderer.resolution;

	        frame = TEMP_RECT;
	        frame.width = renderer.width;
	        frame.height = renderer.height;

	        renderer.renderTexture.bind(null);
	    }

	    var width = frame.width * resolution;
	    var height = frame.height * resolution;

	    var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);

	    // read pixels to the array
	    var gl = renderer.gl;

	    gl.readPixels(
	        frame.x * resolution,
	        frame.y * resolution,
	        width,
	        height,
	        gl.RGBA,
	        gl.UNSIGNED_BYTE,
	        webglPixels
	    );

	    if (generated)
	    {
	        renderTexture.destroy(true);
	    }

	    Extract.arrayPostDivide(webglPixels, webglPixels);

	    return webglPixels;
	};

	/**
	 * Destroys the extract
	 *
	 */
	Extract.prototype.destroy = function destroy ()
	{
	    this.renderer.extract = null;
	    this.renderer = null;
	};

	/**
	 * Takes premultiplied pixel data and produces regular pixel data
	 *
	 * @private
	 * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data
	 * @param out {number[] | Uint8Array | Uint8ClampedArray} output array
	 */
	Extract.arrayPostDivide = function arrayPostDivide (pixels, out)
	{
	    for (var i = 0; i < pixels.length; i += 4)
	    {
	        var alpha = out[i + 3] = pixels[i + 3];

	        if (alpha !== 0)
	        {
	            out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));
	            out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));
	            out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));
	        }
	        else
	        {
	            out[i] = pixels[i];
	            out[i + 1] = pixels[i + 1];
	            out[i + 2] = pixels[i + 2];
	        }
	    }
	};

	var extract_es = ({
		Extract: Extract
	});

	/*!
	 * @pixi/interaction - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/interaction is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Holds all information related to an Interaction event
	 *
	 * @class
	 * @memberof PIXI.interaction
	 */
	var InteractionData = function InteractionData()
	{
	    /**
	     * This point stores the global coords of where the touch/mouse event happened
	     *
	     * @member {PIXI.Point}
	     */
	    this.global = new Point();

	    /**
	     * The target Sprite that was interacted with
	     *
	     * @member {PIXI.Sprite}
	     */
	    this.target = null;

	    /**
	     * When passed to an event handler, this will be the original DOM Event that was captured
	     *
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent
	     * @member {MouseEvent|TouchEvent|PointerEvent}
	     */
	    this.originalEvent = null;

	    /**
	     * Unique identifier for this interaction
	     *
	     * @member {number}
	     */
	    this.identifier = null;

	    /**
	     * Indicates whether or not the pointer device that created the event is the primary pointer.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
	     * @type {Boolean}
	     */
	    this.isPrimary = false;

	    /**
	     * Indicates which button was pressed on the mouse or pointer device to trigger the event.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
	     * @type {number}
	     */
	    this.button = 0;

	    /**
	     * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
	     * @type {number}
	     */
	    this.buttons = 0;

	    /**
	     * The width of the pointer's contact along the x-axis, measured in CSS pixels.
	     * radiusX of TouchEvents will be represented by this value.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
	     * @type {number}
	     */
	    this.width = 0;

	    /**
	     * The height of the pointer's contact along the y-axis, measured in CSS pixels.
	     * radiusY of TouchEvents will be represented by this value.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
	     * @type {number}
	     */
	    this.height = 0;

	    /**
	     * The angle, in degrees, between the pointer device and the screen.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
	     * @type {number}
	     */
	    this.tiltX = 0;

	    /**
	     * The angle, in degrees, between the pointer device and the screen.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
	     * @type {number}
	     */
	    this.tiltY = 0;

	    /**
	     * The type of pointer that triggered the event.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
	     * @type {string}
	     */
	    this.pointerType = null;

	    /**
	     * Pressure applied by the pointing device during the event. A Touch's force property
	     * will be represented by this value.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
	     * @type {number}
	     */
	    this.pressure = 0;

	    /**
	     * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.
	     * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle
	     * @type {number}
	     */
	    this.rotationAngle = 0;

	    /**
	     * Twist of a stylus pointer.
	     * @see https://w3c.github.io/pointerevents/#pointerevent-interface
	     * @type {number}
	     */
	    this.twist = 0;

	    /**
	     * Barrel pressure on a stylus pointer.
	     * @see https://w3c.github.io/pointerevents/#pointerevent-interface
	     * @type {number}
	     */
	    this.tangentialPressure = 0;
	};

	var prototypeAccessors$6 = { pointerId: { configurable: true } };

	/**
	 * The unique identifier of the pointer. It will be the same as `identifier`.
	 * @readonly
	 * @member {number}
	 * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
	 */
	prototypeAccessors$6.pointerId.get = function ()
	{
	    return this.identifier;
	};

	/**
	 * This will return the local coordinates of the specified displayObject for this InteractionData
	 *
	 * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local
	 *  coords off
	 * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise
	 *  will create a new point)
	 * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional
	 *  (otherwise will use the current global coords)
	 * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative
	 *  to the DisplayObject
	 */
	InteractionData.prototype.getLocalPosition = function getLocalPosition (displayObject, point, globalPos)
	{
	    return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
	};

	/**
	 * Copies properties from normalized event data.
	 *
	 * @param {Touch|MouseEvent|PointerEvent} event The normalized event data
	 */
	InteractionData.prototype.copyEvent = function copyEvent (event)
	{
	    // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite
	    // it with "false" on later events when our shim for it on touch events might not be
	    // accurate
	    if (event.isPrimary)
	    {
	        this.isPrimary = true;
	    }
	    this.button = event.button;
	    // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard
	    // event.which property instead, which conveys the same information.
	    this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which;
	    this.width = event.width;
	    this.height = event.height;
	    this.tiltX = event.tiltX;
	    this.tiltY = event.tiltY;
	    this.pointerType = event.pointerType;
	    this.pressure = event.pressure;
	    this.rotationAngle = event.rotationAngle;
	    this.twist = event.twist || 0;
	    this.tangentialPressure = event.tangentialPressure || 0;
	};

	/**
	 * Resets the data for pooling.
	 */
	InteractionData.prototype.reset = function reset ()
	{
	    // isPrimary is the only property that we really need to reset - everything else is
	    // guaranteed to be overwritten
	    this.isPrimary = false;
	};

	Object.defineProperties( InteractionData.prototype, prototypeAccessors$6 );

	/**
	 * Event class that mimics native DOM events.
	 *
	 * @class
	 * @memberof PIXI.interaction
	 */
	var InteractionEvent = function InteractionEvent()
	{
	    /**
	     * Whether this event will continue propagating in the tree.
	     *
	     * Remaining events for the {@link stopsPropagatingAt} object
	     * will still be dispatched.
	     *
	     * @member {boolean}
	     */
	    this.stopped = false;

	    /**
	     * At which object this event stops propagating.
	     *
	     * @private
	     * @member {PIXI.DisplayObject}
	     */
	    this.stopsPropagatingAt = null;

	    /**
	     * Whether we already reached the element we want to
	     * stop propagating at. This is important for delayed events,
	     * where we start over deeper in the tree again.
	     *
	     * @private
	     * @member {boolean}
	     */
	    this.stopPropagationHint = false;

	    /**
	     * The object which caused this event to be dispatched.
	     * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}.
	     *
	     * @member {PIXI.DisplayObject}
	     */
	    this.target = null;

	    /**
	     * The object whose event listener’s callback is currently being invoked.
	     *
	     * @member {PIXI.DisplayObject}
	     */
	    this.currentTarget = null;

	    /**
	     * Type of the event
	     *
	     * @member {string}
	     */
	    this.type = null;

	    /**
	     * InteractionData related to this event
	     *
	     * @member {PIXI.interaction.InteractionData}
	     */
	    this.data = null;
	};

	/**
	 * Prevents event from reaching any objects other than the current object.
	 *
	 */
	InteractionEvent.prototype.stopPropagation = function stopPropagation ()
	{
	    this.stopped = true;
	    this.stopPropagationHint = true;
	    this.stopsPropagatingAt = this.currentTarget;
	};

	/**
	 * Resets the event.
	 */
	InteractionEvent.prototype.reset = function reset ()
	{
	    this.stopped = false;
	    this.stopsPropagatingAt = null;
	    this.stopPropagationHint = false;
	    this.currentTarget = null;
	    this.target = null;
	};

	/**
	 * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions
	 *
	 * @class
	 * @private
	 * @memberof PIXI.interaction
	 */
	var InteractionTrackingData = function InteractionTrackingData(pointerId)
	{
	    this._pointerId = pointerId;
	    this._flags = InteractionTrackingData.FLAGS.NONE;
	};

	var prototypeAccessors$1$3 = { pointerId: { configurable: true },flags: { configurable: true },none: { configurable: true },over: { configurable: true },rightDown: { configurable: true },leftDown: { configurable: true } };

	/**
	 *
	 * @private
	 * @param {number} flag - The interaction flag to set
	 * @param {boolean} yn - Should the flag be set or unset
	 */
	InteractionTrackingData.prototype._doSet = function _doSet (flag, yn)
	{
	    if (yn)
	    {
	        this._flags = this._flags | flag;
	    }
	    else
	    {
	        this._flags = this._flags & (~flag);
	    }
	};

	/**
	 * Unique pointer id of the event
	 *
	 * @readonly
	 * @private
	 * @member {number}
	 */
	prototypeAccessors$1$3.pointerId.get = function ()
	{
	    return this._pointerId;
	};

	/**
	 * State of the tracking data, expressed as bit flags
	 *
	 * @private
	 * @member {number}
	 */
	prototypeAccessors$1$3.flags.get = function ()
	{
	    return this._flags;
	};

	prototypeAccessors$1$3.flags.set = function (flags) // eslint-disable-line require-jsdoc
	{
	    this._flags = flags;
	};

	/**
	 * Is the tracked event inactive (not over or down)?
	 *
	 * @private
	 * @member {number}
	 */
	prototypeAccessors$1$3.none.get = function ()
	{
	    return this._flags === this.constructor.FLAGS.NONE;
	};

	/**
	 * Is the tracked event over the DisplayObject?
	 *
	 * @private
	 * @member {boolean}
	 */
	prototypeAccessors$1$3.over.get = function ()
	{
	    return (this._flags & this.constructor.FLAGS.OVER) !== 0;
	};

	prototypeAccessors$1$3.over.set = function (yn) // eslint-disable-line require-jsdoc
	{
	    this._doSet(this.constructor.FLAGS.OVER, yn);
	};

	/**
	 * Did the right mouse button come down in the DisplayObject?
	 *
	 * @private
	 * @member {boolean}
	 */
	prototypeAccessors$1$3.rightDown.get = function ()
	{
	    return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0;
	};

	prototypeAccessors$1$3.rightDown.set = function (yn) // eslint-disable-line require-jsdoc
	{
	    this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn);
	};

	/**
	 * Did the left mouse button come down in the DisplayObject?
	 *
	 * @private
	 * @member {boolean}
	 */
	prototypeAccessors$1$3.leftDown.get = function ()
	{
	    return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0;
	};

	prototypeAccessors$1$3.leftDown.set = function (yn) // eslint-disable-line require-jsdoc
	{
	    this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn);
	};

	Object.defineProperties( InteractionTrackingData.prototype, prototypeAccessors$1$3 );

	InteractionTrackingData.FLAGS = Object.freeze({
	    NONE: 0,
	    OVER: 1 << 0,
	    LEFT_DOWN: 1 << 1,
	    RIGHT_DOWN: 1 << 2,
	});

	/**
	 * Interface for classes that represent a hit area.
	 *
	 * It is implemented by the following classes:
	 * - {@link PIXI.Circle}
	 * - {@link PIXI.Ellipse}
	 * - {@link PIXI.Polygon}
	 * - {@link PIXI.RoundedRectangle}
	 *
	 * @interface IHitArea
	 * @memberof PIXI
	 */

	/**
	 * Checks whether the x and y coordinates given are contained within this area
	 *
	 * @method
	 * @name contains
	 * @memberof PIXI.IHitArea#
	 * @param {number} x - The X coordinate of the point to test
	 * @param {number} y - The Y coordinate of the point to test
	 * @return {boolean} Whether the x/y coordinates are within this area
	 */

	/**
	 * Default property values of interactive objects
	 * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties
	 *
	 * @private
	 * @name interactiveTarget
	 * @type {Object}
	 * @memberof PIXI.interaction
	 * @example
	 *      function MyObject() {}
	 *
	 *      Object.assign(
	 *          DisplayObject.prototype,
	 *          PIXI.interaction.interactiveTarget
	 *      );
	 */
	var interactiveTarget = {

	    /**
	     * Enable interaction events for the DisplayObject. Touch, pointer and mouse
	     * events will not be emitted unless `interactive` is set to `true`.
	     *
	     * @example
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.interactive = true;
	     * sprite.on('tap', (event) => {
	     *    //handle event
	     * });
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     */
	    interactive: false,

	    /**
	     * Determines if the children to the displayObject can be clicked/touched
	     * Setting this to false allows PixiJS to bypass a recursive `hitTest` function
	     *
	     * @member {boolean}
	     * @memberof PIXI.Container#
	     */
	    interactiveChildren: true,

	    /**
	     * Interaction shape. Children will be hit first, then this shape will be checked.
	     * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.
	     *
	     * @example
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.interactive = true;
	     * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);
	     * @member {PIXI.IHitArea}
	     * @memberof PIXI.DisplayObject#
	     */
	    hitArea: null,

	    /**
	     * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive
	     * Setting this changes the 'cursor' property to `'pointer'`.
	     *
	     * @example
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.interactive = true;
	     * sprite.buttonMode = true;
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     */
	    get buttonMode()
	    {
	        return this.cursor === 'pointer';
	    },
	    set buttonMode(value)
	    {
	        if (value)
	        {
	            this.cursor = 'pointer';
	        }
	        else if (this.cursor === 'pointer')
	        {
	            this.cursor = null;
	        }
	    },

	    /**
	     * This defines what cursor mode is used when the mouse cursor
	     * is hovered over the displayObject.
	     *
	     * @example
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.interactive = true;
	     * sprite.cursor = 'wait';
	     * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor
	     *
	     * @member {string}
	     * @memberof PIXI.DisplayObject#
	     */
	    cursor: null,

	    /**
	     * Internal set of all active pointers, by identifier
	     *
	     * @member {Map<number, InteractionTrackingData>}
	     * @memberof PIXI.DisplayObject#
	     * @private
	     */
	    get trackedPointers()
	    {
	        if (this._trackedPointers === undefined) { this._trackedPointers = {}; }

	        return this._trackedPointers;
	    },

	    /**
	     * Map of all tracked pointers, by identifier. Use trackedPointers to access.
	     *
	     * @private
	     * @type {Map<number, InteractionTrackingData>}
	     */
	    _trackedPointers: undefined,
	};

	// Mix interactiveTarget into DisplayObject.prototype,
	// after deprecation has been handled
	DisplayObject.mixin(interactiveTarget);

	var MOUSE_POINTER_ID = 1;

	// helpers for hitTest() - only used inside hitTest()
	var hitTestEvent = {
	    target: null,
	    data: {
	        global: null,
	    },
	};

	/**
	 * The interaction manager deals with mouse, touch and pointer events.
	 *
	 * Any DisplayObject can be interactive if its `interactive` property is set to true.
	 *
	 * This manager also supports multitouch.
	 *
	 * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`
	 *
	 * @class
	 * @extends PIXI.utils.EventEmitter
	 * @memberof PIXI.interaction
	 */
	var InteractionManager = /*@__PURE__*/(function (EventEmitter) {
	    function InteractionManager(renderer, options)
	    {
	        EventEmitter.call(this);

	        options = options || {};

	        /**
	         * The renderer this interaction manager works for.
	         *
	         * @member {PIXI.AbstractRenderer}
	         */
	        this.renderer = renderer;

	        /**
	         * Should default browser actions automatically be prevented.
	         * Does not apply to pointer events for backwards compatibility
	         * preventDefault on pointer events stops mouse events from firing
	         * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.
	         *
	         * @member {boolean}
	         * @default true
	         */
	        this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;

	        /**
	         * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked.
	         *
	         * @member {number}
	         * @default 10
	         */
	        this.interactionFrequency = options.interactionFrequency || 10;

	        /**
	         * The mouse data
	         *
	         * @member {PIXI.interaction.InteractionData}
	         */
	        this.mouse = new InteractionData();
	        this.mouse.identifier = MOUSE_POINTER_ID;

	        // setting the mouse to start off far off screen will mean that mouse over does
	        //  not get called before we even move the mouse.
	        this.mouse.global.set(-999999);

	        /**
	         * Actively tracked InteractionData
	         *
	         * @private
	         * @member {Object.<number,PIXI.interaction.InteractionData>}
	         */
	        this.activeInteractionData = {};
	        this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;

	        /**
	         * Pool of unused InteractionData
	         *
	         * @private
	         * @member {PIXI.interaction.InteractionData[]}
	         */
	        this.interactionDataPool = [];

	        /**
	         * An event data object to handle all the event tracking/dispatching
	         *
	         * @member {object}
	         */
	        this.eventData = new InteractionEvent();

	        /**
	         * The DOM element to bind to.
	         *
	         * @protected
	         * @member {HTMLElement}
	         */
	        this.interactionDOMElement = null;

	        /**
	         * This property determines if mousemove and touchmove events are fired only when the cursor
	         * is over the object.
	         * Setting to true will make things work more in line with how the DOM version works.
	         * Setting to false can make things easier for things like dragging
	         * It is currently set to false as this is how PixiJS used to work. This will be set to true in
	         * future versions of pixi.
	         *
	         * @member {boolean}
	         * @default false
	         */
	        this.moveWhenInside = false;

	        /**
	         * Have events been attached to the dom element?
	         *
	         * @protected
	         * @member {boolean}
	         */
	        this.eventsAdded = false;

	        /**
	         * Is the mouse hovering over the renderer?
	         *
	         * @protected
	         * @member {boolean}
	         */
	        this.mouseOverRenderer = false;

	        /**
	         * Does the device support touch events
	         * https://www.w3.org/TR/touch-events/
	         *
	         * @readonly
	         * @member {boolean}
	         */
	        this.supportsTouchEvents = 'ontouchstart' in window;

	        /**
	         * Does the device support pointer events
	         * https://www.w3.org/Submission/pointer-events/
	         *
	         * @readonly
	         * @member {boolean}
	         */
	        this.supportsPointerEvents = !!window.PointerEvent;

	        // this will make it so that you don't have to call bind all the time

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerUp = this.onPointerUp.bind(this);
	        this.processPointerUp = this.processPointerUp.bind(this);

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerCancel = this.onPointerCancel.bind(this);
	        this.processPointerCancel = this.processPointerCancel.bind(this);

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerDown = this.onPointerDown.bind(this);
	        this.processPointerDown = this.processPointerDown.bind(this);

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerMove = this.onPointerMove.bind(this);
	        this.processPointerMove = this.processPointerMove.bind(this);

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerOut = this.onPointerOut.bind(this);
	        this.processPointerOverOut = this.processPointerOverOut.bind(this);

	        /**
	         * @private
	         * @member {Function}
	         */
	        this.onPointerOver = this.onPointerOver.bind(this);

	        /**
	         * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor
	         * values, objects are handled as dictionaries of CSS values for interactionDOMElement,
	         * and functions are called instead of changing the CSS.
	         * Default CSS cursor values are provided for 'default' and 'pointer' modes.
	         * @member {Object.<string, Object>}
	         */
	        this.cursorStyles = {
	            default: 'inherit',
	            pointer: 'pointer',
	        };

	        /**
	         * The mode of the cursor that is being used.
	         * The value of this is a key from the cursorStyles dictionary.
	         *
	         * @member {string}
	         */
	        this.currentCursorMode = null;

	        /**
	         * Internal cached let.
	         *
	         * @private
	         * @member {string}
	         */
	        this.cursor = null;

	        /**
	         * Internal cached let.
	         *
	         * @private
	         * @member {PIXI.Point}
	         */
	        this._tempPoint = new Point();

	        /**
	         * The current resolution / device pixel ratio.
	         *
	         * @member {number}
	         * @default 1
	         */
	        this.resolution = 1;

	        /**
	         * Delayed pointer events. Used to guarantee correct ordering of over/out events.
	         *
	         * @private
	         * @member {Array}
	         */
	        this.delayedEvents = [];

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is pressed on the display
	         * object.
	         *
	         * @event PIXI.interaction.InteractionManager#mousedown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is pressed
	         * on the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#rightdown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is released over the display
	         * object.
	         *
	         * @event PIXI.interaction.InteractionManager#mouseup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is released
	         * over the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#rightup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is pressed and released on
	         * the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#click
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is pressed
	         * and released on the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#rightclick
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is released outside the
	         * display object that initially registered a
	         * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}.
	         *
	         * @event PIXI.interaction.InteractionManager#mouseupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is released
	         * outside the display object that initially registered a
	         * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}.
	         *
	         * @event PIXI.interaction.InteractionManager#rightupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved while over the display object
	         *
	         * @event PIXI.interaction.InteractionManager#mousemove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved onto the display object
	         *
	         * @event PIXI.interaction.InteractionManager#mouseover
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved off the display object
	         *
	         * @event PIXI.interaction.InteractionManager#mouseout
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is pressed on the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#pointerdown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is released over the display object.
	         * Not always fired when some buttons are held down while others are released. In those cases,
	         * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and
	         * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead.
	         *
	         * @event PIXI.interaction.InteractionManager#pointerup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when the operating system cancels a pointer event
	         *
	         * @event PIXI.interaction.InteractionManager#pointercancel
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is pressed and released on the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#pointertap
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is released outside the display object that initially
	         * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}.
	         *
	         * @event PIXI.interaction.InteractionManager#pointerupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved while over the display object
	         *
	         * @event PIXI.interaction.InteractionManager#pointermove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved onto the display object
	         *
	         * @event PIXI.interaction.InteractionManager#pointerover
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved off the display object
	         *
	         * @event PIXI.interaction.InteractionManager#pointerout
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is placed on the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#touchstart
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is removed from the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#touchend
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when the operating system cancels a touch
	         *
	         * @event PIXI.interaction.InteractionManager#touchcancel
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is placed and removed from the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#tap
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is removed outside of the display object that initially
	         * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}.
	         *
	         * @event PIXI.interaction.InteractionManager#touchendoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is moved along the display object.
	         *
	         * @event PIXI.interaction.InteractionManager#touchmove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.
	         * object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mousedown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is pressed
	         * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#rightdown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is released over the display
	         * object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mouseup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is released
	         * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#rightup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is pressed and released on
	         * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#click
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is pressed
	         * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#rightclick
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button (usually a mouse left-button) is released outside the
	         * display object that initially registered a
	         * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mouseupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device secondary button (usually a mouse right-button) is released
	         * outside the display object that initially registered a
	         * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#rightupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved while over the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mousemove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved onto the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mouseover
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device (usually a mouse) is moved off the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#mouseout
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is pressed on the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointerdown
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is released over the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointerup
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when the operating system cancels a pointer event.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointercancel
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is pressed and released on the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointertap
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device button is released outside the display object that initially
	         * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointerupoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved while over the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointermove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved onto the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointerover
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a pointer device is moved off the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#pointerout
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is placed on the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#touchstart
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is removed from the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#touchend
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when the operating system cancels a touch.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#touchcancel
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is placed and removed from the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#tap
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is removed outside of the display object that initially
	         * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#touchendoutside
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        /**
	         * Fired when a touch point is moved along the display object.
	         * DisplayObject's `interactive` property must be set to `true` to fire event.
	         *
	         * @event PIXI.DisplayObject#touchmove
	         * @param {PIXI.interaction.InteractionEvent} event - Interaction event
	         */

	        this.setTargetElement(this.renderer.view, this.renderer.resolution);
	    }

	    if ( EventEmitter ) { InteractionManager.__proto__ = EventEmitter; }
	    InteractionManager.prototype = Object.create( EventEmitter && EventEmitter.prototype );
	    InteractionManager.prototype.constructor = InteractionManager;

	    /**
	     * Hit tests a point against the display tree, returning the first interactive object that is hit.
	     *
	     * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.
	     * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults
	     * to the last rendered root of the associated renderer.
	     * @return {PIXI.DisplayObject} The hit display object, if any.
	     */
	    InteractionManager.prototype.hitTest = function hitTest (globalPoint, root)
	    {
	        // clear the target for our hit test
	        hitTestEvent.target = null;
	        // assign the global point
	        hitTestEvent.data.global = globalPoint;
	        // ensure safety of the root
	        if (!root)
	        {
	            root = this.renderer._lastObjectRendered;
	        }
	        // run the hit test
	        this.processInteractive(hitTestEvent, root, null, true);
	        // return our found object - it'll be null if we didn't hit anything

	        return hitTestEvent.target;
	    };

	    /**
	     * Sets the DOM element which will receive mouse/touch events. This is useful for when you have
	     * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate
	     * another DOM element to receive those events.
	     *
	     * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.
	     * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).
	     */
	    InteractionManager.prototype.setTargetElement = function setTargetElement (element, resolution)
	    {
	        if ( resolution === void 0 ) { resolution = 1; }

	        this.removeEvents();

	        this.interactionDOMElement = element;

	        this.resolution = resolution;

	        this.addEvents();
	    };

	    /**
	     * Registers all the DOM events
	     *
	     * @private
	     */
	    InteractionManager.prototype.addEvents = function addEvents ()
	    {
	        if (!this.interactionDOMElement)
	        {
	            return;
	        }

	        Ticker.system.add(this.update, this, UPDATE_PRIORITY.INTERACTION);

	        if (window.navigator.msPointerEnabled)
	        {
	            this.interactionDOMElement.style['-ms-content-zooming'] = 'none';
	            this.interactionDOMElement.style['-ms-touch-action'] = 'none';
	        }
	        else if (this.supportsPointerEvents)
	        {
	            this.interactionDOMElement.style['touch-action'] = 'none';
	        }

	        /**
	         * These events are added first, so that if pointer events are normalized, they are fired
	         * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd
	         */
	        if (this.supportsPointerEvents)
	        {
	            window.document.addEventListener('pointermove', this.onPointerMove, true);
	            this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);
	            // pointerout is fired in addition to pointerup (for touch events) and pointercancel
	            // we already handle those, so for the purposes of what we do in onPointerOut, we only
	            // care about the pointerleave event
	            this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);
	            this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);
	            window.addEventListener('pointercancel', this.onPointerCancel, true);
	            window.addEventListener('pointerup', this.onPointerUp, true);
	        }
	        else
	        {
	            window.document.addEventListener('mousemove', this.onPointerMove, true);
	            this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);
	            this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);
	            this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);
	            window.addEventListener('mouseup', this.onPointerUp, true);
	        }

	        // always look directly for touch events so that we can provide original data
	        // In a future version we should change this to being just a fallback and rely solely on
	        // PointerEvents whenever available
	        if (this.supportsTouchEvents)
	        {
	            this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);
	            this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);
	            this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);
	            this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);
	        }

	        this.eventsAdded = true;
	    };

	    /**
	     * Removes all the DOM events that were previously registered
	     *
	     * @private
	     */
	    InteractionManager.prototype.removeEvents = function removeEvents ()
	    {
	        if (!this.interactionDOMElement)
	        {
	            return;
	        }

	        Ticker.system.remove(this.update, this);

	        if (window.navigator.msPointerEnabled)
	        {
	            this.interactionDOMElement.style['-ms-content-zooming'] = '';
	            this.interactionDOMElement.style['-ms-touch-action'] = '';
	        }
	        else if (this.supportsPointerEvents)
	        {
	            this.interactionDOMElement.style['touch-action'] = '';
	        }

	        if (this.supportsPointerEvents)
	        {
	            window.document.removeEventListener('pointermove', this.onPointerMove, true);
	            this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);
	            this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);
	            this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);
	            window.removeEventListener('pointercancel', this.onPointerCancel, true);
	            window.removeEventListener('pointerup', this.onPointerUp, true);
	        }
	        else
	        {
	            window.document.removeEventListener('mousemove', this.onPointerMove, true);
	            this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);
	            this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);
	            this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);
	            window.removeEventListener('mouseup', this.onPointerUp, true);
	        }

	        if (this.supportsTouchEvents)
	        {
	            this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);
	            this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);
	            this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);
	            this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);
	        }

	        this.interactionDOMElement = null;

	        this.eventsAdded = false;
	    };

	    /**
	     * Updates the state of interactive objects.
	     * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.
	     *
	     * @param {number} deltaTime - time delta since last tick
	     */
	    InteractionManager.prototype.update = function update (deltaTime)
	    {
	        this._deltaTime += deltaTime;

	        if (this._deltaTime < this.interactionFrequency)
	        {
	            return;
	        }

	        this._deltaTime = 0;

	        if (!this.interactionDOMElement)
	        {
	            return;
	        }

	        // if the user move the mouse this check has already been done using the mouse move!
	        if (this.didMove)
	        {
	            this.didMove = false;

	            return;
	        }

	        this.cursor = null;

	        // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,
	        // but there was a scenario of a display object moving under a static mouse cursor.
	        // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function
	        for (var k in this.activeInteractionData)
	        {
	            // eslint-disable-next-line no-prototype-builtins
	            if (this.activeInteractionData.hasOwnProperty(k))
	            {
	                var interactionData = this.activeInteractionData[k];

	                if (interactionData.originalEvent && interactionData.pointerType !== 'touch')
	                {
	                    var interactionEvent = this.configureInteractionEventForDOMEvent(
	                        this.eventData,
	                        interactionData.originalEvent,
	                        interactionData
	                    );

	                    this.processInteractive(
	                        interactionEvent,
	                        this.renderer._lastObjectRendered,
	                        this.processPointerOverOut,
	                        true
	                    );
	                }
	            }
	        }

	        this.setCursorMode(this.cursor);
	    };

	    /**
	     * Sets the current cursor mode, handling any callbacks or CSS style changes.
	     *
	     * @param {string} mode - cursor mode, a key from the cursorStyles dictionary
	     */
	    InteractionManager.prototype.setCursorMode = function setCursorMode (mode)
	    {
	        mode = mode || 'default';
	        // if the mode didn't actually change, bail early
	        if (this.currentCursorMode === mode)
	        {
	            return;
	        }
	        this.currentCursorMode = mode;
	        var style = this.cursorStyles[mode];

	        // only do things if there is a cursor style for it
	        if (style)
	        {
	            switch (typeof style)
	            {
	                case 'string':
	                    // string styles are handled as cursor CSS
	                    this.interactionDOMElement.style.cursor = style;
	                    break;
	                case 'function':
	                    // functions are just called, and passed the cursor mode
	                    style(mode);
	                    break;
	                case 'object':
	                    // if it is an object, assume that it is a dictionary of CSS styles,
	                    // apply it to the interactionDOMElement
	                    Object.assign(this.interactionDOMElement.style, style);
	                    break;
	            }
	        }
	        else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))
	        {
	            // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry
	            // for the mode, then assume that the dev wants it to be CSS for the cursor.
	            this.interactionDOMElement.style.cursor = mode;
	        }
	    };

	    /**
	     * Dispatches an event on the display object that was interacted with
	     *
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question
	     * @param {string} eventString - the name of the event (e.g, mousedown)
	     * @param {object} eventData - the event data object
	     * @private
	     */
	    InteractionManager.prototype.dispatchEvent = function dispatchEvent (displayObject, eventString, eventData)
	    {
	        // Even if the event was stopped, at least dispatch any remaining events
	        // for the same display object.
	        if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)
	        {
	            eventData.currentTarget = displayObject;
	            eventData.type = eventString;

	            displayObject.emit(eventString, eventData);

	            if (displayObject[eventString])
	            {
	                displayObject[eventString](eventData);
	            }
	        }
	    };

	    /**
	     * Puts a event on a queue to be dispatched later. This is used to guarantee correct
	     * ordering of over/out events.
	     *
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question
	     * @param {string} eventString - the name of the event (e.g, mousedown)
	     * @param {object} eventData - the event data object
	     * @private
	     */
	    InteractionManager.prototype.delayDispatchEvent = function delayDispatchEvent (displayObject, eventString, eventData)
	    {
	        this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData });
	    };

	    /**
	     * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The
	     * resulting value is stored in the point. This takes into account the fact that the DOM
	     * element could be scaled and positioned anywhere on the screen.
	     *
	     * @param  {PIXI.Point} point - the point that the result will be stored in
	     * @param  {number} x - the x coord of the position to map
	     * @param  {number} y - the y coord of the position to map
	     */
	    InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint (point, x, y)
	    {
	        var rect;

	        // IE 11 fix
	        if (!this.interactionDOMElement.parentElement)
	        {
	            rect = { x: 0, y: 0, width: 0, height: 0 };
	        }
	        else
	        {
	            rect = this.interactionDOMElement.getBoundingClientRect();
	        }

	        var resolutionMultiplier = 1.0 / this.resolution;

	        point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier;
	        point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier;
	    };

	    /**
	     * This function is provides a neat way of crawling through the scene graph and running a
	     * specified function on all interactive objects it finds. It will also take care of hit
	     * testing the interactive objects and passes the hit across in the function.
	     *
	     * @protected
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that
	     *  is tested for collision
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject
	     *  that will be hit test (recursively crawls its children)
	     * @param {Function} [func] - the function that will be called on each interactive object. The
	     *  interactionEvent, displayObject and hit will be passed to the function
	     * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point
	     * @param {boolean} [interactive] - Whether the displayObject is interactive
	     * @param {boolean} [skipDelayed] - Whether to process delayed events before returning. This is
	     *  used to avoid processing them too early during recursive calls.
	     * @return {boolean} returns true if the displayObject hit the point
	     */
	    InteractionManager.prototype.processInteractive = function processInteractive (interactionEvent, displayObject, func, hitTest, interactive, skipDelayed)
	    {
	        if (!displayObject || !displayObject.visible)
	        {
	            return false;
	        }

	        var point = interactionEvent.data.global;

	        // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^
	        //
	        // This function will now loop through all objects and then only hit test the objects it HAS
	        // to, not all of them. MUCH faster..
	        // An object will be hit test if the following is true:
	        //
	        // 1: It is interactive.
	        // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.
	        //
	        // As another little optimization once an interactive object has been hit we can carry on
	        // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests
	        // A final optimization is that an object is not hit test directly if a child has already been hit.

	        interactive = displayObject.interactive || interactive;

	        var hit = false;
	        var interactiveParent = interactive;

	        // Flag here can set to false if the event is outside the parents hitArea or mask
	        var hitTestChildren = true;

	        // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea
	        // There is also no longer a need to hitTest children.
	        if (displayObject.hitArea)
	        {
	            if (hitTest)
	            {
	                displayObject.worldTransform.applyInverse(point, this._tempPoint);
	                if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))
	                {
	                    hitTest = false;
	                    hitTestChildren = false;
	                }
	                else
	                {
	                    hit = true;
	                }
	            }
	            interactiveParent = false;
	        }
	        // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.
	        // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.
	        // https://github.com/pixijs/pixi.js/issues/5135
	        else if (displayObject._mask)
	        {
	            if (hitTest)
	            {
	                if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point)))
	                {
	                    hitTest = false;
	                }
	            }
	        }

	        // ** FREE TIP **! If an object is not interactive or has no buttons in it
	        // (such as a game scene!) set interactiveChildren to false for that displayObject.
	        // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.
	        if (hitTestChildren && displayObject.interactiveChildren && displayObject.children)
	        {
	            var children = displayObject.children;

	            for (var i = children.length - 1; i >= 0; i--)
	            {
	                var child = children[i];

	                // time to get recursive.. if this function will return if something is hit..
	                var childHit = this.processInteractive(interactionEvent, child, func, hitTest, interactiveParent, true);

	                if (childHit)
	                {
	                    // its a good idea to check if a child has lost its parent.
	                    // this means it has been removed whilst looping so its best
	                    if (!child.parent)
	                    {
	                        continue;
	                    }

	                    // we no longer need to hit test any more objects in this container as we we
	                    // now know the parent has been hit
	                    interactiveParent = false;

	                    // If the child is interactive , that means that the object hit was actually
	                    // interactive and not just the child of an interactive object.
	                    // This means we no longer need to hit test anything else. We still need to run
	                    // through all objects, but we don't need to perform any hit tests.

	                    if (childHit)
	                    {
	                        if (interactionEvent.target)
	                        {
	                            hitTest = false;
	                        }
	                        hit = true;
	                    }
	                }
	            }
	        }

	        // no point running this if the item is not interactive or does not have an interactive parent.
	        if (interactive)
	        {
	            // if we are hit testing (as in we have no hit any objects yet)
	            // We also don't need to worry about hit testing if once of the displayObjects children
	            // has already been hit - but only if it was interactive, otherwise we need to keep
	            // looking for an interactive child, just in case we hit one
	            if (hitTest && !interactionEvent.target)
	            {
	                // already tested against hitArea if it is defined
	                if (!displayObject.hitArea && displayObject.containsPoint)
	                {
	                    if (displayObject.containsPoint(point))
	                    {
	                        hit = true;
	                    }
	                }
	            }

	            if (displayObject.interactive)
	            {
	                if (hit && !interactionEvent.target)
	                {
	                    interactionEvent.target = displayObject;
	                }

	                if (func)
	                {
	                    func(interactionEvent, displayObject, !!hit);
	                }
	            }
	        }

	        var delayedEvents = this.delayedEvents;

	        if (delayedEvents.length && !skipDelayed)
	        {
	            // Reset the propagation hint, because we start deeper in the tree again.
	            interactionEvent.stopPropagationHint = false;

	            var delayedLen = delayedEvents.length;

	            this.delayedEvents = [];

	            for (var i$1 = 0; i$1 < delayedLen; i$1++)
	            {
	                var ref = delayedEvents[i$1];
	                var displayObject$1 = ref.displayObject;
	                var eventString = ref.eventString;
	                var eventData = ref.eventData;

	                // When we reach the object we wanted to stop propagating at,
	                // set the propagation hint.
	                if (eventData.stopsPropagatingAt === displayObject$1)
	                {
	                    eventData.stopPropagationHint = true;
	                }

	                this.dispatchEvent(displayObject$1, eventString, eventData);
	            }
	        }

	        return hit;
	    };

	    /**
	     * Is called when the pointer button is pressed down on the renderer element
	     *
	     * @private
	     * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down
	     */
	    InteractionManager.prototype.onPointerDown = function onPointerDown (originalEvent)
	    {
	        // if we support touch events, then only use those for touch events, not pointer events
	        if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }

	        var events = this.normalizeToPointerData(originalEvent);

	        /**
	         * No need to prevent default on natural pointer events, as there are no side effects
	         * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,
	         * so still need to be prevented.
	         */

	        // Guaranteed that there will be at least one event in events, and all events must have the same pointer type

	        if (this.autoPreventDefault && events[0].isNormalized)
	        {
	            var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);

	            if (cancelable)
	            {
	                originalEvent.preventDefault();
	            }
	        }

	        var eventLen = events.length;

	        for (var i = 0; i < eventLen; i++)
	        {
	            var event = events[i];

	            var interactionData = this.getInteractionDataForPointerId(event);

	            var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);

	            interactionEvent.data.originalEvent = originalEvent;

	            this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true);

	            this.emit('pointerdown', interactionEvent);
	            if (event.pointerType === 'touch')
	            {
	                this.emit('touchstart', interactionEvent);
	            }
	            // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event
	            else if (event.pointerType === 'mouse' || event.pointerType === 'pen')
	            {
	                var isRightButton = event.button === 2;

	                this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);
	            }
	        }
	    };

	    /**
	     * Processes the result of the pointer down check and dispatches the event if need be
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested
	     * @param {boolean} hit - the result of the hit test on the display object
	     */
	    InteractionManager.prototype.processPointerDown = function processPointerDown (interactionEvent, displayObject, hit)
	    {
	        var data = interactionEvent.data;
	        var id = interactionEvent.data.identifier;

	        if (hit)
	        {
	            if (!displayObject.trackedPointers[id])
	            {
	                displayObject.trackedPointers[id] = new InteractionTrackingData(id);
	            }
	            this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);

	            if (data.pointerType === 'touch')
	            {
	                this.dispatchEvent(displayObject, 'touchstart', interactionEvent);
	            }
	            else if (data.pointerType === 'mouse' || data.pointerType === 'pen')
	            {
	                var isRightButton = data.button === 2;

	                if (isRightButton)
	                {
	                    displayObject.trackedPointers[id].rightDown = true;
	                }
	                else
	                {
	                    displayObject.trackedPointers[id].leftDown = true;
	                }

	                this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);
	            }
	        }
	    };

	    /**
	     * Is called when the pointer button is released on the renderer element
	     *
	     * @private
	     * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released
	     * @param {boolean} cancelled - true if the pointer is cancelled
	     * @param {Function} func - Function passed to {@link processInteractive}
	     */
	    InteractionManager.prototype.onPointerComplete = function onPointerComplete (originalEvent, cancelled, func)
	    {
	        var events = this.normalizeToPointerData(originalEvent);

	        var eventLen = events.length;

	        // if the event wasn't targeting our canvas, then consider it to be pointerupoutside
	        // in all cases (unless it was a pointercancel)
	        var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';

	        for (var i = 0; i < eventLen; i++)
	        {
	            var event = events[i];

	            var interactionData = this.getInteractionDataForPointerId(event);

	            var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);

	            interactionEvent.data.originalEvent = originalEvent;

	            // perform hit testing for events targeting our canvas or cancel events
	            this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend);

	            this.emit(cancelled ? 'pointercancel' : ("pointerup" + eventAppend), interactionEvent);

	            if (event.pointerType === 'mouse' || event.pointerType === 'pen')
	            {
	                var isRightButton = event.button === 2;

	                this.emit(isRightButton ? ("rightup" + eventAppend) : ("mouseup" + eventAppend), interactionEvent);
	            }
	            else if (event.pointerType === 'touch')
	            {
	                this.emit(cancelled ? 'touchcancel' : ("touchend" + eventAppend), interactionEvent);
	                this.releaseInteractionDataForPointerId(event.pointerId, interactionData);
	            }
	        }
	    };

	    /**
	     * Is called when the pointer button is cancelled
	     *
	     * @private
	     * @param {PointerEvent} event - The DOM event of a pointer button being released
	     */
	    InteractionManager.prototype.onPointerCancel = function onPointerCancel (event)
	    {
	        // if we support touch events, then only use those for touch events, not pointer events
	        if (this.supportsTouchEvents && event.pointerType === 'touch') { return; }

	        this.onPointerComplete(event, true, this.processPointerCancel);
	    };

	    /**
	     * Processes the result of the pointer cancel check and dispatches the event if need be
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested
	     */
	    InteractionManager.prototype.processPointerCancel = function processPointerCancel (interactionEvent, displayObject)
	    {
	        var data = interactionEvent.data;

	        var id = interactionEvent.data.identifier;

	        if (displayObject.trackedPointers[id] !== undefined)
	        {
	            delete displayObject.trackedPointers[id];
	            this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);

	            if (data.pointerType === 'touch')
	            {
	                this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);
	            }
	        }
	    };

	    /**
	     * Is called when the pointer button is released on the renderer element
	     *
	     * @private
	     * @param {PointerEvent} event - The DOM event of a pointer button being released
	     */
	    InteractionManager.prototype.onPointerUp = function onPointerUp (event)
	    {
	        // if we support touch events, then only use those for touch events, not pointer events
	        if (this.supportsTouchEvents && event.pointerType === 'touch') { return; }

	        this.onPointerComplete(event, false, this.processPointerUp);
	    };

	    /**
	     * Processes the result of the pointer up check and dispatches the event if need be
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested
	     * @param {boolean} hit - the result of the hit test on the display object
	     */
	    InteractionManager.prototype.processPointerUp = function processPointerUp (interactionEvent, displayObject, hit)
	    {
	        var data = interactionEvent.data;

	        var id = interactionEvent.data.identifier;

	        var trackingData = displayObject.trackedPointers[id];

	        var isTouch = data.pointerType === 'touch';

	        var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');
	        // need to track mouse down status in the mouse block so that we can emit
	        // event in a later block
	        var isMouseTap = false;

	        // Mouse only
	        if (isMouse)
	        {
	            var isRightButton = data.button === 2;

	            var flags = InteractionTrackingData.FLAGS;

	            var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;

	            var isDown = trackingData !== undefined && (trackingData.flags & test);

	            if (hit)
	            {
	                this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);

	                if (isDown)
	                {
	                    this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);
	                    // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap
	                    isMouseTap = true;
	                }
	            }
	            else if (isDown)
	            {
	                this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);
	            }
	            // update the down state of the tracking data
	            if (trackingData)
	            {
	                if (isRightButton)
	                {
	                    trackingData.rightDown = false;
	                }
	                else
	                {
	                    trackingData.leftDown = false;
	                }
	            }
	        }

	        // Pointers and Touches, and Mouse
	        if (hit)
	        {
	            this.dispatchEvent(displayObject, 'pointerup', interactionEvent);
	            if (isTouch) { this.dispatchEvent(displayObject, 'touchend', interactionEvent); }

	            if (trackingData)
	            {
	                // emit pointertap if not a mouse, or if the mouse block decided it was a tap
	                if (!isMouse || isMouseTap)
	                {
	                    this.dispatchEvent(displayObject, 'pointertap', interactionEvent);
	                }
	                if (isTouch)
	                {
	                    this.dispatchEvent(displayObject, 'tap', interactionEvent);
	                    // touches are no longer over (if they ever were) when we get the touchend
	                    // so we should ensure that we don't keep pretending that they are
	                    trackingData.over = false;
	                }
	            }
	        }
	        else if (trackingData)
	        {
	            this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);
	            if (isTouch) { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); }
	        }
	        // Only remove the tracking data if there is no over/down state still associated with it
	        if (trackingData && trackingData.none)
	        {
	            delete displayObject.trackedPointers[id];
	        }
	    };

	    /**
	     * Is called when the pointer moves across the renderer element
	     *
	     * @private
	     * @param {PointerEvent} originalEvent - The DOM event of a pointer moving
	     */
	    InteractionManager.prototype.onPointerMove = function onPointerMove (originalEvent)
	    {
	        // if we support touch events, then only use those for touch events, not pointer events
	        if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }

	        var events = this.normalizeToPointerData(originalEvent);

	        if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')
	        {
	            this.didMove = true;

	            this.cursor = null;
	        }

	        var eventLen = events.length;

	        for (var i = 0; i < eventLen; i++)
	        {
	            var event = events[i];

	            var interactionData = this.getInteractionDataForPointerId(event);

	            var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);

	            interactionEvent.data.originalEvent = originalEvent;

	            this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, true);

	            this.emit('pointermove', interactionEvent);
	            if (event.pointerType === 'touch') { this.emit('touchmove', interactionEvent); }
	            if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mousemove', interactionEvent); }
	        }

	        if (events[0].pointerType === 'mouse')
	        {
	            this.setCursorMode(this.cursor);

	            // TODO BUG for parents interactive object (border order issue)
	        }
	    };

	    /**
	     * Processes the result of the pointer move check and dispatches the event if need be
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested
	     * @param {boolean} hit - the result of the hit test on the display object
	     */
	    InteractionManager.prototype.processPointerMove = function processPointerMove (interactionEvent, displayObject, hit)
	    {
	        var data = interactionEvent.data;

	        var isTouch = data.pointerType === 'touch';

	        var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');

	        if (isMouse)
	        {
	            this.processPointerOverOut(interactionEvent, displayObject, hit);
	        }

	        if (!this.moveWhenInside || hit)
	        {
	            this.dispatchEvent(displayObject, 'pointermove', interactionEvent);
	            if (isTouch) { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); }
	            if (isMouse) { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); }
	        }
	    };

	    /**
	     * Is called when the pointer is moved out of the renderer element
	     *
	     * @private
	     * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out
	     */
	    InteractionManager.prototype.onPointerOut = function onPointerOut (originalEvent)
	    {
	        // if we support touch events, then only use those for touch events, not pointer events
	        if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }

	        var events = this.normalizeToPointerData(originalEvent);

	        // Only mouse and pointer can call onPointerOut, so events will always be length 1
	        var event = events[0];

	        if (event.pointerType === 'mouse')
	        {
	            this.mouseOverRenderer = false;
	            this.setCursorMode(null);
	        }

	        var interactionData = this.getInteractionDataForPointerId(event);

	        var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);

	        interactionEvent.data.originalEvent = event;

	        this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false);

	        this.emit('pointerout', interactionEvent);
	        if (event.pointerType === 'mouse' || event.pointerType === 'pen')
	        {
	            this.emit('mouseout', interactionEvent);
	        }
	        else
	        {
	            // we can get touchleave events after touchend, so we want to make sure we don't
	            // introduce memory leaks
	            this.releaseInteractionDataForPointerId(interactionData.identifier);
	        }
	    };

	    /**
	     * Processes the result of the pointer over/out check and dispatches the event if need be
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event
	     * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested
	     * @param {boolean} hit - the result of the hit test on the display object
	     */
	    InteractionManager.prototype.processPointerOverOut = function processPointerOverOut (interactionEvent, displayObject, hit)
	    {
	        var data = interactionEvent.data;

	        var id = interactionEvent.data.identifier;

	        var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');

	        var trackingData = displayObject.trackedPointers[id];

	        // if we just moused over the display object, then we need to track that state
	        if (hit && !trackingData)
	        {
	            trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);
	        }

	        if (trackingData === undefined) { return; }

	        if (hit && this.mouseOverRenderer)
	        {
	            if (!trackingData.over)
	            {
	                trackingData.over = true;
	                this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);
	                if (isMouse)
	                {
	                    this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);
	                }
	            }

	            // only change the cursor if it has not already been changed (by something deeper in the
	            // display tree)
	            if (isMouse && this.cursor === null)
	            {
	                this.cursor = displayObject.cursor;
	            }
	        }
	        else if (trackingData.over)
	        {
	            trackingData.over = false;
	            this.dispatchEvent(displayObject, 'pointerout', this.eventData);
	            if (isMouse)
	            {
	                this.dispatchEvent(displayObject, 'mouseout', interactionEvent);
	            }
	            // if there is no mouse down information for the pointer, then it is safe to delete
	            if (trackingData.none)
	            {
	                delete displayObject.trackedPointers[id];
	            }
	        }
	    };

	    /**
	     * Is called when the pointer is moved into the renderer element
	     *
	     * @private
	     * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view
	     */
	    InteractionManager.prototype.onPointerOver = function onPointerOver (originalEvent)
	    {
	        var events = this.normalizeToPointerData(originalEvent);

	        // Only mouse and pointer can call onPointerOver, so events will always be length 1
	        var event = events[0];

	        var interactionData = this.getInteractionDataForPointerId(event);

	        var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);

	        interactionEvent.data.originalEvent = event;

	        if (event.pointerType === 'mouse')
	        {
	            this.mouseOverRenderer = true;
	        }

	        this.emit('pointerover', interactionEvent);
	        if (event.pointerType === 'mouse' || event.pointerType === 'pen')
	        {
	            this.emit('mouseover', interactionEvent);
	        }
	    };

	    /**
	     * Get InteractionData for a given pointerId. Store that data as well
	     *
	     * @private
	     * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData
	     * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier
	     */
	    InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId (event)
	    {
	        var pointerId = event.pointerId;

	        var interactionData;

	        if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')
	        {
	            interactionData = this.mouse;
	        }
	        else if (this.activeInteractionData[pointerId])
	        {
	            interactionData = this.activeInteractionData[pointerId];
	        }
	        else
	        {
	            interactionData = this.interactionDataPool.pop() || new InteractionData();
	            interactionData.identifier = pointerId;
	            this.activeInteractionData[pointerId] = interactionData;
	        }
	        // copy properties from the event, so that we can make sure that touch/pointer specific
	        // data is available
	        interactionData.copyEvent(event);

	        return interactionData;
	    };

	    /**
	     * Return unused InteractionData to the pool, for a given pointerId
	     *
	     * @private
	     * @param {number} pointerId - Identifier from a pointer event
	     */
	    InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId (pointerId)
	    {
	        var interactionData = this.activeInteractionData[pointerId];

	        if (interactionData)
	        {
	            delete this.activeInteractionData[pointerId];
	            interactionData.reset();
	            this.interactionDataPool.push(interactionData);
	        }
	    };

	    /**
	     * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData
	     *
	     * @private
	     * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured
	     * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent
	     * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired
	     *        with the InteractionEvent
	     * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in
	     */
	    InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent (interactionEvent, pointerEvent, interactionData)
	    {
	        interactionEvent.data = interactionData;

	        this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);

	        // Not really sure why this is happening, but it's how a previous version handled things
	        if (pointerEvent.pointerType === 'touch')
	        {
	            pointerEvent.globalX = interactionData.global.x;
	            pointerEvent.globalY = interactionData.global.y;
	        }

	        interactionData.originalEvent = pointerEvent;
	        interactionEvent.reset();

	        return interactionEvent;
	    };

	    /**
	     * Ensures that the original event object contains all data that a regular pointer event would have
	     *
	     * @private
	     * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event
	     * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer
	     *  or mouse event, or a multiple normalized pointer events if there are multiple changed touches
	     */
	    InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData (event)
	    {
	        var normalizedEvents = [];

	        if (this.supportsTouchEvents && event instanceof TouchEvent)
	        {
	            for (var i = 0, li = event.changedTouches.length; i < li; i++)
	            {
	                var touch = event.changedTouches[i];

	                if (typeof touch.button === 'undefined') { touch.button = event.touches.length ? 1 : 0; }
	                if (typeof touch.buttons === 'undefined') { touch.buttons = event.touches.length ? 1 : 0; }
	                if (typeof touch.isPrimary === 'undefined')
	                {
	                    touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
	                }
	                if (typeof touch.width === 'undefined') { touch.width = touch.radiusX || 1; }
	                if (typeof touch.height === 'undefined') { touch.height = touch.radiusY || 1; }
	                if (typeof touch.tiltX === 'undefined') { touch.tiltX = 0; }
	                if (typeof touch.tiltY === 'undefined') { touch.tiltY = 0; }
	                if (typeof touch.pointerType === 'undefined') { touch.pointerType = 'touch'; }
	                if (typeof touch.pointerId === 'undefined') { touch.pointerId = touch.identifier || 0; }
	                if (typeof touch.pressure === 'undefined') { touch.pressure = touch.force || 0.5; }
	                if (typeof touch.twist === 'undefined') { touch.twist = 0; }
	                if (typeof touch.tangentialPressure === 'undefined') { touch.tangentialPressure = 0; }
	                // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven
	                // support, and the fill ins are not quite the same
	                // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top
	                // left is not 0,0 on the page
	                if (typeof touch.layerX === 'undefined') { touch.layerX = touch.offsetX = touch.clientX; }
	                if (typeof touch.layerY === 'undefined') { touch.layerY = touch.offsetY = touch.clientY; }

	                // mark the touch as normalized, just so that we know we did it
	                touch.isNormalized = true;

	                normalizedEvents.push(touch);
	            }
	        }
	        // apparently PointerEvent subclasses MouseEvent, so yay
	        else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))
	        {
	            if (typeof event.isPrimary === 'undefined') { event.isPrimary = true; }
	            if (typeof event.width === 'undefined') { event.width = 1; }
	            if (typeof event.height === 'undefined') { event.height = 1; }
	            if (typeof event.tiltX === 'undefined') { event.tiltX = 0; }
	            if (typeof event.tiltY === 'undefined') { event.tiltY = 0; }
	            if (typeof event.pointerType === 'undefined') { event.pointerType = 'mouse'; }
	            if (typeof event.pointerId === 'undefined') { event.pointerId = MOUSE_POINTER_ID; }
	            if (typeof event.pressure === 'undefined') { event.pressure = 0.5; }
	            if (typeof event.twist === 'undefined') { event.twist = 0; }
	            if (typeof event.tangentialPressure === 'undefined') { event.tangentialPressure = 0; }

	            // mark the mouse event as normalized, just so that we know we did it
	            event.isNormalized = true;

	            normalizedEvents.push(event);
	        }
	        else
	        {
	            normalizedEvents.push(event);
	        }

	        return normalizedEvents;
	    };

	    /**
	     * Destroys the interaction manager
	     *
	     */
	    InteractionManager.prototype.destroy = function destroy ()
	    {
	        this.removeEvents();

	        this.removeAllListeners();

	        this.renderer = null;

	        this.mouse = null;

	        this.eventData = null;

	        this.interactionDOMElement = null;

	        this.onPointerDown = null;
	        this.processPointerDown = null;

	        this.onPointerUp = null;
	        this.processPointerUp = null;

	        this.onPointerCancel = null;
	        this.processPointerCancel = null;

	        this.onPointerMove = null;
	        this.processPointerMove = null;

	        this.onPointerOut = null;
	        this.processPointerOverOut = null;

	        this.onPointerOver = null;

	        this._tempPoint = null;
	    };

	    return InteractionManager;
	}(eventemitter3));

	var interaction_es = ({
		InteractionData: InteractionData,
		InteractionEvent: InteractionEvent,
		InteractionManager: InteractionManager,
		InteractionTrackingData: InteractionTrackingData,
		interactiveTarget: interactiveTarget
	});

	/*!
	 * @pixi/graphics - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/graphics is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Graphics curves resolution settings. If `adaptive` flag is set to `true`,
	 * the resolution is calculated based on the curve's length to ensure better visual quality.
	 * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.
	 *
	 * @static
	 * @constant
	 * @memberof PIXI
	 * @name GRAPHICS_CURVES
	 * @type {object}
	 * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive
	 * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)
	 * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)
	 * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)
	 */
	var GRAPHICS_CURVES = {
	    adaptive: true,
	    maxLength: 10,
	    minSegments: 8,
	    maxSegments: 2048,
	    _segmentsCount: function _segmentsCount(length, defaultSegments)
	    {
	        if ( defaultSegments === void 0 ) { defaultSegments = 20; }

	        if (!this.adaptive)
	        {
	            return defaultSegments;
	        }

	        var result = Math.ceil(length / this.maxLength);

	        if (result < this.minSegments)
	        {
	            result = this.minSegments;
	        }
	        else if (result > this.maxSegments)
	        {
	            result = this.maxSegments;
	        }

	        return result;
	    },
	};

	/**
	 * Fill style object for Graphics.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var FillStyle = function FillStyle()
	{
	    this.reset();
	};

	/**
	 * Clones the object
	 *
	 * @return {PIXI.FillStyle}
	 */
	FillStyle.prototype.clone = function clone ()
	{
	    var obj = new FillStyle();

	    obj.color = this.color;
	    obj.alpha = this.alpha;
	    obj.texture = this.texture;
	    obj.matrix = this.matrix;
	    obj.visible = this.visible;

	    return obj;
	};

	/**
	 * Reset
	 */
	FillStyle.prototype.reset = function reset ()
	{
	    /**
	     * The hex color value used when coloring the Graphics object.
	     *
	     * @member {number}
	     * @default 1
	     */
	    this.color = 0xFFFFFF;

	    /**
	     * The alpha value used when filling the Graphics object.
	     *
	     * @member {number}
	     * @default 1
	     */
	    this.alpha = 1;

	    /**
	     * The texture to be used for the fill.
	     *
	     * @member {string}
	     * @default 0
	     */
	    this.texture = Texture.WHITE;

	    /**
	     * The transform aplpied to the texture.
	     *
	     * @member {string}
	     * @default 0
	     */
	    this.matrix = null;

	    /**
	     * If the current fill is visible.
	     *
	     * @member {boolean}
	     * @default false
	     */
	    this.visible = false;
	};

	/**
	 * Destroy and don't use after this
	 */
	FillStyle.prototype.destroy = function destroy ()
	{
	    this.texture = null;
	    this.matrix = null;
	};

	/**
	 * A class to contain data useful for Graphics objects
	 *
	 * @class
	 * @memberof PIXI
	 */
	var GraphicsData = function GraphicsData(shape, fillStyle, lineStyle, matrix)
	{
	    if ( fillStyle === void 0 ) { fillStyle = null; }
	    if ( lineStyle === void 0 ) { lineStyle = null; }
	    if ( matrix === void 0 ) { matrix = null; }

	    /**
	     * The shape object to draw.
	     * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}
	     */
	    this.shape = shape;

	    /**
	     * The style of the line.
	     * @member {PIXI.LineStyle}
	     */
	    this.lineStyle = lineStyle;

	    /**
	     * The style of the fill.
	     * @member {PIXI.FillStyle}
	     */
	    this.fillStyle = fillStyle;

	    /**
	     * The transform matrix.
	     * @member {PIXI.Matrix}
	     */
	    this.matrix = matrix;

	    /**
	     * The type of the shape, see the Const.Shapes file for all the existing types,
	     * @member {number}
	     */
	    this.type = shape.type;

	    /**
	     * The collection of points.
	     * @member {number[]}
	     */
	    this.points = [];

	    /**
	     * The collection of holes.
	     * @member {PIXI.GraphicsData[]}
	     */
	    this.holes = [];
	};

	/**
	 * Creates a new GraphicsData object with the same values as this one.
	 *
	 * @return {PIXI.GraphicsData} Cloned GraphicsData object
	 */
	GraphicsData.prototype.clone = function clone ()
	{
	    return new GraphicsData(
	        this.shape,
	        this.fillStyle,
	        this.lineStyle,
	        this.matrix
	    );
	};

	/**
	 * Destroys the Graphics data.
	 */
	GraphicsData.prototype.destroy = function destroy ()
	{
	    this.shape = null;
	    this.holes.length = 0;
	    this.holes = null;
	    this.points.length = 0;
	    this.points = null;
	    this.lineStyle = null;
	    this.fillStyle = null;
	};

	/**
	 * Builds a circle to draw
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw
	 * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape
	 * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines
	 */
	var buildCircle = {

	    build: function build(graphicsData)
	    {
	        // need to convert points to a nice regular data
	        var circleData = graphicsData.shape;
	        var points = graphicsData.points;
	        var x = circleData.x;
	        var y = circleData.y;
	        var width;
	        var height;

	        points.length = 0;

	        // TODO - bit hacky??
	        if (graphicsData.type === SHAPES.CIRC)
	        {
	            width = circleData.radius;
	            height = circleData.radius;
	        }
	        else
	        {
	            width = circleData.width;
	            height = circleData.height;
	        }

	        if (width === 0 || height === 0)
	        {
	            return;
	        }

	        var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))
	            || Math.floor(15 * Math.sqrt(circleData.width + circleData.height));

	        totalSegs /= 2.3;

	        var seg = (Math.PI * 2) / totalSegs;

	        for (var i = 0; i < totalSegs; i++)
	        {
	            points.push(
	                x + (Math.sin(-seg * i) * width),
	                y + (Math.cos(-seg * i) * height)
	            );
	        }

	        points.push(
	            points[0],
	            points[1]
	        );
	    },

	    triangulate: function triangulate(graphicsData, graphicsGeometry)
	    {
	        var points = graphicsData.points;
	        var verts = graphicsGeometry.points;
	        var indices = graphicsGeometry.indices;

	        var vertPos = verts.length / 2;
	        var center = vertPos;

	        verts.push(graphicsData.shape.x, graphicsData.shape.y);

	        for (var i = 0; i < points.length; i += 2)
	        {
	            verts.push(points[i], points[i + 1]);

	            // add some uvs
	            indices.push(vertPos++, center, vertPos);
	        }
	    },
	};

	/**
	 * Builds a line to draw
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output
	 */
	function buildLine (graphicsData, graphicsGeometry)
	{
	    if (graphicsData.lineStyle.native)
	    {
	        buildNativeLine(graphicsData, graphicsGeometry);
	    }
	    else
	    {
	        buildLine$1(graphicsData, graphicsGeometry);
	    }
	}

	/**
	 * Builds a line to draw using the polygon method.
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output
	 */
	function buildLine$1(graphicsData, graphicsGeometry)
	{
	    var shape = graphicsData.shape;
	    var points = graphicsData.points || shape.points.slice();
	    var eps = graphicsGeometry.closePointEps;

	    if (points.length === 0)
	    {
	        return;
	    }
	    // if the line width is an odd number add 0.5 to align to a whole pixel
	    // commenting this out fixes #711 and #1620
	    // if (graphicsData.lineWidth%2)
	    // {
	    //     for (i = 0; i < points.length; i++)
	    //     {
	    //         points[i] += 0.5;
	    //     }
	    // }

	    var style = graphicsData.lineStyle;

	    // get first and last point.. figure out the middle!
	    var firstPoint = new Point(points[0], points[1]);
	    var lastPoint = new Point(points[points.length - 2], points[points.length - 1]);
	    var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;
	    var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps
	        && Math.abs(firstPoint.y - lastPoint.y) < eps;

	    // if the first point is the last point - gonna have issues :)
	    if (closedShape)
	    {
	        // need to clone as we are going to slightly modify the shape..
	        points = points.slice();

	        if (closedPath)
	        {
	            points.pop();
	            points.pop();
	            lastPoint.set(points[points.length - 2], points[points.length - 1]);
	        }

	        var midPointX = lastPoint.x + ((firstPoint.x - lastPoint.x) * 0.5);
	        var midPointY = lastPoint.y + ((firstPoint.y - lastPoint.y) * 0.5);

	        points.unshift(midPointX, midPointY);
	        points.push(midPointX, midPointY);
	    }

	    var verts = graphicsGeometry.points;
	    var length = points.length / 2;
	    var indexCount = points.length;
	    var indexStart = verts.length / 2;

	    // DRAW the Line
	    var width = style.width / 2;

	    // sort color
	    var p1x = points[0];
	    var p1y = points[1];
	    var p2x = points[2];
	    var p2y = points[3];
	    var p3x = 0;
	    var p3y = 0;

	    var perpx = -(p1y - p2y);
	    var perpy = p1x - p2x;
	    var perp2x = 0;
	    var perp2y = 0;
	    var perp3x = 0;
	    var perp3y = 0;

	    var dist = Math.sqrt((perpx * perpx) + (perpy * perpy));

	    perpx /= dist;
	    perpy /= dist;
	    perpx *= width;
	    perpy *= width;

	    var ratio = style.alignment;// 0.5;
	    var r1 = (1 - ratio) * 2;
	    var r2 = ratio * 2;

	    // start
	    verts.push(
	        p1x - (perpx * r1),
	        p1y - (perpy * r1));

	    verts.push(
	        p1x + (perpx * r2),
	        p1y + (perpy * r2));

	    for (var i = 1; i < length - 1; ++i)
	    {
	        p1x = points[(i - 1) * 2];
	        p1y = points[((i - 1) * 2) + 1];

	        p2x = points[i * 2];
	        p2y = points[(i * 2) + 1];

	        p3x = points[(i + 1) * 2];
	        p3y = points[((i + 1) * 2) + 1];

	        perpx = -(p1y - p2y);
	        perpy = p1x - p2x;

	        dist = Math.sqrt((perpx * perpx) + (perpy * perpy));
	        perpx /= dist;
	        perpy /= dist;
	        perpx *= width;
	        perpy *= width;

	        perp2x = -(p2y - p3y);
	        perp2y = p2x - p3x;

	        dist = Math.sqrt((perp2x * perp2x) + (perp2y * perp2y));
	        perp2x /= dist;
	        perp2y /= dist;
	        perp2x *= width;
	        perp2y *= width;

	        var a1 = (-perpy + p1y) - (-perpy + p2y);
	        var b1 = (-perpx + p2x) - (-perpx + p1x);
	        var c1 = ((-perpx + p1x) * (-perpy + p2y)) - ((-perpx + p2x) * (-perpy + p1y));
	        var a2 = (-perp2y + p3y) - (-perp2y + p2y);
	        var b2 = (-perp2x + p2x) - (-perp2x + p3x);
	        var c2 = ((-perp2x + p3x) * (-perp2y + p2y)) - ((-perp2x + p2x) * (-perp2y + p3y));

	        var denom = (a1 * b2) - (a2 * b1);

	        if (Math.abs(denom) < 0.1)
	        {
	            denom += 10.1;
	            verts.push(
	                p2x - (perpx * r1),
	                p2y - (perpy * r1));

	            verts.push(
	                p2x + (perpx * r2),
	                p2y + (perpy * r2));

	            continue;
	        }

	        var px = ((b1 * c2) - (b2 * c1)) / denom;
	        var py = ((a2 * c1) - (a1 * c2)) / denom;
	        var pdist = ((px - p2x) * (px - p2x)) + ((py - p2y) * (py - p2y));

	        if (pdist > (196 * width * width))
	        {
	            perp3x = perpx - perp2x;
	            perp3y = perpy - perp2y;

	            dist = Math.sqrt((perp3x * perp3x) + (perp3y * perp3y));
	            perp3x /= dist;
	            perp3y /= dist;
	            perp3x *= width;
	            perp3y *= width;

	            verts.push(p2x - (perp3x * r1), p2y - (perp3y * r1));

	            verts.push(p2x + (perp3x * r2), p2y + (perp3y * r2));

	            verts.push(p2x - (perp3x * r2 * r1), p2y - (perp3y * r1));

	            indexCount++;
	        }
	        else
	        {
	            verts.push(p2x + ((px - p2x) * r1), p2y + ((py - p2y) * r1));

	            verts.push(p2x - ((px - p2x) * r2), p2y - ((py - p2y) * r2));
	        }
	    }

	    p1x = points[(length - 2) * 2];
	    p1y = points[((length - 2) * 2) + 1];

	    p2x = points[(length - 1) * 2];
	    p2y = points[((length - 1) * 2) + 1];

	    perpx = -(p1y - p2y);
	    perpy = p1x - p2x;

	    dist = Math.sqrt((perpx * perpx) + (perpy * perpy));
	    perpx /= dist;
	    perpy /= dist;
	    perpx *= width;
	    perpy *= width;

	    verts.push(p2x - (perpx * r1), p2y - (perpy * r1));

	    verts.push(p2x + (perpx * r2), p2y + (perpy * r2));

	    var indices = graphicsGeometry.indices;

	    // indices.push(indexStart);

	    for (var i$1 = 0; i$1 < indexCount - 2; ++i$1)
	    {
	        indices.push(indexStart, indexStart + 1, indexStart + 2);

	        indexStart++;
	    }
	}

	/**
	 * Builds a line to draw using the gl.drawArrays(gl.LINES) method
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output
	 */
	function buildNativeLine(graphicsData, graphicsGeometry)
	{
	    var i = 0;

	    var shape = graphicsData.shape;
	    var points = graphicsData.points || shape.points;
	    var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;

	    if (points.length === 0) { return; }

	    var verts = graphicsGeometry.points;
	    var indices = graphicsGeometry.indices;
	    var length = points.length / 2;

	    var startIndex = verts.length / 2;
	    var currentIndex = startIndex;

	    verts.push(points[0], points[1]);

	    for (i = 1; i < length; i++)
	    {
	        verts.push(points[i * 2], points[(i * 2) + 1]);
	        indices.push(currentIndex, currentIndex + 1);

	        currentIndex++;
	    }

	    if (closedShape)
	    {
	        indices.push(currentIndex, startIndex);
	    }
	}

	/**
	 * Builds a polygon to draw
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape
	 * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines
	 */
	var buildPoly = {

	    build: function build(graphicsData)
	    {
	        graphicsData.points = graphicsData.shape.points.slice();
	    },

	    triangulate: function triangulate(graphicsData, graphicsGeometry)
	    {
	        var points = graphicsData.points;
	        var holes = graphicsData.holes;
	        var verts = graphicsGeometry.points;
	        var indices = graphicsGeometry.indices;

	        if (points.length >= 6)
	        {
	            var holeArray = [];
	            // Process holes..

	            for (var i = 0; i < holes.length; i++)
	            {
	                var hole = holes[i];

	                holeArray.push(points.length / 2);
	                points = points.concat(hole.points);
	            }

	            // sort color
	            var triangles = earcut_1(points, holeArray, 2);

	            if (!triangles)
	            {
	                return;
	            }

	            var vertPos = verts.length / 2;

	            for (var i$1 = 0; i$1 < triangles.length; i$1 += 3)
	            {
	                indices.push(triangles[i$1] + vertPos);
	                indices.push(triangles[i$1 + 1] + vertPos);
	                indices.push(triangles[i$1 + 2] + vertPos);
	            }

	            for (var i$2 = 0; i$2 < points.length; i$2++)
	            {
	                verts.push(points[i$2]);
	            }
	        }
	    },
	};

	/**
	 * Builds a rectangle to draw
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape
	 * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines
	 */
	var buildRectangle = {

	    build: function build(graphicsData)
	    {
	        // --- //
	        // need to convert points to a nice regular data
	        //
	        var rectData = graphicsData.shape;
	        var x = rectData.x;
	        var y = rectData.y;
	        var width = rectData.width;
	        var height = rectData.height;

	        var points = graphicsData.points;

	        points.length = 0;

	        points.push(x, y,
	            x + width, y,
	            x + width, y + height,
	            x, y + height);
	    },

	    triangulate: function triangulate(graphicsData, graphicsGeometry)
	    {
	        var points = graphicsData.points;
	        var verts = graphicsGeometry.points;

	        var vertPos = verts.length / 2;

	        verts.push(points[0], points[1],
	            points[2], points[3],
	            points[6], points[7],
	            points[4], points[5]);

	        graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,
	            vertPos + 1, vertPos + 2, vertPos + 3);
	    },
	};

	/**
	 * Builds a rounded rectangle to draw
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties
	 * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape
	 * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines
	 */
	var buildRoundedRectangle = {

	    build: function build(graphicsData)
	    {
	        var rrectData = graphicsData.shape;
	        var points = graphicsData.points;
	        var x = rrectData.x;
	        var y = rrectData.y;
	        var width = rrectData.width;
	        var height = rrectData.height;

	        var radius = rrectData.radius;

	        points.length = 0;

	        quadraticBezierCurve(x, y + radius,
	            x, y,
	            x + radius, y,
	            points);
	        quadraticBezierCurve(x + width - radius,
	            y, x + width, y,
	            x + width, y + radius,
	            points);
	        quadraticBezierCurve(x + width, y + height - radius,
	            x + width, y + height,
	            x + width - radius, y + height,
	            points);
	        quadraticBezierCurve(x + radius, y + height,
	            x, y + height,
	            x, y + height - radius,
	            points);

	        // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.
	        // TODO - fix this properly, this is not very elegant.. but it works for now.
	    },

	    triangulate: function triangulate(graphicsData, graphicsGeometry)
	    {
	        var points = graphicsData.points;

	        var verts = graphicsGeometry.points;
	        var indices = graphicsGeometry.indices;

	        var vecPos = verts.length / 2;

	        var triangles = earcut_1(points, null, 2);

	        for (var i = 0, j = triangles.length; i < j; i += 3)
	        {
	            indices.push(triangles[i] + vecPos);
	            //     indices.push(triangles[i] + vecPos);
	            indices.push(triangles[i + 1] + vecPos);
	            //   indices.push(triangles[i + 2] + vecPos);
	            indices.push(triangles[i + 2] + vecPos);
	        }

	        for (var i$1 = 0, j$1 = points.length; i$1 < j$1; i$1++)
	        {
	            verts.push(points[i$1], points[++i$1]);
	        }
	    },
	};

	/**
	 * Calculate a single point for a quadratic bezier curve.
	 * Utility function used by quadraticBezierCurve.
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {number} n1 - first number
	 * @param {number} n2 - second number
	 * @param {number} perc - percentage
	 * @return {number} the result
	 *
	 */
	function getPt(n1, n2, perc)
	{
	    var diff = n2 - n1;

	    return n1 + (diff * perc);
	}

	/**
	 * Calculate the points for a quadratic bezier curve. (helper function..)
	 * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @private
	 * @param {number} fromX - Origin point x
	 * @param {number} fromY - Origin point x
	 * @param {number} cpX - Control point x
	 * @param {number} cpY - Control point y
	 * @param {number} toX - Destination point x
	 * @param {number} toY - Destination point y
	 * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.
	 * @return {number[]} an array of points
	 */
	function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out)
	{
	    if ( out === void 0 ) { out = []; }

	    var n = 20;
	    var points = out;

	    var xa = 0;
	    var ya = 0;
	    var xb = 0;
	    var yb = 0;
	    var x = 0;
	    var y = 0;

	    for (var i = 0, j = 0; i <= n; ++i)
	    {
	        j = i / n;

	        // The Green Line
	        xa = getPt(fromX, cpX, j);
	        ya = getPt(fromY, cpY, j);
	        xb = getPt(cpX, toX, j);
	        yb = getPt(cpY, toY, j);

	        // The Black Dot
	        x = getPt(xa, xb, j);
	        y = getPt(ya, yb, j);

	        points.push(x, y);
	    }

	    return points;
	}

	var BATCH_POOL = [];
	var DRAW_CALL_POOL = [];
	var tmpPoint = new Point();

	/**
	 * Map of fill commands for each shape type.
	 *
	 * @member {Object}
	 * @private
	 */
	var fillCommands = {};

	fillCommands[SHAPES.POLY] = buildPoly;
	fillCommands[SHAPES.CIRC] = buildCircle;
	fillCommands[SHAPES.ELIP] = buildCircle;
	fillCommands[SHAPES.RECT] = buildRectangle;
	fillCommands[SHAPES.RREC] = buildRoundedRectangle;

	/**
	 * A little internal structure to hold interim batch objects.
	 *
	 * @private
	 */
	var BatchPart = function BatchPart()
	{
	    this.style = null;
	    this.size = 0;
	    this.start = 0;
	    this.attribStart = 0;
	    this.attribSize = 0;
	};

	/**
	 * The Graphics class contains methods used to draw primitive shapes such as lines, circles and
	 * rectangles to the display, and to color and fill them.
	 *
	 * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive
	 * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.
	 *
	 * @class
	 * @extends PIXI.BatchGeometry
	 * @memberof PIXI
	 */
	var GraphicsGeometry = /*@__PURE__*/(function (BatchGeometry) {
	    function GraphicsGeometry()
	    {
	        BatchGeometry.call(this);

	        /**
	         * An array of points to draw, 2 numbers per point
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this.points = [];

	        /**
	         * The collection of colors
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this.colors = [];

	        /**
	         * The UVs collection
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this.uvs = [];

	        /**
	         * The indices of the vertices
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this.indices = [];

	        /**
	         * Reference to the texture IDs.
	         *
	         * @member {number[]}
	         * @protected
	         */
	        this.textureIds = [];

	        /**
	         * The collection of drawn shapes.
	         *
	         * @member {PIXI.GraphicsData[]}
	         * @protected
	         */
	        this.graphicsData = [];

	        /**
	         * Used to detect if the graphics object has changed.
	         *
	         * @member {number}
	         * @protected
	         */
	        this.dirty = 0;

	        /**
	         * Batches need to regenerated if the geometry is updated.
	         *
	         * @member {number}
	         * @protected
	         */
	        this.batchDirty = -1;

	        /**
	         * Used to check if the cache is dirty.
	         *
	         * @member {number}
	         * @protected
	         */
	        this.cacheDirty = -1;

	        /**
	         * Used to detect if we cleared the graphicsData.
	         *
	         * @member {number}
	         * @default 0
	         * @protected
	         */
	        this.clearDirty = 0;

	        /**
	         * List of current draw calls drived from the batches.
	         *
	         * @member {object[]}
	         * @protected
	         */
	        this.drawCalls = [];

	        /**
	         * Intermediate abstract format sent to batch system.
	         * Can be converted to drawCalls or to batchable objects.
	         *
	         * @member {object[]}
	         * @protected
	         */
	        this.batches = [];

	        /**
	         * Index of the last batched shape in the stack of calls.
	         *
	         * @member {number}
	         * @protected
	         */
	        this.shapeIndex = 0;

	        /**
	         * Cached bounds.
	         *
	         * @member {PIXI.Bounds}
	         * @protected
	         */
	        this._bounds = new Bounds();

	        /**
	         * The bounds dirty flag.
	         *
	         * @member {number}
	         * @protected
	         */
	        this.boundsDirty = -1;

	        /**
	         * Padding to add to the bounds.
	         *
	         * @member {number}
	         * @default 0
	         */
	        this.boundsPadding = 0;

	        this.batchable = false;

	        this.indicesUint16 = null;

	        this.uvsFloat32 = null;

	        /**
	         * Minimal distance between points that are considered different.
	         * Affects line tesselation.
	         *
	         * @member {number}
	         */
	        this.closePointEps = 1e-4;
	    }

	    if ( BatchGeometry ) { GraphicsGeometry.__proto__ = BatchGeometry; }
	    GraphicsGeometry.prototype = Object.create( BatchGeometry && BatchGeometry.prototype );
	    GraphicsGeometry.prototype.constructor = GraphicsGeometry;

	    var prototypeAccessors = { bounds: { configurable: true } };

	    /**
	     * Get the current bounds of the graphic geometry.
	     *
	     * @member {PIXI.Bounds}
	     * @readonly
	     */
	    prototypeAccessors.bounds.get = function ()
	    {
	        if (this.boundsDirty !== this.dirty)
	        {
	            this.boundsDirty = this.dirty;
	            this.calculateBounds();
	        }

	        return this._bounds;
	    };

	    /**
	     * Call if you changed graphicsData manually.
	     * Empties all batch buffers.
	     */
	    GraphicsGeometry.prototype.invalidate = function invalidate ()
	    {
	        this.boundsDirty = -1;
	        this.dirty++;
	        this.batchDirty++;
	        this.shapeIndex = 0;

	        this.points.length = 0;
	        this.colors.length = 0;
	        this.uvs.length = 0;
	        this.indices.length = 0;
	        this.textureIds.length = 0;

	        for (var i = 0; i < this.drawCalls.length; i++)
	        {
	            this.drawCalls[i].textures.length = 0;
	            DRAW_CALL_POOL.push(this.drawCalls[i]);
	        }

	        this.drawCalls.length = 0;

	        for (var i$1 = 0; i$1 < this.batches.length; i$1++)
	        {
	            var batch =  this.batches[i$1];

	            batch.start = 0;
	            batch.attribStart = 0;
	            batch.style = null;
	            BATCH_POOL.push(batch);
	        }

	        this.batches.length = 0;
	    };

	    /**
	     * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
	     *
	     * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls
	     */
	    GraphicsGeometry.prototype.clear = function clear ()
	    {
	        if (this.graphicsData.length > 0)
	        {
	            this.invalidate();
	            this.clearDirty++;
	            this.graphicsData.length = 0;
	        }

	        return this;
	    };

	    /**
	     * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
	     *
	     * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
	     * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.
	     * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.
	     * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.
	     * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.
	     */
	    GraphicsGeometry.prototype.drawShape = function drawShape (shape, fillStyle, lineStyle, matrix)
	    {
	        var data = new GraphicsData(shape, fillStyle, lineStyle, matrix);

	        this.graphicsData.push(data);
	        this.dirty++;

	        return this;
	    };

	    /**
	     * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
	     *
	     * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
	     * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.
	     * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.
	     */
	    GraphicsGeometry.prototype.drawHole = function drawHole (shape, matrix)
	    {
	        if (!this.graphicsData.length)
	        {
	            return null;
	        }

	        var data = new GraphicsData(shape, null, null, matrix);

	        var lastShape = this.graphicsData[this.graphicsData.length - 1];

	        data.lineStyle = lastShape.lineStyle;

	        lastShape.holes.push(data);

	        this.dirty++;

	        return this;
	    };

	    /**
	     * Destroys the Graphics object.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all
	     *  options have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have
	     *  their destroy method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the texture of the child sprite
	     * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the base texture of the child sprite
	     */
	    GraphicsGeometry.prototype.destroy = function destroy (options)
	    {
	        BatchGeometry.prototype.destroy.call(this, options);

	        // destroy each of the GraphicsData objects
	        for (var i = 0; i < this.graphicsData.length; ++i)
	        {
	            this.graphicsData[i].destroy();
	        }

	        this.points.length = 0;
	        this.points = null;
	        this.colors.length = 0;
	        this.colors = null;
	        this.uvs.length = 0;
	        this.uvs = null;
	        this.indices.length = 0;
	        this.indices = null;
	        this.indexBuffer.destroy();
	        this.indexBuffer = null;
	        this.graphicsData.length = 0;
	        this.graphicsData = null;
	        this.drawCalls.length = 0;
	        this.drawCalls = null;
	        this.batches.length = 0;
	        this.batches = null;
	        this._bounds = null;
	    };

	    /**
	     * Check to see if a point is contained within this geometry.
	     *
	     * @param {PIXI.Point} point - Point to check if it's contained.
	     * @return {Boolean} `true` if the point is contained within geometry.
	     */
	    GraphicsGeometry.prototype.containsPoint = function containsPoint (point)
	    {
	        var graphicsData = this.graphicsData;

	        for (var i = 0; i < graphicsData.length; ++i)
	        {
	            var data = graphicsData[i];

	            if (!data.fillStyle.visible)
	            {
	                continue;
	            }

	            // only deal with fills..
	            if (data.shape)
	            {
	                if (data.matrix)
	                {
	                    data.matrix.applyInverse(point, tmpPoint);
	                }
	                else
	                {
	                    tmpPoint.copyFrom(point);
	                }

	                if (data.shape.contains(tmpPoint.x, tmpPoint.y))
	                {
	                    if (data.holes)
	                    {
	                        for (var i$1 = 0; i$1 < data.holes.length; i$1++)
	                        {
	                            var hole = data.holes[i$1];

	                            if (hole.shape.contains(tmpPoint.x, tmpPoint.y))
	                            {
	                                return false;
	                            }
	                        }
	                    }

	                    return true;
	                }
	            }
	        }

	        return false;
	    };

	    /**
	     * Generates intermediate batch data. Either gets converted to drawCalls
	     * or used to convert to batch objects directly by the Graphics object.
	     */
	    GraphicsGeometry.prototype.updateBatches = function updateBatches ()
	    {
	        if (this.dirty === this.cacheDirty) { return; }
	        if (this.graphicsData.length === 0)
	        {
	            this.batchable = true;

	            return;
	        }

	        if (this.dirty !== this.cacheDirty)
	        {
	            for (var i = 0; i < this.graphicsData.length; i++)
	            {
	                var data = this.graphicsData[i];

	                if (data.fillStyle && !data.fillStyle.texture.baseTexture.valid) { return; }
	                if (data.lineStyle && !data.lineStyle.texture.baseTexture.valid) { return; }
	            }
	        }

	        this.cacheDirty = this.dirty;

	        var uvs = this.uvs;

	        var batchPart = null;
	        var currentTexture = null;
	        var currentColor = 0;
	        var currentNative = false;

	        if (this.batches.length > 0)
	        {
	            batchPart = this.batches[this.batches.length - 1];

	            var style = batchPart.style;

	            currentTexture = style.texture.baseTexture;
	            currentColor = style.color + style.alpha;
	            currentNative = !!style.native;
	        }

	        for (var i$1 = this.shapeIndex; i$1 < this.graphicsData.length; i$1++)
	        {
	            this.shapeIndex++;

	            var data$1 = this.graphicsData[i$1];
	            var command = fillCommands[data$1.type];

	            var fillStyle = data$1.fillStyle;
	            var lineStyle = data$1.lineStyle;

	            // build out the shapes points..
	            command.build(data$1);

	            if (data$1.matrix)
	            {
	                this.transformPoints(data$1.points, data$1.matrix);
	            }

	            for (var j = 0; j < 2; j++)
	            {
	                var style$1 = (j === 0) ? fillStyle : lineStyle;

	                if (!style$1.visible) { continue; }

	                var nextTexture = style$1.texture.baseTexture;

	                var index$1 = this.indices.length;
	                var attribIndex = this.points.length / 2;

	                // close batch if style is different
	                if (batchPart
	                    && (currentTexture !== nextTexture
	                    || currentColor !== (style$1.color + style$1.alpha)
	                    || currentNative !== !!style$1.native))
	                {
	                    batchPart.size = index$1 - batchPart.start;
	                    batchPart.attribSize = attribIndex - batchPart.attribStart;

	                    if (batchPart.size > 0)
	                    {
	                        batchPart = null;
	                    }
	                }
	                // spawn new batch if its first batch or previous was closed
	                if (!batchPart)
	                {
	                    batchPart = BATCH_POOL.pop() || new BatchPart();
	                    this.batches.push(batchPart);
	                    nextTexture.wrapMode = WRAP_MODES.REPEAT;
	                    currentTexture = nextTexture;
	                    currentColor = style$1.color + style$1.alpha;
	                    currentNative = style$1.native;

	                    batchPart.style = style$1;
	                    batchPart.start = index$1;
	                    batchPart.attribStart = attribIndex;
	                }

	                var start = this.points.length / 2;

	                if (j === 0)
	                {
	                    if (data$1.holes.length)
	                    {
	                        this.processHoles(data$1.holes);

	                        buildPoly.triangulate(data$1, this);
	                    }
	                    else
	                    {
	                        command.triangulate(data$1, this);
	                    }
	                }
	                else
	                {
	                    buildLine(data$1, this);

	                    for (var i$2 = 0; i$2 < data$1.holes.length; i$2++)
	                    {
	                        buildLine(data$1.holes[i$2], this);
	                    }
	                }

	                var size = (this.points.length / 2) - start;

	                this.addUvs(this.points, uvs, style$1.texture, start, size, style$1.matrix);
	            }
	        }

	        var index = this.indices.length;
	        var attrib = this.points.length / 2;

	        if (!batchPart)
	        {
	            // there are no visible styles in GraphicsData
	            // its possible that someone wants Graphics just for the bounds
	            this.batchable = true;

	            return;
	        }

	        batchPart.size = index - batchPart.start;
	        batchPart.attribSize = attrib - batchPart.attribStart;
	        this.indicesUint16 = new Uint16Array(this.indices);

	        // TODO make this a const..
	        this.batchable = this.isBatchable();

	        if (this.batchable)
	        {
	            this.batchDirty++;

	            this.uvsFloat32 = new Float32Array(this.uvs);

	            // offset the indices so that it works with the batcher...
	            for (var i$3 = 0; i$3 < this.batches.length; i$3++)
	            {
	                var batch = this.batches[i$3];

	                for (var j$1 = 0; j$1 < batch.size; j$1++)
	                {
	                    var index$2 = batch.start + j$1;

	                    this.indicesUint16[index$2] = this.indicesUint16[index$2] - batch.attribStart;
	                }
	            }
	        }
	        else
	        {
	            this.buildDrawCalls();
	        }
	    };

	    /**
	     * Checks to see if this graphics geometry can be batched.
	     * Currently it needs to be small enough and not contain any native lines.
	     * @protected
	     */
	    GraphicsGeometry.prototype.isBatchable = function isBatchable ()
	    {
	        var batches = this.batches;

	        for (var i = 0; i < batches.length; i++)
	        {
	            if (batches[i].style.native)
	            {
	                return false;
	            }
	        }

	        return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);
	    };

	    /**
	     * Converts intermediate batches data to drawCalls.
	     * @protected
	     */
	    GraphicsGeometry.prototype.buildDrawCalls = function buildDrawCalls ()
	    {
	        var TICK = ++BaseTexture._globalBatch;

	        for (var i = 0; i < this.drawCalls.length; i++)
	        {
	            this.drawCalls[i].textures.length = 0;
	            DRAW_CALL_POOL.push(this.drawCalls[i]);
	        }

	        this.drawCalls.length = 0;

	        var uvs = this.uvs;
	        var colors = this.colors;
	        var textureIds = this.textureIds;

	        var currentGroup =  DRAW_CALL_POOL.pop() || new BatchDrawCall();

	        currentGroup.textureCount = 0;
	        currentGroup.start = 0;
	        currentGroup.size = 0;
	        currentGroup.type = DRAW_MODES.TRIANGLES;

	        var textureCount = 0;
	        var currentTexture = null;
	        var textureId = 0;
	        var native = false;
	        var drawMode = DRAW_MODES.TRIANGLES;

	        var index = 0;

	        this.drawCalls.push(currentGroup);

	        // TODO - this can be simplified
	        for (var i$1 = 0; i$1 < this.batches.length; i$1++)
	        {
	            var data = this.batches[i$1];

	            // TODO add some full on MAX_TEXTURE CODE..
	            var MAX_TEXTURES = 8;

	            var style = data.style;

	            var nextTexture = style.texture.baseTexture;

	            if (native !== !!style.native)
	            {
	                native = style.native;
	                drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;

	                // force the batch to break!
	                currentTexture = null;
	                textureCount = MAX_TEXTURES;
	                TICK++;
	            }

	            if (currentTexture !== nextTexture)
	            {
	                currentTexture = nextTexture;

	                if (nextTexture._batchEnabled !== TICK)
	                {
	                    if (textureCount === MAX_TEXTURES)
	                    {
	                        TICK++;

	                        textureCount = 0;

	                        if (currentGroup.size > 0)
	                        {
	                            currentGroup = DRAW_CALL_POOL.pop() || new BatchDrawCall();
	                            this.drawCalls.push(currentGroup);
	                        }

	                        currentGroup.start = index;
	                        currentGroup.size = 0;
	                        currentGroup.textureCount = 0;
	                        currentGroup.type = drawMode;
	                    }

	                    // TODO add this to the render part..
	                    nextTexture.touched = 1;// touch;
	                    nextTexture._batchEnabled = TICK;
	                    nextTexture._id = textureCount;
	                    nextTexture.wrapMode = 10497;

	                    currentGroup.textures[currentGroup.textureCount++] = nextTexture;
	                    textureCount++;
	                }
	            }

	            currentGroup.size += data.size;
	            index += data.size;

	            textureId = nextTexture._id;

	            this.addColors(colors, style.color, style.alpha, data.attribSize);
	            this.addTextureIds(textureIds, textureId, data.attribSize);
	        }

	        BaseTexture._globalBatch = TICK;

	        // upload..
	        // merge for now!
	        var verts = this.points;

	        // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes
	        var glPoints = new ArrayBuffer(verts.length * 3 * 4);
	        var f32 = new Float32Array(glPoints);
	        var u32 = new Uint32Array(glPoints);

	        var p = 0;

	        for (var i$2 = 0; i$2 < verts.length / 2; i$2++)
	        {
	            f32[p++] = verts[i$2 * 2];
	            f32[p++] = verts[(i$2 * 2) + 1];

	            f32[p++] = uvs[i$2 * 2];
	            f32[p++] = uvs[(i$2 * 2) + 1];

	            u32[p++] = colors[i$2];

	            f32[p++] = textureIds[i$2];
	        }

	        this._buffer.update(glPoints);
	        this._indexBuffer.update(this.indicesUint16);
	    };

	    /**
	     * Process the holes data.
	     *
	     * @param {PIXI.GraphicsData[]} holes - Holes to render
	     * @protected
	     */
	    GraphicsGeometry.prototype.processHoles = function processHoles (holes)
	    {
	        for (var i = 0; i < holes.length; i++)
	        {
	            var hole = holes[i];

	            var command = fillCommands[hole.type];

	            command.build(hole);

	            if (hole.matrix)
	            {
	                this.transformPoints(hole.points, hole.matrix);
	            }
	        }
	    };

	    /**
	     * Update the local bounds of the object. Expensive to use performance-wise.
	     * @protected
	     */
	    GraphicsGeometry.prototype.calculateBounds = function calculateBounds ()
	    {
	        var minX = Infinity;
	        var maxX = -Infinity;

	        var minY = Infinity;
	        var maxY = -Infinity;

	        if (this.graphicsData.length)
	        {
	            var shape = null;
	            var x = 0;
	            var y = 0;
	            var w = 0;
	            var h = 0;

	            for (var i = 0; i < this.graphicsData.length; i++)
	            {
	                var data = this.graphicsData[i];

	                var type = data.type;
	                var lineWidth = data.lineStyle ? data.lineStyle.width : 0;

	                shape = data.shape;

	                if (type === SHAPES.RECT || type === SHAPES.RREC)
	                {
	                    x = shape.x - (lineWidth / 2);
	                    y = shape.y - (lineWidth / 2);
	                    w = shape.width + lineWidth;
	                    h = shape.height + lineWidth;

	                    minX = x < minX ? x : minX;
	                    maxX = x + w > maxX ? x + w : maxX;

	                    minY = y < minY ? y : minY;
	                    maxY = y + h > maxY ? y + h : maxY;
	                }
	                else if (type === SHAPES.CIRC)
	                {
	                    x = shape.x;
	                    y = shape.y;
	                    w = shape.radius + (lineWidth / 2);
	                    h = shape.radius + (lineWidth / 2);

	                    minX = x - w < minX ? x - w : minX;
	                    maxX = x + w > maxX ? x + w : maxX;

	                    minY = y - h < minY ? y - h : minY;
	                    maxY = y + h > maxY ? y + h : maxY;
	                }
	                else if (type === SHAPES.ELIP)
	                {
	                    x = shape.x;
	                    y = shape.y;
	                    w = shape.width + (lineWidth / 2);
	                    h = shape.height + (lineWidth / 2);

	                    minX = x - w < minX ? x - w : minX;
	                    maxX = x + w > maxX ? x + w : maxX;

	                    minY = y - h < minY ? y - h : minY;
	                    maxY = y + h > maxY ? y + h : maxY;
	                }
	                else
	                {
	                    // POLY
	                    var points = shape.points;
	                    var x2 = 0;
	                    var y2 = 0;
	                    var dx = 0;
	                    var dy = 0;
	                    var rw = 0;
	                    var rh = 0;
	                    var cx = 0;
	                    var cy = 0;

	                    for (var j = 0; j + 2 < points.length; j += 2)
	                    {
	                        x = points[j];
	                        y = points[j + 1];
	                        x2 = points[j + 2];
	                        y2 = points[j + 3];
	                        dx = Math.abs(x2 - x);
	                        dy = Math.abs(y2 - y);
	                        h = lineWidth;
	                        w = Math.sqrt((dx * dx) + (dy * dy));

	                        if (w < 1e-9)
	                        {
	                            continue;
	                        }

	                        rw = ((h / w * dy) + dx) / 2;
	                        rh = ((h / w * dx) + dy) / 2;
	                        cx = (x2 + x) / 2;
	                        cy = (y2 + y) / 2;

	                        minX = cx - rw < minX ? cx - rw : minX;
	                        maxX = cx + rw > maxX ? cx + rw : maxX;

	                        minY = cy - rh < minY ? cy - rh : minY;
	                        maxY = cy + rh > maxY ? cy + rh : maxY;
	                    }
	                }
	            }
	        }
	        else
	        {
	            minX = 0;
	            maxX = 0;
	            minY = 0;
	            maxY = 0;
	        }

	        var padding = this.boundsPadding;

	        this._bounds.minX = minX - padding;
	        this._bounds.maxX = maxX + padding;

	        this._bounds.minY = minY - padding;
	        this._bounds.maxY = maxY + padding;
	    };

	    /**
	     * Transform points using matrix.
	     *
	     * @protected
	     * @param {number[]} points - Points to transform
	     * @param {PIXI.Matrix} matrix - Transform matrix
	     */
	    GraphicsGeometry.prototype.transformPoints = function transformPoints (points, matrix)
	    {
	        for (var i = 0; i < points.length / 2; i++)
	        {
	            var x = points[(i * 2)];
	            var y = points[(i * 2) + 1];

	            points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;
	            points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;
	        }
	    };

	    /**
	     * Add colors.
	     *
	     * @protected
	     * @param {number[]} colors - List of colors to add to
	     * @param {number} color - Color to add
	     * @param {number} alpha - Alpha to use
	     * @param {number} size - Number of colors to add
	     */
	    GraphicsGeometry.prototype.addColors = function addColors (colors, color, alpha, size)
	    {
	        // TODO use the premultiply bits Ivan added
	        var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);

	        var rgba =  premultiplyTint(rgb, alpha);

	        while (size-- > 0)
	        {
	            colors.push(rgba);
	        }
	    };

	    /**
	     * Add texture id that the shader/fragment wants to use.
	     *
	     * @protected
	     * @param {number[]} textureIds
	     * @param {number} id
	     * @param {number} size
	     */
	    GraphicsGeometry.prototype.addTextureIds = function addTextureIds (textureIds, id, size)
	    {
	        while (size-- > 0)
	        {
	            textureIds.push(id);
	        }
	    };

	    /**
	     * Generates the UVs for a shape.
	     *
	     * @protected
	     * @param {number[]} verts - Vertices
	     * @param {number[]} uvs - UVs
	     * @param {PIXI.Texture} texture - Reference to Texture
	     * @param {number} start - Index buffer start index.
	     * @param {number} size - The size/length for index buffer.
	     * @param {PIXI.Matrix} [matrix] - Optional transform for all points.
	     */
	    GraphicsGeometry.prototype.addUvs = function addUvs (verts, uvs, texture, start, size, matrix)
	    {
	        var index = 0;
	        var uvsStart = uvs.length;
	        var frame = texture.frame;

	        while (index < size)
	        {
	            var x = verts[(start + index) * 2];
	            var y = verts[((start + index) * 2) + 1];

	            if (matrix)
	            {
	                var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;

	                y = (matrix.b * x) + (matrix.d * y) + matrix.ty;
	                x = nx;
	            }

	            index++;

	            uvs.push(x / frame.width, y / frame.height);
	        }

	        var baseTexture = texture.baseTexture;

	        if (frame.width < baseTexture.width
	            || frame.height < baseTexture.height)
	        {
	            this.adjustUvs(uvs, texture, uvsStart, size);
	        }
	    };

	    /**
	     * Modify uvs array according to position of texture region
	     * Does not work with rotated or trimmed textures
	     * @param {number[]} uvs array
	     * @param {PIXI.Texture} texture region
	     * @param {number} start starting index for uvs
	     * @param {number} size how many points to adjust
	     */
	    GraphicsGeometry.prototype.adjustUvs = function adjustUvs (uvs, texture, start, size)
	    {
	        var baseTexture = texture.baseTexture;
	        var eps = 1e-6;
	        var finish = start + (size * 2);
	        var frame = texture.frame;
	        var scaleX = frame.width / baseTexture.width;
	        var scaleY = frame.height / baseTexture.height;
	        var offsetX = frame.x / frame.width;
	        var offsetY = frame.y / frame.height;
	        var minX = Math.floor(uvs[start] + eps);
	        var minY = Math.floor(uvs[start + 1] + eps);

	        for (var i = start + 2; i < finish; i += 2)
	        {
	            minX = Math.min(minX, Math.floor(uvs[i] + eps));
	            minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));
	        }
	        offsetX -= minX;
	        offsetY -= minY;
	        for (var i$1 = start; i$1 < finish; i$1 += 2)
	        {
	            uvs[i$1] = (uvs[i$1] + offsetX) * scaleX;
	            uvs[i$1 + 1] = (uvs[i$1 + 1] + offsetY) * scaleY;
	        }
	    };

	    Object.defineProperties( GraphicsGeometry.prototype, prototypeAccessors );

	    return GraphicsGeometry;
	}(BatchGeometry));

	/**
	 * The maximum number of points to consider an object "batchable",
	 * able to be batched by the renderer's batch system.
	 *
	 * @memberof PIXI.GraphicsGeometry
	 * @static
	 * @member {number} BATCHABLE_SIZE
	 * @default 100
	 */
	GraphicsGeometry.BATCHABLE_SIZE = 100;

	/**
	 * Represents the line style for Graphics.
	 * @memberof PIXI
	 * @class
	 * @extends PIXI.FillStyle
	 */
	var LineStyle = /*@__PURE__*/(function (FillStyle) {
	    function LineStyle () {
	        FillStyle.apply(this, arguments);
	    }

	    if ( FillStyle ) { LineStyle.__proto__ = FillStyle; }
	    LineStyle.prototype = Object.create( FillStyle && FillStyle.prototype );
	    LineStyle.prototype.constructor = LineStyle;

	    LineStyle.prototype.clone = function clone ()
	    {
	        var obj = new LineStyle();

	        obj.color = this.color;
	        obj.alpha = this.alpha;
	        obj.texture = this.texture;
	        obj.matrix = this.matrix;
	        obj.visible = this.visible;
	        obj.width = this.width;
	        obj.alignment = this.alignment;
	        obj.native = this.native;

	        return obj;
	    };
	    /**
	     * Reset the line style to default.
	     */
	    LineStyle.prototype.reset = function reset ()
	    {
	        FillStyle.prototype.reset.call(this);

	        // Override default line style color
	        this.color = 0x0;

	        /**
	         * The width (thickness) of any lines drawn.
	         *
	         * @member {number}
	         * @default 0
	         */
	        this.width = 0;

	        /**
	         * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner).
	         *
	         * @member {number}
	         * @default 0
	         */
	        this.alignment = 0.5;

	        /**
	         * If true the lines will be draw using LINES instead of TRIANGLE_STRIP
	         *
	         * @member {boolean}
	         * @default false
	         */
	        this.native = false;
	    };

	    return LineStyle;
	}(FillStyle));

	/**
	 * Utilities for bezier curves
	 * @class
	 * @private
	 */
	var BezierUtils = function BezierUtils () {};

	BezierUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)
	{
	    var n = 10;
	    var result = 0.0;
	    var t = 0.0;
	    var t2 = 0.0;
	    var t3 = 0.0;
	    var nt = 0.0;
	    var nt2 = 0.0;
	    var nt3 = 0.0;
	    var x = 0.0;
	    var y = 0.0;
	    var dx = 0.0;
	    var dy = 0.0;
	    var prevX = fromX;
	    var prevY = fromY;

	    for (var i = 1; i <= n; ++i)
	    {
	        t = i / n;
	        t2 = t * t;
	        t3 = t2 * t;
	        nt = (1.0 - t);
	        nt2 = nt * nt;
	        nt3 = nt2 * nt;

	        x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);
	        y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);
	        dx = prevX - x;
	        dy = prevY - y;
	        prevX = x;
	        prevY = y;

	        result += Math.sqrt((dx * dx) + (dy * dy));
	    }

	    return result;
	};

	/**
	 * Calculate the points for a bezier curve and then draws it.
	 *
	 * Ignored from docs since it is not directly exposed.
	 *
	 * @ignore
	 * @param {number} cpX - Control point x
	 * @param {number} cpY - Control point y
	 * @param {number} cpX2 - Second Control point x
	 * @param {number} cpY2 - Second Control point y
	 * @param {number} toX - Destination point x
	 * @param {number} toY - Destination point y
	 * @param {number[]} points - Path array to push points into
	 */
	BezierUtils.curveTo = function curveTo (cpX, cpY, cpX2, cpY2, toX, toY, points)
	{
	    var fromX = points[points.length - 2];
	    var fromY = points[points.length - 1];

	    points.length -= 2;

	    var n = GRAPHICS_CURVES._segmentsCount(
	        BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)
	    );

	    var dt = 0;
	    var dt2 = 0;
	    var dt3 = 0;
	    var t2 = 0;
	    var t3 = 0;

	    points.push(fromX, fromY);

	    for (var i = 1, j = 0; i <= n; ++i)
	    {
	        j = i / n;

	        dt = (1 - j);
	        dt2 = dt * dt;
	        dt3 = dt2 * dt;

	        t2 = j * j;
	        t3 = t2 * j;

	        points.push(
	            (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),
	            (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)
	        );
	    }
	};

	/**
	 * Utilities for quadratic curves
	 * @class
	 * @private
	 */
	var QuadraticUtils = function QuadraticUtils () {};

	QuadraticUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, toX, toY)
	{
	    var ax = fromX - (2.0 * cpX) + toX;
	    var ay = fromY - (2.0 * cpY) + toY;
	    var bx = (2.0 * cpX) - (2.0 * fromX);
	    var by = (2.0 * cpY) - (2.0 * fromY);
	    var a = 4.0 * ((ax * ax) + (ay * ay));
	    var b = 4.0 * ((ax * bx) + (ay * by));
	    var c = (bx * bx) + (by * by);

	    var s = 2.0 * Math.sqrt(a + b + c);
	    var a2 = Math.sqrt(a);
	    var a32 = 2.0 * a * a2;
	    var c2 = 2.0 * Math.sqrt(c);
	    var ba = b / a2;

	    return (
	        (a32 * s)
	            + (a2 * b * (s - c2))
	            + (
	                ((4.0 * c * a) - (b * b))
	               * Math.log(((2.0 * a2) + ba + s) / (ba + c2))
	            )
	    ) / (4.0 * a32);
	};

	/**
	 * Calculate the points for a quadratic bezier curve and then draws it.
	 * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
	 *
	 * @private
	 * @param {number} cpX - Control point x
	 * @param {number} cpY - Control point y
	 * @param {number} toX - Destination point x
	 * @param {number} toY - Destination point y
	 * @param {number[]} points - Points to add segments to.
	 */
	QuadraticUtils.curveTo = function curveTo (cpX, cpY, toX, toY, points)
	{
	    var fromX = points[points.length - 2];
	    var fromY = points[points.length - 1];

	    var n = GRAPHICS_CURVES._segmentsCount(
	        QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)
	    );

	    var xa = 0;
	    var ya = 0;

	    for (var i = 1; i <= n; ++i)
	    {
	        var j = i / n;

	        xa = fromX + ((cpX - fromX) * j);
	        ya = fromY + ((cpY - fromY) * j);

	        points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),
	            ya + (((cpY + ((toY - cpY) * j)) - ya) * j));
	    }
	};

	/**
	 * Utilities for arc curves
	 * @class
	 * @private
	 */
	var ArcUtils = function ArcUtils () {};

	ArcUtils.curveTo = function curveTo (x1, y1, x2, y2, radius, points)
	{
	    var fromX = points[points.length - 2];
	    var fromY = points[points.length - 1];

	    var a1 = fromY - y1;
	    var b1 = fromX - x1;
	    var a2 = y2 - y1;
	    var b2 = x2 - x1;
	    var mm = Math.abs((a1 * b2) - (b1 * a2));

	    if (mm < 1.0e-8 || radius === 0)
	    {
	        if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)
	        {
	            points.push(x1, y1);
	        }

	        return null;
	    }

	    var dd = (a1 * a1) + (b1 * b1);
	    var cc = (a2 * a2) + (b2 * b2);
	    var tt = (a1 * a2) + (b1 * b2);
	    var k1 = radius * Math.sqrt(dd) / mm;
	    var k2 = radius * Math.sqrt(cc) / mm;
	    var j1 = k1 * tt / dd;
	    var j2 = k2 * tt / cc;
	    var cx = (k1 * b2) + (k2 * b1);
	    var cy = (k1 * a2) + (k2 * a1);
	    var px = b1 * (k2 + j1);
	    var py = a1 * (k2 + j1);
	    var qx = b2 * (k1 + j2);
	    var qy = a2 * (k1 + j2);
	    var startAngle = Math.atan2(py - cy, px - cx);
	    var endAngle = Math.atan2(qy - cy, qx - cx);

	    return {
	        cx: (cx + x1),
	        cy: (cy + y1),
	        radius: radius,
	        startAngle: startAngle,
	        endAngle: endAngle,
	        anticlockwise: (b1 * a2 > b2 * a1),
	    };
	};

	/**
	 * The arc method creates an arc/curve (used to create circles, or parts of circles).
	 *
	 * @private
	 * @param {number} startX - Start x location of arc
	 * @param {number} startY - Start y location of arc
	 * @param {number} cx - The x-coordinate of the center of the circle
	 * @param {number} cy - The y-coordinate of the center of the circle
	 * @param {number} radius - The radius of the circle
	 * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position
	 *  of the arc's circle)
	 * @param {number} endAngle - The ending angle, in radians
	 * @param {boolean} anticlockwise - Specifies whether the drawing should be
	 *  counter-clockwise or clockwise. False is default, and indicates clockwise, while true
	 *  indicates counter-clockwise.
	 * @param {number} n - Number of segments
	 * @param {number[]} points - Collection of points to add to
	 */
	ArcUtils.arc = function arc (startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points)
	{
	    var sweep = endAngle - startAngle;
	    var n = GRAPHICS_CURVES._segmentsCount(
	        Math.abs(sweep) * radius,
	        Math.ceil(Math.abs(sweep) / PI_2) * 40
	    );

	    var theta = (sweep) / (n * 2);
	    var theta2 = theta * 2;
	    var cTheta = Math.cos(theta);
	    var sTheta = Math.sin(theta);
	    var segMinus = n - 1;
	    var remainder = (segMinus % 1) / segMinus;

	    for (var i = 0; i <= segMinus; ++i)
	    {
	        var real = i + (remainder * i);
	        var angle = ((theta) + startAngle + (theta2 * real));
	        var c = Math.cos(angle);
	        var s = -Math.sin(angle);

	        points.push(
	            (((cTheta * c) + (sTheta * s)) * radius) + cx,
	            (((cTheta * -s) + (sTheta * c)) * radius) + cy
	        );
	    }
	};

	/**
	 * Draw a star shape with an arbitrary number of points.
	 *
	 * @class
	 * @extends PIXI.Polygon
	 * @memberof PIXI
	 * @param {number} x - Center X position of the star
	 * @param {number} y - Center Y position of the star
	 * @param {number} points - The number of points of the star, must be > 1
	 * @param {number} radius - The outer radius of the star
	 * @param {number} [innerRadius] - The inner radius between points, default half `radius`
	 * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical
	 * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	 */
	var Star = /*@__PURE__*/(function (Polygon) {
	    function Star(x, y, points, radius, innerRadius, rotation)
	    {
	        innerRadius = innerRadius || radius / 2;

	        var startAngle = (-1 * Math.PI / 2) + rotation;
	        var len = points * 2;
	        var delta = PI_2 / len;
	        var polygon = [];

	        for (var i = 0; i < len; i++)
	        {
	            var r = i % 2 ? innerRadius : radius;
	            var angle = (i * delta) + startAngle;

	            polygon.push(
	                x + (r * Math.cos(angle)),
	                y + (r * Math.sin(angle))
	            );
	        }

	        Polygon.call(this, polygon);
	    }

	    if ( Polygon ) { Star.__proto__ = Polygon; }
	    Star.prototype = Object.create( Polygon && Polygon.prototype );
	    Star.prototype.constructor = Star;

	    return Star;
	}(Polygon));

	var temp = new Float32Array(3);

	// a default shaders map used by graphics..
	var DEFAULT_SHADERS = {};

	/**
	 * The Graphics class contains methods used to draw primitive shapes such as lines, circles and
	 * rectangles to the display, and to color and fill them.
	 *
	 * Note that because Graphics can share a GraphicsGeometry with other instances,
	 * it is necessary to call `destroy()` to properly dereference the underlying
	 * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same
	 * Graphics instance and call `clear()` between redraws.
	 *
	 * @class
	 * @extends PIXI.Container
	 * @memberof PIXI
	 */
	var Graphics = /*@__PURE__*/(function (Container) {
	    function Graphics(geometry)
	    {
	        if ( geometry === void 0 ) { geometry = null; }

	        Container.call(this);
	        /**
	         * Includes vertex positions, face indices, normals, colors, UVs, and
	         * custom attributes within buffers, reducing the cost of passing all
	         * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.
	         * @member {PIXI.GraphicsGeometry}
	         * @readonly
	         */
	        this.geometry = geometry || new GraphicsGeometry();

	        this.geometry.refCount++;

	        /**
	         * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.
	         * Can be shared between multiple Graphics objects.
	         * @member {PIXI.Shader}
	         */
	        this.shader = null;

	        /**
	         * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,
	         * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.
	         * @member {PIXI.State}
	         */
	        this.state = State.for2d();

	        /**
	         * Current fill style
	         *
	         * @member {PIXI.FillStyle}
	         * @protected
	         */
	        this._fillStyle = new FillStyle();

	        /**
	         * Current line style
	         *
	         * @member {PIXI.LineStyle}
	         * @protected
	         */
	        this._lineStyle = new LineStyle();

	        /**
	         * Current shape transform matrix.
	         *
	         * @member {PIXI.Matrix}
	         * @protected
	         */
	        this._matrix = null;

	        /**
	         * Current hole mode is enabled.
	         *
	         * @member {boolean}
	         * @default false
	         * @protected
	         */
	        this._holeMode = false;

	        /**
	         * Current path
	         *
	         * @member {PIXI.Polygon}
	         * @protected
	         */
	        this.currentPath = null;

	        /**
	         * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.
	         * This is useful if your graphics element does not change often, as it will speed up the rendering
	         * of the object in exchange for taking up texture memory. It is also useful if you need the graphics
	         * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if
	         * you are constantly redrawing the graphics element.
	         *
	         * @name cacheAsBitmap
	         * @member {boolean}
	         * @memberof PIXI.Graphics#
	         * @default false
	         */

	        /**
	         * A collections of batches! These can be drawn by the renderer batch system.
	         *
	         * @protected
	         * @member {object[]}
	         */
	        this.batches = [];

	        /**
	         * Update dirty for limiting calculating tints for batches.
	         *
	         * @protected
	         * @member {number}
	         * @default -1
	         */
	        this.batchTint = -1;

	        /**
	         * Copy of the object vertex data.
	         *
	         * @protected
	         * @member {Float32Array}
	         */
	        this.vertexData = null;

	        this._transformID = -1;
	        this.batchDirty = -1;

	        /**
	         * Renderer plugin for batching
	         *
	         * @member {string}
	         * @default 'batch'
	         */
	        this.pluginName = 'batch';

	        // Set default
	        this.tint = 0xFFFFFF;
	        this.blendMode = BLEND_MODES.NORMAL;
	    }

	    if ( Container ) { Graphics.__proto__ = Container; }
	    Graphics.prototype = Object.create( Container && Container.prototype );
	    Graphics.prototype.constructor = Graphics;

	    var prototypeAccessors = { blendMode: { configurable: true },tint: { configurable: true },fill: { configurable: true },line: { configurable: true } };

	    /**
	     * Creates a new Graphics object with the same values as this one.
	     * Note that the only the properties of the object are cloned, not its transform (position,scale,etc)
	     *
	     * @return {PIXI.Graphics} A clone of the graphics object
	     */
	    Graphics.prototype.clone = function clone ()
	    {
	        this.finishPoly();

	        return new Graphics(this.geometry);
	    };

	    /**
	     * The blend mode to be applied to the graphic shape. Apply a value of
	     * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.
	     *
	     * @member {number}
	     * @default PIXI.BLEND_MODES.NORMAL;
	     * @see PIXI.BLEND_MODES
	     */
	    prototypeAccessors.blendMode.set = function (value)
	    {
	        this.state.blendMode = value;
	    };

	    prototypeAccessors.blendMode.get = function ()
	    {
	        return this.state.blendMode;
	    };

	    /**
	     * The tint applied to the graphic shape. This is a hex value. A value of
	     * 0xFFFFFF will remove any tint effect.
	     *
	     * @member {number}
	     * @default 0xFFFFFF
	     */
	    prototypeAccessors.tint.get = function ()
	    {
	        return this._tint;
	    };
	    prototypeAccessors.tint.set = function (value)
	    {
	        this._tint = value;
	    };

	    /**
	     * The current fill style.
	     *
	     * @member {PIXI.FillStyle}
	     * @readonly
	     */
	    prototypeAccessors.fill.get = function ()
	    {
	        return this._fillStyle;
	    };

	    /**
	     * The current line style.
	     *
	     * @member {PIXI.LineStyle}
	     * @readonly
	     */
	    prototypeAccessors.line.get = function ()
	    {
	        return this._lineStyle;
	    };

	    /**
	     * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()
	     * method or the drawCircle() method.
	     *
	     * @param {number} [width=0] - width of the line to draw, will update the objects stored style
	     * @param {number} [color=0] - color of the line to draw, will update the objects stored style
	     * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style
	     * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)
	     * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.lineStyle = function lineStyle (width, color, alpha, alignment, native)
	    {
	        if ( width === void 0 ) { width = 0; }
	        if ( color === void 0 ) { color = 0; }
	        if ( alpha === void 0 ) { alpha = 1; }
	        if ( alignment === void 0 ) { alignment = 0.5; }
	        if ( native === void 0 ) { native = false; }

	        this.lineTextureStyle(width, Texture.WHITE, color, alpha, null, alignment, native);

	        return this;
	    };

	    /**
	     * Like line style but support texture for line fill.
	     *
	     * @param {number} [width=0] - width of the line to draw, will update the objects stored style
	     * @param {PIXI.Texture} [texture=PIXI.Texture.WHITE] - Texture to use
	     * @param {number} [color=0] - color of the line to draw, will update the objects stored style
	     * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style
	     * @param {PIXI.Matrix} [matrix=null] Texture matrix to transform texture
	     * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)
	     * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.lineTextureStyle = function lineTextureStyle (width, texture, color, alpha,
	        matrix, alignment, native)
	    {
	        if ( width === void 0 ) { width = 0; }
	        if ( texture === void 0 ) { texture = Texture.WHITE; }
	        if ( color === void 0 ) { color = 0xFFFFFF; }
	        if ( alpha === void 0 ) { alpha = 1; }
	        if ( matrix === void 0 ) { matrix = null; }
	        if ( alignment === void 0 ) { alignment = 0.5; }
	        if ( native === void 0 ) { native = false; }

	        if (this.currentPath)
	        {
	            this.startPoly();
	        }

	        var visible = width > 0 && alpha > 0;

	        if (!visible)
	        {
	            this._lineStyle.reset();
	        }
	        else
	        {
	            if (matrix)
	            {
	                matrix = matrix.clone();
	                matrix.invert();
	            }

	            Object.assign(this._lineStyle, {
	                color: color,
	                width: width,
	                alpha: alpha,
	                matrix: matrix,
	                texture: texture,
	                alignment: alignment,
	                native: native,
	                visible: visible,
	            });
	        }

	        return this;
	    };

	    /**
	     * Start a polygon object internally
	     * @protected
	     */
	    Graphics.prototype.startPoly = function startPoly ()
	    {
	        if (this.currentPath)
	        {
	            var points = this.currentPath.points;
	            var len = this.currentPath.points.length;

	            if (len > 2)
	            {
	                this.drawShape(this.currentPath);
	                this.currentPath = new Polygon();
	                this.currentPath.closeStroke = false;
	                this.currentPath.points.push(points[len - 2], points[len - 1]);
	            }
	        }
	        else
	        {
	            this.currentPath = new Polygon();
	            this.currentPath.closeStroke = false;
	        }
	    };

	    /**
	     * Finish the polygon object.
	     * @protected
	     */
	    Graphics.prototype.finishPoly = function finishPoly ()
	    {
	        if (this.currentPath)
	        {
	            if (this.currentPath.points.length > 2)
	            {
	                this.drawShape(this.currentPath);
	                this.currentPath = null;
	            }
	            else
	            {
	                this.currentPath.points.length = 0;
	            }
	        }
	    };

	    /**
	     * Moves the current drawing position to x, y.
	     *
	     * @param {number} x - the X coordinate to move to
	     * @param {number} y - the Y coordinate to move to
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.moveTo = function moveTo (x, y)
	    {
	        this.startPoly();
	        this.currentPath.points[0] = x;
	        this.currentPath.points[1] = y;

	        return this;
	    };

	    /**
	     * Draws a line using the current line style from the current drawing position to (x, y);
	     * The current drawing position is then set to (x, y).
	     *
	     * @param {number} x - the X coordinate to draw to
	     * @param {number} y - the Y coordinate to draw to
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.lineTo = function lineTo (x, y)
	    {
	        if (!this.currentPath)
	        {
	            this.moveTo(0, 0);
	        }

	        // remove duplicates..
	        var points = this.currentPath.points;
	        var fromX = points[points.length - 2];
	        var fromY = points[points.length - 1];

	        if (fromX !== x || fromY !== y)
	        {
	            points.push(x, y);
	        }

	        return this;
	    };

	    /**
	     * Initialize the curve
	     *
	     * @protected
	     * @param {number} [x=0]
	     * @param {number} [y=0]
	     */
	    Graphics.prototype._initCurve = function _initCurve (x, y)
	    {
	        if ( x === void 0 ) { x = 0; }
	        if ( y === void 0 ) { y = 0; }

	        if (this.currentPath)
	        {
	            if (this.currentPath.points.length === 0)
	            {
	                this.currentPath.points = [x, y];
	            }
	        }
	        else
	        {
	            this.moveTo(x, y);
	        }
	    };

	    /**
	     * Calculate the points for a quadratic bezier curve and then draws it.
	     * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
	     *
	     * @param {number} cpX - Control point x
	     * @param {number} cpY - Control point y
	     * @param {number} toX - Destination point x
	     * @param {number} toY - Destination point y
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.quadraticCurveTo = function quadraticCurveTo (cpX, cpY, toX, toY)
	    {
	        this._initCurve();

	        var points = this.currentPath.points;

	        if (points.length === 0)
	        {
	            this.moveTo(0, 0);
	        }

	        QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);

	        return this;
	    };

	    /**
	     * Calculate the points for a bezier curve and then draws it.
	     *
	     * @param {number} cpX - Control point x
	     * @param {number} cpY - Control point y
	     * @param {number} cpX2 - Second Control point x
	     * @param {number} cpY2 - Second Control point y
	     * @param {number} toX - Destination point x
	     * @param {number} toY - Destination point y
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.bezierCurveTo = function bezierCurveTo (cpX, cpY, cpX2, cpY2, toX, toY)
	    {
	        this._initCurve();

	        BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);

	        return this;
	    };

	    /**
	     * The arcTo() method creates an arc/curve between two tangents on the canvas.
	     *
	     * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
	     *
	     * @param {number} x1 - The x-coordinate of the first tangent point of the arc
	     * @param {number} y1 - The y-coordinate of the first tangent point of the arc
	     * @param {number} x2 - The x-coordinate of the end of the arc
	     * @param {number} y2 - The y-coordinate of the end of the arc
	     * @param {number} radius - The radius of the arc
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius)
	    {
	        this._initCurve(x1, y1);

	        var points = this.currentPath.points;

	        var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);

	        if (result)
	        {
	            var cx = result.cx;
	            var cy = result.cy;
	            var radius$1 = result.radius;
	            var startAngle = result.startAngle;
	            var endAngle = result.endAngle;
	            var anticlockwise = result.anticlockwise;

	            this.arc(cx, cy, radius$1, startAngle, endAngle, anticlockwise);
	        }

	        return this;
	    };

	    /**
	     * The arc method creates an arc/curve (used to create circles, or parts of circles).
	     *
	     * @param {number} cx - The x-coordinate of the center of the circle
	     * @param {number} cy - The y-coordinate of the center of the circle
	     * @param {number} radius - The radius of the circle
	     * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position
	     *  of the arc's circle)
	     * @param {number} endAngle - The ending angle, in radians
	     * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be
	     *  counter-clockwise or clockwise. False is default, and indicates clockwise, while true
	     *  indicates counter-clockwise.
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.arc = function arc (cx, cy, radius, startAngle, endAngle, anticlockwise)
	    {
	        if ( anticlockwise === void 0 ) { anticlockwise = false; }

	        if (startAngle === endAngle)
	        {
	            return this;
	        }

	        if (!anticlockwise && endAngle <= startAngle)
	        {
	            endAngle += PI_2;
	        }
	        else if (anticlockwise && startAngle <= endAngle)
	        {
	            startAngle += PI_2;
	        }

	        var sweep = endAngle - startAngle;

	        if (sweep === 0)
	        {
	            return this;
	        }

	        var startX = cx + (Math.cos(startAngle) * radius);
	        var startY = cy + (Math.sin(startAngle) * radius);
	        var eps = this.geometry.closePointEps;

	        // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.
	        var points = this.currentPath ? this.currentPath.points : null;

	        if (points)
	        {
	            // TODO: make a better fix.

	            // We check how far our start is from the last existing point
	            var xDiff = Math.abs(points[points.length - 2] - startX);
	            var yDiff = Math.abs(points[points.length - 1] - startY);

	            if (xDiff < eps && yDiff < eps)
	            { ; }
	            else
	            {
	                points.push(startX, startY);
	            }
	        }
	        else
	        {
	            this.moveTo(startX, startY);
	            points = this.currentPath.points;
	        }

	        ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);

	        return this;
	    };

	    /**
	     * Specifies a simple one-color fill that subsequent calls to other Graphics methods
	     * (such as lineTo() or drawCircle()) use when drawing.
	     *
	     * @param {number} [color=0] - the color of the fill
	     * @param {number} [alpha=1] - the alpha of the fill
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.beginFill = function beginFill (color, alpha)
	    {
	        if ( color === void 0 ) { color = 0; }
	        if ( alpha === void 0 ) { alpha = 1; }

	        return this.beginTextureFill(Texture.WHITE, color, alpha);
	    };

	    /**
	     * Begin the texture fill
	     *
	     * @param {PIXI.Texture} [texture=PIXI.Texture.WHITE] - Texture to fill
	     * @param {number} [color=0xffffff] - Background to fill behind texture
	     * @param {number} [alpha=1] - Alpha of fill
	     * @param {PIXI.Matrix} [matrix=null] - Transform matrix
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.beginTextureFill = function beginTextureFill (texture, color, alpha, matrix)
	    {
	        if ( texture === void 0 ) { texture = Texture.WHITE; }
	        if ( color === void 0 ) { color = 0xFFFFFF; }
	        if ( alpha === void 0 ) { alpha = 1; }
	        if ( matrix === void 0 ) { matrix = null; }

	        if (this.currentPath)
	        {
	            this.startPoly();
	        }

	        var visible = alpha > 0;

	        if (!visible)
	        {
	            this._fillStyle.reset();
	        }
	        else
	        {
	            if (matrix)
	            {
	                matrix = matrix.clone();
	                matrix.invert();
	            }

	            Object.assign(this._fillStyle, {
	                color: color,
	                alpha: alpha,
	                texture: texture,
	                matrix: matrix,
	                visible: visible,
	            });
	        }

	        return this;
	    };

	    /**
	     * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
	     *
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.endFill = function endFill ()
	    {
	        this.finishPoly();

	        this._fillStyle.reset();

	        return this;
	    };

	    /**
	     * Draws a rectangle shape.
	     *
	     * @param {number} x - The X coord of the top-left of the rectangle
	     * @param {number} y - The Y coord of the top-left of the rectangle
	     * @param {number} width - The width of the rectangle
	     * @param {number} height - The height of the rectangle
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawRect = function drawRect (x, y, width, height)
	    {
	        return this.drawShape(new Rectangle(x, y, width, height));
	    };

	    /**
	     * Draw a rectangle shape with rounded/beveled corners.
	     *
	     * @param {number} x - The X coord of the top-left of the rectangle
	     * @param {number} y - The Y coord of the top-left of the rectangle
	     * @param {number} width - The width of the rectangle
	     * @param {number} height - The height of the rectangle
	     * @param {number} radius - Radius of the rectangle corners
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawRoundedRect = function drawRoundedRect (x, y, width, height, radius)
	    {
	        return this.drawShape(new RoundedRectangle(x, y, width, height, radius));
	    };

	    /**
	     * Draws a circle.
	     *
	     * @param {number} x - The X coordinate of the center of the circle
	     * @param {number} y - The Y coordinate of the center of the circle
	     * @param {number} radius - The radius of the circle
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawCircle = function drawCircle (x, y, radius)
	    {
	        return this.drawShape(new Circle(x, y, radius));
	    };

	    /**
	     * Draws an ellipse.
	     *
	     * @param {number} x - The X coordinate of the center of the ellipse
	     * @param {number} y - The Y coordinate of the center of the ellipse
	     * @param {number} width - The half width of the ellipse
	     * @param {number} height - The half height of the ellipse
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawEllipse = function drawEllipse (x, y, width, height)
	    {
	        return this.drawShape(new Ellipse(x, y, width, height));
	    };

	    /**
	     * Draws a polygon using the given path.
	     *
	     * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawPolygon = function drawPolygon (path)
	    {
	        var arguments$1 = arguments;

	        // prevents an argument assignment deopt
	        // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments
	        var points = path;

	        var closeStroke = true;// !!this._fillStyle;

	        // check if data has points..
	        if (points.points)
	        {
	            closeStroke = points.closeStroke;
	            points = points.points;
	        }

	        if (!Array.isArray(points))
	        {
	            // prevents an argument leak deopt
	            // see section 3.2: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments
	            points = new Array(arguments.length);

	            for (var i = 0; i < points.length; ++i)
	            {
	                points[i] = arguments$1[i]; // eslint-disable-line prefer-rest-params
	            }
	        }

	        var shape = new Polygon(points);

	        shape.closeStroke = closeStroke;

	        this.drawShape(shape);

	        return this;
	    };

	    /**
	     * Draw any shape.
	     *
	     * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawShape = function drawShape (shape)
	    {
	        if (!this._holeMode)
	        {
	            this.geometry.drawShape(
	                shape,
	                this._fillStyle.clone(),
	                this._lineStyle.clone(),
	                this._matrix
	            );
	        }
	        else
	        {
	            this.geometry.drawHole(shape, this._matrix);
	        }

	        return this;
	    };

	    /**
	     * Draw a star shape with an arbitrary number of points.
	     *
	     * @param {number} x - Center X position of the star
	     * @param {number} y - Center Y position of the star
	     * @param {number} points - The number of points of the star, must be > 1
	     * @param {number} radius - The outer radius of the star
	     * @param {number} [innerRadius] - The inner radius between points, default half `radius`
	     * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.drawStar = function drawStar (x, y, points, radius, innerRadius, rotation)
	    {
	        if ( rotation === void 0 ) { rotation = 0; }

	        return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation));
	    };

	    /**
	     * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
	     *
	     * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls
	     */
	    Graphics.prototype.clear = function clear ()
	    {
	        this.geometry.clear();
	        this._lineStyle.reset();
	        this._fillStyle.reset();

	        this._matrix = null;
	        this._holeMode = false;
	        this.currentPath = null;

	        return this;
	    };

	    /**
	     * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and
	     * masked with gl.scissor.
	     *
	     * @returns {boolean} True if only 1 rect.
	     */
	    Graphics.prototype.isFastRect = function isFastRect ()
	    {
	        // will fix this!
	        return false;
	        // this.graphicsData.length === 1
	        //  && this.graphicsData[0].shape.type === SHAPES.RECT
	        // && !this.graphicsData[0].lineWidth;
	    };

	    /**
	     * Renders the object using the WebGL renderer
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Graphics.prototype._render = function _render (renderer)
	    {
	        this.finishPoly();

	        var geometry = this.geometry;

	        // batch part..
	        // batch it!
	        geometry.updateBatches();

	        if (geometry.batchable)
	        {
	            if (this.batchDirty !== geometry.batchDirty)
	            {
	                this._populateBatches();
	            }

	            this._renderBatched(renderer);
	        }
	        else
	        {
	            // no batching...
	            renderer.batch.flush();

	            this._renderDirect(renderer);
	        }
	    };

	    /**
	     * Populating batches for rendering
	     *
	     * @protected
	     */
	    Graphics.prototype._populateBatches = function _populateBatches ()
	    {
	        var geometry = this.geometry;
	        var blendMode = this.blendMode;

	        this.batches = [];
	        this.batchTint = -1;
	        this._transformID = -1;
	        this.batchDirty = geometry.batchDirty;

	        this.vertexData = new Float32Array(geometry.points);

	        for (var i = 0, l = geometry.batches.length; i < l; i++)
	        {
	            var gI = geometry.batches[i];
	            var color = gI.style.color;
	            var vertexData = new Float32Array(this.vertexData.buffer,
	                gI.attribStart * 4 * 2,
	                gI.attribSize * 2);

	            var uvs = new Float32Array(geometry.uvsFloat32.buffer,
	                gI.attribStart * 4 * 2,
	                gI.attribSize * 2);

	            var indices = new Uint16Array(geometry.indicesUint16.buffer,
	                gI.start * 2,
	                gI.size);

	            var batch = {
	                vertexData: vertexData,
	                blendMode: blendMode,
	                indices: indices,
	                uvs: uvs,
	                _batchRGB: hex2rgb(color),
	                _tintRGB: color,
	                _texture: gI.style.texture,
	                alpha: gI.style.alpha,
	                worldAlpha: 1 };

	            this.batches[i] = batch;
	        }
	    };

	    /**
	     * Renders the batches using the BathedRenderer plugin
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Graphics.prototype._renderBatched = function _renderBatched (renderer)
	    {
	        if (!this.batches.length)
	        {
	            return;
	        }

	        renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);

	        this.calculateVertices();
	        this.calculateTints();

	        for (var i = 0, l = this.batches.length; i < l; i++)
	        {
	            var batch = this.batches[i];

	            batch.worldAlpha = this.worldAlpha * batch.alpha;

	            renderer.plugins[this.pluginName].render(batch);
	        }
	    };

	    /**
	     * Renders the graphics direct
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Graphics.prototype._renderDirect = function _renderDirect (renderer)
	    {
	        var shader = this._resolveDirectShader(renderer);

	        var geometry = this.geometry;
	        var tint = this.tint;
	        var worldAlpha = this.worldAlpha;
	        var uniforms = shader.uniforms;
	        var drawCalls = geometry.drawCalls;

	        // lets set the transfomr
	        uniforms.translationMatrix = this.transform.worldTransform;

	        // and then lets set the tint..
	        uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;
	        uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;
	        uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;
	        uniforms.tint[3] = worldAlpha;

	        // the first draw call, we can set the uniforms of the shader directly here.

	        // this means that we can tack advantage of the sync function of pixi!
	        // bind and sync uniforms..
	        // there is a way to optimise this..
	        renderer.shader.bind(shader);
	        renderer.geometry.bind(geometry, shader);

	        // set state..
	        renderer.state.set(this.state);

	        // then render the rest of them...
	        for (var i = 0, l = drawCalls.length; i < l; i++)
	        {
	            this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);
	        }
	    };

	    /**
	     * Renders specific DrawCall
	     *
	     * @param {PIXI.Renderer} renderer
	     * @param {PIXI.BatchDrawCall} drawCall
	     */
	    Graphics.prototype._renderDrawCallDirect = function _renderDrawCallDirect (renderer, drawCall)
	    {
	        var groupTextureCount = drawCall.textureCount;

	        for (var j = 0; j < groupTextureCount; j++)
	        {
	            renderer.texture.bind(drawCall.textures[j], j);
	        }

	        renderer.geometry.draw(drawCall.type, drawCall.size, drawCall.start);
	    };

	    /**
	     * Resolves shader for direct rendering
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Graphics.prototype._resolveDirectShader = function _resolveDirectShader (renderer)
	    {
	        var shader = this.shader;

	        var pluginName = this.pluginName;

	        if (!shader)
	        {
	            // if there is no shader here, we can use the default shader.
	            // and that only gets created if we actually need it..
	            // but may be more than one plugins for graphics
	            if (!DEFAULT_SHADERS[pluginName])
	            {
	                var sampleValues = new Int32Array(16);

	                for (var i = 0; i < 16; i++)
	                {
	                    sampleValues[i] = i;
	                }

	                var uniforms = {
	                    tint: new Float32Array([1, 1, 1, 1]),
	                    translationMatrix: new Matrix(),
	                    default: UniformGroup.from({ uSamplers: sampleValues }, true),
	                };

	                var program = renderer.plugins[pluginName]._shader.program;

	                DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);
	            }

	            shader = DEFAULT_SHADERS[pluginName];
	        }

	        return shader;
	    };

	    /**
	     * Retrieves the bounds of the graphic shape as a rectangle object
	     *
	     * @protected
	     */
	    Graphics.prototype._calculateBounds = function _calculateBounds ()
	    {
	        this.finishPoly();
	        var lb = this.geometry.bounds;

	        this._bounds.addFrame(this.transform, lb.minX, lb.minY, lb.maxX, lb.maxY);
	    };

	    /**
	     * Tests if a point is inside this graphics object
	     *
	     * @param {PIXI.Point} point - the point to test
	     * @return {boolean} the result of the test
	     */
	    Graphics.prototype.containsPoint = function containsPoint (point)
	    {
	        this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);

	        return this.geometry.containsPoint(Graphics._TEMP_POINT);
	    };

	    /**
	     * Recalcuate the tint by applying tin to batches using Graphics tint.
	     * @protected
	     */
	    Graphics.prototype.calculateTints = function calculateTints ()
	    {
	        if (this.batchTint !== this.tint)
	        {
	            this.batchTint = this.tint;

	            var tintRGB = hex2rgb(this.tint, temp);

	            for (var i = 0; i < this.batches.length; i++)
	            {
	                var batch = this.batches[i];

	                var batchTint = batch._batchRGB;

	                var r = (tintRGB[0] * batchTint[0]) * 255;
	                var g = (tintRGB[1] * batchTint[1]) * 255;
	                var b = (tintRGB[2] * batchTint[2]) * 255;

	                // TODO Ivan, can this be done in one go?
	                var color = (r << 16) + (g << 8) + (b | 0);

	                batch._tintRGB = (color >> 16)
	                        + (color & 0xff00)
	                        + ((color & 0xff) << 16);
	            }
	        }
	    };

	    /**
	     * If there's a transform update or a change to the shape of the
	     * geometry, recaculate the vertices.
	     * @protected
	     */
	    Graphics.prototype.calculateVertices = function calculateVertices ()
	    {
	        if (this._transformID === this.transform._worldID)
	        {
	            return;
	        }

	        this._transformID = this.transform._worldID;

	        var wt = this.transform.worldTransform;
	        var a = wt.a;
	        var b = wt.b;
	        var c = wt.c;
	        var d = wt.d;
	        var tx = wt.tx;
	        var ty = wt.ty;

	        var data = this.geometry.points;// batch.vertexDataOriginal;
	        var vertexData = this.vertexData;

	        var count = 0;

	        for (var i = 0; i < data.length; i += 2)
	        {
	            var x = data[i];
	            var y = data[i + 1];

	            vertexData[count++] = (a * x) + (c * y) + tx;
	            vertexData[count++] = (d * y) + (b * x) + ty;
	        }
	    };

	    /**
	     * Closes the current path.
	     *
	     * @return {PIXI.Graphics} Returns itself.
	     */
	    Graphics.prototype.closePath = function closePath ()
	    {
	        var currentPath = this.currentPath;

	        if (currentPath)
	        {
	            // we don't need to add extra point in the end because buildLine will take care of that
	            currentPath.closeStroke = true;
	        }

	        return this;
	    };

	    /**
	     * Apply a matrix to the positional data.
	     *
	     * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.
	     * @return {PIXI.Graphics} Returns itself.
	     */
	    Graphics.prototype.setMatrix = function setMatrix (matrix)
	    {
	        this._matrix = matrix;

	        return this;
	    };

	    /**
	     * Begin adding holes to the last draw shape
	     * IMPORTANT: holes must be fully inside a shape to work
	     * Also weirdness ensues if holes overlap!
	     * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,
	     * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.
	     * @return {PIXI.Graphics} Returns itself.
	     */
	    Graphics.prototype.beginHole = function beginHole ()
	    {
	        this.finishPoly();
	        this._holeMode = true;

	        return this;
	    };

	    /**
	     * End adding holes to the last draw shape
	     * @return {PIXI.Graphics} Returns itself.
	     */
	    Graphics.prototype.endHole = function endHole ()
	    {
	        this.finishPoly();
	        this._holeMode = false;

	        return this;
	    };

	    /**
	     * Destroys the Graphics object.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all
	     *  options have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have
	     *  their destroy method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the texture of the child sprite
	     * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the base texture of the child sprite
	     */
	    Graphics.prototype.destroy = function destroy (options)
	    {
	        Container.prototype.destroy.call(this, options);

	        this.geometry.refCount--;
	        if (this.geometry.refCount === 0)
	        {
	            this.geometry.dispose();
	        }

	        this._matrix = null;
	        this.currentPath = null;
	        this._lineStyle.destroy();
	        this._lineStyle = null;
	        this._fillStyle.destroy();
	        this._fillStyle = null;
	        this.geometry = null;
	        this.shader = null;
	        this.vertexData = null;
	        this.batches.length = 0;
	        this.batches = null;

	        Container.prototype.destroy.call(this, options);
	    };

	    Object.defineProperties( Graphics.prototype, prototypeAccessors );

	    return Graphics;
	}(Container));

	/**
	 * Temporary point to use for containsPoint
	 *
	 * @static
	 * @private
	 * @member {PIXI.Point}
	 */
	Graphics._TEMP_POINT = new Point();

	/*!
	 * @pixi/sprite - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/sprite is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var tempPoint = new Point();
	var indices = new Uint16Array([0, 1, 2, 0, 2, 3]);

	/**
	 * The Sprite object is the base for all textured objects that are rendered to the screen
	*
	 * A sprite can be created directly from an image like this:
	 *
	 * ```js
	 * let sprite = PIXI.Sprite.from('assets/image.png');
	 * ```
	 *
	 * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},
	 * as swapping base textures when rendering to the screen is inefficient.
	 *
	 * ```js
	 * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);
	 *
	 * function setup() {
	 *   let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
	 *   let sprite = new PIXI.Sprite(sheet.textures["image.png"]);
	 *   ...
	 * }
	 * ```
	 *
	 * @class
	 * @extends PIXI.Container
	 * @memberof PIXI
	 */
	var Sprite = /*@__PURE__*/(function (Container) {
	    function Sprite(texture)
	    {
	        Container.call(this);

	        /**
	         * The anchor point defines the normalized coordinates
	         * in the texture that map to the position of this
	         * sprite.
	         *
	         * By default, this is `(0,0)` (or `texture.defaultAnchor`
	         * if you have modified that), which means the position
	         * `(x,y)` of this `Sprite` will be the top-left corner.
	         *
	         * Note: Updating `texture.defaultAnchor` after
	         * constructing a `Sprite` does _not_ update its anchor.
	         *
	         * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}
	         *
	         * @default `texture.defaultAnchor`
	         * @member {PIXI.ObservablePoint}
	         * @private
	         */
	        this._anchor = new ObservablePoint(
	            this._onAnchorUpdate,
	            this,
	            (texture ? texture.defaultAnchor.x : 0),
	            (texture ? texture.defaultAnchor.y : 0)
	        );

	        /**
	         * The texture that the sprite is using
	         *
	         * @private
	         * @member {PIXI.Texture}
	         */
	        this._texture = null;

	        /**
	         * The width of the sprite (this is initially set by the texture)
	         *
	         * @private
	         * @member {number}
	         */
	        this._width = 0;

	        /**
	         * The height of the sprite (this is initially set by the texture)
	         *
	         * @private
	         * @member {number}
	         */
	        this._height = 0;

	        /**
	         * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.
	         *
	         * @private
	         * @member {number}
	         * @default 0xFFFFFF
	         */
	        this._tint = null;
	        this._tintRGB = null;
	        this.tint = 0xFFFFFF;

	        /**
	         * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.
	         *
	         * @member {number}
	         * @default PIXI.BLEND_MODES.NORMAL
	         * @see PIXI.BLEND_MODES
	         */
	        this.blendMode = BLEND_MODES.NORMAL;

	        /**
	         * The shader that will be used to render the sprite. Set to null to remove a current shader.
	         *
	         * @member {PIXI.Filter|PIXI.Shader}
	         */
	        this.shader = null;

	        /**
	         * Cached tint value so we can tell when the tint is changed.
	         * Value is used for 2d CanvasRenderer.
	         *
	         * @protected
	         * @member {number}
	         * @default 0xFFFFFF
	         */
	        this._cachedTint = 0xFFFFFF;

	        /**
	         * this is used to store the uvs data of the sprite, assigned at the same time
	         * as the vertexData in calculateVertices()
	         *
	         * @private
	         * @member {Float32Array}
	         */
	        this.uvs = null;

	        // call texture setter
	        this.texture = texture || Texture.EMPTY;

	        /**
	         * this is used to store the vertex data of the sprite (basically a quad)
	         *
	         * @private
	         * @member {Float32Array}
	         */
	        this.vertexData = new Float32Array(8);

	        /**
	         * This is used to calculate the bounds of the object IF it is a trimmed sprite
	         *
	         * @private
	         * @member {Float32Array}
	         */
	        this.vertexTrimmedData = null;

	        this._transformID = -1;
	        this._textureID = -1;

	        this._transformTrimmedID = -1;
	        this._textureTrimmedID = -1;

	        // Batchable stuff..
	        // TODO could make this a mixin?
	        this.indices = indices;
	        this.size = 4;
	        this.start = 0;

	        /**
	         * Plugin that is responsible for rendering this element.
	         * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.
	         *
	         * @member {string}
	         * @default 'batch'
	         */
	        this.pluginName = 'batch';

	        /**
	         * used to fast check if a sprite is.. a sprite!
	         * @member {boolean}
	         */
	        this.isSprite = true;

	        /**
	         * Internal roundPixels field
	         *
	         * @member {boolean}
	         * @private
	         */
	        this._roundPixels = settings.ROUND_PIXELS;
	    }

	    if ( Container ) { Sprite.__proto__ = Container; }
	    Sprite.prototype = Object.create( Container && Container.prototype );
	    Sprite.prototype.constructor = Sprite;

	    var prototypeAccessors = { roundPixels: { configurable: true },width: { configurable: true },height: { configurable: true },anchor: { configurable: true },tint: { configurable: true },texture: { configurable: true } };

	    /**
	     * When the texture is updated, this event will fire to update the scale and frame
	     *
	     * @private
	     */
	    Sprite.prototype._onTextureUpdate = function _onTextureUpdate ()
	    {
	        this._textureID = -1;
	        this._textureTrimmedID = -1;
	        this._cachedTint = 0xFFFFFF;

	        // so if _width is 0 then width was not set..
	        if (this._width)
	        {
	            this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width;
	        }

	        if (this._height)
	        {
	            this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height;
	        }
	    };

	    /**
	     * Called when the anchor position updates.
	     *
	     * @private
	     */
	    Sprite.prototype._onAnchorUpdate = function _onAnchorUpdate ()
	    {
	        this._transformID = -1;
	        this._transformTrimmedID = -1;
	    };

	    /**
	     * calculates worldTransform * vertices, store it in vertexData
	     */
	    Sprite.prototype.calculateVertices = function calculateVertices ()
	    {
	        var texture = this._texture;

	        if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)
	        {
	            return;
	        }

	        // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`
	        if (this._textureID !== texture._updateID)
	        {
	            this.uvs = this._texture._uvs.uvsFloat32;
	        }

	        this._transformID = this.transform._worldID;
	        this._textureID = texture._updateID;

	        // set the vertex data

	        var wt = this.transform.worldTransform;
	        var a = wt.a;
	        var b = wt.b;
	        var c = wt.c;
	        var d = wt.d;
	        var tx = wt.tx;
	        var ty = wt.ty;
	        var vertexData = this.vertexData;
	        var trim = texture.trim;
	        var orig = texture.orig;
	        var anchor = this._anchor;

	        var w0 = 0;
	        var w1 = 0;
	        var h0 = 0;
	        var h1 = 0;

	        if (trim)
	        {
	            // if the sprite is trimmed and is not a tilingsprite then we need to add the extra
	            // space before transforming the sprite coords.
	            w1 = trim.x - (anchor._x * orig.width);
	            w0 = w1 + trim.width;

	            h1 = trim.y - (anchor._y * orig.height);
	            h0 = h1 + trim.height;
	        }
	        else
	        {
	            w1 = -anchor._x * orig.width;
	            w0 = w1 + orig.width;

	            h1 = -anchor._y * orig.height;
	            h0 = h1 + orig.height;
	        }

	        // xy
	        vertexData[0] = (a * w1) + (c * h1) + tx;
	        vertexData[1] = (d * h1) + (b * w1) + ty;

	        // xy
	        vertexData[2] = (a * w0) + (c * h1) + tx;
	        vertexData[3] = (d * h1) + (b * w0) + ty;

	        // xy
	        vertexData[4] = (a * w0) + (c * h0) + tx;
	        vertexData[5] = (d * h0) + (b * w0) + ty;

	        // xy
	        vertexData[6] = (a * w1) + (c * h0) + tx;
	        vertexData[7] = (d * h0) + (b * w1) + ty;

	        if (this._roundPixels)
	        {
	            for (var i = 0; i < 8; i++)
	            {
	                vertexData[i] = Math.round(vertexData[i]);
	            }
	        }
	    };

	    /**
	     * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData
	     * This is used to ensure that the true width and height of a trimmed texture is respected
	     */
	    Sprite.prototype.calculateTrimmedVertices = function calculateTrimmedVertices ()
	    {
	        if (!this.vertexTrimmedData)
	        {
	            this.vertexTrimmedData = new Float32Array(8);
	        }
	        else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)
	        {
	            return;
	        }

	        this._transformTrimmedID = this.transform._worldID;
	        this._textureTrimmedID = this._texture._updateID;

	        // lets do some special trim code!
	        var texture = this._texture;
	        var vertexData = this.vertexTrimmedData;
	        var orig = texture.orig;
	        var anchor = this._anchor;

	        // lets calculate the new untrimmed bounds..
	        var wt = this.transform.worldTransform;
	        var a = wt.a;
	        var b = wt.b;
	        var c = wt.c;
	        var d = wt.d;
	        var tx = wt.tx;
	        var ty = wt.ty;

	        var w1 = -anchor._x * orig.width;
	        var w0 = w1 + orig.width;

	        var h1 = -anchor._y * orig.height;
	        var h0 = h1 + orig.height;

	        // xy
	        vertexData[0] = (a * w1) + (c * h1) + tx;
	        vertexData[1] = (d * h1) + (b * w1) + ty;

	        // xy
	        vertexData[2] = (a * w0) + (c * h1) + tx;
	        vertexData[3] = (d * h1) + (b * w0) + ty;

	        // xy
	        vertexData[4] = (a * w0) + (c * h0) + tx;
	        vertexData[5] = (d * h0) + (b * w0) + ty;

	        // xy
	        vertexData[6] = (a * w1) + (c * h0) + tx;
	        vertexData[7] = (d * h0) + (b * w1) + ty;
	    };

	    /**
	    *
	    * Renders the object using the WebGL renderer
	    *
	    * @protected
	    * @param {PIXI.Renderer} renderer - The webgl renderer to use.
	    */
	    Sprite.prototype._render = function _render (renderer)
	    {
	        this.calculateVertices();

	        renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
	        renderer.plugins[this.pluginName].render(this);
	    };

	    /**
	     * Updates the bounds of the sprite.
	     *
	     * @protected
	     */
	    Sprite.prototype._calculateBounds = function _calculateBounds ()
	    {
	        var trim = this._texture.trim;
	        var orig = this._texture.orig;

	        // First lets check to see if the current texture has a trim..
	        if (!trim || (trim.width === orig.width && trim.height === orig.height))
	        {
	            // no trim! lets use the usual calculations..
	            this.calculateVertices();
	            this._bounds.addQuad(this.vertexData);
	        }
	        else
	        {
	            // lets calculate a special trimmed bounds...
	            this.calculateTrimmedVertices();
	            this._bounds.addQuad(this.vertexTrimmedData);
	        }
	    };

	    /**
	     * Gets the local bounds of the sprite object.
	     *
	     * @param {PIXI.Rectangle} [rect] - The output rectangle.
	     * @return {PIXI.Rectangle} The bounds.
	     */
	    Sprite.prototype.getLocalBounds = function getLocalBounds (rect)
	    {
	        // we can do a fast local bounds if the sprite has no children!
	        if (this.children.length === 0)
	        {
	            this._bounds.minX = this._texture.orig.width * -this._anchor._x;
	            this._bounds.minY = this._texture.orig.height * -this._anchor._y;
	            this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);
	            this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);

	            if (!rect)
	            {
	                if (!this._localBoundsRect)
	                {
	                    this._localBoundsRect = new Rectangle();
	                }

	                rect = this._localBoundsRect;
	            }

	            return this._bounds.getRectangle(rect);
	        }

	        return Container.prototype.getLocalBounds.call(this, rect);
	    };

	    /**
	     * Tests if a point is inside this sprite
	     *
	     * @param {PIXI.Point} point - the point to test
	     * @return {boolean} the result of the test
	     */
	    Sprite.prototype.containsPoint = function containsPoint (point)
	    {
	        this.worldTransform.applyInverse(point, tempPoint);

	        var width = this._texture.orig.width;
	        var height = this._texture.orig.height;
	        var x1 = -width * this.anchor.x;
	        var y1 = 0;

	        if (tempPoint.x >= x1 && tempPoint.x < x1 + width)
	        {
	            y1 = -height * this.anchor.y;

	            if (tempPoint.y >= y1 && tempPoint.y < y1 + height)
	            {
	                return true;
	            }
	        }

	        return false;
	    };

	    /**
	     * Destroys this sprite and optionally its texture and children
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
	     *      method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well
	     * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well
	     */
	    Sprite.prototype.destroy = function destroy (options)
	    {
	        Container.prototype.destroy.call(this, options);

	        this._texture.off('update', this._onTextureUpdate, this);

	        this._anchor = null;

	        var destroyTexture = typeof options === 'boolean' ? options : options && options.texture;

	        if (destroyTexture)
	        {
	            var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;

	            this._texture.destroy(!!destroyBaseTexture);
	        }

	        this._texture = null;
	        this.shader = null;
	    };

	    // some helper functions..

	    /**
	     * Helper function that creates a new sprite based on the source you provide.
	     * The source can be - frame id, image url, video url, canvas element, video element, base texture
	     *
	     * @static
	     * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from
	     * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.
	     * @return {PIXI.Sprite} The newly created sprite
	     */
	    Sprite.from = function from (source, options)
	    {
	        var texture = (source instanceof Texture)
	            ? source
	            : Texture.from(source, options);

	        return new Sprite(texture);
	    };

	    /**
	     * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
	     * Advantages can include sharper image quality (like text) and faster rendering on canvas.
	     * The main disadvantage is movement of objects may appear less smooth.
	     * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
	     *
	     * @member {boolean}
	     * @default false
	     */
	    prototypeAccessors.roundPixels.set = function (value)
	    {
	        if (this._roundPixels !== value)
	        {
	            this._transformID = -1;
	        }
	        this._roundPixels = value;
	    };

	    prototypeAccessors.roundPixels.get = function ()
	    {
	        return this._roundPixels;
	    };

	    /**
	     * The width of the sprite, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return Math.abs(this.scale.x) * this._texture.orig.width;
	    };

	    prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        var s = sign$1(this.scale.x) || 1;

	        this.scale.x = s * value / this._texture.orig.width;
	        this._width = value;
	    };

	    /**
	     * The height of the sprite, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return Math.abs(this.scale.y) * this._texture.orig.height;
	    };

	    prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        var s = sign$1(this.scale.y) || 1;

	        this.scale.y = s * value / this._texture.orig.height;
	        this._height = value;
	    };

	    /**
	     * The anchor sets the origin point of the text. The default value is taken from the {@link PIXI.Texture|Texture}
	     * and passed to the constructor.
	     *
	     * The default is `(0,0)`, this means the text's origin is the top left.
	     *
	     * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.
	     *
	     * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.
	     *
	     * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
	     *
	     * @example
	     * const sprite = new PIXI.Sprite(texture);
	     * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    prototypeAccessors.anchor.get = function ()
	    {
	        return this._anchor;
	    };

	    prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._anchor.copyFrom(value);
	    };

	    /**
	     * The tint applied to the sprite. This is a hex value.
	     * A value of 0xFFFFFF will remove any tint effect.
	     *
	     * @member {number}
	     * @default 0xFFFFFF
	     */
	    prototypeAccessors.tint.get = function ()
	    {
	        return this._tint;
	    };

	    prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._tint = value;
	        this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);
	    };

	    /**
	     * The texture that the sprite is using
	     *
	     * @member {PIXI.Texture}
	     */
	    prototypeAccessors.texture.get = function ()
	    {
	        return this._texture;
	    };

	    prototypeAccessors.texture.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (this._texture === value)
	        {
	            return;
	        }

	        this._texture = value || Texture.EMPTY;
	        this._cachedTint = 0xFFFFFF;

	        this._textureID = -1;
	        this._textureTrimmedID = -1;

	        if (value)
	        {
	            // wait for the texture to load
	            if (value.baseTexture.valid)
	            {
	                this._onTextureUpdate();
	            }
	            else
	            {
	                value.once('update', this._onTextureUpdate, this);
	            }
	        }
	    };

	    Object.defineProperties( Sprite.prototype, prototypeAccessors );

	    return Sprite;
	}(Container));

	/*!
	 * @pixi/text - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/text is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Constants that define the type of gradient on text.
	 *
	 * @static
	 * @constant
	 * @name TEXT_GRADIENT
	 * @memberof PIXI
	 * @type {object}
	 * @property {number} LINEAR_VERTICAL Vertical gradient
	 * @property {number} LINEAR_HORIZONTAL Linear gradient
	 */
	var TEXT_GRADIENT = {
	    LINEAR_VERTICAL: 0,
	    LINEAR_HORIZONTAL: 1,
	};

	// disabling eslint for now, going to rewrite this in v5

	var defaultStyle = {
	    align: 'left',
	    breakWords: false,
	    dropShadow: false,
	    dropShadowAlpha: 1,
	    dropShadowAngle: Math.PI / 6,
	    dropShadowBlur: 0,
	    dropShadowColor: 'black',
	    dropShadowDistance: 5,
	    fill: 'black',
	    fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,
	    fillGradientStops: [],
	    fontFamily: 'Arial',
	    fontSize: 26,
	    fontStyle: 'normal',
	    fontVariant: 'normal',
	    fontWeight: 'normal',
	    letterSpacing: 0,
	    lineHeight: 0,
	    lineJoin: 'miter',
	    miterLimit: 10,
	    padding: 0,
	    stroke: 'black',
	    strokeThickness: 0,
	    textBaseline: 'alphabetic',
	    trim: false,
	    whiteSpace: 'pre',
	    wordWrap: false,
	    wordWrapWidth: 100,
	    leading: 0,
	};

	var genericFontFamilies = [
	    'serif',
	    'sans-serif',
	    'monospace',
	    'cursive',
	    'fantasy',
	    'system-ui' ];

	/**
	 * A TextStyle Object contains information to decorate a Text objects.
	 *
	 * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.
	 *
	 * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).
	 *
	 * @class
	 * @memberof PIXI
	 */
	var TextStyle = function TextStyle(style)
	{
	    this.styleID = 0;

	    this.reset();

	    deepCopyProperties(this, style, style);
	};

	var prototypeAccessors$7 = { align: { configurable: true },breakWords: { configurable: true },dropShadow: { configurable: true },dropShadowAlpha: { configurable: true },dropShadowAngle: { configurable: true },dropShadowBlur: { configurable: true },dropShadowColor: { configurable: true },dropShadowDistance: { configurable: true },fill: { configurable: true },fillGradientType: { configurable: true },fillGradientStops: { configurable: true },fontFamily: { configurable: true },fontSize: { configurable: true },fontStyle: { configurable: true },fontVariant: { configurable: true },fontWeight: { configurable: true },letterSpacing: { configurable: true },lineHeight: { configurable: true },leading: { configurable: true },lineJoin: { configurable: true },miterLimit: { configurable: true },padding: { configurable: true },stroke: { configurable: true },strokeThickness: { configurable: true },textBaseline: { configurable: true },trim: { configurable: true },whiteSpace: { configurable: true },wordWrap: { configurable: true },wordWrapWidth: { configurable: true } };

	/**
	 * Creates a new TextStyle object with the same values as this one.
	 * Note that the only the properties of the object are cloned.
	 *
	 * @return {PIXI.TextStyle} New cloned TextStyle object
	 */
	TextStyle.prototype.clone = function clone ()
	{
	    var clonedProperties = {};

	    deepCopyProperties(clonedProperties, this, defaultStyle);

	    return new TextStyle(clonedProperties);
	};

	/**
	 * Resets all properties to the defaults specified in TextStyle.prototype._default
	 */
	TextStyle.prototype.reset = function reset ()
	{
	    deepCopyProperties(this, defaultStyle, defaultStyle);
	};

	/**
	 * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.align.get = function ()
	{
	    return this._align;
	};
	prototypeAccessors$7.align.set = function (align) // eslint-disable-line require-jsdoc
	{
	    if (this._align !== align)
	    {
	        this._align = align;
	        this.styleID++;
	    }
	};

	/**
	 * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true
	 *
	 * @member {boolean}
	 */
	prototypeAccessors$7.breakWords.get = function ()
	{
	    return this._breakWords;
	};
	prototypeAccessors$7.breakWords.set = function (breakWords) // eslint-disable-line require-jsdoc
	{
	    if (this._breakWords !== breakWords)
	    {
	        this._breakWords = breakWords;
	        this.styleID++;
	    }
	};

	/**
	 * Set a drop shadow for the text
	 *
	 * @member {boolean}
	 */
	prototypeAccessors$7.dropShadow.get = function ()
	{
	    return this._dropShadow;
	};
	prototypeAccessors$7.dropShadow.set = function (dropShadow) // eslint-disable-line require-jsdoc
	{
	    if (this._dropShadow !== dropShadow)
	    {
	        this._dropShadow = dropShadow;
	        this.styleID++;
	    }
	};

	/**
	 * Set alpha for the drop shadow
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.dropShadowAlpha.get = function ()
	{
	    return this._dropShadowAlpha;
	};
	prototypeAccessors$7.dropShadowAlpha.set = function (dropShadowAlpha) // eslint-disable-line require-jsdoc
	{
	    if (this._dropShadowAlpha !== dropShadowAlpha)
	    {
	        this._dropShadowAlpha = dropShadowAlpha;
	        this.styleID++;
	    }
	};

	/**
	 * Set a angle of the drop shadow
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.dropShadowAngle.get = function ()
	{
	    return this._dropShadowAngle;
	};
	prototypeAccessors$7.dropShadowAngle.set = function (dropShadowAngle) // eslint-disable-line require-jsdoc
	{
	    if (this._dropShadowAngle !== dropShadowAngle)
	    {
	        this._dropShadowAngle = dropShadowAngle;
	        this.styleID++;
	    }
	};

	/**
	 * Set a shadow blur radius
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.dropShadowBlur.get = function ()
	{
	    return this._dropShadowBlur;
	};
	prototypeAccessors$7.dropShadowBlur.set = function (dropShadowBlur) // eslint-disable-line require-jsdoc
	{
	    if (this._dropShadowBlur !== dropShadowBlur)
	    {
	        this._dropShadowBlur = dropShadowBlur;
	        this.styleID++;
	    }
	};

	/**
	 * A fill style to be used on the dropshadow e.g 'red', '#00FF00'
	 *
	 * @member {string|number}
	 */
	prototypeAccessors$7.dropShadowColor.get = function ()
	{
	    return this._dropShadowColor;
	};
	prototypeAccessors$7.dropShadowColor.set = function (dropShadowColor) // eslint-disable-line require-jsdoc
	{
	    var outputColor = getColor(dropShadowColor);
	    if (this._dropShadowColor !== outputColor)
	    {
	        this._dropShadowColor = outputColor;
	        this.styleID++;
	    }
	};

	/**
	 * Set a distance of the drop shadow
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.dropShadowDistance.get = function ()
	{
	    return this._dropShadowDistance;
	};
	prototypeAccessors$7.dropShadowDistance.set = function (dropShadowDistance) // eslint-disable-line require-jsdoc
	{
	    if (this._dropShadowDistance !== dropShadowDistance)
	    {
	        this._dropShadowDistance = dropShadowDistance;
	        this.styleID++;
	    }
	};

	/**
	 * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.
	 * Can be an array to create a gradient eg ['#000000','#FFFFFF']
	 * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}
	 *
	 * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}
	 */
	prototypeAccessors$7.fill.get = function ()
	{
	    return this._fill;
	};
	prototypeAccessors$7.fill.set = function (fill) // eslint-disable-line require-jsdoc
	{
	    var outputColor = getColor(fill);
	    if (this._fill !== outputColor)
	    {
	        this._fill = outputColor;
	        this.styleID++;
	    }
	};

	/**
	 * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.
	 * See {@link PIXI.TEXT_GRADIENT}
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.fillGradientType.get = function ()
	{
	    return this._fillGradientType;
	};
	prototypeAccessors$7.fillGradientType.set = function (fillGradientType) // eslint-disable-line require-jsdoc
	{
	    if (this._fillGradientType !== fillGradientType)
	    {
	        this._fillGradientType = fillGradientType;
	        this.styleID++;
	    }
	};

	/**
	 * If fill is an array of colours to create a gradient, this array can set the stop points
	 * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.
	 *
	 * @member {number[]}
	 */
	prototypeAccessors$7.fillGradientStops.get = function ()
	{
	    return this._fillGradientStops;
	};
	prototypeAccessors$7.fillGradientStops.set = function (fillGradientStops) // eslint-disable-line require-jsdoc
	{
	    if (!areArraysEqual(this._fillGradientStops,fillGradientStops))
	    {
	        this._fillGradientStops = fillGradientStops;
	        this.styleID++;
	    }
	};

	/**
	 * The font family
	 *
	 * @member {string|string[]}
	 */
	prototypeAccessors$7.fontFamily.get = function ()
	{
	    return this._fontFamily;
	};
	prototypeAccessors$7.fontFamily.set = function (fontFamily) // eslint-disable-line require-jsdoc
	{
	    if (this.fontFamily !== fontFamily)
	    {
	        this._fontFamily = fontFamily;
	        this.styleID++;
	    }
	};

	/**
	 * The font size
	 * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')
	 *
	 * @member {number|string}
	 */
	prototypeAccessors$7.fontSize.get = function ()
	{
	    return this._fontSize;
	};
	prototypeAccessors$7.fontSize.set = function (fontSize) // eslint-disable-line require-jsdoc
	{
	    if (this._fontSize !== fontSize)
	    {
	        this._fontSize = fontSize;
	        this.styleID++;
	    }
	};

	/**
	 * The font style
	 * ('normal', 'italic' or 'oblique')
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.fontStyle.get = function ()
	{
	    return this._fontStyle;
	};
	prototypeAccessors$7.fontStyle.set = function (fontStyle) // eslint-disable-line require-jsdoc
	{
	    if (this._fontStyle !== fontStyle)
	    {
	        this._fontStyle = fontStyle;
	        this.styleID++;
	    }
	};

	/**
	 * The font variant
	 * ('normal' or 'small-caps')
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.fontVariant.get = function ()
	{
	    return this._fontVariant;
	};
	prototypeAccessors$7.fontVariant.set = function (fontVariant) // eslint-disable-line require-jsdoc
	{
	    if (this._fontVariant !== fontVariant)
	    {
	        this._fontVariant = fontVariant;
	        this.styleID++;
	    }
	};

	/**
	 * The font weight
	 * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.fontWeight.get = function ()
	{
	    return this._fontWeight;
	};
	prototypeAccessors$7.fontWeight.set = function (fontWeight) // eslint-disable-line require-jsdoc
	{
	    if (this._fontWeight !== fontWeight)
	    {
	        this._fontWeight = fontWeight;
	        this.styleID++;
	    }
	};

	/**
	 * The amount of spacing between letters, default is 0
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.letterSpacing.get = function ()
	{
	    return this._letterSpacing;
	};
	prototypeAccessors$7.letterSpacing.set = function (letterSpacing) // eslint-disable-line require-jsdoc
	{
	    if (this._letterSpacing !== letterSpacing)
	    {
	        this._letterSpacing = letterSpacing;
	        this.styleID++;
	    }
	};

	/**
	 * The line height, a number that represents the vertical space that a letter uses
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.lineHeight.get = function ()
	{
	    return this._lineHeight;
	};
	prototypeAccessors$7.lineHeight.set = function (lineHeight) // eslint-disable-line require-jsdoc
	{
	    if (this._lineHeight !== lineHeight)
	    {
	        this._lineHeight = lineHeight;
	        this.styleID++;
	    }
	};

	/**
	 * The space between lines
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.leading.get = function ()
	{
	    return this._leading;
	};
	prototypeAccessors$7.leading.set = function (leading) // eslint-disable-line require-jsdoc
	{
	    if (this._leading !== leading)
	    {
	        this._leading = leading;
	        this.styleID++;
	    }
	};

	/**
	 * The lineJoin property sets the type of corner created, it can resolve spiked text issues.
	 * Default is 'miter' (creates a sharp corner).
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.lineJoin.get = function ()
	{
	    return this._lineJoin;
	};
	prototypeAccessors$7.lineJoin.set = function (lineJoin) // eslint-disable-line require-jsdoc
	{
	    if (this._lineJoin !== lineJoin)
	    {
	        this._lineJoin = lineJoin;
	        this.styleID++;
	    }
	};

	/**
	 * The miter limit to use when using the 'miter' lineJoin mode
	 * This can reduce or increase the spikiness of rendered text.
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.miterLimit.get = function ()
	{
	    return this._miterLimit;
	};
	prototypeAccessors$7.miterLimit.set = function (miterLimit) // eslint-disable-line require-jsdoc
	{
	    if (this._miterLimit !== miterLimit)
	    {
	        this._miterLimit = miterLimit;
	        this.styleID++;
	    }
	};

	/**
	 * Occasionally some fonts are cropped. Adding some padding will prevent this from happening
	 * by adding padding to all sides of the text.
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.padding.get = function ()
	{
	    return this._padding;
	};
	prototypeAccessors$7.padding.set = function (padding) // eslint-disable-line require-jsdoc
	{
	    if (this._padding !== padding)
	    {
	        this._padding = padding;
	        this.styleID++;
	    }
	};

	/**
	 * A canvas fillstyle that will be used on the text stroke
	 * e.g 'blue', '#FCFF00'
	 *
	 * @member {string|number}
	 */
	prototypeAccessors$7.stroke.get = function ()
	{
	    return this._stroke;
	};
	prototypeAccessors$7.stroke.set = function (stroke) // eslint-disable-line require-jsdoc
	{
	    var outputColor = getColor(stroke);
	    if (this._stroke !== outputColor)
	    {
	        this._stroke = outputColor;
	        this.styleID++;
	    }
	};

	/**
	 * A number that represents the thickness of the stroke.
	 * Default is 0 (no stroke)
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.strokeThickness.get = function ()
	{
	    return this._strokeThickness;
	};
	prototypeAccessors$7.strokeThickness.set = function (strokeThickness) // eslint-disable-line require-jsdoc
	{
	    if (this._strokeThickness !== strokeThickness)
	    {
	        this._strokeThickness = strokeThickness;
	        this.styleID++;
	    }
	};

	/**
	 * The baseline of the text that is rendered.
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.textBaseline.get = function ()
	{
	    return this._textBaseline;
	};
	prototypeAccessors$7.textBaseline.set = function (textBaseline) // eslint-disable-line require-jsdoc
	{
	    if (this._textBaseline !== textBaseline)
	    {
	        this._textBaseline = textBaseline;
	        this.styleID++;
	    }
	};

	/**
	 * Trim transparent borders
	 *
	 * @member {boolean}
	 */
	prototypeAccessors$7.trim.get = function ()
	{
	    return this._trim;
	};
	prototypeAccessors$7.trim.set = function (trim) // eslint-disable-line require-jsdoc
	{
	    if (this._trim !== trim)
	    {
	        this._trim = trim;
	        this.styleID++;
	    }
	};

	/**
	 * How newlines and spaces should be handled.
	 * Default is 'pre' (preserve, preserve).
	 *
	 *  value   | New lines |   Spaces
	 *  ---     | ---       |   ---
	 * 'normal' | Collapse  |   Collapse
	 * 'pre'    | Preserve  |   Preserve
	 * 'pre-line'   | Preserve  |   Collapse
	 *
	 * @member {string}
	 */
	prototypeAccessors$7.whiteSpace.get = function ()
	{
	    return this._whiteSpace;
	};
	prototypeAccessors$7.whiteSpace.set = function (whiteSpace) // eslint-disable-line require-jsdoc
	{
	    if (this._whiteSpace !== whiteSpace)
	    {
	        this._whiteSpace = whiteSpace;
	        this.styleID++;
	    }
	};

	/**
	 * Indicates if word wrap should be used
	 *
	 * @member {boolean}
	 */
	prototypeAccessors$7.wordWrap.get = function ()
	{
	    return this._wordWrap;
	};
	prototypeAccessors$7.wordWrap.set = function (wordWrap) // eslint-disable-line require-jsdoc
	{
	    if (this._wordWrap !== wordWrap)
	    {
	        this._wordWrap = wordWrap;
	        this.styleID++;
	    }
	};

	/**
	 * The width at which text will wrap, it needs wordWrap to be set to true
	 *
	 * @member {number}
	 */
	prototypeAccessors$7.wordWrapWidth.get = function ()
	{
	    return this._wordWrapWidth;
	};
	prototypeAccessors$7.wordWrapWidth.set = function (wordWrapWidth) // eslint-disable-line require-jsdoc
	{
	    if (this._wordWrapWidth !== wordWrapWidth)
	    {
	        this._wordWrapWidth = wordWrapWidth;
	        this.styleID++;
	    }
	};

	/**
	 * Generates a font style string to use for `TextMetrics.measureFont()`.
	 *
	 * @return {string} Font style string, for passing to `TextMetrics.measureFont()`
	 */
	TextStyle.prototype.toFontString = function toFontString ()
	{
	    // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
	    var fontSizeString = (typeof this.fontSize === 'number') ? ((this.fontSize) + "px") : this.fontSize;

	    // Clean-up fontFamily property by quoting each font name
	    // this will support font names with spaces
	    var fontFamilies = this.fontFamily;

	    if (!Array.isArray(this.fontFamily))
	    {
	        fontFamilies = this.fontFamily.split(',');
	    }

	    for (var i = fontFamilies.length - 1; i >= 0; i--)
	    {
	        // Trim any extra white-space
	        var fontFamily = fontFamilies[i].trim();

	        // Check if font already contains strings
	        if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)
	        {
	            fontFamily = "\"" + fontFamily + "\"";
	        }
	        fontFamilies[i] = fontFamily;
	    }

	    return ((this.fontStyle) + " " + (this.fontVariant) + " " + (this.fontWeight) + " " + fontSizeString + " " + (fontFamilies.join(',')));
	};

	Object.defineProperties( TextStyle.prototype, prototypeAccessors$7 );

	/**
	 * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.
	 * @private
	 * @param {number|number[]} color
	 * @return {string} The color as a string.
	 */
	function getSingleColor(color)
	{
	    if (typeof color === 'number')
	    {
	        return hex2string(color);
	    }
	    else if ( typeof color === 'string' )
	    {
	        if ( color.indexOf('0x') === 0 )
	        {
	            color = color.replace('0x', '#');
	        }
	    }

	    return color;
	}

	/**
	 * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.
	 * This version can also convert array of colors
	 * @private
	 * @param {number|number[]} color
	 * @return {string} The color as a string.
	 */
	function getColor(color)
	{
	    if (!Array.isArray(color))
	    {
	        return getSingleColor(color);
	    }
	    else
	    {
	        for (var i = 0; i < color.length; ++i)
	        {
	            color[i] = getSingleColor(color[i]);
	        }

	        return color;
	    }
	}

	/**
	 * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.
	 * This version can also convert array of colors
	 * @private
	 * @param {Array} array1 First array to compare
	 * @param {Array} array2 Second array to compare
	 * @return {boolean} Do the arrays contain the same values in the same order
	 */
	function areArraysEqual(array1, array2)
	{
	    if (!Array.isArray(array1) || !Array.isArray(array2))
	    {
	        return false;
	    }

	    if (array1.length !== array2.length)
	    {
	        return false;
	    }

	    for (var i = 0; i < array1.length; ++i)
	    {
	        if (array1[i] !== array2[i])
	        {
	            return false;
	        }
	    }

	    return true;
	}

	/**
	 * Utility function to ensure that object properties are copied by value, and not by reference
	 * @private
	 * @param {Object} target Target object to copy properties into
	 * @param {Object} source Source object for the properties to copy
	 * @param {string} propertyObj Object containing properties names we want to loop over
	 */
	function deepCopyProperties(target, source, propertyObj) {
	    for (var prop in propertyObj) {
	        if (Array.isArray(source[prop])) {
	            target[prop] = source[prop].slice();
	        } else {
	            target[prop] = source[prop];
	        }
	    }
	}

	/**
	 * The TextMetrics object represents the measurement of a block of text with a specified style.
	 *
	 * ```js
	 * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})
	 * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)
	 * ```
	 *
	 * @class
	 * @memberof PIXI
	 */
	var TextMetrics = function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties)
	{
	    /**
	     * The text that was measured
	     *
	     * @member {string}
	     */
	    this.text = text;

	    /**
	     * The style that was measured
	     *
	     * @member {PIXI.TextStyle}
	     */
	    this.style = style;

	    /**
	     * The measured width of the text
	     *
	     * @member {number}
	     */
	    this.width = width;

	    /**
	     * The measured height of the text
	     *
	     * @member {number}
	     */
	    this.height = height;

	    /**
	     * An array of lines of the text broken by new lines and wrapping is specified in style
	     *
	     * @member {string[]}
	     */
	    this.lines = lines;

	    /**
	     * An array of the line widths for each line matched to `lines`
	     *
	     * @member {number[]}
	     */
	    this.lineWidths = lineWidths;

	    /**
	     * The measured line height for this style
	     *
	     * @member {number}
	     */
	    this.lineHeight = lineHeight;

	    /**
	     * The maximum line width for all measured lines
	     *
	     * @member {number}
	     */
	    this.maxLineWidth = maxLineWidth;

	    /**
	     * The font properties object from TextMetrics.measureFont
	     *
	     * @member {PIXI.IFontMetrics}
	     */
	    this.fontProperties = fontProperties;
	};

	/**
	 * Measures the supplied string of text and returns a Rectangle.
	 *
	 * @param {string} text - the text to measure.
	 * @param {PIXI.TextStyle} style - the text style to use for measuring
	 * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.
	 * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.
	 * @return {PIXI.TextMetrics} measured width and height of the text.
	 */
	TextMetrics.measureText = function measureText (text, style, wordWrap, canvas)
	{
	        if ( canvas === void 0 ) { canvas = TextMetrics._canvas; }

	    wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;
	    var font = style.toFontString();
	    var fontProperties = TextMetrics.measureFont(font);

	    // fallback in case UA disallow canvas data extraction
	    // (toDataURI, getImageData functions)
	    if (fontProperties.fontSize === 0)
	    {
	        fontProperties.fontSize = style.fontSize;
	        fontProperties.ascent = style.fontSize;
	    }

	    var context = canvas.getContext('2d');

	    context.font = font;

	    var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;
	    var lines = outputText.split(/(?:\r\n|\r|\n)/);
	    var lineWidths = new Array(lines.length);
	    var maxLineWidth = 0;

	    for (var i = 0; i < lines.length; i++)
	    {
	        var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);

	        lineWidths[i] = lineWidth;
	        maxLineWidth = Math.max(maxLineWidth, lineWidth);
	    }
	    var width = maxLineWidth + style.strokeThickness;

	    if (style.dropShadow)
	    {
	        width += style.dropShadowDistance;
	    }

	    var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;
	    var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)
	        + ((lines.length - 1) * (lineHeight + style.leading));

	    if (style.dropShadow)
	    {
	        height += style.dropShadowDistance;
	    }

	    return new TextMetrics(
	        text,
	        style,
	        width,
	        height,
	        lines,
	        lineWidths,
	        lineHeight + style.leading,
	        maxLineWidth,
	        fontProperties
	    );
	};

	/**
	 * Applies newlines to a string to have it optimally fit into the horizontal
	 * bounds set by the Text object's wordWrapWidth property.
	 *
	 * @private
	 * @param {string} text - String to apply word wrapping to
	 * @param {PIXI.TextStyle} style - the style to use when wrapping
	 * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.
	 * @return {string} New string with new lines applied where required
	 */
	TextMetrics.wordWrap = function wordWrap (text, style, canvas)
	{
	        if ( canvas === void 0 ) { canvas = TextMetrics._canvas; }

	    var context = canvas.getContext('2d');

	    var width = 0;
	    var line = '';
	    var lines = '';

	    var cache = {};
	    var letterSpacing = style.letterSpacing;
	        var whiteSpace = style.whiteSpace;

	    // How to handle whitespaces
	    var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);
	    var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);

	    // whether or not spaces may be added to the beginning of lines
	    var canPrependSpaces = !collapseSpaces;

	    // There is letterSpacing after every char except the last one
	    // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!
	    // so for convenience the above needs to be compared to width + 1 extra letterSpace
	    // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_
	    // ________________________________________________
	    // And then the final space is simply no appended to each line
	    var wordWrapWidth = style.wordWrapWidth + letterSpacing;

	    // break text into words, spaces and newline chars
	    var tokens = TextMetrics.tokenize(text);

	    for (var i = 0; i < tokens.length; i++)
	    {
	        // get the word, space or newlineChar
	        var token = tokens[i];

	        // if word is a new line
	        if (TextMetrics.isNewline(token))
	        {
	            // keep the new line
	            if (!collapseNewlines)
	            {
	                lines += TextMetrics.addLine(line);
	                canPrependSpaces = !collapseSpaces;
	                line = '';
	                width = 0;
	                continue;
	            }

	            // if we should collapse new lines
	            // we simply convert it into a space
	            token = ' ';
	        }

	        // if we should collapse repeated whitespaces
	        if (collapseSpaces)
	        {
	            // check both this and the last tokens for spaces
	            var currIsBreakingSpace = TextMetrics.isBreakingSpace(token);
	            var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);

	            if (currIsBreakingSpace && lastIsBreakingSpace)
	            {
	                continue;
	            }
	        }

	        // get word width from cache if possible
	        var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);

	        // word is longer than desired bounds
	        if (tokenWidth > wordWrapWidth)
	        {
	            // if we are not already at the beginning of a line
	            if (line !== '')
	            {
	                // start newlines for overflow words
	                lines += TextMetrics.addLine(line);
	                line = '';
	                width = 0;
	            }

	            // break large word over multiple lines
	            if (TextMetrics.canBreakWords(token, style.breakWords))
	            {
	                // break word into characters
	                var characters = token.split('');

	                // loop the characters
	                for (var j = 0; j < characters.length; j++)
	                {
	                    var char = characters[j];

	                    var k = 1;
	                    // we are not at the end of the token

	                    while (characters[j + k])
	                    {
	                        var nextChar = characters[j + k];
	                        var lastChar = char[char.length - 1];

	                        // should not split chars
	                        if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))
	                        {
	                            // combine chars & move forward one
	                            char += nextChar;
	                        }
	                        else
	                        {
	                            break;
	                        }

	                        k++;
	                    }

	                    j += char.length - 1;

	                    var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);

	                    if (characterWidth + width > wordWrapWidth)
	                    {
	                        lines += TextMetrics.addLine(line);
	                        canPrependSpaces = false;
	                        line = '';
	                        width = 0;
	                    }

	                    line += char;
	                    width += characterWidth;
	                }
	            }

	            // run word out of the bounds
	            else
	            {
	                // if there are words in this line already
	                // finish that line and start a new one
	                if (line.length > 0)
	                {
	                    lines += TextMetrics.addLine(line);
	                    line = '';
	                    width = 0;
	                }

	                var isLastToken = i === tokens.length - 1;

	                // give it its own line if it's not the end
	                lines += TextMetrics.addLine(token, !isLastToken);
	                canPrependSpaces = false;
	                line = '';
	                width = 0;
	            }
	        }

	        // word could fit
	        else
	        {
	            // word won't fit because of existing words
	            // start a new line
	            if (tokenWidth + width > wordWrapWidth)
	            {
	                // if its a space we don't want it
	                canPrependSpaces = false;

	                // add a new line
	                lines += TextMetrics.addLine(line);

	                // start a new line
	                line = '';
	                width = 0;
	            }

	            // don't add spaces to the beginning of lines
	            if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)
	            {
	                // add the word to the current line
	                line += token;

	                // update width counter
	                width += tokenWidth;
	            }
	        }
	    }

	    lines += TextMetrics.addLine(line, false);

	    return lines;
	};

	/**
	 * Convienience function for logging each line added during the wordWrap
	 * method
	 *
	 * @private
	 * @param  {string}   line    - The line of text to add
	 * @param  {boolean}  newLine - Add new line character to end
	 * @return {string}   A formatted line
	 */
	TextMetrics.addLine = function addLine (line, newLine)
	{
	        if ( newLine === void 0 ) { newLine = true; }

	    line = TextMetrics.trimRight(line);

	    line = (newLine) ? (line + "\n") : line;

	    return line;
	};

	/**
	 * Gets & sets the widths of calculated characters in a cache object
	 *
	 * @private
	 * @param  {string}                key        The key
	 * @param  {number}                letterSpacing  The letter spacing
	 * @param  {object}                cache      The cache
	 * @param  {CanvasRenderingContext2D}  context    The canvas context
	 * @return {number}                The from cache.
	 */
	TextMetrics.getFromCache = function getFromCache (key, letterSpacing, cache, context)
	{
	    var width = cache[key];

	    if (width === undefined)
	    {
	        var spacing = ((key.length) * letterSpacing);

	        width = context.measureText(key).width + spacing;
	        cache[key] = width;
	    }

	    return width;
	};

	/**
	 * Determines whether we should collapse breaking spaces
	 *
	 * @private
	 * @param  {string}   whiteSpace  The TextStyle property whiteSpace
	 * @return {boolean}  should collapse
	 */
	TextMetrics.collapseSpaces = function collapseSpaces (whiteSpace)
	{
	    return (whiteSpace === 'normal' || whiteSpace === 'pre-line');
	};

	/**
	 * Determines whether we should collapse newLine chars
	 *
	 * @private
	 * @param  {string}   whiteSpace  The white space
	 * @return {boolean}  should collapse
	 */
	TextMetrics.collapseNewlines = function collapseNewlines (whiteSpace)
	{
	    return (whiteSpace === 'normal');
	};

	/**
	 * trims breaking whitespaces from string
	 *
	 * @private
	 * @param  {string}  text  The text
	 * @return {string}  trimmed string
	 */
	TextMetrics.trimRight = function trimRight (text)
	{
	    if (typeof text !== 'string')
	    {
	        return '';
	    }

	    for (var i = text.length - 1; i >= 0; i--)
	    {
	        var char = text[i];

	        if (!TextMetrics.isBreakingSpace(char))
	        {
	            break;
	        }

	        text = text.slice(0, -1);
	    }

	    return text;
	};

	/**
	 * Determines if char is a newline.
	 *
	 * @private
	 * @param  {string}  char  The character
	 * @return {boolean}  True if newline, False otherwise.
	 */
	TextMetrics.isNewline = function isNewline (char)
	{
	    if (typeof char !== 'string')
	    {
	        return false;
	    }

	    return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);
	};

	/**
	 * Determines if char is a breaking whitespace.
	 *
	 * @private
	 * @param  {string}  char  The character
	 * @return {boolean}  True if whitespace, False otherwise.
	 */
	TextMetrics.isBreakingSpace = function isBreakingSpace (char)
	{
	    if (typeof char !== 'string')
	    {
	        return false;
	    }

	    return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);
	};

	/**
	 * Splits a string into words, breaking-spaces and newLine characters
	 *
	 * @private
	 * @param  {string}  text   The text
	 * @return {string[]}  A tokenized array
	 */
	TextMetrics.tokenize = function tokenize (text)
	{
	    var tokens = [];
	    var token = '';

	    if (typeof text !== 'string')
	    {
	        return tokens;
	    }

	    for (var i = 0; i < text.length; i++)
	    {
	        var char = text[i];

	        if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))
	        {
	            if (token !== '')
	            {
	                tokens.push(token);
	                token = '';
	            }

	            tokens.push(char);

	            continue;
	        }

	        token += char;
	    }

	    if (token !== '')
	    {
	        tokens.push(token);
	    }

	    return tokens;
	};

	/**
	 * This method exists to be easily overridden
	 * It allows one to customise which words should break
	 * Examples are if the token is CJK or numbers.
	 * It must return a boolean.
	 *
	 * @private
	 * @param  {string}  token   The token
	 * @param  {boolean}  breakWords  The style attr break words
	 * @return {boolean} whether to break word or not
	 */
	TextMetrics.canBreakWords = function canBreakWords (token, breakWords)
	{
	    return breakWords;
	};

	/**
	 * This method exists to be easily overridden
	 * It allows one to determine whether a pair of characters
	 * should be broken by newlines
	 * For example certain characters in CJK langs or numbers.
	 * It must return a boolean.
	 *
	 * @private
	 * @param  {string}  char  The character
	 * @param  {string}  nextChar  The next character
	 * @param  {string}  token The token/word the characters are from
	 * @param  {number}  index The index in the token of the char
	 * @param  {boolean}  breakWords  The style attr break words
	 * @return {boolean} whether to break word or not
	 */
	TextMetrics.canBreakChars = function canBreakChars (char, nextChar, token, index, breakWords) // eslint-disable-line no-unused-vars
	{
	    return true;
	};

	/**
	 * Calculates the ascent, descent and fontSize of a given font-style
	 *
	 * @static
	 * @param {string} font - String representing the style of the font
	 * @return {PIXI.IFontMetrics} Font properties object
	 */
	TextMetrics.measureFont = function measureFont (font)
	{
	    // as this method is used for preparing assets, don't recalculate things if we don't need to
	    if (TextMetrics._fonts[font])
	    {
	        return TextMetrics._fonts[font];
	    }

	    var properties = {};

	    var canvas = TextMetrics._canvas;
	    var context = TextMetrics._context;

	    context.font = font;

	    var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;
	    var width = Math.ceil(context.measureText(metricsString).width);
	    var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);
	    var height = 2 * baseline;

	    baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;

	    canvas.width = width;
	    canvas.height = height;

	    context.fillStyle = '#f00';
	    context.fillRect(0, 0, width, height);

	    context.font = font;

	    context.textBaseline = 'alphabetic';
	    context.fillStyle = '#000';
	    context.fillText(metricsString, 0, baseline);

	    var imagedata = context.getImageData(0, 0, width, height).data;
	    var pixels = imagedata.length;
	    var line = width * 4;

	    var i = 0;
	    var idx = 0;
	    var stop = false;

	    // ascent. scan from top to bottom until we find a non red pixel
	    for (i = 0; i < baseline; ++i)
	    {
	        for (var j = 0; j < line; j += 4)
	        {
	            if (imagedata[idx + j] !== 255)
	            {
	                stop = true;
	                break;
	            }
	        }
	        if (!stop)
	        {
	            idx += line;
	        }
	        else
	        {
	            break;
	        }
	    }

	    properties.ascent = baseline - i;

	    idx = pixels - line;
	    stop = false;

	    // descent. scan from bottom to top until we find a non red pixel
	    for (i = height; i > baseline; --i)
	    {
	        for (var j$1 = 0; j$1 < line; j$1 += 4)
	        {
	            if (imagedata[idx + j$1] !== 255)
	            {
	                stop = true;
	                break;
	            }
	        }

	        if (!stop)
	        {
	            idx -= line;
	        }
	        else
	        {
	            break;
	        }
	    }

	    properties.descent = i - baseline;
	    properties.fontSize = properties.ascent + properties.descent;

	    TextMetrics._fonts[font] = properties;

	    return properties;
	};

	/**
	 * Clear font metrics in metrics cache.
	 *
	 * @static
	 * @param {string} [font] - font name. If font name not set then clear cache for all fonts.
	 */
	TextMetrics.clearMetrics = function clearMetrics (font)
	{
	        if ( font === void 0 ) { font = ''; }

	    if (font)
	    {
	        delete TextMetrics._fonts[font];
	    }
	    else
	    {
	        TextMetrics._fonts = {};
	    }
	};

	/**
	 * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.
	 *
	 * @typedef {object} FontMetrics
	 * @property {number} ascent - The ascent distance
	 * @property {number} descent - The descent distance
	 * @property {number} fontSize - Font size from ascent to descent
	 * @memberof PIXI.TextMetrics
	 * @private
	 */

	var canvas = (function () {
	    try
	    {
	        // OffscreenCanvas2D measureText can be up to 40% faster.
	        var c = new OffscreenCanvas(0, 0);

	        return c.getContext('2d') ? c : document.createElement('canvas');
	    }
	    catch (ex)
	    {
	        return document.createElement('canvas');
	    }
	})();

	canvas.width = canvas.height = 10;

	/**
	 * Cached canvas element for measuring text
	 *
	 * @memberof PIXI.TextMetrics
	 * @type {HTMLCanvasElement}
	 * @private
	 */
	TextMetrics._canvas = canvas;

	/**
	 * Cache for context to use.
	 *
	 * @memberof PIXI.TextMetrics
	 * @type {CanvasRenderingContext2D}
	 * @private
	 */
	TextMetrics._context = canvas.getContext('2d');

	/**
	 * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.
	 *
	 * @memberof PIXI.TextMetrics
	 * @type {Object}
	 * @private
	 */
	TextMetrics._fonts = {};

	/**
	 * String used for calculate font metrics.
	 * These characters are all tall to help calculate the height required for text.
	 *
	 * @static
	 * @memberof PIXI.TextMetrics
	 * @name METRICS_STRING
	 * @type {string}
	 * @default |ÉqÅ
	 */
	TextMetrics.METRICS_STRING = '|ÉqÅ';

	/**
	 * Baseline symbol for calculate font metrics.
	 *
	 * @static
	 * @memberof PIXI.TextMetrics
	 * @name BASELINE_SYMBOL
	 * @type {string}
	 * @default M
	 */
	TextMetrics.BASELINE_SYMBOL = 'M';

	/**
	 * Baseline multiplier for calculate font metrics.
	 *
	 * @static
	 * @memberof PIXI.TextMetrics
	 * @name BASELINE_MULTIPLIER
	 * @type {number}
	 * @default 1.4
	 */
	TextMetrics.BASELINE_MULTIPLIER = 1.4;

	/**
	 * Cache of new line chars.
	 *
	 * @memberof PIXI.TextMetrics
	 * @type {number[]}
	 * @private
	 */
	TextMetrics._newlines = [
	    0x000A, // line feed
	    0x000D ];

	/**
	 * Cache of breaking spaces.
	 *
	 * @memberof PIXI.TextMetrics
	 * @type {number[]}
	 * @private
	 */
	TextMetrics._breakingSpaces = [
	    0x0009, // character tabulation
	    0x0020, // space
	    0x2000, // en quad
	    0x2001, // em quad
	    0x2002, // en space
	    0x2003, // em space
	    0x2004, // three-per-em space
	    0x2005, // four-per-em space
	    0x2006, // six-per-em space
	    0x2008, // punctuation space
	    0x2009, // thin space
	    0x200A, // hair space
	    0x205F, // medium mathematical space
	    0x3000 ];

	/**
	 * A number, or a string containing a number.
	 *
	 * @memberof PIXI
	 * @typedef IFontMetrics
	 * @property {number} ascent - Font ascent
	 * @property {number} descent - Font descent
	 * @property {number} fontSize - Font size
	 */

	/* eslint max-depth: [2, 8] */

	var defaultDestroyOptions = {
	    texture: true,
	    children: false,
	    baseTexture: true,
	};

	/**
	 * A Text Object will create a line or multiple lines of text.
	 *
	 * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).
	 *
	 * The primary advantage of this class over BitmapText is that you have great control over the style of the next,
	 * which you can change at runtime.
	 *
	 * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.
	 * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.
	 *
	 * To split a line you can use '\n' in your text string, or, on the `style` object,
	 * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.
	 *
	 * A Text can be created directly from a string and a style object,
	 * which can be generated [here](https://pixijs.io/pixi-text-style).
	 *
	 * ```js
	 * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});
	 * ```
	 *
	 * @class
	 * @extends PIXI.Sprite
	 * @memberof PIXI
	 */
	var Text = /*@__PURE__*/(function (Sprite) {
	    function Text(text, style, canvas)
	    {
	        canvas = canvas || document.createElement('canvas');

	        canvas.width = 3;
	        canvas.height = 3;

	        var texture = Texture.from(canvas);

	        texture.orig = new Rectangle();
	        texture.trim = new Rectangle();

	        Sprite.call(this, texture);

	        /**
	         * The canvas element that everything is drawn to
	         *
	         * @member {HTMLCanvasElement}
	         */
	        this.canvas = canvas;

	        /**
	         * The canvas 2d context that everything is drawn with
	         * @member {CanvasRenderingContext2D}
	         */
	        this.context = this.canvas.getContext('2d');

	        /**
	         * The resolution / device pixel ratio of the canvas.
	         * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
	         * @member {number}
	         * @default 1
	         */
	        this._resolution = settings.RESOLUTION;
	        this._autoResolution = true;

	        /**
	         * Private tracker for the current text.
	         *
	         * @member {string}
	         * @private
	         */
	        this._text = null;

	        /**
	         * Private tracker for the current style.
	         *
	         * @member {object}
	         * @private
	         */
	        this._style = null;
	        /**
	         * Private listener to track style changes.
	         *
	         * @member {Function}
	         * @private
	         */
	        this._styleListener = null;

	        /**
	         * Private tracker for the current font.
	         *
	         * @member {string}
	         * @private
	         */
	        this._font = '';

	        this.text = text;
	        this.style = style;

	        this.localStyleID = -1;
	    }

	    if ( Sprite ) { Text.__proto__ = Sprite; }
	    Text.prototype = Object.create( Sprite && Sprite.prototype );
	    Text.prototype.constructor = Text;

	    var prototypeAccessors = { width: { configurable: true },height: { configurable: true },style: { configurable: true },text: { configurable: true },resolution: { configurable: true } };

	    /**
	     * Renders text and updates it when needed.
	     *
	     * @private
	     * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.
	     */
	    Text.prototype.updateText = function updateText (respectDirty)
	    {
	        var style = this._style;

	        // check if style has changed..
	        if (this.localStyleID !== style.styleID)
	        {
	            this.dirty = true;
	            this.localStyleID = style.styleID;
	        }

	        if (!this.dirty && respectDirty)
	        {
	            return;
	        }

	        this._font = this._style.toFontString();

	        var context = this.context;
	        var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);
	        var width = measured.width;
	        var height = measured.height;
	        var lines = measured.lines;
	        var lineHeight = measured.lineHeight;
	        var lineWidths = measured.lineWidths;
	        var maxLineWidth = measured.maxLineWidth;
	        var fontProperties = measured.fontProperties;

	        this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);
	        this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);

	        context.scale(this._resolution, this._resolution);

	        context.clearRect(0, 0, this.canvas.width, this.canvas.height);

	        context.font = this._font;
	        context.lineWidth = style.strokeThickness;
	        context.textBaseline = style.textBaseline;
	        context.lineJoin = style.lineJoin;
	        context.miterLimit = style.miterLimit;

	        var linePositionX;
	        var linePositionY;

	        // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text
	        var passesCount = style.dropShadow ? 2 : 1;

	        // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,
	        // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.
	        //
	        // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more
	        // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill
	        // and the stroke; and fill drop shadows would appear over the top of the stroke.
	        //
	        // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal
	        // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the
	        // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow
	        // beneath the text, whilst also having the proper text shadow styling.
	        for (var i = 0; i < passesCount; ++i)
	        {
	            var isShadowPass = style.dropShadow && i === 0;
	            var dsOffsetText = isShadowPass ? height * 2 : 0; // we only want the drop shadow, so put text way off-screen
	            var dsOffsetShadow = dsOffsetText * this.resolution;

	            if (isShadowPass)
	            {
	                // On Safari, text with gradient and drop shadows together do not position correctly
	                // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689
	                // Therefore we'll set the styles to be a plain black whilst generating this drop shadow
	                context.fillStyle = 'black';
	                context.strokeStyle = 'black';

	                var dropShadowColor = style.dropShadowColor;
	                var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));

	                context.shadowColor = "rgba(" + (rgb[0] * 255) + "," + (rgb[1] * 255) + "," + (rgb[2] * 255) + "," + (style.dropShadowAlpha) + ")";
	                context.shadowBlur = style.dropShadowBlur;
	                context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;
	                context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;
	            }
	            else
	            {
	                // set canvas text styles
	                context.fillStyle = this._generateFillStyle(style, lines);
	                context.strokeStyle = style.stroke;

	                context.shadowColor = 0;
	                context.shadowBlur = 0;
	                context.shadowOffsetX = 0;
	                context.shadowOffsetY = 0;
	            }

	            // draw lines line by line
	            for (var i$1 = 0; i$1 < lines.length; i$1++)
	            {
	                linePositionX = style.strokeThickness / 2;
	                linePositionY = ((style.strokeThickness / 2) + (i$1 * lineHeight)) + fontProperties.ascent;

	                if (style.align === 'right')
	                {
	                    linePositionX += maxLineWidth - lineWidths[i$1];
	                }
	                else if (style.align === 'center')
	                {
	                    linePositionX += (maxLineWidth - lineWidths[i$1]) / 2;
	                }

	                if (style.stroke && style.strokeThickness)
	                {
	                    this.drawLetterSpacing(
	                        lines[i$1],
	                        linePositionX + style.padding,
	                        linePositionY + style.padding - dsOffsetText,
	                        true
	                    );
	                }

	                if (style.fill)
	                {
	                    this.drawLetterSpacing(
	                        lines[i$1],
	                        linePositionX + style.padding,
	                        linePositionY + style.padding - dsOffsetText
	                    );
	                }
	            }
	        }

	        this.updateTexture();
	    };

	    /**
	     * Render the text with letter-spacing.
	     * @param {string} text - The text to draw
	     * @param {number} x - Horizontal position to draw the text
	     * @param {number} y - Vertical position to draw the text
	     * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the
	     *  text? If not, it's for the inside fill
	     * @private
	     */
	    Text.prototype.drawLetterSpacing = function drawLetterSpacing (text, x, y, isStroke)
	    {
	        if ( isStroke === void 0 ) { isStroke = false; }

	        var style = this._style;

	        // letterSpacing of 0 means normal
	        var letterSpacing = style.letterSpacing;

	        if (letterSpacing === 0)
	        {
	            if (isStroke)
	            {
	                this.context.strokeText(text, x, y);
	            }
	            else
	            {
	                this.context.fillText(text, x, y);
	            }

	            return;
	        }

	        var currentPosition = x;

	        // Using Array.from correctly splits characters whilst keeping emoji together.
	        // This is not supported on IE as it requires ES6, so regular text splitting occurs.
	        // This also doesn't account for emoji that are multiple emoji put together to make something else.
	        // Handling all of this would require a big library itself.
	        // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516
	        // https://github.com/orling/grapheme-splitter
	        var stringArray = Array.from ? Array.from(text) : text.split('');
	        var previousWidth = this.context.measureText(text).width;
	        var currentWidth = 0;

	        for (var i = 0; i < stringArray.length; ++i)
	        {
	            var currentChar = stringArray[i];

	            if (isStroke)
	            {
	                this.context.strokeText(currentChar, currentPosition, y);
	            }
	            else
	            {
	                this.context.fillText(currentChar, currentPosition, y);
	            }
	            currentWidth = this.context.measureText(text.substring(i + 1)).width;
	            currentPosition += previousWidth - currentWidth + letterSpacing;
	            previousWidth = currentWidth;
	        }
	    };

	    /**
	     * Updates texture size based on canvas size
	     *
	     * @private
	     */
	    Text.prototype.updateTexture = function updateTexture ()
	    {
	        var canvas = this.canvas;

	        if (this._style.trim)
	        {
	            var trimmed = trimCanvas(canvas);

	            if (trimmed.data)
	            {
	                canvas.width = trimmed.width;
	                canvas.height = trimmed.height;
	                this.context.putImageData(trimmed.data, 0, 0);
	            }
	        }

	        var texture = this._texture;
	        var style = this._style;
	        var padding = style.trim ? 0 : style.padding;
	        var baseTexture = texture.baseTexture;

	        texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);
	        texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);
	        texture.trim.x = -padding;
	        texture.trim.y = -padding;

	        texture.orig.width = texture._frame.width - (padding * 2);
	        texture.orig.height = texture._frame.height - (padding * 2);

	        // call sprite onTextureUpdate to update scale if _width or _height were set
	        this._onTextureUpdate();

	        baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);

	        this.dirty = false;
	    };

	    /**
	     * Renders the object using the WebGL renderer
	     *
	     * @private
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    Text.prototype._render = function _render (renderer)
	    {
	        if (this._autoResolution && this._resolution !== renderer.resolution)
	        {
	            this._resolution = renderer.resolution;
	            this.dirty = true;
	        }

	        this.updateText(true);

	        Sprite.prototype._render.call(this, renderer);
	    };

	    /**
	     * Gets the local bounds of the text object.
	     *
	     * @param {PIXI.Rectangle} rect - The output rectangle.
	     * @return {PIXI.Rectangle} The bounds.
	     */
	    Text.prototype.getLocalBounds = function getLocalBounds (rect)
	    {
	        this.updateText(true);

	        return Sprite.prototype.getLocalBounds.call(this, rect);
	    };

	    /**
	     * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.
	     * @protected
	     */
	    Text.prototype._calculateBounds = function _calculateBounds ()
	    {
	        this.updateText(true);
	        this.calculateVertices();
	        // if we have already done this on THIS frame.
	        this._bounds.addQuad(this.vertexData);
	    };

	    /**
	     * Method to be called upon a TextStyle change.
	     * @private
	     */
	    Text.prototype._onStyleChange = function _onStyleChange ()
	    {
	        this.dirty = true;
	    };

	    /**
	     * Generates the fill style. Can automatically generate a gradient based on the fill style being an array
	     *
	     * @private
	     * @param {object} style - The style.
	     * @param {string[]} lines - The lines of text.
	     * @return {string|number|CanvasGradient} The fill style
	     */
	    Text.prototype._generateFillStyle = function _generateFillStyle (style, lines)
	    {
	        if (!Array.isArray(style.fill))
	        {
	            return style.fill;
	        }
	        else if (style.fill.length === 1)
	        {
	            return style.fill[0];
	        }

	        // the gradient will be evenly spaced out according to how large the array is.
	        // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75
	        var gradient;
	        var totalIterations;
	        var currentIteration;
	        var stop;

	        var width = Math.ceil(this.canvas.width / this._resolution);
	        var height = Math.ceil(this.canvas.height / this._resolution);

	        // make a copy of the style settings, so we can manipulate them later
	        var fill = style.fill.slice();
	        var fillGradientStops = style.fillGradientStops.slice();

	        // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75
	        if (!fillGradientStops.length)
	        {
	            var lengthPlus1 = fill.length + 1;

	            for (var i = 1; i < lengthPlus1; ++i)
	            {
	                fillGradientStops.push(i / lengthPlus1);
	            }
	        }

	        // stop the bleeding of the last gradient on the line above to the top gradient of the this line
	        // by hard defining the first gradient colour at point 0, and last gradient colour at point 1
	        fill.unshift(style.fill[0]);
	        fillGradientStops.unshift(0);

	        fill.push(style.fill[style.fill.length - 1]);
	        fillGradientStops.push(1);

	        if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)
	        {
	            // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas
	            gradient = this.context.createLinearGradient(width / 2, 0, width / 2, height);

	            // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect
	            // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875
	            totalIterations = (fill.length + 1) * lines.length;
	            currentIteration = 0;
	            for (var i$1 = 0; i$1 < lines.length; i$1++)
	            {
	                currentIteration += 1;
	                for (var j = 0; j < fill.length; j++)
	                {
	                    if (typeof fillGradientStops[j] === 'number')
	                    {
	                        stop = (fillGradientStops[j] / lines.length) + (i$1 / lines.length);
	                    }
	                    else
	                    {
	                        stop = currentIteration / totalIterations;
	                    }
	                    gradient.addColorStop(stop, fill[j]);
	                    currentIteration++;
	                }
	            }
	        }
	        else
	        {
	            // start the gradient at the center left of the canvas, and end at the center right of the canvas
	            gradient = this.context.createLinearGradient(0, height / 2, width, height / 2);

	            // can just evenly space out the gradients in this case, as multiple lines makes no difference
	            // to an even left to right gradient
	            totalIterations = fill.length + 1;
	            currentIteration = 1;

	            for (var i$2 = 0; i$2 < fill.length; i$2++)
	            {
	                if (typeof fillGradientStops[i$2] === 'number')
	                {
	                    stop = fillGradientStops[i$2];
	                }
	                else
	                {
	                    stop = currentIteration / totalIterations;
	                }
	                gradient.addColorStop(stop, fill[i$2]);
	                currentIteration++;
	            }
	        }

	        return gradient;
	    };

	    /**
	     * Destroys this text object.
	     * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as
	     * the majority of the time the texture will not be shared with any other Sprites.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have their
	     *  destroy method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well
	     * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well
	     */
	    Text.prototype.destroy = function destroy (options)
	    {
	        if (typeof options === 'boolean')
	        {
	            options = { children: options };
	        }

	        options = Object.assign({}, defaultDestroyOptions, options);

	        Sprite.prototype.destroy.call(this, options);

	        // make sure to reset the the context and canvas.. dont want this hanging around in memory!
	        this.context = null;
	        this.canvas = null;

	        this._style = null;
	    };

	    /**
	     * The width of the Text, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        this.updateText(true);

	        return Math.abs(this.scale.x) * this._texture.orig.width;
	    };

	    prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.updateText(true);

	        var s = sign$1(this.scale.x) || 1;

	        this.scale.x = s * value / this._texture.orig.width;
	        this._width = value;
	    };

	    /**
	     * The height of the Text, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        this.updateText(true);

	        return Math.abs(this.scale.y) * this._texture.orig.height;
	    };

	    prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.updateText(true);

	        var s = sign$1(this.scale.y) || 1;

	        this.scale.y = s * value / this._texture.orig.height;
	        this._height = value;
	    };

	    /**
	     * Set the style of the text. Set up an event listener to listen for changes on the style
	     * object and mark the text as dirty.
	     *
	     * @member {object|PIXI.TextStyle}
	     */
	    prototypeAccessors.style.get = function ()
	    {
	        return this._style;
	    };

	    prototypeAccessors.style.set = function (style) // eslint-disable-line require-jsdoc
	    {
	        style = style || {};

	        if (style instanceof TextStyle)
	        {
	            this._style = style;
	        }
	        else
	        {
	            this._style = new TextStyle(style);
	        }

	        this.localStyleID = -1;
	        this.dirty = true;
	    };

	    /**
	     * Set the copy for the text object. To split a line you can use '\n'.
	     *
	     * @member {string}
	     */
	    prototypeAccessors.text.get = function ()
	    {
	        return this._text;
	    };

	    prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc
	    {
	        text = String(text === null || text === undefined ? '' : text);

	        if (this._text === text)
	        {
	            return;
	        }
	        this._text = text;
	        this.dirty = true;
	    };

	    /**
	     * The resolution / device pixel ratio of the canvas.
	     * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
	     * @member {number}
	     * @default 1
	     */
	    prototypeAccessors.resolution.get = function ()
	    {
	        return this._resolution;
	    };

	    prototypeAccessors.resolution.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._autoResolution = false;

	        if (this._resolution === value)
	        {
	            return;
	        }

	        this._resolution = value;
	        this.dirty = true;
	    };

	    Object.defineProperties( Text.prototype, prototypeAccessors );

	    return Text;
	}(Sprite));

	/*!
	 * @pixi/prepare - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/prepare is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Default number of uploads per frame using prepare plugin.
	 *
	 * @static
	 * @memberof PIXI.settings
	 * @name UPLOADS_PER_FRAME
	 * @type {number}
	 * @default 4
	 */
	settings.UPLOADS_PER_FRAME = 4;

	/**
	 * CountLimiter limits the number of items handled by a {@link PIXI.prepare.BasePrepare} to a specified
	 * number of items per frame.
	 *
	 * @class
	 * @memberof PIXI.prepare
	 */
	var CountLimiter = function CountLimiter(maxItemsPerFrame)
	{
	    /**
	     * The maximum number of items that can be prepared each frame.
	     * @type {number}
	     * @private
	     */
	    this.maxItemsPerFrame = maxItemsPerFrame;
	    /**
	     * The number of items that can be prepared in the current frame.
	     * @type {number}
	     * @private
	     */
	    this.itemsLeft = 0;
	};

	/**
	 * Resets any counting properties to start fresh on a new frame.
	 */
	CountLimiter.prototype.beginFrame = function beginFrame ()
	{
	    this.itemsLeft = this.maxItemsPerFrame;
	};

	/**
	 * Checks to see if another item can be uploaded. This should only be called once per item.
	 * @return {boolean} If the item is allowed to be uploaded.
	 */
	CountLimiter.prototype.allowedToUpload = function allowedToUpload ()
	{
	    return this.itemsLeft-- > 0;
	};

	/**
	 * The prepare manager provides functionality to upload content to the GPU.
	 *
	 * BasePrepare handles basic queuing functionality and is extended by
	 * {@link PIXI.prepare.Prepare} and {@link PIXI.prepare.CanvasPrepare}
	 * to provide preparation capabilities specific to their respective renderers.
	 *
	 * @example
	 * // Create a sprite
	 * const sprite = PIXI.Sprite.from('something.png');
	 *
	 * // Load object into GPU
	 * app.renderer.plugins.prepare.upload(sprite, () => {
	 *
	 *     //Texture(s) has been uploaded to GPU
	 *     app.stage.addChild(sprite);
	 *
	 * })
	 *
	 * @abstract
	 * @class
	 * @memberof PIXI.prepare
	 */
	var BasePrepare = function BasePrepare(renderer)
	{
	    var this$1 = this;

	    /**
	     * The limiter to be used to control how quickly items are prepared.
	     * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter}
	     */
	    this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);

	    /**
	     * Reference to the renderer.
	     * @type {PIXI.AbstractRenderer}
	     * @protected
	     */
	    this.renderer = renderer;

	    /**
	     * The only real difference between CanvasPrepare and Prepare is what they pass
	     * to upload hooks. That different parameter is stored here.
	     * @type {PIXI.prepare.CanvasPrepare|PIXI.Renderer}
	     * @protected
	     */
	    this.uploadHookHelper = null;

	    /**
	     * Collection of items to uploads at once.
	     * @type {Array<*>}
	     * @private
	     */
	    this.queue = [];

	    /**
	     * Collection of additional hooks for finding assets.
	     * @type {Array<Function>}
	     * @private
	     */
	    this.addHooks = [];

	    /**
	     * Collection of additional hooks for processing assets.
	     * @type {Array<Function>}
	     * @private
	     */
	    this.uploadHooks = [];

	    /**
	     * Callback to call after completed.
	     * @type {Array<Function>}
	     * @private
	     */
	    this.completes = [];

	    /**
	     * If prepare is ticking (running).
	     * @type {boolean}
	     * @private
	     */
	    this.ticking = false;

	    /**
	     * 'bound' call for prepareItems().
	     * @type {Function}
	     * @private
	     */
	    this.delayedTick = function () {
	        // unlikely, but in case we were destroyed between tick() and delayedTick()
	        if (!this$1.queue)
	        {
	            return;
	        }
	        this$1.prepareItems();
	    };

	    // hooks to find the correct texture
	    this.registerFindHook(findText);
	    this.registerFindHook(findTextStyle);
	    this.registerFindHook(findMultipleBaseTextures);
	    this.registerFindHook(findBaseTexture);
	    this.registerFindHook(findTexture);

	    // upload hooks
	    this.registerUploadHook(drawText);
	    this.registerUploadHook(calculateTextStyle);
	};

	/**
	 * Upload all the textures and graphics to the GPU.
	 *
	 * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -
	 *    Either the container or display object to search for items to upload, the items to upload themselves,
	 *    or the callback function, if items have been added using `prepare.add`.
	 * @param {Function} [done] - Optional callback when all queued uploads have completed
	 */
	BasePrepare.prototype.upload = function upload (item, done)
	{
	    if (typeof item === 'function')
	    {
	        done = item;
	        item = null;
	    }

	    // If a display object, search for items
	    // that we could upload
	    if (item)
	    {
	        this.add(item);
	    }

	    // Get the items for upload from the display
	    if (this.queue.length)
	    {
	        if (done)
	        {
	            this.completes.push(done);
	        }

	        if (!this.ticking)
	        {
	            this.ticking = true;
	            Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);
	        }
	    }
	    else if (done)
	    {
	        done();
	    }
	};

	/**
	 * Handle tick update
	 *
	 * @private
	 */
	BasePrepare.prototype.tick = function tick ()
	{
	    setTimeout(this.delayedTick, 0);
	};

	/**
	 * Actually prepare items. This is handled outside of the tick because it will take a while
	 * and we do NOT want to block the current animation frame from rendering.
	 *
	 * @private
	 */
	BasePrepare.prototype.prepareItems = function prepareItems ()
	{
	    this.limiter.beginFrame();
	    // Upload the graphics
	    while (this.queue.length && this.limiter.allowedToUpload())
	    {
	        var item = this.queue[0];
	        var uploaded = false;

	        if (item && !item._destroyed)
	        {
	            for (var i = 0, len = this.uploadHooks.length; i < len; i++)
	            {
	                if (this.uploadHooks[i](this.uploadHookHelper, item))
	                {
	                    this.queue.shift();
	                    uploaded = true;
	                    break;
	                }
	            }
	        }

	        if (!uploaded)
	        {
	            this.queue.shift();
	        }
	    }

	    // We're finished
	    if (!this.queue.length)
	    {
	        this.ticking = false;

	        var completes = this.completes.slice(0);

	        this.completes.length = 0;

	        for (var i$1 = 0, len$1 = completes.length; i$1 < len$1; i$1++)
	        {
	            completes[i$1]();
	        }
	    }
	    else
	    {
	        // if we are not finished, on the next rAF do this again
	        Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);
	    }
	};

	/**
	 * Adds hooks for finding items.
	 *
	 * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`
	 *      function must return `true` if it was able to add item to the queue.
	 * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.
	 */
	BasePrepare.prototype.registerFindHook = function registerFindHook (addHook)
	{
	    if (addHook)
	    {
	        this.addHooks.push(addHook);
	    }

	    return this;
	};

	/**
	 * Adds hooks for uploading items.
	 *
	 * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and
	 *      function must return `true` if it was able to handle upload of item.
	 * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.
	 */
	BasePrepare.prototype.registerUploadHook = function registerUploadHook (uploadHook)
	{
	    if (uploadHook)
	    {
	        this.uploadHooks.push(uploadHook);
	    }

	    return this;
	};

	/**
	 * Manually add an item to the uploading queue.
	 *
	 * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to
	 *    add to the queue
	 * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.
	 */
	BasePrepare.prototype.add = function add (item)
	{
	    // Add additional hooks for finding elements on special
	    // types of objects that
	    for (var i = 0, len = this.addHooks.length; i < len; i++)
	    {
	        if (this.addHooks[i](item, this.queue))
	        {
	            break;
	        }
	    }

	    // Get children recursively
	    if (item instanceof Container)
	    {
	        for (var i$1 = item.children.length - 1; i$1 >= 0; i$1--)
	        {
	            this.add(item.children[i$1]);
	        }
	    }

	    return this;
	};

	/**
	 * Destroys the plugin, don't use after this.
	 *
	 */
	BasePrepare.prototype.destroy = function destroy ()
	{
	    if (this.ticking)
	    {
	        Ticker.system.remove(this.tick, this);
	    }
	    this.ticking = false;
	    this.addHooks = null;
	    this.uploadHooks = null;
	    this.renderer = null;
	    this.completes = null;
	    this.queue = null;
	    this.limiter = null;
	    this.uploadHookHelper = null;
	};

	/**
	 * Built-in hook to find multiple textures from objects like AnimatedSprites.
	 *
	 * @private
	 * @param {PIXI.DisplayObject} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.Texture object was found.
	 */
	function findMultipleBaseTextures(item, queue)
	{
	    var result = false;

	    // Objects with multiple textures
	    if (item && item._textures && item._textures.length)
	    {
	        for (var i = 0; i < item._textures.length; i++)
	        {
	            if (item._textures[i] instanceof Texture)
	            {
	                var baseTexture = item._textures[i].baseTexture;

	                if (queue.indexOf(baseTexture) === -1)
	                {
	                    queue.push(baseTexture);
	                    result = true;
	                }
	            }
	        }
	    }

	    return result;
	}

	/**
	 * Built-in hook to find BaseTextures from Sprites.
	 *
	 * @private
	 * @param {PIXI.DisplayObject} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.Texture object was found.
	 */
	function findBaseTexture(item, queue)
	{
	    // Objects with textures, like Sprites/Text
	    if (item instanceof BaseTexture)
	    {
	        if (queue.indexOf(item) === -1)
	        {
	            queue.push(item);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to find textures from objects.
	 *
	 * @private
	 * @param {PIXI.DisplayObject} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.Texture object was found.
	 */
	function findTexture(item, queue)
	{
	    if (item._texture && item._texture instanceof Texture)
	    {
	        var texture = item._texture.baseTexture;

	        if (queue.indexOf(texture) === -1)
	        {
	            queue.push(texture);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to draw PIXI.Text to its texture.
	 *
	 * @private
	 * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler
	 * @param {PIXI.DisplayObject} item - Item to check
	 * @return {boolean} If item was uploaded.
	 */
	function drawText(helper, item)
	{
	    if (item instanceof Text)
	    {
	        // updating text will return early if it is not dirty
	        item.updateText(true);

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to calculate a text style for a PIXI.Text object.
	 *
	 * @private
	 * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler
	 * @param {PIXI.DisplayObject} item - Item to check
	 * @return {boolean} If item was uploaded.
	 */
	function calculateTextStyle(helper, item)
	{
	    if (item instanceof TextStyle)
	    {
	        var font = item.toFontString();

	        TextMetrics.measureFont(font);

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to find Text objects.
	 *
	 * @private
	 * @param {PIXI.DisplayObject} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.Text object was found.
	 */
	function findText(item, queue)
	{
	    if (item instanceof Text)
	    {
	        // push the text style to prepare it - this can be really expensive
	        if (queue.indexOf(item.style) === -1)
	        {
	            queue.push(item.style);
	        }
	        // also push the text object so that we can render it (to canvas/texture) if needed
	        if (queue.indexOf(item) === -1)
	        {
	            queue.push(item);
	        }
	        // also push the Text's texture for upload to GPU
	        var texture = item._texture.baseTexture;

	        if (queue.indexOf(texture) === -1)
	        {
	            queue.push(texture);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to find TextStyle objects.
	 *
	 * @private
	 * @param {PIXI.TextStyle} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.TextStyle object was found.
	 */
	function findTextStyle(item, queue)
	{
	    if (item instanceof TextStyle)
	    {
	        if (queue.indexOf(item) === -1)
	        {
	            queue.push(item);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * The prepare manager provides functionality to upload content to the GPU.
	 *
	 * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`
	 *
	 * @class
	 * @extends PIXI.prepare.BasePrepare
	 * @memberof PIXI.prepare
	 */
	var Prepare = /*@__PURE__*/(function (BasePrepare) {
	    function Prepare(renderer)
	    {
	        BasePrepare.call(this, renderer);

	        this.uploadHookHelper = this.renderer;

	        // Add textures and graphics to upload
	        this.registerFindHook(findGraphics);
	        this.registerUploadHook(uploadBaseTextures);
	        this.registerUploadHook(uploadGraphics);
	    }

	    if ( BasePrepare ) { Prepare.__proto__ = BasePrepare; }
	    Prepare.prototype = Object.create( BasePrepare && BasePrepare.prototype );
	    Prepare.prototype.constructor = Prepare;

	    return Prepare;
	}(BasePrepare));
	/**
	 * Built-in hook to upload PIXI.Texture objects to the GPU.
	 *
	 * @private
	 * @param {PIXI.Renderer} renderer - instance of the webgl renderer
	 * @param {PIXI.DisplayObject} item - Item to check
	 * @return {boolean} If item was uploaded.
	 */
	function uploadBaseTextures(renderer, item)
	{
	    if (item instanceof BaseTexture)
	    {
	        // if the texture already has a GL texture, then the texture has been prepared or rendered
	        // before now. If the texture changed, then the changer should be calling texture.update() which
	        // reuploads the texture without need for preparing it again
	        if (!item._glTextures[renderer.CONTEXT_UID])
	        {
	            renderer.texture.bind(item);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to upload PIXI.Graphics to the GPU.
	 *
	 * @private
	 * @param {PIXI.Renderer} renderer - instance of the webgl renderer
	 * @param {PIXI.DisplayObject} item - Item to check
	 * @return {boolean} If item was uploaded.
	 */
	function uploadGraphics(renderer, item)
	{
	    if (item instanceof Graphics)
	    {
	        // if the item is not dirty and already has webgl data, then it got prepared or rendered
	        // before now and we shouldn't waste time updating it again
	        if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID])
	        {
	            renderer.plugins.graphics.updateGraphics(item);
	        }

	        return true;
	    }

	    return false;
	}

	/**
	 * Built-in hook to find graphics.
	 *
	 * @private
	 * @param {PIXI.DisplayObject} item - Display object to check
	 * @param {Array<*>} queue - Collection of items to upload
	 * @return {boolean} if a PIXI.Graphics object was found.
	 */
	function findGraphics(item, queue)
	{
	    if (item instanceof Graphics)
	    {
	        queue.push(item);

	        return true;
	    }

	    return false;
	}

	/**
	 * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified
	 * number of milliseconds per frame.
	 *
	 * @class
	 * @memberof PIXI.prepare
	 */
	var TimeLimiter = function TimeLimiter(maxMilliseconds)
	{
	    /**
	     * The maximum milliseconds that can be spent preparing items each frame.
	     * @type {number}
	     * @private
	     */
	    this.maxMilliseconds = maxMilliseconds;
	    /**
	     * The start time of the current frame.
	     * @type {number}
	     * @private
	     */
	    this.frameStart = 0;
	};

	/**
	 * Resets any counting properties to start fresh on a new frame.
	 */
	TimeLimiter.prototype.beginFrame = function beginFrame ()
	{
	    this.frameStart = Date.now();
	};

	/**
	 * Checks to see if another item can be uploaded. This should only be called once per item.
	 * @return {boolean} If the item is allowed to be uploaded.
	 */
	TimeLimiter.prototype.allowedToUpload = function allowedToUpload ()
	{
	    return Date.now() - this.frameStart < this.maxMilliseconds;
	};

	var prepare_es = ({
		BasePrepare: BasePrepare,
		CountLimiter: CountLimiter,
		Prepare: Prepare,
		TimeLimiter: TimeLimiter
	});

	/*!
	 * @pixi/app - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/app is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Convenience class to create a new PIXI application.
	 *
	 * This class automatically creates the renderer, ticker and root container.
	 *
	 * @example
	 * // Create the application
	 * const app = new PIXI.Application();
	 *
	 * // Add the view to the DOM
	 * document.body.appendChild(app.view);
	 *
	 * // ex, add display objects
	 * app.stage.addChild(PIXI.Sprite.from('something.png'));
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Application = function Application(options)
	{
	    var this$1 = this;

	    // The default options
	    options = Object.assign({
	        forceCanvas: false,
	    }, options);

	    /**
	     * WebGL renderer if available, otherwise CanvasRenderer.
	     * @member {PIXI.Renderer|PIXI.CanvasRenderer}
	     */
	    this.renderer = autoDetectRenderer(options);

	    /**
	     * The root display container that's rendered.
	     * @member {PIXI.Container}
	     */
	    this.stage = new Container();

	    // install plugins here
	    Application._plugins.forEach(function (plugin) {
	        plugin.init.call(this$1, options);
	    });
	};

	var prototypeAccessors$8 = { view: { configurable: true },screen: { configurable: true } };

	/**
	 * Register a middleware plugin for the application
	 * @static
	 * @param {PIXI.Application.Plugin} plugin - Plugin being installed
	 */
	Application.registerPlugin = function registerPlugin (plugin)
	{
	    Application._plugins.push(plugin);
	};

	/**
	 * Render the current stage.
	 */
	Application.prototype.render = function render ()
	{
	    this.renderer.render(this.stage);
	};

	/**
	 * Reference to the renderer's canvas element.
	 * @member {HTMLCanvasElement}
	 * @readonly
	 */
	prototypeAccessors$8.view.get = function ()
	{
	    return this.renderer.view;
	};

	/**
	 * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
	 * @member {PIXI.Rectangle}
	 * @readonly
	 */
	prototypeAccessors$8.screen.get = function ()
	{
	    return this.renderer.screen;
	};

	/**
	 * Destroy and don't use after this.
	 * @param {Boolean} [removeView=false] Automatically remove canvas from DOM.
	 * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options
	 *  have been set to that value
	 * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy
	 *  method called as well. 'stageOptions' will be passed on to those calls.
	 * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set
	 *  to true. Should it destroy the texture of the child sprite
	 * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set
	 *  to true. Should it destroy the base texture of the child sprite
	 */
	Application.prototype.destroy = function destroy (removeView, stageOptions)
	{
	        var this$1 = this;

	    // Destroy plugins in the opposite order
	    // which they were constructed
	    var plugins = Application._plugins.slice(0);

	    plugins.reverse();
	    plugins.forEach(function (plugin) {
	        plugin.destroy.call(this$1);
	    });

	    this.stage.destroy(stageOptions);
	    this.stage = null;

	    this.renderer.destroy(removeView);
	    this.renderer = null;

	    this._options = null;
	};

	Object.defineProperties( Application.prototype, prototypeAccessors$8 );

	/**
	 * @memberof PIXI.Application
	 * @typedef {object} Plugin
	 * @property {function} init - Called when Application is constructed, scoped to Application instance.
	 *  Passes in `options` as the only argument, which are Application constructor options.
	 * @property {function} destroy - Called when destroying Application, scoped to Application instance
	 */

	/**
	 * Collection of installed plugins.
	 * @static
	 * @private
	 * @type {PIXI.Application.Plugin[]}
	 */
	Application._plugins = [];

	/**
	 * Middleware for for Application's resize functionality
	 * @private
	 * @class
	 */
	var ResizePlugin = function ResizePlugin () {};

	ResizePlugin.init = function init (options)
	{
	        var this$1 = this;

	    /**
	     * The element or window to resize the application to.
	     * @type {Window|HTMLElement}
	     * @name resizeTo
	     * @memberof PIXI.Application#
	     */
	    Object.defineProperty(this, 'resizeTo',
	        {
	            set: function set(dom)
	            {
	                window.removeEventListener('resize', this.resize);
	                this._resizeTo = dom;
	                if (dom)
	                {
	                    window.addEventListener('resize', this.resize);
	                    this.resize();
	                }
	            },
	            get: function get()
	            {
	                return this._resizeTo;
	            },
	        });

	    /**
	     * If `resizeTo` is set, calling this function
	     * will resize to the width and height of that element.
	     * @method PIXI.Application#resize
	     */
	    this.resize = function () {
	        if (this$1._resizeTo)
	        {
	            // Resize to the window
	            if (this$1._resizeTo === window)
	            {
	                this$1.renderer.resize(
	                    window.innerWidth,
	                    window.innerHeight
	                );
	            }
	            // Resize to other HTML entities
	            else
	            {
	                this$1.renderer.resize(
	                    this$1._resizeTo.clientWidth,
	                    this$1._resizeTo.clientHeight
	                );
	            }
	        }
	    };

	    // On resize
	    this._resizeTo = null;
	    this.resizeTo = options.resizeTo || null;
	};

	/**
	 * Clean up the ticker, scoped to application
	 * @static
	 * @private
	 */
	ResizePlugin.destroy = function destroy ()
	{
	    this.resizeTo = null;
	    this.resize = null;
	};

	Application.registerPlugin(ResizePlugin);

	'use strict';

	var parseUri = function parseURI (str, opts) {
	  opts = opts || {};

	  var o = {
	    key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
	    q: {
	      name: 'queryKey',
	      parser: /(?:^|&)([^&=]*)=?([^&]*)/g
	    },
	    parser: {
	      strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
	      loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
	    }
	  };

	  var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);
	  var uri = {};
	  var i = 14;

	  while (i--) { uri[o.key[i]] = m[i] || ''; }

	  uri[o.q.name] = {};
	  uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
	    if ($1) { uri[o.q.name][$1] = $2; }
	  });

	  return uri
	};

	var miniSignals = createCommonjsModule(function (module, exports) {
	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; })();

	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

	var MiniSignalBinding = (function () {
	  function MiniSignalBinding(fn, once, thisArg) {
	    if (once === undefined) { once = false; }

	    _classCallCheck(this, MiniSignalBinding);

	    this._fn = fn;
	    this._once = once;
	    this._thisArg = thisArg;
	    this._next = this._prev = this._owner = null;
	  }

	  _createClass(MiniSignalBinding, [{
	    key: 'detach',
	    value: function detach() {
	      if (this._owner === null) { return false; }
	      this._owner.detach(this);
	      return true;
	    }
	  }]);

	  return MiniSignalBinding;
	})();

	function _addMiniSignalBinding(self, node) {
	  if (!self._head) {
	    self._head = node;
	    self._tail = node;
	  } else {
	    self._tail._next = node;
	    node._prev = self._tail;
	    self._tail = node;
	  }

	  node._owner = self;

	  return node;
	}

	var MiniSignal = (function () {
	  function MiniSignal() {
	    _classCallCheck(this, MiniSignal);

	    this._head = this._tail = undefined;
	  }

	  _createClass(MiniSignal, [{
	    key: 'handlers',
	    value: function handlers() {
	      var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];

	      var node = this._head;

	      if (exists) { return !!node; }

	      var ee = [];

	      while (node) {
	        ee.push(node);
	        node = node._next;
	      }

	      return ee;
	    }
	  }, {
	    key: 'has',
	    value: function has(node) {
	      if (!(node instanceof MiniSignalBinding)) {
	        throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');
	      }

	      return node._owner === this;
	    }
	  }, {
	    key: 'dispatch',
	    value: function dispatch() {
	      var arguments$1 = arguments;

	      var node = this._head;

	      if (!node) { return false; }

	      while (node) {
	        if (node._once) { this.detach(node); }
	        node._fn.apply(node._thisArg, arguments$1);
	        node = node._next;
	      }

	      return true;
	    }
	  }, {
	    key: 'add',
	    value: function add(fn) {
	      var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];

	      if (typeof fn !== 'function') {
	        throw new Error('MiniSignal#add(): First arg must be a Function.');
	      }
	      return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));
	    }
	  }, {
	    key: 'once',
	    value: function once(fn) {
	      var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];

	      if (typeof fn !== 'function') {
	        throw new Error('MiniSignal#once(): First arg must be a Function.');
	      }
	      return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));
	    }
	  }, {
	    key: 'detach',
	    value: function detach(node) {
	      if (!(node instanceof MiniSignalBinding)) {
	        throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');
	      }
	      if (node._owner !== this) { return this; }

	      if (node._prev) { node._prev._next = node._next; }
	      if (node._next) { node._next._prev = node._prev; }

	      if (node === this._head) {
	        this._head = node._next;
	        if (node._next === null) {
	          this._tail = null;
	        }
	      } else if (node === this._tail) {
	        this._tail = node._prev;
	        this._tail._next = null;
	      }

	      node._owner = null;
	      return this;
	    }
	  }, {
	    key: 'detachAll',
	    value: function detachAll() {
	      var node = this._head;
	      if (!node) { return this; }

	      this._head = this._tail = null;

	      while (node) {
	        node._owner = null;
	        node = node._next;
	      }
	      return this;
	    }
	  }]);

	  return MiniSignal;
	})();

	MiniSignal.MiniSignalBinding = MiniSignalBinding;

	exports['default'] = MiniSignal;
	module.exports = exports['default'];
	});

	var Signal = unwrapExports(miniSignals);

	/*!
	 * resource-loader - v3.0.1
	 * https://github.com/pixijs/pixi-sound
	 * Compiled Tue, 02 Jul 2019 14:06:18 UTC
	 *
	 * resource-loader is licensed under the MIT license.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Smaller version of the async library constructs.
	 *
	 * @namespace async
	 */

	/**
	 * Noop function
	 *
	 * @ignore
	 * @function
	 * @memberof async
	 */
	function _noop() {}
	/* empty */

	/**
	 * Iterates an array in series.
	 *
	 * @memberof async
	 * @function eachSeries
	 * @param {Array.<*>} array - Array to iterate.
	 * @param {function} iterator - Function to call for each element.
	 * @param {function} callback - Function to call when done, or on error.
	 * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.
	 */


	function eachSeries(array, iterator, callback, deferNext) {
	  var i = 0;
	  var len = array.length;

	  (function next(err) {
	    if (err || i === len) {
	      if (callback) {
	        callback(err);
	      }

	      return;
	    }

	    if (deferNext) {
	      setTimeout(function () {
	        iterator(array[i++], next);
	      }, 1);
	    } else {
	      iterator(array[i++], next);
	    }
	  })();
	}
	/**
	 * Ensures a function is only called once.
	 *
	 * @ignore
	 * @memberof async
	 * @param {function} fn - The function to wrap.
	 * @return {function} The wrapping function.
	 */

	function onlyOnce(fn) {
	  return function onceWrapper() {
	    if (fn === null) {
	      throw new Error('Callback was already called.');
	    }

	    var callFn = fn;
	    fn = null;
	    callFn.apply(this, arguments);
	  };
	}
	/**
	 * Async queue implementation,
	 *
	 * @memberof async
	 * @function queue
	 * @param {function} worker - The worker function to call for each task.
	 * @param {number} concurrency - How many workers to run in parrallel.
	 * @return {*} The async queue object.
	 */


	function queue(worker, concurrency) {
	  if (concurrency == null) {
	    // eslint-disable-line no-eq-null,eqeqeq
	    concurrency = 1;
	  } else if (concurrency === 0) {
	    throw new Error('Concurrency must not be zero');
	  }

	  var workers = 0;
	  var q = {
	    _tasks: [],
	    concurrency: concurrency,
	    saturated: _noop,
	    unsaturated: _noop,
	    buffer: concurrency / 4,
	    empty: _noop,
	    drain: _noop,
	    error: _noop,
	    started: false,
	    paused: false,
	    push: function push(data, callback) {
	      _insert(data, false, callback);
	    },
	    kill: function kill() {
	      workers = 0;
	      q.drain = _noop;
	      q.started = false;
	      q._tasks = [];
	    },
	    unshift: function unshift(data, callback) {
	      _insert(data, true, callback);
	    },
	    process: function process() {
	      while (!q.paused && workers < q.concurrency && q._tasks.length) {
	        var task = q._tasks.shift();

	        if (q._tasks.length === 0) {
	          q.empty();
	        }

	        workers += 1;

	        if (workers === q.concurrency) {
	          q.saturated();
	        }

	        worker(task.data, onlyOnce(_next(task)));
	      }
	    },
	    length: function length() {
	      return q._tasks.length;
	    },
	    running: function running() {
	      return workers;
	    },
	    idle: function idle() {
	      return q._tasks.length + workers === 0;
	    },
	    pause: function pause() {
	      if (q.paused === true) {
	        return;
	      }

	      q.paused = true;
	    },
	    resume: function resume() {
	      if (q.paused === false) {
	        return;
	      }

	      q.paused = false; // Need to call q.process once per concurrent
	      // worker to preserve full concurrency after pause

	      for (var w = 1; w <= q.concurrency; w++) {
	        q.process();
	      }
	    }
	  };

	  function _insert(data, insertAtFront, callback) {
	    if (callback != null && typeof callback !== 'function') {
	      // eslint-disable-line no-eq-null,eqeqeq
	      throw new Error('task callback must be a function');
	    }

	    q.started = true;

	    if (data == null && q.idle()) {
	      // eslint-disable-line no-eq-null,eqeqeq
	      // call drain immediately if there are no tasks
	      setTimeout(function () {
	        return q.drain();
	      }, 1);
	      return;
	    }

	    var item = {
	      data: data,
	      callback: typeof callback === 'function' ? callback : _noop
	    };

	    if (insertAtFront) {
	      q._tasks.unshift(item);
	    } else {
	      q._tasks.push(item);
	    }

	    setTimeout(function () {
	      return q.process();
	    }, 1);
	  }

	  function _next(task) {
	    return function next() {
	      workers -= 1;
	      task.callback.apply(task, arguments);

	      if (arguments[0] != null) {
	        // eslint-disable-line no-eq-null,eqeqeq
	        q.error(arguments[0], task.data);
	      }

	      if (workers <= q.concurrency - q.buffer) {
	        q.unsaturated();
	      }

	      if (q.idle()) {
	        q.drain();
	      }

	      q.process();
	    };
	  }

	  return q;
	}

	var async = ({
	    eachSeries: eachSeries,
	    queue: queue
	});

	// a simple in-memory cache for resources
	var cache = {};
	/**
	 * A simple in-memory cache for resource.
	 *
	 * @memberof middleware
	 * @function caching
	 * @example
	 * import { Loader, middleware } from 'resource-loader';
	 * const loader = new Loader();
	 * loader.use(middleware.caching);
	 * @param {Resource} resource - Current Resource
	 * @param {function} next - Callback when complete
	 */

	function caching(resource, next) {
	  var _this = this;

	  // if cached, then set data and complete the resource
	  if (cache[resource.url]) {
	    resource.data = cache[resource.url];
	    resource.complete(); // marks resource load complete and stops processing before middlewares
	  } // if not cached, wait for complete and store it in the cache.
	  else {
	      resource.onComplete.once(function () {
	        return cache[_this.url] = _this.data;
	      });
	    }

	  next();
	}

	function _defineProperties(target, props) {
	  for (var i = 0; i < props.length; i++) {
	    var descriptor = props[i];
	    descriptor.enumerable = descriptor.enumerable || false;
	    descriptor.configurable = true;
	    if ("value" in descriptor) { descriptor.writable = true; }
	    Object.defineProperty(target, descriptor.key, descriptor);
	  }
	}

	function _createClass(Constructor, protoProps, staticProps) {
	  if (protoProps) { _defineProperties(Constructor.prototype, protoProps); }
	  if (staticProps) { _defineProperties(Constructor, staticProps); }
	  return Constructor;
	}

	var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest()));
	var tempAnchor$1 = null; // some status constants

	var STATUS_NONE = 0;
	var STATUS_OK = 200;
	var STATUS_EMPTY = 204;
	var STATUS_IE_BUG_EMPTY = 1223;
	var STATUS_TYPE_OK = 2; // noop

	function _noop$1() {}
	/* empty */

	/**
	 * Manages the state and loading of a resource and all child resources.
	 *
	 * @class
	 */


	var Resource$1 =
	/*#__PURE__*/
	function () {
	  /**
	   * Sets the load type to be used for a specific extension.
	   *
	   * @static
	   * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt"
	   * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.
	   */
	  Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) {
	    setExtMap(Resource._loadTypeMap, extname, loadType);
	  }
	  /**
	   * Sets the load type to be used for a specific extension.
	   *
	   * @static
	   * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt"
	   * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.
	   */
	  ;

	  Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) {
	    setExtMap(Resource._xhrTypeMap, extname, xhrType);
	  }
	  /**
	   * @param {string} name - The name of the resource to load.
	   * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass
	   *      an array of sources.
	   * @param {object} [options] - The options for the load.
	   * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to
	   *      determine automatically.
	   * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes
	   *      longer than this time it is cancelled and the load is considered a failure. If this value is
	   *      set to `0` then there is no explicit timeout.
	   * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource
	   *      be loaded?
	   * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How
	   *      should the data being loaded be interpreted when using XHR?
	   * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.
	   */
	  ;

	  function Resource(name, url, options) {
	    if (typeof name !== 'string' || typeof url !== 'string') {
	      throw new Error('Both name and url are required for constructing a resource.');
	    }

	    options = options || {};
	    /**
	     * The state flags of this resource.
	     *
	     * @private
	     * @member {number}
	     */

	    this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work.

	    this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);
	    /**
	     * The name of this resource.
	     *
	     * @readonly
	     * @member {string}
	     */


	    this.name = name;
	    /**
	     * The url used to load this resource.
	     *
	     * @readonly
	     * @member {string}
	     */

	    this.url = url;
	    /**
	     * The extension used to load this resource.
	     *
	     * @readonly
	     * @member {string}
	     */

	    this.extension = this._getExtension();
	    /**
	     * The data that was loaded by the resource.
	     *
	     * @member {any}
	     */

	    this.data = null;
	    /**
	     * Is this request cross-origin? If unset, determined automatically.
	     *
	     * @member {string}
	     */

	    this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;
	    /**
	     * A timeout in milliseconds for the load. If the load takes longer than this time
	     * it is cancelled and the load is considered a failure. If this value is set to `0`
	     * then there is no explicit timeout.
	     *
	     * @member {number}
	     */

	    this.timeout = options.timeout || 0;
	    /**
	     * The method of loading to use for this resource.
	     *
	     * @member {Resource.LOAD_TYPE}
	     */

	    this.loadType = options.loadType || this._determineLoadType();
	    /**
	     * The type used to load the resource via XHR. If unset, determined automatically.
	     *
	     * @member {string}
	     */

	    this.xhrType = options.xhrType;
	    /**
	     * Extra info for middleware, and controlling specifics about how the resource loads.
	     *
	     * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.
	     * Meaning it will modify it as it sees fit.
	     *
	     * @member {Resource.IMetadata}
	     */

	    this.metadata = options.metadata || {};
	    /**
	     * The error that occurred while loading (if any).
	     *
	     * @readonly
	     * @member {Error}
	     */

	    this.error = null;
	    /**
	     * The XHR object that was used to load this resource. This is only set
	     * when `loadType` is `Resource.LOAD_TYPE.XHR`.
	     *
	     * @readonly
	     * @member {XMLHttpRequest}
	     */

	    this.xhr = null;
	    /**
	     * The child resources this resource owns.
	     *
	     * @readonly
	     * @member {Resource[]}
	     */

	    this.children = [];
	    /**
	     * The resource type.
	     *
	     * @readonly
	     * @member {Resource.TYPE}
	     */

	    this.type = Resource.TYPE.UNKNOWN;
	    /**
	     * The progress chunk owned by this resource.
	     *
	     * @readonly
	     * @member {number}
	     */

	    this.progressChunk = 0;
	    /**
	     * The `dequeue` method that will be used a storage place for the async queue dequeue method
	     * used privately by the loader.
	     *
	     * @private
	     * @member {function}
	     */

	    this._dequeue = _noop$1;
	    /**
	     * Used a storage place for the on load binding used privately by the loader.
	     *
	     * @private
	     * @member {function}
	     */

	    this._onLoadBinding = null;
	    /**
	     * The timer for element loads to check if they timeout.
	     *
	     * @private
	     * @member {number}
	     */

	    this._elementTimer = 0;
	    /**
	     * The `complete` function bound to this resource's context.
	     *
	     * @private
	     * @member {function}
	     */

	    this._boundComplete = this.complete.bind(this);
	    /**
	     * The `_onError` function bound to this resource's context.
	     *
	     * @private
	     * @member {function}
	     */

	    this._boundOnError = this._onError.bind(this);
	    /**
	     * The `_onProgress` function bound to this resource's context.
	     *
	     * @private
	     * @member {function}
	     */

	    this._boundOnProgress = this._onProgress.bind(this);
	    /**
	     * The `_onTimeout` function bound to this resource's context.
	     *
	     * @private
	     * @member {function}
	     */

	    this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks

	    this._boundXhrOnError = this._xhrOnError.bind(this);
	    this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);
	    this._boundXhrOnAbort = this._xhrOnAbort.bind(this);
	    this._boundXhrOnLoad = this._xhrOnLoad.bind(this);
	    /**
	     * Dispatched when the resource beings to load.
	     *
	     * The callback looks like {@link Resource.OnStartSignal}.
	     *
	     * @member {Signal<Resource.OnStartSignal>}
	     */

	    this.onStart = new Signal();
	    /**
	     * Dispatched each time progress of this resource load updates.
	     * Not all resources types and loader systems can support this event
	     * so sometimes it may not be available. If the resource
	     * is being loaded on a modern browser, using XHR, and the remote server
	     * properly sets Content-Length headers, then this will be available.
	     *
	     * The callback looks like {@link Resource.OnProgressSignal}.
	     *
	     * @member {Signal<Resource.OnProgressSignal>}
	     */

	    this.onProgress = new Signal();
	    /**
	     * Dispatched once this resource has loaded, if there was an error it will
	     * be in the `error` property.
	     *
	     * The callback looks like {@link Resource.OnCompleteSignal}.
	     *
	     * @member {Signal<Resource.OnCompleteSignal>}
	     */

	    this.onComplete = new Signal();
	    /**
	     * Dispatched after this resource has had all the *after* middleware run on it.
	     *
	     * The callback looks like {@link Resource.OnCompleteSignal}.
	     *
	     * @member {Signal<Resource.OnCompleteSignal>}
	     */

	    this.onAfterMiddleware = new Signal();
	  }
	  /**
	   * When the resource starts to load.
	   *
	   * @memberof Resource
	   * @callback OnStartSignal
	   * @param {Resource} resource - The resource that the event happened on.
	   */

	  /**
	   * When the resource reports loading progress.
	   *
	   * @memberof Resource
	   * @callback OnProgressSignal
	   * @param {Resource} resource - The resource that the event happened on.
	   * @param {number} percentage - The progress of the load in the range [0, 1].
	   */

	  /**
	   * When the resource finishes loading.
	   *
	   * @memberof Resource
	   * @callback OnCompleteSignal
	   * @param {Resource} resource - The resource that the event happened on.
	   */

	  /**
	   * @memberof Resource
	   * @typedef {object} IMetadata
	   * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The
	   *      element to use for loading, instead of creating one.
	   * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This
	   *      is useful if you want to pass in a `loadElement` that you already added load sources to.
	   * @property {string|string[]} [mimeType] - The mime type to use for the source element
	   *      of a video/audio elment. If the urls are an array, you can pass this as an array as well
	   *      where each index is the mime type to use for the corresponding url index.
	   */

	  /**
	   * Stores whether or not this url is a data url.
	   *
	   * @readonly
	   * @member {boolean}
	   */


	  var _proto = Resource.prototype;

	  /**
	   * Marks the resource as complete.
	   *
	   */
	  _proto.complete = function complete() {
	    this._clearEvents();

	    this._finish();
	  }
	  /**
	   * Aborts the loading of this resource, with an optional message.
	   *
	   * @param {string} message - The message to use for the error
	   */
	  ;

	  _proto.abort = function abort(message) {
	    // abort can be called multiple times, ignore subsequent calls.
	    if (this.error) {
	      return;
	    } // store error


	    this.error = new Error(message); // clear events before calling aborts

	    this._clearEvents(); // abort the actual loading


	    if (this.xhr) {
	      this.xhr.abort();
	    } else if (this.xdr) {
	      this.xdr.abort();
	    } else if (this.data) {
	      // single source
	      if (this.data.src) {
	        this.data.src = Resource.EMPTY_GIF;
	      } // multi-source
	      else {
	          while (this.data.firstChild) {
	            this.data.removeChild(this.data.firstChild);
	          }
	        }
	    } // done now.


	    this._finish();
	  }
	  /**
	   * Kicks off loading of this resource. This method is asynchronous.
	   *
	   * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.
	   */
	  ;

	  _proto.load = function load(cb) {
	    var _this = this;

	    if (this.isLoading) {
	      return;
	    }

	    if (this.isComplete) {
	      if (cb) {
	        setTimeout(function () {
	          return cb(_this);
	        }, 1);
	      }

	      return;
	    } else if (cb) {
	      this.onComplete.once(cb);
	    }

	    this._setFlag(Resource.STATUS_FLAGS.LOADING, true);

	    this.onStart.dispatch(this); // if unset, determine the value

	    if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {
	      this.crossOrigin = this._determineCrossOrigin(this.url);
	    }

	    switch (this.loadType) {
	      case Resource.LOAD_TYPE.IMAGE:
	        this.type = Resource.TYPE.IMAGE;

	        this._loadElement('image');

	        break;

	      case Resource.LOAD_TYPE.AUDIO:
	        this.type = Resource.TYPE.AUDIO;

	        this._loadSourceElement('audio');

	        break;

	      case Resource.LOAD_TYPE.VIDEO:
	        this.type = Resource.TYPE.VIDEO;

	        this._loadSourceElement('video');

	        break;

	      case Resource.LOAD_TYPE.XHR:
	      /* falls through */

	      default:
	        if (useXdr && this.crossOrigin) {
	          this._loadXdr();
	        } else {
	          this._loadXhr();
	        }

	        break;
	    }
	  }
	  /**
	   * Checks if the flag is set.
	   *
	   * @private
	   * @param {number} flag - The flag to check.
	   * @return {boolean} True if the flag is set.
	   */
	  ;

	  _proto._hasFlag = function _hasFlag(flag) {
	    return (this._flags & flag) !== 0;
	  }
	  /**
	   * (Un)Sets the flag.
	   *
	   * @private
	   * @param {number} flag - The flag to (un)set.
	   * @param {boolean} value - Whether to set or (un)set the flag.
	   */
	  ;

	  _proto._setFlag = function _setFlag(flag, value) {
	    this._flags = value ? this._flags | flag : this._flags & ~flag;
	  }
	  /**
	   * Clears all the events from the underlying loading source.
	   *
	   * @private
	   */
	  ;

	  _proto._clearEvents = function _clearEvents() {
	    clearTimeout(this._elementTimer);

	    if (this.data && this.data.removeEventListener) {
	      this.data.removeEventListener('error', this._boundOnError, false);
	      this.data.removeEventListener('load', this._boundComplete, false);
	      this.data.removeEventListener('progress', this._boundOnProgress, false);
	      this.data.removeEventListener('canplaythrough', this._boundComplete, false);
	    }

	    if (this.xhr) {
	      if (this.xhr.removeEventListener) {
	        this.xhr.removeEventListener('error', this._boundXhrOnError, false);
	        this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);
	        this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);
	        this.xhr.removeEventListener('progress', this._boundOnProgress, false);
	        this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);
	      } else {
	        this.xhr.onerror = null;
	        this.xhr.ontimeout = null;
	        this.xhr.onprogress = null;
	        this.xhr.onload = null;
	      }
	    }
	  }
	  /**
	   * Finalizes the load.
	   *
	   * @private
	   */
	  ;

	  _proto._finish = function _finish() {
	    if (this.isComplete) {
	      throw new Error('Complete called again for an already completed resource.');
	    }

	    this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);

	    this._setFlag(Resource.STATUS_FLAGS.LOADING, false);

	    this.onComplete.dispatch(this);
	  }
	  /**
	   * Loads this resources using an element that has a single source,
	   * like an HTMLImageElement.
	   *
	   * @private
	   * @param {string} type - The type of element to use.
	   */
	  ;

	  _proto._loadElement = function _loadElement(type) {
	    if (this.metadata.loadElement) {
	      this.data = this.metadata.loadElement;
	    } else if (type === 'image' && typeof window.Image !== 'undefined') {
	      this.data = new Image();
	    } else {
	      this.data = document.createElement(type);
	    }

	    if (this.crossOrigin) {
	      this.data.crossOrigin = this.crossOrigin;
	    }

	    if (!this.metadata.skipSource) {
	      this.data.src = this.url;
	    }

	    this.data.addEventListener('error', this._boundOnError, false);
	    this.data.addEventListener('load', this._boundComplete, false);
	    this.data.addEventListener('progress', this._boundOnProgress, false);

	    if (this.timeout) {
	      this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
	    }
	  }
	  /**
	   * Loads this resources using an element that has multiple sources,
	   * like an HTMLAudioElement or HTMLVideoElement.
	   *
	   * @private
	   * @param {string} type - The type of element to use.
	   */
	  ;

	  _proto._loadSourceElement = function _loadSourceElement(type) {
	    if (this.metadata.loadElement) {
	      this.data = this.metadata.loadElement;
	    } else if (type === 'audio' && typeof window.Audio !== 'undefined') {
	      this.data = new Audio();
	    } else {
	      this.data = document.createElement(type);
	    }

	    if (this.data === null) {
	      this.abort("Unsupported element: " + type);
	      return;
	    }

	    if (this.crossOrigin) {
	      this.data.crossOrigin = this.crossOrigin;
	    }

	    if (!this.metadata.skipSource) {
	      // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')
	      if (navigator.isCocoonJS) {
	        this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;
	      } else if (Array.isArray(this.url)) {
	        var mimeTypes = this.metadata.mimeType;

	        for (var i = 0; i < this.url.length; ++i) {
	          this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes));
	        }
	      } else {
	        var _mimeTypes = this.metadata.mimeType;
	        this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes));
	      }
	    }

	    this.data.addEventListener('error', this._boundOnError, false);
	    this.data.addEventListener('load', this._boundComplete, false);
	    this.data.addEventListener('progress', this._boundOnProgress, false);
	    this.data.addEventListener('canplaythrough', this._boundComplete, false);
	    this.data.load();

	    if (this.timeout) {
	      this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
	    }
	  }
	  /**
	   * Loads this resources using an XMLHttpRequest.
	   *
	   * @private
	   */
	  ;

	  _proto._loadXhr = function _loadXhr() {
	    // if unset, determine the value
	    if (typeof this.xhrType !== 'string') {
	      this.xhrType = this._determineXhrType();
	    }

	    var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url

	    xhr.open('GET', this.url, true);
	    xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers
	    // *cough* safari *cough* can't deal with it.

	    if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {
	      xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;
	    } else {
	      xhr.responseType = this.xhrType;
	    }

	    xhr.addEventListener('error', this._boundXhrOnError, false);
	    xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);
	    xhr.addEventListener('abort', this._boundXhrOnAbort, false);
	    xhr.addEventListener('progress', this._boundOnProgress, false);
	    xhr.addEventListener('load', this._boundXhrOnLoad, false);
	    xhr.send();
	  }
	  /**
	   * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).
	   *
	   * @private
	   */
	  ;

	  _proto._loadXdr = function _loadXdr() {
	    // if unset, determine the value
	    if (typeof this.xhrType !== 'string') {
	      this.xhrType = this._determineXhrType();
	    }

	    var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef
	    // XDomainRequest has a few quirks. Occasionally it will abort requests
	    // A way to avoid this is to make sure ALL callbacks are set even if not used
	    // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9

	    xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9

	    xdr.onerror = this._boundXhrOnError;
	    xdr.ontimeout = this._boundXhrOnTimeout;
	    xdr.onprogress = this._boundOnProgress;
	    xdr.onload = this._boundXhrOnLoad;
	    xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an
	    // issue with the interface where some requests are lost if multiple
	    // XDomainRequests are being sent at the same time.
	    // Some info here: https://github.com/photonstorm/phaser/issues/1248

	    setTimeout(function () {
	      return xdr.send();
	    }, 1);
	  }
	  /**
	   * Creates a source used in loading via an element.
	   *
	   * @private
	   * @param {string} type - The element type (video or audio).
	   * @param {string} url - The source URL to load from.
	   * @param {string} [mime] - The mime type of the video
	   * @return {HTMLSourceElement} The source element.
	   */
	  ;

	  _proto._createSource = function _createSource(type, url, mime) {
	    if (!mime) {
	      mime = type + "/" + this._getExtension(url);
	    }

	    var source = document.createElement('source');
	    source.src = url;
	    source.type = mime;
	    return source;
	  }
	  /**
	   * Called if a load errors out.
	   *
	   * @param {Event} event - The error event from the element that emits it.
	   * @private
	   */
	  ;

	  _proto._onError = function _onError(event) {
	    this.abort("Failed to load element using: " + event.target.nodeName);
	  }
	  /**
	   * Called if a load progress event fires for an element or xhr/xdr.
	   *
	   * @private
	   * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.
	   */
	  ;

	  _proto._onProgress = function _onProgress(event) {
	    if (event && event.lengthComputable) {
	      this.onProgress.dispatch(this, event.loaded / event.total);
	    }
	  }
	  /**
	   * Called if a timeout event fires for an element.
	   *
	   * @private
	   */
	  ;

	  _proto._onTimeout = function _onTimeout() {
	    this.abort("Load timed out.");
	  }
	  /**
	   * Called if an error event fires for xhr/xdr.
	   *
	   * @private
	   */
	  ;

	  _proto._xhrOnError = function _xhrOnError() {
	    var xhr = this.xhr;
	    this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\"");
	  }
	  /**
	   * Called if an error event fires for xhr/xdr.
	   *
	   * @private
	   */
	  ;

	  _proto._xhrOnTimeout = function _xhrOnTimeout() {
	    var xhr = this.xhr;
	    this.abort(reqType(xhr) + " Request timed out.");
	  }
	  /**
	   * Called if an abort event fires for xhr/xdr.
	   *
	   * @private
	   */
	  ;

	  _proto._xhrOnAbort = function _xhrOnAbort() {
	    var xhr = this.xhr;
	    this.abort(reqType(xhr) + " Request was aborted by the user.");
	  }
	  /**
	   * Called when data successfully loads from an xhr/xdr request.
	   *
	   * @private
	   * @param {XMLHttpRequestLoadEvent|Event} event - Load event
	   */
	  ;

	  _proto._xhrOnLoad = function _xhrOnLoad() {
	    var xhr = this.xhr;
	    var text = '';
	    var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.
	    // responseText is accessible only if responseType is '' or 'text' and on older browsers

	    if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {
	      text = xhr.responseText;
	    } // status can be 0 when using the `file://` protocol so we also check if a response is set.
	    // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.


	    if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {
	      status = STATUS_OK;
	    } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
	    else if (status === STATUS_IE_BUG_EMPTY) {
	        status = STATUS_EMPTY;
	      }

	    var statusType = status / 100 | 0;

	    if (statusType === STATUS_TYPE_OK) {
	      // if text, just return it
	      if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {
	        this.data = text;
	        this.type = Resource.TYPE.TEXT;
	      } // if json, parse into json object
	      else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {
	          try {
	            this.data = JSON.parse(text);
	            this.type = Resource.TYPE.JSON;
	          } catch (e) {
	            this.abort("Error trying to parse loaded json: " + e);
	            return;
	          }
	        } // if xml, parse into an xml document or div element
	        else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {
	            try {
	              if (window.DOMParser) {
	                var domparser = new DOMParser();
	                this.data = domparser.parseFromString(text, 'text/xml');
	              } else {
	                var div = document.createElement('div');
	                div.innerHTML = text;
	                this.data = div;
	              }

	              this.type = Resource.TYPE.XML;
	            } catch (e) {
	              this.abort("Error trying to parse loaded xml: " + e);
	              return;
	            }
	          } // other types just return the response
	          else {
	              this.data = xhr.response || text;
	            }
	    } else {
	      this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL);
	      return;
	    }

	    this.complete();
	  }
	  /**
	   * Sets the `crossOrigin` property for this resource based on if the url
	   * for this resource is cross-origin. If crossOrigin was manually set, this
	   * function does nothing.
	   *
	   * @private
	   * @param {string} url - The url to test.
	   * @param {object} [loc=window.location] - The location object to test against.
	   * @return {string} The crossOrigin value to use (or empty string for none).
	   */
	  ;

	  _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) {
	    // data: and javascript: urls are considered same-origin
	    if (url.indexOf('data:') === 0) {
	      return '';
	    } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special
	    // origin designed not to match window.location.origin, and will always require
	    // crossOrigin requests regardless of whether the location matches.


	    if (window.origin !== window.location.origin) {
	      return 'anonymous';
	    } // default is window.location


	    loc = loc || window.location;

	    if (!tempAnchor$1) {
	      tempAnchor$1 = document.createElement('a');
	    } // let the browser determine the full href for the url of this resource and then
	    // parse with the node url lib, we can't use the properties of the anchor element
	    // because they don't work in IE9 :(


	    tempAnchor$1.href = url;
	    url = parseUri(tempAnchor$1.href, {
	      strictMode: true
	    });
	    var samePort = !url.port && loc.port === '' || url.port === loc.port;
	    var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin

	    if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {
	      return 'anonymous';
	    }

	    return '';
	  }
	  /**
	   * Determines the responseType of an XHR request based on the extension of the
	   * resource being loaded.
	   *
	   * @private
	   * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.
	   */
	  ;

	  _proto._determineXhrType = function _determineXhrType() {
	    return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;
	  }
	  /**
	   * Determines the loadType of a resource based on the extension of the
	   * resource being loaded.
	   *
	   * @private
	   * @return {Resource.LOAD_TYPE} The loadType to use.
	   */
	  ;

	  _proto._determineLoadType = function _determineLoadType() {
	    return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;
	  }
	  /**
	   * Extracts the extension (sans '.') of the file being loaded by the resource.
	   *
	   * @private
	   * @return {string} The extension.
	   */
	  ;

	  _proto._getExtension = function _getExtension() {
	    var url = this.url;
	    var ext = '';

	    if (this.isDataUrl) {
	      var slashIndex = url.indexOf('/');
	      ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));
	    } else {
	      var queryStart = url.indexOf('?');
	      var hashStart = url.indexOf('#');
	      var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length);
	      url = url.substring(0, index);
	      ext = url.substring(url.lastIndexOf('.') + 1);
	    }

	    return ext.toLowerCase();
	  }
	  /**
	   * Determines the mime type of an XHR request based on the responseType of
	   * resource being loaded.
	   *
	   * @private
	   * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.
	   * @return {string} The mime type to use.
	   */
	  ;

	  _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) {
	    switch (type) {
	      case Resource.XHR_RESPONSE_TYPE.BUFFER:
	        return 'application/octet-binary';

	      case Resource.XHR_RESPONSE_TYPE.BLOB:
	        return 'application/blob';

	      case Resource.XHR_RESPONSE_TYPE.DOCUMENT:
	        return 'application/xml';

	      case Resource.XHR_RESPONSE_TYPE.JSON:
	        return 'application/json';

	      case Resource.XHR_RESPONSE_TYPE.DEFAULT:
	      case Resource.XHR_RESPONSE_TYPE.TEXT:
	      /* falls through */

	      default:
	        return 'text/plain';
	    }
	  };

	  _createClass(Resource, [{
	    key: "isDataUrl",
	    get: function get() {
	      return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);
	    }
	    /**
	     * Describes if this resource has finished loading. Is true when the resource has completely
	     * loaded.
	     *
	     * @readonly
	     * @member {boolean}
	     */

	  }, {
	    key: "isComplete",
	    get: function get() {
	      return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);
	    }
	    /**
	     * Describes if this resource is currently loading. Is true when the resource starts loading,
	     * and is false again when complete.
	     *
	     * @readonly
	     * @member {boolean}
	     */

	  }, {
	    key: "isLoading",
	    get: function get() {
	      return this._hasFlag(Resource.STATUS_FLAGS.LOADING);
	    }
	  }]);

	  return Resource;
	}();
	/**
	 * The types of resources a resource could represent.
	 *
	 * @static
	 * @readonly
	 * @enum {number}
	 */


	Resource$1.STATUS_FLAGS = {
	  NONE: 0,
	  DATA_URL: 1 << 0,
	  COMPLETE: 1 << 1,
	  LOADING: 1 << 2
	};
	/**
	 * The types of resources a resource could represent.
	 *
	 * @static
	 * @readonly
	 * @enum {number}
	 */

	Resource$1.TYPE = {
	  UNKNOWN: 0,
	  JSON: 1,
	  XML: 2,
	  IMAGE: 3,
	  AUDIO: 4,
	  VIDEO: 5,
	  TEXT: 6
	};
	/**
	 * The types of loading a resource can use.
	 *
	 * @static
	 * @readonly
	 * @enum {number}
	 */

	Resource$1.LOAD_TYPE = {
	  /** Uses XMLHttpRequest to load the resource. */
	  XHR: 1,

	  /** Uses an `Image` object to load the resource. */
	  IMAGE: 2,

	  /** Uses an `Audio` object to load the resource. */
	  AUDIO: 3,

	  /** Uses a `Video` object to load the resource. */
	  VIDEO: 4
	};
	/**
	 * The XHR ready states, used internally.
	 *
	 * @static
	 * @readonly
	 * @enum {string}
	 */

	Resource$1.XHR_RESPONSE_TYPE = {
	  /** string */
	  DEFAULT: 'text',

	  /** ArrayBuffer */
	  BUFFER: 'arraybuffer',

	  /** Blob */
	  BLOB: 'blob',

	  /** Document */
	  DOCUMENT: 'document',

	  /** Object */
	  JSON: 'json',

	  /** String */
	  TEXT: 'text'
	};
	Resource$1._loadTypeMap = {
	  // images
	  gif: Resource$1.LOAD_TYPE.IMAGE,
	  png: Resource$1.LOAD_TYPE.IMAGE,
	  bmp: Resource$1.LOAD_TYPE.IMAGE,
	  jpg: Resource$1.LOAD_TYPE.IMAGE,
	  jpeg: Resource$1.LOAD_TYPE.IMAGE,
	  tif: Resource$1.LOAD_TYPE.IMAGE,
	  tiff: Resource$1.LOAD_TYPE.IMAGE,
	  webp: Resource$1.LOAD_TYPE.IMAGE,
	  tga: Resource$1.LOAD_TYPE.IMAGE,
	  svg: Resource$1.LOAD_TYPE.IMAGE,
	  'svg+xml': Resource$1.LOAD_TYPE.IMAGE,
	  // for SVG data urls
	  // audio
	  mp3: Resource$1.LOAD_TYPE.AUDIO,
	  ogg: Resource$1.LOAD_TYPE.AUDIO,
	  wav: Resource$1.LOAD_TYPE.AUDIO,
	  // videos
	  mp4: Resource$1.LOAD_TYPE.VIDEO,
	  webm: Resource$1.LOAD_TYPE.VIDEO
	};
	Resource$1._xhrTypeMap = {
	  // xml
	  xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.
	  // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,
	  // this should probably be fine.
	  tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,
	  // images
	  gif: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  png: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  tif: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  webp: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  tga: Resource$1.XHR_RESPONSE_TYPE.BLOB,
	  // json
	  json: Resource$1.XHR_RESPONSE_TYPE.JSON,
	  // text
	  text: Resource$1.XHR_RESPONSE_TYPE.TEXT,
	  txt: Resource$1.XHR_RESPONSE_TYPE.TEXT,
	  // fonts
	  ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER,
	  otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER
	}; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif

	Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
	/**
	 * Quick helper to set a value on one of the extension maps. Ensures there is no
	 * dot at the start of the extension.
	 *
	 * @ignore
	 * @param {object} map - The map to set on.
	 * @param {string} extname - The extension (or key) to set.
	 * @param {number} val - The value to set.
	 */

	function setExtMap(map, extname, val) {
	  if (extname && extname.indexOf('.') === 0) {
	    extname = extname.substring(1);
	  }

	  if (!extname) {
	    return;
	  }

	  map[extname] = val;
	}
	/**
	 * Quick helper to get string xhr type.
	 *
	 * @ignore
	 * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.
	 * @return {string} The type.
	 */


	function reqType(xhr) {
	  return xhr.toString().replace('object ', '');
	}

	var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
	/**
	 * Encodes binary into base64.
	 *
	 * @function encodeBinary
	 * @param {string} input The input data to encode.
	 * @returns {string} The encoded base64 string
	 */

	function encodeBinary(input) {
	  var output = '';
	  var inx = 0;

	  while (inx < input.length) {
	    // Fill byte buffer array
	    var bytebuffer = [0, 0, 0];
	    var encodedCharIndexes = [0, 0, 0, 0];

	    for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {
	      if (inx < input.length) {
	        // throw away high-order byte, as documented at:
	        // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data
	        bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;
	      } else {
	        bytebuffer[jnx] = 0;
	      }
	    } // Get each encoded character, 6 bits at a time
	    // index 1: first 6 bits


	    encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)

	    encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)

	    encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3)

	    encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly

	    var paddingBytes = inx - (input.length - 1);

	    switch (paddingBytes) {
	      case 2:
	        // Set last 2 characters to padding char
	        encodedCharIndexes[3] = 64;
	        encodedCharIndexes[2] = 64;
	        break;

	      case 1:
	        // Set last character to padding char
	        encodedCharIndexes[3] = 64;
	        break;

	      default:
	        break;
	      // No padding - proceed
	    } // Now we will grab each appropriate character out of our keystring
	    // based on our index array and append it to the output string


	    for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) {
	      output += _keyStr.charAt(encodedCharIndexes[_jnx]);
	    }
	  }

	  return output;
	}

	var Url$1 = window.URL || window.webkitURL;
	/**
	 * A middleware for transforming XHR loaded Blobs into more useful objects
	 *
	 * @memberof middleware
	 * @function parsing
	 * @example
	 * import { Loader, middleware } from 'resource-loader';
	 * const loader = new Loader();
	 * loader.use(middleware.parsing);
	 * @param {Resource} resource - Current Resource
	 * @param {function} next - Callback when complete
	 */

	function parsing(resource, next) {
	  if (!resource.data) {
	    next();
	    return;
	  } // if this was an XHR load of a blob


	  if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) {
	    // if there is no blob support we probably got a binary string back
	    if (!window.Blob || typeof resource.data === 'string') {
	      var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url

	      if (type && type.indexOf('image') === 0) {
	        resource.data = new Image();
	        resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText);
	        resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback

	        resource.data.onload = function () {
	          resource.data.onload = null;
	          next();
	        }; // next will be called on load


	        return;
	      }
	    } // if content type says this is an image, then we should transform the blob into an Image object
	    else if (resource.data.type.indexOf('image') === 0) {
	        var src = Url$1.createObjectURL(resource.data);
	        resource.blob = resource.data;
	        resource.data = new Image();
	        resource.data.src = src;
	        resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads
	        // TODO: Is this correct? Will the image be invalid after revoking?

	        resource.data.onload = function () {
	          Url$1.revokeObjectURL(src);
	          resource.data.onload = null;
	          next();
	        }; // next will be called on load.


	        return;
	      }
	  }

	  next();
	}

	/**
	 * @namespace middleware
	 */

	var index$1 = ({
	    caching: caching,
	    parsing: parsing
	});

	var MAX_PROGRESS = 100;
	var rgxExtractUrlHash = /(#[\w-]+)?$/;
	/**
	 * Manages the state and loading of multiple resources to load.
	 *
	 * @class
	 */

	var Loader =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.
	   * @param {number} [concurrency=10] - The number of resources to load concurrently.
	   */
	  function Loader(baseUrl, concurrency) {
	    var _this = this;

	    if (baseUrl === void 0) {
	      baseUrl = '';
	    }

	    if (concurrency === void 0) {
	      concurrency = 10;
	    }

	    /**
	     * The base url for all resources loaded by this loader.
	     *
	     * @member {string}
	     */
	    this.baseUrl = baseUrl;
	    /**
	     * The progress percent of the loader going through the queue.
	     *
	     * @member {number}
	     * @default 0
	     */

	    this.progress = 0;
	    /**
	     * Loading state of the loader, true if it is currently loading resources.
	     *
	     * @member {boolean}
	     * @default false
	     */

	    this.loading = false;
	    /**
	     * A querystring to append to every URL added to the loader.
	     *
	     * This should be a valid query string *without* the question-mark (`?`). The loader will
	     * also *not* escape values for you. Make sure to escape your parameters with
	     * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.
	     *
	     * @example
	     * const loader = new Loader();
	     *
	     * loader.defaultQueryString = 'user=me&password=secret';
	     *
	     * // This will request 'image.png?user=me&password=secret'
	     * loader.add('image.png').load();
	     *
	     * loader.reset();
	     *
	     * // This will request 'image.png?v=1&user=me&password=secret'
	     * loader.add('iamge.png?v=1').load();
	     *
	     * @member {string}
	     * @default ''
	     */

	    this.defaultQueryString = '';
	    /**
	     * The middleware to run before loading each resource.
	     *
	     * @private
	     * @member {function[]}
	     */

	    this._beforeMiddleware = [];
	    /**
	     * The middleware to run after loading each resource.
	     *
	     * @private
	     * @member {function[]}
	     */

	    this._afterMiddleware = [];
	    /**
	     * The tracks the resources we are currently completing parsing for.
	     *
	     * @private
	     * @member {Resource[]}
	     */

	    this._resourcesParsing = [];
	    /**
	     * The `_loadResource` function bound with this object context.
	     *
	     * @private
	     * @member {function}
	     * @param {Resource} r - The resource to load
	     * @param {Function} d - The dequeue function
	     * @return {undefined}
	     */

	    this._boundLoadResource = function (r, d) {
	      return _this._loadResource(r, d);
	    };
	    /**
	     * The resources waiting to be loaded.
	     *
	     * @private
	     * @member {Resource[]}
	     */


	    this._queue = queue(this._boundLoadResource, concurrency);

	    this._queue.pause();
	    /**
	     * All the resources for this loader keyed by name.
	     *
	     * @member {object<string, Resource>}
	     */


	    this.resources = {};
	    /**
	     * Dispatched once per loaded or errored resource.
	     *
	     * The callback looks like {@link Loader.OnProgressSignal}.
	     *
	     * @member {Signal<Loader.OnProgressSignal>}
	     */

	    this.onProgress = new Signal();
	    /**
	     * Dispatched once per errored resource.
	     *
	     * The callback looks like {@link Loader.OnErrorSignal}.
	     *
	     * @member {Signal<Loader.OnErrorSignal>}
	     */

	    this.onError = new Signal();
	    /**
	     * Dispatched once per loaded resource.
	     *
	     * The callback looks like {@link Loader.OnLoadSignal}.
	     *
	     * @member {Signal<Loader.OnLoadSignal>}
	     */

	    this.onLoad = new Signal();
	    /**
	     * Dispatched when the loader begins to process the queue.
	     *
	     * The callback looks like {@link Loader.OnStartSignal}.
	     *
	     * @member {Signal<Loader.OnStartSignal>}
	     */

	    this.onStart = new Signal();
	    /**
	     * Dispatched when the queued resources all load.
	     *
	     * The callback looks like {@link Loader.OnCompleteSignal}.
	     *
	     * @member {Signal<Loader.OnCompleteSignal>}
	     */

	    this.onComplete = new Signal(); // Add default before middleware

	    for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {
	      this.pre(Loader._defaultBeforeMiddleware[i]);
	    } // Add default after middleware


	    for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) {
	      this.use(Loader._defaultAfterMiddleware[_i]);
	    }
	  }
	  /**
	   * When the progress changes the loader and resource are disaptched.
	   *
	   * @memberof Loader
	   * @callback OnProgressSignal
	   * @param {Loader} loader - The loader the progress is advancing on.
	   * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.
	   */

	  /**
	   * When an error occurrs the loader and resource are disaptched.
	   *
	   * @memberof Loader
	   * @callback OnErrorSignal
	   * @param {Loader} loader - The loader the error happened in.
	   * @param {Resource} resource - The resource that caused the error.
	   */

	  /**
	   * When a load completes the loader and resource are disaptched.
	   *
	   * @memberof Loader
	   * @callback OnLoadSignal
	   * @param {Loader} loader - The loader that laoded the resource.
	   * @param {Resource} resource - The resource that has completed loading.
	   */

	  /**
	   * When the loader starts loading resources it dispatches this callback.
	   *
	   * @memberof Loader
	   * @callback OnStartSignal
	   * @param {Loader} loader - The loader that has started loading resources.
	   */

	  /**
	   * When the loader completes loading resources it dispatches this callback.
	   *
	   * @memberof Loader
	   * @callback OnCompleteSignal
	   * @param {Loader} loader - The loader that has finished loading resources.
	   */

	  /**
	   * Options for a call to `.add()`.
	   *
	   * @see Loader#add
	   *
	   * @typedef {object} IAddOptions
	   * @property {string} [name] - The name of the resource to load, if not passed the url is used.
	   * @property {string} [key] - Alias for `name`.
	   * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.
	   * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to
	   *      determine automatically.
	   * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes
	   *      longer than this time it is cancelled and the load is considered a failure. If this value is
	   *      set to `0` then there is no explicit timeout.
	   * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource
	   *      be loaded?
	   * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How
	   *      should the data being loaded be interpreted when using XHR?
	   * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.
	   * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.
	   * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.
	   */

	  /* eslint-disable require-jsdoc,valid-jsdoc */

	  /**
	   * Adds a resource (or multiple resources) to the loader queue.
	   *
	   * This function can take a wide variety of different parameters. The only thing that is always
	   * required the url to load. All the following will work:
	   *
	   * ```js
	   * loader
	   *     // normal param syntax
	   *     .add('key', 'http://...', function () {})
	   *     .add('http://...', function () {})
	   *     .add('http://...')
	   *
	   *     // object syntax
	   *     .add({
	   *         name: 'key2',
	   *         url: 'http://...'
	   *     }, function () {})
	   *     .add({
	   *         url: 'http://...'
	   *     }, function () {})
	   *     .add({
	   *         name: 'key3',
	   *         url: 'http://...'
	   *         onComplete: function () {}
	   *     })
	   *     .add({
	   *         url: 'https://...',
	   *         onComplete: function () {},
	   *         crossOrigin: true
	   *     })
	   *
	   *     // you can also pass an array of objects or urls or both
	   *     .add([
	   *         { name: 'key4', url: 'http://...', onComplete: function () {} },
	   *         { url: 'http://...', onComplete: function () {} },
	   *         'http://...'
	   *     ])
	   *
	   *     // and you can use both params and options
	   *     .add('key', 'http://...', { crossOrigin: true }, function () {})
	   *     .add('http://...', { crossOrigin: true }, function () {});
	   * ```
	   *
	   * @function
	   * @variation 1
	   * @param {string} name - The name of the resource to load.
	   * @param {string} url - The url for this resource, relative to the baseUrl of this loader.
	   * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	   * @return {this} Returns itself.
	   */

	  /**
	  * @function
	  * @variation 2
	  * @param {string} name - The name of the resource to load.
	  * @param {string} url - The url for this resource, relative to the baseUrl of this loader.
	  * @param {IAddOptions} [options] - The options for the load.
	  * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	  * @return {this} Returns itself.
	  */

	  /**
	  * @function
	  * @variation 3
	  * @param {string} url - The url for this resource, relative to the baseUrl of this loader.
	  * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	  * @return {this} Returns itself.
	  */

	  /**
	  * @function
	  * @variation 4
	  * @param {string} url - The url for this resource, relative to the baseUrl of this loader.
	  * @param {IAddOptions} [options] - The options for the load.
	  * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	  * @return {this} Returns itself.
	  */

	  /**
	  * @function
	  * @variation 5
	  * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.
	  * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	  * @return {this} Returns itself.
	  */

	  /**
	  * @function
	  * @variation 6
	  * @param {Array<IAddOptions|string>} resources - An array of resources to load, where each is
	  *      either an object with the options or a string url. If you pass an object, it must contain a `url` property.
	  * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.
	  * @return {this} Returns itself.
	  */


	  var _proto = Loader.prototype;

	  _proto.add = function add(name, url, options, cb) {
	    // special case of an array of objects or urls
	    if (Array.isArray(name)) {
	      for (var i = 0; i < name.length; ++i) {
	        this.add(name[i]);
	      }

	      return this;
	    } // if an object is passed instead of params


	    if (typeof name === 'object') {
	      cb = url || name.callback || name.onComplete;
	      options = name;
	      url = name.url;
	      name = name.name || name.key || name.url;
	    } // case where no name is passed shift all args over by one.


	    if (typeof url !== 'string') {
	      cb = options;
	      options = url;
	      url = name;
	    } // now that we shifted make sure we have a proper url.


	    if (typeof url !== 'string') {
	      throw new Error('No url passed to add resource to loader.');
	    } // options are optional so people might pass a function and no options


	    if (typeof options === 'function') {
	      cb = options;
	      options = null;
	    } // if loading already you can only add resources that have a parent.


	    if (this.loading && (!options || !options.parentResource)) {
	      throw new Error('Cannot add resources while the loader is running.');
	    } // check if resource already exists.


	    if (this.resources[name]) {
	      throw new Error("Resource named \"" + name + "\" already exists.");
	    } // add base url if this isn't an absolute url


	    url = this._prepareUrl(url); // create the store the resource

	    this.resources[name] = new Resource$1(name, url, options);

	    if (typeof cb === 'function') {
	      this.resources[name].onAfterMiddleware.once(cb);
	    } // if actively loading, make sure to adjust progress chunks for that parent and its children


	    if (this.loading) {
	      var parent = options.parentResource;
	      var incompleteChildren = [];

	      for (var _i2 = 0; _i2 < parent.children.length; ++_i2) {
	        if (!parent.children[_i2].isComplete) {
	          incompleteChildren.push(parent.children[_i2]);
	        }
	      }

	      var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent

	      var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child

	      parent.children.push(this.resources[name]);
	      parent.progressChunk = eachChunk;

	      for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) {
	        incompleteChildren[_i3].progressChunk = eachChunk;
	      }

	      this.resources[name].progressChunk = eachChunk;
	    } // add the resource to the queue


	    this._queue.push(this.resources[name]);

	    return this;
	  }
	  /* eslint-enable require-jsdoc,valid-jsdoc */

	  /**
	   * Sets up a middleware function that will run *before* the
	   * resource is loaded.
	   *
	   * @param {function} fn - The middleware function to register.
	   * @return {this} Returns itself.
	   */
	  ;

	  _proto.pre = function pre(fn) {
	    this._beforeMiddleware.push(fn);

	    return this;
	  }
	  /**
	   * Sets up a middleware function that will run *after* the
	   * resource is loaded.
	   *
	   * @param {function} fn - The middleware function to register.
	   * @return {this} Returns itself.
	   */
	  ;

	  _proto.use = function use(fn) {
	    this._afterMiddleware.push(fn);

	    return this;
	  }
	  /**
	   * Resets the queue of the loader to prepare for a new load.
	   *
	   * @return {this} Returns itself.
	   */
	  ;

	  _proto.reset = function reset() {
	    this.progress = 0;
	    this.loading = false;

	    this._queue.kill();

	    this._queue.pause(); // abort all resource loads


	    for (var k in this.resources) {
	      var res = this.resources[k];

	      if (res._onLoadBinding) {
	        res._onLoadBinding.detach();
	      }

	      if (res.isLoading) {
	        res.abort();
	      }
	    }

	    this.resources = {};
	    return this;
	  }
	  /**
	   * Starts loading the queued resources.
	   *
	   * @param {function} [cb] - Optional callback that will be bound to the `complete` event.
	   * @return {this} Returns itself.
	   */
	  ;

	  _proto.load = function load(cb) {
	    // register complete callback if they pass one
	    if (typeof cb === 'function') {
	      this.onComplete.once(cb);
	    } // if the queue has already started we are done here


	    if (this.loading) {
	      return this;
	    }

	    if (this._queue.idle()) {
	      this._onStart();

	      this._onComplete();
	    } else {
	      // distribute progress chunks
	      var numTasks = this._queue._tasks.length;
	      var chunk = MAX_PROGRESS / numTasks;

	      for (var i = 0; i < this._queue._tasks.length; ++i) {
	        this._queue._tasks[i].data.progressChunk = chunk;
	      } // notify we are starting


	      this._onStart(); // start loading


	      this._queue.resume();
	    }

	    return this;
	  }
	  /**
	   * The number of resources to load concurrently.
	   *
	   * @member {number}
	   * @default 10
	   */
	  ;

	  /**
	   * Prepares a url for usage based on the configuration of this object
	   *
	   * @private
	   * @param {string} url - The url to prepare.
	   * @return {string} The prepared url.
	   */
	  _proto._prepareUrl = function _prepareUrl(url) {
	    var parsedUrl = parseUri(url, {
	      strictMode: true
	    });
	    var result; // absolute url, just use it as is.

	    if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {
	      result = url;
	    } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween
	    else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') {
	        result = this.baseUrl + "/" + url;
	      } else {
	        result = this.baseUrl + url;
	      } // if we need to add a default querystring, there is a bit more work


	    if (this.defaultQueryString) {
	      var hash = rgxExtractUrlHash.exec(result)[0];
	      result = result.substr(0, result.length - hash.length);

	      if (result.indexOf('?') !== -1) {
	        result += "&" + this.defaultQueryString;
	      } else {
	        result += "?" + this.defaultQueryString;
	      }

	      result += hash;
	    }

	    return result;
	  }
	  /**
	   * Loads a single resource.
	   *
	   * @private
	   * @param {Resource} resource - The resource to load.
	   * @param {function} dequeue - The function to call when we need to dequeue this item.
	   */
	  ;

	  _proto._loadResource = function _loadResource(resource, dequeue) {
	    var _this2 = this;

	    resource._dequeue = dequeue; // run before middleware

	    eachSeries(this._beforeMiddleware, function (fn, next) {
	      fn.call(_this2, resource, function () {
	        // if the before middleware marks the resource as complete,
	        // break and don't process any more before middleware
	        next(resource.isComplete ? {} : null);
	      });
	    }, function () {
	      if (resource.isComplete) {
	        _this2._onLoad(resource);
	      } else {
	        resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2);
	        resource.load();
	      }
	    }, true);
	  }
	  /**
	   * Called once loading has started.
	   *
	   * @private
	   */
	  ;

	  _proto._onStart = function _onStart() {
	    this.progress = 0;
	    this.loading = true;
	    this.onStart.dispatch(this);
	  }
	  /**
	   * Called once each resource has loaded.
	   *
	   * @private
	   */
	  ;

	  _proto._onComplete = function _onComplete() {
	    this.progress = MAX_PROGRESS;
	    this.loading = false;
	    this.onComplete.dispatch(this, this.resources);
	  }
	  /**
	   * Called each time a resources is loaded.
	   *
	   * @private
	   * @param {Resource} resource - The resource that was loaded
	   */
	  ;

	  _proto._onLoad = function _onLoad(resource) {
	    var _this3 = this;

	    resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed

	    this._resourcesParsing.push(resource);

	    resource._dequeue(); // run all the after middleware for this resource


	    eachSeries(this._afterMiddleware, function (fn, next) {
	      fn.call(_this3, resource, next);
	    }, function () {
	      resource.onAfterMiddleware.dispatch(resource);
	      _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk);

	      _this3.onProgress.dispatch(_this3, resource);

	      if (resource.error) {
	        _this3.onError.dispatch(resource.error, _this3, resource);
	      } else {
	        _this3.onLoad.dispatch(_this3, resource);
	      }

	      _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check


	      if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) {
	        _this3._onComplete();
	      }
	    }, true);
	  };

	  _createClass(Loader, [{
	    key: "concurrency",
	    get: function get() {
	      return this._queue.concurrency;
	    } // eslint-disable-next-line require-jsdoc
	    ,
	    set: function set(concurrency) {
	      this._queue.concurrency = concurrency;
	    }
	  }]);

	  return Loader;
	}();
	/**
	 * A default array of middleware to run before loading each resource.
	 * Each of these middlewares are added to any new Loader instances when they are created.
	 *
	 * @private
	 * @member {function[]}
	 */


	Loader._defaultBeforeMiddleware = [];
	/**
	 * A default array of middleware to run after loading each resource.
	 * Each of these middlewares are added to any new Loader instances when they are created.
	 *
	 * @private
	 * @member {function[]}
	 */

	Loader._defaultAfterMiddleware = [];
	/**
	 * Sets up a middleware function that will run *before* the
	 * resource is loaded.
	 *
	 * @static
	 * @param {function} fn - The middleware function to register.
	 * @return {Loader} Returns itself.
	 */

	Loader.pre = function LoaderPreStatic(fn) {
	  Loader._defaultBeforeMiddleware.push(fn);

	  return Loader;
	};
	/**
	 * Sets up a middleware function that will run *after* the
	 * resource is loaded.
	 *
	 * @static
	 * @param {function} fn - The middleware function to register.
	 * @return {Loader} Returns itself.
	 */


	Loader.use = function LoaderUseStatic(fn) {
	  Loader._defaultAfterMiddleware.push(fn);

	  return Loader;
	};

	/*!
	 * @pixi/loaders - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/loaders is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Loader plugin for handling Texture resources.
	 * @class
	 * @memberof PIXI
	 * @implements PIXI.ILoaderPlugin
	 */
	var TextureLoader = function TextureLoader () {};

	TextureLoader.use = function use (resource, next)
	{
	    // create a new texture if the data is an Image object
	    if (resource.data && resource.type === Resource$1.TYPE.IMAGE)
	    {
	        resource.texture = Texture.fromLoader(
	            resource.data,
	            resource.url,
	            resource.name
	        );
	    }
	    next();
	};

	/**
	 * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader
	 *
	 * ```js
	 * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.
	 * //or
	 * const loader = new PIXI.Loader(); // you can also create your own if you want
	 *
	 * const sprites = {};
	 *
	 * // Chainable `add` to enqueue a resource
	 * loader.add('bunny', 'data/bunny.png')
	 *       .add('spaceship', 'assets/spritesheet.json');
	 * loader.add('scoreFont', 'assets/score.fnt');
	 *
	 * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.
	 * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).
	 * loader.pre(cachingMiddleware);
	 *
	 * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.
	 * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).
	 * loader.use(parsingMiddleware);
	 *
	 * // The `load` method loads the queue of resources, and calls the passed in callback called once all
	 * // resources have loaded.
	 * loader.load((loader, resources) => {
	 *     // resources is an object where the key is the name of the resource loaded and the value is the resource object.
	 *     // They have a couple default properties:
	 *     // - `url`: The URL that the resource was loaded from
	 *     // - `error`: The error that happened when trying to load (if any)
	 *     // - `data`: The raw data that was loaded
	 *     // also may contain other properties based on the middleware that runs.
	 *     sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);
	 *     sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);
	 *     sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);
	 * });
	 *
	 * // throughout the process multiple signals can be dispatched.
	 * loader.onProgress.add(() => {}); // called once per loaded/errored file
	 * loader.onError.add(() => {}); // called once per errored file
	 * loader.onLoad.add(() => {}); // called once per loaded file
	 * loader.onComplete.add(() => {}); // called once when the queued resources all load.
	 * ```
	 *
	 * @see https://github.com/englercj/resource-loader
	 *
	 * @class Loader
	 * @memberof PIXI
	 * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.
	 * @param {number} [concurrency=10] - The number of resources to load concurrently.
	 */
	var Loader$1 = /*@__PURE__*/(function (ResourceLoader) {
	    function Loader(baseUrl, concurrency)
	    {
	        var this$1 = this;

	        ResourceLoader.call(this, baseUrl, concurrency);
	        eventemitter3.call(this);

	        for (var i = 0; i < Loader._plugins.length; ++i)
	        {
	            var plugin = Loader._plugins[i];
	            var pre = plugin.pre;
	            var use = plugin.use;

	            if (pre)
	            {
	                this.pre(pre);
	            }

	            if (use)
	            {
	                this.use(use);
	            }
	        }

	        // Compat layer, translate the new v2 signals into old v1 events.
	        this.onStart.add(function (l) { return this$1.emit('start', l); });
	        this.onProgress.add(function (l, r) { return this$1.emit('progress', l, r); });
	        this.onError.add(function (e, l, r) { return this$1.emit('error', e, l, r); });
	        this.onLoad.add(function (l, r) { return this$1.emit('load', l, r); });
	        this.onComplete.add(function (l, r) { return this$1.emit('complete', l, r); });

	        /**
	         * If this loader cannot be destroyed.
	         * @member {boolean}
	         * @default false
	         * @private
	         */
	        this._protected = false;
	    }

	    if ( ResourceLoader ) { Loader.__proto__ = ResourceLoader; }
	    Loader.prototype = Object.create( ResourceLoader && ResourceLoader.prototype );
	    Loader.prototype.constructor = Loader;

	    var staticAccessors = { shared: { configurable: true } };

	    /**
	     * Destroy the loader, removes references.
	     * @private
	     */
	    Loader.prototype.destroy = function destroy ()
	    {
	        if (!this._protected)
	        {
	            this.removeAllListeners();
	            this.reset();
	        }
	    };

	    /**
	     * A premade instance of the loader that can be used to load resources.
	     * @name shared
	     * @type {PIXI.Loader}
	     * @static
	     * @memberof PIXI.Loader
	     */
	    staticAccessors.shared.get = function ()
	    {
	        var shared = Loader._shared;

	        if (!shared)
	        {
	            shared = new Loader();
	            shared._protected = true;
	            Loader._shared = shared;
	        }

	        return shared;
	    };

	    Object.defineProperties( Loader, staticAccessors );

	    return Loader;
	}(Loader));

	// Copy EE3 prototype (mixin)
	Object.assign(Loader$1.prototype, eventemitter3.prototype);

	/**
	 * Collection of all installed `use` middleware for Loader.
	 *
	 * @static
	 * @member {Array<PIXI.ILoaderPlugin>} _plugins
	 * @memberof PIXI.Loader
	 * @private
	 */
	Loader$1._plugins = [];

	/**
	 * Adds a Loader plugin for the global shared loader and all
	 * new Loader instances created.
	 *
	 * @static
	 * @method registerPlugin
	 * @memberof PIXI.Loader
	 * @param {PIXI.ILoaderPlugin} plugin - The plugin to add
	 * @return {PIXI.Loader} Reference to PIXI.Loader for chaining
	 */
	Loader$1.registerPlugin = function registerPlugin(plugin)
	{
	    Loader$1._plugins.push(plugin);

	    if (plugin.add)
	    {
	        plugin.add();
	    }

	    return Loader$1;
	};

	// parse any blob into more usable objects (e.g. Image)
	Loader$1.registerPlugin({ use: index$1.parsing });

	// parse any Image objects into textures
	Loader$1.registerPlugin(TextureLoader);

	/**
	 * Plugin to be installed for handling specific Loader resources.
	 *
	 * @memberof PIXI
	 * @typedef ILoaderPlugin
	 * @property {function} [add] - Function to call immediate after registering plugin.
	 * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the
	 *           arguments for this are `(resource, next)`
	 * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the
	 *           arguments for this are `(resource, next)`
	 */

	/**
	 * @memberof PIXI.Loader
	 * @callback loaderMiddleware
	 * @param {PIXI.LoaderResource} resource
	 * @param {function} next
	 */

	/**
	 * @memberof PIXI.Loader#
	 * @member {object} onStart
	 */

	/**
	 * @memberof PIXI.Loader#
	 * @member {object} onProgress
	 */

	/**
	 * @memberof PIXI.Loader#
	 * @member {object} onError
	 */

	/**
	 * @memberof PIXI.Loader#
	 * @member {object} onLoad
	 */

	/**
	 * @memberof PIXI.Loader#
	 * @member {object} onComplete
	 */

	/**
	 * Application plugin for supporting loader option. Installing the LoaderPlugin
	 * is not necessary if using **pixi.js** or **pixi.js-legacy**.
	 * @example
	 * import {AppLoaderPlugin} from '@pixi/loaders';
	 * import {Application} from '@pixi/app';
	 * Application.registerPlugin(AppLoaderPlugin);
	 * @class
	 * @memberof PIXI
	 */
	var AppLoaderPlugin = function AppLoaderPlugin () {};

	AppLoaderPlugin.init = function init (options)
	{
	    options = Object.assign({
	        sharedLoader: false,
	    }, options);

	    /**
	     * Loader instance to help with asset loading.
	     * @name PIXI.Application#loader
	     * @type {PIXI.Loader}
	     * @readonly
	     */
	    this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1();
	};

	/**
	 * Called when application destroyed
	 * @private
	 */
	AppLoaderPlugin.destroy = function destroy ()
	{
	    if (this.loader)
	    {
	        this.loader.destroy();
	        this.loader = null;
	    }
	};

	/**
	 * Reference to **{@link https://github.com/englercj/resource-loader
	 * resource-loader}**'s Resource class.
	 * @see http://englercj.github.io/resource-loader/Resource.html
	 * @class LoaderResource
	 * @memberof PIXI
	 */
	var LoaderResource = Resource$1;

	/*!
	 * @pixi/particles - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/particles is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * The ParticleContainer class is a really fast version of the Container built solely for speed,
	 * so use when you need a lot of sprites or particles.
	 *
	 * The tradeoff of the ParticleContainer is that most advanced functionality will not work.
	 * ParticleContainer implements the basic object transform (position, scale, rotation)
	 * and some advanced functionality like tint (as of v4.5.6).
	 *
	 * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.
	 *
	 * It's extremely easy to use:
	 * ```js
	 * let container = new ParticleContainer();
	 *
	 * for (let i = 0; i < 100; ++i)
	 * {
	 *     let sprite = PIXI.Sprite.from("myImage.png");
	 *     container.addChild(sprite);
	 * }
	 * ```
	 *
	 * And here you have a hundred sprites that will be rendered at the speed of light.
	 *
	 * @class
	 * @extends PIXI.Container
	 * @memberof PIXI
	 */
	var ParticleContainer = /*@__PURE__*/(function (Container) {
	    function ParticleContainer(maxSize, properties, batchSize, autoResize)
	    {
	        if ( maxSize === void 0 ) { maxSize = 1500; }
	        if ( batchSize === void 0 ) { batchSize = 16384; }
	        if ( autoResize === void 0 ) { autoResize = false; }

	        Container.call(this);

	        // Making sure the batch size is valid
	        // 65535 is max vertex index in the index buffer (see ParticleRenderer)
	        // so max number of particles is 65536 / 4 = 16384
	        var maxBatchSize = 16384;

	        if (batchSize > maxBatchSize)
	        {
	            batchSize = maxBatchSize;
	        }

	        /**
	         * Set properties to be dynamic (true) / static (false)
	         *
	         * @member {boolean[]}
	         * @private
	         */
	        this._properties = [false, true, false, false, false];

	        /**
	         * @member {number}
	         * @private
	         */
	        this._maxSize = maxSize;

	        /**
	         * @member {number}
	         * @private
	         */
	        this._batchSize = batchSize;

	        /**
	         * @member {Array<PIXI.Buffer>}
	         * @private
	         */
	        this._buffers = null;

	        /**
	         * for every batch stores _updateID corresponding to the last change in that batch
	         * @member {number[]}
	         * @private
	         */
	        this._bufferUpdateIDs = [];

	        /**
	         * when child inserted, removed or changes position this number goes up
	         * @member {number[]}
	         * @private
	         */
	        this._updateID = 0;

	        /**
	         * @member {boolean}
	         *
	         */
	        this.interactiveChildren = false;

	        /**
	         * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`
	         * to reset the blend mode.
	         *
	         * @member {number}
	         * @default PIXI.BLEND_MODES.NORMAL
	         * @see PIXI.BLEND_MODES
	         */
	        this.blendMode = BLEND_MODES.NORMAL;

	        /**
	         * If true, container allocates more batches in case there are more than `maxSize` particles.
	         * @member {boolean}
	         * @default false
	         */
	        this.autoResize = autoResize;

	        /**
	         * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
	         * Advantages can include sharper image quality (like text) and faster rendering on canvas.
	         * The main disadvantage is movement of objects may appear less smooth.
	         * Default to true here as performance is usually the priority for particles.
	         *
	         * @member {boolean}
	         * @default true
	         */
	        this.roundPixels = true;

	        /**
	         * The texture used to render the children.
	         *
	         * @readonly
	         * @member {PIXI.BaseTexture}
	         */
	        this.baseTexture = null;

	        this.setProperties(properties);

	        /**
	         * The tint applied to the container.
	         * This is a hex value. A value of 0xFFFFFF will remove any tint effect.
	         *
	         * @private
	         * @member {number}
	         * @default 0xFFFFFF
	         */
	        this._tint = 0;
	        this.tintRgb = new Float32Array(4);
	        this.tint = 0xFFFFFF;
	    }

	    if ( Container ) { ParticleContainer.__proto__ = Container; }
	    ParticleContainer.prototype = Object.create( Container && Container.prototype );
	    ParticleContainer.prototype.constructor = ParticleContainer;

	    var prototypeAccessors = { tint: { configurable: true } };

	    /**
	     * Sets the private properties array to dynamic / static based on the passed properties object
	     *
	     * @param {object} properties - The properties to be uploaded
	     */
	    ParticleContainer.prototype.setProperties = function setProperties (properties)
	    {
	        if (properties)
	        {
	            this._properties[0] = 'vertices' in properties || 'scale' in properties
	                ? !!properties.vertices || !!properties.scale : this._properties[0];
	            this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];
	            this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];
	            this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];
	            this._properties[4] = 'tint' in properties || 'alpha' in properties
	                ? !!properties.tint || !!properties.alpha : this._properties[4];
	        }
	    };

	    /**
	     * Updates the object transform for rendering
	     *
	     * @private
	     */
	    ParticleContainer.prototype.updateTransform = function updateTransform ()
	    {
	        // TODO don't need to!
	        this.displayObjectUpdateTransform();
	        //  PIXI.Container.prototype.updateTransform.call( this );
	    };

	    /**
	     * The tint applied to the container. This is a hex value.
	     * A value of 0xFFFFFF will remove any tint effect.
	     ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.
	     * @member {number}
	     * @default 0xFFFFFF
	     */
	    prototypeAccessors.tint.get = function ()
	    {
	        return this._tint;
	    };

	    prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._tint = value;
	        hex2rgb(value, this.tintRgb);
	    };

	    /**
	     * Renders the container using the WebGL renderer
	     *
	     * @private
	     * @param {PIXI.Renderer} renderer - The webgl renderer
	     */
	    ParticleContainer.prototype.render = function render (renderer)
	    {
	        var this$1 = this;

	        if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)
	        {
	            return;
	        }

	        if (!this.baseTexture)
	        {
	            this.baseTexture = this.children[0]._texture.baseTexture;
	            if (!this.baseTexture.valid)
	            {
	                this.baseTexture.once('update', function () { return this$1.onChildrenChange(0); });
	            }
	        }

	        renderer.batch.setObjectRenderer(renderer.plugins.particle);
	        renderer.plugins.particle.render(this);
	    };

	    /**
	     * Set the flag that static data should be updated to true
	     *
	     * @private
	     * @param {number} smallestChildIndex - The smallest child index
	     */
	    ParticleContainer.prototype.onChildrenChange = function onChildrenChange (smallestChildIndex)
	    {
	        var bufferIndex = Math.floor(smallestChildIndex / this._batchSize);

	        while (this._bufferUpdateIDs.length < bufferIndex)
	        {
	            this._bufferUpdateIDs.push(0);
	        }
	        this._bufferUpdateIDs[bufferIndex] = ++this._updateID;
	    };

	    ParticleContainer.prototype.dispose = function dispose ()
	    {
	        if (this._buffers)
	        {
	            for (var i = 0; i < this._buffers.length; ++i)
	            {
	                this._buffers[i].destroy();
	            }

	            this._buffers = null;
	        }
	    };

	    /**
	     * Destroys the container
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have their
	     *  destroy method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the texture of the child sprite
	     * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
	     *  Should it destroy the base texture of the child sprite
	     */
	    ParticleContainer.prototype.destroy = function destroy (options)
	    {
	        Container.prototype.destroy.call(this, options);

	        this.dispose();

	        this._properties = null;
	        this._buffers = null;
	        this._bufferUpdateIDs = null;
	    };

	    Object.defineProperties( ParticleContainer.prototype, prototypeAccessors );

	    return ParticleContainer;
	}(Container));

	/**
	 * @author Mat Groves
	 *
	 * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/
	 * for creating the original PixiJS version!
	 * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that
	 * they now share 4 bytes on the vertex buffer
	 *
	 * Heavily inspired by LibGDX's ParticleBuffer:
	 * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java
	 */

	/**
	 * The particle buffer manages the static and dynamic buffers for a particle container.
	 *
	 * @class
	 * @private
	 * @memberof PIXI
	 */
	var ParticleBuffer = function ParticleBuffer(properties, dynamicPropertyFlags, size)
	{
	    this.geometry = new Geometry();

	    this.indexBuffer = null;

	    /**
	     * The number of particles the buffer can hold
	     *
	     * @private
	     * @member {number}
	     */
	    this.size = size;

	    /**
	     * A list of the properties that are dynamic.
	     *
	     * @private
	     * @member {object[]}
	     */
	    this.dynamicProperties = [];

	    /**
	     * A list of the properties that are static.
	     *
	     * @private
	     * @member {object[]}
	     */
	    this.staticProperties = [];

	    for (var i = 0; i < properties.length; ++i)
	    {
	        var property = properties[i];

	        // Make copy of properties object so that when we edit the offset it doesn't
	        // change all other instances of the object literal
	        property = {
	            attributeName: property.attributeName,
	            size: property.size,
	            uploadFunction: property.uploadFunction,
	            type: property.type || TYPES.FLOAT,
	            offset: property.offset,
	        };

	        if (dynamicPropertyFlags[i])
	        {
	            this.dynamicProperties.push(property);
	        }
	        else
	        {
	            this.staticProperties.push(property);
	        }
	    }

	    this.staticStride = 0;
	    this.staticBuffer = null;
	    this.staticData = null;
	    this.staticDataUint32 = null;

	    this.dynamicStride = 0;
	    this.dynamicBuffer = null;
	    this.dynamicData = null;
	    this.dynamicDataUint32 = null;

	    this._updateID = 0;

	    this.initBuffers();
	};

	/**
	 * Sets up the renderer context and necessary buffers.
	 *
	 * @private
	 */
	ParticleBuffer.prototype.initBuffers = function initBuffers ()
	{
	    var geometry = this.geometry;

	    var dynamicOffset = 0;

	    /**
	     * Holds the indices of the geometry (quads) to draw
	     *
	     * @member {Uint16Array}
	     * @private
	     */
	    this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);
	    geometry.addIndex(this.indexBuffer);

	    this.dynamicStride = 0;

	    for (var i = 0; i < this.dynamicProperties.length; ++i)
	    {
	        var property = this.dynamicProperties[i];

	        property.offset = dynamicOffset;
	        dynamicOffset += property.size;
	        this.dynamicStride += property.size;
	    }

	    var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);

	    this.dynamicData = new Float32Array(dynBuffer);
	    this.dynamicDataUint32 = new Uint32Array(dynBuffer);
	    this.dynamicBuffer = new Buffer(this.dynamicData, false, false);

	    // static //
	    var staticOffset = 0;

	    this.staticStride = 0;

	    for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1)
	    {
	        var property$1 = this.staticProperties[i$1];

	        property$1.offset = staticOffset;
	        staticOffset += property$1.size;
	        this.staticStride += property$1.size;
	    }

	    var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);

	    this.staticData = new Float32Array(statBuffer);
	    this.staticDataUint32 = new Uint32Array(statBuffer);
	    this.staticBuffer = new Buffer(this.staticData, true, false);

	    for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2)
	    {
	        var property$2 = this.dynamicProperties[i$2];

	        geometry.addAttribute(
	            property$2.attributeName,
	            this.dynamicBuffer,
	            0,
	            property$2.type === TYPES.UNSIGNED_BYTE,
	            property$2.type,
	            this.dynamicStride * 4,
	            property$2.offset * 4
	        );
	    }

	    for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3)
	    {
	        var property$3 = this.staticProperties[i$3];

	        geometry.addAttribute(
	            property$3.attributeName,
	            this.staticBuffer,
	            0,
	            property$3.type === TYPES.UNSIGNED_BYTE,
	            property$3.type,
	            this.staticStride * 4,
	            property$3.offset * 4
	        );
	    }
	};

	/**
	 * Uploads the dynamic properties.
	 *
	 * @private
	 * @param {PIXI.DisplayObject[]} children - The children to upload.
	 * @param {number} startIndex - The index to start at.
	 * @param {number} amount - The number to upload.
	 */
	ParticleBuffer.prototype.uploadDynamic = function uploadDynamic (children, startIndex, amount)
	{
	    for (var i = 0; i < this.dynamicProperties.length; i++)
	    {
	        var property = this.dynamicProperties[i];

	        property.uploadFunction(children, startIndex, amount,
	            property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,
	            this.dynamicStride, property.offset);
	    }

	    this.dynamicBuffer._updateID++;
	};

	/**
	 * Uploads the static properties.
	 *
	 * @private
	 * @param {PIXI.DisplayObject[]} children - The children to upload.
	 * @param {number} startIndex - The index to start at.
	 * @param {number} amount - The number to upload.
	 */
	ParticleBuffer.prototype.uploadStatic = function uploadStatic (children, startIndex, amount)
	{
	    for (var i = 0; i < this.staticProperties.length; i++)
	    {
	        var property = this.staticProperties[i];

	        property.uploadFunction(children, startIndex, amount,
	            property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,
	            this.staticStride, property.offset);
	    }

	    this.staticBuffer._updateID++;
	};

	/**
	 * Destroys the ParticleBuffer.
	 *
	 * @private
	 */
	ParticleBuffer.prototype.destroy = function destroy ()
	{
	    this.indexBuffer = null;

	    this.dynamicProperties = null;
	    // this.dynamicBuffer.destroy();
	    this.dynamicBuffer = null;
	    this.dynamicData = null;
	    this.dynamicDataUint32 = null;

	    this.staticProperties = null;
	    // this.staticBuffer.destroy();
	    this.staticBuffer = null;
	    this.staticData = null;
	    this.staticDataUint32 = null;
	    // all buffers are destroyed inside geometry
	    this.geometry.destroy();
	};

	var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n    float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n    float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n    vec2 v = vec2(x, y);\n    v = v + aPositionCoord;\n\n    gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vColor = aColor * uColor;\n}\n";

	var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n    vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n    gl_FragColor = color;\n}";

	/**
	 * @author Mat Groves
	 *
	 * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/
	 * for creating the original PixiJS version!
	 * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now
	 * share 4 bytes on the vertex buffer
	 *
	 * Heavily inspired by LibGDX's ParticleRenderer:
	 * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java
	 */

	/**
	 * Renderer for Particles that is designer for speed over feature set.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var ParticleRenderer = /*@__PURE__*/(function (ObjectRenderer) {
	    function ParticleRenderer(renderer)
	    {
	        ObjectRenderer.call(this, renderer);

	        // 65535 is max vertex index in the index buffer (see ParticleRenderer)
	        // so max number of particles is 65536 / 4 = 16384
	        // and max number of element in the index buffer is 16384 * 6 = 98304
	        // Creating a full index buffer, overhead is 98304 * 2 = 196Ko
	        // let numIndices = 98304;

	        /**
	         * The default shader that is used if a sprite doesn't have a more specific one.
	         *
	         * @member {PIXI.Shader}
	         */
	        this.shader = null;

	        this.properties = null;

	        this.tempMatrix = new Matrix();

	        this.properties = [
	            // verticesData
	            {
	                attributeName: 'aVertexPosition',
	                size: 2,
	                uploadFunction: this.uploadVertices,
	                offset: 0,
	            },
	            // positionData
	            {
	                attributeName: 'aPositionCoord',
	                size: 2,
	                uploadFunction: this.uploadPosition,
	                offset: 0,
	            },
	            // rotationData
	            {
	                attributeName: 'aRotation',
	                size: 1,
	                uploadFunction: this.uploadRotation,
	                offset: 0,
	            },
	            // uvsData
	            {
	                attributeName: 'aTextureCoord',
	                size: 2,
	                uploadFunction: this.uploadUvs,
	                offset: 0,
	            },
	            // tintData
	            {
	                attributeName: 'aColor',
	                size: 1,
	                type: TYPES.UNSIGNED_BYTE,
	                uploadFunction: this.uploadTint,
	                offset: 0,
	            } ];

	        this.shader = Shader.from(vertex$1, fragment$1, {});
	    }

	    if ( ObjectRenderer ) { ParticleRenderer.__proto__ = ObjectRenderer; }
	    ParticleRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );
	    ParticleRenderer.prototype.constructor = ParticleRenderer;

	    /**
	     * Renders the particle container object.
	     *
	     * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer
	     */
	    ParticleRenderer.prototype.render = function render (container)
	    {
	        var children = container.children;
	        var maxSize = container._maxSize;
	        var batchSize = container._batchSize;
	        var renderer = this.renderer;
	        var totalChildren = children.length;

	        if (totalChildren === 0)
	        {
	            return;
	        }
	        else if (totalChildren > maxSize && !container.autoResize)
	        {
	            totalChildren = maxSize;
	        }

	        var buffers = container._buffers;

	        if (!buffers)
	        {
	            buffers = container._buffers = this.generateBuffers(container);
	        }

	        var baseTexture = children[0]._texture.baseTexture;

	        // if the uvs have not updated then no point rendering just yet!
	        this.renderer.state.setBlendMode(correctBlendMode(container.blendMode, baseTexture.premultiplyAlpha));

	        var gl = renderer.gl;

	        var m = container.worldTransform.copyTo(this.tempMatrix);

	        m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);

	        this.shader.uniforms.translationMatrix = m.toArray(true);

	        this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,
	            container.worldAlpha, this.shader.uniforms.uColor, baseTexture.premultiplyAlpha);

	        this.shader.uniforms.uSampler = baseTexture;

	        this.renderer.shader.bind(this.shader);

	        var updateStatic = false;

	        // now lets upload and render the buffers..
	        for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)
	        {
	            var amount = (totalChildren - i);

	            if (amount > batchSize)
	            {
	                amount = batchSize;
	            }

	            if (j >= buffers.length)
	            {
	                buffers.push(this._generateOneMoreBuffer(container));
	            }

	            var buffer = buffers[j];

	            // we always upload the dynamic
	            buffer.uploadDynamic(children, i, amount);

	            var bid = container._bufferUpdateIDs[j] || 0;

	            updateStatic = updateStatic || (buffer._updateID < bid);
	            // we only upload the static content when we have to!
	            if (updateStatic)
	            {
	                buffer._updateID = container._updateID;
	                buffer.uploadStatic(children, i, amount);
	            }

	            // bind the buffer
	            renderer.geometry.bind(buffer.geometry);
	            gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);
	        }
	    };

	    /**
	     * Creates one particle buffer for each child in the container we want to render and updates internal properties
	     *
	     * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer
	     * @return {PIXI.ParticleBuffer[]} The buffers
	     * @private
	     */
	    ParticleRenderer.prototype.generateBuffers = function generateBuffers (container)
	    {
	        var buffers = [];
	        var size = container._maxSize;
	        var batchSize = container._batchSize;
	        var dynamicPropertyFlags = container._properties;

	        for (var i = 0; i < size; i += batchSize)
	        {
	            buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));
	        }

	        return buffers;
	    };

	    /**
	     * Creates one more particle buffer, because container has autoResize feature
	     *
	     * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer
	     * @return {PIXI.ParticleBuffer} generated buffer
	     * @private
	     */
	    ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer (container)
	    {
	        var batchSize = container._batchSize;
	        var dynamicPropertyFlags = container._properties;

	        return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);
	    };

	    /**
	     * Uploads the vertices.
	     *
	     * @param {PIXI.DisplayObject[]} children - the array of display objects to render
	     * @param {number} startIndex - the index to start from in the children array
	     * @param {number} amount - the amount of children that will have their vertices uploaded
	     * @param {number[]} array - The vertices to upload.
	     * @param {number} stride - Stride to use for iteration.
	     * @param {number} offset - Offset to start at.
	     */
	    ParticleRenderer.prototype.uploadVertices = function uploadVertices (children, startIndex, amount, array, stride, offset)
	    {
	        var w0 = 0;
	        var w1 = 0;
	        var h0 = 0;
	        var h1 = 0;

	        for (var i = 0; i < amount; ++i)
	        {
	            var sprite = children[startIndex + i];
	            var texture = sprite._texture;
	            var sx = sprite.scale.x;
	            var sy = sprite.scale.y;
	            var trim = texture.trim;
	            var orig = texture.orig;

	            if (trim)
	            {
	                // if the sprite is trimmed and is not a tilingsprite then we need to add the
	                // extra space before transforming the sprite coords..
	                w1 = trim.x - (sprite.anchor.x * orig.width);
	                w0 = w1 + trim.width;

	                h1 = trim.y - (sprite.anchor.y * orig.height);
	                h0 = h1 + trim.height;
	            }
	            else
	            {
	                w0 = (orig.width) * (1 - sprite.anchor.x);
	                w1 = (orig.width) * -sprite.anchor.x;

	                h0 = orig.height * (1 - sprite.anchor.y);
	                h1 = orig.height * -sprite.anchor.y;
	            }

	            array[offset] = w1 * sx;
	            array[offset + 1] = h1 * sy;

	            array[offset + stride] = w0 * sx;
	            array[offset + stride + 1] = h1 * sy;

	            array[offset + (stride * 2)] = w0 * sx;
	            array[offset + (stride * 2) + 1] = h0 * sy;

	            array[offset + (stride * 3)] = w1 * sx;
	            array[offset + (stride * 3) + 1] = h0 * sy;

	            offset += stride * 4;
	        }
	    };

	    /**
	     * Uploads the position.
	     *
	     * @param {PIXI.DisplayObject[]} children - the array of display objects to render
	     * @param {number} startIndex - the index to start from in the children array
	     * @param {number} amount - the amount of children that will have their positions uploaded
	     * @param {number[]} array - The vertices to upload.
	     * @param {number} stride - Stride to use for iteration.
	     * @param {number} offset - Offset to start at.
	     */
	    ParticleRenderer.prototype.uploadPosition = function uploadPosition (children, startIndex, amount, array, stride, offset)
	    {
	        for (var i = 0; i < amount; i++)
	        {
	            var spritePosition = children[startIndex + i].position;

	            array[offset] = spritePosition.x;
	            array[offset + 1] = spritePosition.y;

	            array[offset + stride] = spritePosition.x;
	            array[offset + stride + 1] = spritePosition.y;

	            array[offset + (stride * 2)] = spritePosition.x;
	            array[offset + (stride * 2) + 1] = spritePosition.y;

	            array[offset + (stride * 3)] = spritePosition.x;
	            array[offset + (stride * 3) + 1] = spritePosition.y;

	            offset += stride * 4;
	        }
	    };

	    /**
	     * Uploads the rotiation.
	     *
	     * @param {PIXI.DisplayObject[]} children - the array of display objects to render
	     * @param {number} startIndex - the index to start from in the children array
	     * @param {number} amount - the amount of children that will have their rotation uploaded
	     * @param {number[]} array - The vertices to upload.
	     * @param {number} stride - Stride to use for iteration.
	     * @param {number} offset - Offset to start at.
	     */
	    ParticleRenderer.prototype.uploadRotation = function uploadRotation (children, startIndex, amount, array, stride, offset)
	    {
	        for (var i = 0; i < amount; i++)
	        {
	            var spriteRotation = children[startIndex + i].rotation;

	            array[offset] = spriteRotation;
	            array[offset + stride] = spriteRotation;
	            array[offset + (stride * 2)] = spriteRotation;
	            array[offset + (stride * 3)] = spriteRotation;

	            offset += stride * 4;
	        }
	    };

	    /**
	     * Uploads the Uvs
	     *
	     * @param {PIXI.DisplayObject[]} children - the array of display objects to render
	     * @param {number} startIndex - the index to start from in the children array
	     * @param {number} amount - the amount of children that will have their rotation uploaded
	     * @param {number[]} array - The vertices to upload.
	     * @param {number} stride - Stride to use for iteration.
	     * @param {number} offset - Offset to start at.
	     */
	    ParticleRenderer.prototype.uploadUvs = function uploadUvs (children, startIndex, amount, array, stride, offset)
	    {
	        for (var i = 0; i < amount; ++i)
	        {
	            var textureUvs = children[startIndex + i]._texture._uvs;

	            if (textureUvs)
	            {
	                array[offset] = textureUvs.x0;
	                array[offset + 1] = textureUvs.y0;

	                array[offset + stride] = textureUvs.x1;
	                array[offset + stride + 1] = textureUvs.y1;

	                array[offset + (stride * 2)] = textureUvs.x2;
	                array[offset + (stride * 2) + 1] = textureUvs.y2;

	                array[offset + (stride * 3)] = textureUvs.x3;
	                array[offset + (stride * 3) + 1] = textureUvs.y3;

	                offset += stride * 4;
	            }
	            else
	            {
	                // TODO you know this can be easier!
	                array[offset] = 0;
	                array[offset + 1] = 0;

	                array[offset + stride] = 0;
	                array[offset + stride + 1] = 0;

	                array[offset + (stride * 2)] = 0;
	                array[offset + (stride * 2) + 1] = 0;

	                array[offset + (stride * 3)] = 0;
	                array[offset + (stride * 3) + 1] = 0;

	                offset += stride * 4;
	            }
	        }
	    };

	    /**
	     * Uploads the tint.
	     *
	     * @param {PIXI.DisplayObject[]} children - the array of display objects to render
	     * @param {number} startIndex - the index to start from in the children array
	     * @param {number} amount - the amount of children that will have their rotation uploaded
	     * @param {number[]} array - The vertices to upload.
	     * @param {number} stride - Stride to use for iteration.
	     * @param {number} offset - Offset to start at.
	     */
	    ParticleRenderer.prototype.uploadTint = function uploadTint (children, startIndex, amount, array, stride, offset)
	    {
	        for (var i = 0; i < amount; ++i)
	        {
	            var sprite = children[startIndex + i];
	            var premultiplied = sprite._texture.baseTexture.premultiplyAlpha;
	            var alpha = sprite.alpha;
	            // we dont call extra function if alpha is 1.0, that's faster
	            var argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha)
	                : sprite._tintRGB + (alpha * 255 << 24);

	            array[offset] = argb;
	            array[offset + stride] = argb;
	            array[offset + (stride * 2)] = argb;
	            array[offset + (stride * 3)] = argb;

	            offset += stride * 4;
	        }
	    };

	    /**
	     * Destroys the ParticleRenderer.
	     */
	    ParticleRenderer.prototype.destroy = function destroy ()
	    {
	        ObjectRenderer.prototype.destroy.call(this);

	        if (this.shader)
	        {
	            this.shader.destroy();
	            this.shader = null;
	        }

	        this.tempMatrix = null;
	    };

	    return ParticleRenderer;
	}(ObjectRenderer));

	/*!
	 * @pixi/spritesheet - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/spritesheet is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Utility class for maintaining reference to a collection
	 * of Textures on a single Spritesheet.
	 *
	 * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:
	 *
	 * ```js
	 * PIXI.Loader.shared.add("images/spritesheet.json").load(setup);
	 *
	 * function setup() {
	 *   let sheet = PIXI.Loader.shared.resources["images/spritesheet.json"].spritesheet;
	 *   ...
	 * }
	 * ```
	 * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.
	 *
	 * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},
	 * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.
	 * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only
	 * supported by TexturePacker.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var Spritesheet = function Spritesheet(baseTexture, data, resolutionFilename)
	{
	    if ( resolutionFilename === void 0 ) { resolutionFilename = null; }

	    /**
	     * Reference to ths source texture
	     * @type {PIXI.BaseTexture}
	     */
	    this.baseTexture = baseTexture;

	    /**
	     * A map containing all textures of the sprite sheet.
	     * Can be used to create a {@link PIXI.Sprite|Sprite}:
	     * ```js
	     * new PIXI.Sprite(sheet.textures["image.png"]);
	     * ```
	     * @member {Object}
	     */
	    this.textures = {};

	    /**
	     * A map containing the textures for each animation.
	     * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:
	     * ```js
	     * new PIXI.AnimatedSprite(sheet.animations["anim_name"])
	     * ```
	     * @member {Object}
	     */
	    this.animations = {};

	    /**
	     * Reference to the original JSON data.
	     * @type {Object}
	     */
	    this.data = data;

	    /**
	     * The resolution of the spritesheet.
	     * @type {number}
	     */
	    this.resolution = this._updateResolution(
	        resolutionFilename
	        || (this.baseTexture.resource ? this.baseTexture.resource.url : null)
	    );

	    /**
	     * Map of spritesheet frames.
	     * @type {Object}
	     * @private
	     */
	    this._frames = this.data.frames;

	    /**
	     * Collection of frame names.
	     * @type {string[]}
	     * @private
	     */
	    this._frameKeys = Object.keys(this._frames);

	    /**
	     * Current batch index being processed.
	     * @type {number}
	     * @private
	     */
	    this._batchIndex = 0;

	    /**
	     * Callback when parse is completed.
	     * @type {Function}
	     * @private
	     */
	    this._callback = null;
	};

	var staticAccessors$4 = { BATCH_SIZE: { configurable: true } };

	/**
	 * Generate the resolution from the filename or fallback
	 * to the meta.scale field of the JSON data.
	 *
	 * @private
	 * @param {string} resolutionFilename - The filename to use for resolving
	 *    the default resolution.
	 * @return {number} Resolution to use for spritesheet.
	 */
	staticAccessors$4.BATCH_SIZE.get = function ()
	{
	    return 1000;
	};

	Spritesheet.prototype._updateResolution = function _updateResolution (resolutionFilename)
	{
	    var scale = this.data.meta.scale;

	    // Use a defaultValue of `null` to check if a url-based resolution is set
	    var resolution = getResolutionOfUrl(resolutionFilename, null);

	    // No resolution found via URL
	    if (resolution === null)
	    {
	        // Use the scale value or default to 1
	        resolution = scale !== undefined ? parseFloat(scale) : 1;
	    }

	    // For non-1 resolutions, update baseTexture
	    if (resolution !== 1)
	    {
	        this.baseTexture.setResolution(resolution);
	    }

	    return resolution;
	};

	/**
	 * Parser spritesheet from loaded data. This is done asynchronously
	 * to prevent creating too many Texture within a single process.
	 *
	 * @param {Function} callback - Callback when complete returns
	 *    a map of the Textures for this spritesheet.
	 */
	Spritesheet.prototype.parse = function parse (callback)
	{
	    this._batchIndex = 0;
	    this._callback = callback;

	    if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)
	    {
	        this._processFrames(0);
	        this._processAnimations();
	        this._parseComplete();
	    }
	    else
	    {
	        this._nextBatch();
	    }
	};

	/**
	 * Process a batch of frames
	 *
	 * @private
	 * @param {number} initialFrameIndex - The index of frame to start.
	 */
	Spritesheet.prototype._processFrames = function _processFrames (initialFrameIndex)
	{
	    var frameIndex = initialFrameIndex;
	    var maxFrames = Spritesheet.BATCH_SIZE;

	    while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)
	    {
	        var i = this._frameKeys[frameIndex];
	        var data = this._frames[i];
	        var rect = data.frame;

	        if (rect)
	        {
	            var frame = null;
	            var trim = null;
	            var sourceSize = data.trimmed !== false && data.sourceSize
	                ? data.sourceSize : data.frame;

	            var orig = new Rectangle(
	                0,
	                0,
	                Math.floor(sourceSize.w) / this.resolution,
	                Math.floor(sourceSize.h) / this.resolution
	            );

	            if (data.rotated)
	            {
	                frame = new Rectangle(
	                    Math.floor(rect.x) / this.resolution,
	                    Math.floor(rect.y) / this.resolution,
	                    Math.floor(rect.h) / this.resolution,
	                    Math.floor(rect.w) / this.resolution
	                );
	            }
	            else
	            {
	                frame = new Rectangle(
	                    Math.floor(rect.x) / this.resolution,
	                    Math.floor(rect.y) / this.resolution,
	                    Math.floor(rect.w) / this.resolution,
	                    Math.floor(rect.h) / this.resolution
	                );
	            }

	            //  Check to see if the sprite is trimmed
	            if (data.trimmed !== false && data.spriteSourceSize)
	            {
	                trim = new Rectangle(
	                    Math.floor(data.spriteSourceSize.x) / this.resolution,
	                    Math.floor(data.spriteSourceSize.y) / this.resolution,
	                    Math.floor(rect.w) / this.resolution,
	                    Math.floor(rect.h) / this.resolution
	                );
	            }

	            this.textures[i] = new Texture(
	                this.baseTexture,
	                frame,
	                orig,
	                trim,
	                data.rotated ? 2 : 0,
	                data.anchor
	            );

	            // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions
	            Texture.addToCache(this.textures[i], i);
	        }

	        frameIndex++;
	    }
	};

	/**
	 * Parse animations config
	 *
	 * @private
	 */
	Spritesheet.prototype._processAnimations = function _processAnimations ()
	{
	    var animations = this.data.animations || {};

	    for (var animName in animations)
	    {
	        this.animations[animName] = [];
	        for (var i = 0; i < animations[animName].length; i++)
	        {
	            var frameName = animations[animName][i];

	            this.animations[animName].push(this.textures[frameName]);
	        }
	    }
	};

	/**
	 * The parse has completed.
	 *
	 * @private
	 */
	Spritesheet.prototype._parseComplete = function _parseComplete ()
	{
	    var callback = this._callback;

	    this._callback = null;
	    this._batchIndex = 0;
	    callback.call(this, this.textures);
	};

	/**
	 * Begin the next batch of textures.
	 *
	 * @private
	 */
	Spritesheet.prototype._nextBatch = function _nextBatch ()
	{
	        var this$1 = this;

	    this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);
	    this._batchIndex++;
	    setTimeout(function () {
	        if (this$1._batchIndex * Spritesheet.BATCH_SIZE < this$1._frameKeys.length)
	        {
	            this$1._nextBatch();
	        }
	        else
	        {
	            this$1._processAnimations();
	            this$1._parseComplete();
	        }
	    }, 0);
	};

	/**
	 * Destroy Spritesheet and don't use after this.
	 *
	 * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well
	 */
	Spritesheet.prototype.destroy = function destroy (destroyBase)
	{
	        if ( destroyBase === void 0 ) { destroyBase = false; }

	    for (var i in this.textures)
	    {
	        this.textures[i].destroy();
	    }
	    this._frames = null;
	    this._frameKeys = null;
	    this.data = null;
	    this.textures = null;
	    if (destroyBase)
	    {
	        this.baseTexture.destroy();
	    }
	    this.baseTexture = null;
	};

	Object.defineProperties( Spritesheet, staticAccessors$4 );

	/**
	 * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with
	 * TexturePacker or similar JSON-based spritesheet.
	 *
	 * This middleware automatically generates Texture resources.
	 *
	 * @class
	 * @memberof PIXI
	 * @implements PIXI.ILoaderPlugin
	 */
	var SpritesheetLoader = function SpritesheetLoader () {};

	SpritesheetLoader.use = function use (resource, next)
	{
	    var imageResourceName = (resource.name) + "_image";

	    // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists
	    if (!resource.data
	        || resource.type !== LoaderResource.TYPE.JSON
	        || !resource.data.frames
	        || this.resources[imageResourceName]
	    )
	    {
	        next();

	        return;
	    }

	    var loadOptions = {
	        crossOrigin: resource.crossOrigin,
	        metadata: resource.metadata.imageMetadata,
	        parentResource: resource,
	    };

	    var resourcePath = SpritesheetLoader.getResourcePath(resource, this.baseUrl);

	    // load the image for this sheet
	    this.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res)
	    {
	        if (res.error)
	        {
	            next(res.error);

	            return;
	        }

	        var spritesheet = new Spritesheet(
	            res.texture.baseTexture,
	            resource.data,
	            resource.url
	        );

	        spritesheet.parse(function () {
	            resource.spritesheet = spritesheet;
	            resource.textures = spritesheet.textures;
	            next();
	        });
	    });
	};

	/**
	 * Get the spritesheets root path
	 * @param {PIXI.LoaderResource} resource - Resource to check path
	 * @param {string} baseUrl - Base root url
	 */
	SpritesheetLoader.getResourcePath = function getResourcePath (resource, baseUrl)
	{
	    // Prepend url path unless the resource image is a data url
	    if (resource.isDataUrl)
	    {
	        return resource.data.meta.image;
	    }

	    return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);
	};

	/*!
	 * @pixi/sprite-tiling - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/sprite-tiling is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var tempPoint$1 = new Point();

	/**
	 * A tiling sprite is a fast way of rendering a tiling image
	 *
	 * @class
	 * @extends PIXI.Sprite
	 * @memberof PIXI
	 */
	var TilingSprite = /*@__PURE__*/(function (Sprite) {
	    function TilingSprite(texture, width, height)
	    {
	        if ( width === void 0 ) { width = 100; }
	        if ( height === void 0 ) { height = 100; }

	        Sprite.call(this, texture);

	        /**
	         * Tile transform
	         *
	         * @member {PIXI.Transform}
	         */
	        this.tileTransform = new Transform();

	        // /// private

	        /**
	         * The with of the tiling sprite
	         *
	         * @member {number}
	         * @private
	         */
	        this._width = width;

	        /**
	         * The height of the tiling sprite
	         *
	         * @member {number}
	         * @private
	         */
	        this._height = height;

	        /**
	         * Canvas pattern
	         *
	         * @type {CanvasPattern}
	         * @private
	         */
	        this._canvasPattern = null;

	        /**
	         * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space
	         *
	         * @member {PIXI.TextureMatrix}
	         */
	        this.uvMatrix = texture.uvMatrix || new TextureMatrix(texture);

	        /**
	         * Plugin that is responsible for rendering this element.
	         * Allows to customize the rendering process without overriding '_render' method.
	         *
	         * @member {string}
	         * @default 'tilingSprite'
	         */
	        this.pluginName = 'tilingSprite';

	        /**
	         * Whether or not anchor affects uvs
	         *
	         * @member {boolean}
	         * @default false
	         */
	        this.uvRespectAnchor = false;
	    }

	    if ( Sprite ) { TilingSprite.__proto__ = Sprite; }
	    TilingSprite.prototype = Object.create( Sprite && Sprite.prototype );
	    TilingSprite.prototype.constructor = TilingSprite;

	    var prototypeAccessors = { clampMargin: { configurable: true },tileScale: { configurable: true },tilePosition: { configurable: true },width: { configurable: true },height: { configurable: true } };
	    /**
	     * Changes frame clamping in corresponding textureTransform, shortcut
	     * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
	     *
	     * @default 0.5
	     * @member {number}
	     */
	    prototypeAccessors.clampMargin.get = function ()
	    {
	        return this.uvMatrix.clampMargin;
	    };

	    prototypeAccessors.clampMargin.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uvMatrix.clampMargin = value;
	        this.uvMatrix.update(true);
	    };

	    /**
	     * The scaling of the image that is being tiled
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    prototypeAccessors.tileScale.get = function ()
	    {
	        return this.tileTransform.scale;
	    };

	    prototypeAccessors.tileScale.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.tileTransform.scale.copyFrom(value);
	    };

	    /**
	     * The offset of the image that is being tiled
	     *
	     * @member {PIXI.ObservablePoint}
	     */
	    prototypeAccessors.tilePosition.get = function ()
	    {
	        return this.tileTransform.position;
	    };

	    prototypeAccessors.tilePosition.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.tileTransform.position.copyFrom(value);
	    };

	    /**
	     * @private
	     */
	    TilingSprite.prototype._onTextureUpdate = function _onTextureUpdate ()
	    {
	        if (this.uvMatrix)
	        {
	            this.uvMatrix.texture = this._texture;
	        }
	        this._cachedTint = 0xFFFFFF;
	    };

	    /**
	     * Renders the object using the WebGL renderer
	     *
	     * @protected
	     * @param {PIXI.Renderer} renderer - The renderer
	     */
	    TilingSprite.prototype._render = function _render (renderer)
	    {
	        // tweak our texture temporarily..
	        var texture = this._texture;

	        if (!texture || !texture.valid)
	        {
	            return;
	        }

	        this.tileTransform.updateLocalTransform();
	        this.uvMatrix.update();

	        renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
	        renderer.plugins[this.pluginName].render(this);
	    };

	    /**
	     * Updates the bounds of the tiling sprite.
	     *
	     * @protected
	     */
	    TilingSprite.prototype._calculateBounds = function _calculateBounds ()
	    {
	        var minX = this._width * -this._anchor._x;
	        var minY = this._height * -this._anchor._y;
	        var maxX = this._width * (1 - this._anchor._x);
	        var maxY = this._height * (1 - this._anchor._y);

	        this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
	    };

	    /**
	     * Gets the local bounds of the sprite object.
	     *
	     * @param {PIXI.Rectangle} rect - The output rectangle.
	     * @return {PIXI.Rectangle} The bounds.
	     */
	    TilingSprite.prototype.getLocalBounds = function getLocalBounds (rect)
	    {
	        // we can do a fast local bounds if the sprite has no children!
	        if (this.children.length === 0)
	        {
	            this._bounds.minX = this._width * -this._anchor._x;
	            this._bounds.minY = this._height * -this._anchor._y;
	            this._bounds.maxX = this._width * (1 - this._anchor._x);
	            this._bounds.maxY = this._height * (1 - this._anchor._y);

	            if (!rect)
	            {
	                if (!this._localBoundsRect)
	                {
	                    this._localBoundsRect = new Rectangle();
	                }

	                rect = this._localBoundsRect;
	            }

	            return this._bounds.getRectangle(rect);
	        }

	        return Sprite.prototype.getLocalBounds.call(this, rect);
	    };

	    /**
	     * Checks if a point is inside this tiling sprite.
	     *
	     * @param {PIXI.Point} point - the point to check
	     * @return {boolean} Whether or not the sprite contains the point.
	     */
	    TilingSprite.prototype.containsPoint = function containsPoint (point)
	    {
	        this.worldTransform.applyInverse(point, tempPoint$1);

	        var width = this._width;
	        var height = this._height;
	        var x1 = -width * this.anchor._x;

	        if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width)
	        {
	            var y1 = -height * this.anchor._y;

	            if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height)
	            {
	                return true;
	            }
	        }

	        return false;
	    };

	    /**
	     * Destroys this sprite and optionally its texture and children
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
	     *      method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well
	     * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well
	     */
	    TilingSprite.prototype.destroy = function destroy (options)
	    {
	        Sprite.prototype.destroy.call(this, options);

	        this.tileTransform = null;
	        this.uvMatrix = null;
	    };

	    /**
	     * Helper function that creates a new tiling sprite based on the source you provide.
	     * The source can be - frame id, image url, video url, canvas element, video element, base texture
	     *
	     * @static
	     * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from
	     * @param {number} width - the width of the tiling sprite
	     * @param {number} height - the height of the tiling sprite
	     * @return {PIXI.TilingSprite} The newly created texture
	     */
	    TilingSprite.from = function from (source, width, height)
	    {
	        return new TilingSprite(Texture.from(source), width, height);
	    };

	    /**
	     * 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 {string} frameId - The frame Id of the texture in the cache
	     * @param {number} width - the width of the tiling sprite
	     * @param {number} height - the height of the tiling sprite
	     * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId
	     */
	    TilingSprite.fromFrame = function fromFrame (frameId, width, height)
	    {
	        var texture = TextureCache[frameId];

	        if (!texture)
	        {
	            throw new Error(("The frameId \"" + frameId + "\" does not exist in the texture cache " + (this)));
	        }

	        return new TilingSprite(texture, width, height);
	    };

	    /**
	     * 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 {string} imageId - The image url of the texture
	     * @param {number} width - the width of the tiling sprite
	     * @param {number} height - the height of the tiling sprite
	     * @param {Object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.
	     * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id
	     */
	    TilingSprite.fromImage = function fromImage (imageId, width, height, options)
	    {
	        // Fallback support for crossorigin, scaleMode parameters
	        if (options && typeof options !== 'object')
	        {
	            options = {
	                scaleMode: arguments[4],
	                resourceOptions: {
	                    crossorigin: arguments[3],
	                },
	            };
	        }

	        return new TilingSprite(Texture.from(imageId, options), width, height);
	    };

	    /**
	     * The width of the sprite, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return this._width;
	    };

	    prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._width = value;
	    };

	    /**
	     * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return this._height;
	    };

	    prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._height = value;
	    };

	    Object.defineProperties( TilingSprite.prototype, prototypeAccessors );

	    return TilingSprite;
	}(Sprite));

	var vertex$2 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";

	var fragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    vec4 sample = texture2D(uSampler, coord);\n    gl_FragColor = sample * uColor;\n}\n";

	var fragmentSimple = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n    vec4 sample = texture2D(uSampler, vTextureCoord);\n    gl_FragColor = sample * uColor;\n}\n";

	var tempMat$1 = new Matrix();

	/**
	 * WebGL renderer plugin for tiling sprites
	 *
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.ObjectRenderer
	 */
	var TilingSpriteRenderer = /*@__PURE__*/(function (ObjectRenderer) {
	    function TilingSpriteRenderer(renderer)
	    {
	        ObjectRenderer.call(this, renderer);

	        var uniforms = { globals: this.renderer.globalUniforms };

	        this.shader = Shader.from(vertex$2, fragment$2, uniforms);

	        this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms);

	        this.quad = new QuadUv();
	    }

	    if ( ObjectRenderer ) { TilingSpriteRenderer.__proto__ = ObjectRenderer; }
	    TilingSpriteRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );
	    TilingSpriteRenderer.prototype.constructor = TilingSpriteRenderer;

	    /**
	     *
	     * @param {PIXI.TilingSprite} ts tilingSprite to be rendered
	     */
	    TilingSpriteRenderer.prototype.render = function render (ts)
	    {
	        var renderer = this.renderer;
	        var quad = this.quad;

	        var vertices = quad.vertices;

	        vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;
	        vertices[1] = vertices[3] = ts._height * -ts.anchor.y;

	        vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);
	        vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);

	        if (ts.uvRespectAnchor)
	        {
	            vertices = quad.uvs;

	            vertices[0] = vertices[6] = -ts.anchor.x;
	            vertices[1] = vertices[3] = -ts.anchor.y;

	            vertices[2] = vertices[4] = 1.0 - ts.anchor.x;
	            vertices[5] = vertices[7] = 1.0 - ts.anchor.y;
	        }

	        quad.invalidate();

	        var tex = ts._texture;
	        var baseTex = tex.baseTexture;
	        var lt = ts.tileTransform.localTransform;
	        var uv = ts.uvMatrix;
	        var isSimple = baseTex.isPowerOfTwo
	            && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;

	        // auto, force repeat wrapMode for big tiling textures
	        if (isSimple)
	        {
	            if (!baseTex._glTextures[renderer.CONTEXT_UID])
	            {
	                if (baseTex.wrapMode === WRAP_MODES.CLAMP)
	                {
	                    baseTex.wrapMode = WRAP_MODES.REPEAT;
	                }
	            }
	            else
	            {
	                isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;
	            }
	        }

	        var shader = isSimple ? this.simpleShader : this.shader;

	        var w = tex.width;
	        var h = tex.height;
	        var W = ts._width;
	        var H = ts._height;

	        tempMat$1.set(lt.a * w / W,
	            lt.b * w / H,
	            lt.c * h / W,
	            lt.d * h / H,
	            lt.tx / W,
	            lt.ty / H);

	        // that part is the same as above:
	        // tempMat.identity();
	        // tempMat.scale(tex.width, tex.height);
	        // tempMat.prepend(lt);
	        // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);

	        tempMat$1.invert();
	        if (isSimple)
	        {
	            tempMat$1.prepend(uv.mapCoord);
	        }
	        else
	        {
	            shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);
	            shader.uniforms.uClampFrame = uv.uClampFrame;
	            shader.uniforms.uClampOffset = uv.uClampOffset;
	        }

	        shader.uniforms.uTransform = tempMat$1.toArray(true);
	        shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,
	            shader.uniforms.uColor, baseTex.premultiplyAlpha);
	        shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);
	        shader.uniforms.uSampler = tex;

	        renderer.shader.bind(shader);
	        renderer.geometry.bind(quad);// , renderer.shader.getGLShader());

	        renderer.state.setBlendMode(correctBlendMode(ts.blendMode, baseTex.premultiplyAlpha));
	        renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);
	    };

	    return TilingSpriteRenderer;
	}(ObjectRenderer));

	/*!
	 * @pixi/text-bitmap - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/text-bitmap is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * A BitmapText object will create a line or multiple lines of text using bitmap font.
	 *
	 * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,
	 * meaning that rendering is fast, and changing text has no performance implications.
	 *
	 * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone.
	 * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.
	 *
	 * To split a line you can use '\n', '\r' or '\r\n' in your string.
	 *
	 * You can generate the fnt files using
	 * http://www.angelcode.com/products/bmfont/ for Windows or
	 * http://www.bmglyph.com/ for Mac.
	 *
	 * A BitmapText can only be created when the font is loaded.
	 *
	 * ```js
	 * // in this case the font is in a file called 'desyrel.fnt'
	 * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"});
	 * ```
	 *
	 * @class
	 * @extends PIXI.Container
	 * @memberof PIXI
	 */
	var BitmapText = /*@__PURE__*/(function (Container) {
	    function BitmapText(text, style)
	    {
	        var this$1 = this;
	        if ( style === void 0 ) { style = {}; }

	        Container.call(this);

	        /**
	         * Private tracker for the width of the overall text
	         *
	         * @member {number}
	         * @private
	         */
	        this._textWidth = 0;

	        /**
	         * Private tracker for the height of the overall text
	         *
	         * @member {number}
	         * @private
	         */
	        this._textHeight = 0;

	        /**
	         * Private tracker for the letter sprite pool.
	         *
	         * @member {PIXI.Sprite[]}
	         * @private
	         */
	        this._glyphs = [];

	        /**
	         * Private tracker for the current style.
	         *
	         * @member {object}
	         * @private
	         */
	        this._font = {
	            tint: style.tint !== undefined ? style.tint : 0xFFFFFF,
	            align: style.align || 'left',
	            name: null,
	            size: 0,
	        };

	        /**
	         * Private tracker for the current font.
	         *
	         * @member {object}
	         * @private
	         */
	        this.font = style.font; // run font setter

	        /**
	         * Private tracker for the current text.
	         *
	         * @member {string}
	         * @private
	         */
	        this._text = text;

	        /**
	         * 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}
	         * @private
	         */
	        this._maxWidth = 0;

	        /**
	         * The max line height. This is useful when trying to use the total height of the Text,
	         * ie: when trying to vertically align.
	         *
	         * @member {number}
	         * @private
	         */
	        this._maxLineHeight = 0;

	        /**
	         * Letter spacing. This is useful for setting the space between characters.
	         * @member {number}
	         * @private
	         */
	        this._letterSpacing = 0;

	        /**
	         * Text anchor. read-only
	         *
	         * @member {PIXI.ObservablePoint}
	         * @private
	         */
	        this._anchor = new ObservablePoint(function () { this$1.dirty = true; }, this, 0, 0);

	        /**
	         * The dirty state of this object.
	         *
	         * @member {boolean}
	         */
	        this.dirty = false;

	        /**
	         * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
	         * Advantages can include sharper image quality (like text) and faster rendering on canvas.
	         * The main disadvantage is movement of objects may appear less smooth.
	         * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
	         *
	         * @member {boolean}
	         * @default false
	         */
	        this.roundPixels = settings.ROUND_PIXELS;

	        this.updateText();
	    }

	    if ( Container ) { BitmapText.__proto__ = Container; }
	    BitmapText.prototype = Object.create( Container && Container.prototype );
	    BitmapText.prototype.constructor = BitmapText;

	    var prototypeAccessors = { tint: { configurable: true },align: { configurable: true },anchor: { configurable: true },font: { configurable: true },text: { configurable: true },maxWidth: { configurable: true },maxLineHeight: { configurable: true },textWidth: { configurable: true },letterSpacing: { configurable: true },textHeight: { configurable: true } };

	    /**
	     * Renders text and updates it when needed
	     *
	     * @private
	     */
	    BitmapText.prototype.updateText = function updateText ()
	    {
	        var data = BitmapText.fonts[this._font.name];
	        var scale = this._font.size / data.size;
	        var pos = new Point();
	        var chars = [];
	        var lineWidths = [];
	        var text = this._text.replace(/(?:\r\n|\r)/g, '\n') || ' ';
	        var textLength = text.length;
	        var maxWidth = this._maxWidth * data.size / this._font.size;

	        var prevCharCode = null;
	        var lastLineWidth = 0;
	        var maxLineWidth = 0;
	        var line = 0;
	        var lastBreakPos = -1;
	        var lastBreakWidth = 0;
	        var spacesRemoved = 0;
	        var maxLineHeight = 0;

	        for (var i = 0; i < textLength; i++)
	        {
	            var charCode = text.charCodeAt(i);
	            var char = text.charAt(i);

	            if ((/(?:\s)/).test(char))
	            {
	                lastBreakPos = i;
	                lastBreakWidth = lastLineWidth;
	            }

	            if (char === '\r' || char === '\n')
	            {
	                lineWidths.push(lastLineWidth);
	                maxLineWidth = Math.max(maxLineWidth, lastLineWidth);
	                ++line;
	                ++spacesRemoved;

	                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 Point(pos.x + charData.xOffset + (this._letterSpacing / 2), pos.y + charData.yOffset),
	            });
	            pos.x += charData.xAdvance + this._letterSpacing;
	            lastLineWidth = pos.x;
	            maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));
	            prevCharCode = charCode;

	            if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)
	            {
	                ++spacesRemoved;
	                removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);
	                i = lastBreakPos;
	                lastBreakPos = -1;

	                lineWidths.push(lastBreakWidth);
	                maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);
	                line++;

	                pos.x = 0;
	                pos.y += data.lineHeight;
	                prevCharCode = null;
	            }
	        }

	        var lastChar = text.charAt(text.length - 1);

	        if (lastChar !== '\r' && lastChar !== '\n')
	        {
	            if ((/(?:\s)/).test(lastChar))
	            {
	                lastLineWidth = lastBreakWidth;
	            }

	            lineWidths.push(lastLineWidth);
	            maxLineWidth = Math.max(maxLineWidth, lastLineWidth);
	        }

	        var lineAlignOffsets = [];

	        for (var i$1 = 0; i$1 <= line; i$1++)
	        {
	            var alignOffset = 0;

	            if (this._font.align === 'right')
	            {
	                alignOffset = maxLineWidth - lineWidths[i$1];
	            }
	            else if (this._font.align === 'center')
	            {
	                alignOffset = (maxLineWidth - lineWidths[i$1]) / 2;
	            }

	            lineAlignOffsets.push(alignOffset);
	        }

	        var lenChars = chars.length;
	        var tint = this.tint;

	        for (var i$2 = 0; i$2 < lenChars; i$2++)
	        {
	            var c = this._glyphs[i$2]; // get the next glyph sprite

	            if (c)
	            {
	                c.texture = chars[i$2].texture;
	            }
	            else
	            {
	                c = new Sprite(chars[i$2].texture);
	                c.roundPixels = this.roundPixels;
	                this._glyphs.push(c);
	            }

	            c.position.x = (chars[i$2].position.x + lineAlignOffsets[chars[i$2].line]) * scale;
	            c.position.y = chars[i$2].position.y * scale;
	            c.scale.x = c.scale.y = scale;
	            c.tint = tint;

	            if (!c.parent)
	            {
	                this.addChild(c);
	            }
	        }

	        // remove unnecessary children.
	        for (var i$3 = lenChars; i$3 < this._glyphs.length; ++i$3)
	        {
	            this.removeChild(this._glyphs[i$3]);
	        }

	        this._textWidth = maxLineWidth * scale;
	        this._textHeight = (pos.y + data.lineHeight) * scale;

	        // apply anchor
	        if (this.anchor.x !== 0 || this.anchor.y !== 0)
	        {
	            for (var i$4 = 0; i$4 < lenChars; i$4++)
	            {
	                this._glyphs[i$4].x -= this._textWidth * this.anchor.x;
	                this._glyphs[i$4].y -= this._textHeight * this.anchor.y;
	            }
	        }
	        this._maxLineHeight = maxLineHeight * scale;
	    };

	    /**
	     * Updates the transform of this object
	     *
	     * @private
	     */
	    BitmapText.prototype.updateTransform = function updateTransform ()
	    {
	        this.validate();
	        this.containerUpdateTransform();
	    };

	    /**
	     * Validates text before calling parent's getLocalBounds
	     *
	     * @return {PIXI.Rectangle} The rectangular bounding area
	     */
	    BitmapText.prototype.getLocalBounds = function getLocalBounds ()
	    {
	        this.validate();

	        return Container.prototype.getLocalBounds.call(this);
	    };

	    /**
	     * Updates text when needed
	     *
	     * @private
	     */
	    BitmapText.prototype.validate = function validate ()
	    {
	        if (this.dirty)
	        {
	            this.updateText();
	            this.dirty = false;
	        }
	    };

	    /**
	     * The tint of the BitmapText object.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.tint.get = function ()
	    {
	        return this._font.tint;
	    };

	    prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;

	        this.dirty = true;
	    };

	    /**
	     * The alignment of the BitmapText object.
	     *
	     * @member {string}
	     * @default 'left'
	     */
	    prototypeAccessors.align.get = function ()
	    {
	        return this._font.align;
	    };

	    prototypeAccessors.align.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._font.align = value || 'left';

	        this.dirty = true;
	    };

	    /**
	     * The anchor sets the origin point of the text.
	     *
	     * The default is `(0,0)`, this means the text's origin is the top left.
	     *
	     * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.
	     *
	     * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.
	     *
	     * @member {PIXI.Point | number}
	     */
	    prototypeAccessors.anchor.get = function ()
	    {
	        return this._anchor;
	    };

	    prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (typeof value === 'number')
	        {
	            this._anchor.set(value);
	        }
	        else
	        {
	            this._anchor.copyFrom(value);
	        }
	    };

	    /**
	     * The font descriptor of the BitmapText object.
	     *
	     * @member {object}
	     */
	    prototypeAccessors.font.get = function ()
	    {
	        return this._font;
	    };

	    prototypeAccessors.font.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (!value)
	        {
	            return;
	        }

	        if (typeof value === 'string')
	        {
	            value = value.split(' ');

	            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);
	        }

	        this.dirty = true;
	    };

	    /**
	     * The text of the BitmapText object.
	     *
	     * @member {string}
	     */
	    prototypeAccessors.text.get = function ()
	    {
	        return this._text;
	    };

	    prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc
	    {
	        text = String(text === null || text === undefined ? '' : text);

	        if (this._text === text)
	        {
	            return;
	        }
	        this._text = text;
	        this.dirty = true;
	    };

	    /**
	     * 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 the value to 0.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.maxWidth.get = function ()
	    {
	        return this._maxWidth;
	    };

	    prototypeAccessors.maxWidth.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (this._maxWidth === value)
	        {
	            return;
	        }
	        this._maxWidth = value;
	        this.dirty = true;
	    };

	    /**
	     * The max line height. This is useful when trying to use the total height of the Text,
	     * i.e. when trying to vertically align.
	     *
	     * @member {number}
	     * @readonly
	     */
	    prototypeAccessors.maxLineHeight.get = function ()
	    {
	        this.validate();

	        return this._maxLineHeight;
	    };

	    /**
	     * The width of the overall text, different from fontSize,
	     * which is defined in the style object.
	     *
	     * @member {number}
	     * @readonly
	     */
	    prototypeAccessors.textWidth.get = function ()
	    {
	        this.validate();

	        return this._textWidth;
	    };

	    /**
	     * Additional space between characters.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.letterSpacing.get = function ()
	    {
	        return this._letterSpacing;
	    };

	    prototypeAccessors.letterSpacing.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (this._letterSpacing !== value)
	        {
	            this._letterSpacing = value;
	            this.dirty = true;
	        }
	    };

	    /**
	     * The height of the overall text, different from fontSize,
	     * which is defined in the style object.
	     *
	     * @member {number}
	     * @readonly
	     */
	    prototypeAccessors.textHeight.get = function ()
	    {
	        this.validate();

	        return this._textHeight;
	    };

	    /**
	     * Register a bitmap font with data and a texture.
	     *
	     * @static
	     * @param {XMLDocument} xml - The XML document data.
	     * @param {Object.<string, PIXI.Texture>|PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page.
	     *  If providing an object, the key is the `<page>` element's `file` attribute in the FNT file.
	     * @return {Object} Result font object with font, size, lineHeight and char fields.
	     */
	    BitmapText.registerFont = function registerFont (xml, textures)
	    {
	        var data = {};
	        var info = xml.getElementsByTagName('info')[0];
	        var common = xml.getElementsByTagName('common')[0];
	        var pages = xml.getElementsByTagName('page');
	        var res = getResolutionOfUrl(pages[0].getAttribute('file'), settings.RESOLUTION);
	        var pagesTextures = {};

	        data.font = info.getAttribute('face');
	        data.size = parseInt(info.getAttribute('size'), 10);
	        data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) / res;
	        data.chars = {};

	        // Single texture, convert to list
	        if (textures instanceof Texture)
	        {
	            textures = [textures];
	        }

	        // Convert the input Texture, Textures or object
	        // into a page Texture lookup by "id"
	        for (var i = 0; i < pages.length; i++)
	        {
	            var id = pages[i].getAttribute('id');
	            var file = pages[i].getAttribute('file');

	            pagesTextures[id] = textures instanceof Array ? textures[i] : textures[file];
	        }

	        // parse letters
	        var letters = xml.getElementsByTagName('char');

	        for (var i$1 = 0; i$1 < letters.length; i$1++)
	        {
	            var letter = letters[i$1];
	            var charCode = parseInt(letter.getAttribute('id'), 10);
	            var page = letter.getAttribute('page') || 0;
	            var textureRect = new Rectangle(
	                (parseInt(letter.getAttribute('x'), 10) / res) + (pagesTextures[page].frame.x / res),
	                (parseInt(letter.getAttribute('y'), 10) / res) + (pagesTextures[page].frame.y / res),
	                parseInt(letter.getAttribute('width'), 10) / res,
	                parseInt(letter.getAttribute('height'), 10) / res
	            );

	            data.chars[charCode] = {
	                xOffset: parseInt(letter.getAttribute('xoffset'), 10) / res,
	                yOffset: parseInt(letter.getAttribute('yoffset'), 10) / res,
	                xAdvance: parseInt(letter.getAttribute('xadvance'), 10) / res,
	                kerning: {},
	                texture: new Texture(pagesTextures[page].baseTexture, textureRect),
	                page: page,
	            };
	        }

	        // parse kernings
	        var kernings = xml.getElementsByTagName('kerning');

	        for (var i$2 = 0; i$2 < kernings.length; i$2++)
	        {
	            var kerning = kernings[i$2];
	            var first = parseInt(kerning.getAttribute('first'), 10) / res;
	            var second = parseInt(kerning.getAttribute('second'), 10) / res;
	            var amount = parseInt(kerning.getAttribute('amount'), 10) / res;

	            if (data.chars[second])
	            {
	                data.chars[second].kerning[first] = amount;
	            }
	        }

	        // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3
	        // but it's very likely to change
	        BitmapText.fonts[data.font] = data;

	        return data;
	    };

	    Object.defineProperties( BitmapText.prototype, prototypeAccessors );

	    return BitmapText;
	}(Container));

	BitmapText.fonts = {};

	/**
	 * {@link PIXI.Loader Loader} middleware for loading
	 * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.
	 * @class
	 * @memberof PIXI
	 * @implements PIXI.ILoaderPlugin
	 */
	var BitmapFontLoader = function BitmapFontLoader () {};

	BitmapFontLoader.parse = function parse (resource, texture)
	{
	    resource.bitmapFont = BitmapText.registerFont(resource.data, texture);
	};

	/**
	 * Called when the plugin is installed.
	 *
	 * @see PIXI.Loader.registerPlugin
	 */
	BitmapFontLoader.add = function add ()
	{
	    LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT);
	};

	/**
	 * Replacement for NodeJS's path.dirname
	 * @private
	 * @param {string} url Path to get directory for
	 */
	BitmapFontLoader.dirname = function dirname (url)
	{
	    var dir = url
	        .replace(/\/$/, '') // replace trailing slash
	        .replace(/\/[^\/]*$/, ''); // remove everything after the last

	    // File request is relative, use current directory
	    if (dir === url)
	    {
	        return '.';
	    }
	    // Started with a slash
	    else if (dir === '')
	    {
	        return '/';
	    }

	    return dir;
	};

	/**
	 * Called after a resource is loaded.
	 * @see PIXI.Loader.loaderMiddleware
	 * @param {PIXI.LoaderResource} resource
	 * @param {function} next
	 */
	BitmapFontLoader.use = function use (resource, next)
	{
	    // skip if no data or not xml data
	    if (!resource.data || resource.type !== LoaderResource.TYPE.XML)
	    {
	        next();

	        return;
	    }

	    // 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
	    )
	    {
	        next();

	        return;
	    }

	    var xmlUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';

	    if (resource.isDataUrl)
	    {
	        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 pages = resource.data.getElementsByTagName('page');
	    var textures = {};

	    // Handle completed, when the number of textures
	    // load is the same number as references in the fnt file
	    var completed = function (page) {
	        textures[page.metadata.pageFile] = page.texture;

	        if (Object.keys(textures).length === pages.length)
	        {
	            BitmapFontLoader.parse(resource, textures);
	            next();
	        }
	    };

	    for (var i = 0; i < pages.length; ++i)
	    {
	        var pageFile = pages[i].getAttribute('file');
	        var url = xmlUrl + pageFile;
	        var exists = false;

	        // incase the image is loaded outside
	        // using the same loader, resource will be available
	        for (var name in this.resources)
	        {
	            var bitmapResource = this.resources[name];

	            if (bitmapResource.url === url)
	            {
	                bitmapResource.metadata.pageFile = pageFile;
	                if (bitmapResource.texture)
	                {
	                    completed(bitmapResource);
	                }
	                else
	                {
	                    bitmapResource.onAfterMiddleware.add(completed);
	                }
	                exists = true;
	                break;
	            }
	        }

	        // texture is not loaded, we'll attempt to add
	        // it to the load and add the texture to the list
	        if (!exists)
	        {
	            // Standard loading options for images
	            var options = {
	                crossOrigin: resource.crossOrigin,
	                loadType: LoaderResource.LOAD_TYPE.IMAGE,
	                metadata: Object.assign(
	                    { pageFile: pageFile },
	                    resource.metadata.imageMetadata
	                ),
	                parentResource: resource,
	            };

	            this.add(url, options, completed);
	        }
	    }
	};

	/*!
	 * @pixi/filter-alpha - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-alpha is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var fragment$3 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n   gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n";

	/**
	 * Simplest filter - applies alpha.
	 *
	 * Use this instead of Container's alpha property to avoid visual layering of individual elements.
	 * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.
	 * If elements are not opaque, they will blend with each other anyway.
	 *
	 * Very handy if you want to use common features of all filters:
	 *
	 * 1. Assign a blendMode to this filter, blend all elements inside display object with background.
	 *
	 * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 */
	var AlphaFilter = /*@__PURE__*/(function (Filter) {
	    function AlphaFilter(alpha)
	    {
	        if ( alpha === void 0 ) { alpha = 1.0; }

	        Filter.call(this, _default, fragment$3, { uAlpha: 1 });

	        this.alpha = alpha;
	    }

	    if ( Filter ) { AlphaFilter.__proto__ = Filter; }
	    AlphaFilter.prototype = Object.create( Filter && Filter.prototype );
	    AlphaFilter.prototype.constructor = AlphaFilter;

	    var prototypeAccessors = { alpha: { configurable: true } };

	    /**
	     * Coefficient for alpha multiplication
	     *
	     * @member {number}
	     * @default 1
	     */
	    prototypeAccessors.alpha.get = function ()
	    {
	        return this.uniforms.uAlpha;
	    };

	    prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.uAlpha = value;
	    };

	    Object.defineProperties( AlphaFilter.prototype, prototypeAccessors );

	    return AlphaFilter;
	}(Filter));

	/*!
	 * @pixi/filter-blur - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-blur is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var vertTemplate = "\n    attribute vec2 aVertexPosition;\n\n    uniform mat3 projectionMatrix;\n\n    uniform float strength;\n\n    varying vec2 vBlurTexCoords[%size%];\n\n    uniform vec4 inputSize;\n    uniform vec4 outputFrame;\n    \n    vec4 filterVertexPosition( void )\n    {\n        vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n    \n        return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n    }\n    \n    vec2 filterTextureCoord( void )\n    {\n        return aVertexPosition * (outputFrame.zw * inputSize.zw);\n    }\n\n    void main(void)\n    {\n        gl_Position = filterVertexPosition();\n\n        vec2 textureCoord = filterTextureCoord();\n        %blur%\n    }";

	function generateBlurVertSource(kernelSize, x)
	{
	    var halfLength = Math.ceil(kernelSize / 2);

	    var vertSource = vertTemplate;

	    var blurLoop = '';
	    var template;
	    // let value;

	    if (x)
	    {
	        template = 'vBlurTexCoords[%index%] =  textureCoord + vec2(%sampleIndex% * strength, 0.0);';
	    }
	    else
	    {
	        template = 'vBlurTexCoords[%index%] =  textureCoord + vec2(0.0, %sampleIndex% * strength);';
	    }

	    for (var i = 0; i < kernelSize; i++)
	    {
	        var blur = template.replace('%index%', i);

	        // value = i;

	        // if(i >= halfLength)
	        // {
	        //     value = kernelSize - i - 1;
	        // }

	        blur = blur.replace('%sampleIndex%', ((i - (halfLength - 1)) + ".0"));

	        blurLoop += blur;
	        blurLoop += '\n';
	    }

	    vertSource = vertSource.replace('%blur%', blurLoop);
	    vertSource = vertSource.replace('%size%', kernelSize);

	    return vertSource;
	}

	var GAUSSIAN_VALUES = {
	    5: [0.153388, 0.221461, 0.250301],
	    7: [0.071303, 0.131514, 0.189879, 0.214607],
	    9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],
	    11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],
	    13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],
	    15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],
	};

	var fragTemplate$1 = [
	    'varying vec2 vBlurTexCoords[%size%];',
	    'uniform sampler2D uSampler;',

	    'void main(void)',
	    '{',
	    '    gl_FragColor = vec4(0.0);',
	    '    %blur%',
	    '}' ].join('\n');

	function generateBlurFragSource(kernelSize)
	{
	    var kernel = GAUSSIAN_VALUES[kernelSize];
	    var halfLength = kernel.length;

	    var fragSource = fragTemplate$1;

	    var blurLoop = '';
	    var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';
	    var value;

	    for (var i = 0; i < kernelSize; i++)
	    {
	        var blur = template.replace('%index%', i);

	        value = i;

	        if (i >= halfLength)
	        {
	            value = kernelSize - i - 1;
	        }

	        blur = blur.replace('%value%', kernel[value]);

	        blurLoop += blur;
	        blurLoop += '\n';
	    }

	    fragSource = fragSource.replace('%blur%', blurLoop);
	    fragSource = fragSource.replace('%size%', kernelSize);

	    return fragSource;
	}

	/**
	 * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 */
	var BlurFilterPass = /*@__PURE__*/(function (Filter) {
	    function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize)
	    {
	        kernelSize = kernelSize || 5;
	        var vertSrc = generateBlurVertSource(kernelSize, horizontal);
	        var fragSrc = generateBlurFragSource(kernelSize);

	        Filter.call(
	            // vertex shader
	            this, vertSrc,
	            // fragment shader
	            fragSrc
	        );

	        this.horizontal = horizontal;

	        this.resolution = resolution || settings.RESOLUTION;

	        this._quality = 0;

	        this.quality = quality || 4;

	        this.blur = strength || 8;
	    }

	    if ( Filter ) { BlurFilterPass.__proto__ = Filter; }
	    BlurFilterPass.prototype = Object.create( Filter && Filter.prototype );
	    BlurFilterPass.prototype.constructor = BlurFilterPass;

	    var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true } };

	    BlurFilterPass.prototype.apply = function apply (filterManager, input, output, clear)
	    {
	        if (output)
	        {
	            if (this.horizontal)
	            {
	                this.uniforms.strength = (1 / output.width) * (output.width / input.width);
	            }
	            else
	            {
	                this.uniforms.strength = (1 / output.height) * (output.height / input.height);
	            }
	        }
	        else
	        {
	            if (this.horizontal) // eslint-disable-line
	            {
	                this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);
	            }
	            else
	            {
	                this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line
	            }
	        }

	        // screen space!
	        this.uniforms.strength *= this.strength;
	        this.uniforms.strength /= this.passes;

	        if (this.passes === 1)
	        {
	            filterManager.applyFilter(this, input, output, clear);
	        }
	        else
	        {
	            var renderTarget = filterManager.getFilterTexture();
	            var renderer = filterManager.renderer;

	            var flip = input;
	            var flop = renderTarget;

	            this.state.blend = false;
	            filterManager.applyFilter(this, flip, flop, false);

	            for (var i = 1; i < this.passes - 1; i++)
	            {
	                renderer.renderTexture.bind(flip, flip.filterFrame);

	                this.uniforms.uSampler = flop;

	                var temp = flop;

	                flop = flip;
	                flip = temp;

	                renderer.shader.bind(this);
	                renderer.geometry.draw(5);
	            }

	            this.state.blend = true;
	            filterManager.applyFilter(this, flop, output, clear);
	            filterManager.returnFilterTexture(renderTarget);
	        }
	    };
	    /**
	     * Sets the strength of both the blur.
	     *
	     * @member {number}
	     * @default 16
	     */
	    prototypeAccessors.blur.get = function ()
	    {
	        return this.strength;
	    };

	    prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.padding = 1 + (Math.abs(value) * 2);
	        this.strength = value;
	    };

	    /**
	     * Sets the quality of the blur by modifying the number of passes. More passes means higher
	     * quaility bluring but the lower the performance.
	     *
	     * @member {number}
	     * @default 4
	     */
	    prototypeAccessors.quality.get = function ()
	    {
	        return this._quality;
	    };

	    prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._quality = value;
	        this.passes = value;
	    };

	    Object.defineProperties( BlurFilterPass.prototype, prototypeAccessors );

	    return BlurFilterPass;
	}(Filter));

	/**
	 * The BlurFilter applies a Gaussian blur to an object.
	 *
	 * The strength of the blur can be set for the x-axis and y-axis separately.
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 */
	var BlurFilter = /*@__PURE__*/(function (Filter) {
	    function BlurFilter(strength, quality, resolution, kernelSize)
	    {
	        Filter.call(this);

	        this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);
	        this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);

	        this.resolution = resolution || settings.RESOLUTION;
	        this.quality = quality || 4;
	        this.blur = strength || 8;

	        this.repeatEdgePixels = false;
	    }

	    if ( Filter ) { BlurFilter.__proto__ = Filter; }
	    BlurFilter.prototype = Object.create( Filter && Filter.prototype );
	    BlurFilter.prototype.constructor = BlurFilter;

	    var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true },blurX: { configurable: true },blurY: { configurable: true },blendMode: { configurable: true },repeatEdgePixels: { configurable: true } };

	    /**
	     * Applies the filter.
	     *
	     * @param {PIXI.systems.FilterSystem} filterManager - The manager.
	     * @param {PIXI.RenderTexture} input - The input target.
	     * @param {PIXI.RenderTexture} output - The output target.
	     */
	    BlurFilter.prototype.apply = function apply (filterManager, input, output, clear)
	    {
	        var xStrength = Math.abs(this.blurXFilter.strength);
	        var yStrength = Math.abs(this.blurYFilter.strength);

	        if (xStrength && yStrength)
	        {
	            var renderTarget = filterManager.getFilterTexture();

	            this.blurXFilter.apply(filterManager, input, renderTarget, true);
	            this.blurYFilter.apply(filterManager, renderTarget, output, clear);

	            filterManager.returnFilterTexture(renderTarget);
	        }
	        else if (yStrength)
	        {
	            this.blurYFilter.apply(filterManager, input, output, clear);
	        }
	        else
	        {
	            this.blurXFilter.apply(filterManager, input, output, clear);
	        }
	    };

	    BlurFilter.prototype.updatePadding = function updatePadding ()
	    {
	        if (this._repeatEdgePixels)
	        {
	            this.padding = 0;
	        }
	        else
	        {
	            this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;
	        }
	    };

	    /**
	     * Sets the strength of both the blurX and blurY properties simultaneously
	     *
	     * @member {number}
	     * @default 2
	     */
	    prototypeAccessors.blur.get = function ()
	    {
	        return this.blurXFilter.blur;
	    };

	    prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.blurXFilter.blur = this.blurYFilter.blur = value;
	        this.updatePadding();
	    };

	    /**
	     * Sets the number of passes for blur. More passes means higher quaility bluring.
	     *
	     * @member {number}
	     * @default 1
	     */
	    prototypeAccessors.quality.get = function ()
	    {
	        return this.blurXFilter.quality;
	    };

	    prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.blurXFilter.quality = this.blurYFilter.quality = value;
	    };

	    /**
	     * Sets the strength of the blurX property
	     *
	     * @member {number}
	     * @default 2
	     */
	    prototypeAccessors.blurX.get = function ()
	    {
	        return this.blurXFilter.blur;
	    };

	    prototypeAccessors.blurX.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.blurXFilter.blur = value;
	        this.updatePadding();
	    };

	    /**
	     * Sets the strength of the blurY property
	     *
	     * @member {number}
	     * @default 2
	     */
	    prototypeAccessors.blurY.get = function ()
	    {
	        return this.blurYFilter.blur;
	    };

	    prototypeAccessors.blurY.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.blurYFilter.blur = value;
	        this.updatePadding();
	    };

	    /**
	     * Sets the blendmode of the filter
	     *
	     * @member {number}
	     * @default PIXI.BLEND_MODES.NORMAL
	     */
	    prototypeAccessors.blendMode.get = function ()
	    {
	        return this.blurYFilter.blendMode;
	    };

	    prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.blurYFilter.blendMode = value;
	    };

	    /**
	     * If set to true the edge of the target will be clamped
	     *
	     * @member {bool}
	     * @default false
	     */
	    prototypeAccessors.repeatEdgePixels.get = function ()
	    {
	        return this._repeatEdgePixels;
	    };

	    prototypeAccessors.repeatEdgePixels.set = function (value)
	    {
	        this._repeatEdgePixels = value;
	        this.updatePadding();
	    };

	    Object.defineProperties( BlurFilter.prototype, prototypeAccessors );

	    return BlurFilter;
	}(Filter));

	/*!
	 * @pixi/filter-color-matrix - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-color-matrix is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var fragment$4 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (uAlpha == 0.0) {\n        gl_FragColor = c;\n        return;\n    }\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (c.a > 0.0) {\n      c.rgb /= c.a;\n    }\n\n    vec4 result;\n\n    result.r = (m[0] * c.r);\n        result.r += (m[1] * c.g);\n        result.r += (m[2] * c.b);\n        result.r += (m[3] * c.a);\n        result.r += m[4];\n\n    result.g = (m[5] * c.r);\n        result.g += (m[6] * c.g);\n        result.g += (m[7] * c.b);\n        result.g += (m[8] * c.a);\n        result.g += m[9];\n\n    result.b = (m[10] * c.r);\n       result.b += (m[11] * c.g);\n       result.b += (m[12] * c.b);\n       result.b += (m[13] * c.a);\n       result.b += m[14];\n\n    result.a = (m[15] * c.r);\n       result.a += (m[16] * c.g);\n       result.a += (m[17] * c.b);\n       result.a += (m[18] * c.a);\n       result.a += m[19];\n\n    vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n    // Premultiply alpha again.\n    rgb *= result.a;\n\n    gl_FragColor = vec4(rgb, result.a);\n}\n";

	/**
	 * 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
	 *  let colorMatrix = new PIXI.filters.ColorMatrixFilter();
	 *  container.filters = [colorMatrix];
	 *  colorMatrix.contrast(2);
	 * ```
	 * @author Clément Chenebault <clement@goodboydigital.com>
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 */
	var ColorMatrixFilter = /*@__PURE__*/(function (Filter) {
	    function ColorMatrixFilter()
	    {
	        var uniforms = {
	            m: new Float32Array([1, 0, 0, 0, 0,
	                0, 1, 0, 0, 0,
	                0, 0, 1, 0, 0,
	                0, 0, 0, 1, 0]),
	            uAlpha: 1,
	        };

	        Filter.call(this, defaultFilter, fragment$4, uniforms);

	        this.alpha = 1;
	    }

	    if ( Filter ) { ColorMatrixFilter.__proto__ = Filter; }
	    ColorMatrixFilter.prototype = Object.create( Filter && Filter.prototype );
	    ColorMatrixFilter.prototype.constructor = ColorMatrixFilter;

	    var prototypeAccessors = { matrix: { configurable: true },alpha: { configurable: true } };

	    /**
	     * Transforms current matrix and set the new one
	     *
	     * @param {number[]} matrix - 5x4 matrix
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype._loadMatrix = function _loadMatrix (matrix, multiply)
	    {
	        if ( multiply === void 0 ) { multiply = false; }

	        var newMatrix = matrix;

	        if (multiply)
	        {
	            this._multiply(newMatrix, this.uniforms.m, matrix);
	            newMatrix = this._colorMatrix(newMatrix);
	        }

	        // set the new matrix
	        this.uniforms.m = newMatrix;
	    };

	    /**
	     * Multiplies two mat5's
	     *
	     * @private
	     * @param {number[]} out - 5x4 matrix the receiving matrix
	     * @param {number[]} a - 5x4 matrix the first operand
	     * @param {number[]} b - 5x4 matrix the second operand
	     * @returns {number[]} 5x4 matrix
	     */
	    ColorMatrixFilter.prototype._multiply = function _multiply (out, a, b)
	    {
	        // 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]) + a[4];

	        // 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]) + a[9];

	        // 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]) + a[14];

	        // 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]) + a[19];

	        return out;
	    };

	    /**
	     * Create a Float32 Array and normalize the offset component to 0-1
	     *
	     * @private
	     * @param {number[]} matrix - 5x4 matrix
	     * @return {number[]} 5x4 matrix with all values between 0-1
	     */
	    ColorMatrixFilter.prototype._colorMatrix = function _colorMatrix (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;

	        return m;
	    };

	    /**
	     * Adjusts brightness
	     *
	     * @param {number} b - value of the brigthness (0-1, where 0 is black)
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.brightness = function brightness (b, multiply)
	    {
	        var matrix = [
	            b, 0, 0, 0, 0,
	            0, b, 0, 0, 0,
	            0, 0, b, 0, 0,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Set the matrices in grey scales
	     *
	     * @param {number} scale - value of the grey (0-1, where 0 is black)
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.greyscale = function greyscale (scale, multiply)
	    {
	        var matrix = [
	            scale, scale, scale, 0, 0,
	            scale, scale, scale, 0, 0,
	            scale, scale, scale, 0, 0,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Set the black and white matrice.
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.blackAndWhite = function blackAndWhite (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 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Set the hue property of the color
	     *
	     * @param {number} rotation - in degrees
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.hue = function hue (rotation, multiply)
	    {
	        rotation = (rotation || 0) / 180 * Math.PI;

	        var cosR = Math.cos(rotation);
	        var sinR = Math.sin(rotation);
	        var sqrt = Math.sqrt;

	        /* a good approximation for hue rotation
	         This matrix is far better than the versions with magic luminance constants
	         formerly used here, but also used in the starling framework (flash) and known from this
	         old part of the internet: quasimondo.com/archives/000565.php

	         This new matrix is based on rgb cube rotation in space. Look here for a more descriptive
	         implementation as a shader not a general matrix:
	         https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js

	         This is the source for the code:
	         see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751
	         */

	        var w = 1 / 3;
	        var sqrW = sqrt(w); // weight is

	        var a00 = cosR + ((1.0 - cosR) * w);
	        var a01 = (w * (1.0 - cosR)) - (sqrW * sinR);
	        var a02 = (w * (1.0 - cosR)) + (sqrW * sinR);

	        var a10 = (w * (1.0 - cosR)) + (sqrW * sinR);
	        var a11 = cosR + (w * (1.0 - cosR));
	        var a12 = (w * (1.0 - cosR)) - (sqrW * sinR);

	        var a20 = (w * (1.0 - cosR)) - (sqrW * sinR);
	        var a21 = (w * (1.0 - cosR)) + (sqrW * sinR);
	        var a22 = cosR + (w * (1.0 - cosR));

	        var matrix = [
	            a00, a01, a02, 0, 0,
	            a10, a11, a12, 0, 0,
	            a20, a21, a22, 0, 0,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * 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 {number} amount - value of the contrast (0-1)
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.contrast = function contrast (amount, multiply)
	    {
	        var v = (amount || 0) + 1;
	        var o = -0.5 * (v - 1);

	        var matrix = [
	            v, 0, 0, 0, o,
	            0, v, 0, 0, o,
	            0, 0, v, 0, o,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Set the saturation matrix, increase the separation between colors
	     * Increase saturation : increase contrast, brightness, and sharpness
	     *
	     * @param {number} amount - The saturation amount (0-1)
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.saturate = function saturate (amount, multiply)
	    {
	        if ( amount === void 0 ) { amount = 0; }

	        var x = (amount * 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);
	    };

	    /**
	     * Desaturate image (remove color)
	     *
	     * Call the saturate function
	     *
	     */
	    ColorMatrixFilter.prototype.desaturate = function desaturate () // eslint-disable-line no-unused-vars
	    {
	        this.saturate(-1);
	    };

	    /**
	     * Negative image (inverse of classic rgb matrix)
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.negative = function negative (multiply)
	    {
	        var matrix = [
	            -1, 0, 0, 1, 0,
	            0, -1, 0, 1, 0,
	            0, 0, -1, 1, 0,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Sepia image
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.sepia = function sepia (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);
	    };

	    /**
	     * Color motion picture process invented in 1916 (thanks Dominic Szablewski)
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.technicolor = function technicolor (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);
	    };

	    /**
	     * Polaroid filter
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.polaroid = function polaroid (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 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Filter who transforms : Red -> Blue and Blue -> Red
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.toBGR = function toBGR (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);
	    };

	    /**
	     * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.kodachrome = function kodachrome (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 {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.browni = function browni (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 {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.vintage = function vintage (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 {number} desaturation - Tone values.
	     * @param {number} toned - Tone values.
	     * @param {string} lightColor - Tone values, example: `0xFFE580`
	     * @param {string} darkColor - Tone values, example: `0xFFE580`
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.colorTone = function colorTone (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;

	        var dR = ((darkColor >> 16) & 0xFF) / 255;
	        var dG = ((darkColor >> 8) & 0xFF) / 255;
	        var dB = (darkColor & 0xFF) / 255;

	        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);
	    };

	    /**
	     * Night effect
	     *
	     * @param {number} intensity - The intensity of the night effect.
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.night = function night (intensity, multiply)
	    {
	        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);
	    };

	    /**
	     * Predator effect
	     *
	     * Erase the current matrix by setting a new indepent one
	     *
	     * @param {number} amount - how much the predator feels his future victim
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.predator = function predator (amount, multiply)
	    {
	        var matrix = [
	            // row 1
	            11.224130630493164 * amount,
	            -4.794486999511719 * amount,
	            -2.8746118545532227 * amount,
	            0 * amount,
	            0.40342438220977783 * amount,
	            // row 2
	            -3.6330697536468506 * amount,
	            9.193157196044922 * amount,
	            -2.951810836791992 * amount,
	            0 * amount,
	            -1.316135048866272 * amount,
	            // row 3
	            -3.2184197902679443 * amount,
	            -4.2375030517578125 * amount,
	            7.476448059082031 * amount,
	            0 * amount,
	            0.8044459223747253 * amount,
	            // row 4
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * LSD effect
	     *
	     * Multiply the current matrix
	     *
	     * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,
	     *  just set the current matrix with @param matrix
	     */
	    ColorMatrixFilter.prototype.lsd = function lsd (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 ];

	        this._loadMatrix(matrix, multiply);
	    };

	    /**
	     * Erase the current matrix by setting the default one
	     *
	     */
	    ColorMatrixFilter.prototype.reset = function reset ()
	    {
	        var matrix = [
	            1, 0, 0, 0, 0,
	            0, 1, 0, 0, 0,
	            0, 0, 1, 0, 0,
	            0, 0, 0, 1, 0 ];

	        this._loadMatrix(matrix, false);
	    };

	    /**
	     * The matrix of the color matrix filter
	     *
	     * @member {number[]}
	     * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]
	     */
	    prototypeAccessors.matrix.get = function ()
	    {
	        return this.uniforms.m;
	    };

	    prototypeAccessors.matrix.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.m = value;
	    };

	    /**
	     * The opacity value to use when mixing the original and resultant colors.
	     *
	     * When the value is 0, the original color is used without modification.
	     * When the value is 1, the result color is used.
	     * When in the range (0, 1) the color is interpolated between the original and result by this amount.
	     *
	     * @member {number}
	     * @default 1
	     */
	    prototypeAccessors.alpha.get = function ()
	    {
	        return this.uniforms.uAlpha;
	    };

	    prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.uAlpha = value;
	    };

	    Object.defineProperties( ColorMatrixFilter.prototype, prototypeAccessors );

	    return ColorMatrixFilter;
	}(Filter));

	// Americanized alias
	ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;

	/*!
	 * @pixi/filter-displacement - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-displacement is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var vertex$3 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0)  ).xy;\n}\n";

	var fragment$5 = "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n  vec4 map =  texture2D(mapSampler, vFilterCoord);\n\n  map -= 0.5;\n  map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n";

	/**
	 * 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 way it works is it uses the values of the displacement map to look up the
	 * correct pixels to output. This means it's not technically moving the original.
	 * Instead, it's starting at the output and asking "which pixel from the original goes here".
	 * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,
	 * this filter will output the pixel approximately 20 pixels to the right of the original.
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 */
	var DisplacementFilter = /*@__PURE__*/(function (Filter) {
	    function DisplacementFilter(sprite, scale)
	    {
	        var maskMatrix = new Matrix();

	        sprite.renderable = false;

	        Filter.call(this, vertex$3, fragment$5, {
	            mapSampler: sprite._texture,
	            filterMatrix: maskMatrix,
	            scale: { x: 1, y: 1 },
	            rotation: new Float32Array([1, 0, 0, 1]),
	        });

	        this.maskSprite = sprite;
	        this.maskMatrix = maskMatrix;

	        if (scale === null || scale === undefined)
	        {
	            scale = 20;
	        }

	        /**
	         * scaleX, scaleY for displacements
	         * @member {PIXI.Point}
	         */
	        this.scale = new Point(scale, scale);
	    }

	    if ( Filter ) { DisplacementFilter.__proto__ = Filter; }
	    DisplacementFilter.prototype = Object.create( Filter && Filter.prototype );
	    DisplacementFilter.prototype.constructor = DisplacementFilter;

	    var prototypeAccessors = { map: { configurable: true } };

	    /**
	     * Applies the filter.
	     *
	     * @param {PIXI.systems.FilterSystem} filterManager - The manager.
	     * @param {PIXI.RenderTexture} input - The input target.
	     * @param {PIXI.RenderTexture} output - The output target.
	     * @param {boolean} clear - Should the output be cleared before rendering to it.
	     */
	    DisplacementFilter.prototype.apply = function apply (filterManager, input, output, clear)
	    {
	        // fill maskMatrix with _normalized sprite texture coords_
	        this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);
	        this.uniforms.scale.x = this.scale.x;
	        this.uniforms.scale.y = this.scale.y;

	        // Extract rotation from world transform
	        var wt = this.maskSprite.transform.worldTransform;
	        var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));
	        var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));

	        if (lenX !== 0 && lenY !== 0)
	        {
	            this.uniforms.rotation[0] = wt.a / lenX;
	            this.uniforms.rotation[1] = wt.b / lenX;
	            this.uniforms.rotation[2] = wt.c / lenY;
	            this.uniforms.rotation[3] = wt.d / lenY;
	        }

	        // draw the filter...
	        filterManager.applyFilter(this, input, output, clear);
	    };

	    /**
	     * The texture used for the displacement map. Must be power of 2 sized texture.
	     *
	     * @member {PIXI.Texture}
	     */
	    prototypeAccessors.map.get = function ()
	    {
	        return this.uniforms.mapSampler;
	    };

	    prototypeAccessors.map.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.mapSampler = value;
	    };

	    Object.defineProperties( DisplacementFilter.prototype, prototypeAccessors );

	    return DisplacementFilter;
	}(Filter));

	/*!
	 * @pixi/filter-fxaa - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-fxaa is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var vertex$4 = "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n               out vec2 v_rgbNW, out vec2 v_rgbNE,\n               out vec2 v_rgbSW, out vec2 v_rgbSE,\n               out vec2 v_rgbM) {\n    v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n    v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n    v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n    v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n    v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n   gl_Position = filterVertexPosition();\n\n   vFragCoord = aVertexPosition * outputFrame.zw;\n\n   texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n";

	var fragment$6 = "varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it's\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN   (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL   (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX     8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n          vec2 v_rgbNW, vec2 v_rgbNE,\n          vec2 v_rgbSW, vec2 v_rgbSE,\n          vec2 v_rgbM) {\n    vec4 color;\n    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n    vec4 texColor = texture2D(tex, v_rgbM);\n    vec3 rgbM  = texColor.xyz;\n    vec3 luma = vec3(0.299, 0.587, 0.114);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    mediump vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n                  dir * rcpDirMin)) * inverseVP;\n\n    vec3 rgbA = 0.5 * (\n                       texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n                       texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n    vec3 rgbB = rgbA * 0.5 + 0.25 * (\n                                     texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n                                     texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n    float lumaB = dot(rgbB, luma);\n    if ((lumaB < lumaMin) || (lumaB > lumaMax))\n        color = vec4(rgbA, texColor.a);\n    else\n        color = vec4(rgbB, texColor.a);\n    return color;\n}\n\nvoid main() {\n\n      vec4 color;\n\n      color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n      gl_FragColor = color;\n}\n";

	/**
	 * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com
	 * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.
	 *
	 * @see https://github.com/mitsuhiko/webgl-meincraft
	 *
	 * @class
	 * @extends PIXI.Filter
	 * @memberof PIXI.filters
	 *
	 */
	var FXAAFilter = /*@__PURE__*/(function (Filter) {
	    function FXAAFilter()
	    {
	        // TODO - needs work
	        Filter.call(this, vertex$4, fragment$6);
	    }

	    if ( Filter ) { FXAAFilter.__proto__ = Filter; }
	    FXAAFilter.prototype = Object.create( Filter && Filter.prototype );
	    FXAAFilter.prototype.constructor = FXAAFilter;

	    return FXAAFilter;
	}(Filter));

	/*!
	 * @pixi/filter-noise - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/filter-noise is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var fragment$7 = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    float randomValue = rand(gl_FragCoord.xy * uSeed);\n    float diff = (randomValue - 0.5) * uNoise;\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (color.a > 0.0) {\n        color.rgb /= color.a;\n    }\n\n    color.r += diff;\n    color.g += diff;\n    color.b += diff;\n\n    // Premultiply alpha again.\n    color.rgb *= color.a;\n\n    gl_FragColor = color;\n}\n";

	/**
	 * @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.Filter
	 * @memberof PIXI.filters
	 */
	var NoiseFilter = /*@__PURE__*/(function (Filter) {
	    function NoiseFilter(noise, seed)
	    {
	        if ( noise === void 0 ) { noise = 0.5; }
	        if ( seed === void 0 ) { seed = Math.random(); }

	        Filter.call(this, defaultFilter, fragment$7, {
	            uNoise: 0,
	            uSeed: 0,
	        });

	        this.noise = noise;
	        this.seed = seed;
	    }

	    if ( Filter ) { NoiseFilter.__proto__ = Filter; }
	    NoiseFilter.prototype = Object.create( Filter && Filter.prototype );
	    NoiseFilter.prototype.constructor = NoiseFilter;

	    var prototypeAccessors = { noise: { configurable: true },seed: { configurable: true } };

	    /**
	     * The amount of noise to apply, this value should be in the range (0, 1].
	     *
	     * @member {number}
	     * @default 0.5
	     */
	    prototypeAccessors.noise.get = function ()
	    {
	        return this.uniforms.uNoise;
	    };

	    prototypeAccessors.noise.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.uNoise = value;
	    };

	    /**
	     * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.
	     *
	     * @member {number}
	     */
	    prototypeAccessors.seed.get = function ()
	    {
	        return this.uniforms.uSeed;
	    };

	    prototypeAccessors.seed.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this.uniforms.uSeed = value;
	    };

	    Object.defineProperties( NoiseFilter.prototype, prototypeAccessors );

	    return NoiseFilter;
	}(Filter));

	/*!
	 * @pixi/mixin-cache-as-bitmap - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var _tempMatrix = new Matrix();

	DisplayObject.prototype._cacheAsBitmap = false;
	DisplayObject.prototype._cacheData = false;

	// figured theres no point adding ALL the extra variables to prototype.
	// this model can hold the information needed. This can also be generated on demand as
	// most objects are not cached as bitmaps.
	/**
	 * @class
	 * @ignore
	 */
	var CacheData = function CacheData()
	{
	    this.textureCacheId = null;

	    this.originalRender = null;
	    this.originalRenderCanvas = null;
	    this.originalCalculateBounds = null;
	    this.originalGetLocalBounds = null;

	    this.originalUpdateTransform = null;
	    this.originalHitTest = null;
	    this.originalDestroy = null;
	    this.originalMask = null;
	    this.originalFilterArea = null;
	    this.sprite = null;
	};

	Object.defineProperties(DisplayObject.prototype, {
	    /**
	     * 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 `false`
	     *
	     * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true
	     * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.
	     *
	     * @member {boolean}
	     * @memberof PIXI.DisplayObject#
	     */
	    cacheAsBitmap: {
	        get: function get()
	        {
	            return this._cacheAsBitmap;
	        },
	        set: function set(value)
	        {
	            if (this._cacheAsBitmap === value)
	            {
	                return;
	            }

	            this._cacheAsBitmap = value;

	            var data;

	            if (value)
	            {
	                if (!this._cacheData)
	                {
	                    this._cacheData = new CacheData();
	                }

	                data = this._cacheData;

	                data.originalRender = this.render;
	                data.originalRenderCanvas = this.renderCanvas;

	                data.originalUpdateTransform = this.updateTransform;
	                data.originalCalculateBounds = this.calculateBounds;
	                data.originalGetLocalBounds = this.getLocalBounds;

	                data.originalDestroy = this.destroy;

	                data.originalContainsPoint = this.containsPoint;

	                data.originalMask = this._mask;
	                data.originalFilterArea = this.filterArea;

	                this.render = this._renderCached;
	                this.renderCanvas = this._renderCachedCanvas;

	                this.destroy = this._cacheAsBitmapDestroy;
	            }
	            else
	            {
	                data = this._cacheData;

	                if (data.sprite)
	                {
	                    this._destroyCachedDisplayObject();
	                }

	                this.render = data.originalRender;
	                this.renderCanvas = data.originalRenderCanvas;
	                this.calculateBounds = data.originalCalculateBounds;
	                this.getLocalBounds = data.originalGetLocalBounds;

	                this.destroy = data.originalDestroy;

	                this.updateTransform = data.originalUpdateTransform;
	                this.containsPoint = data.originalContainsPoint;

	                this._mask = data.originalMask;
	                this.filterArea = data.originalFilterArea;
	            }
	        },
	    },
	});

	/**
	 * Renders a cached version of the sprite with WebGL
	 *
	 * @private
	 * @function _renderCached
	 * @memberof PIXI.DisplayObject#
	 * @param {PIXI.Renderer} renderer - the WebGL renderer
	 */
	DisplayObject.prototype._renderCached = function _renderCached(renderer)
	{
	    if (!this.visible || this.worldAlpha <= 0 || !this.renderable)
	    {
	        return;
	    }

	    this._initCachedDisplayObject(renderer);

	    this._cacheData.sprite.transform._worldID = this.transform._worldID;
	    this._cacheData.sprite.worldAlpha = this.worldAlpha;
	    this._cacheData.sprite._render(renderer);
	};

	/**
	 * Prepares the WebGL renderer to cache the sprite
	 *
	 * @private
	 * @function _initCachedDisplayObject
	 * @memberof PIXI.DisplayObject#
	 * @param {PIXI.Renderer} renderer - the WebGL renderer
	 */
	DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer)
	{
	    if (this._cacheData && this._cacheData.sprite)
	    {
	        return;
	    }

	    // make sure alpha is set to 1 otherwise it will get rendered as invisible!
	    var cacheAlpha = this.alpha;

	    this.alpha = 1;

	    // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)
	    renderer.batch.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();

	    // add some padding!
	    if (this.filters)
	    {
	        var padding = this.filters[0].padding;

	        bounds.pad(padding);
	    }

	    bounds.ceil(settings.RESOLUTION);

	    // for now we cache the current renderTarget that the WebGL renderer is currently using.
	    // this could be more elegant..
	    var cachedRenderTexture = renderer.renderTexture.current;
	    var cachedSourceFrame = renderer.renderTexture.sourceFrame;
	    var cachedProjectionTransform = renderer.projection.transform;

	    // We also store the filter stack - I will definitely look to change how this works a little later down the line.
	    // const stack = renderer.filterManager.filterStack;

	    // this renderTexture will be used to store the cached DisplayObject
	    var renderTexture = RenderTexture.create(bounds.width, bounds.height);

	    var textureCacheId = "cacheAsBitmap_" + (uid());

	    this._cacheData.textureCacheId = textureCacheId;

	    BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);
	    Texture.addToCache(renderTexture, textureCacheId);

	    // need to set //
	    var m = _tempMatrix;

	    m.tx = -bounds.x;
	    m.ty = -bounds.y;

	    // reset
	    this.transform.worldTransform.identity();

	    // set all properties to there original so we can render to a texture
	    this.render = this._cacheData.originalRender;

	    renderer.render(this, renderTexture, true, m, true);

	    // now restore the state be setting the new properties
	    renderer.projection.transform = cachedProjectionTransform;
	    renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);

	    // renderer.filterManager.filterStack = stack;

	    this.render = this._renderCached;
	    // the rest is the same as for Canvas
	    this.updateTransform = this.displayObjectUpdateTransform;
	    this.calculateBounds = this._calculateCachedBounds;
	    this.getLocalBounds = this._getCachedLocalBounds;

	    this._mask = null;
	    this.filterArea = null;

	    // create our cached sprite
	    var cachedSprite = new Sprite(renderTexture);

	    cachedSprite.transform.worldTransform = this.transform.worldTransform;
	    cachedSprite.anchor.x = -(bounds.x / bounds.width);
	    cachedSprite.anchor.y = -(bounds.y / bounds.height);
	    cachedSprite.alpha = cacheAlpha;
	    cachedSprite._bounds = this._bounds;

	    this._cacheData.sprite = cachedSprite;

	    this.transform._parentID = -1;
	    // restore the transform of the cached sprite to avoid the nasty flicker..
	    if (!this.parent)
	    {
	        this.parent = renderer._tempDisplayObjectParent;
	        this.updateTransform();
	        this.parent = null;
	    }
	    else
	    {
	        this.updateTransform();
	    }

	    // map the hit test..
	    this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);
	};

	/**
	 * Renders a cached version of the sprite with canvas
	 *
	 * @private
	 * @function _renderCachedCanvas
	 * @memberof PIXI.DisplayObject#
	 * @param {PIXI.Renderer} renderer - the WebGL renderer
	 */
	DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer)
	{
	    if (!this.visible || this.worldAlpha <= 0 || !this.renderable)
	    {
	        return;
	    }

	    this._initCachedDisplayObjectCanvas(renderer);

	    this._cacheData.sprite.worldAlpha = this.worldAlpha;
	    this._cacheData.sprite._renderCanvas(renderer);
	};

	// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..
	/**
	 * Prepares the Canvas renderer to cache the sprite
	 *
	 * @private
	 * @function _initCachedDisplayObjectCanvas
	 * @memberof PIXI.DisplayObject#
	 * @param {PIXI.Renderer} renderer - the WebGL renderer
	 */
	DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer)
	{
	    if (this._cacheData && this._cacheData.sprite)
	    {
	        return;
	    }

	    // get bounds actually transforms the object for us already!
	    var bounds = this.getLocalBounds();

	    var cacheAlpha = this.alpha;

	    this.alpha = 1;

	    var cachedRenderTarget = renderer.context;

	    bounds.ceil(settings.RESOLUTION);

	    var renderTexture = RenderTexture.create(bounds.width, bounds.height);

	    var textureCacheId = "cacheAsBitmap_" + (uid());

	    this._cacheData.textureCacheId = textureCacheId;

	    BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);
	    Texture.addToCache(renderTexture, textureCacheId);

	    // need to set //
	    var m = _tempMatrix;

	    this.transform.localTransform.copyTo(m);
	    m.invert();

	    m.tx -= bounds.x;
	    m.ty -= bounds.y;

	    // m.append(this.transform.worldTransform.)
	    // set all properties to there original so we can render to a texture
	    this.renderCanvas = this._cacheData.originalRenderCanvas;

	    // renderTexture.render(this, m, true);
	    renderer.render(this, renderTexture, true, m, false);

	    // now restore the state be setting the new properties
	    renderer.context = cachedRenderTarget;

	    this.renderCanvas = this._renderCachedCanvas;
	    // the rest is the same as for WebGL
	    this.updateTransform = this.displayObjectUpdateTransform;
	    this.calculateBounds = this._calculateCachedBounds;
	    this.getLocalBounds = this._getCachedLocalBounds;

	    this._mask = null;
	    this.filterArea = null;

	    // create our cached sprite
	    var cachedSprite = new Sprite(renderTexture);

	    cachedSprite.transform.worldTransform = this.transform.worldTransform;
	    cachedSprite.anchor.x = -(bounds.x / bounds.width);
	    cachedSprite.anchor.y = -(bounds.y / bounds.height);
	    cachedSprite.alpha = cacheAlpha;
	    cachedSprite._bounds = this._bounds;

	    this._cacheData.sprite = cachedSprite;

	    this.transform._parentID = -1;
	    // restore the transform of the cached sprite to avoid the nasty flicker..
	    if (!this.parent)
	    {
	        this.parent = renderer._tempDisplayObjectParent;
	        this.updateTransform();
	        this.parent = null;
	    }
	    else
	    {
	        this.updateTransform();
	    }

	    // map the hit test..
	    this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);
	};

	/**
	 * Calculates the bounds of the cached sprite
	 *
	 * @private
	 */
	DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds()
	{
	    this._bounds.clear();
	    this._cacheData.sprite.transform._worldID = this.transform._worldID;
	    this._cacheData.sprite._calculateBounds();
	    this._lastBoundsID = this._boundsID;
	};

	/**
	 * Gets the bounds of the cached sprite.
	 *
	 * @private
	 * @return {Rectangle} The local bounds.
	 */
	DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds()
	{
	    return this._cacheData.sprite.getLocalBounds();
	};

	/**
	 * Destroys the cached sprite.
	 *
	 * @private
	 */
	DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject()
	{
	    this._cacheData.sprite._texture.destroy(true);
	    this._cacheData.sprite = null;

	    BaseTexture.removeFromCache(this._cacheData.textureCacheId);
	    Texture.removeFromCache(this._cacheData.textureCacheId);

	    this._cacheData.textureCacheId = null;
	};

	/**
	 * Destroys the cached object.
	 *
	 * @private
	 * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	 *  have been set to that value.
	 *  Used when destroying containers, see the Container.destroy method.
	 */
	DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options)
	{
	    this.cacheAsBitmap = false;
	    this.destroy(options);
	};

	/*!
	 * @pixi/mixin-get-child-by-name - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/mixin-get-child-by-name is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * The instance name of the object.
	 *
	 * @memberof PIXI.DisplayObject#
	 * @member {string} name
	 */
	DisplayObject.prototype.name = null;

	/**
	 * Returns the display object in the container.
	 *
	 * @method getChildByName
	 * @memberof PIXI.Container#
	 * @param {string} name - Instance name.
	 * @return {PIXI.DisplayObject} The child with the specified name.
	 */
	Container.prototype.getChildByName = function getChildByName(name)
	{
	    for (var i = 0; i < this.children.length; i++)
	    {
	        if (this.children[i].name === name)
	        {
	            return this.children[i];
	        }
	    }

	    return null;
	};

	/*!
	 * @pixi/mixin-get-global-position - v5.1.3
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/mixin-get-global-position is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.
	 *
	 * @method getGlobalPosition
	 * @memberof PIXI.DisplayObject#
	 * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.
	 * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from
	 *  being updated. This means the calculation returned MAY be out of date BUT will give you a
	 *  nice performance boost.
	 * @return {PIXI.Point} The updated point.
	 */
	DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate)
	{
	    if ( point === void 0 ) { point = new Point(); }
	    if ( skipUpdate === void 0 ) { skipUpdate = false; }

	    if (this.parent)
	    {
	        this.parent.toGlobal(this.position, point, skipUpdate);
	    }
	    else
	    {
	        point.x = this.position.x;
	        point.y = this.position.y;
	    }

	    return point;
	};

	var v5 = '5.0.0';

	/**
	 * Deprecations (backward compatibilities) are automatically applied for browser bundles
	 * in the UMD module format. If using Webpack or Rollup, you'll need to apply these
	 * deprecations manually by doing something like this:
	 * @example
	 * import * as PIXI from 'pixi.js';
	 * PIXI.useDeprecated(); // MUST be bound to namespace
	 * @memberof PIXI
	 * @function useDeprecated
	 */
	function useDeprecated()
	{
	    var PIXI = this;

	    Object.defineProperties(PIXI, {
	        /**
	         * @constant {RegExp|string} SVG_SIZE
	         * @memberof PIXI
	         * @see PIXI.resources.SVGResource.SVG_SIZE
	         * @deprecated since 5.0.0
	         */
	        SVG_SIZE: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');

	                return PIXI.SVGResource.SVG_SIZE;
	            },
	        },

	        /**
	         * @class PIXI.TransformStatic
	         * @deprecated since 5.0.0
	         * @see PIXI.Transform
	         */
	        TransformStatic: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');

	                return PIXI.Transform;
	            },
	        },

	        /**
	         * @class PIXI.TransformBase
	         * @deprecated since 5.0.0
	         * @see PIXI.Transform
	         */
	        TransformBase: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');

	                return PIXI.Transform;
	            },
	        },

	        /**
	         * Constants that specify the transform type.
	         *
	         * @static
	         * @constant
	         * @name TRANSFORM_MODE
	         * @memberof PIXI
	         * @enum {number}
	         * @deprecated since 5.0.0
	         * @property {number} STATIC
	         * @property {number} DYNAMIC
	         */
	        TRANSFORM_MODE: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');

	                return { STATIC: 0, DYNAMIC: 1 };
	            },
	        },

	        /**
	         * @class PIXI.WebGLRenderer
	         * @see PIXI.Renderer
	         * @deprecated since 5.0.0
	         */
	        WebGLRenderer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');

	                return PIXI.Renderer;
	            },
	        },

	        /**
	         * @class PIXI.CanvasRenderTarget
	         * @see PIXI.utils.CanvasRenderTarget
	         * @deprecated since 5.0.0
	         */
	        CanvasRenderTarget: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');

	                return PIXI.utils.CanvasRenderTarget;
	            },
	        },

	        /**
	         * @memberof PIXI
	         * @name loader
	         * @type {PIXI.Loader}
	         * @see PIXI.Loader.shared
	         * @deprecated since 5.0.0
	         */
	        loader: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');

	                return PIXI.Loader.shared;
	            },
	        },

	        /**
	         * @class PIXI.FilterManager
	         * @see PIXI.systems.FilterSystem
	         * @deprecated since 5.0.0
	         */
	        FilterManager: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');

	                return PIXI.systems.FilterSystem;
	            },
	        },
	    });

	    /**
	     * This namespace has been removed. All classes previous nested
	     * under this namespace have been moved to the top-level `PIXI` object.
	     * @namespace PIXI.extras
	     * @deprecated since 5.0.0
	     */
	    PIXI.extras = {};

	    Object.defineProperties(PIXI.extras, {
	        /**
	         * @class PIXI.extras.TilingSprite
	         * @see PIXI.TilingSprite
	         * @deprecated since 5.0.0
	         */
	        TilingSprite: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');

	                return PIXI.TilingSprite;
	            },
	        },
	        /**
	         * @class PIXI.extras.TilingSpriteRenderer
	         * @see PIXI.TilingSpriteRenderer
	         * @deprecated since 5.0.0
	         */
	        TilingSpriteRenderer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');

	                return PIXI.TilingSpriteRenderer;
	            },
	        },
	        /**
	         * @class PIXI.extras.AnimatedSprite
	         * @see PIXI.AnimatedSprite
	         * @deprecated since 5.0.0
	         */
	        AnimatedSprite: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');

	                return PIXI.AnimatedSprite;
	            },
	        },
	        /**
	         * @class PIXI.extras.BitmapText
	         * @see PIXI.BitmapText
	         * @deprecated since 5.0.0
	         */
	        BitmapText: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');

	                return PIXI.BitmapText;
	            },
	        },
	    });

	    Object.defineProperties(PIXI.utils, {
	        /**
	         * @function PIXI.utils.getSvgSize
	         * @see PIXI.resources.SVGResource.getSize
	         * @deprecated since 5.0.0
	         */
	        getSvgSize: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');

	                return PIXI.SVGResource.getSize;
	            },
	        },
	    });

	    /**
	     * All classes on this namespace have moved to the high-level `PIXI` object.
	     * @namespace PIXI.mesh
	     * @deprecated since 5.0.0
	     */
	    PIXI.mesh = {};

	    Object.defineProperties(PIXI.mesh, {
	        /**
	         * @class PIXI.mesh.Mesh
	         * @see PIXI.SimpleMesh
	         * @deprecated since 5.0.0
	         */
	        Mesh: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');

	                return PIXI.SimpleMesh;
	            },
	        },
	        /**
	         * @class PIXI.mesh.NineSlicePlane
	         * @see PIXI.NineSlicePlane
	         * @deprecated since 5.0.0
	         */
	        NineSlicePlane: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');

	                return PIXI.NineSlicePlane;
	            },
	        },
	        /**
	         * @class PIXI.mesh.Plane
	         * @see PIXI.SimplePlane
	         * @deprecated since 5.0.0
	         */
	        Plane: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');

	                return PIXI.SimplePlane;
	            },
	        },
	        /**
	         * @class PIXI.mesh.Rope
	         * @see PIXI.SimpleRope
	         * @deprecated since 5.0.0
	         */
	        Rope: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');

	                return PIXI.SimpleRope;
	            },
	        },
	        /**
	         * @class PIXI.mesh.RawMesh
	         * @see PIXI.Mesh
	         * @deprecated since 5.0.0
	         */
	        RawMesh: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');

	                return PIXI.Mesh;
	            },
	        },
	        /**
	         * @class PIXI.mesh.CanvasMeshRenderer
	         * @see PIXI.CanvasMeshRenderer
	         * @deprecated since 5.0.0
	         */
	        CanvasMeshRenderer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');

	                return PIXI.CanvasMeshRenderer;
	            },
	        },
	        /**
	         * @class PIXI.mesh.MeshRenderer
	         * @see PIXI.MeshRenderer
	         * @deprecated since 5.0.0
	         */
	        MeshRenderer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');

	                return PIXI.MeshRenderer;
	            },
	        },
	    });

	    /**
	     * This namespace has been removed and items have been moved to
	     * the top-level `PIXI` object.
	     * @namespace PIXI.particles
	     * @deprecated since 5.0.0
	     */
	    PIXI.particles = {};

	    Object.defineProperties(PIXI.particles, {
	        /**
	         * @class PIXI.particles.ParticleContainer
	         * @deprecated since 5.0.0
	         * @see PIXI.ParticleContainer
	         */
	        ParticleContainer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');

	                return PIXI.ParticleContainer;
	            },
	        },
	        /**
	         * @class PIXI.particles.ParticleRenderer
	         * @deprecated since 5.0.0
	         * @see PIXI.ParticleRenderer
	         */
	        ParticleRenderer: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');

	                return PIXI.ParticleRenderer;
	            },
	        },
	    });

	    /**
	     * This namespace has been removed and items have been moved to
	     * the top-level `PIXI` object.
	     * @namespace PIXI.ticker
	     * @deprecated since 5.0.0
	     */
	    PIXI.ticker = {};

	    Object.defineProperties(PIXI.ticker, {
	        /**
	         * @class PIXI.ticker.Ticker
	         * @deprecated since 5.0.0
	         * @see PIXI.Ticker
	         */
	        Ticker: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');

	                return PIXI.Ticker;
	            },
	        },
	        /**
	         * @name PIXI.ticker.shared
	         * @type {PIXI.Ticker}
	         * @deprecated since 5.0.0
	         * @see PIXI.Ticker.shared
	         */
	        shared: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');

	                return PIXI.Ticker.shared;
	            },
	        },
	    });

	    /**
	     * All classes on this namespace have moved to the high-level `PIXI` object.
	     * @namespace PIXI.loaders
	     * @deprecated since 5.0.0
	     */
	    PIXI.loaders = {};

	    Object.defineProperties(PIXI.loaders, {
	        /**
	         * @class PIXI.loaders.Loader
	         * @see PIXI.Loader
	         * @deprecated since 5.0.0
	         */
	        Loader: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');

	                return PIXI.Loader;
	            },
	        },
	        /**
	         * @class PIXI.loaders.Resource
	         * @see PIXI.LoaderResource
	         * @deprecated since 5.0.0
	         */
	        Resource: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');

	                return PIXI.LoaderResource;
	            },
	        },
	        /**
	         * @function PIXI.loaders.bitmapFontParser
	         * @see PIXI.BitmapFontLoader.use
	         * @deprecated since 5.0.0
	         */
	        bitmapFontParser: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');

	                return PIXI.BitmapFontLoader.use;
	            },
	        },
	        /**
	         * @function PIXI.loaders.parseBitmapFontData
	         * @see PIXI.BitmapFontLoader.parse
	         * @deprecated since 5.0.0
	         */
	        parseBitmapFontData: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has moved to PIXI.BitmapFontLoader.parse');

	                return PIXI.BitmapFontLoader.parse;
	            },
	        },
	        /**
	         * @function PIXI.loaders.spritesheetParser
	         * @see PIXI.SpritesheetLoader.use
	         * @deprecated since 5.0.0
	         */
	        spritesheetParser: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');

	                return PIXI.SpritesheetLoader.use;
	            },
	        },
	        /**
	         * @function PIXI.loaders.getResourcePath
	         * @see PIXI.SpritesheetLoader.getResourcePath
	         * @deprecated since 5.0.0
	         */
	        getResourcePath: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');

	                return PIXI.SpritesheetLoader.getResourcePath;
	            },
	        },
	    });

	    /**
	     * @function PIXI.loaders.Loader.addPixiMiddleware
	     * @see PIXI.Loader.registerPlugin
	     * @deprecated since 5.0.0
	     * @param {function} middleware
	     */
	    PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware)
	    {
	        deprecation(v5,
	            'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'
	        );

	        return PIXI.loaders.Loader.registerPlugin({ use: middleware() });
	    };

	    /**
	     * @class PIXI.extract.WebGLExtract
	     * @deprecated since 5.0.0
	     * @see PIXI.extract.Extract
	     */
	    Object.defineProperty(PIXI.extract, 'WebGLExtract', {
	        get: function get()
	        {
	            deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.extract.Extract');

	            return PIXI.extract.Extract;
	        },
	    });

	    /**
	     * @class PIXI.prepare.WebGLPrepare
	     * @deprecated since 5.0.0
	     * @see PIXI.prepare.Prepare
	     */
	    Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {
	        get: function get()
	        {
	            deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.prepare.Prepare');

	            return PIXI.prepare.Prepare;
	        },
	    });

	    /**
	     * @method PIXI.Container#_renderWebGL
	     * @private
	     * @deprecated since 5.0.0
	     * @see PIXI.Container#render
	     * @param {PIXI.Renderer} renderer Instance of renderer
	     */
	    PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer)
	    {
	        deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');

	        this._render(renderer);
	    };

	    /**
	     * @method PIXI.Container#renderWebGL
	     * @deprecated since 5.0.0
	     * @see PIXI.Container#render
	     * @param {PIXI.Renderer} renderer Instance of renderer
	     */
	    PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer)
	    {
	        deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');

	        this.render(renderer);
	    };

	    /**
	     * @method PIXI.DisplayObject#renderWebGL
	     * @deprecated since 5.0.0
	     * @see PIXI.DisplayObject#render
	     * @param {PIXI.Renderer} renderer Instance of renderer
	     */
	    PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer)
	    {
	        deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');

	        this.render(renderer);
	    };

	    /**
	     * @method PIXI.Container#renderAdvancedWebGL
	     * @deprecated since 5.0.0
	     * @see PIXI.Container#renderAdvanced
	     * @param {PIXI.Renderer} renderer Instance of renderer
	     */
	    PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer)
	    {
	        deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');

	        this.renderAdvanced(renderer);
	    };

	    Object.defineProperties(PIXI.settings, {
	        /**
	         * Default transform type.
	         *
	         * @static
	         * @deprecated since 5.0.0
	         * @memberof PIXI.settings
	         * @type {PIXI.TRANSFORM_MODE}
	         * @default PIXI.TRANSFORM_MODE.STATIC
	         */
	        TRANSFORM_MODE: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');

	                return 0;
	            },
	            set: function set()
	            {
	                deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');
	            },
	        },
	    });

	    var BaseTexture = PIXI.BaseTexture;

	    /**
	     * @method loadSource
	     * @memberof PIXI.BaseTexture#
	     * @deprecated since 5.0.0
	     */
	    BaseTexture.prototype.loadSource = function loadSource(image)
	    {
	        deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');

	        var resource = PIXI.resources.autoDetectResource(image);

	        resource.internal = true;

	        this.setResource(resource);
	        this.update();
	    };

	    Object.defineProperties(BaseTexture.prototype, {
	        /**
	         * @name PIXI.BaseTexture#hasLoaded
	         * @type {boolean}
	         * @deprecated since 5.0.0
	         * @readonly
	         * @see PIXI.BaseTexture#valid
	         */
	        hasLoaded: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');

	                return this.valid;
	            },
	        },
	        /**
	         * @name PIXI.BaseTexture#imageUrl
	         * @type {string}
	         * @deprecated since 5.0.0
	         * @see PIXI.resource.ImageResource#url
	         */
	        imageUrl: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');

	                return this.resource && this.resource.url;
	            },

	            set: function set(imageUrl)
	            {
	                deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');

	                if (this.resource)
	                {
	                    this.resource.url = imageUrl;
	                }
	            },
	        },
	        /**
	         * @name PIXI.BaseTexture#source
	         * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}
	         * @deprecated since 5.0.0
	         * @readonly
	         * @see PIXI.resources.BaseImageResource#source
	         */
	        source: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');

	                return this.resource && this.resource.source;
	            },
	            set: function set(source)
	            {
	                deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '
	                    + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');

	                if (this.resource)
	                {
	                    this.resource.source = source;
	                }
	            },
	        },
	    });

	    /**
	     * @method fromImage
	     * @static
	     * @memberof PIXI.BaseTexture
	     * @deprecated since 5.0.0
	     * @see PIXI.BaseTexture.from
	     */
	    BaseTexture.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale)
	    {
	        deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');

	        var resourceOptions = { scale: scale, crossorigin: crossorigin };

	        return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });
	    };

	    /**
	     * @method fromCanvas
	     * @static
	     * @memberof PIXI.BaseTexture
	     * @deprecated since 5.0.0
	     * @see PIXI.BaseTexture.from
	     */
	    BaseTexture.fromCanvas = function fromCanvas(canvas, scaleMode)
	    {
	        deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');

	        return BaseTexture.from(canvas, { scaleMode: scaleMode });
	    };

	    /**
	     * @method fromSVG
	     * @static
	     * @memberof PIXI.BaseTexture
	     * @deprecated since 5.0.0
	     * @see PIXI.BaseTexture.from
	     */
	    BaseTexture.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale)
	    {
	        deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');

	        var resourceOptions = { scale: scale, crossorigin: crossorigin };

	        return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });
	    };

	    /**
	     * @method PIXI.Point#copy
	     * @deprecated since 5.0.0
	     * @see PIXI.Point#copyFrom
	     */
	    PIXI.Point.prototype.copy = function copy(p)
	    {
	        deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');

	        return this.copyFrom(p);
	    };

	    /**
	     * @method PIXI.ObservablePoint#copy
	     * @deprecated since 5.0.0
	     * @see PIXI.ObservablePoint#copyFrom
	     */
	    PIXI.ObservablePoint.prototype.copy = function copy(p)
	    {
	        deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');

	        return this.copyFrom(p);
	    };

	    /**
	     * @method PIXI.Rectangle#copy
	     * @deprecated since 5.0.0
	     * @see PIXI.Rectangle#copyFrom
	     */
	    PIXI.Rectangle.prototype.copy = function copy(p)
	    {
	        deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');

	        return this.copyFrom(p);
	    };

	    /**
	     * @method PIXI.Matrix#copy
	     * @deprecated since 5.0.0
	     * @see PIXI.Matrix#copyTo
	     */
	    PIXI.Matrix.prototype.copy = function copy(p)
	    {
	        deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');

	        return this.copyTo(p);
	    };

	    /**
	     * @method PIXI.systems.StateSystem#setState
	     * @deprecated since 5.1.0
	     * @see PIXI.systems.StateSystem#set
	     */
	    PIXI.systems.StateSystem.prototype.setState = function setState(s)
	    {
	        deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');

	        return this.set(s);
	    };

	    Object.assign(PIXI.systems.FilterSystem.prototype, {
	        /**
	         * @method PIXI.FilterManager#getRenderTarget
	         * @deprecated since 5.0.0
	         * @see PIXI.systems.FilterSystem#getFilterTexture
	         */
	        getRenderTarget: function getRenderTarget(clear, resolution)
	        {
	            deprecation(v5,
	                'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'
	            );

	            return this.getFilterTexture(resolution);
	        },

	        /**
	         * @method PIXI.FilterManager#returnRenderTarget
	         * @deprecated since 5.0.0
	         * @see PIXI.systems.FilterSystem#returnFilterTexture
	         */
	        returnRenderTarget: function returnRenderTarget(renderTexture)
	        {
	            deprecation(v5,
	                'PIXI.FilterManager.returnRenderTarget method has been replaced with '
	                + 'PIXI.systems.FilterSystem.returnFilterTexture'
	            );

	            this.returnFilterTexture(renderTexture);
	        },

	        /**
	         * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix
	         * @deprecated since 5.0.0
	         * @param {PIXI.Matrix} outputMatrix - the matrix to output to.
	         * @return {PIXI.Matrix} The mapped matrix.
	         */
	        calculateScreenSpaceMatrix: function calculateScreenSpaceMatrix(outputMatrix)
	        {
	            deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '
	                + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');

	            var mappedMatrix = outputMatrix.identity();
	            var ref = this.activeState;
	            var sourceFrame = ref.sourceFrame;
	            var destinationFrame = ref.destinationFrame;

	            mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);
	            mappedMatrix.scale(destinationFrame.width, destinationFrame.height);

	            return mappedMatrix;
	        },

	        /**
	         * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix
	         * @deprecated since 5.0.0
	         * @param {PIXI.Matrix} outputMatrix - The matrix to output to.
	         * @return {PIXI.Matrix} The mapped matrix.
	         */
	        calculateNormalizedScreenSpaceMatrix: function calculateNormalizedScreenSpaceMatrix(outputMatrix)
	        {
	            deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '
	                + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');

	            var ref = this.activeState;
	            var sourceFrame = ref.sourceFrame;
	            var destinationFrame = ref.destinationFrame;
	            var mappedMatrix = outputMatrix.identity();

	            mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);

	            var translateScaleX = (destinationFrame.width / sourceFrame.width);
	            var translateScaleY = (destinationFrame.height / sourceFrame.height);

	            mappedMatrix.scale(translateScaleX, translateScaleY);

	            return mappedMatrix;
	        },
	    });

	    Object.defineProperties(PIXI.RenderTexture.prototype, {
	        /**
	         * @name PIXI.RenderTexture#sourceFrame
	         * @type {PIXI.Rectangle}
	         * @deprecated since 5.0.0
	         * @readonly
	         */
	        sourceFrame: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');

	                return this.filterFrame;
	            },
	        },
	        /**
	         * @name PIXI.RenderTexture#size
	         * @type {PIXI.Rectangle}
	         * @deprecated since 5.0.0
	         * @readonly
	         */
	        size: {
	            get: function get()
	            {
	                deprecation(v5, 'PIXI.RenderTexture.size property has been removed');

	                return this._frame;
	            },
	        },
	    });

	    /**
	     * @class BlurXFilter
	     * @memberof PIXI.filters
	     * @deprecated since 5.0.0
	     * @see PIXI.filters.BlurFilterPass
	     */
	    var BlurXFilter = /*@__PURE__*/(function (superclass) {
	        function BlurXFilter(strength, quality, resolution, kernelSize)
	        {
	            deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');

	            superclass.call(this, true, strength, quality, resolution, kernelSize);
	        }

	        if ( superclass ) BlurXFilter.__proto__ = superclass;
	        BlurXFilter.prototype = Object.create( superclass && superclass.prototype );
	        BlurXFilter.prototype.constructor = BlurXFilter;

	        return BlurXFilter;
	    }(PIXI.filters.BlurFilterPass));

	    /**
	     * @class BlurYFilter
	     * @memberof PIXI.filters
	     * @deprecated since 5.0.0
	     * @see PIXI.filters.BlurFilterPass
	     */
	    var BlurYFilter = /*@__PURE__*/(function (superclass) {
	        function BlurYFilter(strength, quality, resolution, kernelSize)
	        {
	            deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');

	            superclass.call(this, false, strength, quality, resolution, kernelSize);
	        }

	        if ( superclass ) BlurYFilter.__proto__ = superclass;
	        BlurYFilter.prototype = Object.create( superclass && superclass.prototype );
	        BlurYFilter.prototype.constructor = BlurYFilter;

	        return BlurYFilter;
	    }(PIXI.filters.BlurFilterPass));

	    Object.assign(PIXI.filters, {
	        BlurXFilter: BlurXFilter,
	        BlurYFilter: BlurYFilter,
	    });

	    var Sprite = PIXI.Sprite;
	    var Texture = PIXI.Texture;
	    var Graphics = PIXI.Graphics;

	    // Support for pixi.js-legacy bifurcation
	    // give users a friendly assist to use legacy
	    if (!Graphics.prototype.generateCanvasTexture)
	    {
	        Graphics.prototype.generateCanvasTexture = function generateCanvasTexture()
	        {
	            deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in "pixi.js-legacy"');
	        };
	    }

	    /**
	     * @deprecated since 5.0.0
	     * @member {PIXI.Graphics} PIXI.Graphics#graphicsData
	     * @see PIXI.Graphics#geometry
	     * @readonly
	     */
	    Object.defineProperty(PIXI.Graphics.prototype, 'graphicsData', {
	        get: function get()
	        {
	            deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');

	            return this.geometry.graphicsData;
	        },
	    });

	    // Use these to deprecate all the Sprite from* methods
	    function spriteFrom(name, source, crossorigin, scaleMode)
	    {
	        deprecation(v5, ("PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from"));

	        return Sprite.from(source, {
	            resourceOptions: {
	                scale: scaleMode,
	                crossorigin: crossorigin,
	            },
	        });
	    }

	    /**
	     * @deprecated since 5.0.0
	     * @see PIXI.Sprite.from
	     * @method PIXI.Sprite.fromImage
	     * @return {PIXI.Sprite}
	     */
	    Sprite.fromImage = spriteFrom.bind(null, 'fromImage');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Sprite.fromSVG
	     * @see PIXI.Sprite.from
	     * @return {PIXI.Sprite}
	     */
	    Sprite.fromSVG = spriteFrom.bind(null, 'fromSVG');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Sprite.fromCanvas
	     * @see PIXI.Sprite.from
	     * @return {PIXI.Sprite}
	     */
	    Sprite.fromCanvas = spriteFrom.bind(null, 'fromCanvas');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Sprite.fromVideo
	     * @see PIXI.Sprite.from
	     * @return {PIXI.Sprite}
	     */
	    Sprite.fromVideo = spriteFrom.bind(null, 'fromVideo');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Sprite.fromFrame
	     * @see PIXI.Sprite.from
	     * @return {PIXI.Sprite}
	     */
	    Sprite.fromFrame = spriteFrom.bind(null, 'fromFrame');

	    // Use these to deprecate all the Texture from* methods
	    function textureFrom(name, source, crossorigin, scaleMode)
	    {
	        deprecation(v5, ("PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from"));

	        return Texture.from(source, {
	            resourceOptions: {
	                scale: scaleMode,
	                crossorigin: crossorigin,
	            },
	        });
	    }

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Texture.fromImage
	     * @see PIXI.Texture.from
	     * @return {PIXI.Texture}
	     */
	    Texture.fromImage = textureFrom.bind(null, 'fromImage');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Texture.fromSVG
	     * @see PIXI.Texture.from
	     * @return {PIXI.Texture}
	     */
	    Texture.fromSVG = textureFrom.bind(null, 'fromSVG');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Texture.fromCanvas
	     * @see PIXI.Texture.from
	     * @return {PIXI.Texture}
	     */
	    Texture.fromCanvas = textureFrom.bind(null, 'fromCanvas');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Texture.fromVideo
	     * @see PIXI.Texture.from
	     * @return {PIXI.Texture}
	     */
	    Texture.fromVideo = textureFrom.bind(null, 'fromVideo');

	    /**
	     * @deprecated since 5.0.0
	     * @method PIXI.Texture.fromFrame
	     * @see PIXI.Texture.from
	     * @return {PIXI.Texture}
	     */
	    Texture.fromFrame = textureFrom.bind(null, 'fromFrame');

	    /**
	     * @deprecated since 5.0.0
	     * @member {boolean} PIXI.AbstractRenderer#autoResize
	     * @see PIXI.AbstractRenderer#autoDensity
	     */
	    Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {
	        get: function get()
	        {
	            deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '
	                + 'use PIXI.AbstractRenderer.autoDensity');

	            return this.autoDensity;
	        },
	        set: function set(value)
	        {
	            deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '
	                + 'use PIXI.AbstractRenderer.autoDensity');

	            this.autoDensity = value;
	        },
	    });

	    /**
	     * @deprecated since 5.0.0
	     * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager
	     * @see PIXI.Renderer#texture
	     */
	    Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {
	        get: function get()
	        {
	            deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');

	            return this.texture;
	        },
	    });

	    /**
	     * @namespace PIXI.utils.mixins
	     * @deprecated since 5.0.0
	     */
	    PIXI.utils.mixins = {
	        /**
	         * @memberof PIXI.utils.mixins
	         * @function mixin
	         * @deprecated since 5.0.0
	         */
	        mixin: function mixin()
	        {
	            deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');
	        },
	        /**
	         * @memberof PIXI.utils.mixins
	         * @function delayMixin
	         * @deprecated since 5.0.0
	         */
	        delayMixin: function delayMixin()
	        {
	            deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');
	        },
	        /**
	         * @memberof PIXI.utils.mixins
	         * @function performMixins
	         * @deprecated since 5.0.0
	         */
	        performMixins: function performMixins()
	        {
	            deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');
	        },
	    };
	}

	/*!
	 * @pixi/mesh - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/mesh is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.
	 *
	 * @class
	 * @memberof PIXI
	 */
	var MeshBatchUvs = function MeshBatchUvs(uvBuffer, uvMatrix)
	{
	    /**
	     * Buffer with normalized UV's
	     * @member {PIXI.Buffer}
	     */
	    this.uvBuffer = uvBuffer;

	    /**
	     * Material UV matrix
	     * @member {PIXI.TextureMatrix}
	     */
	    this.uvMatrix = uvMatrix;

	    /**
	     * UV Buffer data
	     * @member {Float32Array}
	     * @readonly
	     */
	    this.data = null;

	    this._bufferUpdateId = -1;

	    this._textureUpdateId = -1;

	    this._updateID = 0;
	};

	/**
	 * updates
	 *
	 * @param {boolean} forceUpdate - force the update
	 */
	MeshBatchUvs.prototype.update = function update (forceUpdate)
	{
	    if (!forceUpdate
	        && this._bufferUpdateId === this.uvBuffer._updateID
	        && this._textureUpdateId === this.uvMatrix._updateID)
	    {
	        return;
	    }

	    this._bufferUpdateId = this.uvBuffer._updateID;
	    this._textureUpdateId = this.uvMatrix._updateID;

	    var data = this.uvBuffer.data;

	    if (!this.data || this.data.length !== data.length)
	    {
	        this.data = new Float32Array(data.length);
	    }

	    this.uvMatrix.multiplyUvs(data, this.data);

	    this._updateID++;
	};

	var tempPoint$2 = new Point();
	var tempPolygon = new Polygon();

	/**
	 * Base mesh class.
	 *
	 * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.
	 * This class assumes a certain level of WebGL knowledge.
	 * If you know a bit this should abstract enough away to make you life easier!
	 *
	 * Pretty much ALL WebGL can be broken down into the following:
	 * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..
	 * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)
	 * - State - This is the state of WebGL required to render the mesh.
	 *
	 * Through a combination of the above elements you can render anything you want, 2D or 3D!
	 *
	 * @class
	 * @extends PIXI.Container
	 * @memberof PIXI
	 */
	var Mesh = /*@__PURE__*/(function (Container) {
	    function Mesh(geometry, shader, state, drawMode)// vertices, uvs, indices, drawMode)
	    {
	        if ( drawMode === void 0 ) { drawMode = DRAW_MODES.TRIANGLES; }

	        Container.call(this);

	        /**
	         * Includes vertex positions, face indices, normals, colors, UVs, and
	         * custom attributes within buffers, reducing the cost of passing all
	         * this data to the GPU. Can be shared between multiple Mesh objects.
	         * @member {PIXI.Geometry}
	         * @readonly
	         */
	        this.geometry = geometry;

	        geometry.refCount++;

	        /**
	         * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.
	         * Can be shared between multiple Mesh objects.
	         * @member {PIXI.Shader|PIXI.MeshMaterial}
	         */
	        this.shader = shader;

	        /**
	         * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,
	         * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.
	         * @member {PIXI.State}
	         */
	        this.state = state || State.for2d();

	        /**
	         * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.
	         *
	         * @member {number}
	         * @see PIXI.DRAW_MODES
	         */
	        this.drawMode = drawMode;

	        /**
	         * Typically the index of the IndexBuffer where to start drawing.
	         * @member {number}
	         * @default 0
	         */
	        this.start = 0;

	        /**
	         * How much of the geometry to draw, by default `0` renders everything.
	         * @member {number}
	         * @default 0
	         */
	        this.size = 0;

	        /**
	         * thease are used as easy access for batching
	         * @member {Float32Array}
	         * @private
	         */
	        this.uvs = null;

	        /**
	         * thease are used as easy access for batching
	         * @member {Uint16Array}
	         * @private
	         */
	        this.indices = null;

	        /**
	         * this is the caching layer used by the batcher
	         * @member {Float32Array}
	         * @private
	         */
	        this.vertexData = new Float32Array(1);

	        /**
	         * If geometry is changed used to decide to re-transform
	         * the vertexData.
	         * @member {number}
	         * @private
	         */
	        this.vertexDirty = 0;

	        this._transformID = -1;

	        // Inherited from DisplayMode, set defaults
	        this.tint = 0xFFFFFF;
	        this.blendMode = BLEND_MODES.NORMAL;

	        /**
	         * Internal roundPixels field
	         *
	         * @member {boolean}
	         * @private
	         */
	        this._roundPixels = settings.ROUND_PIXELS;

	        /**
	         * Batched UV's are cached for atlas textures
	         * @member {PIXI.MeshBatchUvs}
	         * @private
	         */
	        this.batchUvs = null;
	    }

	    if ( Container ) { Mesh.__proto__ = Container; }
	    Mesh.prototype = Object.create( Container && Container.prototype );
	    Mesh.prototype.constructor = Mesh;

	    var prototypeAccessors = { uvBuffer: { configurable: true },verticesBuffer: { configurable: true },material: { configurable: true },blendMode: { configurable: true },roundPixels: { configurable: true },tint: { configurable: true },texture: { configurable: true } };

	    /**
	     * To change mesh uv's, change its uvBuffer data and increment its _updateID.
	     * @member {PIXI.Buffer}
	     * @readonly
	     */
	    prototypeAccessors.uvBuffer.get = function ()
	    {
	        return this.geometry.buffers[1];
	    };

	    /**
	     * To change mesh vertices, change its uvBuffer data and increment its _updateID.
	     * Incrementing _updateID is optional because most of Mesh objects do it anyway.
	     * @member {PIXI.Buffer}
	     * @readonly
	     */
	    prototypeAccessors.verticesBuffer.get = function ()
	    {
	        return this.geometry.buffers[0];
	    };

	    /**
	     * Alias for {@link PIXI.Mesh#shader}.
	     * @member {PIXI.Shader|PIXI.MeshMaterial}
	     */
	    prototypeAccessors.material.set = function (value)
	    {
	        this.shader = value;
	    };

	    prototypeAccessors.material.get = function ()
	    {
	        return this.shader;
	    };

	    /**
	     * The blend mode to be applied to the Mesh. Apply a value of
	     * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.
	     *
	     * @member {number}
	     * @default PIXI.BLEND_MODES.NORMAL;
	     * @see PIXI.BLEND_MODES
	     */
	    prototypeAccessors.blendMode.set = function (value)
	    {
	        this.state.blendMode = value;
	    };

	    prototypeAccessors.blendMode.get = function ()
	    {
	        return this.state.blendMode;
	    };

	    /**
	     * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
	     * Advantages can include sharper image quality (like text) and faster rendering on canvas.
	     * The main disadvantage is movement of objects may appear less smooth.
	     * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
	     *
	     * @member {boolean}
	     * @default false
	     */
	    prototypeAccessors.roundPixels.set = function (value)
	    {
	        if (this._roundPixels !== value)
	        {
	            this._transformID = -1;
	        }
	        this._roundPixels = value;
	    };

	    prototypeAccessors.roundPixels.get = function ()
	    {
	        return this._roundPixels;
	    };

	    /**
	     * The multiply tint applied to the Mesh. This is a hex value. A value of
	     * `0xFFFFFF` will remove any tint effect.
	     *
	     * @member {number}
	     * @default 0xFFFFFF
	     */
	    prototypeAccessors.tint.get = function ()
	    {
	        return this.shader.tint;
	    };

	    prototypeAccessors.tint.set = function (value)
	    {
	        this.shader.tint = value;
	    };

	    /**
	     * The texture that the Mesh uses.
	     *
	     * @member {PIXI.Texture}
	     */
	    prototypeAccessors.texture.get = function ()
	    {
	        return this.shader.texture;
	    };

	    prototypeAccessors.texture.set = function (value)
	    {
	        this.shader.texture = value;
	    };

	    /**
	     * Standard renderer draw.
	     * @protected
	     * @param {PIXI.Renderer} renderer - Instance to renderer.
	     */
	    Mesh.prototype._render = function _render (renderer)
	    {
	        // set properties for batching..
	        // TODO could use a different way to grab verts?
	        var vertices = this.geometry.buffers[0].data;

	        // TODO benchmark check for attribute size..
	        if (this.shader.batchable && this.drawMode === DRAW_MODES.TRIANGLES && vertices.length < Mesh.BATCHABLE_SIZE * 2)
	        {
	            this._renderToBatch(renderer);
	        }
	        else
	        {
	            this._renderDefault(renderer);
	        }
	    };

	    /**
	     * Standard non-batching way of rendering.
	     * @protected
	     * @param {PIXI.Renderer} renderer - Instance to renderer.
	     */
	    Mesh.prototype._renderDefault = function _renderDefault (renderer)
	    {
	        var shader = this.shader;

	        shader.alpha = this.worldAlpha;
	        if (shader.update)
	        {
	            shader.update();
	        }

	        renderer.batch.flush();

	        if (shader.program.uniformData.translationMatrix)
	        {
	            shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);
	        }

	        // bind and sync uniforms..
	        renderer.shader.bind(shader);

	        // set state..
	        renderer.state.set(this.state);

	        // bind the geometry...
	        renderer.geometry.bind(this.geometry, shader);

	        // then render it
	        renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);
	    };

	    /**
	     * Rendering by using the Batch system.
	     * @protected
	     * @param {PIXI.Renderer} renderer - Instance to renderer.
	     */
	    Mesh.prototype._renderToBatch = function _renderToBatch (renderer)
	    {
	        var geometry = this.geometry;

	        if (this.shader.uvMatrix)
	        {
	            this.shader.uvMatrix.update();
	            this.calculateUvs();
	        }

	        // set properties for batching..
	        this.calculateVertices();
	        this.indices = geometry.indexBuffer.data;
	        this._tintRGB = this.shader._tintRGB;
	        this._texture = this.shader.texture;

	        var pluginName = this.material.pluginName;

	        renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);
	        renderer.plugins[pluginName].render(this);
	    };

	    /**
	     * Updates vertexData field based on transform and vertices
	     */
	    Mesh.prototype.calculateVertices = function calculateVertices ()
	    {
	        var geometry = this.geometry;
	        var vertices = geometry.buffers[0].data;

	        if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)
	        {
	            return;
	        }

	        this._transformID = this.transform._worldID;

	        if (this.vertexData.length !== vertices.length)
	        {
	            this.vertexData = new Float32Array(vertices.length);
	        }

	        var wt = this.transform.worldTransform;
	        var a = wt.a;
	        var b = wt.b;
	        var c = wt.c;
	        var d = wt.d;
	        var tx = wt.tx;
	        var ty = wt.ty;

	        var vertexData = this.vertexData;

	        for (var i = 0; i < vertexData.length / 2; i++)
	        {
	            var x = vertices[(i * 2)];
	            var y = vertices[(i * 2) + 1];

	            vertexData[(i * 2)] = (a * x) + (c * y) + tx;
	            vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;
	        }

	        if (this._roundPixels)
	        {
	            for (var i$1 = 0; i$1 < vertexData.length; i$1++)
	            {
	                vertexData[i$1] = Math.round(vertexData[i$1]);
	            }
	        }

	        this.vertexDirty = geometry.vertexDirtyId;
	    };

	    /**
	     * Updates uv field based on from geometry uv's or batchUvs
	     */
	    Mesh.prototype.calculateUvs = function calculateUvs ()
	    {
	        var geomUvs = this.geometry.buffers[1];

	        if (!this.shader.uvMatrix.isSimple)
	        {
	            if (!this.batchUvs)
	            {
	                this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);
	            }
	            this.batchUvs.update();
	            this.uvs = this.batchUvs.data;
	        }
	        else
	        {
	            this.uvs = geomUvs.data;
	        }
	    };

	    /**
	     * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.
	     * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.
	     *
	     * @protected
	     */
	    Mesh.prototype._calculateBounds = function _calculateBounds ()
	    {
	        this.calculateVertices();

	        this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);
	    };

	    /**
	     * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.
	     *
	     * @param {PIXI.Point} point the point to test
	     * @return {boolean} the result of the test
	     */
	    Mesh.prototype.containsPoint = function containsPoint (point)
	    {
	        if (!this.getBounds().contains(point.x, point.y))
	        {
	            return false;
	        }

	        this.worldTransform.applyInverse(point, tempPoint$2);

	        var vertices = this.geometry.getBuffer('aVertexPosition').data;

	        var points = tempPolygon.points;
	        var indices =  this.geometry.getIndex().data;
	        var len = indices.length;
	        var step = this.drawMode === 4 ? 3 : 1;

	        for (var i = 0; i + 2 < len; i += step)
	        {
	            var ind0 = indices[i] * 2;
	            var ind1 = indices[i + 1] * 2;
	            var ind2 = indices[i + 2] * 2;

	            points[0] = vertices[ind0];
	            points[1] = vertices[ind0 + 1];
	            points[2] = vertices[ind1];
	            points[3] = vertices[ind1 + 1];
	            points[4] = vertices[ind2];
	            points[5] = vertices[ind2 + 1];

	            if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y))
	            {
	                return true;
	            }
	        }

	        return false;
	    };
	    /**
	     * Destroys the Mesh object.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all
	     *  options have been set to that value
	     * @param {boolean} [options.children=false] - if set to true, all the children will have
	     *  their destroy method called as well. 'options' will be passed on to those calls.
	     */
	    Mesh.prototype.destroy = function destroy (options)
	    {
	        Container.prototype.destroy.call(this, options);

	        this.geometry.refCount--;
	        if (this.geometry.refCount === 0)
	        {
	            this.geometry.dispose();
	        }

	        this.geometry = null;
	        this.shader = null;
	        this.state = null;
	        this.uvs = null;
	        this.indices = null;
	        this.vertexData = null;
	    };

	    Object.defineProperties( Mesh.prototype, prototypeAccessors );

	    return Mesh;
	}(Container));

	/**
	 * The maximum number of vertices to consider batchable. Generally, the complexity
	 * of the geometry.
	 * @memberof PIXI.Mesh
	 * @static
	 * @member {number} BATCHABLE_SIZE
	 */
	Mesh.BATCHABLE_SIZE = 100;

	var vertex$5 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n";

	var fragment$8 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n";

	/**
	 * Slightly opinionated default shader for PixiJS 2D objects.
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.Shader
	 */
	var MeshMaterial = /*@__PURE__*/(function (Shader) {
	    function MeshMaterial(uSampler, options)
	    {
	        var uniforms = {
	            uSampler: uSampler,
	            alpha: 1,
	            uTextureMatrix: Matrix.IDENTITY,
	            uColor: new Float32Array([1, 1, 1, 1]),
	        };

	        // Set defaults
	        options = Object.assign({
	            tint: 0xFFFFFF,
	            alpha: 1,
	            pluginName: 'batch',
	        }, options);

	        if (options.uniforms)
	        {
	            Object.assign(uniforms, options.uniforms);
	        }

	        Shader.call(this, options.program || Program.from(vertex$5, fragment$8), uniforms);

	        /**
	         * Only do update if tint or alpha changes.
	         * @member {boolean}
	         * @private
	         * @default false
	         */
	        this._colorDirty = false;

	        /**
	         * TextureMatrix instance for this Mesh, used to track Texture changes
	         *
	         * @member {PIXI.TextureMatrix}
	         * @readonly
	         */
	        this.uvMatrix = new TextureMatrix(uSampler);

	        /**
	         * `true` if shader can be batch with the renderer's batch system.
	         * @member {boolean}
	         * @default true
	         */
	        this.batchable = options.program === undefined;

	        /**
	         * Renderer plugin for batching
	         *
	         * @member {string}
	         * @default 'batch'
	         */
	        this.pluginName = options.pluginName;

	        this.tint = options.tint;
	        this.alpha = options.alpha;
	    }

	    if ( Shader ) { MeshMaterial.__proto__ = Shader; }
	    MeshMaterial.prototype = Object.create( Shader && Shader.prototype );
	    MeshMaterial.prototype.constructor = MeshMaterial;

	    var prototypeAccessors = { texture: { configurable: true },alpha: { configurable: true },tint: { configurable: true } };

	    /**
	     * Reference to the texture being rendered.
	     * @member {PIXI.Texture}
	     */
	    prototypeAccessors.texture.get = function ()
	    {
	        return this.uniforms.uSampler;
	    };
	    prototypeAccessors.texture.set = function (value)
	    {
	        if (this.uniforms.uSampler !== value)
	        {
	            this.uniforms.uSampler = value;
	            this.uvMatrix.texture = value;
	        }
	    };

	    /**
	     * This gets automatically set by the object using this.
	     *
	     * @default 1
	     * @member {number}
	     */
	    prototypeAccessors.alpha.set = function (value)
	    {
	        if (value === this._alpha) { return; }

	        this._alpha = value;
	        this._colorDirty = true;
	    };
	    prototypeAccessors.alpha.get = function ()
	    {
	        return this._alpha;
	    };

	    /**
	     * Multiply tint for the material.
	     * @member {number}
	     * @default 0xFFFFFF
	     */
	    prototypeAccessors.tint.set = function (value)
	    {
	        if (value === this._tint) { return; }

	        this._tint = value;
	        this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);
	        this._colorDirty = true;
	    };
	    prototypeAccessors.tint.get = function ()
	    {
	        return this._tint;
	    };

	    /**
	     * Gets called automatically by the Mesh. Intended to be overridden for custom
	     * MeshMaterial objects.
	     */
	    MeshMaterial.prototype.update = function update ()
	    {
	        if (this._colorDirty)
	        {
	            this._colorDirty = false;
	            var baseTexture = this.texture.baseTexture;

	            premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.premultiplyAlpha);
	        }
	        if (this.uvMatrix.update())
	        {
	            this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;
	        }
	    };

	    Object.defineProperties( MeshMaterial.prototype, prototypeAccessors );

	    return MeshMaterial;
	}(Shader));

	/**
	 * Standard 2D geometry used in PixiJS.
	 *
	 * Geometry can be defined without passing in a style or data if required.
	 *
	 * ```js
	 * const geometry = new PIXI.Geometry();
	 *
	 * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);
	 * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);
	 * geometry.addIndex([0,1,2,1,3,2]);
	 *
	 * ```
	 * @class
	 * @memberof PIXI
	 * @extends PIXI.Geometry
	 */
	var MeshGeometry = /*@__PURE__*/(function (Geometry) {
	    function MeshGeometry(vertices, uvs, index)
	    {
	        Geometry.call(this);

	        var verticesBuffer = new Buffer(vertices);
	        var uvsBuffer = new Buffer(uvs, true);
	        var indexBuffer = new Buffer(index, true, true);

	        this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)
	            .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)
	            .addIndex(indexBuffer);

	        /**
	         * Dirty flag to limit update calls on Mesh. For example,
	         * limiting updates on a single Mesh instance with a shared Geometry
	         * within the render loop.
	         * @private
	         * @member {number}
	         * @default -1
	         */
	        this._updateId = -1;
	    }

	    if ( Geometry ) { MeshGeometry.__proto__ = Geometry; }
	    MeshGeometry.prototype = Object.create( Geometry && Geometry.prototype );
	    MeshGeometry.prototype.constructor = MeshGeometry;

	    var prototypeAccessors = { vertexDirtyId: { configurable: true } };

	    /**
	     * If the vertex position is updated.
	     * @member {number}
	     * @readonly
	     * @private
	     */
	    prototypeAccessors.vertexDirtyId.get = function ()
	    {
	        return this.buffers[0]._updateID;
	    };

	    Object.defineProperties( MeshGeometry.prototype, prototypeAccessors );

	    return MeshGeometry;
	}(Geometry));

	/*!
	 * @pixi/mesh-extras - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/mesh-extras is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	var PlaneGeometry = /*@__PURE__*/(function (MeshGeometry) {
	    function PlaneGeometry(width, height, segWidth, segHeight)
	    {
	        if ( width === void 0 ) { width = 100; }
	        if ( height === void 0 ) { height = 100; }
	        if ( segWidth === void 0 ) { segWidth = 10; }
	        if ( segHeight === void 0 ) { segHeight = 10; }

	        MeshGeometry.call(this);

	        this.segWidth = segWidth;
	        this.segHeight = segHeight;

	        this.width = width;
	        this.height = height;

	        this.build();
	    }

	    if ( MeshGeometry ) { PlaneGeometry.__proto__ = MeshGeometry; }
	    PlaneGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype );
	    PlaneGeometry.prototype.constructor = PlaneGeometry;

	    /**
	     * Refreshes plane coordinates
	     * @private
	     */
	    PlaneGeometry.prototype.build = function build ()
	    {
	        var total = this.segWidth * this.segHeight;
	        var verts = [];
	        var uvs = [];
	        var indices = [];

	        var segmentsX = this.segWidth - 1;
	        var segmentsY = this.segHeight - 1;

	        var sizeX = (this.width) / segmentsX;
	        var sizeY = (this.height) / segmentsY;

	        for (var i = 0; i < total; i++)
	        {
	            var x = (i % this.segWidth);
	            var y = ((i / this.segWidth) | 0);

	            verts.push(x * sizeX, y * sizeY);
	            uvs.push(x / segmentsX, y / segmentsY);
	        }

	        var totalSub = segmentsX * segmentsY;

	        for (var i$1 = 0; i$1 < totalSub; i$1++)
	        {
	            var xpos = i$1 % segmentsX;
	            var ypos = (i$1 / segmentsX) | 0;

	            var value = (ypos * this.segWidth) + xpos;
	            var value2 = (ypos * this.segWidth) + xpos + 1;
	            var value3 = ((ypos + 1) * this.segWidth) + xpos;
	            var value4 = ((ypos + 1) * this.segWidth) + xpos + 1;

	            indices.push(value, value2, value3,
	                value2, value4, value3);
	        }

	        this.buffers[0].data = new Float32Array(verts);
	        this.buffers[1].data = new Float32Array(uvs);
	        this.indexBuffer.data = new Uint16Array(indices);

	        // ensure that the changes are uploaded
	        this.buffers[0].update();
	        this.buffers[1].update();
	        this.indexBuffer.update();
	    };

	    return PlaneGeometry;
	}(MeshGeometry));

	/**
	 * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.
	 *
	 * ```js
	 * for (let i = 0; i < 20; i++) {
	 *     points.push(new PIXI.Point(i * 50, 0));
	 * };
	 * const rope = new PIXI.RopeGeometry(100, points);
	 * ```
	 *
	 * @class
	 * @extends PIXI.MeshGeometry
	 * @memberof PIXI
	 *
	 */
	var RopeGeometry = /*@__PURE__*/(function (MeshGeometry) {
	    function RopeGeometry(width, points)
	    {
	        if ( width === void 0 ) { width = 200; }

	        MeshGeometry.call(this, new Float32Array(points.length * 4),
	            new Float32Array(points.length * 4),
	            new Uint16Array((points.length - 1) * 6));

	        /**
	         * An array of points that determine the rope
	         * @member {PIXI.Point[]}
	         */
	        this.points = points;

	        /**
	         * The width (i.e., thickness) of the rope.
	         * @member {number}
	         * @readOnly
	         */
	        this.width = width;

	        this.build();
	    }

	    if ( MeshGeometry ) { RopeGeometry.__proto__ = MeshGeometry; }
	    RopeGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype );
	    RopeGeometry.prototype.constructor = RopeGeometry;
	    /**
	     * Refreshes Rope indices and uvs
	     * @private
	     */
	    RopeGeometry.prototype.build = function build ()
	    {
	        var points = this.points;

	        if (!points) { return; }

	        var vertexBuffer = this.getBuffer('aVertexPosition');
	        var uvBuffer = this.getBuffer('aTextureCoord');
	        var indexBuffer = this.getIndex();

	        // if too little points, or texture hasn't got UVs set yet just move on.
	        if (points.length < 1)
	        {
	            return;
	        }

	        // if the number of points has changed we will need to recreate the arraybuffers
	        if (vertexBuffer.data.length / 4 !== points.length)
	        {
	            vertexBuffer.data = new Float32Array(points.length * 4);
	            uvBuffer.data = new Float32Array(points.length * 4);
	            indexBuffer.data = new Uint16Array((points.length - 1) * 6);
	        }

	        var uvs = uvBuffer.data;
	        var indices = indexBuffer.data;

	        uvs[0] = 0;
	        uvs[1] = 0;
	        uvs[2] = 0;
	        uvs[3] = 1;

	        // indices[0] = 0;
	        // indices[1] = 1;

	        var total = points.length; // - 1;

	        for (var i = 0; i < total; i++)
	        {
	            // time to do some smart drawing!
	            var index = i * 4;
	            var amount = i / (total - 1);

	            uvs[index] = amount;
	            uvs[index + 1] = 0;

	            uvs[index + 2] = amount;
	            uvs[index + 3] = 1;
	        }

	        var indexCount = 0;

	        for (var i$1 = 0; i$1 < total - 1; i$1++)
	        {
	            var index$1 = i$1 * 2;

	            indices[indexCount++] = index$1;
	            indices[indexCount++] = index$1 + 1;
	            indices[indexCount++] = index$1 + 2;

	            indices[indexCount++] = index$1 + 2;
	            indices[indexCount++] = index$1 + 1;
	            indices[indexCount++] = index$1 + 3;
	        }

	        // ensure that the changes are uploaded
	        uvBuffer.update();
	        indexBuffer.update();

	        this.updateVertices();
	    };

	    /**
	     * refreshes vertices of Rope mesh
	     */
	    RopeGeometry.prototype.updateVertices = function updateVertices ()
	    {
	        var points = this.points;

	        if (points.length < 1)
	        {
	            return;
	        }

	        var lastPoint = points[0];
	        var nextPoint;
	        var perpX = 0;
	        var perpY = 0;

	        // this.count -= 0.2;

	        var vertices = this.buffers[0].data;
	        var total = points.length;

	        for (var i = 0; i < total; i++)
	        {
	            var point = points[i];
	            var index = i * 4;

	            if (i < points.length - 1)
	            {
	                nextPoint = points[i + 1];
	            }
	            else
	            {
	                nextPoint = point;
	            }

	            perpY = -(nextPoint.x - lastPoint.x);
	            perpX = nextPoint.y - lastPoint.y;

	            var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));
	            var num = this.width / 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.buffers[0].update();
	    };

	    RopeGeometry.prototype.update = function update ()
	    {
	        this.updateVertices();
	    };

	    return RopeGeometry;
	}(MeshGeometry));

	/**
	 * The rope allows you to draw a texture across several points and then manipulate these points
	 *
	 *```js
	 * for (let i = 0; i < 20; i++) {
	 *     points.push(new PIXI.Point(i * 50, 0));
	 * };
	 * let rope = new PIXI.SimpleRope(PIXI.Texture.from("snake.png"), points);
	 *  ```
	 *
	 * @class
	 * @extends PIXI.Mesh
	 * @memberof PIXI
	 *
	 */
	var SimpleRope = /*@__PURE__*/(function (Mesh) {
	    function SimpleRope(texture, points)
	    {
	        var ropeGeometry = new RopeGeometry(texture.height, points);
	        var meshMaterial = new MeshMaterial(texture);

	        Mesh.call(this, ropeGeometry, meshMaterial);

	        /**
	         * re-calculate vertices by rope points each frame
	         *
	         * @member {boolean}
	         */
	        this.autoUpdate = true;
	    }

	    if ( Mesh ) { SimpleRope.__proto__ = Mesh; }
	    SimpleRope.prototype = Object.create( Mesh && Mesh.prototype );
	    SimpleRope.prototype.constructor = SimpleRope;

	    SimpleRope.prototype._render = function _render (renderer)
	    {
	        if (this.autoUpdate
	            || this.geometry.width !== this.shader.texture.height)
	        {
	            this.geometry.width = this.shader.texture.height;
	            this.geometry.update();
	        }

	        Mesh.prototype._render.call(this, renderer);
	    };

	    return SimpleRope;
	}(Mesh));

	/**
	 * The SimplePlane allows you to draw a texture across several points and then manipulate these points
	 *
	 *```js
	 * for (let i = 0; i < 20; i++) {
	 *     points.push(new PIXI.Point(i * 50, 0));
	 * };
	 * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from("snake.png"), points);
	 *  ```
	 *
	 * @class
	 * @extends PIXI.Mesh
	 * @memberof PIXI
	 *
	 */
	var SimplePlane = /*@__PURE__*/(function (Mesh) {
	    function SimplePlane(texture, verticesX, verticesY)
	    {
	        var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);
	        var meshMaterial = new MeshMaterial(Texture.WHITE);

	        Mesh.call(this, planeGeometry, meshMaterial);

	        // lets call the setter to ensure all necessary updates are performed
	        this.texture = texture;
	    }

	    if ( Mesh ) { SimplePlane.__proto__ = Mesh; }
	    SimplePlane.prototype = Object.create( Mesh && Mesh.prototype );
	    SimplePlane.prototype.constructor = SimplePlane;

	    var prototypeAccessors = { texture: { configurable: true } };

	    /**
	     * Method used for overrides, to do something in case texture frame was changed.
	     * Meshes based on plane can override it and change more details based on texture.
	     */
	    SimplePlane.prototype.textureUpdated = function textureUpdated ()
	    {
	        this._textureID = this.shader.texture._updateID;

	        this.geometry.width = this.shader.texture.width;
	        this.geometry.height = this.shader.texture.height;

	        this.geometry.build();
	    };

	    prototypeAccessors.texture.set = function (value)
	    {
	        // Track texture same way sprite does.
	        // For generated meshes like NineSlicePlane it can change the geometry.
	        // Unfortunately, this method might not work if you directly change texture in material.

	        if (this.shader.texture === value)
	        {
	            return;
	        }

	        this.shader.texture = value;
	        this._textureID = -1;

	        if (value.baseTexture.valid)
	        {
	            this.textureUpdated();
	        }
	        else
	        {
	            value.once('update', this.textureUpdated, this);
	        }
	    };

	    prototypeAccessors.texture.get = function ()
	    {
	        return this.shader.texture;
	    };

	    SimplePlane.prototype._render = function _render (renderer)
	    {
	        if (this._textureID !== this.shader.texture._updateID)
	        {
	            this.textureUpdated();
	        }

	        Mesh.prototype._render.call(this, renderer);
	    };

	    Object.defineProperties( SimplePlane.prototype, prototypeAccessors );

	    return SimplePlane;
	}(Mesh));

	/**
	 * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.
	 * For more robust customization, use {@link PIXI.Mesh}.
	 *
	 * @class
	 * @extends PIXI.Mesh
	 * @memberof PIXI
	 */
	var SimpleMesh = /*@__PURE__*/(function (Mesh) {
	    function SimpleMesh(texture, vertices, uvs, indices, drawMode)
	    {
	        if ( texture === void 0 ) { texture = Texture.EMPTY; }

	        var geometry = new MeshGeometry(vertices, uvs, indices);

	        geometry.getBuffer('aVertexPosition').static = false;

	        var meshMaterial = new MeshMaterial(texture);

	        Mesh.call(this, geometry, meshMaterial, null, drawMode);

	        /**
	         * upload vertices buffer each frame
	         * @member {boolean}
	         */
	        this.autoUpdate = true;
	    }

	    if ( Mesh ) { SimpleMesh.__proto__ = Mesh; }
	    SimpleMesh.prototype = Object.create( Mesh && Mesh.prototype );
	    SimpleMesh.prototype.constructor = SimpleMesh;

	    var prototypeAccessors = { vertices: { configurable: true } };

	    /**
	     * Collection of vertices data.
	     * @member {Float32Array}
	     */
	    prototypeAccessors.vertices.get = function ()
	    {
	        return this.geometry.getBuffer('aVertexPosition').data;
	    };
	    prototypeAccessors.vertices.set = function (value)
	    {
	        this.geometry.getBuffer('aVertexPosition').data = value;
	    };

	    SimpleMesh.prototype._render = function _render (renderer)
	    {
	        if (this.autoUpdate)
	        {
	            this.geometry.getBuffer('aVertexPosition').update();
	        }

	        Mesh.prototype._render.call(this, renderer);
	    };

	    Object.defineProperties( SimpleMesh.prototype, prototypeAccessors );

	    return SimpleMesh;
	}(Mesh));

	var DEFAULT_BORDER_SIZE = 10;

	/**
	 * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful
	 * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically
	 *
	 *```js
	 * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);
	 *  ```
	 * <pre>
	 *      A                          B
	 *    +---+----------------------+---+
	 *  C | 1 |          2           | 3 |
	 *    +---+----------------------+---+
	 *    |   |                      |   |
	 *    | 4 |          5           | 6 |
	 *    |   |                      |   |
	 *    +---+----------------------+---+
	 *  D | 7 |          8           | 9 |
	 *    +---+----------------------+---+

	 *  When changing this objects width and/or height:
	 *     areas 1 3 7 and 9 will remain unscaled.
	 *     areas 2 and 8 will be stretched horizontally
	 *     areas 4 and 6 will be stretched vertically
	 *     area 5 will be stretched both horizontally and vertically
	 * </pre>
	 *
	 * @class
	 * @extends PIXI.SimplePlane
	 * @memberof PIXI
	 *
	 */
	var NineSlicePlane = /*@__PURE__*/(function (SimplePlane) {
	    function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight)
	    {
	        SimplePlane.call(this, Texture.WHITE, 4, 4);

	        this._origWidth = texture.orig.width;
	        this._origHeight = texture.orig.height;

	        /**
	         * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane
	         *
	         * @member {number}
	         * @override
	         */
	        this._width = this._origWidth;

	        /**
	         * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane
	         *
	         * @member {number}
	         * @override
	         */
	        this._height = this._origHeight;

	        /**
	         * The width of the left column (a)
	         *
	         * @member {number}
	         * @private
	         */
	        this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE;

	        /**
	         * The width of the right column (b)
	         *
	         * @member {number}
	         * @private
	         */
	        this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE;

	        /**
	         * The height of the top row (c)
	         *
	         * @member {number}
	         * @private
	         */
	        this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE;

	        /**
	         * The height of the bottom row (d)
	         *
	         * @member {number}
	         * @private
	         */
	        this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE;

	        // lets call the setter to ensure all necessary updates are performed
	        this.texture = texture;
	    }

	    if ( SimplePlane ) { NineSlicePlane.__proto__ = SimplePlane; }
	    NineSlicePlane.prototype = Object.create( SimplePlane && SimplePlane.prototype );
	    NineSlicePlane.prototype.constructor = NineSlicePlane;

	    var prototypeAccessors = { vertices: { configurable: true },width: { configurable: true },height: { configurable: true },leftWidth: { configurable: true },rightWidth: { configurable: true },topHeight: { configurable: true },bottomHeight: { configurable: true } };

	    NineSlicePlane.prototype.textureUpdated = function textureUpdated ()
	    {
	        this._textureID = this.shader.texture._updateID;
	        this._refresh();
	    };

	    prototypeAccessors.vertices.get = function ()
	    {
	        return this.geometry.getBuffer('aVertexPosition').data;
	    };

	    prototypeAccessors.vertices.set = function (value)
	    {
	        this.geometry.getBuffer('aVertexPosition').data = value;
	    };

	    /**
	     * Updates the horizontal vertices.
	     *
	     */
	    NineSlicePlane.prototype.updateHorizontalVertices = function updateHorizontalVertices ()
	    {
	        var vertices = this.vertices;

	        var h = this._topHeight + this._bottomHeight;
	        var scale = this._height > h ? 1.0 : this._height / h;

	        vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;
	        vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);
	        vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;
	    };

	    /**
	     * Updates the vertical vertices.
	     *
	     */
	    NineSlicePlane.prototype.updateVerticalVertices = function updateVerticalVertices ()
	    {
	        var vertices = this.vertices;

	        var w = this._leftWidth + this._rightWidth;
	        var scale = this._width > w ? 1.0 : this._width / w;

	        vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;
	        vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);
	        vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;
	    };

	    /**
	     * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane
	     *
	     * @member {number}
	     */
	    prototypeAccessors.width.get = function ()
	    {
	        return this._width;
	    };

	    prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._width = value;
	        this._refresh();
	    };

	    /**
	     * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane
	     *
	     * @member {number}
	     */
	    prototypeAccessors.height.get = function ()
	    {
	        return this._height;
	    };

	    prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._height = value;
	        this._refresh();
	    };

	    /**
	     * The width of the left column
	     *
	     * @member {number}
	     */
	    prototypeAccessors.leftWidth.get = function ()
	    {
	        return this._leftWidth;
	    };

	    prototypeAccessors.leftWidth.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._leftWidth = value;
	        this._refresh();
	    };

	    /**
	     * The width of the right column
	     *
	     * @member {number}
	     */
	    prototypeAccessors.rightWidth.get = function ()
	    {
	        return this._rightWidth;
	    };

	    prototypeAccessors.rightWidth.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._rightWidth = value;
	        this._refresh();
	    };

	    /**
	     * The height of the top row
	     *
	     * @member {number}
	     */
	    prototypeAccessors.topHeight.get = function ()
	    {
	        return this._topHeight;
	    };

	    prototypeAccessors.topHeight.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._topHeight = value;
	        this._refresh();
	    };

	    /**
	     * The height of the bottom row
	     *
	     * @member {number}
	     */
	    prototypeAccessors.bottomHeight.get = function ()
	    {
	        return this._bottomHeight;
	    };

	    prototypeAccessors.bottomHeight.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        this._bottomHeight = value;
	        this._refresh();
	    };

	    /**
	     * Refreshes NineSlicePlane coords. All of them.
	     */
	    NineSlicePlane.prototype._refresh = function _refresh ()
	    {
	        var texture = this.texture;

	        var uvs = this.geometry.buffers[1].data;

	        this._origWidth = texture.orig.width;
	        this._origHeight = texture.orig.height;

	        var _uvw = 1.0 / this._origWidth;
	        var _uvh = 1.0 / this._origHeight;

	        uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;
	        uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;
	        uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;
	        uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;

	        uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;
	        uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);
	        uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;
	        uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);

	        this.updateHorizontalVertices();
	        this.updateVerticalVertices();

	        this.geometry.buffers[0].update();
	        this.geometry.buffers[1].update();
	    };

	    Object.defineProperties( NineSlicePlane.prototype, prototypeAccessors );

	    return NineSlicePlane;
	}(SimplePlane));

	/*!
	 * @pixi/sprite-animated - v5.1.5
	 * Compiled Tue, 24 Sep 2019 04:07:05 UTC
	 *
	 * @pixi/sprite-animated is licensed under the MIT License.
	 * http://www.opensource.org/licenses/mit-license
	 */

	/**
	 * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.
	 *
	 * ```js
	 * let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"];
	 * let textureArray = [];
	 *
	 * for (let i=0; i < 4; i++)
	 * {
	 *      let texture = PIXI.Texture.from(alienImages[i]);
	 *      textureArray.push(texture);
	 * };
	 *
	 * let animatedSprite = new PIXI.AnimatedSprite(textureArray);
	 * ```
	 *
	 * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}
	 * containing the animation definitions:
	 *
	 * ```js
	 * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);
	 *
	 * function setup() {
	 *   let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
	 *   animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]);
	 *   ...
	 * }
	 * ```
	 *
	 * @class
	 * @extends PIXI.Sprite
	 * @memberof PIXI
	 */
	var AnimatedSprite = /*@__PURE__*/(function (Sprite) {
	    function AnimatedSprite(textures, autoUpdate)
	    {
	        Sprite.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture);

	        /**
	         * @type {PIXI.Texture[]}
	         * @private
	         */
	        this._textures = null;

	        /**
	         * @type {number[]}
	         * @private
	         */
	        this._durations = null;

	        this.textures = textures;

	        /**
	         * `true` uses PIXI.Ticker.shared to auto update animation time.
	         * @type {boolean}
	         * @default true
	         * @private
	         */
	        this._autoUpdate = autoUpdate !== false;

	        /**
	         * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.
	         *
	         * @member {number}
	         * @default 1
	         */
	        this.animationSpeed = 1;

	        /**
	         * Whether or not the animate sprite repeats after playing.
	         *
	         * @member {boolean}
	         * @default true
	         */
	        this.loop = true;

	        /**
	         * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.
	         *
	         * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.
	         * Changing anchor for each frame allows to pin sprite origin to certain moving feature
	         * of the frame (e.g. left foot).
	         *
	         * Note: Enabling this will override any previously set `anchor` on each frame change.
	         *
	         * @member {boolean}
	         * @default false
	         */
	        this.updateAnchor = false;

	        /**
	         * Function to call when an AnimatedSprite finishes playing.
	         *
	         * @member {Function}
	         */
	        this.onComplete = null;

	        /**
	         * Function to call when an AnimatedSprite changes which texture is being rendered.
	         *
	         * @member {Function}
	         */
	        this.onFrameChange = null;

	        /**
	         * Function to call when `loop` is true, and an AnimatedSprite is played and loops around to start again.
	         *
	         * @member {Function}
	         */
	        this.onLoop = null;

	        /**
	         * Elapsed time since animation has been started, used internally to display current texture.
	         *
	         * @member {number}
	         * @private
	         */
	        this._currentTime = 0;

	        /**
	         * Indicates if the AnimatedSprite is currently playing.
	         *
	         * @member {boolean}
	         * @readonly
	         */
	        this.playing = false;
	    }

	    if ( Sprite ) { AnimatedSprite.__proto__ = Sprite; }
	    AnimatedSprite.prototype = Object.create( Sprite && Sprite.prototype );
	    AnimatedSprite.prototype.constructor = AnimatedSprite;

	    var prototypeAccessors = { totalFrames: { configurable: true },textures: { configurable: true },currentFrame: { configurable: true } };

	    /**
	     * Stops the AnimatedSprite.
	     *
	     */
	    AnimatedSprite.prototype.stop = function stop ()
	    {
	        if (!this.playing)
	        {
	            return;
	        }

	        this.playing = false;
	        if (this._autoUpdate)
	        {
	            Ticker.shared.remove(this.update, this);
	        }
	    };

	    /**
	     * Plays the AnimatedSprite.
	     *
	     */
	    AnimatedSprite.prototype.play = function play ()
	    {
	        if (this.playing)
	        {
	            return;
	        }

	        this.playing = true;
	        if (this._autoUpdate)
	        {
	            Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);
	        }
	    };

	    /**
	     * Stops the AnimatedSprite and goes to a specific frame.
	     *
	     * @param {number} frameNumber - Frame index to stop at.
	     */
	    AnimatedSprite.prototype.gotoAndStop = function gotoAndStop (frameNumber)
	    {
	        this.stop();

	        var previousFrame = this.currentFrame;

	        this._currentTime = frameNumber;

	        if (previousFrame !== this.currentFrame)
	        {
	            this.updateTexture();
	        }
	    };

	    /**
	     * Goes to a specific frame and begins playing the AnimatedSprite.
	     *
	     * @param {number} frameNumber - Frame index to start at.
	     */
	    AnimatedSprite.prototype.gotoAndPlay = function gotoAndPlay (frameNumber)
	    {
	        var previousFrame = this.currentFrame;

	        this._currentTime = frameNumber;

	        if (previousFrame !== this.currentFrame)
	        {
	            this.updateTexture();
	        }

	        this.play();
	    };

	    /**
	     * Updates the object transform for rendering.
	     *
	     * @private
	     * @param {number} deltaTime - Time since last tick.
	     */
	    AnimatedSprite.prototype.update = function update (deltaTime)
	    {
	        var elapsed = this.animationSpeed * deltaTime;
	        var previousFrame = this.currentFrame;

	        if (this._durations !== null)
	        {
	            var lag = this._currentTime % 1 * this._durations[this.currentFrame];

	            lag += elapsed / 60 * 1000;

	            while (lag < 0)
	            {
	                this._currentTime--;
	                lag += this._durations[this.currentFrame];
	            }

	            var sign = Math.sign(this.animationSpeed * deltaTime);

	            this._currentTime = Math.floor(this._currentTime);

	            while (lag >= this._durations[this.currentFrame])
	            {
	                lag -= this._durations[this.currentFrame] * sign;
	                this._currentTime += sign;
	            }

	            this._currentTime += lag / this._durations[this.currentFrame];
	        }
	        else
	        {
	            this._currentTime += elapsed;
	        }

	        if (this._currentTime < 0 && !this.loop)
	        {
	            this.gotoAndStop(0);

	            if (this.onComplete)
	            {
	                this.onComplete();
	            }
	        }
	        else if (this._currentTime >= this._textures.length && !this.loop)
	        {
	            this.gotoAndStop(this._textures.length - 1);

	            if (this.onComplete)
	            {
	                this.onComplete();
	            }
	        }
	        else if (previousFrame !== this.currentFrame)
	        {
	            if (this.loop && this.onLoop)
	            {
	                if (this.animationSpeed > 0 && this.currentFrame < previousFrame)
	                {
	                    this.onLoop();
	                }
	                else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)
	                {
	                    this.onLoop();
	                }
	            }

	            this.updateTexture();
	        }
	    };

	    /**
	     * Updates the displayed texture to match the current frame index.
	     *
	     * @private
	     */
	    AnimatedSprite.prototype.updateTexture = function updateTexture ()
	    {
	        this._texture = this._textures[this.currentFrame];
	        this._textureID = -1;
	        this._textureTrimmedID = -1;
	        this._cachedTint = 0xFFFFFF;
	        this.uvs = this._texture._uvs.uvsFloat32;

	        if (this.updateAnchor)
	        {
	            this._anchor.copyFrom(this._texture.defaultAnchor);
	        }

	        if (this.onFrameChange)
	        {
	            this.onFrameChange(this.currentFrame);
	        }
	    };

	    /**
	     * Stops the AnimatedSprite and destroys it.
	     *
	     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
	     *  have been set to that value.
	     * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy
	     *      method called as well. 'options' will be passed on to those calls.
	     * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.
	     * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.
	     */
	    AnimatedSprite.prototype.destroy = function destroy (options)
	    {
	        this.stop();
	        Sprite.prototype.destroy.call(this, options);

	        this.onComplete = null;
	        this.onFrameChange = null;
	        this.onLoop = null;
	    };

	    /**
	     * A short hand way of creating an AnimatedSprite from an array of frame ids.
	     *
	     * @static
	     * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.
	     * @return {AnimatedSprite} The new animated sprite with the specified frames.
	     */
	    AnimatedSprite.fromFrames = function fromFrames (frames)
	    {
	        var textures = [];

	        for (var i = 0; i < frames.length; ++i)
	        {
	            textures.push(Texture.from(frames[i]));
	        }

	        return new AnimatedSprite(textures);
	    };

	    /**
	     * A short hand way of creating an AnimatedSprite from an array of image ids.
	     *
	     * @static
	     * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.
	     * @return {AnimatedSprite} The new animate sprite with the specified images as frames.
	     */
	    AnimatedSprite.fromImages = function fromImages (images)
	    {
	        var textures = [];

	        for (var i = 0; i < images.length; ++i)
	        {
	            textures.push(Texture.from(images[i]));
	        }

	        return new AnimatedSprite(textures);
	    };

	    /**
	     * The total number of frames in the AnimatedSprite. This is the same as number of textures
	     * assigned to the AnimatedSprite.
	     *
	     * @readonly
	     * @member {number}
	     * @default 0
	     */
	    prototypeAccessors.totalFrames.get = function ()
	    {
	        return this._textures.length;
	    };

	    /**
	     * The array of textures used for this AnimatedSprite.
	     *
	     * @member {PIXI.Texture[]}
	     */
	    prototypeAccessors.textures.get = function ()
	    {
	        return this._textures;
	    };

	    prototypeAccessors.textures.set = function (value) // eslint-disable-line require-jsdoc
	    {
	        if (value[0] instanceof Texture)
	        {
	            this._textures = value;
	            this._durations = null;
	        }
	        else
	        {
	            this._textures = [];
	            this._durations = [];

	            for (var i = 0; i < value.length; i++)
	            {
	                this._textures.push(value[i].texture);
	                this._durations.push(value[i].time);
	            }
	        }
	        this.gotoAndStop(0);
	        this.updateTexture();
	    };

	    /**
	    * The AnimatedSprites current frame index.
	    *
	    * @member {number}
	    * @readonly
	    */
	    prototypeAccessors.currentFrame.get = function ()
	    {
	        var currentFrame = Math.floor(this._currentTime) % this._textures.length;

	        if (currentFrame < 0)
	        {
	            currentFrame += this._textures.length;
	        }

	        return currentFrame;
	    };

	    Object.defineProperties( AnimatedSprite.prototype, prototypeAccessors );

	    return AnimatedSprite;
	}(Sprite));

	// Install renderer plugins
	Renderer.registerPlugin('accessibility', AccessibilityManager);
	Renderer.registerPlugin('extract', Extract);
	Renderer.registerPlugin('interaction', InteractionManager);
	Renderer.registerPlugin('particle', ParticleRenderer);
	Renderer.registerPlugin('prepare', Prepare);
	Renderer.registerPlugin('batch', BatchRenderer);
	Renderer.registerPlugin('tilingSprite', TilingSpriteRenderer);

	Loader$1.registerPlugin(BitmapFontLoader);
	Loader$1.registerPlugin(SpritesheetLoader);

	Application.registerPlugin(TickerPlugin);
	Application.registerPlugin(AppLoaderPlugin);

	/**
	 * String of the current PIXI version.
	 *
	 * @static
	 * @constant
	 * @memberof PIXI
	 * @name VERSION
	 * @type {string}
	 */
	var VERSION$1 = '5.1.5';

	/**
	 * @namespace PIXI
	 */

	/**
	 * This namespace contains WebGL-only display filters that can be applied
	 * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.
	 *
	 * Since PixiJS only had a handful of built-in filters, additional filters
	 * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the
	 * PixiJS Filters repository.
	 *
	 * All filters must extend {@link PIXI.Filter}.
	 *
	 * @example
	 * // Create a new application
	 * const app = new PIXI.Application();
	 *
	 * // Draw a green rectangle
	 * const rect = new PIXI.Graphics()
	 *     .beginFill(0x00ff00)
	 *     .drawRect(40, 40, 200, 200);
	 *
	 * // Add a blur filter
	 * rect.filters = [new PIXI.filters.BlurFilter()];
	 *
	 * // Display rectangle
	 * app.stage.addChild(rect);
	 * document.body.appendChild(app.view);
	 * @namespace PIXI.filters
	 */
	var filters = {
	    AlphaFilter: AlphaFilter,
	    BlurFilter: BlurFilter,
	    BlurFilterPass: BlurFilterPass,
	    ColorMatrixFilter: ColorMatrixFilter,
	    DisplacementFilter: DisplacementFilter,
	    FXAAFilter: FXAAFilter,
	    NoiseFilter: NoiseFilter,
	};

	exports.AbstractBatchRenderer = AbstractBatchRenderer;
	exports.AbstractRenderer = AbstractRenderer;
	exports.AnimatedSprite = AnimatedSprite;
	exports.AppLoaderPlugin = AppLoaderPlugin;
	exports.Application = Application;
	exports.Attribute = Attribute;
	exports.BLEND_MODES = BLEND_MODES;
	exports.BaseRenderTexture = BaseRenderTexture;
	exports.BaseTexture = BaseTexture;
	exports.BatchDrawCall = BatchDrawCall;
	exports.BatchGeometry = BatchGeometry;
	exports.BatchPluginFactory = BatchPluginFactory;
	exports.BatchRenderer = BatchRenderer;
	exports.BatchShaderGenerator = BatchShaderGenerator;
	exports.BitmapFontLoader = BitmapFontLoader;
	exports.BitmapText = BitmapText;
	exports.Bounds = Bounds;
	exports.Buffer = Buffer;
	exports.Circle = Circle;
	exports.Container = Container;
	exports.CubeTexture = CubeTexture;
	exports.DEG_TO_RAD = DEG_TO_RAD;
	exports.DRAW_MODES = DRAW_MODES;
	exports.DisplayObject = DisplayObject;
	exports.ENV = ENV;
	exports.Ellipse = Ellipse;
	exports.FORMATS = FORMATS;
	exports.FillStyle = FillStyle;
	exports.Filter = Filter;
	exports.Framebuffer = Framebuffer;
	exports.GC_MODES = GC_MODES;
	exports.GLProgram = GLProgram;
	exports.GLTexture = BaseTexture;
	exports.GRAPHICS_CURVES = GRAPHICS_CURVES;
	exports.Geometry = Geometry;
	exports.Graphics = Graphics;
	exports.GraphicsData = GraphicsData;
	exports.GraphicsGeometry = GraphicsGeometry;
	exports.GroupD8 = GroupD8;
	exports.LineStyle = LineStyle;
	exports.Loader = Loader$1;
	exports.LoaderResource = LoaderResource;
	exports.MIPMAP_MODES = MIPMAP_MODES;
	exports.Matrix = Matrix;
	exports.Mesh = Mesh;
	exports.MeshBatchUvs = MeshBatchUvs;
	exports.MeshGeometry = MeshGeometry;
	exports.MeshMaterial = MeshMaterial;
	exports.NineSlicePlane = NineSlicePlane;
	exports.ObjectRenderer = ObjectRenderer;
	exports.ObservablePoint = ObservablePoint;
	exports.PI_2 = PI_2;
	exports.PRECISION = PRECISION;
	exports.ParticleContainer = ParticleContainer;
	exports.ParticleRenderer = ParticleRenderer;
	exports.PlaneGeometry = PlaneGeometry;
	exports.Point = Point;
	exports.Polygon = Polygon;
	exports.Program = Program;
	exports.Quad = Quad;
	exports.QuadUv = QuadUv;
	exports.RAD_TO_DEG = RAD_TO_DEG;
	exports.RENDERER_TYPE = RENDERER_TYPE;
	exports.Rectangle = Rectangle;
	exports.RenderTexture = RenderTexture;
	exports.RenderTexturePool = RenderTexturePool;
	exports.Renderer = Renderer;
	exports.RopeGeometry = RopeGeometry;
	exports.RoundedRectangle = RoundedRectangle;
	exports.Runner = Runner;
	exports.SCALE_MODES = SCALE_MODES;
	exports.SHAPES = SHAPES;
	exports.Shader = Shader;
	exports.SimpleMesh = SimpleMesh;
	exports.SimplePlane = SimplePlane;
	exports.SimpleRope = SimpleRope;
	exports.Sprite = Sprite;
	exports.SpriteMaskFilter = SpriteMaskFilter;
	exports.Spritesheet = Spritesheet;
	exports.SpritesheetLoader = SpritesheetLoader;
	exports.State = State;
	exports.System = System;
	exports.TARGETS = TARGETS;
	exports.TEXT_GRADIENT = TEXT_GRADIENT;
	exports.TYPES = TYPES;
	exports.Text = Text;
	exports.TextMetrics = TextMetrics;
	exports.TextStyle = TextStyle;
	exports.Texture = Texture;
	exports.TextureLoader = TextureLoader;
	exports.TextureMatrix = TextureMatrix;
	exports.TextureUvs = TextureUvs;
	exports.Ticker = Ticker;
	exports.TickerPlugin = TickerPlugin;
	exports.TilingSprite = TilingSprite;
	exports.TilingSpriteRenderer = TilingSpriteRenderer;
	exports.Transform = Transform;
	exports.UPDATE_PRIORITY = UPDATE_PRIORITY;
	exports.UniformGroup = UniformGroup;
	exports.VERSION = VERSION$1;
	exports.ViewableBuffer = ViewableBuffer;
	exports.WRAP_MODES = WRAP_MODES;
	exports.accessibility = accessibility_es;
	exports.autoDetectRenderer = autoDetectRenderer;
	exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader;
	exports.defaultFilterVertex = defaultFilter;
	exports.defaultVertex = _default;
	exports.extract = extract_es;
	exports.filters = filters;
	exports.interaction = interaction_es;
	exports.isMobile = isMobile_min;
	exports.prepare = prepare_es;
	exports.resources = index;
	exports.settings = settings;
	exports.systems = systems;
	exports.useDeprecated = useDeprecated;
	exports.utils = utils_es;

	return exports;

}({}));
PIXI.useDeprecated();


var e;e||(e=eval("(function() { try { return Module || {} } catch(e) { return {} } })()"));var aa={},k;for(k in e)e.hasOwnProperty(k)&&(aa[k]=e[k]);var ba="object"===typeof window,ca="function"===typeof importScripts,da="object"===typeof process&&"function"===typeof require&&!ba&&!ca,ea=!ba&&!da&&!ca;
if(da){e.print||(e.print=function(a){process.stdout.write(a+"\n")});e.printErr||(e.printErr=function(a){process.stderr.write(a+"\n")});var fa=require("fs"),ga=require("path");e.read=function(a,b){a=ga.normalize(a);var c=fa.readFileSync(a);c||a==ga.resolve(a)||(a=path.join(__dirname,"..","src",a),c=fa.readFileSync(a));c&&!b&&(c=c.toString());return c};e.readBinary=function(a){a=e.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};e.load=function(a){ha(read(a))};e.thisProgram||(e.thisProgram=
1<process.argv.length?process.argv[1].replace(/\\/g,"/"):"unknown-program");e.arguments=process.argv.slice(2);"undefined"!==typeof module&&(module.exports=e);process.on("uncaughtException",function(a){if(!(a instanceof ia))throw a;});e.inspect=function(){return"[Emscripten Module object]"}}else if(ea)e.print||(e.print=print),"undefined"!=typeof printErr&&(e.printErr=printErr),e.read="undefined"!=typeof read?read:function(){throw"no read() available (jsc?)";},e.readBinary=function(a){if("function"===
typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!=typeof scriptArgs?e.arguments=scriptArgs:"undefined"!=typeof arguments&&(e.arguments=arguments),eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined");else if(ba||ca)e.read=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!==
typeof console?(e.print||(e.print=function(a){console.log(a)}),e.printErr||(e.printErr=function(a){console.log(a)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),"undefined"===typeof e.setWindowTitle&&(e.setWindowTitle=function(a){document.title=a});else throw"Unknown runtime environment. Where are we?";function ha(a){eval.call(null,a)}!e.load&&e.read&&(e.load=function(a){ha(e.read(a))});e.print||(e.print=function(){});e.printErr||(e.printErr=e.print);e.arguments||(e.arguments=[]);
e.thisProgram||(e.thisProgram="./this.program");e.print=e.print;e.W=e.printErr;e.preRun=[];e.postRun=[];for(k in aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);
var n={rb:function(a){ka=a},fb:function(){return ka},ua:function(){return m},ba:function(a){m=a},Ka:function(a){switch(a){case "i1":case "i8":return 1;case "i16":return 2;case "i32":return 4;case "i64":return 8;case "float":return 4;case "double":return 8;default:return"*"===a[a.length-1]?n.J:"i"===a[0]?(a=parseInt(a.substr(1)),assert(0===a%8),a/8):0}},eb:function(a){return Math.max(n.Ka(a),n.J)},ud:16,Qd:function(a,b){"double"===b||"i64"===b?a&7&&(assert(4===(a&7)),a+=4):assert(0===(a&3));return a},
Ed:function(a,b,c){return c||"i64"!=a&&"double"!=a?a?Math.min(b||(a?n.eb(a):0),n.J):Math.min(b,8):8},L:function(a,b,c){return c&&c.length?(c.splice||(c=Array.prototype.slice.call(c)),c.splice(0,0,b),e["dynCall_"+a].apply(null,c)):e["dynCall_"+a].call(null,b)},Z:[],Xa:function(a){for(var b=0;b<n.Z.length;b++)if(!n.Z[b])return n.Z[b]=a,2*(1+b);throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.";},nb:function(a){n.Z[(a-2)/2]=null},O:function(a){n.O.ta||
(n.O.ta={});n.O.ta[a]||(n.O.ta[a]=1,e.W(a))},ma:{},Hd:function(a,b){assert(b);n.ma[b]||(n.ma[b]={});var c=n.ma[b];c[a]||(c[a]=function(){return n.L(b,a,arguments)});return c[a]},Fd:function(){throw"You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work";},aa:function(a){var b=m;m=m+a|0;m=m+15&-16;return b},Ra:function(a){var b=la;la=la+a|0;la=la+15&-16;return b},R:function(a){var b=r;r=r+a|0;r=r+15&-16;return r>=t&&!ma()?(r=b,0):
b},ja:function(a,b){return Math.ceil(a/(b?b:16))*(b?b:16)},Nd:function(a,b,c){return c?+(a>>>0)+4294967296*+(b>>>0):+(a>>>0)+4294967296*+(b|0)},Ua:8,J:4,vd:0};e.Runtime=n;n.addFunction=n.Xa;n.removeFunction=n.nb;var na=!1,oa,pa,ka;function assert(a,b){a||x("Assertion failed: "+b)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(c){}assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)");return b}var ra,sa;
(function(){function a(a){a=a.toString().match(d).slice(1);return{arguments:a[0],body:a[1],returnValue:a[2]}}var b={stackSave:function(){n.ua()},stackRestore:function(){n.ba()},arrayToC:function(a){var b=n.aa(a.length);ta(a,b);return b},stringToC:function(a){var b=0;null!==a&&void 0!==a&&0!==a&&(b=n.aa((a.length<<2)+1),ua(a,b));return b}},c={string:b.stringToC,array:b.arrayToC};sa=function(a,b,d,f,g){a=qa(a);var v=[],B=0;if(f)for(var G=0;G<f.length;G++){var O=c[d[G]];O?(0===B&&(B=n.ua()),v[G]=O(f[G])):
v[G]=f[G]}d=a.apply(null,v);"string"===b&&(d=va(d));if(0!==B){if(g&&g.async){EmterpreterAsync.yd.push(function(){n.ba(B)});return}n.ba(B)}return d};var d=/^function\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/,f={},g;for(g in b)b.hasOwnProperty(g)&&(f[g]=a(b[g]));ra=function(b,c,d){d=d||[];var g=qa(b);b=d.every(function(a){return"number"===a});var q="string"!==c;if(q&&b)return g;var v=d.map(function(a,b){return"$"+b});c="(function("+v.join(",")+") {";var B=d.length;if(!b){c+="var stack = "+
f.stackSave.body+";";for(var G=0;G<B;G++){var O=v[G],ja=d[G];"number"!==ja&&(ja=f[ja+"ToC"],c+="var "+ja.arguments+" = "+O+";",c+=ja.body+";",c+=O+"="+ja.returnValue+";")}}d=a(function(){return g}).returnValue;c+="var ret = "+d+"("+v.join(",")+");";q||(d=a(function(){return va}).returnValue,c+="ret = "+d+"(ret);");b||(c+=f.stackRestore.body.replace("()","(stack)")+";");return eval(c+"return ret})")}})();e.ccall=sa;e.cwrap=ra;
function wa(a,b,c){c=c||"i8";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":y[a>>0]=b;break;case "i8":y[a>>0]=b;break;case "i16":z[a>>1]=b;break;case "i32":C[a>>2]=b;break;case "i64":pa=[b>>>0,(oa=b,1<=+xa(oa)?0<oa?(ya(+za(oa/4294967296),4294967295)|0)>>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)];C[a>>2]=pa[0];C[a+4>>2]=pa[1];break;case "float":Ba[a>>2]=b;break;case "double":Ca[a>>3]=b;break;default:x("invalid type for setValue: "+c)}}e.setValue=wa;
function Da(a,b){b=b||"i8";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":return y[a>>0];case "i8":return y[a>>0];case "i16":return z[a>>1];case "i32":return C[a>>2];case "i64":return C[a>>2];case "float":return Ba[a>>2];case "double":return Ca[a>>3];default:x("invalid type for setValue: "+b)}return null}e.getValue=Da;e.ALLOC_NORMAL=0;e.ALLOC_STACK=1;e.ALLOC_STATIC=2;e.ALLOC_DYNAMIC=3;e.ALLOC_NONE=4;
function D(a,b,c,d){var f,g;"number"===typeof a?(f=!0,g=a):(f=!1,g=a.length);var h="string"===typeof b?b:null;c=4==c?d:[Ea,n.aa,n.Ra,n.R][void 0===c?2:c](Math.max(g,h?1:b.length));if(f){d=c;assert(0==(c&3));for(a=c+(g&-4);d<a;d+=4)C[d>>2]=0;for(a=c+g;d<a;)y[d++>>0]=0;return c}if("i8"===h)return a.subarray||a.slice?E.set(a,c):E.set(new Uint8Array(a),c),c;d=0;for(var l,w;d<g;){var u=a[d];"function"===typeof u&&(u=n.Id(u));f=h||b[d];0===f?d++:("i64"==f&&(f="i32"),wa(c+d,u,f),w!==f&&(l=n.Ka(f),w=f),d+=
l)}return c}e.allocate=D;e.getMemory=function(a){return Fa?"undefined"!==typeof Ga&&!Ga.p||!Ha?n.R(a):Ea(a):n.Ra(a)};function va(a,b){if(0===b||!a)return"";for(var c=0,d,f=0;;){d=E[a+f>>0];c|=d;if(0==d&&!b)break;f++;if(b&&f==b)break}b||(b=f);d="";if(128>c){for(;0<b;)c=String.fromCharCode.apply(String,E.subarray(a,a+Math.min(b,1024))),d=d?d+c:c,a+=1024,b-=1024;return d}return e.UTF8ToString(a)}e.Pointer_stringify=va;e.AsciiToString=function(a){for(var b="";;){var c=y[a++>>0];if(!c)return b;b+=String.fromCharCode(c)}};
e.stringToAscii=function(a,b){return Ia(a,b,!1)};
function Ja(a,b){for(var c,d,f,g,h,l,w="";;){c=a[b++];if(!c)return w;c&128?(d=a[b++]&63,192==(c&224)?w+=String.fromCharCode((c&31)<<6|d):(f=a[b++]&63,224==(c&240)?c=(c&15)<<12|d<<6|f:(g=a[b++]&63,240==(c&248)?c=(c&7)<<18|d<<12|f<<6|g:(h=a[b++]&63,248==(c&252)?c=(c&3)<<24|d<<18|f<<12|g<<6|h:(l=a[b++]&63,c=(c&1)<<30|d<<24|f<<18|g<<12|h<<6|l))),65536>c?w+=String.fromCharCode(c):(c-=65536,w+=String.fromCharCode(55296|c>>10,56320|c&1023)))):w+=String.fromCharCode(c)}}e.UTF8ArrayToString=Ja;
e.UTF8ToString=function(a){return Ja(E,a)};
function Ka(a,b,c,d){if(!(0<d))return 0;var f=c;d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);55296<=h&&57343>=h&&(h=65536+((h&1023)<<10)|a.charCodeAt(++g)&1023);if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(2097151>=h){if(c+3>=d)break;b[c++]=240|h>>18}else{if(67108863>=h){if(c+4>=d)break;b[c++]=248|h>>24}else{if(c+5>=d)break;b[c++]=252|h>>30;b[c++]=128|h>>24&63}b[c++]=128|h>>18&63}b[c++]=128|
h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0;return c-f}e.stringToUTF8Array=Ka;e.stringToUTF8=function(a,b,c){return Ka(a,E,b,c)};function La(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:2097151>=d?b+4:67108863>=d?b+5:b+6}return b}e.lengthBytesUTF8=La;e.UTF16ToString=function(a){for(var b=0,c="";;){var d=z[a+2*b>>1];if(0==d)return c;++b;c+=String.fromCharCode(d)}};
e.stringToUTF16=function(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)z[b>>1]=a.charCodeAt(f),b+=2;z[b>>1]=0;return b-d};e.lengthBytesUTF16=function(a){return 2*a.length};e.UTF32ToString=function(a){for(var b=0,c="";;){var d=C[a+4*b>>2];if(0==d)return c;++b;65536<=d?(d=d-65536,c+=String.fromCharCode(55296|d>>10,56320|d&1023)):c+=String.fromCharCode(d)}};
e.stringToUTF32=function(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g)var h=a.charCodeAt(++f),g=65536+((g&1023)<<10)|h&1023;C[b>>2]=g;b+=4;if(b+4>c)break}C[b>>2]=0;return b-d};e.lengthBytesUTF32=function(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b};
function Ma(a){function b(c,d,f){d=d||Infinity;var g="",h=[],v;if("N"===a[l]){l++;"K"===a[l]&&l++;for(v=[];"E"!==a[l];)if("S"===a[l]){l++;var A=a.indexOf("_",l);v.push(u[a.substring(l,A)||0]||"?");l=A+1}else if("C"===a[l])v.push(v[v.length-1]),l+=2;else{var A=parseInt(a.substr(l)),U=A.toString().length;if(!A||!U){l--;break}var Ub=a.substr(l+U,A);v.push(Ub);u.push(Ub);l+=U+A}l++;v=v.join("::");d--;if(0===d)return c?[v]:v}else if(("K"===a[l]||q&&"L"===a[l])&&l++,A=parseInt(a.substr(l)))U=A.toString().length,
v=a.substr(l+U,A),l+=U+A;q=!1;"I"===a[l]?(l++,A=b(!0),U=b(!0,1,!0),g+=U[0]+" "+v+"<"+A.join(", ")+">"):g=v;a:for(;l<a.length&&0<d--;)if(v=a[l++],v in w)h.push(w[v]);else switch(v){case "P":h.push(b(!0,1,!0)[0]+"*");break;case "R":h.push(b(!0,1,!0)[0]+"&");break;case "L":l++;A=a.indexOf("E",l)-l;h.push(a.substr(l,A));l+=A+2;break;case "A":A=parseInt(a.substr(l));l+=A.toString().length;if("_"!==a[l])throw"?";l++;h.push(b(!0,1,!0)[0]+" ["+A+"]");break;case "E":break a;default:g+="?"+v;break a}f||1!==
h.length||"void"!==h[0]||(h=[]);return c?(g&&h.push(g+"?"),h):g+("("+h.join(", ")+")")}var c=!!e.___cxa_demangle;if(c)try{var d=Ea(a.length);ua(a.substr(1),d);var f=Ea(4),g=e.___cxa_demangle(d,0,0,f);if(0===Da(f,"i32")&&g)return va(g)}catch(h){}finally{d&&Na(d),f&&Na(f),g&&Na(g)}var l=3,w={v:"void",b:"bool",c:"char",s:"short",i:"int",l:"long",f:"float",d:"double",w:"wchar_t",a:"signed char",h:"unsigned char",t:"unsigned short",j:"unsigned int",m:"unsigned long",x:"long long",y:"unsigned long long",
z:"..."},u=[],q=!0,d=a;try{if("Object._main"==a||"_main"==a)return"main()";"number"===typeof a&&(a=va(a));if("_"!==a[0]||"_"!==a[1]||"Z"!==a[2])return a;switch(a[3]){case "n":return"operator new()";case "d":return"operator delete()"}d=b()}catch(v){d+="?"}0<=d.indexOf("?")&&!c&&n.O("warning: a problem occurred in builtin C++ name demangling; build with  -s DEMANGLE_SUPPORT=1  to link in libcxxabi demangling");return d}
function Oa(){return Pa().replace(/__Z[\w\d_]+/g,function(a){var b=Ma(a);return a===b?a:a+" ["+b+"]"})}function Pa(){var a=Error();if(!a.stack){try{throw Error(0);}catch(b){a=b}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}e.stackTrace=function(){return Oa()};function Qa(a){0<a%4096&&(a+=4096-a%4096);return a}var y,E,z,Ra,C,Sa,Ba,Ca,Ta=0,la=0,Fa=!1,Ua=0,m=0,Va=0,Wa=0,r=0;
function ma(){var a=Math.pow(2,31);if(r>=a)return!1;for(;t<=r;)if(t<a/2)t=Qa(2*t);else{var b=t;t=Qa((3*t+a)/4);if(t<=b)return!1}t=Math.max(t,16777216);if(t>=a)return!1;try{if(ArrayBuffer.p)buffer=ArrayBuffer.p(buffer,t);else{var c=y;buffer=new ArrayBuffer(t)}}catch(d){return!1}if(!Xa(buffer))return!1;e.buffer=buffer;e.HEAP8=y=new Int8Array(buffer);e.HEAP16=z=new Int16Array(buffer);e.HEAP32=C=new Int32Array(buffer);e.HEAPU8=E=new Uint8Array(buffer);e.HEAPU16=Ra=new Uint16Array(buffer);e.HEAPU32=Sa=
new Uint32Array(buffer);e.HEAPF32=Ba=new Float32Array(buffer);e.HEAPF64=Ca=new Float64Array(buffer);ArrayBuffer.p||y.set(c);return!0}var Ya;try{Ya=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),Ya(new ArrayBuffer(4))}catch(Za){Ya=function(a){return a.byteLength}}for(var $a=e.TOTAL_STACK||5242880,t=e.TOTAL_MEMORY||16777216,F=65536;F<t||F<2*$a;)F=16777216>F?2*F:F+16777216;F=Math.max(F,16777216);F!==t&&(t=F);
assert("undefined"!==typeof Int32Array&&"undefined"!==typeof Float64Array&&!!(new Int32Array(1)).subarray&&!!(new Int32Array(1)).set,"JS engine does not provide full typed array support");var buffer;buffer=new ArrayBuffer(t);y=new Int8Array(buffer);z=new Int16Array(buffer);C=new Int32Array(buffer);E=new Uint8Array(buffer);Ra=new Uint16Array(buffer);Sa=new Uint32Array(buffer);Ba=new Float32Array(buffer);Ca=new Float64Array(buffer);C[0]=255;assert(255===E[0]&&0===E[3],"Typed arrays 2 must be run on a little-endian system");
e.HEAP=void 0;e.buffer=buffer;e.HEAP8=y;e.HEAP16=z;e.HEAP32=C;e.HEAPU8=E;e.HEAPU16=Ra;e.HEAPU32=Sa;e.HEAPF32=Ba;e.HEAPF64=Ca;function ab(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var c=b.ab;"number"===typeof c?void 0===b.X?n.L("v",c):n.L("vi",c,[b.X]):c(void 0===b.X?null:b.X)}}}var bb=[],cb=[],db=[],H=[],eb=[],Ha=!1;function fb(a){bb.unshift(a)}e.addOnPreRun=fb;e.addOnInit=function(a){cb.unshift(a)};e.addOnPreMain=function(a){db.unshift(a)};e.addOnExit=function(a){H.unshift(a)};
function gb(a){eb.unshift(a)}e.addOnPostRun=gb;function hb(a,b,c){c=Array(0<c?c:La(a)+1);a=Ka(a,c,0,c.length);b&&(c.length=a);return c}e.intArrayFromString=hb;e.intArrayToString=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];255<d&&(d&=255);b.push(String.fromCharCode(d))}return b.join("")};function ua(a,b,c){a=hb(a,c);for(c=0;c<a.length;)y[b+c>>0]=a[c],c+=1}e.writeStringToMemory=ua;function ta(a,b){for(var c=0;c<a.length;c++)y[b++>>0]=a[c]}e.writeArrayToMemory=ta;
function Ia(a,b,c){for(var d=0;d<a.length;++d)y[b++>>0]=a.charCodeAt(d);c||(y[b>>0]=0)}e.writeAsciiToMemory=Ia;Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(a,b){var c=a&65535,d=b&65535;return c*d+((a>>>16)*d+c*(b>>>16)<<16)|0});Math.Jd=Math.imul;Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var b=0;32>b;b++)if(a&1<<31-b)return b;return 32});Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;
function kb(){I++;e.monitorRunDependencies&&e.monitorRunDependencies(I)}e.addRunDependency=kb;function lb(){I--;e.monitorRunDependencies&&e.monitorRunDependencies(I);if(0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var a=jb;jb=null;a()}}e.removeRunDependency=lb;e.preloadedImages={};e.preloadedAudios={};Ta=8;la=Ta+5888;cb.push();
D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,
110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,
115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,
82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,
109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,
101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,
98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,
105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,
32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,
101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,
96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,
99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,
116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,
116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,
100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,
111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,
99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,
101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,
117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,
32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,
112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,
0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,
32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,
105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,
0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,
0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);assert(0==mb%8);e._i64Subtract=nb;
function ob(a){e.___errno_location&&(C[e.___errno_location()>>2]=a);return a}
var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,
wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(a,b){H.push(function(){n.L("vi",a,[b])});pb.level=H.length}e._memset=qb;e._bitshift64Lshr=rb;e._bitshift64Shl=sb;function tb(){return!!tb.p}var ub=[],vb={};function wb(a,b){wb.p||(wb.p={});a in wb.p||(n.L("v",b),wb.p[a]=1)}
var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",
24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",
44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",
65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can   access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",
82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",
100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",
122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function zb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=yb(a.split("/").filter(function(a){return!!a}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
function Ab(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function Bb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}function Cb(){var a=Array.prototype.slice.call(arguments,0);return zb(a.join("/"))}function K(a,b){return zb(a+"/"+b)}
function Db(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=yb(a.split("/").filter(function(a){return!!a}),!b).join("/");return(b?"/":"")+a||"."}var Eb=[];function Fb(a,b){Eb[a]={input:[],output:[],N:b};Gb(a,Hb)}
var Hb={open:function(a){var b=Eb[a.g.rdev];if(!b)throw new L(J.ha);a.tty=b;a.seekable=!1},close:function(a){a.tty.N.flush(a.tty)},flush:function(a){a.tty.N.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.N.La)throw new L(J.Aa);for(var f=0,g=0;g<d;g++){var h;try{h=a.tty.N.La(a.tty)}catch(l){throw new L(J.H);}if(void 0===h&&0===f)throw new L(J.va);if(null===h||void 0===h)break;f++;b[c+g]=h}f&&(a.g.timestamp=Date.now());return f},write:function(a,b,c,d){if(!a.tty||!a.tty.N.qa)throw new L(J.Aa);
for(var f=0;f<d;f++)try{a.tty.N.qa(a.tty,b[c+f])}catch(g){throw new L(J.H);}d&&(a.g.timestamp=Date.now());return f}},Ib={La:function(a){if(!a.input.length){var b=null;if(da){var c=new Buffer(256),d=0,f=process.stdin.fd,g=!1;try{f=fs.openSync("/dev/stdin","r"),g=!0}catch(h){}d=fs.readSync(f,c,0,256,null);g&&fs.closeSync(f);0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==typeof readline&&
(b=readline(),null!==b&&(b+="\n"));if(!b)return null;a.input=hb(b,!0)}return a.input.shift()},qa:function(a,b){null===b||10===b?(e.print(Ja(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(e.print(Ja(a.output,0)),a.output=[])}},Jb={qa:function(a,b){null===b||10===b?(e.printErr(Ja(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(e.printErr(Ja(a.output,0)),a.output=[])}},M={C:null,A:function(){return M.createNode(null,
"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new L(J.I);M.C||(M.C={dir:{g:{D:M.k.D,u:M.k.u,lookup:M.k.lookup,T:M.k.T,rename:M.k.rename,unlink:M.k.unlink,rmdir:M.k.rmdir,readdir:M.k.readdir,symlink:M.k.symlink},stream:{G:M.n.G}},file:{g:{D:M.k.D,u:M.k.u},stream:{G:M.n.G,read:M.n.read,write:M.n.write,Ba:M.n.Ba,Na:M.n.Na,Pa:M.n.Pa}},link:{g:{D:M.k.D,u:M.k.u,readlink:M.k.readlink},stream:{}},Ea:{g:{D:M.k.D,u:M.k.u},stream:Kb}});c=Lb(a,b,c,d);N(c.mode)?(c.k=M.C.dir.g,
c.n=M.C.dir.stream,c.e={}):32768===(c.mode&61440)?(c.k=M.C.file.g,c.n=M.C.file.stream,c.o=0,c.e=null):40960===(c.mode&61440)?(c.k=M.C.link.g,c.n=M.C.link.stream):8192===(c.mode&61440)&&(c.k=M.C.Ea.g,c.n=M.C.Ea.stream);c.timestamp=Date.now();a&&(a.e[b]=c);return c},cb:function(a){if(a.e&&a.e.subarray){for(var b=[],c=0;c<a.o;++c)b.push(a.e[c]);return b}return a.e},Gd:function(a){return a.e?a.e.subarray?a.e.subarray(0,a.o):new Uint8Array(a.e):new Uint8Array},Ga:function(a,b){a.e&&a.e.subarray&&b>a.e.length&&
(a.e=M.cb(a),a.o=a.e.length);if(!a.e||a.e.subarray){var c=a.e?a.e.buffer.byteLength:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)|0),0!=c&&(b=Math.max(b,256)),c=a.e,a.e=new Uint8Array(b),0<a.o&&a.e.set(c.subarray(0,a.o),0))}else for(!a.e&&0<b&&(a.e=[]);a.e.length<b;)a.e.push(0)},ob:function(a,b){if(a.o!=b)if(0==b)a.e=null,a.o=0;else{if(!a.e||a.e.subarray){var c=a.e;a.e=new Uint8Array(new ArrayBuffer(b));c&&a.e.set(c.subarray(0,Math.min(b,a.o)))}else if(a.e||(a.e=[]),a.e.length>b)a.e.length=b;else for(;a.e.length<
b;)a.e.push(0);a.o=b}},k:{D:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;N(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.o:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.K=4096;b.blocks=Math.ceil(b.size/b.K);return b},u:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==
b.size&&M.ob(a,b.size)},lookup:function(){throw Mb[J.F];},T:function(a,b,c,d){return M.createNode(a,b,c,d)},rename:function(a,b,c){if(N(a.mode)){var d;try{d=Nb(b,c)}catch(f){}if(d)for(var g in d.e)throw new L(J.za);}delete a.parent.e[a.name];a.name=c;b.e[c]=a;a.parent=b},unlink:function(a,b){delete a.e[b]},rmdir:function(a,b){var c=Nb(a,b),d;for(d in c.e)throw new L(J.za);delete a.e[b]},readdir:function(a){var b=[".",".."],c;for(c in a.e)a.e.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,
b,c){a=M.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new L(J.q);return a.link}},n:{read:function(a,b,c,d,f){var g=a.g.e;if(f>=a.g.o)return 0;a=Math.min(a.g.o-f,d);assert(0<=a);if(8<a&&g.subarray)b.set(g.subarray(f,f+a),c);else for(d=0;d<a;d++)b[c+d]=g[f+d];return a},write:function(a,b,c,d,f,g){if(!d)return 0;a=a.g;a.timestamp=Date.now();if(b.subarray&&(!a.e||a.e.subarray)){if(g)return a.e=b.subarray(c,c+d),a.o=d;if(0===a.o&&0===f)return a.e=new Uint8Array(b.subarray(c,
c+d)),a.o=d;if(f+d<=a.o)return a.e.set(b.subarray(c,c+d),f),d}M.Ga(a,f+d);if(a.e.subarray&&b.subarray)a.e.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.e[f+g]=b[c+g];a.o=Math.max(a.o,f+d);return d},G:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.g.mode&61440)&&(b+=a.g.o);if(0>b)throw new L(J.q);return b},Ba:function(a,b,c){M.Ga(a.g,b+c);a.g.o=Math.max(a.g.o,b+c)},Na:function(a,b,c,d,f,g,h){if(32768!==(a.g.mode&61440))throw new L(J.ha);c=a.g.e;if(h&2||c.buffer!==b&&c.buffer!==b.buffer){if(0<
f||f+d<a.g.o)c.subarray?c=c.subarray(f,f+d):c=Array.prototype.slice.call(c,f,f+d);a=!0;d=Ea(d);if(!d)throw new L(J.Ta);b.set(c,d)}else a=!1,d=c.byteOffset;return{Rd:d,xd:a}},Pa:function(a,b,c,d,f){if(32768!==(a.g.mode&61440))throw new L(J.ha);if(f&2)return 0;M.n.write(a,b,0,d,c,!1);return 0}}},P={$:!1,sb:function(){P.$=!!process.platform.match(/^win/)},A:function(a){assert(da);return P.createNode(null,"/",P.Ja(a.pa.root),0)},createNode:function(a,b,c){if(!N(c)&&32768!==(c&61440)&&40960!==(c&61440))throw new L(J.q);
a=Lb(a,b,c);a.k=P.k;a.n=P.n;return a},Ja:function(a){var b;try{b=fs.lstatSync(a),P.$&&(b.mode=b.mode|(b.mode&146)>>1)}catch(c){if(!c.code)throw c;throw new L(J[c.code]);}return b.mode},B:function(a){for(var b=[];a.parent!==a;)b.push(a.name),a=a.parent;b.push(a.A.pa.root);b.reverse();return Cb.apply(null,b)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",
4096:"rs",4098:"rs+"},$a:function(a){a&=-32769;if(a in P.Ha)return P.Ha[a];throw new L(J.q);},k:{D:function(a){a=P.B(a);var b;try{b=fs.lstatSync(a)}catch(c){if(!c.code)throw c;throw new L(J[c.code]);}P.$&&!b.K&&(b.K=4096);P.$&&!b.blocks&&(b.blocks=(b.size+b.K-1)/b.K|0);return{dev:b.dev,ino:b.ino,mode:b.mode,nlink:b.nlink,uid:b.uid,gid:b.gid,rdev:b.rdev,size:b.size,atime:b.atime,mtime:b.mtime,ctime:b.ctime,K:b.K,blocks:b.blocks}},u:function(a,b){var c=P.B(a);try{void 0!==b.mode&&(fs.chmodSync(c,b.mode),
a.mode=b.mode),void 0!==b.size&&fs.truncateSync(c,b.size)}catch(d){if(!d.code)throw d;throw new L(J[d.code]);}},lookup:function(a,b){var c=K(P.B(a),b),c=P.Ja(c);return P.createNode(a,b,c)},T:function(a,b,c,d){a=P.createNode(a,b,c,d);b=P.B(a);try{N(a.mode)?fs.mkdirSync(b,a.mode):fs.writeFileSync(b,"",{mode:a.mode})}catch(f){if(!f.code)throw f;throw new L(J[f.code]);}return a},rename:function(a,b,c){a=P.B(a);b=K(P.B(b),c);try{fs.renameSync(a,b)}catch(d){if(!d.code)throw d;throw new L(J[d.code]);}},
unlink:function(a,b){var c=K(P.B(a),b);try{fs.unlinkSync(c)}catch(d){if(!d.code)throw d;throw new L(J[d.code]);}},rmdir:function(a,b){var c=K(P.B(a),b);try{fs.rmdirSync(c)}catch(d){if(!d.code)throw d;throw new L(J[d.code]);}},readdir:function(a){a=P.B(a);try{return fs.readdirSync(a)}catch(b){if(!b.code)throw b;throw new L(J[b.code]);}},symlink:function(a,b,c){a=K(P.B(a),b);try{fs.symlinkSync(c,a)}catch(d){if(!d.code)throw d;throw new L(J[d.code]);}},readlink:function(a){var b=P.B(a);try{return b=
fs.readlinkSync(b),b=Ob.relative(Ob.resolve(a.A.pa.root),b)}catch(c){if(!c.code)throw c;throw new L(J[c.code]);}}},n:{open:function(a){var b=P.B(a.g);try{32768===(a.g.mode&61440)&&(a.V=fs.openSync(b,P.$a(a.flags)))}catch(c){if(!c.code)throw c;throw new L(J[c.code]);}},close:function(a){try{32768===(a.g.mode&61440)&&a.V&&fs.closeSync(a.V)}catch(b){if(!b.code)throw b;throw new L(J[b.code]);}},read:function(a,b,c,d,f){if(0===d)return 0;var g=new Buffer(d),h;try{h=fs.readSync(a.V,g,0,d,f)}catch(l){throw new L(J[l.code]);
}if(0<h)for(a=0;a<h;a++)b[c+a]=g[a];return h},write:function(a,b,c,d,f){b=new Buffer(b.subarray(c,c+d));var g;try{g=fs.writeSync(a.V,b,0,d,f)}catch(h){throw new L(J[h.code]);}return g},G:function(a,b,c){if(1===c)b+=a.position;else if(2===c&&32768===(a.g.mode&61440))try{b+=fs.fstatSync(a.V).size}catch(d){throw new L(J[d.code]);}if(0>b)throw new L(J.q);return b}}};D(1,"i32*",2);D(1,"i32*",2);D(1,"i32*",2);var Pb=null,Qb=[null],Rb=[],Sb=1,Q=null,Tb=!0,R={},L=null,Mb={};
function S(a,b){a=Db("/",a);b=b||{};if(!a)return{path:"",g:null};var c={Ia:!0,ra:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.ra)throw new L(J.ga);var c=yb(a.split("/").filter(function(a){return!!a}),!1),f=Pb;d="/";for(var g=0;g<c.length;g++){var h=g===c.length-1;if(h&&b.parent)break;f=Nb(f,c[g]);d=K(d,c[g]);f.U&&(!h||h&&b.Ia)&&(f=f.U.root);if(!h||b.la)for(h=0;40960===(f.mode&61440);)if(f=Vb(d),d=Db(Ab(d),f),f=S(d,{ra:b.ra}).g,40<h++)throw new L(J.ga);}return{path:d,g:f}}
function T(a){for(var b;;){if(a===a.parent)return a=a.A.Oa,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function Wb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%Q.length}function Xb(a){var b=Wb(a.parent.id,a.name);a.M=Q[b];Q[b]=a}function Nb(a,b){var c;if(c=(c=Yb(a,"x"))?c:a.k.lookup?0:J.da)throw new L(c,a);for(c=Q[Wb(a.id,b)];c;c=c.M){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.k.lookup(a,b)}
function Lb(a,b,c,d){Zb||(Zb=function(a,b,c,d){a||(a=this);this.parent=a;this.A=a.A;this.U=null;this.id=Sb++;this.name=b;this.mode=c;this.k={};this.n={};this.rdev=d},Zb.prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192===(this.mode&
61440)}}}));a=new Zb(a,b,c,d);Xb(a);return a}function N(a){return 16384===(a&61440)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(a,b){if(Tb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return J.da}else return J.da;return 0}function ac(a,b){try{return Nb(a,b),J.wa}catch(c){}return Yb(a,"wx")}
function bc(){var a;a=4096;for(var b=0;b<=a;b++)if(!Rb[b])return b;throw new L(J.Sa);}function cc(a){dc||(dc=function(){},dc.prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(a){this.g=a}},Ld:{get:function(){return 1!==(this.flags&2097155)}},Md:{get:function(){return 0!==(this.flags&2097155)}},Kd:{get:function(){return this.flags&1024}}}));var b=new dc,c;for(c in a)b[c]=a[c];a=b;b=bc();a.fd=b;return Rb[b]=a}
var Kb={open:function(a){a.n=Qb[a.g.rdev].n;a.n.open&&a.n.open(a)},G:function(){throw new L(J.ia);}};function Gb(a,b){Qb[a]={n:b}}function ec(a,b){var c="/"===b,d=!b,f;if(c&&Pb)throw new L(J.fa);if(!c&&!d){f=S(b,{Ia:!1});b=f.path;f=f.g;if(f.U)throw new L(J.fa);if(!N(f.mode))throw new L(J.ya);}var d={type:a,pa:{},Oa:b,lb:[]},g=a.A(d);g.A=d;d.root=g;c?Pb=g:f&&(f.U=d,f.A&&f.A.lb.push(d))}
function fc(a,b,c){var d=S(a,{parent:!0}).g;a=Bb(a);if(!a||"."===a||".."===a)throw new L(J.q);var f=ac(d,a);if(f)throw new L(f);if(!d.k.T)throw new L(J.I);return d.k.T(d,a,b,c)}function gc(a,b){b=(void 0!==b?b:438)&4095;b|=32768;return fc(a,b,0)}function V(a,b){b=(void 0!==b?b:511)&1023;b|=16384;return fc(a,b,0)}function hc(a,b,c){"undefined"===typeof c&&(c=b,b=438);return fc(a,b|8192,c)}
function ic(a,b){if(!Db(a))throw new L(J.F);var c=S(b,{parent:!0}).g;if(!c)throw new L(J.F);var d=Bb(b),f=ac(c,d);if(f)throw new L(f);if(!c.k.symlink)throw new L(J.I);return c.k.symlink(c,d,a)}function Vb(a){a=S(a).g;if(!a)throw new L(J.F);if(!a.k.readlink)throw new L(J.q);return Db(T(a.parent),a.k.readlink(a))}function jc(a,b){var c;"string"===typeof a?c=S(a,{la:!0}).g:c=a;if(!c.k.u)throw new L(J.I);c.k.u(c,{mode:b&4095|c.mode&-4096,timestamp:Date.now()})}
function kc(a,b){var c;if(""===a)throw new L(J.F);var d;if("string"===typeof b){if(d=$b[b],"undefined"===typeof d)throw Error("Unknown file open mode: "+b);}else d=b;b=d;c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;var f;if("object"===typeof a)f=a;else{a=zb(a);try{f=S(a,{la:!(b&131072)}).g}catch(g){}}d=!1;if(b&64)if(f){if(b&128)throw new L(J.wa);}else f=fc(a,c,0),d=!0;if(!f)throw new L(J.F);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&!N(f.mode))throw new L(J.ya);if(!d&&(f?40960===(f.mode&61440)?
c=J.ga:N(f.mode)&&(0!==(b&2097155)||b&512)?c=J.P:(c=["r","w","rw"][b&3],b&512&&(c+="w"),c=Yb(f,c)):c=J.F,c))throw new L(c);if(b&512){c=f;var h;"string"===typeof c?h=S(c,{la:!0}).g:h=c;if(!h.k.u)throw new L(J.I);if(N(h.mode))throw new L(J.P);if(32768!==(h.mode&61440))throw new L(J.q);if(c=Yb(h,"w"))throw new L(c);h.k.u(h,{size:0,timestamp:Date.now()})}b&=-641;f=cc({g:f,path:T(f),flags:b,seekable:!0,position:0,n:f.n,tb:[],error:!1});f.n.open&&f.n.open(f);!e.logReadFiles||b&1||(lc||(lc={}),a in lc||
(lc[a]=1,e.printErr("read file: "+a)));try{R.onOpenFile&&(h=0,1!==(b&2097155)&&(h|=1),0!==(b&2097155)&&(h|=2),R.onOpenFile(a,h))}catch(l){console.log("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return f}function mc(a){a.na&&(a.na=null);try{a.n.close&&a.n.close(a)}catch(b){throw b;}finally{Rb[a.fd]=null}}function nc(a,b,c){if(!a.seekable||!a.n.G)throw new L(J.ia);a.position=a.n.G(a,b,c);a.tb=[]}
function oc(a,b,c,d,f,g){if(0>d||0>f)throw new L(J.q);if(0===(a.flags&2097155))throw new L(J.ea);if(N(a.g.mode))throw new L(J.P);if(!a.n.write)throw new L(J.q);a.flags&1024&&nc(a,0,2);var h=!0;if("undefined"===typeof f)f=a.position,h=!1;else if(!a.seekable)throw new L(J.ia);b=a.n.write(a,b,c,d,f,g);h||(a.position+=b);try{if(a.path&&R.onWriteToFile)R.onWriteToFile(a.path)}catch(l){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+l.message)}return b}
function pc(){L||(L=function(a,b){this.g=b;this.qb=function(a){this.S=a;for(var b in J)if(J[b]===a){this.code=b;break}};this.qb(a);this.message=xb[a]},L.prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(a){Mb[a]=new L(a);Mb[a].stack="<generic error, no stack>"}))}var qc;function rc(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}function sc(a,b,c,d){a=K("string"===typeof a?a:T(a),b);return gc(a,rc(c,d))}
function tc(a,b,c,d,f,g){a=b?K("string"===typeof a?a:T(a),b):a;d=rc(d,f);f=gc(a,d);if(c){if("string"===typeof c){a=Array(c.length);b=0;for(var h=c.length;b<h;++b)a[b]=c.charCodeAt(b);c=a}jc(f,d|146);a=kc(f,"w");oc(a,c,0,c.length,0,g);mc(a);jc(f,d)}return f}
function W(a,b,c,d){a=K("string"===typeof a?a:T(a),b);b=rc(!!c,!!d);W.Ma||(W.Ma=64);var f=W.Ma++<<8|0;Gb(f,{open:function(a){a.seekable=!1},close:function(){d&&d.buffer&&d.buffer.length&&d(10)},read:function(a,b,d,f){for(var u=0,q=0;q<f;q++){var v;try{v=c()}catch(B){throw new L(J.H);}if(void 0===v&&0===u)throw new L(J.va);if(null===v||void 0===v)break;u++;b[d+q]=v}u&&(a.g.timestamp=Date.now());return u},write:function(a,b,c,f){for(var u=0;u<f;u++)try{d(b[c+u])}catch(q){throw new L(J.H);}f&&(a.g.timestamp=
Date.now());return u}});return hc(a,b,f)}
function uc(a){if(a.jb||a.kb||a.link||a.e)return!0;var b=!0;if("undefined"!==typeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(e.read)try{a.e=hb(e.read(a.url),!0),a.o=a.e.length}catch(c){b=!1}else throw Error("Cannot load without read() or XMLHttpRequest.");b||ob(J.H);return b}var vc={},Zb,dc,lc,wc=0;
function X(){wc+=4;return C[wc-4>>2]}function xc(){var a;a=X();a=Rb[a];if(!a)throw new L(J.ea);return a}var yc={};e._i64Add=zc;function Ga(a){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var b=r;return 0==a||Ga.bb(a)?b:4294967295}var Ac=1;e._memcpy=Bc;
function Cc(a,b){Dc=a;Ec=b;if(!Fc)return 1;if(0==a)Y=function(){setTimeout(Gc,b)},Hc="timeout";else if(1==a)Y=function(){Ic(Gc)},Hc="rAF";else if(2==a){if(!window.setImmediate){var c=[];window.addEventListener("message",function(a){a.source===window&&"__emcc"===a.data&&(a.stopPropagation(),c.shift()())},!0);window.setImmediate=function(a){c.push(a);window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)};Hc="immediate"}return 0}
function Jc(a,b,c,d,f){e.noExitRuntime=!0;assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Fc=a;Kc=d;var g=Lc;Gc=function(){if(!na)if(0<Mc.length){var b=Date.now(),c=Mc.shift();c.ab(c.X);if(Nc){var f=Nc,u=0==f%1?f-1:Math.floor(f);Nc=c.Bd?u:(8*f+(u+.5))/9}console.log('main loop blocker "'+c.name+'" took '+(Date.now()-b)+" ms");Oc();setTimeout(Gc,0)}else g<
Lc||(Pc=Pc+1|0,1==Dc&&1<Ec&&0!=Pc%Ec?Y():("timeout"===Hc&&e.ka&&(e.W("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Hc=""),Qc(function(){"undefined"!==typeof d?n.L("vi",a,[d]):n.L("v",a)}),g<Lc||("object"===typeof SDL&&SDL.audio&&SDL.audio.mb&&SDL.audio.mb(),Y())))};f||(b&&0<b?Cc(0,1E3/b):Cc(1,1),Y());if(c)throw"SimulateInfiniteLoop";
}var Y=null,Hc="",Lc=0,Fc=null,Kc=0,Dc=0,Ec=0,Pc=0,Mc=[];function Oc(){if(e.setStatus){var a=e.statusMessage||"Please wait...",b=Nc,c=Rc.Dd;b?b<c?e.setStatus(a+" ("+(c-b)+"/"+c+")"):e.setStatus(a):e.setStatus("")}}function Qc(a){if(!(na||e.preMainLoop&&!1===e.preMainLoop())){try{a()}catch(b){if(b instanceof ia)return;b&&"object"===typeof b&&b.stack&&e.W("exception thrown: "+[b,b.stack]);throw b;}e.postMainLoop&&e.postMainLoop()}}var Rc={},Gc,Nc,Sc=!1,Tc=!1,Uc=[];
function Vc(){function a(){Tc=document.pointerLockElement===c||document.mozPointerLockElement===c||document.webkitPointerLockElement===c||document.msPointerLockElement===c}e.preloadPlugins||(e.preloadPlugins=[]);if(!Wc){Wc=!0;try{Xc=!0}catch(b){Xc=!1,console.log("warning: no blob constructor, cannot create blobs with mimetypes")}Yc="undefined"!=typeof MozBlobBuilder?MozBlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:Xc?null:console.log("warning: no BlobBuilder");Zc="undefined"!=
typeof window?window.URL?window.URL:window.webkitURL:void 0;e.Qa||"undefined"!==typeof Zc||(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),e.Qa=!0);e.preloadPlugins.push({canHandle:function(a){return!e.Qa&&/\.(jpg|jpeg|png|bmp)$/i.test(a)},handle:function(a,b,c,h){var l=null;if(Xc)try{l=new Blob([a],{type:$c(b)}),l.size!==a.length&&(l=new Blob([(new Uint8Array(a)).buffer],{type:$c(b)}))}catch(w){n.O("Blob constructor present but fails: "+
w+"; falling back to blob builder")}l||(l=new Yc,l.append((new Uint8Array(a)).buffer),l=l.getBlob());var u=Zc.createObjectURL(l),q=new Image;q.onload=function(){assert(q.complete,"Image "+b+" could not be decoded");var h=document.createElement("canvas");h.width=q.width;h.height=q.height;h.getContext("2d").drawImage(q,0,0);e.preloadedImages[b]=h;Zc.revokeObjectURL(u);c&&c(a)};q.onerror=function(){console.log("Image "+u+" could not be decoded");h&&h()};q.src=u}});e.preloadPlugins.push({canHandle:function(a){return!e.Pd&&
a.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},handle:function(a,b,c,h){function l(h){u||(u=!0,e.preloadedAudios[b]=h,c&&c(a))}function w(){u||(u=!0,e.preloadedAudios[b]=new Audio,h&&h())}var u=!1;if(Xc){try{var q=new Blob([a],{type:$c(b)})}catch(v){return w()}var q=Zc.createObjectURL(q),B=new Audio;B.addEventListener("canplaythrough",function(){l(B)},!1);B.onerror=function(){if(!u){console.log("warning: browser could not fully decode audio "+b+", trying slower base64 approach");for(var c="",g=0,h=0,
q=0;q<a.length;q++)for(g=g<<8|a[q],h+=8;6<=h;)var v=g>>h-6&63,h=h-6,c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[v];2==h?(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(g&3)<<4],c+="=="):4==h&&(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(g&15)<<2],c+="=");B.src="data:audio/x-"+b.substr(-3)+";base64,"+c;l(B)}};B.src=q;ad(function(){l(B)})}else return w()}});var c=e.canvas;c&&(c.sa=c.requestPointerLock||c.mozRequestPointerLock||
c.webkitRequestPointerLock||c.msRequestPointerLock||function(){},c.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},c.Fa=c.Fa.bind(document),document.addEventListener("pointerlockchange",a,!1),document.addEventListener("mozpointerlockchange",a,!1),document.addEventListener("webkitpointerlockchange",a,!1),document.addEventListener("mspointerlockchange",a,!1),e.elementPointerLock&&c.addEventListener("click",function(a){!Tc&&
c.sa&&(c.sa(),a.preventDefault())},!1))}}function bd(a,b,c,d){if(b&&e.ka&&a==e.canvas)return e.ka;var f,g;if(b){g={antialias:!1,alpha:!1};if(d)for(var h in d)g[h]=d[h];if(g=GL.createContext(a,g))f=GL.getContext(g).td;a.style.backgroundColor="black"}else f=a.getContext("2d");if(!f)return null;c&&(b||assert("undefined"===typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=f,b&&GL.Od(g),e.Td=b,Uc.forEach(function(a){a()}),Vc());return f}
var cd=!1,dd=void 0,ed=void 0;
function fd(a,b,c){function d(){Sc=!1;var a=f.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===a?(f.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},
f.Da=f.Da.bind(document),dd&&f.sa(),Sc=!0,ed&&gd()):(a.parentNode.insertBefore(f,a),a.parentNode.removeChild(a),ed&&hd());if(e.onFullScreen)e.onFullScreen(Sc);id(f)}dd=a;ed=b;jd=c;"undefined"===typeof dd&&(dd=!0);"undefined"===typeof ed&&(ed=!1);"undefined"===typeof jd&&(jd=null);var f=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",d,!1),document.addEventListener("mozfullscreenchange",d,!1),document.addEventListener("webkitfullscreenchange",d,!1),document.addEventListener("MSFullscreenChange",
d,!1));var g=document.createElement("div");f.parentNode.insertBefore(g,f);g.appendChild(f);g.p=g.requestFullScreen||g.mozRequestFullScreen||g.msRequestFullscreen||(g.webkitRequestFullScreen?function(){g.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null);c?g.p({Ud:c}):g.p()}var kd=0;function ld(a){var b=Date.now();if(0===kd)kd=b+1E3/60;else for(;b+2>=kd;)kd+=1E3/60;b=Math.max(kd-b,0);setTimeout(a,b)}
function Ic(a){"undefined"===typeof window?ld(a):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(a))}function ad(a){e.noExitRuntime=!0;setTimeout(function(){na||a()},1E4)}
function $c(a){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[a.substr(a.lastIndexOf(".")+1)]}function md(a,b,c){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)}
function nd(a,b,c){md(a,function(c){assert(c,'Loading data file "'+a+'" failed (no arrayBuffer).');b(new Uint8Array(c));lb()},function(){if(c)c();else throw'Loading data file "'+a+'" failed.';});kb()}var od=[];function pd(){var a=e.canvas;od.forEach(function(b){b(a.width,a.height)})}function gd(){if("undefined"!=typeof SDL){var a=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=a|8388608}pd()}
function hd(){if("undefined"!=typeof SDL){var a=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=a&-8388609}pd()}
function id(a,b,c){b&&c?(a.ub=b,a.hb=c):(b=a.ub,c=a.hb);var d=b,f=c;e.forcedAspectRatio&&0<e.forcedAspectRatio&&(d/f<e.forcedAspectRatio?d=Math.round(f*e.forcedAspectRatio):f=Math.round(d/e.forcedAspectRatio));if((document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===
a.parentNode&&"undefined"!=typeof screen)var g=Math.min(screen.width/d,screen.height/f),d=Math.round(d*g),f=Math.round(f*g);ed?(a.width!=d&&(a.width=d),a.height!=f&&(a.height=f),"undefined"!=typeof a.style&&(a.style.removeProperty("width"),a.style.removeProperty("height"))):(a.width!=b&&(a.width=b),a.height!=c&&(a.height=c),"undefined"!=typeof a.style&&(d!=b||f!=c?(a.style.setProperty("width",d+"px","important"),a.style.setProperty("height",f+"px","important")):(a.style.removeProperty("width"),a.style.removeProperty("height"))))}
var Wc,Xc,Yc,Zc,jd;pc();Q=Array(4096);ec(M,"/");V("/tmp");V("/home");V("/home/web_user");
(function(){V("/dev");Gb(259,{read:function(){return 0},write:function(a,b,f,g){return g}});hc("/dev/null",259);Fb(1280,Ib);Fb(1536,Jb);hc("/dev/tty",1280);hc("/dev/tty1",1536);var a;if("undefined"!==typeof crypto){var b=new Uint8Array(1);a=function(){crypto.getRandomValues(b);return b[0]}}else a=da?function(){return require("crypto").randomBytes(1)[0]}:function(){return 256*Math.random()|0};W("/dev","random",a);W("/dev","urandom",a);V("/dev/shm");V("/dev/shm/tmp")})();V("/proc");V("/proc/self");
V("/proc/self/fd");ec({A:function(){var a=Lb("/proc/self","fd",16895,73);a.k={lookup:function(a,c){var d=Rb[+c];if(!d)throw new L(J.ea);var f={parent:null,A:{Oa:"fake"},k:{readlink:function(){return d.path}}};return f.parent=f}};return a}},"/proc/self/fd");
cb.unshift(function(){if(!e.noFSInit&&!qc){assert(!qc,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");qc=!0;pc();e.stdin=e.stdin;e.stdout=e.stdout;e.stderr=e.stderr;e.stdin?W("/dev","stdin",e.stdin):ic("/dev/tty","/dev/stdin");e.stdout?W("/dev","stdout",null,e.stdout):ic("/dev/tty","/dev/stdout");e.stderr?W("/dev","stderr",null,e.stderr):ic("/dev/tty1","/dev/stderr");var a=
kc("/dev/stdin","r");assert(0===a.fd,"invalid handle for stdin ("+a.fd+")");a=kc("/dev/stdout","w");assert(1===a.fd,"invalid handle for stdout ("+a.fd+")");a=kc("/dev/stderr","w");assert(2===a.fd,"invalid handle for stderr ("+a.fd+")")}});db.push(function(){Tb=!1});H.push(function(){qc=!1;var a=e._fflush;a&&a(0);for(a=0;a<Rb.length;a++){var b=Rb[a];b&&mc(b)}});e.FS_createFolder=function(a,b,c,d){a=K("string"===typeof a?a:T(a),b);return V(a,rc(c,d))};
e.FS_createPath=function(a,b){a="string"===typeof a?a:T(a);for(var c=b.split("/").reverse();c.length;){var d=c.pop();if(d){var f=K(a,d);try{V(f)}catch(g){}a=f}}return f};e.FS_createDataFile=tc;
e.FS_createPreloadedFile=function(a,b,c,d,f,g,h,l,w,u){function q(c){function q(c){u&&u();l||tc(a,b,c,d,f,w);g&&g();lb()}var O=!1;e.preloadPlugins.forEach(function(a){!O&&a.canHandle(v)&&(a.handle(c,v,q,function(){h&&h();lb()}),O=!0)});O||q(c)}Vc();var v=b?Db(K(a,b)):a;kb();"string"==typeof c?nd(c,function(a){q(a)},h):q(c)};
e.FS_createLazyFile=function(a,b,c,d,f){var g,h;function l(){this.oa=!1;this.Y=[]}l.prototype.get=function(a){if(!(a>this.length-1||0>a)){var b=a%this.chunkSize;return this.gb(a/this.chunkSize|0)[b]}};l.prototype.pb=function(a){this.gb=a};l.prototype.Ca=function(){var a=new XMLHttpRequest;a.open("HEAD",c,!1);a.send(null);if(!(200<=a.status&&300>a.status||304===a.status))throw Error("Couldn't load "+c+". Status: "+a.status);var b=Number(a.getResponseHeader("Content-length")),d,f=1048576;(d=a.getResponseHeader("Accept-Ranges"))&&
"bytes"===d||(f=b);var g=this;g.pb(function(a){var d=a*f,h=(a+1)*f-1,h=Math.min(h,b-1);if("undefined"===typeof g.Y[a]){var l=g.Y;if(d>h)throw Error("invalid range ("+d+", "+h+") or no bytes requested!");if(h>b-1)throw Error("only "+b+" bytes available! programmer error!");var q=new XMLHttpRequest;q.open("GET",c,!1);b!==f&&q.setRequestHeader("Range","bytes="+d+"-"+h);"undefined"!=typeof Uint8Array&&(q.responseType="arraybuffer");q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined");
q.send(null);if(!(200<=q.status&&300>q.status||304===q.status))throw Error("Couldn't load "+c+". Status: "+q.status);d=void 0!==q.response?new Uint8Array(q.response||[]):hb(q.responseText||"",!0);l[a]=d}if("undefined"===typeof g.Y[a])throw Error("doXHR failed!");return g.Y[a]});this.Wa=b;this.Va=f;this.oa=!0};if("undefined"!==typeof XMLHttpRequest){if(!ca)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";g=new l;Object.defineProperty(g,
"length",{get:function(){this.oa||this.Ca();return this.Wa}});Object.defineProperty(g,"chunkSize",{get:function(){this.oa||this.Ca();return this.Va}});h=void 0}else h=c,g=void 0;var w=sc(a,b,d,f);g?w.e=g:h&&(w.e=null,w.url=h);Object.defineProperty(w,"usedBytes",{get:function(){return this.e.length}});var u={};Object.keys(w.n).forEach(function(a){var b=w.n[a];u[a]=function(){if(!uc(w))throw new L(J.H);return b.apply(null,arguments)}});u.read=function(a,b,c,d,f){if(!uc(w))throw new L(J.H);a=a.g.e;if(f>=
a.length)return 0;d=Math.min(a.length-f,d);assert(0<=d);if(a.slice)for(var g=0;g<d;g++)b[c+g]=a[f+g];else for(g=0;g<d;g++)b[c+g]=a.get(f+g);return d};w.n=u;return w};e.FS_createLink=function(a,b,c){a=K("string"===typeof a?a:T(a),b);return ic(c,a)};e.FS_createDevice=W;
e.FS_unlink=function(a){var b=S(a,{parent:!0}).g,c=Bb(a),d=Nb(b,c),f;a:{try{f=Nb(b,c)}catch(g){f=g.S;break a}var h=Yb(b,"wx");f=h?h:N(f.mode)?J.P:0}if(f)throw f===J.P&&(f=J.I),new L(f);if(!b.k.unlink)throw new L(J.I);if(d.U)throw new L(J.fa);try{R.willDeletePath&&R.willDeletePath(a)}catch(l){console.log("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+l.message)}b.k.unlink(b,c);b=Wb(d.parent.id,d.name);if(Q[b]===d)Q[b]=d.M;else for(b=Q[b];b;){if(b.M===d){b.M=d.M;break}b=b.M}try{if(R.onDeletePath)R.onDeletePath(a)}catch(w){console.log("FS.trackingDelegate['onDeletePath']('"+
a+"') threw an exception: "+w.message)}};cb.unshift(function(){});H.push(function(){});if(da){var fs=require("fs"),Ob=require("path");P.sb()}e.requestFullScreen=function(a,b,c){fd(a,b,c)};e.requestAnimationFrame=function(a){Ic(a)};e.setCanvasSize=function(a,b,c){id(e.canvas,a,b);c||pd()};e.pauseMainLoop=function(){Y=null;Lc++};e.resumeMainLoop=function(){Lc++;var a=Dc,b=Ec,c=Fc;Fc=null;Jc(c,0,!1,Kc,!0);Cc(a,b);Y()};
e.getUserMedia=function(){window.p||(window.p=navigator.getUserMedia||navigator.mozGetUserMedia);window.p(void 0)};e.createContext=function(a,b,c,d){return bd(a,b,c,d)};Ua=m=n.ja(la);Fa=!0;Va=Ua+$a;Wa=r=n.ja(Va);assert(Wa<t,"TOTAL_MEMORY not big enough for stack");
var qd=D([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,
1,0,3,0,1,0,2,0,1,0],"i8",3);e.Ya={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:Infinity,byteLength:Ya};
e.Za={abort:x,assert:assert,invoke_iiii:function(a,b,c,d){try{return e.dynCall_iiii(a,b,c,d)}catch(f){if("number"!==typeof f&&"longjmp"!==f)throw f;Z.setThrew(1,0)}},invoke_viiiii:function(a,b,c,d,f,g){try{e.dynCall_viiiii(a,b,c,d,f,g)}catch(h){if("number"!==typeof h&&"longjmp"!==h)throw h;Z.setThrew(1,0)}},invoke_vi:function(a,b){try{e.dynCall_vi(a,b)}catch(c){if("number"!==typeof c&&"longjmp"!==c)throw c;Z.setThrew(1,0)}},invoke_ii:function(a,b){try{return e.dynCall_ii(a,b)}catch(c){if("number"!==
typeof c&&"longjmp"!==c)throw c;Z.setThrew(1,0)}},invoke_viii:function(a,b,c,d){try{e.dynCall_viii(a,b,c,d)}catch(f){if("number"!==typeof f&&"longjmp"!==f)throw f;Z.setThrew(1,0)}},invoke_v:function(a){try{e.dynCall_v(a)}catch(b){if("number"!==typeof b&&"longjmp"!==b)throw b;Z.setThrew(1,0)}},invoke_viiiiii:function(a,b,c,d,f,g,h){try{e.dynCall_viiiiii(a,b,c,d,f,g,h)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;Z.setThrew(1,0)}},invoke_iiiiii:function(a,b,c,d,f,g){try{return e.dynCall_iiiiii(a,
b,c,d,f,g)}catch(h){if("number"!==typeof h&&"longjmp"!==h)throw h;Z.setThrew(1,0)}},invoke_viiii:function(a,b,c,d,f){try{e.dynCall_viiii(a,b,c,d,f)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;Z.setThrew(1,0)}},_pthread_cleanup_pop:function(){assert(pb.level==H.length,"cannot pop if something else added meanwhile!");H.pop();pb.level=H.length},___syscall54:function(a,b){wc=b;try{var c=xc(),d=X();switch(d){case 21505:return c.tty?0:-J.Q;case 21506:return c.tty?0:-J.Q;case 21519:if(!c.tty)return-J.Q;
var f=X();return C[f>>2]=0;case 21520:return c.tty?-J.q:-J.Q;case 21531:f=X();if(!c.n.ib)throw new L(J.Q);return c.n.ib(c,d,f);default:x("bad ioctl syscall "+d)}}catch(g){return"undefined"!==typeof vc&&g instanceof L||x(g),-g.S}},___syscall6:function(a,b){wc=b;try{var c=xc();mc(c);return 0}catch(d){return"undefined"!==typeof vc&&d instanceof L||x(d),-d.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(a){tb.p--;ub.push(a);var b;
a:{if(a&&!vb[a])for(b in vb)if(vb[b].wd===a)break a;b=a}b&&vb[b].Sd++;return a},_emscripten_memcpy_big:function(a,b,c){E.set(E.subarray(b,b+c),a);return a},_sysconf:function(a){switch(a){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;
case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;
case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===typeof navigator?navigator.hardwareConcurrency||1:1}ob(J.q);return-1},
_pthread_getspecific:function(a){return yc[a]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(a){if(0==a)return J.q;C[a>>2]=Ac;yc[Ac]=0;Ac++;return 0},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(a,b){if(!(a in yc))return J.q;yc[a]=b;return 0},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(a){var b=Date.now()/1E3|0;a&&(C[a>>2]=b);return b},___syscall140:function(a,b){wc=b;try{var c=
xc(),d=X(),f=X(),g=X(),h=X();assert(0===d);nc(c,f,h);C[g>>2]=c.position;c.na&&0===f&&0===h&&(c.na=null);return 0}catch(l){return"undefined"!==typeof vc&&l instanceof L||x(l),-l.S}},___syscall146:function(a,b){wc=b;try{var c=xc(),d=X(),f;a:{for(var g=X(),h=0,l=0;l<g;l++){var w=oc(c,y,C[d+8*l>>2],C[d+(8*l+4)>>2],void 0);if(0>w){f=-1;break a}h+=w}f=h}return f}catch(u){return"undefined"!==typeof vc&&u instanceof L||x(u),-u.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};// EMSCRIPTEN_START_ASM

var Z=(function(global,env,buffer) {
"use asm";var a=global.Int8Array;var b=global.Int16Array;var c=global.Int32Array;var d=global.Uint8Array;var e=global.Uint16Array;var f=global.Uint32Array;var g=global.Float32Array;var h=global.Float64Array;var i=new a(buffer);var j=new b(buffer);var k=new c(buffer);var l=new d(buffer);var m=new e(buffer);var n=new f(buffer);var o=new g(buffer);var p=new h(buffer);var q=global.byteLength;var r=env.STACKTOP|0;var s=env.STACK_MAX|0;var t=env.tempDoublePtr|0;var u=env.ABORT|0;var v=env.cttz_i8|0;var w=0;var x=0;var y=0;var z=0;var A=global.NaN,B=global.Infinity;var C=0,D=0,E=0,F=0,G=0.0,H=0,I=0,J=0,K=0.0;var L=0;var M=0;var N=0;var O=0;var P=0;var Q=0;var R=0;var S=0;var T=0;var U=0;var V=global.Math.floor;var W=global.Math.abs;var X=global.Math.sqrt;var Y=global.Math.pow;var Z=global.Math.cos;var _=global.Math.sin;var $=global.Math.tan;var aa=global.Math.acos;var ba=global.Math.asin;var ca=global.Math.atan;var da=global.Math.atan2;var ea=global.Math.exp;var fa=global.Math.log;var ga=global.Math.ceil;var ha=global.Math.imul;var ia=global.Math.min;var ja=global.Math.clz32;var ka=env.abort;var la=env.assert;var ma=env.invoke_iiii;var na=env.invoke_viiiii;var oa=env.invoke_vi;var pa=env.invoke_ii;var qa=env.invoke_viii;var ra=env.invoke_v;var sa=env.invoke_viiiiii;var ta=env.invoke_iiiiii;var ua=env.invoke_viiii;var va=env._pthread_cleanup_pop;var wa=env.___syscall54;var xa=env.___syscall6;var ya=env._emscripten_set_main_loop_timing;var za=env.__ZSt18uncaught_exceptionv;var Aa=env.___setErrNo;var Ba=env._sbrk;var Ca=env.___cxa_begin_catch;var Da=env._emscripten_memcpy_big;var Ea=env._sysconf;var Fa=env._pthread_getspecific;var Ga=env._pthread_self;var Ha=env._pthread_once;var Ia=env._pthread_key_create;var Ja=env.___unlock;var Ka=env._emscripten_set_main_loop;var La=env._pthread_setspecific;var Ma=env.___lock;var Na=env._abort;var Oa=env._pthread_cleanup_push;var Pa=env._time;var Qa=env.___syscall140;var Ra=env.___syscall146;var Sa=0.0;function Ta(newBuffer){if(q(newBuffer)&16777215||q(newBuffer)<=16777215||q(newBuffer)>2147483648)return false;i=new a(newBuffer);j=new b(newBuffer);k=new c(newBuffer);l=new d(newBuffer);m=new e(newBuffer);n=new f(newBuffer);o=new g(newBuffer);p=new h(newBuffer);buffer=newBuffer;return true}
// EMSCRIPTEN_START_FUNCS
function bb(a){a=a|0;var b=0;b=r;r=r+a|0;r=r+15&-16;return b|0}function cb(){return r|0}function db(a){a=a|0;r=a}function eb(a,b){a=a|0;b=b|0;r=a;s=b}function fb(a,b){a=a|0;b=b|0;if(!w){w=a;x=b}}function gb(a){a=a|0;i[t>>0]=i[a>>0];i[t+1>>0]=i[a+1>>0];i[t+2>>0]=i[a+2>>0];i[t+3>>0]=i[a+3>>0]}function hb(a){a=a|0;i[t>>0]=i[a>>0];i[t+1>>0]=i[a+1>>0];i[t+2>>0]=i[a+2>>0];i[t+3>>0]=i[a+3>>0];i[t+4>>0]=i[a+4>>0];i[t+5>>0]=i[a+5>>0];i[t+6>>0]=i[a+6>>0];i[t+7>>0]=i[a+7>>0]}function ib(a){a=a|0;L=a}function jb(){return L|0}function kb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0;q=r;r=r+608|0;n=q+88|0;m=q+72|0;i=q+64|0;h=q+48|0;g=q+24|0;f=q;l=q+96|0;o=q+92|0;j=a+4|0;p=a+8|0;if((k[j>>2]|0)>>>0>(k[p>>2]|0)>>>0){k[f>>2]=1154;k[f+4>>2]=2120;k[f+8>>2]=1133;Ac(l,1100,f)|0;zc(l,q+16|0)|0}if((2147418112/(d>>>0)|0)>>>0<=b>>>0){k[g>>2]=1154;k[g+4>>2]=2121;k[g+8>>2]=1169;Ac(l,1100,g)|0;zc(l,q+40|0)|0}g=k[p>>2]|0;if(g>>>0>=b>>>0){p=1;r=q;return p|0}do if(c){if(b){f=b+-1|0;if(!(f&b)){f=11;break}else b=f}else b=-1;b=b>>>16|b;b=b>>>8|b;b=b>>>4|b;b=b>>>2|b;b=(b>>>1|b)+1|0;f=10}else f=10;while(0);if((f|0)==10)if(!b){b=0;f=12}else f=11;if((f|0)==11)if(b>>>0<=g>>>0)f=12;if((f|0)==12){k[h>>2]=1154;k[h+4>>2]=2130;k[h+8>>2]=1217;Ac(l,1100,h)|0;zc(l,i)|0}c=ha(b,d)|0;do if(!e){f=lb(k[a>>2]|0,c,o,1)|0;if(!f){p=0;r=q;return p|0}else{k[a>>2]=f;break}}else{g=mb(c,o)|0;if(!g){p=0;r=q;return p|0}Ya[e&0](g,k[a>>2]|0,k[j>>2]|0);f=k[a>>2]|0;do if(f)if(!(f&7)){$a[k[104>>2]&1](f,0,0,1,k[27]|0)|0;break}else{k[m>>2]=1154;k[m+4>>2]=2499;k[m+8>>2]=1516;Ac(l,1100,m)|0;zc(l,n)|0;break}while(0);k[a>>2]=g}while(0);f=k[o>>2]|0;if(f>>>0>c>>>0)b=(f>>>0)/(d>>>0)|0;k[p>>2]=b;p=1;r=q;return p|0}function lb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=r;r=r+592|0;i=j+48|0;f=j+24|0;e=j;h=j+72|0;g=j+68|0;if(a&7){k[e>>2]=1154;k[e+4>>2]=2499;k[e+8>>2]=1494;Ac(h,1100,e)|0;zc(h,j+16|0)|0;i=0;r=j;return i|0}if(b>>>0>2147418112){k[f>>2]=1154;k[f+4>>2]=2499;k[f+8>>2]=1387;Ac(h,1100,f)|0;zc(h,j+40|0)|0;i=0;r=j;return i|0}k[g>>2]=b;d=$a[k[104>>2]&1](a,b,g,d,k[27]|0)|0;if(c)k[c>>2]=k[g>>2];if(!(d&7)){i=d;r=j;return i|0}k[i>>2]=1154;k[i+4>>2]=2551;k[i+8>>2]=1440;Ac(h,1100,i)|0;zc(h,j+64|0)|0;i=d;r=j;return i|0}function mb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0;i=r;r=r+592|0;g=i+48|0;h=i+24|0;c=i;f=i+72|0;e=i+68|0;d=a+3&-4;d=(d|0)!=0?d:4;if(d>>>0>2147418112){k[c>>2]=1154;k[c+4>>2]=2499;k[c+8>>2]=1387;Ac(f,1100,c)|0;zc(f,i+16|0)|0;h=0;r=i;return h|0}k[e>>2]=d;c=$a[k[104>>2]&1](0,d,e,1,k[27]|0)|0;a=k[e>>2]|0;if(b)k[b>>2]=a;if((c|0)==0|a>>>0<d>>>0){k[h>>2]=1154;k[h+4>>2]=2499;k[h+8>>2]=1413;Ac(f,1100,h)|0;zc(f,i+40|0)|0;h=0;r=i;return h|0}if(!(c&7)){h=c;r=i;return h|0}k[g>>2]=1154;k[g+4>>2]=2526;k[g+8>>2]=1440;Ac(f,1100,g)|0;zc(f,i+64|0)|0;h=c;r=i;return h|0}function nb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;S=r;r=r+960|0;P=S+232|0;O=S+216|0;N=S+208|0;M=S+192|0;L=S+184|0;K=S+168|0;J=S+160|0;I=S+144|0;F=S+136|0;E=S+120|0;D=S+112|0;C=S+96|0;z=S+88|0;y=S+72|0;x=S+64|0;w=S+48|0;q=S+40|0;t=S+24|0;s=S+16|0;p=S;H=S+440|0;Q=S+376|0;R=S+304|0;v=S+236|0;if((b|0)==0|d>>>0>11){a=0;r=S;return a|0}k[a>>2]=b;e=R;f=e+68|0;do{k[e>>2]=0;e=e+4|0}while((e|0)<(f|0));f=0;do{e=i[c+f>>0]|0;if(e<<24>>24){G=R+((e&255)<<2)|0;k[G>>2]=(k[G>>2]|0)+1}f=f+1|0}while((f|0)!=(b|0));f=0;o=1;g=0;h=-1;n=0;while(1){e=k[R+(o<<2)>>2]|0;if(!e)k[a+28+(o+-1<<2)>>2]=0;else{G=o+-1|0;k[Q+(G<<2)>>2]=f;f=e+f|0;B=16-o|0;k[a+28+(G<<2)>>2]=(f+-1<<B|(1<<B)+-1)+1;k[a+96+(G<<2)>>2]=n;k[v+(o<<2)>>2]=n;g=g>>>0>o>>>0?g:o;h=h>>>0<o>>>0?h:o;n=e+n|0}o=o+1|0;if((o|0)==17){G=g;break}else f=f<<1}k[a+4>>2]=n;f=a+172|0;do if(n>>>0>(k[f>>2]|0)>>>0){k[f>>2]=n;if(n){e=n+-1|0;if(e&n)u=14}else{e=-1;u=14}if((u|0)==14){B=e>>>16|e;B=B>>>8|B;B=B>>>4|B;B=B>>>2|B;B=(B>>>1|B)+1|0;k[f>>2]=B>>>0>b>>>0?b:B}g=a+176|0;e=k[g>>2]|0;do if(e){B=k[e+-4>>2]|0;e=e+-8|0;if(!((B|0)!=0?(B|0)==(~k[e>>2]|0):0)){k[p>>2]=1154;k[p+4>>2]=644;k[p+8>>2]=1863;Ac(H,1100,p)|0;zc(H,s)|0}if(!(e&7)){$a[k[104>>2]&1](e,0,0,1,k[27]|0)|0;break}else{k[t>>2]=1154;k[t+4>>2]=2499;k[t+8>>2]=1516;Ac(H,1100,t)|0;zc(H,q)|0;break}}while(0);f=k[f>>2]|0;f=(f|0)!=0?f:1;e=mb((f<<1)+8|0,0)|0;if(!e){k[g>>2]=0;e=0;break}else{k[e+4>>2]=f;k[e>>2]=~f;k[g>>2]=e+8;u=25;break}}else u=25;while(0);a:do if((u|0)==25){B=a+24|0;i[B>>0]=h;i[a+25>>0]=G;f=a+176|0;g=0;do{A=i[c+g>>0]|0;e=A&255;if(A<<24>>24){if(!(k[R+(e<<2)>>2]|0)){k[w>>2]=1154;k[w+4>>2]=2273;k[w+8>>2]=1261;Ac(H,1100,w)|0;zc(H,x)|0}A=v+(e<<2)|0;e=k[A>>2]|0;k[A>>2]=e+1;if(e>>>0>=n>>>0){k[y>>2]=1154;k[y+4>>2]=2277;k[y+8>>2]=1274;Ac(H,1100,y)|0;zc(H,z)|0}j[(k[f>>2]|0)+(e<<1)>>1]=g}g=g+1|0}while((g|0)!=(b|0));e=i[B>>0]|0;z=(e&255)>>>0<d>>>0?d:0;A=a+8|0;k[A>>2]=z;y=(z|0)!=0;if(y){x=1<<z;e=a+164|0;do if(x>>>0>(k[e>>2]|0)>>>0){k[e>>2]=x;g=a+168|0;e=k[g>>2]|0;do if(e){w=k[e+-4>>2]|0;e=e+-8|0;if(!((w|0)!=0?(w|0)==(~k[e>>2]|0):0)){k[C>>2]=1154;k[C+4>>2]=644;k[C+8>>2]=1863;Ac(H,1100,C)|0;zc(H,D)|0}if(!(e&7)){$a[k[104>>2]&1](e,0,0,1,k[27]|0)|0;break}else{k[E>>2]=1154;k[E+4>>2]=2499;k[E+8>>2]=1516;Ac(H,1100,E)|0;zc(H,F)|0;break}}while(0);e=x<<2;f=mb(e+8|0,0)|0;if(!f){k[g>>2]=0;e=0;break a}else{F=f+8|0;k[f+4>>2]=x;k[f>>2]=~x;k[g>>2]=F;f=F;break}}else{f=a+168|0;e=x<<2;g=f;f=k[f>>2]|0}while(0);ad(f|0,-1,e|0)|0;u=a+176|0;w=1;do{if(k[R+(w<<2)>>2]|0){b=z-w|0;v=1<<b;f=w+-1|0;h=k[Q+(f<<2)>>2]|0;if(f>>>0>=16){k[I>>2]=1154;k[I+4>>2]=1953;k[I+8>>2]=1737;Ac(H,1100,I)|0;zc(H,J)|0}e=k[a+28+(f<<2)>>2]|0;if(!e)t=-1;else t=(e+-1|0)>>>(16-w|0);if(h>>>0<=t>>>0){q=(k[a+96+(f<<2)>>2]|0)-h|0;s=w<<16;do{e=m[(k[u>>2]|0)+(q+h<<1)>>1]|0;if((l[c+e>>0]|0|0)!=(w|0)){k[K>>2]=1154;k[K+4>>2]=2319;k[K+8>>2]=1303;Ac(H,1100,K)|0;zc(H,L)|0}p=h<<b;f=e|s;o=0;do{n=o+p|0;if(n>>>0>=x>>>0){k[M>>2]=1154;k[M+4>>2]=2325;k[M+8>>2]=1337;Ac(H,1100,M)|0;zc(H,N)|0}e=k[g>>2]|0;if((k[e+(n<<2)>>2]|0)!=-1){k[O>>2]=1154;k[O+4>>2]=2327;k[O+8>>2]=1360;Ac(H,1100,O)|0;zc(H,P)|0;e=k[g>>2]|0}k[e+(n<<2)>>2]=f;o=o+1|0}while(o>>>0<v>>>0);h=h+1|0}while(h>>>0<=t>>>0)}}w=w+1|0}while(z>>>0>=w>>>0);e=i[B>>0]|0}f=a+96|0;k[f>>2]=(k[f>>2]|0)-(k[Q>>2]|0);f=a+100|0;k[f>>2]=(k[f>>2]|0)-(k[Q+4>>2]|0);f=a+104|0;k[f>>2]=(k[f>>2]|0)-(k[Q+8>>2]|0);f=a+108|0;k[f>>2]=(k[f>>2]|0)-(k[Q+12>>2]|0);f=a+112|0;k[f>>2]=(k[f>>2]|0)-(k[Q+16>>2]|0);f=a+116|0;k[f>>2]=(k[f>>2]|0)-(k[Q+20>>2]|0);f=a+120|0;k[f>>2]=(k[f>>2]|0)-(k[Q+24>>2]|0);f=a+124|0;k[f>>2]=(k[f>>2]|0)-(k[Q+28>>2]|0);f=a+128|0;k[f>>2]=(k[f>>2]|0)-(k[Q+32>>2]|0);f=a+132|0;k[f>>2]=(k[f>>2]|0)-(k[Q+36>>2]|0);f=a+136|0;k[f>>2]=(k[f>>2]|0)-(k[Q+40>>2]|0);f=a+140|0;k[f>>2]=(k[f>>2]|0)-(k[Q+44>>2]|0);f=a+144|0;k[f>>2]=(k[f>>2]|0)-(k[Q+48>>2]|0);f=a+148|0;k[f>>2]=(k[f>>2]|0)-(k[Q+52>>2]|0);f=a+152|0;k[f>>2]=(k[f>>2]|0)-(k[Q+56>>2]|0);f=a+156|0;k[f>>2]=(k[f>>2]|0)-(k[Q+60>>2]|0);f=a+16|0;k[f>>2]=0;g=a+20|0;k[g>>2]=e&255;b:do if(y){while(1){if(!d)break b;e=d+-1|0;if(!(k[R+(d<<2)>>2]|0))d=e;else break}k[f>>2]=k[a+28+(e<<2)>>2];e=z+1|0;k[g>>2]=e;if(e>>>0<=G>>>0){while(1){if(k[R+(e<<2)>>2]|0)break;e=e+1|0;if(e>>>0>G>>>0)break b}k[g>>2]=e}}while(0);k[a+92>>2]=-1;k[a+160>>2]=1048575;k[a+12>>2]=32-(k[A>>2]|0);e=1}while(0);a=e;r=S;return a|0}function ob(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;if(!a){e=Uc(b)|0;if(!c){c=e;return c|0}if(!e)f=0;else f=Xc(e)|0;k[c>>2]=f;c=e;return c|0}if(!b){Vc(a);if(!c){c=0;return c|0}k[c>>2]=0;c=0;return c|0}e=Wc(a,b)|0;f=(e|0)!=0;if(f|d^1)f=f?e:a;else{e=Wc(a,b)|0;f=(e|0)==0?a:e}if(!c){c=e;return c|0}b=Xc(f)|0;k[c>>2]=b;c=e;return c|0}function pb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!((a|0)!=0&b>>>0>73&(c|0)!=0)){c=0;return c|0}if((k[c>>2]|0)!=40|b>>>0<74){c=0;return c|0}if(((l[a>>0]|0)<<8|(l[a+1>>0]|0)|0)!=18552){c=0;return c|0}if(((l[a+2>>0]|0)<<8|(l[a+3>>0]|0))>>>0<74){c=0;return c|0}if(((l[a+7>>0]|0)<<16|(l[a+6>>0]|0)<<24|(l[a+8>>0]|0)<<8|(l[a+9>>0]|0))>>>0>b>>>0){c=0;return c|0}k[c+4>>2]=(l[a+12>>0]|0)<<8|(l[a+13>>0]|0);k[c+8>>2]=(l[a+14>>0]|0)<<8|(l[a+15>>0]|0);k[c+12>>2]=l[a+16>>0];k[c+16>>2]=l[a+17>>0];b=a+18|0;d=c+32|0;k[d>>2]=l[b>>0];k[d+4>>2]=0;b=i[b>>0]|0;k[c+20>>2]=b<<24>>24==0|b<<24>>24==9?8:16;k[c+24>>2]=(l[a+26>>0]|0)<<16|(l[a+25>>0]|0)<<24|(l[a+27>>0]|0)<<8|(l[a+28>>0]|0);k[c+28>>2]=(l[a+30>>0]|0)<<16|(l[a+29>>0]|0)<<24|(l[a+31>>0]|0)<<8|(l[a+32>>0]|0);c=1;return c|0}function qb(a){a=a|0;Ca(a|0)|0;Vb()}function rb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;f=r;r=r+544|0;e=f;d=f+24|0;b=k[a+20>>2]|0;if(b)sb(b);b=a+4|0;c=k[b>>2]|0;if(!c){e=a+16|0;i[e>>0]=0;r=f;return}if(!(c&7))$a[k[104>>2]&1](c,0,0,1,k[27]|0)|0;else{k[e>>2]=1154;k[e+4>>2]=2499;k[e+8>>2]=1516;Ac(d,1100,e)|0;zc(d,f+16|0)|0}k[b>>2]=0;k[a+8>>2]=0;k[a+12>>2]=0;e=a+16|0;i[e>>0]=0;r=f;return}function sb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0;o=r;r=r+640|0;n=o+112|0;m=o+96|0;l=o+88|0;j=o+72|0;i=o+64|0;h=o+48|0;d=o+40|0;f=o+24|0;e=o+16|0;c=o;g=o+120|0;if(!a){r=o;return}b=k[a+168>>2]|0;do if(b){p=k[b+-4>>2]|0;b=b+-8|0;if(!((p|0)!=0?(p|0)==(~k[b>>2]|0):0)){k[c>>2]=1154;k[c+4>>2]=644;k[c+8>>2]=1863;Ac(g,1100,c)|0;zc(g,e)|0}if(!(b&7)){$a[k[104>>2]&1](b,0,0,1,k[27]|0)|0;break}else{k[f>>2]=1154;k[f+4>>2]=2499;k[f+8>>2]=1516;Ac(g,1100,f)|0;zc(g,d)|0;break}}while(0);b=k[a+176>>2]|0;do if(b){p=k[b+-4>>2]|0;b=b+-8|0;if(!((p|0)!=0?(p|0)==(~k[b>>2]|0):0)){k[h>>2]=1154;k[h+4>>2]=644;k[h+8>>2]=1863;Ac(g,1100,h)|0;zc(g,i)|0}if(!(b&7)){$a[k[104>>2]&1](b,0,0,1,k[27]|0)|0;break}else{k[j>>2]=1154;k[j+4>>2]=2499;k[j+8>>2]=1516;Ac(g,1100,j)|0;zc(g,l)|0;break}}while(0);if(!(a&7)){$a[k[104>>2]&1](a,0,0,1,k[27]|0)|0;r=o;return}else{k[m>>2]=1154;k[m+4>>2]=2499;k[m+8>>2]=1516;Ac(g,1100,m)|0;zc(g,n)|0;r=o;return}}function tb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0;l=r;r=r+560|0;g=l+40|0;h=l+24|0;b=l;f=l+48|0;e=a+8|0;c=k[e>>2]|0;if((c+-1|0)>>>0>=8192){k[b>>2]=1154;k[b+4>>2]=2997;k[b+8>>2]=1541;Ac(f,1100,b)|0;zc(f,l+16|0)|0}k[a>>2]=c;d=a+20|0;b=k[d>>2]|0;if(!b){b=mb(180,0)|0;if(!b)b=0;else{j=b+164|0;k[j>>2]=0;k[j+4>>2]=0;k[j+8>>2]=0;k[j+12>>2]=0}k[d>>2]=b;j=b;i=k[a>>2]|0}else{j=b;i=c}if(!(k[e>>2]|0)){k[h>>2]=1154;k[h+4>>2]=903;k[h+8>>2]=1781;Ac(f,1100,h)|0;zc(f,g)|0;f=k[a>>2]|0}else f=i;e=k[a+4>>2]|0;if(f>>>0>16){c=f;b=0}else{a=0;j=nb(j,i,e,a)|0;r=l;return j|0}while(1){d=b+1|0;if(c>>>0>3){c=c>>>1;b=d}else{c=d;break}}a=b+2+((c|0)!=32&1<<c>>>0<f>>>0&1)|0;a=a>>>0<11?a&255:11;j=nb(j,i,e,a)|0;r=l;return j|0}function ub(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,j=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;N=r;r=r+800|0;I=N+256|0;H=N+240|0;G=N+232|0;F=N+216|0;E=N+208|0;D=N+192|0;C=N+184|0;B=N+168|0;A=N+160|0;z=N+144|0;y=N+136|0;x=N+120|0;w=N+112|0;v=N+96|0;u=N+88|0;t=N+72|0;o=N+64|0;n=N+48|0;h=N+40|0;j=N+24|0;f=N+16|0;e=N;L=N+288|0;M=N+264|0;J=vb(a,14)|0;if(!J){k[b>>2]=0;c=b+4|0;d=k[c>>2]|0;if(d){if(!(d&7))$a[k[104>>2]&1](d,0,0,1,k[27]|0)|0;else{k[e>>2]=1154;k[e+4>>2]=2499;k[e+8>>2]=1516;Ac(L,1100,e)|0;zc(L,f)|0}k[c>>2]=0;k[b+8>>2]=0;k[b+12>>2]=0}i[b+16>>0]=0;c=b+20|0;d=k[c>>2]|0;if(!d){b=1;r=N;return b|0}sb(d);k[c>>2]=0;b=1;r=N;return b|0}q=b+4|0;s=b+8|0;c=k[s>>2]|0;if((c|0)!=(J|0)){if(c>>>0<=J>>>0){do if((k[b+12>>2]|0)>>>0<J>>>0){if(kb(q,J,(c+1|0)==(J|0),1,0)|0){c=k[s>>2]|0;break}i[b+16>>0]=1;b=0;r=N;return b|0}while(0);ad((k[q>>2]|0)+c|0,0,J-c|0)|0}k[s>>2]=J}ad(k[q>>2]|0,0,J|0)|0;p=a+20|0;c=k[p>>2]|0;if((c|0)<5){f=a+4|0;g=a+8|0;e=a+16|0;do{d=k[f>>2]|0;if((d|0)==(k[g>>2]|0))d=0;else{k[f>>2]=d+1;d=l[d>>0]|0}c=c+8|0;k[p>>2]=c;if((c|0)>=33){k[j>>2]=1154;k[j+4>>2]=3199;k[j+8>>2]=1650;Ac(L,1100,j)|0;zc(L,h)|0;c=k[p>>2]|0}d=d<<32-c|k[e>>2];k[e>>2]=d}while((c|0)<5)}else{d=a+16|0;e=d;d=k[d>>2]|0}m=d>>>27;k[e>>2]=d<<5;k[p>>2]=c+-5;if((m+-1|0)>>>0>20){b=0;r=N;return b|0}k[M+20>>2]=0;k[M>>2]=0;k[M+4>>2]=0;k[M+8>>2]=0;k[M+12>>2]=0;i[M+16>>0]=0;c=M+4|0;d=M+8|0;a:do if(kb(c,21,0,1,0)|0){h=k[d>>2]|0;j=k[c>>2]|0;ad(j+h|0,0,21-h|0)|0;k[d>>2]=21;if(m){e=a+4|0;f=a+8|0;g=a+16|0;h=0;do{c=k[p>>2]|0;if((c|0)<3)do{d=k[e>>2]|0;if((d|0)==(k[f>>2]|0))d=0;else{k[e>>2]=d+1;d=l[d>>0]|0}c=c+8|0;k[p>>2]=c;if((c|0)>=33){k[n>>2]=1154;k[n+4>>2]=3199;k[n+8>>2]=1650;Ac(L,1100,n)|0;zc(L,o)|0;c=k[p>>2]|0}d=d<<32-c|k[g>>2];k[g>>2]=d}while((c|0)<3);else d=k[g>>2]|0;k[g>>2]=d<<3;k[p>>2]=c+-3;i[j+(l[1611+h>>0]|0)>>0]=d>>>29;h=h+1|0}while((h|0)!=(m|0))}if(tb(M)|0){h=a+4|0;j=a+8|0;m=a+16|0;d=0;b:while(1){g=J-d|0;c=wb(a,M)|0;c:do if(c>>>0<17){if((k[s>>2]|0)>>>0<=d>>>0){k[t>>2]=1154;k[t+4>>2]=903;k[t+8>>2]=1781;Ac(L,1100,t)|0;zc(L,u)|0}i[(k[q>>2]|0)+d>>0]=c;c=d+1|0}else switch(c|0){case 17:{c=k[p>>2]|0;if((c|0)<3)do{e=k[h>>2]|0;if((e|0)==(k[j>>2]|0))e=0;else{k[h>>2]=e+1;e=l[e>>0]|0}c=c+8|0;k[p>>2]=c;if((c|0)>=33){k[v>>2]=1154;k[v+4>>2]=3199;k[v+8>>2]=1650;Ac(L,1100,v)|0;zc(L,w)|0;c=k[p>>2]|0}e=e<<32-c|k[m>>2];k[m>>2]=e}while((c|0)<3);else e=k[m>>2]|0;k[m>>2]=e<<3;k[p>>2]=c+-3;c=(e>>>29)+3|0;if(c>>>0>g>>>0){c=0;break a}c=c+d|0;break c}case 18:{c=k[p>>2]|0;if((c|0)<7)do{e=k[h>>2]|0;if((e|0)==(k[j>>2]|0))e=0;else{k[h>>2]=e+1;e=l[e>>0]|0}c=c+8|0;k[p>>2]=c;if((c|0)>=33){k[x>>2]=1154;k[x+4>>2]=3199;k[x+8>>2]=1650;Ac(L,1100,x)|0;zc(L,y)|0;c=k[p>>2]|0}e=e<<32-c|k[m>>2];k[m>>2]=e}while((c|0)<7);else e=k[m>>2]|0;k[m>>2]=e<<7;k[p>>2]=c+-7;c=(e>>>25)+11|0;if(c>>>0>g>>>0){c=0;break a}c=c+d|0;break c}default:{if((c+-19|0)>>>0>=2){K=90;break b}f=k[p>>2]|0;if((c|0)==19){if((f|0)<2){e=f;while(1){c=k[h>>2]|0;if((c|0)==(k[j>>2]|0))f=0;else{k[h>>2]=c+1;f=l[c>>0]|0}c=e+8|0;k[p>>2]=c;if((c|0)>=33){k[z>>2]=1154;k[z+4>>2]=3199;k[z+8>>2]=1650;Ac(L,1100,z)|0;zc(L,A)|0;c=k[p>>2]|0}e=f<<32-c|k[m>>2];k[m>>2]=e;if((c|0)<2)e=c;else break}}else{e=k[m>>2]|0;c=f}k[m>>2]=e<<2;k[p>>2]=c+-2;f=(e>>>30)+3|0}else{if((f|0)<6){e=f;while(1){c=k[h>>2]|0;if((c|0)==(k[j>>2]|0))f=0;else{k[h>>2]=c+1;f=l[c>>0]|0}c=e+8|0;k[p>>2]=c;if((c|0)>=33){k[B>>2]=1154;k[B+4>>2]=3199;k[B+8>>2]=1650;Ac(L,1100,B)|0;zc(L,C)|0;c=k[p>>2]|0}e=f<<32-c|k[m>>2];k[m>>2]=e;if((c|0)<6)e=c;else break}}else{e=k[m>>2]|0;c=f}k[m>>2]=e<<6;k[p>>2]=c+-6;f=(e>>>26)+7|0}if((d|0)==0|f>>>0>g>>>0){c=0;break a}c=d+-1|0;if((k[s>>2]|0)>>>0<=c>>>0){k[D>>2]=1154;k[D+4>>2]=903;k[D+8>>2]=1781;Ac(L,1100,D)|0;zc(L,E)|0}e=i[(k[q>>2]|0)+c>>0]|0;if(!(e<<24>>24)){c=0;break a}c=f+d|0;if(d>>>0>=c>>>0){c=d;break c}do{if((k[s>>2]|0)>>>0<=d>>>0){k[F>>2]=1154;k[F+4>>2]=903;k[F+8>>2]=1781;Ac(L,1100,F)|0;zc(L,G)|0}i[(k[q>>2]|0)+d>>0]=e;d=d+1|0}while((d|0)!=(c|0))}}while(0);if(J>>>0>c>>>0)d=c;else break}if((K|0)==90){k[H>>2]=1154;k[H+4>>2]=3140;k[H+8>>2]=1632;Ac(L,1100,H)|0;zc(L,I)|0;c=0;break}if((J|0)==(c|0))c=tb(b)|0;else c=0}else c=0}else{i[M+16>>0]=1;c=0}while(0);rb(M);b=c;r=N;return b|0}function vb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,m=0;m=r;r=r+544|0;h=m+16|0;g=m;f=m+24|0;if(!b){j=0;r=m;return j|0}if(b>>>0<=16){j=xb(a,b)|0;r=m;return j|0}i=xb(a,b+-16|0)|0;j=a+20|0;b=k[j>>2]|0;if((b|0)<16){d=a+4|0;e=a+8|0;c=a+16|0;do{a=k[d>>2]|0;if((a|0)==(k[e>>2]|0))a=0;else{k[d>>2]=a+1;a=l[a>>0]|0}b=b+8|0;k[j>>2]=b;if((b|0)>=33){k[g>>2]=1154;k[g+4>>2]=3199;k[g+8>>2]=1650;Ac(f,1100,g)|0;zc(f,h)|0;b=k[j>>2]|0}a=a<<32-b|k[c>>2];k[c>>2]=a}while((b|0)<16)}else{a=a+16|0;c=a;a=k[a>>2]|0}k[c>>2]=a<<16;k[j>>2]=b+-16;j=a>>>16|i<<16;r=m;return j|0}function wb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0;x=r;r=r+608|0;t=x+88|0;s=x+72|0;p=x+64|0;o=x+48|0;n=x+40|0;q=x+24|0;j=x+16|0;i=x;v=x+96|0;u=k[b+20>>2]|0;w=a+20|0;h=k[w>>2]|0;do if((h|0)<24){g=a+4|0;d=k[g>>2]|0;e=k[a+8>>2]|0;c=d>>>0<e>>>0;if((h|0)>=16){if(c){k[g>>2]=d+1;c=l[d>>0]|0}else c=0;k[w>>2]=h+8;g=a+16|0;f=c<<24-h|k[g>>2];k[g>>2]=f;break}if(c){f=(l[d>>0]|0)<<8;c=d+1|0}else{f=0;c=d}if(c>>>0<e>>>0){d=l[c>>0]|0;c=c+1|0}else d=0;k[g>>2]=c;k[w>>2]=h+16;g=a+16|0;f=(d|f)<<16-h|k[g>>2];k[g>>2]=f}else{f=a+16|0;g=f;f=k[f>>2]|0}while(0);e=(f>>>16)+1|0;do if(e>>>0<=(k[u+16>>2]|0)>>>0){d=k[(k[u+168>>2]|0)+(f>>>(32-(k[u+8>>2]|0)|0)<<2)>>2]|0;if((d|0)==-1){k[i>>2]=1154;k[i+4>>2]=3244;k[i+8>>2]=1677;Ac(v,1100,i)|0;zc(v,j)|0}c=d&65535;d=d>>>16;if((k[b+8>>2]|0)>>>0<=c>>>0){k[q>>2]=1154;k[q+4>>2]=902;k[q+8>>2]=1781;Ac(v,1100,q)|0;zc(v,n)|0}if((l[(k[b+4>>2]|0)+c>>0]|0|0)!=(d|0)){k[o>>2]=1154;k[o+4>>2]=3248;k[o+8>>2]=1694;Ac(v,1100,o)|0;zc(v,p)|0}}else{d=k[u+20>>2]|0;while(1){c=d+-1|0;if(e>>>0>(k[u+28+(c<<2)>>2]|0)>>>0)d=d+1|0;else break}c=(f>>>(32-d|0))+(k[u+96+(c<<2)>>2]|0)|0;if(c>>>0<(k[b>>2]|0)>>>0){c=m[(k[u+176>>2]|0)+(c<<1)>>1]|0;break}k[s>>2]=1154;k[s+4>>2]=3266;k[s+8>>2]=1632;Ac(v,1100,s)|0;zc(v,t)|0;w=0;r=x;return w|0}while(0);k[g>>2]=k[g>>2]<<d;k[w>>2]=(k[w>>2]|0)-d;w=c;r=x;return w|0}function xb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,m=0;m=r;r=r+560|0;h=m+40|0;i=m+24|0;c=m;g=m+48|0;if(b>>>0>=33){k[c>>2]=1154;k[c+4>>2]=3190;k[c+8>>2]=1634;Ac(g,1100,c)|0;zc(g,m+16|0)|0}j=a+20|0;c=k[j>>2]|0;if((c|0)>=(b|0)){f=a+16|0;g=f;f=k[f>>2]|0;h=c;i=32-b|0;i=f>>>i;f=f<<b;k[g>>2]=f;b=h-b|0;k[j>>2]=b;r=m;return i|0}e=a+4|0;f=a+8|0;d=a+16|0;do{a=k[e>>2]|0;if((a|0)==(k[f>>2]|0))a=0;else{k[e>>2]=a+1;a=l[a>>0]|0}c=c+8|0;k[j>>2]=c;if((c|0)>=33){k[i>>2]=1154;k[i+4>>2]=3199;k[i+8>>2]=1650;Ac(g,1100,i)|0;zc(g,h)|0;c=k[j>>2]|0}a=a<<32-c|k[d>>2];k[d>>2]=a}while((c|0)<(b|0));i=32-b|0;i=a>>>i;h=a<<b;k[d>>2]=h;b=c-b|0;k[j>>2]=b;r=m;return i|0}function yb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,j=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0;s=r;r=r+544|0;p=s+16|0;o=s;n=s+24|0;if((a|0)==0|b>>>0<62){q=0;r=s;return q|0}m=mb(300,0)|0;if(!m){q=0;r=s;return q|0}k[m>>2]=519686845;c=m+4|0;k[c>>2]=0;d=m+8|0;k[d>>2]=0;j=m+88|0;e=m+136|0;f=m+160|0;g=j;h=g+44|0;do{k[g>>2]=0;g=g+4|0}while((g|0)<(h|0));i[j+44>>0]=0;t=m+184|0;g=m+208|0;h=m+232|0;u=m+252|0;k[u>>2]=0;k[u+4>>2]=0;k[u+8>>2]=0;i[u+12>>0]=0;u=m+268|0;k[u>>2]=0;k[u+4>>2]=0;k[u+8>>2]=0;i[u+12>>0]=0;u=m+284|0;k[u>>2]=0;k[u+4>>2]=0;k[u+8>>2]=0;i[u+12>>0]=0;k[e>>2]=0;k[e+4>>2]=0;k[e+8>>2]=0;k[e+12>>2]=0;k[e+16>>2]=0;i[e+20>>0]=0;k[f>>2]=0;k[f+4>>2]=0;k[f+8>>2]=0;k[f+12>>2]=0;k[f+16>>2]=0;i[f+20>>0]=0;k[t>>2]=0;k[t+4>>2]=0;k[t+8>>2]=0;k[t+12>>2]=0;k[t+16>>2]=0;i[t+20>>0]=0;k[g>>2]=0;k[g+4>>2]=0;k[g+8>>2]=0;k[g+12>>2]=0;k[g+16>>2]=0;i[g+20>>0]=0;k[h>>2]=0;k[h+4>>2]=0;k[h+8>>2]=0;k[h+12>>2]=0;i[h+16>>0]=0;do if(((b>>>0>=74?((l[a>>0]|0)<<8|(l[a+1>>0]|0)|0)==18552:0)?((l[a+2>>0]|0)<<8|(l[a+3>>0]|0))>>>0>=74:0)?((l[a+7>>0]|0)<<16|(l[a+6>>0]|0)<<24|(l[a+8>>0]|0)<<8|(l[a+9>>0]|0))>>>0<=b>>>0:0){k[j>>2]=a;k[c>>2]=a;k[d>>2]=b;if(Hb(m)|0){c=k[j>>2]|0;if((l[c+39>>0]|0)<<8|(l[c+40>>0]|0)){if(!(Ib(m)|0))break;if(!(Jb(m)|0))break;c=k[j>>2]|0}if(!((l[c+55>>0]|0)<<8|(l[c+56>>0]|0))){u=m;r=s;return u|0}if(Kb(m)|0?Lb(m)|0:0){u=m;r=s;return u|0}}}else q=7;while(0);if((q|0)==7)k[j>>2]=0;Qb(m);if(!(m&7)){$a[k[104>>2]&1](m,0,0,1,k[27]|0)|0;u=0;r=s;return u|0}else{k[o>>2]=1154;k[o+4>>2]=2499;k[o+8>>2]=1516;Ac(n,1100,o)|0;zc(n,p)|0;u=0;r=s;return u|0}return 0}function zb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,m=0;m=r;r=r+544|0;j=m;i=m+24|0;f=k[a+88>>2]|0;h=(l[f+70+(e<<2)+1>>0]|0)<<16|(l[f+70+(e<<2)>>0]|0)<<24|(l[f+70+(e<<2)+2>>0]|0)<<8|(l[f+70+(e<<2)+3>>0]|0);g=e+1|0;if(g>>>0<(l[f+16>>0]|0)>>>0)f=(l[f+70+(g<<2)+1>>0]|0)<<16|(l[f+70+(g<<2)>>0]|0)<<24|(l[f+70+(g<<2)+2>>0]|0)<<8|(l[f+70+(g<<2)+3>>0]|0);else f=k[a+8>>2]|0;if(f>>>0>h>>>0){i=a+4|0;i=k[i>>2]|0;i=i+h|0;j=f-h|0;j=Ab(a,i,j,b,c,d,e)|0;r=m;return j|0}k[j>>2]=1154;k[j+4>>2]=3704;k[j+8>>2]=1792;Ac(i,1100,j)|0;zc(i,m+16|0)|0;i=a+4|0;i=k[i>>2]|0;i=i+h|0;j=f-h|0;j=Ab(a,i,j,b,c,d,e)|0;r=m;return j|0}function Ab(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,m=0,n=0;n=k[a+88>>2]|0;j=((l[n+12>>0]|0)<<8|(l[n+13>>0]|0))>>>g;m=((l[n+14>>0]|0)<<8|(l[n+15>>0]|0))>>>g;j=j>>>0>1?(j+3|0)>>>2:1;m=m>>>0>1?(m+3|0)>>>2:1;n=n+18|0;g=i[n>>0]|0;g=ha(g<<24>>24==0|g<<24>>24==9?8:16,j)|0;if(f)if((f&3|0)==0&g>>>0<=f>>>0)g=f;else{a=0;return a|0}if((ha(g,m)|0)>>>0>e>>>0){a=0;return a|0}f=(j+1|0)>>>1;h=(m+1|0)>>>1;if(!c){a=0;return a|0}k[a+92>>2]=b;k[a+96>>2]=b;k[a+104>>2]=c;k[a+100>>2]=b+c;k[a+108>>2]=0;k[a+112>>2]=0;switch(l[n>>0]|0|0){case 0:{Mb(a,d,e,g,j,m,f,h)|0;a=1;return a|0}case 4:case 6:case 5:case 3:case 2:{Nb(a,d,e,g,j,m,f,h)|0;a=1;return a|0}case 9:{Ob(a,d,e,g,j,m,f,h)|0;a=1;return a|0}case 8:case 7:{Pb(a,d,e,g,j,m,f,h)|0;a=1;return a|0}default:{a=0;return a|0}}return 0}function Bb(a,b){a=a|0;b=b|0;var c=0,d=0;d=r;r=r+48|0;c=d;k[c>>2]=40;pb(a,b,c)|0;r=d;return k[c+4>>2]|0}function Cb(a,b){a=a|0;b=b|0;var c=0,d=0;d=r;r=r+48|0;c=d;k[c>>2]=40;pb(a,b,c)|0;r=d;return k[c+8>>2]|0}function Db(a,b){a=a|0;b=b|0;var c=0,d=0;d=r;r=r+48|0;c=d;k[c>>2]=40;pb(a,b,c)|0;r=d;return k[c+12>>2]|0}function Eb(a,b){a=a|0;b=b|0;var c=0,d=0;d=r;r=r+48|0;c=d;k[c>>2]=40;pb(a,b,c)|0;r=d;return k[c+32>>2]|0}function Fb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=r;r=r+576|0;g=i+56|0;f=i+40|0;e=i+64|0;j=i;k[j>>2]=40;pb(a,b,j)|0;d=(((k[j+4>>2]|0)>>>c)+3|0)>>>2;b=(((k[j+8>>2]|0)>>>c)+3|0)>>>2;c=j+32|0;a=k[c+4>>2]|0;do switch(k[c>>2]|0){case 0:{if(!a)a=8;else h=13;break}case 1:{if(!a)h=12;else h=13;break}case 2:{if(!a)h=12;else h=13;break}case 3:{if(!a)h=12;else h=13;break}case 4:{if(!a)h=12;else h=13;break}case 5:{if(!a)h=12;else h=13;break}case 6:{if(!a)h=12;else h=13;break}case 7:{if(!a)h=12;else h=13;break}case 8:{if(!a)h=12;else h=13;break}case 9:{if(!a)a=8;else h=13;break}default:h=13}while(0);if((h|0)==12)a=16;else if((h|0)==13){k[f>>2]=1154;k[f+4>>2]=2663;k[f+8>>2]=1535;Ac(e,1100,f)|0;zc(e,g)|0;a=0}j=ha(ha(b,d)|0,a)|0;r=i;return j|0}function Gb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0;p=r;r=r+608|0;n=p+80|0;o=p+64|0;h=p+56|0;g=p+40|0;l=p+88|0;q=p;m=p+84|0;k[q>>2]=40;pb(a,b,q)|0;i=(((k[q+4>>2]|0)>>>e)+3|0)>>>2;q=q+32|0;f=k[q+4>>2]|0;do switch(k[q>>2]|0){case 0:{if(!f)f=8;else j=13;break}case 1:{if(!f)j=12;else j=13;break}case 2:{if(!f)j=12;else j=13;break}case 3:{if(!f)j=12;else j=13;break}case 4:{if(!f)j=12;else j=13;break}case 5:{if(!f)j=12;else j=13;break}case 6:{if(!f)j=12;else j=13;break}case 7:{if(!f)j=12;else j=13;break}case 8:{if(!f)j=12;else j=13;break}case 9:{if(!f)f=8;else j=13;break}default:j=13}while(0);if((j|0)==12)f=16;else if((j|0)==13){k[g>>2]=1154;k[g+4>>2]=2663;k[g+8>>2]=1535;Ac(l,1100,g)|0;zc(l,h)|0;f=0}h=ha(f,i)|0;g=yb(a,b)|0;k[m>>2]=c;f=(g|0)==0;if(!(e>>>0>15|(d>>>0<8|f))?(k[g>>2]|0)==519686845:0)zb(g,m,d,h,e)|0;if(f){r=p;return}if((k[g>>2]|0)!=519686845){r=p;return}Qb(g);if(!(g&7)){$a[k[104>>2]&1](g,0,0,1,k[27]|0)|0;r=p;return}else{k[o>>2]=1154;k[o+4>>2]=2499;k[o+8>>2]=1516;Ac(l,1100,o)|0;zc(l,n)|0;r=p;return}}function Hb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;g=a+92|0;d=k[a+4>>2]|0;f=a+88|0;e=k[f>>2]|0;b=(l[e+68>>0]|0)<<8|(l[e+67>>0]|0)<<16|(l[e+69>>0]|0);c=d+b|0;e=(l[e+65>>0]|0)<<8|(l[e+66>>0]|0);if(!e){a=0;return a|0}k[g>>2]=c;k[a+96>>2]=c;k[a+104>>2]=e;k[a+100>>2]=d+(e+b);k[a+108>>2]=0;k[a+112>>2]=0;if(!(ub(g,a+116|0)|0)){a=0;return a|0}b=k[f>>2]|0;do if(!((l[b+39>>0]|0)<<8|(l[b+40>>0]|0))){if(!((l[b+55>>0]|0)<<8|(l[b+56>>0]|0))){a=0;return a|0}}else{if(!(ub(g,a+140|0)|0)){a=0;return a|0}if(ub(g,a+188|0)|0){b=k[f>>2]|0;break}else{a=0;return a|0}}while(0);if((l[b+55>>0]|0)<<8|(l[b+56>>0]|0)){if(!(ub(g,a+164|0)|0)){a=0;return a|0}if(!(ub(g,a+212|0)|0)){a=0;return a|0}}a=1;return a|0}function Ib(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,j=0,m=0,n=0,o=0,p=0,q=0,s=0;s=r;r=r+592|0;j=s+16|0;h=s;g=s+72|0;q=s+24|0;d=a+88|0;b=k[d>>2]|0;p=(l[b+39>>0]|0)<<8|(l[b+40>>0]|0);n=a+236|0;f=a+240|0;c=k[f>>2]|0;if((c|0)!=(p|0)){if(c>>>0<=p>>>0){do if((k[a+244>>2]|0)>>>0<p>>>0){if(kb(n,p,(c+1|0)==(p|0),4,0)|0){b=k[f>>2]|0;break}i[a+248>>0]=1;q=0;r=s;return q|0}else b=c;while(0);ad((k[n>>2]|0)+(b<<2)|0,0,p-b<<2|0)|0;b=k[d>>2]|0}k[f>>2]=p}m=a+92|0;c=k[a+4>>2]|0;d=(l[b+34>>0]|0)<<8|(l[b+33>>0]|0)<<16|(l[b+35>>0]|0);e=c+d|0;b=(l[b+37>>0]|0)<<8|(l[b+36>>0]|0)<<16|(l[b+38>>0]|0);if(!b){q=0;r=s;return q|0}k[m>>2]=e;k[a+96>>2]=e;k[a+104>>2]=b;k[a+100>>2]=c+(b+d);k[a+108>>2]=0;k[a+112>>2]=0;k[q+20>>2]=0;k[q>>2]=0;k[q+4>>2]=0;k[q+8>>2]=0;k[q+12>>2]=0;i[q+16>>0]=0;a=q+24|0;k[q+44>>2]=0;k[a>>2]=0;k[a+4>>2]=0;k[a+8>>2]=0;k[a+12>>2]=0;i[a+16>>0]=0;if(ub(m,q)|0?(o=q+24|0,ub(m,o)|0):0){if(!(k[f>>2]|0)){k[h>>2]=1154;k[h+4>>2]=903;k[h+8>>2]=1781;Ac(g,1100,h)|0;zc(g,j)|0}if(!p)b=1;else{d=0;e=0;f=0;b=0;g=0;a=0;h=0;c=k[n>>2]|0;while(1){d=(wb(m,q)|0)+d&31;e=(wb(m,o)|0)+e&63;f=(wb(m,q)|0)+f&31;b=(wb(m,q)|0)+b|0;g=(wb(m,o)|0)+g&63;a=(wb(m,q)|0)+a&31;k[c>>2]=e<<5|d<<11|f|b<<27|g<<21|a<<16;h=h+1|0;if((h|0)==(p|0)){b=1;break}else{b=b&31;c=c+4|0}}}}else b=0;rb(q+24|0);rb(q);q=b;r=s;return q|0}function Jb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,j=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;D=r;r=r+1024|0;h=D+16|0;g=D;f=D+504|0;C=D+480|0;A=D+284|0;B=D+88|0;z=D+24|0;e=k[a+88>>2]|0;y=(l[e+47>>0]|0)<<8|(l[e+48>>0]|0);x=a+92|0;b=k[a+4>>2]|0;c=(l[e+42>>0]|0)<<8|(l[e+41>>0]|0)<<16|(l[e+43>>0]|0);d=b+c|0;e=(l[e+45>>0]|0)<<8|(l[e+44>>0]|0)<<16|(l[e+46>>0]|0);if(!e){C=0;r=D;return C|0}k[x>>2]=d;k[a+96>>2]=d;k[a+104>>2]=e;k[a+100>>2]=b+(e+c);k[a+108>>2]=0;k[a+112>>2]=0;k[C+20>>2]=0;k[C>>2]=0;k[C+4>>2]=0;k[C+8>>2]=0;k[C+12>>2]=0;i[C+16>>0]=0;if(ub(x,C)|0){c=0;d=-3;e=-3;while(1){k[A+(c<<2)>>2]=d;k[B+(c<<2)>>2]=e;b=(d|0)>2;c=c+1|0;if((c|0)==49)break;else{d=b?-3:d+1|0;e=(b&1)+e|0}}b=z;c=b+64|0;do{k[b>>2]=0;b=b+4|0}while((b|0)<(c|0));w=a+252|0;c=a+256|0;b=k[c>>2]|0;a:do if((b|0)==(y|0))j=13;else{if(b>>>0<=y>>>0){do if((k[a+260>>2]|0)>>>0<y>>>0)if(kb(w,y,(b+1|0)==(y|0),4,0)|0){b=k[c>>2]|0;break}else{i[a+264>>0]=1;b=0;break a}while(0);ad((k[w>>2]|0)+(b<<2)|0,0,y-b<<2|0)|0}k[c>>2]=y;j=13}while(0);do if((j|0)==13){if(!y){k[g>>2]=1154;k[g+4>>2]=903;k[g+8>>2]=1781;Ac(f,1100,g)|0;zc(f,h)|0;b=1;break}d=z+4|0;e=z+8|0;a=z+12|0;f=z+16|0;g=z+20|0;h=z+24|0;j=z+28|0;m=z+32|0;n=z+36|0;o=z+40|0;p=z+44|0;q=z+48|0;s=z+52|0;t=z+56|0;u=z+60|0;v=0;c=k[w>>2]|0;while(1){b=0;do{E=wb(x,C)|0;w=b<<1;F=z+(w<<2)|0;k[F>>2]=(k[F>>2]|0)+(k[A+(E<<2)>>2]|0)&3;w=z+((w|1)<<2)|0;k[w>>2]=(k[w>>2]|0)+(k[B+(E<<2)>>2]|0)&3;b=b+1|0}while((b|0)!=8);k[c>>2]=(l[1725+(k[d>>2]|0)>>0]|0)<<2|(l[1725+(k[z>>2]|0)>>0]|0)|(l[1725+(k[e>>2]|0)>>0]|0)<<4|(l[1725+(k[a>>2]|0)>>0]|0)<<6|(l[1725+(k[f>>2]|0)>>0]|0)<<8|(l[1725+(k[g>>2]|0)>>0]|0)<<10|(l[1725+(k[h>>2]|0)>>0]|0)<<12|(l[1725+(k[j>>2]|0)>>0]|0)<<14|(l[1725+(k[m>>2]|0)>>0]|0)<<16|(l[1725+(k[n>>2]|0)>>0]|0)<<18|(l[1725+(k[o>>2]|0)>>0]|0)<<20|(l[1725+(k[p>>2]|0)>>0]|0)<<22|(l[1725+(k[q>>2]|0)>>0]|0)<<24|(l[1725+(k[s>>2]|0)>>0]|0)<<26|(l[1725+(k[t>>2]|0)>>0]|0)<<28|(l[1725+(k[u>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(y|0)){b=1;break}else c=c+4|0}}while(0)}else b=0;rb(C);F=b;r=D;return F|0}function Kb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,m=0,n=0,o=0,p=0,q=0;q=r;r=r+560|0;m=q+16|0;h=q;g=q+48|0;p=q+24|0;e=k[a+88>>2]|0;o=(l[e+55>>0]|0)<<8|(l[e+56>>0]|0);n=a+92|0;b=k[a+4>>2]|0;c=(l[e+50>>0]|0)<<8|(l[e+49>>0]|0)<<16|(l[e+51>>0]|0);d=b+c|0;e=(l[e+53>>0]|0)<<8|(l[e+52>>0]|0)<<16|(l[e+54>>0]|0);if(!e){p=0;r=q;return p|0}k[n>>2]=d;k[a+96>>2]=d;k[a+104>>2]=e;k[a+100>>2]=b+(e+c);k[a+108>>2]=0;k[a+112>>2]=0;k[p+20>>2]=0;k[p>>2]=0;k[p+4>>2]=0;k[p+8>>2]=0;k[p+12>>2]=0;i[p+16>>0]=0;a:do if(ub(n,p)|0){f=a+268|0;c=a+272|0;b=k[c>>2]|0;if((b|0)!=(o|0)){if(b>>>0<=o>>>0){do if((k[a+276>>2]|0)>>>0<o>>>0)if(kb(f,o,(b+1|0)==(o|0),2,0)|0){b=k[c>>2]|0;break}else{i[a+280>>0]=1;b=0;break a}while(0);ad((k[f>>2]|0)+(b<<1)|0,0,o-b<<1|0)|0}k[c>>2]=o}if(!o){k[h>>2]=1154;k[h+4>>2]=903;k[h+8>>2]=1781;Ac(g,1100,h)|0;zc(g,m)|0;b=1;break}c=0;d=0;e=0;b=k[f>>2]|0;while(1){m=wb(n,p)|0;c=m+c&255;d=(wb(n,p)|0)+d&255;j[b>>1]=d<<8|c;e=e+1|0;if((e|0)==(o|0)){b=1;break}else b=b+2|0}}else b=0;while(0);rb(p);p=b;r=q;return p|0}function Lb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;E=r;r=r+2432|0;h=E+16|0;g=E;f=E+1912|0;D=E+1888|0;B=E+988|0;C=E+88|0;A=E+24|0;e=k[a+88>>2]|0;z=(l[e+63>>0]|0)<<8|(l[e+64>>0]|0);y=a+92|0;b=k[a+4>>2]|0;c=(l[e+58>>0]|0)<<8|(l[e+57>>0]|0)<<16|(l[e+59>>0]|0);d=b+c|0;e=(l[e+61>>0]|0)<<8|(l[e+60>>0]|0)<<16|(l[e+62>>0]|0);if(!e){D=0;r=E;return D|0}k[y>>2]=d;k[a+96>>2]=d;k[a+104>>2]=e;k[a+100>>2]=b+(e+c);k[a+108>>2]=0;k[a+112>>2]=0;k[D+20>>2]=0;k[D>>2]=0;k[D+4>>2]=0;k[D+8>>2]=0;k[D+12>>2]=0;i[D+16>>0]=0;if(ub(y,D)|0){c=0;d=-7;e=-7;while(1){k[B+(c<<2)>>2]=d;k[C+(c<<2)>>2]=e;b=(d|0)>6;c=c+1|0;if((c|0)==225)break;else{d=b?-7:d+1|0;e=(b&1)+e|0}}b=A;c=b+64|0;do{k[b>>2]=0;b=b+4|0}while((b|0)<(c|0));x=a+284|0;c=z*3|0;d=a+288|0;b=k[d>>2]|0;a:do if((b|0)==(c|0))m=13;else{if(b>>>0<=c>>>0){do if((k[a+292>>2]|0)>>>0<c>>>0)if(kb(x,c,(b+1|0)==(c|0),2,0)|0){b=k[d>>2]|0;break}else{i[a+296>>0]=1;b=0;break a}while(0);ad((k[x>>2]|0)+(b<<1)|0,0,c-b<<1|0)|0}k[d>>2]=c;m=13}while(0);do if((m|0)==13){if(!z){k[g>>2]=1154;k[g+4>>2]=903;k[g+8>>2]=1781;Ac(f,1100,g)|0;zc(f,h)|0;b=1;break}d=A+4|0;e=A+8|0;a=A+12|0;f=A+16|0;g=A+20|0;h=A+24|0;m=A+28|0;n=A+32|0;o=A+36|0;p=A+40|0;q=A+44|0;s=A+48|0;t=A+52|0;u=A+56|0;v=A+60|0;w=0;c=k[x>>2]|0;while(1){b=0;do{F=wb(y,D)|0;x=b<<1;G=A+(x<<2)|0;k[G>>2]=(k[G>>2]|0)+(k[B+(F<<2)>>2]|0)&7;x=A+((x|1)<<2)|0;k[x>>2]=(k[x>>2]|0)+(k[C+(F<<2)>>2]|0)&7;b=b+1|0}while((b|0)!=8);F=l[1729+(k[g>>2]|0)>>0]|0;j[c>>1]=(l[1729+(k[d>>2]|0)>>0]|0)<<3|(l[1729+(k[A>>2]|0)>>0]|0)|(l[1729+(k[e>>2]|0)>>0]|0)<<6|(l[1729+(k[a>>2]|0)>>0]|0)<<9|(l[1729+(k[f>>2]|0)>>0]|0)<<12|F<<15;G=l[1729+(k[p>>2]|0)>>0]|0;j[c+2>>1]=(l[1729+(k[h>>2]|0)>>0]|0)<<2|F>>>1|(l[1729+(k[m>>2]|0)>>0]|0)<<5|(l[1729+(k[n>>2]|0)>>0]|0)<<8|(l[1729+(k[o>>2]|0)>>0]|0)<<11|G<<14;j[c+4>>1]=(l[1729+(k[q>>2]|0)>>0]|0)<<1|G>>>2|(l[1729+(k[s>>2]|0)>>0]|0)<<4|(l[1729+(k[t>>2]|0)>>0]|0)<<7|(l[1729+(k[u>>2]|0)>>0]|0)<<10|(l[1729+(k[v>>2]|0)>>0]|0)<<13;w=w+1|0;if((w|0)==(z|0)){b=1;break}else c=c+6|0}}while(0)}else b=0;rb(D);G=b;r=E;return G|0}function Mb(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,m=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0;pa=r;r=r+720|0;oa=pa+184|0;ma=pa+168|0;la=pa+160|0;ka=pa+144|0;ja=pa+136|0;ia=pa+120|0;ga=pa+112|0;ea=pa+96|0;da=pa+88|0;ca=pa+72|0;ba=pa+64|0;aa=pa+48|0;$=pa+40|0;na=pa+24|0;fa=pa+16|0;_=pa;Y=pa+208|0;Z=pa+192|0;R=a+240|0;S=k[R>>2]|0;V=a+256|0;W=k[V>>2]|0;c=i[(k[a+88>>2]|0)+17>>0]|0;X=d>>>2;if(!(c<<24>>24)){r=pa;return 1}T=(h|0)==0;U=h+-1|0;K=(f&1|0)!=0;L=d<<1;M=a+92|0;N=a+116|0;O=a+140|0;P=a+236|0;Q=g+-1|0;J=(e&1|0)!=0;I=a+188|0;D=a+252|0;E=X+1|0;F=X+2|0;G=X+3|0;H=Q<<4;B=c&255;c=0;f=0;e=1;C=0;do{if(!T){z=k[b+(C<<2)>>2]|0;A=0;while(1){w=A&1;j=(w|0)==0;v=(w<<5^32)+-16|0;w=(w<<1^2)+-1|0;y=j?g:-1;m=j?0:Q;a=(A|0)==(U|0);x=K&a;if((m|0)!=(y|0)){u=K&a^1;t=j?z:z+H|0;while(1){if((e|0)==1)e=wb(M,N)|0|512;s=e&7;e=e>>>3;j=l[1823+s>>0]|0;a=0;do{p=(wb(M,O)|0)+f|0;q=p-S|0;f=q>>31;f=f&p|q&~f;if((k[R>>2]|0)>>>0<=f>>>0){k[_>>2]=1154;k[_+4>>2]=903;k[_+8>>2]=1781;Ac(Y,1100,_)|0;zc(Y,fa)|0}k[Z+(a<<2)>>2]=k[(k[P>>2]|0)+(f<<2)>>2];a=a+1|0}while(a>>>0<j>>>0);q=J&(m|0)==(Q|0);if(x|q){p=0;do{n=ha(p,d)|0;a=t+n|0;j=(p|0)==0|u;o=p<<1;ra=(wb(M,I)|0)+c|0;qa=ra-W|0;c=qa>>31;c=c&ra|qa&~c;do if(q){if(!j){qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;break}k[a>>2]=k[Z+((l[1831+(s<<2)+o>>0]|0)<<2)>>2];if((k[V>>2]|0)>>>0<=c>>>0){k[ka>>2]=1154;k[ka+4>>2]=903;k[ka+8>>2]=1781;Ac(Y,1100,ka)|0;zc(Y,la)|0}k[t+(n+4)>>2]=k[(k[D>>2]|0)+(c<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c}else{if(!j){qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;break}k[a>>2]=k[Z+((l[1831+(s<<2)+o>>0]|0)<<2)>>2];if((k[V>>2]|0)>>>0<=c>>>0){k[ia>>2]=1154;k[ia+4>>2]=903;k[ia+8>>2]=1781;Ac(Y,1100,ia)|0;zc(Y,ja)|0}k[t+(n+4)>>2]=k[(k[D>>2]|0)+(c<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;k[t+(n+8)>>2]=k[Z+((l[(o|1)+(1831+(s<<2))>>0]|0)<<2)>>2];if((k[V>>2]|0)>>>0<=c>>>0){k[ma>>2]=1154;k[ma+4>>2]=903;k[ma+8>>2]=1781;Ac(Y,1100,ma)|0;zc(Y,oa)|0}k[t+(n+12)>>2]=k[(k[D>>2]|0)+(c<<2)>>2]}while(0);p=p+1|0}while((p|0)!=2)}else{k[t>>2]=k[Z+((l[1831+(s<<2)>>0]|0)<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;if((k[V>>2]|0)>>>0<=c>>>0){k[na>>2]=1154;k[na+4>>2]=903;k[na+8>>2]=1781;Ac(Y,1100,na)|0;zc(Y,$)|0}k[t+4>>2]=k[(k[D>>2]|0)+(c<<2)>>2];k[t+8>>2]=k[Z+((l[1831+(s<<2)+1>>0]|0)<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;if((k[V>>2]|0)>>>0<=c>>>0){k[aa>>2]=1154;k[aa+4>>2]=903;k[aa+8>>2]=1781;Ac(Y,1100,aa)|0;zc(Y,ba)|0}k[t+12>>2]=k[(k[D>>2]|0)+(c<<2)>>2];k[t+(X<<2)>>2]=k[Z+((l[1831+(s<<2)+2>>0]|0)<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;if((k[V>>2]|0)>>>0<=c>>>0){k[ca>>2]=1154;k[ca+4>>2]=903;k[ca+8>>2]=1781;Ac(Y,1100,ca)|0;zc(Y,da)|0}k[t+(E<<2)>>2]=k[(k[D>>2]|0)+(c<<2)>>2];k[t+(F<<2)>>2]=k[Z+((l[1831+(s<<2)+3>>0]|0)<<2)>>2];qa=(wb(M,I)|0)+c|0;ra=qa-W|0;c=ra>>31;c=c&qa|ra&~c;if((k[V>>2]|0)>>>0<=c>>>0){k[ea>>2]=1154;k[ea+4>>2]=903;k[ea+8>>2]=1781;Ac(Y,1100,ea)|0;zc(Y,ga)|0}k[t+(G<<2)>>2]=k[(k[D>>2]|0)+(c<<2)>>2]}m=m+w|0;if((m|0)==(y|0))break;else t=t+v|0}}A=A+1|0;if((A|0)==(h|0))break;else z=z+L|0}}C=C+1|0}while((C|0)!=(B|0));r=pa;return 1}function Nb(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0;qa=r;r=r+640|0;na=qa+88|0;ma=qa+72|0;la=qa+64|0;ka=qa+48|0;ja=qa+40|0;pa=qa+24|0;oa=qa+16|0;ia=qa;ga=qa+128|0;ha=qa+112|0;fa=qa+96|0;S=a+240|0;T=k[S>>2]|0;W=a+256|0;ca=k[W>>2]|0;da=a+272|0;ea=k[da>>2]|0;c=k[a+88>>2]|0;U=(l[c+63>>0]|0)<<8|(l[c+64>>0]|0);c=i[c+17>>0]|0;if(!(c<<24>>24)){r=qa;return 1}V=(h|0)==0;X=h+-1|0;Y=d<<1;Z=a+92|0;_=a+116|0;$=g+-1|0;aa=a+212|0;ba=a+188|0;R=(e&1|0)==0;Q=(f&1|0)==0;K=a+288|0;L=a+284|0;M=a+252|0;N=a+140|0;O=a+236|0;P=a+164|0;I=a+268|0;J=$<<5;G=c&255;c=0;e=0;f=0;a=0;j=1;H=0;do{if(!V){E=k[b+(H<<2)>>2]|0;F=0;while(1){C=F&1;n=(C|0)==0;B=(C<<6^64)+-32|0;C=(C<<1^2)+-1|0;D=n?g:-1;o=n?0:$;if((o|0)!=(D|0)){A=Q|(F|0)!=(X|0);z=n?E:E+J|0;while(1){if((j|0)==1)j=wb(Z,_)|0|512;y=j&7;j=j>>>3;p=l[1823+y>>0]|0;n=0;do{w=(wb(Z,P)|0)+e|0;x=w-ea|0;e=x>>31;e=e&w|x&~e;if((k[da>>2]|0)>>>0<=e>>>0){k[ia>>2]=1154;k[ia+4>>2]=903;k[ia+8>>2]=1781;Ac(ga,1100,ia)|0;zc(ga,oa)|0}k[fa+(n<<2)>>2]=m[(k[I>>2]|0)+(e<<1)>>1];n=n+1|0}while(n>>>0<p>>>0);n=0;do{w=(wb(Z,N)|0)+a|0;x=w-T|0;a=x>>31;a=a&w|x&~a;if((k[S>>2]|0)>>>0<=a>>>0){k[pa>>2]=1154;k[pa+4>>2]=903;k[pa+8>>2]=1781;Ac(ga,1100,pa)|0;zc(ga,ja)|0}k[ha+(n<<2)>>2]=k[(k[O>>2]|0)+(a<<2)>>2];n=n+1|0}while(n>>>0<p>>>0);x=R|(o|0)!=($|0);v=0;w=z;while(1){u=A|(v|0)==0;t=v<<1;q=0;s=w;while(1){p=(wb(Z,aa)|0)+c|0;n=p-U|0;c=n>>31;c=c&p|n&~c;n=(wb(Z,ba)|0)+f|0;p=n-ca|0;f=p>>31;f=f&n|p&~f;if((x|(q|0)==0)&u){n=l[q+t+(1831+(y<<2))>>0]|0;p=c*3|0;if((k[K>>2]|0)>>>0<=p>>>0){k[ka>>2]=1154;k[ka+4>>2]=903;k[ka+8>>2]=1781;Ac(ga,1100,ka)|0;zc(ga,la)|0}ra=k[L>>2]|0;k[s>>2]=(m[ra+(p<<1)>>1]|0)<<16|k[fa+(n<<2)>>2];k[s+4>>2]=(m[ra+(p+2<<1)>>1]|0)<<16|(m[ra+(p+1<<1)>>1]|0);k[s+8>>2]=k[ha+(n<<2)>>2];if((k[W>>2]|0)>>>0<=f>>>0){k[ma>>2]=1154;k[ma+4>>2]=903;k[ma+8>>2]=1781;Ac(ga,1100,ma)|0;zc(ga,na)|0}k[s+12>>2]=k[(k[M>>2]|0)+(f<<2)>>2]}q=q+1|0;if((q|0)==2)break;else s=s+16|0}v=v+1|0;if((v|0)==2)break;else w=w+d|0}o=o+C|0;if((o|0)==(D|0))break;else z=z+B|0}}F=F+1|0;if((F|0)==(h|0))break;else E=E+Y|0}}H=H+1|0}while((H|0)!=(G|0));r=qa;return 1}function Ob(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;ca=r;r=r+608|0;$=ca+64|0;_=ca+48|0;Z=ca+40|0;ba=ca+24|0;aa=ca+16|0;Y=ca;X=ca+88|0;W=ca+72|0;M=a+272|0;N=k[M>>2]|0;c=k[a+88>>2]|0;O=(l[c+63>>0]|0)<<8|(l[c+64>>0]|0);c=i[c+17>>0]|0;if(!(c<<24>>24)){r=ca;return 1}P=(h|0)==0;Q=h+-1|0;R=d<<1;S=a+92|0;T=a+116|0;U=g+-1|0;V=a+212|0;L=(f&1|0)==0;I=a+288|0;J=a+284|0;K=a+164|0;G=a+268|0;H=U<<4;F=c&255;E=(e&1|0)!=0;c=0;f=0;a=1;D=0;do{if(!P){B=k[b+(D<<2)>>2]|0;C=0;while(1){z=C&1;e=(z|0)==0;y=(z<<5^32)+-16|0;z=(z<<1^2)+-1|0;A=e?g:-1;j=e?0:U;if((j|0)!=(A|0)){x=L|(C|0)!=(Q|0);w=e?B:B+H|0;while(1){if((a|0)==1)a=wb(S,T)|0|512;v=a&7;a=a>>>3;n=l[1823+v>>0]|0;e=0;do{t=(wb(S,K)|0)+f|0;u=t-N|0;f=u>>31;f=f&t|u&~f;if((k[M>>2]|0)>>>0<=f>>>0){k[Y>>2]=1154;k[Y+4>>2]=903;k[Y+8>>2]=1781;Ac(X,1100,Y)|0;zc(X,aa)|0}k[W+(e<<2)>>2]=m[(k[G>>2]|0)+(f<<1)>>1];e=e+1|0}while(e>>>0<n>>>0);u=(j|0)==(U|0)&E;s=0;t=w;while(1){q=x|(s|0)==0;p=s<<1;e=(wb(S,V)|0)+c|0;o=e-O|0;n=o>>31;n=n&e|o&~n;if(q){c=l[1831+(v<<2)+p>>0]|0;e=n*3|0;if((k[I>>2]|0)>>>0<=e>>>0){k[ba>>2]=1154;k[ba+4>>2]=903;k[ba+8>>2]=1781;Ac(X,1100,ba)|0;zc(X,Z)|0}o=k[J>>2]|0;k[t>>2]=(m[o+(e<<1)>>1]|0)<<16|k[W+(c<<2)>>2];k[t+4>>2]=(m[o+(e+2<<1)>>1]|0)<<16|(m[o+(e+1<<1)>>1]|0)}o=t+8|0;e=(wb(S,V)|0)+n|0;n=e-O|0;c=n>>31;c=c&e|n&~c;if(!(u|q^1)){e=l[(p|1)+(1831+(v<<2))>>0]|0;n=c*3|0;if((k[I>>2]|0)>>>0<=n>>>0){k[_>>2]=1154;k[_+4>>2]=903;k[_+8>>2]=1781;Ac(X,1100,_)|0;zc(X,$)|0}q=k[J>>2]|0;k[o>>2]=(m[q+(n<<1)>>1]|0)<<16|k[W+(e<<2)>>2];k[t+12>>2]=(m[q+(n+2<<1)>>1]|0)<<16|(m[q+(n+1<<1)>>1]|0)}s=s+1|0;if((s|0)==2)break;else t=t+d|0}j=j+z|0;if((j|0)==(A|0))break;else w=w+y|0}}C=C+1|0;if((C|0)==(h|0))break;else B=B+R|0}}D=D+1|0}while((D|0)!=(F|0));r=ca;return 1}function Pb(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,n=0,o=0,p=0,q=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0;la=r;r=r+640|0;ia=la+88|0;ha=la+72|0;ga=la+64|0;fa=la+48|0;ea=la+40|0;ka=la+24|0;ja=la+16|0;da=la;ca=la+128|0;aa=la+112|0;ba=la+96|0;S=a+272|0;T=k[S>>2]|0;c=k[a+88>>2]|0;U=(l[c+63>>0]|0)<<8|(l[c+64>>0]|0);c=i[c+17>>0]|0;if(!(c<<24>>24)){r=la;return 1}V=(h|0)==0;W=h+-1|0;X=d<<1;Y=a+92|0;Z=a+116|0;_=g+-1|0;$=a+212|0;R=(e&1|0)==0;Q=(f&1|0)==0;N=a+288|0;O=a+284|0;P=a+164|0;L=a+268|0;M=_<<5;J=c&255;c=0;e=0;f=0;a=0;j=1;K=0;do{if(!V){H=k[b+(K<<2)>>2]|0;I=0;while(1){F=I&1;n=(F|0)==0;E=(F<<6^64)+-32|0;F=(F<<1^2)+-1|0;G=n?g:-1;o=n?0:_;if((o|0)!=(G|0)){D=Q|(I|0)!=(W|0);C=n?H:H+M|0;while(1){if((j|0)==1)j=wb(Y,Z)|0|512;B=j&7;j=j>>>3;p=l[1823+B>>0]|0;n=0;do{z=(wb(Y,P)|0)+a|0;A=z-T|0;a=A>>31;a=a&z|A&~a;if((k[S>>2]|0)>>>0<=a>>>0){k[da>>2]=1154;k[da+4>>2]=903;k[da+8>>2]=1781;Ac(ca,1100,da)|0;zc(ca,ja)|0}k[aa+(n<<2)>>2]=m[(k[L>>2]|0)+(a<<1)>>1];n=n+1|0}while(n>>>0<p>>>0);n=0;do{z=(wb(Y,P)|0)+e|0;A=z-T|0;e=A>>31;e=e&z|A&~e;if((k[S>>2]|0)>>>0<=e>>>0){k[ka>>2]=1154;k[ka+4>>2]=903;k[ka+8>>2]=1781;Ac(ca,1100,ka)|0;zc(ca,ea)|0}k[ba+(n<<2)>>2]=m[(k[L>>2]|0)+(e<<1)>>1];n=n+1|0}while(n>>>0<p>>>0);A=R|(o|0)!=(_|0);y=0;z=C;while(1){x=D|(y|0)==0;w=y<<1;u=0;v=z;while(1){t=(wb(Y,$)|0)+f|0;s=t-U|0;f=s>>31;f=f&t|s&~f;s=(wb(Y,$)|0)+c|0;t=s-U|0;c=t>>31;c=c&s|t&~c;if((A|(u|0)==0)&x){s=l[u+w+(1831+(B<<2))>>0]|0;t=f*3|0;n=k[N>>2]|0;if(n>>>0<=t>>>0){k[fa>>2]=1154;k[fa+4>>2]=903;k[fa+8>>2]=1781;Ac(ca,1100,fa)|0;zc(ca,ga)|0;n=k[N>>2]|0}p=k[O>>2]|0;q=c*3|0;if(n>>>0>q>>>0)n=p;else{k[ha>>2]=1154;k[ha+4>>2]=903;k[ha+8>>2]=1781;Ac(ca,1100,ha)|0;zc(ca,ia)|0;n=k[O>>2]|0}k[v>>2]=(m[p+(t<<1)>>1]|0)<<16|k[aa+(s<<2)>>2];k[v+4>>2]=(m[p+(t+2<<1)>>1]|0)<<16|(m[p+(t+1<<1)>>1]|0);k[v+8>>2]=(m[n+(q<<1)>>1]|0)<<16|k[ba+(s<<2)>>2];k[v+12>>2]=(m[n+(q+2<<1)>>1]|0)<<16|(m[n+(q+1<<1)>>1]|0)}u=u+1|0;if((u|0)==2)break;else v=v+16|0}y=y+1|0;if((y|0)==2)break;else z=z+d|0}o=o+F|0;if((o|0)==(G|0))break;else C=C+E|0}}I=I+1|0;if((I|0)==(h|0))break;else H=H+X|0}}K=K+1|0}while((K|0)!=(J|0));r=la;return 1}function Qb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,j=0,l=0,m=0,n=0,o=0;o=r;r=r+608|0;n=o+88|0;m=o+72|0;j=o+64|0;h=o+48|0;f=o+40|0;g=o+24|0;e=o+16|0;d=o;l=o+96|0;k[a>>2]=0;b=a+284|0;c=k[b>>2]|0;if(c){if(!(c&7))$a[k[104>>2]&1](c,0,0,1,k[27]|0)|0;else{k[d>>2]=1154;k[d+4>>2]=2499;k[d+8>>2]=1516;Ac(l,1100,d)|0;zc(l,e)|0}k[b>>2]=0;k[a+288>>2]=0;k[a+292>>2]=0}i[a+296>>0]=0;b=a+268|0;c=k[b>>2]|0;if(c){if(!(c&7))$a[k[104>>2]&1](c,0,0,1,k[27]|0)|0;else{k[g>>2]=1154;k[g+4>>2]=2499;k[g+8>>2]=1516;Ac(l,1100,g)|0;zc(l,f)|0}k[b>>2]=0;k[a+272>>2]=0;k[a+276>>2]=0}i[a+280>>0]=0;b=a+252|0;c=k[b>>2]|0;if(c){if(!(c&7))$a[k[104>>2]&1](c,0,0,1,k[27]|0)|0;else{k[h>>2]=1154;k[h+4>>2]=2499;k[h+8>>2]=1516;Ac(l,1100,h)|0;zc(l,j)|0}k[b>>2]=0;k[a+256>>2]=0;k[a+260>>2]=0}i[a+264>>0]=0;b=a+236|0;c=k[b>>2]|0;if(!c){n=a+248|0;i[n>>0]=0;n=a+212|0;rb(n);n=a+188|0;rb(n);n=a+164|0;rb(n);n=a+140|0;rb(n);n=a+116|0;rb(n);r=o;return}if(!(c&7))$a[k[104>>2]&1](c,0,0,1,k[27]|0)|0;else{k[m>>2]=1154;k[m+4>>2]=2499;k[m+8>>2]=1516;Ac(l,1100,m)|0;zc(l,n)|0}k[b>>2]=0;k[a+240>>2]=0;k[a+244>>2]=0;n=a+248|0;i[n>>0]=0;n=a+212|0;rb(n);n=a+188|0;rb(n);n=a+164|0;rb(n);n=a+140|0;rb(n);n=a+116|0;rb(n);r=o;return}function Rb(a,b){a=a|0;b=b|0;var c=0;c=r;r=r+16|0;k[c>>2]=b;b=k[63]|0;Bc(b,a,c)|0;xc(10,b)|0;Na()}function Sb(){var a=0,b=0;a=r;r=r+16|0;if(!(Ha(200,2)|0)){b=Fa(k[49]|0)|0;r=a;return b|0}else Rb(2090,a);return 0}function Tb(a){a=a|0;Vc(a);return}function Ub(a){a=a|0;var b=0;b=r;r=r+16|0;Za[a&3]();Rb(2139,b)}function Vb(){var a=0,b=0;a=Sb()|0;if(((a|0)!=0?(b=k[a>>2]|0,(b|0)!=0):0)?(a=b+48|0,(k[a>>2]&-256|0)==1126902528?(k[a+4>>2]|0)==1129074247:0):0)Ub(k[b+12>>2]|0);b=k[28]|0;k[28]=b+0;Ub(b)}function Wb(a){a=a|0;return}function Xb(a){a=a|0;return}function Yb(a){a=a|0;return}function Zb(a){a=a|0;return}function _b(a){a=a|0;Tb(a);return}function $b(a){a=a|0;Tb(a);return}function ac(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;g=r;r=r+64|0;f=g;if((a|0)!=(b|0))if((b|0)!=0?(e=ec(b,24,40,0)|0,(e|0)!=0):0){b=f;d=b+56|0;do{k[b>>2]=0;b=b+4|0}while((b|0)<(d|0));k[f>>2]=e;k[f+8>>2]=a;k[f+12>>2]=-1;k[f+48>>2]=1;ab[k[(k[e>>2]|0)+28>>2]&3](e,f,k[c>>2]|0,1);if((k[f+24>>2]|0)==1){k[c>>2]=k[f+16>>2];b=1}else b=0}else b=0;else b=1;r=g;return b|0}function bc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;a=b+16|0;e=k[a>>2]|0;do if(e){if((e|0)!=(c|0)){d=b+36|0;k[d>>2]=(k[d>>2]|0)+1;k[b+24>>2]=2;i[b+54>>0]=1;break}a=b+24|0;if((k[a>>2]|0)==2)k[a>>2]=d}else{k[a>>2]=c;k[b+24>>2]=d;k[b+36>>2]=1}while(0);return}function cc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if((a|0)==(k[b+8>>2]|0))bc(0,b,c,d);return}function dc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if((a|0)==(k[b+8>>2]|0))bc(0,b,c,d);else{a=k[a+8>>2]|0;ab[k[(k[a>>2]|0)+28>>2]&3](a,b,c,d)}return}function ec(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,l=0,m=0,n=0,o=0,p=0,q=0;q=r;r=r+64|0;p=q;o=k[a>>2]|0;n=a+(k[o+-8>>2]|0)|0;o=k[o+-4>>2]|0;k[p>>2]=c;k[p+4>>2]=a;k[p+8>>2]=b;k[p+12>>2]=d;d=p+16|0;a=p+20|0;b=p+24|0;e=p+28|0;f=p+32|0;g=p+40|0;h=(o|0)==(c|0);l=d;m=l+36|0;do{k[l>>2]=0;l=l+4|0}while((l|0)<(m|0));j[d+36>>1]=0;i[d+38>>0]=0;a:do if(h){k[p+48>>2]=1;_a[k[(k[c>>2]|0)+20>>2]&3](c,p,n,n,1,0);d=(k[b>>2]|0)==1?n:0}else{Va[k[(k[o>>2]|0)+24>>2]&3](o,p,n,1,0);switch(k[p+36>>2]|0){case 0:{d=(k[g>>2]|0)==1&(k[e>>2]|0)==1&(k[f>>2]|0)==1?k[a>>2]|0:0;break a}case 1:break;default:{d=0;break a}}if((k[b>>2]|0)!=1?!((k[g>>2]|0)==0&(k[e>>2]|0)==1&(k[f>>2]|0)==1):0){d=0;break}d=k[d>>2]|0}while(0);r=q;return d|0}function fc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;i[b+53>>0]=1;do if((k[b+4>>2]|0)==(d|0)){i[b+52>>0]=1;d=b+16|0;a=k[d>>2]|0;if(!a){k[d>>2]=c;k[b+24>>2]=e;k[b+36>>2]=1;if(!((e|0)==1?(k[b+48>>2]|0)==1:0))break;i[b+54>>0]=1;break}if((a|0)!=(c|0)){e=b+36|0;k[e>>2]=(k[e>>2]|0)+1;i[b+54>>0]=1;break}a=b+24|0;d=k[a>>2]|0;if((d|0)==2){k[a>>2]=e;d=e}if((d|0)==1?(k[b+48>>2]|0)==1:0)i[b+54>>0]=1}while(0);return}function gc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;a:do if((a|0)==(k[b+8>>2]|0)){if((k[b+4>>2]|0)==(c|0)?(f=b+28|0,(k[f>>2]|0)!=1):0)k[f>>2]=d}else{if((a|0)!=(k[b>>2]|0)){h=k[a+8>>2]|0;Va[k[(k[h>>2]|0)+24>>2]&3](h,b,c,d,e);break}if((k[b+16>>2]|0)!=(c|0)?(g=b+20|0,(k[g>>2]|0)!=(c|0)):0){k[b+32>>2]=d;d=b+44|0;if((k[d>>2]|0)==4)break;f=b+52|0;i[f>>0]=0;j=b+53|0;i[j>>0]=0;a=k[a+8>>2]|0;_a[k[(k[a>>2]|0)+20>>2]&3](a,b,c,c,1,e);if(i[j>>0]|0){if(!(i[f>>0]|0)){f=1;h=13}}else{f=0;h=13}do if((h|0)==13){k[g>>2]=c;j=b+40|0;k[j>>2]=(k[j>>2]|0)+1;if((k[b+36>>2]|0)==1?(k[b+24>>2]|0)==2:0){i[b+54>>0]=1;if(f)break}else h=16;if((h|0)==16?f:0)break;k[d>>2]=4;break a}while(0);k[d>>2]=3;break}if((d|0)==1)k[b+32>>2]=1}while(0);return}function hc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;do if((a|0)==(k[b+8>>2]|0)){if((k[b+4>>2]|0)==(c|0)?(g=b+28|0,(k[g>>2]|0)!=1):0)k[g>>2]=d}else if((a|0)==(k[b>>2]|0)){if((k[b+16>>2]|0)!=(c|0)?(f=b+20|0,(k[f>>2]|0)!=(c|0)):0){k[b+32>>2]=d;k[f>>2]=c;e=b+40|0;k[e>>2]=(k[e>>2]|0)+1;if((k[b+36>>2]|0)==1?(k[b+24>>2]|0)==2:0)i[b+54>>0]=1;k[b+44>>2]=4;break}if((d|0)==1)k[b+32>>2]=1}while(0);return}function ic(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if((a|0)==(k[b+8>>2]|0))fc(0,b,c,d,e);else{a=k[a+8>>2]|0;_a[k[(k[a>>2]|0)+20>>2]&3](a,b,c,d,e,f)}return}function jc(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if((a|0)==(k[b+8>>2]|0))fc(0,b,c,d,e);return}function kc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=r;r=r+16|0;d=e;k[d>>2]=k[c>>2];a=Ua[k[(k[a>>2]|0)+16>>2]&7](a,b,d)|0;if(a)k[c>>2]=k[d>>2];r=e;return a&1|0}function lc(a){a=a|0;if(!a)a=0;else a=(ec(a,24,72,0)|0)!=0;return a&1|0}function mc(){var a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0;e=r;r=r+48|0;g=e+32|0;c=e+24|0;h=e+16|0;f=e;e=e+36|0;a=Sb()|0;if((a|0)!=0?(d=k[a>>2]|0,(d|0)!=0):0){a=d+48|0;b=k[a>>2]|0;a=k[a+4>>2]|0;if(!((b&-256|0)==1126902528&(a|0)==1129074247)){k[c>>2]=k[51];Rb(2368,c)}if((b|0)==1126902529&(a|0)==1129074247)a=k[d+44>>2]|0;else a=d+80|0;k[e>>2]=a;d=k[d>>2]|0;a=k[d+4>>2]|0;if(Ua[k[(k[8>>2]|0)+16>>2]&7](8,d,e)|0){h=k[e>>2]|0;e=k[51]|0;h=Xa[k[(k[h>>2]|0)+8>>2]&1](h)|0;k[f>>2]=e;k[f+4>>2]=a;k[f+8>>2]=h;Rb(2282,f)}else{k[h>>2]=k[51];k[h+4>>2]=a;Rb(2327,h)}}Rb(2406,g)}function nc(){var a=0;a=r;r=r+16|0;if(!(Ia(196,6)|0)){r=a;return}else Rb(2179,a)}function oc(a){a=a|0;var b=0;b=r;r=r+16|0;Vc(a);if(!(La(k[49]|0,0)|0)){r=b;return}else Rb(2229,b)}function pc(a){a=a|0;var b=0,c=0;b=0;while(1){if((l[2427+b>>0]|0)==(a|0)){c=2;break}b=b+1|0;if((b|0)==87){b=87;a=2515;c=5;break}}if((c|0)==2)if(!b)a=2515;else{a=2515;c=5}if((c|0)==5)while(1){c=a;while(1){a=c+1|0;if(!(i[c>>0]|0))break;else c=a}b=b+-1|0;if(!b)break;else c=5}return a|0}function qc(){var a=0;if(!(k[52]|0))a=264;else{a=(Ga()|0)+60|0;a=k[a>>2]|0}return a|0}function rc(a){a=a|0;var b=0;if(a>>>0>4294963200){b=qc()|0;k[b>>2]=0-a;a=-1}return a|0}function sc(a,b){a=+a;b=b|0;var c=0,d=0,e=0;p[t>>3]=a;c=k[t>>2]|0;d=k[t+4>>2]|0;e=bd(c|0,d|0,52)|0;e=e&2047;switch(e|0){case 0:{if(a!=0.0){a=+sc(a*18446744073709552.0e3,b);c=(k[b>>2]|0)+-64|0}else c=0;k[b>>2]=c;break}case 2047:break;default:{k[b>>2]=e+-1022;k[t>>2]=c;k[t+4>>2]=d&-2146435073|1071644672;a=+p[t>>3]}}return +a}function tc(a,b){a=+a;b=b|0;return +(+sc(a,b))}function uc(a,b,c){a=a|0;b=b|0;c=c|0;do if(a){if(b>>>0<128){i[a>>0]=b;a=1;break}if(b>>>0<2048){i[a>>0]=b>>>6|192;i[a+1>>0]=b&63|128;a=2;break}if(b>>>0<55296|(b&-8192|0)==57344){i[a>>0]=b>>>12|224;i[a+1>>0]=b>>>6&63|128;i[a+2>>0]=b&63|128;a=3;break}if((b+-65536|0)>>>0<1048576){i[a>>0]=b>>>18|240;i[a+1>>0]=b>>>12&63|128;i[a+2>>0]=b>>>6&63|128;i[a+3>>0]=b&63|128;a=4;break}else{a=qc()|0;k[a>>2]=84;a=-1;break}}else a=1;while(0);return a|0}function vc(a,b){a=a|0;b=b|0;if(!a)a=0;else a=uc(a,b,0)|0;return a|0}function wc(a){a=a|0;var b=0,c=0;do if(a){if((k[a+76>>2]|0)<=-1){b=Nc(a)|0;break}c=(Ec(a)|0)==0;b=Nc(a)|0;if(!c)Fc(a)}else{if(!(k[65]|0))b=0;else b=wc(k[65]|0)|0;Ma(236);a=k[58]|0;if(a)do{if((k[a+76>>2]|0)>-1)c=Ec(a)|0;else c=0;if((k[a+20>>2]|0)>>>0>(k[a+28>>2]|0)>>>0)b=Nc(a)|0|b;if(c)Fc(a);a=k[a+56>>2]|0}while((a|0)!=0);Ja(236)}while(0);return b|0}function xc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;if((k[b+76>>2]|0)>=0?(Ec(b)|0)!=0:0){if((i[b+75>>0]|0)!=(a|0)?(d=b+20|0,e=k[d>>2]|0,e>>>0<(k[b+16>>2]|0)>>>0):0){k[d>>2]=e+1;i[e>>0]=a;c=a&255}else c=Gc(b,a)|0;Fc(b)}else g=3;do if((g|0)==3){if((i[b+75>>0]|0)!=(a|0)?(f=b+20|0,c=k[f>>2]|0,c>>>0<(k[b+16>>2]|0)>>>0):0){k[f>>2]=c+1;i[c>>0]=a;c=a&255;break}c=Gc(b,a)|0}while(0);return c|0}function yc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=c+16|0;e=k[d>>2]|0;if(!e)if(!(Lc(c)|0)){e=k[d>>2]|0;f=4}else d=0;else f=4;a:do if((f|0)==4){g=c+20|0;f=k[g>>2]|0;if((e-f|0)>>>0<b>>>0){d=Ua[k[c+36>>2]&7](c,a,b)|0;break}b:do if((i[c+75>>0]|0)>-1){d=b;while(1){if(!d){e=f;d=0;break b}e=d+-1|0;if((i[a+e>>0]|0)==10)break;else d=e}if((Ua[k[c+36>>2]&7](c,a,d)|0)>>>0<d>>>0)break a;b=b-d|0;a=a+d|0;e=k[g>>2]|0}else{e=f;d=0}while(0);ed(e|0,a|0,b|0)|0;k[g>>2]=(k[g>>2]|0)+b;d=d+b|0}while(0);return d|0}function zc(a,b){a=a|0;b=b|0;var c=0,d=0;c=r;r=r+16|0;d=c;k[d>>2]=b;b=Bc(k[64]|0,a,d)|0;r=c;return b|0}function Ac(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=r;r=r+16|0;e=d;k[e>>2]=c;c=Dc(a,b,e)|0;r=d;return c|0}function Bc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,s=0;s=r;r=r+224|0;n=s+120|0;q=s+80|0;p=s;o=s+136|0;d=q;e=d+40|0;do{k[d>>2]=0;d=d+4|0}while((d|0)<(e|0));k[n>>2]=k[c>>2];if((Oc(0,b,n,p,q)|0)<0)c=-1;else{if((k[a+76>>2]|0)>-1)l=Ec(a)|0;else l=0;c=k[a>>2]|0;m=c&32;if((i[a+74>>0]|0)<1)k[a>>2]=c&-33;c=a+48|0;if(!(k[c>>2]|0)){e=a+44|0;f=k[e>>2]|0;k[e>>2]=o;g=a+28|0;k[g>>2]=o;h=a+20|0;k[h>>2]=o;k[c>>2]=80;j=a+16|0;k[j>>2]=o+80;d=Oc(a,b,n,p,q)|0;if(f){Ua[k[a+36>>2]&7](a,0,0)|0;d=(k[h>>2]|0)==0?-1:d;k[e>>2]=f;k[c>>2]=0;k[j>>2]=0;k[g>>2]=0;k[h>>2]=0}}else d=Oc(a,b,n,p,q)|0;c=k[a>>2]|0;k[a>>2]=c|m;if(l)Fc(a);c=(c&32|0)==0?d:-1}r=s;return c|0}function Cc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,l=0,m=0;m=r;r=r+128|0;e=m+112|0;l=m;f=l;g=268;h=f+112|0;do{k[f>>2]=k[g>>2];f=f+4|0;g=g+4|0}while((f|0)<(h|0));if((b+-1|0)>>>0>2147483646)if(!b){b=1;j=4}else{b=qc()|0;k[b>>2]=75;b=-1}else{e=a;j=4}if((j|0)==4){j=-2-e|0;j=b>>>0>j>>>0?j:b;k[l+48>>2]=j;a=l+20|0;k[a>>2]=e;k[l+44>>2]=e;b=e+j|0;e=l+16|0;k[e>>2]=b;k[l+28>>2]=b;b=Bc(l,c,d)|0;if(j){c=k[a>>2]|0;i[c+(((c|0)==(k[e>>2]|0))<<31>>31)>>0]=0}}r=m;return b|0}function Dc(a,b,c){a=a|0;b=b|0;c=c|0;return Cc(a,2147483647,b,c)|0}function Ec(a){a=a|0;return 0}function Fc(a){a=a|0;return}function Gc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,j=0;j=r;r=r+16|0;h=j;g=b&255;i[h>>0]=g;d=a+16|0;e=k[d>>2]|0;if(!e)if(!(Lc(a)|0)){e=k[d>>2]|0;f=4}else c=-1;else f=4;do if((f|0)==4){d=a+20|0;f=k[d>>2]|0;if(f>>>0<e>>>0?(c=b&255,(c|0)!=(i[a+75>>0]|0)):0){k[d>>2]=f+1;i[f>>0]=g;break}if((Ua[k[a+36>>2]&7](a,h,1)|0)==1)c=l[h>>0]|0;else c=-1}while(0);r=j;return c|0}function Hc(a){a=a|0;var b=0,c=0;b=r;r=r+16|0;c=b;k[c>>2]=k[a+60>>2];a=rc(xa(6,c|0)|0)|0;r=b;return a|0}function Ic(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;e=r;r=r+32|0;f=e;d=e+20|0;k[f>>2]=k[a+60>>2];k[f+4>>2]=0;k[f+8>>2]=b;k[f+12>>2]=d;k[f+16>>2]=c;if((rc(Qa(140,f|0)|0)|0)<0){k[d>>2]=-1;a=-1}else a=k[d>>2]|0;r=e;return a|0}function Jc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0;p=r;r=r+48|0;m=p+16|0;l=p;d=p+32|0;n=a+28|0;e=k[n>>2]|0;k[d>>2]=e;o=a+20|0;e=(k[o>>2]|0)-e|0;k[d+4>>2]=e;k[d+8>>2]=b;k[d+12>>2]=c;i=a+60|0;j=a+44|0;b=2;e=e+c|0;while(1){if(!(k[52]|0)){k[m>>2]=k[i>>2];k[m+4>>2]=d;k[m+8>>2]=b;g=rc(Ra(146,m|0)|0)|0}else{Oa(7,a|0);k[l>>2]=k[i>>2];k[l+4>>2]=d;k[l+8>>2]=b;g=rc(Ra(146,l|0)|0)|0;va(0)}if((e|0)==(g|0)){e=6;break}if((g|0)<0){e=8;break}e=e-g|0;f=k[d+4>>2]|0;if(g>>>0<=f>>>0)if((b|0)==2){k[n>>2]=(k[n>>2]|0)+g;h=f;b=2}else h=f;else{h=k[j>>2]|0;k[n>>2]=h;k[o>>2]=h;h=k[d+12>>2]|0;g=g-f|0;d=d+8|0;b=b+-1|0}k[d>>2]=(k[d>>2]|0)+g;k[d+4>>2]=h-g}if((e|0)==6){m=k[j>>2]|0;k[a+16>>2]=m+(k[a+48>>2]|0);a=m;k[n>>2]=a;k[o>>2]=a}else if((e|0)==8){k[a+16>>2]=0;k[n>>2]=0;k[o>>2]=0;k[a>>2]=k[a>>2]|32;if((b|0)==2)c=0;else c=c-(k[d+4>>2]|0)|0}r=p;return c|0}function Kc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=r;r=r+80|0;d=e;k[a+36>>2]=3;if((k[a>>2]&64|0)==0?(k[d>>2]=k[a+60>>2],k[d+4>>2]=21505,k[d+8>>2]=e+12,(wa(54,d|0)|0)!=0):0)i[a+75>>0]=-1;d=Jc(a,b,c)|0;r=e;return d|0}function Lc(a){a=a|0;var b=0,c=0;b=a+74|0;c=i[b>>0]|0;i[b>>0]=c+255|c;b=k[a>>2]|0;if(!(b&8)){k[a+8>>2]=0;k[a+4>>2]=0;b=k[a+44>>2]|0;k[a+28>>2]=b;k[a+20>>2]=b;k[a+16>>2]=b+(k[a+48>>2]|0);b=0}else{k[a>>2]=b|32;b=-1}return b|0}function Mc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;f=b&255;d=(c|0)!=0;a:do if(d&(a&3|0)!=0){e=b&255;while(1){if((i[a>>0]|0)==e<<24>>24){g=6;break a}a=a+1|0;c=c+-1|0;d=(c|0)!=0;if(!(d&(a&3|0)!=0)){g=5;break}}}else g=5;while(0);if((g|0)==5)if(d)g=6;else c=0;b:do if((g|0)==6){e=b&255;if((i[a>>0]|0)!=e<<24>>24){d=ha(f,16843009)|0;c:do if(c>>>0>3)while(1){f=k[a>>2]^d;if((f&-2139062144^-2139062144)&f+-16843009)break;a=a+4|0;c=c+-4|0;if(c>>>0<=3){g=11;break c}}else g=11;while(0);if((g|0)==11)if(!c){c=0;break}while(1){if((i[a>>0]|0)==e<<24>>24)break b;a=a+1|0;c=c+-1|0;if(!c){c=0;break}}}}while(0);return ((c|0)!=0?a:0)|0}function Nc(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;b=a+20|0;f=a+28|0;if((k[b>>2]|0)>>>0>(k[f>>2]|0)>>>0?(Ua[k[a+36>>2]&7](a,0,0)|0,(k[b>>2]|0)==0):0)b=-1;else{g=a+4|0;c=k[g>>2]|0;d=a+8|0;e=k[d>>2]|0;if(c>>>0<e>>>0)Ua[k[a+40>>2]&7](a,c-e|0,1)|0;k[a+16>>2]=0;k[f>>2]=0;k[b>>2]=0;k[d>>2]=0;k[g>>2]=0;b=0}return b|0}function Oc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,m=0,n=0.0,o=0,q=0,s=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0;ga=r;r=r+624|0;ba=ga+24|0;da=ga+16|0;ca=ga+588|0;Y=ga+576|0;aa=ga;V=ga+536|0;fa=ga+8|0;ea=ga+528|0;M=(a|0)!=0;N=V+40|0;U=N;V=V+39|0;W=fa+4|0;X=Y+12|0;Y=Y+11|0;Z=ca;_=X;$=_-Z|0;O=-2-Z|0;P=_+2|0;Q=ba+288|0;R=ca+9|0;S=R;T=ca+8|0;f=0;w=b;g=0;b=0;a:while(1){do if((f|0)>-1)if((g|0)>(2147483647-f|0)){f=qc()|0;k[f>>2]=75;f=-1;break}else{f=g+f|0;break}while(0);g=i[w>>0]|0;if(!(g<<24>>24)){K=245;break}else h=w;b:while(1){switch(g<<24>>24){case 37:{g=h;K=9;break b}case 0:{g=h;break b}default:{}}J=h+1|0;g=i[J>>0]|0;h=J}c:do if((K|0)==9)while(1){K=0;if((i[g+1>>0]|0)!=37)break c;h=h+1|0;g=g+2|0;if((i[g>>0]|0)==37)K=9;else break}while(0);y=h-w|0;if(M?(k[a>>2]&32|0)==0:0)yc(w,y,a)|0;if((h|0)!=(w|0)){w=g;g=y;continue}o=g+1|0;h=i[o>>0]|0;m=(h<<24>>24)+-48|0;if(m>>>0<10){J=(i[g+2>>0]|0)==36;o=J?g+3|0:o;h=i[o>>0]|0;u=J?m:-1;b=J?1:b}else u=-1;g=h<<24>>24;d:do if((g&-32|0)==32){m=0;while(1){if(!(1<<g+-32&75913)){q=m;g=o;break d}m=1<<(h<<24>>24)+-32|m;o=o+1|0;h=i[o>>0]|0;g=h<<24>>24;if((g&-32|0)!=32){q=m;g=o;break}}}else{q=0;g=o}while(0);do if(h<<24>>24==42){m=g+1|0;h=(i[m>>0]|0)+-48|0;if(h>>>0<10?(i[g+2>>0]|0)==36:0){k[e+(h<<2)>>2]=10;b=1;g=g+3|0;h=k[d+((i[m>>0]|0)+-48<<3)>>2]|0}else{if(b){f=-1;break a}if(!M){x=q;g=m;b=0;J=0;break}b=(k[c>>2]|0)+(4-1)&~(4-1);h=k[b>>2]|0;k[c>>2]=b+4;b=0;g=m}if((h|0)<0){x=q|8192;J=0-h|0}else{x=q;J=h}}else{m=(h<<24>>24)+-48|0;if(m>>>0<10){h=0;do{h=(h*10|0)+m|0;g=g+1|0;m=(i[g>>0]|0)+-48|0}while(m>>>0<10);if((h|0)<0){f=-1;break a}else{x=q;J=h}}else{x=q;J=0}}while(0);e:do if((i[g>>0]|0)==46){m=g+1|0;h=i[m>>0]|0;if(h<<24>>24!=42){o=(h<<24>>24)+-48|0;if(o>>>0<10){g=m;h=0}else{g=m;o=0;break}while(1){h=(h*10|0)+o|0;g=g+1|0;o=(i[g>>0]|0)+-48|0;if(o>>>0>=10){o=h;break e}}}m=g+2|0;h=(i[m>>0]|0)+-48|0;if(h>>>0<10?(i[g+3>>0]|0)==36:0){k[e+(h<<2)>>2]=10;g=g+4|0;o=k[d+((i[m>>0]|0)+-48<<3)>>2]|0;break}if(b){f=-1;break a}if(M){g=(k[c>>2]|0)+(4-1)&~(4-1);o=k[g>>2]|0;k[c>>2]=g+4;g=m}else{g=m;o=0}}else o=-1;while(0);s=0;while(1){h=(i[g>>0]|0)+-65|0;if(h>>>0>57){f=-1;break a}m=g+1|0;h=i[5359+(s*58|0)+h>>0]|0;q=h&255;if((q+-1|0)>>>0<8){g=m;s=q}else{I=m;break}}if(!(h<<24>>24)){f=-1;break}m=(u|0)>-1;do if(h<<24>>24==19)if(m){f=-1;break a}else K=52;else{if(m){k[e+(u<<2)>>2]=q;G=d+(u<<3)|0;H=k[G+4>>2]|0;K=aa;k[K>>2]=k[G>>2];k[K+4>>2]=H;K=52;break}if(!M){f=0;break a}Rc(aa,q,c)}while(0);if((K|0)==52?(K=0,!M):0){w=I;g=y;continue}u=i[g>>0]|0;u=(s|0)!=0&(u&15|0)==3?u&-33:u;m=x&-65537;H=(x&8192|0)==0?x:m;f:do switch(u|0){case 110:switch(s|0){case 0:{k[k[aa>>2]>>2]=f;w=I;g=y;continue a}case 1:{k[k[aa>>2]>>2]=f;w=I;g=y;continue a}case 2:{w=k[aa>>2]|0;k[w>>2]=f;k[w+4>>2]=((f|0)<0)<<31>>31;w=I;g=y;continue a}case 3:{j[k[aa>>2]>>1]=f;w=I;g=y;continue a}case 4:{i[k[aa>>2]>>0]=f;w=I;g=y;continue a}case 6:{k[k[aa>>2]>>2]=f;w=I;g=y;continue a}case 7:{w=k[aa>>2]|0;k[w>>2]=f;k[w+4>>2]=((f|0)<0)<<31>>31;w=I;g=y;continue a}default:{w=I;g=y;continue a}}case 112:{s=H|8;o=o>>>0>8?o:8;u=120;K=64;break}case 88:case 120:{s=H;K=64;break}case 111:{m=aa;h=k[m>>2]|0;m=k[m+4>>2]|0;if((h|0)==0&(m|0)==0)g=N;else{g=N;do{g=g+-1|0;i[g>>0]=h&7|48;h=bd(h|0,m|0,3)|0;m=L}while(!((h|0)==0&(m|0)==0))}if(!(H&8)){h=H;s=0;q=5839;K=77}else{s=U-g+1|0;h=H;o=(o|0)<(s|0)?s:o;s=0;q=5839;K=77}break}case 105:case 100:{h=aa;g=k[h>>2]|0;h=k[h+4>>2]|0;if((h|0)<0){g=$c(0,0,g|0,h|0)|0;h=L;m=aa;k[m>>2]=g;k[m+4>>2]=h;m=1;q=5839;K=76;break f}if(!(H&2048)){q=H&1;m=q;q=(q|0)==0?5839:5841;K=76}else{m=1;q=5840;K=76}break}case 117:{h=aa;g=k[h>>2]|0;h=k[h+4>>2]|0;m=0;q=5839;K=76;break}case 99:{i[V>>0]=k[aa>>2];w=V;h=1;s=0;u=5839;g=N;break}case 109:{g=qc()|0;g=pc(k[g>>2]|0)|0;K=82;break}case 115:{g=k[aa>>2]|0;g=(g|0)!=0?g:5849;K=82;break}case 67:{k[fa>>2]=k[aa>>2];k[W>>2]=0;k[aa>>2]=fa;o=-1;K=86;break}case 83:{if(!o){Tc(a,32,J,0,H);g=0;K=98}else K=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{n=+p[aa>>3];k[da>>2]=0;p[t>>3]=n;if((k[t+4>>2]|0)>=0)if(!(H&2048)){G=H&1;F=G;G=(G|0)==0?5857:5862}else{F=1;G=5859}else{n=-n;F=1;G=5856}p[t>>3]=n;E=k[t+4>>2]&2146435072;do if(E>>>0<2146435072|(E|0)==2146435072&0<0){v=+tc(n,da)*2.0;h=v!=0.0;if(h)k[da>>2]=(k[da>>2]|0)+-1;C=u|32;if((C|0)==97){w=u&32;y=(w|0)==0?G:G+9|0;x=F|2;g=12-o|0;do if(!(o>>>0>11|(g|0)==0)){n=8.0;do{g=g+-1|0;n=n*16.0}while((g|0)!=0);if((i[y>>0]|0)==45){n=-(n+(-v-n));break}else{n=v+n-n;break}}else n=v;while(0);h=k[da>>2]|0;g=(h|0)<0?0-h|0:h;g=Sc(g,((g|0)<0)<<31>>31,X)|0;if((g|0)==(X|0)){i[Y>>0]=48;g=Y}i[g+-1>>0]=(h>>31&2)+43;s=g+-2|0;i[s>>0]=u+15;q=(o|0)<1;m=(H&8|0)==0;h=ca;while(1){G=~~n;g=h+1|0;i[h>>0]=l[5823+G>>0]|w;n=(n-+(G|0))*16.0;do if((g-Z|0)==1){if(m&(q&n==0.0))break;i[g>>0]=46;g=h+2|0}while(0);if(!(n!=0.0))break;else h=g}o=(o|0)!=0&(O+g|0)<(o|0)?P+o-s|0:$-s+g|0;m=o+x|0;Tc(a,32,J,m,H);if(!(k[a>>2]&32))yc(y,x,a)|0;Tc(a,48,J,m,H^65536);g=g-Z|0;if(!(k[a>>2]&32))yc(ca,g,a)|0;h=_-s|0;Tc(a,48,o-(g+h)|0,0,0);if(!(k[a>>2]&32))yc(s,h,a)|0;Tc(a,32,J,m,H^8192);g=(m|0)<(J|0)?J:m;break}g=(o|0)<0?6:o;if(h){h=(k[da>>2]|0)+-28|0;k[da>>2]=h;n=v*268435456.0}else{n=v;h=k[da>>2]|0}E=(h|0)<0?ba:Q;D=E;h=E;do{B=~~n>>>0;k[h>>2]=B;h=h+4|0;n=(n-+(B>>>0))*1.0e9}while(n!=0.0);m=h;h=k[da>>2]|0;if((h|0)>0){q=E;while(1){s=(h|0)>29?29:h;o=m+-4|0;do if(o>>>0<q>>>0)o=q;else{h=0;do{B=cd(k[o>>2]|0,0,s|0)|0;B=dd(B|0,L|0,h|0,0)|0;h=L;A=md(B|0,h|0,1e9,0)|0;k[o>>2]=A;h=ld(B|0,h|0,1e9,0)|0;o=o+-4|0}while(o>>>0>=q>>>0);if(!h){o=q;break}o=q+-4|0;k[o>>2]=h}while(0);while(1){if(m>>>0<=o>>>0)break;h=m+-4|0;if(!(k[h>>2]|0))m=h;else break}h=(k[da>>2]|0)-s|0;k[da>>2]=h;if((h|0)>0)q=o;else break}}else o=E;if((h|0)<0){y=((g+25|0)/9|0)+1|0;z=(C|0)==102;w=o;while(1){x=0-h|0;x=(x|0)>9?9:x;do if(w>>>0<m>>>0){h=(1<<x)+-1|0;q=1e9>>>x;o=0;s=w;do{B=k[s>>2]|0;k[s>>2]=(B>>>x)+o;o=ha(B&h,q)|0;s=s+4|0}while(s>>>0<m>>>0);h=(k[w>>2]|0)==0?w+4|0:w;if(!o){o=h;break}k[m>>2]=o;o=h;m=m+4|0}else o=(k[w>>2]|0)==0?w+4|0:w;while(0);h=z?E:o;m=(m-h>>2|0)>(y|0)?h+(y<<2)|0:m;h=(k[da>>2]|0)+x|0;k[da>>2]=h;if((h|0)>=0){w=o;break}else w=o}}else w=o;do if(w>>>0<m>>>0){h=(D-w>>2)*9|0;q=k[w>>2]|0;if(q>>>0<10)break;else o=10;do{o=o*10|0;h=h+1|0}while(q>>>0>=o>>>0)}else h=0;while(0);A=(C|0)==103;B=(g|0)!=0;o=g-((C|0)!=102?h:0)+((B&A)<<31>>31)|0;if((o|0)<(((m-D>>2)*9|0)+-9|0)){s=o+9216|0;z=(s|0)/9|0;o=E+(z+-1023<<2)|0;s=((s|0)%9|0)+1|0;if((s|0)<9){q=10;do{q=q*10|0;s=s+1|0}while((s|0)!=9)}else q=10;x=k[o>>2]|0;y=(x>>>0)%(q>>>0)|0;if((y|0)==0?(E+(z+-1022<<2)|0)==(m|0):0)q=w;else K=163;do if((K|0)==163){K=0;v=(((x>>>0)/(q>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;s=(q|0)/2|0;do if(y>>>0<s>>>0)n=.5;else{if((y|0)==(s|0)?(E+(z+-1022<<2)|0)==(m|0):0){n=1.0;break}n=1.5}while(0);do if(F){if((i[G>>0]|0)!=45)break;v=-v;n=-n}while(0);s=x-y|0;k[o>>2]=s;if(!(v+n!=v)){q=w;break}C=s+q|0;k[o>>2]=C;if(C>>>0>999999999){h=w;while(1){q=o+-4|0;k[o>>2]=0;if(q>>>0<h>>>0){h=h+-4|0;k[h>>2]=0}C=(k[q>>2]|0)+1|0;k[q>>2]=C;if(C>>>0>999999999)o=q;else{w=h;o=q;break}}}h=(D-w>>2)*9|0;s=k[w>>2]|0;if(s>>>0<10){q=w;break}else q=10;do{q=q*10|0;h=h+1|0}while(s>>>0>=q>>>0);q=w}while(0);C=o+4|0;w=q;m=m>>>0>C>>>0?C:m}y=0-h|0;while(1){if(m>>>0<=w>>>0){z=0;C=m;break}o=m+-4|0;if(!(k[o>>2]|0))m=o;else{z=1;C=m;break}}do if(A){g=(B&1^1)+g|0;if((g|0)>(h|0)&(h|0)>-5){u=u+-1|0;g=g+-1-h|0}else{u=u+-2|0;g=g+-1|0}m=H&8;if(m)break;do if(z){m=k[C+-4>>2]|0;if(!m){o=9;break}if(!((m>>>0)%10|0)){q=10;o=0}else{o=0;break}do{q=q*10|0;o=o+1|0}while(((m>>>0)%(q>>>0)|0|0)==0)}else o=9;while(0);m=((C-D>>2)*9|0)+-9|0;if((u|32|0)==102){m=m-o|0;m=(m|0)<0?0:m;g=(g|0)<(m|0)?g:m;m=0;break}else{m=m+h-o|0;m=(m|0)<0?0:m;g=(g|0)<(m|0)?g:m;m=0;break}}else m=H&8;while(0);x=g|m;q=(x|0)!=0&1;s=(u|32|0)==102;if(s){h=(h|0)>0?h:0;u=0}else{o=(h|0)<0?y:h;o=Sc(o,((o|0)<0)<<31>>31,X)|0;if((_-o|0)<2)do{o=o+-1|0;i[o>>0]=48}while((_-o|0)<2);i[o+-1>>0]=(h>>31&2)+43;D=o+-2|0;i[D>>0]=u;h=_-D|0;u=D}y=F+1+g+q+h|0;Tc(a,32,J,y,H);if(!(k[a>>2]&32))yc(G,F,a)|0;Tc(a,48,J,y,H^65536);do if(s){o=w>>>0>E>>>0?E:w;h=o;do{m=Sc(k[h>>2]|0,0,R)|0;do if((h|0)==(o|0)){if((m|0)!=(R|0))break;i[T>>0]=48;m=T}else{if(m>>>0<=ca>>>0)break;do{m=m+-1|0;i[m>>0]=48}while(m>>>0>ca>>>0)}while(0);if(!(k[a>>2]&32))yc(m,S-m|0,a)|0;h=h+4|0}while(h>>>0<=E>>>0);do if(x){if(k[a>>2]&32)break;yc(5891,1,a)|0}while(0);if((g|0)>0&h>>>0<C>>>0){m=h;while(1){h=Sc(k[m>>2]|0,0,R)|0;if(h>>>0>ca>>>0)do{h=h+-1|0;i[h>>0]=48}while(h>>>0>ca>>>0);if(!(k[a>>2]&32))yc(h,(g|0)>9?9:g,a)|0;m=m+4|0;h=g+-9|0;if(!((g|0)>9&m>>>0<C>>>0)){g=h;break}else g=h}}Tc(a,48,g+9|0,9,0)}else{s=z?C:w+4|0;if((g|0)>-1){q=(m|0)==0;o=w;do{h=Sc(k[o>>2]|0,0,R)|0;if((h|0)==(R|0)){i[T>>0]=48;h=T}do if((o|0)==(w|0)){m=h+1|0;if(!(k[a>>2]&32))yc(h,1,a)|0;if(q&(g|0)<1){h=m;break}if(k[a>>2]&32){h=m;break}yc(5891,1,a)|0;h=m}else{if(h>>>0<=ca>>>0)break;do{h=h+-1|0;i[h>>0]=48}while(h>>>0>ca>>>0)}while(0);m=S-h|0;if(!(k[a>>2]&32))yc(h,(g|0)>(m|0)?m:g,a)|0;g=g-m|0;o=o+4|0}while(o>>>0<s>>>0&(g|0)>-1)}Tc(a,48,g+18|0,18,0);if(k[a>>2]&32)break;yc(u,_-u|0,a)|0}while(0);Tc(a,32,J,y,H^8192);g=(y|0)<(J|0)?J:y}else{s=(u&32|0)!=0;q=n!=n|0.0!=0.0;h=q?0:F;o=h+3|0;Tc(a,32,J,o,m);g=k[a>>2]|0;if(!(g&32)){yc(G,h,a)|0;g=k[a>>2]|0}if(!(g&32))yc(q?(s?5883:5887):s?5875:5879,3,a)|0;Tc(a,32,J,o,H^8192);g=(o|0)<(J|0)?J:o}while(0);w=I;continue a}default:{m=H;h=o;s=0;u=5839;g=N}}while(0);g:do if((K|0)==64){m=aa;h=k[m>>2]|0;m=k[m+4>>2]|0;q=u&32;if(!((h|0)==0&(m|0)==0)){g=N;do{g=g+-1|0;i[g>>0]=l[5823+(h&15)>>0]|q;h=bd(h|0,m|0,4)|0;m=L}while(!((h|0)==0&(m|0)==0));K=aa;if((s&8|0)==0|(k[K>>2]|0)==0&(k[K+4>>2]|0)==0){h=s;s=0;q=5839;K=77}else{h=s;s=2;q=5839+(u>>4)|0;K=77}}else{g=N;h=s;s=0;q=5839;K=77}}else if((K|0)==76){g=Sc(g,h,N)|0;h=H;s=m;K=77}else if((K|0)==82){K=0;H=Mc(g,0,o)|0;G=(H|0)==0;w=g;h=G?o:H-g|0;s=0;u=5839;g=G?g+o|0:H}else if((K|0)==86){K=0;h=0;g=0;q=k[aa>>2]|0;while(1){m=k[q>>2]|0;if(!m)break;g=vc(ea,m)|0;if((g|0)<0|g>>>0>(o-h|0)>>>0)break;h=g+h|0;if(o>>>0>h>>>0)q=q+4|0;else break}if((g|0)<0){f=-1;break a}Tc(a,32,J,h,H);if(!h){g=0;K=98}else{m=0;o=k[aa>>2]|0;while(1){g=k[o>>2]|0;if(!g){g=h;K=98;break g}g=vc(ea,g)|0;m=g+m|0;if((m|0)>(h|0)){g=h;K=98;break g}if(!(k[a>>2]&32))yc(ea,g,a)|0;if(m>>>0>=h>>>0){g=h;K=98;break}else o=o+4|0}}}while(0);if((K|0)==98){K=0;Tc(a,32,J,g,H^8192);w=I;g=(J|0)>(g|0)?J:g;continue}if((K|0)==77){K=0;m=(o|0)>-1?h&-65537:h;h=aa;h=(k[h>>2]|0)!=0|(k[h+4>>2]|0)!=0;if((o|0)!=0|h){h=(h&1^1)+(U-g)|0;w=g;h=(o|0)>(h|0)?o:h;u=q;g=N}else{w=N;h=0;u=q;g=N}}q=g-w|0;h=(h|0)<(q|0)?q:h;o=s+h|0;g=(J|0)<(o|0)?o:J;Tc(a,32,g,o,m);if(!(k[a>>2]&32))yc(u,s,a)|0;Tc(a,48,g,o,m^65536);Tc(a,48,h,q,0);if(!(k[a>>2]&32))yc(w,q,a)|0;Tc(a,32,g,o,m^8192);w=I}h:do if((K|0)==245)if(!a)if(b){f=1;while(1){b=k[e+(f<<2)>>2]|0;if(!b)break;Rc(d+(f<<3)|0,b,c);f=f+1|0;if((f|0)>=10){f=1;break h}}if((f|0)<10)while(1){if(k[e+(f<<2)>>2]|0){f=-1;break h}f=f+1|0;if((f|0)>=10){f=1;break}}else f=1}else f=0;while(0);r=ga;return f|0}function Pc(a){a=a|0;if(!(k[a+68>>2]|0))Fc(a);return}function Qc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=a+20|0;e=k[d>>2]|0;a=(k[a+16>>2]|0)-e|0;a=a>>>0>c>>>0?c:a;ed(e|0,b|0,a|0)|0;k[d>>2]=(k[d>>2]|0)+a;return c|0}function Rc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{d=(k[c>>2]|0)+(4-1)&~(4-1);b=k[d>>2]|0;k[c>>2]=d+4;k[a>>2]=b;break a}case 10:{d=(k[c>>2]|0)+(4-1)&~(4-1);b=k[d>>2]|0;k[c>>2]=d+4;d=a;k[d>>2]=b;k[d+4>>2]=((b|0)<0)<<31>>31;break a}case 11:{d=(k[c>>2]|0)+(4-1)&~(4-1);b=k[d>>2]|0;k[c>>2]=d+4;d=a;k[d>>2]=b;k[d+4>>2]=0;break a}case 12:{d=(k[c>>2]|0)+(8-1)&~(8-1);b=d;e=k[b>>2]|0;b=k[b+4>>2]|0;k[c>>2]=d+8;d=a;k[d>>2]=e;k[d+4>>2]=b;break a}case 13:{e=(k[c>>2]|0)+(4-1)&~(4-1);d=k[e>>2]|0;k[c>>2]=e+4;d=(d&65535)<<16>>16;e=a;k[e>>2]=d;k[e+4>>2]=((d|0)<0)<<31>>31;break a}case 14:{e=(k[c>>2]|0)+(4-1)&~(4-1);d=k[e>>2]|0;k[c>>2]=e+4;e=a;k[e>>2]=d&65535;k[e+4>>2]=0;break a}case 15:{e=(k[c>>2]|0)+(4-1)&~(4-1);d=k[e>>2]|0;k[c>>2]=e+4;d=(d&255)<<24>>24;e=a;k[e>>2]=d;k[e+4>>2]=((d|0)<0)<<31>>31;break a}case 16:{e=(k[c>>2]|0)+(4-1)&~(4-1);d=k[e>>2]|0;k[c>>2]=e+4;e=a;k[e>>2]=d&255;k[e+4>>2]=0;break a}case 17:{e=(k[c>>2]|0)+(8-1)&~(8-1);f=+p[e>>3];k[c>>2]=e+8;p[a>>3]=f;break a}case 18:{e=(k[c>>2]|0)+(8-1)&~(8-1);f=+p[e>>3];k[c>>2]=e+8;p[a>>3]=f;break a}default:break a}while(0);while(0);return}function Sc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(b>>>0>0|(b|0)==0&a>>>0>4294967295)while(1){d=md(a|0,b|0,10,0)|0;c=c+-1|0;i[c>>0]=d|48;d=ld(a|0,b|0,10,0)|0;if(b>>>0>9|(b|0)==9&a>>>0>4294967295){a=d;b=L}else{a=d;break}}if(a)while(1){c=c+-1|0;i[c>>0]=(a>>>0)%10|0|48;if(a>>>0<10)break;else a=(a>>>0)/10|0}return c|0}function Tc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;h=r;r=r+256|0;g=h;do if((c|0)>(d|0)&(e&73728|0)==0){e=c-d|0;ad(g|0,b|0,(e>>>0>256?256:e)|0)|0;b=k[a>>2]|0;f=(b&32|0)==0;if(e>>>0>255){d=c-d|0;do{if(f){yc(g,256,a)|0;b=k[a>>2]|0}e=e+-256|0;f=(b&32|0)==0}while(e>>>0>255);if(f)e=d&255;else break}else if(!f)break;yc(g,e,a)|0}while(0);r=h;return}function Uc(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;do if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;h=k[151]|0;c=h>>>a;if(c&3){a=(c&1^1)+a|0;d=a<<1;c=644+(d<<2)|0;d=644+(d+2<<2)|0;e=k[d>>2]|0;f=e+8|0;g=k[f>>2]|0;do if((c|0)!=(g|0)){if(g>>>0<(k[155]|0)>>>0)Na();b=g+12|0;if((k[b>>2]|0)==(e|0)){k[b>>2]=c;k[d>>2]=g;break}else Na()}else k[151]=h&~(1<<a);while(0);M=a<<3;k[e+4>>2]=M|3;M=e+(M|4)|0;k[M>>2]=k[M>>2]|1;M=f;return M|0}g=k[153]|0;if(o>>>0>g>>>0){if(c){d=2<<a;d=c<<a&(d|0-d);d=(d&0-d)+-1|0;i=d>>>12&16;d=d>>>i;e=d>>>5&8;d=d>>>e;f=d>>>2&4;d=d>>>f;c=d>>>1&2;d=d>>>c;a=d>>>1&1;a=(e|i|f|c|a)+(d>>>a)|0;d=a<<1;c=644+(d<<2)|0;d=644+(d+2<<2)|0;f=k[d>>2]|0;i=f+8|0;e=k[i>>2]|0;do if((c|0)!=(e|0)){if(e>>>0<(k[155]|0)>>>0)Na();b=e+12|0;if((k[b>>2]|0)==(f|0)){k[b>>2]=c;k[d>>2]=e;j=k[153]|0;break}else Na()}else{k[151]=h&~(1<<a);j=g}while(0);M=a<<3;g=M-o|0;k[f+4>>2]=o|3;h=f+o|0;k[f+(o|4)>>2]=g|1;k[f+M>>2]=g;if(j){e=k[156]|0;c=j>>>3;b=c<<1;d=644+(b<<2)|0;a=k[151]|0;c=1<<c;if(a&c){a=644+(b+2<<2)|0;b=k[a>>2]|0;if(b>>>0<(k[155]|0)>>>0)Na();else{l=a;m=b}}else{k[151]=a|c;l=644+(b+2<<2)|0;m=d}k[l>>2]=e;k[m+12>>2]=e;k[e+8>>2]=m;k[e+12>>2]=d}k[153]=g;k[156]=h;M=i;return M|0}a=k[152]|0;if(a){c=(a&0-a)+-1|0;L=c>>>12&16;c=c>>>L;K=c>>>5&8;c=c>>>K;M=c>>>2&4;c=c>>>M;a=c>>>1&2;c=c>>>a;d=c>>>1&1;d=k[908+((K|L|M|a|d)+(c>>>d)<<2)>>2]|0;c=(k[d+4>>2]&-8)-o|0;a=d;while(1){b=k[a+16>>2]|0;if(!b){b=k[a+20>>2]|0;if(!b){i=c;break}}a=(k[b+4>>2]&-8)-o|0;M=a>>>0<c>>>0;c=M?a:c;a=b;d=M?b:d}f=k[155]|0;if(d>>>0<f>>>0)Na();h=d+o|0;if(d>>>0>=h>>>0)Na();g=k[d+24>>2]|0;c=k[d+12>>2]|0;do if((c|0)==(d|0)){a=d+20|0;b=k[a>>2]|0;if(!b){a=d+16|0;b=k[a>>2]|0;if(!b){n=0;break}}while(1){c=b+20|0;e=k[c>>2]|0;if(e){b=e;a=c;continue}c=b+16|0;e=k[c>>2]|0;if(!e)break;else{b=e;a=c}}if(a>>>0<f>>>0)Na();else{k[a>>2]=0;n=b;break}}else{e=k[d+8>>2]|0;if(e>>>0<f>>>0)Na();b=e+12|0;if((k[b>>2]|0)!=(d|0))Na();a=c+8|0;if((k[a>>2]|0)==(d|0)){k[b>>2]=c;k[a>>2]=e;n=c;break}else Na()}while(0);do if(g){b=k[d+28>>2]|0;a=908+(b<<2)|0;if((d|0)==(k[a>>2]|0)){k[a>>2]=n;if(!n){k[152]=k[152]&~(1<<b);break}}else{if(g>>>0<(k[155]|0)>>>0)Na();b=g+16|0;if((k[b>>2]|0)==(d|0))k[b>>2]=n;else k[g+20>>2]=n;if(!n)break}a=k[155]|0;if(n>>>0<a>>>0)Na();k[n+24>>2]=g;b=k[d+16>>2]|0;do if(b)if(b>>>0<a>>>0)Na();else{k[n+16>>2]=b;k[b+24>>2]=n;break}while(0);b=k[d+20>>2]|0;if(b)if(b>>>0<(k[155]|0)>>>0)Na();else{k[n+20>>2]=b;k[b+24>>2]=n;break}}while(0);if(i>>>0<16){M=i+o|0;k[d+4>>2]=M|3;M=d+(M+4)|0;k[M>>2]=k[M>>2]|1}else{k[d+4>>2]=o|3;k[d+(o|4)>>2]=i|1;k[d+(i+o)>>2]=i;b=k[153]|0;if(b){f=k[156]|0;c=b>>>3;b=c<<1;e=644+(b<<2)|0;a=k[151]|0;c=1<<c;if(a&c){b=644+(b+2<<2)|0;a=k[b>>2]|0;if(a>>>0<(k[155]|0)>>>0)Na();else{p=b;q=a}}else{k[151]=a|c;p=644+(b+2<<2)|0;q=e}k[p>>2]=f;k[q+12>>2]=f;k[f+8>>2]=q;k[f+12>>2]=e}k[153]=i;k[156]=h}M=d+8|0;return M|0}else q=o}else q=o}else if(a>>>0<=4294967231){a=a+11|0;m=a&-8;l=k[152]|0;if(l){c=0-m|0;a=a>>>8;if(a)if(m>>>0>16777215)j=31;else{q=(a+1048320|0)>>>16&8;v=a<<q;p=(v+520192|0)>>>16&4;v=v<<p;j=(v+245760|0)>>>16&2;j=14-(p|q|j)+(v<<j>>>15)|0;j=m>>>(j+7|0)&1|j<<1}else j=0;a=k[908+(j<<2)>>2]|0;a:do if(!a){e=0;a=0;v=86}else{g=c;e=0;h=m<<((j|0)==31?0:25-(j>>>1)|0);i=a;a=0;while(1){f=k[i+4>>2]&-8;c=f-m|0;if(c>>>0<g>>>0)if((f|0)==(m|0)){f=i;a=i;v=90;break a}else a=i;else c=g;v=k[i+20>>2]|0;i=k[i+16+(h>>>31<<2)>>2]|0;e=(v|0)==0|(v|0)==(i|0)?e:v;if(!i){v=86;break}else{g=c;h=h<<1}}}while(0);if((v|0)==86){if((e|0)==0&(a|0)==0){a=2<<j;a=l&(a|0-a);if(!a){q=m;break}a=(a&0-a)+-1|0;n=a>>>12&16;a=a>>>n;l=a>>>5&8;a=a>>>l;p=a>>>2&4;a=a>>>p;q=a>>>1&2;a=a>>>q;e=a>>>1&1;e=k[908+((l|n|p|q|e)+(a>>>e)<<2)>>2]|0;a=0}if(!e){h=c;i=a}else{f=e;v=90}}if((v|0)==90)while(1){v=0;q=(k[f+4>>2]&-8)-m|0;e=q>>>0<c>>>0;c=e?q:c;a=e?f:a;e=k[f+16>>2]|0;if(e){f=e;v=90;continue}f=k[f+20>>2]|0;if(!f){h=c;i=a;break}else v=90}if((i|0)!=0?h>>>0<((k[153]|0)-m|0)>>>0:0){e=k[155]|0;if(i>>>0<e>>>0)Na();g=i+m|0;if(i>>>0>=g>>>0)Na();f=k[i+24>>2]|0;c=k[i+12>>2]|0;do if((c|0)==(i|0)){a=i+20|0;b=k[a>>2]|0;if(!b){a=i+16|0;b=k[a>>2]|0;if(!b){o=0;break}}while(1){c=b+20|0;d=k[c>>2]|0;if(d){b=d;a=c;continue}c=b+16|0;d=k[c>>2]|0;if(!d)break;else{b=d;a=c}}if(a>>>0<e>>>0)Na();else{k[a>>2]=0;o=b;break}}else{d=k[i+8>>2]|0;if(d>>>0<e>>>0)Na();b=d+12|0;if((k[b>>2]|0)!=(i|0))Na();a=c+8|0;if((k[a>>2]|0)==(i|0)){k[b>>2]=c;k[a>>2]=d;o=c;break}else Na()}while(0);do if(f){b=k[i+28>>2]|0;a=908+(b<<2)|0;if((i|0)==(k[a>>2]|0)){k[a>>2]=o;if(!o){k[152]=k[152]&~(1<<b);break}}else{if(f>>>0<(k[155]|0)>>>0)Na();b=f+16|0;if((k[b>>2]|0)==(i|0))k[b>>2]=o;else k[f+20>>2]=o;if(!o)break}a=k[155]|0;if(o>>>0<a>>>0)Na();k[o+24>>2]=f;b=k[i+16>>2]|0;do if(b)if(b>>>0<a>>>0)Na();else{k[o+16>>2]=b;k[b+24>>2]=o;break}while(0);b=k[i+20>>2]|0;if(b)if(b>>>0<(k[155]|0)>>>0)Na();else{k[o+20>>2]=b;k[b+24>>2]=o;break}}while(0);b:do if(h>>>0>=16){k[i+4>>2]=m|3;k[i+(m|4)>>2]=h|1;k[i+(h+m)>>2]=h;b=h>>>3;if(h>>>0<256){a=b<<1;d=644+(a<<2)|0;c=k[151]|0;b=1<<b;if(c&b){b=644+(a+2<<2)|0;a=k[b>>2]|0;if(a>>>0<(k[155]|0)>>>0)Na();else{s=b;t=a}}else{k[151]=c|b;s=644+(a+2<<2)|0;t=d}k[s>>2]=g;k[t+12>>2]=g;k[i+(m+8)>>2]=t;k[i+(m+12)>>2]=d;break}b=h>>>8;if(b)if(h>>>0>16777215)d=31;else{L=(b+1048320|0)>>>16&8;M=b<<L;K=(M+520192|0)>>>16&4;M=M<<K;d=(M+245760|0)>>>16&2;d=14-(K|L|d)+(M<<d>>>15)|0;d=h>>>(d+7|0)&1|d<<1}else d=0;b=908+(d<<2)|0;k[i+(m+28)>>2]=d;k[i+(m+20)>>2]=0;k[i+(m+16)>>2]=0;a=k[152]|0;c=1<<d;if(!(a&c)){k[152]=a|c;k[b>>2]=g;k[i+(m+24)>>2]=b;k[i+(m+12)>>2]=g;k[i+(m+8)>>2]=g;break}b=k[b>>2]|0;c:do if((k[b+4>>2]&-8|0)!=(h|0)){d=h<<((d|0)==31?0:25-(d>>>1)|0);while(1){a=b+16+(d>>>31<<2)|0;c=k[a>>2]|0;if(!c)break;if((k[c+4>>2]&-8|0)==(h|0)){y=c;break c}else{d=d<<1;b=c}}if(a>>>0<(k[155]|0)>>>0)Na();else{k[a>>2]=g;k[i+(m+24)>>2]=b;k[i+(m+12)>>2]=g;k[i+(m+8)>>2]=g;break b}}else y=b;while(0);b=y+8|0;a=k[b>>2]|0;M=k[155]|0;if(a>>>0>=M>>>0&y>>>0>=M>>>0){k[a+12>>2]=g;k[b>>2]=g;k[i+(m+8)>>2]=a;k[i+(m+12)>>2]=y;k[i+(m+24)>>2]=0;break}else Na()}else{M=h+m|0;k[i+4>>2]=M|3;M=i+(M+4)|0;k[M>>2]=k[M>>2]|1}while(0);M=i+8|0;return M|0}else q=m}else q=m}else q=-1;while(0);c=k[153]|0;if(c>>>0>=q>>>0){b=c-q|0;a=k[156]|0;if(b>>>0>15){k[156]=a+q;k[153]=b;k[a+(q+4)>>2]=b|1;k[a+c>>2]=b;k[a+4>>2]=q|3}else{k[153]=0;k[156]=0;k[a+4>>2]=c|3;M=a+(c+4)|0;k[M>>2]=k[M>>2]|1}M=a+8|0;return M|0}a=k[154]|0;if(a>>>0>q>>>0){L=a-q|0;k[154]=L;M=k[157]|0;k[157]=M+q;k[M+(q+4)>>2]=L|1;k[M+4>>2]=q|3;M=M+8|0;return M|0}do if(!(k[269]|0)){a=Ea(30)|0;if(!(a+-1&a)){k[271]=a;k[270]=a;k[272]=-1;k[273]=-1;k[274]=0;k[262]=0;y=(Pa(0)|0)&-16^1431655768;k[269]=y;break}else Na()}while(0);i=q+48|0;h=k[271]|0;j=q+47|0;g=h+j|0;h=0-h|0;l=g&h;if(l>>>0<=q>>>0){M=0;return M|0}a=k[261]|0;if((a|0)!=0?(t=k[259]|0,y=t+l|0,y>>>0<=t>>>0|y>>>0>a>>>0):0){M=0;return M|0}d:do if(!(k[262]&4)){a=k[157]|0;e:do if(a){e=1052;while(1){c=k[e>>2]|0;if(c>>>0<=a>>>0?(r=e+4|0,(c+(k[r>>2]|0)|0)>>>0>a>>>0):0){f=e;a=r;break}e=k[e+8>>2]|0;if(!e){v=174;break e}}c=g-(k[154]|0)&h;if(c>>>0<2147483647){e=Ba(c|0)|0;y=(e|0)==((k[f>>2]|0)+(k[a>>2]|0)|0);a=y?c:0;if(y){if((e|0)!=(-1|0)){w=e;p=a;v=194;break d}}else v=184}else a=0}else v=174;while(0);do if((v|0)==174){f=Ba(0)|0;if((f|0)!=(-1|0)){a=f;c=k[270]|0;e=c+-1|0;if(!(e&a))c=l;else c=l-a+(e+a&0-c)|0;a=k[259]|0;e=a+c|0;if(c>>>0>q>>>0&c>>>0<2147483647){y=k[261]|0;if((y|0)!=0?e>>>0<=a>>>0|e>>>0>y>>>0:0){a=0;break}e=Ba(c|0)|0;y=(e|0)==(f|0);a=y?c:0;if(y){w=f;p=a;v=194;break d}else v=184}else a=0}else a=0}while(0);f:do if((v|0)==184){f=0-c|0;do if(i>>>0>c>>>0&(c>>>0<2147483647&(e|0)!=(-1|0))?(u=k[271]|0,u=j-c+u&0-u,u>>>0<2147483647):0)if((Ba(u|0)|0)==(-1|0)){Ba(f|0)|0;break f}else{c=u+c|0;break}while(0);if((e|0)!=(-1|0)){w=e;p=c;v=194;break d}}while(0);k[262]=k[262]|4;v=191}else{a=0;v=191}while(0);if((((v|0)==191?l>>>0<2147483647:0)?(w=Ba(l|0)|0,x=Ba(0)|0,w>>>0<x>>>0&((w|0)!=(-1|0)&(x|0)!=(-1|0))):0)?(z=x-w|0,A=z>>>0>(q+40|0)>>>0,A):0){p=A?z:a;v=194}if((v|0)==194){a=(k[259]|0)+p|0;k[259]=a;if(a>>>0>(k[260]|0)>>>0)k[260]=a;g=k[157]|0;g:do if(g){f=1052;do{a=k[f>>2]|0;c=f+4|0;e=k[c>>2]|0;if((w|0)==(a+e|0)){B=a;C=c;D=e;E=f;v=204;break}f=k[f+8>>2]|0}while((f|0)!=0);if(((v|0)==204?(k[E+12>>2]&8|0)==0:0)?g>>>0<w>>>0&g>>>0>=B>>>0:0){k[C>>2]=D+p;M=(k[154]|0)+p|0;L=g+8|0;L=(L&7|0)==0?0:0-L&7;K=M-L|0;k[157]=g+L;k[154]=K;k[g+(L+4)>>2]=K|1;k[g+(M+4)>>2]=40;k[158]=k[273];break}a=k[155]|0;if(w>>>0<a>>>0){k[155]=w;a=w}c=w+p|0;f=1052;while(1){if((k[f>>2]|0)==(c|0)){e=f;c=f;v=212;break}f=k[f+8>>2]|0;if(!f){c=1052;break}}if((v|0)==212)if(!(k[c+12>>2]&8)){k[e>>2]=w;n=c+4|0;k[n>>2]=(k[n>>2]|0)+p;n=w+8|0;n=(n&7|0)==0?0:0-n&7;j=w+(p+8)|0;j=(j&7|0)==0?0:0-j&7;b=w+(j+p)|0;m=n+q|0;o=w+m|0;l=b-(w+n)-q|0;k[w+(n+4)>>2]=q|3;h:do if((b|0)!=(g|0)){if((b|0)==(k[156]|0)){M=(k[153]|0)+l|0;k[153]=M;k[156]=o;k[w+(m+4)>>2]=M|1;k[w+(M+m)>>2]=M;break}h=p+4|0;c=k[w+(h+j)>>2]|0;if((c&3|0)==1){i=c&-8;f=c>>>3;i:do if(c>>>0>=256){g=k[w+((j|24)+p)>>2]|0;d=k[w+(p+12+j)>>2]|0;do if((d|0)==(b|0)){e=j|16;d=w+(h+e)|0;c=k[d>>2]|0;if(!c){d=w+(e+p)|0;c=k[d>>2]|0;if(!c){J=0;break}}while(1){e=c+20|0;f=k[e>>2]|0;if(f){c=f;d=e;continue}e=c+16|0;f=k[e>>2]|0;if(!f)break;else{c=f;d=e}}if(d>>>0<a>>>0)Na();else{k[d>>2]=0;J=c;break}}else{e=k[w+((j|8)+p)>>2]|0;if(e>>>0<a>>>0)Na();a=e+12|0;if((k[a>>2]|0)!=(b|0))Na();c=d+8|0;if((k[c>>2]|0)==(b|0)){k[a>>2]=d;k[c>>2]=e;J=d;break}else Na()}while(0);if(!g)break;a=k[w+(p+28+j)>>2]|0;c=908+(a<<2)|0;do if((b|0)!=(k[c>>2]|0)){if(g>>>0<(k[155]|0)>>>0)Na();a=g+16|0;if((k[a>>2]|0)==(b|0))k[a>>2]=J;else k[g+20>>2]=J;if(!J)break i}else{k[c>>2]=J;if(J)break;k[152]=k[152]&~(1<<a);break i}while(0);c=k[155]|0;if(J>>>0<c>>>0)Na();k[J+24>>2]=g;b=j|16;a=k[w+(b+p)>>2]|0;do if(a)if(a>>>0<c>>>0)Na();else{k[J+16>>2]=a;k[a+24>>2]=J;break}while(0);b=k[w+(h+b)>>2]|0;if(!b)break;if(b>>>0<(k[155]|0)>>>0)Na();else{k[J+20>>2]=b;k[b+24>>2]=J;break}}else{d=k[w+((j|8)+p)>>2]|0;e=k[w+(p+12+j)>>2]|0;c=644+(f<<1<<2)|0;do if((d|0)!=(c|0)){if(d>>>0<a>>>0)Na();if((k[d+12>>2]|0)==(b|0))break;Na()}while(0);if((e|0)==(d|0)){k[151]=k[151]&~(1<<f);break}do if((e|0)==(c|0))F=e+8|0;else{if(e>>>0<a>>>0)Na();a=e+8|0;if((k[a>>2]|0)==(b|0)){F=a;break}Na()}while(0);k[d+12>>2]=e;k[F>>2]=d}while(0);b=w+((i|j)+p)|0;e=i+l|0}else e=l;b=b+4|0;k[b>>2]=k[b>>2]&-2;k[w+(m+4)>>2]=e|1;k[w+(e+m)>>2]=e;b=e>>>3;if(e>>>0<256){a=b<<1;d=644+(a<<2)|0;c=k[151]|0;b=1<<b;do if(!(c&b)){k[151]=c|b;K=644+(a+2<<2)|0;L=d}else{b=644+(a+2<<2)|0;a=k[b>>2]|0;if(a>>>0>=(k[155]|0)>>>0){K=b;L=a;break}Na()}while(0);k[K>>2]=o;k[L+12>>2]=o;k[w+(m+8)>>2]=L;k[w+(m+12)>>2]=d;break}b=e>>>8;do if(!b)d=0;else{if(e>>>0>16777215){d=31;break}K=(b+1048320|0)>>>16&8;L=b<<K;J=(L+520192|0)>>>16&4;L=L<<J;d=(L+245760|0)>>>16&2;d=14-(J|K|d)+(L<<d>>>15)|0;d=e>>>(d+7|0)&1|d<<1}while(0);b=908+(d<<2)|0;k[w+(m+28)>>2]=d;k[w+(m+20)>>2]=0;k[w+(m+16)>>2]=0;a=k[152]|0;c=1<<d;if(!(a&c)){k[152]=a|c;k[b>>2]=o;k[w+(m+24)>>2]=b;k[w+(m+12)>>2]=o;k[w+(m+8)>>2]=o;break}b=k[b>>2]|0;j:do if((k[b+4>>2]&-8|0)!=(e|0)){d=e<<((d|0)==31?0:25-(d>>>1)|0);while(1){a=b+16+(d>>>31<<2)|0;c=k[a>>2]|0;if(!c)break;if((k[c+4>>2]&-8|0)==(e|0)){M=c;break j}else{d=d<<1;b=c}}if(a>>>0<(k[155]|0)>>>0)Na();else{k[a>>2]=o;k[w+(m+24)>>2]=b;k[w+(m+12)>>2]=o;k[w+(m+8)>>2]=o;break h}}else M=b;while(0);b=M+8|0;a=k[b>>2]|0;L=k[155]|0;if(a>>>0>=L>>>0&M>>>0>=L>>>0){k[a+12>>2]=o;k[b>>2]=o;k[w+(m+8)>>2]=a;k[w+(m+12)>>2]=M;k[w+(m+24)>>2]=0;break}else Na()}else{M=(k[154]|0)+l|0;k[154]=M;k[157]=o;k[w+(m+4)>>2]=M|1}while(0);M=w+(n|8)|0;return M|0}else c=1052;while(1){a=k[c>>2]|0;if(a>>>0<=g>>>0?(b=k[c+4>>2]|0,d=a+b|0,d>>>0>g>>>0):0)break;c=k[c+8>>2]|0}e=a+(b+-39)|0;a=a+(b+-47+((e&7|0)==0?0:0-e&7))|0;e=g+16|0;a=a>>>0<e>>>0?g:a;b=a+8|0;c=w+8|0;c=(c&7|0)==0?0:0-c&7;M=p+-40-c|0;k[157]=w+c;k[154]=M;k[w+(c+4)>>2]=M|1;k[w+(p+-36)>>2]=40;k[158]=k[273];c=a+4|0;k[c>>2]=27;k[b>>2]=k[263];k[b+4>>2]=k[264];k[b+8>>2]=k[265];k[b+12>>2]=k[266];k[263]=w;k[264]=p;k[266]=0;k[265]=b;b=a+28|0;k[b>>2]=7;if((a+32|0)>>>0<d>>>0)do{M=b;b=b+4|0;k[b>>2]=7}while((M+8|0)>>>0<d>>>0);if((a|0)!=(g|0)){f=a-g|0;k[c>>2]=k[c>>2]&-2;k[g+4>>2]=f|1;k[a>>2]=f;b=f>>>3;if(f>>>0<256){a=b<<1;d=644+(a<<2)|0;c=k[151]|0;b=1<<b;if(c&b){b=644+(a+2<<2)|0;a=k[b>>2]|0;if(a>>>0<(k[155]|0)>>>0)Na();else{G=b;H=a}}else{k[151]=c|b;G=644+(a+2<<2)|0;H=d}k[G>>2]=g;k[H+12>>2]=g;k[g+8>>2]=H;k[g+12>>2]=d;break}b=f>>>8;if(b)if(f>>>0>16777215)d=31;else{L=(b+1048320|0)>>>16&8;M=b<<L;K=(M+520192|0)>>>16&4;M=M<<K;d=(M+245760|0)>>>16&2;d=14-(K|L|d)+(M<<d>>>15)|0;d=f>>>(d+7|0)&1|d<<1}else d=0;c=908+(d<<2)|0;k[g+28>>2]=d;k[g+20>>2]=0;k[e>>2]=0;b=k[152]|0;a=1<<d;if(!(b&a)){k[152]=b|a;k[c>>2]=g;k[g+24>>2]=c;k[g+12>>2]=g;k[g+8>>2]=g;break}b=k[c>>2]|0;k:do if((k[b+4>>2]&-8|0)!=(f|0)){d=f<<((d|0)==31?0:25-(d>>>1)|0);while(1){a=b+16+(d>>>31<<2)|0;c=k[a>>2]|0;if(!c)break;if((k[c+4>>2]&-8|0)==(f|0)){I=c;break k}else{d=d<<1;b=c}}if(a>>>0<(k[155]|0)>>>0)Na();else{k[a>>2]=g;k[g+24>>2]=b;k[g+12>>2]=g;k[g+8>>2]=g;break g}}else I=b;while(0);b=I+8|0;a=k[b>>2]|0;M=k[155]|0;if(a>>>0>=M>>>0&I>>>0>=M>>>0){k[a+12>>2]=g;k[b>>2]=g;k[g+8>>2]=a;k[g+12>>2]=I;k[g+24>>2]=0;break}else Na()}}else{M=k[155]|0;if((M|0)==0|w>>>0<M>>>0)k[155]=w;k[263]=w;k[264]=p;k[266]=0;k[160]=k[269];k[159]=-1;b=0;do{M=b<<1;L=644+(M<<2)|0;k[644+(M+3<<2)>>2]=L;k[644+(M+2<<2)>>2]=L;b=b+1|0}while((b|0)!=32);M=w+8|0;M=(M&7|0)==0?0:0-M&7;L=p+-40-M|0;k[157]=w+M;k[154]=L;k[w+(M+4)>>2]=L|1;k[w+(p+-36)>>2]=40;k[158]=k[273]}while(0);b=k[154]|0;if(b>>>0>q>>>0){L=b-q|0;k[154]=L;M=k[157]|0;k[157]=M+q;k[M+(q+4)>>2]=L|1;k[M+4>>2]=q|3;M=M+8|0;return M|0}}M=qc()|0;k[M>>2]=12;M=0;return M|0}function Vc(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if(!a)return;b=a+-8|0;h=k[155]|0;if(b>>>0<h>>>0)Na();c=k[a+-4>>2]|0;d=c&3;if((d|0)==1)Na();o=c&-8;q=a+(o+-8)|0;do if(!(c&1)){b=k[b>>2]|0;if(!d)return;i=-8-b|0;l=a+i|0;m=b+o|0;if(l>>>0<h>>>0)Na();if((l|0)==(k[156]|0)){b=a+(o+-4)|0;c=k[b>>2]|0;if((c&3|0)!=3){u=l;f=m;break}k[153]=m;k[b>>2]=c&-2;k[a+(i+4)>>2]=m|1;k[q>>2]=m;return}e=b>>>3;if(b>>>0<256){d=k[a+(i+8)>>2]|0;c=k[a+(i+12)>>2]|0;b=644+(e<<1<<2)|0;if((d|0)!=(b|0)){if(d>>>0<h>>>0)Na();if((k[d+12>>2]|0)!=(l|0))Na()}if((c|0)==(d|0)){k[151]=k[151]&~(1<<e);u=l;f=m;break}if((c|0)!=(b|0)){if(c>>>0<h>>>0)Na();b=c+8|0;if((k[b>>2]|0)==(l|0))g=b;else Na()}else g=c+8|0;k[d+12>>2]=c;k[g>>2]=d;u=l;f=m;break}g=k[a+(i+24)>>2]|0;d=k[a+(i+12)>>2]|0;do if((d|0)==(l|0)){c=a+(i+20)|0;b=k[c>>2]|0;if(!b){c=a+(i+16)|0;b=k[c>>2]|0;if(!b){j=0;break}}while(1){d=b+20|0;e=k[d>>2]|0;if(e){b=e;c=d;continue}d=b+16|0;e=k[d>>2]|0;if(!e)break;else{b=e;c=d}}if(c>>>0<h>>>0)Na();else{k[c>>2]=0;j=b;break}}else{e=k[a+(i+8)>>2]|0;if(e>>>0<h>>>0)Na();b=e+12|0;if((k[b>>2]|0)!=(l|0))Na();c=d+8|0;if((k[c>>2]|0)==(l|0)){k[b>>2]=d;k[c>>2]=e;j=d;break}else Na()}while(0);if(g){b=k[a+(i+28)>>2]|0;c=908+(b<<2)|0;if((l|0)==(k[c>>2]|0)){k[c>>2]=j;if(!j){k[152]=k[152]&~(1<<b);u=l;f=m;break}}else{if(g>>>0<(k[155]|0)>>>0)Na();b=g+16|0;if((k[b>>2]|0)==(l|0))k[b>>2]=j;else k[g+20>>2]=j;if(!j){u=l;f=m;break}}c=k[155]|0;if(j>>>0<c>>>0)Na();k[j+24>>2]=g;b=k[a+(i+16)>>2]|0;do if(b)if(b>>>0<c>>>0)Na();else{k[j+16>>2]=b;k[b+24>>2]=j;break}while(0);b=k[a+(i+20)>>2]|0;if(b)if(b>>>0<(k[155]|0)>>>0)Na();else{k[j+20>>2]=b;k[b+24>>2]=j;u=l;f=m;break}else{u=l;f=m}}else{u=l;f=m}}else{u=b;f=o}while(0);if(u>>>0>=q>>>0)Na();b=a+(o+-4)|0;c=k[b>>2]|0;if(!(c&1))Na();if(!(c&2)){if((q|0)==(k[157]|0)){t=(k[154]|0)+f|0;k[154]=t;k[157]=u;k[u+4>>2]=t|1;if((u|0)!=(k[156]|0))return;k[156]=0;k[153]=0;return}if((q|0)==(k[156]|0)){t=(k[153]|0)+f|0;k[153]=t;k[156]=u;k[u+4>>2]=t|1;k[u+t>>2]=t;return}f=(c&-8)+f|0;e=c>>>3;do if(c>>>0>=256){g=k[a+(o+16)>>2]|0;b=k[a+(o|4)>>2]|0;do if((b|0)==(q|0)){c=a+(o+12)|0;b=k[c>>2]|0;if(!b){c=a+(o+8)|0;b=k[c>>2]|0;if(!b){p=0;break}}while(1){d=b+20|0;e=k[d>>2]|0;if(e){b=e;c=d;continue}d=b+16|0;e=k[d>>2]|0;if(!e)break;else{b=e;c=d}}if(c>>>0<(k[155]|0)>>>0)Na();else{k[c>>2]=0;p=b;break}}else{c=k[a+o>>2]|0;if(c>>>0<(k[155]|0)>>>0)Na();d=c+12|0;if((k[d>>2]|0)!=(q|0))Na();e=b+8|0;if((k[e>>2]|0)==(q|0)){k[d>>2]=b;k[e>>2]=c;p=b;break}else Na()}while(0);if(g){b=k[a+(o+20)>>2]|0;c=908+(b<<2)|0;if((q|0)==(k[c>>2]|0)){k[c>>2]=p;if(!p){k[152]=k[152]&~(1<<b);break}}else{if(g>>>0<(k[155]|0)>>>0)Na();b=g+16|0;if((k[b>>2]|0)==(q|0))k[b>>2]=p;else k[g+20>>2]=p;if(!p)break}c=k[155]|0;if(p>>>0<c>>>0)Na();k[p+24>>2]=g;b=k[a+(o+8)>>2]|0;do if(b)if(b>>>0<c>>>0)Na();else{k[p+16>>2]=b;k[b+24>>2]=p;break}while(0);b=k[a+(o+12)>>2]|0;if(b)if(b>>>0<(k[155]|0)>>>0)Na();else{k[p+20>>2]=b;k[b+24>>2]=p;break}}}else{d=k[a+o>>2]|0;c=k[a+(o|4)>>2]|0;b=644+(e<<1<<2)|0;if((d|0)!=(b|0)){if(d>>>0<(k[155]|0)>>>0)Na();if((k[d+12>>2]|0)!=(q|0))Na()}if((c|0)==(d|0)){k[151]=k[151]&~(1<<e);break}if((c|0)!=(b|0)){if(c>>>0<(k[155]|0)>>>0)Na();b=c+8|0;if((k[b>>2]|0)==(q|0))n=b;else Na()}else n=c+8|0;k[d+12>>2]=c;k[n>>2]=d}while(0);k[u+4>>2]=f|1;k[u+f>>2]=f;if((u|0)==(k[156]|0)){k[153]=f;return}}else{k[b>>2]=c&-2;k[u+4>>2]=f|1;k[u+f>>2]=f}b=f>>>3;if(f>>>0<256){c=b<<1;e=644+(c<<2)|0;d=k[151]|0;b=1<<b;if(d&b){b=644+(c+2<<2)|0;c=k[b>>2]|0;if(c>>>0<(k[155]|0)>>>0)Na();else{r=b;s=c}}else{k[151]=d|b;r=644+(c+2<<2)|0;s=e}k[r>>2]=u;k[s+12>>2]=u;k[u+8>>2]=s;k[u+12>>2]=e;return}b=f>>>8;if(b)if(f>>>0>16777215)e=31;else{r=(b+1048320|0)>>>16&8;s=b<<r;q=(s+520192|0)>>>16&4;s=s<<q;e=(s+245760|0)>>>16&2;e=14-(q|r|e)+(s<<e>>>15)|0;e=f>>>(e+7|0)&1|e<<1}else e=0;b=908+(e<<2)|0;k[u+28>>2]=e;k[u+20>>2]=0;k[u+16>>2]=0;c=k[152]|0;d=1<<e;a:do if(c&d){b=k[b>>2]|0;b:do if((k[b+4>>2]&-8|0)!=(f|0)){e=f<<((e|0)==31?0:25-(e>>>1)|0);while(1){c=b+16+(e>>>31<<2)|0;d=k[c>>2]|0;if(!d)break;if((k[d+4>>2]&-8|0)==(f|0)){t=d;break b}else{e=e<<1;b=d}}if(c>>>0<(k[155]|0)>>>0)Na();else{k[c>>2]=u;k[u+24>>2]=b;k[u+12>>2]=u;k[u+8>>2]=u;break a}}else t=b;while(0);b=t+8|0;c=k[b>>2]|0;s=k[155]|0;if(c>>>0>=s>>>0&t>>>0>=s>>>0){k[c+12>>2]=u;k[b>>2]=u;k[u+8>>2]=c;k[u+12>>2]=t;k[u+24>>2]=0;break}else Na()}else{k[152]=c|d;k[b>>2]=u;k[u+24>>2]=b;k[u+12>>2]=u;k[u+8>>2]=u}while(0);u=(k[159]|0)+-1|0;k[159]=u;if(!u)b=1060;else return;while(1){b=k[b>>2]|0;if(!b)break;else b=b+8|0}k[159]=-1;return}function Wc(a,b){a=a|0;b=b|0;var c=0,d=0;if(!a){a=Uc(b)|0;return a|0}if(b>>>0>4294967231){a=qc()|0;k[a>>2]=12;a=0;return a|0}c=Yc(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(c){a=c+8|0;return a|0}c=Uc(b)|0;if(!c){a=0;return a|0}d=k[a+-4>>2]|0;d=(d&-8)-((d&3|0)==0?8:4)|0;ed(c|0,a|0,(d>>>0<b>>>0?d:b)|0)|0;Vc(a);a=c;return a|0}function Xc(a){a=a|0;var b=0;if(!a){b=0;return b|0}a=k[a+-4>>2]|0;b=a&3;if((b|0)==1){b=0;return b|0}b=(a&-8)-((b|0)==0?8:4)|0;return b|0}function Yc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0;o=a+4|0;p=k[o>>2]|0;i=p&-8;l=a+i|0;h=k[155]|0;c=p&3;if(!((c|0)!=1&a>>>0>=h>>>0&a>>>0<l>>>0))Na();d=a+(i|4)|0;e=k[d>>2]|0;if(!(e&1))Na();if(!c){if(b>>>0<256){a=0;return a|0}if(i>>>0>=(b+4|0)>>>0?(i-b|0)>>>0<=k[271]<<1>>>0:0)return a|0;a=0;return a|0}if(i>>>0>=b>>>0){c=i-b|0;if(c>>>0<=15)return a|0;k[o>>2]=p&1|b|2;k[a+(b+4)>>2]=c|3;k[d>>2]=k[d>>2]|1;Zc(a+b|0,c);return a|0}if((l|0)==(k[157]|0)){c=(k[154]|0)+i|0;if(c>>>0<=b>>>0){a=0;return a|0}n=c-b|0;k[o>>2]=p&1|b|2;k[a+(b+4)>>2]=n|1;k[157]=a+b;k[154]=n;return a|0}if((l|0)==(k[156]|0)){d=(k[153]|0)+i|0;if(d>>>0<b>>>0){a=0;return a|0}c=d-b|0;if(c>>>0>15){k[o>>2]=p&1|b|2;k[a+(b+4)>>2]=c|1;k[a+d>>2]=c;d=a+(d+4)|0;k[d>>2]=k[d>>2]&-2;d=a+b|0}else{k[o>>2]=p&1|d|2;d=a+(d+4)|0;k[d>>2]=k[d>>2]|1;d=0;c=0}k[153]=c;k[156]=d;return a|0}if(e&2){a=0;return a|0}m=(e&-8)+i|0;if(m>>>0<b>>>0){a=0;return a|0}n=m-b|0;f=e>>>3;do if(e>>>0>=256){g=k[a+(i+24)>>2]|0;f=k[a+(i+12)>>2]|0;do if((f|0)==(l|0)){d=a+(i+20)|0;c=k[d>>2]|0;if(!c){d=a+(i+16)|0;c=k[d>>2]|0;if(!c){j=0;break}}while(1){e=c+20|0;f=k[e>>2]|0;if(f){c=f;d=e;continue}e=c+16|0;f=k[e>>2]|0;if(!f)break;else{c=f;d=e}}if(d>>>0<h>>>0)Na();else{k[d>>2]=0;j=c;break}}else{e=k[a+(i+8)>>2]|0;if(e>>>0<h>>>0)Na();c=e+12|0;if((k[c>>2]|0)!=(l|0))Na();d=f+8|0;if((k[d>>2]|0)==(l|0)){k[c>>2]=f;k[d>>2]=e;j=f;break}else Na()}while(0);if(g){c=k[a+(i+28)>>2]|0;d=908+(c<<2)|0;if((l|0)==(k[d>>2]|0)){k[d>>2]=j;if(!j){k[152]=k[152]&~(1<<c);break}}else{if(g>>>0<(k[155]|0)>>>0)Na();c=g+16|0;if((k[c>>2]|0)==(l|0))k[c>>2]=j;else k[g+20>>2]=j;if(!j)break}d=k[155]|0;if(j>>>0<d>>>0)Na();k[j+24>>2]=g;c=k[a+(i+16)>>2]|0;do if(c)if(c>>>0<d>>>0)Na();else{k[j+16>>2]=c;k[c+24>>2]=j;break}while(0);c=k[a+(i+20)>>2]|0;if(c)if(c>>>0<(k[155]|0)>>>0)Na();else{k[j+20>>2]=c;k[c+24>>2]=j;break}}}else{e=k[a+(i+8)>>2]|0;d=k[a+(i+12)>>2]|0;c=644+(f<<1<<2)|0;if((e|0)!=(c|0)){if(e>>>0<h>>>0)Na();if((k[e+12>>2]|0)!=(l|0))Na()}if((d|0)==(e|0)){k[151]=k[151]&~(1<<f);break}if((d|0)!=(c|0)){if(d>>>0<h>>>0)Na();c=d+8|0;if((k[c>>2]|0)==(l|0))g=c;else Na()}else g=d+8|0;k[e+12>>2]=d;k[g>>2]=e}while(0);if(n>>>0<16){k[o>>2]=m|p&1|2;b=a+(m|4)|0;k[b>>2]=k[b>>2]|1;return a|0}else{k[o>>2]=p&1|b|2;k[a+(b+4)>>2]=n|3;p=a+(m|4)|0;k[p>>2]=k[p>>2]|1;Zc(a+b|0,n);return a|0}return 0}function Zc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;q=a+b|0;c=k[a+4>>2]|0;do if(!(c&1)){j=k[a>>2]|0;if(!(c&3))return;n=a+(0-j)|0;m=j+b|0;i=k[155]|0;if(n>>>0<i>>>0)Na();if((n|0)==(k[156]|0)){d=a+(b+4)|0;c=k[d>>2]|0;if((c&3|0)!=3){t=n;g=m;break}k[153]=m;k[d>>2]=c&-2;k[a+(4-j)>>2]=m|1;k[q>>2]=m;return}f=j>>>3;if(j>>>0<256){e=k[a+(8-j)>>2]|0;d=k[a+(12-j)>>2]|0;c=644+(f<<1<<2)|0;if((e|0)!=(c|0)){if(e>>>0<i>>>0)Na();if((k[e+12>>2]|0)!=(n|0))Na()}if((d|0)==(e|0)){k[151]=k[151]&~(1<<f);t=n;g=m;break}if((d|0)!=(c|0)){if(d>>>0<i>>>0)Na();c=d+8|0;if((k[c>>2]|0)==(n|0))h=c;else Na()}else h=d+8|0;k[e+12>>2]=d;k[h>>2]=e;t=n;g=m;break}h=k[a+(24-j)>>2]|0;e=k[a+(12-j)>>2]|0;do if((e|0)==(n|0)){e=16-j|0;d=a+(e+4)|0;c=k[d>>2]|0;if(!c){d=a+e|0;c=k[d>>2]|0;if(!c){l=0;break}}while(1){e=c+20|0;f=k[e>>2]|0;if(f){c=f;d=e;continue}e=c+16|0;f=k[e>>2]|0;if(!f)break;else{c=f;d=e}}if(d>>>0<i>>>0)Na();else{k[d>>2]=0;l=c;break}}else{f=k[a+(8-j)>>2]|0;if(f>>>0<i>>>0)Na();c=f+12|0;if((k[c>>2]|0)!=(n|0))Na();d=e+8|0;if((k[d>>2]|0)==(n|0)){k[c>>2]=e;k[d>>2]=f;l=e;break}else Na()}while(0);if(h){c=k[a+(28-j)>>2]|0;d=908+(c<<2)|0;if((n|0)==(k[d>>2]|0)){k[d>>2]=l;if(!l){k[152]=k[152]&~(1<<c);t=n;g=m;break}}else{if(h>>>0<(k[155]|0)>>>0)Na();c=h+16|0;if((k[c>>2]|0)==(n|0))k[c>>2]=l;else k[h+20>>2]=l;if(!l){t=n;g=m;break}}e=k[155]|0;if(l>>>0<e>>>0)Na();k[l+24>>2]=h;c=16-j|0;d=k[a+c>>2]|0;do if(d)if(d>>>0<e>>>0)Na();else{k[l+16>>2]=d;k[d+24>>2]=l;break}while(0);c=k[a+(c+4)>>2]|0;if(c)if(c>>>0<(k[155]|0)>>>0)Na();else{k[l+20>>2]=c;k[c+24>>2]=l;t=n;g=m;break}else{t=n;g=m}}else{t=n;g=m}}else{t=a;g=b}while(0);i=k[155]|0;if(q>>>0<i>>>0)Na();c=a+(b+4)|0;d=k[c>>2]|0;if(!(d&2)){if((q|0)==(k[157]|0)){s=(k[154]|0)+g|0;k[154]=s;k[157]=t;k[t+4>>2]=s|1;if((t|0)!=(k[156]|0))return;k[156]=0;k[153]=0;return}if((q|0)==(k[156]|0)){s=(k[153]|0)+g|0;k[153]=s;k[156]=t;k[t+4>>2]=s|1;k[t+s>>2]=s;return}g=(d&-8)+g|0;f=d>>>3;do if(d>>>0>=256){h=k[a+(b+24)>>2]|0;e=k[a+(b+12)>>2]|0;do if((e|0)==(q|0)){d=a+(b+20)|0;c=k[d>>2]|0;if(!c){d=a+(b+16)|0;c=k[d>>2]|0;if(!c){p=0;break}}while(1){e=c+20|0;f=k[e>>2]|0;if(f){c=f;d=e;continue}e=c+16|0;f=k[e>>2]|0;if(!f)break;else{c=f;d=e}}if(d>>>0<i>>>0)Na();else{k[d>>2]=0;p=c;break}}else{f=k[a+(b+8)>>2]|0;if(f>>>0<i>>>0)Na();c=f+12|0;if((k[c>>2]|0)!=(q|0))Na();d=e+8|0;if((k[d>>2]|0)==(q|0)){k[c>>2]=e;k[d>>2]=f;p=e;break}else Na()}while(0);if(h){c=k[a+(b+28)>>2]|0;d=908+(c<<2)|0;if((q|0)==(k[d>>2]|0)){k[d>>2]=p;if(!p){k[152]=k[152]&~(1<<c);break}}else{if(h>>>0<(k[155]|0)>>>0)Na();c=h+16|0;if((k[c>>2]|0)==(q|0))k[c>>2]=p;else k[h+20>>2]=p;if(!p)break}d=k[155]|0;if(p>>>0<d>>>0)Na();k[p+24>>2]=h;c=k[a+(b+16)>>2]|0;do if(c)if(c>>>0<d>>>0)Na();else{k[p+16>>2]=c;k[c+24>>2]=p;break}while(0);c=k[a+(b+20)>>2]|0;if(c)if(c>>>0<(k[155]|0)>>>0)Na();else{k[p+20>>2]=c;k[c+24>>2]=p;break}}}else{e=k[a+(b+8)>>2]|0;d=k[a+(b+12)>>2]|0;c=644+(f<<1<<2)|0;if((e|0)!=(c|0)){if(e>>>0<i>>>0)Na();if((k[e+12>>2]|0)!=(q|0))Na()}if((d|0)==(e|0)){k[151]=k[151]&~(1<<f);break}if((d|0)!=(c|0)){if(d>>>0<i>>>0)Na();c=d+8|0;if((k[c>>2]|0)==(q|0))o=c;else Na()}else o=d+8|0;k[e+12>>2]=d;k[o>>2]=e}while(0);k[t+4>>2]=g|1;k[t+g>>2]=g;if((t|0)==(k[156]|0)){k[153]=g;return}}else{k[c>>2]=d&-2;k[t+4>>2]=g|1;k[t+g>>2]=g}c=g>>>3;if(g>>>0<256){d=c<<1;f=644+(d<<2)|0;e=k[151]|0;c=1<<c;if(e&c){c=644+(d+2<<2)|0;d=k[c>>2]|0;if(d>>>0<(k[155]|0)>>>0)Na();else{r=c;s=d}}else{k[151]=e|c;r=644+(d+2<<2)|0;s=f}k[r>>2]=t;k[s+12>>2]=t;k[t+8>>2]=s;k[t+12>>2]=f;return}c=g>>>8;if(c)if(g>>>0>16777215)f=31;else{r=(c+1048320|0)>>>16&8;s=c<<r;q=(s+520192|0)>>>16&4;s=s<<q;f=(s+245760|0)>>>16&2;f=14-(q|r|f)+(s<<f>>>15)|0;f=g>>>(f+7|0)&1|f<<1}else f=0;c=908+(f<<2)|0;k[t+28>>2]=f;k[t+20>>2]=0;k[t+16>>2]=0;d=k[152]|0;e=1<<f;if(!(d&e)){k[152]=d|e;k[c>>2]=t;k[t+24>>2]=c;k[t+12>>2]=t;k[t+8>>2]=t;return}c=k[c>>2]|0;a:do if((k[c+4>>2]&-8|0)!=(g|0)){f=g<<((f|0)==31?0:25-(f>>>1)|0);while(1){d=c+16+(f>>>31<<2)|0;e=k[d>>2]|0;if(!e)break;if((k[e+4>>2]&-8|0)==(g|0)){c=e;break a}else{f=f<<1;c=e}}if(d>>>0<(k[155]|0)>>>0)Na();k[d>>2]=t;k[t+24>>2]=c;k[t+12>>2]=t;k[t+8>>2]=t;return}while(0);d=c+8|0;e=k[d>>2]|0;s=k[155]|0;if(!(e>>>0>=s>>>0&c>>>0>=s>>>0))Na();k[e+12>>2]=t;k[d>>2]=t;k[t+8>>2]=e;k[t+12>>2]=c;k[t+24>>2]=0;return}function _c(){}function $c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (L=d,a-c>>>0|0)|0}function ad(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=a+c|0;if((c|0)>=20){b=b&255;f=a&3;g=b|b<<8|b<<16|b<<24;e=d&~3;if(f){f=a+4-f|0;while((a|0)<(f|0)){i[a>>0]=b;a=a+1|0}}while((a|0)<(e|0)){k[a>>2]=g;a=a+4|0}}while((a|0)<(d|0)){i[a>>0]=b;a=a+1|0}return a-c|0}function bd(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){L=b>>>c;return a>>>c|(b&(1<<c)-1)<<32-c}L=0;return b>>>c-32|0}function cd(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){L=b<<c|(a&(1<<c)-1<<32-c)>>>32-c;return a<<c}L=a<<c-32;return 0}function dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return (L=b+d+(c>>>0<a>>>0|0)>>>0,c|0)|0}function ed(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if((c|0)>=4096)return Da(a|0,b|0,c|0)|0;d=a|0;if((a&3)==(b&3)){while(a&3){if(!c)return d|0;i[a>>0]=i[b>>0]|0;a=a+1|0;b=b+1|0;c=c-1|0}while((c|0)>=4){k[a>>2]=k[b>>2];a=a+4|0;b=b+4|0;c=c-4|0}}while((c|0)>0){i[a>>0]=i[b>>0]|0;a=a+1|0;b=b+1|0;c=c-1|0}return d|0}function fd(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){L=b>>c;return a>>>c|(b&(1<<c)-1)<<32-c}L=(b|0)<0?-1:0;return b>>c-32|0}function gd(a){a=a|0;var b=0;b=i[v+(a&255)>>0]|0;if((b|0)<8)return b|0;b=i[v+(a>>8&255)>>0]|0;if((b|0)<8)return b+8|0;b=i[v+(a>>16&255)>>0]|0;if((b|0)<8)return b+16|0;return (i[v+(a>>>24)>>0]|0)+24|0}function hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=ha(e,f)|0;d=a>>>16;a=(c>>>16)+(ha(e,d)|0)|0;e=b>>>16;b=ha(e,f)|0;return (L=(a>>>16)+(ha(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function id(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=$c(j^a,i^b,j,i)|0;g=L;a=f^j;b=e^i;return $c((nd(h,g,$c(f^c,e^d,f,e)|0,L,0)|0)^a,L^b,a,b)|0}function jd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=r;r=r+16|0;h=e|0;g=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;j=d>>31|((d|0)<0?-1:0)<<1;i=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;a=$c(g^a,f^b,g,f)|0;b=L;nd(a,b,$c(j^c,i^d,j,i)|0,L,h)|0;d=$c(k[h>>2]^g,k[h+4>>2]^f,g,f)|0;c=L;r=e;return (L=c,d)|0}function kd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=hd(e,f)|0;a=L;return (L=(ha(b,f)|0)+(ha(d,e)|0)+a|a&0,c|0|0)|0}function ld(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return nd(a,b,c,d,0)|0}function md(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;f=r;r=r+16|0;e=f|0;nd(a,b,c,d,e)|0;r=f;return (L=k[e+4>>2]|0,k[e>>2]|0)|0}function nd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0;l=a;i=b;j=i;g=c;n=d;h=n;if(!j){f=(e|0)!=0;if(!h){if(f){k[e>>2]=(l>>>0)%(g>>>0);k[e+4>>2]=0}n=0;e=(l>>>0)/(g>>>0)>>>0;return (L=n,e)|0}else{if(!f){n=0;e=0;return (L=n,e)|0}k[e>>2]=a|0;k[e+4>>2]=b&0;n=0;e=0;return (L=n,e)|0}}f=(h|0)==0;do if(g){if(!f){f=(ja(h|0)|0)-(ja(j|0)|0)|0;if(f>>>0<=31){m=f+1|0;h=31-f|0;b=f-31>>31;g=m;a=l>>>(m>>>0)&b|j<<h;b=j>>>(m>>>0)&b;f=0;h=l<<h;break}if(!e){n=0;e=0;return (L=n,e)|0}k[e>>2]=a|0;k[e+4>>2]=i|b&0;n=0;e=0;return (L=n,e)|0}f=g-1|0;if(f&g){h=(ja(g|0)|0)+33-(ja(j|0)|0)|0;p=64-h|0;m=32-h|0;i=m>>31;o=h-32|0;b=o>>31;g=h;a=m-1>>31&j>>>(o>>>0)|(j<<m|l>>>(h>>>0))&b;b=b&j>>>(h>>>0);f=l<<p&i;h=(j<<p|l>>>(o>>>0))&i|l<<m&h-33>>31;break}if(e){k[e>>2]=f&l;k[e+4>>2]=0}if((g|0)==1){o=i|b&0;p=a|0|0;return (L=o,p)|0}else{p=gd(g|0)|0;o=j>>>(p>>>0)|0;p=j<<32-p|l>>>(p>>>0)|0;return (L=o,p)|0}}else{if(f){if(e){k[e>>2]=(j>>>0)%(g>>>0);k[e+4>>2]=0}o=0;p=(j>>>0)/(g>>>0)>>>0;return (L=o,p)|0}if(!l){if(e){k[e>>2]=0;k[e+4>>2]=(j>>>0)%(h>>>0)}o=0;p=(j>>>0)/(h>>>0)>>>0;return (L=o,p)|0}f=h-1|0;if(!(f&h)){if(e){k[e>>2]=a|0;k[e+4>>2]=f&j|b&0}o=0;p=j>>>((gd(h|0)|0)>>>0);return (L=o,p)|0}f=(ja(h|0)|0)-(ja(j|0)|0)|0;if(f>>>0<=30){b=f+1|0;h=31-f|0;g=b;a=j<<h|l>>>(b>>>0);b=j>>>(b>>>0);f=0;h=l<<h;break}if(!e){o=0;p=0;return (L=o,p)|0}k[e>>2]=a|0;k[e+4>>2]=i|b&0;o=0;p=0;return (L=o,p)|0}while(0);if(!g){j=h;i=0;h=0}else{m=c|0|0;l=n|d&0;j=dd(m|0,l|0,-1,-1)|0;c=L;i=h;h=0;do{d=i;i=f>>>31|i<<1;f=h|f<<1;d=a<<1|d>>>31|0;n=a>>>31|b<<1|0;$c(j,c,d,n)|0;p=L;o=p>>31|((p|0)<0?-1:0)<<1;h=o&1;a=$c(d,n,o&m,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l)|0;b=L;g=g-1|0}while((g|0)!=0);j=i;i=0}g=0;if(e){k[e>>2]=a;k[e+4>>2]=b}o=(f|0)>>>31|(j|g)<<1|(g<<1|f>>>31)&0|i;p=(f<<1|0>>>31)&-2|h;return (L=o,p)|0}function od(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Ua[a&7](b|0,c|0,d|0)|0}function pd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Va[a&3](b|0,c|0,d|0,e|0,f|0)}function qd(a,b){a=a|0;b=b|0;Wa[a&7](b|0)}function rd(a,b){a=a|0;b=b|0;return Xa[a&1](b|0)|0}function sd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Ya[a&0](b|0,c|0,d|0)}function td(a){a=a|0;Za[a&3]()}function ud(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;_a[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function vd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return $a[a&1](b|0,c|0,d|0,e|0,f|0)|0}function wd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ab[a&3](b|0,c|0,d|0,e|0)}function xd(a,b,c){a=a|0;b=b|0;c=c|0;ka(0);return 0}function yd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(1)}function zd(a){a=a|0;ka(2)}function Ad(a){a=a|0;ka(3);return 0}function Bd(a,b,c){a=a|0;b=b|0;c=c|0;ka(4)}function Cd(){ka(5)}function Dd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ka(6)}function Ed(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ka(7);return 0}function Fd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(8)}

// EMSCRIPTEN_END_FUNCS
var Ua=[xd,ac,Qc,Jc,Ic,Kc,xd,xd];var Va=[yd,hc,gc,yd];var Wa=[zd,Xb,_b,Yb,Zb,$b,oc,Pc];var Xa=[Ad,Hc];var Ya=[Bd];var Za=[Cd,mc,nc,Cd];var _a=[Dd,jc,ic,Dd];var $a=[Ed,ob];var ab=[Fd,cc,dc,Fd];return{___cxa_can_catch:kc,_crn_get_levels:Db,_crn_get_uncompressed_size:Fb,_crn_decompress:Gb,_i64Add:dd,_crn_get_width:Bb,___cxa_is_pointer_type:lc,_i64Subtract:$c,_memset:ad,_malloc:Uc,_free:Vc,_memcpy:ed,_bitshift64Lshr:bd,_fflush:wc,_bitshift64Shl:cd,_crn_get_height:Cb,___errno_location:qc,_crn_get_dxt_format:Eb,runPostSets:_c,_emscripten_replace_memory:Ta,stackAlloc:bb,stackSave:cb,stackRestore:db,establishStackSpace:eb,setThrew:fb,setTempRet0:ib,getTempRet0:jb,dynCall_iiii:od,dynCall_viiiii:pd,dynCall_vi:qd,dynCall_ii:rd,dynCall_viii:sd,dynCall_v:td,dynCall_viiiiii:ud,dynCall_iiiiii:vd,dynCall_viiii:wd}})


// EMSCRIPTEN_END_ASM
(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch;e._crn_get_levels=Z._crn_get_levels;e.runPostSets=Z.runPostSets;e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size;e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height;e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;
var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush;e._crn_get_width=Z._crn_get_width;e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;e.dynCall_iiii=Z.dynCall_iiii;e.dynCall_viiiii=Z.dynCall_viiiii;e.dynCall_vi=Z.dynCall_vi;
e.dynCall_ii=Z.dynCall_ii;e.dynCall_viii=Z.dynCall_viii;e.dynCall_v=Z.dynCall_v;e.dynCall_viiiiii=Z.dynCall_viiiiii;e.dynCall_iiiiii=Z.dynCall_iiiiii;e.dynCall_viiii=Z.dynCall_viiii;n.aa=Z.stackAlloc;n.ua=Z.stackSave;n.ba=Z.stackRestore;n.Cd=Z.establishStackSpace;n.rb=Z.setTempRet0;n.fb=Z.getTempRet0;function ia(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}ia.prototype=Error();ia.prototype.constructor=ia;
var rd=null,jb=function sd(){e.calledRun||td();e.calledRun||(jb=sd)};
e.callMain=e.zd=function(a){function b(){for(var a=0;3>a;a++)d.push(0)}assert(0==I,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(0==bb.length,"cannot call main when preRun functions remain to be called");a=a||[];Ha||(Ha=!0,ab(cb));var c=a.length+1,d=[D(hb(e.thisProgram),"i8",0)];b();for(var f=0;f<c-1;f+=1)d.push(D(hb(a[f]),"i8",0)),b();d.push(0);d=D(d,"i32",0);try{var g=e._main(c,d,0);ud(g,!0)}catch(h){if(!(h instanceof ia))if("SimulateInfiniteLoop"==h)e.noExitRuntime=
!0;else throw h&&"object"===typeof h&&h.stack&&e.W("exception thrown: "+[h,h.stack]),h;}finally{}};
function td(a){function b(){if(!e.calledRun&&(e.calledRun=!0,!na)){Ha||(Ha=!0,ab(cb));ab(db);if(e.onRuntimeInitialized)e.onRuntimeInitialized();e._main&&vd&&e.callMain(a);if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}a=a||e.arguments;null===rd&&(rd=Date.now());if(!(0<I)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)fb(e.preRun.shift());ab(bb);0<I||e.calledRun||(e.setStatus?(e.setStatus("Running..."),
setTimeout(function(){setTimeout(function(){e.setStatus("")},1);b()},1)):b())}}e.run=e.run=td;function ud(a,b){if(!b||!e.noExitRuntime){if(!e.noExitRuntime&&(na=!0,m=void 0,ab(H),e.onExit))e.onExit(a);da?(process.stdout.once("drain",function(){process.exit(a)}),console.log(" "),setTimeout(function(){process.exit(a)},500)):ea&&"function"===typeof quit&&quit(a);throw new ia(a);}}e.exit=e.exit=ud;var wd=[];
function x(a){void 0!==a?(e.print(a),e.W(a),a=JSON.stringify(a)):a="";na=!0;var b="abort("+a+") at "+Oa()+"\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";wd&&wd.forEach(function(c){b=c(b,a)});throw b;}e.abort=e.abort=x;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();var vd=!0;e.noInitialRun&&(vd=!1);td();

window.Module = e;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    function loadFromArrayBuffer(arrayBuffer, src, crnLoad) {
        return new CompressedImage(src).loadFromArrayBuffer(arrayBuffer, crnLoad);
    }
    pixi_compressed_textures.loadFromArrayBuffer = loadFromArrayBuffer;
    var CompressedImage = (function (_super) {
        __extends(CompressedImage, _super);
        function CompressedImage(src, data, type, width, height, levels, internalFormat) {
            var _this = _super.call(this) || this;
            _this.complete = false;
            _this.isCompressedImage = true;
            _this.preserveSource = true;
            _this.onload = null;
            _this.baseTexture = null;
            _this.init(src, data, type, width, height, levels, internalFormat);
            return _this;
        }
        CompressedImage.prototype.init = function (src, data, type, width, height, levels, internalFormat) {
            if (width === void 0) { width = -1; }
            if (height === void 0) { height = -1; }
            this.src = src;
            this.resize(width, height);
            this._width = width;
            this._height = height;
            this.data = data;
            this.type = type;
            this.levels = levels;
            this.internalFormat = internalFormat;
            var oldComplete = this.complete;
            this.complete = !!data;
            if (!oldComplete && this.complete && this.onload) {
                this.onload({ target: this });
            }
            this.update();
            return this;
        };
        CompressedImage.prototype.dispose = function () {
            this.data = null;
        };
        CompressedImage.prototype.bind = function (baseTexture) {
            baseTexture.premultiplyAlpha = false;
            _super.prototype.bind.call(this, baseTexture);
        };
        CompressedImage.prototype.upload = function (renderer, baseTexture, glTexture) {
            var gl = renderer.state.gl;
            glTexture.compressed = false;
            renderer.texture.initCompressed();
            if (this.data === null) {
                throw "Trying to create a second (or more) webgl texture from the same CompressedImage : " + this.src;
            }
            var levels = this.levels;
            var width = this.width;
            var height = this.height;
            var offset = 0;
            for (var i = 0; i < levels; ++i) {
                var levelSize = this._internalLoader.levelBufferSize(width, height, i);
                var dxtLevel = new Uint8Array(this.data.buffer, this.data.byteOffset + offset, levelSize);
                gl.compressedTexImage2D(gl.TEXTURE_2D, i, this.internalFormat, width, height, 0, dxtLevel);
                width = width >> 1;
                if (width < 1) {
                    width = 1;
                }
                height = height >> 1;
                if (height < 1) {
                    height = 1;
                }
                offset += levelSize;
            }
            this._internalLoader.free();
            if (!this.preserveSource)
                this.data = null;
            return true;
        };
        CompressedImage.prototype.style = function (renderer, baseTexture, glTexture) {
            var gl = renderer.state.gl;
            var levels = this.levels;
            if (baseTexture.scaleMode === PIXI.SCALE_MODES.LINEAR) {
                if (levels > 1) {
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
                }
                else {
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
                }
            }
            else {
                if (levels > 1) {
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST);
                }
                else {
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
                    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
                }
            }
            return true;
        };
        CompressedImage.prototype.loadFromArrayBuffer = function (arrayBuffer, crnLoad) {
            var loaders = pixi_compressed_textures.Loaders;
            if (!loaders || !loaders.length) {
                throw "Registered compressed loaders is missing. Call `TextureSystem.initCompressed` before loading!";
            }
            var selectedLoaderCtr = undefined;
            for (var _i = 0, loaders_1 = loaders; _i < loaders_1.length; _i++) {
                var loader = loaders_1[_i];
                if (!crnLoad) {
                    if (loader.test(arrayBuffer)) {
                        selectedLoaderCtr = loader;
                        break;
                    }
                }
                else {
                    if (loader.type === "CRN") {
                        selectedLoaderCtr = loader;
                        break;
                    }
                }
            }
            if (selectedLoaderCtr) {
                this._internalLoader = new selectedLoaderCtr(this);
                return this._internalLoader.load(arrayBuffer);
            }
            else {
                throw new Error("Compressed texture format is not recognized: " + this.src);
            }
        };
        return CompressedImage;
    }(PIXI.resources.Resource));
    pixi_compressed_textures.CompressedImage = CompressedImage;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var AbstractInternalLoader = (function () {
        function AbstractInternalLoader(_image) {
            if (_image === void 0) { _image = new pixi_compressed_textures.CompressedImage("unknown"); }
            this._image = _image;
            this._format = 0;
            _image._internalLoader = this;
        }
        AbstractInternalLoader.prototype.free = function () { };
        ;
        AbstractInternalLoader.test = function (arrayBuffer) {
            return false;
        };
        AbstractInternalLoader.type = "ABSTRACT";
        return AbstractInternalLoader;
    }());
    pixi_compressed_textures.AbstractInternalLoader = AbstractInternalLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var _a;
    var ASTC_HEADER_LENGTH = 16;
    var ASTC_HEADER_DIM_X = 4;
    var ASTC_HEADER_DIM_Y = 5;
    var ASTC_HEADER_WIDTH = 7;
    var ASTC_HEADER_HEIGHT = 10;
    var ASTC_MAGIC = 0x5CA1AB13;
    var COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
    var COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
    var COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
    var COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
    var COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
    var COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
    var COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
    var COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
    var COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
    var COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
    var COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
    var COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
    var COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
    var COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
    var COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
    var ASTC_DIMS_TO_FORMAT = (_a = {},
        _a[4 * 4] = 0,
        _a[5 * 4] = 1,
        _a[5 * 5] = 2,
        _a[6 * 5] = 3,
        _a[6 * 6] = 4,
        _a[8 * 5] = 5,
        _a[8 * 6] = 6,
        _a[8 * 8] = 7,
        _a[10 * 5] = 8,
        _a[10 * 6] = 9,
        _a[10 * 8] = 10,
        _a[10 * 10] = 11,
        _a[12 * 10] = 12,
        _a[12 * 12] = 13,
        _a);
    var ASTCLoader = (function (_super) {
        __extends(ASTCLoader, _super);
        function ASTCLoader(_image, useSRGB) {
            if (useSRGB === void 0) { useSRGB = false; }
            var _this = _super.call(this, _image) || this;
            _this.useSRGB = useSRGB;
            _this._blockSize = { x: 0, y: 0 };
            return _this;
        }
        ASTCLoader.prototype.load = function (buffer) {
            if (!ASTCLoader.test(buffer)) {
                throw "Invalid magic number in ASTC header";
            }
            var header = new Uint8Array(buffer, 0, ASTC_HEADER_LENGTH);
            var dim_x = header[ASTC_HEADER_DIM_X];
            var dim_y = header[ASTC_HEADER_DIM_Y];
            var width = (header[ASTC_HEADER_WIDTH]) + (header[ASTC_HEADER_WIDTH + 1] << 8) + (header[ASTC_HEADER_WIDTH + 2] << 16);
            var height = (header[ASTC_HEADER_HEIGHT]) + (header[ASTC_HEADER_HEIGHT + 1] << 8) + (header[ASTC_HEADER_HEIGHT + 2] << 16);
            var internalFormat = ASTC_DIMS_TO_FORMAT[dim_x * dim_y] + (this.useSRGB ? COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : COMPRESSED_RGBA_ASTC_4x4_KHR);
            var astcData = new Uint8Array(buffer, ASTC_HEADER_LENGTH);
            this._format = internalFormat;
            this._blockSize.x = dim_x;
            this._blockSize.y = dim_y;
            var dest = this._image;
            dest.init(dest.src, astcData, 'ASTC', width, height, 1, internalFormat);
            return dest;
        };
        ASTCLoader.test = function (buffer) {
            var magic = new Int32Array(buffer, 0, 1);
            return magic[0] === ASTC_MAGIC;
        };
        ASTCLoader.prototype.levelBufferSize = function (width, height, mipLevel) {
            if (mipLevel === void 0) { mipLevel = 0; }
            var f_ = Math.floor;
            var dim_x = this._blockSize.x;
            var dim_y = this._blockSize.y;
            return (f_((width + dim_x - 1) / dim_x) * f_((height + dim_y - 1) / dim_y)) << 4;
        };
        ASTCLoader.type = "ASTC";
        return ASTCLoader;
    }(pixi_compressed_textures.AbstractInternalLoader));
    pixi_compressed_textures.ASTCLoader = ASTCLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
function fourCCToInt32(value) {
    return value.charCodeAt(0) +
        (value.charCodeAt(1) << 8) +
        (value.charCodeAt(2) << 16) +
        (value.charCodeAt(3) << 24);
}
function int32ToFourCC(value) {
    return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);
}
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var _a;
    var DDS_MAGIC = 0x20534444;
    var DDSD_MIPMAPCOUNT = 0x20000;
    var DDPF_FOURCC = 0x4;
    var DDS_HEADER_LENGTH = 31;
    var DDS_HEADER_MAGIC = 0;
    var DDS_HEADER_SIZE = 1;
    var DDS_HEADER_FLAGS = 2;
    var DDS_HEADER_HEIGHT = 3;
    var DDS_HEADER_WIDTH = 4;
    var DDS_HEADER_MIPMAPCOUNT = 7;
    var DDS_HEADER_PF_FLAGS = 20;
    var DDS_HEADER_PF_FOURCC = 21;
    var FOURCC_DXT1 = fourCCToInt32("DXT1");
    var FOURCC_DXT3 = fourCCToInt32("DXT3");
    var FOURCC_DXT5 = fourCCToInt32("DXT5");
    var FOURCC_ATC = fourCCToInt32("ATC ");
    var FOURCC_ATCA = fourCCToInt32("ATCA");
    var FOURCC_ATCI = fourCCToInt32("ATCI");
    var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
    var COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
    var COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
    var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
    var COMPRESSED_RGB_ATC_WEBGL = 0x8C92;
    var COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93;
    var COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
    var FOURCC_TO_FORMAT = (_a = {},
        _a[FOURCC_DXT1] = COMPRESSED_RGB_S3TC_DXT1_EXT,
        _a[FOURCC_DXT3] = COMPRESSED_RGBA_S3TC_DXT3_EXT,
        _a[FOURCC_DXT5] = COMPRESSED_RGBA_S3TC_DXT5_EXT,
        _a[FOURCC_ATC] = COMPRESSED_RGB_ATC_WEBGL,
        _a[FOURCC_ATCA] = COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
        _a[FOURCC_ATCI] = COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
        _a);
    var DDSLoader = (function (_super) {
        __extends(DDSLoader, _super);
        function DDSLoader(_image) {
            return _super.call(this, _image) || this;
        }
        DDSLoader.prototype.load = function (arrayBuffer) {
            if (!DDSLoader.test(arrayBuffer)) {
                throw "Invalid magic number in DDS header";
            }
            var header = new Int32Array(arrayBuffer, 0, DDS_HEADER_LENGTH);
            if (!(header[DDS_HEADER_PF_FLAGS] & DDPF_FOURCC))
                throw "Unsupported format, must contain a FourCC code";
            var fourCC = header[DDS_HEADER_PF_FOURCC];
            var internalFormat = FOURCC_TO_FORMAT[fourCC] || -1;
            if (internalFormat < 0) {
                throw "Unsupported FourCC code: " + int32ToFourCC(fourCC);
            }
            var levels = 1;
            if (header[DDS_HEADER_FLAGS] & DDSD_MIPMAPCOUNT) {
                levels = Math.max(1, header[DDS_HEADER_MIPMAPCOUNT]);
            }
            var width = header[DDS_HEADER_WIDTH];
            var height = header[DDS_HEADER_HEIGHT];
            var dataOffset = header[DDS_HEADER_SIZE] + 4;
            var dxtData = new Uint8Array(arrayBuffer, dataOffset);
            var dest = this._image;
            this._format = internalFormat;
            dest.init(dest.src, dxtData, 'DDS', width, height, levels, internalFormat);
            return dest;
        };
        DDSLoader.test = function (buffer) {
            var magic = new Int32Array(buffer, 0, 1);
            return magic[0] === DDS_MAGIC;
        };
        DDSLoader.prototype.levelBufferSize = function (width, height, mipLevel) {
            if (mipLevel === void 0) { mipLevel = 0; }
            switch (this._format) {
                case COMPRESSED_RGB_S3TC_DXT1_EXT:
                case COMPRESSED_RGB_ATC_WEBGL:
                    return ((width + 3) >> 2) * ((height + 3) >> 2) * 8;
                case COMPRESSED_RGBA_S3TC_DXT3_EXT:
                case COMPRESSED_RGBA_S3TC_DXT5_EXT:
                case COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:
                case COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:
                    return ((width + 3) >> 2) * ((height + 3) >> 2) * 16;
                default:
                    return 0;
            }
        };
        DDSLoader.type = "DDS";
        return DDSLoader;
    }(pixi_compressed_textures.AbstractInternalLoader));
    pixi_compressed_textures.DDSLoader = DDSLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var _a;
    var COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
    var COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
    var COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
    var COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
    var COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
    var PVR_FORMAT_2BPP_RGB = 0;
    var PVR_FORMAT_2BPP_RGBA = 1;
    var PVR_FORMAT_4BPP_RGB = 2;
    var PVR_FORMAT_4BPP_RGBA = 3;
    var PVR_FORMAT_ETC1 = 6;
    var PVR_FORMAT_DXT1 = 7;
    var PVR_FORMAT_DXT3 = 9;
    var PVR_FORMAT_DXT5 = 5;
    var PVR_HEADER_LENGTH = 13;
    var PVR_MAGIC = 0x03525650;
    var PVR_HEADER_MAGIC = 0;
    var PVR_HEADER_FORMAT = 2;
    var PVR_HEADER_HEIGHT = 6;
    var PVR_HEADER_WIDTH = 7;
    var PVR_HEADER_MIPMAPCOUNT = 11;
    var PVR_HEADER_METADATA = 12;
    var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
    var COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
    var COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
    var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
    var PVR_TO_FORMAT = (_a = {},
        _a[PVR_FORMAT_2BPP_RGB] = COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
        _a[PVR_FORMAT_2BPP_RGBA] = COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
        _a[PVR_FORMAT_4BPP_RGB] = COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
        _a[PVR_FORMAT_4BPP_RGBA] = COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
        _a[PVR_FORMAT_ETC1] = COMPRESSED_RGB_ETC1_WEBGL,
        _a[PVR_FORMAT_DXT1] = COMPRESSED_RGB_S3TC_DXT1_EXT,
        _a[PVR_FORMAT_DXT3] = COMPRESSED_RGBA_S3TC_DXT3_EXT,
        _a[PVR_FORMAT_DXT5] = COMPRESSED_RGBA_S3TC_DXT5_EXT,
        _a);
    var PVRTCLoader = (function (_super) {
        __extends(PVRTCLoader, _super);
        function PVRTCLoader(_image) {
            return _super.call(this, _image) || this;
        }
        PVRTCLoader.prototype.load = function (arrayBuffer) {
            if (!pixi_compressed_textures.DDSLoader.test(arrayBuffer)) {
                throw "Invalid magic number in PVR header";
            }
            var header = new Int32Array(arrayBuffer, 0, PVR_HEADER_LENGTH);
            var format = header[PVR_HEADER_FORMAT];
            var internalFormat = PVR_TO_FORMAT[format] || -1;
            var width = header[PVR_HEADER_WIDTH];
            var height = header[PVR_HEADER_HEIGHT];
            var levels = header[PVR_HEADER_MIPMAPCOUNT];
            var dataOffset = header[PVR_HEADER_METADATA] + 52;
            var pvrtcData = new Uint8Array(arrayBuffer, dataOffset);
            var dest = this._image;
            this._format = internalFormat;
            dest.init(dest.src, pvrtcData, 'PVR', width, height, levels, internalFormat);
            return dest;
        };
        PVRTCLoader.test = function (buffer) {
            var magic = new Int32Array(buffer, 0, 1);
            return magic[0] === PVR_MAGIC;
        };
        PVRTCLoader.prototype.levelBufferSize = function (width, height, mipLevel) {
            if (mipLevel === void 0) { mipLevel = 0; }
            switch (this._format) {
                case COMPRESSED_RGB_S3TC_DXT1_EXT:
                case COMPRESSED_RGB_ETC1_WEBGL:
                    return ((width + 3) >> 2) * ((height + 3) >> 2) * 8;
                case COMPRESSED_RGBA_S3TC_DXT3_EXT:
                case COMPRESSED_RGBA_S3TC_DXT5_EXT:
                    return ((width + 3) >> 2) * ((height + 3) >> 2) * 16;
                case COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
                case COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
                    return Math.floor((Math.max(width, 8) * Math.max(height, 8) * 4 + 7) / 8);
                case COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
                case COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
                    return Math.floor((Math.max(width, 16) * Math.max(height, 8) * 2 + 7) / 8);
                default:
                    return 0;
            }
        };
        PVRTCLoader.type = "PVR";
        return PVRTCLoader;
    }(pixi_compressed_textures.AbstractInternalLoader));
    pixi_compressed_textures.PVRTCLoader = PVRTCLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var _a, _b;
    var BASIS_FORMAT = {
        cTFETC1: 0,
        cTFBC1: 2,
        cTFBC3: 3,
        cTFPVRTC1_4_RGB: 8,
        cTFPVRTC1_4_RGBA: 9,
        cTFASTC_4x4: 10,
        cTFRGBA32: 11
    };
    var BASIS_HAS_ALPHA = (_a = {},
        _a[3] = true,
        _a[9] = true,
        _a[10] = true,
        _a[11] = true,
        _a);
    var NON_COMPRESSED = -1;
    var COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
    var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
    var COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
    var COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
    var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
    var COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
    var COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
    var COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
    var BASIS_TO_FMT = (_b = {},
        _b[BASIS_FORMAT.cTFRGBA32] = NON_COMPRESSED,
        _b[BASIS_FORMAT.cTFETC1] = COMPRESSED_RGB_ETC1_WEBGL,
        _b[BASIS_FORMAT.cTFBC1] = COMPRESSED_RGB_S3TC_DXT1_EXT,
        _b[BASIS_FORMAT.cTFBC3] = COMPRESSED_RGBA_S3TC_DXT5_EXT,
        _b[BASIS_FORMAT.cTFPVRTC1_4_RGB] = COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
        _b[BASIS_FORMAT.cTFPVRTC1_4_RGBA] = COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
        _b[BASIS_FORMAT.cTFASTC_4x4] = COMPRESSED_RGBA_ASTC_4x4_KHR,
        _b);
    var FMT_TO_BASIS = Object.keys(BASIS_TO_FMT).reduce(function (acc, next) {
        acc[BASIS_TO_FMT[+next]] = +next;
        return acc;
    }, {});
    var BASISLoader = (function (_super) {
        __extends(BASISLoader, _super);
        function BASISLoader(_image) {
            var _this = _super.call(this, _image) || this;
            _this.type = "BASIS";
            _this._file = undefined;
            return _this;
        }
        BASISLoader.test = function (array) {
            var header = new Uint32Array(array, 0, 1)[0];
            var decoder = !!BASISLoader.BASIS_BINDING;
            var isValid = header === 0x134273 && decoder;
            var isSupported = BASISLoader.RGB_FORMAT && BASISLoader.RGBA_FORMAT;
            if (!isValid && isSupported) {
                console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!");
            }
            return (isSupported && isValid);
        };
        BASISLoader.bindTranscoder = function (fileCtr, ext) {
            if (!fileCtr || !ext) {
                throw "Invalid state! undef fileCtr or ext invalid!";
            }
            ;
            var plain = Object.keys(ext)
                .reduce(function (acc, key) {
                var val = ext[key];
                if (!val) {
                    return acc;
                }
                ;
                return Object.assign(acc, val.__proto__);
            }, {});
            var latestOp = undefined;
            var lastestAlpha = undefined;
            for (var v in plain) {
                var native = plain[v];
                if (FMT_TO_BASIS[native] !== undefined) {
                    var basis = FMT_TO_BASIS[native];
                    if (BASIS_HAS_ALPHA[basis]) {
                        lastestAlpha = {
                            native: native, name: v, basis: basis
                        };
                    }
                    else {
                        latestOp = {
                            native: native, name: v, basis: basis
                        };
                    }
                }
            }
            BASISLoader.RGB_FORMAT = latestOp || lastestAlpha;
            BASISLoader.RGBA_FORMAT = lastestAlpha || latestOp;
            BASISLoader.BASIS_BINDING = fileCtr;
            console.log("[BASISLoader] Supported formats:", "\nRGB:" + BASISLoader.RGB_FORMAT.name + "\nRGBA:" + BASISLoader.RGBA_FORMAT.name);
            pixi_compressed_textures.RegisterCompressedLoader(BASISLoader);
            pixi_compressed_textures.RegisterCompressedExtensions('basis');
        };
        BASISLoader.prototype.load = function (buffer) {
            if (!BASISLoader.test(buffer)) {
                throw "BASIS Transcoder not binded or transcoding not supported =(!";
            }
            this._loadAsync(buffer);
            return this._image;
        };
        BASISLoader.prototype._loadAsync = function (buffer) {
            return __awaiter(this, void 0, void 0, function () {
                var startTime, BasisFileCtr, basisFile, width, height, levels, hasAlpha, dest, target, dst, _a, name;
                return __generator(this, function (_b) {
                    switch (_b.label) {
                        case 0:
                            startTime = performance.now();
                            BasisFileCtr = BASISLoader.BASIS_BINDING;
                            basisFile = new BasisFileCtr(new Uint8Array(buffer));
                            return [4, basisFile.getImageWidth(0, 0)];
                        case 1:
                            width = _b.sent();
                            return [4, basisFile.getImageHeight(0, 0)];
                        case 2:
                            height = _b.sent();
                            levels = 1;
                            return [4, basisFile.getHasAlpha()];
                        case 3:
                            hasAlpha = _b.sent();
                            dest = this._image;
                            return [4, basisFile.startTranscoding()];
                        case 4:
                            if (!(_b.sent())) {
                                throw "Transcoding error!";
                            }
                            target = hasAlpha ? BASISLoader.RGBA_FORMAT : BASISLoader.RGB_FORMAT;
                            console.log("Grats! BASIS will be transcoded to:", target);
                            _a = Uint8Array.bind;
                            return [4, basisFile.getImageTranscodedSizeInBytes(0, 0, target.basis)];
                        case 5:
                            dst = new (_a.apply(Uint8Array, [void 0, _b.sent()]))();
                            return [4, basisFile.transcodeImage(dst, 0, 0, target.basis, !!0, !!0)];
                        case 6:
                            if (!(_b.sent())) {
                                throw "Transcoding error!";
                            }
                            console.log("[BASISLoader] Totla transcoding time:", performance.now() - startTime);
                            this._format = target.native;
                            this._file = basisFile;
                            name = target.name.replace("COMPRESSED_", "");
                            return [2, dest.init(dest.src, dst, 'BASIS|' + name, width, height, levels, target.native)];
                    }
                });
            });
        };
        BASISLoader.prototype.levelBufferSize = function (width, height, level) {
            return this._file ? this._file.getImageTranscodedSizeInBytes(0, level, FMT_TO_BASIS[this._format]) : undefined;
        };
        BASISLoader.BASIS_BINDING = undefined;
        return BASISLoader;
    }(pixi_compressed_textures.AbstractInternalLoader));
    pixi_compressed_textures.BASISLoader = BASISLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var CRN_Module = window.CRN_Module;
    function arrayBufferCopy(src, dst, dstByteOffset, numBytes) {
        var dst32Offset = dstByteOffset / 4;
        var tail = (numBytes % 4);
        var src32 = new Uint32Array(src.buffer, 0, (numBytes - tail) / 4);
        var dst32 = new Uint32Array(dst.buffer);
        for (var ii = 0; ii < src32.length; ii++) {
            dst32[dst32Offset + ii] = src32[ii];
        }
        for (var i = numBytes - tail; i < numBytes; i++) {
            dst[dstByteOffset + i] = src[i];
        }
    }
    var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
    var COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
    var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
    var DXT_FORMAT_MAP = [
        COMPRESSED_RGB_S3TC_DXT1_EXT,
        COMPRESSED_RGBA_S3TC_DXT3_EXT,
        COMPRESSED_RGBA_S3TC_DXT5_EXT
    ];
    var CRNLoader = (function (_super) {
        __extends(CRNLoader, _super);
        function CRNLoader(_image) {
            return _super.call(this, _image) || this;
        }
        CRNLoader.prototype.load = function (arrayBuffer) {
            var srcSize = arrayBuffer.byteLength;
            var bytes = new Uint8Array(arrayBuffer);
            var src = CRN_Module._malloc(srcSize);
            arrayBufferCopy(bytes, CRN_Module.HEAPU8, src, srcSize);
            var width = CRN_Module._crn_get_width(src, srcSize);
            var height = CRN_Module._crn_get_height(src, srcSize);
            var levels = CRN_Module._crn_get_levels(src, srcSize);
            var format = CRN_Module._crn_get_dxt_format(src, srcSize);
            var dstSize = CRN_Module._crn_get_uncompressed_size(src, srcSize, 0);
            var dst = CRN_Module._malloc(dstSize);
            CRN_Module._crn_decompress(src, srcSize, dst, dstSize, 0);
            var dxtData = new Uint8Array(CRN_Module.HEAPU8.buffer, dst, dstSize);
            var internalFormat = DXT_FORMAT_MAP[format];
            var dest = this._image;
            this._format = internalFormat;
            this._caches = [src, dst];
            return dest.init(dest.src, dxtData, 'CRN', width, height, levels, internalFormat);
        };
        CRNLoader.prototype.levelBufferSize = function (width, height, mipLevel) {
            if (mipLevel === void 0) { mipLevel = 0; }
            return pixi_compressed_textures.DDSLoader.prototype.levelBufferSize.call(this, width, height, mipLevel);
        };
        CRNLoader.prototype.free = function () {
            CRN_Module._free(this._caches[0]);
            CRN_Module._free(this._caches[1]);
        };
        CRNLoader.test = function (buffer) {
            return !!CRN_Module;
        };
        CRNLoader.type = "CRN";
        return CRNLoader;
    }(pixi_compressed_textures.AbstractInternalLoader));
    pixi_compressed_textures.CRNLoader = CRNLoader;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    pixi_compressed_textures.Loaders = [
        pixi_compressed_textures.DDSLoader,
        pixi_compressed_textures.PVRTCLoader,
        pixi_compressed_textures.ASTCLoader,
        pixi_compressed_textures.CRNLoader
    ];
    PIXI.systems.TextureSystem.prototype.initCompressed = function () {
        var gl = this.gl;
        if (!this.compressedExtensions) {
            this.compressedExtensions = {
                dxt: gl.getExtension("WEBGL_compressed_texture_s3tc"),
                pvrtc: (gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")),
                astc: gl.getExtension("WEBGL_compressed_texture_astc"),
                atc: gl.getExtension("WEBGL_compressed_texture_atc"),
                etc1: gl.getExtension("WEBGL_compressed_texture_etc1")
            };
            this.compressedExtensions.crn = this.compressedExtensions.dxt;
        }
    };
    function RegisterCompressedLoader() {
        var loaders = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            loaders[_i] = arguments[_i];
        }
        pixi_compressed_textures.Loaders = pixi_compressed_textures.Loaders || [];
        for (var e in loaders) {
            if (pixi_compressed_textures.Loaders.indexOf(loaders[e]) < 0) {
                pixi_compressed_textures.Loaders.push(loaders[e]);
            }
        }
    }
    pixi_compressed_textures.RegisterCompressedLoader = RegisterCompressedLoader;
    function detectExtensions(renderer, resolution) {
        var extensions = [];
        if (renderer instanceof PIXI.Renderer) {
            renderer.texture.initCompressed();
            var data = renderer.texture.compressedExtensions;
            if (data.dxt)
                extensions.push('.dds');
            if (data.pvrtc)
                extensions.push('.pvr');
            if (data.atc)
                extensions.push('.atc');
            if (data.astc)
                extensions.push('.astc');
            if (data.etc1)
                extensions.push('.etc1');
        }
        resolution = resolution || renderer.resolution;
        var res = "@" + resolution + "x";
        var ext = extensions.slice(0);
        while (ext.length > 0) {
            extensions.push(res + ext.pop());
        }
        extensions.push(res + ".png");
        extensions.push(res + ".jpg");
        extensions.push(res + ".json");
        extensions.push(res + ".atlas");
        return extensions;
    }
    pixi_compressed_textures.detectExtensions = detectExtensions;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var Resource = PIXI.LoaderResource;
    pixi_compressed_textures.TEXTURE_EXTENSIONS = [];
    function RegisterCompressedExtensions() {
        var exts = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            exts[_i] = arguments[_i];
        }
        for (var e in exts) {
            if (pixi_compressed_textures.TEXTURE_EXTENSIONS.indexOf(exts[e]) < 0) {
                pixi_compressed_textures.TEXTURE_EXTENSIONS.push(exts[e]);
                Resource.setExtensionXhrType(exts[e], Resource.XHR_RESPONSE_TYPE.BUFFER);
            }
        }
    }
    pixi_compressed_textures.RegisterCompressedExtensions = RegisterCompressedExtensions;
    var ImageParser = (function () {
        function ImageParser() {
        }
        ImageParser.use = function (resource, next) {
            var url = resource.url;
            var idx = url.lastIndexOf('.');
            var amper = url.lastIndexOf('?');
            var ext = url.substring(idx + 1, amper > 0 ? amper : url.length);
            if (pixi_compressed_textures.TEXTURE_EXTENSIONS.indexOf(ext) < 0) {
                next();
                return;
            }
            if (!resource.data) {
                throw new Error("compressedImageParser middleware for PixiJS v5 must be specified in loader.use()" +
                    " and must have resource.data when completed");
            }
            if (resource.compressedImage) {
                next();
                return;
            }
            resource.compressedImage = new pixi_compressed_textures.CompressedImage(resource.url);
            resource.compressedImage.loadFromArrayBuffer(resource.data, ext === 'crn');
            resource.isCompressedImage = true;
            resource.texture = fromResource(resource.compressedImage, resource.url, resource.name);
            next();
        };
        return ImageParser;
    }());
    pixi_compressed_textures.ImageParser = ImageParser;
    function fromResource(resource, imageUrl, name) {
        var baseTexture = new PIXI.BaseTexture(resource, {
            scaleMode: PIXI.settings.SCALE_MODE,
            resolution: PIXI.utils.getResolutionOfUrl(imageUrl),
        });
        var texture = new PIXI.Texture(baseTexture);
        if (!name) {
            name = imageUrl;
        }
        PIXI.BaseTexture.addToCache(texture.baseTexture, name);
        PIXI.Texture.addToCache(texture, name);
        if (name !== imageUrl) {
            PIXI.BaseTexture.addToCache(texture.baseTexture, imageUrl);
            PIXI.Texture.addToCache(texture, imageUrl);
        }
        return texture;
    }
    RegisterCompressedExtensions('dds', 'crn', 'pvr', 'etc1', 'astc');
    PIXI.Loader.registerPlugin(ImageParser);
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    function extensionChooser(supportedExtensions) {
        if (supportedExtensions === void 0) { supportedExtensions = []; }
        return function (resource, next) {
            var ext = resource.metadata.choice;
            if (!ext) {
                return next();
            }
            var url = resource.url;
            var k = 0;
            if (!resource._defaultUrlChoice) {
                resource._defaultUrlChoice = url;
                k = url.lastIndexOf(".");
                if (k >= 0) {
                    resource._baseUrl = url.substring(0, k);
                    if (k >= 4 && url.substring(k - 3, 3) === '@1x') {
                        resource._baseUrl = url.substring(0, k);
                    }
                }
                else {
                    return next();
                }
            }
            for (var i = ext.length - 1; i >= 0; i--) {
                url = resource._baseUrl + ext[i];
                var isSupported = false;
                for (var j = 0; j < supportedExtensions.length; j++) {
                    if (ext[i] === supportedExtensions[j]) {
                        resource.url = url;
                        var pureExt = ext[i];
                        if (pureExt.indexOf('@') > -1) {
                            pureExt = pureExt.replace(/@[0-9.]*x/, "");
                        }
                        k = pureExt.indexOf('.');
                        if (k >= 0) {
                            pureExt = pureExt.substring(k + 1);
                        }
                        resource.extension = pureExt;
                        resource.loadType = resource._determineLoadType();
                        next();
                        return;
                    }
                }
            }
            next();
        };
    }
    pixi_compressed_textures.extensionChooser = extensionChooser;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    var ExtensionFixer = (function () {
        function ExtensionFixer() {
        }
        ExtensionFixer.use = function (resource, next) {
            if (resource.texture && resource._defaultUrlChoice && resource._defaultUrl !== resource.url) {
                var texture = resource.texture;
                var baseTexture = texture.baseTexture;
                var oldUrl = resource.url;
                var newUrl = resource._defaultUrlChoice;
                var ind = baseTexture.textureCacheIds.indexOf(oldUrl);
                if (ind >= 0) {
                    baseTexture.textureCacheIds[ind] = newUrl;
                    delete PIXI.utils.BaseTextureCache[resource.url];
                    PIXI.utils.BaseTextureCache[newUrl] = baseTexture;
                }
                ind = texture.textureCacheIds.indexOf(oldUrl);
                if (ind >= 0) {
                    texture.textureCacheIds[ind] = newUrl;
                    delete PIXI.utils.TextureCache[resource.url];
                    PIXI.utils.TextureCache[newUrl] = baseTexture;
                }
            }
            next();
        };
        return ExtensionFixer;
    }());
    pixi_compressed_textures.ExtensionFixer = ExtensionFixer;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));
var pixi_compressed_textures;
(function (pixi_compressed_textures) {
    PIXI.compressedTextures = pixi_compressed_textures;
})(pixi_compressed_textures || (pixi_compressed_textures = {}));

/*!
 * pixi-filters - v3.0.3
 * Compiled Wed, 29 May 2019 03:04:05 UTC
 *
 * pixi-filters is licensed under the MIT License.
 * http://www.opensource.org/licenses/mit-license
 */
var __filters=function(e,t,n,r,o,i,l,s){"use strict";var a="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",u="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (c.a > 0.0) {\n        c.rgb /= c.a;\n\n        vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n        rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n        rgb.r *= red;\n        rgb.g *= green;\n        rgb.b *= blue;\n        c.rgb = rgb * brightness;\n\n        c.rgb *= c.a;\n    }\n\n    gl_FragColor = c * alpha;\n}\n",c=function(e){function t(t){e.call(this,a,u),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(e,t,n,r){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,n,r)},t}(t.Filter),f=a,h="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n\n    // Sample top left pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n    // Sample top right pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n    // Sample bottom right pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n    // Sample bottom left pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n    // Average\n    color *= 0.25;\n\n    gl_FragColor = color;\n}",p="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n\n    // Sample top left pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample top right pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample bottom right pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample bottom left pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Average\n    color *= 0.25;\n\n    gl_FragColor = color;\n}\n",d=function(e){function t(t,r,o){void 0===t&&(t=4),void 0===r&&(r=3),void 0===o&&(o=!1),e.call(this,f,o?p:h),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new n.Point,this.pixelSize=1,this._clamp=o,this._kernels=null,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=r)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){var o,i=this.pixelSize.x/t._frame.width,l=this.pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*i,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,t,n,r);else{for(var s,a=e.getFilterTexture(),u=t,c=a,f=this._quality-1,h=0;h<f;h++)o=this._kernels[h]+.5,this.uniforms.uOffset[0]=o*i,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,u,c,!0),s=u,u=c,c=s;o=this._kernels[f]+.5,this.uniforms.uOffset[0]=o*i,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,u,n,r),e.returnFilterTexture(a)}},t.prototype._generateKernels=function(){var e=this._blur,t=this._quality,n=[e];if(e>0)for(var r=e,o=e/t,i=1;i<t;i++)r-=o,n.push(r);this._kernels=n},r.kernels.get=function(){return this._kernels},r.kernels.set=function(e){Array.isArray(e)&&e.length>0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},r.clamp.get=function(){return this._clamp},r.pixelSize.set=function(e){"number"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof n.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},r.pixelSize.get=function(){return this._pixelSize},r.quality.get=function(){return this._quality},r.quality.set=function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},r.blur.get=function(){return this._blur},r.blur.set=function(e){this._blur=e,this._generateKernels()},Object.defineProperties(t.prototype,r),t}(t.Filter),m=a,g="\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n    vec4 color = texture2D(uSampler, vTextureCoord);\n\n    // A simple & fast algorithm for getting brightness.\n    // It's inaccuracy , but good enought for this feature.\n    float _max = max(max(color.r, color.g), color.b);\n    float _min = min(min(color.r, color.g), color.b);\n    float brightness = (_max + _min) * 0.5;\n\n    if(brightness > threshold) {\n        gl_FragColor = color;\n    } else {\n        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n}\n",v=function(e){function t(t){void 0===t&&(t=.5),e.call(this,m,g),this.threshold=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={threshold:{configurable:!0}};return n.threshold.get=function(){return this.uniforms.threshold},n.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(t.prototype,n),t}(t.Filter),x="uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    color.rgb *= brightness;\n    vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n    bloomColor.rgb *= bloomScale;\n    gl_FragColor = color + bloomColor;\n}\n",y=function(e){function t(t){e.call(this,m,x),"number"==typeof t&&(t={threshold:t}),t=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:r.settings.RESOLUTION},t),this.bloomScale=t.bloomScale,this.brightness=t.brightness;var n=t.kernels,o=t.blur,i=t.quality,l=t.pixelSize,s=t.resolution;this._extractFilter=new v(t.threshold),this._extractFilter.resolution=s,this._blurFilter=n?new d(n):new d(o,i),this.pixelSize=l,this.resolution=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return t.prototype.apply=function(e,t,n,r,o){var i=e.getFilterTexture();this._extractFilter.apply(e,t,i,!0,o);var l=e.getFilterTexture();this._blurFilter.apply(e,i,l,!0,o),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,e.applyFilter(this,t,n,r),e.returnFilterTexture(l),e.returnFilterTexture(i)},n.resolution.get=function(){return this._resolution},n.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},n.threshold.get=function(){return this._extractFilter.threshold},n.threshold.set=function(e){this._extractFilter.threshold=e},n.kernels.get=function(){return this._blurFilter.kernels},n.kernels.set=function(e){this._blurFilter.kernels=e},n.blur.get=function(){return this._blurFilter.blur},n.blur.set=function(e){this._blurFilter.blur=e},n.quality.get=function(){return this._blurFilter.quality},n.quality.set=function(e){this._blurFilter.quality=e},n.pixelSize.get=function(){return this._blurFilter.pixelSize},n.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(t.prototype,n),t}(t.Filter),b=a,_="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n    coord *= filterArea.xy;\n    coord += filterArea.zw;\n\n    return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n    coord -= filterArea.zw;\n    coord /= filterArea.xy;\n\n    return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n    return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n    return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n    p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n    if (clamp(p.x, 0.0, 4.0) == p.x)\n    {\n        if (clamp(p.y, 0.0, 4.0) == p.y)\n        {\n            if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n        }\n    }\n    return 0.0;\n}\n\nvoid main()\n{\n    vec2 coord = mapCoord(vTextureCoord);\n\n    // get the rounded color..\n    vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n    pixCoord = unmapCoord(pixCoord);\n\n    vec4 color = texture2D(uSampler, pixCoord);\n\n    // determine the character to use\n    float gray = (color.r + color.g + color.b) / 3.0;\n\n    float n =  65536.0;             // .\n    if (gray > 0.2) n = 65600.0;    // :\n    if (gray > 0.3) n = 332772.0;   // *\n    if (gray > 0.4) n = 15255086.0; // o\n    if (gray > 0.5) n = 23385164.0; // &\n    if (gray > 0.6) n = 15252014.0; // 8\n    if (gray > 0.7) n = 13199452.0; // @\n    if (gray > 0.8) n = 11512810.0; // #\n\n    // get the mod..\n    vec2 modd = getMod(coord, vec2(pixelSize));\n\n    gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n",C=function(e){function t(t){void 0===t&&(t=8),e.call(this,b,_),this.size=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.uniforms.pixelSize},n.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(t.prototype,n),t}(t.Filter),S=a,F="precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n    vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    float light = texture2D(uSampler, vTextureCoord - transform).a;\n    float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n    color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n    color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n    gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n",z=function(e){function t(t){void 0===t&&(t={}),e.call(this,S,F),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),t=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),this.rotation=t.rotation,this.thickness=t.thickness,this.lightColor=t.lightColor,this.lightAlpha=t.lightAlpha,this.shadowColor=t.shadowColor,this.shadowAlpha=t.shadowAlpha}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return t.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/n.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*n.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return o.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){o.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return o.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){o.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(t.prototype,r),t}(t.Filter),A=function(e){function t(t,o,a,u){var c,f;void 0===t&&(t=2),void 0===o&&(o=4),void 0===a&&(a=r.settings.RESOLUTION),void 0===u&&(u=5),e.call(this),"number"==typeof t?(c=t,f=t):t instanceof n.Point?(c=t.x,f=t.y):Array.isArray(t)&&(c=t[0],f=t[1]),this.blurXFilter=new s.BlurFilterPass(!0,c,o,a,u),this.blurYFilter=new s.BlurFilterPass(!1,f,o,a,u),this.blurYFilter.blendMode=i.BLEND_MODES.SCREEN,this.defaultFilter=new l.AlphaFilter}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var o={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return t.prototype.apply=function(e,t,n){var r=e.getFilterTexture(!0);this.defaultFilter.apply(e,t,n),this.blurXFilter.apply(e,t,r),this.blurYFilter.apply(e,r,n),e.returnFilterTexture(r)},o.blur.get=function(){return this.blurXFilter.blur},o.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},o.blurX.get=function(){return this.blurXFilter.blur},o.blurX.set=function(e){this.blurXFilter.blur=e},o.blurY.get=function(){return this.blurYFilter.blur},o.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(t.prototype,o),t}(t.Filter),w=a,T="uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n    vec2 coord = vTextureCoord * filterArea.xy;\n    coord -= center * dimensions.xy;\n    float distance = length(coord);\n    if (distance < radius) {\n        float percent = distance / radius;\n        if (strength > 0.0) {\n            coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n        } else {\n            coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n        }\n    }\n    coord += center * dimensions.xy;\n    coord /= filterArea.xy;\n    vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    vec4 color = texture2D(uSampler, clampedCoord);\n    if (coord != clampedCoord) {\n        color *= max(0.0, 1.0 - length(coord - clampedCoord));\n    }\n\n    gl_FragColor = color;\n}\n",D=function(e){function t(t,n,r){e.call(this,w,T),this.uniforms.dimensions=new Float32Array(2),this.center=t||[.5,.5],this.radius="number"==typeof n?n:100,this.strength="number"==typeof r?r:1}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,n,r)},n.radius.get=function(){return this.uniforms.radius},n.radius.set=function(e){this.uniforms.radius=e},n.strength.get=function(){return this.uniforms.strength},n.strength.set=function(e){this.uniforms.strength=e},n.center.get=function(){return this.uniforms.center},n.center.set=function(e){this.uniforms.center=e},Object.defineProperties(t.prototype,n),t}(t.Filter),O=a,P="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n    vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n    vec4 adjusted;\n    if (color.a > 0.0) {\n        color.rgb /= color.a;\n        float innerWidth = _size - 1.0;\n        float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n        float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n        float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n        float s0 = xOffset + (zSlice0 * _sliceSize);\n        float s1 = xOffset + (zSlice1 * _sliceSize);\n        float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n        vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n        vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n        float zOffset = fract(color.b * innerWidth);\n        adjusted = mix(slice0Color, slice1Color, zOffset);\n\n        color.rgb *= color.a;\n    }\n    gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}",M=function(e){function n(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=1),e.call(this,O,P),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=n,this.mix=r,this.colorMap=t}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var r={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return n.prototype.apply=function(e,t,n,r){this.uniforms._mix=this.mix,e.applyFilter(this,t,n,r)},r.colorSize.get=function(){return this._size},r.colorMap.get=function(){return this._colorMap},r.colorMap.set=function(e){e instanceof t.Texture||(e=t.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},r.nearest.get=function(){return this._nearest},r.nearest.set=function(e){this._nearest=e,this._scaleMode=e?i.SCALE_MODES.NEAREST:i.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},n.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},n.prototype.destroy=function(t){this._colorMap&&this._colorMap.destroy(t),e.prototype.destroy.call(this)},Object.defineProperties(n.prototype,r),n}(t.Filter),R=a,j="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n    vec4 currentColor = texture2D(uSampler, vTextureCoord);\n    vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n    float colorDistance = length(colorDiff);\n    float doReplace = step(colorDistance, epsilon);\n    gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n",k=function(e){function t(t,n,r){void 0===t&&(t=16711680),void 0===n&&(n=0),void 0===r&&(r=.4),e.call(this,R,j),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=t,this.newColor=n,this.epsilon=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return n.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(o.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=o.rgb2hex(t))},n.originalColor.get=function(){return this._originalColor},n.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(o.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=o.rgb2hex(t))},n.newColor.get=function(){return this._newColor},n.epsilon.set=function(e){this.uniforms.epsilon=e},n.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(t.prototype,n),t}(t.Filter),L=a,I="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",E=function(e){function t(t,n,r){void 0===n&&(n=200),void 0===r&&(r=200),e.call(this,L,I),this.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==t&&(this.matrix=t),this.width=n,this.height=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return n.matrix.get=function(){return this.uniforms.matrix},n.matrix.set=function(e){var t=this;e.forEach(function(e,n){return t.uniforms.matrix[n]=e})},n.width.get=function(){return 1/this.uniforms.texelSize[0]},n.width.set=function(e){this.uniforms.texelSize[0]=1/e},n.height.get=function(){return 1/this.uniforms.texelSize[1]},n.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(t.prototype,n),t}(t.Filter),B=a,X="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",N=function(e){function t(){e.call(this,B,X)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t.Filter),q=a,W="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n    vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n    vec2 coord = pixelCoord / dimensions;\n\n    vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n    float _c = curvature > 0. ? curvature : 1.;\n    float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n    vec2 uv = dir * k;\n\n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n    vec3 rgb = gl_FragColor.rgb;\n\n\n    if (noise > 0.0 && noiseSize > 0.0)\n    {\n        pixelCoord.x = floor(pixelCoord.x / noiseSize);\n        pixelCoord.y = floor(pixelCoord.y / noiseSize);\n        float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n        rgb += _noise * noise;\n    }\n\n    if (lineWidth > 0.0) {\n        float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n        float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n        rgb *= j;\n        float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n        rgb *= 0.99 + ceil(segment) * 0.015;\n    }\n\n    if (vignetting > 0.0)\n    {\n        float outter = SQRT_2 - vignetting * SQRT_2;\n        float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n        rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n    }\n\n    gl_FragColor.rgb = rgb;\n}\n",K=function(e){function t(t){e.call(this,q,W),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},t)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,n,r)},n.curvature.set=function(e){this.uniforms.curvature=e},n.curvature.get=function(){return this.uniforms.curvature},n.lineWidth.set=function(e){this.uniforms.lineWidth=e},n.lineWidth.get=function(){return this.uniforms.lineWidth},n.lineContrast.set=function(e){this.uniforms.lineContrast=e},n.lineContrast.get=function(){return this.uniforms.lineContrast},n.verticalLine.set=function(e){this.uniforms.verticalLine=e},n.verticalLine.get=function(){return this.uniforms.verticalLine},n.noise.set=function(e){this.uniforms.noise=e},n.noise.get=function(){return this.uniforms.noise},n.noiseSize.set=function(e){this.uniforms.noiseSize=e},n.noiseSize.get=function(){return this.uniforms.noiseSize},n.vignetting.set=function(e){this.uniforms.vignetting=e},n.vignetting.get=function(){return this.uniforms.vignetting},n.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},n.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},n.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},n.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(t.prototype,n),t}(t.Filter),Y=a,G="precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n   float s = sin(angle), c = cos(angle);\n   vec2 tex = vTextureCoord * filterArea.xy;\n   vec2 point = vec2(\n       c * tex.x - s * tex.y,\n       s * tex.x + c * tex.y\n   ) * scale;\n   return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n   vec4 color = texture2D(uSampler, vTextureCoord);\n   float average = (color.r + color.g + color.b) / 3.0;\n   gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",Q=function(e){function t(t,n){void 0===t&&(t=1),void 0===n&&(n=5),e.call(this,Y,G),this.scale=t,this.angle=n}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={scale:{configurable:!0},angle:{configurable:!0}};return n.scale.get=function(){return this.uniforms.scale},n.scale.set=function(e){this.uniforms.scale=e},n.angle.get=function(){return this.uniforms.angle},n.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(t.prototype,n),t}(t.Filter),U=a,Z="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n    vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n    // Un-premultiply alpha before applying the color\n    if (sample.a > 0.0) {\n        sample.rgb /= sample.a;\n    }\n\n    // Premultiply alpha again\n    sample.rgb = color.rgb * sample.a;\n\n    // alpha user alpha\n    sample *= alpha;\n\n    gl_FragColor = sample;\n}",V=function(e){function t(t){t&&t.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),t={rotation:t},void 0!==arguments[1]&&(t.distance=arguments[1]),void 0!==arguments[2]&&(t.blur=arguments[2]),void 0!==arguments[3]&&(t.color=arguments[3]),void 0!==arguments[4]&&(t.alpha=arguments[4])),t=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:r.settings.RESOLUTION},t),e.call(this);var o=t.kernels,i=t.blur,l=t.quality,s=t.pixelSize,a=t.resolution;this._tintFilter=new e(U,Z),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new n.Point,this._tintFilter.resolution=a,this._blurFilter=o?new d(o):new d(i,l),this.pixelSize=s,this.resolution=a;var u=t.shadowOnly,c=t.rotation,f=t.distance,h=t.alpha,p=t.color;this.shadowOnly=u,this.rotation=c,this.distance=f,this.alpha=h,this.color=p,this._updatePadding()}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var i={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){var o=e.getFilterTexture();this._tintFilter.apply(e,t,o,!0),this._blurFilter.apply(e,o,n,r),!0!==this.shadowOnly&&e.applyFilter(this,t,n,!1),e.returnFilterTexture(o)},t.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},t.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},i.resolution.get=function(){return this._resolution},i.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},i.distance.get=function(){return this._distance},i.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateShift()},i.rotation.get=function(){return this.angle/n.DEG_TO_RAD},i.rotation.set=function(e){this.angle=e*n.DEG_TO_RAD,this._updateShift()},i.alpha.get=function(){return this._tintFilter.uniforms.alpha},i.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},i.color.get=function(){return o.rgb2hex(this._tintFilter.uniforms.color)},i.color.set=function(e){o.hex2rgb(e,this._tintFilter.uniforms.color)},i.kernels.get=function(){return this._blurFilter.kernels},i.kernels.set=function(e){this._blurFilter.kernels=e},i.blur.get=function(){return this._blurFilter.blur},i.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},i.quality.get=function(){return this._blurFilter.quality},i.quality.set=function(e){this._blurFilter.quality=e},i.pixelSize.get=function(){return this._blurFilter.pixelSize},i.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(t.prototype,i),t}(t.Filter),H=a,$="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n",J=function(e){function t(t){void 0===t&&(t=5),e.call(this,H,$),this.strength=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={strength:{configurable:!0}};return n.strength.get=function(){return this.uniforms.strength},n.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(t.prototype,n),t}(t.Filter),ee=a,te="// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n    vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n    if (coord.x > 1.0 || coord.y > 1.0) {\n        return;\n    }\n\n    float cx = coord.x - 0.5;\n    float cy = (coord.y - 0.5) * aspect;\n    float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n    // displacementMap: repeat\n    // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n    // displacementMap: mirror\n    ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n    vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n    float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n    coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n    if (fillMode == CLAMP) {\n        coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    } else {\n        if( coord.x > filterClamp.z ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.x -= filterClamp.z;\n            } else if (fillMode == MIRROR) {\n                coord.x = filterClamp.z * 2.0 - coord.x;\n            }\n        } else if( coord.x < filterClamp.x ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.x += filterClamp.z;\n            } else if (fillMode == MIRROR) {\n                coord.x *= -filterClamp.z;\n            }\n        }\n\n        if( coord.y > filterClamp.w ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.y -= filterClamp.w;\n            } else if (fillMode == MIRROR) {\n                coord.y = filterClamp.w * 2.0 - coord.y;\n            }\n        } else if( coord.y < filterClamp.y ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.y += filterClamp.w;\n            } else if (fillMode == MIRROR) {\n                coord.y *= -filterClamp.w;\n            }\n        }\n    }\n\n    gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n    gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n    gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n    gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n",ne=function(e){function r(n){void 0===n&&(n={}),e.call(this,ee,te),this.uniforms.dimensions=new Float32Array(2),n=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},n),this.direction=n.direction,this.red=n.red,this.green=n.green,this.blue=n.blue,this.offset=n.offset,this.fillMode=n.fillMode,this.average=n.average,this.seed=n.seed,this.minSize=n.minSize,this.sampleSize=n.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=t.Texture.from(this._canvas,{scaleMode:i.SCALE_MODES.NEAREST}),this._slices=0,this.slices=n.slices}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var o={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return r.prototype.apply=function(e,t,n,r){var o=t.filterFrame.width,i=t.filterFrame.height;this.uniforms.dimensions[0]=o,this.uniforms.dimensions[1]=i,this.uniforms.aspect=i/o,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,n,r)},r.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,n=this.sampleSize,r=Math.min(this.minSize/n,.9/this._slices);if(this.average){for(var o=this._slices,i=1,l=0;l<t;l++){var s=i/(o-l),a=Math.max(s*(1-.6*Math.random()),r);e[l]=a,i-=a}e[t]=i}else{for(var u=1,c=Math.sqrt(1/this._slices),f=0;f<t;f++){var h=Math.max(c*u*Math.random(),r);e[f]=h,u-=h}e[t]=u}this.shuffle()},r.prototype.shuffle=function(){for(var e=this._sizes,t=this._slices-1;t>0;t--){var n=Math.random()*t>>0,r=e[t];e[t]=e[n],e[n]=r}},r.prototype._randomizeOffsets=function(){for(var e=0;e<this._slices;e++)this._offsets[e]=Math.random()*(Math.random()<.5?-1:1)},r.prototype.refresh=function(){this._randomizeSizes(),this._randomizeOffsets(),this.redraw()},r.prototype.redraw=function(){var e,t=this.sampleSize,n=this.texture,r=this._canvas.getContext("2d");r.clearRect(0,0,8,t);for(var o=0,i=0;i<this._slices;i++){e=Math.floor(256*this._offsets[i]);var l=this._sizes[i]*t,s=e>0?e:0,a=e<0?-e:0;r.fillStyle="rgba("+s+", "+a+", 0, 1)",r.fillRect(0,o>>0,t,l+1>>0),o+=l}n.baseTexture.update(),this.uniforms.displacementMap=n},o.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),n=0;n<t;n++)this._sizes[n]=e[n]},o.sizes.get=function(){return this._sizes},o.offsets.set=function(e){for(var t=Math.min(this._slices,e.length),n=0;n<t;n++)this._offsets[n]=e[n]},o.offsets.get=function(){return this._offsets},o.slices.get=function(){return this._slices},o.slices.set=function(e){this._slices!==e&&(this._slices=e,this.uniforms.slices=e,this._sizes=this.uniforms.slicesWidth=new Float32Array(e),this._offsets=this.uniforms.slicesOffset=new Float32Array(e),this.refresh())},o.direction.get=function(){return this._direction},o.direction.set=function(e){if(this._direction!==e){this._direction=e;var t=e*n.DEG_TO_RAD;this.uniforms.sinDir=Math.sin(t),this.uniforms.cosDir=Math.cos(t)}},o.red.get=function(){return this.uniforms.red},o.red.set=function(e){this.uniforms.red=e},o.green.get=function(){return this.uniforms.green},o.green.set=function(e){this.uniforms.green=e},o.blue.get=function(){return this.uniforms.blue},o.blue.set=function(e){this.uniforms.blue=e},r.prototype.destroy=function(){this.texture.destroy(!0),this.texture=null,this._canvas=null,this.red=null,this.green=null,this.blue=null,this._sizes=null,this._offsets=null},Object.defineProperties(r.prototype,o),r}(t.Filter);ne.TRANSPARENT=0,ne.ORIGINAL=1,ne.LOOP=2,ne.CLAMP=3,ne.MIRROR=4;var re=a,oe="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float distance;\nuniform float outerStrength;\nuniform float innerStrength;\nuniform vec4 glowColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nconst float PI = 3.14159265358979323846264;\n\nvoid main(void) {\n    vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n    vec4 ownColor = texture2D(uSampler, vTextureCoord);\n    vec4 curColor;\n    float totalAlpha = 0.0;\n    float maxTotalAlpha = 0.0;\n    float cosAngle;\n    float sinAngle;\n    vec2 displaced;\n    for (float angle = 0.0; angle <= PI * 2.0; angle += %QUALITY_DIST%) {\n       cosAngle = cos(angle);\n       sinAngle = sin(angle);\n       for (float curDistance = 1.0; curDistance <= %DIST%; curDistance++) {\n           displaced.x = vTextureCoord.x + cosAngle * curDistance * px.x;\n           displaced.y = vTextureCoord.y + sinAngle * curDistance * px.y;\n           curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n           totalAlpha += (distance - curDistance) * curColor.a;\n           maxTotalAlpha += (distance - curDistance);\n       }\n    }\n    maxTotalAlpha = max(maxTotalAlpha, 0.0001);\n\n    ownColor.a = max(ownColor.a, 0.0001);\n    ownColor.rgb = ownColor.rgb / ownColor.a;\n    float outerGlowAlpha = (totalAlpha / maxTotalAlpha)  * outerStrength * (1. - ownColor.a);\n    float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;\n    float resultAlpha = (ownColor.a + outerGlowAlpha);\n    gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);\n}\n",ie=function(e){function t(t,n,r,o,i){void 0===t&&(t=10),void 0===n&&(n=4),void 0===r&&(r=0),void 0===o&&(o=16777215),void 0===i&&(i=.1),e.call(this,re,oe.replace(/%QUALITY_DIST%/gi,""+(1/i/t).toFixed(7)).replace(/%DIST%/gi,""+t.toFixed(7))),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.distance=t,this.color=o,this.outerStrength=n,this.innerStrength=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={color:{configurable:!0},distance:{configurable:!0},outerStrength:{configurable:!0},innerStrength:{configurable:!0}};return n.color.get=function(){return o.rgb2hex(this.uniforms.glowColor)},n.color.set=function(e){o.hex2rgb(e,this.uniforms.glowColor)},n.distance.get=function(){return this.uniforms.distance},n.distance.set=function(e){this.uniforms.distance=e},n.outerStrength.get=function(){return this.uniforms.outerStrength},n.outerStrength.set=function(e){this.uniforms.outerStrength=e},n.innerStrength.get=function(){return this.uniforms.innerStrength},n.innerStrength.set=function(e){this.uniforms.innerStrength=e},Object.defineProperties(t.prototype,n),t}(t.Filter),le=a,se="vec3 mod289(vec3 x)\n{\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n    return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n    return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n    return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n    vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n    vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n    Pi0 = mod289(Pi0);\n    Pi1 = mod289(Pi1);\n    vec3 Pf0 = fract(P); // Fractional part for interpolation\n    vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n    vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n    vec4 iy = vec4(Pi0.yy, Pi1.yy);\n    vec4 iz0 = Pi0.zzzz;\n    vec4 iz1 = Pi1.zzzz;\n    vec4 ixy = permute(permute(ix) + iy);\n    vec4 ixy0 = permute(ixy + iz0);\n    vec4 ixy1 = permute(ixy + iz1);\n    vec4 gx0 = ixy0 * (1.0 / 7.0);\n    vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n    gx0 = fract(gx0);\n    vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n    vec4 sz0 = step(gz0, vec4(0.0));\n    gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n    gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n    vec4 gx1 = ixy1 * (1.0 / 7.0);\n    vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n    gx1 = fract(gx1);\n    vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n    vec4 sz1 = step(gz1, vec4(0.0));\n    gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n    gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n    vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n    vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n    vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n    vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n    vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n    vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n    vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n    vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n    vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n    g000 *= norm0.x;\n    g010 *= norm0.y;\n    g100 *= norm0.z;\n    g110 *= norm0.w;\n    vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n    g001 *= norm1.x;\n    g011 *= norm1.y;\n    g101 *= norm1.z;\n    g111 *= norm1.w;\n    float n000 = dot(g000, Pf0);\n    float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n    float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n    float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n    float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n    float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n    float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n    float n111 = dot(g111, Pf1);\n    vec3 fade_xyz = fade(Pf0);\n    vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n    vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n    float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n    return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n    float sum = 0.0;\n    float sc = 1.0;\n    float totalgain = 1.0;\n    for (float i = 0.0; i < 6.0; i++)\n    {\n        sum += totalgain * pnoise(P * sc, rep);\n        sc *= lacunarity;\n        totalgain *= gain;\n    }\n    return abs(sum);\n}\n",ae="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform vec2 light;\nuniform bool parallel;\nuniform float aspect;\n\nuniform float gain;\nuniform float lacunarity;\nuniform float time;\n\n${perlin}\n\nvoid main(void) {\n    vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n    float d;\n\n    if (parallel) {\n        float _cos = light.x;\n        float _sin = light.y;\n        d = (_cos * coord.x) + (_sin * coord.y * aspect);\n    } else {\n        float dx = coord.x - light.x / dimensions.x;\n        float dy = (coord.y - light.y / dimensions.y) * aspect;\n        float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n        d = dy / dis;\n    }\n\n    vec3 dir = vec3(d, d, 0.0);\n\n    float noise = turb(dir + vec3(time, 0.0, 62.1 + time) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n    noise = mix(noise, 0.0, 0.3);\n    //fade vertically.\n    vec4 mist = vec4(noise, noise, noise, 1.0) * (1.0 - coord.y);\n    mist.a = 1.0;\n\n    gl_FragColor = texture2D(uSampler, vTextureCoord) + mist;\n}\n",ue=function(e){function t(t){e.call(this,le,ae.replace("${perlin}",se)),this.uniforms.dimensions=new Float32Array(2),"number"==typeof t&&(console.warn("GodrayFilter now uses options instead of (angle, gain, lacunarity, time)"),t={angle:t},void 0!==arguments[1]&&(t.gain=arguments[1]),void 0!==arguments[2]&&(t.lacunarity=arguments[2]),void 0!==arguments[3]&&(t.time=arguments[3])),t=Object.assign({angle:30,gain:.5,lacunarity:2.5,time:0,parallel:!0,center:[0,0]},t),this._angleLight=new n.Point,this.angle=t.angle,this.gain=t.gain,this.lacunarity=t.lacunarity,this.parallel=t.parallel,this.center=t.center,this.time=t.time}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={angle:{configurable:!0},gain:{configurable:!0},lacunarity:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){var o=t.filterFrame,i=o.width,l=o.height;this.uniforms.light=this.parallel?this._angleLight:this.center,this.uniforms.parallel=this.parallel,this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,this.uniforms.aspect=l/i,this.uniforms.time=this.time,e.applyFilter(this,t,n,r)},r.angle.get=function(){return this._angle},r.angle.set=function(e){this._angle=e;var t=e*n.DEG_TO_RAD;this._angleLight.x=Math.cos(t),this._angleLight.y=Math.sin(t)},r.gain.get=function(){return this.uniforms.gain},r.gain.set=function(e){this.uniforms.gain=e},r.lacunarity.get=function(){return this.uniforms.lacunarity},r.lacunarity.set=function(e){this.uniforms.lacunarity=e},Object.defineProperties(t.prototype,r),t}(t.Filter),ce=a,fe="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uVelocity;\nuniform int uKernelSize;\nuniform float uOffset;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\n// Notice:\n// the perfect way:\n//    int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n// BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n// So use uKernelSize directly.\n\nvoid main(void)\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n\n    if (uKernelSize == 0)\n    {\n        gl_FragColor = color;\n        return;\n    }\n\n    vec2 velocity = uVelocity / filterArea.xy;\n    float offset = -uOffset / length(uVelocity) - 0.5;\n    int k = uKernelSize - 1;\n\n    for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n        if (i == k) {\n            break;\n        }\n        vec2 bias = velocity * (float(i) / float(k) + offset);\n        color += texture2D(uSampler, vTextureCoord + bias);\n    }\n    gl_FragColor = color / float(uKernelSize);\n}\n",he=function(e){function t(t,r,o){void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===o&&(o=0),e.call(this,ce,fe),this.uniforms.uVelocity=new Float32Array(2),this._velocity=new n.ObservablePoint(this.velocityChanged,this),this.velocity=t,this.kernelSize=r,this.offset=o}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={velocity:{configurable:!0},offset:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){var o=this.velocity,i=o.x,l=o.y;this.uniforms.uKernelSize=0!==i||0!==l?this.kernelSize:0,e.applyFilter(this,t,n,r)},r.velocity.set=function(e){Array.isArray(e)?this._velocity.set(e[0],e[1]):(e instanceof n.Point||e instanceof n.ObservablePoint)&&this._velocity.copy(e)},r.velocity.get=function(){return this._velocity},t.prototype.velocityChanged=function(){this.uniforms.uVelocity[0]=this._velocity.x,this.uniforms.uVelocity[1]=this._velocity.y},r.offset.set=function(e){this.uniforms.uOffset=e},r.offset.get=function(){return this.uniforms.uOffset},Object.defineProperties(t.prototype,r),t}(t.Filter),pe=a,de="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float epsilon;\n\nconst int MAX_COLORS = %maxColors%;\n\nuniform vec3 originalColors[MAX_COLORS];\nuniform vec3 targetColors[MAX_COLORS];\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n    float alpha = gl_FragColor.a;\n    if (alpha < 0.0001)\n    {\n      return;\n    }\n\n    vec3 color = gl_FragColor.rgb / alpha;\n\n    for(int i = 0; i < MAX_COLORS; i++)\n    {\n      vec3 origColor = originalColors[i];\n      if (origColor.r < 0.0)\n      {\n        break;\n      }\n      vec3 colorDiff = origColor - color;\n      if (length(colorDiff) < epsilon)\n      {\n        vec3 targetColor = targetColors[i];\n        gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\n        return;\n      }\n    }\n}\n",me=function(e){function t(t,n,r){void 0===n&&(n=.05),void 0===r&&(r=null),r=r||t.length,e.call(this,pe,de.replace(/%maxColors%/g,r)),this.epsilon=n,this._maxColors=r,this._replacements=null,this.uniforms.originalColors=new Float32Array(3*r),this.uniforms.targetColors=new Float32Array(3*r),this.replacements=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={replacements:{configurable:!0},maxColors:{configurable:!0},epsilon:{configurable:!0}};return n.replacements.set=function(e){var t=this.uniforms.originalColors,n=this.uniforms.targetColors,r=e.length;if(r>this._maxColors)throw"Length of replacements ("+r+") exceeds the maximum colors length ("+this._maxColors+")";t[3*r]=-1;for(var i=0;i<r;i++){var l=e[i],s=l[0];"number"==typeof s?s=o.hex2rgb(s):l[0]=o.rgb2hex(s),t[3*i]=s[0],t[3*i+1]=s[1],t[3*i+2]=s[2];var a=l[1];"number"==typeof a?a=o.hex2rgb(a):l[1]=o.rgb2hex(a),n[3*i]=a[0],n[3*i+1]=a[1],n[3*i+2]=a[2]}this._replacements=e},n.replacements.get=function(){return this._replacements},t.prototype.refresh=function(){this.replacements=this._replacements},n.maxColors.get=function(){return this._maxColors},n.epsilon.set=function(e){this.uniforms.epsilon=e},n.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(t.prototype,n),t}(t.Filter),ge=a,ve="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform float sepia;\nuniform float noise;\nuniform float noiseSize;\nuniform float scratch;\nuniform float scratchDensity;\nuniform float scratchWidth;\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\nuniform float seed;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n    // if (dst <= 0.5) then: 2 * src * dst\n    // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n    return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n                (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n                (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n    vec3 color = gl_FragColor.rgb;\n\n    if (sepia > 0.0)\n    {\n        float gray = (color.x + color.y + color.z) / 3.0;\n        vec3 grayscale = vec3(gray);\n\n        color = Overlay(SEPIA_RGB, grayscale);\n\n        color = grayscale + sepia * (color - grayscale);\n    }\n\n    vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n    if (vignetting > 0.0)\n    {\n        float outter = SQRT_2 - vignetting * SQRT_2;\n        vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n        dir.y *= dimensions.y / dimensions.x;\n        float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n        color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n    }\n\n    if (scratchDensity > seed && scratch != 0.0)\n    {\n        float phase = seed * 256.0;\n        float s = mod(floor(phase), 2.0);\n        float dist = 1.0 / scratchDensity;\n        float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n        if (d < seed * 0.6 + 0.4)\n        {\n            highp float period = scratchDensity * 10.0;\n\n            float xx = coord.x * period + phase;\n            float aa = abs(mod(xx, 0.5) * 4.0);\n            float bb = mod(floor(xx / 0.5), 2.0);\n            float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n            float kk = 2.0 * period;\n            float dw = scratchWidth / dimensions.x * (0.75 + seed);\n            float dh = dw * kk;\n\n            float tine = (yy - (2.0 - dh));\n\n            if (tine > 0.0) {\n                float _sign = sign(scratch);\n\n                tine = s * tine / period + scratch + 0.1;\n                tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n                color.rgb *= tine;\n            }\n        }\n    }\n\n    if (noise > 0.0 && noiseSize > 0.0)\n    {\n        vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n        pixelCoord.x = floor(pixelCoord.x / noiseSize);\n        pixelCoord.y = floor(pixelCoord.y / noiseSize);\n        // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n        // float _noise = snoise(d) * 0.5;\n        float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n        color += _noise * noise;\n    }\n\n    gl_FragColor.rgb = color;\n}\n",xe=function(e){function t(t,n){void 0===n&&(n=0),e.call(this,ge,ve),this.uniforms.dimensions=new Float32Array(2),"number"==typeof t?(this.seed=t,t=null):this.seed=n,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},t)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,n,r)},n.sepia.set=function(e){this.uniforms.sepia=e},n.sepia.get=function(){return this.uniforms.sepia},n.noise.set=function(e){this.uniforms.noise=e},n.noise.get=function(){return this.uniforms.noise},n.noiseSize.set=function(e){this.uniforms.noiseSize=e},n.noiseSize.get=function(){return this.uniforms.noiseSize},n.scratch.set=function(e){this.uniforms.scratch=e},n.scratch.get=function(){return this.uniforms.scratch},n.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},n.scratchDensity.get=function(){return this.uniforms.scratchDensity},n.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},n.scratchWidth.get=function(){return this.uniforms.scratchWidth},n.vignetting.set=function(e){this.uniforms.vignetting=e},n.vignetting.get=function(){return this.uniforms.vignetting},n.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},n.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},n.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},n.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(t.prototype,n),t}(t.Filter),ye=a,be="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n    vec4 ownColor = texture2D(uSampler, vTextureCoord);\n    vec4 curColor;\n    float maxAlpha = 0.;\n    vec2 displaced;\n    for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n        displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n        displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n        curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n        maxAlpha = max(maxAlpha, curColor.a);\n    }\n    float resultAlpha = max(maxAlpha, ownColor.a);\n    gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",_e=function(e){function t(n,r,o){void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=.1);var i=Math.max(o*t.MAX_SAMPLES,t.MIN_SAMPLES),l=(2*Math.PI/i).toFixed(7);e.call(this,ye,be.replace(/\$\{angleStep\}/,l)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=n,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=r,this.quality=o}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={color:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.thickness[0]=this.thickness/t._frame.width,this.uniforms.thickness[1]=this.thickness/t._frame.height,e.applyFilter(this,t,n,r)},n.color.get=function(){return o.rgb2hex(this.uniforms.outlineColor)},n.color.set=function(e){o.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(t.prototype,n),t}(t.Filter);_e.MIN_SAMPLES=1,_e.MAX_SAMPLES=100;var Ce=a,Se="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n    coord *= filterArea.xy;\n    coord += filterArea.zw;\n\n    return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n    coord -= filterArea.zw;\n    coord /= filterArea.xy;\n\n    return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n    vec2 coord = mapCoord(vTextureCoord);\n\n    coord = pixelate(coord, size);\n\n    coord = unmapCoord(coord);\n\n    gl_FragColor = texture2D(uSampler, coord);\n}\n",Fe=function(e){function t(t){void 0===t&&(t=10),e.call(this,Ce,Se),this.size=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={size:{configurable:!0}};return n.size.get=function(){return this.uniforms.size},n.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(t.prototype,n),t}(t.Filter),ze=a,Ae="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n\n    if (uKernelSize == 0)\n    {\n        gl_FragColor = color;\n        return;\n    }\n\n    float aspect = filterArea.y / filterArea.x;\n    vec2 center = uCenter.xy / filterArea.xy;\n    float gradient = uRadius / filterArea.x * 0.3;\n    float radius = uRadius / filterArea.x - gradient * 0.5;\n    int k = uKernelSize - 1;\n\n    vec2 coord = vTextureCoord;\n    vec2 dir = vec2(center - coord);\n    float dist = length(vec2(dir.x, dir.y * aspect));\n\n    float radianStep = uRadian;\n    if (radius >= 0.0 && dist > radius) {\n        float delta = dist - radius;\n        float gap = gradient;\n        float scale = 1.0 - abs(delta / gap);\n        if (scale <= 0.0) {\n            gl_FragColor = color;\n            return;\n        }\n        radianStep *= scale;\n    }\n    radianStep /= float(k);\n\n    float s = sin(radianStep);\n    float c = cos(radianStep);\n    mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n    for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n        if (i == k) {\n            break;\n        }\n\n        coord -= center;\n        coord.y *= aspect;\n        coord = rotationMatrix * coord;\n        coord.y /= aspect;\n        coord += center;\n\n        vec4 sample = texture2D(uSampler, coord);\n\n        // switch to pre-multiplied alpha to correctly blur transparent images\n        // sample.rgb *= sample.a;\n\n        color += sample;\n    }\n\n    gl_FragColor = color / float(uKernelSize);\n}\n",we=function(e){function t(t,n,r,o){void 0===t&&(t=0),void 0===n&&(n=[0,0]),void 0===r&&(r=5),void 0===o&&(o=-1),e.call(this,ze,Ae),this._angle=0,this.angle=t,this.center=n,this.kernelSize=r,this.radius=o}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,n,r)},n.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},n.angle.get=function(){return this._angle},n.center.get=function(){return this.uniforms.uCenter},n.center.set=function(e){this.uniforms.uCenter=e},n.radius.get=function(){return this.uniforms.uRadius},n.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(t.prototype,n),t}(t.Filter),Te=a,De="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n    vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n    vec2 coord = pixelCoord / dimensions;\n\n    if (coord.y < boundary) {\n        gl_FragColor = texture2D(uSampler, vTextureCoord);\n        return;\n    }\n\n    float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n    float areaY = boundary * dimensions.y / filterArea.y;\n    float v = areaY + areaY - vTextureCoord.y;\n    float y = mirror ? v : vTextureCoord.y;\n\n    float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n    float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n    float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n    float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n    x = clamp(x, filterClamp.x, filterClamp.z);\n\n    vec4 color = texture2D(uSampler, vec2(x, y));\n\n    gl_FragColor = color * _alpha;\n}\n",Oe=function(e){function t(t){e.call(this,Te,De),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},t)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,n,r)},n.mirror.set=function(e){this.uniforms.mirror=e},n.mirror.get=function(){return this.uniforms.mirror},n.boundary.set=function(e){this.uniforms.boundary=e},n.boundary.get=function(){return this.uniforms.boundary},n.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},n.amplitude.get=function(){return this.uniforms.amplitude},n.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},n.waveLength.get=function(){return this.uniforms.waveLength},n.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},n.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(t.prototype,n),t}(t.Filter),Pe=a,Me="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n   gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n   gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n   gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n   gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n",Re=function(e){function t(t,n,r){void 0===t&&(t=[-10,0]),void 0===n&&(n=[0,10]),void 0===r&&(r=[0,0]),e.call(this,Pe,Me),this.red=t,this.green=n,this.blue=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return n.red.get=function(){return this.uniforms.red},n.red.set=function(e){this.uniforms.red=e},n.green.get=function(){return this.uniforms.green},n.green.set=function(e){this.uniforms.green=e},n.blue.get=function(){return this.uniforms.blue},n.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(t.prototype,n),t}(t.Filter),je=a,ke="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n    float halfWavelength = wavelength * 0.5 / filterArea.x;\n    float maxRadius = radius / filterArea.x;\n    float currentRadius = time * speed / filterArea.x;\n\n    float fade = 1.0;\n\n    if (maxRadius > 0.0) {\n        if (currentRadius > maxRadius) {\n            gl_FragColor = texture2D(uSampler, vTextureCoord);\n            return;\n        }\n        fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n    }\n\n    vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n    dir.y *= filterArea.y / filterArea.x;\n    float dist = length(dir);\n\n    if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n        gl_FragColor = texture2D(uSampler, vTextureCoord);\n        return;\n    }\n\n    vec2 diffUV = normalize(dir);\n\n    float diff = (dist - currentRadius) / halfWavelength;\n\n    float p = 1.0 - pow(abs(diff), 2.0);\n\n    // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n    float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n    vec2 offset = diffUV * powDiff / filterArea.xy;\n\n    // Do clamp :\n    vec2 coord = vTextureCoord + offset;\n    vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    vec4 color = texture2D(uSampler, clampedCoord);\n    if (coord != clampedCoord) {\n        color *= max(0.0, 1.0 - length(coord - clampedCoord));\n    }\n\n    // No clamp :\n    // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n    color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n    gl_FragColor = color;\n}\n",Le=function(e){function t(t,n,r){void 0===t&&(t=[0,0]),void 0===n&&(n={}),void 0===r&&(r=0),e.call(this,je,ke),this.center=t,Array.isArray(n)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),n={}),n=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},n),this.amplitude=n.amplitude,this.wavelength=n.wavelength,this.brightness=n.brightness,this.speed=n.speed,this.radius=n.radius,this.time=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.time=this.time,e.applyFilter(this,t,n,r)},n.center.get=function(){return this.uniforms.center},n.center.set=function(e){this.uniforms.center=e},n.amplitude.get=function(){return this.uniforms.amplitude},n.amplitude.set=function(e){this.uniforms.amplitude=e},n.wavelength.get=function(){return this.uniforms.wavelength},n.wavelength.set=function(e){this.uniforms.wavelength=e},n.brightness.get=function(){return this.uniforms.brightness},n.brightness.set=function(e){this.uniforms.brightness=e},n.speed.get=function(){return this.uniforms.speed},n.speed.set=function(e){this.uniforms.speed=e},n.radius.get=function(){return this.uniforms.radius},n.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(t.prototype,n),t}(t.Filter),Ie=a,Ee="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n    vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n    vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n    vec4 light = texture2D(uLightmap, lightCoord);\n    vec3 ambient = ambientColor.rgb * ambientColor.a;\n    vec3 intensity = ambient + light.rgb;\n    vec3 finalColor = diffuseColor.rgb * intensity;\n    gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n",Be=function(e){function t(t,n,r){void 0===n&&(n=0),void 0===r&&(r=1),e.call(this,Ie,Ee),this.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=t,this.color=n}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return t.prototype.apply=function(e,t,n,r){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,n,r)},n.texture.get=function(){return this.uniforms.uLightmap},n.texture.set=function(e){this.uniforms.uLightmap=e},n.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(o.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=o.rgb2hex(t))},n.color.get=function(){return this._color},n.alpha.get=function(){return this.uniforms.ambientColor[3]},n.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(t.prototype,n),t}(t.Filter),Xe=a,Ne="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n    return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n    vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n    float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n    for (float t = -30.0; t <= 30.0; t++)\n    {\n        float percent = (t + offset - 0.5) / 30.0;\n        float weight = 1.0 - abs(percent);\n        vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n        sample.rgb *= sample.a;\n        color += sample * weight;\n        total += weight;\n    }\n\n    color /= total;\n    color.rgb /= color.a + 0.00001;\n\n    gl_FragColor = color;\n}\n",qe=function(e){function t(t,r,o,i){void 0===t&&(t=100),void 0===r&&(r=600),void 0===o&&(o=null),void 0===i&&(i=null),e.call(this,Xe,Ne),this.uniforms.blur=t,this.uniforms.gradientBlur=r,this.uniforms.start=o||new n.Point(0,window.innerHeight/2),this.uniforms.end=i||new n.Point(600,window.innerHeight/2),this.uniforms.delta=new n.Point(30,30),this.uniforms.texSize=new n.Point(window.innerWidth,window.innerHeight),this.updateDelta()}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return t.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},r.blur.get=function(){return this.uniforms.blur},r.blur.set=function(e){this.uniforms.blur=e},r.gradientBlur.get=function(){return this.uniforms.gradientBlur},r.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},r.start.get=function(){return this.uniforms.start},r.start.set=function(e){this.uniforms.start=e,this.updateDelta()},r.end.get=function(){return this.uniforms.end},r.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(t.prototype,r),t}(t.Filter),We=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/n,this.uniforms.delta.y=t/n},t}(qe),Ke=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/n,this.uniforms.delta.y=e/n},t}(qe),Ye=function(e){function t(t,n,r,o){void 0===t&&(t=100),void 0===n&&(n=600),void 0===r&&(r=null),void 0===o&&(o=null),e.call(this),this.tiltShiftXFilter=new We(t,n,r,o),this.tiltShiftYFilter=new Ke(t,n,r,o)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return t.prototype.apply=function(e,t,n){var r=e.getFilterTexture();this.tiltShiftXFilter.apply(e,t,r),this.tiltShiftYFilter.apply(e,r,n),e.returnFilterTexture(r)},n.blur.get=function(){return this.tiltShiftXFilter.blur},n.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},n.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},n.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},n.start.get=function(){return this.tiltShiftXFilter.start},n.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},n.end.get=function(){return this.tiltShiftXFilter.end},n.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(t.prototype,n),t}(t.Filter),Ge=a,Qe="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n    coord *= filterArea.xy;\n    coord += filterArea.zw;\n\n    return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n    coord -= filterArea.zw;\n    coord /= filterArea.xy;\n\n    return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n    coord -= offset;\n\n    float dist = length(coord);\n\n    if (dist < radius)\n    {\n        float ratioDist = (radius - dist) / radius;\n        float angleMod = ratioDist * ratioDist * angle;\n        float s = sin(angleMod);\n        float c = cos(angleMod);\n        coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n    }\n\n    coord += offset;\n\n    return coord;\n}\n\nvoid main(void)\n{\n\n    vec2 coord = mapCoord(vTextureCoord);\n\n    coord = twist(coord);\n\n    coord = unmapCoord(coord);\n\n    gl_FragColor = texture2D(uSampler, coord );\n\n}\n",Ue=function(e){function t(t,n,r){void 0===t&&(t=200),void 0===n&&(n=4),void 0===r&&(r=20),e.call(this,Ge,Qe),this.radius=t,this.angle=n,this.padding=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return n.offset.get=function(){return this.uniforms.offset},n.offset.set=function(e){this.uniforms.offset=e},n.radius.get=function(){return this.uniforms.radius},n.radius.set=function(e){this.uniforms.radius=e},n.angle.get=function(){return this.uniforms.angle},n.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(t.prototype,n),t}(t.Filter),Ze=a,Ve="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n    const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n    highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n    return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n    float minGradient = uInnerRadius * 0.3;\n    float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n    float gradient = uRadius * 0.3;\n    float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n    float countLimit = MAX_KERNEL_SIZE;\n\n    vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n    float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n    float strength = uStrength;\n\n    float delta = 0.0;\n    float gap;\n    if (dist < innerRadius) {\n        delta = innerRadius - dist;\n        gap = minGradient;\n    } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n        delta = dist - radius;\n        gap = gradient;\n    }\n\n    if (delta > 0.0) {\n        float normalCount = gap / filterArea.x;\n        delta = (normalCount - delta) / normalCount;\n        countLimit *= delta;\n        strength *= delta;\n        if (countLimit < 1.0)\n        {\n            gl_FragColor = texture2D(uSampler, vTextureCoord);\n            return;\n        }\n    }\n\n    // randomize the lookup values to hide the fixed number of samples\n    float offset = rand(vTextureCoord, 0.0);\n\n    float total = 0.0;\n    vec4 color = vec4(0.0);\n\n    dir *= strength;\n\n    for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n        float percent = (t + offset) / MAX_KERNEL_SIZE;\n        float weight = 4.0 * (percent - percent * percent);\n        vec2 p = vTextureCoord + dir * percent;\n        vec4 sample = texture2D(uSampler, p);\n\n        // switch to pre-multiplied alpha to correctly blur transparent images\n        // sample.rgb *= sample.a;\n\n        color += sample * weight;\n        total += weight;\n\n        if (t > countLimit){\n            break;\n        }\n    }\n\n    color /= total;\n    // switch back from pre-multiplied alpha\n    // color.rgb /= color.a + 0.00001;\n\n    gl_FragColor = color;\n}\n",He=function(e){function t(t,n,r,o){void 0===t&&(t=.1),void 0===n&&(n=[0,0]),void 0===r&&(r=0),void 0===o&&(o=-1),e.call(this,Ze,Ve),this.center=n,this.strength=t,this.innerRadius=r,this.radius=o}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return n.center.get=function(){return this.uniforms.uCenter},n.center.set=function(e){this.uniforms.uCenter=e},n.strength.get=function(){return this.uniforms.uStrength},n.strength.set=function(e){this.uniforms.uStrength=e},n.innerRadius.get=function(){return this.uniforms.uInnerRadius},n.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},n.radius.get=function(){return this.uniforms.uRadius},n.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(t.prototype,n),t}(t.Filter);return e.AdjustmentFilter=c,e.AdvancedBloomFilter=y,e.AsciiFilter=C,e.BevelFilter=z,e.BloomFilter=A,e.BulgePinchFilter=D,e.CRTFilter=K,e.ColorMapFilter=M,e.ColorReplaceFilter=k,e.ConvolutionFilter=E,e.CrossHatchFilter=N,e.DotFilter=Q,e.DropShadowFilter=V,e.EmbossFilter=J,e.GlitchFilter=ne,e.GlowFilter=ie,e.GodrayFilter=ue,e.KawaseBlurFilter=d,e.MotionBlurFilter=he,e.MultiColorReplaceFilter=me,e.OldFilmFilter=xe,e.OutlineFilter=_e,e.PixelateFilter=Fe,e.RGBSplitFilter=Re,e.RadialBlurFilter=we,e.ReflectionFilter=Oe,e.ShockwaveFilter=Le,e.SimpleLightmapFilter=Be,e.TiltShiftAxisFilter=qe,e.TiltShiftFilter=Ye,e.TiltShiftXFilter=We,e.TiltShiftYFilter=Ke,e.TwistFilter=Ue,e.ZoomBlurFilter=He,e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters);Object.assign(PIXI.filters,__filters);


/*!
 * pixi-particles - v4.2.0
 * Compiled Sat, 26 Oct 2019 14:40:23 UTC
 *
 * pixi-particles is licensed under the MIT License.
 * http://www.opensource.org/licenses/mit-license
 */
this.PIXI = this.PIXI || {};
(function (exports, pixi) {
	'use strict';

	/**
	 * A single node in a PropertyList.
	 */
	var PropertyNode = /** @class */ (function () {
	    /**
	     * @param value The value for this node
	     * @param time The time for this node, between 0-1
	     * @param [ease] Custom ease for this list. Only relevant for the first node.
	     */
	    function PropertyNode(value, time, ease) {
	        this.value = value;
	        this.time = time;
	        this.next = null;
	        this.isStepped = false;
	        if (ease) {
	            this.ease = typeof ease == "function" ? ease : exports.ParticleUtils.generateEase(ease);
	        }
	        else {
	            this.ease = null;
	        }
	    }
	    /**
	     * Creates a list of property values from a data object {list, isStepped} with a list of objects in
	     * the form {value, time}. Alternatively, the data object can be in the deprecated form of
	     * {start, end}.
	     * @param data The data for the list.
	     * @param data.list The array of value and time objects.
	     * @param data.isStepped If the list is stepped rather than interpolated.
	     * @param data.ease Custom ease for this list.
	     * @return The first node in the list
	     */
	    PropertyNode.createList = function (data) {
	        if ("list" in data) {
	            var array = data.list;
	            var node = void 0, first = void 0;
	            var _a = array[0], value = _a.value, time = _a.time;
	            first = node = new PropertyNode(typeof value === 'string' ? exports.ParticleUtils.hexToRGB(value) : value, time, data.ease);
	            //only set up subsequent nodes if there are a bunch or the 2nd one is different from the first
	            if (array.length > 2 || (array.length === 2 && array[1].value !== value)) {
	                for (var i = 1; i < array.length; ++i) {
	                    var _b = array[i], value_1 = _b.value, time_1 = _b.time;
	                    node.next = new PropertyNode(typeof value_1 === 'string' ? exports.ParticleUtils.hexToRGB(value_1) : value_1, time_1);
	                    node = node.next;
	                }
	            }
	            first.isStepped = !!data.isStepped;
	            return first;
	        }
	        else {
	            //Handle deprecated version here
	            var start = new PropertyNode(typeof data.start === 'string' ? exports.ParticleUtils.hexToRGB(data.start) : data.start, 0);
	            //only set up a next value if it is different from the starting value
	            if (data.end !== data.start)
	                start.next = new PropertyNode(typeof data.end === 'string' ? exports.ParticleUtils.hexToRGB(data.end) : data.end, 1);
	            return start;
	        }
	    };
	    return PropertyNode;
	}());

	// get Texture.from()/Texture.fromImage(), in V4 and V5 friendly methods
	/**
	 * @hidden
	 */
	var TextureFromString;
	// to avoid Rollup transforming our import, save pixi namespace in a variable
	var pixiNS = pixi;
	if (parseInt(/^(\d+)\./.exec(pixi.VERSION)[1]) < 5) {
	    TextureFromString = pixiNS.Texture.fromImage;
	}
	else {
	    TextureFromString = pixiNS.Texture.from;
	}
	function GetTextureFromString(s) {
	    return TextureFromString(s);
	}
	(function (ParticleUtils) {
	    /**
	     * If errors and warnings should be logged within the library.
	     */
	    ParticleUtils.verbose = false;
	    ParticleUtils.DEG_TO_RADS = Math.PI / 180;
	    /**
	     * Rotates a point by a given angle.
	     * @param angle The angle to rotate by in degrees
	     * @param p The point to rotate around 0,0.
	     */
	    function rotatePoint(angle, p) {
	        if (!angle)
	            return;
	        angle *= ParticleUtils.DEG_TO_RADS;
	        var s = Math.sin(angle);
	        var c = Math.cos(angle);
	        var xnew = p.x * c - p.y * s;
	        var ynew = p.x * s + p.y * c;
	        p.x = xnew;
	        p.y = ynew;
	    }
	    ParticleUtils.rotatePoint = rotatePoint;
	    /**
	     * Combines separate color components (0-255) into a single uint color.
	     * @param r The red value of the color
	     * @param g The green value of the color
	     * @param b The blue value of the color
	     * @return The color in the form of 0xRRGGBB
	     */
	    function combineRGBComponents(r, g, b /*, a*/) {
	        return /*a << 24 |*/ r << 16 | g << 8 | b;
	    }
	    ParticleUtils.combineRGBComponents = combineRGBComponents;
	    /**
	     * Reduces the point to a length of 1.
	     * @param point The point to normalize
	     */
	    function normalize(point) {
	        var oneOverLen = 1 / ParticleUtils.length(point);
	        point.x *= oneOverLen;
	        point.y *= oneOverLen;
	    }
	    ParticleUtils.normalize = normalize;
	    /**
	     * Multiplies the x and y values of this point by a value.
	     * @param point The point to scaleBy
	     * @param value The value to scale by.
	     */
	    function scaleBy(point, value) {
	        point.x *= value;
	        point.y *= value;
	    }
	    ParticleUtils.scaleBy = scaleBy;
	    /**
	     * Returns the length (or magnitude) of this point.
	     * @param point The point to measure length
	     * @return The length of this point.
	     */
	    function length(point) {
	        return Math.sqrt(point.x * point.x + point.y * point.y);
	    }
	    ParticleUtils.length = length;
	    /**
	     * Converts a hex string from "#AARRGGBB", "#RRGGBB", "0xAARRGGBB", "0xRRGGBB",
	     * "AARRGGBB", or "RRGGBB" to an object of ints of 0-255, as
	     * {r, g, b, (a)}.
	     * @param color The input color string.
	     * @param output An object to put the output in. If omitted, a new object is created.
	     * @return The object with r, g, and b properties, possibly with an a property.
	     */
	    function hexToRGB(color, output) {
	        if (!output)
	            output = {};
	        if (color.charAt(0) == "#")
	            color = color.substr(1);
	        else if (color.indexOf("0x") === 0)
	            color = color.substr(2);
	        var alpha;
	        if (color.length == 8) {
	            alpha = color.substr(0, 2);
	            color = color.substr(2);
	        }
	        output.r = parseInt(color.substr(0, 2), 16); //Red
	        output.g = parseInt(color.substr(2, 2), 16); //Green
	        output.b = parseInt(color.substr(4, 2), 16); //Blue
	        if (alpha)
	            output.a = parseInt(alpha, 16);
	        return output;
	    }
	    ParticleUtils.hexToRGB = hexToRGB;
	    /**
	     * Generates a custom ease function, based on the GreenSock custom ease, as demonstrated
	     * by the related tool at http://www.greensock.com/customease/.
	     * @param segments An array of segments, as created by
	     * http://www.greensock.com/customease/.
	     * @return A function that calculates the percentage of change at
	     *                    a given point in time (0-1 inclusive).
	     */
	    function generateEase(segments) {
	        var qty = segments.length;
	        var oneOverQty = 1 / qty;
	        /*
	         * Calculates the percentage of change at a given point in time (0-1 inclusive).
	         * @param {Number} time The time of the ease, 0-1 inclusive.
	         * @return {Number} The percentage of the change, 0-1 inclusive (unless your
	         *                  ease goes outside those bounds).
	         */
	        return function (time) {
	            var t, s;
	            var i = (qty * time) | 0; //do a quick floor operation
	            t = (time - (i * oneOverQty)) * qty;
	            s = segments[i] || segments[qty - 1];
	            return (s.s + t * (2 * (1 - t) * (s.cp - s.s) + t * (s.e - s.s)));
	        };
	    }
	    ParticleUtils.generateEase = generateEase;
	    /**
	     * Gets a blend mode, ensuring that it is valid.
	     * @param name The name of the blend mode to get.
	     * @return The blend mode as specified in the PIXI.BLEND_MODES enumeration.
	     */
	    function getBlendMode(name) {
	        if (!name)
	            return pixi.BLEND_MODES.NORMAL;
	        name = name.toUpperCase();
	        while (name.indexOf(" ") >= 0)
	            name = name.replace(" ", "_");
	        return pixi.BLEND_MODES[name] || pixi.BLEND_MODES.NORMAL;
	    }
	    ParticleUtils.getBlendMode = getBlendMode;
	    /**
	     * Converts a list of {value, time} objects starting at time 0 and ending at time 1 into an evenly
	     * spaced stepped list of PropertyNodes for color values. This is primarily to handle conversion of
	     * linear gradients to fewer colors, allowing for some optimization for Canvas2d fallbacks.
	     * @param list The list of data to convert.
	     * @param [numSteps=10] The number of steps to use.
	     * @return The blend mode as specified in the PIXI.blendModes enumeration.
	     */
	    function createSteppedGradient(list, numSteps) {
	        if (numSteps === void 0) { numSteps = 10; }
	        if (typeof numSteps !== 'number' || numSteps <= 0)
	            numSteps = 10;
	        var first = new PropertyNode(ParticleUtils.hexToRGB(list[0].value), list[0].time);
	        first.isStepped = true;
	        var currentNode = first;
	        var current = list[0];
	        var nextIndex = 1;
	        var next = list[nextIndex];
	        for (var i = 1; i < numSteps; ++i) {
	            var lerp = i / numSteps;
	            //ensure we are on the right segment, if multiple
	            while (lerp > next.time) {
	                current = next;
	                next = list[++nextIndex];
	            }
	            //convert the lerp value to the segment range
	            lerp = (lerp - current.time) / (next.time - current.time);
	            var curVal = ParticleUtils.hexToRGB(current.value);
	            var nextVal = ParticleUtils.hexToRGB(next.value);
	            var output = {
	                r: (nextVal.r - curVal.r) * lerp + curVal.r,
	                g: (nextVal.g - curVal.g) * lerp + curVal.g,
	                b: (nextVal.b - curVal.b) * lerp + curVal.b,
	            };
	            currentNode.next = new PropertyNode(output, i / numSteps);
	            currentNode = currentNode.next;
	        }
	        //we don't need to have a PropertyNode for time of 1, because in a stepped version at that point
	        //the particle has died of old age
	        return first;
	    }
	    ParticleUtils.createSteppedGradient = createSteppedGradient;
	})(exports.ParticleUtils || (exports.ParticleUtils = {}));

	/*! *****************************************************************************
	Copyright (c) Microsoft Corporation. All rights reserved.
	Licensed under the Apache License, Version 2.0 (the "License"); you may not use
	this file except in compliance with the License. You may obtain a copy of the
	License at http://www.apache.org/licenses/LICENSE-2.0

	THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
	KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
	WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
	MERCHANTABLITY OR NON-INFRINGEMENT.

	See the Apache Version 2.0 License for specific language governing permissions
	and limitations under the License.
	***************************************************************************** */
	/* global Reflect, Promise */

	var extendStatics = function(d, b) {
	    extendStatics = Object.setPrototypeOf ||
	        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
	        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
	    return extendStatics(d, b);
	};

	function __extends(d, b) {
	    extendStatics(d, b);
	    function __() { this.constructor = d; }
	    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
	}

	var __assign = function() {
	    __assign = Object.assign || function __assign(t) {
	        for (var s, i = 1, n = arguments.length; i < n; i++) {
	            s = arguments[i];
	            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
	        }
	        return t;
	    };
	    return __assign.apply(this, arguments);
	};

	function __rest(s, e) {
	    var t = {};
	    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
	        t[p] = s[p];
	    if (s != null && typeof Object.getOwnPropertySymbols === "function")
	        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
	            t[p[i]] = s[p[i]];
	    return t;
	}

	function __decorate(decorators, target, key, desc) {
	    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
	    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
	    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
	    return c > 3 && r && Object.defineProperty(target, key, r), r;
	}

	function __param(paramIndex, decorator) {
	    return function (target, key) { decorator(target, key, paramIndex); }
	}

	function __metadata(metadataKey, metadataValue) {
	    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
	}

	function __awaiter(thisArg, _arguments, P, generator) {
	    return new (P || (P = Promise))(function (resolve, reject) {
	        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
	        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
	        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
	        step((generator = generator.apply(thisArg, _arguments || [])).next());
	    });
	}

	function __generator(thisArg, body) {
	    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
	    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
	    function verb(n) { return function (v) { return step([n, v]); }; }
	    function step(op) {
	        if (f) throw new TypeError("Generator is already executing.");
	        while (_) try {
	            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
	            if (y = 0, t) op = [op[0] & 2, t.value];
	            switch (op[0]) {
	                case 0: case 1: t = op; break;
	                case 4: _.label++; return { value: op[1], done: false };
	                case 5: _.label++; y = op[1]; op = [0]; continue;
	                case 7: op = _.ops.pop(); _.trys.pop(); continue;
	                default:
	                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
	                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
	                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
	                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
	                    if (t[2]) _.ops.pop();
	                    _.trys.pop(); continue;
	            }
	            op = body.call(thisArg, _);
	        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
	        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
	    }
	}

	function __exportStar(m, exports) {
	    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
	}

	function __values(o) {
	    var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
	    if (m) return m.call(o);
	    return {
	        next: function () {
	            if (o && i >= o.length) o = void 0;
	            return { value: o && o[i++], done: !o };
	        }
	    };
	}

	function __read(o, n) {
	    var m = typeof Symbol === "function" && o[Symbol.iterator];
	    if (!m) return o;
	    var i = m.call(o), r, ar = [], e;
	    try {
	        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
	    }
	    catch (error) { e = { error: error }; }
	    finally {
	        try {
	            if (r && !r.done && (m = i["return"])) m.call(i);
	        }
	        finally { if (e) throw e.error; }
	    }
	    return ar;
	}

	function __spread() {
	    for (var ar = [], i = 0; i < arguments.length; i++)
	        ar = ar.concat(__read(arguments[i]));
	    return ar;
	}

	function __await(v) {
	    return this instanceof __await ? (this.v = v, this) : new __await(v);
	}

	function __asyncGenerator(thisArg, _arguments, generator) {
	    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
	    var g = generator.apply(thisArg, _arguments || []), i, q = [];
	    return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
	    function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
	    function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
	    function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
	    function fulfill(value) { resume("next", value); }
	    function reject(value) { resume("throw", value); }
	    function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
	}

	function __asyncDelegator(o) {
	    var i, p;
	    return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
	    function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
	}

	function __asyncValues(o) {
	    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
	    var m = o[Symbol.asyncIterator], i;
	    return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
	    function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
	    function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
	}

	function __makeTemplateObject(cooked, raw) {
	    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
	    return cooked;
	};

	function __importStar(mod) {
	    if (mod && mod.__esModule) return mod;
	    var result = {};
	    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
	    result.default = mod;
	    return result;
	}

	function __importDefault(mod) {
	    return (mod && mod.__esModule) ? mod : { default: mod };
	}

	/**
	 * Singly linked list container for keeping track of interpolated properties for particles.
	 * Each Particle will have one of these for each interpolated property.
	 */
	var PropertyList = /** @class */ (function () {
	    /**
	     * @param isColor If this list handles color values
	     */
	    function PropertyList(isColor) {
	        if (isColor === void 0) { isColor = false; }
	        this.current = null;
	        this.next = null;
	        this.isColor = !!isColor;
	        this.interpolate = null;
	        this.ease = null;
	    }
	    /**
	     * Resets the list for use.
	     * @param first The first node in the list.
	     * @param first.isStepped If the values should be stepped instead of interpolated linearly.
	     */
	    PropertyList.prototype.reset = function (first) {
	        this.current = first;
	        this.next = first.next;
	        var isSimple = this.next && this.next.time >= 1;
	        if (isSimple) {
	            this.interpolate = this.isColor ? intColorSimple : intValueSimple;
	        }
	        else if (first.isStepped) {
	            this.interpolate = this.isColor ? intColorStepped : intValueStepped;
	        }
	        else {
	            this.interpolate = this.isColor ? intColorComplex : intValueComplex;
	        }
	        this.ease = this.current.ease;
	    };
	    return PropertyList;
	}());
	function intValueSimple(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    return (this.next.value - this.current.value) * lerp + this.current.value;
	}
	function intColorSimple(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    var curVal = this.current.value, nextVal = this.next.value;
	    var r = (nextVal.r - curVal.r) * lerp + curVal.r;
	    var g = (nextVal.g - curVal.g) * lerp + curVal.g;
	    var b = (nextVal.b - curVal.b) * lerp + curVal.b;
	    return exports.ParticleUtils.combineRGBComponents(r, g, b);
	}
	function intValueComplex(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    //make sure we are on the right segment
	    while (lerp > this.next.time) {
	        this.current = this.next;
	        this.next = this.next.next;
	    }
	    //convert the lerp value to the segment range
	    lerp = (lerp - this.current.time) / (this.next.time - this.current.time);
	    return (this.next.value - this.current.value) * lerp + this.current.value;
	}
	function intColorComplex(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    //make sure we are on the right segment
	    while (lerp > this.next.time) {
	        this.current = this.next;
	        this.next = this.next.next;
	    }
	    //convert the lerp value to the segment range
	    lerp = (lerp - this.current.time) / (this.next.time - this.current.time);
	    var curVal = this.current.value, nextVal = this.next.value;
	    var r = (nextVal.r - curVal.r) * lerp + curVal.r;
	    var g = (nextVal.g - curVal.g) * lerp + curVal.g;
	    var b = (nextVal.b - curVal.b) * lerp + curVal.b;
	    return exports.ParticleUtils.combineRGBComponents(r, g, b);
	}
	function intValueStepped(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    //make sure we are on the right segment
	    while (this.next && lerp > this.next.time) {
	        this.current = this.next;
	        this.next = this.next.next;
	    }
	    return this.current.value;
	}
	function intColorStepped(lerp) {
	    if (this.ease)
	        lerp = this.ease(lerp);
	    //make sure we are on the right segment
	    while (this.next && lerp > this.next.time) {
	        this.current = this.next;
	        this.next = this.next.next;
	    }
	    var curVal = this.current.value;
	    return exports.ParticleUtils.combineRGBComponents(curVal.r, curVal.g, curVal.b);
	}

	/**
	 * An individual particle image. You shouldn't have to deal with these.
	 */
	var Particle = /** @class */ (function (_super) {
	    __extends(Particle, _super);
	    /**
	     * @param {PIXI.particles.Emitter} emitter The emitter that controls this particle.
	     */
	    function Particle(emitter) {
	        var _this = 
	        //start off the sprite with a blank texture, since we are going to replace it
	        //later when the particle is initialized.
	        _super.call(this) || this;
	        _this.emitter = emitter;
	        //particles should be centered
	        _this.anchor.x = _this.anchor.y = 0.5;
	        _this.velocity = new pixi.Point();
	        _this.rotationSpeed = 0;
	        _this.rotationAcceleration = 0;
	        _this.maxLife = 0;
	        _this.age = 0;
	        _this.ease = null;
	        _this.extraData = null;
	        _this.alphaList = new PropertyList();
	        _this.speedList = new PropertyList();
	        _this.speedMultiplier = 1;
	        _this.acceleration = new pixi.Point();
	        _this.maxSpeed = NaN;
	        _this.scaleList = new PropertyList();
	        _this.scaleMultiplier = 1;
	        _this.colorList = new PropertyList(true);
	        _this._doAlpha = false;
	        _this._doScale = false;
	        _this._doSpeed = false;
	        _this._doAcceleration = false;
	        _this._doColor = false;
	        _this._doNormalMovement = false;
	        _this._oneOverLife = 0;
	        _this.next = null;
	        _this.prev = null;
	        //save often used functions on the instance instead of the prototype for better speed
	        _this.init = _this.init;
	        _this.Particle_init = Particle.prototype.init;
	        _this.update = _this.update;
	        _this.Particle_update = Particle.prototype.update;
	        _this.Sprite_destroy = _super.prototype.destroy;
	        _this.Particle_destroy = Particle.prototype.destroy;
	        _this.applyArt = _this.applyArt;
	        _this.kill = _this.kill;
	        return _this;
	    }
	    /**
	     * Initializes the particle for use, based on the properties that have to
	     * have been set already on the particle.
	     */
	    Particle.prototype.init = function () {
	        //reset the age
	        this.age = 0;
	        //set up the velocity based on the start speed and rotation
	        this.velocity.x = this.speedList.current.value * this.speedMultiplier;
	        this.velocity.y = 0;
	        exports.ParticleUtils.rotatePoint(this.rotation, this.velocity);
	        if (this.noRotation) {
	            this.rotation = 0;
	        }
	        else {
	            //convert rotation to Radians from Degrees
	            this.rotation *= exports.ParticleUtils.DEG_TO_RADS;
	        }
	        //convert rotation speed to Radians from Degrees
	        this.rotationSpeed *= exports.ParticleUtils.DEG_TO_RADS;
	        this.rotationAcceleration *= exports.ParticleUtils.DEG_TO_RADS;
	        //set alpha to inital alpha
	        this.alpha = this.alphaList.current.value;
	        //set scale to initial scale
	        this.scale.x = this.scale.y = this.scaleList.current.value;
	        //figure out what we need to interpolate
	        this._doAlpha = !!this.alphaList.current.next;
	        this._doSpeed = !!this.speedList.current.next;
	        this._doScale = !!this.scaleList.current.next;
	        this._doColor = !!this.colorList.current.next;
	        this._doAcceleration = this.acceleration.x !== 0 || this.acceleration.y !== 0;
	        //_doNormalMovement can be cancelled by subclasses
	        this._doNormalMovement = this._doSpeed || this.speedList.current.value !== 0 || this._doAcceleration;
	        //save our lerp helper
	        this._oneOverLife = 1 / this.maxLife;
	        //set the inital color
	        var color = this.colorList.current.value;
	        this.tint = exports.ParticleUtils.combineRGBComponents(color.r, color.g, color.b);
	        //ensure visibility
	        this.visible = true;
	    };
	    /**
	     * Sets the texture for the particle. This can be overridden to allow
	     * for an animated particle.
	     * @param art The texture to set.
	     */
	    Particle.prototype.applyArt = function (art) {
	        this.texture = art || pixi.Texture.EMPTY;
	    };
	    /**
	     * Updates the particle.
	     * @param delta Time elapsed since the previous frame, in __seconds__.
	     * @return The standard interpolation multiplier (0-1) used for all
	     *         relevant particle properties. A value of -1 means the particle
	     *         died of old age instead.
	     */
	    Particle.prototype.update = function (delta) {
	        //increase age
	        this.age += delta;
	        //recycle particle if it is too old
	        if (this.age >= this.maxLife || this.age < 0) {
	            this.kill();
	            return -1;
	        }
	        //determine our interpolation value
	        var lerp = this.age * this._oneOverLife; //lifetime / maxLife;
	        if (this.ease) {
	            if (this.ease.length == 4) {
	                //the t, b, c, d parameters that some tween libraries use
	                //(time, initial value, end value, duration)
	                lerp = this.ease(lerp, 0, 1, 1);
	            }
	            else {
	                //the simplified version that we like that takes
	                //one parameter, time from 0-1. TweenJS eases provide this usage.
	                lerp = this.ease(lerp);
	            }
	        }
	        //interpolate alpha
	        if (this._doAlpha)
	            this.alpha = this.alphaList.interpolate(lerp);
	        //interpolate scale
	        if (this._doScale) {
	            var scale = this.scaleList.interpolate(lerp) * this.scaleMultiplier;
	            this.scale.x = this.scale.y = scale;
	        }
	        //handle movement
	        if (this._doNormalMovement) {
	            var deltaX = void 0;
	            var deltaY = void 0;
	            //interpolate speed
	            if (this._doSpeed) {
	                var speed = this.speedList.interpolate(lerp) * this.speedMultiplier;
	                exports.ParticleUtils.normalize(this.velocity);
	                exports.ParticleUtils.scaleBy(this.velocity, speed);
	                deltaX = this.velocity.x * delta;
	                deltaY = this.velocity.y * delta;
	            }
	            else if (this._doAcceleration) {
	                var oldVX = this.velocity.x;
	                var oldVY = this.velocity.y;
	                this.velocity.x += this.acceleration.x * delta;
	                this.velocity.y += this.acceleration.y * delta;
	                if (this.maxSpeed) {
	                    var currentSpeed = exports.ParticleUtils.length(this.velocity);
	                    //if we are going faster than we should, clamp at the max speed
	                    //DO NOT recalculate vector length
	                    if (currentSpeed > this.maxSpeed) {
	                        exports.ParticleUtils.scaleBy(this.velocity, this.maxSpeed / currentSpeed);
	                    }
	                }
	                // calculate position delta by the midpoint between our old velocity and our new velocity
	                deltaX = (oldVX + this.velocity.x) / 2 * delta;
	                deltaY = (oldVY + this.velocity.y) / 2 * delta;
	            }
	            else {
	                deltaX = this.velocity.x * delta;
	                deltaY = this.velocity.y * delta;
	            }
	            //adjust position based on velocity
	            this.position.x += deltaX;
	            this.position.y += deltaY;
	        }
	        //interpolate color
	        if (this._doColor) {
	            this.tint = this.colorList.interpolate(lerp);
	        }
	        //update rotation
	        if (this.rotationAcceleration !== 0) {
	            var newRotationSpeed = this.rotationSpeed + this.rotationAcceleration * delta;
	            this.rotation += (this.rotationSpeed + newRotationSpeed) / 2 * delta;
	            this.rotationSpeed = newRotationSpeed;
	        }
	        else if (this.rotationSpeed !== 0) {
	            this.rotation += this.rotationSpeed * delta;
	        }
	        else if (this.acceleration && !this.noRotation) {
	            this.rotation = Math.atan2(this.velocity.y, this.velocity.x); // + Math.PI / 2;
	        }
	        return lerp;
	    };
	    /**
	     * Kills the particle, removing it from the display list
	     * and telling the emitter to recycle it.
	     */
	    Particle.prototype.kill = function () {
	        this.emitter.recycle(this);
	    };
	    /**
	     * Destroys the particle, removing references and preventing future use.
	     */
	    Particle.prototype.destroy = function () {
	        if (this.parent)
	            this.parent.removeChild(this);
	        this.Sprite_destroy();
	        this.emitter = this.velocity = this.colorList = this.scaleList = this.alphaList =
	            this.speedList = this.ease = this.next = this.prev = null;
	    };
	    /**
	     * Checks over the art that was passed to the Emitter's init() function, to do any special
	     * modifications to prepare it ahead of time.
	     * @param art The array of art data. For Particle, it should be an array of
	     *            Textures. Any strings in the array will be converted to
	     *            Textures via Texture.from().
	     * @return The art, after any needed modifications.
	     */
	    Particle.parseArt = function (art) {
	        //convert any strings to Textures.
	        var i;
	        for (i = art.length; i >= 0; --i) {
	            if (typeof art[i] == "string")
	                art[i] = GetTextureFromString(art[i]);
	        }
	        //particles from different base textures will be slower in WebGL than if they
	        //were from one spritesheet
	        if (exports.ParticleUtils.verbose) {
	            for (i = art.length - 1; i > 0; --i) {
	                if (art[i].baseTexture != art[i - 1].baseTexture) {
	                    if (window.console)
	                        console.warn("PixiParticles: using particle textures from different images may hinder performance in WebGL");
	                    break;
	                }
	            }
	        }
	        return art;
	    };
	    /**
	     * Parses extra emitter data to ensure it is set up for this particle class.
	     * Particle does nothing to the extra data.
	     * @param extraData The extra data from the particle config.
	     * @return The parsed extra data.
	     */
	    Particle.parseData = function (extraData) {
	        return extraData;
	    };
	    return Particle;
	}(pixi.Sprite));

	/**
	 * Chain of line segments for generating spawn positions.
	 */
	var PolygonalChain = /** @class */ (function () {
	    /**
	     * @param data Point data for polygon chains. Either a list of points for a single chain, or a list of chains.
	     */
	    function PolygonalChain(data) {
	        this.segments = [];
	        this.countingLengths = [];
	        this.totalLength = 0;
	        this.init(data);
	    }
	    /**
	     * @param data Point data for polygon chains. Either a list of points for a single chain, or a list of chains.
	     */
	    PolygonalChain.prototype.init = function (data) {
	        // if data is not present, set up a segment of length 0
	        if (!data || !data.length) {
	            this.segments.push({ p1: { x: 0, y: 0 }, p2: { x: 0, y: 0 }, l: 0 });
	        }
	        else {
	            if (Array.isArray(data[0])) {
	                // list of segment chains, each defined as a list of points
	                for (var i = 0; i < data.length; ++i) {
	                    // loop through the chain, connecting points
	                    var chain = data[i];
	                    var prevPoint = chain[0];
	                    for (var j = 1; j < chain.length; ++j) {
	                        var second = chain[j];
	                        this.segments.push({ p1: prevPoint, p2: second, l: 0 });
	                        prevPoint = second;
	                    }
	                }
	            }
	            else {
	                var prevPoint = data[0];
	                // list of points
	                for (var i = 1; i < data.length; ++i) {
	                    var second = data[i];
	                    this.segments.push({ p1: prevPoint, p2: second, l: 0 });
	                    prevPoint = second;
	                }
	            }
	        }
	        // now go through our segments to calculate the lengths so that we
	        // can set up a nice weighted random distribution
	        for (var i = 0; i < this.segments.length; ++i) {
	            var _a = this.segments[i], p1 = _a.p1, p2 = _a.p2;
	            var segLength = Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y));
	            // save length so we can turn a random number into a 0-1 interpolation value later
	            this.segments[i].l = segLength;
	            this.totalLength += segLength;
	            // keep track of the length so far, counting up
	            this.countingLengths.push(this.totalLength);
	        }
	    };
	    /**
	     * Gets a random point in the chain.
	     * @param out The point to store the selected position in.
	     */
	    PolygonalChain.prototype.getRandomPoint = function (out) {
	        // select a random spot in the length of the chain
	        var rand = Math.random() * this.totalLength;
	        var chosenSeg;
	        var lerp;
	        // if only one segment, it wins
	        if (this.segments.length === 1) {
	            chosenSeg = this.segments[0];
	            lerp = rand;
	        }
	        else {
	            // otherwise, go through countingLengths until we have determined
	            // which segment we chose
	            for (var i = 0; i < this.countingLengths.length; ++i) {
	                if (rand < this.countingLengths[i]) {
	                    chosenSeg = this.segments[i];
	                    // set lerp equal to the length into that segment (i.e. the remainder after subtracting all the segments before it)
	                    lerp = i === 0 ? rand : rand - this.countingLengths[i - 1];
	                    break;
	                }
	            }
	        }
	        // divide lerp by the segment length, to result in a 0-1 number.
	        lerp /= chosenSeg.l || 1;
	        var p1 = chosenSeg.p1, p2 = chosenSeg.p2;
	        // now calculate the position in the segment that the lerp value represents
	        out.x = p1.x + lerp * (p2.x - p1.x);
	        out.y = p1.y + lerp * (p2.y - p1.y);
	    };
	    return PolygonalChain;
	}());

	// get the shared ticker, in V4 and V5 friendly methods
	/**
	 * @hidden
	 */
	var ticker;
	// to avoid Rollup transforming our import, save pixi namespace in a variable
	var pixiNS$1 = pixi;
	if (parseInt(/^(\d+)\./.exec(pixi.VERSION)[1]) < 5) {
	    ticker = pixiNS$1.ticker.shared;
	}
	else {
	    ticker = pixiNS$1.Ticker.shared;
	}
	/**
	 * @hidden
	 */
	var helperPoint = new pixi.Point();
	/**
	 * A particle emitter.
	 */
	var Emitter = /** @class */ (function () {
	    /**
	     * @param particleParent The container to add the particles to.
	     * @param particleImages A texture or array of textures to use
	     *                       for the particles. Strings will be turned
	     *                       into textures via Texture.fromImage().
	     * @param config A configuration object containing settings for the emitter.
	     * @param config.emit If config.emit is explicitly passed as false, the
	     *                    Emitter will start disabled.
	     * @param config.autoUpdate If config.autoUpdate is explicitly passed as
	     *                          true, the Emitter will automatically call
	     *                          update via the PIXI shared ticker.
	     */
	    function Emitter(particleParent, particleImages, config) {
	        /**
	         * A number keeping index of currently applied image. Used to emit arts in order.
	         */
	        this._currentImageIndex = -1;
	        this._particleConstructor = Particle;
	        //properties for individual particles
	        this.particleImages = null;
	        this.startAlpha = null;
	        this.startSpeed = null;
	        this.minimumSpeedMultiplier = 1;
	        this.acceleration = null;
	        this.maxSpeed = NaN;
	        this.startScale = null;
	        this.minimumScaleMultiplier = 1;
	        this.startColor = null;
	        this.minLifetime = 0;
	        this.maxLifetime = 0;
	        this.minStartRotation = 0;
	        this.maxStartRotation = 0;
	        this.noRotation = false;
	        this.minRotationSpeed = 0;
	        this.maxRotationSpeed = 0;
	        this.particleBlendMode = 0;
	        this.customEase = null;
	        this.extraData = null;
	        //properties for spawning particles
	        this._frequency = 1;
	        this.spawnChance = 1;
	        this.maxParticles = 1000;
	        this.emitterLifetime = -1;
	        this.spawnPos = null;
	        this.spawnType = null;
	        this._spawnFunc = null;
	        this.spawnRect = null;
	        this.spawnCircle = null;
	        this.spawnPolygonalChain = null;
	        this.particlesPerWave = 1;
	        this.particleSpacing = 0;
	        this.angleStart = 0;
	        //emitter properties
	        this.rotation = 0;
	        this.ownerPos = null;
	        this._prevEmitterPos = null;
	        this._prevPosIsValid = false;
	        this._posChanged = false;
	        this._parent = null;
	        this.addAtBack = false;
	        this.particleCount = 0;
	        this._emit = false;
	        this._spawnTimer = 0;
	        this._emitterLife = -1;
	        this._activeParticlesFirst = null;
	        this._activeParticlesLast = null;
	        this._poolFirst = null;
	        this._origConfig = null;
	        this._origArt = null;
	        this._autoUpdate = false;
	        this._currentImageIndex = -1;
	        this._destroyWhenComplete = false;
	        this._completeCallback = null;
	        //set the initial parent
	        this.parent = particleParent;
	        if (particleImages && config)
	            this.init(particleImages, config);
	        //save often used functions on the instance instead of the prototype for better speed
	        this.recycle = this.recycle;
	        this.update = this.update;
	        this.rotate = this.rotate;
	        this.updateSpawnPos = this.updateSpawnPos;
	        this.updateOwnerPos = this.updateOwnerPos;
	    }
	    Object.defineProperty(Emitter.prototype, "orderedArt", {
	        /**
	         * If the emitter is using particle art in order as provided in `particleImages`.
	         * Effective only when `particleImages` has multiple art options.
	         * This is particularly useful ensuring that each art shows up once, in case you need to emit a body in an order.
	         * For example: dragon - [Head, body1, body2, ..., tail]
	         */
	        get: function () { return this._currentImageIndex !== -1; },
	        set: function (value) {
	            this._currentImageIndex = value ? 0 : -1;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(Emitter.prototype, "frequency", {
	        /**
	         * Time between particle spawns in seconds. If this value is not a number greater than 0,
	         * it will be set to 1 (particle per second) to prevent infinite loops.
	         */
	        get: function () { return this._frequency; },
	        set: function (value) {
	            //do some error checking to prevent infinite loops
	            if (typeof value == "number" && value > 0)
	                this._frequency = value;
	            else
	                this._frequency = 1;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(Emitter.prototype, "particleConstructor", {
	        /**
	         * The constructor used to create new particles. The default is
	         * the built in Particle class. Setting this will dump any active or
	         * pooled particles, if the emitter has already been used.
	         */
	        get: function () { return this._particleConstructor; },
	        set: function (value) {
	            if (value != this._particleConstructor) {
	                this._particleConstructor = value;
	                //clean up existing particles
	                this.cleanup();
	                //scrap all the particles
	                for (var particle = this._poolFirst; particle; particle = particle.next) {
	                    particle.destroy();
	                }
	                this._poolFirst = null;
	                //re-initialize the emitter so that the new constructor can do anything it needs to
	                if (this._origConfig && this._origArt)
	                    this.init(this._origArt, this._origConfig);
	            }
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(Emitter.prototype, "parent", {
	        /**
	        * The container to add particles to. Settings this will dump any active particles.
	        */
	        get: function () { return this._parent; },
	        set: function (value) {
	            this.cleanup();
	            this._parent = value;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    /**
	     * Sets up the emitter based on the config settings.
	     * @param art A texture or array of textures to use for the particles.
	     * @param config A configuration object containing settings for the emitter.
	     */
	    Emitter.prototype.init = function (art, config) {
	        if (!art || !config)
	            return;
	        //clean up any existing particles
	        this.cleanup();
	        //store the original config and particle images, in case we need to re-initialize
	        //when the particle constructor is changed
	        this._origConfig = config;
	        this._origArt = art;
	        //set up the array of data, also ensuring that it is an array
	        art = Array.isArray(art) ? art.slice() : [art];
	        //run the art through the particle class's parsing function
	        var partClass = this._particleConstructor;
	        this.particleImages = partClass.parseArt ? partClass.parseArt(art) : art;
	        ///////////////////////////
	        // Particle Properties   //
	        ///////////////////////////
	        //set up the alpha
	        if (config.alpha) {
	            this.startAlpha = PropertyNode.createList(config.alpha);
	        }
	        else
	            this.startAlpha = new PropertyNode(1, 0);
	        //set up the speed
	        if (config.speed) {
	            this.startSpeed = PropertyNode.createList(config.speed);
	            this.minimumSpeedMultiplier = ('minimumSpeedMultiplier' in config ? config.minimumSpeedMultiplier : config.speed.minimumSpeedMultiplier) || 1;
	        }
	        else {
	            this.minimumSpeedMultiplier = 1;
	            this.startSpeed = new PropertyNode(0, 0);
	        }
	        //set up acceleration
	        var acceleration = config.acceleration;
	        if (acceleration && (acceleration.x || acceleration.y)) {
	            //make sure we disable speed interpolation
	            this.startSpeed.next = null;
	            this.acceleration = new pixi.Point(acceleration.x, acceleration.y);
	            this.maxSpeed = config.maxSpeed || NaN;
	        }
	        else
	            this.acceleration = new pixi.Point();
	        //set up the scale
	        if (config.scale) {
	            this.startScale = PropertyNode.createList(config.scale);
	            this.minimumScaleMultiplier = ('minimumScaleMultiplier' in config ? config.minimumScaleMultiplier : config.scale.minimumScaleMultiplier) || 1;
	        }
	        else {
	            this.startScale = new PropertyNode(1, 0);
	            this.minimumScaleMultiplier = 1;
	        }
	        //set up the color
	        if (config.color) {
	            this.startColor = PropertyNode.createList(config.color);
	        }
	        else {
	            this.startColor = new PropertyNode({ r: 0xFF, g: 0xFF, b: 0xFF }, 0);
	        }
	        //set up the start rotation
	        if (config.startRotation) {
	            this.minStartRotation = config.startRotation.min;
	            this.maxStartRotation = config.startRotation.max;
	        }
	        else
	            this.minStartRotation = this.maxStartRotation = 0;
	        if (config.noRotation &&
	            (this.minStartRotation || this.maxStartRotation)) {
	            this.noRotation = !!config.noRotation;
	        }
	        else
	            this.noRotation = false;
	        //set up the rotation speed
	        if (config.rotationSpeed) {
	            this.minRotationSpeed = config.rotationSpeed.min;
	            this.maxRotationSpeed = config.rotationSpeed.max;
	        }
	        else
	            this.minRotationSpeed = this.maxRotationSpeed = 0;
	        this.rotationAcceleration = config.rotationAcceleration || 0;
	        //set up the lifetime
	        this.minLifetime = config.lifetime.min;
	        this.maxLifetime = config.lifetime.max;
	        //get the blend mode
	        this.particleBlendMode = exports.ParticleUtils.getBlendMode(config.blendMode);
	        //use the custom ease if provided
	        if (config.ease) {
	            this.customEase = typeof config.ease == "function" ?
	                config.ease : exports.ParticleUtils.generateEase(config.ease);
	        }
	        else
	            this.customEase = null;
	        //set up the extra data, running it through the particle class's parseData function.
	        if (partClass.parseData)
	            this.extraData = partClass.parseData(config.extraData);
	        else
	            this.extraData = config.extraData || null;
	        //////////////////////////
	        // Emitter Properties   //
	        //////////////////////////
	        //reset spawn type specific settings
	        this.spawnRect = this.spawnCircle = null;
	        this.particlesPerWave = 1;
	        if (config.particlesPerWave && config.particlesPerWave > 1)
	            this.particlesPerWave = config.particlesPerWave;
	        this.particleSpacing = 0;
	        this.angleStart = 0;
	        //determine the spawn function to use
	        this.parseSpawnType(config);
	        //set the spawning frequency
	        this.frequency = config.frequency;
	        this.spawnChance = (typeof config.spawnChance === 'number' && config.spawnChance > 0) ? config.spawnChance : 1;
	        //set the emitter lifetime
	        this.emitterLifetime = config.emitterLifetime || -1;
	        //set the max particles
	        this.maxParticles = config.maxParticles > 0 ? config.maxParticles : 1000;
	        //determine if we should add the particle at the back of the list or not
	        this.addAtBack = !!config.addAtBack;
	        //reset the emitter position and rotation variables
	        this.rotation = 0;
	        this.ownerPos = new pixi.Point();
	        this.spawnPos = new pixi.Point(config.pos.x, config.pos.y);
	        this.initAdditional(art, config);
	        this._prevEmitterPos = this.spawnPos.clone();
	        //previous emitter position is invalid and should not be used for interpolation
	        this._prevPosIsValid = false;
	        //start emitting
	        this._spawnTimer = 0;
	        this.emit = config.emit === undefined ? true : !!config.emit;
	        this.autoUpdate = !!config.autoUpdate;
	        this.orderedArt = !!config.orderedArt;
	    };
	    /**
	     * Sets up additional parameters to the emitter from config settings.
	     * Using for parsing additional parameters on classes that extend from Emitter
	     * @param art A texture or array of textures to use for the particles.
	     * @param config A configuration object containing settings for the emitter.
	     */
	    Emitter.prototype.initAdditional = function (art, config) {
	    };
	    /**
	     * Parsing emitter spawn type from config settings.
	     * Place for override and add new kind of spawn type
	     * @param config A configuration object containing settings for the emitter.
	     */
	    Emitter.prototype.parseSpawnType = function (config) {
	        var spawnCircle;
	        switch (config.spawnType) {
	            case "rect":
	                this.spawnType = "rect";
	                this._spawnFunc = this._spawnRect;
	                var spawnRect = config.spawnRect;
	                this.spawnRect = new pixi.Rectangle(spawnRect.x, spawnRect.y, spawnRect.w, spawnRect.h);
	                break;
	            case "circle":
	                this.spawnType = "circle";
	                this._spawnFunc = this._spawnCircle;
	                spawnCircle = config.spawnCircle;
	                this.spawnCircle = new pixi.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r);
	                break;
	            case "ring":
	                this.spawnType = "ring";
	                this._spawnFunc = this._spawnRing;
	                spawnCircle = config.spawnCircle;
	                this.spawnCircle = new pixi.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r);
	                this.spawnCircle.minRadius = spawnCircle.minR;
	                break;
	            case "burst":
	                this.spawnType = "burst";
	                this._spawnFunc = this._spawnBurst;
	                this.particleSpacing = config.particleSpacing;
	                this.angleStart = config.angleStart ? config.angleStart : 0;
	                break;
	            case "point":
	                this.spawnType = "point";
	                this._spawnFunc = this._spawnPoint;
	                break;
	            case "polygonalChain":
	                this.spawnType = "polygonalChain";
	                this._spawnFunc = this._spawnPolygonalChain;
	                this.spawnPolygonalChain = new PolygonalChain(config.spawnPolygon);
	                break;
	            default:
	                this.spawnType = "point";
	                this._spawnFunc = this._spawnPoint;
	                break;
	        }
	    };
	    /**
	     * Recycles an individual particle. For internal use only.
	     * @param particle The particle to recycle.
	     * @internal
	     */
	    Emitter.prototype.recycle = function (particle) {
	        if (particle.next)
	            particle.next.prev = particle.prev;
	        if (particle.prev)
	            particle.prev.next = particle.next;
	        if (particle == this._activeParticlesLast)
	            this._activeParticlesLast = particle.prev;
	        if (particle == this._activeParticlesFirst)
	            this._activeParticlesFirst = particle.next;
	        //add to pool
	        particle.prev = null;
	        particle.next = this._poolFirst;
	        this._poolFirst = particle;
	        //remove child from display, or make it invisible if it is in a ParticleContainer
	        if (particle.parent)
	            particle.parent.removeChild(particle);
	        //decrease count
	        --this.particleCount;
	    };
	    /**
	     * Sets the rotation of the emitter to a new value.
	     * @param newRot The new rotation, in degrees.
	     */
	    Emitter.prototype.rotate = function (newRot) {
	        if (this.rotation == newRot)
	            return;
	        //caclulate the difference in rotation for rotating spawnPos
	        var diff = newRot - this.rotation;
	        this.rotation = newRot;
	        //rotate spawnPos
	        exports.ParticleUtils.rotatePoint(diff, this.spawnPos);
	        //mark the position as having changed
	        this._posChanged = true;
	    };
	    /**
	     * Changes the spawn position of the emitter.
	     * @param x The new x value of the spawn position for the emitter.
	     * @param y The new y value of the spawn position for the emitter.
	     */
	    Emitter.prototype.updateSpawnPos = function (x, y) {
	        this._posChanged = true;
	        this.spawnPos.x = x;
	        this.spawnPos.y = y;
	    };
	    /**
	     * Changes the position of the emitter's owner. You should call this if you are adding
	     * particles to the world container that your emitter's owner is moving around in.
	     * @param x The new x value of the emitter's owner.
	     * @param y The new y value of the emitter's owner.
	     */
	    Emitter.prototype.updateOwnerPos = function (x, y) {
	        this._posChanged = true;
	        this.ownerPos.x = x;
	        this.ownerPos.y = y;
	    };
	    /**
	     * Prevents emitter position interpolation in the next update.
	     * This should be used if you made a major position change of your emitter's owner
	     * that was not normal movement.
	     */
	    Emitter.prototype.resetPositionTracking = function () {
	        this._prevPosIsValid = false;
	    };
	    Object.defineProperty(Emitter.prototype, "emit", {
	        /**
	         * If particles should be emitted during update() calls. Setting this to false
	         * stops new particles from being created, but allows existing ones to die out.
	         */
	        get: function () { return this._emit; },
	        set: function (value) {
	            this._emit = !!value;
	            this._emitterLife = this.emitterLifetime;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    ;
	    Object.defineProperty(Emitter.prototype, "autoUpdate", {
	        /**
	         * If the update function is called automatically from the shared ticker.
	         * Setting this to false requires calling the update function manually.
	         */
	        get: function () { return this._autoUpdate; },
	        set: function (value) {
	            if (this._autoUpdate && !value) {
	                ticker.remove(this.update, this);
	            }
	            else if (!this._autoUpdate && value) {
	                ticker.add(this.update, this);
	            }
	            this._autoUpdate = !!value;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    /**
	     * Starts emitting particles, sets autoUpdate to true, and sets up the Emitter to destroy itself
	     * when particle emission is complete.
	     * @param callback Callback for when emission is complete (all particles have died off)
	     */
	    Emitter.prototype.playOnceAndDestroy = function (callback) {
	        this.autoUpdate = true;
	        this.emit = true;
	        this._destroyWhenComplete = true;
	        this._completeCallback = callback;
	    };
	    /**
	     * Starts emitting particles and optionally calls a callback when particle emission is complete.
	     * @param callback Callback for when emission is complete (all particles have died off)
	     */
	    Emitter.prototype.playOnce = function (callback) {
	        this.emit = true;
	        this._completeCallback = callback;
	    };
	    /**
	     * Updates all particles spawned by this emitter and emits new ones.
	     * @param delta Time elapsed since the previous frame, in __seconds__.
	     */
	    Emitter.prototype.update = function (delta) {
	        if (this._autoUpdate) {
	            delta = delta / pixi.settings.TARGET_FPMS / 1000;
	        }
	        //if we don't have a parent to add particles to, then don't do anything.
	        //this also works as a isDestroyed check
	        if (!this._parent)
	            return;
	        //update existing particles
	        var i, particle, next;
	        for (particle = this._activeParticlesFirst; particle; particle = next) {
	            next = particle.next;
	            particle.update(delta);
	        }
	        var prevX, prevY;
	        //if the previous position is valid, store these for later interpolation
	        if (this._prevPosIsValid) {
	            prevX = this._prevEmitterPos.x;
	            prevY = this._prevEmitterPos.y;
	        }
	        //store current position of the emitter as local variables
	        var curX = this.ownerPos.x + this.spawnPos.x;
	        var curY = this.ownerPos.y + this.spawnPos.y;
	        //spawn new particles
	        if (this._emit) {
	            //decrease spawn timer
	            this._spawnTimer -= delta < 0 ? 0 : delta;
	            //while _spawnTimer < 0, we have particles to spawn
	            while (this._spawnTimer <= 0) {
	                //determine if the emitter should stop spawning
	                if (this._emitterLife > 0) {
	                    this._emitterLife -= this._frequency;
	                    if (this._emitterLife <= 0) {
	                        this._spawnTimer = 0;
	                        this._emitterLife = 0;
	                        this.emit = false;
	                        break;
	                    }
	                }
	                //determine if we have hit the particle limit
	                if (this.particleCount >= this.maxParticles) {
	                    this._spawnTimer += this._frequency;
	                    continue;
	                }
	                //determine the particle lifetime
	                var lifetime = void 0;
	                if (this.minLifetime == this.maxLifetime)
	                    lifetime = this.minLifetime;
	                else
	                    lifetime = Math.random() * (this.maxLifetime - this.minLifetime) + this.minLifetime;
	                //only make the particle if it wouldn't immediately destroy itself
	                if (-this._spawnTimer < lifetime) {
	                    //If the position has changed and this isn't the first spawn,
	                    //interpolate the spawn position
	                    var emitPosX = void 0, emitPosY = void 0;
	                    if (this._prevPosIsValid && this._posChanged) {
	                        //1 - _spawnTimer / delta, but _spawnTimer is negative
	                        var lerp = 1 + this._spawnTimer / delta;
	                        emitPosX = (curX - prevX) * lerp + prevX;
	                        emitPosY = (curY - prevY) * lerp + prevY;
	                    }
	                    else //otherwise just set to the spawn position
	                     {
	                        emitPosX = curX;
	                        emitPosY = curY;
	                    }
	                    //create enough particles to fill the wave (non-burst types have a wave of 1)
	                    i = 0;
	                    for (var len = Math.min(this.particlesPerWave, this.maxParticles - this.particleCount); i < len; ++i) {
	                        //see if we actually spawn one
	                        if (this.spawnChance < 1 && Math.random() >= this.spawnChance)
	                            continue;
	                        //create particle
	                        var p = void 0;
	                        if (this._poolFirst) {
	                            p = this._poolFirst;
	                            this._poolFirst = this._poolFirst.next;
	                            p.next = null;
	                        }
	                        else {
	                            p = new this.particleConstructor(this);
	                        }
	                        //set a random texture if we have more than one
	                        if (this.particleImages.length > 1) {
	                            // if using ordered art
	                            if (this._currentImageIndex !== -1) {
	                                // get current art index, then increment for the next particle
	                                p.applyArt(this.particleImages[this._currentImageIndex++]);
	                                // loop around if needed
	                                if (this._currentImageIndex < 0 || this._currentImageIndex >= this.particleImages.length) {
	                                    this._currentImageIndex = 0;
	                                }
	                            }
	                            // otherwise grab a random one
	                            else {
	                                p.applyArt(this.particleImages[Math.floor(Math.random() * this.particleImages.length)]);
	                            }
	                        }
	                        else {
	                            //if they are actually the same texture, a standard particle
	                            //will quit early from the texture setting in setTexture().
	                            p.applyArt(this.particleImages[0]);
	                        }
	                        //set up the start and end values
	                        p.alphaList.reset(this.startAlpha);
	                        if (this.minimumSpeedMultiplier != 1) {
	                            p.speedMultiplier = Math.random() * (1 - this.minimumSpeedMultiplier) + this.minimumSpeedMultiplier;
	                        }
	                        p.speedList.reset(this.startSpeed);
	                        p.acceleration.x = this.acceleration.x;
	                        p.acceleration.y = this.acceleration.y;
	                        p.maxSpeed = this.maxSpeed;
	                        if (this.minimumScaleMultiplier != 1) {
	                            p.scaleMultiplier = Math.random() * (1 - this.minimumScaleMultiplier) + this.minimumScaleMultiplier;
	                        }
	                        p.scaleList.reset(this.startScale);
	                        p.colorList.reset(this.startColor);
	                        //randomize the rotation speed
	                        if (this.minRotationSpeed == this.maxRotationSpeed)
	                            p.rotationSpeed = this.minRotationSpeed;
	                        else
	                            p.rotationSpeed = Math.random() * (this.maxRotationSpeed - this.minRotationSpeed) + this.minRotationSpeed;
	                        p.rotationAcceleration = this.rotationAcceleration;
	                        p.noRotation = this.noRotation;
	                        //set up the lifetime
	                        p.maxLife = lifetime;
	                        //set the blend mode
	                        p.blendMode = this.particleBlendMode;
	                        //set the custom ease, if any
	                        p.ease = this.customEase;
	                        //set the extra data, if any
	                        p.extraData = this.extraData;
	                        //set additional properties to particle
	                        this.applyAdditionalProperties(p);
	                        //call the proper function to handle rotation and position of particle
	                        this._spawnFunc(p, emitPosX, emitPosY, i);
	                        //initialize particle
	                        p.init();
	                        //update the particle by the time passed, so the particles are spread out properly
	                        p.update(-this._spawnTimer); //we want a positive delta, because a negative delta messes things up
	                        //add the particle to the display list
	                        if (!p.parent) {
	                            if (this.addAtBack)
	                                this._parent.addChildAt(p, 0);
	                            else
	                                this._parent.addChild(p);
	                        }
	                        else {
	                            //kind of hacky, but performance friendly
	                            //shuffle children to correct place
	                            var children = this._parent.children;
	                            //avoid using splice if possible
	                            if (children[0] == p)
	                                children.shift();
	                            else if (children[children.length - 1] == p)
	                                children.pop();
	                            else {
	                                var index = children.indexOf(p);
	                                children.splice(index, 1);
	                            }
	                            if (this.addAtBack)
	                                children.unshift(p);
	                            else
	                                children.push(p);
	                        }
	                        //add particle to list of active particles
	                        if (this._activeParticlesLast) {
	                            this._activeParticlesLast.next = p;
	                            p.prev = this._activeParticlesLast;
	                            this._activeParticlesLast = p;
	                        }
	                        else {
	                            this._activeParticlesLast = this._activeParticlesFirst = p;
	                        }
	                        ++this.particleCount;
	                    }
	                }
	                //increase timer and continue on to any other particles that need to be created
	                this._spawnTimer += this._frequency;
	            }
	        }
	        //if the position changed before this update, then keep track of that
	        if (this._posChanged) {
	            this._prevEmitterPos.x = curX;
	            this._prevEmitterPos.y = curY;
	            this._prevPosIsValid = true;
	            this._posChanged = false;
	        }
	        //if we are all done and should destroy ourselves, take care of that
	        if (!this._emit && !this._activeParticlesFirst) {
	            if (this._completeCallback) {
	                var cb = this._completeCallback;
	                this._completeCallback = null;
	                cb();
	            }
	            if (this._destroyWhenComplete) {
	                this.destroy();
	            }
	        }
	    };
	    /**
	     * Set additional properties to new particle.
	     * Using on classes that extend from Emitter
	     * @param p The particle
	     */
	    Emitter.prototype.applyAdditionalProperties = function (p) {
	    };
	    /**
	     * Positions a particle for a point type emitter.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave. Not used for this function.
	     */
	    Emitter.prototype._spawnPoint = function (p, emitPosX, emitPosY) {
	        //set the initial rotation/direction of the particle based on
	        //starting particle angle and rotation of emitter
	        if (this.minStartRotation == this.maxStartRotation)
	            p.rotation = this.minStartRotation + this.rotation;
	        else
	            p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation;
	        //drop the particle at the emitter's position
	        p.position.x = emitPosX;
	        p.position.y = emitPosY;
	    };
	    /**
	     * Positions a particle for a rectangle type emitter.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave. Not used for this function.
	     */
	    Emitter.prototype._spawnRect = function (p, emitPosX, emitPosY) {
	        //set the initial rotation/direction of the particle based on starting
	        //particle angle and rotation of emitter
	        if (this.minStartRotation == this.maxStartRotation)
	            p.rotation = this.minStartRotation + this.rotation;
	        else
	            p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation;
	        //place the particle at a random point in the rectangle
	        helperPoint.x = Math.random() * this.spawnRect.width + this.spawnRect.x;
	        helperPoint.y = Math.random() * this.spawnRect.height + this.spawnRect.y;
	        if (this.rotation !== 0)
	            exports.ParticleUtils.rotatePoint(this.rotation, helperPoint);
	        p.position.x = emitPosX + helperPoint.x;
	        p.position.y = emitPosY + helperPoint.y;
	    };
	    /**
	     * Positions a particle for a circle type emitter.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave. Not used for this function.
	     */
	    Emitter.prototype._spawnCircle = function (p, emitPosX, emitPosY) {
	        //set the initial rotation/direction of the particle based on starting
	        //particle angle and rotation of emitter
	        if (this.minStartRotation == this.maxStartRotation)
	            p.rotation = this.minStartRotation + this.rotation;
	        else
	            p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) +
	                this.minStartRotation + this.rotation;
	        //place the particle at a random radius in the circle
	        helperPoint.x = Math.random() * this.spawnCircle.radius;
	        helperPoint.y = 0;
	        //rotate the point to a random angle in the circle
	        exports.ParticleUtils.rotatePoint(Math.random() * 360, helperPoint);
	        //offset by the circle's center
	        helperPoint.x += this.spawnCircle.x;
	        helperPoint.y += this.spawnCircle.y;
	        //rotate the point by the emitter's rotation
	        if (this.rotation !== 0)
	            exports.ParticleUtils.rotatePoint(this.rotation, helperPoint);
	        //set the position, offset by the emitter's position
	        p.position.x = emitPosX + helperPoint.x;
	        p.position.y = emitPosY + helperPoint.y;
	    };
	    /**
	     * Positions a particle for a ring type emitter.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave. Not used for this function.
	     */
	    Emitter.prototype._spawnRing = function (p, emitPosX, emitPosY) {
	        var spawnCircle = this.spawnCircle;
	        //set the initial rotation/direction of the particle based on starting
	        //particle angle and rotation of emitter
	        if (this.minStartRotation == this.maxStartRotation)
	            p.rotation = this.minStartRotation + this.rotation;
	        else
	            p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) +
	                this.minStartRotation + this.rotation;
	        //place the particle at a random radius in the ring
	        if (spawnCircle.minRadius !== spawnCircle.radius) {
	            helperPoint.x = Math.random() * (spawnCircle.radius - spawnCircle.minRadius) +
	                spawnCircle.minRadius;
	        }
	        else
	            helperPoint.x = spawnCircle.radius;
	        helperPoint.y = 0;
	        //rotate the point to a random angle in the circle
	        var angle = Math.random() * 360;
	        p.rotation += angle;
	        exports.ParticleUtils.rotatePoint(angle, helperPoint);
	        //offset by the circle's center
	        helperPoint.x += this.spawnCircle.x;
	        helperPoint.y += this.spawnCircle.y;
	        //rotate the point by the emitter's rotation
	        if (this.rotation !== 0)
	            exports.ParticleUtils.rotatePoint(this.rotation, helperPoint);
	        //set the position, offset by the emitter's position
	        p.position.x = emitPosX + helperPoint.x;
	        p.position.y = emitPosY + helperPoint.y;
	    };
	    /**
	     * Positions a particle for polygonal chain.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave. Not used for this function.
	     */
	    Emitter.prototype._spawnPolygonalChain = function (p, emitPosX, emitPosY) {
	        //set the initial rotation/direction of the particle based on starting
	        //particle angle and rotation of emitter
	        if (this.minStartRotation == this.maxStartRotation)
	            p.rotation = this.minStartRotation + this.rotation;
	        else
	            p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) +
	                this.minStartRotation + this.rotation;
	        // get random point on the polygon chain
	        this.spawnPolygonalChain.getRandomPoint(helperPoint);
	        //rotate the point by the emitter's rotation
	        if (this.rotation !== 0)
	            exports.ParticleUtils.rotatePoint(this.rotation, helperPoint);
	        //set the position, offset by the emitter's position
	        p.position.x = emitPosX + helperPoint.x;
	        p.position.y = emitPosY + helperPoint.y;
	    };
	    /**
	     * Positions a particle for a burst type emitter.
	     * @param p The particle to position and rotate.
	     * @param emitPosX The emitter's x position
	     * @param emitPosY The emitter's y position
	     * @param i The particle number in the current wave.
	     */
	    Emitter.prototype._spawnBurst = function (p, emitPosX, emitPosY, i) {
	        //set the initial rotation/direction of the particle based on spawn
	        //angle and rotation of emitter
	        if (this.particleSpacing === 0)
	            p.rotation = Math.random() * 360;
	        else
	            p.rotation = this.angleStart + (this.particleSpacing * i) + this.rotation;
	        //drop the particle at the emitter's position
	        p.position.x = emitPosX;
	        p.position.y = emitPosY;
	    };
	    /**
	     * Kills all active particles immediately.
	     */
	    Emitter.prototype.cleanup = function () {
	        var particle, next;
	        for (particle = this._activeParticlesFirst; particle; particle = next) {
	            next = particle.next;
	            this.recycle(particle);
	            if (particle.parent)
	                particle.parent.removeChild(particle);
	        }
	        this._activeParticlesFirst = this._activeParticlesLast = null;
	        this.particleCount = 0;
	    };
	    /**
	     * Destroys the emitter and all of its particles.
	     */
	    Emitter.prototype.destroy = function () {
	        //make sure we aren't still listening to any tickers
	        this.autoUpdate = false;
	        //puts all active particles in the pool, and removes them from the particle parent
	        this.cleanup();
	        //wipe the pool clean
	        var next;
	        for (var particle = this._poolFirst; particle; particle = next) {
	            //store next value so we don't lose it in our destroy call
	            next = particle.next;
	            particle.destroy();
	        }
	        this._poolFirst = this._parent = this.particleImages = this.spawnPos = this.ownerPos =
	            this.startColor = this.startScale = this.startAlpha = this.startSpeed =
	                this.customEase = this._completeCallback = null;
	    };
	    return Emitter;
	}());

	/**
	 * A helper point for math things.
	 * @hidden
	 */
	var helperPoint$1 = new pixi.Point();
	/**
	 * A hand picked list of Math functions (and a couple properties) that are
	 * allowable. They should be used without the preceding "Math."
	 * @hidden
	 */
	var MATH_FUNCS = [
	    "pow",
	    "sqrt",
	    "abs",
	    "floor",
	    "round",
	    "ceil",
	    "E",
	    "PI",
	    "sin",
	    "cos",
	    "tan",
	    "asin",
	    "acos",
	    "atan",
	    "atan2",
	    "log"
	];
	/**
	 * create an actual regular expression object from the string
	 * @hidden
	 */
	var WHITELISTER = new RegExp([
	    //Allow the 4 basic operations, parentheses and all numbers/decimals, as well
	    //as 'x', for the variable usage.
	    "[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]",
	].concat(MATH_FUNCS).join("|"), "g");
	/**
	 * Parses a string into a function for path following.
	 * This involves whitelisting the string for safety, inserting "Math." to math function
	 * names, and using `new Function()` to generate a function.
	 * @hidden
	 * @param pathString The string to parse.
	 * @return The path function - takes x, outputs y.
	 */
	var parsePath = function (pathString) {
	    var matches = pathString.match(WHITELISTER);
	    for (var i = matches.length - 1; i >= 0; --i) {
	        if (MATH_FUNCS.indexOf(matches[i]) >= 0)
	            matches[i] = "Math." + matches[i];
	    }
	    pathString = matches.join("");
	    return new Function("x", "return " + pathString + ";");
	};
	/**
	 * An particle that follows a path defined by an algebraic expression, e.g. "sin(x)" or
	 * "5x + 3".
	 * To use this class, the particle config must have a "path" string in the
	 * "extraData" parameter. This string should have "x" in it to represent movement (from the
	 * speed settings of the particle). It may have numbers, parentheses, the four basic
	 * operations, and the following Math functions or properties (without the preceding "Math."):
	 * "pow", "sqrt", "abs", "floor", "round", "ceil", "E", "PI", "sin", "cos", "tan", "asin",
	 * "acos", "atan", "atan2", "log".
	 * The overall movement of the particle and the expression value become x and y positions for
	 * the particle, respectively. The final position is rotated by the spawn rotation/angle of
	 * the particle.
	 *
	 * Some example paths:
	 *
	 * 	"sin(x/10) * 20" // A sine wave path.
	 * 	"cos(x/100) * 30" // Particles curve counterclockwise (for medium speed/low lifetime particles)
	 * 	"pow(x/10, 2) / 2" // Particles curve clockwise (remember, +y is down).
	 */
	var PathParticle = /** @class */ (function (_super) {
	    __extends(PathParticle, _super);
	    /**
	     * @param {PIXI.particles.Emitter} emitter The emitter that controls this PathParticle.
	     */
	    function PathParticle(emitter) {
	        var _this = _super.call(this, emitter) || this;
	        _this.path = null;
	        _this.initialRotation = 0;
	        _this.initialPosition = new pixi.Point();
	        _this.movement = 0;
	        return _this;
	    }
	    /**
	     * Initializes the particle for use, based on the properties that have to
	     * have been set already on the particle.
	     */
	    PathParticle.prototype.init = function () {
	        //get initial rotation before it is converted to radians
	        this.initialRotation = this.rotation;
	        //standard init
	        this.Particle_init();
	        //set the path for the particle
	        this.path = this.extraData.path;
	        //cancel the normal movement behavior
	        this._doNormalMovement = !this.path;
	        //reset movement
	        this.movement = 0;
	        //grab position
	        this.initialPosition.x = this.position.x;
	        this.initialPosition.y = this.position.y;
	    };
	    /**
	     * Updates the particle.
	     * @param delta Time elapsed since the previous frame, in __seconds__.
	     */
	    PathParticle.prototype.update = function (delta) {
	        var lerp = this.Particle_update(delta);
	        //if the particle died during the update, then don't bother
	        if (lerp >= 0 && this.path) {
	            //increase linear movement based on speed
	            var speed = this.speedList.interpolate(lerp) * this.speedMultiplier;
	            this.movement += speed * delta;
	            //set up the helper point for rotation
	            helperPoint$1.x = this.movement;
	            helperPoint$1.y = this.path(this.movement);
	            exports.ParticleUtils.rotatePoint(this.initialRotation, helperPoint$1);
	            this.position.x = this.initialPosition.x + helperPoint$1.x;
	            this.position.y = this.initialPosition.y + helperPoint$1.y;
	        }
	        return lerp;
	    };
	    /**
	     * Destroys the particle, removing references and preventing future use.
	     */
	    PathParticle.prototype.destroy = function () {
	        this.Particle_destroy();
	        this.path = this.initialPosition = null;
	    };
	    /**
	     * Checks over the art that was passed to the Emitter's init() function, to do any special
	     * modifications to prepare it ahead of time. This just runs Particle.parseArt().
	     * @param art The array of art data. For Particle, it should be an array of
	     *            Textures. Any strings in the array will be converted to
	     *            Textures via Texture.fromImage().
	     * @return The art, after any needed modifications.
	     */
	    PathParticle.parseArt = function (art) {
	        return Particle.parseArt(art);
	    };
	    /**
	     * Parses extra emitter data to ensure it is set up for this particle class.
	     * PathParticle checks for the existence of path data, and parses the path data for use
	     * by particle instances.
	     * @param extraData The extra data from the particle config.
	     * @return The parsed extra data.
	     */
	    PathParticle.parseData = function (extraData) {
	        var output = {};
	        if (extraData && extraData.path) {
	            try {
	                output.path = parsePath(extraData.path);
	            }
	            catch (e) {
	                if (exports.ParticleUtils.verbose)
	                    console.error("PathParticle: error in parsing path expression");
	                output.path = null;
	            }
	        }
	        else {
	            if (exports.ParticleUtils.verbose)
	                console.error("PathParticle requires a path string in extraData!");
	            output.path = null;
	        }
	        return output;
	    };
	    return PathParticle;
	}(Particle));

	/**
	 * An individual particle image with an animation. Art data passed to the emitter must be
	 * formatted in a particular way for AnimatedParticle to be able to handle it:
	 *
	 * ```typescript
	 * {
	 *     //framerate is required. It is the animation speed of the particle in frames per
	 *     //second.
	 *     //A value of "matchLife" causes the animation to match the lifetime of an individual
	 *     //particle, instead of at a constant framerate. This causes the animation to play
	 *     //through one time, completing when the particle expires.
	 *     framerate: 6,
	 *     //loop is optional, and defaults to false.
	 *     loop: true,
	 *     //textures is required, and can be an array of any (non-zero) length.
	 *     textures: [
	 *         //each entry represents a single texture that should be used for one or more
	 *         //frames. Any strings will be converted to Textures with Texture.from().
	 *         //Instances of PIXI.Texture will be used directly.
	 *         "animFrame1.png",
	 *         //entries can be an object with a 'count' property, telling AnimatedParticle to
	 *         //use that texture for 'count' frames sequentially.
	 *         {
	 *             texture: "animFrame2.png",
	 *             count: 3
	 *         },
	 *         "animFrame3.png"
	 *     ]
	 * }
	 * ```
	 */
	var AnimatedParticle = /** @class */ (function (_super) {
	    __extends(AnimatedParticle, _super);
	    /**
	     * @param emitter The emitter that controls this AnimatedParticle.
	     */
	    function AnimatedParticle(emitter) {
	        var _this = _super.call(this, emitter) || this;
	        _this.textures = null;
	        _this.duration = 0;
	        _this.framerate = 0;
	        _this.elapsed = 0;
	        _this.loop = false;
	        return _this;
	    }
	    /**
	     * Initializes the particle for use, based on the properties that have to
	     * have been set already on the particle.
	     */
	    AnimatedParticle.prototype.init = function () {
	        this.Particle_init();
	        this.elapsed = 0;
	        //if the animation needs to match the particle's life, then cacluate variables
	        if (this.framerate < 0) {
	            this.duration = this.maxLife;
	            this.framerate = this.textures.length / this.duration;
	        }
	    };
	    /**
	     * Sets the textures for the particle.
	     * @param art An array of PIXI.Texture objects for this animated particle.
	     */
	    AnimatedParticle.prototype.applyArt = function (art) {
	        this.textures = art.textures;
	        this.framerate = art.framerate;
	        this.duration = art.duration;
	        this.loop = art.loop;
	    };
	    /**
	     * Updates the particle.
	     * @param delta Time elapsed since the previous frame, in __seconds__.
	     */
	    AnimatedParticle.prototype.update = function (delta) {
	        var lerp = this.Particle_update(delta);
	        //only animate the particle if it is still alive
	        if (lerp >= 0) {
	            this.elapsed += delta;
	            if (this.elapsed > this.duration) {
	                //loop elapsed back around
	                if (this.loop)
	                    this.elapsed = this.elapsed % this.duration;
	                //subtract a small amount to prevent attempting to go past the end of the animation
	                else
	                    this.elapsed = this.duration - 0.000001;
	            }
	            // add a very small number to the frame and then floor it to avoid
	            // the frame being one short due to floating point errors.
	            var frame = (this.elapsed * this.framerate + 0.0000001) | 0;
	            this.texture = this.textures[frame] || pixi.Texture.EMPTY;
	        }
	        return lerp;
	    };
	    /**
	     * Destroys the particle, removing references and preventing future use.
	     */
	    AnimatedParticle.prototype.destroy = function () {
	        this.Particle_destroy();
	        this.textures = null;
	    };
	    /**
	     * Checks over the art that was passed to the Emitter's init() function, to do any special
	     * modifications to prepare it ahead of time.
	     * @param art The array of art data, properly formatted for AnimatedParticle.
	     * @return The art, after any needed modifications.
	     */
	    AnimatedParticle.parseArt = function (art) {
	        var data, output, textures, tex, outTextures;
	        var outArr = [];
	        for (var i = 0; i < art.length; ++i) {
	            data = art[i];
	            outArr[i] = output = {};
	            output.textures = outTextures = [];
	            textures = data.textures;
	            for (var j = 0; j < textures.length; ++j) {
	                tex = textures[j];
	                if (typeof tex == "string")
	                    outTextures.push(GetTextureFromString(tex));
	                else if (tex instanceof pixi.Texture)
	                    outTextures.push(tex);
	                //assume an object with extra data determining duplicate frame data
	                else {
	                    var dupe = tex.count || 1;
	                    if (typeof tex.texture == "string")
	                        tex = GetTextureFromString(tex.texture);
	                    else // if(tex.texture instanceof Texture)
	                        tex = tex.texture;
	                    for (; dupe > 0; --dupe) {
	                        outTextures.push(tex);
	                    }
	                }
	            }
	            //use these values to signify that the animation should match the particle life time.
	            if (data.framerate == "matchLife") {
	                //-1 means that it should be calculated
	                output.framerate = -1;
	                output.duration = 0;
	                output.loop = false;
	            }
	            else {
	                //determine if the animation should loop
	                output.loop = !!data.loop;
	                //get the framerate, default to 60
	                output.framerate = data.framerate > 0 ? data.framerate : 60;
	                //determine the duration
	                output.duration = outTextures.length / output.framerate;
	            }
	        }
	        return outArr;
	    };
	    return AnimatedParticle;
	}(Particle));

	exports.GetTextureFromString = GetTextureFromString;
	exports.Particle = Particle;
	exports.Emitter = Emitter;
	exports.PathParticle = PathParticle;
	exports.AnimatedParticle = AnimatedParticle;
	exports.PolygonalChain = PolygonalChain;
	exports.PropertyList = PropertyList;
	exports.PropertyNode = PropertyNode;

}(this.PIXI.particles = this.PIXI.particles || {}, PIXI));


var pixi_projection;
(function (pixi_projection) {
    var utils;
    (function (utils) {
        function getIntersectionFactor(p1, p2, p3, p4, out) {
            var A1 = p2.x - p1.x, B1 = p3.x - p4.x, C1 = p3.x - p1.x;
            var A2 = p2.y - p1.y, B2 = p3.y - p4.y, C2 = p3.y - p1.y;
            var D = A1 * B2 - A2 * B1;
            if (Math.abs(D) < 1e-7) {
                out.x = A1;
                out.y = A2;
                return 0;
            }
            var T = C1 * B2 - C2 * B1;
            var U = A1 * C2 - A2 * C1;
            var t = T / D, u = U / D;
            if (u < (1e-6) || u - 1 > -1e-6) {
                return -1;
            }
            out.x = p1.x + t * (p2.x - p1.x);
            out.y = p1.y + t * (p2.y - p1.y);
            return 1;
        }
        utils.getIntersectionFactor = getIntersectionFactor;
        function getPositionFromQuad(p, anchor, out) {
            out = out || new PIXI.Point();
            var a1 = 1.0 - anchor.x, a2 = 1.0 - a1;
            var b1 = 1.0 - anchor.y, b2 = 1.0 - b1;
            out.x = (p[0].x * a1 + p[1].x * a2) * b1 + (p[3].x * a1 + p[2].x * a2) * b2;
            out.y = (p[0].y * a1 + p[1].y * a2) * b1 + (p[3].y * a1 + p[2].y * a2) * b2;
            return out;
        }
        utils.getPositionFromQuad = getPositionFromQuad;
    })(utils = pixi_projection.utils || (pixi_projection.utils = {}));
})(pixi_projection || (pixi_projection = {}));
PIXI.projection = pixi_projection;
var pixi_projection;
(function (pixi_projection) {
    var AbstractProjection = (function () {
        function AbstractProjection(legacy, enable) {
            if (enable === void 0) { enable = true; }
            this._enabled = false;
            this.legacy = legacy;
            if (enable) {
                this.enabled = true;
            }
            this.legacy.proj = this;
        }
        Object.defineProperty(AbstractProjection.prototype, "enabled", {
            get: function () {
                return this._enabled;
            },
            set: function (value) {
                this._enabled = value;
            },
            enumerable: true,
            configurable: true
        });
        AbstractProjection.prototype.clear = function () {
        };
        return AbstractProjection;
    }());
    pixi_projection.AbstractProjection = AbstractProjection;
    var TRANSFORM_STEP;
    (function (TRANSFORM_STEP) {
        TRANSFORM_STEP[TRANSFORM_STEP["NONE"] = 0] = "NONE";
        TRANSFORM_STEP[TRANSFORM_STEP["BEFORE_PROJ"] = 4] = "BEFORE_PROJ";
        TRANSFORM_STEP[TRANSFORM_STEP["PROJ"] = 5] = "PROJ";
        TRANSFORM_STEP[TRANSFORM_STEP["ALL"] = 9] = "ALL";
    })(TRANSFORM_STEP = pixi_projection.TRANSFORM_STEP || (pixi_projection.TRANSFORM_STEP = {}));
})(pixi_projection || (pixi_projection = {}));
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var pixi_projection;
(function (pixi_projection) {
    function transformHack(parentTransform) {
        var proj = this.proj;
        var ta = this;
        var pwid = parentTransform._worldID;
        var lt = ta.localTransform;
        var scaleAfterAffine = proj.scaleAfterAffine && proj.affine >= 2;
        if (ta._localID !== ta._currentLocalID) {
            if (scaleAfterAffine) {
                lt.a = ta._cx;
                lt.b = ta._sx;
                lt.c = ta._cy;
                lt.d = ta._sy;
                lt.tx = ta.position._x;
                lt.ty = ta.position._y;
            }
            else {
                lt.a = ta._cx * ta.scale._x;
                lt.b = ta._sx * ta.scale._x;
                lt.c = ta._cy * ta.scale._y;
                lt.d = ta._sy * ta.scale._y;
                lt.tx = ta.position._x - ((ta.pivot._x * lt.a) + (ta.pivot._y * lt.c));
                lt.ty = ta.position._y - ((ta.pivot._x * lt.b) + (ta.pivot._y * lt.d));
            }
            ta._currentLocalID = ta._localID;
            proj._currentProjID = -1;
        }
        var _matrixID = proj._projID;
        if (proj._currentProjID !== _matrixID) {
            proj._currentProjID = _matrixID;
            proj.updateLocalTransform(lt);
            ta._parentID = -1;
        }
        if (ta._parentID !== pwid) {
            var pp = parentTransform.proj;
            if (pp && !pp._affine) {
                proj.world.setToMult(pp.world, proj.local);
            }
            else {
                proj.world.setToMultLegacy(parentTransform.worldTransform, proj.local);
            }
            var wa = ta.worldTransform;
            proj.world.copyTo(wa, proj._affine, proj.affinePreserveOrientation);
            if (scaleAfterAffine) {
                wa.a *= ta.scale._x;
                wa.b *= ta.scale._x;
                wa.c *= ta.scale._y;
                wa.d *= ta.scale._y;
                wa.tx -= ((ta.pivot._x * wa.a) + (ta.pivot._y * wa.c));
                wa.ty -= ((ta.pivot._x * wa.b) + (ta.pivot._y * wa.d));
            }
            ta._parentID = pwid;
            ta._worldID++;
        }
    }
    var LinearProjection = (function (_super) {
        __extends(LinearProjection, _super);
        function LinearProjection() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this._projID = 0;
            _this._currentProjID = -1;
            _this._affine = pixi_projection.AFFINE.NONE;
            _this.affinePreserveOrientation = false;
            _this.scaleAfterAffine = true;
            return _this;
        }
        LinearProjection.prototype.updateLocalTransform = function (lt) {
        };
        Object.defineProperty(LinearProjection.prototype, "affine", {
            get: function () {
                return this._affine;
            },
            set: function (value) {
                if (this._affine == value)
                    return;
                this._affine = value;
                this._currentProjID = -1;
                this.legacy._currentLocalID = -1;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(LinearProjection.prototype, "enabled", {
            set: function (value) {
                if (value === this._enabled) {
                    return;
                }
                this._enabled = value;
                if (value) {
                    this.legacy.updateTransform = transformHack;
                    this.legacy._parentID = -1;
                }
                else {
                    this.legacy.updateTransform = PIXI.Transform.prototype.updateTransform;
                    this.legacy._parentID = -1;
                }
            },
            enumerable: true,
            configurable: true
        });
        LinearProjection.prototype.clear = function () {
            this._currentProjID = -1;
            this._projID = 0;
        };
        return LinearProjection;
    }(pixi_projection.AbstractProjection));
    pixi_projection.LinearProjection = LinearProjection;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var TYPES = PIXI.TYPES;
    var premultiplyTint = PIXI.utils.premultiplyTint;
    var shaderVert = "precision highp float;\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position.xyw = projectionMatrix * aVertexPosition;\n    gl_Position.z = 0.0;\n    \n    vTextureCoord = aTextureCoord;\n    vTextureId = aTextureId;\n    vColor = aColor;\n}\n";
    var shaderFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\nvec4 color;\n%forloop%\ngl_FragColor = color * vColor;\n}";
    var Batch3dGeometry = (function (_super) {
        __extends(Batch3dGeometry, _super);
        function Batch3dGeometry(_static) {
            if (_static === void 0) { _static = false; }
            var _this = _super.call(this) || this;
            _this._buffer = new PIXI.Buffer(null, _static, false);
            _this._indexBuffer = new PIXI.Buffer(null, _static, true);
            _this.addAttribute('aVertexPosition', _this._buffer, 3, false, TYPES.FLOAT)
                .addAttribute('aTextureCoord', _this._buffer, 2, false, TYPES.FLOAT)
                .addAttribute('aColor', _this._buffer, 4, true, TYPES.UNSIGNED_BYTE)
                .addAttribute('aTextureId', _this._buffer, 1, true, TYPES.FLOAT)
                .addIndex(_this._indexBuffer);
            return _this;
        }
        return Batch3dGeometry;
    }(PIXI.Geometry));
    pixi_projection.Batch3dGeometry = Batch3dGeometry;
    var Batch2dPluginFactory = (function () {
        function Batch2dPluginFactory() {
        }
        Batch2dPluginFactory.create = function (options) {
            var _a = Object.assign({
                vertex: shaderVert,
                fragment: shaderFrag,
                geometryClass: Batch3dGeometry,
                vertexSize: 7,
            }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass;
            return (function (_super) {
                __extends(BatchPlugin, _super);
                function BatchPlugin(renderer) {
                    var _this = _super.call(this, renderer) || this;
                    _this.shaderGenerator = new PIXI.BatchShaderGenerator(vertex, fragment);
                    _this.geometryClass = geometryClass;
                    _this.vertexSize = vertexSize;
                    return _this;
                }
                BatchPlugin.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) {
                    var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View;
                    var p = aIndex / this.vertexSize;
                    var uvs = element.uvs;
                    var indicies = element.indices;
                    var vertexData = element.vertexData;
                    var vertexData2d = element.vertexData2d;
                    var textureId = element._texture.baseTexture._id;
                    var alpha = Math.min(element.worldAlpha, 1.0);
                    var argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha)
                        : element._tintRGB + (alpha * 255 << 24);
                    if (vertexData2d) {
                        var j = 0;
                        for (var i = 0; i < vertexData2d.length; i += 3, j += 2) {
                            float32View[aIndex++] = vertexData2d[i];
                            float32View[aIndex++] = vertexData2d[i + 1];
                            float32View[aIndex++] = vertexData2d[i + 2];
                            float32View[aIndex++] = uvs[j];
                            float32View[aIndex++] = uvs[j + 1];
                            uint32View[aIndex++] = argb;
                            float32View[aIndex++] = textureId;
                        }
                    }
                    else {
                        for (var i = 0; i < vertexData.length; i += 2) {
                            float32View[aIndex++] = vertexData[i];
                            float32View[aIndex++] = vertexData[i + 1];
                            float32View[aIndex++] = 1.0;
                            float32View[aIndex++] = uvs[i];
                            float32View[aIndex++] = uvs[i + 1];
                            uint32View[aIndex++] = argb;
                            float32View[aIndex++] = textureId;
                        }
                    }
                    for (var i = 0; i < indicies.length; i++) {
                        indexBuffer[iIndex++] = p + indicies[i];
                    }
                };
                return BatchPlugin;
            }(PIXI.AbstractBatchRenderer));
        };
        return Batch2dPluginFactory;
    }());
    pixi_projection.Batch2dPluginFactory = Batch2dPluginFactory;
    PIXI.Renderer.registerPlugin('batch2d', Batch2dPluginFactory.create({}));
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var UniformBatchRenderer = (function (_super) {
        __extends(UniformBatchRenderer, _super);
        function UniformBatchRenderer() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        UniformBatchRenderer.prototype.addToBatch = function (sprite) {
        };
        return UniformBatchRenderer;
    }(PIXI.AbstractBatchRenderer));
    pixi_projection.UniformBatchRenderer = UniformBatchRenderer;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var p = [new PIXI.Point(), new PIXI.Point(), new PIXI.Point(), new PIXI.Point()];
    var a = [0, 0, 0, 0];
    var Surface = (function () {
        function Surface() {
            this.surfaceID = "default";
            this._updateID = 0;
            this.vertexSrc = "";
            this.fragmentSrc = "";
        }
        Surface.prototype.fillUniforms = function (uniforms) {
        };
        Surface.prototype.clear = function () {
        };
        Surface.prototype.boundsQuad = function (v, out, after) {
            var minX = out[0], minY = out[1];
            var maxX = out[0], maxY = out[1];
            for (var i = 2; i < 8; i += 2) {
                if (minX > out[i])
                    minX = out[i];
                if (maxX < out[i])
                    maxX = out[i];
                if (minY > out[i + 1])
                    minY = out[i + 1];
                if (maxY < out[i + 1])
                    maxY = out[i + 1];
            }
            p[0].set(minX, minY);
            this.apply(p[0], p[0]);
            p[1].set(maxX, minY);
            this.apply(p[1], p[1]);
            p[2].set(maxX, maxY);
            this.apply(p[2], p[2]);
            p[3].set(minX, maxY);
            this.apply(p[3], p[3]);
            if (after) {
                after.apply(p[0], p[0]);
                after.apply(p[1], p[1]);
                after.apply(p[2], p[2]);
                after.apply(p[3], p[3]);
                out[0] = p[0].x;
                out[1] = p[0].y;
                out[2] = p[1].x;
                out[3] = p[1].y;
                out[4] = p[2].x;
                out[5] = p[2].y;
                out[6] = p[3].x;
                out[7] = p[3].y;
            }
            else {
                for (var i = 1; i <= 3; i++) {
                    if (p[i].y < p[0].y || p[i].y == p[0].y && p[i].x < p[0].x) {
                        var t = p[0];
                        p[0] = p[i];
                        p[i] = t;
                    }
                }
                for (var i = 1; i <= 3; i++) {
                    a[i] = Math.atan2(p[i].y - p[0].y, p[i].x - p[0].x);
                }
                for (var i = 1; i <= 3; i++) {
                    for (var j = i + 1; j <= 3; j++) {
                        if (a[i] > a[j]) {
                            var t = p[i];
                            p[i] = p[j];
                            p[j] = t;
                            var t2 = a[i];
                            a[i] = a[j];
                            a[j] = t2;
                        }
                    }
                }
                out[0] = p[0].x;
                out[1] = p[0].y;
                out[2] = p[1].x;
                out[3] = p[1].y;
                out[4] = p[2].x;
                out[5] = p[2].y;
                out[6] = p[3].x;
                out[7] = p[3].y;
                if ((p[3].x - p[2].x) * (p[1].y - p[2].y) - (p[1].x - p[2].x) * (p[3].y - p[2].y) < 0) {
                    out[4] = p[3].x;
                    out[5] = p[3].y;
                    return;
                }
            }
        };
        return Surface;
    }());
    pixi_projection.Surface = Surface;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var tempMat = new PIXI.Matrix();
    var tempRect = new PIXI.Rectangle();
    var tempPoint = new PIXI.Point();
    var BilinearSurface = (function (_super) {
        __extends(BilinearSurface, _super);
        function BilinearSurface() {
            var _this = _super.call(this) || this;
            _this.distortion = new PIXI.Point();
            return _this;
        }
        BilinearSurface.prototype.clear = function () {
            this.distortion.set(0, 0);
        };
        BilinearSurface.prototype.apply = function (pos, newPos) {
            newPos = newPos || new PIXI.Point();
            var d = this.distortion;
            var m = pos.x * pos.y;
            newPos.x = pos.x + d.x * m;
            newPos.y = pos.y + d.y * m;
            return newPos;
        };
        BilinearSurface.prototype.applyInverse = function (pos, newPos) {
            newPos = newPos || new PIXI.Point();
            var vx = pos.x, vy = pos.y;
            var dx = this.distortion.x, dy = this.distortion.y;
            if (dx == 0.0) {
                newPos.x = vx;
                newPos.y = vy / (1.0 + dy * vx);
            }
            else if (dy == 0.0) {
                newPos.y = vy;
                newPos.x = vx / (1.0 + dx * vy);
            }
            else {
                var b = (vy * dx - vx * dy + 1.0) * 0.5 / dy;
                var d = b * b + vx / dy;
                if (d <= 0.00001) {
                    newPos.set(NaN, NaN);
                    return;
                }
                if (dy > 0.0) {
                    newPos.x = -b + Math.sqrt(d);
                }
                else {
                    newPos.x = -b - Math.sqrt(d);
                }
                newPos.y = (vx / newPos.x - 1.0) / dx;
            }
            return newPos;
        };
        BilinearSurface.prototype.mapSprite = function (sprite, quad, outTransform) {
            var tex = sprite.texture;
            tempRect.x = -sprite.anchor.x * tex.orig.width;
            tempRect.y = -sprite.anchor.y * tex.orig.height;
            tempRect.width = tex.orig.width;
            tempRect.height = tex.orig.height;
            return this.mapQuad(tempRect, quad, outTransform || sprite.transform);
        };
        BilinearSurface.prototype.mapQuad = function (rect, quad, outTransform) {
            var ax = -rect.x / rect.width;
            var ay = -rect.y / rect.height;
            var ax2 = (1.0 - rect.x) / rect.width;
            var ay2 = (1.0 - rect.y) / rect.height;
            var up1x = (quad[0].x * (1.0 - ax) + quad[1].x * ax);
            var up1y = (quad[0].y * (1.0 - ax) + quad[1].y * ax);
            var up2x = (quad[0].x * (1.0 - ax2) + quad[1].x * ax2);
            var up2y = (quad[0].y * (1.0 - ax2) + quad[1].y * ax2);
            var down1x = (quad[3].x * (1.0 - ax) + quad[2].x * ax);
            var down1y = (quad[3].y * (1.0 - ax) + quad[2].y * ax);
            var down2x = (quad[3].x * (1.0 - ax2) + quad[2].x * ax2);
            var down2y = (quad[3].y * (1.0 - ax2) + quad[2].y * ax2);
            var x00 = up1x * (1.0 - ay) + down1x * ay;
            var y00 = up1y * (1.0 - ay) + down1y * ay;
            var x10 = up2x * (1.0 - ay) + down2x * ay;
            var y10 = up2y * (1.0 - ay) + down2y * ay;
            var x01 = up1x * (1.0 - ay2) + down1x * ay2;
            var y01 = up1y * (1.0 - ay2) + down1y * ay2;
            var x11 = up2x * (1.0 - ay2) + down2x * ay2;
            var y11 = up2y * (1.0 - ay2) + down2y * ay2;
            var mat = tempMat;
            mat.tx = x00;
            mat.ty = y00;
            mat.a = x10 - x00;
            mat.b = y10 - y00;
            mat.c = x01 - x00;
            mat.d = y01 - y00;
            tempPoint.set(x11, y11);
            mat.applyInverse(tempPoint, tempPoint);
            this.distortion.set(tempPoint.x - 1, tempPoint.y - 1);
            outTransform.setFromMatrix(mat);
            return this;
        };
        BilinearSurface.prototype.fillUniforms = function (uniforms) {
            uniforms.distortion = uniforms.distortion || new Float32Array([0, 0, 0, 0]);
            var ax = Math.abs(this.distortion.x);
            var ay = Math.abs(this.distortion.y);
            uniforms.distortion[0] = ax * 10000 <= ay ? 0 : this.distortion.x;
            uniforms.distortion[1] = ay * 10000 <= ax ? 0 : this.distortion.y;
            uniforms.distortion[2] = 1.0 / uniforms.distortion[0];
            uniforms.distortion[3] = 1.0 / uniforms.distortion[1];
        };
        return BilinearSurface;
    }(pixi_projection.Surface));
    pixi_projection.BilinearSurface = BilinearSurface;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Container2s = (function (_super) {
        __extends(Container2s, _super);
        function Container2s() {
            var _this = _super.call(this) || this;
            _this.proj = new pixi_projection.ProjectionSurface(_this.transform);
            return _this;
        }
        Object.defineProperty(Container2s.prototype, "worldTransform", {
            get: function () {
                return this.proj;
            },
            enumerable: true,
            configurable: true
        });
        return Container2s;
    }(PIXI.Container));
    pixi_projection.Container2s = Container2s;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var fun = PIXI.Transform.prototype.updateTransform;
    function transformHack(parentTransform) {
        var proj = this.proj;
        var pp = parentTransform.proj;
        var ta = this;
        if (!pp) {
            fun.call(this, parentTransform);
            proj._activeProjection = null;
            return;
        }
        if (pp._surface) {
            proj._activeProjection = pp;
            this.updateLocalTransform();
            this.localTransform.copyFrom(this.worldTransform);
            if (ta._parentID < 0) {
                ++ta._worldID;
            }
            return;
        }
        fun.call(this, parentTransform);
        proj._activeProjection = pp._activeProjection;
    }
    var ProjectionSurface = (function (_super) {
        __extends(ProjectionSurface, _super);
        function ProjectionSurface(legacy, enable) {
            var _this = _super.call(this, legacy, enable) || this;
            _this._surface = null;
            _this._activeProjection = null;
            _this._currentSurfaceID = -1;
            _this._currentLegacyID = -1;
            _this._lastUniforms = null;
            return _this;
        }
        Object.defineProperty(ProjectionSurface.prototype, "enabled", {
            set: function (value) {
                if (value === this._enabled) {
                    return;
                }
                this._enabled = value;
                if (value) {
                    this.legacy.updateTransform = transformHack;
                    this.legacy._parentID = -1;
                }
                else {
                    this.legacy.updateTransform = PIXI.Transform.prototype.updateTransform;
                    this.legacy._parentID = -1;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProjectionSurface.prototype, "surface", {
            get: function () {
                return this._surface;
            },
            set: function (value) {
                if (this._surface == value) {
                    return;
                }
                this._surface = value || null;
                this.legacy._parentID = -1;
            },
            enumerable: true,
            configurable: true
        });
        ProjectionSurface.prototype.applyPartial = function (pos, newPos) {
            if (this._activeProjection !== null) {
                newPos = this.legacy.worldTransform.apply(pos, newPos);
                return this._activeProjection.surface.apply(newPos, newPos);
            }
            if (this._surface !== null) {
                return this.surface.apply(pos, newPos);
            }
            return this.legacy.worldTransform.apply(pos, newPos);
        };
        ProjectionSurface.prototype.apply = function (pos, newPos) {
            if (this._activeProjection !== null) {
                newPos = this.legacy.worldTransform.apply(pos, newPos);
                this._activeProjection.surface.apply(newPos, newPos);
                return this._activeProjection.legacy.worldTransform.apply(newPos, newPos);
            }
            if (this._surface !== null) {
                newPos = this.surface.apply(pos, newPos);
                return this.legacy.worldTransform.apply(newPos, newPos);
            }
            return this.legacy.worldTransform.apply(pos, newPos);
        };
        ProjectionSurface.prototype.applyInverse = function (pos, newPos) {
            if (this._activeProjection !== null) {
                newPos = this._activeProjection.legacy.worldTransform.applyInverse(pos, newPos);
                this._activeProjection._surface.applyInverse(newPos, newPos);
                return this.legacy.worldTransform.applyInverse(newPos, newPos);
            }
            if (this._surface !== null) {
                newPos = this.legacy.worldTransform.applyInverse(pos, newPos);
                return this._surface.applyInverse(newPos, newPos);
            }
            return this.legacy.worldTransform.applyInverse(pos, newPos);
        };
        ProjectionSurface.prototype.mapBilinearSprite = function (sprite, quad) {
            if (!(this._surface instanceof pixi_projection.BilinearSurface)) {
                this.surface = new pixi_projection.BilinearSurface();
            }
            this.surface.mapSprite(sprite, quad, this.legacy);
        };
        ProjectionSurface.prototype.clear = function () {
            if (this.surface) {
                this.surface.clear();
            }
        };
        Object.defineProperty(ProjectionSurface.prototype, "uniforms", {
            get: function () {
                if (this._currentLegacyID === this.legacy._worldID &&
                    this._currentSurfaceID === this.surface._updateID) {
                    return this._lastUniforms;
                }
                this._lastUniforms = this._lastUniforms || {};
                this._lastUniforms.worldTransform = this.legacy.worldTransform.toArray(true);
                this._surface.fillUniforms(this._lastUniforms);
                return this._lastUniforms;
            },
            enumerable: true,
            configurable: true
        });
        return ProjectionSurface;
    }(pixi_projection.AbstractProjection));
    pixi_projection.ProjectionSurface = ProjectionSurface;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var TYPES = PIXI.TYPES;
    var premultiplyTint = PIXI.utils.premultiplyTint;
    var shaderVert = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec3 aTrans1;\nattribute vec3 aTrans2;\nattribute vec4 aFrame;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 worldTransform;\n\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position.xyw = projectionMatrix * worldTransform * vec3(aVertexPosition, 1.0);\n    gl_Position.z = 0.0;\n    \n    vTextureCoord = aVertexPosition;\n    vTrans1 = aTrans1;\n    vTrans2 = aTrans2;\n    vTextureId = aTextureId;\n    vColor = aColor;\n    vFrame = aFrame;\n}\n";
    var shaderFrag = "precision highp float;\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nuniform sampler2D uSamplers[%count%];\nuniform vec2 samplerSize[%count%]; \nuniform vec4 distortion;\n\nvoid main(void){\nvec2 surface;\nvec2 surface2;\n\nfloat vx = vTextureCoord.x;\nfloat vy = vTextureCoord.y;\nfloat dx = distortion.x;\nfloat dy = distortion.y;\nfloat revx = distortion.z;\nfloat revy = distortion.w;\n\nif (distortion.x == 0.0) {\n    surface.x = vx;\n    surface.y = vy / (1.0 + dy * vx);\n    surface2 = surface;\n} else\nif (distortion.y == 0.0) {\n    surface.y = vy;\n    surface.x = vx/ (1.0 + dx * vy);\n    surface2 = surface;\n} else {\n    float c = vy * dx - vx * dy;\n    float b = (c + 1.0) * 0.5;\n    float b2 = (-c + 1.0) * 0.5;\n    float d = b * b + vx * dy;\n    if (d < -0.00001) {\n        discard;\n    }\n    d = sqrt(max(d, 0.0));\n    surface.x = (- b + d) * revy;\n    surface2.x = (- b - d) * revy;\n    surface.y = (- b2 + d) * revx;\n    surface2.y = (- b2 - d) * revx;\n}\n\nvec2 uv;\nuv.x = vTrans1.x * surface.x + vTrans1.y * surface.y + vTrans1.z;\nuv.y = vTrans2.x * surface.x + vTrans2.y * surface.y + vTrans2.z;\n\nvec2 pixels = uv * samplerSize[0];\n\nif (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n    pixels.y < vFrame.y || pixels.y > vFrame.w) {\n    uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n    uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n    pixels = uv * samplerSize[0];\n    \n    if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n        pixels.y < vFrame.y || pixels.y > vFrame.w) {\n        discard;\n    }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\n%forloop%\ngl_FragColor = color * rColor;\n}";
    var BatchBilineardGeometry = (function (_super) {
        __extends(BatchBilineardGeometry, _super);
        function BatchBilineardGeometry(_static) {
            if (_static === void 0) { _static = false; }
            var _this = _super.call(this) || this;
            _this._buffer = new PIXI.Buffer(null, _static, false);
            _this._indexBuffer = new PIXI.Buffer(null, _static, true);
            _this.addAttribute('aVertexPosition', _this._buffer, 2, false, TYPES.FLOAT)
                .addAttribute('aTrans1', _this._buffer, 3, false, TYPES.FLOAT)
                .addAttribute('aTrans2', _this._buffer, 3, false, TYPES.FLOAT)
                .addAttribute('aFrame', _this._buffer, 4, false, TYPES.FLOAT)
                .addAttribute('aColor', _this._buffer, 4, true, TYPES.UNSIGNED_BYTE)
                .addIndex(_this._indexBuffer);
            return _this;
        }
        return BatchBilineardGeometry;
    }(PIXI.Geometry));
    pixi_projection.BatchBilineardGeometry = BatchBilineardGeometry;
    var BatchBilinearPluginFactory = (function () {
        function BatchBilinearPluginFactory() {
        }
        BatchBilinearPluginFactory.create = function (options) {
            var _a = Object.assign({
                vertex: shaderVert,
                fragment: shaderFrag,
                geometryClass: pixi_projection.Batch3dGeometry,
                vertexSize: 7,
            }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass;
            return (function (_super) {
                __extends(BatchPlugin, _super);
                function BatchPlugin(renderer) {
                    var _this = _super.call(this, renderer) || this;
                    _this.defUniforms = {
                        worldTransform: new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]),
                        distortion: new Float32Array([0, 0])
                    };
                    _this.shaderGenerator = new PIXI.BatchShaderGenerator(vertex, fragment);
                    _this.geometryClass = geometryClass;
                    _this.vertexSize = vertexSize;
                    return _this;
                }
                BatchPlugin.prototype.getUniforms = function (sprite) {
                    var proj = sprite.proj;
                    var shader = this._shader;
                    if (proj.surface !== null) {
                        return proj.uniforms;
                    }
                    if (proj._activeProjection !== null) {
                        return proj._activeProjection.uniforms;
                    }
                    return this.defUniforms;
                };
                BatchPlugin.prototype.packGeometry = function (element, float32View, uint32View, indexBuffer, index, indexCount) {
                    var p = index / this.vertexSize;
                    var uvs = element.uvs;
                    var indices = element.indices;
                    var vertexData = element.vertexData;
                    var tex = element._texture;
                    var frame = tex._frame;
                    var aTrans = element.aTrans;
                    var alpha = Math.min(element.worldAlpha, 1.0);
                    var argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha)
                        : element._tintRGB + (alpha * 255 << 24);
                    for (var i = 0; i < vertexData.length; i += 2) {
                        float32View[index] = vertexData[i * 2];
                        float32View[index + 1] = vertexData[i * 2 + 1];
                        float32View[index + 2] = aTrans.a;
                        float32View[index + 3] = aTrans.c;
                        float32View[index + 4] = aTrans.tx;
                        float32View[index + 5] = aTrans.b;
                        float32View[index + 6] = aTrans.d;
                        float32View[index + 7] = aTrans.ty;
                        float32View[index + 8] = frame.x;
                        float32View[index + 9] = frame.y;
                        float32View[index + 10] = frame.x + frame.width;
                        float32View[index + 11] = frame.y + frame.height;
                        uint32View[index + 12] = argb;
                        index += 13;
                    }
                    for (var i = 0; i < indices.length; i++) {
                        indexBuffer[indexCount++] = p + indices[i];
                    }
                };
                return BatchPlugin;
            }(PIXI.AbstractBatchRenderer));
        };
        return BatchBilinearPluginFactory;
    }());
    pixi_projection.BatchBilinearPluginFactory = BatchBilinearPluginFactory;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Sprite2s = (function (_super) {
        __extends(Sprite2s, _super);
        function Sprite2s(texture) {
            var _this = _super.call(this, texture) || this;
            _this.aTrans = new PIXI.Matrix();
            _this.proj = new pixi_projection.ProjectionSurface(_this.transform);
            _this.pluginName = 'batch_bilinear';
            return _this;
        }
        Sprite2s.prototype._calculateBounds = function () {
            this.calculateTrimmedVertices();
            this._bounds.addQuad(this.vertexTrimmedData);
        };
        Sprite2s.prototype.calculateVertices = function () {
            var wid = this.transform._worldID;
            var tuid = this._texture._updateID;
            if (this._transformID === wid && this._textureID === tuid) {
                return;
            }
            this._transformID = wid;
            this._textureID = tuid;
            var texture = this._texture;
            var vertexData = this.vertexData;
            var trim = texture.trim;
            var orig = texture.orig;
            var anchor = this._anchor;
            var w0 = 0;
            var w1 = 0;
            var h0 = 0;
            var h1 = 0;
            if (trim) {
                w1 = trim.x - (anchor._x * orig.width);
                w0 = w1 + trim.width;
                h1 = trim.y - (anchor._y * orig.height);
                h0 = h1 + trim.height;
            }
            else {
                w1 = -anchor._x * orig.width;
                w0 = w1 + orig.width;
                h1 = -anchor._y * orig.height;
                h0 = h1 + orig.height;
            }
            if (this.proj._surface) {
                vertexData[0] = w1;
                vertexData[1] = h1;
                vertexData[2] = w0;
                vertexData[3] = h1;
                vertexData[4] = w0;
                vertexData[5] = h0;
                vertexData[6] = w1;
                vertexData[7] = h0;
                this.proj._surface.boundsQuad(vertexData, vertexData);
            }
            else {
                var wt = this.transform.worldTransform;
                var a = wt.a;
                var b = wt.b;
                var c = wt.c;
                var d = wt.d;
                var tx = wt.tx;
                var ty = wt.ty;
                vertexData[0] = (a * w1) + (c * h1) + tx;
                vertexData[1] = (d * h1) + (b * w1) + ty;
                vertexData[2] = (a * w0) + (c * h1) + tx;
                vertexData[3] = (d * h1) + (b * w0) + ty;
                vertexData[4] = (a * w0) + (c * h0) + tx;
                vertexData[5] = (d * h0) + (b * w0) + ty;
                vertexData[6] = (a * w1) + (c * h0) + tx;
                vertexData[7] = (d * h0) + (b * w1) + ty;
                if (this.proj._activeProjection) {
                    this.proj._activeProjection.surface.boundsQuad(vertexData, vertexData);
                }
            }
            if (!texture.uvMatrix) {
                texture.uvMatrix = new PIXI.TextureMatrix(texture);
            }
            texture.uvMatrix.update();
            var aTrans = this.aTrans;
            aTrans.set(orig.width, 0, 0, orig.height, w1, h1);
            if (this.proj._surface === null) {
                aTrans.prepend(this.transform.worldTransform);
            }
            aTrans.invert();
            aTrans.prepend(texture.uvMatrix.mapCoord);
        };
        Sprite2s.prototype.calculateTrimmedVertices = function () {
            var wid = this.transform._worldID;
            var tuid = this._texture._updateID;
            if (!this.vertexTrimmedData) {
                this.vertexTrimmedData = new Float32Array(8);
            }
            else if (this._transformTrimmedID === wid && this._textureTrimmedID === tuid) {
                return;
            }
            this._transformTrimmedID = wid;
            this._textureTrimmedID = tuid;
            var texture = this._texture;
            var vertexData = this.vertexTrimmedData;
            var orig = texture.orig;
            var anchor = this._anchor;
            var w1 = -anchor._x * orig.width;
            var w0 = w1 + orig.width;
            var h1 = -anchor._y * orig.height;
            var h0 = h1 + orig.height;
            if (this.proj._surface) {
                vertexData[0] = w1;
                vertexData[1] = h1;
                vertexData[2] = w0;
                vertexData[3] = h1;
                vertexData[4] = w0;
                vertexData[5] = h0;
                vertexData[6] = w1;
                vertexData[7] = h0;
                this.proj._surface.boundsQuad(vertexData, vertexData, this.transform.worldTransform);
            }
            else {
                var wt = this.transform.worldTransform;
                var a = wt.a;
                var b = wt.b;
                var c = wt.c;
                var d = wt.d;
                var tx = wt.tx;
                var ty = wt.ty;
                vertexData[0] = (a * w1) + (c * h1) + tx;
                vertexData[1] = (d * h1) + (b * w1) + ty;
                vertexData[2] = (a * w0) + (c * h1) + tx;
                vertexData[3] = (d * h1) + (b * w0) + ty;
                vertexData[4] = (a * w0) + (c * h0) + tx;
                vertexData[5] = (d * h0) + (b * w0) + ty;
                vertexData[6] = (a * w1) + (c * h0) + tx;
                vertexData[7] = (d * h0) + (b * w1) + ty;
                if (this.proj._activeProjection) {
                    this.proj._activeProjection.surface.boundsQuad(vertexData, vertexData, this.proj._activeProjection.legacy.worldTransform);
                }
            }
        };
        Object.defineProperty(Sprite2s.prototype, "worldTransform", {
            get: function () {
                return this.proj;
            },
            enumerable: true,
            configurable: true
        });
        return Sprite2s;
    }(PIXI.Sprite));
    pixi_projection.Sprite2s = Sprite2s;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Text2s = (function (_super) {
        __extends(Text2s, _super);
        function Text2s(text, style, canvas) {
            var _this = _super.call(this, text, style, canvas) || this;
            _this.aTrans = new PIXI.Matrix();
            _this.proj = new pixi_projection.ProjectionSurface(_this.transform);
            _this.pluginName = 'batch_bilinear';
            return _this;
        }
        Object.defineProperty(Text2s.prototype, "worldTransform", {
            get: function () {
                return this.proj;
            },
            enumerable: true,
            configurable: true
        });
        return Text2s;
    }(PIXI.Text));
    pixi_projection.Text2s = Text2s;
    Text2s.prototype.calculateVertices = pixi_projection.Sprite2s.prototype.calculateVertices;
    Text2s.prototype.calculateTrimmedVertices = pixi_projection.Sprite2s.prototype.calculateTrimmedVertices;
    Text2s.prototype._calculateBounds = pixi_projection.Sprite2s.prototype._calculateBounds;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    PIXI.Sprite.prototype.convertTo2s = function () {
        if (this.proj)
            return;
        this.pluginName = 'sprite_bilinear';
        this.aTrans = new PIXI.Matrix();
        this.calculateVertices = pixi_projection.Sprite2s.prototype.calculateVertices;
        this.calculateTrimmedVertices = pixi_projection.Sprite2s.prototype.calculateTrimmedVertices;
        this._calculateBounds = pixi_projection.Sprite2s.prototype._calculateBounds;
        PIXI.Container.prototype.convertTo2s.call(this);
    };
    PIXI.Container.prototype.convertTo2s = function () {
        if (this.proj)
            return;
        this.proj = new pixi_projection.Projection2d(this.transform);
        Object.defineProperty(this, "worldTransform", {
            get: function () {
                return this.proj;
            },
            enumerable: true,
            configurable: true
        });
    };
    PIXI.Container.prototype.convertSubtreeTo2s = function () {
        this.convertTo2s();
        for (var i = 0; i < this.children.length; i++) {
            this.children[i].convertSubtreeTo2s();
        }
    };
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    function container2dWorldTransform() {
        return this.proj.affine ? this.transform.worldTransform : this.proj.world;
    }
    pixi_projection.container2dWorldTransform = container2dWorldTransform;
    var Container2d = (function (_super) {
        __extends(Container2d, _super);
        function Container2d() {
            var _this = _super.call(this) || this;
            _this.proj = new pixi_projection.Projection2d(_this.transform);
            return _this;
        }
        Container2d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            if (from) {
                position = from.toGlobal(position, point, skipUpdate);
            }
            if (!skipUpdate) {
                this._recursivePostUpdateTransform();
            }
            if (step >= pixi_projection.TRANSFORM_STEP.PROJ) {
                if (!skipUpdate) {
                    this.displayObjectUpdateTransform();
                }
                if (this.proj.affine) {
                    return this.transform.worldTransform.applyInverse(position, point);
                }
                return this.proj.world.applyInverse(position, point);
            }
            if (this.parent) {
                point = this.parent.worldTransform.applyInverse(position, point);
            }
            else {
                point.copyFrom(position);
            }
            if (step === pixi_projection.TRANSFORM_STEP.NONE) {
                return point;
            }
            return this.transform.localTransform.applyInverse(point, point);
        };
        Object.defineProperty(Container2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        return Container2d;
    }(PIXI.Container));
    pixi_projection.Container2d = Container2d;
    pixi_projection.container2dToLocal = Container2d.prototype.toLocal;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Point = PIXI.Point;
    var mat3id = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    var AFFINE;
    (function (AFFINE) {
        AFFINE[AFFINE["NONE"] = 0] = "NONE";
        AFFINE[AFFINE["FREE"] = 1] = "FREE";
        AFFINE[AFFINE["AXIS_X"] = 2] = "AXIS_X";
        AFFINE[AFFINE["AXIS_Y"] = 3] = "AXIS_Y";
        AFFINE[AFFINE["POINT"] = 4] = "POINT";
        AFFINE[AFFINE["AXIS_XR"] = 5] = "AXIS_XR";
    })(AFFINE = pixi_projection.AFFINE || (pixi_projection.AFFINE = {}));
    var Matrix2d = (function () {
        function Matrix2d(backingArray) {
            this.floatArray = null;
            this.mat3 = new Float64Array(backingArray || mat3id);
        }
        Object.defineProperty(Matrix2d.prototype, "a", {
            get: function () {
                return this.mat3[0] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[0] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix2d.prototype, "b", {
            get: function () {
                return this.mat3[1] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[1] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix2d.prototype, "c", {
            get: function () {
                return this.mat3[3] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[3] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix2d.prototype, "d", {
            get: function () {
                return this.mat3[4] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[4] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix2d.prototype, "tx", {
            get: function () {
                return this.mat3[6] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[6] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix2d.prototype, "ty", {
            get: function () {
                return this.mat3[7] / this.mat3[8];
            },
            set: function (value) {
                this.mat3[7] = value * this.mat3[8];
            },
            enumerable: true,
            configurable: true
        });
        Matrix2d.prototype.set = function (a, b, c, d, tx, ty) {
            var mat3 = this.mat3;
            mat3[0] = a;
            mat3[1] = b;
            mat3[2] = 0;
            mat3[3] = c;
            mat3[4] = d;
            mat3[5] = 0;
            mat3[6] = tx;
            mat3[7] = ty;
            mat3[8] = 1;
            return this;
        };
        Matrix2d.prototype.toArray = function (transpose, out) {
            if (!this.floatArray) {
                this.floatArray = new Float32Array(9);
            }
            var array = out || this.floatArray;
            var mat3 = this.mat3;
            if (transpose) {
                array[0] = mat3[0];
                array[1] = mat3[1];
                array[2] = mat3[2];
                array[3] = mat3[3];
                array[4] = mat3[4];
                array[5] = mat3[5];
                array[6] = mat3[6];
                array[7] = mat3[7];
                array[8] = mat3[8];
            }
            else {
                array[0] = mat3[0];
                array[1] = mat3[3];
                array[2] = mat3[6];
                array[3] = mat3[1];
                array[4] = mat3[4];
                array[5] = mat3[7];
                array[6] = mat3[2];
                array[7] = mat3[5];
                array[8] = mat3[8];
            }
            return array;
        };
        Matrix2d.prototype.apply = function (pos, newPos) {
            newPos = newPos || new PIXI.Point();
            var mat3 = this.mat3;
            var x = pos.x;
            var y = pos.y;
            var z = 1.0 / (mat3[2] * x + mat3[5] * y + mat3[8]);
            newPos.x = z * (mat3[0] * x + mat3[3] * y + mat3[6]);
            newPos.y = z * (mat3[1] * x + mat3[4] * y + mat3[7]);
            return newPos;
        };
        Matrix2d.prototype.translate = function (tx, ty) {
            var mat3 = this.mat3;
            mat3[0] += tx * mat3[2];
            mat3[1] += ty * mat3[2];
            mat3[3] += tx * mat3[5];
            mat3[4] += ty * mat3[5];
            mat3[6] += tx * mat3[8];
            mat3[7] += ty * mat3[8];
            return this;
        };
        Matrix2d.prototype.scale = function (x, y) {
            var mat3 = this.mat3;
            mat3[0] *= x;
            mat3[1] *= y;
            mat3[3] *= x;
            mat3[4] *= y;
            mat3[6] *= x;
            mat3[7] *= y;
            return this;
        };
        Matrix2d.prototype.scaleAndTranslate = function (scaleX, scaleY, tx, ty) {
            var mat3 = this.mat3;
            mat3[0] = scaleX * mat3[0] + tx * mat3[2];
            mat3[1] = scaleY * mat3[1] + ty * mat3[2];
            mat3[3] = scaleX * mat3[3] + tx * mat3[5];
            mat3[4] = scaleY * mat3[4] + ty * mat3[5];
            mat3[6] = scaleX * mat3[6] + tx * mat3[8];
            mat3[7] = scaleY * mat3[7] + ty * mat3[8];
        };
        Matrix2d.prototype.applyInverse = function (pos, newPos) {
            newPos = newPos || new Point();
            var a = this.mat3;
            var x = pos.x;
            var y = pos.y;
            var a00 = a[0], a01 = a[3], a02 = a[6], a10 = a[1], a11 = a[4], a12 = a[7], a20 = a[2], a21 = a[5], a22 = a[8];
            var newX = (a22 * a11 - a12 * a21) * x + (-a22 * a01 + a02 * a21) * y + (a12 * a01 - a02 * a11);
            var newY = (-a22 * a10 + a12 * a20) * x + (a22 * a00 - a02 * a20) * y + (-a12 * a00 + a02 * a10);
            var newZ = (a21 * a10 - a11 * a20) * x + (-a21 * a00 + a01 * a20) * y + (a11 * a00 - a01 * a10);
            newPos.x = newX / newZ;
            newPos.y = newY / newZ;
            return newPos;
        };
        Matrix2d.prototype.invert = function () {
            var a = this.mat3;
            var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], b01 = a22 * a11 - a12 * a21, b11 = -a22 * a10 + a12 * a20, b21 = a21 * a10 - a11 * a20;
            var det = a00 * b01 + a01 * b11 + a02 * b21;
            if (!det) {
                return this;
            }
            det = 1.0 / det;
            a[0] = b01 * det;
            a[1] = (-a22 * a01 + a02 * a21) * det;
            a[2] = (a12 * a01 - a02 * a11) * det;
            a[3] = b11 * det;
            a[4] = (a22 * a00 - a02 * a20) * det;
            a[5] = (-a12 * a00 + a02 * a10) * det;
            a[6] = b21 * det;
            a[7] = (-a21 * a00 + a01 * a20) * det;
            a[8] = (a11 * a00 - a01 * a10) * det;
            return this;
        };
        Matrix2d.prototype.identity = function () {
            var mat3 = this.mat3;
            mat3[0] = 1;
            mat3[1] = 0;
            mat3[2] = 0;
            mat3[3] = 0;
            mat3[4] = 1;
            mat3[5] = 0;
            mat3[6] = 0;
            mat3[7] = 0;
            mat3[8] = 1;
            return this;
        };
        Matrix2d.prototype.clone = function () {
            return new Matrix2d(this.mat3);
        };
        Matrix2d.prototype.copyTo2dOr3d = function (matrix) {
            var mat3 = this.mat3;
            var ar2 = matrix.mat3;
            ar2[0] = mat3[0];
            ar2[1] = mat3[1];
            ar2[2] = mat3[2];
            ar2[3] = mat3[3];
            ar2[4] = mat3[4];
            ar2[5] = mat3[5];
            ar2[6] = mat3[6];
            ar2[7] = mat3[7];
            ar2[8] = mat3[8];
            return matrix;
        };
        Matrix2d.prototype.copyTo = function (matrix, affine, preserveOrientation) {
            var mat3 = this.mat3;
            var d = 1.0 / mat3[8];
            var tx = mat3[6] * d, ty = mat3[7] * d;
            matrix.a = (mat3[0] - mat3[2] * tx) * d;
            matrix.b = (mat3[1] - mat3[2] * ty) * d;
            matrix.c = (mat3[3] - mat3[5] * tx) * d;
            matrix.d = (mat3[4] - mat3[5] * ty) * d;
            matrix.tx = tx;
            matrix.ty = ty;
            if (affine >= 2) {
                var D = matrix.a * matrix.d - matrix.b * matrix.c;
                if (!preserveOrientation) {
                    D = Math.abs(D);
                }
                if (affine === AFFINE.POINT) {
                    if (D > 0) {
                        D = 1;
                    }
                    else
                        D = -1;
                    matrix.a = D;
                    matrix.b = 0;
                    matrix.c = 0;
                    matrix.d = D;
                }
                else if (affine === AFFINE.AXIS_X) {
                    D /= Math.sqrt(matrix.b * matrix.b + matrix.d * matrix.d);
                    matrix.c = 0;
                    matrix.d = D;
                }
                else if (affine === AFFINE.AXIS_Y) {
                    D /= Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c);
                    matrix.a = D;
                    matrix.c = 0;
                }
                else if (affine === AFFINE.AXIS_XR) {
                    matrix.a = matrix.d * D;
                    matrix.c = -matrix.b * D;
                }
            }
            return matrix;
        };
        Matrix2d.prototype.copyFrom = function (matrix) {
            var mat3 = this.mat3;
            mat3[0] = matrix.a;
            mat3[1] = matrix.b;
            mat3[2] = 0;
            mat3[3] = matrix.c;
            mat3[4] = matrix.d;
            mat3[5] = 0;
            mat3[6] = matrix.tx;
            mat3[7] = matrix.ty;
            mat3[8] = 1.0;
            return this;
        };
        Matrix2d.prototype.setToMultLegacy = function (pt, lt) {
            var out = this.mat3;
            var b = lt.mat3;
            var a00 = pt.a, a01 = pt.b, a10 = pt.c, a11 = pt.d, a20 = pt.tx, a21 = pt.ty, b00 = b[0], b01 = b[1], b02 = b[2], b10 = b[3], b11 = b[4], b12 = b[5], b20 = b[6], b21 = b[7], b22 = b[8];
            out[0] = b00 * a00 + b01 * a10 + b02 * a20;
            out[1] = b00 * a01 + b01 * a11 + b02 * a21;
            out[2] = b02;
            out[3] = b10 * a00 + b11 * a10 + b12 * a20;
            out[4] = b10 * a01 + b11 * a11 + b12 * a21;
            out[5] = b12;
            out[6] = b20 * a00 + b21 * a10 + b22 * a20;
            out[7] = b20 * a01 + b21 * a11 + b22 * a21;
            out[8] = b22;
            return this;
        };
        Matrix2d.prototype.setToMultLegacy2 = function (pt, lt) {
            var out = this.mat3;
            var a = pt.mat3;
            var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], b00 = lt.a, b01 = lt.b, b10 = lt.c, b11 = lt.d, b20 = lt.tx, b21 = lt.ty;
            out[0] = b00 * a00 + b01 * a10;
            out[1] = b00 * a01 + b01 * a11;
            out[2] = b00 * a02 + b01 * a12;
            out[3] = b10 * a00 + b11 * a10;
            out[4] = b10 * a01 + b11 * a11;
            out[5] = b10 * a02 + b11 * a12;
            out[6] = b20 * a00 + b21 * a10 + a20;
            out[7] = b20 * a01 + b21 * a11 + a21;
            out[8] = b20 * a02 + b21 * a12 + a22;
            return this;
        };
        Matrix2d.prototype.setToMult = function (pt, lt) {
            var out = this.mat3;
            var a = pt.mat3, b = lt.mat3;
            var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], b00 = b[0], b01 = b[1], b02 = b[2], b10 = b[3], b11 = b[4], b12 = b[5], b20 = b[6], b21 = b[7], b22 = b[8];
            out[0] = b00 * a00 + b01 * a10 + b02 * a20;
            out[1] = b00 * a01 + b01 * a11 + b02 * a21;
            out[2] = b00 * a02 + b01 * a12 + b02 * a22;
            out[3] = b10 * a00 + b11 * a10 + b12 * a20;
            out[4] = b10 * a01 + b11 * a11 + b12 * a21;
            out[5] = b10 * a02 + b11 * a12 + b12 * a22;
            out[6] = b20 * a00 + b21 * a10 + b22 * a20;
            out[7] = b20 * a01 + b21 * a11 + b22 * a21;
            out[8] = b20 * a02 + b21 * a12 + b22 * a22;
            return this;
        };
        Matrix2d.prototype.prepend = function (lt) {
            if (lt.mat3) {
                return this.setToMult(lt, this);
            }
            else {
                return this.setToMultLegacy(lt, this);
            }
        };
        Matrix2d.IDENTITY = new Matrix2d();
        Matrix2d.TEMP_MATRIX = new Matrix2d();
        return Matrix2d;
    }());
    pixi_projection.Matrix2d = Matrix2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var t0 = new PIXI.Point();
    var tt = [new PIXI.Point(), new PIXI.Point(), new PIXI.Point(), new PIXI.Point()];
    var tempRect = new PIXI.Rectangle();
    var tempMat = new pixi_projection.Matrix2d();
    var Projection2d = (function (_super) {
        __extends(Projection2d, _super);
        function Projection2d(legacy, enable) {
            var _this = _super.call(this, legacy, enable) || this;
            _this.matrix = new pixi_projection.Matrix2d();
            _this.pivot = new PIXI.ObservablePoint(_this.onChange, _this, 0, 0);
            _this.reverseLocalOrder = false;
            _this.local = new pixi_projection.Matrix2d();
            _this.world = new pixi_projection.Matrix2d();
            return _this;
        }
        Projection2d.prototype.onChange = function () {
            var pivot = this.pivot;
            var mat3 = this.matrix.mat3;
            mat3[6] = -(pivot._x * mat3[0] + pivot._y * mat3[3]);
            mat3[7] = -(pivot._x * mat3[1] + pivot._y * mat3[4]);
            this._projID++;
        };
        Projection2d.prototype.setAxisX = function (p, factor) {
            if (factor === void 0) { factor = 1; }
            var x = p.x, y = p.y;
            var d = Math.sqrt(x * x + y * y);
            var mat3 = this.matrix.mat3;
            mat3[0] = x / d;
            mat3[1] = y / d;
            mat3[2] = factor / d;
            this.onChange();
        };
        Projection2d.prototype.setAxisY = function (p, factor) {
            if (factor === void 0) { factor = 1; }
            var x = p.x, y = p.y;
            var d = Math.sqrt(x * x + y * y);
            var mat3 = this.matrix.mat3;
            mat3[3] = x / d;
            mat3[4] = y / d;
            mat3[5] = factor / d;
            this.onChange();
        };
        Projection2d.prototype.mapSprite = function (sprite, quad) {
            var tex = sprite.texture;
            tempRect.x = -sprite.anchor.x * tex.orig.width;
            tempRect.y = -sprite.anchor.y * tex.orig.height;
            tempRect.width = tex.orig.width;
            tempRect.height = tex.orig.height;
            return this.mapQuad(tempRect, quad);
        };
        Projection2d.prototype.mapQuad = function (rect, p) {
            tt[0].set(rect.x, rect.y);
            tt[1].set(rect.x + rect.width, rect.y);
            tt[2].set(rect.x + rect.width, rect.y + rect.height);
            tt[3].set(rect.x, rect.y + rect.height);
            var k1 = 1, k2 = 2, k3 = 3;
            var f = pixi_projection.utils.getIntersectionFactor(p[0], p[2], p[1], p[3], t0);
            if (f !== 0) {
                k1 = 1;
                k2 = 3;
                k3 = 2;
            }
            else {
                return;
            }
            var d0 = Math.sqrt((p[0].x - t0.x) * (p[0].x - t0.x) + (p[0].y - t0.y) * (p[0].y - t0.y));
            var d1 = Math.sqrt((p[k1].x - t0.x) * (p[k1].x - t0.x) + (p[k1].y - t0.y) * (p[k1].y - t0.y));
            var d2 = Math.sqrt((p[k2].x - t0.x) * (p[k2].x - t0.x) + (p[k2].y - t0.y) * (p[k2].y - t0.y));
            var d3 = Math.sqrt((p[k3].x - t0.x) * (p[k3].x - t0.x) + (p[k3].y - t0.y) * (p[k3].y - t0.y));
            var q0 = (d0 + d3) / d3;
            var q1 = (d1 + d2) / d2;
            var q2 = (d1 + d2) / d1;
            var mat3 = this.matrix.mat3;
            mat3[0] = tt[0].x * q0;
            mat3[1] = tt[0].y * q0;
            mat3[2] = q0;
            mat3[3] = tt[k1].x * q1;
            mat3[4] = tt[k1].y * q1;
            mat3[5] = q1;
            mat3[6] = tt[k2].x * q2;
            mat3[7] = tt[k2].y * q2;
            mat3[8] = q2;
            this.matrix.invert();
            mat3 = tempMat.mat3;
            mat3[0] = p[0].x;
            mat3[1] = p[0].y;
            mat3[2] = 1;
            mat3[3] = p[k1].x;
            mat3[4] = p[k1].y;
            mat3[5] = 1;
            mat3[6] = p[k2].x;
            mat3[7] = p[k2].y;
            mat3[8] = 1;
            this.matrix.setToMult(tempMat, this.matrix);
            this._projID++;
        };
        Projection2d.prototype.updateLocalTransform = function (lt) {
            if (this._projID !== 0) {
                if (this.reverseLocalOrder) {
                    this.local.setToMultLegacy2(this.matrix, lt);
                }
                else {
                    this.local.setToMultLegacy(lt, this.matrix);
                }
            }
            else {
                this.local.copyFrom(lt);
            }
        };
        Projection2d.prototype.clear = function () {
            _super.prototype.clear.call(this);
            this.matrix.identity();
            this.pivot.set(0, 0);
        };
        return Projection2d;
    }(pixi_projection.LinearProjection));
    pixi_projection.Projection2d = Projection2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Mesh2d = (function (_super) {
        __extends(Mesh2d, _super);
        function Mesh2d(geometry, shader, state, drawMode) {
            var _this = _super.call(this, geometry, shader, state, drawMode) || this;
            _this.vertexData2d = null;
            _this.proj = new pixi_projection.Projection2d(_this.transform);
            return _this;
        }
        Mesh2d.prototype.calculateVertices = function () {
            if (this.proj._affine) {
                this.vertexData2d = null;
                _super.prototype.calculateVertices.call(this);
                return;
            }
            var geometry = this.geometry;
            var vertices = geometry.buffers[0].data;
            var thisAny = this;
            if (geometry.vertexDirtyId === thisAny.vertexDirty && thisAny._transformID === thisAny.transform._worldID) {
                return;
            }
            thisAny._transformID = thisAny.transform._worldID;
            if (thisAny.vertexData.length !== vertices.length) {
                thisAny.vertexData = new Float32Array(vertices.length);
            }
            if (this.vertexData2d.length !== vertices.length * 3 / 2) {
                this.vertexData2d = new Float32Array(vertices.length * 3);
            }
            var wt = this.proj.world.mat3;
            var vertexData2d = this.vertexData2d;
            var vertexData = thisAny.vertexData;
            for (var i = 0; i < vertexData.length / 2; i++) {
                var x = vertices[(i * 2)];
                var y = vertices[(i * 2) + 1];
                var xx = (wt[0] * x) + (wt[3] * y) + wt[6];
                var yy = (wt[1] * x) + (wt[4] * y) + wt[7];
                var ww = (wt[2] * x) + (wt[5] * y) + wt[8];
                vertexData2d[i * 3] = xx;
                vertexData2d[i * 3 + 1] = yy;
                vertexData2d[i * 3 + 2] = ww;
                vertexData[(i * 2)] = xx / ww;
                vertexData[(i * 2) + 1] = yy / ww;
            }
            thisAny.vertexDirty = geometry.vertexDirtyId;
        };
        Mesh2d.prototype._renderDefault = function (renderer) {
            var shader = this.shader;
            shader.alpha = this.worldAlpha;
            if (shader.update) {
                shader.update();
            }
            renderer.batch.flush();
            if (shader.program.uniformData.translationMatrix) {
                shader.uniforms.translationMatrix = this.worldTransform.toArray(true);
            }
            renderer.shader.bind(shader, false);
            renderer.state.set(this.state);
            renderer.geometry.bind(this.geometry, shader);
            renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);
        };
        Mesh2d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container2dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        Object.defineProperty(Mesh2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        Mesh2d.defaultVertexShader = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n    gl_Position.z = 0.0;\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";
        Mesh2d.defaultFragmentShader = "\nvarying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}";
        return Mesh2d;
    }(PIXI.Mesh));
    pixi_projection.Mesh2d = Mesh2d;
    var SimpleMesh2d = (function (_super) {
        __extends(SimpleMesh2d, _super);
        function SimpleMesh2d(texture, vertices, uvs, indices, drawMode) {
            var _this = _super.call(this, new PIXI.MeshGeometry(vertices, uvs, indices), new PIXI.MeshMaterial(texture, {
                program: PIXI.Program.from(Mesh2d.defaultVertexShader, Mesh2d.defaultFragmentShader),
                pluginName: 'batch2d'
            }), null, drawMode) || this;
            _this.autoUpdate = true;
            _this.geometry.getBuffer('aVertexPosition').static = false;
            return _this;
        }
        Object.defineProperty(SimpleMesh2d.prototype, "vertices", {
            get: function () {
                return this.geometry.getBuffer('aVertexPosition').data;
            },
            set: function (value) {
                this.geometry.getBuffer('aVertexPosition').data = value;
            },
            enumerable: true,
            configurable: true
        });
        SimpleMesh2d.prototype._render = function (renderer) {
            if (this.autoUpdate) {
                this.geometry.getBuffer('aVertexPosition').update();
            }
            _super.prototype._render.call(this, renderer);
        };
        return SimpleMesh2d;
    }(Mesh2d));
    pixi_projection.SimpleMesh2d = SimpleMesh2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Sprite2d = (function (_super) {
        __extends(Sprite2d, _super);
        function Sprite2d(texture) {
            var _this = _super.call(this, texture) || this;
            _this.vertexData2d = null;
            _this.proj = new pixi_projection.Projection2d(_this.transform);
            _this.pluginName = 'batch2d';
            return _this;
        }
        Sprite2d.prototype._calculateBounds = function () {
            this.calculateTrimmedVertices();
            this._bounds.addQuad(this.vertexTrimmedData);
        };
        Sprite2d.prototype.calculateVertices = function () {
            var texture = this._texture;
            if (this.proj._affine) {
                this.vertexData2d = null;
                _super.prototype.calculateVertices.call(this);
                return;
            }
            if (!this.vertexData2d) {
                this.vertexData2d = new Float32Array(12);
            }
            var wid = this.transform._worldID;
            var tuid = texture._updateID;
            if (this._transformID === wid && this._textureID === tuid) {
                return;
            }
            if (this._textureID !== tuid) {
                this.uvs = texture._uvs.uvsFloat32;
            }
            this._transformID = wid;
            this._textureID = tuid;
            var wt = this.proj.world.mat3;
            var vertexData2d = this.vertexData2d;
            var vertexData = this.vertexData;
            var trim = texture.trim;
            var orig = texture.orig;
            var anchor = this._anchor;
            var w0 = 0;
            var w1 = 0;
            var h0 = 0;
            var h1 = 0;
            if (trim) {
                w1 = trim.x - (anchor._x * orig.width);
                w0 = w1 + trim.width;
                h1 = trim.y - (anchor._y * orig.height);
                h0 = h1 + trim.height;
            }
            else {
                w1 = -anchor._x * orig.width;
                w0 = w1 + orig.width;
                h1 = -anchor._y * orig.height;
                h0 = h1 + orig.height;
            }
            vertexData2d[0] = (wt[0] * w1) + (wt[3] * h1) + wt[6];
            vertexData2d[1] = (wt[1] * w1) + (wt[4] * h1) + wt[7];
            vertexData2d[2] = (wt[2] * w1) + (wt[5] * h1) + wt[8];
            vertexData2d[3] = (wt[0] * w0) + (wt[3] * h1) + wt[6];
            vertexData2d[4] = (wt[1] * w0) + (wt[4] * h1) + wt[7];
            vertexData2d[5] = (wt[2] * w0) + (wt[5] * h1) + wt[8];
            vertexData2d[6] = (wt[0] * w0) + (wt[3] * h0) + wt[6];
            vertexData2d[7] = (wt[1] * w0) + (wt[4] * h0) + wt[7];
            vertexData2d[8] = (wt[2] * w0) + (wt[5] * h0) + wt[8];
            vertexData2d[9] = (wt[0] * w1) + (wt[3] * h0) + wt[6];
            vertexData2d[10] = (wt[1] * w1) + (wt[4] * h0) + wt[7];
            vertexData2d[11] = (wt[2] * w1) + (wt[5] * h0) + wt[8];
            vertexData[0] = vertexData2d[0] / vertexData2d[2];
            vertexData[1] = vertexData2d[1] / vertexData2d[2];
            vertexData[2] = vertexData2d[3] / vertexData2d[5];
            vertexData[3] = vertexData2d[4] / vertexData2d[5];
            vertexData[4] = vertexData2d[6] / vertexData2d[8];
            vertexData[5] = vertexData2d[7] / vertexData2d[8];
            vertexData[6] = vertexData2d[9] / vertexData2d[11];
            vertexData[7] = vertexData2d[10] / vertexData2d[11];
        };
        Sprite2d.prototype.calculateTrimmedVertices = function () {
            if (this.proj._affine) {
                _super.prototype.calculateTrimmedVertices.call(this);
                return;
            }
            var wid = this.transform._worldID;
            var tuid = this._texture._updateID;
            if (!this.vertexTrimmedData) {
                this.vertexTrimmedData = new Float32Array(8);
            }
            else if (this._transformTrimmedID === wid && this._textureTrimmedID === tuid) {
                return;
            }
            this._transformTrimmedID = wid;
            this._textureTrimmedID = tuid;
            var texture = this._texture;
            var vertexData = this.vertexTrimmedData;
            var orig = texture.orig;
            var anchor = this._anchor;
            var wt = this.proj.world.mat3;
            var w1 = -anchor._x * orig.width;
            var w0 = w1 + orig.width;
            var h1 = -anchor._y * orig.height;
            var h0 = h1 + orig.height;
            var z = 1.0 / (wt[2] * w1 + wt[5] * h1 + wt[8]);
            vertexData[0] = z * ((wt[0] * w1) + (wt[3] * h1) + wt[6]);
            vertexData[1] = z * ((wt[1] * w1) + (wt[4] * h1) + wt[7]);
            z = 1.0 / (wt[2] * w0 + wt[5] * h1 + wt[8]);
            vertexData[2] = z * ((wt[0] * w0) + (wt[3] * h1) + wt[6]);
            vertexData[3] = z * ((wt[1] * w0) + (wt[4] * h1) + wt[7]);
            z = 1.0 / (wt[2] * w0 + wt[5] * h0 + wt[8]);
            vertexData[4] = z * ((wt[0] * w0) + (wt[3] * h0) + wt[6]);
            vertexData[5] = z * ((wt[1] * w0) + (wt[4] * h0) + wt[7]);
            z = 1.0 / (wt[2] * w1 + wt[5] * h0 + wt[8]);
            vertexData[6] = z * ((wt[0] * w1) + (wt[3] * h0) + wt[6]);
            vertexData[7] = z * ((wt[1] * w1) + (wt[4] * h0) + wt[7]);
        };
        Sprite2d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container2dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        Object.defineProperty(Sprite2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        return Sprite2d;
    }(PIXI.Sprite));
    pixi_projection.Sprite2d = Sprite2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Text2d = (function (_super) {
        __extends(Text2d, _super);
        function Text2d(text, style, canvas) {
            var _this = _super.call(this, text, style, canvas) || this;
            _this.vertexData2d = null;
            _this.proj = new pixi_projection.Projection2d(_this.transform);
            _this.pluginName = 'batch2d';
            return _this;
        }
        Object.defineProperty(Text2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        return Text2d;
    }(PIXI.Text));
    pixi_projection.Text2d = Text2d;
    Text2d.prototype.calculateVertices = pixi_projection.Sprite2d.prototype.calculateVertices;
    Text2d.prototype.calculateTrimmedVertices = pixi_projection.Sprite2d.prototype.calculateTrimmedVertices;
    Text2d.prototype._calculateBounds = pixi_projection.Sprite2d.prototype._calculateBounds;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    function convertTo2d() {
        if (this.proj)
            return;
        this.proj = new pixi_projection.Projection2d(this.transform);
        this.toLocal = pixi_projection.Container2d.prototype.toLocal;
        Object.defineProperty(this, "worldTransform", {
            get: pixi_projection.container2dWorldTransform,
            enumerable: true,
            configurable: true
        });
    }
    PIXI.Container.prototype.convertTo2d = convertTo2d;
    PIXI.Sprite.prototype.convertTo2d = function () {
        if (this.proj)
            return;
        this.calculateVertices = pixi_projection.Sprite2d.prototype.calculateVertices;
        this.calculateTrimmedVertices = pixi_projection.Sprite2d.prototype.calculateTrimmedVertices;
        this._calculateBounds = pixi_projection.Sprite2d.prototype._calculateBounds;
        this.pluginName = 'sprite2d';
        convertTo2d.call(this);
    };
    PIXI.Container.prototype.convertSubtreeTo2d = function () {
        this.convertTo2d();
        for (var i = 0; i < this.children.length; i++) {
            this.children[i].convertSubtreeTo2d();
        }
    };
    if (PIXI.SimpleMesh) {
        PIXI.SimpleMesh.prototype.convertTo2d =
            PIXI.SimpleRope.prototype.convertTo2d =
                function () {
                    if (this.proj)
                        return;
                    this.calculateVertices = pixi_projection.Mesh2d.prototype.calculateVertices;
                    this._renderDefault = pixi_projection.Mesh2d.prototype._renderDefault;
                    if (this.material.pluginName !== 'batch2d') {
                        this.material = new PIXI.MeshMaterial(this.material.texture, {
                            program: PIXI.Program.from(pixi_projection.Mesh2d.defaultVertexShader, pixi_projection.Mesh2d.defaultFragmentShader),
                            pluginName: 'batch2d'
                        });
                    }
                    convertTo2d.call(this);
                };
    }
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var tempTransform = new PIXI.Transform();
    var TilingSprite2d = (function (_super) {
        __extends(TilingSprite2d, _super);
        function TilingSprite2d(texture, width, height) {
            var _this = _super.call(this, texture, width, height) || this;
            _this.tileProj = new pixi_projection.Projection2d(_this.tileTransform);
            _this.tileProj.reverseLocalOrder = true;
            _this.proj = new pixi_projection.Projection2d(_this.transform);
            _this.pluginName = 'tilingSprite2d';
            _this.uvRespectAnchor = true;
            return _this;
        }
        Object.defineProperty(TilingSprite2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        TilingSprite2d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container2dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        TilingSprite2d.prototype._render = function (renderer) {
            var texture = this._texture;
            if (!texture || !texture.valid) {
                return;
            }
            this.tileTransform.updateTransform(tempTransform);
            this.uvMatrix.update();
            renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
            renderer.plugins[this.pluginName].render(this);
        };
        return TilingSprite2d;
    }(PIXI.TilingSprite));
    pixi_projection.TilingSprite2d = TilingSprite2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var shaderVert = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec3 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n\n    vTextureCoord = uTransform * vec3(aTextureCoord, 1.0);\n}\n";
    var shaderFrag = "\nvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = mod(vTextureCoord.xy / vTextureCoord.z - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    vec4 sample = texture2D(uSampler, coord);\n    gl_FragColor = sample * uColor;\n}\n";
    var shaderSimpleFrag = "\n\tvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n    vec4 sample = texture2D(uSampler, vTextureCoord.xy / vTextureCoord.z);\n    gl_FragColor = sample * uColor;\n}\n";
    var tempMat = new pixi_projection.Matrix2d();
    var WRAP_MODES = PIXI.WRAP_MODES;
    var utils = PIXI.utils;
    var TilingSprite2dRenderer = (function (_super) {
        __extends(TilingSprite2dRenderer, _super);
        function TilingSprite2dRenderer(renderer) {
            var _this = _super.call(this, renderer) || this;
            _this.quad = new PIXI.QuadUv();
            var uniforms = { globals: _this.renderer.globalUniforms };
            _this.shader = PIXI.Shader.from(shaderVert, shaderFrag, uniforms);
            _this.simpleShader = PIXI.Shader.from(shaderVert, shaderSimpleFrag, uniforms);
            return _this;
        }
        TilingSprite2dRenderer.prototype.render = function (ts) {
            var renderer = this.renderer;
            var quad = this.quad;
            var vertices = quad.vertices;
            vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;
            vertices[1] = vertices[3] = ts._height * -ts.anchor.y;
            vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);
            vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);
            if (ts.uvRespectAnchor) {
                vertices = quad.uvs;
                vertices[0] = vertices[6] = -ts.anchor.x;
                vertices[1] = vertices[3] = -ts.anchor.y;
                vertices[2] = vertices[4] = 1.0 - ts.anchor.x;
                vertices[5] = vertices[7] = 1.0 - ts.anchor.y;
            }
            quad.invalidate();
            var tex = ts._texture;
            var baseTex = tex.baseTexture;
            var lt = ts.tileProj.world;
            var uv = ts.uvMatrix;
            var isSimple = baseTex.isPowerOfTwo
                && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
            if (isSimple) {
                if (!baseTex._glTextures[renderer.CONTEXT_UID]) {
                    if (baseTex.wrapMode === WRAP_MODES.CLAMP) {
                        baseTex.wrapMode = WRAP_MODES.REPEAT;
                    }
                }
                else {
                    isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;
                }
            }
            var shader = isSimple ? this.simpleShader : this.shader;
            tempMat.identity();
            tempMat.scale(tex.width, tex.height);
            tempMat.prepend(lt);
            tempMat.scale(1.0 / ts._width, 1.0 / ts._height);
            tempMat.invert();
            if (isSimple) {
                tempMat.prepend(uv.mapCoord);
            }
            else {
                shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);
                shader.uniforms.uClampFrame = uv.uClampFrame;
                shader.uniforms.uClampOffset = uv.uClampOffset;
            }
            shader.uniforms.uTransform = tempMat.toArray(true);
            shader.uniforms.uColor = utils.premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.premultiplyAlpha);
            shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);
            shader.uniforms.uSampler = tex;
            renderer.shader.bind(shader, false);
            renderer.geometry.bind(quad, undefined);
            renderer.state.setBlendMode(utils.correctBlendMode(ts.blendMode, baseTex.premultiplyAlpha));
            renderer.geometry.draw(PIXI.DRAW_MODES.TRIANGLES, 6, 0);
        };
        return TilingSprite2dRenderer;
    }(PIXI.ObjectRenderer));
    pixi_projection.TilingSprite2dRenderer = TilingSprite2dRenderer;
    PIXI.Renderer.registerPlugin('tilingSprite2d', TilingSprite2dRenderer);
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    PIXI.systems.MaskSystem.prototype.pushSpriteMask = function (target, maskData) {
        var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];
        if (!alphaMaskFilter) {
            alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new pixi_projection.SpriteMaskFilter2d(maskData)];
        }
        alphaMaskFilter[0].resolution = this.renderer.resolution;
        alphaMaskFilter[0].maskSprite = maskData;
        target.filterArea = maskData.getBounds(true);
        this.renderer.filter.push(target, alphaMaskFilter);
        this.alphaMaskIndex++;
    };
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var spriteMaskVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n\tgl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n\tvTextureCoord = aTextureCoord;\n\tvMaskCoord = otherMatrix * vec3( aTextureCoord, 1.0);\n}\n";
    var spriteMaskFrag = "\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n    vec2 uv = vMaskCoord.xy / vMaskCoord.z;\n    \n    float clip = step(3.5,\n        step(maskClamp.x, uv.x) +\n        step(maskClamp.y, uv.y) +\n        step(uv.x, maskClamp.z) +\n        step(uv.y, maskClamp.w));\n\n    vec4 original = texture2D(uSampler, vTextureCoord);\n    vec4 masky = texture2D(mask, uv);\n    \n    original *= (masky.r * masky.a * alpha * clip);\n\n    gl_FragColor = original;\n}\n";
    var tempMat = new pixi_projection.Matrix2d();
    var SpriteMaskFilter2d = (function (_super) {
        __extends(SpriteMaskFilter2d, _super);
        function SpriteMaskFilter2d(sprite) {
            var _this = _super.call(this, spriteMaskVert, spriteMaskFrag) || this;
            _this.maskMatrix = new pixi_projection.Matrix2d();
            sprite.renderable = false;
            _this.maskSprite = sprite;
            return _this;
        }
        SpriteMaskFilter2d.prototype.apply = function (filterManager, input, output, clear) {
            var maskSprite = this.maskSprite;
            var tex = this.maskSprite.texture;
            if (!tex.valid) {
                return;
            }
            if (!tex.uvMatrix) {
                tex.uvMatrix = new PIXI.TextureMatrix(tex, 0.0);
            }
            tex.uvMatrix.update();
            this.uniforms.mask = maskSprite.texture;
            this.uniforms.otherMatrix = SpriteMaskFilter2d.calculateSpriteMatrix(input, this.maskMatrix, maskSprite)
                .prepend(tex.uvMatrix.mapCoord);
            this.uniforms.alpha = maskSprite.worldAlpha;
            this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;
            filterManager.applyFilter(this, input, output, clear);
        };
        SpriteMaskFilter2d.calculateSpriteMatrix = function (input, mappedMatrix, sprite) {
            var proj = sprite.proj;
            var filterArea = input.filterFrame;
            var worldTransform = proj && !proj._affine ? proj.world.copyTo2dOr3d(tempMat) : tempMat.copyFrom(sprite.transform.worldTransform);
            var texture = sprite.texture.orig;
            mappedMatrix.set(input.width, 0, 0, input.height, filterArea.x, filterArea.y);
            worldTransform.invert();
            mappedMatrix.setToMult(worldTransform, mappedMatrix);
            mappedMatrix.scaleAndTranslate(1.0 / texture.width, 1.0 / texture.height, sprite.anchor.x, sprite.anchor.y);
            return mappedMatrix;
        };
        return SpriteMaskFilter2d;
    }(PIXI.Filter));
    pixi_projection.SpriteMaskFilter2d = SpriteMaskFilter2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    function container3dWorldTransform() {
        return this.proj.affine ? this.transform.worldTransform : this.proj.world;
    }
    pixi_projection.container3dWorldTransform = container3dWorldTransform;
    var Container3d = (function (_super) {
        __extends(Container3d, _super);
        function Container3d() {
            var _this = _super.call(this) || this;
            _this.proj = new pixi_projection.Projection3d(_this.transform);
            return _this;
        }
        Container3d.prototype.isFrontFace = function (forceUpdate) {
            if (forceUpdate === void 0) { forceUpdate = false; }
            if (forceUpdate) {
                this._recursivePostUpdateTransform();
                this.displayObjectUpdateTransform();
            }
            var mat = this.proj.world.mat4;
            var dx1 = mat[0] * mat[15] - mat[3] * mat[12];
            var dy1 = mat[1] * mat[15] - mat[3] * mat[13];
            var dx2 = mat[4] * mat[15] - mat[7] * mat[12];
            var dy2 = mat[5] * mat[15] - mat[7] * mat[13];
            return dx1 * dy2 - dx2 * dy1 > 0;
        };
        Container3d.prototype.getDepth = function (forceUpdate) {
            if (forceUpdate === void 0) { forceUpdate = false; }
            if (forceUpdate) {
                this._recursivePostUpdateTransform();
                this.displayObjectUpdateTransform();
            }
            var mat4 = this.proj.world.mat4;
            return mat4[14] / mat4[15];
        };
        Container3d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            if (from) {
                position = from.toGlobal(position, point, skipUpdate);
            }
            if (!skipUpdate) {
                this._recursivePostUpdateTransform();
            }
            if (step === pixi_projection.TRANSFORM_STEP.ALL) {
                if (!skipUpdate) {
                    this.displayObjectUpdateTransform();
                }
                if (this.proj.affine) {
                    return this.transform.worldTransform.applyInverse(position, point);
                }
                return this.proj.world.applyInverse(position, point);
            }
            if (this.parent) {
                point = this.parent.worldTransform.applyInverse(position, point);
            }
            else {
                point.copyFrom(position);
            }
            if (step === pixi_projection.TRANSFORM_STEP.NONE) {
                return point;
            }
            point = this.transform.localTransform.applyInverse(point, point);
            if (step === pixi_projection.TRANSFORM_STEP.PROJ && this.proj.cameraMode) {
                point = this.proj.cameraMatrix.applyInverse(point, point);
            }
            return point;
        };
        Object.defineProperty(Container3d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Container3d.prototype, "position3d", {
            get: function () {
                return this.proj.position;
            },
            set: function (value) {
                this.proj.position.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Container3d.prototype, "scale3d", {
            get: function () {
                return this.proj.scale;
            },
            set: function (value) {
                this.proj.scale.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Container3d.prototype, "euler", {
            get: function () {
                return this.proj.euler;
            },
            set: function (value) {
                this.proj.euler.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Container3d.prototype, "pivot3d", {
            get: function () {
                return this.proj.pivot;
            },
            set: function (value) {
                this.proj.pivot.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        return Container3d;
    }(PIXI.Container));
    pixi_projection.Container3d = Container3d;
    pixi_projection.container3dToLocal = Container3d.prototype.toLocal;
    pixi_projection.container3dGetDepth = Container3d.prototype.getDepth;
    pixi_projection.container3dIsFrontFace = Container3d.prototype.isFrontFace;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Camera3d = (function (_super) {
        __extends(Camera3d, _super);
        function Camera3d() {
            var _this = _super.call(this) || this;
            _this._far = 0;
            _this._near = 0;
            _this._focus = 0;
            _this._orthographic = false;
            _this.proj.cameraMode = true;
            _this.setPlanes(400, 10, 10000, false);
            return _this;
        }
        Object.defineProperty(Camera3d.prototype, "far", {
            get: function () {
                return this._far;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Camera3d.prototype, "near", {
            get: function () {
                return this._near;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Camera3d.prototype, "focus", {
            get: function () {
                return this._focus;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Camera3d.prototype, "ortographic", {
            get: function () {
                return this._orthographic;
            },
            enumerable: true,
            configurable: true
        });
        Camera3d.prototype.setPlanes = function (focus, near, far, orthographic) {
            if (near === void 0) { near = 10; }
            if (far === void 0) { far = 10000; }
            if (orthographic === void 0) { orthographic = false; }
            this._focus = focus;
            this._near = near;
            this._far = far;
            this._orthographic = orthographic;
            var proj = this.proj;
            var mat4 = proj.cameraMatrix.mat4;
            proj._projID++;
            mat4[10] = 1.0 / (far - near);
            mat4[14] = (focus - near) / (far - near);
            if (this._orthographic) {
                mat4[11] = 0;
            }
            else {
                mat4[11] = 1.0 / focus;
            }
        };
        return Camera3d;
    }(pixi_projection.Container3d));
    pixi_projection.Camera3d = Camera3d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Euler = (function () {
        function Euler(x, y, z) {
            this._quatUpdateId = -1;
            this._quatDirtyId = 0;
            this._sign = 1;
            this._x = x || 0;
            this._y = y || 0;
            this._z = z || 0;
            this.quaternion = new Float64Array(4);
            this.quaternion[3] = 1;
            this.update();
        }
        Object.defineProperty(Euler.prototype, "x", {
            get: function () {
                return this._x;
            },
            set: function (value) {
                if (this._x !== value) {
                    this._x = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Euler.prototype, "y", {
            get: function () {
                return this._y;
            },
            set: function (value) {
                if (this._y !== value) {
                    this._y = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Euler.prototype, "z", {
            get: function () {
                return this._z;
            },
            set: function (value) {
                if (this._z !== value) {
                    this._z = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Euler.prototype, "pitch", {
            get: function () {
                return this._x;
            },
            set: function (value) {
                if (this._x !== value) {
                    this._x = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Euler.prototype, "yaw", {
            get: function () {
                return this._y;
            },
            set: function (value) {
                if (this._y !== value) {
                    this._y = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Euler.prototype, "roll", {
            get: function () {
                return this._z;
            },
            set: function (value) {
                if (this._z !== value) {
                    this._z = value;
                    this._quatDirtyId++;
                }
            },
            enumerable: true,
            configurable: true
        });
        Euler.prototype.set = function (x, y, z) {
            var _x = x || 0;
            var _y = y || 0;
            var _z = z || 0;
            if (this._x !== _x || this._y !== _y || this._z !== _z) {
                this._x = _x;
                this._y = _y;
                this._z = _z;
                this._quatDirtyId++;
            }
        };
        ;
        Euler.prototype.copyFrom = function (euler) {
            var _x = euler.x;
            var _y = euler.y;
            var _z = euler.z;
            if (this._x !== _x || this._y !== _y || this._z !== _z) {
                this._x = _x;
                this._y = _y;
                this._z = _z;
                this._quatDirtyId++;
            }
        };
        Euler.prototype.copyTo = function (p) {
            p.set(this._x, this._y, this._z);
            return p;
        };
        Euler.prototype.equals = function (euler) {
            return this._x === euler.x
                && this._y === euler.y
                && this._z === euler.z;
        };
        Euler.prototype.clone = function () {
            return new Euler(this._x, this._y, this._z);
        };
        Euler.prototype.update = function () {
            if (this._quatUpdateId === this._quatDirtyId) {
                return false;
            }
            this._quatUpdateId = this._quatDirtyId;
            var c1 = Math.cos(this._x / 2);
            var c2 = Math.cos(this._y / 2);
            var c3 = Math.cos(this._z / 2);
            var s = this._sign;
            var s1 = s * Math.sin(this._x / 2);
            var s2 = s * Math.sin(this._y / 2);
            var s3 = s * Math.sin(this._z / 2);
            var q = this.quaternion;
            q[0] = s1 * c2 * c3 + c1 * s2 * s3;
            q[1] = c1 * s2 * c3 - s1 * c2 * s3;
            q[2] = c1 * c2 * s3 + s1 * s2 * c3;
            q[3] = c1 * c2 * c3 - s1 * s2 * s3;
            return true;
        };
        return Euler;
    }());
    pixi_projection.Euler = Euler;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var mat4id = [1, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 1, 0,
        0, 0, 0, 1];
    var Matrix3d = (function () {
        function Matrix3d(backingArray) {
            this.floatArray = null;
            this._dirtyId = 0;
            this._updateId = -1;
            this._mat4inv = null;
            this.cacheInverse = false;
            this.mat4 = new Float64Array(backingArray || mat4id);
        }
        Object.defineProperty(Matrix3d.prototype, "a", {
            get: function () {
                return this.mat4[0] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[0] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix3d.prototype, "b", {
            get: function () {
                return this.mat4[1] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[1] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix3d.prototype, "c", {
            get: function () {
                return this.mat4[4] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[4] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix3d.prototype, "d", {
            get: function () {
                return this.mat4[5] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[5] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix3d.prototype, "tx", {
            get: function () {
                return this.mat4[12] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[12] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Matrix3d.prototype, "ty", {
            get: function () {
                return this.mat4[13] / this.mat4[15];
            },
            set: function (value) {
                this.mat4[13] = value * this.mat4[15];
            },
            enumerable: true,
            configurable: true
        });
        Matrix3d.prototype.set = function (a, b, c, d, tx, ty) {
            var mat4 = this.mat4;
            mat4[0] = a;
            mat4[1] = b;
            mat4[2] = 0;
            mat4[3] = 0;
            mat4[4] = c;
            mat4[5] = d;
            mat4[6] = 0;
            mat4[7] = 0;
            mat4[8] = 0;
            mat4[9] = 0;
            mat4[10] = 1;
            mat4[11] = 0;
            mat4[12] = tx;
            mat4[13] = ty;
            mat4[14] = 0;
            mat4[15] = 1;
            return this;
        };
        Matrix3d.prototype.toArray = function (transpose, out) {
            if (!this.floatArray) {
                this.floatArray = new Float32Array(9);
            }
            var array = out || this.floatArray;
            var mat3 = this.mat4;
            if (transpose) {
                array[0] = mat3[0];
                array[1] = mat3[1];
                array[2] = mat3[3];
                array[3] = mat3[4];
                array[4] = mat3[5];
                array[5] = mat3[7];
                array[6] = mat3[12];
                array[7] = mat3[13];
                array[8] = mat3[15];
            }
            else {
                array[0] = mat3[0];
                array[1] = mat3[4];
                array[2] = mat3[12];
                array[3] = mat3[2];
                array[4] = mat3[6];
                array[5] = mat3[13];
                array[6] = mat3[3];
                array[7] = mat3[7];
                array[8] = mat3[15];
            }
            return array;
        };
        Matrix3d.prototype.setToTranslation = function (tx, ty, tz) {
            var mat4 = this.mat4;
            mat4[0] = 1;
            mat4[1] = 0;
            mat4[2] = 0;
            mat4[3] = 0;
            mat4[4] = 0;
            mat4[5] = 1;
            mat4[6] = 0;
            mat4[7] = 0;
            mat4[8] = 0;
            mat4[9] = 0;
            mat4[10] = 1;
            mat4[11] = 0;
            mat4[12] = tx;
            mat4[13] = ty;
            mat4[14] = tz;
            mat4[15] = 1;
        };
        Matrix3d.prototype.setToRotationTranslationScale = function (quat, tx, ty, tz, sx, sy, sz) {
            var out = this.mat4;
            var x = quat[0], y = quat[1], z = quat[2], w = quat[3];
            var x2 = x + x;
            var y2 = y + y;
            var z2 = z + z;
            var xx = x * x2;
            var xy = x * y2;
            var xz = x * z2;
            var yy = y * y2;
            var yz = y * z2;
            var zz = z * z2;
            var wx = w * x2;
            var wy = w * y2;
            var wz = w * z2;
            out[0] = (1 - (yy + zz)) * sx;
            out[1] = (xy + wz) * sx;
            out[2] = (xz - wy) * sx;
            out[3] = 0;
            out[4] = (xy - wz) * sy;
            out[5] = (1 - (xx + zz)) * sy;
            out[6] = (yz + wx) * sy;
            out[7] = 0;
            out[8] = (xz + wy) * sz;
            out[9] = (yz - wx) * sz;
            out[10] = (1 - (xx + yy)) * sz;
            out[11] = 0;
            out[12] = tx;
            out[13] = ty;
            out[14] = tz;
            out[15] = 1;
            return out;
        };
        Matrix3d.prototype.apply = function (pos, newPos) {
            newPos = newPos || new pixi_projection.Point3d();
            var mat4 = this.mat4;
            var x = pos.x;
            var y = pos.y;
            var z = pos.z || 0;
            var w = 1.0 / (mat4[3] * x + mat4[7] * y + mat4[11] * z + mat4[15]);
            newPos.x = w * (mat4[0] * x + mat4[4] * y + mat4[8] * z + mat4[12]);
            newPos.y = w * (mat4[1] * x + mat4[5] * y + mat4[9] * z + mat4[13]);
            newPos.z = w * (mat4[2] * x + mat4[6] * y + mat4[10] * z + mat4[14]);
            return newPos;
        };
        Matrix3d.prototype.translate = function (tx, ty, tz) {
            var a = this.mat4;
            a[12] = a[0] * tx + a[4] * ty + a[8] * tz + a[12];
            a[13] = a[1] * tx + a[5] * ty + a[9] * tz + a[13];
            a[14] = a[2] * tx + a[6] * ty + a[10] * tz + a[14];
            a[15] = a[3] * tx + a[7] * ty + a[11] * tz + a[15];
            return this;
        };
        Matrix3d.prototype.scale = function (x, y, z) {
            var mat4 = this.mat4;
            mat4[0] *= x;
            mat4[1] *= x;
            mat4[2] *= x;
            mat4[3] *= x;
            mat4[4] *= y;
            mat4[5] *= y;
            mat4[6] *= y;
            mat4[7] *= y;
            if (z !== undefined) {
                mat4[8] *= z;
                mat4[9] *= z;
                mat4[10] *= z;
                mat4[11] *= z;
            }
            return this;
        };
        Matrix3d.prototype.scaleAndTranslate = function (scaleX, scaleY, scaleZ, tx, ty, tz) {
            var mat4 = this.mat4;
            mat4[0] = scaleX * mat4[0] + tx * mat4[3];
            mat4[1] = scaleY * mat4[1] + ty * mat4[3];
            mat4[2] = scaleZ * mat4[2] + tz * mat4[3];
            mat4[4] = scaleX * mat4[4] + tx * mat4[7];
            mat4[5] = scaleY * mat4[5] + ty * mat4[7];
            mat4[6] = scaleZ * mat4[6] + tz * mat4[7];
            mat4[8] = scaleX * mat4[8] + tx * mat4[11];
            mat4[9] = scaleY * mat4[9] + ty * mat4[11];
            mat4[10] = scaleZ * mat4[10] + tz * mat4[11];
            mat4[12] = scaleX * mat4[12] + tx * mat4[15];
            mat4[13] = scaleY * mat4[13] + ty * mat4[15];
            mat4[14] = scaleZ * mat4[14] + tz * mat4[15];
        };
        Matrix3d.prototype.applyInverse = function (pos, newPos) {
            newPos = newPos || new pixi_projection.Point3d();
            if (!this._mat4inv) {
                this._mat4inv = new Float64Array(16);
            }
            var mat4 = this._mat4inv;
            var a = this.mat4;
            var x = pos.x;
            var y = pos.y;
            var z = pos.z || 0;
            if (!this.cacheInverse || this._updateId !== this._dirtyId) {
                this._updateId = this._dirtyId;
                Matrix3d.glMatrixMat4Invert(mat4, a);
            }
            var w1 = 1.0 / (mat4[3] * x + mat4[7] * y + mat4[11] * z + mat4[15]);
            var x1 = w1 * (mat4[0] * x + mat4[4] * y + mat4[8] * z + mat4[12]);
            var y1 = w1 * (mat4[1] * x + mat4[5] * y + mat4[9] * z + mat4[13]);
            var z1 = w1 * (mat4[2] * x + mat4[6] * y + mat4[10] * z + mat4[14]);
            z += 1.0;
            var w2 = 1.0 / (mat4[3] * x + mat4[7] * y + mat4[11] * z + mat4[15]);
            var x2 = w2 * (mat4[0] * x + mat4[4] * y + mat4[8] * z + mat4[12]);
            var y2 = w2 * (mat4[1] * x + mat4[5] * y + mat4[9] * z + mat4[13]);
            var z2 = w2 * (mat4[2] * x + mat4[6] * y + mat4[10] * z + mat4[14]);
            if (Math.abs(z1 - z2) < 1e-10) {
                newPos.set(NaN, NaN, 0);
            }
            var alpha = (0 - z1) / (z2 - z1);
            newPos.set((x2 - x1) * alpha + x1, (y2 - y1) * alpha + y1, 0.0);
            return newPos;
        };
        Matrix3d.prototype.invert = function () {
            Matrix3d.glMatrixMat4Invert(this.mat4, this.mat4);
            return this;
        };
        Matrix3d.prototype.invertCopyTo = function (matrix) {
            if (!this._mat4inv) {
                this._mat4inv = new Float64Array(16);
            }
            var mat4 = this._mat4inv;
            var a = this.mat4;
            if (!this.cacheInverse || this._updateId !== this._dirtyId) {
                this._updateId = this._dirtyId;
                Matrix3d.glMatrixMat4Invert(mat4, a);
            }
            matrix.mat4.set(mat4);
        };
        Matrix3d.prototype.identity = function () {
            var mat3 = this.mat4;
            mat3[0] = 1;
            mat3[1] = 0;
            mat3[2] = 0;
            mat3[3] = 0;
            mat3[4] = 0;
            mat3[5] = 1;
            mat3[6] = 0;
            mat3[7] = 0;
            mat3[8] = 0;
            mat3[9] = 0;
            mat3[10] = 1;
            mat3[11] = 0;
            mat3[12] = 0;
            mat3[13] = 0;
            mat3[14] = 0;
            mat3[15] = 1;
            return this;
        };
        Matrix3d.prototype.clone = function () {
            return new Matrix3d(this.mat4);
        };
        Matrix3d.prototype.copyTo3d = function (matrix) {
            var mat3 = this.mat4;
            var ar2 = matrix.mat4;
            ar2[0] = mat3[0];
            ar2[1] = mat3[1];
            ar2[2] = mat3[2];
            ar2[3] = mat3[3];
            ar2[4] = mat3[4];
            ar2[5] = mat3[5];
            ar2[6] = mat3[6];
            ar2[7] = mat3[7];
            ar2[8] = mat3[8];
            return matrix;
        };
        Matrix3d.prototype.copyTo2d = function (matrix) {
            var mat3 = this.mat4;
            var ar2 = matrix.mat3;
            ar2[0] = mat3[0];
            ar2[1] = mat3[1];
            ar2[2] = mat3[3];
            ar2[3] = mat3[4];
            ar2[4] = mat3[5];
            ar2[5] = mat3[7];
            ar2[6] = mat3[12];
            ar2[7] = mat3[13];
            ar2[8] = mat3[15];
            return matrix;
        };
        Matrix3d.prototype.copyTo2dOr3d = function (matrix) {
            if (matrix instanceof pixi_projection.Matrix2d) {
                return this.copyTo2d(matrix);
            }
            else {
                return this.copyTo3d(matrix);
            }
        };
        Matrix3d.prototype.copyTo = function (matrix, affine, preserveOrientation) {
            var mat3 = this.mat4;
            var d = 1.0 / mat3[15];
            var tx = mat3[12] * d, ty = mat3[13] * d;
            matrix.a = (mat3[0] - mat3[3] * tx) * d;
            matrix.b = (mat3[1] - mat3[3] * ty) * d;
            matrix.c = (mat3[4] - mat3[7] * tx) * d;
            matrix.d = (mat3[5] - mat3[7] * ty) * d;
            matrix.tx = tx;
            matrix.ty = ty;
            if (affine >= 2) {
                var D = matrix.a * matrix.d - matrix.b * matrix.c;
                if (!preserveOrientation) {
                    D = Math.abs(D);
                }
                if (affine === pixi_projection.AFFINE.POINT) {
                    if (D > 0) {
                        D = 1;
                    }
                    else
                        D = -1;
                    matrix.a = D;
                    matrix.b = 0;
                    matrix.c = 0;
                    matrix.d = D;
                }
                else if (affine === pixi_projection.AFFINE.AXIS_X) {
                    D /= Math.sqrt(matrix.b * matrix.b + matrix.d * matrix.d);
                    matrix.c = 0;
                    matrix.d = D;
                }
                else if (affine === pixi_projection.AFFINE.AXIS_Y) {
                    D /= Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c);
                    matrix.a = D;
                    matrix.c = 0;
                }
            }
            return matrix;
        };
        Matrix3d.prototype.copyFrom = function (matrix) {
            var mat3 = this.mat4;
            mat3[0] = matrix.a;
            mat3[1] = matrix.b;
            mat3[2] = 0;
            mat3[3] = 0;
            mat3[4] = matrix.c;
            mat3[5] = matrix.d;
            mat3[6] = 0;
            mat3[7] = 0;
            mat3[8] = 0;
            mat3[9] = 0;
            mat3[10] = 1;
            mat3[11] = 0;
            mat3[12] = matrix.tx;
            mat3[13] = matrix.ty;
            mat3[14] = 0;
            mat3[15] = 1;
            this._dirtyId++;
            return this;
        };
        Matrix3d.prototype.setToMultLegacy = function (pt, lt) {
            var out = this.mat4;
            var b = lt.mat4;
            var a00 = pt.a, a01 = pt.b, a10 = pt.c, a11 = pt.d, a30 = pt.tx, a31 = pt.ty;
            var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
            out[0] = b0 * a00 + b1 * a10 + b3 * a30;
            out[1] = b0 * a01 + b1 * a11 + b3 * a31;
            out[2] = b2;
            out[3] = b3;
            b0 = b[4];
            b1 = b[5];
            b2 = b[6];
            b3 = b[7];
            out[4] = b0 * a00 + b1 * a10 + b3 * a30;
            out[5] = b0 * a01 + b1 * a11 + b3 * a31;
            out[6] = b2;
            out[7] = b3;
            b0 = b[8];
            b1 = b[9];
            b2 = b[10];
            b3 = b[11];
            out[8] = b0 * a00 + b1 * a10 + b3 * a30;
            out[9] = b0 * a01 + b1 * a11 + b3 * a31;
            out[10] = b2;
            out[11] = b3;
            b0 = b[12];
            b1 = b[13];
            b2 = b[14];
            b3 = b[15];
            out[12] = b0 * a00 + b1 * a10 + b3 * a30;
            out[13] = b0 * a01 + b1 * a11 + b3 * a31;
            out[14] = b2;
            out[15] = b3;
            this._dirtyId++;
            return this;
        };
        Matrix3d.prototype.setToMultLegacy2 = function (pt, lt) {
            var out = this.mat4;
            var a = pt.mat4;
            var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];
            var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
            var b00 = lt.a, b01 = lt.b, b10 = lt.c, b11 = lt.d, b30 = lt.tx, b31 = lt.ty;
            out[0] = b00 * a00 + b01 * a10;
            out[1] = b00 * a01 + b01 * a11;
            out[2] = b00 * a02 + b01 * a12;
            out[3] = b00 * a03 + b01 * a13;
            out[4] = b10 * a00 + b11 * a10;
            out[5] = b10 * a01 + b11 * a11;
            out[6] = b10 * a02 + b11 * a12;
            out[7] = b10 * a03 + b11 * a13;
            out[8] = a[8];
            out[9] = a[9];
            out[10] = a[10];
            out[11] = a[11];
            out[12] = b30 * a00 + b31 * a10 + a[12];
            out[13] = b30 * a01 + b31 * a11 + a[13];
            out[14] = b30 * a02 + b31 * a12 + a[14];
            out[15] = b30 * a03 + b31 * a13 + a[15];
            this._dirtyId++;
            return this;
        };
        Matrix3d.prototype.setToMult = function (pt, lt) {
            Matrix3d.glMatrixMat4Multiply(this.mat4, pt.mat4, lt.mat4);
            this._dirtyId++;
            return this;
        };
        Matrix3d.prototype.prepend = function (lt) {
            if (lt.mat4) {
                this.setToMult(lt, this);
            }
            else {
                this.setToMultLegacy(lt, this);
            }
        };
        Matrix3d.glMatrixMat4Invert = function (out, a) {
            var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];
            var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
            var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
            var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
            var b00 = a00 * a11 - a01 * a10;
            var b01 = a00 * a12 - a02 * a10;
            var b02 = a00 * a13 - a03 * a10;
            var b03 = a01 * a12 - a02 * a11;
            var b04 = a01 * a13 - a03 * a11;
            var b05 = a02 * a13 - a03 * a12;
            var b06 = a20 * a31 - a21 * a30;
            var b07 = a20 * a32 - a22 * a30;
            var b08 = a20 * a33 - a23 * a30;
            var b09 = a21 * a32 - a22 * a31;
            var b10 = a21 * a33 - a23 * a31;
            var b11 = a22 * a33 - a23 * a32;
            var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
            if (!det) {
                return null;
            }
            det = 1.0 / det;
            out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
            out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
            out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
            out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
            out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
            out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
            out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
            out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
            out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
            out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
            out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
            out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
            out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
            out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
            out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
            out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
            return out;
        };
        Matrix3d.glMatrixMat4Multiply = function (out, a, b) {
            var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];
            var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
            var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
            var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
            var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
            out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
            out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
            out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
            out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
            b0 = b[4];
            b1 = b[5];
            b2 = b[6];
            b3 = b[7];
            out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
            out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
            out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
            out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
            b0 = b[8];
            b1 = b[9];
            b2 = b[10];
            b3 = b[11];
            out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
            out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
            out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
            out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
            b0 = b[12];
            b1 = b[13];
            b2 = b[14];
            b3 = b[15];
            out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
            out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
            out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
            out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
            return out;
        };
        Matrix3d.IDENTITY = new Matrix3d();
        Matrix3d.TEMP_MATRIX = new Matrix3d();
        return Matrix3d;
    }());
    pixi_projection.Matrix3d = Matrix3d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var ObservableEuler = (function () {
        function ObservableEuler(cb, scope, x, y, z) {
            this.cb = cb;
            this.scope = scope;
            this._quatUpdateId = -1;
            this._quatDirtyId = 0;
            this._sign = 1;
            this._x = x || 0;
            this._y = y || 0;
            this._z = z || 0;
            this.quaternion = new Float64Array(4);
            this.quaternion[3] = 1;
            this.update();
        }
        Object.defineProperty(ObservableEuler.prototype, "x", {
            get: function () {
                return this._x;
            },
            set: function (value) {
                if (this._x !== value) {
                    this._x = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ObservableEuler.prototype, "y", {
            get: function () {
                return this._y;
            },
            set: function (value) {
                if (this._y !== value) {
                    this._y = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ObservableEuler.prototype, "z", {
            get: function () {
                return this._z;
            },
            set: function (value) {
                if (this._z !== value) {
                    this._z = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ObservableEuler.prototype, "pitch", {
            get: function () {
                return this._x;
            },
            set: function (value) {
                if (this._x !== value) {
                    this._x = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ObservableEuler.prototype, "yaw", {
            get: function () {
                return this._y;
            },
            set: function (value) {
                if (this._y !== value) {
                    this._y = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ObservableEuler.prototype, "roll", {
            get: function () {
                return this._z;
            },
            set: function (value) {
                if (this._z !== value) {
                    this._z = value;
                    this._quatDirtyId++;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        ObservableEuler.prototype.set = function (x, y, z) {
            var _x = x || 0;
            var _y = y || 0;
            var _z = z || 0;
            if (this._x !== _x || this._y !== _y || this._z !== _z) {
                this._x = _x;
                this._y = _y;
                this._z = _z;
                this._quatDirtyId++;
                this.cb.call(this.scope);
            }
        };
        ;
        ObservableEuler.prototype.copyFrom = function (euler) {
            var _x = euler.x;
            var _y = euler.y;
            var _z = euler.z;
            if (this._x !== _x || this._y !== _y || this._z !== _z) {
                this._x = _x;
                this._y = _y;
                this._z = _z;
                this._quatDirtyId++;
                this.cb.call(this.scope);
            }
        };
        ObservableEuler.prototype.copyTo = function (p) {
            p.set(this._x, this._y, this._z);
            return p;
        };
        ObservableEuler.prototype.equals = function (euler) {
            return this._x === euler.x
                && this._y === euler.y
                && this._z === euler.z;
        };
        ObservableEuler.prototype.clone = function () {
            return new pixi_projection.Euler(this._x, this._y, this._z);
        };
        ObservableEuler.prototype.update = function () {
            if (this._quatUpdateId === this._quatDirtyId) {
                return false;
            }
            this._quatUpdateId = this._quatDirtyId;
            var c1 = Math.cos(this._x / 2);
            var c2 = Math.cos(this._y / 2);
            var c3 = Math.cos(this._z / 2);
            var s = this._sign;
            var s1 = s * Math.sin(this._x / 2);
            var s2 = s * Math.sin(this._y / 2);
            var s3 = s * Math.sin(this._z / 2);
            var q = this.quaternion;
            q[0] = s1 * c2 * c3 + c1 * s2 * s3;
            q[1] = c1 * s2 * c3 - s1 * c2 * s3;
            q[2] = c1 * c2 * s3 + s1 * s2 * c3;
            q[3] = c1 * c2 * c3 - s1 * s2 * s3;
            return true;
        };
        return ObservableEuler;
    }());
    pixi_projection.ObservableEuler = ObservableEuler;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    PIXI.ObservablePoint.prototype.copy = function (point) {
    };
    var Point3d = (function (_super) {
        __extends(Point3d, _super);
        function Point3d(x, y, z) {
            var _this = _super.call(this, x, y) || this;
            _this.z = z;
            return _this;
        }
        Point3d.prototype.set = function (x, y, z) {
            this.x = x || 0;
            this.y = (y === undefined) ? this.x : (y || 0);
            this.z = (y === undefined) ? this.x : (z || 0);
        };
        Point3d.prototype.copyFrom = function (p) {
            this.set(p.x, p.y, p.z || 0);
            return this;
        };
        Point3d.prototype.copyTo = function (p) {
            p.set(this.x, this.y, this.z);
            return p;
        };
        return Point3d;
    }(PIXI.Point));
    pixi_projection.Point3d = Point3d;
    var ObservablePoint3d = (function (_super) {
        __extends(ObservablePoint3d, _super);
        function ObservablePoint3d() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this._z = 0;
            return _this;
        }
        Object.defineProperty(ObservablePoint3d.prototype, "z", {
            get: function () {
                return this._z;
            },
            set: function (value) {
                if (this._z !== value) {
                    this._z = value;
                    this.cb.call(this.scope);
                }
            },
            enumerable: true,
            configurable: true
        });
        ObservablePoint3d.prototype.set = function (x, y, z) {
            var _x = x || 0;
            var _y = (y === undefined) ? _x : (y || 0);
            var _z = (y === undefined) ? _x : (z || 0);
            if (this._x !== _x || this._y !== _y || this._z !== _z) {
                this._x = _x;
                this._y = _y;
                this._z = _z;
                this.cb.call(this.scope);
            }
        };
        ObservablePoint3d.prototype.copyFrom = function (p) {
            this.set(p.x, p.y, p.z || 0);
            return this;
        };
        ObservablePoint3d.prototype.copyTo = function (p) {
            p.set(this._x, this._y, this._z);
            return p;
        };
        return ObservablePoint3d;
    }(PIXI.ObservablePoint));
    pixi_projection.ObservablePoint3d = ObservablePoint3d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var tempMat = new pixi_projection.Matrix3d();
    var Projection3d = (function (_super) {
        __extends(Projection3d, _super);
        function Projection3d(legacy, enable) {
            var _this = _super.call(this, legacy, enable) || this;
            _this.cameraMatrix = null;
            _this._cameraMode = false;
            _this.position = new pixi_projection.ObservablePoint3d(_this.onChange, _this, 0, 0);
            _this.scale = new pixi_projection.ObservablePoint3d(_this.onChange, _this, 1, 1);
            _this.euler = new pixi_projection.ObservableEuler(_this.onChange, _this, 0, 0, 0);
            _this.pivot = new pixi_projection.ObservablePoint3d(_this.onChange, _this, 0, 0);
            _this.local = new pixi_projection.Matrix3d();
            _this.world = new pixi_projection.Matrix3d();
            _this.local.cacheInverse = true;
            _this.world.cacheInverse = true;
            _this.position._z = 0;
            _this.scale._z = 1;
            _this.pivot._z = 0;
            return _this;
        }
        Object.defineProperty(Projection3d.prototype, "cameraMode", {
            get: function () {
                return this._cameraMode;
            },
            set: function (value) {
                if (this._cameraMode === value) {
                    return;
                }
                this._cameraMode = value;
                this.euler._sign = this._cameraMode ? -1 : 1;
                this.euler._quatDirtyId++;
                if (value) {
                    this.cameraMatrix = new pixi_projection.Matrix3d();
                }
            },
            enumerable: true,
            configurable: true
        });
        Projection3d.prototype.onChange = function () {
            this._projID++;
        };
        Projection3d.prototype.clear = function () {
            if (this.cameraMatrix) {
                this.cameraMatrix.identity();
            }
            this.position.set(0, 0, 0);
            this.scale.set(1, 1, 1);
            this.euler.set(0, 0, 0);
            this.pivot.set(0, 0, 0);
            _super.prototype.clear.call(this);
        };
        Projection3d.prototype.updateLocalTransform = function (lt) {
            if (this._projID === 0) {
                this.local.copyFrom(lt);
                return;
            }
            var matrix = this.local;
            var euler = this.euler;
            var pos = this.position;
            var scale = this.scale;
            var pivot = this.pivot;
            euler.update();
            if (!this.cameraMode) {
                matrix.setToRotationTranslationScale(euler.quaternion, pos._x, pos._y, pos._z, scale._x, scale._y, scale._z);
                matrix.translate(-pivot._x, -pivot._y, -pivot._z);
                matrix.setToMultLegacy(lt, matrix);
                return;
            }
            matrix.setToMultLegacy(lt, this.cameraMatrix);
            matrix.translate(pivot._x, pivot._y, pivot._z);
            matrix.scale(1.0 / scale._x, 1.0 / scale._y, 1.0 / scale._z);
            tempMat.setToRotationTranslationScale(euler.quaternion, 0, 0, 0, 1, 1, 1);
            matrix.setToMult(matrix, tempMat);
            matrix.translate(-pos._x, -pos._y, -pos._z);
            this.local._dirtyId++;
        };
        return Projection3d;
    }(pixi_projection.LinearProjection));
    pixi_projection.Projection3d = Projection3d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Mesh3d2d = (function (_super) {
        __extends(Mesh3d2d, _super);
        function Mesh3d2d(geometry, shader, state, drawMode) {
            var _this = _super.call(this, geometry, shader, state, drawMode) || this;
            _this.vertexData2d = null;
            _this.proj = new pixi_projection.Projection3d(_this.transform);
            return _this;
        }
        Mesh3d2d.prototype.calculateVertices = function () {
            if (this.proj._affine) {
                this.vertexData2d = null;
                _super.prototype.calculateVertices.call(this);
                return;
            }
            var geometry = this.geometry;
            var vertices = geometry.buffers[0].data;
            var thisAny = this;
            if (geometry.vertexDirtyId === thisAny.vertexDirty && thisAny._transformID === thisAny.transform._worldID) {
                return;
            }
            thisAny._transformID = thisAny.transform._worldID;
            if (thisAny.vertexData.length !== vertices.length) {
                thisAny.vertexData = new Float32Array(vertices.length);
            }
            if (this.vertexData2d.length !== vertices.length * 3 / 2) {
                this.vertexData2d = new Float32Array(vertices.length * 3);
            }
            var wt = this.proj.world.mat4;
            var vertexData2d = this.vertexData2d;
            var vertexData = thisAny.vertexData;
            for (var i = 0; i < vertexData.length / 2; i++) {
                var x = vertices[(i * 2)];
                var y = vertices[(i * 2) + 1];
                var xx = (wt[0] * x) + (wt[4] * y) + wt[12];
                var yy = (wt[1] * x) + (wt[5] * y) + wt[13];
                var ww = (wt[3] * x) + (wt[7] * y) + wt[15];
                vertexData2d[i * 3] = xx;
                vertexData2d[i * 3 + 1] = yy;
                vertexData2d[i * 3 + 2] = ww;
                vertexData[(i * 2)] = xx / ww;
                vertexData[(i * 2) + 1] = yy / ww;
            }
            thisAny.vertexDirty = geometry.vertexDirtyId;
        };
        Object.defineProperty(Mesh3d2d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        Mesh3d2d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container3dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        Mesh3d2d.prototype.isFrontFace = function (forceUpdate) {
            return pixi_projection.container3dIsFrontFace.call(this, forceUpdate);
        };
        Mesh3d2d.prototype.getDepth = function (forceUpdate) {
            return pixi_projection.container3dGetDepth.call(this, forceUpdate);
        };
        Object.defineProperty(Mesh3d2d.prototype, "position3d", {
            get: function () {
                return this.proj.position;
            },
            set: function (value) {
                this.proj.position.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Mesh3d2d.prototype, "scale3d", {
            get: function () {
                return this.proj.scale;
            },
            set: function (value) {
                this.proj.scale.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Mesh3d2d.prototype, "euler", {
            get: function () {
                return this.proj.euler;
            },
            set: function (value) {
                this.proj.euler.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Mesh3d2d.prototype, "pivot3d", {
            get: function () {
                return this.proj.pivot;
            },
            set: function (value) {
                this.proj.pivot.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        return Mesh3d2d;
    }(PIXI.Mesh));
    pixi_projection.Mesh3d2d = Mesh3d2d;
    Mesh3d2d.prototype._renderDefault = pixi_projection.Mesh2d.prototype._renderDefault;
    var SimpleMesh3d2d = (function (_super) {
        __extends(SimpleMesh3d2d, _super);
        function SimpleMesh3d2d(texture, vertices, uvs, indices, drawMode) {
            var _this = _super.call(this, new PIXI.MeshGeometry(vertices, uvs, indices), new PIXI.MeshMaterial(texture, {
                program: PIXI.Program.from(pixi_projection.Mesh2d.defaultVertexShader, pixi_projection.Mesh2d.defaultFragmentShader),
                pluginName: 'batch2d'
            }), null, drawMode) || this;
            _this.autoUpdate = true;
            _this.geometry.getBuffer('aVertexPosition').static = false;
            return _this;
        }
        Object.defineProperty(SimpleMesh3d2d.prototype, "vertices", {
            get: function () {
                return this.geometry.getBuffer('aVertexPosition').data;
            },
            set: function (value) {
                this.geometry.getBuffer('aVertexPosition').data = value;
            },
            enumerable: true,
            configurable: true
        });
        SimpleMesh3d2d.prototype._render = function (renderer) {
            if (this.autoUpdate) {
                this.geometry.getBuffer('aVertexPosition').update();
            }
            _super.prototype._render.call(this, renderer);
        };
        return SimpleMesh3d2d;
    }(Mesh3d2d));
    pixi_projection.SimpleMesh3d2d = SimpleMesh3d2d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Sprite3d = (function (_super) {
        __extends(Sprite3d, _super);
        function Sprite3d(texture) {
            var _this = _super.call(this, texture) || this;
            _this.vertexData2d = null;
            _this.culledByFrustrum = false;
            _this.trimmedCulledByFrustrum = false;
            _this.proj = new pixi_projection.Projection3d(_this.transform);
            _this.pluginName = 'batch2d';
            return _this;
        }
        Sprite3d.prototype.calculateVertices = function () {
            var texture = this._texture;
            if (this.proj._affine) {
                this.vertexData2d = null;
                _super.prototype.calculateVertices.call(this);
                return;
            }
            if (!this.vertexData2d) {
                this.vertexData2d = new Float32Array(12);
            }
            var wid = this.transform._worldID;
            var tuid = texture._updateID;
            if (this._transformID === wid && this._textureID === tuid) {
                return;
            }
            if (this._textureID !== tuid) {
                this.uvs = texture._uvs.uvsFloat32;
            }
            this._transformID = wid;
            this._textureID = tuid;
            var wt = this.proj.world.mat4;
            var vertexData2d = this.vertexData2d;
            var vertexData = this.vertexData;
            var trim = texture.trim;
            var orig = texture.orig;
            var anchor = this._anchor;
            var w0 = 0;
            var w1 = 0;
            var h0 = 0;
            var h1 = 0;
            if (trim) {
                w1 = trim.x - (anchor._x * orig.width);
                w0 = w1 + trim.width;
                h1 = trim.y - (anchor._y * orig.height);
                h0 = h1 + trim.height;
            }
            else {
                w1 = -anchor._x * orig.width;
                w0 = w1 + orig.width;
                h1 = -anchor._y * orig.height;
                h0 = h1 + orig.height;
            }
            var culled = false;
            var z;
            vertexData2d[0] = (wt[0] * w1) + (wt[4] * h1) + wt[12];
            vertexData2d[1] = (wt[1] * w1) + (wt[5] * h1) + wt[13];
            z = (wt[2] * w1) + (wt[6] * h1) + wt[14];
            vertexData2d[2] = (wt[3] * w1) + (wt[7] * h1) + wt[15];
            culled = culled || z < 0;
            vertexData2d[3] = (wt[0] * w0) + (wt[4] * h1) + wt[12];
            vertexData2d[4] = (wt[1] * w0) + (wt[5] * h1) + wt[13];
            z = (wt[2] * w0) + (wt[6] * h1) + wt[14];
            vertexData2d[5] = (wt[3] * w0) + (wt[7] * h1) + wt[15];
            culled = culled || z < 0;
            vertexData2d[6] = (wt[0] * w0) + (wt[4] * h0) + wt[12];
            vertexData2d[7] = (wt[1] * w0) + (wt[5] * h0) + wt[13];
            z = (wt[2] * w0) + (wt[6] * h0) + wt[14];
            vertexData2d[8] = (wt[3] * w0) + (wt[7] * h0) + wt[15];
            culled = culled || z < 0;
            vertexData2d[9] = (wt[0] * w1) + (wt[4] * h0) + wt[12];
            vertexData2d[10] = (wt[1] * w1) + (wt[5] * h0) + wt[13];
            z = (wt[2] * w1) + (wt[6] * h0) + wt[14];
            vertexData2d[11] = (wt[3] * w1) + (wt[7] * h0) + wt[15];
            culled = culled || z < 0;
            this.culledByFrustrum = culled;
            vertexData[0] = vertexData2d[0] / vertexData2d[2];
            vertexData[1] = vertexData2d[1] / vertexData2d[2];
            vertexData[2] = vertexData2d[3] / vertexData2d[5];
            vertexData[3] = vertexData2d[4] / vertexData2d[5];
            vertexData[4] = vertexData2d[6] / vertexData2d[8];
            vertexData[5] = vertexData2d[7] / vertexData2d[8];
            vertexData[6] = vertexData2d[9] / vertexData2d[11];
            vertexData[7] = vertexData2d[10] / vertexData2d[11];
        };
        Sprite3d.prototype.calculateTrimmedVertices = function () {
            if (this.proj._affine) {
                _super.prototype.calculateTrimmedVertices.call(this);
                return;
            }
            var wid = this.transform._worldID;
            var tuid = this._texture._updateID;
            if (!this.vertexTrimmedData) {
                this.vertexTrimmedData = new Float32Array(8);
            }
            else if (this._transformTrimmedID === wid && this._textureTrimmedID === tuid) {
                return;
            }
            this._transformTrimmedID = wid;
            this._textureTrimmedID = tuid;
            var texture = this._texture;
            var vertexData = this.vertexTrimmedData;
            var orig = texture.orig;
            var anchor = this._anchor;
            var wt = this.proj.world.mat4;
            var w1 = -anchor._x * orig.width;
            var w0 = w1 + orig.width;
            var h1 = -anchor._y * orig.height;
            var h0 = h1 + orig.height;
            var culled = false;
            var z;
            var w = 1.0 / ((wt[3] * w1) + (wt[7] * h1) + wt[15]);
            vertexData[0] = w * ((wt[0] * w1) + (wt[4] * h1) + wt[12]);
            vertexData[1] = w * ((wt[1] * w1) + (wt[5] * h1) + wt[13]);
            z = (wt[2] * w1) + (wt[6] * h1) + wt[14];
            culled = culled || z < 0;
            w = 1.0 / ((wt[3] * w0) + (wt[7] * h1) + wt[15]);
            vertexData[2] = w * ((wt[0] * w0) + (wt[4] * h1) + wt[12]);
            vertexData[3] = w * ((wt[1] * w0) + (wt[5] * h1) + wt[13]);
            z = (wt[2] * w0) + (wt[6] * h1) + wt[14];
            culled = culled || z < 0;
            w = 1.0 / ((wt[3] * w0) + (wt[7] * h0) + wt[15]);
            vertexData[4] = w * ((wt[0] * w0) + (wt[4] * h0) + wt[12]);
            vertexData[5] = w * ((wt[1] * w0) + (wt[5] * h0) + wt[13]);
            z = (wt[2] * w0) + (wt[6] * h0) + wt[14];
            culled = culled || z < 0;
            w = 1.0 / ((wt[3] * w1) + (wt[7] * h0) + wt[15]);
            vertexData[6] = w * ((wt[0] * w1) + (wt[4] * h0) + wt[12]);
            vertexData[7] = w * ((wt[1] * w1) + (wt[5] * h0) + wt[13]);
            z = (wt[2] * w1) + (wt[6] * h0) + wt[14];
            culled = culled || z < 0;
            this.culledByFrustrum = culled;
        };
        Sprite3d.prototype._calculateBounds = function () {
            this.calculateVertices();
            if (this.culledByFrustrum) {
                return;
            }
            var trim = this._texture.trim;
            var orig = this._texture.orig;
            if (!trim || (trim.width === orig.width && trim.height === orig.height)) {
                this._bounds.addQuad(this.vertexData);
                return;
            }
            this.calculateTrimmedVertices();
            if (!this.trimmedCulledByFrustrum) {
                this._bounds.addQuad(this.vertexTrimmedData);
            }
        };
        Sprite3d.prototype._render = function (renderer) {
            this.calculateVertices();
            if (this.culledByFrustrum) {
                return;
            }
            renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
            renderer.plugins[this.pluginName].render(this);
        };
        Sprite3d.prototype.containsPoint = function (point) {
            if (this.culledByFrustrum) {
                return false;
            }
            return _super.prototype.containsPoint.call(this, point);
        };
        Object.defineProperty(Sprite3d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        Sprite3d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container3dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        Sprite3d.prototype.isFrontFace = function (forceUpdate) {
            return pixi_projection.container3dIsFrontFace.call(this, forceUpdate);
        };
        Sprite3d.prototype.getDepth = function (forceUpdate) {
            return pixi_projection.container3dGetDepth.call(this, forceUpdate);
        };
        Object.defineProperty(Sprite3d.prototype, "position3d", {
            get: function () {
                return this.proj.position;
            },
            set: function (value) {
                this.proj.position.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Sprite3d.prototype, "scale3d", {
            get: function () {
                return this.proj.scale;
            },
            set: function (value) {
                this.proj.scale.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Sprite3d.prototype, "euler", {
            get: function () {
                return this.proj.euler;
            },
            set: function (value) {
                this.proj.euler.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Sprite3d.prototype, "pivot3d", {
            get: function () {
                return this.proj.pivot;
            },
            set: function (value) {
                this.proj.pivot.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        return Sprite3d;
    }(PIXI.Sprite));
    pixi_projection.Sprite3d = Sprite3d;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var Text3d = (function (_super) {
        __extends(Text3d, _super);
        function Text3d(text, style, canvas) {
            var _this = _super.call(this, text, style, canvas) || this;
            _this.vertexData2d = null;
            _this.proj = new pixi_projection.Projection3d(_this.transform);
            _this.pluginName = 'batch2d';
            return _this;
        }
        Object.defineProperty(Text3d.prototype, "worldTransform", {
            get: function () {
                return this.proj.affine ? this.transform.worldTransform : this.proj.world;
            },
            enumerable: true,
            configurable: true
        });
        Text3d.prototype.toLocal = function (position, from, point, skipUpdate, step) {
            if (step === void 0) { step = pixi_projection.TRANSFORM_STEP.ALL; }
            return pixi_projection.container3dToLocal.call(this, position, from, point, skipUpdate, step);
        };
        Text3d.prototype.isFrontFace = function (forceUpdate) {
            return pixi_projection.container3dIsFrontFace.call(this, forceUpdate);
        };
        Text3d.prototype.getDepth = function (forceUpdate) {
            return pixi_projection.container3dGetDepth.call(this, forceUpdate);
        };
        Object.defineProperty(Text3d.prototype, "position3d", {
            get: function () {
                return this.proj.position;
            },
            set: function (value) {
                this.proj.position.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Text3d.prototype, "scale3d", {
            get: function () {
                return this.proj.scale;
            },
            set: function (value) {
                this.proj.scale.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Text3d.prototype, "euler", {
            get: function () {
                return this.proj.euler;
            },
            set: function (value) {
                this.proj.euler.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Text3d.prototype, "pivot3d", {
            get: function () {
                return this.proj.pivot;
            },
            set: function (value) {
                this.proj.pivot.copyFrom(value);
            },
            enumerable: true,
            configurable: true
        });
        return Text3d;
    }(PIXI.Text));
    pixi_projection.Text3d = Text3d;
    Text3d.prototype.calculateVertices = pixi_projection.Sprite3d.prototype.calculateVertices;
    Text3d.prototype.calculateTrimmedVertices = pixi_projection.Sprite3d.prototype.calculateTrimmedVertices;
    Text3d.prototype._calculateBounds = pixi_projection.Sprite3d.prototype._calculateBounds;
    Text3d.prototype.containsPoint = pixi_projection.Sprite3d.prototype.containsPoint;
    Text3d.prototype._render = pixi_projection.Sprite3d.prototype._render;
})(pixi_projection || (pixi_projection = {}));
var pixi_projection;
(function (pixi_projection) {
    var containerProps = {
        worldTransform: {
            get: pixi_projection.container3dWorldTransform,
            enumerable: true,
            configurable: true
        },
        position3d: {
            get: function () { return this.proj.position; },
            set: function (value) { this.proj.position.copy(value); }
        },
        scale3d: {
            get: function () { return this.proj.scale; },
            set: function (value) { this.proj.scale.copy(value); }
        },
        pivot3d: {
            get: function () { return this.proj.pivot; },
            set: function (value) { this.proj.pivot.copy(value); }
        },
        euler: {
            get: function () { return this.proj.euler; },
            set: function (value) { this.proj.euler.copy(value); }
        }
    };
    function convertTo3d() {
        if (this.proj)
            return;
        this.proj = new pixi_projection.Projection3d(this.transform);
        this.toLocal = pixi_projection.Container3d.prototype.toLocal;
        this.isFrontFace = pixi_projection.Container3d.prototype.isFrontFace;
        this.getDepth = pixi_projection.Container3d.prototype.getDepth;
        Object.defineProperties(this, containerProps);
    }
    PIXI.Container.prototype.convertTo3d = convertTo3d;
    PIXI.Sprite.prototype.convertTo3d = function () {
        if (this.proj)
            return;
        this.calculateVertices = pixi_projection.Sprite3d.prototype.calculateVertices;
        this.calculateTrimmedVertices = pixi_projection.Sprite3d.prototype.calculateTrimmedVertices;
        this._calculateBounds = pixi_projection.Sprite3d.prototype._calculateBounds;
        this.containsPoint = pixi_projection.Sprite3d.prototype.containsPoint;
        this.pluginName = 'batch2d';
        convertTo3d.call(this);
    };
    PIXI.Container.prototype.convertSubtreeTo3d = function () {
        this.convertTo3d();
        for (var i = 0; i < this.children.length; i++) {
            this.children[i].convertSubtreeTo3d();
        }
    };
    if (PIXI.SimpleMesh) {
        PIXI.SimpleMesh.prototype.convertTo3d =
            PIXI.SimpleRope.prototype.convertTo3d =
                function () {
                    if (this.proj)
                        return;
                    this.calculateVertices = pixi_projection.Mesh3d2d.prototype.calculateVertices;
                    this._renderDefault = pixi_projection.Mesh3d2d.prototype._renderDefault;
                    if (this.material.pluginName !== 'batch2d') {
                        this.material = new PIXI.MeshMaterial(this.material.texture, {
                            program: PIXI.Program.from(pixi_projection.Mesh2d.defaultVertexShader, pixi_projection.Mesh2d.defaultFragmentShader),
                            pluginName: 'batch2d'
                        });
                    }
                    convertTo3d.call(this);
                };
    }
})(pixi_projection || (pixi_projection = {}));

/*!
 * VERSION: 2.1.3
 * DATE: 2019-05-17
 * UPDATES AND DOCS AT: http://greensock.com
 * 
 * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
 *
 * @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
 * This work is subject to the terms at http://greensock.com/standard-license or for
 * Club GreenSock members, the software agreement that was issued with your membership.
 * 
 * @author: Jack Doyle, jack@greensock.com
 **/
/* eslint-disable */
var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {

	"use strict";

	_gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {

		var _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
				var b = [],
					l = a.length,
					i;
				for (i = 0; i !== l; b.push(a[i++]));
				return b;
			},
			_applyCycle = function(vars, targets, i) {
				var alt = vars.cycle,
					p, val;
				for (p in alt) {
					val = alt[p];
					vars[p] = (typeof(val) === "function") ? val(i, targets[i], targets) : val[i % val.length];
				}
				delete vars.cycle;
			},
			//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
			_distribute = function(v) {
				if (typeof(v) === "function") {
					return v;
				}
				var vars = (typeof(v) === "object") ? v : {each:v}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
					ease = vars.ease,
					from = vars.from || 0,
					base = vars.base || 0,
					cache = {},
					isFromKeyword = isNaN(from),
					axis = vars.axis,
					ratio = {center:0.5, end:1}[from] || 0;
				return function(i, target, a) {
					var l = (a || vars).length,
						distances = cache[l],
						originX, originY, x, y, d, j, max, min, wrap;
					if (!distances) {
						wrap = (vars.grid === "auto") ? 0 : (vars.grid || [Infinity])[0];
						if (!wrap) {
							max = -Infinity;
							while (max < (max = a[wrap++].getBoundingClientRect().left) && wrap < l) { }
							wrap--;
						}
						distances = cache[l] = [];
						originX = isFromKeyword ? (Math.min(wrap, l) * ratio) - 0.5 : from % wrap;
						originY = isFromKeyword ? l * ratio / wrap - 0.5 : (from / wrap) | 0;
						max = 0;
						min = Infinity;
						for (j = 0; j < l; j++) {
							x = (j % wrap) - originX;
							y = originY - ((j / wrap) | 0);
							distances[j] = d = !axis ? Math.sqrt(x * x + y * y) : Math.abs((axis === "y") ? y : x);
							if (d > max) {
								max = d;
							}
							if (d < min) {
								min = d;
							}
						}
						distances.max = max - min;
						distances.min = min;
						distances.v = l = vars.amount || (vars.each * (wrap > l ? l - 1 : !axis ? Math.max(wrap, l / wrap) : axis === "y" ? l / wrap : wrap)) || 0;
						distances.b = (l < 0) ? base - l : base;
					}
					l = (distances[i] - distances.min) / distances.max;
					return distances.b + (ease ? ease.getRatio(l) : l) * distances.v;
				};
			},
			TweenMax = function(target, duration, vars) {
				TweenLite.call(this, target, duration, vars);
				this._cycle = 0;
				this._yoyo = (this.vars.yoyo === true || !!this.vars.yoyoEase);
				this._repeat = this.vars.repeat || 0;
				this._repeatDelay = this.vars.repeatDelay || 0;
				if (this._repeat) {
					this._uncache(true); //ensures that if there is any repeat, the totalDuration will get recalculated to accurately report it.
				}
				this.render = TweenMax.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method)
			},
			_tinyNum = 0.00000001,
			TweenLiteInternals = TweenLite._internals,
			_isSelector = TweenLiteInternals.isSelector,
			_isArray = TweenLiteInternals.isArray,
			p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
			_blankArray = [];

		TweenMax.version = "2.1.3";
		p.constructor = TweenMax;
		p.kill()._gc = false;
		TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
		TweenMax.getTweensOf = TweenLite.getTweensOf;
		TweenMax.lagSmoothing = TweenLite.lagSmoothing;
		TweenMax.ticker = TweenLite.ticker;
		TweenMax.render = TweenLite.render;
		TweenMax.distribute = _distribute;

		p.invalidate = function() {
			this._yoyo = (this.vars.yoyo === true || !!this.vars.yoyoEase);
			this._repeat = this.vars.repeat || 0;
			this._repeatDelay = this.vars.repeatDelay || 0;
			this._yoyoEase = null;
			this._uncache(true);
			return TweenLite.prototype.invalidate.call(this);
		};
		
		p.updateTo = function(vars, resetDuration) {
			var self = this,
				curRatio = self.ratio,
				immediate = self.vars.immediateRender || vars.immediateRender,
				p;
			if (resetDuration && self._startTime < self._timeline._time) {
				self._startTime = self._timeline._time;
				self._uncache(false);
				if (self._gc) {
					self._enabled(true, false);
				} else {
					self._timeline.insert(self, self._startTime - self._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct.
				}
			}
			for (p in vars) {
				self.vars[p] = vars[p];
			}
			if (self._initted || immediate) {
				if (resetDuration) {
					self._initted = false;
					if (immediate) {
						self.render(0, true, true);
					}
				} else {
					if (self._gc) {
						self._enabled(true, false);
					}
					if (self._notifyPluginsOfEnabled && self._firstPT) {
						TweenLite._onPluginEvent("_onDisable", self); //in case a plugin like MotionBlur must perform some cleanup tasks
					}
					if (self._time / self._duration > 0.998) { //if the tween has finished (or come extremely close to finishing), we just need to rewind it to 0 and then render it again at the end which forces it to re-initialize (parsing the new vars). We allow tweens that are close to finishing (but haven't quite finished) to work this way too because otherwise, the values are so small when determining where to project the starting values that binary math issues creep in and can make the tween appear to render incorrectly when run backwards.
						var prevTime = self._totalTime;
						self.render(0, true, false);
						self._initted = false;
						self.render(prevTime, true, false);
					} else {
						self._initted = false;
						self._init();
						if (self._time > 0 || immediate) {
							var inv = 1 / (1 - curRatio),
								pt = self._firstPT, endValue;
							while (pt) {
								endValue = pt.s + pt.c;
								pt.c *= inv;
								pt.s = endValue - pt.c;
								pt = pt._next;
							}
						}
					}
				}
			}
			return self;
		};
				
		p.render = function(time, suppressEvents, force) {
			if (!this._initted) if (this._duration === 0 && this.vars.repeat) { //zero duration tweens that render immediately have render() called from TweenLite's constructor, before TweenMax's constructor has finished setting _repeat, _repeatDelay, and _yoyo which are critical in determining totalDuration() so we need to call invalidate() which is a low-kb way to get those set properly.
				this.invalidate();
			}
			var self = this,
				totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(),
				prevTime = self._time,
				prevTotalTime = self._totalTime,
				prevCycle = self._cycle,
				duration = self._duration,
				prevRawPrevTime = self._rawPrevTime,
				isComplete, callback, pt, cycleDuration, r, type, pow, rawPrevTime, yoyoEase;
			if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				self._totalTime = totalDur;
				self._cycle = self._repeat;
				if (self._yoyo && (self._cycle & 1) !== 0) {
					self._time = 0;
					self.ratio = self._ease._calcEnd ? self._ease.getRatio(0) : 0;
				} else {
					self._time = duration;
					self.ratio = self._ease._calcEnd ? self._ease.getRatio(1) : 1;
				}
				if (!self._reversed) {
					isComplete = true;
					callback = "onComplete";
					force = (force || self._timeline.autoRemoveChildren); //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
				}
				if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
					if (self._startTime === self._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate.
						time = 0;
					}
					if (prevRawPrevTime < 0 || (time <= 0 && time >= -_tinyNum) || (prevRawPrevTime === _tinyNum && self.data !== "isPause")) if (prevRawPrevTime !== time) { //note: when this.data is "isPause", it's a callback added by addPause() on a timeline that we should not be triggered when LEAVING its exact start time. In other words, tl.addPause(1).play(1) shouldn't pause.
						force = true;
						if (prevRawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
					self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				}
				
			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				self._totalTime = self._time = self._cycle = 0;
				self.ratio = self._ease._calcEnd ? self._ease.getRatio(0) : 0;
				if (prevTotalTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) {
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time > -_tinyNum) {
					time = 0;
				} else if (time < 0) {
					self._active = false;
					if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
						if (prevRawPrevTime >= 0) {
							force = true;
						}
						self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					}
				}
				if (!self._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
					force = true;
				}
			} else {
				self._totalTime = self._time = time;
				if (self._repeat !== 0) {
					cycleDuration = duration + self._repeatDelay;
					self._cycle = (self._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!)
					if (self._cycle !== 0) if (self._cycle === self._totalTime / cycleDuration && prevTotalTime <= time) {
						self._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
					}
					self._time = self._totalTime - (self._cycle * cycleDuration);
					if (self._yoyo) if ((self._cycle & 1) !== 0) {
						self._time = duration - self._time;
						yoyoEase = self._yoyoEase || self.vars.yoyoEase; //note: we don't set this._yoyoEase in _init() like we do other properties because it's TweenMax-specific and doing it here allows us to optimize performance (most tweens don't have a yoyoEase). Note that we also must skip the this.ratio calculation further down right after we _init() in this function, because we're doing it here.
						if (yoyoEase) {
							if (!self._yoyoEase) {
								if (yoyoEase === true && !self._initted) { //if it's not initted and yoyoEase is true, this._ease won't have been populated yet so we must discern it here.
									yoyoEase = self.vars.ease;
									self._yoyoEase = yoyoEase = !yoyoEase ? TweenLite.defaultEase : (yoyoEase instanceof Ease) ? yoyoEase : (typeof(yoyoEase) === "function") ? new Ease(yoyoEase, self.vars.easeParams) : Ease.map[yoyoEase] || TweenLite.defaultEase;
								} else {
									self._yoyoEase = yoyoEase = (yoyoEase === true) ? self._ease : (yoyoEase instanceof Ease) ? yoyoEase : Ease.map[yoyoEase];
								}
							}
							self.ratio = yoyoEase ? 1 - yoyoEase.getRatio((duration - self._time) / duration) : 0;
						}
					}
					if (self._time > duration) {
						self._time = duration;
					} else if (self._time < 0) {
						self._time = 0;
					}
				}
				if (self._easeType && !yoyoEase) {
					r = self._time / duration;
					type = self._easeType;
					pow = self._easePower;
					if (type === 1 || (type === 3 && r >= 0.5)) {
						r = 1 - r;
					}
					if (type === 3) {
						r *= 2;
					}
					if (pow === 1) {
						r *= r;
					} else if (pow === 2) {
						r *= r * r;
					} else if (pow === 3) {
						r *= r * r * r;
					} else if (pow === 4) {
						r *= r * r * r * r;
					}
					self.ratio = (type === 1) ? 1 - r : (type === 2) ? r : (self._time / duration < 0.5) ? r / 2 : 1 - (r / 2);

				} else if (!yoyoEase) {
					self.ratio = self._ease.getRatio(self._time / duration);
				}
				
			}
				
			if (prevTime === self._time && !force && prevCycle === self._cycle) {
				if (prevTotalTime !== self._totalTime) if (self._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
					self._callback("onUpdate");
				}
				return;
			} else if (!self._initted) {
				self._init();
				if (!self._initted || self._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
					return;
				} else if (!force && self._firstPT && ((self.vars.lazy !== false && self._duration) || (self.vars.lazy && !self._duration))) { //we stick it in the queue for rendering at the very end of the tick - this is a performance optimization because browsers invalidate styles and force a recalculation if you read, write, and then read style data (so it's better to read/read/read/write/write/write than read/write/read/write/read/write). The down side, of course, is that usually you WANT things to render immediately because you may have code running right after that which depends on the change. Like imagine running TweenLite.set(...) and then immediately after that, creating a nother tween that animates the same property to another value; the starting values of that 2nd tween wouldn't be accurate if lazy is true.
					self._time = prevTime;
					self._totalTime = prevTotalTime;
					self._rawPrevTime = prevRawPrevTime;
					self._cycle = prevCycle;
					TweenLiteInternals.lazyTweens.push(self);
					self._lazy = [time, suppressEvents];
					return;
				}
				//_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
				if (self._time && !isComplete && !yoyoEase) {
					self.ratio = self._ease.getRatio(self._time / duration);
				} else if (isComplete && this._ease._calcEnd && !yoyoEase) {
					self.ratio = self._ease.getRatio((self._time === 0) ? 0 : 1);
				}
			}
			if (self._lazy !== false) {
				self._lazy = false;
			}

			if (!self._active) if (!self._paused && self._time !== prevTime && time >= 0) {
				self._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
			}
			if (prevTotalTime === 0) {
				if (self._initted === 2 && time > 0) {
					self._init(); //will just apply overwriting since _initted of (2) means it was a from() tween that had immediateRender:true
				}
				if (self._startAt) {
					if (time >= 0) {
						self._startAt.render(time, true, force);
					} else if (!callback) {
						callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area.
					}
				}
				if (self.vars.onStart) if (self._totalTime !== 0 || duration === 0) if (!suppressEvents) {
					self._callback("onStart");
				}
			}
			
			pt = self._firstPT;
			while (pt) {
				if (pt.f) {
					pt.t[pt.p](pt.c * self.ratio + pt.s);
				} else {
					pt.t[pt.p] = pt.c * self.ratio + pt.s;
				}
				pt = pt._next;
			}
			
			if (self._onUpdate) {
				if (time < 0) if (self._startAt && self._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
					self._startAt.render(time, true, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
				}
				if (!suppressEvents) if (self._totalTime !== prevTotalTime || callback) {
					self._callback("onUpdate");
				}
			}
			if (self._cycle !== prevCycle) if (!suppressEvents) if (!self._gc) if (self.vars.onRepeat) {
				self._callback("onRepeat");
			}
			if (callback) if (!self._gc || force) { //check gc because there's a chance that kill() could be called in an onUpdate
				if (time < 0 && self._startAt && !self._onUpdate && self._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
					self._startAt.render(time, true, force);
				}
				if (isComplete) {
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
				if (duration === 0 && self._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
					self._rawPrevTime = 0;
				}
			}
		};
		
//---- STATIC FUNCTIONS -----------------------------------------------------------------------------------------------------------
		
		TweenMax.to = function(target, duration, vars) {
			return new TweenMax(target, duration, vars);
		};
		
		TweenMax.from = function(target, duration, vars) {
			vars.runBackwards = true;
			vars.immediateRender = (vars.immediateRender != false);
			return new TweenMax(target, duration, vars);
		};
		
		TweenMax.fromTo = function(target, duration, fromVars, toVars) {
			toVars.startAt = fromVars;
			toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
			return new TweenMax(target, duration, toVars);
		};

		TweenMax.staggerTo = TweenMax.allTo = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			var a = [],
				staggerFunc = _distribute(vars.stagger || stagger),
				cycle = vars.cycle,
				fromCycle = (vars.startAt || _blankArray).cycle,
				l, copy, i, p;
			if (!_isArray(targets)) {
				if (typeof(targets) === "string") {
					targets = TweenLite.selector(targets) || targets;
				}
				if (_isSelector(targets)) {
					targets = _slice(targets);
				}
			}
			targets = targets || [];
			l = targets.length - 1;
			for (i = 0; i <= l; i++) {
				copy = {};
				for (p in vars) {
					copy[p] = vars[p];
				}
				if (cycle) {
					_applyCycle(copy, targets, i);
					if (copy.duration != null) {
						duration = copy.duration;
						delete copy.duration;
					}
				}
				if (fromCycle) {
					fromCycle = copy.startAt = {};
					for (p in vars.startAt) {
						fromCycle[p] = vars.startAt[p];
					}
					_applyCycle(copy.startAt, targets, i);
				}
				copy.delay = staggerFunc(i, targets[i], targets) + (copy.delay || 0);
				if (i === l && onCompleteAll) {
					copy.onComplete = function() {
						if (vars.onComplete) {
							vars.onComplete.apply(vars.onCompleteScope || this, arguments);
						}
						onCompleteAll.apply(onCompleteAllScope || vars.callbackScope || this, onCompleteAllParams || _blankArray);
					};
				}
				a[i] = new TweenMax(targets[i], duration, copy);
			}
			return a;
		};
		
		TweenMax.staggerFrom = TweenMax.allFrom = function(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			vars.runBackwards = true;
			vars.immediateRender = (vars.immediateRender != false);
			return TweenMax.staggerTo(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};
		
		TweenMax.staggerFromTo = TweenMax.allFromTo = function(targets, duration, fromVars, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			toVars.startAt = fromVars;
			toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
			return TweenMax.staggerTo(targets, duration, toVars, stagger, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};
				
		TweenMax.delayedCall = function(delay, callback, params, scope, useFrames) {
			return new TweenMax(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, useFrames:useFrames, overwrite:0});
		};
		
		TweenMax.set = function(target, vars) {
			return new TweenMax(target, 0, vars);
		};
		
		TweenMax.isTweening = function(target) {
			return (TweenLite.getTweensOf(target, true).length > 0);
		};
		
		var _getChildrenOf = function(timeline, includeTimelines) {
				var a = [],
					cnt = 0,
					tween = timeline._first;
				while (tween) {
					if (tween instanceof TweenLite) {
						a[cnt++] = tween;
					} else {
						if (includeTimelines) {
							a[cnt++] = tween;
						}
						a = a.concat(_getChildrenOf(tween, includeTimelines));
						cnt = a.length;
					}
					tween = tween._next;
				}
				return a;
			}, 
			getAllTweens = TweenMax.getAllTweens = function(includeTimelines) {
				return _getChildrenOf(Animation._rootTimeline, includeTimelines).concat( _getChildrenOf(Animation._rootFramesTimeline, includeTimelines) );
			};
		
		TweenMax.killAll = function(complete, tweens, delayedCalls, timelines) {
			if (tweens == null) {
				tweens = true;
			}
			if (delayedCalls == null) {
				delayedCalls = true;
			}
			var a = getAllTweens((timelines != false)),
				l = a.length,
				allTrue = (tweens && delayedCalls && timelines),
				isDC, tween, i;
			for (i = 0; i < l; i++) {
				tween = a[i];
				if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {
					if (complete) {
						tween.totalTime(tween._reversed ? 0 : tween.totalDuration());
					} else {
						tween._enabled(false, false);
					}
				}
			}
		};
		
		TweenMax.killChildTweensOf = function(parent, complete) {
			if (parent == null) {
				return;
			}
			var tl = TweenLiteInternals.tweenLookup,
				a, curParent, p, i, l;
			if (typeof(parent) === "string") {
				parent = TweenLite.selector(parent) || parent;
			}
			if (_isSelector(parent)) {
				parent = _slice(parent);
			}
			if (_isArray(parent)) {
				i = parent.length;
				while (--i > -1) {
					TweenMax.killChildTweensOf(parent[i], complete);
				}
				return;
			}
			a = [];
			for (p in tl) {
				curParent = tl[p].target.parentNode;
				while (curParent) {
					if (curParent === parent) {
						a = a.concat(tl[p].tweens);
					}
					curParent = curParent.parentNode;
				}
			}
			l = a.length;
			for (i = 0; i < l; i++) {
				if (complete) {
					a[i].totalTime(a[i].totalDuration());
				}
				a[i]._enabled(false, false);
			}
		};

		var _changePause = function(pause, tweens, delayedCalls, timelines) {
			tweens = (tweens !== false);
			delayedCalls = (delayedCalls !== false);
			timelines = (timelines !== false);
			var a = getAllTweens(timelines),
				allTrue = (tweens && delayedCalls && timelines),
				i = a.length,
				isDC, tween;
			while (--i > -1) {
				tween = a[i];
				if (allTrue || (tween instanceof SimpleTimeline) || ((isDC = (tween.target === tween.vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {
					tween.paused(pause);
				}
			}
		};
		
		TweenMax.pauseAll = function(tweens, delayedCalls, timelines) {
			_changePause(true, tweens, delayedCalls, timelines);
		};
		
		TweenMax.resumeAll = function(tweens, delayedCalls, timelines) {
			_changePause(false, tweens, delayedCalls, timelines);
		};

		TweenMax.globalTimeScale = function(value) {
			var tl = Animation._rootTimeline,
				t = TweenLite.ticker.time;
			if (!arguments.length) {
				return tl._timeScale;
			}
			value = value || _tinyNum; //can't allow zero because it'll throw the math off
			tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value);
			tl = Animation._rootFramesTimeline;
			t = TweenLite.ticker.frame;
			tl._startTime = t - ((t - tl._startTime) * tl._timeScale / value);
			tl._timeScale = Animation._rootTimeline._timeScale = value;
			return value;
		};
		
	
//---- GETTERS / SETTERS ----------------------------------------------------------------------------------------------------------
		
		p.progress = function(value, suppressEvents) {
			return (!arguments.length) ? (this.duration() ? this._time / this._duration : this.ratio) : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents);
		};
		
		p.totalProgress = function(value, suppressEvents) {
			return (!arguments.length) ? this._totalTime / this.totalDuration() : this.totalTime( this.totalDuration() * value, suppressEvents);
		};
		
		p.time = function(value, suppressEvents) {
			if (!arguments.length) {
				return this._time;
			}
			if (this._dirty) {
				this.totalDuration();
			}
			var duration = this._duration,
				cycle = this._cycle,
				cycleDur = cycle * (duration + this._repeatDelay);
			if (value > duration) {
				value = duration;
			}
			return this.totalTime((this._yoyo && (cycle & 1)) ? duration - value + cycleDur : this._repeat ? value + cycleDur : value, suppressEvents);
		};

		p.duration = function(value) {
			if (!arguments.length) {
				return this._duration; //don't set _dirty = false because there could be repeats that haven't been factored into the _totalDuration yet. Otherwise, if you create a repeated TweenMax and then immediately check its duration(), it would cache the value and the totalDuration would not be correct, thus repeats wouldn't take effect.
			}
			return Animation.prototype.duration.call(this, value);
		};

		p.totalDuration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					//instead of Infinity, we use 999999999999 so that we can accommodate reverses
					this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat);
					this._dirty = false;
				}
				return this._totalDuration;
			}
			return (this._repeat === -1) ? this : this.duration( (value - (this._repeat * this._repeatDelay)) / (this._repeat + 1) );
		};
		
		p.repeat = function(value) {
			if (!arguments.length) {
				return this._repeat;
			}
			this._repeat = value;
			return this._uncache(true);
		};
		
		p.repeatDelay = function(value) {
			if (!arguments.length) {
				return this._repeatDelay;
			}
			this._repeatDelay = value;
			return this._uncache(true);
		};
		
		p.yoyo = function(value) {
			if (!arguments.length) {
				return this._yoyo;
			}
			this._yoyo = value;
			return this;
		};
		
		
		return TweenMax;
		
	}, true);








/*
 * ----------------------------------------------------------------
 * TimelineLite
 * ----------------------------------------------------------------
 */
	_gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {

		var TimelineLite = function(vars) {
				SimpleTimeline.call(this, vars);
				var self = this,
					v = self.vars,
					val, p;
				self._labels = {};
				self.autoRemoveChildren = !!v.autoRemoveChildren;
				self.smoothChildTiming = !!v.smoothChildTiming;
				self._sortChildren = true;
				self._onUpdate = v.onUpdate;
				for (p in v) {
					val = v[p];
					if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) {
						v[p] = self._swapSelfInParams(val);
					}
				}
				if (_isArray(v.tweens)) {
					self.add(v.tweens, 0, v.align, v.stagger);
				}
			},
			_tinyNum = 0.00000001,
			TweenLiteInternals = TweenLite._internals,
			_internals = TimelineLite._internals = {},
			_isSelector = TweenLiteInternals.isSelector,
			_isArray = TweenLiteInternals.isArray,
			_lazyTweens = TweenLiteInternals.lazyTweens,
			_lazyRender = TweenLiteInternals.lazyRender,
			_globals = _gsScope._gsDefine.globals,
			_copy = function(vars) {
				var copy = {}, p;
				for (p in vars) {
					copy[p] = vars[p];
				}
				return copy;
			},
			_applyCycle = function(vars, targets, i) {
				var alt = vars.cycle,
					p, val;
				for (p in alt) {
					val = alt[p];
					vars[p] = (typeof(val) === "function") ? val(i, targets[i], targets) : val[i % val.length];
				}
				delete vars.cycle;
			},
			_pauseCallback = _internals.pauseCallback = function() {},
			_slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
				var b = [],
					l = a.length,
					i;
				for (i = 0; i !== l; b.push(a[i++]));
				return b;
			},
			_defaultImmediateRender = function(tl, toVars, fromVars, defaultFalse) { //default to immediateRender:true unless otherwise set in toVars, fromVars or if defaultFalse is passed in as true
				var ir = "immediateRender";
				if (!(ir in toVars)) {
					toVars[ir] = !((fromVars && fromVars[ir] === false) || defaultFalse);
				}
				return toVars;
			},
			//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
			_distribute = function(v) {
				if (typeof(v) === "function") {
					return v;
				}
				var vars = (typeof(v) === "object") ? v : {each:v}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
					ease = vars.ease,
					from = vars.from || 0,
					base = vars.base || 0,
					cache = {},
					isFromKeyword = isNaN(from),
					axis = vars.axis,
					ratio = {center:0.5, end:1}[from] || 0;
				return function(i, target, a) {
					var l = (a || vars).length,
						distances = cache[l],
						originX, originY, x, y, d, j, max, min, wrap;
					if (!distances) {
						wrap = (vars.grid === "auto") ? 0 : (vars.grid || [Infinity])[0];
						if (!wrap) {
							max = -Infinity;
							while (max < (max = a[wrap++].getBoundingClientRect().left) && wrap < l) { }
							wrap--;
						}
						distances = cache[l] = [];
						originX = isFromKeyword ? (Math.min(wrap, l) * ratio) - 0.5 : from % wrap;
						originY = isFromKeyword ? l * ratio / wrap - 0.5 : (from / wrap) | 0;
						max = 0;
						min = Infinity;
						for (j = 0; j < l; j++) {
							x = (j % wrap) - originX;
							y = originY - ((j / wrap) | 0);
							distances[j] = d = !axis ? Math.sqrt(x * x + y * y) : Math.abs((axis === "y") ? y : x);
							if (d > max) {
								max = d;
							}
							if (d < min) {
								min = d;
							}
						}
						distances.max = max - min;
						distances.min = min;
						distances.v = l = vars.amount || (vars.each * (wrap > l ? l - 1 : !axis ? Math.max(wrap, l / wrap) : axis === "y" ? l / wrap : wrap)) || 0;
						distances.b = (l < 0) ? base - l : base;
					}
					l = (distances[i] - distances.min) / distances.max;
					return distances.b + (ease ? ease.getRatio(l) : l) * distances.v;
				};
			},
			p = TimelineLite.prototype = new SimpleTimeline();

		TimelineLite.version = "2.1.3";
		TimelineLite.distribute = _distribute;
		p.constructor = TimelineLite;
		p.kill()._gc = p._forcingPlayhead = p._hasPause = false;

		/* might use later...
		//translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
		function localToGlobal(time, animation) {
			while (animation) {
				time = (time / animation._timeScale) + animation._startTime;
				animation = animation.timeline;
			}
			return time;
		}

		//translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales
		function globalToLocal(time, animation) {
			var scale = 1;
			time -= localToGlobal(0, animation);
			while (animation) {
				scale *= animation._timeScale;
				animation = animation.timeline;
			}
			return time * scale;
		}
		*/

		p.to = function(target, duration, vars, position) {
			var Engine = (vars.repeat && _globals.TweenMax) || TweenLite;
			return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position);
		};

		p.from = function(target, duration, vars, position) {
			return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, _defaultImmediateRender(this, vars)), position);
		};

		p.fromTo = function(target, duration, fromVars, toVars, position) {
			var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite;
			toVars = _defaultImmediateRender(this, toVars, fromVars);
			return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position);
		};

		p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
				staggerFunc = _distribute(vars.stagger || stagger),
				startAt = vars.startAt,
				cycle = vars.cycle,
				copy, i;
			if (typeof(targets) === "string") {
				targets = TweenLite.selector(targets) || targets;
			}
			targets = targets || [];
			if (_isSelector(targets)) { //if the targets object is a selector, translate it into an array.
				targets = _slice(targets);
			}
			for (i = 0; i < targets.length; i++) {
				copy = _copy(vars);
				if (startAt) {
					copy.startAt = _copy(startAt);
					if (startAt.cycle) {
						_applyCycle(copy.startAt, targets, i);
					}
				}
				if (cycle) {
					_applyCycle(copy, targets, i);
					if (copy.duration != null) {
						duration = copy.duration;
						delete copy.duration;
					}
				}
				tl.to(targets[i], duration, copy, staggerFunc(i, targets[i], targets));
			}
			return this.add(tl, position);
		};

		p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			vars.runBackwards = true;
			return this.staggerTo(targets, duration, _defaultImmediateRender(this, vars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};

		p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			toVars.startAt = fromVars;
			return this.staggerTo(targets, duration, _defaultImmediateRender(this, toVars, fromVars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};

		p.call = function(callback, params, scope, position) {
			return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
		};

		p.set = function(target, vars, position) {
			return this.add( new TweenLite(target, 0, _defaultImmediateRender(this, vars, null, true)), position);
		};

		TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) {
			vars = vars || {};
			if (vars.smoothChildTiming == null) {
				vars.smoothChildTiming = true;
			}
			var tl = new TimelineLite(vars),
				root = tl._timeline,
				hasNegativeStart, time,	tween, next;
			if (ignoreDelayedCalls == null) {
				ignoreDelayedCalls = true;
			}
			root._remove(tl, true);
			tl._startTime = 0;
			tl._rawPrevTime = tl._time = tl._totalTime = root._time;
			tween = root._first;
			while (tween) {
				next = tween._next;
				if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) {
					time = tween._startTime - tween._delay;
					if (time < 0) {
						hasNegativeStart = 1;
					}
					tl.add(tween, time);
				}
				tween = next;
			}
			root.add(tl, 0);
			if (hasNegativeStart) { //calling totalDuration() will force the adjustment necessary to shift the children forward so none of them start before zero, and moves the timeline backwards the same amount, so the playhead is still aligned where it should be globally, but the timeline doesn't have illegal children that start before zero.
				tl.totalDuration();
			}
			return tl;
		};

		p.add = function(value, position, align, stagger) {
			var self = this,
				curTime, l, i, child, tl, beforeRawTime;
			if (typeof(position) !== "number") {
				position = self._parseTimeOrLabel(position, 0, true, value);
			}
			if (!(value instanceof Animation)) {
				if ((value instanceof Array) || (value && value.push && _isArray(value))) {
					align = align || "normal";
					stagger = stagger || 0;
					curTime = position;
					l = value.length;
					for (i = 0; i < l; i++) {
						if (_isArray(child = value[i])) {
							child = new TimelineLite({tweens:child});
						}
						self.add(child, curTime);
						if (typeof(child) !== "string" && typeof(child) !== "function") {
							if (align === "sequence") {
								curTime = child._startTime + (child.totalDuration() / child._timeScale);
							} else if (align === "start") {
								child._startTime -= child.delay();
							}
						}
						curTime += stagger;
					}
					return self._uncache(true);
				} else if (typeof(value) === "string") {
					return self.addLabel(value, position);
				} else if (typeof(value) === "function") {
					value = TweenLite.delayedCall(0, value);
				} else {
					throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string.");
				}
			}

			SimpleTimeline.prototype.add.call(self, value, position);

			if (value._time || (!value._duration && value._initted)) { //in case, for example, the _startTime is moved on a tween that has already rendered. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning.
				curTime = (self.rawTime() - value._startTime) * value._timeScale;
				if (!value._duration || Math.abs(Math.max(0, Math.min(value.totalDuration(), curTime))) - value._totalTime > 0.00001) {
					value.render(curTime, false, false);
				}
			}

			//if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
			if (self._gc || self._time === self._duration) if (!self._paused) if (self._duration < self.duration()) {
				//in case any of the ancestors had completed but should now be enabled...
				tl = self;
				beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
				while (tl._timeline) {
					if (beforeRawTime && tl._timeline.smoothChildTiming) {
						tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
					} else if (tl._gc) {
						tl._enabled(true, false);
					}
					tl = tl._timeline;
				}
			}

			return self;
		};

		p.remove = function(value) {
			if (value instanceof Animation) {
				this._remove(value, false);
				var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline.
				value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct.
				return this;
			} else if (value instanceof Array || (value && value.push && _isArray(value))) {
				var i = value.length;
				while (--i > -1) {
					this.remove(value[i]);
				}
				return this;
			} else if (typeof(value) === "string") {
				return this.removeLabel(value);
			}
			return this.kill(null, value);
		};

		p._remove = function(tween, skipDisable) {
			SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
			var last = this._last;
			if (!last) {
				this._time = this._totalTime = this._duration = this._totalDuration = 0;
			} else if (this._time > this.duration()) {
				this._time = this._duration;
				this._totalTime = this._totalDuration;
			}
			return this;
		};

		p.append = function(value, offsetOrLabel) {
			return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value));
		};

		p.insert = p.insertMultiple = function(value, position, align, stagger) {
			return this.add(value, position || 0, align, stagger);
		};

		p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) {
			return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger);
		};

		p.addLabel = function(label, position) {
			this._labels[label] = this._parseTimeOrLabel(position);
			return this;
		};

		p.addPause = function(position, callback, params, scope) {
			var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this);
			t.vars.onComplete = t.vars.onReverseComplete = callback;
			t.data = "isPause";
			this._hasPause = true;
			return this.add(t, position);
		};

		p.removeLabel = function(label) {
			delete this._labels[label];
			return this;
		};

		p.getLabelTime = function(label) {
			return (this._labels[label] != null) ? this._labels[label] : -1;
		};

		p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) {
			var clippedDuration, i;
			//if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration().
			if (ignore instanceof Animation && ignore.timeline === this) {
				this.remove(ignore);
			} else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) {
				i = ignore.length;
				while (--i > -1) {
					if (ignore[i] instanceof Animation && ignore[i].timeline === this) {
						this.remove(ignore[i]);
					}
				}
			}
			clippedDuration = (typeof(timeOrLabel) === "number" && !offsetOrLabel) ? 0 : (this.duration() > 99999999999) ? this.recent().endTime(false) : this._duration; //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead.
			if (typeof(offsetOrLabel) === "string") {
				return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - clippedDuration : 0, appendIfAbsent);
			}
			offsetOrLabel = offsetOrLabel || 0;
			if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value).
				i = timeOrLabel.indexOf("=");
				if (i === -1) {
					if (this._labels[timeOrLabel] == null) {
						return appendIfAbsent ? (this._labels[timeOrLabel] = clippedDuration + offsetOrLabel) : offsetOrLabel;
					}
					return this._labels[timeOrLabel] + offsetOrLabel;
				}
				offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1));
				timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : clippedDuration;
			} else if (timeOrLabel == null) {
				timeOrLabel = clippedDuration;
			}
			return Number(timeOrLabel) + offsetOrLabel;
		};

		p.seek = function(position, suppressEvents) {
			return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false));
		};

		p.stop = function() {
			return this.paused(true);
		};

		p.gotoAndPlay = function(position, suppressEvents) {
			return this.play(position, suppressEvents);
		};

		p.gotoAndStop = function(position, suppressEvents) {
			return this.pause(position, suppressEvents);
		};

		p.render = function(time, suppressEvents, force) {
			if (this._gc) {
				this._enabled(true, false);
			}
			var self = this,
				prevTime = self._time,
				totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(),
				prevStart = self._startTime,
				prevTimeScale = self._timeScale,
				prevPaused = self._paused,
				tween, isComplete, next, callback, internalForce, pauseTween, curTime, pauseTime;
			if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump).
				time += self._time - prevTime;
			}
			if (self._hasPause && !self._forcingPlayhead && !suppressEvents) {
				if (time > prevTime) {
					tween = self._first;
					while (tween && tween._startTime <= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) {
							pauseTween = tween;
						}
						tween = tween._next;
					}
				} else {
					tween = self._last;
					while (tween && tween._startTime >= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
							pauseTween = tween;
						}
						tween = tween._prev;
					}
				}
				if (pauseTween) {
					self._time = self._totalTime = time = pauseTween._startTime;
					pauseTime = self._startTime + (self._reversed ? self._duration - time : time) / self._timeScale;
				}
			}
			if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				self._totalTime = self._time = totalDur;
				if (!self._reversed) if (!self._hasPausedChild()) {
					isComplete = true;
					callback = "onComplete";
					internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
					if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || self._rawPrevTime < 0 || self._rawPrevTime === _tinyNum) if (self._rawPrevTime !== time && self._first) {
						internalForce = true;
						if (self._rawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
				}
				self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7.

			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				self._totalTime = self._time = 0;
				if (time > -_tinyNum) {
					time = 0;
				}
				if (prevTime !== 0 || (self._duration === 0 && self._rawPrevTime !== _tinyNum && (self._rawPrevTime > 0 || (time < 0 && self._rawPrevTime >= 0)))) {
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time < 0) {
					self._active = false;
					if (self._timeline.autoRemoveChildren && self._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing.
						internalForce = isComplete = true;
						callback = "onReverseComplete";
					} else if (self._rawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
						internalForce = true;
					}
					self._rawPrevTime = time;
				} else {
					self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
						tween = self._first;
						while (tween && tween._startTime === 0) {
							if (!tween._duration) {
								isComplete = false;
							}
							tween = tween._next;
						}
					}
					time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
					if (!self._initted) {
						internalForce = true;
					}
				}

			} else {
				self._totalTime = self._time = self._rawPrevTime = time;
			}
			if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) {
				return;
			} else if (!self._initted) {
				self._initted = true;
			}

			if (!self._active) if (!self._paused && self._time !== prevTime && time > 0) {
				self._active = true;  //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
			}

			if (prevTime === 0) if (self.vars.onStart) if (self._time !== 0 || !self._duration) if (!suppressEvents) {
				self._callback("onStart");
			}

			curTime = self._time;
			if (curTime >= prevTime) {
				tween = self._first;
				while (tween) {
					next = tween._next; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= curTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			} else {
				tween = self._last;
				while (tween) {
					next = tween._prev; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
							while (pauseTween && pauseTween.endTime() > self._time) {
								pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
								pauseTween = pauseTween._prev;
							}
							pauseTween = null;
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			}

			if (self._onUpdate) if (!suppressEvents) {
				if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
					_lazyRender();
				}
				self._callback("onUpdate");
			}

			if (callback) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
				if (isComplete) {
					if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values.
						_lazyRender();
					}
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
			}
		};

		p._hasPausedChild = function() {
			var tween = this._first;
			while (tween) {
				if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) {
					return true;
				}
				tween = tween._next;
			}
			return false;
		};

		p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) {
			ignoreBeforeTime = ignoreBeforeTime || -9999999999;
			var a = [],
				tween = this._first,
				cnt = 0;
			while (tween) {
				if (tween._startTime < ignoreBeforeTime) {
					//do nothing
				} else if (tween instanceof TweenLite) {
					if (tweens !== false) {
						a[cnt++] = tween;
					}
				} else {
					if (timelines !== false) {
						a[cnt++] = tween;
					}
					if (nested !== false) {
						a = a.concat(tween.getChildren(true, tweens, timelines));
						cnt = a.length;
					}
				}
				tween = tween._next;
			}
			return a;
		};

		p.getTweensOf = function(target, nested) {
			var disabled = this._gc,
				a = [],
				cnt = 0,
				tweens, i;
			if (disabled) {
				this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here.
			}
			tweens = TweenLite.getTweensOf(target);
			i = tweens.length;
			while (--i > -1) {
				if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) {
					a[cnt++] = tweens[i];
				}
			}
			if (disabled) {
				this._enabled(false, true);
			}
			return a;
		};

		p.recent = function() {
			return this._recent;
		};

		p._contains = function(tween) {
			var tl = tween.timeline;
			while (tl) {
				if (tl === this) {
					return true;
				}
				tl = tl.timeline;
			}
			return false;
		};

		p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) {
			ignoreBeforeTime = ignoreBeforeTime || 0;
			var tween = this._first,
				labels = this._labels,
				p;
			while (tween) {
				if (tween._startTime >= ignoreBeforeTime) {
					tween._startTime += amount;
				}
				tween = tween._next;
			}
			if (adjustLabels) {
				for (p in labels) {
					if (labels[p] >= ignoreBeforeTime) {
						labels[p] += amount;
					}
				}
			}
			return this._uncache(true);
		};

		p._kill = function(vars, target) {
			if (!vars && !target) {
				return this._enabled(false, false);
			}
			var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target),
				i = tweens.length,
				changed = false;
			while (--i > -1) {
				if (tweens[i]._kill(vars, target)) {
					changed = true;
				}
			}
			return changed;
		};

		p.clear = function(labels) {
			var tweens = this.getChildren(false, true, true),
				i = tweens.length;
			this._time = this._totalTime = 0;
			while (--i > -1) {
				tweens[i]._enabled(false, false);
			}
			if (labels !== false) {
				this._labels = {};
			}
			return this._uncache(true);
		};

		p.invalidate = function() {
			var tween = this._first;
			while (tween) {
				tween.invalidate();
				tween = tween._next;
			}
			return Animation.prototype.invalidate.call(this);;
		};

		p._enabled = function(enabled, ignoreTimeline) {
			if (enabled === this._gc) {
				var tween = this._first;
				while (tween) {
					tween._enabled(enabled, true);
					tween = tween._next;
				}
			}
			return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline);
		};

		p.totalTime = function(time, suppressEvents, uncapped) {
			this._forcingPlayhead = true;
			var val = Animation.prototype.totalTime.apply(this, arguments);
			this._forcingPlayhead = false;
			return val;
		};

		p.duration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					this.totalDuration(); //just triggers recalculation
				}
				return this._duration;
			}
			if (this.duration() !== 0 && value !== 0) {
				this.timeScale(this._duration / value);
			}
			return this;
		};

		p.totalDuration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					var max = 0,
						self = this,
						tween = self._last,
						prevStart = 999999999999,
						prev, end;
					while (tween) {
						prev = tween._prev; //record it here in case the tween changes position in the sequence...
						if (tween._dirty) {
							tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it.
						}
						if (tween._startTime > prevStart && self._sortChildren && !tween._paused && !self._calculatingDuration) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence
							self._calculatingDuration = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(), like _parseTimeOrLabel().
							self.add(tween, tween._startTime - tween._delay);
							self._calculatingDuration = 0;
						} else {
							prevStart = tween._startTime;
						}
						if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found.
							max -= tween._startTime;
							if (self._timeline.smoothChildTiming) {
								self._startTime += tween._startTime / self._timeScale;
								self._time -= tween._startTime;
								self._totalTime -= tween._startTime;
								self._rawPrevTime -= tween._startTime;
							}
							self.shiftChildren(-tween._startTime, false, -9999999999);
							prevStart = 0;
						}
						end = tween._startTime + (tween._totalDuration / tween._timeScale);
						if (end > max) {
							max = end;
						}
						tween = prev;
					}
					self._duration = self._totalDuration = max;
					self._dirty = false;
				}
				return this._totalDuration;
			}
			return (value && this.totalDuration()) ? this.timeScale(this._totalDuration / value) : this;
		};

		p.paused = function(value) {
			if (value === false && this._paused) { //if there's a pause directly at the spot from where we're unpausing, skip it.
				var tween = this._first;
				while (tween) {
					if (tween._startTime === this._time && tween.data === "isPause") {
						tween._rawPrevTime = 0; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire.
					}
					tween = tween._next;
				}
			}
			return Animation.prototype.paused.apply(this, arguments);
		};

		p.usesFrames = function() {
			var tl = this._timeline;
			while (tl._timeline) {
				tl = tl._timeline;
			}
			return (tl === Animation._rootFramesTimeline);
		};

		p.rawTime = function(wrapRepeats) {
			return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale;
		};

		return TimelineLite;

	}, true);








	
	
	
	
	
/*
 * ----------------------------------------------------------------
 * TimelineMax
 * ----------------------------------------------------------------
 */
	_gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) {

		var TimelineMax = function(vars) {
				TimelineLite.call(this, vars);
				this._repeat = this.vars.repeat || 0;
				this._repeatDelay = this.vars.repeatDelay || 0;
				this._cycle = 0;
				this._yoyo = !!this.vars.yoyo;
				this._dirty = true;
			},
			_tinyNum = 0.00000001,
			TweenLiteInternals = TweenLite._internals,
			_lazyTweens = TweenLiteInternals.lazyTweens,
			_lazyRender = TweenLiteInternals.lazyRender,
			_globals = _gsScope._gsDefine.globals,
			_easeNone = new Ease(null, null, 1, 0),
			p = TimelineMax.prototype = new TimelineLite();

		p.constructor = TimelineMax;
		p.kill()._gc = false;
		TimelineMax.version = "2.1.3";

		p.invalidate = function() {
			this._yoyo = !!this.vars.yoyo;
			this._repeat = this.vars.repeat || 0;
			this._repeatDelay = this.vars.repeatDelay || 0;
			this._uncache(true);
			return TimelineLite.prototype.invalidate.call(this);
		};

		p.addCallback = function(callback, position, params, scope) {
			return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
		};

		p.removeCallback = function(callback, position) {
			if (callback) {
				if (position == null) {
					this._kill(null, callback);
				} else {
					var a = this.getTweensOf(callback, false),
						i = a.length,
						time = this._parseTimeOrLabel(position);
					while (--i > -1) {
						if (a[i]._startTime === time) {
							a[i]._enabled(false, false);
						}
					}
				}
			}
			return this;
		};

		p.removePause = function(position) {
			return this.removeCallback(TimelineLite._internals.pauseCallback, position);
		};

		p.tweenTo = function(position, vars) {
			vars = vars || {};
			var copy = {ease:_easeNone, useFrames:this.usesFrames(), immediateRender:false, lazy:false},
				Engine = (vars.repeat && _globals.TweenMax) || TweenLite,
				duration, p, t;
			for (p in vars) {
				copy[p] = vars[p];
			}
			copy.time = this._parseTimeOrLabel(position);
			duration = (Math.abs(Number(copy.time) - this._time) / this._timeScale) || 0.001;
			t = new Engine(this, duration, copy);
			copy.onStart = function() {
				t.target.paused(true);
				if (t.vars.time !== t.target.time() && duration === t.duration() && !t.isFromTo) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all.
					t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale ).render(t.time(), true, true); //render() right away to ensure that things look right, especially in the case of .tweenTo(0).
				}
				if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
					vars.onStart.apply(vars.onStartScope || vars.callbackScope || t, vars.onStartParams || []); //don't use t._callback("onStart") or it'll point to the copy.onStart and we'll get a recursion error.
				}
			};
			return t;
		};

		p.tweenFromTo = function(fromPosition, toPosition, vars) {
			vars = vars || {};
			fromPosition = this._parseTimeOrLabel(fromPosition);
			vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this};
			vars.immediateRender = (vars.immediateRender !== false);
			var t = this.tweenTo(toPosition, vars);
			t.isFromTo = 1; //to ensure we don't mess with the duration in the onStart (we've got the start and end values here, so lock it in)
			return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001);
		};

		p.render = function(time, suppressEvents, force) {
			if (this._gc) {
				this._enabled(true, false);
			}
			var self = this,
				prevTime = self._time,
				totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(),
				dur = self._duration,
				prevTotalTime = self._totalTime,
				prevStart = self._startTime,
				prevTimeScale = self._timeScale,
				prevRawPrevTime = self._rawPrevTime,
				prevPaused = self._paused,
				prevCycle = self._cycle,
				tween, isComplete, next, callback, internalForce, cycleDuration, pauseTween, curTime, pauseTime;
			if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump).
				time += self._time - prevTime;
			}
			if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				if (!self._locked) {
					self._totalTime = totalDur;
					self._cycle = self._repeat;
				}
				if (!self._reversed) if (!self._hasPausedChild()) {
					isComplete = true;
					callback = "onComplete";
					internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
					if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time && self._first) {
						internalForce = true;
						if (prevRawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
				}
				self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				if (self._yoyo && (self._cycle & 1)) {
					self._time = time = 0;
				} else {
					self._time = dur;
					time = dur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. We cannot do less then 0.0001 because the same issue can occur when the duration is extremely large like 999999999999 in which case adding 0.00000001, for example, causes it to act like nothing was added.
				}

			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				if (!self._locked) {
					self._totalTime = self._cycle = 0;
				}
				self._time = 0;
				if (time > -_tinyNum) {
					time = 0;
				}
				if (prevTime !== 0 || (dur === 0 && prevRawPrevTime !== _tinyNum && (prevRawPrevTime > 0 || (time < 0 && prevRawPrevTime >= 0)) && !self._locked)) { //edge case for checking time < 0 && prevRawPrevTime >= 0: a zero-duration fromTo() tween inside a zero-duration timeline (yeah, very rare)
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time < 0) {
					self._active = false;
					if (self._timeline.autoRemoveChildren && self._reversed) {
						internalForce = isComplete = true;
						callback = "onReverseComplete";
					} else if (prevRawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
						internalForce = true;
					}
					self._rawPrevTime = time;
				} else {
					self._rawPrevTime = (dur || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
						tween = self._first;
						while (tween && tween._startTime === 0) {
							if (!tween._duration) {
								isComplete = false;
							}
							tween = tween._next;
						}
					}
					time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
					if (!self._initted) {
						internalForce = true;
					}
				}

			} else {
				if (dur === 0 && prevRawPrevTime < 0) { //without this, zero-duration repeating timelines (like with a simple callback nested at the very beginning and a repeatDelay) wouldn't render the first time through.
					internalForce = true;
				}
				self._time = self._rawPrevTime = time;
				if (!self._locked) {
					self._totalTime = time;
					if (self._repeat !== 0) {
						cycleDuration = dur + self._repeatDelay;
						self._cycle = (self._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but it gets reported as 0.79999999!)
						if (self._cycle) if (self._cycle === self._totalTime / cycleDuration && prevTotalTime <= time) {
							self._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
						}
						self._time = self._totalTime - (self._cycle * cycleDuration);
						if (self._yoyo) if (self._cycle & 1) {
							self._time = dur - self._time;
						}
						if (self._time > dur) {
							self._time = dur;
							time = dur + 0.0001; //to avoid occasional floating point rounding error
						} else if (self._time < 0) {
							self._time = time = 0;
						} else {
							time = self._time;
						}
					}
				}
			}

			if (self._hasPause && !self._forcingPlayhead && !suppressEvents) {
				time = self._time;
				if (time > prevTime || (self._repeat && prevCycle !== self._cycle)) {
					tween = self._first;
					while (tween && tween._startTime <= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) {
							pauseTween = tween;
						}
						tween = tween._next;
					}
				} else {
					tween = self._last;
					while (tween && tween._startTime >= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
							pauseTween = tween;
						}
						tween = tween._prev;
					}
				}
				if (pauseTween) {
					pauseTime = self._startTime + (self._reversed ? self._duration - pauseTween._startTime : pauseTween._startTime) / self._timeScale;
					if (pauseTween._startTime < dur) {
						self._time = self._rawPrevTime = time = pauseTween._startTime;
						self._totalTime = time + (self._cycle * (self._totalDuration + self._repeatDelay));
					}
				}
			}

			if (self._cycle !== prevCycle) if (!self._locked) {
				/*
				make sure children at the end/beginning of the timeline are rendered properly. If, for example,
				a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
				would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there
				could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So
				we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must
				ensure that zero-duration tweens at the very beginning or end of the TimelineMax work.
				*/
				var backwards = (self._yoyo && (prevCycle & 1) !== 0),
					wrap = (backwards === (self._yoyo && (self._cycle & 1) !== 0)),
					recTotalTime = self._totalTime,
					recCycle = self._cycle,
					recRawPrevTime = self._rawPrevTime,
					recTime = self._time;

				self._totalTime = prevCycle * dur;
				if (self._cycle < prevCycle) {
					backwards = !backwards;
				} else {
					self._totalTime += dur;
				}
				self._time = prevTime; //temporarily revert _time so that render() renders the children in the correct order. Without this, tweens won't rewind correctly. We could arhictect things in a "cleaner" way by splitting out the rendering queue into a separate method but for performance reasons, we kept it all inside this method.

				self._rawPrevTime = (dur === 0) ? prevRawPrevTime - 0.0001 : prevRawPrevTime;
				self._cycle = prevCycle;
				self._locked = true; //prevents changes to totalTime and skips repeat/yoyo behavior when we recursively call render()
				prevTime = (backwards) ? 0 : dur;
				self.render(prevTime, suppressEvents, (dur === 0));
				if (!suppressEvents) if (!self._gc) {
					if (self.vars.onRepeat) {
						self._cycle = recCycle; //in case the onRepeat alters the playhead or invalidates(), we shouldn't stay locked or use the previous cycle.
						self._locked = false;
						self._callback("onRepeat");
					}
				}
				if (prevTime !== self._time) { //in case there's a callback like onComplete in a nested tween/timeline that changes the playhead position, like via seek(), we should just abort.
					return;
				}
				if (wrap) {
					self._cycle = prevCycle; //if there's an onRepeat, we reverted this above, so make sure it's set properly again. We also unlocked in that scenario, so reset that too.
					self._locked = true;
					prevTime = (backwards) ? dur + 0.0001 : -0.0001;
					self.render(prevTime, true, false);
				}
				self._locked = false;
				if (self._paused && !prevPaused) { //if the render() triggered callback that paused this timeline, we should abort (very rare, but possible)
					return;
				}
				self._time = recTime;
				self._totalTime = recTotalTime;
				self._cycle = recCycle;
				self._rawPrevTime = recRawPrevTime;
			}

			if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) {
				if (prevTotalTime !== self._totalTime) if (self._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
					self._callback("onUpdate");
				}
				return;
			} else if (!self._initted) {
				self._initted = true;
			}

			if (!self._active) if (!self._paused && self._totalTime !== prevTotalTime && time > 0) {
				self._active = true;  //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
			}

			if (prevTotalTime === 0) if (self.vars.onStart) if (self._totalTime !== 0 || !self._totalDuration) if (!suppressEvents) {
				self._callback("onStart");
			}

			curTime = self._time;
			if (curTime >= prevTime) {
				tween = self._first;
				while (tween) {
					next = tween._next; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= self._time && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			} else {
				tween = self._last;
				while (tween) {
					next = tween._prev; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
							while (pauseTween && pauseTween.endTime() > self._time) {
								pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
								pauseTween = pauseTween._prev;
							}
							pauseTween = null;
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			}

			if (self._onUpdate) if (!suppressEvents) {
				if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
					_lazyRender();
				}
				self._callback("onUpdate");
			}
			if (callback) if (!self._locked) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
				if (isComplete) {
					if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values.
						_lazyRender();
					}
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
			}
		};

		p.getActive = function(nested, tweens, timelines) {
			var a = [],
				all = this.getChildren(nested || (nested == null), tweens || (nested == null), !!timelines),
				cnt = 0,
				l = all.length,
				i, tween;
			for (i = 0; i < l; i++) {
				tween = all[i];
				if (tween.isActive()) {
					a[cnt++] = tween;
				}
			}
			return a;
		};


		p.getLabelAfter = function(time) {
			if (!time) if (time !== 0) { //faster than isNan()
				time = this._time;
			}
			var labels = this.getLabelsArray(),
				l = labels.length,
				i;
			for (i = 0; i < l; i++) {
				if (labels[i].time > time) {
					return labels[i].name;
				}
			}
			return null;
		};

		p.getLabelBefore = function(time) {
			if (time == null) {
				time = this._time;
			}
			var labels = this.getLabelsArray(),
				i = labels.length;
			while (--i > -1) {
				if (labels[i].time < time) {
					return labels[i].name;
				}
			}
			return null;
		};

		p.getLabelsArray = function() {
			var a = [],
				cnt = 0,
				p;
			for (p in this._labels) {
				a[cnt++] = {time:this._labels[p], name:p};
			}
			a.sort(function(a,b) {
				return a.time - b.time;
			});
			return a;
		};

		p.invalidate = function() {
			this._locked = false; //unlock and set cycle in case invalidate() is called from inside an onRepeat
			return TimelineLite.prototype.invalidate.call(this);
		};


//---- GETTERS / SETTERS -------------------------------------------------------------------------------------------------------

		p.progress = function(value, suppressEvents) {
			return (!arguments.length) ? (this._time / this.duration()) || 0 : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents);
		};

		p.totalProgress = function(value, suppressEvents) {
			return (!arguments.length) ? (this._totalTime / this.totalDuration()) || 0 : this.totalTime( this.totalDuration() * value, suppressEvents);
		};

		p.totalDuration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					TimelineLite.prototype.totalDuration.call(this); //just forces refresh
					//Instead of Infinity, we use 999999999999 so that we can accommodate reverses.
					this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat);
				}
				return this._totalDuration;
			}
			return (this._repeat === -1 || !value) ? this : this.timeScale( this.totalDuration() / value );
		};

		p.time = function(value, suppressEvents) {
			if (!arguments.length) {
				return this._time;
			}
			if (this._dirty) {
				this.totalDuration();
			}
			var duration = this._duration,
				cycle = this._cycle,
				cycleDur = cycle * (duration + this._repeatDelay);
			if (value > duration) {
				value = duration;
			}
			return this.totalTime((this._yoyo && (cycle & 1)) ? duration - value + cycleDur : this._repeat ? value + cycleDur : value, suppressEvents);
		};

		p.repeat = function(value) {
			if (!arguments.length) {
				return this._repeat;
			}
			this._repeat = value;
			return this._uncache(true);
		};

		p.repeatDelay = function(value) {
			if (!arguments.length) {
				return this._repeatDelay;
			}
			this._repeatDelay = value;
			return this._uncache(true);
		};

		p.yoyo = function(value) {
			if (!arguments.length) {
				return this._yoyo;
			}
			this._yoyo = value;
			return this;
		};

		p.currentLabel = function(value) {
			if (!arguments.length) {
				return this.getLabelBefore(this._time + _tinyNum);
			}
			return this.seek(value, true);
		};

		return TimelineMax;

	}, true);
	




	
	
	
	
	

	
/*
 * ----------------------------------------------------------------
 * BezierPlugin
 * ----------------------------------------------------------------
 */
	(function() {

		var _RAD2DEG = 180 / Math.PI,
			_r1 = [],
			_r2 = [],
			_r3 = [],
			_corProps = {},
			_globals = _gsScope._gsDefine.globals,
			Segment = function(a, b, c, d) {
				if (c === d) { //if c and d match, the final autoRotate value could lock at -90 degrees, so differentiate them slightly.
					c = d - (d - b) / 1000000;
				}
				if (a === b) { //if a and b match, the starting autoRotate value could lock at -90 degrees, so differentiate them slightly.
					b = a + (c - a) / 1000000;
				}
				this.a = a;
				this.b = b;
				this.c = c;
				this.d = d;
				this.da = d - a;
				this.ca = c - a;
				this.ba = b - a;
			},
			_correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,",
			cubicToQuadratic = function(a, b, c, d) {
				var q1 = {a:a},
					q2 = {},
					q3 = {},
					q4 = {c:d},
					mab = (a + b) / 2,
					mbc = (b + c) / 2,
					mcd = (c + d) / 2,
					mabc = (mab + mbc) / 2,
					mbcd = (mbc + mcd) / 2,
					m8 = (mbcd - mabc) / 8;
				q1.b = mab + (a - mab) / 4;
				q2.b = mabc + m8;
				q1.c = q2.a = (q1.b + q2.b) / 2;
				q2.c = q3.a = (mabc + mbcd) / 2;
				q3.b = mbcd - m8;
				q4.b = mcd + (d - mcd) / 4;
				q3.c = q4.a = (q3.b + q4.b) / 2;
				return [q1, q2, q3, q4];
			},
			_calculateControlPoints = function(a, curviness, quad, basic, correlate) {
				var l = a.length - 1,
					ii = 0,
					cp1 = a[0].a,
					i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl;
				for (i = 0; i < l; i++) {
					seg = a[ii];
					p1 = seg.a;
					p2 = seg.d;
					p3 = a[ii+1].d;

					if (correlate) {
						r1 = _r1[i];
						r2 = _r2[i];
						tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5);
						m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0));
						m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0));
						mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0));
					} else {
						m1 = p2 - (p2 - p1) * curviness * 0.5;
						m2 = p2 + (p3 - p2) * curviness * 0.5;
						mm = p2 - (m1 + m2) / 2;
					}
					m1 += mm;
					m2 += mm;

					seg.c = cp2 = m1;
					if (i !== 0) {
						seg.b = cp1;
					} else {
						seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly.
					}

					seg.da = p2 - p1;
					seg.ca = cp2 - p1;
					seg.ba = cp1 - p1;

					if (quad) {
						qb = cubicToQuadratic(p1, cp1, cp2, p2);
						a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]);
						ii += 4;
					} else {
						ii++;
					}

					cp1 = m2;
				}
				seg = a[ii];
				seg.b = cp1;
				seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly.
				seg.da = seg.d - seg.a;
				seg.ca = seg.c - seg.a;
				seg.ba = cp1 - seg.a;
				if (quad) {
					qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d);
					a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]);
				}
			},
			_parseAnchors = function(values, p, correlate, prepend) {
				var a = [],
					l, i, p1, p2, p3, tmp;
				if (prepend) {
					values = [prepend].concat(values);
					i = values.length;
					while (--i > -1) {
						if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") {
							values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons
						}
					}
				}
				l = values.length - 2;
				if (l < 0) {
					a[0] = new Segment(values[0][p], 0, 0, values[0][p]);
					return a;
				}
				for (i = 0; i < l; i++) {
					p1 = values[i][p];
					p2 = values[i+1][p];
					a[i] = new Segment(p1, 0, 0, p2);
					if (correlate) {
						p3 = values[i+2][p];
						_r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1);
						_r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2);
					}
				}
				a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]);
				return a;
			},
			bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) {
				var obj = {},
					props = [],
					first = prepend || values[0],
					i, p, a, j, r, l, seamless, last;
				correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate;
				if (curviness == null) {
					curviness = 1;
				}
				for (p in values[0]) {
					props.push(p);
				}
				//check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later)
				if (values.length > 1) {
					last = values[values.length - 1];
					seamless = true;
					i = props.length;
					while (--i > -1) {
						p = props[i];
						if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors.
							seamless = false;
							break;
						}
					}
					if (seamless) {
						values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens
						if (prepend) {
							values.unshift(prepend);
						}
						values.push(values[1]);
						prepend = values[values.length - 3];
					}
				}
				_r1.length = _r2.length = _r3.length = 0;
				i = props.length;
				while (--i > -1) {
					p = props[i];
					_corProps[p] = (correlate.indexOf(","+p+",") !== -1);
					obj[p] = _parseAnchors(values, p, _corProps[p], prepend);
				}
				i = _r1.length;
				while (--i > -1) {
					_r1[i] = Math.sqrt(_r1[i]);
					_r2[i] = Math.sqrt(_r2[i]);
				}
				if (!basic) {
					i = props.length;
					while (--i > -1) {
						if (_corProps[p]) {
							a = obj[props[i]];
							l = a.length - 1;
							for (j = 0; j < l; j++) {
								r = (a[j+1].da / _r2[j] + a[j].da / _r1[j]) || 0;
								_r3[j] = (_r3[j] || 0) + r * r;
							}
						}
					}
					i = _r3.length;
					while (--i > -1) {
						_r3[i] = Math.sqrt(_r3[i]);
					}
				}
				i = props.length;
				j = quadratic ? 4 : 1;
				while (--i > -1) {
					p = props[i];
					a = obj[p];
					_calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties
					if (seamless) {
						a.splice(0, j);
						a.splice(a.length - j, j);
					}
				}
				return obj;
			},
			_parseBezierData = function(values, type, prepend) {
				type = type || "soft";
				var obj = {},
					inc = (type === "cubic") ? 3 : 2,
					soft = (type === "soft"),
					props = [],
					a, b, c, d, cur, i, j, l, p, cnt, tmp;
				if (soft && prepend) {
					values = [prepend].concat(values);
				}
				if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; }
				for (p in values[0]) {
					props.push(p);
				}
				i = props.length;
				while (--i > -1) {
					p = props[i];
					obj[p] = cur = [];
					cnt = 0;
					l = values.length;
					for (j = 0; j < l; j++) {
						a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp);
						if (soft) if (j > 1) if (j < l - 1) {
							cur[cnt++] = (a + cur[cnt-2]) / 2;
						}
						cur[cnt++] = a;
					}
					l = cnt - inc + 1;
					cnt = 0;
					for (j = 0; j < l; j += inc) {
						a = cur[j];
						b = cur[j+1];
						c = cur[j+2];
						d = (inc === 2) ? 0 : cur[j+3];
						cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c);
					}
					cur.length = cnt;
				}
				return obj;
			},
			_addCubicLengths = function(a, steps, resolution) {
				var inc = 1 / resolution,
					j = a.length,
					d, d1, s, da, ca, ba, p, i, inv, bez, index;
				while (--j > -1) {
					bez = a[j];
					s = bez.a;
					da = bez.d - s;
					ca = bez.c - s;
					ba = bez.b - s;
					d = d1 = 0;
					for (i = 1; i <= resolution; i++) {
						p = inc * i;
						inv = 1 - p;
						d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p);
						index = j * resolution + i - 1;
						steps[index] = (steps[index] || 0) + d * d;
					}
				}
			},
			_parseLengthData = function(obj, resolution) {
				resolution = resolution >> 0 || 6;
				var a = [],
					lengths = [],
					d = 0,
					total = 0,
					threshold = resolution - 1,
					segments = [],
					curLS = [], //current length segments array
					p, i, l, index;
				for (p in obj) {
					_addCubicLengths(obj[p], a, resolution);
				}
				l = a.length;
				for (i = 0; i < l; i++) {
					d += Math.sqrt(a[i]);
					index = i % resolution;
					curLS[index] = d;
					if (index === threshold) {
						total += d;
						index = (i / resolution) >> 0;
						segments[index] = curLS;
						lengths[index] = total;
						d = 0;
						curLS = [];
					}
				}
				return {length:total, lengths:lengths, segments:segments};
			},



			BezierPlugin = _gsScope._gsDefine.plugin({
					propName: "bezier",
					priority: -1,
					version: "1.3.9",
					API: 2,
					global:true,

					//gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
					init: function(target, vars, tween) {
						this._target = target;
						if (vars instanceof Array) {
							vars = {values:vars};
						}
						this._func = {};
						this._mod = {};
						this._props = [];
						this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10);
						var values = vars.values || [],
							first = {},
							second = values[0],
							autoRotate = vars.autoRotate || tween.vars.orientToBezier,
							p, isFunc, i, j, prepend;

						this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null;
						for (p in second) {
							this._props.push(p);
						}

						i = this._props.length;
						while (--i > -1) {
							p = this._props[i];

							this._overwriteProps.push(p);
							isFunc = this._func[p] = (typeof(target[p]) === "function");
							first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
							if (!prepend) if (first[p] !== values[0][p]) {
								prepend = first;
							}
						}
						this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first);
						this._segCount = this._beziers[p].length;

						if (this._timeRes) {
							var ld = _parseLengthData(this._beziers, this._timeRes);
							this._length = ld.length;
							this._lengths = ld.lengths;
							this._segments = ld.segments;
							this._l1 = this._li = this._s1 = this._si = 0;
							this._l2 = this._lengths[0];
							this._curSeg = this._segments[0];
							this._s2 = this._curSeg[0];
							this._prec = 1 / this._curSeg.length;
						}

						if ((autoRotate = this._autoRotate)) {
							this._initialRotations = [];
							if (!(autoRotate[0] instanceof Array)) {
								this._autoRotate = autoRotate = [autoRotate];
							}
							i = autoRotate.length;
							while (--i > -1) {
								for (j = 0; j < 3; j++) {
									p = autoRotate[i][j];
									this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false;
								}
								p = autoRotate[i][2];
								this._initialRotations[i] = (this._func[p] ? this._func[p].call(this._target) : this._target[p]) || 0;
								this._overwriteProps.push(p);
							}
						}
						this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1.
						return true;
					},

					//called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
					set: function(v) {
						var segments = this._segCount,
							func = this._func,
							target = this._target,
							notStart = (v !== this._startRatio),
							curIndex, inv, i, p, b, t, val, l, lengths, curSeg, v1;
						if (!this._timeRes) {
							curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0;
							t = (v - (curIndex * (1 / segments))) * segments;
						} else {
							lengths = this._lengths;
							curSeg = this._curSeg;
							v1 = v * this._length;
							i = this._li;
							//find the appropriate segment (if the currently cached one isn't correct)
							if (v1 > this._l2 && i < segments - 1) {
								l = segments - 1;
								while (i < l && (this._l2 = lengths[++i]) <= v1) {	}
								this._l1 = lengths[i-1];
								this._li = i;
								this._curSeg = curSeg = this._segments[i];
								this._s2 = curSeg[(this._s1 = this._si = 0)];
							} else if (v1 < this._l1 && i > 0) {
								while (i > 0 && (this._l1 = lengths[--i]) >= v1) { }
								if (i === 0 && v1 < this._l1) {
									this._l1 = 0;
								} else {
									i++;
								}
								this._l2 = lengths[i];
								this._li = i;
								this._curSeg = curSeg = this._segments[i];
								this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0;
								this._s2 = curSeg[this._si];
							}
							curIndex = i;
							//now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one)
							v1 -= this._l1;
							i = this._si;
							if (v1 > this._s2 && i < curSeg.length - 1) {
								l = curSeg.length - 1;
								while (i < l && (this._s2 = curSeg[++i]) <= v1) {	}
								this._s1 = curSeg[i-1];
								this._si = i;
							} else if (v1 < this._s1 && i > 0) {
								while (i > 0 && (this._s1 = curSeg[--i]) >= v1) {	}
								if (i === 0 && v1 < this._s1) {
									this._s1 = 0;
								} else {
									i++;
								}
								this._s2 = curSeg[i];
								this._si = i;
							}
							t = (v === 1) ? 1 : ((i + (v1 - this._s1) / (this._s2 - this._s1)) * this._prec) || 0;
						}
						inv = 1 - t;

						i = this._props.length;
						while (--i > -1) {
							p = this._props[i];
							b = this._beziers[p][curIndex];
							val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a;
							if (this._mod[p]) {
								val = this._mod[p](val, target);
							}
							if (func[p]) {
								target[p](val);
							} else {
								target[p] = val;
							}
						}

						if (this._autoRotate) {
							var ar = this._autoRotate,
								b2, x1, y1, x2, y2, add, conv;
							i = ar.length;
							while (--i > -1) {
								p = ar[i][2];
								add = ar[i][3] || 0;
								conv = (ar[i][4] === true) ? 1 : _RAD2DEG;
								b = this._beziers[ar[i][0]];
								b2 = this._beziers[ar[i][1]];

								if (b && b2) { //in case one of the properties got overwritten.
									b = b[curIndex];
									b2 = b2[curIndex];

									x1 = b.a + (b.b - b.a) * t;
									x2 = b.b + (b.c - b.b) * t;
									x1 += (x2 - x1) * t;
									x2 += ((b.c + (b.d - b.c) * t) - x2) * t;

									y1 = b2.a + (b2.b - b2.a) * t;
									y2 = b2.b + (b2.c - b2.b) * t;
									y1 += (y2 - y1) * t;
									y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t;

									val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i];

									if (this._mod[p]) {
										val = this._mod[p](val, target); //for modProps
									}

									if (func[p]) {
										target[p](val);
									} else {
										target[p] = val;
									}
								}
							}
						}
					}
			}),
			p = BezierPlugin.prototype;


		BezierPlugin.bezierThrough = bezierThrough;
		BezierPlugin.cubicToQuadratic = cubicToQuadratic;
		BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite
		BezierPlugin.quadraticToCubic = function(a, b, c) {
			return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c);
		};

		BezierPlugin._cssRegister = function() {
			var CSSPlugin = _globals.CSSPlugin;
			if (!CSSPlugin) {
				return;
			}
			var _internals = CSSPlugin._internals,
				_parseToProxy = _internals._parseToProxy,
				_setPluginRatio = _internals._setPluginRatio,
				CSSPropTween = _internals.CSSPropTween;
			_internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) {
				if (e instanceof Array) {
					e = {values:e};
				}
				plugin = new BezierPlugin();
				var values = e.values,
					l = values.length - 1,
					pluginValues = [],
					v = {},
					i, p, data;
				if (l < 0) {
					return pt;
				}
				for (i = 0; i <= l; i++) {
					data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i));
					pluginValues[i] = data.end;
				}
				for (p in e) {
					v[p] = e[p]; //duplicate the vars object because we need to alter some things which would cause problems if the user plans to reuse the same vars object for another tween.
				}
				v.values = pluginValues;
				pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2);
				pt.data = data;
				pt.plugin = plugin;
				pt.setRatio = _setPluginRatio;
				if (v.autoRotate === 0) {
					v.autoRotate = true;
				}
				if (v.autoRotate && !(v.autoRotate instanceof Array)) {
					i = (v.autoRotate === true) ? 0 : Number(v.autoRotate);
					v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false;
				}
				if (v.autoRotate) {
					if (!cssp._transform) {
						cssp._enableTransforms(false);
					}
					data.autoRotate = cssp._target._gsTransform;
					data.proxy.rotation = data.autoRotate.rotation || 0;
					cssp._overwriteProps.push("rotation");
				}
				plugin._onInitTween(data.proxy, v, cssp._tween);
				return pt;
			}});
		};

		p._mod = function(lookup) {
			var op = this._overwriteProps,
				i = op.length,
				val;
			while (--i > -1) {
				val = lookup[op[i]];
				if (val && typeof(val) === "function") {
					this._mod[op[i]] = val;
				}
			}
		};

		p._kill = function(lookup) {
			var a = this._props,
				p, i;
			for (p in this._beziers) {
				if (p in lookup) {
					delete this._beziers[p];
					delete this._func[p];
					i = a.length;
					while (--i > -1) {
						if (a[i] === p) {
							a.splice(i, 1);
						}
					}
				}
			}
			a = this._autoRotate;
			if (a) {
				i = a.length;
				while (--i > -1) {
					if (lookup[a[i][2]]) {
						a.splice(i, 1);
					}
				}
			}
			return this._super._kill.call(this, lookup);
		};

	}());






	
	
	
	
	
	
	
	
/*
 * ----------------------------------------------------------------
 * CSSPlugin
 * ----------------------------------------------------------------
 */
	_gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {

		/** @constructor **/
		var CSSPlugin = function() {
				TweenPlugin.call(this, "css");
				this._overwriteProps.length = 0;
				this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method)
			},
			_globals = _gsScope._gsDefine.globals,
			_hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called.
			_suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance
			_cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter
			_overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification.
			_specialProps = {},
			p = CSSPlugin.prototype = new TweenPlugin("css");

		p.constructor = CSSPlugin;
		CSSPlugin.version = "2.1.3";
		CSSPlugin.API = 2;
		CSSPlugin.defaultTransformPerspective = 0;
		CSSPlugin.defaultSkewType = "compensated";
		CSSPlugin.defaultSmoothOrigin = true;
		p = "px"; //we'll reuse the "p" variable to keep file size down
		CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""};


		var _numExp = /(?:\-|\.|\b)(\d|\.|e\-)+/g,
			_relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,
			_valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)"
			_valuesExpWithCommas = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)"
			_NaNExp = /(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g, //also allows scientific notation and doesn't kill the leading -/+ in -= and +=
			_suffixExp = /(?:\d|\-|\+|=|#|\.)*/g,
			_opacityExp = /opacity *= *([^)]*)/i,
			_opacityValExp = /opacity:([^;]*)/i,
			_alphaFilterExp = /alpha\(opacity *=.+?\)/i,
			_rgbhslExp = /^(rgb|hsl)/,
			_capsExp = /([A-Z])/g,
			_camelExp = /-([a-z])/gi,
			_urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage)
			_camelFunc = function(s, g) { return g.toUpperCase(); },
			_horizExp = /(?:Left|Right|Width)/i,
			_ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi,
			_ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,
			_commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis
			_complexExp = /[\s,\(]/i, //for testing a string to find if it has a space, comma, or open parenthesis (clues that it's a complex value)
			_DEG2RAD = Math.PI / 180,
			_RAD2DEG = 180 / Math.PI,
			_forcePT = {},
			_dummyElement = {style:{}},
			_doc = _gsScope.document || {createElement: function() {return _dummyElement;}},
			_createElement = function(type, ns) {
				var e = _doc.createElementNS ? _doc.createElementNS(ns || "http://www.w3.org/1999/xhtml", type) : _doc.createElement(type);
				return e.style ? e : _doc.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://greensock.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/).
			},
			_tempDiv = _createElement("div"),
			_tempImg = _createElement("img"),
			_internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins
			_agent = (_gsScope.navigator || {}).userAgent || "",
			_autoRound,
			_reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance).

			_isSafari,
			_isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element.
			_isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!)
			_ieVers,
			_supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version.
				var i = _agent.indexOf("Android"),
					a = _createElement("a");
				_isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || parseFloat(_agent.substr(i+8, 2)) > 3));
				_isSafariLT6 = (_isSafari && (parseFloat(_agent.substr(_agent.indexOf("Version/")+8, 2)) < 6));
				_isFirefox = (_agent.indexOf("Firefox") !== -1);
				if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent) || (/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) {
					_ieVers = parseFloat( RegExp.$1 );
				}
				if (!a) {
					return false;
				}
				a.style.cssText = "top:1px;opacity:.55;";
				return /^0.55/.test(a.style.opacity);
			}()),
			_getIEOpacity = function(v) {
				return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1);
			},
			_log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE.
				if (_gsScope.console) {
					console.log(s);
				}
			},
			_target, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params
			_index, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params

			_prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-"
			_prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz".

			// @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
			_checkPropPrefix = function(p, e) {
				e = e || _tempDiv;
				var s = e.style,
					a, i;
				if (s[p] !== undefined) {
					return p;
				}
				p = p.charAt(0).toUpperCase() + p.substr(1);
				a = ["O","Moz","ms","Ms","Webkit"];
				i = 5;
				while (--i > -1 && s[a[i]+p] === undefined) { }
				if (i >= 0) {
					_prefix = (i === 3) ? "ms" : a[i];
					_prefixCSS = "-" + _prefix.toLowerCase() + "-";
					return _prefix + p;
				}
				return null;
			},

			_computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}),
			_getComputedStyle = function(e) {
				return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window.
			},

			/**
			 * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do:
			 * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left");
			 *
			 * @param {!Object} t Target element whose style property you want to query
			 * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.)
			 * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call.
			 * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value.
			 * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto".
			 * @return {?string} The current property value
			 */
			_getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) {
				var rv;
				if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here.
					return _getIEOpacity(t);
				}
				if (!calc && t.style[p]) {
					rv = t.style[p];
				} else if ((cs = cs || _getComputedStyle(t))) {
					rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase());
				} else if (t.currentStyle) {
					rv = t.currentStyle[p];
				}
				return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv;
			},

			/**
			 * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number.
			 * @param {!Object} t Target element
			 * @param {!string} p Property name (like "left", "top", "marginLeft", etc.)
			 * @param {!number} v Value
			 * @param {string=} sfx Suffix (like "px" or "%" or "em")
			 * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect.
			 * @return {number} value in pixels
			 */
			_convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) {
				if (sfx === "px" || (!sfx && p !== "lineHeight")) { return v; }
				if (sfx === "auto" || !v) { return 0; }
				var horiz = _horizExp.test(p),
					node = t,
					style = _tempDiv.style,
					neg = (v < 0),
					precise = (v === 1),
					pix, cache, time;
				if (neg) {
					v = -v;
				}
				if (precise) {
					v *= 100;
				}
				if (p === "lineHeight" && !sfx) { //special case of when a simple lineHeight (without a unit) is used. Set it to the value, read back the computed value, and then revert.
					cache = _getComputedStyle(t).lineHeight;
					t.style.lineHeight = v;
					pix = parseFloat(_getComputedStyle(t).lineHeight);
					t.style.lineHeight = cache;
				} else if (sfx === "%" && p.indexOf("border") !== -1) {
					pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight);
				} else {
					style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;";
					if (sfx === "%" || !node.appendChild || sfx.charAt(0) === "v" || sfx === "rem") {
						node = t.parentNode || _doc.body;
						if (_getStyle(node, "display").indexOf("flex") !== -1) { //Edge and IE11 have a bug that causes offsetWidth to report as 0 if the container has display:flex and the child is position:relative. Switching to position: absolute solves it.
							style.position = "absolute";
						}
						cache = node._gsCache;
						time = TweenLite.ticker.frame;
						if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick)
							return cache.width * v / 100;
						}
						style[(horiz ? "width" : "height")] = v + sfx;
					} else {
						style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx;
					}
					node.appendChild(_tempDiv);
					pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]);
					node.removeChild(_tempDiv);
					if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) {
						cache = node._gsCache = node._gsCache || {};
						cache.time = time;
						cache.width = pix / v * 100;
					}
					if (pix === 0 && !recurse) {
						pix = _convertToPixels(t, p, v, sfx, true);
					}
				}
				if (precise) {
					pix /= 100;
				}
				return neg ? -pix : pix;
			},
			_calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop
				if (_getStyle(t, "position", cs) !== "absolute") { return 0; }
				var dim = ((p === "left") ? "Left" : "Top"),
					v = _getStyle(t, "margin" + dim, cs);
				return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0);
			},

			// @private returns at object containing ALL of the style properties in camelCase and their associated values.
			_getAllStyles = function(t, cs) {
				var s = {},
					i, tr, p;
				if ((cs = cs || _getComputedStyle(t, null))) {
					if ((i = cs.length)) {
						while (--i > -1) {
							p = cs[i];
							if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
								s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p);
							}
						}
					} else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop.
						for (i in cs) {
							if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
								s[i] = cs[i];
							}
						}
					}
				} else if ((cs = t.currentStyle || t.style)) {
					for (i in cs) {
						if (typeof(i) === "string" && s[i] === undefined) {
							s[i.replace(_camelExp, _camelFunc)] = cs[i];
						}
					}
				}
				if (!_supportsOpacity) {
					s.opacity = _getIEOpacity(t);
				}
				tr = _getTransform(t, cs, false);
				s.rotation = tr.rotation;
				s.skewX = tr.skewX;
				s.scaleX = tr.scaleX;
				s.scaleY = tr.scaleY;
				s.x = tr.x;
				s.y = tr.y;
				if (_supports3D) {
					s.z = tr.z;
					s.rotationX = tr.rotationX;
					s.rotationY = tr.rotationY;
					s.scaleZ = tr.scaleZ;
				}
				if (s.filters) {
					delete s.filters;
				}
				return s;
			},

			// @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
			_cssDif = function(t, s1, s2, vars, forceLookup) {
				var difs = {},
					style = t.style,
					val, p, mpt;
				for (p in s2) {
					if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") {
						difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween.
						if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes.
							mpt = new MiniPropTween(style, p, style[p], mpt);
						}
					}
				}
				if (vars) {
					for (p in vars) { //copy properties (except className)
						if (p !== "className") {
							difs[p] = vars[p];
						}
					}
				}
				return {difs:difs, firstMPT:mpt};
			},
			_dimensions = {width:["Left","Right"], height:["Top","Bottom"]},
			_margins = ["marginLeft","marginRight","marginTop","marginBottom"],

			/**
			 * @private Gets the width or height of an element
			 * @param {!Object} t Target element
			 * @param {!string} p Property name ("width" or "height")
			 * @param {Object=} cs Computed style object (if one exists). Just a speed optimization.
			 * @return {number} Dimension (in pixels)
			 */
			_getDimension = function(t, p, cs) {
				if ((t.nodeName + "").toLowerCase() === "svg") { //Chrome no longer supports offsetWidth/offsetHeight on SVG elements.
					return (cs || _getComputedStyle(t))[p] || 0;
				} else if (t.getCTM && _isSVG(t)) {
					return t.getBBox()[p] || 0;
				}
				var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight),
					a = _dimensions[p],
					i = a.length;
				cs = cs || _getComputedStyle(t, null);
				while (--i > -1) {
					v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0;
					v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0;
				}
				return v;
			},

			// @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
			_parsePosition = function(v, recObj) {
				if (v === "contain" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto".
					return v + " ";
				}
				if (v == null || v === "") {
					v = "0 0";
				}
				var a = v.split(" "),
					x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0],
					y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1],
					i;
				if (a.length > 3 && !recObj) { //multiple positions
					a = v.split(", ").join(",").split(",");
					v = [];
					for (i = 0; i < a.length; i++) {
						v.push(_parsePosition(a[i]));
					}
					return v.join(",");
				}
				if (y == null) {
					y = (x === "center") ? "50%" : "0";
				} else if (y === "center") {
					y = "50%";
				}
				if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative.
					x = "50%";
				}
				v = x + " " + y + ((a.length > 2) ? " " + a[2] : "");
				if (recObj) {
					recObj.oxp = (x.indexOf("%") !== -1);
					recObj.oyp = (y.indexOf("%") !== -1);
					recObj.oxr = (x.charAt(1) === "=");
					recObj.oyr = (y.charAt(1) === "=");
					recObj.ox = parseFloat(x.replace(_NaNExp, ""));
					recObj.oy = parseFloat(y.replace(_NaNExp, ""));
					recObj.v = v;
				}
				return recObj || v;
			},

			/**
			 * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!)
			 * @param {(number|string)} e End value which is typically a string, but could be a number
			 * @param {(number|string)} b Beginning value which is typically a string but could be a number
			 * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized)
			 */
			_parseChange = function(e, b) {
				if (typeof(e) === "function") {
					e = e(_index, _target);
				}
				return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : (parseFloat(e) - parseFloat(b)) || 0;
			},

			/**
			 * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function.
			 * @param {Object} v Value to be parsed
			 * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter)
			 * @return {number} Parsed value
			 */
			_parseVal = function(v, d) {
				if (typeof(v) === "function") {
					v = v(_index, _target);
				}
				var isRelative = (typeof(v) === "string" && v.charAt(1) === "=");
				if (typeof(v) === "string" && v.charAt(v.length - 2) === "v") { //convert vw and vh into px-equivalents.
					v = (isRelative ? v.substr(0, 2) : 0) + (window["inner" + ((v.substr(-2) === "vh") ? "Height" : "Width")] * (parseFloat(isRelative ? v.substr(2) : v) / 100));
				}
				return (v == null) ? d : isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(v.substr(2)) + d : parseFloat(v) || 0;
			},

			/**
			 * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly.
			 * @param {Object} v Value to be parsed
			 * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter)
			 * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY"
			 * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation.
			 * @return {number} parsed angle in radians
			 */
			_parseAngle = function(v, d, p, directionalEnd) {
				var min = 0.000001,
					cap, split, dif, result, isRelative;
				if (typeof(v) === "function") {
					v = v(_index, _target);
				}
				if (v == null) {
					result = d;
				} else if (typeof(v) === "number") {
					result = v;
				} else {
					cap = 360;
					split = v.split("_");
					isRelative = (v.charAt(1) === "=");
					dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d);
					if (split.length) {
						if (directionalEnd) {
							directionalEnd[p] = d + dif;
						}
						if (v.indexOf("short") !== -1) {
							dif = dif % cap;
							if (dif !== dif % (cap / 2)) {
								dif = (dif < 0) ? dif + cap : dif - cap;
							}
						}
						if (v.indexOf("_cw") !== -1 && dif < 0) {
							dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
						} else if (v.indexOf("ccw") !== -1 && dif > 0) {
							dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
						}
					}
					result = d + dif;
				}
				if (result < min && result > -min) {
					result = 0;
				}
				return result;
			},

			_colorLookup = {aqua:[0,255,255],
				lime:[0,255,0],
				silver:[192,192,192],
				black:[0,0,0],
				maroon:[128,0,0],
				teal:[0,128,128],
				blue:[0,0,255],
				navy:[0,0,128],
				white:[255,255,255],
				fuchsia:[255,0,255],
				olive:[128,128,0],
				yellow:[255,255,0],
				orange:[255,165,0],
				gray:[128,128,128],
				purple:[128,0,128],
				green:[0,128,0],
				red:[255,0,0],
				pink:[255,192,203],
				cyan:[0,255,255],
				transparent:[255,255,255,0]},

			_hue = function(h, m1, m2) {
				h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h;
				return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0;
			},

			/**
			 * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers).
			 * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc.
			 * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba()
			 * @return {Array.<number>} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true.
			 */
			_parseColor = CSSPlugin.parseColor = function(v, toHSL) {
				var a, r, g, b, h, s, l, max, min, d, wasHSL;
				if (!v) {
					a = _colorLookup.black;
				} else if (typeof(v) === "number") {
					a = [v >> 16, (v >> 8) & 255, v & 255];
				} else {
					if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value.
						v = v.substr(0, v.length - 1);
					}
					if (_colorLookup[v]) {
						a = _colorLookup[v];
					} else if (v.charAt(0) === "#") {
						if (v.length === 4) { //for shorthand like #9F0
							r = v.charAt(1);
							g = v.charAt(2);
							b = v.charAt(3);
							v = "#" + r + r + g + g + b + b;
						}
						v = parseInt(v.substr(1), 16);
						a = [v >> 16, (v >> 8) & 255, v & 255];
					} else if (v.substr(0, 3) === "hsl") {
						a = wasHSL = v.match(_numExp);
						if (!toHSL) {
							h = (Number(a[0]) % 360) / 360;
							s = Number(a[1]) / 100;
							l = Number(a[2]) / 100;
							g = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
							r = l * 2 - g;
							if (a.length > 3) {
								a[3] = Number(a[3]);
							}
							a[0] = _hue(h + 1 / 3, r, g);
							a[1] = _hue(h, r, g);
							a[2] = _hue(h - 1 / 3, r, g);
						} else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place.
							return v.match(_relNumExp);
						}
					} else {
						a = v.match(_numExp) || _colorLookup.transparent;
					}
					a[0] = Number(a[0]);
					a[1] = Number(a[1]);
					a[2] = Number(a[2]);
					if (a.length > 3) {
						a[3] = Number(a[3]);
					}
				}
				if (toHSL && !wasHSL) {
					r = a[0] / 255;
					g = a[1] / 255;
					b = a[2] / 255;
					max = Math.max(r, g, b);
					min = Math.min(r, g, b);
					l = (max + min) / 2;
					if (max === min) {
						h = s = 0;
					} else {
						d = max - min;
						s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
						h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4;
						h *= 60;
					}
					a[0] = (h + 0.5) | 0;
					a[1] = (s * 100 + 0.5) | 0;
					a[2] = (l * 100 + 0.5) | 0;
				}
				return a;
			},
			_formatColors = function(s, toHSL) {
				var colors = s.match(_colorExp) || [],
					charIndex = 0,
					parsed = "",
					i, color, temp;
				if (!colors.length) {
					return s;
				}
				for (i = 0; i < colors.length; i++) {
					color = colors[i];
					temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex);
					charIndex += temp.length + color.length;
					color = _parseColor(color, toHSL);
					if (color.length === 3) {
						color.push(1);
					}
					parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")";
				}
				return parsed + s.substr(charIndex);
			},
			_colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc.

		for (p in _colorLookup) {
			_colorExp += "|" + p + "\\b";
		}
		_colorExp = new RegExp(_colorExp+")", "gi");

		CSSPlugin.colorStringFilter = function(a) {
			var combined = a[0] + " " + a[1],
				toHSL;
			if (_colorExp.test(combined)) {
				toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1);
				a[0] = _formatColors(a[0], toHSL);
				a[1] = _formatColors(a[1], toHSL);
			}
			_colorExp.lastIndex = 0;
		};

		if (!TweenLite.defaultStringFilter) {
			TweenLite.defaultStringFilter = CSSPlugin.colorStringFilter;
		}

		/**
		 * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned.
		 * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned.
		 * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't.
		 * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc.
		 * @return {Function} formatter function
		 */
		var _getFormatter = function(dflt, clr, collapsible, multi) {
				if (dflt == null) {
					return function(v) {return v;};
				}
				var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "",
					dVals = dflt.split(dColor).join("").match(_valuesExp) || [],
					pfx = dflt.substr(0, dflt.indexOf(dVals[0])),
					sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "",
					delim = (dflt.indexOf(" ") !== -1) ? " " : ",",
					numVals = dVals.length,
					dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "",
					formatter;
				if (!numVals) {
					return function(v) {return v;};
				}
				if (clr) {
					formatter = function(v) {
						var color, vals, i, a;
						if (typeof(v) === "number") {
							v += dSfx;
						} else if (multi && _commasOutsideParenExp.test(v)) {
							a = v.replace(_commasOutsideParenExp, "|").split("|");
							for (i = 0; i < a.length; i++) {
								a[i] = formatter(a[i]);
							}
							return a.join(",");
						}
						color = (v.match(_colorExp) || [dColor])[0];
						vals = v.split(color).join("").match(_valuesExp) || [];
						i = vals.length;
						if (numVals > i--) {
							while (++i < numVals) {
								vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i];
							}
						}
						return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : "");
					};
					return formatter;

				}
				formatter = function(v) {
					var vals, a, i;
					if (typeof(v) === "number") {
						v += dSfx;
					} else if (multi && _commasOutsideParenExp.test(v)) {
						a = v.replace(_commasOutsideParenExp, "|").split("|");
						for (i = 0; i < a.length; i++) {
							a[i] = formatter(a[i]);
						}
						return a.join(",");
					}
					vals = v.match(delim === "," ? _valuesExp : _valuesExpWithCommas) || [];
					i = vals.length;
					if (numVals > i--) {
						while (++i < numVals) {
							vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i];
						}
					}
					return ((pfx && v !== "none") ? v.substr(0, v.indexOf(vals[0])) || pfx : pfx) + vals.join(delim) + sfx; //note: prefix might be different, like for clipPath it could start with inset( or polygon(
				};
				return formatter;
			},

			/**
			 * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges.
			 * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft"
			 * @return {Function} a formatter function
			 */
			_getEdgeParser = function(props) {
				props = props.split(",");
				return function(t, e, p, cssp, pt, plugin, vars) {
					var a = (e + "").split(" "),
						i;
					vars = {};
					for (i = 0; i < 4; i++) {
						vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)];
					}
					return cssp.parse(t, vars, pt, plugin);
				};
			},

			// @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
			_setPluginRatio = _internals._setPluginRatio = function(v) {
				this.plugin.setRatio(v);
				var d = this.data,
					proxy = d.proxy,
					mpt = d.firstMPT,
					min = 0.000001,
					val, pt, i, str, p;
				while (mpt) {
					val = proxy[mpt.v];
					if (mpt.r) {
						val = mpt.r(val);
					} else if (val < min && val > -min) {
						val = 0;
					}
					mpt.t[mpt.p] = val;
					mpt = mpt._next;
				}
				if (d.autoRotate) {
					d.autoRotate.rotation = d.mod ? d.mod.call(this._tween, proxy.rotation, this.t, this._tween) : proxy.rotation; //special case for ModifyPlugin to hook into an auto-rotating bezier
				}
				//at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method. Same for "b" at the beginning.
				if (v === 1 || v === 0) {
					mpt = d.firstMPT;
					p = (v === 1) ? "e" : "b";
					while (mpt) {
						pt = mpt.t;
						if (!pt.type) {
							pt[p] = pt.s + pt.xs0;
						} else if (pt.type === 1) {
							str = pt.xs0 + pt.s + pt.xs1;
							for (i = 1; i < pt.l; i++) {
								str += pt["xn"+i] + pt["xs"+(i+1)];
							}
							pt[p] = str;
						}
						mpt = mpt._next;
					}
				}
			},

			/**
			 * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value.
			 * @param {!Object} t target object whose property we're tweening (often a CSSPropTween)
			 * @param {!string} p property name
			 * @param {(number|string|object)} v value
			 * @param {MiniPropTween=} next next MiniPropTween in the linked list
			 * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer
			 */
			MiniPropTween = function(t, p, v, next, r) {
				this.t = t;
				this.p = p;
				this.v = v;
				this.r = r;
				if (next) {
					next._prev = this;
					this._next = next;
				}
			},

			/**
			 * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element.
			 * This method returns an object that has the following properties:
			 *  - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin.  This is what we feed to the external _onInitTween() as the target
			 *  - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values
			 *  - firstMPT: the first MiniPropTween in the linked list
			 *  - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter.
			 * @param {!Object} t target object to be tweened
			 * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed
			 * @param {!CSSPlugin} cssp The CSSPlugin instance
			 * @param {CSSPropTween=} pt the next CSSPropTween in the linked list
			 * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values
			 * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter.
			 * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions)
			 */
			_parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) {
				var bpt = pt,
					start = {},
					end = {},
					transform = cssp._transform,
					oldForce = _forcePT,
					i, p, xp, mpt, firstPT;
				cssp._transform = null;
				_forcePT = vars;
				pt = firstPT = cssp.parse(t, vars, pt, plugin);
				_forcePT = oldForce;
				//break off from the linked list so the new ones are isolated.
				if (shallow) {
					cssp._transform = transform;
					if (bpt) {
						bpt._prev = null;
						if (bpt._prev) {
							bpt._prev._next = null;
						}
					}
				}
				while (pt && pt !== bpt) {
					if (pt.type <= 1) {
						p = pt.p;
						end[p] = pt.s + pt.c;
						start[p] = pt.s;
						if (!shallow) {
							mpt = new MiniPropTween(pt, "s", p, mpt, pt.r);
							pt.c = 0;
						}
						if (pt.type === 1) {
							i = pt.l;
							while (--i > 0) {
								xp = "xn" + i;
								p = pt.p + "_" + xp;
								end[p] = pt.data[xp];
								start[p] = pt[xp];
								if (!shallow) {
									mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]);
								}
							}
						}
					}
					pt = pt._next;
				}
				return {proxy:start, end:end, firstMPT:mpt, pt:firstPT};
			},



			/**
			 * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory.
			 * CSSPropTweens have the following optional properties as well (not defined through the constructor):
			 *  - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc.
			 *  - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list)
			 *  - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subtweens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request.
			 *  - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target.
			 *  - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible.
			 * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything.
			 * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width".
			 * @param {number} s Starting numeric value
			 * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95.
			 * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it.
			 * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update.
			 * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip"
			 * @param {boolean=} r If true, the value(s) should be rounded
			 * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0.
			 * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues.
			 * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues.
			 */
			CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) {
				this.t = t; //target
				this.p = p; //property
				this.s = s; //starting value
				this.c = c; //change value
				this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at)
				if (!(t instanceof CSSPropTween)) {
					_overwriteProps.push(this.n);
				}
				this.r = !r ? r : (typeof(r) === "function") ? r : Math.round; //round (boolean)
				this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work
				if (pr) {
					this.pr = pr;
					_hasPriority = true;
				}
				this.b = (b === undefined) ? s : b;
				this.e = (e === undefined) ? s + c : e;
				if (next) {
					this._next = next;
					next._prev = this;
				}
			},

			_addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween
				var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp);
				pt.b = start;
				pt.e = pt.xs0 = end;
				return pt;
			},

			/**
			 * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example:
			 * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt);
			 * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio().
			 * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method.
			 *
			 * @param {!Object} t Target whose property will be tweened
			 * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow")
			 * @param {string} b Beginning value
			 * @param {string} e Ending value
			 * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization)
			 * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match
			 * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this).
			 * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0.
			 * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300}
			 * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here.
			 * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call.
			 */
			_parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) {
				//DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e);
				b = b || dflt || "";
				if (typeof(e) === "function") {
					e = e(_index, _target);
				}
				pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e);
				e += ""; //ensures it's a string
				if (clrs && _colorExp.test(e + b)) { //if colors are found, normalize the formatting to rgba() or hsla().
					e = [b, e];
					CSSPlugin.colorStringFilter(e);
					b = e[0];
					e = e[1];
				}
				var ba = b.split(", ").join(",").split(" "), //beginning array
					ea = e.split(", ").join(",").split(" "), //ending array
					l = ba.length,
					autoRound = (_autoRound !== false),
					i, xi, ni, bv, ev, bnums, enums, bn, hasAlpha, temp, cv, str, useHSL;
				if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) {
					if ((e + b).indexOf("rgb") !== -1 || (e + b).indexOf("hsl") !== -1) { //keep rgb(), rgba(), hsl(), and hsla() values together! (remember, we're splitting on spaces)
						ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" ");
						ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" ");
					} else {
						ba = ba.join(" ").split(",").join(", ").split(" ");
						ea = ea.join(" ").split(",").join(", ").split(" ");
					}
					l = ba.length;
				}
				if (l !== ea.length) {
					//DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")");
					ba = (dflt || "").split(" ");
					l = ba.length;
				}
				pt.plugin = plugin;
				pt.setRatio = setRatio;
				_colorExp.lastIndex = 0;
				for (i = 0; i < l; i++) {
					bv = ba[i];
					ev = ea[i] + "";
					bn = parseFloat(bv);
					//if the value begins with a number (most common). It's fine if it has a suffix like px
					if (bn || bn === 0) {
						pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1) ? Math.round : false, true);

					//if the value is a color
					} else if (clrs && _colorExp.test(bv)) {
						str = ev.indexOf(")") + 1;
						str = ")" + (str ? ev.substr(str) : ""); //if there's a comma or ) at the end, retain it.
						useHSL = (ev.indexOf("hsl") !== -1 && _supportsOpacity);
						temp = ev; //original string value so we can look for any prefix later.
						bv = _parseColor(bv, useHSL);
						ev = _parseColor(ev, useHSL);
						hasAlpha = (bv.length + ev.length > 6);
						if (hasAlpha && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color
							pt["xs" + pt.l] += pt.l ? " transparent" : "transparent";
							pt.e = pt.e.split(ea[i]).join("transparent");
						} else {
							if (!_supportsOpacity) { //old versions of IE don't support rgba().
								hasAlpha = false;
							}
							if (useHSL) {
								pt.appendXtra(temp.substr(0, temp.indexOf("hsl")) + (hasAlpha ? "hsla(" : "hsl("), bv[0], _parseChange(ev[0], bv[0]), ",", false, true)
									.appendXtra("", bv[1], _parseChange(ev[1], bv[1]), "%,", false)
									.appendXtra("", bv[2], _parseChange(ev[2], bv[2]), (hasAlpha ? "%," : "%" + str), false);
							} else {
								pt.appendXtra(temp.substr(0, temp.indexOf("rgb")) + (hasAlpha ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", Math.round, true)
									.appendXtra("", bv[1], ev[1] - bv[1], ",", Math.round)
									.appendXtra("", bv[2], ev[2] - bv[2], (hasAlpha ? "," : str), Math.round);
							}

							if (hasAlpha) {
								bv = (bv.length < 4) ? 1 : bv[3];
								pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false);
							}
						}
						_colorExp.lastIndex = 0; //otherwise the test() on the RegExp could move the lastIndex and taint future results.

					} else {
						bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array

						//if no number is found, treat it as a non-tweening value and just append the string to the current xs.
						if (!bnums) {
							pt["xs" + pt.l] += (pt.l || pt["xs" + pt.l]) ? " " + ev : ev;

						//loop through all the numbers that are found and construct the extra values on the pt.
						} else {
							enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5
							if (!enums || enums.length !== bnums.length) {
								//DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")");
								return pt;
							}
							ni = 0;
							for (xi = 0; xi < bnums.length; xi++) {
								cv = bnums[xi];
								temp = bv.indexOf(cv, ni);
								pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px") ? Math.round : false, (xi === 0));
								ni = temp + cv.length;
							}
							pt["xs" + pt.l] += bv.substr(ni);
						}
					}
				}
				//if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly.
				if (e.indexOf("=") !== -1) if (pt.data) {
					str = pt.xs0 + pt.data.s;
					for (i = 1; i < pt.l; i++) {
						str += pt["xs" + i] + pt.data["xn" + i];
					}
					pt.e = str + pt["xs" + i];
				}
				if (!pt.l) {
					pt.type = -1;
					pt.xs0 = pt.e;
				}
				return pt.xfirst || pt;
			},
			i = 9;


		p = CSSPropTween.prototype;
		p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc.
		while (--i > 0) {
			p["xn" + i] = 0;
			p["xs" + i] = "";
		}
		p.xs0 = "";
		p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null;


		/**
		 * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this:
		 * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)"
		 * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method).
		 * @param {string=} pfx Prefix (if any)
		 * @param {!number} s Starting value
		 * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95.
		 * @param {string=} sfx Suffix (if any)
		 * @param {boolean=} r Round (if true).
		 * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space.
		 * @return {CSSPropTween} returns itself so that multiple methods can be chained together.
		 */
		p.appendXtra = function(pfx, s, c, sfx, r, pad) {
			var pt = this,
				l = pt.l;
			pt["xs" + l] += (pad && (l || pt["xs" + l])) ? " " + pfx : pfx || "";
			if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value!
				pt["xs" + l] += s + (sfx || "");
				return pt;
			}
			pt.l++;
			pt.type = pt.setRatio ? 2 : 1;
			pt["xs" + pt.l] = sfx || "";
			if (l > 0) {
				pt.data["xn" + l] = s + c;
				pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method)
				pt["xn" + l] = s;
				if (!pt.plugin) {
					pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr);
					pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly.
				}
				return pt;
			}
			pt.data = {s:s + c};
			pt.rxp = {};
			pt.s = s;
			pt.c = c;
			pt.r = r;
			return pt;
		};

		/**
		 * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly.
		 * @param {!string} p Property name (like "boxShadow" or "throwProps")
		 * @param {Object=} options An object containing any of the following configuration options:
		 *                      - defaultValue: the default value
		 *                      - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker)
		 *                      - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.)
		 *                      - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O)
		 *                      - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc.
		 *                      - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0.
		 *                      - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out.
		 *                      - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc.
		 *                      - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default).
		 */
		var SpecialProp = function(p, options) {
				options = options || {};
				this.p = options.prefix ? _checkPropPrefix(p) || p : p;
				_specialProps[p] = _specialProps[this.p] = this;
				this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi);
				if (options.parser) {
					this.parse = options.parser;
				}
				this.clrs = options.color;
				this.multi = options.multi;
				this.keyword = options.keyword;
				this.dflt = options.defaultValue;
				this.allowFunc = options.allowFunc;
				this.pr = options.priority || 0;
			},

			//shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin.
			_registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) {
				if (typeof(options) !== "object") {
					options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin
				}
				var a = p.split(","),
					d = options.defaultValue,
					i, temp;
				defaults = defaults || [d];
				for (i = 0; i < a.length; i++) {
					options.prefix = (i === 0 && options.prefix);
					options.defaultValue = defaults[i] || d;
					temp = new SpecialProp(a[i], options);
				}
			},

			//creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file.
			_registerPluginProp = _internals._registerPluginProp = function(p) {
				if (!_specialProps[p]) {
					var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin";
					_registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) {
						var pluginClass = _globals.com.greensock.plugins[pluginName];
						if (!pluginClass) {
							_log("Error: " + pluginName + " js file not loaded.");
							return pt;
						}
						pluginClass._cssRegister();
						return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars);
					}});
				}
			};


		p = SpecialProp.prototype;

		/**
		 * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list)
		 * @param {!Object} t target element
		 * @param {(string|number|object)} b beginning value
		 * @param {(string|number|object)} e ending (destination) value
		 * @param {CSSPropTween=} pt next CSSPropTween in the linked list
		 * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here.
		 * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here.
		 * @return {CSSPropTween=} First CSSPropTween in the linked list
		 */
		p.parseComplex = function(t, b, e, pt, plugin, setRatio) {
			var kwd = this.keyword,
				i, ba, ea, l, bi, ei;
			//if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example)
			if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) {
				ba = b.replace(_commasOutsideParenExp, "|").split("|");
				ea = e.replace(_commasOutsideParenExp, "|").split("|");
			} else if (kwd) {
				ba = [b];
				ea = [e];
			}
			if (ea) {
				l = (ea.length > ba.length) ? ea.length : ba.length;
				for (i = 0; i < l; i++) {
					b = ba[i] = ba[i] || this.dflt;
					e = ea[i] = ea[i] || this.dflt;
					if (kwd) {
						bi = b.indexOf(kwd);
						ei = e.indexOf(kwd);
						if (bi !== ei) {
							if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one.
								ba[i] = ba[i].split(kwd).join("");
							} else if (bi === -1) { //if the keyword isn't in the beginning, add it.
								ba[i] += " " + kwd;
							}
						}
					}
				}
				b = ba.join(", ");
				e = ea.join(", ");
			}
			return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio);
		};

		/**
		 * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call:
		 * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this);
		 * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that).
		 * @param {!Object} t Target object whose property is being tweened
		 * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object).
		 * @param {!string} p Property name
		 * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween.
		 * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it)
		 * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance.
		 * @param {Object=} vars Original vars object that contains the data for parsing.
		 * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call.
		 */
		p.parse = function(t, e, p, cssp, pt, plugin, vars) {
			return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin);
		};

		/**
		 * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters:
		 *  1) Target object whose property should be tweened (typically a DOM element)
		 *  2) The end/destination value (could be a string, number, object, or whatever you want)
		 *  3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration)
		 *
		 * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example:
		 *
		 * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) {
		 *      var start = target.style.width;
		 *      return function(ratio) {
		 *              target.style.width = (start + value * ratio) + "px";
		 *              console.log("set width to " + target.style.width);
		 *          }
		 * }, 0);
		 *
		 * Then, when I do this tween, it will trigger my special property:
		 *
		 * TweenLite.to(element, 1, {css:{myCustomProp:100}});
		 *
		 * In the example, of course, we're just changing the width, but you can do anything you want.
		 *
		 * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}})
		 * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function.
		 * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones.
		 */
		CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) {
			_registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) {
				var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority);
				rv.plugin = plugin;
				rv.setRatio = onInitTween(t, e, cssp._tween, p);
				return rv;
			}, priority:priority});
		};






		//transform-related methods and properties
		CSSPlugin.useSVGTransformAttr = true; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this).
		var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
			_transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
			_transformPropCSS = _prefixCSS + "transform",
			_transformOriginProp = _checkPropPrefix("transformOrigin"),
			_supports3D = (_checkPropPrefix("perspective") !== null),
			Transform = _internals.Transform = function() {
				this.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
				this.force3D = (CSSPlugin.defaultForce3D === false || !_supports3D) ? false : CSSPlugin.defaultForce3D || "auto";
			},
			_SVGElement = _gsScope.SVGElement,
			_useSVGTransformAttr,
			//Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future.

			_createSVG = function(type, container, attributes) {
				var element = _doc.createElementNS("http://www.w3.org/2000/svg", type),
					reg = /([a-z])([A-Z])/g,
					p;
				for (p in attributes) {
					element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]);
				}
				container.appendChild(element);
				return element;
			},
			_docElement = _doc.documentElement || {},
			_forceSVGTransformAttr = (function() {
				//IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element
				var force = _ieVers || (/Android/i.test(_agent) && !_gsScope.chrome),
					svg, rect, width;
				if (_doc.createElementNS && _docElement.appendChild && !force) { //IE8 and earlier doesn't support SVG anyway
					svg = _createSVG("svg", _docElement);
					rect = _createSVG("rect", svg, {width:100, height:50, x:100});
					width = rect.getBoundingClientRect().width;
					rect.style[_transformOriginProp] = "50% 50%";
					rect.style[_transformProp] = "scaleX(0.5)";
					force = (width === rect.getBoundingClientRect().width && !(_isFirefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D).
					_docElement.removeChild(svg);
				}
				return force;
			})(),
			_parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin, skipRecord) {
				var tm = e._gsTransform,
					m = _getMatrix(e, true),
					v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld;
				if (tm) {
					xOriginOld = tm.xOrigin; //record the original values before we alter them.
					yOriginOld = tm.yOrigin;
				}
				if (!absolute || (v = absolute.split(" ")).length < 2) {
					b = e.getBBox();
					if (b.x === 0 && b.y === 0 && b.width + b.height === 0) { //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case.
						b = {x: parseFloat(e.hasAttribute("x") ? e.getAttribute("x") : e.hasAttribute("cx") ? e.getAttribute("cx") : 0) || 0, y: parseFloat(e.hasAttribute("y") ? e.getAttribute("y") : e.hasAttribute("cy") ? e.getAttribute("cy") : 0) || 0, width:0, height:0};
					}
					local = _parsePosition(local).split(" ");
					v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x,
						 (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y];
				}
				decoratee.xOrigin = xOrigin = parseFloat(v[0]);
				decoratee.yOrigin = yOrigin = parseFloat(v[1]);
				if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas.
					a = m[0];
					b = m[1];
					c = m[2];
					d = m[3];
					tx = m[4];
					ty = m[5];
					determinant = (a * d - b * c);
					if (determinant) { //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero.
						x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant);
						y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant);
						xOrigin = decoratee.xOrigin = v[0] = x;
						yOrigin = decoratee.yOrigin = v[1] = y;
					}
				}
				if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly
					if (skipRecord) {
						decoratee.xOffset = tm.xOffset;
						decoratee.yOffset = tm.yOffset;
						tm = decoratee;
					}
					if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) {
						x = xOrigin - xOriginOld;
						y = yOrigin - yOriginOld;
						//originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility.
						//tm.x -= x - (x * m[0] + y * m[2]);
						//tm.y -= y - (x * m[1] + y * m[3]);
						tm.xOffset += (x * m[0] + y * m[2]) - x;
						tm.yOffset += (x * m[1] + y * m[3]) - y;
					} else {
						tm.xOffset = tm.yOffset = 0;
					}
				}
				if (!skipRecord) {
					e.setAttribute("data-svg-origin", v.join(" "));
				}
			},
			_getBBoxHack = function(swapIfPossible) { //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a <defs> element and/or <mask>. We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it).
				var svg = _createElement("svg", (this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns")) || "http://www.w3.org/2000/svg"),
					oldParent = this.parentNode,
					oldSibling = this.nextSibling,
					oldCSS = this.style.cssText,
					bbox;
				_docElement.appendChild(svg);
				svg.appendChild(this);
				this.style.display = "block";
				if (swapIfPossible) {
					try {
						bbox = this.getBBox();
						this._originalGetBBox = this.getBBox;
						this.getBBox = _getBBoxHack;
					} catch (e) { }
				} else if (this._originalGetBBox) {
					bbox = this._originalGetBBox();
				}
				if (oldSibling) {
					oldParent.insertBefore(this, oldSibling);
				} else {
					oldParent.appendChild(this);
				}
				_docElement.removeChild(svg);
				this.style.cssText = oldCSS;
				return bbox;
			},
			_getBBox = function(e) {
				try {
					return e.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a <symbol> or <defs>). https://bugzilla.mozilla.org/show_bug.cgi?id=612118
				} catch (error) {
					return _getBBoxHack.call(e, true);
				}
			},
			_isSVG = function(e) { //reports if the element is an SVG on which getBBox() actually works
				return !!(_SVGElement && e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
			},
			_identity2DMatrix = [1,0,0,1,0,0],
			_getMatrix = function(e, force2D) {
				var tm = e._gsTransform || new Transform(),
					rnd = 100000,
					style = e.style,
					isDefault, s, m, n, dec, nextSibling, parent;
				if (_transformProp) {
					s = _getStyle(e, _transformPropCSS, null, true);
				} else if (e.currentStyle) {
					//for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix.
					s = e.currentStyle.filter.match(_ieGetMatrixExp);
					s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : "";
				}
				isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)");
				if (_transformProp && isDefault && !e.offsetParent && e !== _docElement) { //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397
					//browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px).
					n = style.display;
					style.display = "block";
					parent = e.parentNode;
					if (!parent || !e.offsetParent) {
						dec = 1; //flag
						nextSibling = e.nextSibling;
						_docElement.appendChild(e); //we must add it to the DOM in order to get values properly
					}
					s = _getStyle(e, _transformPropCSS, null, true);
					isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)");
					if (n) {
						style.display = n;
					} else {
						_removeProp(style, "display");
					}
					if (dec) {
						if (nextSibling) {
							parent.insertBefore(e, nextSibling);
						} else if (parent) {
							parent.appendChild(e);
						} else {
							_docElement.removeChild(e);
						}
					}
				}
				if (tm.svg || (e.getCTM && _isSVG(e))) {
					if (isDefault && (style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values
						s = style[_transformProp];
						isDefault = 0;
					}
					m = e.getAttribute("transform");
					if (isDefault && m) {
						m = e.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix.
						s = "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + m.e + "," + m.f + ")";
						isDefault = 0;
					}
				}
				if (isDefault) {
					return _identity2DMatrix;
				}
				//split the matrix values out into an array (m for matrix)
				m = (s || "").match(_numExp) || [];
				i = m.length;
				while (--i > -1) {
					n = Number(m[i]);
					m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
				}
				return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m;
			},

			/**
			 * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10.
			 * @param {!Object} t target element
			 * @param {Object=} cs computed style object (optional)
			 * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...}
			 * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style)
			 * @return {object} object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...}
			 */
			_getTransform = _internals.getTransform = function(t, cs, rec, parse) {
				if (t._gsTransform && rec && !parse) {
					return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things.
				}
				var tm = rec ? t._gsTransform || new Transform() : new Transform(),
					invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent.
					min = 0.00002,
					rnd = 100000,
					zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin  || 0 : 0,
					defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0,
					m, i, scaleX, scaleY, rotation, skewX;

				tm.svg = !!(t.getCTM && _isSVG(t));
				if (tm.svg) {
					_parseSVGOrigin(t, _getStyle(t, _transformOriginProp, cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin"));
					_useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr;
				}
				m = _getMatrix(t);
				if (m !== _identity2DMatrix) {

					if (m.length === 16) {
						//we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values)
						var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
							a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
							a13 = m[8], a23 = m[9], a33 = m[10],
							a14 = m[12], a24 = m[13], a34 = m[14],
							a43 = m[11],
							angle = Math.atan2(a32, a33),
							t1, t2, t3, t4, cos, sin;
						//we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
						if (tm.zOrigin) {
							a34 = -tm.zOrigin;
							a14 = a13*a34-m[12];
							a24 = a23*a34-m[13];
							a34 = a33*a34+tm.zOrigin-m[14];
						}
						//note for possible future consolidation: rotationX: Math.atan2(a32, a33), rotationY: Math.atan2(-a31, Math.sqrt(a33 * a33 + a32 * a32)), rotation: Math.atan2(a21, a11), skew: Math.atan2(a12, a22). However, it doesn't seem to be quite as reliable as the full-on backwards rotation procedure.
						tm.rotationX = angle * _RAD2DEG;
						//rotationX
						if (angle) {
							cos = Math.cos(-angle);
							sin = Math.sin(-angle);
							t1 = a12*cos+a13*sin;
							t2 = a22*cos+a23*sin;
							t3 = a32*cos+a33*sin;
							a13 = a12*-sin+a13*cos;
							a23 = a22*-sin+a23*cos;
							a33 = a32*-sin+a33*cos;
							a43 = a42*-sin+a43*cos;
							a12 = t1;
							a22 = t2;
							a32 = t3;
						}
						//rotationY
						angle = Math.atan2(-a31, a33);
						tm.rotationY = angle * _RAD2DEG;
						if (angle) {
							cos = Math.cos(-angle);
							sin = Math.sin(-angle);
							t1 = a11*cos-a13*sin;
							t2 = a21*cos-a23*sin;
							t3 = a31*cos-a33*sin;
							a23 = a21*sin+a23*cos;
							a33 = a31*sin+a33*cos;
							a43 = a41*sin+a43*cos;
							a11 = t1;
							a21 = t2;
							a31 = t3;
						}
						//rotationZ
						angle = Math.atan2(a21, a11);
						tm.rotation = angle * _RAD2DEG;
						if (angle) {
							cos = Math.cos(angle);
							sin = Math.sin(angle);
							t1 = a11*cos+a21*sin;
							t2 = a12*cos+a22*sin;
							t3 = a13*cos+a23*sin;
							a21 = a21*cos-a11*sin;
							a22 = a22*cos-a12*sin;
							a23 = a23*cos-a13*sin;
							a11 = t1;
							a12 = t2;
							a13 = t3;
						}

						if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here.
							tm.rotationX = tm.rotation = 0;
							tm.rotationY = 180 - tm.rotationY;
						}

						//skewX
						angle = Math.atan2(a12, a22);

						//scales
						tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21 + a31 * a31) * rnd + 0.5) | 0) / rnd;
						tm.scaleY = ((Math.sqrt(a22 * a22 + a32 * a32) * rnd + 0.5) | 0) / rnd;
						tm.scaleZ = ((Math.sqrt(a13 * a13 + a23 * a23 + a33 * a33) * rnd + 0.5) | 0) / rnd;
						a11 /= tm.scaleX;
						a12 /= tm.scaleY;
						a21 /= tm.scaleX;
						a22 /= tm.scaleY;
						if (Math.abs(angle) > min) {
							tm.skewX = angle * _RAD2DEG;
							a12 = 0; //unskews
							if (tm.skewType !== "simple") {
								tm.scaleY *= 1 / Math.cos(angle); //by default, we compensate the scale based on the skew so that the element maintains a similar proportion when skewed, so we have to alter the scaleY here accordingly to match the default (non-adjusted) skewing that CSS does (stretching more and more as it skews).
							}

						} else {
							tm.skewX = 0;
						}

						/* //for testing purposes
						var transform = "matrix3d(",
							comma = ",",
							zero = "0";
						a13 /= tm.scaleZ;
						a23 /= tm.scaleZ;
						a31 /= tm.scaleX;
						a32 /= tm.scaleY;
						a33 /= tm.scaleZ;
						transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31);
						transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22);
						transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13);
						transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma;
						transform += a14 + comma + a24 + comma + a34 + comma + (tm.perspective ? (1 + (-a34 / tm.perspective)) : 1) + ")";
						console.log(transform);
						document.querySelector(".test").style[_transformProp] = transform;
						*/

						tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
						tm.x = a14;
						tm.y = a24;
						tm.z = a34;
						if (tm.svg) {
							tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12);
							tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22);
						}

					} else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY))) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those.
						var k = (m.length >= 6),
							a = k ? m[0] : 1,
							b = m[1] || 0,
							c = m[2] || 0,
							d = k ? m[3] : 1;
						tm.x = m[4] || 0;
						tm.y = m[5] || 0;
						scaleX = Math.sqrt(a * a + b * b);
						scaleY = Math.sqrt(d * d + c * c);
						rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist).
						skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
						tm.scaleX = scaleX;
						tm.scaleY = scaleY;
						tm.rotation = rotation;
						tm.skewX = skewX;
						if (_supports3D) {
							tm.rotationX = tm.rotationY = tm.z = 0;
							tm.perspective = defaultTransformPerspective;
							tm.scaleZ = 1;
						}
						if (tm.svg) {
							tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c);
							tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d);
						}
					}
					if (Math.abs(tm.skewX) > 90 && Math.abs(tm.skewX) < 270) {
						if (invX) {
							tm.scaleX *= -1;
							tm.skewX += (tm.rotation <= 0) ? 180 : -180;
							tm.rotation += (tm.rotation <= 0) ? 180 : -180;
						} else {
							tm.scaleY *= -1;
							tm.skewX += (tm.skewX <= 0) ? 180 : -180;
						}
					}
					tm.zOrigin = zOrigin;
					//some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate.
					for (i in tm) {
						if (tm[i] < min) if (tm[i] > -min) {
							tm[i] = 0;
						}
					}
				}
				//DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin);
				if (rec) {
					t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method)
					if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean.
						if (_useSVGTransformAttr && t.style[_transformProp]) {
							TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it).
								_removeProp(t.style, _transformProp);
							});
						} else if (!_useSVGTransformAttr && t.getAttribute("transform")) {
							TweenLite.delayedCall(0.001, function(){
								t.removeAttribute("transform");
							});
						}
					}
				}
				return tm;
			},

			//for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms)
			_setIETransformRatio = function(v) {
				var t = this.data, //refers to the element's _gsTransform object
					ang = -t.rotation * _DEG2RAD,
					skew = ang + t.skewX * _DEG2RAD,
					rnd = 100000,
					a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd,
					b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd,
					c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd,
					d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd,
					style = this.t.style,
					cs = this.t.currentStyle,
					filters, val;
				if (!cs) {
					return;
				}
				val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted)
				b = -c;
				c = -val;
				filters = cs.filter;
				style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight
				var w = this.t.offsetWidth,
					h = this.t.offsetHeight,
					clip = (cs.position !== "absolute"),
					m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d,
					ox = t.x + (w * t.xPercent / 100),
					oy = t.y + (h * t.yPercent / 100),
					dx, dy;

				//if transformOrigin is being used, adjust the offset x and y
				if (t.ox != null) {
					dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2;
					dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2;
					ox += dx - (dx * a + dy * b);
					oy += dy - (dx * c + dy * d);
				}

				if (!clip) {
					m += ", sizingMethod='auto expand')";
				} else {
					dx = (w / 2);
					dy = (h / 2);
					//translate to ensure that transformations occur around the correct origin (default is center).
					m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")";
				}
				if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) {
					style.filter = filters.replace(_ieSetMatrixExp, m);
				} else {
					style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha.
				}

				//at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance.
				if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) {
					style.removeAttribute("filter");
				}

				//we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration).
				if (!clip) {
					var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom
						marg, prop, dif;
					dx = t.ieOffsetX || 0;
					dy = t.ieOffsetY || 0;
					t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox);
					t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy);
					for (i = 0; i < 4; i++) {
						prop = _margins[i];
						marg = cs[prop];
						//we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes)
						val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0;
						if (val !== t[prop]) {
							dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible.
						} else {
							dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY;
						}
						style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px";
					}
				}
			},

			/* translates a super small decimal to a string WITHOUT scientific notation
			_safeDecimal = function(n) {
				var s = (n < 0 ? -n : n) + "",
					a = s.split("e-");
				return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join("");
			},
			*/

			_setTransformRatio = _internals.set3DTransformRatio = _internals.setTransformRatio = function(v) {
				var t = this.data, //refers to the element's _gsTransform object
					style = this.t.style,
					angle = t.rotation,
					rotationX = t.rotationX,
					rotationY = t.rotationY,
					sx = t.scaleX,
					sy = t.scaleY,
					sz = t.scaleZ,
					x = t.x,
					y = t.y,
					z = t.z,
					isSVG = t.svg,
					perspective = t.perspective,
					force3D = t.force3D,
					skewY = t.skewY,
					skewX = t.skewX,
					t1,	a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43,
					zOrigin, min, cos, sin, t2, transform, comma, zero, skew, rnd;
				if (skewY) { //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees.
					skewX += skewY;
					angle += skewY;
				}

				//check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true)
				if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX && sz === 1) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween.

					//2D
					if (angle || skewX || isSVG) {
						angle *= _DEG2RAD;
						skew = skewX * _DEG2RAD;
						rnd = 100000;
						a11 = Math.cos(angle) * sx;
						a21 = Math.sin(angle) * sx;
						a12 = Math.sin(angle - skew) * -sy;
						a22 = Math.cos(angle - skew) * sy;
						if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does
							t1 = Math.tan(skew - skewY * _DEG2RAD);
							t1 = Math.sqrt(1 + t1 * t1);
							a12 *= t1;
							a22 *= t1;
							if (skewY) {
								t1 = Math.tan(skewY * _DEG2RAD);
								t1 = Math.sqrt(1 + t1 * t1);
								a11 *= t1;
								a21 *= t1;
							}
						}
						if (isSVG) {
							x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset;
							y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset;
							if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it.
								min = this.t.getBBox();
								x += t.xPercent * 0.01 * min.width;
								y += t.yPercent * 0.01 * min.height;
							}
							min = 0.000001;
							if (x < min) if (x > -min) {
								x = 0;
							}
							if (y < min) if (y > -min) {
								y = 0;
							}
						}
						transform = (((a11 * rnd) | 0) / rnd) + "," + (((a21 * rnd) | 0) / rnd) + "," + (((a12 * rnd) | 0) / rnd) + "," + (((a22 * rnd) | 0) / rnd) + "," + x + "," + y + ")";
						if (isSVG && _useSVGTransformAttr) {
							this.t.setAttribute("transform", "matrix(" + transform);
						} else {
							//some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places.
							style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + transform;
						}
					} else {
						style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + sx + ",0,0," + sy + "," + x + "," + y + ")";
					}
					return;

				}
				if (_isFirefox) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue.
					min = 0.0001;
					if (sx < min && sx > -min) {
						sx = sz = 0.00002;
					}
					if (sy < min && sy > -min) {
						sy = sz = 0.00002;
					}
					if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z).
						perspective = 0;
					}
				}
				if (angle || skewX) {
					angle *= _DEG2RAD;
					cos = a11 = Math.cos(angle);
					sin = a21 = Math.sin(angle);
					if (skewX) {
						angle -= skewX * _DEG2RAD;
						cos = Math.cos(angle);
						sin = Math.sin(angle);
						if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does
							t1 = Math.tan((skewX - skewY) * _DEG2RAD);
							t1 = Math.sqrt(1 + t1 * t1);
							cos *= t1;
							sin *= t1;
							if (t.skewY) {
								t1 = Math.tan(skewY * _DEG2RAD);
								t1 = Math.sqrt(1 + t1 * t1);
								a11 *= t1;
								a21 *= t1;
							}
						}
					}
					a12 = -sin;
					a22 = cos;

				} else if (!rotationY && !rotationX && sz === 1 && !perspective && !isSVG) { //if we're only translating and/or 2D scaling, this is faster...
					style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : "");
					return;
				} else {
					a11 = a22 = 1;
					a12 = a21 = 0;
				}
				// KEY  INDEX   AFFECTS a[row][column]
				// a11  0       rotation, rotationY, scaleX
				// a21  1       rotation, rotationY, scaleX
				// a31  2       rotationY, scaleX
				// a41  3       rotationY, scaleX
				// a12  4       rotation, skewX, rotationX, scaleY
				// a22  5       rotation, skewX, rotationX, scaleY
				// a32  6       rotationX, scaleY
				// a42  7       rotationX, scaleY
				// a13  8       rotationY, rotationX, scaleZ
				// a23  9       rotationY, rotationX, scaleZ
				// a33  10      rotationY, rotationX, scaleZ
				// a43  11      rotationY, rotationX, perspective, scaleZ
				// a14  12      x, zOrigin, svgOrigin
				// a24  13      y, zOrigin, svgOrigin
				// a34  14      z, zOrigin
				// a44  15
				// rotation: Math.atan2(a21, a11)
				// rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11))
				// rotationX: Math.atan2(a32, a33)
				a33 = 1;
				a13 = a23 = a31 = a32 = a41 = a42 = 0;
				a43 = (perspective) ? -1 / perspective : 0;
				zOrigin = t.zOrigin;
				min = 0.000001; //threshold below which browsers use scientific notation which won't work.
				comma = ",";
				zero = "0";
				angle = rotationY * _DEG2RAD;
				if (angle) {
					cos = Math.cos(angle);
					sin = Math.sin(angle);
					a31 = -sin;
					a41 = a43*-sin;
					a13 = a11*sin;
					a23 = a21*sin;
					a33 = cos;
					a43 *= cos;
					a11 *= cos;
					a21 *= cos;
				}
				angle = rotationX * _DEG2RAD;
				if (angle) {
					cos = Math.cos(angle);
					sin = Math.sin(angle);
					t1 = a12*cos+a13*sin;
					t2 = a22*cos+a23*sin;
					a32 = a33*sin;
					a42 = a43*sin;
					a13 = a12*-sin+a13*cos;
					a23 = a22*-sin+a23*cos;
					a33 = a33*cos;
					a43 = a43*cos;
					a12 = t1;
					a22 = t2;
				}
				if (sz !== 1) {
					a13*=sz;
					a23*=sz;
					a33*=sz;
					a43*=sz;
				}
				if (sy !== 1) {
					a12*=sy;
					a22*=sy;
					a32*=sy;
					a42*=sy;
				}
				if (sx !== 1) {
					a11*=sx;
					a21*=sx;
					a31*=sx;
					a41*=sx;
				}

				if (zOrigin || isSVG) {
					if (zOrigin) {
						x += a13*-zOrigin;
						y += a23*-zOrigin;
						z += a33*-zOrigin+zOrigin;
					}
					if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually
						x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset;
						y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset;
					}
					if (x < min && x > -min) {
						x = zero;
					}
					if (y < min && y > -min) {
						y = zero;
					}
					if (z < min && z > -min) {
						z = 0; //don't use string because we calculate perspective later and need the number.
					}
				}

				//optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall:
				transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d(");
				transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31);
				transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22);
				if (rotationX || rotationY || sz !== 1) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations)
					transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13);
					transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma;
				} else {
					transform += ",0,0,0,0,1,0,";
				}
				transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")";

				style[_transformProp] = transform;
			};

		p = Transform.prototype;
		p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0;
		p.scaleX = p.scaleY = p.scaleZ = 1;

		_registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, parsingProp, cssp, pt, plugin, vars) {
			if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it.
			cssp._lastParsedTransform = vars;
			var scaleFunc = (vars.scale && typeof(vars.scale) === "function") ? vars.scale : 0; //if there's a function-based "scale" value, swap in the resulting numeric value temporarily. Otherwise, if it's called for both scaleX and scaleY independently, they may not match (like if the function uses Math.random()).
			if (scaleFunc) {
				vars.scale = scaleFunc(_index, t);
			}
			var originalGSTransform = t._gsTransform,
				style = t.style,
				min = 0.000001,
				i = _transformProps.length,
				v = vars,
				endRotations = {},
				transformOriginString = "transformOrigin",
				m1 = _getTransform(t, _cs, true, v.parseTransform),
				orig = v.transform && ((typeof(v.transform) === "function") ? v.transform(_index, _target) : v.transform),
				m2, copy, has3D, hasChange, dr, x, y, matrix, p;
			m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType;
			cssp._transform = m1;
			if ("rotationZ" in v) {
				v.rotation = v.rotationZ;
			}
			if (orig && typeof(orig) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)"
				copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly.
				copy[_transformProp] = orig;
				copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly.
				copy.position = "absolute";
				if (orig.indexOf("%") !== -1) { //%-based translations will fail unless we set the width/height to match the original target...
					copy.width = _getStyle(t, "width");
					copy.height = _getStyle(t, "height");
				}
				_doc.body.appendChild(_tempDiv);
				m2 = _getTransform(_tempDiv, null, false);
				if (m1.skewType === "simple") { //the default _getTransform() reports the skewX/scaleY as if skewType is "compensated", thus we need to adjust that here if skewType is "simple".
					m2.scaleY *= Math.cos(m2.skewX * _DEG2RAD);
				}
				if (m1.svg) { //if it's an SVG element, x/y part of the matrix will be affected by whatever we use as the origin and the offsets, so compensate here...
					x = m1.xOrigin;
					y = m1.yOrigin;
					m2.x -= m1.xOffset;
					m2.y -= m1.yOffset;
					if (v.transformOrigin || v.svgOrigin) { //if this tween is altering the origin, we must factor that in here. The actual work of recording the transformOrigin values and setting up the PropTween is done later (still inside this function) so we cannot leave the changes intact here - we only want to update the x/y accordingly.
						orig = {};
						_parseSVGOrigin(t, _parsePosition(v.transformOrigin), orig, v.svgOrigin, v.smoothOrigin, true);
						x = orig.xOrigin;
						y = orig.yOrigin;
						m2.x -= orig.xOffset - m1.xOffset;
						m2.y -= orig.yOffset - m1.yOffset;
					}
					if (x || y) {
						matrix = _getMatrix(_tempDiv, true);
						m2.x -= x - (x * matrix[0] + y * matrix[2]);
						m2.y -= y - (x * matrix[1] + y * matrix[3]);
					}
				}
				_doc.body.removeChild(_tempDiv);
				if (!m2.perspective) {
					m2.perspective = m1.perspective; //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case.
				}
				if (v.xPercent != null) {
					m2.xPercent = _parseVal(v.xPercent, m1.xPercent);
				}
				if (v.yPercent != null) {
					m2.yPercent = _parseVal(v.yPercent, m1.yPercent);
				}
			} else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object)
				m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX),
					scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY),
					scaleZ:_parseVal(v.scaleZ, m1.scaleZ),
					x:_parseVal(v.x, m1.x),
					y:_parseVal(v.y, m1.y),
					z:_parseVal(v.z, m1.z),
					xPercent:_parseVal(v.xPercent, m1.xPercent),
					yPercent:_parseVal(v.yPercent, m1.yPercent),
					perspective:_parseVal(v.transformPerspective, m1.perspective)};
				dr = v.directionalRotation;
				if (dr != null) {
					if (typeof(dr) === "object") {
						for (copy in dr) {
							v[copy] = dr[copy];
						}
					} else {
						v.rotation = dr;
					}
				}
				if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) {
					m2.x = 0;
					m2.xPercent = _parseVal(v.x, m1.xPercent);
				}
				if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) {
					m2.y = 0;
					m2.yPercent = _parseVal(v.y, m1.yPercent);
				}

				m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : m1.rotation, m1.rotation, "rotation", endRotations);
				if (_supports3D) {
					m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations);
					m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations);
				}
				m2.skewX = _parseAngle(v.skewX, m1.skewX);
				m2.skewY = _parseAngle(v.skewY, m1.skewY);
			}
			if (_supports3D && v.force3D != null) {
				m1.force3D = v.force3D;
				hasChange = true;
			}

			has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective);
			if (!has3D && v.scale != null) {
				m2.scaleZ = 1; //no need to tween scaleZ.
			}

			while (--i > -1) {
				p = _transformProps[i];
				orig = m2[p] - m1[p];
				if (orig > min || orig < -min || v[p] != null || _forcePT[p] != null) {
					hasChange = true;
					pt = new CSSPropTween(m1, p, m1[p], orig, pt);
					if (p in endRotations) {
						pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested
					}
					pt.xs0 = 0; //ensures the value stays numeric in setRatio()
					pt.plugin = plugin;
					cssp._overwriteProps.push(pt.n);
				}
			}

			orig = (typeof(v.transformOrigin) === "function") ? v.transformOrigin(_index, _target) : v.transformOrigin;
			if (m1.svg && (orig || v.svgOrigin)) {
				x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin
				y = m1.yOffset;
				_parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin);
				pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween.
				pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString);
				if (x !== m1.xOffset || y !== m1.yOffset) {
					pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString);
					pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString);
				}
				orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
			}
			if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
				if (_transformProp) {
					hasChange = true;
					p = _transformOriginProp;
					if (!orig) {
						orig = (_getStyle(t, p, _cs, false, "50% 50%") + "").split(" ");
						orig = orig[0] + " " + orig[1] + " " + m1.zOrigin + "px";
					}
					orig += "";
					pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString);
					pt.b = style[p];
					pt.plugin = plugin;
					if (_supports3D) {
						copy = m1.zOrigin;
						orig = orig.split(" ");
						m1.zOrigin = ((orig.length > 2) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method.
						pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)!
						pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here)
						pt.b = copy;
						pt.xs0 = pt.e = m1.zOrigin;
					} else {
						pt.xs0 = pt.e = orig;
					}

					//for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp).
				} else {
					_parsePosition(orig + "", m1);
				}
			}
			if (hasChange) {
				cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms();
			}
			if (scaleFunc) {
				vars.scale = scaleFunc;
			}
			return pt;
		}, allowFunc:true, prefix:true});

		_registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"});
		_registerComplexSpecialProp("clipPath", {defaultValue:"inset(0%)", prefix:true, multi:true, formatter:_getFormatter("inset(0% 0% 0% 0%)", false, true)});

		_registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) {
			e = this.format(e);
			var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],
				style = t.style,
				ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em;
			w = parseFloat(t.offsetWidth);
			h = parseFloat(t.offsetHeight);
			ea1 = e.split(" ");
			for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis!
				if (this.p.indexOf("border")) { //older browsers used a prefix
					props[i] = _checkPropPrefix(props[i]);
				}
				bs = bs2 = _getStyle(t, props[i], _cs, false, "0px");
				if (bs.indexOf(" ") !== -1) {
					bs2 = bs.split(" ");
					bs = bs2[0];
					bs2 = bs2[1];
				}
				es = es2 = ea1[i];
				bn = parseFloat(bs);
				bsfx = bs.substr((bn + "").length);
				rel = (es.charAt(1) === "=");
				if (rel) {
					en = parseInt(es.charAt(0)+"1", 10);
					es = es.substr(2);
					en *= parseFloat(es);
					esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || "";
				} else {
					en = parseFloat(es);
					esfx = es.substr((en + "").length);
				}
				if (esfx === "") {
					esfx = _suffixMap[p] || bsfx;
				}
				if (esfx !== bsfx) {
					hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent.
					vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number
					if (esfx === "%") {
						bs = (hn / w * 100) + "%";
						bs2 = (vn / h * 100) + "%";
					} else if (esfx === "em") {
						em = _convertToPixels(t, "borderLeft", 1, "em");
						bs = (hn / em) + "em";
						bs2 = (vn / em) + "em";
					} else {
						bs = hn + "px";
						bs2 = vn + "px";
					}
					if (rel) {
						es = (parseFloat(bs) + en) + esfx;
						es2 = (parseFloat(bs2) + en) + esfx;
					}
				}
				pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt);
			}
			return pt;
		}, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)});
		_registerComplexSpecialProp("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) {
			return _parseComplex(t.style, p, this.format(_getStyle(t, p, _cs, false, "0px 0px")), this.format(e), false, "0px", pt);
		}, prefix:true, formatter:_getFormatter("0px 0px", false, true)});
		_registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) {
			var bp = "background-position",
				cs = (_cs || _getComputedStyle(t, null)),
				bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase
				es = this.format(e),
				ba, ea, i, pct, overlap, src;
			if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1) && es.split(",").length < 2) {
				src = _getStyle(t, "backgroundImage").replace(_urlExp, "");
				if (src && src !== "none") {
					ba = bs.split(" ");
					ea = es.split(" ");
					_tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height
					i = 2;
					while (--i > -1) {
						bs = ba[i];
						pct = (bs.indexOf("%") !== -1);
						if (pct !== (ea[i].indexOf("%") !== -1)) {
							overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height;
							ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%";
						}
					}
					bs = ba.join(" ");
				}
			}
			return this.parseComplex(t.style, bs, es, pt, plugin);
		}, formatter:_parsePosition});
		_registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:function(v) {
			v += ""; //ensure it's a string
			return (v.substr(0,2) === "co") ? v : _parsePosition(v.indexOf(" ") === -1 ? v + " " + v : v); //if set to something like "100% 100%", Safari typically reports the computed style as just "100%" (no 2nd value), but we should ensure that there are two values, so copy the first one. Otherwise, it'd be interpreted as "100% 0" (wrong). Also remember that it could be "cover" or "contain" which we can't tween but should be able to set.
		}});
		_registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true});
		_registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true});
		_registerComplexSpecialProp("transformStyle", {prefix:true});
		_registerComplexSpecialProp("backfaceVisibility", {prefix:true});
		_registerComplexSpecialProp("userSelect", {prefix:true});
		_registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")});
		_registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")});
		_registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){
			var b, cs, delim;
			if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited.
				cs = t.currentStyle;
				delim = _ieVers < 8 ? " " : ",";
				b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")";
				e = this.format(e).split(",").join(delim);
			} else {
				b = this.format(_getStyle(t, this.p, _cs, false, this.dflt));
				e = this.format(e);
			}
			return this.parseComplex(t.style, b, e, pt, plugin);
		}});
		_registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true});
		_registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them)
		_registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) {
			var bw = _getStyle(t, "borderTopWidth", _cs, false, "0px"),
				end = this.format(e).split(" "),
				esfx = end[0].replace(_suffixExp, "");
			if (esfx !== "px") { //if we're animating to a non-px value, we need to convert the beginning width to that unit.
				bw = (parseFloat(bw) / _convertToPixels(t, "borderTopWidth", 1, esfx)) + esfx;
			}
			return this.parseComplex(t.style, this.format(bw + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), end.join(" "), pt, plugin);
			}, color:true, formatter:function(v) {
				var a = v.split(" ");
				return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0];
			}});
		_registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline).
		_registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) {
			var s = t.style,
				prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat";
			return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e);
		}});

		//opacity-related
		var _setIEOpacityRatio = function(v) {
				var t = this.t, //refers to the element's style property
					filters = t.filter || _getStyle(this.data, "filter") || "",
					val = (this.s + this.c * v) | 0,
					skip;
				if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters.
					if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) {
						t.removeAttribute("filter");
						skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check.
					} else {
						t.filter = filters.replace(_alphaFilterExp, "");
						skip = true;
					}
				}
				if (!skip) {
					if (this.xn1) {
						t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame.
					}
					if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues
						if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween)
							t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly.
						}
					} else {
						t.filter = filters.replace(_opacityExp, "opacity=" + val);
					}
				}
			};
		_registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) {
			var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")),
				style = t.style,
				isAutoAlpha = (p === "autoAlpha");
			if (typeof(e) === "string" && e.charAt(1) === "=") {
				e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b;
			}
			if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience)
				b = 0;
			}
			if (_supportsOpacity) {
				pt = new CSSPropTween(style, "opacity", b, e - b, pt);
			} else {
				pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt);
				pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug.
				style.zoom = 1; //helps correct an IE issue.
				pt.type = 2;
				pt.b = "alpha(opacity=" + pt.s + ")";
				pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")";
				pt.data = t;
				pt.plugin = plugin;
				pt.setRatio = _setIEOpacityRatio;
			}
			if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier
				pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit"));
				pt.xs0 = "inherit";
				cssp._overwriteProps.push(pt.n);
				cssp._overwriteProps.push(p);
			}
			return pt;
		}});


		var _removeProp = function(s, p) {
				if (p) {
					if (s.removeProperty) {
						if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example)
							p = "-" + p;
						}
						s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase());
					} else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()"
						s.removeAttribute(p);
					}
				}
			},
			_setClassNameRatio = function(v) {
				this.t._gsClassPT = this;
				if (v === 1 || v === 0) {
					this.t.setAttribute("class", (v === 0) ? this.b : this.e);
					var mpt = this.data, //first MiniPropTween
						s = this.t.style;
					while (mpt) {
						if (!mpt.v) {
							_removeProp(s, mpt.p);
						} else {
							s[mpt.p] = mpt.v;
						}
						mpt = mpt._next;
					}
					if (v === 1 && this.t._gsClassPT === this) {
						this.t._gsClassPT = null;
					}
				} else if (this.t.getAttribute("class") !== this.e) {
					this.t.setAttribute("class", this.e);
				}
			};
		_registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) {
			var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable.
				cssText = t.style.cssText,
				difData, bs, cnpt, cnptLookup, mpt;
			pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2);
			pt.setRatio = _setClassNameRatio;
			pt.pr = -11;
			_hasPriority = true;
			pt.b = b;
			bs = _getAllStyles(t, _cs);
			//if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfering that were there just for class-specific values)
			cnpt = t._gsClassPT;
			if (cnpt) {
				cnptLookup = {};
				mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned.
				while (mpt) {
					cnptLookup[mpt.p] = 1;
					mpt = mpt._next;
				}
				cnpt.setRatio(1);
			}
			t._gsClassPT = pt;
			pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("(?:\\s|^)" + e.substr(2) + "(?![\\w-])"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : "");
			t.setAttribute("class", pt.e);
			difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup);
			t.setAttribute("class", b);
			pt.data = difData.firstMPT;
			if (t.style.cssText !== cssText) { //only apply if things change. Otherwise, in cases like a background-image that's pulled dynamically, it could cause a refresh. See https://greensock.com/forums/topic/20368-possible-gsap-bug-switching-classnames-in-chrome/.
				t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity).
			}
			pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself)
			return pt;
		}});


		var _setClearPropsRatio = function(v) {
			if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in).
				var s = this.t.style,
					transformParse = _specialProps.transform.parse,
					a, p, i, clearTransform, transform;
				if (this.e === "all") {
					s.cssText = "";
					clearTransform = true;
				} else {
					a = this.e.split(" ").join("").split(",");
					i = a.length;
					while (--i > -1) {
						p = a[i];
						if (_specialProps[p]) {
							if (_specialProps[p].parse === transformParse) {
								clearTransform = true;
							} else {
								p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow"
							}
						}
						_removeProp(s, p);
					}
				}
				if (clearTransform) {
					_removeProp(s, _transformProp);
					transform = this.t._gsTransform;
					if (transform) {
						if (transform.svg) {
							this.t.removeAttribute("data-svg-origin");
							this.t.removeAttribute("transform");
						}
						delete this.t._gsTransform;
					}
				}

			}
		};
		_registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) {
			pt = new CSSPropTween(t, p, 0, 0, pt, 2);
			pt.setRatio = _setClearPropsRatio;
			pt.e = e;
			pt.pr = -10;
			pt.data = cssp._tween;
			_hasPriority = true;
			return pt;
		}});

		p = "bezier,throwProps,physicsProps,physics2D".split(",");
		i = p.length;
		while (i--) {
			_registerPluginProp(p[i]);
		}








		p = CSSPlugin.prototype;
		p._firstPT = p._lastParsedTransform = p._transform = null;

		//gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc.
		p._onInitTween = function(target, vars, tween, index) {
			if (!target.nodeType) { //css is only for dom elements
				return false;
			}
			this._target = _target = target;
			this._tween = tween;
			this._vars = vars;
			_index = index;
			_autoRound = vars.autoRound;
			_hasPriority = false;
			_suffixMap = vars.suffixMap || CSSPlugin.suffixMap;
			_cs = _getComputedStyle(target, "");
			_overwriteProps = this._overwriteProps;
			var style = target.style,
				v, pt, pt2, first, last, next, zIndex, tpt, threeD;
			if (_reqSafariFix) if (style.zIndex === "") {
				v = _getStyle(target, "zIndex", _cs);
				if (v === "auto" || v === "") {
					//corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive.
					this._addLazySet(style, "zIndex", 0);
				}
			}

			if (typeof(vars) === "string") {
				first = style.cssText;
				v = _getAllStyles(target, _cs);
				style.cssText = first + ";" + vars;
				v = _cssDif(target, v, _getAllStyles(target)).difs;
				if (!_supportsOpacity && _opacityValExp.test(vars)) {
					v.opacity = parseFloat( RegExp.$1 );
				}
				vars = v;
				style.cssText = first;
			}

			if (vars.className) { //className tweens will combine any differences they find in the css with the vars that are passed in, so {className:"myClass", scale:0.5, left:20} would work.
				this._firstPT = pt = _specialProps.className.parse(target, vars.className, "className", this, null, null, vars);
			} else {
				this._firstPT = pt = this.parse(target, vars, null);
			}

			if (this._transformType) {
				threeD = (this._transformType === 3);
				if (!_transformProp) {
					style.zoom = 1; //helps correct an IE issue.
				} else if (_isSafari) {
					_reqSafariFix = true;
					//if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random).
					if (style.zIndex === "") {
						zIndex = _getStyle(target, "zIndex", _cs);
						if (zIndex === "auto" || zIndex === "") {
							this._addLazySet(style, "zIndex", 0);
						}
					}
					//Setting WebkitBackfaceVisibility corrects 3 bugs:
					// 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update.
					// 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly.
					// 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug.
					//Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween.
					if (_isSafariLT6) {
						this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden"));
					}
				}
				pt2 = pt;
				while (pt2 && pt2._next) {
					pt2 = pt2._next;
				}
				tpt = new CSSPropTween(target, "transform", 0, 0, null, 2);
				this._linkCSSP(tpt, null, pt2);
				tpt.setRatio = _transformProp ? _setTransformRatio : _setIETransformRatio;
				tpt.data = this._transform || _getTransform(target, _cs, true);
				tpt.tween = tween;
				tpt.pr = -1; //ensures that the transforms get applied after the components are updated.
				_overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here.
			}

			if (_hasPriority) {
				//reorders the linked list in order of pr (priority)
				while (pt) {
					next = pt._next;
					pt2 = first;
					while (pt2 && pt2.pr > pt.pr) {
						pt2 = pt2._next;
					}
					if ((pt._prev = pt2 ? pt2._prev : last)) {
						pt._prev._next = pt;
					} else {
						first = pt;
					}
					if ((pt._next = pt2)) {
						pt2._prev = pt;
					} else {
						last = pt;
					}
					pt = next;
				}
				this._firstPT = first;
			}
			return true;
		};


		p.parse = function(target, vars, pt, plugin) {
			var style = target.style,
				p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel;
			for (p in vars) {
				es = vars[p]; //ending value string
				sp = _specialProps[p]; //SpecialProp lookup.
				if (typeof(es) === "function" && !(sp && sp.allowFunc)) {
					es = es(_index, _target);
				}
				if (sp) {
					pt = sp.parse(target, es, p, this, pt, plugin, vars);
				} else if (p.substr(0,2) === "--") { //for tweening CSS variables (which always start with "--"). To maximize performance and simplicity, we bypass CSSPlugin altogether and just add a normal property tween to the tween instance itself.
					this._tween._propLookup[p] = this._addTween.call(this._tween, target.style, "setProperty", _getComputedStyle(target).getPropertyValue(p) + "", es + "", p, false, p);
					continue;
				} else {
					bs = _getStyle(target, p, _cs) + "";
					isStr = (typeof(es) === "string");
					if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor:
						if (!isStr) {
							es = _parseColor(es);
							es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")";
						}
						pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin);

					} else if (isStr && _complexExp.test(es)) {
						pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin);

					} else {
						bn = parseFloat(bs);
						bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case.

						if (bs === "" || bs === "auto") {
							if (p === "width" || p === "height") {
								bn = _getDimension(target, p, _cs);
								bsfx = "px";
							} else if (p === "left" || p === "top") {
								bn = _calculateOffset(target, p, _cs);
								bsfx = "px";
							} else {
								bn = (p !== "opacity") ? 0 : 1;
								bsfx = "";
							}
						}

						rel = (isStr && es.charAt(1) === "=");
						if (rel) {
							en = parseInt(es.charAt(0) + "1", 10);
							es = es.substr(2);
							en *= parseFloat(es);
							esfx = es.replace(_suffixExp, "");
						} else {
							en = parseFloat(es);
							esfx = isStr ? es.replace(_suffixExp, "") : "";
						}

						if (esfx === "") {
							esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix.
						}

						es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix.
						//if the beginning/ending suffixes don't match, normalize them...
						if (bsfx !== esfx) if (esfx !== "" || p === "lineHeight") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units!
							bn = _convertToPixels(target, p, bn, bsfx);
							if (esfx === "%") {
								bn /= _convertToPixels(target, p, 100, "%") / 100;
								if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens.
									bs = bn + "%";
								}

							} else if (esfx === "em" || esfx === "rem" || esfx === "vw" || esfx === "vh") {
								bn /= _convertToPixels(target, p, 1, esfx);

							//otherwise convert to pixels.
							} else if (esfx !== "px") {
								en = _convertToPixels(target, p, en, esfx);
								esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too.
							}
							if (rel) if (en || en === 0) {
								es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here.
							}
						}

						if (rel) {
							en += bn;
						}

						if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly.
							pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es);
							pt.xs0 = esfx;
							//DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0);
						} else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) {
							_log("invalid " + p + " tween value: " + vars[p]);
						} else {
							pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es);
							pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween.
							//DEBUG: _log("non-tweening value "+p+": "+pt.xs0);
						}
					}
				}
				if (plugin) if (pt && !pt.plugin) {
					pt.plugin = plugin;
				}
			}
			return pt;
		};


		//gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1.
		p.setRatio = function(v) {
			var pt = this._firstPT,
				min = 0.000001,
				val, str, i;
			//at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards).
			if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) {
				while (pt) {
					if (pt.type !== 2) {
						if (pt.r && pt.type !== -1) {
							val = pt.r(pt.s + pt.c);
							if (!pt.type) {
								pt.t[pt.p] = val + pt.xs0;
							} else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)"
								i = pt.l;
								str = pt.xs0 + val + pt.xs1;
								for (i = 1; i < pt.l; i++) {
									str += pt["xn"+i] + pt["xs"+(i+1)];
								}
								pt.t[pt.p] = str;
							}
						} else {
							pt.t[pt.p] = pt.e;
						}
					} else {
						pt.setRatio(v);
					}
					pt = pt._next;
				}

			} else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) {
				while (pt) {
					val = pt.c * v + pt.s;
					if (pt.r) {
						val = pt.r(val);
					} else if (val < min) if (val > -min) {
						val = 0;
					}
					if (!pt.type) {
						pt.t[pt.p] = val + pt.xs0;
					} else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)"
						i = pt.l;
						if (i === 2) {
							pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2;
						} else if (i === 3) {
							pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3;
						} else if (i === 4) {
							pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4;
						} else if (i === 5) {
							pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5;
						} else {
							str = pt.xs0 + val + pt.xs1;
							for (i = 1; i < pt.l; i++) {
								str += pt["xn"+i] + pt["xs"+(i+1)];
							}
							pt.t[pt.p] = str;
						}

					} else if (pt.type === -1) { //non-tweening value
						pt.t[pt.p] = pt.xs0;

					} else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc.
						pt.setRatio(v);
					}
					pt = pt._next;
				}

			//if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever).
			} else {
				while (pt) {
					if (pt.type !== 2) {
						pt.t[pt.p] = pt.b;
					} else {
						pt.setRatio(v);
					}
					pt = pt._next;
				}
			}
		};

		/**
		 * @private
		 * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called.
		 * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked
		 * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call
		 * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin
		 * doesn't have any transform-related properties of its own. You can call this method as many times as you
		 * want and it won't create duplicate CSSPropTweens.
		 *
		 * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster)
		 */
		p._enableTransforms = function(threeD) {
			this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values.
			this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2;
		};

		var lazySet = function(v) {
			this.t[this.p] = this.e;
			this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop.
		};
		/** @private Gives us a way to set a value on the first render (and only the first render). **/
		p._addLazySet = function(t, p, v) {
			var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2);
			pt.e = v;
			pt.setRatio = lazySet;
			pt.data = this;
		};

		/** @private **/
		p._linkCSSP = function(pt, next, prev, remove) {
			if (pt) {
				if (next) {
					next._prev = pt;
				}
				if (pt._next) {
					pt._next._prev = pt._prev;
				}
				if (pt._prev) {
					pt._prev._next = pt._next;
				} else if (this._firstPT === pt) {
					this._firstPT = pt._next;
					remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed)
				}
				if (prev) {
					prev._next = pt;
				} else if (!remove && this._firstPT === null) {
					this._firstPT = pt;
				}
				pt._next = next;
				pt._prev = prev;
			}
			return pt;
		};

		p._mod = function(lookup) {
			var pt = this._firstPT;
			while (pt) {
				if (typeof(lookup[pt.p]) === "function") { //only gets called by RoundPropsPlugin (ModifyPlugin manages all the rendering internally for CSSPlugin properties that need modification). Remember, we handle rounding a bit differently in this plugin for performance reasons, leveraging "r" as an indicator that the value should be rounded internally.
					pt.r = lookup[pt.p];
				}
				pt = pt._next;
			}
		};

		//we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property.
		p._kill = function(lookup) {
			var copy = lookup,
				pt, p, xfirst;
			if (lookup.autoAlpha || lookup.alpha) {
				copy = {};
				for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere.
					copy[p] = lookup[p];
				}
				copy.opacity = 1;
				if (copy.autoAlpha) {
					copy.visibility = 1;
				}
			}
			if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst".
				xfirst = pt.xfirst;
				if (xfirst && xfirst._prev) {
					this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev
				} else if (xfirst === this._firstPT) {
					this._firstPT = pt._next;
				}
				if (pt._next) {
					this._linkCSSP(pt._next, pt._next._next, xfirst._prev);
				}
				this._classNamePT = null;
			}
			pt = this._firstPT;
			while (pt) {
				if (pt.plugin && pt.plugin !== p && pt.plugin._kill) { //for plugins that are registered with CSSPlugin, we should notify them of the kill.
					pt.plugin._kill(lookup);
					p = pt.plugin;
				}
				pt = pt._next;
			}
			return TweenPlugin.prototype._kill.call(this, copy);
		};



		//used by cascadeTo() for gathering all the style properties of each child element into an array for comparison.
		var _getChildStyles = function(e, props, targets) {
				var children, i, child, type;
				if (e.slice) {
					i = e.length;
					while (--i > -1) {
						_getChildStyles(e[i], props, targets);
					}
					return;
				}
				children = e.childNodes;
				i = children.length;
				while (--i > -1) {
					child = children[i];
					type = child.type;
					if (child.style) {
						props.push(_getAllStyles(child));
						if (targets) {
							targets.push(child);
						}
					}
					if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) {
						_getChildStyles(child, props, targets);
					}
				}
			};

		/**
		 * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite
		 * and then compares the style properties of all the target's child elements at the tween's start and end, and
		 * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting
		 * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is
		 * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens
		 * is because it creates entirely new tweens that may have completely different targets than the original tween,
		 * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API
		 * and it would create other problems. For example:
		 *  - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted)
		 *  - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others.
		 *  - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed.
		 *
		 * @param {Object} target object to be tweened
		 * @param {number} Duration in seconds (or frames for frames-based tweens)
		 * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone}
		 * @return {Array} An array of TweenLite instances
		 */
		CSSPlugin.cascadeTo = function(target, duration, vars) {
			var tween = TweenLite.to(target, duration, vars),
				results = [tween],
				b = [],
				e = [],
				targets = [],
				_reservedProps = TweenLite._internals.reservedProps,
				i, difs, p, from;
			target = tween._targets || tween.target;
			_getChildStyles(target, b, targets);
			tween.render(duration, true, true);
			_getChildStyles(target, e);
			tween.render(0, true, true);
			tween._enabled(true);
			i = targets.length;
			while (--i > -1) {
				difs = _cssDif(targets[i], b[i], e[i]);
				if (difs.firstMPT) {
					difs = difs.difs;
					for (p in vars) {
						if (_reservedProps[p]) {
							difs[p] = vars[p];
						}
					}
					from = {};
					for (p in difs) {
						from[p] = b[i][p];
					}
					results.push(TweenLite.fromTo(targets[i], duration, from, difs));
				}
			}
			return results;
		};

		TweenPlugin.activate([CSSPlugin]);
		return CSSPlugin;

	}, true);

	
	
	
	
	
	
	
	
	
	
/*
 * ----------------------------------------------------------------
 * RoundPropsPlugin
 * ----------------------------------------------------------------
 */
	(function() {

		var RoundPropsPlugin = _gsScope._gsDefine.plugin({
				propName: "roundProps",
				version: "1.7.0",
				priority: -1,
				API: 2,

				//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
				init: function(target, value, tween) {
					this._tween = tween;
					return true;
				}

			}),
			_getRoundFunc = function(v) { //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc.
				var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1; //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed()
				return function(n) {
					return ((Math.round(n / v) * v * p) | 0) / p;
				};
			},
			_roundLinkedList = function(node, mod) {
				while (node) {
					if (!node.f && !node.blob) {
						node.m = mod || Math.round;
					}
					node = node._next;
				}
			},
			p = RoundPropsPlugin.prototype;

		p._onInitAllProps = function() {
			var tween = this._tween,
				rp = tween.vars.roundProps,
				lookup = {},
				rpt = tween._propLookup.roundProps,
				pt, next, i, p;
			if (typeof(rp) === "object" && !rp.push) {
				for (p in rp) {
					lookup[p] = _getRoundFunc(rp[p]);
				}
			} else {
				if (typeof(rp) === "string") {
					rp = rp.split(",");
				}
				i = rp.length;
				while (--i > -1) {
					lookup[rp[i]] = Math.round;
				}
			}

			for (p in lookup) {
				pt = tween._firstPT;
				while (pt) {
					next = pt._next; //record here, because it may get removed
					if (pt.pg) {
						pt.t._mod(lookup);
					} else if (pt.n === p) {
						if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values)
							_roundLinkedList(pt.t._firstPT, lookup[p]);
						} else {
							this._add(pt.t, p, pt.s, pt.c, lookup[p]);
							//remove from linked list
							if (next) {
								next._prev = pt._prev;
							}
							if (pt._prev) {
								pt._prev._next = next;
							} else if (tween._firstPT === pt) {
								tween._firstPT = next;
							}
							pt._next = pt._prev = null;
							tween._propLookup[p] = rpt;
						}
					}
					pt = next;
				}
			}
			return false;
		};

		p._add = function(target, p, s, c, mod) {
			this._addTween(target, p, s, s + c, p, mod || Math.round);
			this._overwriteProps.push(p);
		};

	}());










/*
 * ----------------------------------------------------------------
 * AttrPlugin
 * ----------------------------------------------------------------
 */

	(function() {

		_gsScope._gsDefine.plugin({
			propName: "attr",
			API: 2,
			version: "0.6.1",

			//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
			init: function(target, value, tween, index) {
				var p, end;
				if (typeof(target.setAttribute) !== "function") {
					return false;
				}
				for (p in value) {
					end = value[p];
					if (typeof(end) === "function") {
						end = end(index, target);
					}
					this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p);
					this._overwriteProps.push(p);
				}
				return true;
			}

		});

	}());










/*
 * ----------------------------------------------------------------
 * DirectionalRotationPlugin
 * ----------------------------------------------------------------
 */
	_gsScope._gsDefine.plugin({
		propName: "directionalRotation",
		version: "0.3.1",
		API: 2,

		//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
		init: function(target, value, tween, index) {
			if (typeof(value) !== "object") {
				value = {rotation:value};
			}
			this.finals = {};
			var cap = (value.useRadians === true) ? Math.PI * 2 : 360,
				min = 0.000001,
				p, v, start, end, dif, split;
			for (p in value) {
				if (p !== "useRadians") {
					end = value[p];
					if (typeof(end) === "function") {
						end = end(index, target);
					}
					split = (end + "").split("_");
					v = split[0];
					start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() );
					end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0;
					dif = end - start;
					if (split.length) {
						v = split.join("_");
						if (v.indexOf("short") !== -1) {
							dif = dif % cap;
							if (dif !== dif % (cap / 2)) {
								dif = (dif < 0) ? dif + cap : dif - cap;
							}
						}
						if (v.indexOf("_cw") !== -1 && dif < 0) {
							dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
						} else if (v.indexOf("ccw") !== -1 && dif > 0) {
							dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap;
						}
					}
					if (dif > min || dif < -min) {
						this._addTween(target, p, start, start + dif, p);
						this._overwriteProps.push(p);
					}
				}
			}
			return true;
		},

		//called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
		set: function(ratio) {
			var pt;
			if (ratio !== 1) {
				this._super.setRatio.call(this, ratio);
			} else {
				pt = this._firstPT;
				while (pt) {
					if (pt.f) {
						pt.t[pt.p](this.finals[pt.p]);
					} else {
						pt.t[pt.p] = this.finals[pt.p];
					}
					pt = pt._next;
				}
			}
		}

	})._autoCSS = true;







	
	
	
	
/*
 * ----------------------------------------------------------------
 * EasePack
 * ----------------------------------------------------------------
 */
	_gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
		
		var w = (_gsScope.GreenSockGlobals || _gsScope),
			gs = w.com.greensock,
			_2PI = Math.PI * 2,
			_HALF_PI = Math.PI / 2,
			_class = gs._class,
			_create = function(n, f) {
				var C = _class("easing." + n, function(){}, true),
					p = C.prototype = new Ease();
				p.constructor = C;
				p.getRatio = f;
				return C;
			},
			_easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist.
			_wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) {
				var C = _class("easing."+name, {
					easeOut:new EaseOut(),
					easeIn:new EaseIn(),
					easeInOut:new EaseInOut()
				}, true);
				_easeReg(C, name);
				return C;
			},
			EasePoint = function(time, value, next) {
				this.t = time;
				this.v = value;
				if (next) {
					this.next = next;
					next.prev = this;
					this.c = next.v - value;
					this.gap = next.t - time;
				}
			},

			//Back
			_createBack = function(n, f) {
				var C = _class("easing." + n, function(overshoot) {
						this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158;
						this._p2 = this._p1 * 1.525;
					}, true),
					p = C.prototype = new Ease();
				p.constructor = C;
				p.getRatio = f;
				p.config = function(overshoot) {
					return new C(overshoot);
				};
				return C;
			},

			Back = _wrap("Back",
				_createBack("BackOut", function(p) {
					return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1);
				}),
				_createBack("BackIn", function(p) {
					return p * p * ((this._p1 + 1) * p - this._p1);
				}),
				_createBack("BackInOut", function(p) {
					return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2);
				})
			),


			//SlowMo
			SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) {
				power = (power || power === 0) ? power : 0.7;
				if (linearRatio == null) {
					linearRatio = 0.7;
				} else if (linearRatio > 1) {
					linearRatio = 1;
				}
				this._p = (linearRatio !== 1) ? power : 0;
				this._p1 = (1 - linearRatio) / 2;
				this._p2 = linearRatio;
				this._p3 = this._p1 + this._p2;
				this._calcEnd = (yoyoMode === true);
			}, true),
			p = SlowMo.prototype = new Ease(),
			SteppedEase, ExpoScaleEase, RoughEase, _createElastic;

		p.constructor = SlowMo;
		p.getRatio = function(p) {
			var r = p + (0.5 - p) * this._p;
			if (p < this._p1) {
				return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r);
			} else if (p > this._p3) {
				return this._calcEnd ? (p === 1 ? 0 : 1 - (p = (p - this._p3) / this._p1) * p) : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p); //added p === 1 ? 0 to avoid floating point rounding errors from affecting the final value, like 1 - 0.7 = 0.30000000000000004 instead of 0.3
			}
			return this._calcEnd ? 1 : r;
		};
		SlowMo.ease = new SlowMo(0.7, 0.7);

		p.config = SlowMo.config = function(linearRatio, power, yoyoMode) {
			return new SlowMo(linearRatio, power, yoyoMode);
		};


		//SteppedEase
		SteppedEase = _class("easing.SteppedEase", function(steps, immediateStart) {
				steps = steps || 1;
				this._p1 = 1 / steps;
				this._p2 = steps + (immediateStart ? 0 : 1);
				this._p3 = immediateStart ? 1 : 0;
			}, true);
		p = SteppedEase.prototype = new Ease();
		p.constructor = SteppedEase;
		p.getRatio = function(p) {
			if (p < 0) {
				p = 0;
			} else if (p >= 1) {
				p = 0.999999999;
			}
			return (((this._p2 * p) | 0) + this._p3) * this._p1;
		};
		p.config = SteppedEase.config = function(steps, immediateStart) {
			return new SteppedEase(steps, immediateStart);
		};

		//ExpoScaleEase
		ExpoScaleEase = _class("easing.ExpoScaleEase", function(start, end, ease) {
			this._p1 = Math.log(end / start);
			this._p2 = end - start;
			this._p3 = start;
			this._ease = ease;
		}, true);
		p = ExpoScaleEase.prototype = new Ease();
		p.constructor = ExpoScaleEase;
		p.getRatio = function(p) {
			if (this._ease) {
				p = this._ease.getRatio(p);
			}
			return (this._p3 * Math.exp(this._p1 * p) - this._p3) / this._p2;
		};
		p.config = ExpoScaleEase.config = function(start, end, ease) {
			return new ExpoScaleEase(start, end, ease);
		};


		//RoughEase
		RoughEase = _class("easing.RoughEase", function(vars) {
			vars = vars || {};
			var taper = vars.taper || "none",
				a = [],
				cnt = 0,
				points = (vars.points || 20) | 0,
				i = points,
				randomize = (vars.randomize !== false),
				clamp = (vars.clamp === true),
				template = (vars.template instanceof Ease) ? vars.template : null,
				strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4,
				x, y, bump, invX, obj, pnt;
			while (--i > -1) {
				x = randomize ? Math.random() : (1 / points) * i;
				y = template ? template.getRatio(x) : x;
				if (taper === "none") {
					bump = strength;
				} else if (taper === "out") {
					invX = 1 - x;
					bump = invX * invX * strength;
				} else if (taper === "in") {
					bump = x * x * strength;
				} else if (x < 0.5) {  //"both" (start)
					invX = x * 2;
					bump = invX * invX * 0.5 * strength;
				} else {				//"both" (end)
					invX = (1 - x) * 2;
					bump = invX * invX * 0.5 * strength;
				}
				if (randomize) {
					y += (Math.random() * bump) - (bump * 0.5);
				} else if (i % 2) {
					y += bump * 0.5;
				} else {
					y -= bump * 0.5;
				}
				if (clamp) {
					if (y > 1) {
						y = 1;
					} else if (y < 0) {
						y = 0;
					}
				}
				a[cnt++] = {x:x, y:y};
			}
			a.sort(function(a, b) {
				return a.x - b.x;
			});

			pnt = new EasePoint(1, 1, null);
			i = points;
			while (--i > -1) {
				obj = a[i];
				pnt = new EasePoint(obj.x, obj.y, pnt);
			}

			this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next);
		}, true);
		p = RoughEase.prototype = new Ease();
		p.constructor = RoughEase;
		p.getRatio = function(p) {
			var pnt = this._prev;
			if (p > pnt.t) {
				while (pnt.next && p >= pnt.t) {
					pnt = pnt.next;
				}
				pnt = pnt.prev;
			} else {
				while (pnt.prev && p <= pnt.t) {
					pnt = pnt.prev;
				}
			}
			this._prev = pnt;
			return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c);
		};
		p.config = function(vars) {
			return new RoughEase(vars);
		};
		RoughEase.ease = new RoughEase();


		//Bounce
		_wrap("Bounce",
			_create("BounceOut", function(p) {
				if (p < 1 / 2.75) {
					return 7.5625 * p * p;
				} else if (p < 2 / 2.75) {
					return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
				} else if (p < 2.5 / 2.75) {
					return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
				}
				return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
			}),
			_create("BounceIn", function(p) {
				if ((p = 1 - p) < 1 / 2.75) {
					return 1 - (7.5625 * p * p);
				} else if (p < 2 / 2.75) {
					return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75);
				} else if (p < 2.5 / 2.75) {
					return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375);
				}
				return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375);
			}),
			_create("BounceInOut", function(p) {
				var invert = (p < 0.5);
				if (invert) {
					p = 1 - (p * 2);
				} else {
					p = (p * 2) - 1;
				}
				if (p < 1 / 2.75) {
					p = 7.5625 * p * p;
				} else if (p < 2 / 2.75) {
					p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75;
				} else if (p < 2.5 / 2.75) {
					p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375;
				} else {
					p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
				}
				return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5;
			})
		);


		//CIRC
		_wrap("Circ",
			_create("CircOut", function(p) {
				return Math.sqrt(1 - (p = p - 1) * p);
			}),
			_create("CircIn", function(p) {
				return -(Math.sqrt(1 - (p * p)) - 1);
			}),
			_create("CircInOut", function(p) {
				return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1);
			})
		);


		//Elastic
		_createElastic = function(n, f, def) {
			var C = _class("easing." + n, function(amplitude, period) {
					this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1.
					this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1);
					this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0);
					this._p2 = _2PI / this._p2; //precalculate to optimize
				}, true),
				p = C.prototype = new Ease();
			p.constructor = C;
			p.getRatio = f;
			p.config = function(amplitude, period) {
				return new C(amplitude, period);
			};
			return C;
		};
		_wrap("Elastic",
			_createElastic("ElasticOut", function(p) {
				return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1;
			}, 0.3),
			_createElastic("ElasticIn", function(p) {
				return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 ));
			}, 0.3),
			_createElastic("ElasticInOut", function(p) {
				return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1;
			}, 0.45)
		);


		//Expo
		_wrap("Expo",
			_create("ExpoOut", function(p) {
				return 1 - Math.pow(2, -10 * p);
			}),
			_create("ExpoIn", function(p) {
				return Math.pow(2, 10 * (p - 1)) - 0.001;
			}),
			_create("ExpoInOut", function(p) {
				return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
			})
		);


		//Sine
		_wrap("Sine",
			_create("SineOut", function(p) {
				return Math.sin(p * _HALF_PI);
			}),
			_create("SineIn", function(p) {
				return -Math.cos(p * _HALF_PI) + 1;
			}),
			_create("SineInOut", function(p) {
				return -0.5 * (Math.cos(Math.PI * p) - 1);
			})
		);

		_class("easing.EaseLookup", {
				find:function(s) {
					return Ease.map[s];
				}
			}, true);

		//register the non-standard eases
		_easeReg(w.SlowMo, "SlowMo", "ease,");
		_easeReg(RoughEase, "RoughEase", "ease,");
		_easeReg(SteppedEase, "SteppedEase", "ease,");

		return Back;
		
	}, true);


});

if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case TweenLite was already loaded separately.











/*
 * ----------------------------------------------------------------
 * Base classes like TweenLite, SimpleTimeline, Ease, Ticker, etc.
 * ----------------------------------------------------------------
 */
(function(window, moduleName) {

		"use strict";
		var _exports = {},
			_doc = window.document,
			_globals = window.GreenSockGlobals = window.GreenSockGlobals || window,
			existingModule = _globals[moduleName];
		if (existingModule) {
			if (typeof(module) !== "undefined" && module.exports) { //node
				module.exports = existingModule;
			}
			return existingModule; //in case the core set of classes is already loaded, don't instantiate twice.
		}
		var _namespace = function(ns) {
				var a = ns.split("."),
					p = _globals, i;
				for (i = 0; i < a.length; i++) {
					p[a[i]] = p = p[a[i]] || {};
				}
				return p;
			},
			gs = _namespace("com.greensock"),
			_tinyNum = 0.00000001,
			_slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
				var b = [],
					l = a.length,
					i;
				for (i = 0; i !== l; b.push(a[i++])) {}
				return b;
			},
			_emptyFunc = function() {},
			_isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower)
				var toString = Object.prototype.toString,
					array = toString.call([]);
				return function(obj) {
					return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array));
				};
			}()),
			a, i, p, _ticker, _tickerActive,
			_defLookup = {},

			/**
			 * @constructor
			 * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition.
			 * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is
			 * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin
			 * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally.
			 *
			 * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found,
			 * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere,
			 * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so
			 * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything
			 * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock
			 * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could
			 * sandbox the banner one like:
			 *
			 * <script>
			 *     var gs = window.GreenSockGlobals = {}; //the newer version we're about to load could now be referenced in a "gs" object, like gs.TweenLite.to(...). Use whatever alias you want as long as it's unique, "gs" or "banner" or whatever.
			 * </script>
			 * <script src="js/greensock/v1.7/TweenMax.js"></script>
			 * <script>
			 *     window.GreenSockGlobals = window._gsQueue = window._gsDefine = null; //reset it back to null (along with the special _gsQueue variable) so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...)
			 * </script>
			 * <script src="js/greensock/v1.6/TweenMax.js"></script>
			 * <script>
			 *     gs.TweenLite.to(...); //would use v1.7
			 *     TweenLite.to(...); //would use v1.6
			 * </script>
			 *
			 * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back".
			 * @param {!Array.<string>} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"]
			 * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition.
			 * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object)
			 */
			Definition = function(ns, dependencies, func, global) {
				this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses
				_defLookup[ns] = this;
				this.gsClass = null;
				this.func = func;
				var _classes = [];
				this.check = function(init) {
					var i = dependencies.length,
						missing = i,
						cur, a, n, cl;
					while (--i > -1) {
						if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) {
							_classes[i] = cur.gsClass;
							missing--;
						} else if (init) {
							cur.sc.push(this);
						}
					}
					if (missing === 0 && func) {
						a = ("com.greensock." + ns).split(".");
						n = a.pop();
						cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes);

						//exports to multiple environments
						if (global) {
							_globals[n] = _exports[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.)
							if (typeof(module) !== "undefined" && module.exports) { //node
								if (ns === moduleName) {
									module.exports = _exports[moduleName] = cl;
									for (i in _exports) {
										cl[i] = _exports[i];
									}
								} else if (_exports[moduleName]) {
									_exports[moduleName][n] = cl;
								}
							} else if (typeof(define) === "function" && define.amd){ //AMD
								define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").pop(), [], function() { return cl; });
							}
						}
						for (i = 0; i < this.sc.length; i++) {
							this.sc[i].check();
						}
					}
				};
				this.check(true);
			},

			//used to create Definition instances (which basically registers a class that has dependencies).
			_gsDefine = window._gsDefine = function(ns, dependencies, func, global) {
				return new Definition(ns, dependencies, func, global);
			},

			//a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class).
			_class = gs._class = function(ns, func, global) {
				func = func || function() {};
				_gsDefine(ns, [], function(){ return func; }, global);
				return func;
			};

		_gsDefine.globals = _globals;



/*
 * ----------------------------------------------------------------
 * Ease
 * ----------------------------------------------------------------
 */
		var _baseParams = [0, 0, 1, 1],
			Ease = _class("easing.Ease", function(func, extraParams, type, power) {
				this._func = func;
				this._type = type || 0;
				this._power = power || 0;
				this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams;
			}, true),
			_easeMap = Ease.map = {},
			_easeReg = Ease.register = function(ease, names, types, create) {
				var na = names.split(","),
					i = na.length,
					ta = (types || "easeIn,easeOut,easeInOut").split(","),
					e, name, j, type;
				while (--i > -1) {
					name = na[i];
					e = create ? _class("easing."+name, null, true) : gs.easing[name] || {};
					j = ta.length;
					while (--j > -1) {
						type = ta[j];
						_easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease();
					}
				}
			};

		p = Ease.prototype;
		p._calcEnd = false;
		p.getRatio = function(p) {
			if (this._func) {
				this._params[0] = p;
				return this._func.apply(null, this._params);
			}
			var t = this._type,
				pw = this._power,
				r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2;
			if (pw === 1) {
				r *= r;
			} else if (pw === 2) {
				r *= r * r;
			} else if (pw === 3) {
				r *= r * r * r;
			} else if (pw === 4) {
				r *= r * r * r * r;
			}
			return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2);
		};

		//create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut)
		a = ["Linear","Quad","Cubic","Quart","Quint,Strong"];
		i = a.length;
		while (--i > -1) {
			p = a[i]+",Power"+i;
			_easeReg(new Ease(null,null,1,i), p, "easeOut", true);
			_easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : ""));
			_easeReg(new Ease(null,null,3,i), p, "easeInOut");
		}
		_easeMap.linear = gs.easing.Linear.easeIn;
		_easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks


/*
 * ----------------------------------------------------------------
 * EventDispatcher
 * ----------------------------------------------------------------
 */
		var EventDispatcher = _class("events.EventDispatcher", function(target) {
			this._listeners = {};
			this._eventTarget = target || this;
		});
		p = EventDispatcher.prototype;

		p.addEventListener = function(type, callback, scope, useParam, priority) {
			priority = priority || 0;
			var list = this._listeners[type],
				index = 0,
				listener, i;
			if (this === _ticker && !_tickerActive) {
				_ticker.wake();
			}
			if (list == null) {
				this._listeners[type] = list = [];
			}
			i = list.length;
			while (--i > -1) {
				listener = list[i];
				if (listener.c === callback && listener.s === scope) {
					list.splice(i, 1);
				} else if (index === 0 && listener.pr < priority) {
					index = i + 1;
				}
			}
			list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority});
		};

		p.removeEventListener = function(type, callback) {
			var list = this._listeners[type], i;
			if (list) {
				i = list.length;
				while (--i > -1) {
					if (list[i].c === callback) {
						list.splice(i, 1);
						return;
					}
				}
			}
		};

		p.dispatchEvent = function(type) {
			var list = this._listeners[type],
				i, t, listener;
			if (list) {
				i = list.length;
				if (i > 1) {
					list = list.slice(0); //in case addEventListener() is called from within a listener/callback (otherwise the index could change, resulting in a skip)
				}
				t = this._eventTarget;
				while (--i > -1) {
					listener = list[i];
					if (listener) {
						if (listener.up) {
							listener.c.call(listener.s || t, {type:type, target:t});
						} else {
							listener.c.call(listener.s || t);
						}
					}
				}
			}
		};


/*
 * ----------------------------------------------------------------
 * Ticker
 * ----------------------------------------------------------------
 */
 		var _reqAnimFrame = window.requestAnimationFrame,
			_cancelAnimFrame = window.cancelAnimationFrame,
			_getTime = Date.now || function() {return new Date().getTime();},
			_lastUpdate = _getTime();

		//now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill.
		a = ["ms","moz","webkit","o"];
		i = a.length;
		while (--i > -1 && !_reqAnimFrame) {
			_reqAnimFrame = window[a[i] + "RequestAnimationFrame"];
			_cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"];
		}

		_class("Ticker", function(fps, useRAF) {
			var _self = this,
				_startTime = _getTime(),
				_useRAF = (useRAF !== false && _reqAnimFrame) ? "auto" : false,
				_lagThreshold = 500,
				_adjustedLag = 33,
				_tickWord = "tick", //helps reduce gc burden
				_fps, _req, _id, _gap, _nextTime,
				_tick = function(manual) {
					var elapsed = _getTime() - _lastUpdate,
						overlap, dispatch;
					if (elapsed > _lagThreshold) {
						_startTime += elapsed - _adjustedLag;
					}
					_lastUpdate += elapsed;
					_self.time = (_lastUpdate - _startTime) / 1000;
					overlap = _self.time - _nextTime;
					if (!_fps || overlap > 0 || manual === true) {
						_self.frame++;
						_nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap);
						dispatch = true;
					}
					if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise.
						_id = _req(_tick);
					}
					if (dispatch) {
						_self.dispatchEvent(_tickWord);
					}
				};

			EventDispatcher.call(_self);
			_self.time = _self.frame = 0;
			_self.tick = function() {
				_tick(true);
			};

			_self.lagSmoothing = function(threshold, adjustedLag) {
				if (!arguments.length) { //if lagSmoothing() is called with no arguments, treat it like a getter that returns a boolean indicating if it's enabled or not. This is purposely undocumented and is for internal use.
					return (_lagThreshold < 1 / _tinyNum);
				}
				_lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited
				_adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
			};

			_self.sleep = function() {
				if (_id == null) {
					return;
				}
				if (!_useRAF || !_cancelAnimFrame) {
					clearTimeout(_id);
				} else {
					_cancelAnimFrame(_id);
				}
				_req = _emptyFunc;
				_id = null;
				if (_self === _ticker) {
					_tickerActive = false;
				}
			};

			_self.wake = function(seamless) {
				if (_id !== null) {
					_self.sleep();
				} else if (seamless) {
					_startTime += -_lastUpdate + (_lastUpdate = _getTime());
				} else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout().
					_lastUpdate = _getTime() - _lagThreshold + 5;
				}
				_req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame;
				if (_self === _ticker) {
					_tickerActive = true;
				}
				_tick(2);
			};

			_self.fps = function(value) {
				if (!arguments.length) {
					return _fps;
				}
				_fps = value;
				_gap = 1 / (_fps || 60);
				_nextTime = this.time + _gap;
				_self.wake();
			};

			_self.useRAF = function(value) {
				if (!arguments.length) {
					return _useRAF;
				}
				_self.sleep();
				_useRAF = value;
				_self.fps(_fps);
			};
			_self.fps(fps);

			//a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition.
			setTimeout(function() {
				if (_useRAF === "auto" && _self.frame < 5 && (_doc || {}).visibilityState !== "hidden") {
					_self.useRAF(false);
				}
			}, 1500);
		});

		p = gs.Ticker.prototype = new gs.events.EventDispatcher();
		p.constructor = gs.Ticker;


/*
 * ----------------------------------------------------------------
 * Animation
 * ----------------------------------------------------------------
 */
		var Animation = _class("core.Animation", function(duration, vars) {
				this.vars = vars = vars || {};
				this._duration = this._totalDuration = duration || 0;
				this._delay = Number(vars.delay) || 0;
				this._timeScale = 1;
				this._active = !!vars.immediateRender;
				this.data = vars.data;
				this._reversed = !!vars.reversed;

				if (!_rootTimeline) {
					return;
				}
				if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly.
					_ticker.wake();
				}

				var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline;
				tl.add(this, tl._time);

				if (this.vars.paused) {
					this.paused(true);
				}
			});

		_ticker = Animation.ticker = new gs.Ticker();
		p = Animation.prototype;
		p._dirty = p._gc = p._initted = p._paused = false;
		p._totalTime = p._time = 0;
		p._rawPrevTime = -1;
		p._next = p._last = p._onUpdate = p._timeline = p.timeline = null;
		p._paused = false;


		//some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker.
		var _checkTimeout = function() {
				if (_tickerActive && _getTime() - _lastUpdate > 2000 && ((_doc || {}).visibilityState !== "hidden" || !_ticker.lagSmoothing())) { //note: if the tab is hidden, we should still wake if lagSmoothing has been disabled.
					_ticker.wake();
				}
				var t = setTimeout(_checkTimeout, 2000);
				if (t.unref) {
					// allows a node process to exit even if the timeout’s callback hasn't been invoked. Without it, the node process could hang as this function is called every two seconds.
					t.unref();
				}
			};
		_checkTimeout();


		p.play = function(from, suppressEvents) {
			if (from != null) {
				this.seek(from, suppressEvents);
			}
			return this.reversed(false).paused(false);
		};

		p.pause = function(atTime, suppressEvents) {
			if (atTime != null) {
				this.seek(atTime, suppressEvents);
			}
			return this.paused(true);
		};

		p.resume = function(from, suppressEvents) {
			if (from != null) {
				this.seek(from, suppressEvents);
			}
			return this.paused(false);
		};

		p.seek = function(time, suppressEvents) {
			return this.totalTime(Number(time), suppressEvents !== false);
		};

		p.restart = function(includeDelay, suppressEvents) {
			return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true);
		};

		p.reverse = function(from, suppressEvents) {
			if (from != null) {
				this.seek((from || this.totalDuration()), suppressEvents);
			}
			return this.reversed(true).paused(false);
		};

		p.render = function(time, suppressEvents, force) {
			//stub - we override this method in subclasses.
		};

		p.invalidate = function() {
			this._time = this._totalTime = 0;
			this._initted = this._gc = false;
			this._rawPrevTime = -1;
			if (this._gc || !this.timeline) {
				this._enabled(true);
			}
			return this;
		};

		p.isActive = function() {
			var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active.
				startTime = this._startTime,
				rawTime;
			return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale - _tinyNum));
		};

		p._enabled = function (enabled, ignoreTimeline) {
			if (!_tickerActive) {
				_ticker.wake();
			}
			this._gc = !enabled;
			this._active = this.isActive();
			if (ignoreTimeline !== true) {
				if (enabled && !this.timeline) {
					this._timeline.add(this, this._startTime - this._delay);
				} else if (!enabled && this.timeline) {
					this._timeline._remove(this, true);
				}
			}
			return false;
		};


		p._kill = function(vars, target) {
			return this._enabled(false, false);
		};

		p.kill = function(vars, target) {
			this._kill(vars, target);
			return this;
		};

		p._uncache = function(includeSelf) {
			var tween = includeSelf ? this : this.timeline;
			while (tween) {
				tween._dirty = true;
				tween = tween.timeline;
			}
			return this;
		};

		p._swapSelfInParams = function(params) {
			var i = params.length,
				copy = params.concat();
			while (--i > -1) {
				if (params[i] === "{self}") {
					copy[i] = this;
				}
			}
			return copy;
		};

		p._callback = function(type) {
			var v = this.vars,
				callback = v[type],
				params = v[type + "Params"],
				scope = v[type + "Scope"] || v.callbackScope || this,
				l = params ? params.length : 0;
			switch (l) { //speed optimization; call() is faster than apply() so use it when there are only a few parameters (which is by far most common). Previously we simply did var v = this.vars; v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray);
				case 0: callback.call(scope); break;
				case 1: callback.call(scope, params[0]); break;
				case 2: callback.call(scope, params[0], params[1]); break;
				default: callback.apply(scope, params);
			}
		};

//----Animation getters/setters --------------------------------------------------------

		p.eventCallback = function(type, callback, params, scope) {
			if ((type || "").substr(0,2) === "on") {
				var v = this.vars;
				if (arguments.length === 1) {
					return v[type];
				}
				if (callback == null) {
					delete v[type];
				} else {
					v[type] = callback;
					v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params;
					v[type + "Scope"] = scope;
				}
				if (type === "onUpdate") {
					this._onUpdate = callback;
				}
			}
			return this;
		};

		p.delay = function(value) {
			if (!arguments.length) {
				return this._delay;
			}
			if (this._timeline.smoothChildTiming) {
				this.startTime( this._startTime + value - this._delay );
			}
			this._delay = value;
			return this;
		};

		p.duration = function(value) {
			if (!arguments.length) {
				this._dirty = false;
				return this._duration;
			}
			this._duration = this._totalDuration = value;
			this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration.
			if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) {
				this.totalTime(this._totalTime * (value / this._duration), true);
			}
			return this;
		};

		p.totalDuration = function(value) {
			this._dirty = false;
			return (!arguments.length) ? this._totalDuration : this.duration(value);
		};

		p.time = function(value, suppressEvents) {
			if (!arguments.length) {
				return this._time;
			}
			if (this._dirty) {
				this.totalDuration();
			}
			return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents);
		};

		p.totalTime = function(time, suppressEvents, uncapped) {
			if (!_tickerActive) {
				_ticker.wake();
			}
			if (!arguments.length) {
				return this._totalTime;
			}
			if (this._timeline) {
				if (time < 0 && !uncapped) {
					time += this.totalDuration();
				}
				if (this._timeline.smoothChildTiming) {
					if (this._dirty) {
						this.totalDuration();
					}
					var totalDuration = this._totalDuration,
						tl = this._timeline;
					if (time > totalDuration && !uncapped) {
						time = totalDuration;
					}
					this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale);
					if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here.
						this._uncache(false);
					}
					//in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed.
					if (tl._timeline) {
						while (tl._timeline) {
							if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) {
								tl.totalTime(tl._totalTime, true);
							}
							tl = tl._timeline;
						}
					}
				}
				if (this._gc) {
					this._enabled(true, false);
				}
				if (this._totalTime !== time || this._duration === 0) {
					if (_lazyTweens.length) {
						_lazyRender();
					}
					this.render(time, suppressEvents, false);
					if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render.
						_lazyRender();
					}
				}
			}
			return this;
		};

		p.progress = p.totalProgress = function(value, suppressEvents) {
			var duration = this.duration();
			return (!arguments.length) ? (duration ? this._time / duration : this.ratio) : this.totalTime(duration * value, suppressEvents);
		};

		p.startTime = function(value) {
			if (!arguments.length) {
				return this._startTime;
			}
			if (value !== this._startTime) {
				this._startTime = value;
				if (this.timeline) if (this.timeline._sortChildren) {
					this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct.
				}
			}
			return this;
		};

		p.endTime = function(includeRepeats) {
			return this._startTime + ((includeRepeats != false) ? this.totalDuration() : this.duration()) / this._timeScale;
		};

		p.timeScale = function(value) {
			if (!arguments.length) {
				return this._timeScale;
			}
			var pauseTime, t;
			value = value || _tinyNum; //can't allow zero because it'll throw the math off
			if (this._timeline && this._timeline.smoothChildTiming) {
				pauseTime = this._pauseTime;
				t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime();
				this._startTime = t - ((t - this._startTime) * this._timeScale / value);
			}
			this._timeScale = value;
			t = this.timeline;
			while (t && t.timeline) { //must update the duration/totalDuration of all ancestor timelines immediately in case in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though.
				t._dirty = true;
				t.totalDuration();
				t = t.timeline;
			}
			return this;
		};

		p.reversed = function(value) {
			if (!arguments.length) {
				return this._reversed;
			}
			if (value != this._reversed) {
				this._reversed = value;
				this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true);
			}
			return this;
		};

		p.paused = function(value) {
			if (!arguments.length) {
				return this._paused;
			}
			var tl = this._timeline,
				raw, elapsed;
			if (value != this._paused) if (tl) {
				if (!_tickerActive && !value) {
					_ticker.wake();
				}
				raw = tl.rawTime();
				elapsed = raw - this._pauseTime;
				if (!value && tl.smoothChildTiming) {
					this._startTime += elapsed;
					this._uncache(false);
				}
				this._pauseTime = value ? raw : null;
				this._paused = value;
				this._active = this.isActive();
				if (!value && elapsed !== 0 && this._initted && this.duration()) {
					raw = tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale;
					this.render(raw, (raw === this._totalTime), true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render.
				}
			}
			if (this._gc && !value) {
				this._enabled(true, false);
			}
			return this;
		};


/*
 * ----------------------------------------------------------------
 * SimpleTimeline
 * ----------------------------------------------------------------
 */
		var SimpleTimeline = _class("core.SimpleTimeline", function(vars) {
			Animation.call(this, 0, vars);
			this.autoRemoveChildren = this.smoothChildTiming = true;
		});

		p = SimpleTimeline.prototype = new Animation();
		p.constructor = SimpleTimeline;
		p.kill()._gc = false;
		p._first = p._last = p._recent = null;
		p._sortChildren = false;

		p.add = p.insert = function(child, position, align, stagger) {
			var prevTween, st;
			child._startTime = Number(position || 0) + child._delay;
			if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order).
				child._pauseTime = this.rawTime() - (child._timeline.rawTime() - child._pauseTime);
			}
			if (child.timeline) {
				child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one.
			}
			child.timeline = child._timeline = this;
			if (child._gc) {
				child._enabled(true, true);
			}
			prevTween = this._last;
			if (this._sortChildren) {
				st = child._startTime;
				while (prevTween && prevTween._startTime > st) {
					prevTween = prevTween._prev;
				}
			}
			if (prevTween) {
				child._next = prevTween._next;
				prevTween._next = child;
			} else {
				child._next = this._first;
				this._first = child;
			}
			if (child._next) {
				child._next._prev = child;
			} else {
				this._last = child;
			}
			child._prev = prevTween;
			this._recent = child;
			if (this._timeline) {
				this._uncache(true);
			}
			return this;
		};

		p._remove = function(tween, skipDisable) {
			if (tween.timeline === this) {
				if (!skipDisable) {
					tween._enabled(false, true);
				}

				if (tween._prev) {
					tween._prev._next = tween._next;
				} else if (this._first === tween) {
					this._first = tween._next;
				}
				if (tween._next) {
					tween._next._prev = tween._prev;
				} else if (this._last === tween) {
					this._last = tween._prev;
				}
				tween._next = tween._prev = tween.timeline = null;
				if (tween === this._recent) {
					this._recent = this._last;
				}

				if (this._timeline) {
					this._uncache(true);
				}
			}
			return this;
		};

		p.render = function(time, suppressEvents, force) {
			var tween = this._first,
				next;
			this._totalTime = this._time = this._rawPrevTime = time;
			while (tween) {
				next = tween._next; //record it here because the value could change after rendering...
				if (tween._active || (time >= tween._startTime && !tween._paused && !tween._gc)) {
					if (!tween._reversed) {
						tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
					} else {
						tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
					}
				}
				tween = next;
			}
		};

		p.rawTime = function() {
			if (!_tickerActive) {
				_ticker.wake();
			}
			return this._totalTime;
		};

/*
 * ----------------------------------------------------------------
 * TweenLite
 * ----------------------------------------------------------------
 */
		var TweenLite = _class("TweenLite", function(target, duration, vars) {
				Animation.call(this, duration, vars);
				this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method)

				if (target == null) {
					throw "Cannot tween a null target.";
				}

				this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;

				var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))),
					overwrite = this.vars.overwrite,
					i, targ, targets;

				this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite];

				if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") {
					this._targets = targets = _slice(target);  //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
					this._propLookup = [];
					this._siblings = [];
					for (i = 0; i < targets.length; i++) {
						targ = targets[i];
						if (!targ) {
							targets.splice(i--, 1);
							continue;
						} else if (typeof(targ) === "string") {
							targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings
							if (typeof(targ) === "string") {
								targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case)
							}
							continue;
						} else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself.
							targets.splice(i--, 1);
							this._targets = targets = targets.concat(_slice(targ));
							continue;
						}
						this._siblings[i] = _register(targ, this, false);
						if (overwrite === 1) if (this._siblings[i].length > 1) {
							_applyOverwrite(targ, this, null, 1, this._siblings[i]);
						}
					}

				} else {
					this._propLookup = {};
					this._siblings = _register(target, this, false);
					if (overwrite === 1) if (this._siblings.length > 1) {
						_applyOverwrite(target, this, null, 1, this._siblings);
					}
				}
				if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) {
					this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render)
					this.render(Math.min(0, -this._delay)); //in case delay is negative
				}
			}, true),
			_isSelector = function(v) {
				return (v && v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox.
			},
			_autoCSS = function(vars, target) {
				var css = {},
					p;
				for (p in vars) {
					if (!_reservedProps[p] && (!(p in target) || p === "transform" || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties.
						css[p] = vars[p];
						delete vars[p];
					}
				}
				vars.css = css;
			};

		p = TweenLite.prototype = new Animation();
		p.constructor = TweenLite;
		p.kill()._gc = false;

//----TweenLite defaults, overwrite management, and root updates ----------------------------------------------------

		p.ratio = 0;
		p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
		p._notifyPluginsOfEnabled = p._lazy = false;

		TweenLite.version = "2.1.3";
		TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
		TweenLite.defaultOverwrite = "auto";
		TweenLite.ticker = _ticker;
		TweenLite.autoSleep = 120;
		TweenLite.lagSmoothing = function(threshold, adjustedLag) {
			_ticker.lagSmoothing(threshold, adjustedLag);
		};

		TweenLite.selector = window.$ || window.jQuery || function(e) {
			var selector = window.$ || window.jQuery;
			if (selector) {
				TweenLite.selector = selector;
				return selector(e);
			}
			if (!_doc) { //in some dev environments (like Angular 6), GSAP gets loaded before the document is defined! So re-query it here if/when necessary.
				_doc = window.document;
			}
			return (!_doc) ? e : (_doc.querySelectorAll ? _doc.querySelectorAll(e) : _doc.getElementById((e.charAt(0) === "#") ? e.substr(1) : e));
		};

		var _lazyTweens = [],
			_lazyLookup = {},
			_numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,
			_relExp = /[\+-]=-?[\.\d]/,
			//_nonNumbersExp = /(?:([\-+](?!(\d|=)))|[^\d\-+=e]|(e(?![\-+][\d])))+/ig,
			_setRatio = function(v) {
				var pt = this._firstPT,
					min = 0.000001,
					val;
				while (pt) {
					val = !pt.blob ? pt.c * v + pt.s : (v === 1 && this.end != null) ? this.end : v ? this.join("") : this.start;
					if (pt.m) {
						val = pt.m.call(this._tween, val, this._target || pt.t, this._tween);
					} else if (val < min) if (val > -min && !pt.blob) { //prevents issues with converting very small numbers to strings in the browser
						val = 0;
					}
					if (!pt.f) {
						pt.t[pt.p] = val;
					} else if (pt.fp) {
						pt.t[pt.p](pt.fp, val);
					} else {
						pt.t[pt.p](val);
					}
					pt = pt._next;
				}
			},
			_blobRound = function(v) {
				return (((v * 1000) | 0) / 1000) + "";
			},
			//compares two strings (start/end), finds the numbers that are different and spits back an array representing the whole value but with the changing values isolated as elements. For example, "rgb(0,0,0)" and "rgb(100,50,0)" would become ["rgb(", 0, ",", 50, ",0)"]. Notice it merges the parts that are identical (performance optimization). The array also has a linked list of PropTweens attached starting with _firstPT that contain the tweening data (t, p, s, c, f, etc.). It also stores the starting value as a "start" property so that we can revert to it if/when necessary, like when a tween rewinds fully. If the quantity of numbers differs between the start and end, it will always prioritize the end value(s). The pt parameter is optional - it's for a PropTween that will be appended to the end of the linked list and is typically for actually setting the value after all of the elements have been updated (with array.join("")).
			_blobDif = function(start, end, filter, pt) {
				var a = [],
					charIndex = 0,
					s = "",
					color = 0,
					startNums, endNums, num, i, l, nonNumbers, currentNum;
				a.start = start;
				a.end = end;
				start = a[0] = start + ""; //ensure values are strings
				end = a[1] = end + "";
				if (filter) {
					filter(a); //pass an array with the starting and ending values and let the filter do whatever it needs to the values.
					start = a[0];
					end = a[1];
				}
				a.length = 0;
				startNums = start.match(_numbersExp) || [];
				endNums = end.match(_numbersExp) || [];
				if (pt) {
					pt._next = null;
					pt.blob = 1;
					a._firstPT = a._applyPT = pt; //apply last in the linked list (which means inserting it first)
				}
				l = endNums.length;
				for (i = 0; i < l; i++) {
					currentNum = endNums[i];
					nonNumbers = end.substr(charIndex, end.indexOf(currentNum, charIndex)-charIndex);
					s += (nonNumbers || !i) ? nonNumbers : ","; //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case.
					charIndex += nonNumbers.length;
					if (color) { //sense rgba() values and round them.
						color = (color + 1) % 5;
					} else if (nonNumbers.substr(-5) === "rgba(") {
						color = 1;
					}
					if (currentNum === startNums[i] || startNums.length <= i) {
						s += currentNum;
					} else {
						if (s) {
							a.push(s);
							s = "";
						}
						num = parseFloat(startNums[i]);
						a.push(num);
						a._firstPT = {_next: a._firstPT, t:a, p: a.length-1, s:num, c:((currentNum.charAt(1) === "=") ? parseInt(currentNum.charAt(0) + "1", 10) * parseFloat(currentNum.substr(2)) : (parseFloat(currentNum) - num)) || 0, f:0, m:(color && color < 4) ? Math.round : _blobRound}; //limiting to 3 decimal places and casting as a string can really help performance when array.join() is called!
						//note: we don't set _prev because we'll never need to remove individual PropTweens from this list.
					}
					charIndex += currentNum.length;
				}
				s += end.substr(charIndex);
				if (s) {
					a.push(s);
				}
				a.setRatio = _setRatio;
				if (_relExp.test(end)) { //if the end string contains relative values, delete it so that on the final render (in _setRatio()), we don't actually set it to the string with += or -= characters (forces it to use the calculated value).
					a.end = null;
				}
				return a;
			},
			//note: "funcParam" is only necessary for function-based getters/setters that require an extra parameter like getAttribute("width") and setAttribute("width", value). In this example, funcParam would be "width". Used by AttrPlugin for example.
			_addPropTween = function(target, prop, start, end, overwriteProp, mod, funcParam, stringFilter, index) {
				if (typeof(end) === "function") {
					end = end(index || 0, target);
				}
				var type = typeof(target[prop]),
					getterName = (type !== "function") ? "" : ((prop.indexOf("set") || typeof(target["get" + prop.substr(3)]) !== "function") ? prop : "get" + prop.substr(3)),
					s = (start !== "get") ? start : !getterName ? target[prop] : funcParam ? target[getterName](funcParam) : target[getterName](),
					isRelative = (typeof(end) === "string" && end.charAt(1) === "="),
					pt = {t:target, p:prop, s:s, f:(type === "function"), pg:0, n:overwriteProp || prop, m:(!mod ? 0 : (typeof(mod) === "function") ? mod : Math.round), pr:0, c:isRelative ? parseInt(end.charAt(0) + "1", 10) * parseFloat(end.substr(2)) : (parseFloat(end) - s) || 0},
					blob;

				if (typeof(s) !== "number" || (typeof(end) !== "number" && !isRelative)) {
					if (funcParam || isNaN(s) || (!isRelative && isNaN(end)) || typeof(s) === "boolean" || typeof(end) === "boolean") {
						//a blob (string that has multiple numbers in it)
						pt.fp = funcParam;
						blob = _blobDif(s, (isRelative ? (parseFloat(pt.s) + pt.c) + (pt.s + "").replace(/[0-9\-\.]/g, "") : end), stringFilter || TweenLite.defaultStringFilter, pt);
						pt = {t: blob, p: "setRatio", s: 0, c: 1, f: 2, pg: 0, n: overwriteProp || prop, pr: 0, m: 0}; //"2" indicates it's a Blob property tween. Needed for RoundPropsPlugin for example.
					} else {
						pt.s = parseFloat(s);
						if (!isRelative) {
							pt.c = (parseFloat(end) - pt.s) || 0;
						}
					}
				}
				if (pt.c) { //only add it to the linked list if there's a change.
					if ((pt._next = this._firstPT)) {
						pt._next._prev = pt;
					}
					this._firstPT = pt;
					return pt;
				}
			},
			_internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector, lazyTweens:_lazyTweens, blobDif:_blobDif}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object.
			_plugins = TweenLite._plugins = {},
			_tweenLookup = _internals.tweenLookup = {},
			_tweenLookupNum = 0,
			_reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1, callbackScope:1, stringFilter:1, id:1, yoyoEase:1, stagger:1},
			_overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
			_rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
			_rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
			_nextGCFrame = 30,
			_lazyRender = _internals.lazyRender = function() {
				var l = _lazyTweens.length,
					i, tween;
				_lazyLookup = {};
				for (i = 0; i < l; i++) {
					tween = _lazyTweens[i];
					if (tween && tween._lazy !== false) {
						tween.render(tween._lazy[0], tween._lazy[1], true);
						tween._lazy = false;
					}
				}
				_lazyTweens.length = 0;
			};

		_rootTimeline._startTime = _ticker.time;
		_rootFramesTimeline._startTime = _ticker.frame;
		_rootTimeline._active = _rootFramesTimeline._active = true;
		setTimeout(_lazyRender, 1); //on some mobile devices, there isn't a "tick" before code runs which means any lazy renders wouldn't run before the next official "tick".

		Animation._updateRoot = TweenLite.render = function() {
				var i, a, p;
				if (_lazyTweens.length) { //if code is run outside of the requestAnimationFrame loop, there may be tweens queued AFTER the engine refreshed, so we need to ensure any pending renders occur before we refresh again.
					_lazyRender();
				}
				_rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false);
				_rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false);
				if (_lazyTweens.length) {
					_lazyRender();
				}
				if (_ticker.frame >= _nextGCFrame) { //dump garbage every 120 frames or whatever the user sets TweenLite.autoSleep to
					_nextGCFrame = _ticker.frame + (parseInt(TweenLite.autoSleep, 10) || 120);
					for (p in _tweenLookup) {
						a = _tweenLookup[p].tweens;
						i = a.length;
						while (--i > -1) {
							if (a[i]._gc) {
								a.splice(i, 1);
							}
						}
						if (a.length === 0) {
							delete _tweenLookup[p];
						}
					}
					//if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly
					p = _rootTimeline._first;
					if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) {
						while (p && p._paused) {
							p = p._next;
						}
						if (!p) {
							_ticker.sleep();
						}
					}
				}
			};

		_ticker.addEventListener("tick", Animation._updateRoot);

		var _register = function(target, tween, scrub) {
				var id = target._gsTweenID, a, i;
				if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) {
					_tweenLookup[id] = {target:target, tweens:[]};
				}
				if (tween) {
					a = _tweenLookup[id].tweens;
					a[(i = a.length)] = tween;
					if (scrub) {
						while (--i > -1) {
							if (a[i] === tween) {
								a.splice(i, 1);
							}
						}
					}
				}
				return _tweenLookup[id].tweens;
			},
			_onOverwrite = function(overwrittenTween, overwritingTween, target, killedProps) {
				var func = overwrittenTween.vars.onOverwrite, r1, r2;
				if (func) {
					r1 = func(overwrittenTween, overwritingTween, target, killedProps);
				}
				func = TweenLite.onOverwrite;
				if (func) {
					r2 = func(overwrittenTween, overwritingTween, target, killedProps);
				}
				return (r1 !== false && r2 !== false);
			},
			_applyOverwrite = function(target, tween, props, mode, siblings) {
				var i, changed, curTween, l;
				if (mode === 1 || mode >= 4) {
					l = siblings.length;
					for (i = 0; i < l; i++) {
						if ((curTween = siblings[i]) !== tween) {
							if (!curTween._gc) {
								if (curTween._kill(null, target, tween)) {
									changed = true;
								}
							}
						} else if (mode === 5) {
							break;
						}
					}
					return changed;
				}
				//NOTE: Add tiny amount to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example)
				var startTime = tween._startTime + _tinyNum,
					overlaps = [],
					oCount = 0,
					zeroDur = (tween._duration === 0),
					globalStart;
				i = siblings.length;
				while (--i > -1) {
					if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) {
						//ignore
					} else if (curTween._timeline !== tween._timeline) {
						globalStart = globalStart || _checkOverlap(tween, 0, zeroDur);
						if (_checkOverlap(curTween, globalStart, zeroDur) === 0) {
							overlaps[oCount++] = curTween;
						}
					} else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= _tinyNum * 2)) {
						overlaps[oCount++] = curTween;
					}
				}

				i = oCount;
				while (--i > -1) {
					curTween = overlaps[i];
					l = curTween._firstPT; //we need to discern if there were property tweens originally; if they all get removed in the next line's _kill() call, the tween should be killed. See https://github.com/greensock/GreenSock-JS/issues/278
					if (mode === 2) if (curTween._kill(props, target, tween)) {
						changed = true;
					}
					if (mode !== 2 || (!curTween._firstPT && curTween._initted && l)) {
						if (mode !== 2 && !_onOverwrite(curTween, tween)) {
							continue;
						}
						if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween.
							changed = true;
						}
					}
				}
				return changed;
			},
			_checkOverlap = function(tween, reference, zeroDur) {
				var tl = tween._timeline,
					ts = tl._timeScale,
					t = tween._startTime;
				while (tl._timeline) {
					t += tl._startTime;
					ts *= tl._timeScale;
					if (tl._paused) {
						return -100;
					}
					tl = tl._timeline;
				}
				t /= ts;
				return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum;
			};


//---- TweenLite instance methods -----------------------------------------------------------------------------

		p._init = function() {
			var v = this.vars,
				op = this._overwrittenProps,
				dur = this._duration,
				immediate = !!v.immediateRender,
				ease = v.ease,
				startAt = this._startAt,
				i, initPlugins, pt, p, startVars, l;
			if (v.startAt) {
				if (startAt) {
					startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change.
					startAt.kill();
				}
				startVars = {};
				for (p in v.startAt) { //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, 1, from, to).fromTo(e, 1, to, from);
					startVars[p] = v.startAt[p];
				}
				startVars.data = "isStart";
				startVars.overwrite = false;
				startVars.immediateRender = true;
				startVars.lazy = (immediate && v.lazy !== false);
				startVars.startAt = startVars.delay = null; //no nesting of startAt objects allowed (otherwise it could cause an infinite loop).
				startVars.onUpdate = v.onUpdate;
				startVars.onUpdateParams = v.onUpdateParams;
				startVars.onUpdateScope = v.onUpdateScope || v.callbackScope || this;
				this._startAt = TweenLite.to(this.target || {}, 0, startVars);
				if (immediate) {
					if (this._time > 0) {
						this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()).
					} else if (dur !== 0) {
						return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting.
					}
				}
			} else if (v.runBackwards && dur !== 0) {
				//from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards)
				if (startAt) {
					startAt.render(-1, true);
					startAt.kill();
					this._startAt = null;
				} else {
					if (this._time !== 0) { //in rare cases (like if a from() tween runs and then is invalidate()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0
						immediate = false;
					}
					pt = {};
					for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through.
						if (!_reservedProps[p] || p === "autoCSS") {
							pt[p] = v[p];
						}
					}
					pt.overwrite = 0;
					pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in.
					pt.lazy = (immediate && v.lazy !== false);
					pt.immediateRender = immediate; //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after)
					this._startAt = TweenLite.to(this.target, 0, pt);
					if (!immediate) {
						this._startAt._init(); //ensures that the initial values are recorded
						this._startAt._enabled(false); //no need to have the tween render on the next cycle. Disable it because we'll always manually control the renders of the _startAt tween.
						if (this.vars.immediateRender) {
							this._startAt = null;
						}
					} else if (this._time === 0) {
						return;
					}
				}
			}
			this._ease = ease = (!ease) ? TweenLite.defaultEase : (ease instanceof Ease) ? ease : (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase;
			if (v.easeParams instanceof Array && ease.config) {
				this._ease = ease.config.apply(ease, v.easeParams);
			}
			this._easeType = this._ease._type;
			this._easePower = this._ease._power;
			this._firstPT = null;

			if (this._targets) {
				l = this._targets.length;
				for (i = 0; i < l; i++) {
					if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null), i) ) {
						initPlugins = true;
					}
				}
			} else {
				initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op, 0);
			}

			if (initPlugins) {
				TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite
			}
			if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live.
				this._enabled(false, false);
			}
			if (v.runBackwards) {
				pt = this._firstPT;
				while (pt) {
					pt.s += pt.c;
					pt.c = -pt.c;
					pt = pt._next;
				}
			}
			this._onUpdate = v.onUpdate;
			this._initted = true;
		};

		p._initProps = function(target, propLookup, siblings, overwrittenProps, index) {
			var p, i, initPlugins, plugin, pt, v;
			if (target == null) {
				return false;
			}
			if (_lazyLookup[target._gsTweenID]) {
				_lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end)
			}

			if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe.
				_autoCSS(this.vars, target);
			}
			for (p in this.vars) {
				v = this.vars[p];
				if (_reservedProps[p]) {
					if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) {
						this.vars[p] = v = this._swapSelfInParams(v, this);
					}

				} else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this, index)) {

					//t - target 		[object]
					//p - property 		[string]
					//s - start			[number]
					//c - change		[number]
					//f - isFunction	[boolean]
					//n - name			[string]
					//pg - isPlugin 	[boolean]
					//pr - priority		[number]
					//m - mod           [function | 0]
					this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:1, n:p, pg:1, pr:plugin._priority, m:0};
					i = plugin._overwriteProps.length;
					while (--i > -1) {
						propLookup[plugin._overwriteProps[i]] = this._firstPT;
					}
					if (plugin._priority || plugin._onInitAllProps) {
						initPlugins = true;
					}
					if (plugin._onDisable || plugin._onEnable) {
						this._notifyPluginsOfEnabled = true;
					}
					if (pt._next) {
						pt._next._prev = pt;
					}

				} else {
					propLookup[p] = _addPropTween.call(this, target, p, "get", v, p, 0, null, this.vars.stringFilter, index);
				}
			}

			if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first)
				return this._initProps(target, propLookup, siblings, overwrittenProps, index);
			}
			if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) {
				this._kill(propLookup, target);
				return this._initProps(target, propLookup, siblings, overwrittenProps, index);
			}
			if (this._firstPT) if ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration)) { //zero duration tweens don't lazy render by default; everything else does.
				_lazyLookup[target._gsTweenID] = true;
			}
			return initPlugins;
		};

		p.render = function(time, suppressEvents, force) {
			var self = this,
				prevTime = self._time,
				duration = self._duration,
				prevRawPrevTime = self._rawPrevTime,
				isComplete, callback, pt, rawPrevTime;
			if (time >= duration - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				self._totalTime = self._time = duration;
				self.ratio = self._ease._calcEnd ? self._ease.getRatio(1) : 1;
				if (!self._reversed ) {
					isComplete = true;
					callback = "onComplete";
					force = (force || self._timeline.autoRemoveChildren); //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
				}
				if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
					if (self._startTime === self._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate.
						time = 0;
					}
					if (prevRawPrevTime < 0 || (time <= 0 && time >= -_tinyNum) || (prevRawPrevTime === _tinyNum && self.data !== "isPause")) if (prevRawPrevTime !== time) { //note: when this.data is "isPause", it's a callback added by addPause() on a timeline that we should not be triggered when LEAVING its exact start time. In other words, tl.addPause(1).play(1) shouldn't pause.
						force = true;
						if (prevRawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
					self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				}

			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				self._totalTime = self._time = 0;
				self.ratio = self._ease._calcEnd ? self._ease.getRatio(0) : 0;
				if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) {
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time > -_tinyNum) {
					time = 0;
				} else if (time < 0) {
					self._active = false;
					if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
						if (prevRawPrevTime >= 0 && !(prevRawPrevTime === _tinyNum && self.data === "isPause")) {
							force = true;
						}
						self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					}
				}
				if (!self._initted || (self._startAt && self._startAt.progress())) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. Also, we check progress() because if startAt has already rendered at its end, we should force a render at its beginning. Otherwise, if you put the playhead directly on top of where a fromTo({immediateRender:false}) starts, and then move it backwards, the from() won't revert its values.
					force = true;
				}
			} else {
				self._totalTime = self._time = time;

				if (self._easeType) {
					var r = time / duration, type = self._easeType, pow = self._easePower;
					if (type === 1 || (type === 3 && r >= 0.5)) {
						r = 1 - r;
					}
					if (type === 3) {
						r *= 2;
					}
					if (pow === 1) {
						r *= r;
					} else if (pow === 2) {
						r *= r * r;
					} else if (pow === 3) {
						r *= r * r * r;
					} else if (pow === 4) {
						r *= r * r * r * r;
					}
					self.ratio = (type === 1) ? 1 - r : (type === 2) ? r : (time / duration < 0.5) ? r / 2 : 1 - (r / 2);
				} else {
					self.ratio = self._ease.getRatio(time / duration);
				}
			}

			if (self._time === prevTime && !force) {
				return;
			} else if (!self._initted) {
				self._init();
				if (!self._initted || self._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
					return;
				} else if (!force && self._firstPT && ((self.vars.lazy !== false && self._duration) || (self.vars.lazy && !self._duration))) {
					self._time = self._totalTime = prevTime;
					self._rawPrevTime = prevRawPrevTime;
					_lazyTweens.push(self);
					self._lazy = [time, suppressEvents];
					return;
				}
				//_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
				if (self._time && !isComplete) {
					self.ratio = self._ease.getRatio(self._time / duration);
				} else if (isComplete && self._ease._calcEnd) {
					self.ratio = self._ease.getRatio((self._time === 0) ? 0 : 1);
				}
			}
			if (self._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occurring now (imagine a lazy tween instantiating and then immediately the user calls tween.seek(tween.duration()), skipping to the end - the end render would be forced, and then if we didn't flush the lazy render, it'd fire AFTER the seek(), rendering it at the wrong time.
				self._lazy = false;
			}
			if (!self._active) if (!self._paused && self._time !== prevTime && time >= 0) {
				self._active = true;  //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
			}
			if (prevTime === 0) {
				if (self._startAt) {
					if (time >= 0) {
						self._startAt.render(time, true, force);
					} else if (!callback) {
						callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area.
					}
				}
				if (self.vars.onStart) if (self._time !== 0 || duration === 0) if (!suppressEvents) {
					self._callback("onStart");
				}
			}
			pt = self._firstPT;
			while (pt) {
				if (pt.f) {
					pt.t[pt.p](pt.c * self.ratio + pt.s);
				} else {
					pt.t[pt.p] = pt.c * self.ratio + pt.s;
				}
				pt = pt._next;
			}

			if (self._onUpdate) {
				if (time < 0) if (self._startAt && time !== -0.0001) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
					self._startAt.render(time, true, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
				}
				if (!suppressEvents) if (self._time !== prevTime || isComplete || force) {
					self._callback("onUpdate");
				}
			}
			if (callback) if (!self._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate
				if (time < 0 && self._startAt && !self._onUpdate && time !== -0.0001) { //-0.0001 is a special value that we use when looping back to the beginning of a repeated TimelineMax, in which case we shouldn't render the _startAt values.
					self._startAt.render(time, true, force);
				}
				if (isComplete) {
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
				if (duration === 0 && self._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
					self._rawPrevTime = 0;
				}
			}
		};

		p._kill = function(vars, target, overwritingTween) {
			if (vars === "all") {
				vars = null;
			}
			if (vars == null) if (target == null || target === this.target) {
				this._lazy = false;
				return this._enabled(false, false);
			}
			target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
			var simultaneousOverwrite = (overwritingTween && this._time && overwritingTween._startTime === this._startTime && this._timeline === overwritingTween._timeline),
				firstPT = this._firstPT,
				i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed;
			if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
				i = target.length;
				while (--i > -1) {
					if (this._kill(vars, target[i], overwritingTween)) {
						changed = true;
					}
				}
			} else {
				if (this._targets) {
					i = this._targets.length;
					while (--i > -1) {
						if (target === this._targets[i]) {
							propLookup = this._propLookup[i] || {};
							this._overwrittenProps = this._overwrittenProps || [];
							overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all";
							break;
						}
					}
				} else if (target !== this.target) {
					return false;
				} else {
					propLookup = this._propLookup;
					overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all";
				}

				if (propLookup) {
					killProps = vars || propLookup;
					record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin)
					if (overwritingTween && (TweenLite.onOverwrite || this.vars.onOverwrite)) {
						for (p in killProps) {
							if (propLookup[p]) {
								if (!killed) {
									killed = [];
								}
								killed.push(p);
							}
						}
						if ((killed || !vars) && !_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
							return false;
						}
					}

					for (p in killProps) {
						if ((pt = propLookup[p])) {
							if (simultaneousOverwrite) { //if another tween overwrites this one and they both start at exactly the same time, yet this tween has already rendered once (for example, at 0.001) because it's first in the queue, we should revert the values to where they were at 0 so that the starting values aren't contaminated on the overwriting tween.
								if (pt.f) {
									pt.t[pt.p](pt.s);
								} else {
									pt.t[pt.p] = pt.s;
								}
								changed = true;
							}
							if (pt.pg && pt.t._kill(killProps)) {
								changed = true; //some plugins need to be notified so they can perform cleanup tasks first
							}
							if (!pt.pg || pt.t._overwriteProps.length === 0) {
								if (pt._prev) {
									pt._prev._next = pt._next;
								} else if (pt === this._firstPT) {
									this._firstPT = pt._next;
								}
								if (pt._next) {
									pt._next._prev = pt._prev;
								}
								pt._next = pt._prev = null;
							}
							delete propLookup[p];
						}
						if (record) {
							overwrittenProps[p] = 1;
						}
					}
					if (!this._firstPT && this._initted && firstPT) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening.
						this._enabled(false, false);
					}
				}
			}
			return changed;
		};

		p.invalidate = function() {
			if (this._notifyPluginsOfEnabled) {
				TweenLite._onPluginEvent("_onDisable", this);
			}
			var t = this._time;
			this._firstPT = this._overwrittenProps = this._startAt = this._onUpdate = null;
			this._notifyPluginsOfEnabled = this._active = this._lazy = false;
			this._propLookup = (this._targets) ? {} : [];
			Animation.prototype.invalidate.call(this);
			if (this.vars.immediateRender) {
				this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render)
				this.render(t, false, this.vars.lazy !== false);
			}
			return this;
		};

		p._enabled = function(enabled, ignoreTimeline) {
			if (!_tickerActive) {
				_ticker.wake();
			}
			if (enabled && this._gc) {
				var targets = this._targets,
					i;
				if (targets) {
					i = targets.length;
					while (--i > -1) {
						this._siblings[i] = _register(targets[i], this, true);
					}
				} else {
					this._siblings = _register(this.target, this, true);
				}
			}
			Animation.prototype._enabled.call(this, enabled, ignoreTimeline);
			if (this._notifyPluginsOfEnabled) if (this._firstPT) {
				return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this);
			}
			return false;
		};


//----TweenLite static methods -----------------------------------------------------

		TweenLite.to = function(target, duration, vars) {
			return new TweenLite(target, duration, vars);
		};

		TweenLite.from = function(target, duration, vars) {
			vars.runBackwards = true;
			vars.immediateRender = (vars.immediateRender != false);
			return new TweenLite(target, duration, vars);
		};

		TweenLite.fromTo = function(target, duration, fromVars, toVars) {
			toVars.startAt = fromVars;
			toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
			return new TweenLite(target, duration, toVars);
		};

		TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
			return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0});
		};

		TweenLite.set = function(target, vars) {
			return new TweenLite(target, 0, vars);
		};

		TweenLite.getTweensOf = function(target, onlyActive) {
			if (target == null) { return []; }
			target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;
			var i, a, j, t;
			if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
				i = target.length;
				a = [];
				while (--i > -1) {
					a = a.concat(TweenLite.getTweensOf(target[i], onlyActive));
				}
				i = a.length;
				//now get rid of any duplicates (tweens of arrays of objects could cause duplicates)
				while (--i > -1) {
					t = a[i];
					j = i;
					while (--j > -1) {
						if (t === a[j]) {
							a.splice(i, 1);
						}
					}
				}
			} else if (target._gsTweenID) {
				a = _register(target).concat();
				i = a.length;
				while (--i > -1) {
					if (a[i]._gc || (onlyActive && !a[i].isActive())) {
						a.splice(i, 1);
					}
				}
			}
			return a || [];
		};

		TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) {
			if (typeof(onlyActive) === "object") {
				vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted)
				onlyActive = false;
			}
			var a = TweenLite.getTweensOf(target, onlyActive),
				i = a.length;
			while (--i > -1) {
				a[i]._kill(vars, target);
			}
		};



/*
 * ----------------------------------------------------------------
 * TweenPlugin   (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another script call before loading plugins which is easy to forget)
 * ----------------------------------------------------------------
 */
		var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) {
					this._overwriteProps = (props || "").split(",");
					this._propName = this._overwriteProps[0];
					this._priority = priority || 0;
					this._super = TweenPlugin.prototype;
				}, true);

		p = TweenPlugin.prototype;
		TweenPlugin.version = "1.19.0";
		TweenPlugin.API = 2;
		p._firstPT = null;
		p._addTween = _addPropTween;
		p.setRatio = _setRatio;

		p._kill = function(lookup) {
			var a = this._overwriteProps,
				pt = this._firstPT,
				i;
			if (lookup[this._propName] != null) {
				this._overwriteProps = [];
			} else {
				i = a.length;
				while (--i > -1) {
					if (lookup[a[i]] != null) {
						a.splice(i, 1);
					}
				}
			}
			while (pt) {
				if (lookup[pt.n] != null) {
					if (pt._next) {
						pt._next._prev = pt._prev;
					}
					if (pt._prev) {
						pt._prev._next = pt._next;
						pt._prev = null;
					} else if (this._firstPT === pt) {
						this._firstPT = pt._next;
					}
				}
				pt = pt._next;
			}
			return false;
		};

		p._mod = p._roundProps = function(lookup) {
			var pt = this._firstPT,
				val;
			while (pt) {
				val = lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ]);
				if (val && typeof(val) === "function") { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here.
					if (pt.f === 2) {
						pt.t._applyPT.m = val;
					} else {
						pt.m = val;
					}
				}
				pt = pt._next;
			}
		};

		TweenLite._onPluginEvent = function(type, tween) {
			var pt = tween._firstPT,
				changed, pt2, first, last, next;
			if (type === "_onInitAllProps") {
				//sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame.
				while (pt) {
					next = pt._next;
					pt2 = first;
					while (pt2 && pt2.pr > pt.pr) {
						pt2 = pt2._next;
					}
					if ((pt._prev = pt2 ? pt2._prev : last)) {
						pt._prev._next = pt;
					} else {
						first = pt;
					}
					if ((pt._next = pt2)) {
						pt2._prev = pt;
					} else {
						last = pt;
					}
					pt = next;
				}
				pt = tween._firstPT = first;
			}
			while (pt) {
				if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) {
					changed = true;
				}
				pt = pt._next;
			}
			return changed;
		};

		TweenPlugin.activate = function(plugins) {
			var i = plugins.length;
			while (--i > -1) {
				if (plugins[i].API === TweenPlugin.API) {
					_plugins[(new plugins[i]())._propName] = plugins[i];
				}
			}
			return true;
		};

		//provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations.
		_gsDefine.plugin = function(config) {
			if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; }
			var propName = config.propName,
				priority = config.priority || 0,
				overwriteProps = config.overwriteProps,
				map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_mod", mod:"_mod", initAll:"_onInitAllProps"},
				Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin",
					function() {
						TweenPlugin.call(this, propName, priority);
						this._overwriteProps = overwriteProps || [];
					}, (config.global === true)),
				p = Plugin.prototype = new TweenPlugin(propName),
				prop;
			p.constructor = Plugin;
			Plugin.API = config.API;
			for (prop in map) {
				if (typeof(config[prop]) === "function") {
					p[map[prop]] = config[prop];
				}
			}
			Plugin.version = config.version;
			TweenPlugin.activate([Plugin]);
			return Plugin;
		};


		//now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you.
		a = window._gsQueue;
		if (a) {
			for (i = 0; i < a.length; i++) {
				a[i]();
			}
			for (p in _defLookup) {
				if (!_defLookup[p].func) {
					window.console.log("GSAP encountered missing dependency: " + p);
				}
			}
		}

		_tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated

})((typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window, "TweenMax");
/*!
 * VERSION: 2.1.3
 * DATE: 2019-05-17
 * UPDATES AND DOCS AT: http://greensock.com
 *
 * @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
 * This work is subject to the terms at http://greensock.com/standard-license or for
 * Club GreenSock members, the software agreement that was issued with your membership.
 * 
 * @author: Jack Doyle, jack@greensock.com
 */
/* eslint-disable */
var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {

	"use strict";

	_gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) {
		
		var TimelineMax = function(vars) {
				TimelineLite.call(this, vars);
				this._repeat = this.vars.repeat || 0;
				this._repeatDelay = this.vars.repeatDelay || 0;
				this._cycle = 0;
				this._yoyo = !!this.vars.yoyo;
				this._dirty = true;
			},
			_tinyNum = 0.00000001,
			TweenLiteInternals = TweenLite._internals,
			_lazyTweens = TweenLiteInternals.lazyTweens,
			_lazyRender = TweenLiteInternals.lazyRender,
			_globals = _gsScope._gsDefine.globals,
			_easeNone = new Ease(null, null, 1, 0),
			p = TimelineMax.prototype = new TimelineLite();
			
		p.constructor = TimelineMax;
		p.kill()._gc = false;
		TimelineMax.version = "2.1.3";
		
		p.invalidate = function() {
			this._yoyo = !!this.vars.yoyo;
			this._repeat = this.vars.repeat || 0;
			this._repeatDelay = this.vars.repeatDelay || 0;
			this._uncache(true);
			return TimelineLite.prototype.invalidate.call(this);
		};
		
		p.addCallback = function(callback, position, params, scope) {
			return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
		};
		
		p.removeCallback = function(callback, position) {
			if (callback) {
				if (position == null) {
					this._kill(null, callback);
				} else {
					var a = this.getTweensOf(callback, false),
						i = a.length,
						time = this._parseTimeOrLabel(position);
					while (--i > -1) {
						if (a[i]._startTime === time) {
							a[i]._enabled(false, false);
						}
					}
				}
			}
			return this;
		};

		p.removePause = function(position) {
			return this.removeCallback(TimelineLite._internals.pauseCallback, position);
		};

		p.tweenTo = function(position, vars) {
			vars = vars || {};
			var copy = {ease:_easeNone, useFrames:this.usesFrames(), immediateRender:false, lazy:false},
				Engine = (vars.repeat && _globals.TweenMax) || TweenLite,
				duration, p, t;
			for (p in vars) {
				copy[p] = vars[p];
			}
			copy.time = this._parseTimeOrLabel(position);
			duration = (Math.abs(Number(copy.time) - this._time) / this._timeScale) || 0.001;
			t = new Engine(this, duration, copy);
			copy.onStart = function() {
				t.target.paused(true);
				if (t.vars.time !== t.target.time() && duration === t.duration() && !t.isFromTo) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all.
					t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale ).render(t.time(), true, true); //render() right away to ensure that things look right, especially in the case of .tweenTo(0).
				}
				if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it.
					vars.onStart.apply(vars.onStartScope || vars.callbackScope || t, vars.onStartParams || []); //don't use t._callback("onStart") or it'll point to the copy.onStart and we'll get a recursion error.
				}
			};
			return t;
		};

		p.tweenFromTo = function(fromPosition, toPosition, vars) {
			vars = vars || {};
			fromPosition = this._parseTimeOrLabel(fromPosition);
			vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this};
			vars.immediateRender = (vars.immediateRender !== false);
			var t = this.tweenTo(toPosition, vars);
			t.isFromTo = 1; //to ensure we don't mess with the duration in the onStart (we've got the start and end values here, so lock it in)
			return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001);
		};
		
		p.render = function(time, suppressEvents, force) {
			if (this._gc) {
				this._enabled(true, false);
			}
			var self = this,
				prevTime = self._time,
				totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(),
				dur = self._duration,
				prevTotalTime = self._totalTime,
				prevStart = self._startTime,
				prevTimeScale = self._timeScale,
				prevRawPrevTime = self._rawPrevTime,
				prevPaused = self._paused,
				prevCycle = self._cycle,
				tween, isComplete, next, callback, internalForce, cycleDuration, pauseTween, curTime, pauseTime;
			if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump).
				time += self._time - prevTime;
			}
			if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				if (!self._locked) {
					self._totalTime = totalDur;
					self._cycle = self._repeat;
				}
				if (!self._reversed) if (!self._hasPausedChild()) {
					isComplete = true;
					callback = "onComplete";
					internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
					if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time && self._first) {
						internalForce = true;
						if (prevRawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
				}
				self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				if (self._yoyo && (self._cycle & 1)) {
					self._time = time = 0;
				} else {
					self._time = dur;
					time = dur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. We cannot do less then 0.0001 because the same issue can occur when the duration is extremely large like 999999999999 in which case adding 0.00000001, for example, causes it to act like nothing was added.
				}
				
			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				if (!self._locked) {
					self._totalTime = self._cycle = 0;
				}
				self._time = 0;
				if (time > -_tinyNum) {
					time = 0;
				}
				if (prevTime !== 0 || (dur === 0 && prevRawPrevTime !== _tinyNum && (prevRawPrevTime > 0 || (time < 0 && prevRawPrevTime >= 0)) && !self._locked)) { //edge case for checking time < 0 && prevRawPrevTime >= 0: a zero-duration fromTo() tween inside a zero-duration timeline (yeah, very rare)
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time < 0) {
					self._active = false;
					if (self._timeline.autoRemoveChildren && self._reversed) {
						internalForce = isComplete = true;
						callback = "onReverseComplete";
					} else if (prevRawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
						internalForce = true;
					}
					self._rawPrevTime = time;
				} else {
					self._rawPrevTime = (dur || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
						tween = self._first;
						while (tween && tween._startTime === 0) {
							if (!tween._duration) {
								isComplete = false;
							}
							tween = tween._next;
						}
					}
					time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
					if (!self._initted) {
						internalForce = true;
					}
				}
				
			} else {
				if (dur === 0 && prevRawPrevTime < 0) { //without this, zero-duration repeating timelines (like with a simple callback nested at the very beginning and a repeatDelay) wouldn't render the first time through.
					internalForce = true;
				}
				self._time = self._rawPrevTime = time;
				if (!self._locked) {
					self._totalTime = time;
					if (self._repeat !== 0) {
						cycleDuration = dur + self._repeatDelay;
						self._cycle = (self._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but it gets reported as 0.79999999!)
						if (self._cycle) if (self._cycle === self._totalTime / cycleDuration && prevTotalTime <= time) {
							self._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
						}
						self._time = self._totalTime - (self._cycle * cycleDuration);
						if (self._yoyo) if (self._cycle & 1) {
							self._time = dur - self._time;
						}
						if (self._time > dur) {
							self._time = dur;
							time = dur + 0.0001; //to avoid occasional floating point rounding error
						} else if (self._time < 0) {
							self._time = time = 0;
						} else {
							time = self._time;
						}
					}
				}
			}

			if (self._hasPause && !self._forcingPlayhead && !suppressEvents) {
				time = self._time;
				if (time > prevTime || (self._repeat && prevCycle !== self._cycle)) {
					tween = self._first;
					while (tween && tween._startTime <= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) {
							pauseTween = tween;
						}
						tween = tween._next;
					}
				} else {
					tween = self._last;
					while (tween && tween._startTime >= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
							pauseTween = tween;
						}
						tween = tween._prev;
					}
				}
				if (pauseTween) {
					pauseTime = self._startTime + (self._reversed ? self._duration - pauseTween._startTime : pauseTween._startTime) / self._timeScale;
					if (pauseTween._startTime < dur) {
						self._time = self._rawPrevTime = time = pauseTween._startTime;
						self._totalTime = time + (self._cycle * (self._totalDuration + self._repeatDelay));
					}
				}
			}
			
			if (self._cycle !== prevCycle) if (!self._locked) {
				/*
				make sure children at the end/beginning of the timeline are rendered properly. If, for example, 
				a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
				would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there
				could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So 
				we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must
				ensure that zero-duration tweens at the very beginning or end of the TimelineMax work. 
				*/
				var backwards = (self._yoyo && (prevCycle & 1) !== 0),
					wrap = (backwards === (self._yoyo && (self._cycle & 1) !== 0)),
					recTotalTime = self._totalTime,
					recCycle = self._cycle,
					recRawPrevTime = self._rawPrevTime,
					recTime = self._time;

				self._totalTime = prevCycle * dur;
				if (self._cycle < prevCycle) {
					backwards = !backwards;
				} else {
					self._totalTime += dur;
				}
				self._time = prevTime; //temporarily revert _time so that render() renders the children in the correct order. Without this, tweens won't rewind correctly. We could arhictect things in a "cleaner" way by splitting out the rendering queue into a separate method but for performance reasons, we kept it all inside this method.

				self._rawPrevTime = (dur === 0) ? prevRawPrevTime - 0.0001 : prevRawPrevTime;
				self._cycle = prevCycle;
				self._locked = true; //prevents changes to totalTime and skips repeat/yoyo behavior when we recursively call render()
				prevTime = (backwards) ? 0 : dur;
				self.render(prevTime, suppressEvents, (dur === 0));
				if (!suppressEvents) if (!self._gc) {
					if (self.vars.onRepeat) {
						self._cycle = recCycle; //in case the onRepeat alters the playhead or invalidates(), we shouldn't stay locked or use the previous cycle.
						self._locked = false;
						self._callback("onRepeat");
					}
				}
				if (prevTime !== self._time) { //in case there's a callback like onComplete in a nested tween/timeline that changes the playhead position, like via seek(), we should just abort.
					return;
				}
				if (wrap) {
					self._cycle = prevCycle; //if there's an onRepeat, we reverted this above, so make sure it's set properly again. We also unlocked in that scenario, so reset that too.
					self._locked = true;
					prevTime = (backwards) ? dur + 0.0001 : -0.0001;
					self.render(prevTime, true, false);
				}
				self._locked = false;
				if (self._paused && !prevPaused) { //if the render() triggered callback that paused this timeline, we should abort (very rare, but possible)
					return;
				}
				self._time = recTime;
				self._totalTime = recTotalTime;
				self._cycle = recCycle;
				self._rawPrevTime = recRawPrevTime;
			}

			if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) {
				if (prevTotalTime !== self._totalTime) if (self._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
					self._callback("onUpdate");
				}
				return;
			} else if (!self._initted) {
				self._initted = true;
			}

			if (!self._active) if (!self._paused && self._totalTime !== prevTotalTime && time > 0) {
				self._active = true;  //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
			}
			
			if (prevTotalTime === 0) if (self.vars.onStart) if (self._totalTime !== 0 || !self._totalDuration) if (!suppressEvents) {
				self._callback("onStart");
			}

			curTime = self._time;
			if (curTime >= prevTime) {
				tween = self._first;
				while (tween) {
					next = tween._next; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= self._time && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			} else {
				tween = self._last;
				while (tween) {
					next = tween._prev; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
							while (pauseTween && pauseTween.endTime() > self._time) {
								pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
								pauseTween = pauseTween._prev;
							}
							pauseTween = null;
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			}
			
			if (self._onUpdate) if (!suppressEvents) {
				if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
					_lazyRender();
				}
				self._callback("onUpdate");
			}
			if (callback) if (!self._locked) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
				if (isComplete) {
					if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values.
						_lazyRender();
					}
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
			}
		};
		
		p.getActive = function(nested, tweens, timelines) {
			var a = [], 
				all = this.getChildren(nested || (nested == null), tweens || (nested == null), !!timelines),
				cnt = 0, 
				l = all.length,
				i, tween;
			for (i = 0; i < l; i++) {
				tween = all[i];
				if (tween.isActive()) {
					a[cnt++] = tween;
				}
			}
			return a;
		};
		
		
		p.getLabelAfter = function(time) {
			if (!time) if (time !== 0) { //faster than isNan()
				time = this._time;
			}
			var labels = this.getLabelsArray(),
				l = labels.length,
				i;
			for (i = 0; i < l; i++) {
				if (labels[i].time > time) {
					return labels[i].name;
				}
			}
			return null;
		};
		
		p.getLabelBefore = function(time) {
			if (time == null) {
				time = this._time;
			}
			var labels = this.getLabelsArray(),
				i = labels.length;
			while (--i > -1) {
				if (labels[i].time < time) {
					return labels[i].name;
				}
			}
			return null;
		};
		
		p.getLabelsArray = function() {
			var a = [],
				cnt = 0,
				p;
			for (p in this._labels) {
				a[cnt++] = {time:this._labels[p], name:p};
			}
			a.sort(function(a,b) {
				return a.time - b.time;
			});
			return a;
		};

		p.invalidate = function() {
			this._locked = false; //unlock and set cycle in case invalidate() is called from inside an onRepeat
			return TimelineLite.prototype.invalidate.call(this);
		};

		
//---- GETTERS / SETTERS -------------------------------------------------------------------------------------------------------
		
		p.progress = function(value, suppressEvents) {
			return (!arguments.length) ? (this._time / this.duration()) || 0 : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents);
		};
		
		p.totalProgress = function(value, suppressEvents) {
			return (!arguments.length) ? (this._totalTime / this.totalDuration()) || 0 : this.totalTime( this.totalDuration() * value, suppressEvents);
		};

		p.totalDuration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					TimelineLite.prototype.totalDuration.call(this); //just forces refresh
					//Instead of Infinity, we use 999999999999 so that we can accommodate reverses.
					this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat);
				}
				return this._totalDuration;
			}
			return (this._repeat === -1 || !value) ? this : this.timeScale( this.totalDuration() / value );
		};
		
		p.time = function(value, suppressEvents) {
			if (!arguments.length) {
				return this._time;
			}
			if (this._dirty) {
				this.totalDuration();
			}
			var duration = this._duration,
				cycle = this._cycle,
				cycleDur = cycle * (duration + this._repeatDelay);
			if (value > duration) {
				value = duration;
			}
			return this.totalTime((this._yoyo && (cycle & 1)) ? duration - value + cycleDur : this._repeat ? value + cycleDur : value, suppressEvents);
		};
		
		p.repeat = function(value) {
			if (!arguments.length) {
				return this._repeat;
			}
			this._repeat = value;
			return this._uncache(true);
		};
		
		p.repeatDelay = function(value) {
			if (!arguments.length) {
				return this._repeatDelay;
			}
			this._repeatDelay = value;
			return this._uncache(true);
		};
		
		p.yoyo = function(value) {
			if (!arguments.length) {
				return this._yoyo;
			}
			this._yoyo = value;
			return this;
		};
		
		p.currentLabel = function(value) {
			if (!arguments.length) {
				return this.getLabelBefore(this._time + _tinyNum);
			}
			return this.seek(value, true);
		};
		
		return TimelineMax;
		
	}, true);







/*
 * ----------------------------------------------------------------
 * TimelineLite
 * ----------------------------------------------------------------
 */

	_gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {

		var TimelineLite = function(vars) {
				SimpleTimeline.call(this, vars);
				var self = this,
					v = self.vars,
					val, p;
				self._labels = {};
				self.autoRemoveChildren = !!v.autoRemoveChildren;
				self.smoothChildTiming = !!v.smoothChildTiming;
				self._sortChildren = true;
				self._onUpdate = v.onUpdate;
				for (p in v) {
					val = v[p];
					if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) {
						v[p] = self._swapSelfInParams(val);
					}
				}
				if (_isArray(v.tweens)) {
					self.add(v.tweens, 0, v.align, v.stagger);
				}
			},
			_tinyNum = 0.00000001,
			TweenLiteInternals = TweenLite._internals,
			_internals = TimelineLite._internals = {},
			_isSelector = TweenLiteInternals.isSelector,
			_isArray = TweenLiteInternals.isArray,
			_lazyTweens = TweenLiteInternals.lazyTweens,
			_lazyRender = TweenLiteInternals.lazyRender,
			_globals = _gsScope._gsDefine.globals,
			_copy = function(vars) {
				var copy = {}, p;
				for (p in vars) {
					copy[p] = vars[p];
				}
				return copy;
			},
			_applyCycle = function(vars, targets, i) {
				var alt = vars.cycle,
					p, val;
				for (p in alt) {
					val = alt[p];
					vars[p] = (typeof(val) === "function") ? val(i, targets[i], targets) : val[i % val.length];
				}
				delete vars.cycle;
			},
			_pauseCallback = _internals.pauseCallback = function() {},
			_slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
				var b = [],
					l = a.length,
					i;
				for (i = 0; i !== l; b.push(a[i++]));
				return b;
			},
			_defaultImmediateRender = function(tl, toVars, fromVars, defaultFalse) { //default to immediateRender:true unless otherwise set in toVars, fromVars or if defaultFalse is passed in as true
				var ir = "immediateRender";
				if (!(ir in toVars)) {
					toVars[ir] = !((fromVars && fromVars[ir] === false) || defaultFalse);
				}
				return toVars;
			},
			//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
			_distribute = function(v) {
				if (typeof(v) === "function") {
					return v;
				}
				var vars = (typeof(v) === "object") ? v : {each:v}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
					ease = vars.ease,
					from = vars.from || 0,
					base = vars.base || 0,
					cache = {},
					isFromKeyword = isNaN(from),
					axis = vars.axis,
					ratio = {center:0.5, end:1}[from] || 0;
				return function(i, target, a) {
					var l = (a || vars).length,
						distances = cache[l],
						originX, originY, x, y, d, j, max, min, wrap;
					if (!distances) {
						wrap = (vars.grid === "auto") ? 0 : (vars.grid || [Infinity])[0];
						if (!wrap) {
							max = -Infinity;
							while (max < (max = a[wrap++].getBoundingClientRect().left) && wrap < l) { }
							wrap--;
						}
						distances = cache[l] = [];
						originX = isFromKeyword ? (Math.min(wrap, l) * ratio) - 0.5 : from % wrap;
						originY = isFromKeyword ? l * ratio / wrap - 0.5 : (from / wrap) | 0;
						max = 0;
						min = Infinity;
						for (j = 0; j < l; j++) {
							x = (j % wrap) - originX;
							y = originY - ((j / wrap) | 0);
							distances[j] = d = !axis ? Math.sqrt(x * x + y * y) : Math.abs((axis === "y") ? y : x);
							if (d > max) {
								max = d;
							}
							if (d < min) {
								min = d;
							}
						}
						distances.max = max - min;
						distances.min = min;
						distances.v = l = vars.amount || (vars.each * (wrap > l ? l - 1 : !axis ? Math.max(wrap, l / wrap) : axis === "y" ? l / wrap : wrap)) || 0;
						distances.b = (l < 0) ? base - l : base;
					}
					l = (distances[i] - distances.min) / distances.max;
					return distances.b + (ease ? ease.getRatio(l) : l) * distances.v;
				};
			},
			p = TimelineLite.prototype = new SimpleTimeline();

		TimelineLite.version = "2.1.3";
		TimelineLite.distribute = _distribute;
		p.constructor = TimelineLite;
		p.kill()._gc = p._forcingPlayhead = p._hasPause = false;

		/* might use later...
		//translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
		function localToGlobal(time, animation) {
			while (animation) {
				time = (time / animation._timeScale) + animation._startTime;
				animation = animation.timeline;
			}
			return time;
		}

		//translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales
		function globalToLocal(time, animation) {
			var scale = 1;
			time -= localToGlobal(0, animation);
			while (animation) {
				scale *= animation._timeScale;
				animation = animation.timeline;
			}
			return time * scale;
		}
		*/

		p.to = function(target, duration, vars, position) {
			var Engine = (vars.repeat && _globals.TweenMax) || TweenLite;
			return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position);
		};

		p.from = function(target, duration, vars, position) {
			return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, _defaultImmediateRender(this, vars)), position);
		};

		p.fromTo = function(target, duration, fromVars, toVars, position) {
			var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite;
			toVars = _defaultImmediateRender(this, toVars, fromVars);
			return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position);
		};

		p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
				staggerFunc = _distribute(vars.stagger || stagger),
				startAt = vars.startAt,
				cycle = vars.cycle,
				copy, i;
			if (typeof(targets) === "string") {
				targets = TweenLite.selector(targets) || targets;
			}
			targets = targets || [];
			if (_isSelector(targets)) { //if the targets object is a selector, translate it into an array.
				targets = _slice(targets);
			}
			for (i = 0; i < targets.length; i++) {
				copy = _copy(vars);
				if (startAt) {
					copy.startAt = _copy(startAt);
					if (startAt.cycle) {
						_applyCycle(copy.startAt, targets, i);
					}
				}
				if (cycle) {
					_applyCycle(copy, targets, i);
					if (copy.duration != null) {
						duration = copy.duration;
						delete copy.duration;
					}
				}
				tl.to(targets[i], duration, copy, staggerFunc(i, targets[i], targets));
			}
			return this.add(tl, position);
		};

		p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			vars.runBackwards = true;
			return this.staggerTo(targets, duration, _defaultImmediateRender(this, vars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};

		p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
			toVars.startAt = fromVars;
			return this.staggerTo(targets, duration, _defaultImmediateRender(this, toVars, fromVars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
		};

		p.call = function(callback, params, scope, position) {
			return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
		};

		p.set = function(target, vars, position) {
			return this.add( new TweenLite(target, 0, _defaultImmediateRender(this, vars, null, true)), position);
		};

		TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) {
			vars = vars || {};
			if (vars.smoothChildTiming == null) {
				vars.smoothChildTiming = true;
			}
			var tl = new TimelineLite(vars),
				root = tl._timeline,
				hasNegativeStart, time,	tween, next;
			if (ignoreDelayedCalls == null) {
				ignoreDelayedCalls = true;
			}
			root._remove(tl, true);
			tl._startTime = 0;
			tl._rawPrevTime = tl._time = tl._totalTime = root._time;
			tween = root._first;
			while (tween) {
				next = tween._next;
				if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) {
					time = tween._startTime - tween._delay;
					if (time < 0) {
						hasNegativeStart = 1;
					}
					tl.add(tween, time);
				}
				tween = next;
			}
			root.add(tl, 0);
			if (hasNegativeStart) { //calling totalDuration() will force the adjustment necessary to shift the children forward so none of them start before zero, and moves the timeline backwards the same amount, so the playhead is still aligned where it should be globally, but the timeline doesn't have illegal children that start before zero.
				tl.totalDuration();
			}
			return tl;
		};

		p.add = function(value, position, align, stagger) {
			var self = this,
				curTime, l, i, child, tl, beforeRawTime;
			if (typeof(position) !== "number") {
				position = self._parseTimeOrLabel(position, 0, true, value);
			}
			if (!(value instanceof Animation)) {
				if ((value instanceof Array) || (value && value.push && _isArray(value))) {
					align = align || "normal";
					stagger = stagger || 0;
					curTime = position;
					l = value.length;
					for (i = 0; i < l; i++) {
						if (_isArray(child = value[i])) {
							child = new TimelineLite({tweens:child});
						}
						self.add(child, curTime);
						if (typeof(child) !== "string" && typeof(child) !== "function") {
							if (align === "sequence") {
								curTime = child._startTime + (child.totalDuration() / child._timeScale);
							} else if (align === "start") {
								child._startTime -= child.delay();
							}
						}
						curTime += stagger;
					}
					return self._uncache(true);
				} else if (typeof(value) === "string") {
					return self.addLabel(value, position);
				} else if (typeof(value) === "function") {
					value = TweenLite.delayedCall(0, value);
				} else {
					throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string.");
				}
			}

			SimpleTimeline.prototype.add.call(self, value, position);

			if (value._time || (!value._duration && value._initted)) { //in case, for example, the _startTime is moved on a tween that has already rendered. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning.
				curTime = (self.rawTime() - value._startTime) * value._timeScale;
				if (!value._duration || Math.abs(Math.max(0, Math.min(value.totalDuration(), curTime))) - value._totalTime > 0.00001) {
					value.render(curTime, false, false);
				}
			}

			//if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
			if (self._gc || self._time === self._duration) if (!self._paused) if (self._duration < self.duration()) {
				//in case any of the ancestors had completed but should now be enabled...
				tl = self;
				beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
				while (tl._timeline) {
					if (beforeRawTime && tl._timeline.smoothChildTiming) {
						tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
					} else if (tl._gc) {
						tl._enabled(true, false);
					}
					tl = tl._timeline;
				}
			}

			return self;
		};

		p.remove = function(value) {
			if (value instanceof Animation) {
				this._remove(value, false);
				var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline.
				value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct.
				return this;
			} else if (value instanceof Array || (value && value.push && _isArray(value))) {
				var i = value.length;
				while (--i > -1) {
					this.remove(value[i]);
				}
				return this;
			} else if (typeof(value) === "string") {
				return this.removeLabel(value);
			}
			return this.kill(null, value);
		};

		p._remove = function(tween, skipDisable) {
			SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
			var last = this._last;
			if (!last) {
				this._time = this._totalTime = this._duration = this._totalDuration = 0;
			} else if (this._time > this.duration()) {
				this._time = this._duration;
				this._totalTime = this._totalDuration;
			}
			return this;
		};

		p.append = function(value, offsetOrLabel) {
			return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value));
		};

		p.insert = p.insertMultiple = function(value, position, align, stagger) {
			return this.add(value, position || 0, align, stagger);
		};

		p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) {
			return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger);
		};

		p.addLabel = function(label, position) {
			this._labels[label] = this._parseTimeOrLabel(position);
			return this;
		};

		p.addPause = function(position, callback, params, scope) {
			var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this);
			t.vars.onComplete = t.vars.onReverseComplete = callback;
			t.data = "isPause";
			this._hasPause = true;
			return this.add(t, position);
		};

		p.removeLabel = function(label) {
			delete this._labels[label];
			return this;
		};

		p.getLabelTime = function(label) {
			return (this._labels[label] != null) ? this._labels[label] : -1;
		};

		p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) {
			var clippedDuration, i;
			//if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration().
			if (ignore instanceof Animation && ignore.timeline === this) {
				this.remove(ignore);
			} else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) {
				i = ignore.length;
				while (--i > -1) {
					if (ignore[i] instanceof Animation && ignore[i].timeline === this) {
						this.remove(ignore[i]);
					}
				}
			}
			clippedDuration = (typeof(timeOrLabel) === "number" && !offsetOrLabel) ? 0 : (this.duration() > 99999999999) ? this.recent().endTime(false) : this._duration; //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead.
			if (typeof(offsetOrLabel) === "string") {
				return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - clippedDuration : 0, appendIfAbsent);
			}
			offsetOrLabel = offsetOrLabel || 0;
			if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value).
				i = timeOrLabel.indexOf("=");
				if (i === -1) {
					if (this._labels[timeOrLabel] == null) {
						return appendIfAbsent ? (this._labels[timeOrLabel] = clippedDuration + offsetOrLabel) : offsetOrLabel;
					}
					return this._labels[timeOrLabel] + offsetOrLabel;
				}
				offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1));
				timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : clippedDuration;
			} else if (timeOrLabel == null) {
				timeOrLabel = clippedDuration;
			}
			return Number(timeOrLabel) + offsetOrLabel;
		};

		p.seek = function(position, suppressEvents) {
			return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false));
		};

		p.stop = function() {
			return this.paused(true);
		};

		p.gotoAndPlay = function(position, suppressEvents) {
			return this.play(position, suppressEvents);
		};

		p.gotoAndStop = function(position, suppressEvents) {
			return this.pause(position, suppressEvents);
		};

		p.render = function(time, suppressEvents, force) {
			if (this._gc) {
				this._enabled(true, false);
			}
			var self = this,
				prevTime = self._time,
				totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(),
				prevStart = self._startTime,
				prevTimeScale = self._timeScale,
				prevPaused = self._paused,
				tween, isComplete, next, callback, internalForce, pauseTween, curTime, pauseTime;
			if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump).
				time += self._time - prevTime;
			}
			if (self._hasPause && !self._forcingPlayhead && !suppressEvents) {
				if (time > prevTime) {
					tween = self._first;
					while (tween && tween._startTime <= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) {
							pauseTween = tween;
						}
						tween = tween._next;
					}
				} else {
					tween = self._last;
					while (tween && tween._startTime >= time && !pauseTween) {
						if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
							pauseTween = tween;
						}
						tween = tween._prev;
					}
				}
				if (pauseTween) {
					self._time = self._totalTime = time = pauseTween._startTime;
					pauseTime = self._startTime + (self._reversed ? self._duration - time : time) / self._timeScale;
				}
			}
			if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts.
				self._totalTime = self._time = totalDur;
				if (!self._reversed) if (!self._hasPausedChild()) {
					isComplete = true;
					callback = "onComplete";
					internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline.
					if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || self._rawPrevTime < 0 || self._rawPrevTime === _tinyNum) if (self._rawPrevTime !== time && self._first) {
						internalForce = true;
						if (self._rawPrevTime > _tinyNum) {
							callback = "onReverseComplete";
						}
					}
				}
				self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
				time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7.

			} else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0.
				self._totalTime = self._time = 0;
				if (time > -_tinyNum) {
					time = 0;
				}
				if (prevTime !== 0 || (self._duration === 0 && self._rawPrevTime !== _tinyNum && (self._rawPrevTime > 0 || (time < 0 && self._rawPrevTime >= 0)))) {
					callback = "onReverseComplete";
					isComplete = self._reversed;
				}
				if (time < 0) {
					self._active = false;
					if (self._timeline.autoRemoveChildren && self._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing.
						internalForce = isComplete = true;
						callback = "onReverseComplete";
					} else if (self._rawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
						internalForce = true;
					}
					self._rawPrevTime = time;
				} else {
					self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
					if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
						tween = self._first;
						while (tween && tween._startTime === 0) {
							if (!tween._duration) {
								isComplete = false;
							}
							tween = tween._next;
						}
					}
					time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
					if (!self._initted) {
						internalForce = true;
					}
				}

			} else {
				self._totalTime = self._time = self._rawPrevTime = time;
			}
			if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) {
				return;
			} else if (!self._initted) {
				self._initted = true;
			}

			if (!self._active) if (!self._paused && self._time !== prevTime && time > 0) {
				self._active = true;  //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example.
			}

			if (prevTime === 0) if (self.vars.onStart) if (self._time !== 0 || !self._duration) if (!suppressEvents) {
				self._callback("onStart");
			}

			curTime = self._time;
			if (curTime >= prevTime) {
				tween = self._first;
				while (tween) {
					next = tween._next; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= curTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			} else {
				tween = self._last;
				while (tween) {
					next = tween._prev; //record it here because the value could change after rendering...
					if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete
						break;
					} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
						if (pauseTween === tween) {
							pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
							while (pauseTween && pauseTween.endTime() > self._time) {
								pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
								pauseTween = pauseTween._prev;
							}
							pauseTween = null;
							self.pause();
							self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead)
						}
						if (!tween._reversed) {
							tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
						} else {
							tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
						}
					}
					tween = next;
				}
			}

			if (self._onUpdate) if (!suppressEvents) {
				if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
					_lazyRender();
				}
				self._callback("onUpdate");
			}

			if (callback) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
				if (isComplete) {
					if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values.
						_lazyRender();
					}
					if (self._timeline.autoRemoveChildren) {
						self._enabled(false, false);
					}
					self._active = false;
				}
				if (!suppressEvents && self.vars[callback]) {
					self._callback(callback);
				}
			}
		};

		p._hasPausedChild = function() {
			var tween = this._first;
			while (tween) {
				if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) {
					return true;
				}
				tween = tween._next;
			}
			return false;
		};

		p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) {
			ignoreBeforeTime = ignoreBeforeTime || -9999999999;
			var a = [],
				tween = this._first,
				cnt = 0;
			while (tween) {
				if (tween._startTime < ignoreBeforeTime) {
					//do nothing
				} else if (tween instanceof TweenLite) {
					if (tweens !== false) {
						a[cnt++] = tween;
					}
				} else {
					if (timelines !== false) {
						a[cnt++] = tween;
					}
					if (nested !== false) {
						a = a.concat(tween.getChildren(true, tweens, timelines));
						cnt = a.length;
					}
				}
				tween = tween._next;
			}
			return a;
		};

		p.getTweensOf = function(target, nested) {
			var disabled = this._gc,
				a = [],
				cnt = 0,
				tweens, i;
			if (disabled) {
				this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here.
			}
			tweens = TweenLite.getTweensOf(target);
			i = tweens.length;
			while (--i > -1) {
				if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) {
					a[cnt++] = tweens[i];
				}
			}
			if (disabled) {
				this._enabled(false, true);
			}
			return a;
		};

		p.recent = function() {
			return this._recent;
		};

		p._contains = function(tween) {
			var tl = tween.timeline;
			while (tl) {
				if (tl === this) {
					return true;
				}
				tl = tl.timeline;
			}
			return false;
		};

		p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) {
			ignoreBeforeTime = ignoreBeforeTime || 0;
			var tween = this._first,
				labels = this._labels,
				p;
			while (tween) {
				if (tween._startTime >= ignoreBeforeTime) {
					tween._startTime += amount;
				}
				tween = tween._next;
			}
			if (adjustLabels) {
				for (p in labels) {
					if (labels[p] >= ignoreBeforeTime) {
						labels[p] += amount;
					}
				}
			}
			return this._uncache(true);
		};

		p._kill = function(vars, target) {
			if (!vars && !target) {
				return this._enabled(false, false);
			}
			var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target),
				i = tweens.length,
				changed = false;
			while (--i > -1) {
				if (tweens[i]._kill(vars, target)) {
					changed = true;
				}
			}
			return changed;
		};

		p.clear = function(labels) {
			var tweens = this.getChildren(false, true, true),
				i = tweens.length;
			this._time = this._totalTime = 0;
			while (--i > -1) {
				tweens[i]._enabled(false, false);
			}
			if (labels !== false) {
				this._labels = {};
			}
			return this._uncache(true);
		};

		p.invalidate = function() {
			var tween = this._first;
			while (tween) {
				tween.invalidate();
				tween = tween._next;
			}
			return Animation.prototype.invalidate.call(this);;
		};

		p._enabled = function(enabled, ignoreTimeline) {
			if (enabled === this._gc) {
				var tween = this._first;
				while (tween) {
					tween._enabled(enabled, true);
					tween = tween._next;
				}
			}
			return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline);
		};

		p.totalTime = function(time, suppressEvents, uncapped) {
			this._forcingPlayhead = true;
			var val = Animation.prototype.totalTime.apply(this, arguments);
			this._forcingPlayhead = false;
			return val;
		};

		p.duration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					this.totalDuration(); //just triggers recalculation
				}
				return this._duration;
			}
			if (this.duration() !== 0 && value !== 0) {
				this.timeScale(this._duration / value);
			}
			return this;
		};

		p.totalDuration = function(value) {
			if (!arguments.length) {
				if (this._dirty) {
					var max = 0,
						self = this,
						tween = self._last,
						prevStart = 999999999999,
						prev, end;
					while (tween) {
						prev = tween._prev; //record it here in case the tween changes position in the sequence...
						if (tween._dirty) {
							tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it.
						}
						if (tween._startTime > prevStart && self._sortChildren && !tween._paused && !self._calculatingDuration) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence
							self._calculatingDuration = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(), like _parseTimeOrLabel().
							self.add(tween, tween._startTime - tween._delay);
							self._calculatingDuration = 0;
						} else {
							prevStart = tween._startTime;
						}
						if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found.
							max -= tween._startTime;
							if (self._timeline.smoothChildTiming) {
								self._startTime += tween._startTime / self._timeScale;
								self._time -= tween._startTime;
								self._totalTime -= tween._startTime;
								self._rawPrevTime -= tween._startTime;
							}
							self.shiftChildren(-tween._startTime, false, -9999999999);
							prevStart = 0;
						}
						end = tween._startTime + (tween._totalDuration / tween._timeScale);
						if (end > max) {
							max = end;
						}
						tween = prev;
					}
					self._duration = self._totalDuration = max;
					self._dirty = false;
				}
				return this._totalDuration;
			}
			return (value && this.totalDuration()) ? this.timeScale(this._totalDuration / value) : this;
		};

		p.paused = function(value) {
			if (value === false && this._paused) { //if there's a pause directly at the spot from where we're unpausing, skip it.
				var tween = this._first;
				while (tween) {
					if (tween._startTime === this._time && tween.data === "isPause") {
						tween._rawPrevTime = 0; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire.
					}
					tween = tween._next;
				}
			}
			return Animation.prototype.paused.apply(this, arguments);
		};

		p.usesFrames = function() {
			var tl = this._timeline;
			while (tl._timeline) {
				tl = tl._timeline;
			}
			return (tl === Animation._rootFramesTimeline);
		};

		p.rawTime = function(wrapRepeats) {
			return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale;
		};

		return TimelineLite;

	}, true);

}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }

//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
(function(name) {
	"use strict";
	var getGlobal = function() {
		return (_gsScope.GreenSockGlobals || _gsScope)[name];
	};
	if (typeof(module) !== "undefined" && module.exports) { //node
		require("./TweenLite.js"); //dependency
		module.exports = getGlobal();
	} else if (typeof(define) === "function" && define.amd) { //AMD
		define(["TweenLite"], getGlobal);
	}
}("TimelineMax"));
/*!
 * jQuery JavaScript Library v3.3.1
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2018-01-20T17:24Z
 */
( function( global, factory ) {

	"use strict";

	if ( typeof module === "object" && typeof module.exports === "object" ) {

		// For CommonJS and CommonJS-like environments where a proper `window`
		// is present, execute the factory and get jQuery.
		// For environments that do not have a `window` with a `document`
		// (such as Node.js), expose a factory as module.exports.
		// This accentuates the need for the creation of a real `window`.
		// e.g. var jQuery = require("jquery")(window);
		// See ticket #14549 for more info.
		module.exports = global.document ?
			factory( global, true ) :
			function( w ) {
				if ( !w.document ) {
					throw new Error( "jQuery requires a window with a document" );
				}
				return factory( w );
			};
	} else {
		factory( global );
	}

// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {

// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";

var arr = [];

var document = window.document;

var getProto = Object.getPrototypeOf;

var slice = arr.slice;

var concat = arr.concat;

var push = arr.push;

var indexOf = arr.indexOf;

var class2type = {};

var toString = class2type.toString;

var hasOwn = class2type.hasOwnProperty;

var fnToString = hasOwn.toString;

var ObjectFunctionString = fnToString.call( Object );

var support = {};

var isFunction = function isFunction( obj ) {

      // Support: Chrome <=57, Firefox <=52
      // In some browsers, typeof returns "function" for HTML <object> elements
      // (i.e., `typeof document.createElement( "object" ) === "function"`).
      // We don't want to classify *any* DOM node as a function.
      return typeof obj === "function" && typeof obj.nodeType !== "number";
  };


var isWindow = function isWindow( obj ) {
		return obj != null && obj === obj.window;
	};




	var preservedScriptAttributes = {
		type: true,
		src: true,
		noModule: true
	};

	function DOMEval( code, doc, node ) {
		doc = doc || document;

		var i,
			script = doc.createElement( "script" );

		script.text = code;
		if ( node ) {
			for ( i in preservedScriptAttributes ) {
				if ( node[ i ] ) {
					script[ i ] = node[ i ];
				}
			}
		}
		doc.head.appendChild( script ).parentNode.removeChild( script );
	}


function toType( obj ) {
	if ( obj == null ) {
		return obj + "";
	}

	// Support: Android <=2.3 only (functionish RegExp)
	return typeof obj === "object" || typeof obj === "function" ?
		class2type[ toString.call( obj ) ] || "object" :
		typeof obj;
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module



var
	version = "3.3.1",

	// Define a local copy of jQuery
	jQuery = function( selector, context ) {

		// The jQuery object is actually just the init constructor 'enhanced'
		// Need init if jQuery is called (just allow error to be thrown if not included)
		return new jQuery.fn.init( selector, context );
	},

	// Support: Android <=4.0 only
	// Make sure we trim BOM and NBSP
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;

jQuery.fn = jQuery.prototype = {

	// The current version of jQuery being used
	jquery: version,

	constructor: jQuery,

	// The default length of a jQuery object is 0
	length: 0,

	toArray: function() {
		return slice.call( this );
	},

	// Get the Nth element in the matched element set OR
	// Get the whole matched element set as a clean array
	get: function( num ) {

		// Return all the elements in a clean array
		if ( num == null ) {
			return slice.call( this );
		}

		// Return just the one element from the set
		return num < 0 ? this[ num + this.length ] : this[ num ];
	},

	// Take an array of elements and push it onto the stack
	// (returning the new matched element set)
	pushStack: function( elems ) {

		// Build a new jQuery matched element set
		var ret = jQuery.merge( this.constructor(), elems );

		// Add the old object onto the stack (as a reference)
		ret.prevObject = this;

		// Return the newly-formed element set
		return ret;
	},

	// Execute a callback for every element in the matched set.
	each: function( callback ) {
		return jQuery.each( this, callback );
	},

	map: function( callback ) {
		return this.pushStack( jQuery.map( this, function( elem, i ) {
			return callback.call( elem, i, elem );
		} ) );
	},

	slice: function() {
		return this.pushStack( slice.apply( this, arguments ) );
	},

	first: function() {
		return this.eq( 0 );
	},

	last: function() {
		return this.eq( -1 );
	},

	eq: function( i ) {
		var len = this.length,
			j = +i + ( i < 0 ? len : 0 );
		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
	},

	end: function() {
		return this.prevObject || this.constructor();
	},

	// For internal use only.
	// Behaves like an Array's method, not like a jQuery method.
	push: push,
	sort: arr.sort,
	splice: arr.splice
};

jQuery.extend = jQuery.fn.extend = function() {
	var options, name, src, copy, copyIsArray, clone,
		target = arguments[ 0 ] || {},
		i = 1,
		length = arguments.length,
		deep = false;

	// Handle a deep copy situation
	if ( typeof target === "boolean" ) {
		deep = target;

		// Skip the boolean and the target
		target = arguments[ i ] || {};
		i++;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !isFunction( target ) ) {
		target = {};
	}

	// Extend jQuery itself if only one argument is passed
	if ( i === length ) {
		target = this;
		i--;
	}

	for ( ; i < length; i++ ) {

		// Only deal with non-null/undefined values
		if ( ( options = arguments[ i ] ) != null ) {

			// Extend the base object
			for ( name in options ) {
				src = target[ name ];
				copy = options[ name ];

				// Prevent never-ending loop
				if ( target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
					( copyIsArray = Array.isArray( copy ) ) ) ) {

					if ( copyIsArray ) {
						copyIsArray = false;
						clone = src && Array.isArray( src ) ? src : [];

					} else {
						clone = src && jQuery.isPlainObject( src ) ? src : {};
					}

					// Never move original objects, clone them
					target[ name ] = jQuery.extend( deep, clone, copy );

				// Don't bring in undefined values
				} else if ( copy !== undefined ) {
					target[ name ] = copy;
				}
			}
		}
	}

	// Return the modified object
	return target;
};

jQuery.extend( {

	// Unique for each copy of jQuery on the page
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),

	// Assume jQuery is ready without the ready module
	isReady: true,

	error: function( msg ) {
		throw new Error( msg );
	},

	noop: function() {},

	isPlainObject: function( obj ) {
		var proto, Ctor;

		// Detect obvious negatives
		// Use toString instead of jQuery.type to catch host objects
		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
			return false;
		}

		proto = getProto( obj );

		// Objects with no prototype (e.g., `Object.create( null )`) are plain
		if ( !proto ) {
			return true;
		}

		// Objects with prototype are plain iff they were constructed by a global Object function
		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
	},

	isEmptyObject: function( obj ) {

		/* eslint-disable no-unused-vars */
		// See https://github.com/eslint/eslint/issues/6125
		var name;

		for ( name in obj ) {
			return false;
		}
		return true;
	},

	// Evaluates a script in a global context
	globalEval: function( code ) {
		DOMEval( code );
	},

	each: function( obj, callback ) {
		var length, i = 0;

		if ( isArrayLike( obj ) ) {
			length = obj.length;
			for ( ; i < length; i++ ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		} else {
			for ( i in obj ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		}

		return obj;
	},

	// Support: Android <=4.0 only
	trim: function( text ) {
		return text == null ?
			"" :
			( text + "" ).replace( rtrim, "" );
	},

	// results is for internal usage only
	makeArray: function( arr, results ) {
		var ret = results || [];

		if ( arr != null ) {
			if ( isArrayLike( Object( arr ) ) ) {
				jQuery.merge( ret,
					typeof arr === "string" ?
					[ arr ] : arr
				);
			} else {
				push.call( ret, arr );
			}
		}

		return ret;
	},

	inArray: function( elem, arr, i ) {
		return arr == null ? -1 : indexOf.call( arr, elem, i );
	},

	// Support: Android <=4.0 only, PhantomJS 1 only
	// push.apply(_, arraylike) throws on ancient WebKit
	merge: function( first, second ) {
		var len = +second.length,
			j = 0,
			i = first.length;

		for ( ; j < len; j++ ) {
			first[ i++ ] = second[ j ];
		}

		first.length = i;

		return first;
	},

	grep: function( elems, callback, invert ) {
		var callbackInverse,
			matches = [],
			i = 0,
			length = elems.length,
			callbackExpect = !invert;

		// Go through the array, only saving the items
		// that pass the validator function
		for ( ; i < length; i++ ) {
			callbackInverse = !callback( elems[ i ], i );
			if ( callbackInverse !== callbackExpect ) {
				matches.push( elems[ i ] );
			}
		}

		return matches;
	},

	// arg is for internal usage only
	map: function( elems, callback, arg ) {
		var length, value,
			i = 0,
			ret = [];

		// Go through the array, translating each of the items to their new values
		if ( isArrayLike( elems ) ) {
			length = elems.length;
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}
		}

		// Flatten any nested arrays
		return concat.apply( [], ret );
	},

	// A global GUID counter for objects
	guid: 1,

	// jQuery.support is not used in Core but other projects attach their
	// properties to it so it needs to exist.
	support: support
} );

if ( typeof Symbol === "function" ) {
	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
}

// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( i, name ) {
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );

function isArrayLike( obj ) {

	// Support: real iOS 8.2 only (not reproducible in simulator)
	// `in` check used to prevent JIT error (gh-2145)
	// hasOwn isn't used here due to false negatives
	// regarding Nodelist length in IE
	var length = !!obj && "length" in obj && obj.length,
		type = toType( obj );

	if ( isFunction( obj ) || isWindow( obj ) ) {
		return false;
	}

	return type === "array" || length === 0 ||
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
 * Sizzle CSS Selector Engine v2.3.3
 * https://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2016-08-08
 */
(function( window ) {

var i,
	support,
	Expr,
	getText,
	isXML,
	tokenize,
	compile,
	select,
	outermostContext,
	sortInput,
	hasDuplicate,

	// Local document vars
	setDocument,
	document,
	docElem,
	documentIsHTML,
	rbuggyQSA,
	rbuggyMatches,
	matches,
	contains,

	// Instance-specific data
	expando = "sizzle" + 1 * new Date(),
	preferredDoc = window.document,
	dirruns = 0,
	done = 0,
	classCache = createCache(),
	tokenCache = createCache(),
	compilerCache = createCache(),
	sortOrder = function( a, b ) {
		if ( a === b ) {
			hasDuplicate = true;
		}
		return 0;
	},

	// Instance methods
	hasOwn = ({}).hasOwnProperty,
	arr = [],
	pop = arr.pop,
	push_native = arr.push,
	push = arr.push,
	slice = arr.slice,
	// Use a stripped-down indexOf as it's faster than native
	// https://jsperf.com/thor-indexof-vs-for/5
	indexOf = function( list, elem ) {
		var i = 0,
			len = list.length;
		for ( ; i < len; i++ ) {
			if ( list[i] === elem ) {
				return i;
			}
		}
		return -1;
	},

	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",

	// Regular expressions

	// http://www.w3.org/TR/css3-selectors/#whitespace
	whitespace = "[\\x20\\t\\r\\n\\f]",

	// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
	identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",

	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
		// Operator (capture 2)
		"*([*^$|!~]?=)" + whitespace +
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
		"*\\]",

	pseudos = ":(" + identifier + ")(?:\\((" +
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
		// 1. quoted (capture 3; capture 4 or capture 5)
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
		// 2. simple (capture 6)
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
		// 3. anything else (capture 2)
		".*" +
		")\\)|)",

	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
	rwhitespace = new RegExp( whitespace + "+", "g" ),
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),

	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),

	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),

	rpseudo = new RegExp( pseudos ),
	ridentifier = new RegExp( "^" + identifier + "$" ),

	matchExpr = {
		"ID": new RegExp( "^#(" + identifier + ")" ),
		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
		"ATTR": new RegExp( "^" + attributes ),
		"PSEUDO": new RegExp( "^" + pseudos ),
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
		// For use in libraries implementing .is()
		// We use this for POS matching in `select`
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
	},

	rinputs = /^(?:input|select|textarea|button)$/i,
	rheader = /^h\d$/i,

	rnative = /^[^{]+\{\s*\[native \w/,

	// Easily-parseable/retrievable ID or TAG or CLASS selectors
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,

	rsibling = /[+~]/,

	// CSS escapes
	// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
	funescape = function( _, escaped, escapedWhitespace ) {
		var high = "0x" + escaped - 0x10000;
		// NaN means non-codepoint
		// Support: Firefox<24
		// Workaround erroneous numeric interpretation of +"0x"
		return high !== high || escapedWhitespace ?
			escaped :
			high < 0 ?
				// BMP codepoint
				String.fromCharCode( high + 0x10000 ) :
				// Supplemental Plane codepoint (surrogate pair)
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
	},

	// CSS string/identifier serialization
	// https://drafts.csswg.org/cssom/#common-serializing-idioms
	rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
	fcssescape = function( ch, asCodePoint ) {
		if ( asCodePoint ) {

			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
			if ( ch === "\0" ) {
				return "\uFFFD";
			}

			// Control characters and (dependent upon position) numbers get escaped as code points
			return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
		}

		// Other potentially-special ASCII characters get backslash-escaped
		return "\\" + ch;
	},

	// Used for iframes
	// See setDocument()
	// Removing the function wrapper causes a "Permission Denied"
	// error in IE
	unloadHandler = function() {
		setDocument();
	},

	disabledAncestor = addCombinator(
		function( elem ) {
			return elem.disabled === true && ("form" in elem || "label" in elem);
		},
		{ dir: "parentNode", next: "legend" }
	);

// Optimize for push.apply( _, NodeList )
try {
	push.apply(
		(arr = slice.call( preferredDoc.childNodes )),
		preferredDoc.childNodes
	);
	// Support: Android<4.0
	// Detect silently failing push.apply
	arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
	push = { apply: arr.length ?

		// Leverage slice if possible
		function( target, els ) {
			push_native.apply( target, slice.call(els) );
		} :

		// Support: IE<9
		// Otherwise append directly
		function( target, els ) {
			var j = target.length,
				i = 0;
			// Can't trust NodeList.length
			while ( (target[j++] = els[i++]) ) {}
			target.length = j - 1;
		}
	};
}

function Sizzle( selector, context, results, seed ) {
	var m, i, elem, nid, match, groups, newSelector,
		newContext = context && context.ownerDocument,

		// nodeType defaults to 9, since context defaults to document
		nodeType = context ? context.nodeType : 9;

	results = results || [];

	// Return early from calls with invalid selector or context
	if ( typeof selector !== "string" || !selector ||
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {

		return results;
	}

	// Try to shortcut find operations (as opposed to filters) in HTML documents
	if ( !seed ) {

		if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
			setDocument( context );
		}
		context = context || document;

		if ( documentIsHTML ) {

			// If the selector is sufficiently simple, try using a "get*By*" DOM method
			// (excepting DocumentFragment context, where the methods don't exist)
			if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {

				// ID selector
				if ( (m = match[1]) ) {

					// Document context
					if ( nodeType === 9 ) {
						if ( (elem = context.getElementById( m )) ) {

							// Support: IE, Opera, Webkit
							// TODO: identify versions
							// getElementById can match elements by name instead of ID
							if ( elem.id === m ) {
								results.push( elem );
								return results;
							}
						} else {
							return results;
						}

					// Element context
					} else {

						// Support: IE, Opera, Webkit
						// TODO: identify versions
						// getElementById can match elements by name instead of ID
						if ( newContext && (elem = newContext.getElementById( m )) &&
							contains( context, elem ) &&
							elem.id === m ) {

							results.push( elem );
							return results;
						}
					}

				// Type selector
				} else if ( match[2] ) {
					push.apply( results, context.getElementsByTagName( selector ) );
					return results;

				// Class selector
				} else if ( (m = match[3]) && support.getElementsByClassName &&
					context.getElementsByClassName ) {

					push.apply( results, context.getElementsByClassName( m ) );
					return results;
				}
			}

			// Take advantage of querySelectorAll
			if ( support.qsa &&
				!compilerCache[ selector + " " ] &&
				(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {

				if ( nodeType !== 1 ) {
					newContext = context;
					newSelector = selector;

				// qSA looks outside Element context, which is not what we want
				// Thanks to Andrew Dupont for this workaround technique
				// Support: IE <=8
				// Exclude object elements
				} else if ( context.nodeName.toLowerCase() !== "object" ) {

					// Capture the context ID, setting it first if necessary
					if ( (nid = context.getAttribute( "id" )) ) {
						nid = nid.replace( rcssescape, fcssescape );
					} else {
						context.setAttribute( "id", (nid = expando) );
					}

					// Prefix every selector in the list
					groups = tokenize( selector );
					i = groups.length;
					while ( i-- ) {
						groups[i] = "#" + nid + " " + toSelector( groups[i] );
					}
					newSelector = groups.join( "," );

					// Expand context for sibling selectors
					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
						context;
				}

				if ( newSelector ) {
					try {
						push.apply( results,
							newContext.querySelectorAll( newSelector )
						);
						return results;
					} catch ( qsaError ) {
					} finally {
						if ( nid === expando ) {
							context.removeAttribute( "id" );
						}
					}
				}
			}
		}
	}

	// All others
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
}

/**
 * Create key-value caches of limited size
 * @returns {function(string, object)} Returns the Object data after storing it on itself with
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
 *	deleting the oldest entry
 */
function createCache() {
	var keys = [];

	function cache( key, value ) {
		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
		if ( keys.push( key + " " ) > Expr.cacheLength ) {
			// Only keep the most recent entries
			delete cache[ keys.shift() ];
		}
		return (cache[ key + " " ] = value);
	}
	return cache;
}

/**
 * Mark a function for special use by Sizzle
 * @param {Function} fn The function to mark
 */
function markFunction( fn ) {
	fn[ expando ] = true;
	return fn;
}

/**
 * Support testing using an element
 * @param {Function} fn Passed the created element and returns a boolean result
 */
function assert( fn ) {
	var el = document.createElement("fieldset");

	try {
		return !!fn( el );
	} catch (e) {
		return false;
	} finally {
		// Remove from its parent by default
		if ( el.parentNode ) {
			el.parentNode.removeChild( el );
		}
		// release memory in IE
		el = null;
	}
}

/**
 * Adds the same handler for all of the specified attrs
 * @param {String} attrs Pipe-separated list of attributes
 * @param {Function} handler The method that will be applied
 */
function addHandle( attrs, handler ) {
	var arr = attrs.split("|"),
		i = arr.length;

	while ( i-- ) {
		Expr.attrHandle[ arr[i] ] = handler;
	}
}

/**
 * Checks document order of two siblings
 * @param {Element} a
 * @param {Element} b
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
 */
function siblingCheck( a, b ) {
	var cur = b && a,
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
			a.sourceIndex - b.sourceIndex;

	// Use IE sourceIndex if available on both nodes
	if ( diff ) {
		return diff;
	}

	// Check if b follows a
	if ( cur ) {
		while ( (cur = cur.nextSibling) ) {
			if ( cur === b ) {
				return -1;
			}
		}
	}

	return a ? 1 : -1;
}

/**
 * Returns a function to use in pseudos for input types
 * @param {String} type
 */
function createInputPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return name === "input" && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for buttons
 * @param {String} type
 */
function createButtonPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return (name === "input" || name === "button") && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for :enabled/:disabled
 * @param {Boolean} disabled true for :disabled; false for :enabled
 */
function createDisabledPseudo( disabled ) {

	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
	return function( elem ) {

		// Only certain elements can match :enabled or :disabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
		if ( "form" in elem ) {

			// Check for inherited disabledness on relevant non-disabled elements:
			// * listed form-associated elements in a disabled fieldset
			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
			// * option elements in a disabled optgroup
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
			// All such elements have a "form" property.
			if ( elem.parentNode && elem.disabled === false ) {

				// Option elements defer to a parent optgroup if present
				if ( "label" in elem ) {
					if ( "label" in elem.parentNode ) {
						return elem.parentNode.disabled === disabled;
					} else {
						return elem.disabled === disabled;
					}
				}

				// Support: IE 6 - 11
				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
				return elem.isDisabled === disabled ||

					// Where there is no isDisabled, check manually
					/* jshint -W018 */
					elem.isDisabled !== !disabled &&
						disabledAncestor( elem ) === disabled;
			}

			return elem.disabled === disabled;

		// Try to winnow out elements that can't be disabled before trusting the disabled property.
		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
		// even exist on them, let alone have a boolean value.
		} else if ( "label" in elem ) {
			return elem.disabled === disabled;
		}

		// Remaining elements are neither :enabled nor :disabled
		return false;
	};
}

/**
 * Returns a function to use in pseudos for positionals
 * @param {Function} fn
 */
function createPositionalPseudo( fn ) {
	return markFunction(function( argument ) {
		argument = +argument;
		return markFunction(function( seed, matches ) {
			var j,
				matchIndexes = fn( [], seed.length, argument ),
				i = matchIndexes.length;

			// Match elements found at the specified indexes
			while ( i-- ) {
				if ( seed[ (j = matchIndexes[i]) ] ) {
					seed[j] = !(matches[j] = seed[j]);
				}
			}
		});
	});
}

/**
 * Checks a node for validity as a Sizzle context
 * @param {Element|Object=} context
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
 */
function testContext( context ) {
	return context && typeof context.getElementsByTagName !== "undefined" && context;
}

// Expose support vars for convenience
support = Sizzle.support = {};

/**
 * Detects XML nodes
 * @param {Element|Object} elem An element or a document
 * @returns {Boolean} True iff elem is a non-HTML XML node
 */
isXML = Sizzle.isXML = function( elem ) {
	// documentElement is verified for cases where it doesn't yet exist
	// (such as loading iframes in IE - #4833)
	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
	return documentElement ? documentElement.nodeName !== "HTML" : false;
};

/**
 * Sets document-related variables once based on the current document
 * @param {Element|Object} [doc] An element or document object to use to set the document
 * @returns {Object} Returns the current document
 */
setDocument = Sizzle.setDocument = function( node ) {
	var hasCompare, subWindow,
		doc = node ? node.ownerDocument || node : preferredDoc;

	// Return early if doc is invalid or already selected
	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
		return document;
	}

	// Update global variables
	document = doc;
	docElem = document.documentElement;
	documentIsHTML = !isXML( document );

	// Support: IE 9-11, Edge
	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
	if ( preferredDoc !== document &&
		(subWindow = document.defaultView) && subWindow.top !== subWindow ) {

		// Support: IE 11, Edge
		if ( subWindow.addEventListener ) {
			subWindow.addEventListener( "unload", unloadHandler, false );

		// Support: IE 9 - 10 only
		} else if ( subWindow.attachEvent ) {
			subWindow.attachEvent( "onunload", unloadHandler );
		}
	}

	/* Attributes
	---------------------------------------------------------------------- */

	// Support: IE<8
	// Verify that getAttribute really returns attributes and not properties
	// (excepting IE8 booleans)
	support.attributes = assert(function( el ) {
		el.className = "i";
		return !el.getAttribute("className");
	});

	/* getElement(s)By*
	---------------------------------------------------------------------- */

	// Check if getElementsByTagName("*") returns only elements
	support.getElementsByTagName = assert(function( el ) {
		el.appendChild( document.createComment("") );
		return !el.getElementsByTagName("*").length;
	});

	// Support: IE<9
	support.getElementsByClassName = rnative.test( document.getElementsByClassName );

	// Support: IE<10
	// Check if getElementById returns elements by name
	// The broken getElementById methods don't pick up programmatically-set names,
	// so use a roundabout getElementsByName test
	support.getById = assert(function( el ) {
		docElem.appendChild( el ).id = expando;
		return !document.getElementsByName || !document.getElementsByName( expando ).length;
	});

	// ID filter and find
	if ( support.getById ) {
		Expr.filter["ID"] = function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				return elem.getAttribute("id") === attrId;
			};
		};
		Expr.find["ID"] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var elem = context.getElementById( id );
				return elem ? [ elem ] : [];
			}
		};
	} else {
		Expr.filter["ID"] =  function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				var node = typeof elem.getAttributeNode !== "undefined" &&
					elem.getAttributeNode("id");
				return node && node.value === attrId;
			};
		};

		// Support: IE 6 - 7 only
		// getElementById is not reliable as a find shortcut
		Expr.find["ID"] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var node, i, elems,
					elem = context.getElementById( id );

				if ( elem ) {

					// Verify the id attribute
					node = elem.getAttributeNode("id");
					if ( node && node.value === id ) {
						return [ elem ];
					}

					// Fall back on getElementsByName
					elems = context.getElementsByName( id );
					i = 0;
					while ( (elem = elems[i++]) ) {
						node = elem.getAttributeNode("id");
						if ( node && node.value === id ) {
							return [ elem ];
						}
					}
				}

				return [];
			}
		};
	}

	// Tag
	Expr.find["TAG"] = support.getElementsByTagName ?
		function( tag, context ) {
			if ( typeof context.getElementsByTagName !== "undefined" ) {
				return context.getElementsByTagName( tag );

			// DocumentFragment nodes don't have gEBTN
			} else if ( support.qsa ) {
				return context.querySelectorAll( tag );
			}
		} :

		function( tag, context ) {
			var elem,
				tmp = [],
				i = 0,
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
				results = context.getElementsByTagName( tag );

			// Filter out possible comments
			if ( tag === "*" ) {
				while ( (elem = results[i++]) ) {
					if ( elem.nodeType === 1 ) {
						tmp.push( elem );
					}
				}

				return tmp;
			}
			return results;
		};

	// Class
	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
			return context.getElementsByClassName( className );
		}
	};

	/* QSA/matchesSelector
	---------------------------------------------------------------------- */

	// QSA and matchesSelector support

	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
	rbuggyMatches = [];

	// qSa(:focus) reports false when true (Chrome 21)
	// We allow this because of a bug in IE8/9 that throws an error
	// whenever `document.activeElement` is accessed on an iframe
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
	// See https://bugs.jquery.com/ticket/13378
	rbuggyQSA = [];

	if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
		// Build QSA regex
		// Regex strategy adopted from Diego Perini
		assert(function( el ) {
			// Select is set to empty string on purpose
			// This is to test IE's treatment of not explicitly
			// setting a boolean content attribute,
			// since its presence should be enough
			// https://bugs.jquery.com/ticket/12359
			docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
				"<select id='" + expando + "-\r\\' msallowcapture=''>" +
				"<option selected=''></option></select>";

			// Support: IE8, Opera 11-12.16
			// Nothing should be selected when empty strings follow ^= or $= or *=
			// The test attribute must be unknown in Opera but "safe" for WinRT
			// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
			if ( el.querySelectorAll("[msallowcapture^='']").length ) {
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
			}

			// Support: IE8
			// Boolean attributes and "value" are not treated correctly
			if ( !el.querySelectorAll("[selected]").length ) {
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
			}

			// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
			if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
				rbuggyQSA.push("~=");
			}

			// Webkit/Opera - :checked should return selected option elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			// IE8 throws error here and will not see later tests
			if ( !el.querySelectorAll(":checked").length ) {
				rbuggyQSA.push(":checked");
			}

			// Support: Safari 8+, iOS 8+
			// https://bugs.webkit.org/show_bug.cgi?id=136851
			// In-page `selector#id sibling-combinator selector` fails
			if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
				rbuggyQSA.push(".#.+[+~]");
			}
		});

		assert(function( el ) {
			el.innerHTML = "<a href='' disabled='disabled'></a>" +
				"<select disabled='disabled'><option/></select>";

			// Support: Windows 8 Native Apps
			// The type and name attributes are restricted during .innerHTML assignment
			var input = document.createElement("input");
			input.setAttribute( "type", "hidden" );
			el.appendChild( input ).setAttribute( "name", "D" );

			// Support: IE8
			// Enforce case-sensitivity of name attribute
			if ( el.querySelectorAll("[name=d]").length ) {
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
			}

			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
			// IE8 throws error here and will not see later tests
			if ( el.querySelectorAll(":enabled").length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Support: IE9-11+
			// IE's :disabled selector does not pick up the children of disabled fieldsets
			docElem.appendChild( el ).disabled = true;
			if ( el.querySelectorAll(":disabled").length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Opera 10-11 does not throw on post-comma invalid pseudos
			el.querySelectorAll("*,:x");
			rbuggyQSA.push(",.*:");
		});
	}

	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
		docElem.webkitMatchesSelector ||
		docElem.mozMatchesSelector ||
		docElem.oMatchesSelector ||
		docElem.msMatchesSelector) )) ) {

		assert(function( el ) {
			// Check to see if it's possible to do matchesSelector
			// on a disconnected node (IE 9)
			support.disconnectedMatch = matches.call( el, "*" );

			// This should fail with an exception
			// Gecko does not error, returns false instead
			matches.call( el, "[s!='']:x" );
			rbuggyMatches.push( "!=", pseudos );
		});
	}

	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );

	/* Contains
	---------------------------------------------------------------------- */
	hasCompare = rnative.test( docElem.compareDocumentPosition );

	// Element contains another
	// Purposefully self-exclusive
	// As in, an element does not contain itself
	contains = hasCompare || rnative.test( docElem.contains ) ?
		function( a, b ) {
			var adown = a.nodeType === 9 ? a.documentElement : a,
				bup = b && b.parentNode;
			return a === bup || !!( bup && bup.nodeType === 1 && (
				adown.contains ?
					adown.contains( bup ) :
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
			));
		} :
		function( a, b ) {
			if ( b ) {
				while ( (b = b.parentNode) ) {
					if ( b === a ) {
						return true;
					}
				}
			}
			return false;
		};

	/* Sorting
	---------------------------------------------------------------------- */

	// Document order sorting
	sortOrder = hasCompare ?
	function( a, b ) {

		// Flag for duplicate removal
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		// Sort on method existence if only one input has compareDocumentPosition
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
		if ( compare ) {
			return compare;
		}

		// Calculate position if both inputs belong to the same document
		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
			a.compareDocumentPosition( b ) :

			// Otherwise we know they are disconnected
			1;

		// Disconnected nodes
		if ( compare & 1 ||
			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {

			// Choose the first element that is related to our preferred document
			if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
				return -1;
			}
			if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
				return 1;
			}

			// Maintain original order
			return sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;
		}

		return compare & 4 ? -1 : 1;
	} :
	function( a, b ) {
		// Exit early if the nodes are identical
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		var cur,
			i = 0,
			aup = a.parentNode,
			bup = b.parentNode,
			ap = [ a ],
			bp = [ b ];

		// Parentless nodes are either documents or disconnected
		if ( !aup || !bup ) {
			return a === document ? -1 :
				b === document ? 1 :
				aup ? -1 :
				bup ? 1 :
				sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;

		// If the nodes are siblings, we can do a quick check
		} else if ( aup === bup ) {
			return siblingCheck( a, b );
		}

		// Otherwise we need full lists of their ancestors for comparison
		cur = a;
		while ( (cur = cur.parentNode) ) {
			ap.unshift( cur );
		}
		cur = b;
		while ( (cur = cur.parentNode) ) {
			bp.unshift( cur );
		}

		// Walk down the tree looking for a discrepancy
		while ( ap[i] === bp[i] ) {
			i++;
		}

		return i ?
			// Do a sibling check if the nodes have a common ancestor
			siblingCheck( ap[i], bp[i] ) :

			// Otherwise nodes in our document sort first
			ap[i] === preferredDoc ? -1 :
			bp[i] === preferredDoc ? 1 :
			0;
	};

	return document;
};

Sizzle.matches = function( expr, elements ) {
	return Sizzle( expr, null, null, elements );
};

Sizzle.matchesSelector = function( elem, expr ) {
	// Set document vars if needed
	if ( ( elem.ownerDocument || elem ) !== document ) {
		setDocument( elem );
	}

	// Make sure that attribute selectors are quoted
	expr = expr.replace( rattributeQuotes, "='$1']" );

	if ( support.matchesSelector && documentIsHTML &&
		!compilerCache[ expr + " " ] &&
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {

		try {
			var ret = matches.call( elem, expr );

			// IE 9's matchesSelector returns false on disconnected nodes
			if ( ret || support.disconnectedMatch ||
					// As well, disconnected nodes are said to be in a document
					// fragment in IE 9
					elem.document && elem.document.nodeType !== 11 ) {
				return ret;
			}
		} catch (e) {}
	}

	return Sizzle( expr, document, null, [ elem ] ).length > 0;
};

Sizzle.contains = function( context, elem ) {
	// Set document vars if needed
	if ( ( context.ownerDocument || context ) !== document ) {
		setDocument( context );
	}
	return contains( context, elem );
};

Sizzle.attr = function( elem, name ) {
	// Set document vars if needed
	if ( ( elem.ownerDocument || elem ) !== document ) {
		setDocument( elem );
	}

	var fn = Expr.attrHandle[ name.toLowerCase() ],
		// Don't get fooled by Object.prototype properties (jQuery #13807)
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
			fn( elem, name, !documentIsHTML ) :
			undefined;

	return val !== undefined ?
		val :
		support.attributes || !documentIsHTML ?
			elem.getAttribute( name ) :
			(val = elem.getAttributeNode(name)) && val.specified ?
				val.value :
				null;
};

Sizzle.escape = function( sel ) {
	return (sel + "").replace( rcssescape, fcssescape );
};

Sizzle.error = function( msg ) {
	throw new Error( "Syntax error, unrecognized expression: " + msg );
};

/**
 * Document sorting and removing duplicates
 * @param {ArrayLike} results
 */
Sizzle.uniqueSort = function( results ) {
	var elem,
		duplicates = [],
		j = 0,
		i = 0;

	// Unless we *know* we can detect duplicates, assume their presence
	hasDuplicate = !support.detectDuplicates;
	sortInput = !support.sortStable && results.slice( 0 );
	results.sort( sortOrder );

	if ( hasDuplicate ) {
		while ( (elem = results[i++]) ) {
			if ( elem === results[ i ] ) {
				j = duplicates.push( i );
			}
		}
		while ( j-- ) {
			results.splice( duplicates[ j ], 1 );
		}
	}

	// Clear input after sorting to release objects
	// See https://github.com/jquery/sizzle/pull/225
	sortInput = null;

	return results;
};

/**
 * Utility function for retrieving the text value of an array of DOM nodes
 * @param {Array|Element} elem
 */
getText = Sizzle.getText = function( elem ) {
	var node,
		ret = "",
		i = 0,
		nodeType = elem.nodeType;

	if ( !nodeType ) {
		// If no nodeType, this is expected to be an array
		while ( (node = elem[i++]) ) {
			// Do not traverse comment nodes
			ret += getText( node );
		}
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
		// Use textContent for elements
		// innerText usage removed for consistency of new lines (jQuery #11153)
		if ( typeof elem.textContent === "string" ) {
			return elem.textContent;
		} else {
			// Traverse its children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				ret += getText( elem );
			}
		}
	} else if ( nodeType === 3 || nodeType === 4 ) {
		return elem.nodeValue;
	}
	// Do not include comment or processing instruction nodes

	return ret;
};

Expr = Sizzle.selectors = {

	// Can be adjusted by the user
	cacheLength: 50,

	createPseudo: markFunction,

	match: matchExpr,

	attrHandle: {},

	find: {},

	relative: {
		">": { dir: "parentNode", first: true },
		" ": { dir: "parentNode" },
		"+": { dir: "previousSibling", first: true },
		"~": { dir: "previousSibling" }
	},

	preFilter: {
		"ATTR": function( match ) {
			match[1] = match[1].replace( runescape, funescape );

			// Move the given value to match[3] whether quoted or unquoted
			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );

			if ( match[2] === "~=" ) {
				match[3] = " " + match[3] + " ";
			}

			return match.slice( 0, 4 );
		},

		"CHILD": function( match ) {
			/* matches from matchExpr["CHILD"]
				1 type (only|nth|...)
				2 what (child|of-type)
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
				4 xn-component of xn+y argument ([+-]?\d*n|)
				5 sign of xn-component
				6 x of xn-component
				7 sign of y-component
				8 y of y-component
			*/
			match[1] = match[1].toLowerCase();

			if ( match[1].slice( 0, 3 ) === "nth" ) {
				// nth-* requires argument
				if ( !match[3] ) {
					Sizzle.error( match[0] );
				}

				// numeric x and y parameters for Expr.filter.CHILD
				// remember that false/true cast respectively to 0/1
				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );

			// other types prohibit arguments
			} else if ( match[3] ) {
				Sizzle.error( match[0] );
			}

			return match;
		},

		"PSEUDO": function( match ) {
			var excess,
				unquoted = !match[6] && match[2];

			if ( matchExpr["CHILD"].test( match[0] ) ) {
				return null;
			}

			// Accept quoted arguments as-is
			if ( match[3] ) {
				match[2] = match[4] || match[5] || "";

			// Strip excess characters from unquoted arguments
			} else if ( unquoted && rpseudo.test( unquoted ) &&
				// Get excess from tokenize (recursively)
				(excess = tokenize( unquoted, true )) &&
				// advance to the next closing parenthesis
				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {

				// excess is a negative index
				match[0] = match[0].slice( 0, excess );
				match[2] = unquoted.slice( 0, excess );
			}

			// Return only captures needed by the pseudo filter method (type and argument)
			return match.slice( 0, 3 );
		}
	},

	filter: {

		"TAG": function( nodeNameSelector ) {
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
			return nodeNameSelector === "*" ?
				function() { return true; } :
				function( elem ) {
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
				};
		},

		"CLASS": function( className ) {
			var pattern = classCache[ className + " " ];

			return pattern ||
				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
				classCache( className, function( elem ) {
					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
				});
		},

		"ATTR": function( name, operator, check ) {
			return function( elem ) {
				var result = Sizzle.attr( elem, name );

				if ( result == null ) {
					return operator === "!=";
				}
				if ( !operator ) {
					return true;
				}

				result += "";

				return operator === "=" ? result === check :
					operator === "!=" ? result !== check :
					operator === "^=" ? check && result.indexOf( check ) === 0 :
					operator === "*=" ? check && result.indexOf( check ) > -1 :
					operator === "$=" ? check && result.slice( -check.length ) === check :
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
					false;
			};
		},

		"CHILD": function( type, what, argument, first, last ) {
			var simple = type.slice( 0, 3 ) !== "nth",
				forward = type.slice( -4 ) !== "last",
				ofType = what === "of-type";

			return first === 1 && last === 0 ?

				// Shortcut for :nth-*(n)
				function( elem ) {
					return !!elem.parentNode;
				} :

				function( elem, context, xml ) {
					var cache, uniqueCache, outerCache, node, nodeIndex, start,
						dir = simple !== forward ? "nextSibling" : "previousSibling",
						parent = elem.parentNode,
						name = ofType && elem.nodeName.toLowerCase(),
						useCache = !xml && !ofType,
						diff = false;

					if ( parent ) {

						// :(first|last|only)-(child|of-type)
						if ( simple ) {
							while ( dir ) {
								node = elem;
								while ( (node = node[ dir ]) ) {
									if ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) {

										return false;
									}
								}
								// Reverse direction for :only-* (if we haven't yet done so)
								start = dir = type === "only" && !start && "nextSibling";
							}
							return true;
						}

						start = [ forward ? parent.firstChild : parent.lastChild ];

						// non-xml :nth-child(...) stores cache data on `parent`
						if ( forward && useCache ) {

							// Seek `elem` from a previously-cached index

							// ...in a gzip-friendly way
							node = parent;
							outerCache = node[ expando ] || (node[ expando ] = {});

							// Support: IE <9 only
							// Defend against cloned attroperties (jQuery gh-1709)
							uniqueCache = outerCache[ node.uniqueID ] ||
								(outerCache[ node.uniqueID ] = {});

							cache = uniqueCache[ type ] || [];
							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
							diff = nodeIndex && cache[ 2 ];
							node = nodeIndex && parent.childNodes[ nodeIndex ];

							while ( (node = ++nodeIndex && node && node[ dir ] ||

								// Fallback to seeking `elem` from the start
								(diff = nodeIndex = 0) || start.pop()) ) {

								// When found, cache indexes on `parent` and break
								if ( node.nodeType === 1 && ++diff && node === elem ) {
									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
									break;
								}
							}

						} else {
							// Use previously-cached element index if available
							if ( useCache ) {
								// ...in a gzip-friendly way
								node = elem;
								outerCache = node[ expando ] || (node[ expando ] = {});

								// Support: IE <9 only
								// Defend against cloned attroperties (jQuery gh-1709)
								uniqueCache = outerCache[ node.uniqueID ] ||
									(outerCache[ node.uniqueID ] = {});

								cache = uniqueCache[ type ] || [];
								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
								diff = nodeIndex;
							}

							// xml :nth-child(...)
							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
							if ( diff === false ) {
								// Use the same loop as above to seek `elem` from the start
								while ( (node = ++nodeIndex && node && node[ dir ] ||
									(diff = nodeIndex = 0) || start.pop()) ) {

									if ( ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) &&
										++diff ) {

										// Cache the index of each encountered element
										if ( useCache ) {
											outerCache = node[ expando ] || (node[ expando ] = {});

											// Support: IE <9 only
											// Defend against cloned attroperties (jQuery gh-1709)
											uniqueCache = outerCache[ node.uniqueID ] ||
												(outerCache[ node.uniqueID ] = {});

											uniqueCache[ type ] = [ dirruns, diff ];
										}

										if ( node === elem ) {
											break;
										}
									}
								}
							}
						}

						// Incorporate the offset, then check against cycle size
						diff -= last;
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
					}
				};
		},

		"PSEUDO": function( pseudo, argument ) {
			// pseudo-class names are case-insensitive
			// http://www.w3.org/TR/selectors/#pseudo-classes
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
			// Remember that setFilters inherits from pseudos
			var args,
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
					Sizzle.error( "unsupported pseudo: " + pseudo );

			// The user may use createPseudo to indicate that
			// arguments are needed to create the filter function
			// just as Sizzle does
			if ( fn[ expando ] ) {
				return fn( argument );
			}

			// But maintain support for old signatures
			if ( fn.length > 1 ) {
				args = [ pseudo, pseudo, "", argument ];
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
					markFunction(function( seed, matches ) {
						var idx,
							matched = fn( seed, argument ),
							i = matched.length;
						while ( i-- ) {
							idx = indexOf( seed, matched[i] );
							seed[ idx ] = !( matches[ idx ] = matched[i] );
						}
					}) :
					function( elem ) {
						return fn( elem, 0, args );
					};
			}

			return fn;
		}
	},

	pseudos: {
		// Potentially complex pseudos
		"not": markFunction(function( selector ) {
			// Trim the selector passed to compile
			// to avoid treating leading and trailing
			// spaces as combinators
			var input = [],
				results = [],
				matcher = compile( selector.replace( rtrim, "$1" ) );

			return matcher[ expando ] ?
				markFunction(function( seed, matches, context, xml ) {
					var elem,
						unmatched = matcher( seed, null, xml, [] ),
						i = seed.length;

					// Match elements unmatched by `matcher`
					while ( i-- ) {
						if ( (elem = unmatched[i]) ) {
							seed[i] = !(matches[i] = elem);
						}
					}
				}) :
				function( elem, context, xml ) {
					input[0] = elem;
					matcher( input, null, xml, results );
					// Don't keep the element (issue #299)
					input[0] = null;
					return !results.pop();
				};
		}),

		"has": markFunction(function( selector ) {
			return function( elem ) {
				return Sizzle( selector, elem ).length > 0;
			};
		}),

		"contains": markFunction(function( text ) {
			text = text.replace( runescape, funescape );
			return function( elem ) {
				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
			};
		}),

		// "Whether an element is represented by a :lang() selector
		// is based solely on the element's language value
		// being equal to the identifier C,
		// or beginning with the identifier C immediately followed by "-".
		// The matching of C against the element's language value is performed case-insensitively.
		// The identifier C does not have to be a valid language name."
		// http://www.w3.org/TR/selectors/#lang-pseudo
		"lang": markFunction( function( lang ) {
			// lang value must be a valid identifier
			if ( !ridentifier.test(lang || "") ) {
				Sizzle.error( "unsupported lang: " + lang );
			}
			lang = lang.replace( runescape, funescape ).toLowerCase();
			return function( elem ) {
				var elemLang;
				do {
					if ( (elemLang = documentIsHTML ?
						elem.lang :
						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {

						elemLang = elemLang.toLowerCase();
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
					}
				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
				return false;
			};
		}),

		// Miscellaneous
		"target": function( elem ) {
			var hash = window.location && window.location.hash;
			return hash && hash.slice( 1 ) === elem.id;
		},

		"root": function( elem ) {
			return elem === docElem;
		},

		"focus": function( elem ) {
			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
		},

		// Boolean properties
		"enabled": createDisabledPseudo( false ),
		"disabled": createDisabledPseudo( true ),

		"checked": function( elem ) {
			// In CSS3, :checked should return both checked and selected elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			var nodeName = elem.nodeName.toLowerCase();
			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
		},

		"selected": function( elem ) {
			// Accessing this property makes selected-by-default
			// options in Safari work properly
			if ( elem.parentNode ) {
				elem.parentNode.selectedIndex;
			}

			return elem.selected === true;
		},

		// Contents
		"empty": function( elem ) {
			// http://www.w3.org/TR/selectors/#empty-pseudo
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
			//   but not by others (comment: 8; processing instruction: 7; etc.)
			// nodeType < 6 works because attributes (2) do not appear as children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				if ( elem.nodeType < 6 ) {
					return false;
				}
			}
			return true;
		},

		"parent": function( elem ) {
			return !Expr.pseudos["empty"]( elem );
		},

		// Element/input types
		"header": function( elem ) {
			return rheader.test( elem.nodeName );
		},

		"input": function( elem ) {
			return rinputs.test( elem.nodeName );
		},

		"button": function( elem ) {
			var name = elem.nodeName.toLowerCase();
			return name === "input" && elem.type === "button" || name === "button";
		},

		"text": function( elem ) {
			var attr;
			return elem.nodeName.toLowerCase() === "input" &&
				elem.type === "text" &&

				// Support: IE<8
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
		},

		// Position-in-collection
		"first": createPositionalPseudo(function() {
			return [ 0 ];
		}),

		"last": createPositionalPseudo(function( matchIndexes, length ) {
			return [ length - 1 ];
		}),

		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
			return [ argument < 0 ? argument + length : argument ];
		}),

		"even": createPositionalPseudo(function( matchIndexes, length ) {
			var i = 0;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"odd": createPositionalPseudo(function( matchIndexes, length ) {
			var i = 1;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
			var i = argument < 0 ? argument + length : argument;
			for ( ; --i >= 0; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
			var i = argument < 0 ? argument + length : argument;
			for ( ; ++i < length; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		})
	}
};

Expr.pseudos["nth"] = Expr.pseudos["eq"];

// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
	Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
	Expr.pseudos[ i ] = createButtonPseudo( i );
}

// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();

tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
	var matched, match, tokens, type,
		soFar, groups, preFilters,
		cached = tokenCache[ selector + " " ];

	if ( cached ) {
		return parseOnly ? 0 : cached.slice( 0 );
	}

	soFar = selector;
	groups = [];
	preFilters = Expr.preFilter;

	while ( soFar ) {

		// Comma and first run
		if ( !matched || (match = rcomma.exec( soFar )) ) {
			if ( match ) {
				// Don't consume trailing commas as valid
				soFar = soFar.slice( match[0].length ) || soFar;
			}
			groups.push( (tokens = []) );
		}

		matched = false;

		// Combinators
		if ( (match = rcombinators.exec( soFar )) ) {
			matched = match.shift();
			tokens.push({
				value: matched,
				// Cast descendant combinators to space
				type: match[0].replace( rtrim, " " )
			});
			soFar = soFar.slice( matched.length );
		}

		// Filters
		for ( type in Expr.filter ) {
			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
				(match = preFilters[ type ]( match ))) ) {
				matched = match.shift();
				tokens.push({
					value: matched,
					type: type,
					matches: match
				});
				soFar = soFar.slice( matched.length );
			}
		}

		if ( !matched ) {
			break;
		}
	}

	// Return the length of the invalid excess
	// if we're just parsing
	// Otherwise, throw an error or return tokens
	return parseOnly ?
		soFar.length :
		soFar ?
			Sizzle.error( selector ) :
			// Cache the tokens
			tokenCache( selector, groups ).slice( 0 );
};

function toSelector( tokens ) {
	var i = 0,
		len = tokens.length,
		selector = "";
	for ( ; i < len; i++ ) {
		selector += tokens[i].value;
	}
	return selector;
}

function addCombinator( matcher, combinator, base ) {
	var dir = combinator.dir,
		skip = combinator.next,
		key = skip || dir,
		checkNonElements = base && key === "parentNode",
		doneName = done++;

	return combinator.first ?
		// Check against closest ancestor/preceding element
		function( elem, context, xml ) {
			while ( (elem = elem[ dir ]) ) {
				if ( elem.nodeType === 1 || checkNonElements ) {
					return matcher( elem, context, xml );
				}
			}
			return false;
		} :

		// Check against all ancestor/preceding elements
		function( elem, context, xml ) {
			var oldCache, uniqueCache, outerCache,
				newCache = [ dirruns, doneName ];

			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
			if ( xml ) {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						if ( matcher( elem, context, xml ) ) {
							return true;
						}
					}
				}
			} else {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						outerCache = elem[ expando ] || (elem[ expando ] = {});

						// Support: IE <9 only
						// Defend against cloned attroperties (jQuery gh-1709)
						uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});

						if ( skip && skip === elem.nodeName.toLowerCase() ) {
							elem = elem[ dir ] || elem;
						} else if ( (oldCache = uniqueCache[ key ]) &&
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {

							// Assign to newCache so results back-propagate to previous elements
							return (newCache[ 2 ] = oldCache[ 2 ]);
						} else {
							// Reuse newcache so results back-propagate to previous elements
							uniqueCache[ key ] = newCache;

							// A match means we're done; a fail means we have to keep checking
							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
								return true;
							}
						}
					}
				}
			}
			return false;
		};
}

function elementMatcher( matchers ) {
	return matchers.length > 1 ?
		function( elem, context, xml ) {
			var i = matchers.length;
			while ( i-- ) {
				if ( !matchers[i]( elem, context, xml ) ) {
					return false;
				}
			}
			return true;
		} :
		matchers[0];
}

function multipleContexts( selector, contexts, results ) {
	var i = 0,
		len = contexts.length;
	for ( ; i < len; i++ ) {
		Sizzle( selector, contexts[i], results );
	}
	return results;
}

function condense( unmatched, map, filter, context, xml ) {
	var elem,
		newUnmatched = [],
		i = 0,
		len = unmatched.length,
		mapped = map != null;

	for ( ; i < len; i++ ) {
		if ( (elem = unmatched[i]) ) {
			if ( !filter || filter( elem, context, xml ) ) {
				newUnmatched.push( elem );
				if ( mapped ) {
					map.push( i );
				}
			}
		}
	}

	return newUnmatched;
}

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
	if ( postFilter && !postFilter[ expando ] ) {
		postFilter = setMatcher( postFilter );
	}
	if ( postFinder && !postFinder[ expando ] ) {
		postFinder = setMatcher( postFinder, postSelector );
	}
	return markFunction(function( seed, results, context, xml ) {
		var temp, i, elem,
			preMap = [],
			postMap = [],
			preexisting = results.length,

			// Get initial elements from seed or context
			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),

			// Prefilter to get matcher input, preserving a map for seed-results synchronization
			matcherIn = preFilter && ( seed || !selector ) ?
				condense( elems, preMap, preFilter, context, xml ) :
				elems,

			matcherOut = matcher ?
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?

					// ...intermediate processing is necessary
					[] :

					// ...otherwise use results directly
					results :
				matcherIn;

		// Find primary matches
		if ( matcher ) {
			matcher( matcherIn, matcherOut, context, xml );
		}

		// Apply postFilter
		if ( postFilter ) {
			temp = condense( matcherOut, postMap );
			postFilter( temp, [], context, xml );

			// Un-match failing elements by moving them back to matcherIn
			i = temp.length;
			while ( i-- ) {
				if ( (elem = temp[i]) ) {
					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
				}
			}
		}

		if ( seed ) {
			if ( postFinder || preFilter ) {
				if ( postFinder ) {
					// Get the final matcherOut by condensing this intermediate into postFinder contexts
					temp = [];
					i = matcherOut.length;
					while ( i-- ) {
						if ( (elem = matcherOut[i]) ) {
							// Restore matcherIn since elem is not yet a final match
							temp.push( (matcherIn[i] = elem) );
						}
					}
					postFinder( null, (matcherOut = []), temp, xml );
				}

				// Move matched elements from seed to results to keep them synchronized
				i = matcherOut.length;
				while ( i-- ) {
					if ( (elem = matcherOut[i]) &&
						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {

						seed[temp] = !(results[temp] = elem);
					}
				}
			}

		// Add elements to results, through postFinder if defined
		} else {
			matcherOut = condense(
				matcherOut === results ?
					matcherOut.splice( preexisting, matcherOut.length ) :
					matcherOut
			);
			if ( postFinder ) {
				postFinder( null, results, matcherOut, xml );
			} else {
				push.apply( results, matcherOut );
			}
		}
	});
}

function matcherFromTokens( tokens ) {
	var checkContext, matcher, j,
		len = tokens.length,
		leadingRelative = Expr.relative[ tokens[0].type ],
		implicitRelative = leadingRelative || Expr.relative[" "],
		i = leadingRelative ? 1 : 0,

		// The foundational matcher ensures that elements are reachable from top-level context(s)
		matchContext = addCombinator( function( elem ) {
			return elem === checkContext;
		}, implicitRelative, true ),
		matchAnyContext = addCombinator( function( elem ) {
			return indexOf( checkContext, elem ) > -1;
		}, implicitRelative, true ),
		matchers = [ function( elem, context, xml ) {
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
				(checkContext = context).nodeType ?
					matchContext( elem, context, xml ) :
					matchAnyContext( elem, context, xml ) );
			// Avoid hanging onto element (issue #299)
			checkContext = null;
			return ret;
		} ];

	for ( ; i < len; i++ ) {
		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
		} else {
			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );

			// Return special upon seeing a positional matcher
			if ( matcher[ expando ] ) {
				// Find the next relative operator (if any) for proper handling
				j = ++i;
				for ( ; j < len; j++ ) {
					if ( Expr.relative[ tokens[j].type ] ) {
						break;
					}
				}
				return setMatcher(
					i > 1 && elementMatcher( matchers ),
					i > 1 && toSelector(
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
					).replace( rtrim, "$1" ),
					matcher,
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
					j < len && toSelector( tokens )
				);
			}
			matchers.push( matcher );
		}
	}

	return elementMatcher( matchers );
}

function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
	var bySet = setMatchers.length > 0,
		byElement = elementMatchers.length > 0,
		superMatcher = function( seed, context, xml, results, outermost ) {
			var elem, j, matcher,
				matchedCount = 0,
				i = "0",
				unmatched = seed && [],
				setMatched = [],
				contextBackup = outermostContext,
				// We must always have either seed elements or outermost context
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
				// Use integer dirruns iff this is the outermost matcher
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
				len = elems.length;

			if ( outermost ) {
				outermostContext = context === document || context || outermost;
			}

			// Add elements passing elementMatchers directly to results
			// Support: IE<9, Safari
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
				if ( byElement && elem ) {
					j = 0;
					if ( !context && elem.ownerDocument !== document ) {
						setDocument( elem );
						xml = !documentIsHTML;
					}
					while ( (matcher = elementMatchers[j++]) ) {
						if ( matcher( elem, context || document, xml) ) {
							results.push( elem );
							break;
						}
					}
					if ( outermost ) {
						dirruns = dirrunsUnique;
					}
				}

				// Track unmatched elements for set filters
				if ( bySet ) {
					// They will have gone through all possible matchers
					if ( (elem = !matcher && elem) ) {
						matchedCount--;
					}

					// Lengthen the array for every element, matched or not
					if ( seed ) {
						unmatched.push( elem );
					}
				}
			}

			// `i` is now the count of elements visited above, and adding it to `matchedCount`
			// makes the latter nonnegative.
			matchedCount += i;

			// Apply set filters to unmatched elements
			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
			// no element matchers and no seed.
			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
			// numerically zero.
			if ( bySet && i !== matchedCount ) {
				j = 0;
				while ( (matcher = setMatchers[j++]) ) {
					matcher( unmatched, setMatched, context, xml );
				}

				if ( seed ) {
					// Reintegrate element matches to eliminate the need for sorting
					if ( matchedCount > 0 ) {
						while ( i-- ) {
							if ( !(unmatched[i] || setMatched[i]) ) {
								setMatched[i] = pop.call( results );
							}
						}
					}

					// Discard index placeholder values to get only actual matches
					setMatched = condense( setMatched );
				}

				// Add matches to results
				push.apply( results, setMatched );

				// Seedless set matches succeeding multiple successful matchers stipulate sorting
				if ( outermost && !seed && setMatched.length > 0 &&
					( matchedCount + setMatchers.length ) > 1 ) {

					Sizzle.uniqueSort( results );
				}
			}

			// Override manipulation of globals by nested matchers
			if ( outermost ) {
				dirruns = dirrunsUnique;
				outermostContext = contextBackup;
			}

			return unmatched;
		};

	return bySet ?
		markFunction( superMatcher ) :
		superMatcher;
}

compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
	var i,
		setMatchers = [],
		elementMatchers = [],
		cached = compilerCache[ selector + " " ];

	if ( !cached ) {
		// Generate a function of recursive functions that can be used to check each element
		if ( !match ) {
			match = tokenize( selector );
		}
		i = match.length;
		while ( i-- ) {
			cached = matcherFromTokens( match[i] );
			if ( cached[ expando ] ) {
				setMatchers.push( cached );
			} else {
				elementMatchers.push( cached );
			}
		}

		// Cache the compiled function
		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );

		// Save selector and tokenization
		cached.selector = selector;
	}
	return cached;
};

/**
 * A low-level selection function that works with Sizzle's compiled
 *  selector functions
 * @param {String|Function} selector A selector or a pre-compiled
 *  selector function built with Sizzle.compile
 * @param {Element} context
 * @param {Array} [results]
 * @param {Array} [seed] A set of elements to match against
 */
select = Sizzle.select = function( selector, context, results, seed ) {
	var i, tokens, token, type, find,
		compiled = typeof selector === "function" && selector,
		match = !seed && tokenize( (selector = compiled.selector || selector) );

	results = results || [];

	// Try to minimize operations if there is only one selector in the list and no seed
	// (the latter of which guarantees us context)
	if ( match.length === 1 ) {

		// Reduce context if the leading compound selector is an ID
		tokens = match[0] = match[0].slice( 0 );
		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
				context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {

			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
			if ( !context ) {
				return results;

			// Precompiled matchers will still verify ancestry, so step up a level
			} else if ( compiled ) {
				context = context.parentNode;
			}

			selector = selector.slice( tokens.shift().value.length );
		}

		// Fetch a seed set for right-to-left matching
		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
		while ( i-- ) {
			token = tokens[i];

			// Abort if we hit a combinator
			if ( Expr.relative[ (type = token.type) ] ) {
				break;
			}
			if ( (find = Expr.find[ type ]) ) {
				// Search, expanding context for leading sibling combinators
				if ( (seed = find(
					token.matches[0].replace( runescape, funescape ),
					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
				)) ) {

					// If seed is empty or no tokens remain, we can return early
					tokens.splice( i, 1 );
					selector = seed.length && toSelector( tokens );
					if ( !selector ) {
						push.apply( results, seed );
						return results;
					}

					break;
				}
			}
		}
	}

	// Compile and execute a filtering function if one is not provided
	// Provide `match` to avoid retokenization if we modified the selector above
	( compiled || compile( selector, match ) )(
		seed,
		context,
		!documentIsHTML,
		results,
		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
	);
	return results;
};

// One-time assignments

// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;

// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;

// Initialize against the default document
setDocument();

// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( el ) {
	// Should return 1, but returns 4 (following)
	return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
});

// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( el ) {
	el.innerHTML = "<a href='#'></a>";
	return el.firstChild.getAttribute("href") === "#" ;
}) ) {
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
		if ( !isXML ) {
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
		}
	});
}

// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( el ) {
	el.innerHTML = "<input/>";
	el.firstChild.setAttribute( "value", "" );
	return el.firstChild.getAttribute( "value" ) === "";
}) ) {
	addHandle( "value", function( elem, name, isXML ) {
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
			return elem.defaultValue;
		}
	});
}

// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( el ) {
	return el.getAttribute("disabled") == null;
}) ) {
	addHandle( booleans, function( elem, name, isXML ) {
		var val;
		if ( !isXML ) {
			return elem[ name ] === true ? name.toLowerCase() :
					(val = elem.getAttributeNode( name )) && val.specified ?
					val.value :
				null;
		}
	});
}

return Sizzle;

})( window );



jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;

// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;




var dir = function( elem, dir, until ) {
	var matched = [],
		truncate = until !== undefined;

	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
		if ( elem.nodeType === 1 ) {
			if ( truncate && jQuery( elem ).is( until ) ) {
				break;
			}
			matched.push( elem );
		}
	}
	return matched;
};


var siblings = function( n, elem ) {
	var matched = [];

	for ( ; n; n = n.nextSibling ) {
		if ( n.nodeType === 1 && n !== elem ) {
			matched.push( n );
		}
	}

	return matched;
};


var rneedsContext = jQuery.expr.match.needsContext;



function nodeName( elem, name ) {

  return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();

};
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );



// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
	if ( isFunction( qualifier ) ) {
		return jQuery.grep( elements, function( elem, i ) {
			return !!qualifier.call( elem, i, elem ) !== not;
		} );
	}

	// Single element
	if ( qualifier.nodeType ) {
		return jQuery.grep( elements, function( elem ) {
			return ( elem === qualifier ) !== not;
		} );
	}

	// Arraylike of elements (jQuery, arguments, Array)
	if ( typeof qualifier !== "string" ) {
		return jQuery.grep( elements, function( elem ) {
			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
		} );
	}

	// Filtered directly for both simple and complex selectors
	return jQuery.filter( qualifier, elements, not );
}

jQuery.filter = function( expr, elems, not ) {
	var elem = elems[ 0 ];

	if ( not ) {
		expr = ":not(" + expr + ")";
	}

	if ( elems.length === 1 && elem.nodeType === 1 ) {
		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
	}

	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
		return elem.nodeType === 1;
	} ) );
};

jQuery.fn.extend( {
	find: function( selector ) {
		var i, ret,
			len = this.length,
			self = this;

		if ( typeof selector !== "string" ) {
			return this.pushStack( jQuery( selector ).filter( function() {
				for ( i = 0; i < len; i++ ) {
					if ( jQuery.contains( self[ i ], this ) ) {
						return true;
					}
				}
			} ) );
		}

		ret = this.pushStack( [] );

		for ( i = 0; i < len; i++ ) {
			jQuery.find( selector, self[ i ], ret );
		}

		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
	},
	filter: function( selector ) {
		return this.pushStack( winnow( this, selector || [], false ) );
	},
	not: function( selector ) {
		return this.pushStack( winnow( this, selector || [], true ) );
	},
	is: function( selector ) {
		return !!winnow(
			this,

			// If this is a positional/relative selector, check membership in the returned set
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
			typeof selector === "string" && rneedsContext.test( selector ) ?
				jQuery( selector ) :
				selector || [],
			false
		).length;
	}
} );


// Initialize a jQuery object


// A central reference to the root jQuery(document)
var rootjQuery,

	// A simple way to check for HTML strings
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
	// Strict HTML recognition (#11290: must start with <)
	// Shortcut simple #id case for speed
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,

	init = jQuery.fn.init = function( selector, context, root ) {
		var match, elem;

		// HANDLE: $(""), $(null), $(undefined), $(false)
		if ( !selector ) {
			return this;
		}

		// Method init() accepts an alternate rootjQuery
		// so migrate can support jQuery.sub (gh-2101)
		root = root || rootjQuery;

		// Handle HTML strings
		if ( typeof selector === "string" ) {
			if ( selector[ 0 ] === "<" &&
				selector[ selector.length - 1 ] === ">" &&
				selector.length >= 3 ) {

				// Assume that strings that start and end with <> are HTML and skip the regex check
				match = [ null, selector, null ];

			} else {
				match = rquickExpr.exec( selector );
			}

			// Match html or make sure no context is specified for #id
			if ( match && ( match[ 1 ] || !context ) ) {

				// HANDLE: $(html) -> $(array)
				if ( match[ 1 ] ) {
					context = context instanceof jQuery ? context[ 0 ] : context;

					// Option to run scripts is true for back-compat
					// Intentionally let the error be thrown if parseHTML is not present
					jQuery.merge( this, jQuery.parseHTML(
						match[ 1 ],
						context && context.nodeType ? context.ownerDocument || context : document,
						true
					) );

					// HANDLE: $(html, props)
					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
						for ( match in context ) {

							// Properties of context are called as methods if possible
							if ( isFunction( this[ match ] ) ) {
								this[ match ]( context[ match ] );

							// ...and otherwise set as attributes
							} else {
								this.attr( match, context[ match ] );
							}
						}
					}

					return this;

				// HANDLE: $(#id)
				} else {
					elem = document.getElementById( match[ 2 ] );

					if ( elem ) {

						// Inject the element directly into the jQuery object
						this[ 0 ] = elem;
						this.length = 1;
					}
					return this;
				}

			// HANDLE: $(expr, $(...))
			} else if ( !context || context.jquery ) {
				return ( context || root ).find( selector );

			// HANDLE: $(expr, context)
			// (which is just equivalent to: $(context).find(expr)
			} else {
				return this.constructor( context ).find( selector );
			}

		// HANDLE: $(DOMElement)
		} else if ( selector.nodeType ) {
			this[ 0 ] = selector;
			this.length = 1;
			return this;

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( isFunction( selector ) ) {
			return root.ready !== undefined ?
				root.ready( selector ) :

				// Execute immediately if ready is not present
				selector( jQuery );
		}

		return jQuery.makeArray( selector, this );
	};

// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;

// Initialize central reference
rootjQuery = jQuery( document );


var rparentsprev = /^(?:parents|prev(?:Until|All))/,

	// Methods guaranteed to produce a unique set when starting from a unique set
	guaranteedUnique = {
		children: true,
		contents: true,
		next: true,
		prev: true
	};

jQuery.fn.extend( {
	has: function( target ) {
		var targets = jQuery( target, this ),
			l = targets.length;

		return this.filter( function() {
			var i = 0;
			for ( ; i < l; i++ ) {
				if ( jQuery.contains( this, targets[ i ] ) ) {
					return true;
				}
			}
		} );
	},

	closest: function( selectors, context ) {
		var cur,
			i = 0,
			l = this.length,
			matched = [],
			targets = typeof selectors !== "string" && jQuery( selectors );

		// Positional selectors never match, since there's no _selection_ context
		if ( !rneedsContext.test( selectors ) ) {
			for ( ; i < l; i++ ) {
				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {

					// Always skip document fragments
					if ( cur.nodeType < 11 && ( targets ?
						targets.index( cur ) > -1 :

						// Don't pass non-elements to Sizzle
						cur.nodeType === 1 &&
							jQuery.find.matchesSelector( cur, selectors ) ) ) {

						matched.push( cur );
						break;
					}
				}
			}
		}

		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
	},

	// Determine the position of an element within the set
	index: function( elem ) {

		// No argument, return index in parent
		if ( !elem ) {
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
		}

		// Index in selector
		if ( typeof elem === "string" ) {
			return indexOf.call( jQuery( elem ), this[ 0 ] );
		}

		// Locate the position of the desired element
		return indexOf.call( this,

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[ 0 ] : elem
		);
	},

	add: function( selector, context ) {
		return this.pushStack(
			jQuery.uniqueSort(
				jQuery.merge( this.get(), jQuery( selector, context ) )
			)
		);
	},

	addBack: function( selector ) {
		return this.add( selector == null ?
			this.prevObject : this.prevObject.filter( selector )
		);
	}
} );

function sibling( cur, dir ) {
	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
	return cur;
}

jQuery.each( {
	parent: function( elem ) {
		var parent = elem.parentNode;
		return parent && parent.nodeType !== 11 ? parent : null;
	},
	parents: function( elem ) {
		return dir( elem, "parentNode" );
	},
	parentsUntil: function( elem, i, until ) {
		return dir( elem, "parentNode", until );
	},
	next: function( elem ) {
		return sibling( elem, "nextSibling" );
	},
	prev: function( elem ) {
		return sibling( elem, "previousSibling" );
	},
	nextAll: function( elem ) {
		return dir( elem, "nextSibling" );
	},
	prevAll: function( elem ) {
		return dir( elem, "previousSibling" );
	},
	nextUntil: function( elem, i, until ) {
		return dir( elem, "nextSibling", until );
	},
	prevUntil: function( elem, i, until ) {
		return dir( elem, "previousSibling", until );
	},
	siblings: function( elem ) {
		return siblings( ( elem.parentNode || {} ).firstChild, elem );
	},
	children: function( elem ) {
		return siblings( elem.firstChild );
	},
	contents: function( elem ) {
        if ( nodeName( elem, "iframe" ) ) {
            return elem.contentDocument;
        }

        // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
        // Treat the template element as a regular one in browsers that
        // don't support it.
        if ( nodeName( elem, "template" ) ) {
            elem = elem.content || elem;
        }

        return jQuery.merge( [], elem.childNodes );
	}
}, function( name, fn ) {
	jQuery.fn[ name ] = function( until, selector ) {
		var matched = jQuery.map( this, fn, until );

		if ( name.slice( -5 ) !== "Until" ) {
			selector = until;
		}

		if ( selector && typeof selector === "string" ) {
			matched = jQuery.filter( selector, matched );
		}

		if ( this.length > 1 ) {

			// Remove duplicates
			if ( !guaranteedUnique[ name ] ) {
				jQuery.uniqueSort( matched );
			}

			// Reverse order for parents* and prev-derivatives
			if ( rparentsprev.test( name ) ) {
				matched.reverse();
			}
		}

		return this.pushStack( matched );
	};
} );
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );



// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
	var object = {};
	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
		object[ flag ] = true;
	} );
	return object;
}

/*
 * Create a callback list using the following parameters:
 *
 *	options: an optional list of space-separated options that will change how
 *			the callback list behaves or a more traditional option object
 *
 * By default a callback list will act like an event callback list and can be
 * "fired" multiple times.
 *
 * Possible options:
 *
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
 *
 *	memory:			will keep track of previous values and will call any callback added
 *					after the list has been fired right away with the latest "memorized"
 *					values (like a Deferred)
 *
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
 *
 *	stopOnFalse:	interrupt callings when a callback returns false
 *
 */
jQuery.Callbacks = function( options ) {

	// Convert options from String-formatted to Object-formatted if needed
	// (we check in cache first)
	options = typeof options === "string" ?
		createOptions( options ) :
		jQuery.extend( {}, options );

	var // Flag to know if list is currently firing
		firing,

		// Last fire value for non-forgettable lists
		memory,

		// Flag to know if list was already fired
		fired,

		// Flag to prevent firing
		locked,

		// Actual callback list
		list = [],

		// Queue of execution data for repeatable lists
		queue = [],

		// Index of currently firing callback (modified by add/remove as needed)
		firingIndex = -1,

		// Fire callbacks
		fire = function() {

			// Enforce single-firing
			locked = locked || options.once;

			// Execute callbacks for all pending executions,
			// respecting firingIndex overrides and runtime changes
			fired = firing = true;
			for ( ; queue.length; firingIndex = -1 ) {
				memory = queue.shift();
				while ( ++firingIndex < list.length ) {

					// Run callback and check for early termination
					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
						options.stopOnFalse ) {

						// Jump to end and forget the data so .add doesn't re-fire
						firingIndex = list.length;
						memory = false;
					}
				}
			}

			// Forget the data if we're done with it
			if ( !options.memory ) {
				memory = false;
			}

			firing = false;

			// Clean up if we're done firing for good
			if ( locked ) {

				// Keep an empty list if we have data for future add calls
				if ( memory ) {
					list = [];

				// Otherwise, this object is spent
				} else {
					list = "";
				}
			}
		},

		// Actual Callbacks object
		self = {

			// Add a callback or a collection of callbacks to the list
			add: function() {
				if ( list ) {

					// If we have memory from a past run, we should fire after adding
					if ( memory && !firing ) {
						firingIndex = list.length - 1;
						queue.push( memory );
					}

					( function add( args ) {
						jQuery.each( args, function( _, arg ) {
							if ( isFunction( arg ) ) {
								if ( !options.unique || !self.has( arg ) ) {
									list.push( arg );
								}
							} else if ( arg && arg.length && toType( arg ) !== "string" ) {

								// Inspect recursively
								add( arg );
							}
						} );
					} )( arguments );

					if ( memory && !firing ) {
						fire();
					}
				}
				return this;
			},

			// Remove a callback from the list
			remove: function() {
				jQuery.each( arguments, function( _, arg ) {
					var index;
					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
						list.splice( index, 1 );

						// Handle firing indexes
						if ( index <= firingIndex ) {
							firingIndex--;
						}
					}
				} );
				return this;
			},

			// Check if a given callback is in the list.
			// If no argument is given, return whether or not list has callbacks attached.
			has: function( fn ) {
				return fn ?
					jQuery.inArray( fn, list ) > -1 :
					list.length > 0;
			},

			// Remove all callbacks from the list
			empty: function() {
				if ( list ) {
					list = [];
				}
				return this;
			},

			// Disable .fire and .add
			// Abort any current/pending executions
			// Clear all callbacks and values
			disable: function() {
				locked = queue = [];
				list = memory = "";
				return this;
			},
			disabled: function() {
				return !list;
			},

			// Disable .fire
			// Also disable .add unless we have memory (since it would have no effect)
			// Abort any pending executions
			lock: function() {
				locked = queue = [];
				if ( !memory && !firing ) {
					list = memory = "";
				}
				return this;
			},
			locked: function() {
				return !!locked;
			},

			// Call all callbacks with the given context and arguments
			fireWith: function( context, args ) {
				if ( !locked ) {
					args = args || [];
					args = [ context, args.slice ? args.slice() : args ];
					queue.push( args );
					if ( !firing ) {
						fire();
					}
				}
				return this;
			},

			// Call all the callbacks with the given arguments
			fire: function() {
				self.fireWith( this, arguments );
				return this;
			},

			// To know if the callbacks have already been called at least once
			fired: function() {
				return !!fired;
			}
		};

	return self;
};


function Identity( v ) {
	return v;
}
function Thrower( ex ) {
	throw ex;
}

function adoptValue( value, resolve, reject, noValue ) {
	var method;

	try {

		// Check for promise aspect first to privilege synchronous behavior
		if ( value && isFunction( ( method = value.promise ) ) ) {
			method.call( value ).done( resolve ).fail( reject );

		// Other thenables
		} else if ( value && isFunction( ( method = value.then ) ) ) {
			method.call( value, resolve, reject );

		// Other non-thenables
		} else {

			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
			// * false: [ value ].slice( 0 ) => resolve( value )
			// * true: [ value ].slice( 1 ) => resolve()
			resolve.apply( undefined, [ value ].slice( noValue ) );
		}

	// For Promises/A+, convert exceptions into rejections
	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
	// Deferred#then to conditionally suppress rejection.
	} catch ( value ) {

		// Support: Android 4.0 only
		// Strict mode functions invoked without .call/.apply get global-object context
		reject.apply( undefined, [ value ] );
	}
}

jQuery.extend( {

	Deferred: function( func ) {
		var tuples = [

				// action, add listener, callbacks,
				// ... .then handlers, argument index, [final state]
				[ "notify", "progress", jQuery.Callbacks( "memory" ),
					jQuery.Callbacks( "memory" ), 2 ],
				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
			],
			state = "pending",
			promise = {
				state: function() {
					return state;
				},
				always: function() {
					deferred.done( arguments ).fail( arguments );
					return this;
				},
				"catch": function( fn ) {
					return promise.then( null, fn );
				},

				// Keep pipe for back-compat
				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
					var fns = arguments;

					return jQuery.Deferred( function( newDefer ) {
						jQuery.each( tuples, function( i, tuple ) {

							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];

							// deferred.progress(function() { bind to newDefer or newDefer.notify })
							// deferred.done(function() { bind to newDefer or newDefer.resolve })
							// deferred.fail(function() { bind to newDefer or newDefer.reject })
							deferred[ tuple[ 1 ] ]( function() {
								var returned = fn && fn.apply( this, arguments );
								if ( returned && isFunction( returned.promise ) ) {
									returned.promise()
										.progress( newDefer.notify )
										.done( newDefer.resolve )
										.fail( newDefer.reject );
								} else {
									newDefer[ tuple[ 0 ] + "With" ](
										this,
										fn ? [ returned ] : arguments
									);
								}
							} );
						} );
						fns = null;
					} ).promise();
				},
				then: function( onFulfilled, onRejected, onProgress ) {
					var maxDepth = 0;
					function resolve( depth, deferred, handler, special ) {
						return function() {
							var that = this,
								args = arguments,
								mightThrow = function() {
									var returned, then;

									// Support: Promises/A+ section 2.3.3.3.3
									// https://promisesaplus.com/#point-59
									// Ignore double-resolution attempts
									if ( depth < maxDepth ) {
										return;
									}

									returned = handler.apply( that, args );

									// Support: Promises/A+ section 2.3.1
									// https://promisesaplus.com/#point-48
									if ( returned === deferred.promise() ) {
										throw new TypeError( "Thenable self-resolution" );
									}

									// Support: Promises/A+ sections 2.3.3.1, 3.5
									// https://promisesaplus.com/#point-54
									// https://promisesaplus.com/#point-75
									// Retrieve `then` only once
									then = returned &&

										// Support: Promises/A+ section 2.3.4
										// https://promisesaplus.com/#point-64
										// Only check objects and functions for thenability
										( typeof returned === "object" ||
											typeof returned === "function" ) &&
										returned.then;

									// Handle a returned thenable
									if ( isFunction( then ) ) {

										// Special processors (notify) just wait for resolution
										if ( special ) {
											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special )
											);

										// Normal processors (resolve) also hook into progress
										} else {

											// ...and disregard older resolution values
											maxDepth++;

											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special ),
												resolve( maxDepth, deferred, Identity,
													deferred.notifyWith )
											);
										}

									// Handle all other returned values
									} else {

										// Only substitute handlers pass on context
										// and multiple values (non-spec behavior)
										if ( handler !== Identity ) {
											that = undefined;
											args = [ returned ];
										}

										// Process the value(s)
										// Default process is resolve
										( special || deferred.resolveWith )( that, args );
									}
								},

								// Only normal processors (resolve) catch and reject exceptions
								process = special ?
									mightThrow :
									function() {
										try {
											mightThrow();
										} catch ( e ) {

											if ( jQuery.Deferred.exceptionHook ) {
												jQuery.Deferred.exceptionHook( e,
													process.stackTrace );
											}

											// Support: Promises/A+ section 2.3.3.3.4.1
											// https://promisesaplus.com/#point-61
											// Ignore post-resolution exceptions
											if ( depth + 1 >= maxDepth ) {

												// Only substitute handlers pass on context
												// and multiple values (non-spec behavior)
												if ( handler !== Thrower ) {
													that = undefined;
													args = [ e ];
												}

												deferred.rejectWith( that, args );
											}
										}
									};

							// Support: Promises/A+ section 2.3.3.3.1
							// https://promisesaplus.com/#point-57
							// Re-resolve promises immediately to dodge false rejection from
							// subsequent errors
							if ( depth ) {
								process();
							} else {

								// Call an optional hook to record the stack, in case of exception
								// since it's otherwise lost when execution goes async
								if ( jQuery.Deferred.getStackHook ) {
									process.stackTrace = jQuery.Deferred.getStackHook();
								}
								window.setTimeout( process );
							}
						};
					}

					return jQuery.Deferred( function( newDefer ) {

						// progress_handlers.add( ... )
						tuples[ 0 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onProgress ) ?
									onProgress :
									Identity,
								newDefer.notifyWith
							)
						);

						// fulfilled_handlers.add( ... )
						tuples[ 1 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onFulfilled ) ?
									onFulfilled :
									Identity
							)
						);

						// rejected_handlers.add( ... )
						tuples[ 2 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onRejected ) ?
									onRejected :
									Thrower
							)
						);
					} ).promise();
				},

				// Get a promise for this deferred
				// If obj is provided, the promise aspect is added to the object
				promise: function( obj ) {
					return obj != null ? jQuery.extend( obj, promise ) : promise;
				}
			},
			deferred = {};

		// Add list-specific methods
		jQuery.each( tuples, function( i, tuple ) {
			var list = tuple[ 2 ],
				stateString = tuple[ 5 ];

			// promise.progress = list.add
			// promise.done = list.add
			// promise.fail = list.add
			promise[ tuple[ 1 ] ] = list.add;

			// Handle state
			if ( stateString ) {
				list.add(
					function() {

						// state = "resolved" (i.e., fulfilled)
						// state = "rejected"
						state = stateString;
					},

					// rejected_callbacks.disable
					// fulfilled_callbacks.disable
					tuples[ 3 - i ][ 2 ].disable,

					// rejected_handlers.disable
					// fulfilled_handlers.disable
					tuples[ 3 - i ][ 3 ].disable,

					// progress_callbacks.lock
					tuples[ 0 ][ 2 ].lock,

					// progress_handlers.lock
					tuples[ 0 ][ 3 ].lock
				);
			}

			// progress_handlers.fire
			// fulfilled_handlers.fire
			// rejected_handlers.fire
			list.add( tuple[ 3 ].fire );

			// deferred.notify = function() { deferred.notifyWith(...) }
			// deferred.resolve = function() { deferred.resolveWith(...) }
			// deferred.reject = function() { deferred.rejectWith(...) }
			deferred[ tuple[ 0 ] ] = function() {
				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
				return this;
			};

			// deferred.notifyWith = list.fireWith
			// deferred.resolveWith = list.fireWith
			// deferred.rejectWith = list.fireWith
			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
		} );

		// Make the deferred a promise
		promise.promise( deferred );

		// Call given func if any
		if ( func ) {
			func.call( deferred, deferred );
		}

		// All done!
		return deferred;
	},

	// Deferred helper
	when: function( singleValue ) {
		var

			// count of uncompleted subordinates
			remaining = arguments.length,

			// count of unprocessed arguments
			i = remaining,

			// subordinate fulfillment data
			resolveContexts = Array( i ),
			resolveValues = slice.call( arguments ),

			// the master Deferred
			master = jQuery.Deferred(),

			// subordinate callback factory
			updateFunc = function( i ) {
				return function( value ) {
					resolveContexts[ i ] = this;
					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
					if ( !( --remaining ) ) {
						master.resolveWith( resolveContexts, resolveValues );
					}
				};
			};

		// Single- and empty arguments are adopted like Promise.resolve
		if ( remaining <= 1 ) {
			adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
				!remaining );

			// Use .then() to unwrap secondary thenables (cf. gh-3000)
			if ( master.state() === "pending" ||
				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {

				return master.then();
			}
		}

		// Multiple arguments are aggregated like Promise.all array elements
		while ( i-- ) {
			adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
		}

		return master.promise();
	}
} );


// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;

jQuery.Deferred.exceptionHook = function( error, stack ) {

	// Support: IE 8 - 9 only
	// Console exists when dev tools are open, which can happen at any time
	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
		window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
	}
};




jQuery.readyException = function( error ) {
	window.setTimeout( function() {
		throw error;
	} );
};




// The deferred used on DOM ready
var readyList = jQuery.Deferred();

jQuery.fn.ready = function( fn ) {

	readyList
		.then( fn )

		// Wrap jQuery.readyException in a function so that the lookup
		// happens at the time of error handling instead of callback
		// registration.
		.catch( function( error ) {
			jQuery.readyException( error );
		} );

	return this;
};

jQuery.extend( {

	// Is the DOM ready to be used? Set to true once it occurs.
	isReady: false,

	// A counter to track how many items to wait for before
	// the ready event fires. See #6781
	readyWait: 1,

	// Handle when the DOM is ready
	ready: function( wait ) {

		// Abort if there are pending holds or we're already ready
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
			return;
		}

		// Remember that the DOM is ready
		jQuery.isReady = true;

		// If a normal DOM Ready event fired, decrement, and wait if need be
		if ( wait !== true && --jQuery.readyWait > 0 ) {
			return;
		}

		// If there are functions bound, to execute
		readyList.resolveWith( document, [ jQuery ] );
	}
} );

jQuery.ready.then = readyList.then;

// The ready event handler and self cleanup method
function completed() {
	document.removeEventListener( "DOMContentLoaded", completed );
	window.removeEventListener( "load", completed );
	jQuery.ready();
}

// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {

	// Handle it asynchronously to allow scripts the opportunity to delay ready
	window.setTimeout( jQuery.ready );

} else {

	// Use the handy event callback
	document.addEventListener( "DOMContentLoaded", completed );

	// A fallback to window.onload, that will always work
	window.addEventListener( "load", completed );
}




// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
	var i = 0,
		len = elems.length,
		bulk = key == null;

	// Sets many values
	if ( toType( key ) === "object" ) {
		chainable = true;
		for ( i in key ) {
			access( elems, fn, i, key[ i ], true, emptyGet, raw );
		}

	// Sets one value
	} else if ( value !== undefined ) {
		chainable = true;

		if ( !isFunction( value ) ) {
			raw = true;
		}

		if ( bulk ) {

			// Bulk operations run against the entire set
			if ( raw ) {
				fn.call( elems, value );
				fn = null;

			// ...except when executing function values
			} else {
				bulk = fn;
				fn = function( elem, key, value ) {
					return bulk.call( jQuery( elem ), value );
				};
			}
		}

		if ( fn ) {
			for ( ; i < len; i++ ) {
				fn(
					elems[ i ], key, raw ?
					value :
					value.call( elems[ i ], i, fn( elems[ i ], key ) )
				);
			}
		}
	}

	if ( chainable ) {
		return elems;
	}

	// Gets
	if ( bulk ) {
		return fn.call( elems );
	}

	return len ? fn( elems[ 0 ], key ) : emptyGet;
};


// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
	rdashAlpha = /-([a-z])/g;

// Used by camelCase as callback to replace()
function fcamelCase( all, letter ) {
	return letter.toUpperCase();
}

// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (#9572)
function camelCase( string ) {
	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
var acceptData = function( owner ) {

	// Accepts only:
	//  - Node
	//    - Node.ELEMENT_NODE
	//    - Node.DOCUMENT_NODE
	//  - Object
	//    - Any
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};




function Data() {
	this.expando = jQuery.expando + Data.uid++;
}

Data.uid = 1;

Data.prototype = {

	cache: function( owner ) {

		// Check if the owner object already has a cache
		var value = owner[ this.expando ];

		// If not, create one
		if ( !value ) {
			value = {};

			// We can accept data for non-element nodes in modern browsers,
			// but we should not, see #8335.
			// Always return an empty object.
			if ( acceptData( owner ) ) {

				// If it is a node unlikely to be stringify-ed or looped over
				// use plain assignment
				if ( owner.nodeType ) {
					owner[ this.expando ] = value;

				// Otherwise secure it in a non-enumerable property
				// configurable must be true to allow the property to be
				// deleted when data is removed
				} else {
					Object.defineProperty( owner, this.expando, {
						value: value,
						configurable: true
					} );
				}
			}
		}

		return value;
	},
	set: function( owner, data, value ) {
		var prop,
			cache = this.cache( owner );

		// Handle: [ owner, key, value ] args
		// Always use camelCase key (gh-2257)
		if ( typeof data === "string" ) {
			cache[ camelCase( data ) ] = value;

		// Handle: [ owner, { properties } ] args
		} else {

			// Copy the properties one-by-one to the cache object
			for ( prop in data ) {
				cache[ camelCase( prop ) ] = data[ prop ];
			}
		}
		return cache;
	},
	get: function( owner, key ) {
		return key === undefined ?
			this.cache( owner ) :

			// Always use camelCase key (gh-2257)
			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
	},
	access: function( owner, key, value ) {

		// In cases where either:
		//
		//   1. No key was specified
		//   2. A string key was specified, but no value provided
		//
		// Take the "read" path and allow the get method to determine
		// which value to return, respectively either:
		//
		//   1. The entire cache object
		//   2. The data stored at the key
		//
		if ( key === undefined ||
				( ( key && typeof key === "string" ) && value === undefined ) ) {

			return this.get( owner, key );
		}

		// When the key is not a string, or both a key and value
		// are specified, set or extend (existing objects) with either:
		//
		//   1. An object of properties
		//   2. A key and value
		//
		this.set( owner, key, value );

		// Since the "set" path can have two possible entry points
		// return the expected data based on which path was taken[*]
		return value !== undefined ? value : key;
	},
	remove: function( owner, key ) {
		var i,
			cache = owner[ this.expando ];

		if ( cache === undefined ) {
			return;
		}

		if ( key !== undefined ) {

			// Support array or space separated string of keys
			if ( Array.isArray( key ) ) {

				// If key is an array of keys...
				// We always set camelCase keys, so remove that.
				key = key.map( camelCase );
			} else {
				key = camelCase( key );

				// If a key with the spaces exists, use it.
				// Otherwise, create an array by matching non-whitespace
				key = key in cache ?
					[ key ] :
					( key.match( rnothtmlwhite ) || [] );
			}

			i = key.length;

			while ( i-- ) {
				delete cache[ key[ i ] ];
			}
		}

		// Remove the expando if there's no more data
		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {

			// Support: Chrome <=35 - 45
			// Webkit & Blink performance suffers when deleting properties
			// from DOM nodes, so set to undefined instead
			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
			if ( owner.nodeType ) {
				owner[ this.expando ] = undefined;
			} else {
				delete owner[ this.expando ];
			}
		}
	},
	hasData: function( owner ) {
		var cache = owner[ this.expando ];
		return cache !== undefined && !jQuery.isEmptyObject( cache );
	}
};
var dataPriv = new Data();

var dataUser = new Data();



//	Implementation Summary
//
//	1. Enforce API surface and semantic compatibility with 1.9.x branch
//	2. Improve the module's maintainability by reducing the storage
//		paths to a single mechanism.
//	3. Use the same single mechanism to support "private" and "user" data.
//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
//	5. Avoid exposing implementation details on user objects (eg. expando properties)
//	6. Provide a clear path for implementation upgrade to WeakMap in 2014

var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
	rmultiDash = /[A-Z]/g;

function getData( data ) {
	if ( data === "true" ) {
		return true;
	}

	if ( data === "false" ) {
		return false;
	}

	if ( data === "null" ) {
		return null;
	}

	// Only convert to a number if it doesn't change the string
	if ( data === +data + "" ) {
		return +data;
	}

	if ( rbrace.test( data ) ) {
		return JSON.parse( data );
	}

	return data;
}

function dataAttr( elem, key, data ) {
	var name;

	// If nothing was found internally, try to fetch any
	// data from the HTML5 data-* attribute
	if ( data === undefined && elem.nodeType === 1 ) {
		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
		data = elem.getAttribute( name );

		if ( typeof data === "string" ) {
			try {
				data = getData( data );
			} catch ( e ) {}

			// Make sure we set the data so it isn't changed later
			dataUser.set( elem, key, data );
		} else {
			data = undefined;
		}
	}
	return data;
}

jQuery.extend( {
	hasData: function( elem ) {
		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
	},

	data: function( elem, name, data ) {
		return dataUser.access( elem, name, data );
	},

	removeData: function( elem, name ) {
		dataUser.remove( elem, name );
	},

	// TODO: Now that all calls to _data and _removeData have been replaced
	// with direct calls to dataPriv methods, these can be deprecated.
	_data: function( elem, name, data ) {
		return dataPriv.access( elem, name, data );
	},

	_removeData: function( elem, name ) {
		dataPriv.remove( elem, name );
	}
} );

jQuery.fn.extend( {
	data: function( key, value ) {
		var i, name, data,
			elem = this[ 0 ],
			attrs = elem && elem.attributes;

		// Gets all values
		if ( key === undefined ) {
			if ( this.length ) {
				data = dataUser.get( elem );

				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
					i = attrs.length;
					while ( i-- ) {

						// Support: IE 11 only
						// The attrs elements can be null (#14894)
						if ( attrs[ i ] ) {
							name = attrs[ i ].name;
							if ( name.indexOf( "data-" ) === 0 ) {
								name = camelCase( name.slice( 5 ) );
								dataAttr( elem, name, data[ name ] );
							}
						}
					}
					dataPriv.set( elem, "hasDataAttrs", true );
				}
			}

			return data;
		}

		// Sets multiple values
		if ( typeof key === "object" ) {
			return this.each( function() {
				dataUser.set( this, key );
			} );
		}

		return access( this, function( value ) {
			var data;

			// The calling jQuery object (element matches) is not empty
			// (and therefore has an element appears at this[ 0 ]) and the
			// `value` parameter was not undefined. An empty jQuery object
			// will result in `undefined` for elem = this[ 0 ] which will
			// throw an exception if an attempt to read a data cache is made.
			if ( elem && value === undefined ) {

				// Attempt to get data from the cache
				// The key will always be camelCased in Data
				data = dataUser.get( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// Attempt to "discover" the data in
				// HTML5 custom data-* attrs
				data = dataAttr( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// We tried really hard, but the data doesn't exist.
				return;
			}

			// Set the data...
			this.each( function() {

				// We always store the camelCased key
				dataUser.set( this, key, value );
			} );
		}, null, value, arguments.length > 1, null, true );
	},

	removeData: function( key ) {
		return this.each( function() {
			dataUser.remove( this, key );
		} );
	}
} );


jQuery.extend( {
	queue: function( elem, type, data ) {
		var queue;

		if ( elem ) {
			type = ( type || "fx" ) + "queue";
			queue = dataPriv.get( elem, type );

			// Speed up dequeue by getting out quickly if this is just a lookup
			if ( data ) {
				if ( !queue || Array.isArray( data ) ) {
					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
				} else {
					queue.push( data );
				}
			}
			return queue || [];
		}
	},

	dequeue: function( elem, type ) {
		type = type || "fx";

		var queue = jQuery.queue( elem, type ),
			startLength = queue.length,
			fn = queue.shift(),
			hooks = jQuery._queueHooks( elem, type ),
			next = function() {
				jQuery.dequeue( elem, type );
			};

		// If the fx queue is dequeued, always remove the progress sentinel
		if ( fn === "inprogress" ) {
			fn = queue.shift();
			startLength--;
		}

		if ( fn ) {

			// Add a progress sentinel to prevent the fx queue from being
			// automatically dequeued
			if ( type === "fx" ) {
				queue.unshift( "inprogress" );
			}

			// Clear up the last queue stop function
			delete hooks.stop;
			fn.call( elem, next, hooks );
		}

		if ( !startLength && hooks ) {
			hooks.empty.fire();
		}
	},

	// Not public - generate a queueHooks object, or return the current one
	_queueHooks: function( elem, type ) {
		var key = type + "queueHooks";
		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
			empty: jQuery.Callbacks( "once memory" ).add( function() {
				dataPriv.remove( elem, [ type + "queue", key ] );
			} )
		} );
	}
} );

jQuery.fn.extend( {
	queue: function( type, data ) {
		var setter = 2;

		if ( typeof type !== "string" ) {
			data = type;
			type = "fx";
			setter--;
		}

		if ( arguments.length < setter ) {
			return jQuery.queue( this[ 0 ], type );
		}

		return data === undefined ?
			this :
			this.each( function() {
				var queue = jQuery.queue( this, type, data );

				// Ensure a hooks for this queue
				jQuery._queueHooks( this, type );

				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
					jQuery.dequeue( this, type );
				}
			} );
	},
	dequeue: function( type ) {
		return this.each( function() {
			jQuery.dequeue( this, type );
		} );
	},
	clearQueue: function( type ) {
		return this.queue( type || "fx", [] );
	},

	// Get a promise resolved when queues of a certain type
	// are emptied (fx is the type by default)
	promise: function( type, obj ) {
		var tmp,
			count = 1,
			defer = jQuery.Deferred(),
			elements = this,
			i = this.length,
			resolve = function() {
				if ( !( --count ) ) {
					defer.resolveWith( elements, [ elements ] );
				}
			};

		if ( typeof type !== "string" ) {
			obj = type;
			type = undefined;
		}
		type = type || "fx";

		while ( i-- ) {
			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
			if ( tmp && tmp.empty ) {
				count++;
				tmp.empty.add( resolve );
			}
		}
		resolve();
		return defer.promise( obj );
	}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;

var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );


var cssExpand = [ "Top", "Right", "Bottom", "Left" ];

var isHiddenWithinTree = function( elem, el ) {

		// isHiddenWithinTree might be called from jQuery#filter function;
		// in that case, element will be second argument
		elem = el || elem;

		// Inline style trumps all
		return elem.style.display === "none" ||
			elem.style.display === "" &&

			// Otherwise, check computed style
			// Support: Firefox <=43 - 45
			// Disconnected elements can have computed display: none, so first confirm that elem is
			// in the document.
			jQuery.contains( elem.ownerDocument, elem ) &&

			jQuery.css( elem, "display" ) === "none";
	};

var swap = function( elem, options, callback, args ) {
	var ret, name,
		old = {};

	// Remember the old values, and insert the new ones
	for ( name in options ) {
		old[ name ] = elem.style[ name ];
		elem.style[ name ] = options[ name ];
	}

	ret = callback.apply( elem, args || [] );

	// Revert the old values
	for ( name in options ) {
		elem.style[ name ] = old[ name ];
	}

	return ret;
};




function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted, scale,
		maxIterations = 20,
		currentValue = tween ?
			function() {
				return tween.cur();
			} :
			function() {
				return jQuery.css( elem, prop, "" );
			},
		initial = currentValue(),
		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),

		// Starting value computation is required for potential unit mismatches
		initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

		// Support: Firefox <=54
		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
		initial = initial / 2;

		// Trust units reported by jQuery.css
		unit = unit || initialInUnit[ 3 ];

		// Iteratively approximate from a nonzero starting point
		initialInUnit = +initial || 1;

		while ( maxIterations-- ) {

			// Evaluate and update our best guess (doubling guesses that zero out).
			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
			jQuery.style( elem, prop, initialInUnit + unit );
			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
				maxIterations = 0;
			}
			initialInUnit = initialInUnit / scale;

		}

		initialInUnit = initialInUnit * 2;
		jQuery.style( elem, prop, initialInUnit + unit );

		// Make sure we update the tween properties later on
		valueParts = valueParts || [];
	}

	if ( valueParts ) {
		initialInUnit = +initialInUnit || +initial || 0;

		// Apply relative offset (+=/-=) if specified
		adjusted = valueParts[ 1 ] ?
			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
			+valueParts[ 2 ];
		if ( tween ) {
			tween.unit = unit;
			tween.start = initialInUnit;
			tween.end = adjusted;
		}
	}
	return adjusted;
}


var defaultDisplayMap = {};

function getDefaultDisplay( elem ) {
	var temp,
		doc = elem.ownerDocument,
		nodeName = elem.nodeName,
		display = defaultDisplayMap[ nodeName ];

	if ( display ) {
		return display;
	}

	temp = doc.body.appendChild( doc.createElement( nodeName ) );
	display = jQuery.css( temp, "display" );

	temp.parentNode.removeChild( temp );

	if ( display === "none" ) {
		display = "block";
	}
	defaultDisplayMap[ nodeName ] = display;

	return display;
}

function showHide( elements, show ) {
	var display, elem,
		values = [],
		index = 0,
		length = elements.length;

	// Determine new display value for elements that need to change
	for ( ; index < length; index++ ) {
		elem = elements[ index ];
		if ( !elem.style ) {
			continue;
		}

		display = elem.style.display;
		if ( show ) {

			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
			// check is required in this first loop unless we have a nonempty display value (either
			// inline or about-to-be-restored)
			if ( display === "none" ) {
				values[ index ] = dataPriv.get( elem, "display" ) || null;
				if ( !values[ index ] ) {
					elem.style.display = "";
				}
			}
			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
				values[ index ] = getDefaultDisplay( elem );
			}
		} else {
			if ( display !== "none" ) {
				values[ index ] = "none";

				// Remember what we're overwriting
				dataPriv.set( elem, "display", display );
			}
		}
	}

	// Set the display of the elements in a second loop to avoid constant reflow
	for ( index = 0; index < length; index++ ) {
		if ( values[ index ] != null ) {
			elements[ index ].style.display = values[ index ];
		}
	}

	return elements;
}

jQuery.fn.extend( {
	show: function() {
		return showHide( this, true );
	},
	hide: function() {
		return showHide( this );
	},
	toggle: function( state ) {
		if ( typeof state === "boolean" ) {
			return state ? this.show() : this.hide();
		}

		return this.each( function() {
			if ( isHiddenWithinTree( this ) ) {
				jQuery( this ).show();
			} else {
				jQuery( this ).hide();
			}
		} );
	}
} );
var rcheckableType = ( /^(?:checkbox|radio)$/i );

var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );

var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );



// We have to close these tags to support XHTML (#13200)
var wrapMap = {

	// Support: IE <=9 only
	option: [ 1, "<select multiple='multiple'>", "</select>" ],

	// XHTML parsers do not magically insert elements in the
	// same way that tag soup parsers do. So we cannot shorten
	// this by omitting <tbody> or other required elements.
	thead: [ 1, "<table>", "</table>" ],
	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],

	_default: [ 0, "", "" ]
};

// Support: IE <=9 only
wrapMap.optgroup = wrapMap.option;

wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;


function getAll( context, tag ) {

	// Support: IE <=9 - 11 only
	// Use typeof to avoid zero-argument method invocation on host objects (#15151)
	var ret;

	if ( typeof context.getElementsByTagName !== "undefined" ) {
		ret = context.getElementsByTagName( tag || "*" );

	} else if ( typeof context.querySelectorAll !== "undefined" ) {
		ret = context.querySelectorAll( tag || "*" );

	} else {
		ret = [];
	}

	if ( tag === undefined || tag && nodeName( context, tag ) ) {
		return jQuery.merge( [ context ], ret );
	}

	return ret;
}


// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
	var i = 0,
		l = elems.length;

	for ( ; i < l; i++ ) {
		dataPriv.set(
			elems[ i ],
			"globalEval",
			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
		);
	}
}


var rhtml = /<|&#?\w+;/;

function buildFragment( elems, context, scripts, selection, ignored ) {
	var elem, tmp, tag, wrap, contains, j,
		fragment = context.createDocumentFragment(),
		nodes = [],
		i = 0,
		l = elems.length;

	for ( ; i < l; i++ ) {
		elem = elems[ i ];

		if ( elem || elem === 0 ) {

			// Add nodes directly
			if ( toType( elem ) === "object" ) {

				// Support: Android <=4.0 only, PhantomJS 1 only
				// push.apply(_, arraylike) throws on ancient WebKit
				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );

			// Convert non-html into a text node
			} else if ( !rhtml.test( elem ) ) {
				nodes.push( context.createTextNode( elem ) );

			// Convert html into DOM nodes
			} else {
				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );

				// Deserialize a standard representation
				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
				wrap = wrapMap[ tag ] || wrapMap._default;
				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];

				// Descend through wrappers to the right content
				j = wrap[ 0 ];
				while ( j-- ) {
					tmp = tmp.lastChild;
				}

				// Support: Android <=4.0 only, PhantomJS 1 only
				// push.apply(_, arraylike) throws on ancient WebKit
				jQuery.merge( nodes, tmp.childNodes );

				// Remember the top-level container
				tmp = fragment.firstChild;

				// Ensure the created nodes are orphaned (#12392)
				tmp.textContent = "";
			}
		}
	}

	// Remove wrapper from fragment
	fragment.textContent = "";

	i = 0;
	while ( ( elem = nodes[ i++ ] ) ) {

		// Skip elements already in the context collection (trac-4087)
		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
			if ( ignored ) {
				ignored.push( elem );
			}
			continue;
		}

		contains = jQuery.contains( elem.ownerDocument, elem );

		// Append to fragment
		tmp = getAll( fragment.appendChild( elem ), "script" );

		// Preserve script evaluation history
		if ( contains ) {
			setGlobalEval( tmp );
		}

		// Capture executables
		if ( scripts ) {
			j = 0;
			while ( ( elem = tmp[ j++ ] ) ) {
				if ( rscriptType.test( elem.type || "" ) ) {
					scripts.push( elem );
				}
			}
		}
	}

	return fragment;
}


( function() {
	var fragment = document.createDocumentFragment(),
		div = fragment.appendChild( document.createElement( "div" ) ),
		input = document.createElement( "input" );

	// Support: Android 4.0 - 4.3 only
	// Check state lost if the name is set (#11217)
	// Support: Windows Web Apps (WWA)
	// `name` and `type` must use .setAttribute for WWA (#14901)
	input.setAttribute( "type", "radio" );
	input.setAttribute( "checked", "checked" );
	input.setAttribute( "name", "t" );

	div.appendChild( input );

	// Support: Android <=4.1 only
	// Older WebKit doesn't clone checked state correctly in fragments
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

	// Support: IE <=11 only
	// Make sure textarea (and checkbox) defaultValue is properly cloned
	div.innerHTML = "<textarea>x</textarea>";
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
} )();
var documentElement = document.documentElement;



var
	rkeyEvent = /^key/,
	rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
	rtypenamespace = /^([^.]*)(?:\.(.+)|)/;

function returnTrue() {
	return true;
}

function returnFalse() {
	return false;
}

// Support: IE <=9 only
// See #13393 for more info
function safeActiveElement() {
	try {
		return document.activeElement;
	} catch ( err ) { }
}

function on( elem, types, selector, data, fn, one ) {
	var origFn, type;

	// Types can be a map of types/handlers
	if ( typeof types === "object" ) {

		// ( types-Object, selector, data )
		if ( typeof selector !== "string" ) {

			// ( types-Object, data )
			data = data || selector;
			selector = undefined;
		}
		for ( type in types ) {
			on( elem, type, selector, data, types[ type ], one );
		}
		return elem;
	}

	if ( data == null && fn == null ) {

		// ( types, fn )
		fn = selector;
		data = selector = undefined;
	} else if ( fn == null ) {
		if ( typeof selector === "string" ) {

			// ( types, selector, fn )
			fn = data;
			data = undefined;
		} else {

			// ( types, data, fn )
			fn = data;
			data = selector;
			selector = undefined;
		}
	}
	if ( fn === false ) {
		fn = returnFalse;
	} else if ( !fn ) {
		return elem;
	}

	if ( one === 1 ) {
		origFn = fn;
		fn = function( event ) {

			// Can use an empty set, since event contains the info
			jQuery().off( event );
			return origFn.apply( this, arguments );
		};

		// Use same guid so caller can remove using origFn
		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
	}
	return elem.each( function() {
		jQuery.event.add( this, types, fn, data, selector );
	} );
}

/*
 * Helper functions for managing events -- not part of the public interface.
 * Props to Dean Edwards' addEvent library for many of the ideas.
 */
jQuery.event = {

	global: {},

	add: function( elem, types, handler, data, selector ) {

		var handleObjIn, eventHandle, tmp,
			events, t, handleObj,
			special, handlers, type, namespaces, origType,
			elemData = dataPriv.get( elem );

		// Don't attach events to noData or text/comment nodes (but allow plain objects)
		if ( !elemData ) {
			return;
		}

		// Caller can pass in an object of custom data in lieu of the handler
		if ( handler.handler ) {
			handleObjIn = handler;
			handler = handleObjIn.handler;
			selector = handleObjIn.selector;
		}

		// Ensure that invalid selectors throw exceptions at attach time
		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
		if ( selector ) {
			jQuery.find.matchesSelector( documentElement, selector );
		}

		// Make sure that the handler has a unique ID, used to find/remove it later
		if ( !handler.guid ) {
			handler.guid = jQuery.guid++;
		}

		// Init the element's event structure and main handler, if this is the first
		if ( !( events = elemData.events ) ) {
			events = elemData.events = {};
		}
		if ( !( eventHandle = elemData.handle ) ) {
			eventHandle = elemData.handle = function( e ) {

				// Discard the second event of a jQuery.event.trigger() and
				// when an event is called after a page has unloaded
				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
			};
		}

		// Handle multiple events separated by a space
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// There *must* be a type, no attaching namespace-only handlers
			if ( !type ) {
				continue;
			}

			// If event changes its type, use the special event handlers for the changed type
			special = jQuery.event.special[ type ] || {};

			// If selector defined, determine special event api type, otherwise given type
			type = ( selector ? special.delegateType : special.bindType ) || type;

			// Update special based on newly reset type
			special = jQuery.event.special[ type ] || {};

			// handleObj is passed to all event handlers
			handleObj = jQuery.extend( {
				type: type,
				origType: origType,
				data: data,
				handler: handler,
				guid: handler.guid,
				selector: selector,
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
				namespace: namespaces.join( "." )
			}, handleObjIn );

			// Init the event handler queue if we're the first
			if ( !( handlers = events[ type ] ) ) {
				handlers = events[ type ] = [];
				handlers.delegateCount = 0;

				// Only use addEventListener if the special events handler returns false
				if ( !special.setup ||
					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {

					if ( elem.addEventListener ) {
						elem.addEventListener( type, eventHandle );
					}
				}
			}

			if ( special.add ) {
				special.add.call( elem, handleObj );

				if ( !handleObj.handler.guid ) {
					handleObj.handler.guid = handler.guid;
				}
			}

			// Add to the element's handler list, delegates in front
			if ( selector ) {
				handlers.splice( handlers.delegateCount++, 0, handleObj );
			} else {
				handlers.push( handleObj );
			}

			// Keep track of which events have ever been used, for event optimization
			jQuery.event.global[ type ] = true;
		}

	},

	// Detach an event or set of events from an element
	remove: function( elem, types, handler, selector, mappedTypes ) {

		var j, origCount, tmp,
			events, t, handleObj,
			special, handlers, type, namespaces, origType,
			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );

		if ( !elemData || !( events = elemData.events ) ) {
			return;
		}

		// Once for each type.namespace in types; type may be omitted
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// Unbind all events (on this namespace, if provided) for the element
			if ( !type ) {
				for ( type in events ) {
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
				}
				continue;
			}

			special = jQuery.event.special[ type ] || {};
			type = ( selector ? special.delegateType : special.bindType ) || type;
			handlers = events[ type ] || [];
			tmp = tmp[ 2 ] &&
				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );

			// Remove matching events
			origCount = j = handlers.length;
			while ( j-- ) {
				handleObj = handlers[ j ];

				if ( ( mappedTypes || origType === handleObj.origType ) &&
					( !handler || handler.guid === handleObj.guid ) &&
					( !tmp || tmp.test( handleObj.namespace ) ) &&
					( !selector || selector === handleObj.selector ||
						selector === "**" && handleObj.selector ) ) {
					handlers.splice( j, 1 );

					if ( handleObj.selector ) {
						handlers.delegateCount--;
					}
					if ( special.remove ) {
						special.remove.call( elem, handleObj );
					}
				}
			}

			// Remove generic event handler if we removed something and no more handlers exist
			// (avoids potential for endless recursion during removal of special event handlers)
			if ( origCount && !handlers.length ) {
				if ( !special.teardown ||
					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {

					jQuery.removeEvent( elem, type, elemData.handle );
				}

				delete events[ type ];
			}
		}

		// Remove data and the expando if it's no longer used
		if ( jQuery.isEmptyObject( events ) ) {
			dataPriv.remove( elem, "handle events" );
		}
	},

	dispatch: function( nativeEvent ) {

		// Make a writable jQuery.Event from the native event object
		var event = jQuery.event.fix( nativeEvent );

		var i, j, ret, matched, handleObj, handlerQueue,
			args = new Array( arguments.length ),
			handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
			special = jQuery.event.special[ event.type ] || {};

		// Use the fix-ed jQuery.Event rather than the (read-only) native event
		args[ 0 ] = event;

		for ( i = 1; i < arguments.length; i++ ) {
			args[ i ] = arguments[ i ];
		}

		event.delegateTarget = this;

		// Call the preDispatch hook for the mapped type, and let it bail if desired
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
			return;
		}

		// Determine handlers
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );

		// Run delegates first; they may want to stop propagation beneath us
		i = 0;
		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
			event.currentTarget = matched.elem;

			j = 0;
			while ( ( handleObj = matched.handlers[ j++ ] ) &&
				!event.isImmediatePropagationStopped() ) {

				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
				// a subset or equal to those in the bound event (both can have no namespace).
				if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {

					event.handleObj = handleObj;
					event.data = handleObj.data;

					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
						handleObj.handler ).apply( matched.elem, args );

					if ( ret !== undefined ) {
						if ( ( event.result = ret ) === false ) {
							event.preventDefault();
							event.stopPropagation();
						}
					}
				}
			}
		}

		// Call the postDispatch hook for the mapped type
		if ( special.postDispatch ) {
			special.postDispatch.call( this, event );
		}

		return event.result;
	},

	handlers: function( event, handlers ) {
		var i, handleObj, sel, matchedHandlers, matchedSelectors,
			handlerQueue = [],
			delegateCount = handlers.delegateCount,
			cur = event.target;

		// Find delegate handlers
		if ( delegateCount &&

			// Support: IE <=9
			// Black-hole SVG <use> instance trees (trac-13180)
			cur.nodeType &&

			// Support: Firefox <=42
			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
			// Support: IE 11 only
			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
			!( event.type === "click" && event.button >= 1 ) ) {

			for ( ; cur !== this; cur = cur.parentNode || this ) {

				// Don't check non-elements (#13208)
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
					matchedHandlers = [];
					matchedSelectors = {};
					for ( i = 0; i < delegateCount; i++ ) {
						handleObj = handlers[ i ];

						// Don't conflict with Object.prototype properties (#13203)
						sel = handleObj.selector + " ";

						if ( matchedSelectors[ sel ] === undefined ) {
							matchedSelectors[ sel ] = handleObj.needsContext ?
								jQuery( sel, this ).index( cur ) > -1 :
								jQuery.find( sel, this, null, [ cur ] ).length;
						}
						if ( matchedSelectors[ sel ] ) {
							matchedHandlers.push( handleObj );
						}
					}
					if ( matchedHandlers.length ) {
						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
					}
				}
			}
		}

		// Add the remaining (directly-bound) handlers
		cur = this;
		if ( delegateCount < handlers.length ) {
			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
		}

		return handlerQueue;
	},

	addProp: function( name, hook ) {
		Object.defineProperty( jQuery.Event.prototype, name, {
			enumerable: true,
			configurable: true,

			get: isFunction( hook ) ?
				function() {
					if ( this.originalEvent ) {
							return hook( this.originalEvent );
					}
				} :
				function() {
					if ( this.originalEvent ) {
							return this.originalEvent[ name ];
					}
				},

			set: function( value ) {
				Object.defineProperty( this, name, {
					enumerable: true,
					configurable: true,
					writable: true,
					value: value
				} );
			}
		} );
	},

	fix: function( originalEvent ) {
		return originalEvent[ jQuery.expando ] ?
			originalEvent :
			new jQuery.Event( originalEvent );
	},

	special: {
		load: {

			// Prevent triggered image.load events from bubbling to window.load
			noBubble: true
		},
		focus: {

			// Fire native event if possible so blur/focus sequence is correct
			trigger: function() {
				if ( this !== safeActiveElement() && this.focus ) {
					this.focus();
					return false;
				}
			},
			delegateType: "focusin"
		},
		blur: {
			trigger: function() {
				if ( this === safeActiveElement() && this.blur ) {
					this.blur();
					return false;
				}
			},
			delegateType: "focusout"
		},
		click: {

			// For checkbox, fire native event so checked state will be right
			trigger: function() {
				if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
					this.click();
					return false;
				}
			},

			// For cross-browser consistency, don't fire native .click() on links
			_default: function( event ) {
				return nodeName( event.target, "a" );
			}
		},

		beforeunload: {
			postDispatch: function( event ) {

				// Support: Firefox 20+
				// Firefox doesn't alert if the returnValue field is not set.
				if ( event.result !== undefined && event.originalEvent ) {
					event.originalEvent.returnValue = event.result;
				}
			}
		}
	}
};

jQuery.removeEvent = function( elem, type, handle ) {

	// This "if" is needed for plain objects
	if ( elem.removeEventListener ) {
		elem.removeEventListener( type, handle );
	}
};

jQuery.Event = function( src, props ) {

	// Allow instantiation without the 'new' keyword
	if ( !( this instanceof jQuery.Event ) ) {
		return new jQuery.Event( src, props );
	}

	// Event object
	if ( src && src.type ) {
		this.originalEvent = src;
		this.type = src.type;

		// Events bubbling up the document may have been marked as prevented
		// by a handler lower down the tree; reflect the correct value.
		this.isDefaultPrevented = src.defaultPrevented ||
				src.defaultPrevented === undefined &&

				// Support: Android <=2.3 only
				src.returnValue === false ?
			returnTrue :
			returnFalse;

		// Create target properties
		// Support: Safari <=6 - 7 only
		// Target should not be a text node (#504, #13143)
		this.target = ( src.target && src.target.nodeType === 3 ) ?
			src.target.parentNode :
			src.target;

		this.currentTarget = src.currentTarget;
		this.relatedTarget = src.relatedTarget;

	// Event type
	} else {
		this.type = src;
	}

	// Put explicitly provided properties onto the event object
	if ( props ) {
		jQuery.extend( this, props );
	}

	// Create a timestamp if incoming event doesn't have one
	this.timeStamp = src && src.timeStamp || Date.now();

	// Mark it as fixed
	this[ jQuery.expando ] = true;
};

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
	constructor: jQuery.Event,
	isDefaultPrevented: returnFalse,
	isPropagationStopped: returnFalse,
	isImmediatePropagationStopped: returnFalse,
	isSimulated: false,

	preventDefault: function() {
		var e = this.originalEvent;

		this.isDefaultPrevented = returnTrue;

		if ( e && !this.isSimulated ) {
			e.preventDefault();
		}
	},
	stopPropagation: function() {
		var e = this.originalEvent;

		this.isPropagationStopped = returnTrue;

		if ( e && !this.isSimulated ) {
			e.stopPropagation();
		}
	},
	stopImmediatePropagation: function() {
		var e = this.originalEvent;

		this.isImmediatePropagationStopped = returnTrue;

		if ( e && !this.isSimulated ) {
			e.stopImmediatePropagation();
		}

		this.stopPropagation();
	}
};

// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each( {
	altKey: true,
	bubbles: true,
	cancelable: true,
	changedTouches: true,
	ctrlKey: true,
	detail: true,
	eventPhase: true,
	metaKey: true,
	pageX: true,
	pageY: true,
	shiftKey: true,
	view: true,
	"char": true,
	charCode: true,
	key: true,
	keyCode: true,
	button: true,
	buttons: true,
	clientX: true,
	clientY: true,
	offsetX: true,
	offsetY: true,
	pointerId: true,
	pointerType: true,
	screenX: true,
	screenY: true,
	targetTouches: true,
	toElement: true,
	touches: true,

	which: function( event ) {
		var button = event.button;

		// Add which for key events
		if ( event.which == null && rkeyEvent.test( event.type ) ) {
			return event.charCode != null ? event.charCode : event.keyCode;
		}

		// Add which for click: 1 === left; 2 === middle; 3 === right
		if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
			if ( button & 1 ) {
				return 1;
			}

			if ( button & 2 ) {
				return 3;
			}

			if ( button & 4 ) {
				return 2;
			}

			return 0;
		}

		return event.which;
	}
}, jQuery.event.addProp );

// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
	mouseenter: "mouseover",
	mouseleave: "mouseout",
	pointerenter: "pointerover",
	pointerleave: "pointerout"
}, function( orig, fix ) {
	jQuery.event.special[ orig ] = {
		delegateType: fix,
		bindType: fix,

		handle: function( event ) {
			var ret,
				target = this,
				related = event.relatedTarget,
				handleObj = event.handleObj;

			// For mouseenter/leave call the handler if related is outside the target.
			// NB: No relatedTarget if the mouse left/entered the browser window
			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
				event.type = handleObj.origType;
				ret = handleObj.handler.apply( this, arguments );
				event.type = fix;
			}
			return ret;
		}
	};
} );

jQuery.fn.extend( {

	on: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn );
	},
	one: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn, 1 );
	},
	off: function( types, selector, fn ) {
		var handleObj, type;
		if ( types && types.preventDefault && types.handleObj ) {

			// ( event )  dispatched jQuery.Event
			handleObj = types.handleObj;
			jQuery( types.delegateTarget ).off(
				handleObj.namespace ?
					handleObj.origType + "." + handleObj.namespace :
					handleObj.origType,
				handleObj.selector,
				handleObj.handler
			);
			return this;
		}
		if ( typeof types === "object" ) {

			// ( types-object [, selector] )
			for ( type in types ) {
				this.off( type, selector, types[ type ] );
			}
			return this;
		}
		if ( selector === false || typeof selector === "function" ) {

			// ( types [, fn] )
			fn = selector;
			selector = undefined;
		}
		if ( fn === false ) {
			fn = returnFalse;
		}
		return this.each( function() {
			jQuery.event.remove( this, types, fn, selector );
		} );
	}
} );


var

	/* eslint-disable max-len */

	// See https://github.com/eslint/eslint/issues/3229
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,

	/* eslint-enable */

	// Support: IE <=10 - 11, Edge 12 - 13 only
	// In IE/Edge using regex groups here causes severe slowdowns.
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
	rnoInnerhtml = /<script|<style|<link/i,

	// checked="checked" or checked
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
	if ( nodeName( elem, "table" ) &&
		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {

		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
	}

	return elem;
}

// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
	return elem;
}
function restoreScript( elem ) {
	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
		elem.type = elem.type.slice( 5 );
	} else {
		elem.removeAttribute( "type" );
	}

	return elem;
}

function cloneCopyEvent( src, dest ) {
	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;

	if ( dest.nodeType !== 1 ) {
		return;
	}

	// 1. Copy private data: events, handlers, etc.
	if ( dataPriv.hasData( src ) ) {
		pdataOld = dataPriv.access( src );
		pdataCur = dataPriv.set( dest, pdataOld );
		events = pdataOld.events;

		if ( events ) {
			delete pdataCur.handle;
			pdataCur.events = {};

			for ( type in events ) {
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
					jQuery.event.add( dest, type, events[ type ][ i ] );
				}
			}
		}
	}

	// 2. Copy user data
	if ( dataUser.hasData( src ) ) {
		udataOld = dataUser.access( src );
		udataCur = jQuery.extend( {}, udataOld );

		dataUser.set( dest, udataCur );
	}
}

// Fix IE bugs, see support tests
function fixInput( src, dest ) {
	var nodeName = dest.nodeName.toLowerCase();

	// Fails to persist the checked state of a cloned checkbox or radio button.
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
		dest.checked = src.checked;

	// Fails to return the selected option to the default selected state when cloning options
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
		dest.defaultValue = src.defaultValue;
	}
}

function domManip( collection, args, callback, ignored ) {

	// Flatten any nested arrays
	args = concat.apply( [], args );

	var fragment, first, scripts, hasScripts, node, doc,
		i = 0,
		l = collection.length,
		iNoClone = l - 1,
		value = args[ 0 ],
		valueIsFunction = isFunction( value );

	// We can't cloneNode fragments that contain checked, in WebKit
	if ( valueIsFunction ||
			( l > 1 && typeof value === "string" &&
				!support.checkClone && rchecked.test( value ) ) ) {
		return collection.each( function( index ) {
			var self = collection.eq( index );
			if ( valueIsFunction ) {
				args[ 0 ] = value.call( this, index, self.html() );
			}
			domManip( self, args, callback, ignored );
		} );
	}

	if ( l ) {
		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
		first = fragment.firstChild;

		if ( fragment.childNodes.length === 1 ) {
			fragment = first;
		}

		// Require either new content or an interest in ignored elements to invoke the callback
		if ( first || ignored ) {
			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
			hasScripts = scripts.length;

			// Use the original fragment for the last item
			// instead of the first because it can end up
			// being emptied incorrectly in certain situations (#8070).
			for ( ; i < l; i++ ) {
				node = fragment;

				if ( i !== iNoClone ) {
					node = jQuery.clone( node, true, true );

					// Keep references to cloned scripts for later restoration
					if ( hasScripts ) {

						// Support: Android <=4.0 only, PhantomJS 1 only
						// push.apply(_, arraylike) throws on ancient WebKit
						jQuery.merge( scripts, getAll( node, "script" ) );
					}
				}

				callback.call( collection[ i ], node, i );
			}

			if ( hasScripts ) {
				doc = scripts[ scripts.length - 1 ].ownerDocument;

				// Reenable scripts
				jQuery.map( scripts, restoreScript );

				// Evaluate executable scripts on first document insertion
				for ( i = 0; i < hasScripts; i++ ) {
					node = scripts[ i ];
					if ( rscriptType.test( node.type || "" ) &&
						!dataPriv.access( node, "globalEval" ) &&
						jQuery.contains( doc, node ) ) {

						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {

							// Optional AJAX dependency, but won't run scripts if not present
							if ( jQuery._evalUrl ) {
								jQuery._evalUrl( node.src );
							}
						} else {
							DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
						}
					}
				}
			}
		}
	}

	return collection;
}

function remove( elem, selector, keepData ) {
	var node,
		nodes = selector ? jQuery.filter( selector, elem ) : elem,
		i = 0;

	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
		if ( !keepData && node.nodeType === 1 ) {
			jQuery.cleanData( getAll( node ) );
		}

		if ( node.parentNode ) {
			if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
				setGlobalEval( getAll( node, "script" ) );
			}
			node.parentNode.removeChild( node );
		}
	}

	return elem;
}

jQuery.extend( {
	htmlPrefilter: function( html ) {
		return html.replace( rxhtmlTag, "<$1></$2>" );
	},

	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
		var i, l, srcElements, destElements,
			clone = elem.cloneNode( true ),
			inPage = jQuery.contains( elem.ownerDocument, elem );

		// Fix IE cloning issues
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
				!jQuery.isXMLDoc( elem ) ) {

			// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
			destElements = getAll( clone );
			srcElements = getAll( elem );

			for ( i = 0, l = srcElements.length; i < l; i++ ) {
				fixInput( srcElements[ i ], destElements[ i ] );
			}
		}

		// Copy the events from the original to the clone
		if ( dataAndEvents ) {
			if ( deepDataAndEvents ) {
				srcElements = srcElements || getAll( elem );
				destElements = destElements || getAll( clone );

				for ( i = 0, l = srcElements.length; i < l; i++ ) {
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
				}
			} else {
				cloneCopyEvent( elem, clone );
			}
		}

		// Preserve script evaluation history
		destElements = getAll( clone, "script" );
		if ( destElements.length > 0 ) {
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
		}

		// Return the cloned set
		return clone;
	},

	cleanData: function( elems ) {
		var data, elem, type,
			special = jQuery.event.special,
			i = 0;

		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
			if ( acceptData( elem ) ) {
				if ( ( data = elem[ dataPriv.expando ] ) ) {
					if ( data.events ) {
						for ( type in data.events ) {
							if ( special[ type ] ) {
								jQuery.event.remove( elem, type );

							// This is a shortcut to avoid jQuery.event.remove's overhead
							} else {
								jQuery.removeEvent( elem, type, data.handle );
							}
						}
					}

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataPriv.expando ] = undefined;
				}
				if ( elem[ dataUser.expando ] ) {

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataUser.expando ] = undefined;
				}
			}
		}
	}
} );

jQuery.fn.extend( {
	detach: function( selector ) {
		return remove( this, selector, true );
	},

	remove: function( selector ) {
		return remove( this, selector );
	},

	text: function( value ) {
		return access( this, function( value ) {
			return value === undefined ?
				jQuery.text( this ) :
				this.empty().each( function() {
					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
						this.textContent = value;
					}
				} );
		}, null, value, arguments.length );
	},

	append: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.appendChild( elem );
			}
		} );
	},

	prepend: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.insertBefore( elem, target.firstChild );
			}
		} );
	},

	before: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this );
			}
		} );
	},

	after: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this.nextSibling );
			}
		} );
	},

	empty: function() {
		var elem,
			i = 0;

		for ( ; ( elem = this[ i ] ) != null; i++ ) {
			if ( elem.nodeType === 1 ) {

				// Prevent memory leaks
				jQuery.cleanData( getAll( elem, false ) );

				// Remove any remaining nodes
				elem.textContent = "";
			}
		}

		return this;
	},

	clone: function( dataAndEvents, deepDataAndEvents ) {
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;

		return this.map( function() {
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
		} );
	},

	html: function( value ) {
		return access( this, function( value ) {
			var elem = this[ 0 ] || {},
				i = 0,
				l = this.length;

			if ( value === undefined && elem.nodeType === 1 ) {
				return elem.innerHTML;
			}

			// See if we can take a shortcut and just use innerHTML
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {

				value = jQuery.htmlPrefilter( value );

				try {
					for ( ; i < l; i++ ) {
						elem = this[ i ] || {};

						// Remove element nodes and prevent memory leaks
						if ( elem.nodeType === 1 ) {
							jQuery.cleanData( getAll( elem, false ) );
							elem.innerHTML = value;
						}
					}

					elem = 0;

				// If using innerHTML throws an exception, use the fallback method
				} catch ( e ) {}
			}

			if ( elem ) {
				this.empty().append( value );
			}
		}, null, value, arguments.length );
	},

	replaceWith: function() {
		var ignored = [];

		// Make the changes, replacing each non-ignored context element with the new content
		return domManip( this, arguments, function( elem ) {
			var parent = this.parentNode;

			if ( jQuery.inArray( this, ignored ) < 0 ) {
				jQuery.cleanData( getAll( this ) );
				if ( parent ) {
					parent.replaceChild( elem, this );
				}
			}

		// Force callback invocation
		}, ignored );
	}
} );

jQuery.each( {
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function( name, original ) {
	jQuery.fn[ name ] = function( selector ) {
		var elems,
			ret = [],
			insert = jQuery( selector ),
			last = insert.length - 1,
			i = 0;

		for ( ; i <= last; i++ ) {
			elems = i === last ? this : this.clone( true );
			jQuery( insert[ i ] )[ original ]( elems );

			// Support: Android <=4.0 only, PhantomJS 1 only
			// .get() because push.apply(_, arraylike) throws on ancient WebKit
			push.apply( ret, elems.get() );
		}

		return this.pushStack( ret );
	};
} );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );

var getStyles = function( elem ) {

		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
		// IE throws on elements created in popups
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
		var view = elem.ownerDocument.defaultView;

		if ( !view || !view.opener ) {
			view = window;
		}

		return view.getComputedStyle( elem );
	};

var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );



( function() {

	// Executing both pixelPosition & boxSizingReliable tests require only one layout
	// so they're executed at the same time to save the second computation.
	function computeStyleTests() {

		// This is a singleton, we need to execute it only once
		if ( !div ) {
			return;
		}

		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
			"margin-top:1px;padding:0;border:0";
		div.style.cssText =
			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
			"margin:auto;border:1px;padding:1px;" +
			"width:60%;top:1%";
		documentElement.appendChild( container ).appendChild( div );

		var divStyle = window.getComputedStyle( div );
		pixelPositionVal = divStyle.top !== "1%";

		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;

		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
		// Some styles come back with percentage values, even though they shouldn't
		div.style.right = "60%";
		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;

		// Support: IE 9 - 11 only
		// Detect misreporting of content dimensions for box-sizing:border-box elements
		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;

		// Support: IE 9 only
		// Detect overflow:scroll screwiness (gh-3699)
		div.style.position = "absolute";
		scrollboxSizeVal = div.offsetWidth === 36 || "absolute";

		documentElement.removeChild( container );

		// Nullify the div so it wouldn't be stored in the memory and
		// it will also be a sign that checks already performed
		div = null;
	}

	function roundPixelMeasures( measure ) {
		return Math.round( parseFloat( measure ) );
	}

	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
		reliableMarginLeftVal,
		container = document.createElement( "div" ),
		div = document.createElement( "div" );

	// Finish early in limited (non-browser) environments
	if ( !div.style ) {
		return;
	}

	// Support: IE <=9 - 11 only
	// Style of cloned element affects source element cloned (#8908)
	div.style.backgroundClip = "content-box";
	div.cloneNode( true ).style.backgroundClip = "";
	support.clearCloneStyle = div.style.backgroundClip === "content-box";

	jQuery.extend( support, {
		boxSizingReliable: function() {
			computeStyleTests();
			return boxSizingReliableVal;
		},
		pixelBoxStyles: function() {
			computeStyleTests();
			return pixelBoxStylesVal;
		},
		pixelPosition: function() {
			computeStyleTests();
			return pixelPositionVal;
		},
		reliableMarginLeft: function() {
			computeStyleTests();
			return reliableMarginLeftVal;
		},
		scrollboxSize: function() {
			computeStyleTests();
			return scrollboxSizeVal;
		}
	} );
} )();


function curCSS( elem, name, computed ) {
	var width, minWidth, maxWidth, ret,

		// Support: Firefox 51+
		// Retrieving style before computed somehow
		// fixes an issue with getting wrong values
		// on detached elements
		style = elem.style;

	computed = computed || getStyles( elem );

	// getPropertyValue is needed for:
	//   .css('filter') (IE 9 only, #12537)
	//   .css('--customProperty) (#3144)
	if ( computed ) {
		ret = computed.getPropertyValue( name ) || computed[ name ];

		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
			ret = jQuery.style( elem, name );
		}

		// A tribute to the "awesome hack by Dean Edwards"
		// Android Browser returns percentage for some values,
		// but width seems to be reliably pixels.
		// This is against the CSSOM draft spec:
		// https://drafts.csswg.org/cssom/#resolved-values
		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {

			// Remember the original values
			width = style.width;
			minWidth = style.minWidth;
			maxWidth = style.maxWidth;

			// Put in the new values to get a computed value out
			style.minWidth = style.maxWidth = style.width = ret;
			ret = computed.width;

			// Revert the changed values
			style.width = width;
			style.minWidth = minWidth;
			style.maxWidth = maxWidth;
		}
	}

	return ret !== undefined ?

		// Support: IE <=9 - 11 only
		// IE returns zIndex value as an integer.
		ret + "" :
		ret;
}


function addGetHookIf( conditionFn, hookFn ) {

	// Define the hook, we'll check on the first run if it's really needed.
	return {
		get: function() {
			if ( conditionFn() ) {

				// Hook not needed (or it's not possible to use it due
				// to missing dependency), remove it.
				delete this.get;
				return;
			}

			// Hook needed; redefine it so that the support test is not executed again.
			return ( this.get = hookFn ).apply( this, arguments );
		}
	};
}


var

	// Swappable if display is none or starts with table
	// except "table", "table-cell", or "table-caption"
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	rcustomProp = /^--/,
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	},

	cssPrefixes = [ "Webkit", "Moz", "ms" ],
	emptyStyle = document.createElement( "div" ).style;

// Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {

	// Shortcut for names that are not vendor prefixed
	if ( name in emptyStyle ) {
		return name;
	}

	// Check for vendor prefixed names
	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
		i = cssPrefixes.length;

	while ( i-- ) {
		name = cssPrefixes[ i ] + capName;
		if ( name in emptyStyle ) {
			return name;
		}
	}
}

// Return a property mapped along what jQuery.cssProps suggests or to
// a vendor prefixed property.
function finalPropName( name ) {
	var ret = jQuery.cssProps[ name ];
	if ( !ret ) {
		ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
	}
	return ret;
}

function setPositiveNumber( elem, value, subtract ) {

	// Any relative (+/-) values have already been
	// normalized at this point
	var matches = rcssNum.exec( value );
	return matches ?

		// Guard against undefined "subtract", e.g., when used as in cssHooks
		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
		value;
}

function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
	var i = dimension === "width" ? 1 : 0,
		extra = 0,
		delta = 0;

	// Adjustment may not be necessary
	if ( box === ( isBorderBox ? "border" : "content" ) ) {
		return 0;
	}

	for ( ; i < 4; i += 2 ) {

		// Both box models exclude margin
		if ( box === "margin" ) {
			delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
		}

		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
		if ( !isBorderBox ) {

			// Add padding
			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );

			// For "border" or "margin", add border
			if ( box !== "padding" ) {
				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );

			// But still keep track of it otherwise
			} else {
				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}

		// If we get here with a border-box (content + padding + border), we're seeking "content" or
		// "padding" or "margin"
		} else {

			// For "content", subtract padding
			if ( box === "content" ) {
				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
			}

			// For "content" or "padding", subtract border
			if ( box !== "margin" ) {
				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		}
	}

	// Account for positive content-box scroll gutter when requested by providing computedVal
	if ( !isBorderBox && computedVal >= 0 ) {

		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
		// Assuming integer scroll gutter, subtract the rest and round down
		delta += Math.max( 0, Math.ceil(
			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
			computedVal -
			delta -
			extra -
			0.5
		) );
	}

	return delta;
}

function getWidthOrHeight( elem, dimension, extra ) {

	// Start with computed style
	var styles = getStyles( elem ),
		val = curCSS( elem, dimension, styles ),
		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
		valueIsBorderBox = isBorderBox;

	// Support: Firefox <=54
	// Return a confounding non-pixel value or feign ignorance, as appropriate.
	if ( rnumnonpx.test( val ) ) {
		if ( !extra ) {
			return val;
		}
		val = "auto";
	}

	// Check for style in case a browser which returns unreliable values
	// for getComputedStyle silently falls back to the reliable elem.style
	valueIsBorderBox = valueIsBorderBox &&
		( support.boxSizingReliable() || val === elem.style[ dimension ] );

	// Fall back to offsetWidth/offsetHeight when value is "auto"
	// This happens for inline elements with no explicit setting (gh-3571)
	// Support: Android <=4.1 - 4.3 only
	// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
	if ( val === "auto" ||
		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {

		val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];

		// offsetWidth/offsetHeight provide border-box values
		valueIsBorderBox = true;
	}

	// Normalize "" and auto
	val = parseFloat( val ) || 0;

	// Adjust for the element's box model
	return ( val +
		boxModelAdjustment(
			elem,
			dimension,
			extra || ( isBorderBox ? "border" : "content" ),
			valueIsBorderBox,
			styles,

			// Provide the current computed size to request scroll gutter calculation (gh-3589)
			val
		)
	) + "px";
}

jQuery.extend( {

	// Add in style property hooks for overriding the default
	// behavior of getting and setting a style property
	cssHooks: {
		opacity: {
			get: function( elem, computed ) {
				if ( computed ) {

					// We should always get a number back from opacity
					var ret = curCSS( elem, "opacity" );
					return ret === "" ? "1" : ret;
				}
			}
		}
	},

	// Don't automatically add "px" to these possibly-unitless properties
	cssNumber: {
		"animationIterationCount": true,
		"columnCount": true,
		"fillOpacity": true,
		"flexGrow": true,
		"flexShrink": true,
		"fontWeight": true,
		"lineHeight": true,
		"opacity": true,
		"order": true,
		"orphans": true,
		"widows": true,
		"zIndex": true,
		"zoom": true
	},

	// Add in properties whose names you wish to fix before
	// setting or getting the value
	cssProps: {},

	// Get and set the style property on a DOM Node
	style: function( elem, name, value, extra ) {

		// Don't set styles on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
			return;
		}

		// Make sure that we're working with the right name
		var ret, type, hooks,
			origName = camelCase( name ),
			isCustomProp = rcustomProp.test( name ),
			style = elem.style;

		// Make sure that we're working with the right name. We don't
		// want to query the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( origName );
		}

		// Gets hook for the prefixed version, then unprefixed version
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// Check if we're setting a value
		if ( value !== undefined ) {
			type = typeof value;

			// Convert "+=" or "-=" to relative numbers (#7345)
			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
				value = adjustCSS( elem, name, ret );

				// Fixes bug #9237
				type = "number";
			}

			// Make sure that null and NaN values aren't set (#7116)
			if ( value == null || value !== value ) {
				return;
			}

			// If a number was passed in, add the unit (except for certain CSS properties)
			if ( type === "number" ) {
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
			}

			// background-* props affect original clone's values
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
				style[ name ] = "inherit";
			}

			// If a hook was provided, use that value, otherwise just set the specified value
			if ( !hooks || !( "set" in hooks ) ||
				( value = hooks.set( elem, value, extra ) ) !== undefined ) {

				if ( isCustomProp ) {
					style.setProperty( name, value );
				} else {
					style[ name ] = value;
				}
			}

		} else {

			// If a hook was provided get the non-computed value from there
			if ( hooks && "get" in hooks &&
				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {

				return ret;
			}

			// Otherwise just get the value from the style object
			return style[ name ];
		}
	},

	css: function( elem, name, extra, styles ) {
		var val, num, hooks,
			origName = camelCase( name ),
			isCustomProp = rcustomProp.test( name );

		// Make sure that we're working with the right name. We don't
		// want to modify the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( origName );
		}

		// Try prefixed name followed by the unprefixed name
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// If a hook was provided get the computed value from there
		if ( hooks && "get" in hooks ) {
			val = hooks.get( elem, true, extra );
		}

		// Otherwise, if a way to get the computed value exists, use that
		if ( val === undefined ) {
			val = curCSS( elem, name, styles );
		}

		// Convert "normal" to computed value
		if ( val === "normal" && name in cssNormalTransform ) {
			val = cssNormalTransform[ name ];
		}

		// Make numeric if forced or a qualifier was provided and val looks numeric
		if ( extra === "" || extra ) {
			num = parseFloat( val );
			return extra === true || isFinite( num ) ? num || 0 : val;
		}

		return val;
	}
} );

jQuery.each( [ "height", "width" ], function( i, dimension ) {
	jQuery.cssHooks[ dimension ] = {
		get: function( elem, computed, extra ) {
			if ( computed ) {

				// Certain elements can have dimension info if we invisibly show them
				// but it must have a current display style that would benefit
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&

					// Support: Safari 8+
					// Table columns in Safari have non-zero offsetWidth & zero
					// getBoundingClientRect().width unless display is changed.
					// Support: IE <=11 only
					// Running getBoundingClientRect on a disconnected node
					// in IE throws an error.
					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
						swap( elem, cssShow, function() {
							return getWidthOrHeight( elem, dimension, extra );
						} ) :
						getWidthOrHeight( elem, dimension, extra );
			}
		},

		set: function( elem, value, extra ) {
			var matches,
				styles = getStyles( elem ),
				isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
				subtract = extra && boxModelAdjustment(
					elem,
					dimension,
					extra,
					isBorderBox,
					styles
				);

			// Account for unreliable border-box dimensions by comparing offset* to computed and
			// faking a content-box to get border and padding (gh-3699)
			if ( isBorderBox && support.scrollboxSize() === styles.position ) {
				subtract -= Math.ceil(
					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
					parseFloat( styles[ dimension ] ) -
					boxModelAdjustment( elem, dimension, "border", false, styles ) -
					0.5
				);
			}

			// Convert to pixels if value adjustment is needed
			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
				( matches[ 3 ] || "px" ) !== "px" ) {

				elem.style[ dimension ] = value;
				value = jQuery.css( elem, dimension );
			}

			return setPositiveNumber( elem, value, subtract );
		}
	};
} );

jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
	function( elem, computed ) {
		if ( computed ) {
			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
				elem.getBoundingClientRect().left -
					swap( elem, { marginLeft: 0 }, function() {
						return elem.getBoundingClientRect().left;
					} )
				) + "px";
		}
	}
);

// These hooks are used by animate to expand properties
jQuery.each( {
	margin: "",
	padding: "",
	border: "Width"
}, function( prefix, suffix ) {
	jQuery.cssHooks[ prefix + suffix ] = {
		expand: function( value ) {
			var i = 0,
				expanded = {},

				// Assumes a single number if not a string
				parts = typeof value === "string" ? value.split( " " ) : [ value ];

			for ( ; i < 4; i++ ) {
				expanded[ prefix + cssExpand[ i ] + suffix ] =
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
			}

			return expanded;
		}
	};

	if ( prefix !== "margin" ) {
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
	}
} );

jQuery.fn.extend( {
	css: function( name, value ) {
		return access( this, function( elem, name, value ) {
			var styles, len,
				map = {},
				i = 0;

			if ( Array.isArray( name ) ) {
				styles = getStyles( elem );
				len = name.length;

				for ( ; i < len; i++ ) {
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
				}

				return map;
			}

			return value !== undefined ?
				jQuery.style( elem, name, value ) :
				jQuery.css( elem, name );
		}, name, value, arguments.length > 1 );
	}
} );


function Tween( elem, options, prop, end, easing ) {
	return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;

Tween.prototype = {
	constructor: Tween,
	init: function( elem, options, prop, end, easing, unit ) {
		this.elem = elem;
		this.prop = prop;
		this.easing = easing || jQuery.easing._default;
		this.options = options;
		this.start = this.now = this.cur();
		this.end = end;
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
	},
	cur: function() {
		var hooks = Tween.propHooks[ this.prop ];

		return hooks && hooks.get ?
			hooks.get( this ) :
			Tween.propHooks._default.get( this );
	},
	run: function( percent ) {
		var eased,
			hooks = Tween.propHooks[ this.prop ];

		if ( this.options.duration ) {
			this.pos = eased = jQuery.easing[ this.easing ](
				percent, this.options.duration * percent, 0, 1, this.options.duration
			);
		} else {
			this.pos = eased = percent;
		}
		this.now = ( this.end - this.start ) * eased + this.start;

		if ( this.options.step ) {
			this.options.step.call( this.elem, this.now, this );
		}

		if ( hooks && hooks.set ) {
			hooks.set( this );
		} else {
			Tween.propHooks._default.set( this );
		}
		return this;
	}
};

Tween.prototype.init.prototype = Tween.prototype;

Tween.propHooks = {
	_default: {
		get: function( tween ) {
			var result;

			// Use a property on the element directly when it is not a DOM element,
			// or when there is no matching style property that exists.
			if ( tween.elem.nodeType !== 1 ||
				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
				return tween.elem[ tween.prop ];
			}

			// Passing an empty string as a 3rd parameter to .css will automatically
			// attempt a parseFloat and fallback to a string if the parse fails.
			// Simple values such as "10px" are parsed to Float;
			// complex values such as "rotate(1rad)" are returned as-is.
			result = jQuery.css( tween.elem, tween.prop, "" );

			// Empty strings, null, undefined and "auto" are converted to 0.
			return !result || result === "auto" ? 0 : result;
		},
		set: function( tween ) {

			// Use step hook for back compat.
			// Use cssHook if its there.
			// Use .style if available and use plain properties where available.
			if ( jQuery.fx.step[ tween.prop ] ) {
				jQuery.fx.step[ tween.prop ]( tween );
			} else if ( tween.elem.nodeType === 1 &&
				( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
					jQuery.cssHooks[ tween.prop ] ) ) {
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
			} else {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	}
};

// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
	set: function( tween ) {
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
			tween.elem[ tween.prop ] = tween.now;
		}
	}
};

jQuery.easing = {
	linear: function( p ) {
		return p;
	},
	swing: function( p ) {
		return 0.5 - Math.cos( p * Math.PI ) / 2;
	},
	_default: "swing"
};

jQuery.fx = Tween.prototype.init;

// Back compat <1.8 extension point
jQuery.fx.step = {};




var
	fxNow, inProgress,
	rfxtypes = /^(?:toggle|show|hide)$/,
	rrun = /queueHooks$/;

function schedule() {
	if ( inProgress ) {
		if ( document.hidden === false && window.requestAnimationFrame ) {
			window.requestAnimationFrame( schedule );
		} else {
			window.setTimeout( schedule, jQuery.fx.interval );
		}

		jQuery.fx.tick();
	}
}

// Animations created synchronously will run synchronously
function createFxNow() {
	window.setTimeout( function() {
		fxNow = undefined;
	} );
	return ( fxNow = Date.now() );
}

// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
	var which,
		i = 0,
		attrs = { height: type };

	// If we include width, step value is 1 to do all cssExpand values,
	// otherwise step value is 2 to skip over Left and Right
	includeWidth = includeWidth ? 1 : 0;
	for ( ; i < 4; i += 2 - includeWidth ) {
		which = cssExpand[ i ];
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
	}

	if ( includeWidth ) {
		attrs.opacity = attrs.width = type;
	}

	return attrs;
}

function createTween( value, prop, animation ) {
	var tween,
		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
		index = 0,
		length = collection.length;
	for ( ; index < length; index++ ) {
		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {

			// We're done with this property
			return tween;
		}
	}
}

function defaultPrefilter( elem, props, opts ) {
	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
		isBox = "width" in props || "height" in props,
		anim = this,
		orig = {},
		style = elem.style,
		hidden = elem.nodeType && isHiddenWithinTree( elem ),
		dataShow = dataPriv.get( elem, "fxshow" );

	// Queue-skipping animations hijack the fx hooks
	if ( !opts.queue ) {
		hooks = jQuery._queueHooks( elem, "fx" );
		if ( hooks.unqueued == null ) {
			hooks.unqueued = 0;
			oldfire = hooks.empty.fire;
			hooks.empty.fire = function() {
				if ( !hooks.unqueued ) {
					oldfire();
				}
			};
		}
		hooks.unqueued++;

		anim.always( function() {

			// Ensure the complete handler is called before this completes
			anim.always( function() {
				hooks.unqueued--;
				if ( !jQuery.queue( elem, "fx" ).length ) {
					hooks.empty.fire();
				}
			} );
		} );
	}

	// Detect show/hide animations
	for ( prop in props ) {
		value = props[ prop ];
		if ( rfxtypes.test( value ) ) {
			delete props[ prop ];
			toggle = toggle || value === "toggle";
			if ( value === ( hidden ? "hide" : "show" ) ) {

				// Pretend to be hidden if this is a "show" and
				// there is still data from a stopped show/hide
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
					hidden = true;

				// Ignore all other no-op show/hide data
				} else {
					continue;
				}
			}
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
		}
	}

	// Bail out if this is a no-op like .hide().hide()
	propTween = !jQuery.isEmptyObject( props );
	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
		return;
	}

	// Restrict "overflow" and "display" styles during box animations
	if ( isBox && elem.nodeType === 1 ) {

		// Support: IE <=9 - 11, Edge 12 - 15
		// Record all 3 overflow attributes because IE does not infer the shorthand
		// from identically-valued overflowX and overflowY and Edge just mirrors
		// the overflowX value there.
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];

		// Identify a display type, preferring old show/hide data over the CSS cascade
		restoreDisplay = dataShow && dataShow.display;
		if ( restoreDisplay == null ) {
			restoreDisplay = dataPriv.get( elem, "display" );
		}
		display = jQuery.css( elem, "display" );
		if ( display === "none" ) {
			if ( restoreDisplay ) {
				display = restoreDisplay;
			} else {

				// Get nonempty value(s) by temporarily forcing visibility
				showHide( [ elem ], true );
				restoreDisplay = elem.style.display || restoreDisplay;
				display = jQuery.css( elem, "display" );
				showHide( [ elem ] );
			}
		}

		// Animate inline elements as inline-block
		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
			if ( jQuery.css( elem, "float" ) === "none" ) {

				// Restore the original display value at the end of pure show/hide animations
				if ( !propTween ) {
					anim.done( function() {
						style.display = restoreDisplay;
					} );
					if ( restoreDisplay == null ) {
						display = style.display;
						restoreDisplay = display === "none" ? "" : display;
					}
				}
				style.display = "inline-block";
			}
		}
	}

	if ( opts.overflow ) {
		style.overflow = "hidden";
		anim.always( function() {
			style.overflow = opts.overflow[ 0 ];
			style.overflowX = opts.overflow[ 1 ];
			style.overflowY = opts.overflow[ 2 ];
		} );
	}

	// Implement show/hide animations
	propTween = false;
	for ( prop in orig ) {

		// General show/hide setup for this element animation
		if ( !propTween ) {
			if ( dataShow ) {
				if ( "hidden" in dataShow ) {
					hidden = dataShow.hidden;
				}
			} else {
				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
			}

			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
			if ( toggle ) {
				dataShow.hidden = !hidden;
			}

			// Show elements before animating them
			if ( hidden ) {
				showHide( [ elem ], true );
			}

			/* eslint-disable no-loop-func */

			anim.done( function() {

			/* eslint-enable no-loop-func */

				// The final step of a "hide" animation is actually hiding the element
				if ( !hidden ) {
					showHide( [ elem ] );
				}
				dataPriv.remove( elem, "fxshow" );
				for ( prop in orig ) {
					jQuery.style( elem, prop, orig[ prop ] );
				}
			} );
		}

		// Per-property setup
		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
		if ( !( prop in dataShow ) ) {
			dataShow[ prop ] = propTween.start;
			if ( hidden ) {
				propTween.end = propTween.start;
				propTween.start = 0;
			}
		}
	}
}

function propFilter( props, specialEasing ) {
	var index, name, easing, value, hooks;

	// camelCase, specialEasing and expand cssHook pass
	for ( index in props ) {
		name = camelCase( index );
		easing = specialEasing[ name ];
		value = props[ index ];
		if ( Array.isArray( value ) ) {
			easing = value[ 1 ];
			value = props[ index ] = value[ 0 ];
		}

		if ( index !== name ) {
			props[ name ] = value;
			delete props[ index ];
		}

		hooks = jQuery.cssHooks[ name ];
		if ( hooks && "expand" in hooks ) {
			value = hooks.expand( value );
			delete props[ name ];

			// Not quite $.extend, this won't overwrite existing keys.
			// Reusing 'index' because we have the correct "name"
			for ( index in value ) {
				if ( !( index in props ) ) {
					props[ index ] = value[ index ];
					specialEasing[ index ] = easing;
				}
			}
		} else {
			specialEasing[ name ] = easing;
		}
	}
}

function Animation( elem, properties, options ) {
	var result,
		stopped,
		index = 0,
		length = Animation.prefilters.length,
		deferred = jQuery.Deferred().always( function() {

			// Don't match elem in the :animated selector
			delete tick.elem;
		} ),
		tick = function() {
			if ( stopped ) {
				return false;
			}
			var currentTime = fxNow || createFxNow(),
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),

				// Support: Android 2.3 only
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
				temp = remaining / animation.duration || 0,
				percent = 1 - temp,
				index = 0,
				length = animation.tweens.length;

			for ( ; index < length; index++ ) {
				animation.tweens[ index ].run( percent );
			}

			deferred.notifyWith( elem, [ animation, percent, remaining ] );

			// If there's more to do, yield
			if ( percent < 1 && length ) {
				return remaining;
			}

			// If this was an empty animation, synthesize a final progress notification
			if ( !length ) {
				deferred.notifyWith( elem, [ animation, 1, 0 ] );
			}

			// Resolve the animation and report its conclusion
			deferred.resolveWith( elem, [ animation ] );
			return false;
		},
		animation = deferred.promise( {
			elem: elem,
			props: jQuery.extend( {}, properties ),
			opts: jQuery.extend( true, {
				specialEasing: {},
				easing: jQuery.easing._default
			}, options ),
			originalProperties: properties,
			originalOptions: options,
			startTime: fxNow || createFxNow(),
			duration: options.duration,
			tweens: [],
			createTween: function( prop, end ) {
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
				animation.tweens.push( tween );
				return tween;
			},
			stop: function( gotoEnd ) {
				var index = 0,

					// If we are going to the end, we want to run all the tweens
					// otherwise we skip this part
					length = gotoEnd ? animation.tweens.length : 0;
				if ( stopped ) {
					return this;
				}
				stopped = true;
				for ( ; index < length; index++ ) {
					animation.tweens[ index ].run( 1 );
				}

				// Resolve when we played the last frame; otherwise, reject
				if ( gotoEnd ) {
					deferred.notifyWith( elem, [ animation, 1, 0 ] );
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
				} else {
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
				}
				return this;
			}
		} ),
		props = animation.props;

	propFilter( props, animation.opts.specialEasing );

	for ( ; index < length; index++ ) {
		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
		if ( result ) {
			if ( isFunction( result.stop ) ) {
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
					result.stop.bind( result );
			}
			return result;
		}
	}

	jQuery.map( props, createTween, animation );

	if ( isFunction( animation.opts.start ) ) {
		animation.opts.start.call( elem, animation );
	}

	// Attach callbacks from options
	animation
		.progress( animation.opts.progress )
		.done( animation.opts.done, animation.opts.complete )
		.fail( animation.opts.fail )
		.always( animation.opts.always );

	jQuery.fx.timer(
		jQuery.extend( tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		} )
	);

	return animation;
}

jQuery.Animation = jQuery.extend( Animation, {

	tweeners: {
		"*": [ function( prop, value ) {
			var tween = this.createTween( prop, value );
			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
			return tween;
		} ]
	},

	tweener: function( props, callback ) {
		if ( isFunction( props ) ) {
			callback = props;
			props = [ "*" ];
		} else {
			props = props.match( rnothtmlwhite );
		}

		var prop,
			index = 0,
			length = props.length;

		for ( ; index < length; index++ ) {
			prop = props[ index ];
			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
			Animation.tweeners[ prop ].unshift( callback );
		}
	},

	prefilters: [ defaultPrefilter ],

	prefilter: function( callback, prepend ) {
		if ( prepend ) {
			Animation.prefilters.unshift( callback );
		} else {
			Animation.prefilters.push( callback );
		}
	}
} );

jQuery.speed = function( speed, easing, fn ) {
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
		complete: fn || !fn && easing ||
			isFunction( speed ) && speed,
		duration: speed,
		easing: fn && easing || easing && !isFunction( easing ) && easing
	};

	// Go to the end state if fx are off
	if ( jQuery.fx.off ) {
		opt.duration = 0;

	} else {
		if ( typeof opt.duration !== "number" ) {
			if ( opt.duration in jQuery.fx.speeds ) {
				opt.duration = jQuery.fx.speeds[ opt.duration ];

			} else {
				opt.duration = jQuery.fx.speeds._default;
			}
		}
	}

	// Normalize opt.queue - true/undefined/null -> "fx"
	if ( opt.queue == null || opt.queue === true ) {
		opt.queue = "fx";
	}

	// Queueing
	opt.old = opt.complete;

	opt.complete = function() {
		if ( isFunction( opt.old ) ) {
			opt.old.call( this );
		}

		if ( opt.queue ) {
			jQuery.dequeue( this, opt.queue );
		}
	};

	return opt;
};

jQuery.fn.extend( {
	fadeTo: function( speed, to, easing, callback ) {

		// Show any hidden elements after setting opacity to 0
		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()

			// Animate to the value specified
			.end().animate( { opacity: to }, speed, easing, callback );
	},
	animate: function( prop, speed, easing, callback ) {
		var empty = jQuery.isEmptyObject( prop ),
			optall = jQuery.speed( speed, easing, callback ),
			doAnimation = function() {

				// Operate on a copy of prop so per-property easing won't be lost
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );

				// Empty animations, or finishing resolves immediately
				if ( empty || dataPriv.get( this, "finish" ) ) {
					anim.stop( true );
				}
			};
			doAnimation.finish = doAnimation;

		return empty || optall.queue === false ?
			this.each( doAnimation ) :
			this.queue( optall.queue, doAnimation );
	},
	stop: function( type, clearQueue, gotoEnd ) {
		var stopQueue = function( hooks ) {
			var stop = hooks.stop;
			delete hooks.stop;
			stop( gotoEnd );
		};

		if ( typeof type !== "string" ) {
			gotoEnd = clearQueue;
			clearQueue = type;
			type = undefined;
		}
		if ( clearQueue && type !== false ) {
			this.queue( type || "fx", [] );
		}

		return this.each( function() {
			var dequeue = true,
				index = type != null && type + "queueHooks",
				timers = jQuery.timers,
				data = dataPriv.get( this );

			if ( index ) {
				if ( data[ index ] && data[ index ].stop ) {
					stopQueue( data[ index ] );
				}
			} else {
				for ( index in data ) {
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
						stopQueue( data[ index ] );
					}
				}
			}

			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this &&
					( type == null || timers[ index ].queue === type ) ) {

					timers[ index ].anim.stop( gotoEnd );
					dequeue = false;
					timers.splice( index, 1 );
				}
			}

			// Start the next in the queue if the last step wasn't forced.
			// Timers currently will call their complete callbacks, which
			// will dequeue but only if they were gotoEnd.
			if ( dequeue || !gotoEnd ) {
				jQuery.dequeue( this, type );
			}
		} );
	},
	finish: function( type ) {
		if ( type !== false ) {
			type = type || "fx";
		}
		return this.each( function() {
			var index,
				data = dataPriv.get( this ),
				queue = data[ type + "queue" ],
				hooks = data[ type + "queueHooks" ],
				timers = jQuery.timers,
				length = queue ? queue.length : 0;

			// Enable finishing flag on private data
			data.finish = true;

			// Empty the queue first
			jQuery.queue( this, type, [] );

			if ( hooks && hooks.stop ) {
				hooks.stop.call( this, true );
			}

			// Look for any active animations, and finish them
			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
					timers[ index ].anim.stop( true );
					timers.splice( index, 1 );
				}
			}

			// Look for any animations in the old queue and finish them
			for ( index = 0; index < length; index++ ) {
				if ( queue[ index ] && queue[ index ].finish ) {
					queue[ index ].finish.call( this );
				}
			}

			// Turn off finishing flag
			delete data.finish;
		} );
	}
} );

jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
	var cssFn = jQuery.fn[ name ];
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return speed == null || typeof speed === "boolean" ?
			cssFn.apply( this, arguments ) :
			this.animate( genFx( name, true ), speed, easing, callback );
	};
} );

// Generate shortcuts for custom animations
jQuery.each( {
	slideDown: genFx( "show" ),
	slideUp: genFx( "hide" ),
	slideToggle: genFx( "toggle" ),
	fadeIn: { opacity: "show" },
	fadeOut: { opacity: "hide" },
	fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return this.animate( props, speed, easing, callback );
	};
} );

jQuery.timers = [];
jQuery.fx.tick = function() {
	var timer,
		i = 0,
		timers = jQuery.timers;

	fxNow = Date.now();

	for ( ; i < timers.length; i++ ) {
		timer = timers[ i ];

		// Run the timer and safely remove it when done (allowing for external removal)
		if ( !timer() && timers[ i ] === timer ) {
			timers.splice( i--, 1 );
		}
	}

	if ( !timers.length ) {
		jQuery.fx.stop();
	}
	fxNow = undefined;
};

jQuery.fx.timer = function( timer ) {
	jQuery.timers.push( timer );
	jQuery.fx.start();
};

jQuery.fx.interval = 13;
jQuery.fx.start = function() {
	if ( inProgress ) {
		return;
	}

	inProgress = true;
	schedule();
};

jQuery.fx.stop = function() {
	inProgress = null;
};

jQuery.fx.speeds = {
	slow: 600,
	fast: 200,

	// Default speed
	_default: 400
};


// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
	type = type || "fx";

	return this.queue( type, function( next, hooks ) {
		var timeout = window.setTimeout( next, time );
		hooks.stop = function() {
			window.clearTimeout( timeout );
		};
	} );
};


( function() {
	var input = document.createElement( "input" ),
		select = document.createElement( "select" ),
		opt = select.appendChild( document.createElement( "option" ) );

	input.type = "checkbox";

	// Support: Android <=4.3 only
	// Default value for a checkbox should be "on"
	support.checkOn = input.value !== "";

	// Support: IE <=11 only
	// Must access selectedIndex to make default options select
	support.optSelected = opt.selected;

	// Support: IE <=11 only
	// An input loses its value after becoming a radio
	input = document.createElement( "input" );
	input.value = "t";
	input.type = "radio";
	support.radioValue = input.value === "t";
} )();


var boolHook,
	attrHandle = jQuery.expr.attrHandle;

jQuery.fn.extend( {
	attr: function( name, value ) {
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
	},

	removeAttr: function( name ) {
		return this.each( function() {
			jQuery.removeAttr( this, name );
		} );
	}
} );

jQuery.extend( {
	attr: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set attributes on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		// Fallback to prop when attributes are not supported
		if ( typeof elem.getAttribute === "undefined" ) {
			return jQuery.prop( elem, name, value );
		}

		// Attribute hooks are determined by the lowercase version
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
		}

		if ( value !== undefined ) {
			if ( value === null ) {
				jQuery.removeAttr( elem, name );
				return;
			}

			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			elem.setAttribute( name, value + "" );
			return value;
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		ret = jQuery.find.attr( elem, name );

		// Non-existent attributes return null, we normalize to undefined
		return ret == null ? undefined : ret;
	},

	attrHooks: {
		type: {
			set: function( elem, value ) {
				if ( !support.radioValue && value === "radio" &&
					nodeName( elem, "input" ) ) {
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name,
			i = 0,

			// Attribute names can contain non-HTML whitespace characters
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
			attrNames = value && value.match( rnothtmlwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				elem.removeAttribute( name );
			}
		}
	}
} );

// Hooks for boolean attributes
boolHook = {
	set: function( elem, value, name ) {
		if ( value === false ) {

			// Remove boolean attributes when set to false
			jQuery.removeAttr( elem, name );
		} else {
			elem.setAttribute( name, name );
		}
		return name;
	}
};

jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
	var getter = attrHandle[ name ] || jQuery.find.attr;

	attrHandle[ name ] = function( elem, name, isXML ) {
		var ret, handle,
			lowercaseName = name.toLowerCase();

		if ( !isXML ) {

			// Avoid an infinite loop by temporarily removing this function from the getter
			handle = attrHandle[ lowercaseName ];
			attrHandle[ lowercaseName ] = ret;
			ret = getter( elem, name, isXML ) != null ?
				lowercaseName :
				null;
			attrHandle[ lowercaseName ] = handle;
		}
		return ret;
	};
} );




var rfocusable = /^(?:input|select|textarea|button)$/i,
	rclickable = /^(?:a|area)$/i;

jQuery.fn.extend( {
	prop: function( name, value ) {
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
	},

	removeProp: function( name ) {
		return this.each( function() {
			delete this[ jQuery.propFix[ name ] || name ];
		} );
	}
} );

jQuery.extend( {
	prop: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set properties on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {

			// Fix name and attach hooks
			name = jQuery.propFix[ name ] || name;
			hooks = jQuery.propHooks[ name ];
		}

		if ( value !== undefined ) {
			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			return ( elem[ name ] = value );
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		return elem[ name ];
	},

	propHooks: {
		tabIndex: {
			get: function( elem ) {

				// Support: IE <=9 - 11 only
				// elem.tabIndex doesn't always return the
				// correct value when it hasn't been explicitly set
				// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
				// Use proper attribute retrieval(#12072)
				var tabindex = jQuery.find.attr( elem, "tabindex" );

				if ( tabindex ) {
					return parseInt( tabindex, 10 );
				}

				if (
					rfocusable.test( elem.nodeName ) ||
					rclickable.test( elem.nodeName ) &&
					elem.href
				) {
					return 0;
				}

				return -1;
			}
		}
	},

	propFix: {
		"for": "htmlFor",
		"class": "className"
	}
} );

// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
	jQuery.propHooks.selected = {
		get: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent && parent.parentNode ) {
				parent.parentNode.selectedIndex;
			}
			return null;
		},
		set: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent ) {
				parent.selectedIndex;

				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
		}
	};
}

jQuery.each( [
	"tabIndex",
	"readOnly",
	"maxLength",
	"cellSpacing",
	"cellPadding",
	"rowSpan",
	"colSpan",
	"useMap",
	"frameBorder",
	"contentEditable"
], function() {
	jQuery.propFix[ this.toLowerCase() ] = this;
} );




	// Strip and collapse whitespace according to HTML spec
	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
	function stripAndCollapse( value ) {
		var tokens = value.match( rnothtmlwhite ) || [];
		return tokens.join( " " );
	}


function getClass( elem ) {
	return elem.getAttribute && elem.getAttribute( "class" ) || "";
}

function classesToArray( value ) {
	if ( Array.isArray( value ) ) {
		return value;
	}
	if ( typeof value === "string" ) {
		return value.match( rnothtmlwhite ) || [];
	}
	return [];
}

jQuery.fn.extend( {
	addClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
							cur += clazz + " ";
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( !arguments.length ) {
			return this.attr( "class", "" );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );

				// This expression is here for better compressibility (see addClass)
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {

						// Remove *all* instances
						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
							cur = cur.replace( " " + clazz + " ", " " );
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value,
			isValidValue = type === "string" || Array.isArray( value );

		if ( typeof stateVal === "boolean" && isValidValue ) {
			return stateVal ? this.addClass( value ) : this.removeClass( value );
		}

		if ( isFunction( value ) ) {
			return this.each( function( i ) {
				jQuery( this ).toggleClass(
					value.call( this, i, getClass( this ), stateVal ),
					stateVal
				);
			} );
		}

		return this.each( function() {
			var className, i, self, classNames;

			if ( isValidValue ) {

				// Toggle individual class names
				i = 0;
				self = jQuery( this );
				classNames = classesToArray( value );

				while ( ( className = classNames[ i++ ] ) ) {

					// Check each className given, space separated list
					if ( self.hasClass( className ) ) {
						self.removeClass( className );
					} else {
						self.addClass( className );
					}
				}

			// Toggle whole class name
			} else if ( value === undefined || type === "boolean" ) {
				className = getClass( this );
				if ( className ) {

					// Store className if set
					dataPriv.set( this, "__className__", className );
				}

				// If the element has a class name or if we're passed `false`,
				// then remove the whole classname (if there was one, the above saved it).
				// Otherwise bring back whatever was previously saved (if anything),
				// falling back to the empty string if nothing was stored.
				if ( this.setAttribute ) {
					this.setAttribute( "class",
						className || value === false ?
						"" :
						dataPriv.get( this, "__className__" ) || ""
					);
				}
			}
		} );
	},

	hasClass: function( selector ) {
		var className, elem,
			i = 0;

		className = " " + selector + " ";
		while ( ( elem = this[ i++ ] ) ) {
			if ( elem.nodeType === 1 &&
				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
					return true;
			}
		}

		return false;
	}
} );




var rreturn = /\r/g;

jQuery.fn.extend( {
	val: function( value ) {
		var hooks, ret, valueIsFunction,
			elem = this[ 0 ];

		if ( !arguments.length ) {
			if ( elem ) {
				hooks = jQuery.valHooks[ elem.type ] ||
					jQuery.valHooks[ elem.nodeName.toLowerCase() ];

				if ( hooks &&
					"get" in hooks &&
					( ret = hooks.get( elem, "value" ) ) !== undefined
				) {
					return ret;
				}

				ret = elem.value;

				// Handle most common string cases
				if ( typeof ret === "string" ) {
					return ret.replace( rreturn, "" );
				}

				// Handle cases where value is null/undef or number
				return ret == null ? "" : ret;
			}

			return;
		}

		valueIsFunction = isFunction( value );

		return this.each( function( i ) {
			var val;

			if ( this.nodeType !== 1 ) {
				return;
			}

			if ( valueIsFunction ) {
				val = value.call( this, i, jQuery( this ).val() );
			} else {
				val = value;
			}

			// Treat null/undefined as ""; convert numbers to string
			if ( val == null ) {
				val = "";

			} else if ( typeof val === "number" ) {
				val += "";

			} else if ( Array.isArray( val ) ) {
				val = jQuery.map( val, function( value ) {
					return value == null ? "" : value + "";
				} );
			}

			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];

			// If set returns undefined, fall back to normal setting
			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
				this.value = val;
			}
		} );
	}
} );

jQuery.extend( {
	valHooks: {
		option: {
			get: function( elem ) {

				var val = jQuery.find.attr( elem, "value" );
				return val != null ?
					val :

					// Support: IE <=10 - 11 only
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					stripAndCollapse( jQuery.text( elem ) );
			}
		},
		select: {
			get: function( elem ) {
				var value, option, i,
					options = elem.options,
					index = elem.selectedIndex,
					one = elem.type === "select-one",
					values = one ? null : [],
					max = one ? index + 1 : options.length;

				if ( index < 0 ) {
					i = max;

				} else {
					i = one ? index : 0;
				}

				// Loop through all the selected options
				for ( ; i < max; i++ ) {
					option = options[ i ];

					// Support: IE <=9 only
					// IE8-9 doesn't update selected after form reset (#2551)
					if ( ( option.selected || i === index ) &&

							// Don't return options that are disabled or in a disabled optgroup
							!option.disabled &&
							( !option.parentNode.disabled ||
								!nodeName( option.parentNode, "optgroup" ) ) ) {

						// Get the specific value for the option
						value = jQuery( option ).val();

						// We don't need an array for one selects
						if ( one ) {
							return value;
						}

						// Multi-Selects return an array
						values.push( value );
					}
				}

				return values;
			},

			set: function( elem, value ) {
				var optionSet, option,
					options = elem.options,
					values = jQuery.makeArray( value ),
					i = options.length;

				while ( i-- ) {
					option = options[ i ];

					/* eslint-disable no-cond-assign */

					if ( option.selected =
						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
					) {
						optionSet = true;
					}

					/* eslint-enable no-cond-assign */
				}

				// Force browsers to behave consistently when non-matching value is set
				if ( !optionSet ) {
					elem.selectedIndex = -1;
				}
				return values;
			}
		}
	}
} );

// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
	jQuery.valHooks[ this ] = {
		set: function( elem, value ) {
			if ( Array.isArray( value ) ) {
				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
			}
		}
	};
	if ( !support.checkOn ) {
		jQuery.valHooks[ this ].get = function( elem ) {
			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
		};
	}
} );




// Return jQuery for attributes-only inclusion


support.focusin = "onfocusin" in window;


var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
	stopPropagationCallback = function( e ) {
		e.stopPropagation();
	};

jQuery.extend( jQuery.event, {

	trigger: function( event, data, elem, onlyHandlers ) {

		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
			eventPath = [ elem || document ],
			type = hasOwn.call( event, "type" ) ? event.type : event,
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];

		cur = lastElement = tmp = elem = elem || document;

		// Don't do events on text and comment nodes
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
			return;
		}

		// focus/blur morphs to focusin/out; ensure we're not firing them right now
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
			return;
		}

		if ( type.indexOf( "." ) > -1 ) {

			// Namespaced trigger; create a regexp to match event type in handle()
			namespaces = type.split( "." );
			type = namespaces.shift();
			namespaces.sort();
		}
		ontype = type.indexOf( ":" ) < 0 && "on" + type;

		// Caller can pass in a jQuery.Event object, Object, or just an event type string
		event = event[ jQuery.expando ] ?
			event :
			new jQuery.Event( type, typeof event === "object" && event );

		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
		event.isTrigger = onlyHandlers ? 2 : 3;
		event.namespace = namespaces.join( "." );
		event.rnamespace = event.namespace ?
			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
			null;

		// Clean up the event in case it is being reused
		event.result = undefined;
		if ( !event.target ) {
			event.target = elem;
		}

		// Clone any incoming data and prepend the event, creating the handler arg list
		data = data == null ?
			[ event ] :
			jQuery.makeArray( data, [ event ] );

		// Allow special events to draw outside the lines
		special = jQuery.event.special[ type ] || {};
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
			return;
		}

		// Determine event propagation path in advance, per W3C events spec (#9951)
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {

			bubbleType = special.delegateType || type;
			if ( !rfocusMorph.test( bubbleType + type ) ) {
				cur = cur.parentNode;
			}
			for ( ; cur; cur = cur.parentNode ) {
				eventPath.push( cur );
				tmp = cur;
			}

			// Only add window if we got to document (e.g., not plain obj or detached DOM)
			if ( tmp === ( elem.ownerDocument || document ) ) {
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
			}
		}

		// Fire handlers on the event path
		i = 0;
		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
			lastElement = cur;
			event.type = i > 1 ?
				bubbleType :
				special.bindType || type;

			// jQuery handler
			handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
				dataPriv.get( cur, "handle" );
			if ( handle ) {
				handle.apply( cur, data );
			}

			// Native handler
			handle = ontype && cur[ ontype ];
			if ( handle && handle.apply && acceptData( cur ) ) {
				event.result = handle.apply( cur, data );
				if ( event.result === false ) {
					event.preventDefault();
				}
			}
		}
		event.type = type;

		// If nobody prevented the default action, do it now
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {

			if ( ( !special._default ||
				special._default.apply( eventPath.pop(), data ) === false ) &&
				acceptData( elem ) ) {

				// Call a native DOM method on the target with the same name as the event.
				// Don't do default actions on window, that's where global variables be (#6170)
				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {

					// Don't re-trigger an onFOO event when we call its FOO() method
					tmp = elem[ ontype ];

					if ( tmp ) {
						elem[ ontype ] = null;
					}

					// Prevent re-triggering of the same event, since we already bubbled it above
					jQuery.event.triggered = type;

					if ( event.isPropagationStopped() ) {
						lastElement.addEventListener( type, stopPropagationCallback );
					}

					elem[ type ]();

					if ( event.isPropagationStopped() ) {
						lastElement.removeEventListener( type, stopPropagationCallback );
					}

					jQuery.event.triggered = undefined;

					if ( tmp ) {
						elem[ ontype ] = tmp;
					}
				}
			}
		}

		return event.result;
	},

	// Piggyback on a donor event to simulate a different one
	// Used only for `focus(in | out)` events
	simulate: function( type, elem, event ) {
		var e = jQuery.extend(
			new jQuery.Event(),
			event,
			{
				type: type,
				isSimulated: true
			}
		);

		jQuery.event.trigger( e, null, elem );
	}

} );

jQuery.fn.extend( {

	trigger: function( type, data ) {
		return this.each( function() {
			jQuery.event.trigger( type, data, this );
		} );
	},
	triggerHandler: function( type, data ) {
		var elem = this[ 0 ];
		if ( elem ) {
			return jQuery.event.trigger( type, data, elem, true );
		}
	}
} );


// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {

		// Attach a single capturing handler on the document while someone wants focusin/focusout
		var handler = function( event ) {
			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
		};

		jQuery.event.special[ fix ] = {
			setup: function() {
				var doc = this.ownerDocument || this,
					attaches = dataPriv.access( doc, fix );

				if ( !attaches ) {
					doc.addEventListener( orig, handler, true );
				}
				dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
			},
			teardown: function() {
				var doc = this.ownerDocument || this,
					attaches = dataPriv.access( doc, fix ) - 1;

				if ( !attaches ) {
					doc.removeEventListener( orig, handler, true );
					dataPriv.remove( doc, fix );

				} else {
					dataPriv.access( doc, fix, attaches );
				}
			}
		};
	} );
}
var location = window.location;

var nonce = Date.now();

var rquery = ( /\?/ );



// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
	var xml;
	if ( !data || typeof data !== "string" ) {
		return null;
	}

	// Support: IE 9 - 11 only
	// IE throws on parseFromString with invalid input.
	try {
		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
	} catch ( e ) {
		xml = undefined;
	}

	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
		jQuery.error( "Invalid XML: " + data );
	}
	return xml;
};


var
	rbracket = /\[\]$/,
	rCRLF = /\r?\n/g,
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
	rsubmittable = /^(?:input|select|textarea|keygen)/i;

function buildParams( prefix, obj, traditional, add ) {
	var name;

	if ( Array.isArray( obj ) ) {

		// Serialize array item.
		jQuery.each( obj, function( i, v ) {
			if ( traditional || rbracket.test( prefix ) ) {

				// Treat each array item as a scalar.
				add( prefix, v );

			} else {

				// Item is non-scalar (array or object), encode its numeric index.
				buildParams(
					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
					v,
					traditional,
					add
				);
			}
		} );

	} else if ( !traditional && toType( obj ) === "object" ) {

		// Serialize object item.
		for ( name in obj ) {
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
		}

	} else {

		// Serialize scalar item.
		add( prefix, obj );
	}
}

// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
	var prefix,
		s = [],
		add = function( key, valueOrFunction ) {

			// If value is a function, invoke it and use its return value
			var value = isFunction( valueOrFunction ) ?
				valueOrFunction() :
				valueOrFunction;

			s[ s.length ] = encodeURIComponent( key ) + "=" +
				encodeURIComponent( value == null ? "" : value );
		};

	// If an array was passed in, assume that it is an array of form elements.
	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {

		// Serialize the form elements
		jQuery.each( a, function() {
			add( this.name, this.value );
		} );

	} else {

		// If traditional, encode the "old" way (the way 1.3.2 or older
		// did it), otherwise encode params recursively.
		for ( prefix in a ) {
			buildParams( prefix, a[ prefix ], traditional, add );
		}
	}

	// Return the resulting serialization
	return s.join( "&" );
};

jQuery.fn.extend( {
	serialize: function() {
		return jQuery.param( this.serializeArray() );
	},
	serializeArray: function() {
		return this.map( function() {

			// Can add propHook for "elements" to filter or add form elements
			var elements = jQuery.prop( this, "elements" );
			return elements ? jQuery.makeArray( elements ) : this;
		} )
		.filter( function() {
			var type = this.type;

			// Use .is( ":disabled" ) so that fieldset[disabled] works
			return this.name && !jQuery( this ).is( ":disabled" ) &&
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
				( this.checked || !rcheckableType.test( type ) );
		} )
		.map( function( i, elem ) {
			var val = jQuery( this ).val();

			if ( val == null ) {
				return null;
			}

			if ( Array.isArray( val ) ) {
				return jQuery.map( val, function( val ) {
					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
				} );
			}

			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
		} ).get();
	}
} );


var
	r20 = /%20/g,
	rhash = /#.*$/,
	rantiCache = /([?&])_=[^&]*/,
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,

	// #7653, #8125, #8152: local protocol detection
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
	rnoContent = /^(?:GET|HEAD)$/,
	rprotocol = /^\/\//,

	/* Prefilters
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
	 * 2) These are called:
	 *    - BEFORE asking for a transport
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
	 * 3) key is the dataType
	 * 4) the catchall symbol "*" can be used
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
	 */
	prefilters = {},

	/* Transports bindings
	 * 1) key is the dataType
	 * 2) the catchall symbol "*" can be used
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
	 */
	transports = {},

	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
	allTypes = "*/".concat( "*" ),

	// Anchor tag for parsing the document origin
	originAnchor = document.createElement( "a" );
	originAnchor.href = location.href;

// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {

	// dataTypeExpression is optional and defaults to "*"
	return function( dataTypeExpression, func ) {

		if ( typeof dataTypeExpression !== "string" ) {
			func = dataTypeExpression;
			dataTypeExpression = "*";
		}

		var dataType,
			i = 0,
			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];

		if ( isFunction( func ) ) {

			// For each dataType in the dataTypeExpression
			while ( ( dataType = dataTypes[ i++ ] ) ) {

				// Prepend if requested
				if ( dataType[ 0 ] === "+" ) {
					dataType = dataType.slice( 1 ) || "*";
					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );

				// Otherwise append
				} else {
					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
				}
			}
		}
	};
}

// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {

	var inspected = {},
		seekingTransport = ( structure === transports );

	function inspect( dataType ) {
		var selected;
		inspected[ dataType ] = true;
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
			if ( typeof dataTypeOrTransport === "string" &&
				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {

				options.dataTypes.unshift( dataTypeOrTransport );
				inspect( dataTypeOrTransport );
				return false;
			} else if ( seekingTransport ) {
				return !( selected = dataTypeOrTransport );
			}
		} );
		return selected;
	}

	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}

// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
	var key, deep,
		flatOptions = jQuery.ajaxSettings.flatOptions || {};

	for ( key in src ) {
		if ( src[ key ] !== undefined ) {
			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
		}
	}
	if ( deep ) {
		jQuery.extend( true, target, deep );
	}

	return target;
}

/* Handles responses to an ajax request:
 * - finds the right dataType (mediates between content-type and expected dataType)
 * - returns the corresponding response
 */
function ajaxHandleResponses( s, jqXHR, responses ) {

	var ct, type, finalDataType, firstDataType,
		contents = s.contents,
		dataTypes = s.dataTypes;

	// Remove auto dataType and get content-type in the process
	while ( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {

		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}

		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}

/* Chain conversions given the request and the original response
 * Also sets the responseXXX fields on the jqXHR instance
 */
function ajaxConvert( s, response, jqXHR, isSuccess ) {
	var conv2, current, conv, tmp, prev,
		converters = {},

		// Work with a copy of dataTypes in case we need to modify it for conversion
		dataTypes = s.dataTypes.slice();

	// Create converters map with lowercased keys
	if ( dataTypes[ 1 ] ) {
		for ( conv in s.converters ) {
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
		}
	}

	current = dataTypes.shift();

	// Convert to each sequential dataType
	while ( current ) {

		if ( s.responseFields[ current ] ) {
			jqXHR[ s.responseFields[ current ] ] = response;
		}

		// Apply the dataFilter if provided
		if ( !prev && isSuccess && s.dataFilter ) {
			response = s.dataFilter( response, s.dataType );
		}

		prev = current;
		current = dataTypes.shift();

		if ( current ) {

			// There's only work to do if current dataType is non-auto
			if ( current === "*" ) {

				current = prev;

			// Convert response if prev dataType is non-auto and differs from current
			} else if ( prev !== "*" && prev !== current ) {

				// Seek a direct converter
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];

				// If none found, seek a pair
				if ( !conv ) {
					for ( conv2 in converters ) {

						// If conv2 outputs current
						tmp = conv2.split( " " );
						if ( tmp[ 1 ] === current ) {

							// If prev can be converted to accepted input
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
								converters[ "* " + tmp[ 0 ] ];
							if ( conv ) {

								// Condense equivalence converters
								if ( conv === true ) {
									conv = converters[ conv2 ];

								// Otherwise, insert the intermediate dataType
								} else if ( converters[ conv2 ] !== true ) {
									current = tmp[ 0 ];
									dataTypes.unshift( tmp[ 1 ] );
								}
								break;
							}
						}
					}
				}

				// Apply converter (if not an equivalence)
				if ( conv !== true ) {

					// Unless errors are allowed to bubble, catch and return them
					if ( conv && s.throws ) {
						response = conv( response );
					} else {
						try {
							response = conv( response );
						} catch ( e ) {
							return {
								state: "parsererror",
								error: conv ? e : "No conversion from " + prev + " to " + current
							};
						}
					}
				}
			}
		}
	}

	return { state: "success", data: response };
}

jQuery.extend( {

	// Counter for holding the number of active queries
	active: 0,

	// Last-Modified header cache for next request
	lastModified: {},
	etag: {},

	ajaxSettings: {
		url: location.href,
		type: "GET",
		isLocal: rlocalProtocol.test( location.protocol ),
		global: true,
		processData: true,
		async: true,
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",

		/*
		timeout: 0,
		data: null,
		dataType: null,
		username: null,
		password: null,
		cache: null,
		throws: false,
		traditional: false,
		headers: {},
		*/

		accepts: {
			"*": allTypes,
			text: "text/plain",
			html: "text/html",
			xml: "application/xml, text/xml",
			json: "application/json, text/javascript"
		},

		contents: {
			xml: /\bxml\b/,
			html: /\bhtml/,
			json: /\bjson\b/
		},

		responseFields: {
			xml: "responseXML",
			text: "responseText",
			json: "responseJSON"
		},

		// Data converters
		// Keys separate source (or catchall "*") and destination types with a single space
		converters: {

			// Convert anything to text
			"* text": String,

			// Text to html (true = no transformation)
			"text html": true,

			// Evaluate text as a json expression
			"text json": JSON.parse,

			// Parse text as xml
			"text xml": jQuery.parseXML
		},

		// For options that shouldn't be deep extended:
		// you can add your own custom options here if
		// and when you create one that shouldn't be
		// deep extended (see ajaxExtend)
		flatOptions: {
			url: true,
			context: true
		}
	},

	// Creates a full fledged settings object into target
	// with both ajaxSettings and settings fields.
	// If target is omitted, writes into ajaxSettings.
	ajaxSetup: function( target, settings ) {
		return settings ?

			// Building a settings object
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :

			// Extending ajaxSettings
			ajaxExtend( jQuery.ajaxSettings, target );
	},

	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
	ajaxTransport: addToPrefiltersOrTransports( transports ),

	// Main method
	ajax: function( url, options ) {

		// If url is an object, simulate pre-1.5 signature
		if ( typeof url === "object" ) {
			options = url;
			url = undefined;
		}

		// Force options to be an object
		options = options || {};

		var transport,

			// URL without anti-cache param
			cacheURL,

			// Response headers
			responseHeadersString,
			responseHeaders,

			// timeout handle
			timeoutTimer,

			// Url cleanup var
			urlAnchor,

			// Request state (becomes false upon send and true upon completion)
			completed,

			// To know if global events are to be dispatched
			fireGlobals,

			// Loop variable
			i,

			// uncached part of the url
			uncached,

			// Create the final options object
			s = jQuery.ajaxSetup( {}, options ),

			// Callbacks context
			callbackContext = s.context || s,

			// Context for global events is callbackContext if it is a DOM node or jQuery collection
			globalEventContext = s.context &&
				( callbackContext.nodeType || callbackContext.jquery ) ?
					jQuery( callbackContext ) :
					jQuery.event,

			// Deferreds
			deferred = jQuery.Deferred(),
			completeDeferred = jQuery.Callbacks( "once memory" ),

			// Status-dependent callbacks
			statusCode = s.statusCode || {},

			// Headers (they are sent all at once)
			requestHeaders = {},
			requestHeadersNames = {},

			// Default abort message
			strAbort = "canceled",

			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function( key ) {
					var match;
					if ( completed ) {
						if ( !responseHeaders ) {
							responseHeaders = {};
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
								responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
							}
						}
						match = responseHeaders[ key.toLowerCase() ];
					}
					return match == null ? null : match;
				},

				// Raw string
				getAllResponseHeaders: function() {
					return completed ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function( name, value ) {
					if ( completed == null ) {
						name = requestHeadersNames[ name.toLowerCase() ] =
							requestHeadersNames[ name.toLowerCase() ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function( type ) {
					if ( completed == null ) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function( map ) {
					var code;
					if ( map ) {
						if ( completed ) {

							// Execute the appropriate callbacks
							jqXHR.always( map[ jqXHR.status ] );
						} else {

							// Lazy-add the new callbacks in a way that preserves old ones
							for ( code in map ) {
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
							}
						}
					}
					return this;
				},

				// Cancel the request
				abort: function( statusText ) {
					var finalText = statusText || strAbort;
					if ( transport ) {
						transport.abort( finalText );
					}
					done( 0, finalText );
					return this;
				}
			};

		// Attach deferreds
		deferred.promise( jqXHR );

		// Add protocol if not provided (prefilters might expect it)
		// Handle falsy url in the settings object (#10093: consistency with old signature)
		// We also use the url parameter if available
		s.url = ( ( url || s.url || location.href ) + "" )
			.replace( rprotocol, location.protocol + "//" );

		// Alias method option to type as per ticket #12004
		s.type = options.method || options.type || s.method || s.type;

		// Extract dataTypes list
		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];

		// A cross-domain request is in order when the origin doesn't match the current origin.
		if ( s.crossDomain == null ) {
			urlAnchor = document.createElement( "a" );

			// Support: IE <=8 - 11, Edge 12 - 15
			// IE throws exception on accessing the href property if url is malformed,
			// e.g. http://example.com:80x/
			try {
				urlAnchor.href = s.url;

				// Support: IE <=8 - 11 only
				// Anchor's host property isn't correctly set when s.url is relative
				urlAnchor.href = urlAnchor.href;
				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
					urlAnchor.protocol + "//" + urlAnchor.host;
			} catch ( e ) {

				// If there is an error parsing the URL, assume it is crossDomain,
				// it can be rejected by the transport if it is invalid
				s.crossDomain = true;
			}
		}

		// Convert data if not already a string
		if ( s.data && s.processData && typeof s.data !== "string" ) {
			s.data = jQuery.param( s.data, s.traditional );
		}

		// Apply prefilters
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );

		// If request was aborted inside a prefilter, stop there
		if ( completed ) {
			return jqXHR;
		}

		// We can fire global events as of now if asked to
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
		fireGlobals = jQuery.event && s.global;

		// Watch for a new set of requests
		if ( fireGlobals && jQuery.active++ === 0 ) {
			jQuery.event.trigger( "ajaxStart" );
		}

		// Uppercase the type
		s.type = s.type.toUpperCase();

		// Determine if request has content
		s.hasContent = !rnoContent.test( s.type );

		// Save the URL in case we're toying with the If-Modified-Since
		// and/or If-None-Match header later on
		// Remove hash to simplify url manipulation
		cacheURL = s.url.replace( rhash, "" );

		// More options handling for requests with no content
		if ( !s.hasContent ) {

			// Remember the hash so we can put it back
			uncached = s.url.slice( cacheURL.length );

			// If data is available and should be processed, append data to url
			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;

				// #9682: remove data so that it's not used in an eventual retry
				delete s.data;
			}

			// Add or update anti-cache param if needed
			if ( s.cache === false ) {
				cacheURL = cacheURL.replace( rantiCache, "$1" );
				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
			}

			// Put hash and anti-cache on the URL that will be requested (gh-1732)
			s.url = cacheURL + uncached;

		// Change '%20' to '+' if this is encoded form body content (gh-2658)
		} else if ( s.data && s.processData &&
			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
			s.data = s.data.replace( r20, "+" );
		}

		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
		if ( s.ifModified ) {
			if ( jQuery.lastModified[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
			}
			if ( jQuery.etag[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
			}
		}

		// Set the correct header, if data is being sent
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
		}

		// Set the Accepts header for the server, depending on the dataType
		jqXHR.setRequestHeader(
			"Accept",
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
				s.accepts[ s.dataTypes[ 0 ] ] +
					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
				s.accepts[ "*" ]
		);

		// Check for headers option
		for ( i in s.headers ) {
			jqXHR.setRequestHeader( i, s.headers[ i ] );
		}

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend &&
			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {

			// Abort if not done already and return
			return jqXHR.abort();
		}

		// Aborting is no longer a cancellation
		strAbort = "abort";

		// Install callbacks on deferreds
		completeDeferred.add( s.complete );
		jqXHR.done( s.success );
		jqXHR.fail( s.error );

		// Get transport
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );

		// If no transport, we auto-abort
		if ( !transport ) {
			done( -1, "No Transport" );
		} else {
			jqXHR.readyState = 1;

			// Send global event
			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
			}

			// If request was aborted inside ajaxSend, stop there
			if ( completed ) {
				return jqXHR;
			}

			// Timeout
			if ( s.async && s.timeout > 0 ) {
				timeoutTimer = window.setTimeout( function() {
					jqXHR.abort( "timeout" );
				}, s.timeout );
			}

			try {
				completed = false;
				transport.send( requestHeaders, done );
			} catch ( e ) {

				// Rethrow post-completion exceptions
				if ( completed ) {
					throw e;
				}

				// Propagate others as results
				done( -1, e );
			}
		}

		// Callback for when everything is done
		function done( status, nativeStatusText, responses, headers ) {
			var isSuccess, success, error, response, modified,
				statusText = nativeStatusText;

			// Ignore repeat invocations
			if ( completed ) {
				return;
			}

			completed = true;

			// Clear timeout if it exists
			if ( timeoutTimer ) {
				window.clearTimeout( timeoutTimer );
			}

			// Dereference transport for early garbage collection
			// (no matter how long the jqXHR object will be used)
			transport = undefined;

			// Cache response headers
			responseHeadersString = headers || "";

			// Set readyState
			jqXHR.readyState = status > 0 ? 4 : 0;

			// Determine if successful
			isSuccess = status >= 200 && status < 300 || status === 304;

			// Get response data
			if ( responses ) {
				response = ajaxHandleResponses( s, jqXHR, responses );
			}

			// Convert no matter what (that way responseXXX fields are always set)
			response = ajaxConvert( s, response, jqXHR, isSuccess );

			// If successful, handle type chaining
			if ( isSuccess ) {

				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
				if ( s.ifModified ) {
					modified = jqXHR.getResponseHeader( "Last-Modified" );
					if ( modified ) {
						jQuery.lastModified[ cacheURL ] = modified;
					}
					modified = jqXHR.getResponseHeader( "etag" );
					if ( modified ) {
						jQuery.etag[ cacheURL ] = modified;
					}
				}

				// if no content
				if ( status === 204 || s.type === "HEAD" ) {
					statusText = "nocontent";

				// if not modified
				} else if ( status === 304 ) {
					statusText = "notmodified";

				// If we have data, let's convert it
				} else {
					statusText = response.state;
					success = response.data;
					error = response.error;
					isSuccess = !error;
				}
			} else {

				// Extract error from statusText and normalize for non-aborts
				error = statusText;
				if ( status || !statusText ) {
					statusText = "error";
					if ( status < 0 ) {
						status = 0;
					}
				}
			}

			// Set data for the fake xhr object
			jqXHR.status = status;
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";

			// Success/Error
			if ( isSuccess ) {
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
			} else {
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
			}

			// Status-dependent callbacks
			jqXHR.statusCode( statusCode );
			statusCode = undefined;

			if ( fireGlobals ) {
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
					[ jqXHR, s, isSuccess ? success : error ] );
			}

			// Complete
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );

			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );

				// Handle the global AJAX counter
				if ( !( --jQuery.active ) ) {
					jQuery.event.trigger( "ajaxStop" );
				}
			}
		}

		return jqXHR;
	},

	getJSON: function( url, data, callback ) {
		return jQuery.get( url, data, callback, "json" );
	},

	getScript: function( url, callback ) {
		return jQuery.get( url, undefined, callback, "script" );
	}
} );

jQuery.each( [ "get", "post" ], function( i, method ) {
	jQuery[ method ] = function( url, data, callback, type ) {

		// Shift arguments if data argument was omitted
		if ( isFunction( data ) ) {
			type = type || callback;
			callback = data;
			data = undefined;
		}

		// The url can be an options object (which then must have .url)
		return jQuery.ajax( jQuery.extend( {
			url: url,
			type: method,
			dataType: type,
			data: data,
			success: callback
		}, jQuery.isPlainObject( url ) && url ) );
	};
} );


jQuery._evalUrl = function( url ) {
	return jQuery.ajax( {
		url: url,

		// Make this explicit, since user can override this through ajaxSetup (#11264)
		type: "GET",
		dataType: "script",
		cache: true,
		async: false,
		global: false,
		"throws": true
	} );
};


jQuery.fn.extend( {
	wrapAll: function( html ) {
		var wrap;

		if ( this[ 0 ] ) {
			if ( isFunction( html ) ) {
				html = html.call( this[ 0 ] );
			}

			// The elements to wrap the target around
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );

			if ( this[ 0 ].parentNode ) {
				wrap.insertBefore( this[ 0 ] );
			}

			wrap.map( function() {
				var elem = this;

				while ( elem.firstElementChild ) {
					elem = elem.firstElementChild;
				}

				return elem;
			} ).append( this );
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapInner( html.call( this, i ) );
			} );
		}

		return this.each( function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		} );
	},

	wrap: function( html ) {
		var htmlIsFunction = isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function( selector ) {
		this.parent( selector ).not( "body" ).each( function() {
			jQuery( this ).replaceWith( this.childNodes );
		} );
		return this;
	}
} );


jQuery.expr.pseudos.hidden = function( elem ) {
	return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};




jQuery.ajaxSettings.xhr = function() {
	try {
		return new window.XMLHttpRequest();
	} catch ( e ) {}
};

var xhrSuccessStatus = {

		// File protocol always yields status code 0, assume 200
		0: 200,

		// Support: IE <=9 only
		// #1450: sometimes IE returns 1223 when it should be 204
		1223: 204
	},
	xhrSupported = jQuery.ajaxSettings.xhr();

support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;

jQuery.ajaxTransport( function( options ) {
	var callback, errorCallback;

	// Cross domain only allowed if supported through XMLHttpRequest
	if ( support.cors || xhrSupported && !options.crossDomain ) {
		return {
			send: function( headers, complete ) {
				var i,
					xhr = options.xhr();

				xhr.open(
					options.type,
					options.url,
					options.async,
					options.username,
					options.password
				);

				// Apply custom fields if provided
				if ( options.xhrFields ) {
					for ( i in options.xhrFields ) {
						xhr[ i ] = options.xhrFields[ i ];
					}
				}

				// Override mime type if needed
				if ( options.mimeType && xhr.overrideMimeType ) {
					xhr.overrideMimeType( options.mimeType );
				}

				// X-Requested-With header
				// For cross-domain requests, seeing as conditions for a preflight are
				// akin to a jigsaw puzzle, we simply never set it to be sure.
				// (it can always be set on a per-request basis or even using ajaxSetup)
				// For same-domain requests, won't change header if already provided.
				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
					headers[ "X-Requested-With" ] = "XMLHttpRequest";
				}

				// Set headers
				for ( i in headers ) {
					xhr.setRequestHeader( i, headers[ i ] );
				}

				// Callback
				callback = function( type ) {
					return function() {
						if ( callback ) {
							callback = errorCallback = xhr.onload =
								xhr.onerror = xhr.onabort = xhr.ontimeout =
									xhr.onreadystatechange = null;

							if ( type === "abort" ) {
								xhr.abort();
							} else if ( type === "error" ) {

								// Support: IE <=9 only
								// On a manual native abort, IE9 throws
								// errors on any property access that is not readyState
								if ( typeof xhr.status !== "number" ) {
									complete( 0, "error" );
								} else {
									complete(

										// File: protocol always yields status 0; see #8605, #14207
										xhr.status,
										xhr.statusText
									);
								}
							} else {
								complete(
									xhrSuccessStatus[ xhr.status ] || xhr.status,
									xhr.statusText,

									// Support: IE <=9 only
									// IE9 has no XHR2 but throws on binary (trac-11426)
									// For XHR2 non-text, let the caller handle it (gh-2498)
									( xhr.responseType || "text" ) !== "text"  ||
									typeof xhr.responseText !== "string" ?
										{ binary: xhr.response } :
										{ text: xhr.responseText },
									xhr.getAllResponseHeaders()
								);
							}
						}
					};
				};

				// Listen to events
				xhr.onload = callback();
				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );

				// Support: IE 9 only
				// Use onreadystatechange to replace onabort
				// to handle uncaught aborts
				if ( xhr.onabort !== undefined ) {
					xhr.onabort = errorCallback;
				} else {
					xhr.onreadystatechange = function() {

						// Check readyState before timeout as it changes
						if ( xhr.readyState === 4 ) {

							// Allow onerror to be called first,
							// but that will not handle a native abort
							// Also, save errorCallback to a variable
							// as xhr.onerror cannot be accessed
							window.setTimeout( function() {
								if ( callback ) {
									errorCallback();
								}
							} );
						}
					};
				}

				// Create the abort callback
				callback = callback( "abort" );

				try {

					// Do send the request (this may raise an exception)
					xhr.send( options.hasContent && options.data || null );
				} catch ( e ) {

					// #14683: Only rethrow if this hasn't been notified as an error yet
					if ( callback ) {
						throw e;
					}
				}
			},

			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
	if ( s.crossDomain ) {
		s.contents.script = false;
	}
} );

// Install script dataType
jQuery.ajaxSetup( {
	accepts: {
		script: "text/javascript, application/javascript, " +
			"application/ecmascript, application/x-ecmascript"
	},
	contents: {
		script: /\b(?:java|ecma)script\b/
	},
	converters: {
		"text script": function( text ) {
			jQuery.globalEval( text );
			return text;
		}
	}
} );

// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
	if ( s.cache === undefined ) {
		s.cache = false;
	}
	if ( s.crossDomain ) {
		s.type = "GET";
	}
} );

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {

	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {
		var script, callback;
		return {
			send: function( _, complete ) {
				script = jQuery( "<script>" ).prop( {
					charset: s.scriptCharset,
					src: s.url
				} ).on(
					"load error",
					callback = function( evt ) {
						script.remove();
						callback = null;
						if ( evt ) {
							complete( evt.type === "error" ? 404 : 200, evt.type );
						}
					}
				);

				// Use native DOM manipulation to avoid our domManip AJAX trickery
				document.head.appendChild( script[ 0 ] );
			},
			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




var oldCallbacks = [],
	rjsonp = /(=)\?(?=&|$)|\?\?/;

// Default jsonp settings
jQuery.ajaxSetup( {
	jsonp: "callback",
	jsonpCallback: function() {
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
		this[ callback ] = true;
		return callback;
	}
} );

// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {

	var callbackName, overwritten, responseContainer,
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
			"url" :
			typeof s.data === "string" &&
				( s.contentType || "" )
					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
				rjsonp.test( s.data ) && "data"
		);

	// Handle iff the expected data type is "jsonp" or we have a parameter to set
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {

		// Get callback name, remembering preexisting value associated with it
		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
			s.jsonpCallback() :
			s.jsonpCallback;

		// Insert callback into url or form data
		if ( jsonProp ) {
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
		} else if ( s.jsonp !== false ) {
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
		}

		// Use data converter to retrieve json after script execution
		s.converters[ "script json" ] = function() {
			if ( !responseContainer ) {
				jQuery.error( callbackName + " was not called" );
			}
			return responseContainer[ 0 ];
		};

		// Force json dataType
		s.dataTypes[ 0 ] = "json";

		// Install callback
		overwritten = window[ callbackName ];
		window[ callbackName ] = function() {
			responseContainer = arguments;
		};

		// Clean-up function (fires after converters)
		jqXHR.always( function() {

			// If previous value didn't exist - remove it
			if ( overwritten === undefined ) {
				jQuery( window ).removeProp( callbackName );

			// Otherwise restore preexisting value
			} else {
				window[ callbackName ] = overwritten;
			}

			// Save back as free
			if ( s[ callbackName ] ) {

				// Make sure that re-using the options doesn't screw things around
				s.jsonpCallback = originalSettings.jsonpCallback;

				// Save the callback name for future use
				oldCallbacks.push( callbackName );
			}

			// Call if it was a function and we have a response
			if ( responseContainer && isFunction( overwritten ) ) {
				overwritten( responseContainer[ 0 ] );
			}

			responseContainer = overwritten = undefined;
		} );

		// Delegate to script
		return "script";
	}
} );




// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
	var body = document.implementation.createHTMLDocument( "" ).body;
	body.innerHTML = "<form></form><form></form>";
	return body.childNodes.length === 2;
} )();


// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
	if ( typeof data !== "string" ) {
		return [];
	}
	if ( typeof context === "boolean" ) {
		keepScripts = context;
		context = false;
	}

	var base, parsed, scripts;

	if ( !context ) {

		// Stop scripts or inline event handlers from being executed immediately
		// by using document.implementation
		if ( support.createHTMLDocument ) {
			context = document.implementation.createHTMLDocument( "" );

			// Set the base href for the created document
			// so any parsed elements with URLs
			// are based on the document's URL (gh-2965)
			base = context.createElement( "base" );
			base.href = document.location.href;
			context.head.appendChild( base );
		} else {
			context = document;
		}
	}

	parsed = rsingleTag.exec( data );
	scripts = !keepScripts && [];

	// Single tag
	if ( parsed ) {
		return [ context.createElement( parsed[ 1 ] ) ];
	}

	parsed = buildFragment( [ data ], context, scripts );

	if ( scripts && scripts.length ) {
		jQuery( scripts ).remove();
	}

	return jQuery.merge( [], parsed.childNodes );
};


/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = stripAndCollapse( url.slice( off ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( isFunction( params ) ) {

		// We assume that it's the callback
		callback = params;
		params = undefined;

	// Otherwise, build a param string
	} else if ( params && typeof params === "object" ) {
		type = "POST";
	}

	// If we have elements to modify, make the request
	if ( self.length > 0 ) {
		jQuery.ajax( {
			url: url,

			// If "type" variable is undefined, then "GET" method will be used.
			// Make value of this field explicit since
			// user can override it through ajaxSetup method
			type: type || "GET",
			dataType: "html",
			data: params
		} ).done( function( responseText ) {

			// Save response for use in complete callback
			response = arguments;

			self.html( selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :

				// Otherwise use the full result
				responseText );

		// If the request succeeds, this function gets "data", "status", "jqXHR"
		// but they are ignored because response was set above.
		// If it fails, this function gets "jqXHR", "status", "error"
		} ).always( callback && function( jqXHR, status ) {
			self.each( function() {
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
			} );
		} );
	}

	return this;
};




// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
	"ajaxStart",
	"ajaxStop",
	"ajaxComplete",
	"ajaxError",
	"ajaxSuccess",
	"ajaxSend"
], function( i, type ) {
	jQuery.fn[ type ] = function( fn ) {
		return this.on( type, fn );
	};
} );




jQuery.expr.pseudos.animated = function( elem ) {
	return jQuery.grep( jQuery.timers, function( fn ) {
		return elem === fn.elem;
	} ).length;
};




jQuery.offset = {
	setOffset: function( elem, options, i ) {
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
			position = jQuery.css( elem, "position" ),
			curElem = jQuery( elem ),
			props = {};

		// Set position first, in-case top/left are set even on static elem
		if ( position === "static" ) {
			elem.style.position = "relative";
		}

		curOffset = curElem.offset();
		curCSSTop = jQuery.css( elem, "top" );
		curCSSLeft = jQuery.css( elem, "left" );
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;

		// Need to be able to calculate position if either
		// top or left is auto and position is either absolute or fixed
		if ( calculatePosition ) {
			curPosition = curElem.position();
			curTop = curPosition.top;
			curLeft = curPosition.left;

		} else {
			curTop = parseFloat( curCSSTop ) || 0;
			curLeft = parseFloat( curCSSLeft ) || 0;
		}

		if ( isFunction( options ) ) {

			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
		}

		if ( options.top != null ) {
			props.top = ( options.top - curOffset.top ) + curTop;
		}
		if ( options.left != null ) {
			props.left = ( options.left - curOffset.left ) + curLeft;
		}

		if ( "using" in options ) {
			options.using.call( elem, props );

		} else {
			curElem.css( props );
		}
	}
};

jQuery.fn.extend( {

	// offset() relates an element's border box to the document origin
	offset: function( options ) {

		// Preserve chaining for setter
		if ( arguments.length ) {
			return options === undefined ?
				this :
				this.each( function( i ) {
					jQuery.offset.setOffset( this, options, i );
				} );
		}

		var rect, win,
			elem = this[ 0 ];

		if ( !elem ) {
			return;
		}

		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
		// Support: IE <=11 only
		// Running getBoundingClientRect on a
		// disconnected node in IE throws an error
		if ( !elem.getClientRects().length ) {
			return { top: 0, left: 0 };
		}

		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
		rect = elem.getBoundingClientRect();
		win = elem.ownerDocument.defaultView;
		return {
			top: rect.top + win.pageYOffset,
			left: rect.left + win.pageXOffset
		};
	},

	// position() relates an element's margin box to its offset parent's padding box
	// This corresponds to the behavior of CSS absolute positioning
	position: function() {
		if ( !this[ 0 ] ) {
			return;
		}

		var offsetParent, offset, doc,
			elem = this[ 0 ],
			parentOffset = { top: 0, left: 0 };

		// position:fixed elements are offset from the viewport, which itself always has zero offset
		if ( jQuery.css( elem, "position" ) === "fixed" ) {

			// Assume position:fixed implies availability of getBoundingClientRect
			offset = elem.getBoundingClientRect();

		} else {
			offset = this.offset();

			// Account for the *real* offset parent, which can be the document or its root element
			// when a statically positioned element is identified
			doc = elem.ownerDocument;
			offsetParent = elem.offsetParent || doc.documentElement;
			while ( offsetParent &&
				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
				jQuery.css( offsetParent, "position" ) === "static" ) {

				offsetParent = offsetParent.parentNode;
			}
			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {

				// Incorporate borders into its offset, since they are outside its content origin
				parentOffset = jQuery( offsetParent ).offset();
				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
			}
		}

		// Subtract parent offsets and element margins
		return {
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
		};
	},

	// This method will return documentElement in the following cases:
	// 1) For the element inside the iframe without offsetParent, this method will return
	//    documentElement of the parent window
	// 2) For the hidden or detached element
	// 3) For body or html element, i.e. in case of the html node - it will return itself
	//
	// but those exceptions were never presented as a real life use-cases
	// and might be considered as more preferable results.
	//
	// This logic, however, is not guaranteed and can change at any point in the future
	offsetParent: function() {
		return this.map( function() {
			var offsetParent = this.offsetParent;

			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
				offsetParent = offsetParent.offsetParent;
			}

			return offsetParent || documentElement;
		} );
	}
} );

// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
	var top = "pageYOffset" === prop;

	jQuery.fn[ method ] = function( val ) {
		return access( this, function( elem, method, val ) {

			// Coalesce documents and windows
			var win;
			if ( isWindow( elem ) ) {
				win = elem;
			} else if ( elem.nodeType === 9 ) {
				win = elem.defaultView;
			}

			if ( val === undefined ) {
				return win ? win[ prop ] : elem[ method ];
			}

			if ( win ) {
				win.scrollTo(
					!top ? val : win.pageXOffset,
					top ? val : win.pageYOffset
				);

			} else {
				elem[ method ] = val;
			}
		}, method, val, arguments.length );
	};
} );

// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
		function( elem, computed ) {
			if ( computed ) {
				computed = curCSS( elem, prop );

				// If curCSS returns percentage, fallback to offset
				return rnumnonpx.test( computed ) ?
					jQuery( elem ).position()[ prop ] + "px" :
					computed;
			}
		}
	);
} );


// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
		function( defaultExtra, funcName ) {

		// Margin is only for outerHeight, outerWidth
		jQuery.fn[ funcName ] = function( margin, value ) {
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );

			return access( this, function( elem, type, value ) {
				var doc;

				if ( isWindow( elem ) ) {

					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
					return funcName.indexOf( "outer" ) === 0 ?
						elem[ "inner" + name ] :
						elem.document.documentElement[ "client" + name ];
				}

				// Get document width or height
				if ( elem.nodeType === 9 ) {
					doc = elem.documentElement;

					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
					// whichever is greatest
					return Math.max(
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
						elem.body[ "offset" + name ], doc[ "offset" + name ],
						doc[ "client" + name ]
					);
				}

				return value === undefined ?

					// Get width or height on the element, requesting but not forcing parseFloat
					jQuery.css( elem, type, extra ) :

					// Set width or height on the element
					jQuery.style( elem, type, value, extra );
			}, type, chainable ? margin : undefined, chainable );
		};
	} );
} );


jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
	function( i, name ) {

	// Handle event binding
	jQuery.fn[ name ] = function( data, fn ) {
		return arguments.length > 0 ?
			this.on( name, null, data, fn ) :
			this.trigger( name );
	};
} );

jQuery.fn.extend( {
	hover: function( fnOver, fnOut ) {
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
	}
} );




jQuery.fn.extend( {

	bind: function( types, data, fn ) {
		return this.on( types, null, data, fn );
	},
	unbind: function( types, fn ) {
		return this.off( types, null, fn );
	},

	delegate: function( selector, types, data, fn ) {
		return this.on( types, selector, data, fn );
	},
	undelegate: function( selector, types, fn ) {

		// ( namespace ) or ( selector, types [, fn] )
		return arguments.length === 1 ?
			this.off( selector, "**" ) :
			this.off( types, selector || "**", fn );
	}
} );

// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
// However, it is not slated for removal any time soon
jQuery.proxy = function( fn, context ) {
	var tmp, args, proxy;

	if ( typeof context === "string" ) {
		tmp = fn[ context ];
		context = fn;
		fn = tmp;
	}

	// Quick check to determine if target is callable, in the spec
	// this throws a TypeError, but we will just return undefined.
	if ( !isFunction( fn ) ) {
		return undefined;
	}

	// Simulated bind
	args = slice.call( arguments, 2 );
	proxy = function() {
		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
	};

	// Set the guid of unique handler to the same of original handler, so it can be removed
	proxy.guid = fn.guid = fn.guid || jQuery.guid++;

	return proxy;
};

jQuery.holdReady = function( hold ) {
	if ( hold ) {
		jQuery.readyWait++;
	} else {
		jQuery.ready( true );
	}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;

jQuery.now = Date.now;

jQuery.isNumeric = function( obj ) {

	// As of jQuery 3.0, isNumeric is limited to
	// strings and numbers (primitives or objects)
	// that can be coerced to finite numbers (gh-2662)
	var type = jQuery.type( obj );
	return ( type === "number" || type === "string" ) &&

		// parseFloat NaNs numeric-cast false positives ("")
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
		// subtraction forces infinities to NaN
		!isNaN( obj - parseFloat( obj ) );
};




// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.

// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

if ( typeof define === "function" && define.amd ) {
	define( "jquery", [], function() {
		return jQuery;
	} );
}




var

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,

	// Map over the $ in case of overwrite
	_$ = window.$;

jQuery.noConflict = function( deep ) {
	if ( window.$ === jQuery ) {
		window.$ = _$;
	}

	if ( deep && window.jQuery === jQuery ) {
		window.jQuery = _jQuery;
	}

	return jQuery;
};

// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
	window.jQuery = window.$ = jQuery;
}




return jQuery;
} );

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var wait = require('./wait');

var angle = function (_wait) {
    _inherits(angle, _wait);

    /**
     * animate object's {x, y} using an angle
     * @param {object} object to animate
     * @param {number} angle in radians
     * @param {number} speed in pixels/millisecond
     * @param {number} [duration=0] in milliseconds; if 0, then continues forever
     * @param {object} [options] @see {@link Wait}
     * @private
     */
    function angle(object, _angle, speed, duration, options) {
        _classCallCheck(this, angle);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (angle.__proto__ || Object.getPrototypeOf(angle)).call(this, object, options));

        _this.type = 'Angle';
        if (options.load) {
            _this.load(options.load);
        } else {
            _this.angle = _angle;
            _this.speed = speed;
            _this.duration = duration || 0;
        }
        return _this;
    }

    _createClass(angle, [{
        key: 'save',
        value: function save() {
            var save = _get(angle.prototype.__proto__ || Object.getPrototypeOf(angle.prototype), 'save', this).call(this);
            save.angle = this.angle;
            save.speed = this.speed;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(angle.prototype.__proto__ || Object.getPrototypeOf(angle.prototype), 'load', this).call(this, _load);
            this.angle = _load.angle;
            this.speed = _load.speed;
        }
    }, {
        key: 'calculate',
        value: function calculate(elapsed) {
            this.object.x += this.cos * elapsed * this.speed;
            this.object.y += this.sin * elapsed * this.speed;
        }
    }, {
        key: 'reverse',
        value: function reverse() {
            this.angle += Math.PI;
        }
    }, {
        key: 'angle',
        get: function get() {
            return this._angle;
        },
        set: function set(value) {
            this._angle = value;
            this.sin = Math.sin(this._angle);
            this.cos = Math.cos(this._angle);
        }
    }]);

    return angle;
}(wait);

module.exports = angle;

},{"./wait":11}],2:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Angle = require('yy-angle');
var wait = require('./wait');

/** Rotates an object to face the target */

var face = function (_wait) {
    _inherits(face, _wait);

    /**
     * @param {object} object
     * @param {Point} target
     * @param {number} speed in radians/millisecond
     * @param {object} [options] @see {@link Wait}
     * @param {boolean} [options.keepAlive] don't stop animation when complete
     */
    function face(object, target, speed, options) {
        _classCallCheck(this, face);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (face.__proto__ || Object.getPrototypeOf(face)).call(this, object, options));

        _this.type = 'Face';
        _this.target = target;
        if (options.load) {
            _this.load(options.load);
        } else {
            _this.speed = speed;
        }
        return _this;
    }

    _createClass(face, [{
        key: 'save',
        value: function save() {
            if (this.options.cancel) {
                return null;
            }
            var save = _get(face.prototype.__proto__ || Object.getPrototypeOf(face.prototype), 'save', this).call(this);
            save.speed = this.speed;
            save.keepAlive = this.options.keepAlive;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(face.prototype.__proto__ || Object.getPrototypeOf(face.prototype), 'load', this).call(this, _load);
            this.speed = _load.speed;
            this.options.keepAlive = _load.keepAlive;
        }
    }, {
        key: 'calculate',
        value: function calculate(elapsed) {
            var angle = Angle.angleTwoPoints(this.object.position, this.target);
            var difference = Angle.differenceAngles(angle, this.object.rotation);
            if (difference === 0) {
                this.emit('done', this.object);
                if (!this.options.keepAlive) {
                    return true;
                }
            } else {
                var sign = Angle.differenceAnglesSign(angle, this.object.rotation);
                var change = this.speed * elapsed;
                var delta = change > difference ? difference : change;
                this.object.rotation += delta * sign;
            }
        }
    }]);

    return face;
}(wait);

module.exports = face;

},{"./wait":11,"yy-angle":22}],3:[function(require,module,exports){
'use strict';

var Ease = {
    list: require('./list'),
    wait: require('./wait'),
    to: require('./to'),
    shake: require('./shake'),
    tint: require('./tint'),
    face: require('./face'),
    angle: require('./angle'),
    target: require('./target'),
    movie: require('./movie'),
    load: require('./load')
};

PIXI.extras.Ease = Ease;

module.exports = Ease;

},{"./angle":1,"./face":2,"./list":4,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],4:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Events = require('eventemitter3');

var Angle = require('./angle');
var Face = require('./face');
var Load = require('./load');
var Movie = require('./movie');
var Shake = require('./shake');
var Target = require('./target');
var Tint = require('./tint');
var To = require('./to');
var Wait = require('./wait');

var Ease = function (_Events) {
    _inherits(Ease, _Events);

    /**
     * Main class for creating eases
     * @param {object} [options]
     * @param {boolean} [options.noTicker] don't add the update function to PIXI.ticker
     * @param {PIXI.ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for the list
     * @extends eventemitter
     * @fire done
     * @fire each
     */
    function Ease(options) {
        _classCallCheck(this, Ease);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (Ease.__proto__ || Object.getPrototypeOf(Ease)).call(this));

        if (!options.noTicker) {
            var ticker = options.ticker || PIXI.ticker.shared;
            ticker.add(function () {
                return _this.update(ticker.elapsedMS);
            });
        }
        _this.list = [];
        _this.empty = true;
        _this.removeWaiting = [];
        _this.removeAllWaiting = false;
        return _this;
    }

    /**
     * Add animation(s) to animation list
     * @param {(object|object[])} any animation class
     * @return {object} first animation
     */


    _createClass(Ease, [{
        key: 'add',
        value: function add() {
            var first = void 0;
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = arguments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    var arg = _step.value;

                    if (Array.isArray(arg)) {
                        var _iteratorNormalCompletion2 = true;
                        var _didIteratorError2 = false;
                        var _iteratorError2 = undefined;

                        try {
                            for (var _iterator2 = arg[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                                var entry = _step2.value;

                                if (!first) {
                                    first = entry;
                                }
                                this.list.push(entry);
                            }
                        } catch (err) {
                            _didIteratorError2 = true;
                            _iteratorError2 = err;
                        } finally {
                            try {
                                if (!_iteratorNormalCompletion2 && _iterator2.return) {
                                    _iterator2.return();
                                }
                            } finally {
                                if (_didIteratorError2) {
                                    throw _iteratorError2;
                                }
                            }
                        }
                    } else {
                        first = arg;
                        this.list.push(arg);
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator.return) {
                        _iterator.return();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }

            this.empty = false;
            return first;
        }

        /**
         * remove animation(s)
         * @param {object|array} animate - the animation (or array of animations) to remove; can be null
         */

    }, {
        key: 'remove',
        value: function remove(animate) {
            if (this.inUpdate) {
                this.removeWaiting.push(animate);
            } else {
                var index = this.list.indexOf(animate);
                if (index !== -1) {
                    this.list.splice(index, 1);
                }
            }
        }

        /**
         * remove all animations from list
         * @inherited from yy-loop
         */

    }, {
        key: 'removeAll',
        value: function removeAll() {
            if (this.inUpdate) {
                this.removeAllWaiting = true;
            } else {
                this.list = [];
            }
        }

        /**
         * update frame
         * this is automatically added to PIXI.ticker unless options.noTicker is set
         * if using options.noTicker, this should be called manually
         * @param {number} elasped time in MS since last update
         */

    }, {
        key: 'update',
        value: function update(elapsed) {
            this.inUpdate = true;
            for (var i = 0, _i = this.list.length; i < _i; i++) {
                if (this.list[i] && this.list[i].update(elapsed)) {
                    this.list.splice(i, 1);
                    i--;
                    _i--;
                }
            }
            this.emit('each', this);
            if (this.list.length === 0 && !this.empty) {
                this.emit('done', this);
                this.empty = true;
            }
            this.inUpdate = false;
            if (this.removeAllWaiting) {
                this.removeAll();
                this.removeAllWaiting = false;
            }
            while (this.removeWaiting.length) {
                this.remove(this.removeWaiting.pop());
            }
        }

        /**
         * number of animations
         * @type {number}
         */

    }, {
        key: 'to',


        /**
         * default options for all eases
         * @typedef {object} EaseOptions
         * @param {object} [EaseOptions.options]
         * @param {number} [EaseOptions.options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time)
         * @param {boolean} [EaseOptions.options.pause] start the animation paused
         * @param {boolean|number} [EaseOptions.options.repeat] true: repeat animation forever n: repeat animation n times
         * @param {boolean|number} [EaseOptions.options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times
         * @param {Function} [EaseOptions.options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set
         * @param {string|Function} [EaseOptions.options.ease] name or function from easing.js (see http://easings.net for examples)
         */

        /**
         * ease parameters of object
         * @param {PIXI.DisplayObject} object to animate
         * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI}
         * @param {number} duration - time to run
         * @fires done
         * @fires wait
         * @fires first
         * @fires each
         * @fires loop
         * @fires reverse
         */
        value: function to() {
            return this.add(new (Function.prototype.bind.apply(To, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /**
         * animate object's {x, y} using an angle
         * @param {object} object to animate
         * @param {number} angle in radians
         * @param {number} speed in pixels/millisecond
         * @param {number} [duration=0] in milliseconds; if 0, then continues forever
         * @param {object} [options] @see {@link Wait}
         */

    }, {
        key: 'angle',
        value: function angle() {
            return this.add(new (Function.prototype.bind.apply(Angle, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.face class; see Ease.to class below for parameters */

    }, {
        key: 'face',
        value: function face() {
            return this.add(new (Function.prototype.bind.apply(Face, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.load class; see Ease.to class below for parameters */

    }, {
        key: 'load',
        value: function load() {
            return this.add(new (Function.prototype.bind.apply(Load, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.movie class; see Ease.to class below for parameters */

    }, {
        key: 'movie',
        value: function movie() {
            return this.add(new (Function.prototype.bind.apply(Movie, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.shake class; see Ease.to class below for parameters */

    }, {
        key: 'shake',
        value: function shake() {
            return this.add(new (Function.prototype.bind.apply(Shake, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.target class; see Ease.to class below for parameters */

    }, {
        key: 'target',
        value: function target() {
            return this.add(new (Function.prototype.bind.apply(Target, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.angle tint; see Ease.to class below for parameters */

    }, {
        key: 'tint',
        value: function tint() {
            return this.add(new (Function.prototype.bind.apply(Tint, [null].concat(Array.prototype.slice.call(arguments))))());
        }

        /** helper to add to the list a new Ease.wait class; see Ease.to class below for parameters */

    }, {
        key: 'wait',
        value: function wait() {
            return this.add(new (Function.prototype.bind.apply(Wait, [null].concat(Array.prototype.slice.call(arguments))))());
        }
    }, {
        key: 'count',
        get: function get() {
            return this.list.length;
        }

        /**
         * number of active animations
         * @type {number}
         */

    }, {
        key: 'countRunning',
        get: function get() {
            var count = 0;
            var _iteratorNormalCompletion3 = true;
            var _didIteratorError3 = false;
            var _iteratorError3 = undefined;

            try {
                for (var _iterator3 = this.list[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
                    var entry = _step3.value;

                    if (!entry.pause) {
                        count++;
                    }
                }
            } catch (err) {
                _didIteratorError3 = true;
                _iteratorError3 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion3 && _iterator3.return) {
                        _iterator3.return();
                    }
                } finally {
                    if (_didIteratorError3) {
                        throw _iteratorError3;
                    }
                }
            }

            return count;
        }
    }]);

    return Ease;
}(Events);

module.exports = Ease;

},{"./angle":1,"./face":2,"./load":5,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11,"eventemitter3":12}],5:[function(require,module,exports){
'use strict';

var wait = require('./wait');
var to = require('./to');
var tint = require('./tint');
var shake = require('./shake');
var angle = require('./angle');
var face = require('./face');
var target = require('./target');
var movie = require('./movie');

/**
 * restart an animation = requires a saved state
 * @param {object} object(s) to animate
 */
function load(object, load) {
    if (!load) {
        return null;
    }
    var options = { load: load };
    switch (load.type) {
        case 'Wait':
            return new wait(object, options);
        case 'To':
            return new to(object, null, null, options);
        case 'Tint':
            return new tint(object, null, null, options);
        case 'Shake':
            return new shake(object, null, null, options);
        case 'Angle':
            return new angle(object, null, null, null, options);
        case 'Face':
            return new face(object[0], object[1], null, options);
        case 'Target':
            return new target(object[0], object[1], null, options);
        case 'Movie':
            return new movie(object, object[1], null, options);
    }
}

module.exports = load;

},{"./angle":1,"./face":2,"./movie":6,"./shake":7,"./target":8,"./tint":9,"./to":10,"./wait":11}],6:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var wait = require('./wait');

/**
 * animate a movie of textures
 */

var movie = function (_wait) {
    _inherits(movie, _wait);

    /**
     * @param {object} object to animate
     * @param {PIXI.Texture[]} textures
     * @param {number} [duration=0] time to run (use 0 for infinite duration--should only be used with customized easing functions)
     * @param {object} [options]
     * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time)
     * @param {boolean} [options.pause] start the animation paused
     * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times
     * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times
     * @param {(boolean|number)} [options.continue] true: continue animation with new starting values n: continue animation n times
     * @param {Function} [options.load] loads an animation using a .save() object note the * parameters below cannot be loaded and must be re-set
     * @param {Function} [options.ease] function from easing.js (see http://easings.net for examples)
     * @emits {done} animation expires
     * @emits {wait} each update during a wait
     * @emits {first} first update when animation starts
     * @emits {each} each update while animation is running
     * @emits {loop} when animation is repeated
     * @emits {reverse} when animation is reversed
     */
    function movie(object, textures, duration, options) {
        _classCallCheck(this, movie);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (movie.__proto__ || Object.getPrototypeOf(movie)).call(this, object, options));

        _this.type = 'Movie';
        if (Array.isArray(object)) {
            _this.list = object;
            _this.object = _this.list[0];
        }
        if (options.load) {
            _this.load(options.load);
        } else {
            _this.textures = textures;
            _this.duration = duration;
            _this.current = 0;
            _this.length = textures.length;
            _this.interval = duration / _this.length;
            _this.isReverse = false;
            _this.restart();
        }
        return _this;
    }

    _createClass(movie, [{
        key: 'save',
        value: function save() {
            var save = _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'save', this).call(this);
            save.goto = this.goto;
            save.current = this.current;
            save.length = this.length;
            save.interval = this.interval;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(movie.prototype.__proto__ || Object.getPrototypeOf(movie.prototype), 'load', this).call(this, _load);
            this.goto = _load.goto;
            this.current = _load.current;
            this.interval = _load.current;
        }
    }, {
        key: 'restart',
        value: function restart() {
            this.current = 0;
            this.time = 0;
            this.isReverse = false;
        }
    }, {
        key: 'reverse',
        value: function reverse() {
            this.isReverse = !this.isReverse;
        }
    }, {
        key: 'calculate',
        value: function calculate() {
            var index = Math.round(this.options.ease(this.time, 0, this.length - 1, this.duration));
            if (this.isReverse) {
                index = this.length - 1 - index;
            }
            if (this.list) {
                for (var i = 0; i < this.list.length; i++) {
                    this.list[i].texture = this.textures[index];
                }
            } else {
                this.object.texture = this.textures[index];
            }
        }
    }]);

    return movie;
}(wait);

module.exports = movie;

},{"./wait":11}],7:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var wait = require('./wait');

/**
 * shakes an object or list of objects
 */

var shake = function (_wait) {
    _inherits(shake, _wait);

    /**
     * @param {object|array} object or list of objects to shake
     * @param {number} amount to shake
     * @param {number} duration (in milliseconds) to shake
     * @param {object} options (see Animate.wait)
     */
    function shake(object, amount, duration, options) {
        _classCallCheck(this, shake);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (shake.__proto__ || Object.getPrototypeOf(shake)).call(this, object, options));

        _this.type = 'Shake';
        if (Array.isArray(object)) {
            _this.array = true;
            _this.list = object;
        }
        if (options.load) {
            _this.load(options.load);
        } else {
            if (_this.list) {
                _this.start = [];
                for (var i = 0; i < object.length; i++) {
                    var target = object[i];
                    _this.start[i] = { x: target.x, y: target.y };
                }
            } else {
                _this.start = { x: object.x, y: object.y };
            }
            _this.amount = amount;
            _this.duration = duration;
        }
        return _this;
    }

    _createClass(shake, [{
        key: 'save',
        value: function save() {
            var save = _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'save', this).call(this);
            save.start = this.start;
            save.amount = this.amount;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(shake.prototype.__proto__ || Object.getPrototypeOf(shake.prototype), 'load', this).call(this, _load);
            this.start = _load.start;
            this.amount = _load.amount;
        }
    }, {
        key: 'calculate',
        value: function calculate() /*elapsed*/{
            var object = this.object;
            var start = this.start;
            var amount = this.amount;
            if (this.array) {
                var list = this.list;
                for (var i = 0; i < list.length; i++) {
                    var _object = list[i];
                    var actual = start[i];
                    _object.x = actual.x + Math.floor(Math.random() * amount * 2) - amount;
                    _object.y = actual.y + Math.floor(Math.random() * amount * 2) - amount;
                }
            }
            object.x = start.x + Math.floor(Math.random() * amount * 2) - amount;
            object.y = start.y + Math.floor(Math.random() * amount * 2) - amount;
        }
    }, {
        key: 'done',
        value: function done() {
            var object = this.object;
            var start = this.start;
            if (this.array) {
                var list = this.list;
                for (var i = 0; i < list.length; i++) {
                    var _object2 = list[i];
                    var actual = start[i];
                    _object2.x = actual.x;
                    _object2.y = actual.y;
                }
            } else {
                object.x = start.x;
                object.y = start.y;
            }
        }
    }]);

    return shake;
}(wait);

module.exports = shake;

},{"./wait":11}],8:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var wait = require('./wait');

/** move an object to a target's location */

var target = function (_wait) {
    _inherits(target, _wait);

    /**
     * move to a target
     * @param {object} object - object to animate
     * @param {object} target - object needs to contain {x: x, y: y}
     * @param {number} speed - number of pixels to move per millisecond
     * @param {object} [options] @see {@link Wait}
     * @param {boolean} [options.keepAlive] don't cancel the animation when target is reached
     */
    function target(object, _target, speed, options) {
        _classCallCheck(this, target);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (target.__proto__ || Object.getPrototypeOf(target)).call(this, object, options));

        _this.type = 'Target';
        _this.target = _target;
        if (options.load) {
            _this.load(options.load);
        } else {
            _this.speed = speed;
        }
        return _this;
    }

    _createClass(target, [{
        key: 'save',
        value: function save() {
            var save = _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'save', this).call(this);
            save.speed = this.speed;
            save.keepAlive = this.options.keepAlive;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(target.prototype.__proto__ || Object.getPrototypeOf(target.prototype), 'load', this).call(this, _load);
            this.speed = _load.speed;
            this.options.keepAlive = _load.keepAlive;
        }
    }, {
        key: 'calculate',
        value: function calculate(elapsed) {
            var deltaX = this.target.x - this.object.x;
            var deltaY = this.target.y - this.object.y;
            if (deltaX === 0 && deltaY === 0) {
                this.emit('done', this.object);
                if (!this.options.keepAlive) {
                    return true;
                }
            } else {
                var angle = Math.atan2(deltaY, deltaX);
                this.object.x += Math.cos(angle) * elapsed * this.speed;
                this.object.y += Math.sin(angle) * elapsed * this.speed;
                if (deltaX >= 0 !== this.target.x - this.object.x >= 0) {
                    this.object.x = this.target.x;
                }
                if (deltaY >= 0 !== this.target.y - this.object.y >= 0) {
                    this.object.y = this.target.y;
                }
            }
        }
    }]);

    return target;
}(wait);

module.exports = target;

},{"./wait":11}],9:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Color = require('yy-color');
var wait = require('./wait');

var tint = function (_wait) {
    _inherits(tint, _wait);

    /**
     * @param {PIXI.DisplayObject|PIXI.DisplayObject[]} object
     * @param {number|number[]} tint
     * @param {number} [duration] in milliseconds
     * @param {object} [options] @see {@link Wait}
     */
    function tint(object, _tint, duration, options) {
        _classCallCheck(this, tint);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (tint.__proto__ || Object.getPrototypeOf(tint)).call(this, object, options));

        _this.type = 'Tint';
        if (Array.isArray(object)) {
            _this.list = object;
            _this.object = _this.list[0];
        }
        _this.duration = duration;
        if (options.load) {
            _this.load(options.load);
        } else if (Array.isArray(_tint)) {
            _this.tints = [_this.object.tint].concat(_toConsumableArray(_tint));
        } else {
            _this.start = _this.object.tint;
            _this.to = _tint;
        }
        return _this;
    }

    _createClass(tint, [{
        key: 'save',
        value: function save() {
            var save = _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'save', this).call(this);
            save.start = this.start;
            save.to = this.to;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(tint.prototype.__proto__ || Object.getPrototypeOf(tint.prototype), 'load', this).call(this, _load);
            this.start = _load.start;
            this.to = _load.to;
        }
    }, {
        key: 'calculate',
        value: function calculate() {
            var percent = this.options.ease(this.time, 0, 1, this.duration);
            if (this.tints) {
                var each = 1 / (this.tints.length - 1);
                var per = each;
                for (var i = 1; i < this.tints.length; i++) {
                    if (percent <= per) {
                        var color = Color.blend(1 - (per - percent) / each, this.tints[i - 1], this.tints[i]);
                        if (this.list) {
                            var _iteratorNormalCompletion = true;
                            var _didIteratorError = false;
                            var _iteratorError = undefined;

                            try {
                                for (var _iterator = this.list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                                    var object = _step.value;

                                    object.tint = color;
                                }
                            } catch (err) {
                                _didIteratorError = true;
                                _iteratorError = err;
                            } finally {
                                try {
                                    if (!_iteratorNormalCompletion && _iterator.return) {
                                        _iterator.return();
                                    }
                                } finally {
                                    if (_didIteratorError) {
                                        throw _iteratorError;
                                    }
                                }
                            }
                        } else {
                            this.object.tint = color;
                        }
                        break;
                    }
                    per += each;
                }
            } else {
                var _color = Color.blend(percent, this.start, this.to);
                if (this.list) {
                    var _iteratorNormalCompletion2 = true;
                    var _didIteratorError2 = false;
                    var _iteratorError2 = undefined;

                    try {
                        for (var _iterator2 = this.list[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                            var _object = _step2.value;

                            _object.tint = _color;
                        }
                    } catch (err) {
                        _didIteratorError2 = true;
                        _iteratorError2 = err;
                    } finally {
                        try {
                            if (!_iteratorNormalCompletion2 && _iterator2.return) {
                                _iterator2.return();
                            }
                        } finally {
                            if (_didIteratorError2) {
                                throw _iteratorError2;
                            }
                        }
                    }
                } else {
                    this.object.tint = _color;
                }
            }
        }
    }, {
        key: 'reverse',
        value: function reverse() {
            if (this.tints) {
                var tints = [];
                for (var i = this.tints.length - 1; i >= 0; i--) {
                    tints.push(this.tints[i]);
                }
                this.tints = tints;
            } else {
                var swap = this.to;
                this.to = this.start;
                this.start = swap;
            }
        }
    }]);

    return tint;
}(wait);

module.exports = tint;

},{"./wait":11,"yy-color":23}],10:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var wait = require('./wait');

/** animate any numeric parameter of an object or array of objects */

var to = function (_wait) {
    _inherits(to, _wait);

    /**
     * @private
     * @param {object} object to animate
     * @param {object} goto - parameters to animate, e.g.: {alpha: 5, scale: {3, 5}, scale: 5, rotation: Math.PI}
     * @param {number} duration - time to run
     * @param {object} [options]
     * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time)
     * @param {boolean} [options.pause] start the animation paused
     * @param {boolean|number} [options.repeat] true: repeat animation forever n: repeat animation n times
     * @param {boolean|number} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times
     * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set
     * @param {string|Function} [options.ease] name or function from easing.js (see http://easings.net for examples)
     * @emits to:done animation expires
     * @emits to:wait each update during a wait
     * @emits to:first first update when animation starts
     * @emits to:each each update while animation is running
     * @emits to:loop when animation is repeated
     * @emits to:reverse when animation is reversed
     */
    function to(object, goto, duration, options) {
        _classCallCheck(this, to);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (to.__proto__ || Object.getPrototypeOf(to)).call(this, object, options));

        _this.type = 'To';
        if (Array.isArray(object)) {
            _this.list = object;
            _this.object = _this.list[0];
        }
        if (options.load) {
            _this.load(options.load);
        } else {
            _this.goto = goto;
            _this.fixScale();
            _this.duration = duration;
            _this.restart();
        }
        return _this;
    }

    /**
     * converts scale from { scale: n } to { scale: { x: n, y: n }}
     * @private
     */


    _createClass(to, [{
        key: 'fixScale',
        value: function fixScale() {
            if (typeof this.goto['scale'] !== 'undefined' && !Number.isNaN(this.goto['scale'])) {
                this.goto['scale'] = { x: this.goto['scale'], y: this.goto['scale'] };
            }
        }
    }, {
        key: 'save',
        value: function save() {
            var save = _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'save', this).call(this);
            save.goto = this.goto;
            save.start = this.start;
            save.delta = this.delta;
            save.keys = this.keys;
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            _get(to.prototype.__proto__ || Object.getPrototypeOf(to.prototype), 'load', this).call(this, _load);
            this.goto = _load.goto;
            this.start = _load.start;
            this.delta = _load.delta;
            this.keys = _load.keys;
        }
    }, {
        key: 'restart',
        value: function restart() {
            var i = 0;
            var start = this.start = [];
            var delta = this.delta = [];
            var keys = this.keys = [];
            var goto = this.goto;
            var object = this.object;

            // loops through all keys in goto object
            for (var key in goto) {

                // handles keys with one additional level e.g.: goto = {scale: {x: 5, y: 3}}
                if (isNaN(goto[key])) {
                    keys[i] = { key: key, children: [] };
                    start[i] = [];
                    delta[i] = [];
                    var j = 0;
                    for (var key2 in goto[key]) {
                        keys[i].children[j] = key2;
                        start[i][j] = parseFloat(object[key][key2]);
                        start[i][j] = this._correctDOM(key2, start[i][j]);
                        start[i][j] = isNaN(this.start[i][j]) ? 0 : start[i][j];
                        delta[i][j] = goto[key][key2] - start[i][j];
                        j++;
                    }
                } else {
                    start[i] = parseFloat(object[key]);
                    start[i] = this._correctDOM(key, start[i]);
                    start[i] = isNaN(this.start[i]) ? 0 : start[i];
                    delta[i] = goto[key] - start[i];
                    keys[i] = key;
                }
                i++;
            }
            this.time = 0;
        }
    }, {
        key: 'reverse',
        value: function reverse() {
            var object = this.object;
            var keys = this.keys;
            var goto = this.goto;
            var delta = this.delta;
            var start = this.start;

            for (var i = 0, _i = keys.length; i < _i; i++) {
                var key = keys[i];
                if (isNaN(goto[key])) {
                    for (var j = 0, _j = key.children.length; j < _j; j++) {
                        delta[i][j] = -delta[i][j];
                        start[i][j] = parseFloat(object[key.key][key.children[j]]);
                        start[i][j] = isNaN(start[i][j]) ? 0 : start[i][j];
                    }
                } else {
                    delta[i] = -delta[i];
                    start[i] = parseFloat(object[key]);
                    start[i] = isNaN(start[i]) ? 0 : start[i];
                }
            }
        }
    }, {
        key: 'calculate',
        value: function calculate() /*elapsed*/{
            var object = this.object;
            var list = this.list;
            var keys = this.keys;
            var goto = this.goto;
            var time = this.time;
            var start = this.start;
            var delta = this.delta;
            var duration = this.duration;
            var ease = this.options.ease;
            for (var i = 0, _i = this.keys.length; i < _i; i++) {
                var key = keys[i];
                if (isNaN(goto[key])) {
                    var key1 = key.key;
                    for (var j = 0, _j = key.children.length; j < _j; j++) {
                        var key2 = key.children[j];
                        var others = object[key1][key2] = time >= duration ? start[i][j] + delta[i][j] : ease(time, start[i][j], delta[i][j], duration);
                        if (list) {
                            for (var k = 1, _k = list.length; k < _k; k++) {
                                list[k][key1][key2] = others;
                            }
                        }
                    }
                } else {
                    var _key = keys[i];
                    var _others = object[_key] = time >= duration ? start[i] + delta[i] : ease(time, start[i], delta[i], duration);
                    if (list) {
                        for (var _j2 = 1, _j3 = this.list.length; _j2 < _j3; _j2++) {
                            list[_j2][_key] = _others;
                        }
                    }
                }
            }
        }
    }]);

    return to;
}(wait);

module.exports = to;

},{"./wait":11}],11:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Easing = require('penner');
var EventEmitter = require('eventemitter3');

var wait = function (_EventEmitter) {
    _inherits(wait, _EventEmitter);

    /**
     * @param {object|object[]} object or list of objects to animate
     * @param {object} [options]
     * @param {number} [options.wait=0] n milliseconds before starting animation (can also be used to pause animation for a length of time)
     * @param {boolean} [options.pause] start the animation paused
     * @param {(boolean|number)} [options.repeat] true: repeat animation forever n: repeat animation n times
     * @param {(boolean|number)} [options.reverse] true: reverse animation (if combined with repeat, then pulse) n: reverse animation n times
     *
     * @param {number} [options.id] user-generated id (e.g., I use it to properly load animations when an object has multiple animations running)
     * @param {Function} [options.load] loads an animation using an .save() object note the * parameters below cannot be loaded and must be re-set
     * @param {Function|string} [options.ease] function (or penner function name) from easing.js (see http://easings.net for examples)*
     *
     * @emits {done} animation expires
     * @emits {wait} each update during a wait
     * @emits {first} first update when animation starts
     * @emits {each} each update while animation is running
     * @emits {loop} when animation is repeated
     * @emits {reverse} when animation is reversed
     */
    function wait(object, options) {
        _classCallCheck(this, wait);

        var _this = _possibleConstructorReturn(this, (wait.__proto__ || Object.getPrototypeOf(wait)).call(this));

        _this.object = object;
        _this.options = options || {};
        _this.type = 'Wait';
        if (_this.options.load) {
            _this.load(_this.options.load);
        } else {
            _this.time = 0;
        }
        if (_this.options.ease && typeof _this.options.ease !== 'function') {
            _this.options.easeName = _this.options.ease;
            _this.options.ease = Easing[_this.options.ease];
        }
        if (!_this.options.ease) {
            _this.options.ease = Easing['linear'];
        }
        return _this;
    }

    _createClass(wait, [{
        key: 'save',
        value: function save() {
            var save = { type: this.type, time: this.time, duration: this.duration, ease: this.options.easeName };
            var options = this.options;
            if (options.wait) {
                save.wait = options.wait;
            }
            if (typeof options.id !== 'undefined') {
                save.id = options.id;
            }
            if (options.pause) {
                save.pause = options.pause;
            }
            if (options.repeat) {
                save.repeat = options.repeat;
            }
            if (options.reverse) {
                save.reverse = options.reverse;
            }
            return save;
        }
    }, {
        key: 'load',
        value: function load(_load) {
            this.options.wait = _load.wait;
            this.options.pause = _load.pause;
            this.options.repeat = _load.repeat;
            this.options.reverse = _load.reverse;
            this.options.id = _load.id;
            this.options.ease = _load.ease;
            if (this.options.ease && typeof this.options.ease !== 'function') {
                this.options.easeName = this.options.ease;
                this.options.ease = Easing[this.options.ease];
            }
            if (!this.options.ease) {
                this.options.ease = Easing['linear'];
            }
            this.time = _load.time;
            this.duration = _load.duration;
        }

        /**
         * pause this entry
         * @type {boolean}
         */

    }, {
        key: 'end',
        value: function end(leftOver) {
            if (this.options.reverse) {
                this.reverse();
                this.time = leftOver;
                if (!this.options.repeat) {
                    if (this.options.reverse === true) {
                        this.options.reverse = false;
                    } else {
                        this.options.reverse--;
                    }
                } else {
                    if (this.options.repeat !== true) {
                        this.options.repeat--;
                    }
                }
                this.emit('loop', this.list || this.object);
            } else if (this.options.repeat) {
                this.time = leftOver;
                if (this.options.repeat !== true) {
                    this.options.repeat--;
                }
                this.emit('loop', this.list || this.object);
            } else {
                this.done();
                this.emit('done', this.list || this.object, leftOver);
                // this.list = this.object = null
                return true;
            }
        }
    }, {
        key: 'update',
        value: function update(elapsed) {
            var options = this.options;
            if (options.pause) {
                return;
            }
            if (options.wait) {
                options.wait -= elapsed;
                if (options.wait <= 0) {
                    elapsed = -options.wait;
                    options.wait = false;
                } else {
                    this.emit('wait', elapsed, this.list || this.object);
                    return;
                }
            }
            if (!this.first) {
                this.first = true;
                this.emit('first', this.list || this.object);
            }
            this.time += elapsed;
            var leftOver = 0;
            var duration = this.duration;
            var time = this.time;
            if (duration !== 0 && time > duration) {
                leftOver = time - duration;
                this.time = time = duration;
            }
            var force = this.calculate(elapsed);
            this.emit('each', elapsed, this.list || this.object, this);
            if (this.type === 'Wait' || duration !== 0 && time === duration) {
                return this.end(leftOver);
            }
            return force || time === duration;
        }

        // correct certain DOM values

    }, {
        key: '_correctDOM',
        value: function _correctDOM(key, value) {
            switch (key) {
                case 'opacity':
                    return isNaN(value) ? 1 : value;
            }
            return value;
        }
    }, {
        key: 'reverse',
        value: function reverse() {}
    }, {
        key: 'calculate',
        value: function calculate() {}
    }, {
        key: 'done',
        value: function done() {}
    }, {
        key: 'pause',
        set: function set(value) {
            this.options.pause = value;
        },
        get: function get() {
            return this.options.pause;
        }
    }]);

    return wait;
}(EventEmitter);

module.exports = wait;

},{"eventemitter3":12,"penner":13}],12:[function(require,module,exports){
'use strict';

var has = Object.prototype.hasOwnProperty
  , prefix = '~';

/**
 * Constructor to create a storage for our `EE` objects.
 * An `Events` instance is a plain object whose properties are event names.
 *
 * @constructor
 * @private
 */
function Events() {}

//
// We try to not inherit from `Object.prototype`. In some engines creating an
// instance in this way is faster than calling `Object.create(null)` directly.
// If `Object.create(null)` is not supported we prefix the event names with a
// character to make sure that the built-in object properties are not
// overridden or used as an attack vector.
//
if (Object.create) {
  Events.prototype = Object.create(null);

  //
  // This hack is needed because the `__proto__` property is still inherited in
  // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  //
  if (!new Events().__proto__) prefix = false;
}

/**
 * Representation of a single event listener.
 *
 * @param {Function} fn The listener function.
 * @param {*} context The context to invoke the listener with.
 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
 * @constructor
 * @private
 */
function EE(fn, context, once) {
  this.fn = fn;
  this.context = context;
  this.once = once || false;
}

/**
 * Add a listener for a given event.
 *
 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
 * @param {(String|Symbol)} event The event name.
 * @param {Function} fn The listener function.
 * @param {*} context The context to invoke the listener with.
 * @param {Boolean} once Specify if the listener is a one-time listener.
 * @returns {EventEmitter}
 * @private
 */
function addListener(emitter, event, fn, context, once) {
  if (typeof fn !== 'function') {
    throw new TypeError('The listener must be a function');
  }

  var listener = new EE(fn, context || emitter, once)
    , evt = prefix ? prefix + event : event;

  if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
  else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
  else emitter._events[evt] = [emitter._events[evt], listener];

  return emitter;
}

/**
 * Clear event by name.
 *
 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
 * @param {(String|Symbol)} evt The Event name.
 * @private
 */
function clearEvent(emitter, evt) {
  if (--emitter._eventsCount === 0) emitter._events = new Events();
  else delete emitter._events[evt];
}

/**
 * Minimal `EventEmitter` interface that is molded against the Node.js
 * `EventEmitter` interface.
 *
 * @constructor
 * @public
 */
function EventEmitter() {
  this._events = new Events();
  this._eventsCount = 0;
}

/**
 * Return an array listing the events for which the emitter has registered
 * listeners.
 *
 * @returns {Array}
 * @public
 */
EventEmitter.prototype.eventNames = function eventNames() {
  var names = []
    , events
    , name;

  if (this._eventsCount === 0) return names;

  for (name in (events = this._events)) {
    if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  }

  if (Object.getOwnPropertySymbols) {
    return names.concat(Object.getOwnPropertySymbols(events));
  }

  return names;
};

/**
 * Return the listeners registered for a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @returns {Array} The registered listeners.
 * @public
 */
EventEmitter.prototype.listeners = function listeners(event) {
  var evt = prefix ? prefix + event : event
    , handlers = this._events[evt];

  if (!handlers) return [];
  if (handlers.fn) return [handlers.fn];

  for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
    ee[i] = handlers[i].fn;
  }

  return ee;
};

/**
 * Return the number of listeners listening to a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @returns {Number} The number of listeners.
 * @public
 */
EventEmitter.prototype.listenerCount = function listenerCount(event) {
  var evt = prefix ? prefix + event : event
    , listeners = this._events[evt];

  if (!listeners) return 0;
  if (listeners.fn) return 1;
  return listeners.length;
};

/**
 * Calls each of the listeners registered for a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @returns {Boolean} `true` if the event had listeners, else `false`.
 * @public
 */
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  var evt = prefix ? prefix + event : event;

  if (!this._events[evt]) return false;

  var listeners = this._events[evt]
    , len = arguments.length
    , args
    , i;

  if (listeners.fn) {
    if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);

    switch (len) {
      case 1: return listeners.fn.call(listeners.context), true;
      case 2: return listeners.fn.call(listeners.context, a1), true;
      case 3: return listeners.fn.call(listeners.context, a1, a2), true;
      case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
      case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
      case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
    }

    for (i = 1, args = new Array(len -1); i < len; i++) {
      args[i - 1] = arguments[i];
    }

    listeners.fn.apply(listeners.context, args);
  } else {
    var length = listeners.length
      , j;

    for (i = 0; i < length; i++) {
      if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);

      switch (len) {
        case 1: listeners[i].fn.call(listeners[i].context); break;
        case 2: listeners[i].fn.call(listeners[i].context, a1); break;
        case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
        case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
        default:
          if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
            args[j - 1] = arguments[j];
          }

          listeners[i].fn.apply(listeners[i].context, args);
      }
    }
  }

  return true;
};

/**
 * Add a listener for a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @param {Function} fn The listener function.
 * @param {*} [context=this] The context to invoke the listener with.
 * @returns {EventEmitter} `this`.
 * @public
 */
EventEmitter.prototype.on = function on(event, fn, context) {
  return addListener(this, event, fn, context, false);
};

/**
 * Add a one-time listener for a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @param {Function} fn The listener function.
 * @param {*} [context=this] The context to invoke the listener with.
 * @returns {EventEmitter} `this`.
 * @public
 */
EventEmitter.prototype.once = function once(event, fn, context) {
  return addListener(this, event, fn, context, true);
};

/**
 * Remove the listeners of a given event.
 *
 * @param {(String|Symbol)} event The event name.
 * @param {Function} fn Only remove the listeners that match this function.
 * @param {*} context Only remove the listeners that have this context.
 * @param {Boolean} once Only remove one-time listeners.
 * @returns {EventEmitter} `this`.
 * @public
 */
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  var evt = prefix ? prefix + event : event;

  if (!this._events[evt]) return this;
  if (!fn) {
    clearEvent(this, evt);
    return this;
  }

  var listeners = this._events[evt];

  if (listeners.fn) {
    if (
      listeners.fn === fn &&
      (!once || listeners.once) &&
      (!context || listeners.context === context)
    ) {
      clearEvent(this, evt);
    }
  } else {
    for (var i = 0, events = [], length = listeners.length; i < length; i++) {
      if (
        listeners[i].fn !== fn ||
        (once && !listeners[i].once) ||
        (context && listeners[i].context !== context)
      ) {
        events.push(listeners[i]);
      }
    }

    //
    // Reset the array, or remove it completely if we have no more listeners.
    //
    if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
    else clearEvent(this, evt);
  }

  return this;
};

/**
 * Remove all listeners, or those of the specified event.
 *
 * @param {(String|Symbol)} [event] The event name.
 * @returns {EventEmitter} `this`.
 * @public
 */
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  var evt;

  if (event) {
    evt = prefix ? prefix + event : event;
    if (this._events[evt]) clearEvent(this, evt);
  } else {
    this._events = new Events();
    this._eventsCount = 0;
  }

  return this;
};

//
// Alias methods names because people roll like that.
//
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;

//
// Expose the prefix.
//
EventEmitter.prefixed = prefix;

//
// Allow `EventEmitter` to be imported as module namespace.
//
EventEmitter.EventEmitter = EventEmitter;

//
// Expose the module.
//
if ('undefined' !== typeof module) {
  module.exports = EventEmitter;
}

},{}],13:[function(require,module,exports){

/*
	Copyright © 2001 Robert Penner
	All rights reserved.

	Redistribution and use in source and binary forms, with or without modification, 
	are permitted provided that the following conditions are met:

	Redistributions of source code must retain the above copyright notice, this list of 
	conditions and the following disclaimer.
	Redistributions in binary form must reproduce the above copyright notice, this list 
	of conditions and the following disclaimer in the documentation and/or other materials 
	provided with the distribution.

	Neither the name of the author nor the names of contributors may be used to endorse 
	or promote products derived from this software without specific prior written permission.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
	EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
	MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
	GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
	AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
	NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
	OF THE POSSIBILITY OF SUCH DAMAGE.
 */

(function() {
  var penner, umd;

  umd = function(factory) {
    if (typeof exports === 'object') {
      return module.exports = factory;
    } else if (typeof define === 'function' && define.amd) {
      return define([], factory);
    } else {
      return this.penner = factory;
    }
  };

  penner = {
    linear: function(t, b, c, d) {
      return c * t / d + b;
    },
    easeInQuad: function(t, b, c, d) {
      return c * (t /= d) * t + b;
    },
    easeOutQuad: function(t, b, c, d) {
      return -c * (t /= d) * (t - 2) + b;
    },
    easeInOutQuad: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t + b;
      } else {
        return -c / 2 * ((--t) * (t - 2) - 1) + b;
      }
    },
    easeInCubic: function(t, b, c, d) {
      return c * (t /= d) * t * t + b;
    },
    easeOutCubic: function(t, b, c, d) {
      return c * ((t = t / d - 1) * t * t + 1) + b;
    },
    easeInOutCubic: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t + b;
      } else {
        return c / 2 * ((t -= 2) * t * t + 2) + b;
      }
    },
    easeInQuart: function(t, b, c, d) {
      return c * (t /= d) * t * t * t + b;
    },
    easeOutQuart: function(t, b, c, d) {
      return -c * ((t = t / d - 1) * t * t * t - 1) + b;
    },
    easeInOutQuart: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t * t + b;
      } else {
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
      }
    },
    easeInQuint: function(t, b, c, d) {
      return c * (t /= d) * t * t * t * t + b;
    },
    easeOutQuint: function(t, b, c, d) {
      return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
    },
    easeInOutQuint: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t * t * t + b;
      } else {
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
      }
    },
    easeInSine: function(t, b, c, d) {
      return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
    },
    easeOutSine: function(t, b, c, d) {
      return c * Math.sin(t / d * (Math.PI / 2)) + b;
    },
    easeInOutSine: function(t, b, c, d) {
      return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
    },
    easeInExpo: function(t, b, c, d) {
      if (t === 0) {
        return b;
      } else {
        return c * Math.pow(2, 10 * (t / d - 1)) + b;
      }
    },
    easeOutExpo: function(t, b, c, d) {
      if (t === d) {
        return b + c;
      } else {
        return c * (-Math.pow(2, -10 * t / d) + 1) + b;
      }
    },
    easeInOutExpo: function(t, b, c, d) {
      if (t === 0) {
        b;
      }
      if (t === d) {
        b + c;
      }
      if ((t /= d / 2) < 1) {
        return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
      } else {
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
      }
    },
    easeInCirc: function(t, b, c, d) {
      return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
    },
    easeOutCirc: function(t, b, c, d) {
      return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
    },
    easeInOutCirc: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
      } else {
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
      }
    },
    easeInElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d) === 1) {
        b + c;
      }
      if (!p) {
        p = d * .3;
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
    },
    easeOutElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d) === 1) {
        b + c;
      }
      if (!p) {
        p = d * .3;
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
    },
    easeInOutElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d / 2) === 2) {
        b + c;
      }
      if (!p) {
        p = d * (.3 * 1.5);
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      if (t < 1) {
        return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
      } else {
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
      }
    },
    easeInBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      return c * (t /= d) * t * ((s + 1) * t - s) + b;
    },
    easeOutBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    },
    easeInOutBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      if ((t /= d / 2) < 1) {
        return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
      } else {
        return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
      }
    },
    easeInBounce: function(t, b, c, d) {
      var v;
      v = penner.easeOutBounce(d - t, 0, c, d);
      return c - v + b;
    },
    easeOutBounce: function(t, b, c, d) {
      if ((t /= d) < 1 / 2.75) {
        return c * (7.5625 * t * t) + b;
      } else if (t < 2 / 2.75) {
        return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;
      } else if (t < 2.5 / 2.75) {
        return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;
      } else {
        return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;
      }
    },
    easeInOutBounce: function(t, b, c, d) {
      var v;
      if (t < d / 2) {
        v = penner.easeInBounce(t * 2, 0, c, d);
        return v * .5 + b;
      } else {
        v = penner.easeOutBounce(t * 2 - d, 0, c, d);
        return v * .5 + c * .5 + b;
      }
    }
  };

  umd(penner);

}).call(this);

},{}],14:[function(require,module,exports){
// A library of seedable RNGs implemented in Javascript.
//
// Usage:
//
// var seedrandom = require('seedrandom');
// var random = seedrandom(1); // or any seed.
// var x = random();       // 0 <= x < 1.  Every bit is random.
// var x = random.quick(); // 0 <= x < 1.  32 bits of randomness.

// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.
// Period: ~2^116
// Reported to pass all BigCrush tests.
var alea = require('./lib/alea');

// xor128, a pure xor-shift generator by George Marsaglia.
// Period: 2^128-1.
// Reported to fail: MatrixRank and LinearComp.
var xor128 = require('./lib/xor128');

// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.
// Period: 2^192-2^32
// Reported to fail: CollisionOver, SimpPoker, and LinearComp.
var xorwow = require('./lib/xorwow');

// xorshift7, by François Panneton and Pierre L'ecuyer, takes
// a different approach: it adds robustness by allowing more shifts
// than Marsaglia's original three.  It is a 7-shift generator
// with 256 bits, that passes BigCrush with no systmatic failures.
// Period 2^256-1.
// No systematic BigCrush failures reported.
var xorshift7 = require('./lib/xorshift7');

// xor4096, by Richard Brent, is a 4096-bit xor-shift with a
// very long period that also adds a Weyl generator. It also passes
// BigCrush with no systematic failures.  Its long period may
// be useful if you have many generators and need to avoid
// collisions.
// Period: 2^4128-2^32.
// No systematic BigCrush failures reported.
var xor4096 = require('./lib/xor4096');

// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random
// number generator derived from ChaCha, a modern stream cipher.
// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
// Period: ~2^127
// No systematic BigCrush failures reported.
var tychei = require('./lib/tychei');

// The original ARC4-based prng included in this library.
// Period: ~2^1600
var sr = require('./seedrandom');

sr.alea = alea;
sr.xor128 = xor128;
sr.xorwow = xorwow;
sr.xorshift7 = xorshift7;
sr.xor4096 = xor4096;
sr.tychei = tychei;

module.exports = sr;

},{"./lib/alea":15,"./lib/tychei":16,"./lib/xor128":17,"./lib/xor4096":18,"./lib/xorshift7":19,"./lib/xorwow":20,"./seedrandom":21}],15:[function(require,module,exports){
// A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010
// http://baagoe.com/en/RandomMusings/javascript/
// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
// Original work is under MIT license -

// Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.



(function(global, module, define) {

function Alea(seed) {
  var me = this, mash = Mash();

  me.next = function() {
    var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32
    me.s0 = me.s1;
    me.s1 = me.s2;
    return me.s2 = t - (me.c = t | 0);
  };

  // Apply the seeding algorithm from Baagoe.
  me.c = 1;
  me.s0 = mash(' ');
  me.s1 = mash(' ');
  me.s2 = mash(' ');
  me.s0 -= mash(seed);
  if (me.s0 < 0) { me.s0 += 1; }
  me.s1 -= mash(seed);
  if (me.s1 < 0) { me.s1 += 1; }
  me.s2 -= mash(seed);
  if (me.s2 < 0) { me.s2 += 1; }
  mash = null;
}

function copy(f, t) {
  t.c = f.c;
  t.s0 = f.s0;
  t.s1 = f.s1;
  t.s2 = f.s2;
  return t;
}

function impl(seed, opts) {
  var xg = new Alea(seed),
      state = opts && opts.state,
      prng = xg.next;
  prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }
  prng.double = function() {
    return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
  };
  prng.quick = prng;
  if (state) {
    if (typeof(state) == 'object') copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

function Mash() {
  var n = 0xefc8249d;

  var mash = function(data) {
    data = data.toString();
    for (var i = 0; i < data.length; i++) {
      n += data.charCodeAt(i);
      var h = 0.02519603282416938 * n;
      n = h >>> 0;
      h -= n;
      h *= n;
      n = h >>> 0;
      h -= n;
      n += h * 0x100000000; // 2^32
    }
    return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
  };

  return mash;
}


if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.alea = impl;
}

})(
  this,
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);



},{}],16:[function(require,module,exports){
// A Javascript implementaion of the "Tyche-i" prng algorithm by
// Samuel Neves and Filipe Araujo.
// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf

(function(global, module, define) {

function XorGen(seed) {
  var me = this, strseed = '';

  // Set up generator function.
  me.next = function() {
    var b = me.b, c = me.c, d = me.d, a = me.a;
    b = (b << 25) ^ (b >>> 7) ^ c;
    c = (c - d) | 0;
    d = (d << 24) ^ (d >>> 8) ^ a;
    a = (a - b) | 0;
    me.b = b = (b << 20) ^ (b >>> 12) ^ c;
    me.c = c = (c - d) | 0;
    me.d = (d << 16) ^ (c >>> 16) ^ a;
    return me.a = (a - b) | 0;
  };

  /* The following is non-inverted tyche, which has better internal
   * bit diffusion, but which is about 25% slower than tyche-i in JS.
  me.next = function() {
    var a = me.a, b = me.b, c = me.c, d = me.d;
    a = (me.a + me.b | 0) >>> 0;
    d = me.d ^ a; d = d << 16 ^ d >>> 16;
    c = me.c + d | 0;
    b = me.b ^ c; b = b << 12 ^ d >>> 20;
    me.a = a = a + b | 0;
    d = d ^ a; me.d = d = d << 8 ^ d >>> 24;
    me.c = c = c + d | 0;
    b = b ^ c;
    return me.b = (b << 7 ^ b >>> 25);
  }
  */

  me.a = 0;
  me.b = 0;
  me.c = 2654435769 | 0;
  me.d = 1367130551;

  if (seed === Math.floor(seed)) {
    // Integer seed.
    me.a = (seed / 0x100000000) | 0;
    me.b = seed | 0;
  } else {
    // String seed.
    strseed += seed;
  }

  // Mix in string seed, then discard an initial batch of 64 values.
  for (var k = 0; k < strseed.length + 20; k++) {
    me.b ^= strseed.charCodeAt(k) | 0;
    me.next();
  }
}

function copy(f, t) {
  t.a = f.a;
  t.b = f.b;
  t.c = f.c;
  t.d = f.d;
  return t;
};

function impl(seed, opts) {
  var xg = new XorGen(seed),
      state = opts && opts.state,
      prng = function() { return (xg.next() >>> 0) / 0x100000000; };
  prng.double = function() {
    do {
      var top = xg.next() >>> 11,
          bot = (xg.next() >>> 0) / 0x100000000,
          result = (top + bot) / (1 << 21);
    } while (result === 0);
    return result;
  };
  prng.int32 = xg.next;
  prng.quick = prng;
  if (state) {
    if (typeof(state) == 'object') copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.tychei = impl;
}

})(
  this,
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);



},{}],17:[function(require,module,exports){
// A Javascript implementaion of the "xor128" prng algorithm by
// George Marsaglia.  See http://www.jstatsoft.org/v08/i14/paper

(function(global, module, define) {

function XorGen(seed) {
  var me = this, strseed = '';

  me.x = 0;
  me.y = 0;
  me.z = 0;
  me.w = 0;

  // Set up generator function.
  me.next = function() {
    var t = me.x ^ (me.x << 11);
    me.x = me.y;
    me.y = me.z;
    me.z = me.w;
    return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);
  };

  if (seed === (seed | 0)) {
    // Integer seed.
    me.x = seed;
  } else {
    // String seed.
    strseed += seed;
  }

  // Mix in string seed, then discard an initial batch of 64 values.
  for (var k = 0; k < strseed.length + 64; k++) {
    me.x ^= strseed.charCodeAt(k) | 0;
    me.next();
  }
}

function copy(f, t) {
  t.x = f.x;
  t.y = f.y;
  t.z = f.z;
  t.w = f.w;
  return t;
}

function impl(seed, opts) {
  var xg = new XorGen(seed),
      state = opts && opts.state,
      prng = function() { return (xg.next() >>> 0) / 0x100000000; };
  prng.double = function() {
    do {
      var top = xg.next() >>> 11,
          bot = (xg.next() >>> 0) / 0x100000000,
          result = (top + bot) / (1 << 21);
    } while (result === 0);
    return result;
  };
  prng.int32 = xg.next;
  prng.quick = prng;
  if (state) {
    if (typeof(state) == 'object') copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.xor128 = impl;
}

})(
  this,
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);



},{}],18:[function(require,module,exports){
// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.
//
// This fast non-cryptographic random number generator is designed for
// use in Monte-Carlo algorithms. It combines a long-period xorshift
// generator with a Weyl generator, and it passes all common batteries
// of stasticial tests for randomness while consuming only a few nanoseconds
// for each prng generated.  For background on the generator, see Brent's
// paper: "Some long-period random number generators using shifts and xors."
// http://arxiv.org/pdf/1004.3115v1.pdf
//
// Usage:
//
// var xor4096 = require('xor4096');
// random = xor4096(1);                        // Seed with int32 or string.
// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.
// assert.equal(random.int32(), 1806534897);   // signed int32, 32 bits.
//
// For nonzero numeric keys, this impelementation provides a sequence
// identical to that by Brent's xorgens 3 implementaion in C.  This
// implementation also provides for initalizing the generator with
// string seeds, or for saving and restoring the state of the generator.
//
// On Chrome, this prng benchmarks about 2.1 times slower than
// Javascript's built-in Math.random().

(function(global, module, define) {

function XorGen(seed) {
  var me = this;

  // Set up generator function.
  me.next = function() {
    var w = me.w,
        X = me.X, i = me.i, t, v;
    // Update Weyl generator.
    me.w = w = (w + 0x61c88647) | 0;
    // Update xor generator.
    v = X[(i + 34) & 127];
    t = X[i = ((i + 1) & 127)];
    v ^= v << 13;
    t ^= t << 17;
    v ^= v >>> 15;
    t ^= t >>> 12;
    // Update Xor generator array state.
    v = X[i] = v ^ t;
    me.i = i;
    // Result is the combination.
    return (v + (w ^ (w >>> 16))) | 0;
  };

  function init(me, seed) {
    var t, v, i, j, w, X = [], limit = 128;
    if (seed === (seed | 0)) {
      // Numeric seeds initialize v, which is used to generates X.
      v = seed;
      seed = null;
    } else {
      // String seeds are mixed into v and X one character at a time.
      seed = seed + '\0';
      v = 0;
      limit = Math.max(limit, seed.length);
    }
    // Initialize circular array and weyl value.
    for (i = 0, j = -32; j < limit; ++j) {
      // Put the unicode characters into the array, and shuffle them.
      if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);
      // After 32 shuffles, take v as the starting w value.
      if (j === 0) w = v;
      v ^= v << 10;
      v ^= v >>> 15;
      v ^= v << 4;
      v ^= v >>> 13;
      if (j >= 0) {
        w = (w + 0x61c88647) | 0;     // Weyl.
        t = (X[j & 127] ^= (v + w));  // Combine xor and weyl to init array.
        i = (0 == t) ? i + 1 : 0;     // Count zeroes.
      }
    }
    // We have detected all zeroes; make the key nonzero.
    if (i >= 128) {
      X[(seed && seed.length || 0) & 127] = -1;
    }
    // Run the generator 512 times to further mix the state before using it.
    // Factoring this as a function slows the main generator, so it is just
    // unrolled here.  The weyl generator is not advanced while warming up.
    i = 127;
    for (j = 4 * 128; j > 0; --j) {
      v = X[(i + 34) & 127];
      t = X[i = ((i + 1) & 127)];
      v ^= v << 13;
      t ^= t << 17;
      v ^= v >>> 15;
      t ^= t >>> 12;
      X[i] = v ^ t;
    }
    // Storing state as object members is faster than using closure variables.
    me.w = w;
    me.X = X;
    me.i = i;
  }

  init(me, seed);
}

function copy(f, t) {
  t.i = f.i;
  t.w = f.w;
  t.X = f.X.slice();
  return t;
};

function impl(seed, opts) {
  if (seed == null) seed = +(new Date);
  var xg = new XorGen(seed),
      state = opts && opts.state,
      prng = function() { return (xg.next() >>> 0) / 0x100000000; };
  prng.double = function() {
    do {
      var top = xg.next() >>> 11,
          bot = (xg.next() >>> 0) / 0x100000000,
          result = (top + bot) / (1 << 21);
    } while (result === 0);
    return result;
  };
  prng.int32 = xg.next;
  prng.quick = prng;
  if (state) {
    if (state.X) copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.xor4096 = impl;
}

})(
  this,                                     // window object or global
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);

},{}],19:[function(require,module,exports){
// A Javascript implementaion of the "xorshift7" algorithm by
// François Panneton and Pierre L'ecuyer:
// "On the Xorgshift Random Number Generators"
// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf

(function(global, module, define) {

function XorGen(seed) {
  var me = this;

  // Set up generator function.
  me.next = function() {
    // Update xor generator.
    var X = me.x, i = me.i, t, v, w;
    t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);
    t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);
    t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);
    t = X[(i + 4) & 7]; v ^= t ^ (t << 7);
    t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);
    X[i] = v;
    me.i = (i + 1) & 7;
    return v;
  };

  function init(me, seed) {
    var j, w, X = [];

    if (seed === (seed | 0)) {
      // Seed state array using a 32-bit integer.
      w = X[0] = seed;
    } else {
      // Seed state using a string.
      seed = '' + seed;
      for (j = 0; j < seed.length; ++j) {
        X[j & 7] = (X[j & 7] << 15) ^
            (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);
      }
    }
    // Enforce an array length of 8, not all zeroes.
    while (X.length < 8) X.push(0);
    for (j = 0; j < 8 && X[j] === 0; ++j);
    if (j == 8) w = X[7] = -1; else w = X[j];

    me.x = X;
    me.i = 0;

    // Discard an initial 256 values.
    for (j = 256; j > 0; --j) {
      me.next();
    }
  }

  init(me, seed);
}

function copy(f, t) {
  t.x = f.x.slice();
  t.i = f.i;
  return t;
}

function impl(seed, opts) {
  if (seed == null) seed = +(new Date);
  var xg = new XorGen(seed),
      state = opts && opts.state,
      prng = function() { return (xg.next() >>> 0) / 0x100000000; };
  prng.double = function() {
    do {
      var top = xg.next() >>> 11,
          bot = (xg.next() >>> 0) / 0x100000000,
          result = (top + bot) / (1 << 21);
    } while (result === 0);
    return result;
  };
  prng.int32 = xg.next;
  prng.quick = prng;
  if (state) {
    if (state.x) copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.xorshift7 = impl;
}

})(
  this,
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);


},{}],20:[function(require,module,exports){
// A Javascript implementaion of the "xorwow" prng algorithm by
// George Marsaglia.  See http://www.jstatsoft.org/v08/i14/paper

(function(global, module, define) {

function XorGen(seed) {
  var me = this, strseed = '';

  // Set up generator function.
  me.next = function() {
    var t = (me.x ^ (me.x >>> 2));
    me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;
    return (me.d = (me.d + 362437 | 0)) +
       (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;
  };

  me.x = 0;
  me.y = 0;
  me.z = 0;
  me.w = 0;
  me.v = 0;

  if (seed === (seed | 0)) {
    // Integer seed.
    me.x = seed;
  } else {
    // String seed.
    strseed += seed;
  }

  // Mix in string seed, then discard an initial batch of 64 values.
  for (var k = 0; k < strseed.length + 64; k++) {
    me.x ^= strseed.charCodeAt(k) | 0;
    if (k == strseed.length) {
      me.d = me.x << 10 ^ me.x >>> 4;
    }
    me.next();
  }
}

function copy(f, t) {
  t.x = f.x;
  t.y = f.y;
  t.z = f.z;
  t.w = f.w;
  t.v = f.v;
  t.d = f.d;
  return t;
}

function impl(seed, opts) {
  var xg = new XorGen(seed),
      state = opts && opts.state,
      prng = function() { return (xg.next() >>> 0) / 0x100000000; };
  prng.double = function() {
    do {
      var top = xg.next() >>> 11,
          bot = (xg.next() >>> 0) / 0x100000000,
          result = (top + bot) / (1 << 21);
    } while (result === 0);
    return result;
  };
  prng.int32 = xg.next;
  prng.quick = prng;
  if (state) {
    if (typeof(state) == 'object') copy(state, xg);
    prng.state = function() { return copy(xg, {}); }
  }
  return prng;
}

if (module && module.exports) {
  module.exports = impl;
} else if (define && define.amd) {
  define(function() { return impl; });
} else {
  this.xorwow = impl;
}

})(
  this,
  (typeof module) == 'object' && module,    // present in node.js
  (typeof define) == 'function' && define   // present with an AMD loader
);



},{}],21:[function(require,module,exports){
/*
Copyright 2014 David Bau.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

(function (pool, math) {
//
// The following constants are related to IEEE 754 limits.
//
var global = this,
    width = 256,        // each RC4 output is 0 <= x < 256
    chunks = 6,         // at least six RC4 outputs for each double
    digits = 52,        // there are 52 significant digits in a double
    rngname = 'random', // rngname: name for Math.random and Math.seedrandom
    startdenom = math.pow(width, chunks),
    significance = math.pow(2, digits),
    overflow = significance * 2,
    mask = width - 1,
    nodecrypto;         // node.js crypto module, initialized at the bottom.

//
// seedrandom()
// This is the seedrandom function described above.
//
function seedrandom(seed, options, callback) {
  var key = [];
  options = (options == true) ? { entropy: true } : (options || {});

  // Flatten the seed string or build one from local entropy if needed.
  var shortseed = mixkey(flatten(
    options.entropy ? [seed, tostring(pool)] :
    (seed == null) ? autoseed() : seed, 3), key);

  // Use the seed to initialize an ARC4 generator.
  var arc4 = new ARC4(key);

  // This function returns a random double in [0, 1) that contains
  // randomness in every bit of the mantissa of the IEEE 754 value.
  var prng = function() {
    var n = arc4.g(chunks),             // Start with a numerator n < 2 ^ 48
        d = startdenom,                 //   and denominator d = 2 ^ 48.
        x = 0;                          //   and no 'extra last byte'.
    while (n < significance) {          // Fill up all significant digits by
      n = (n + x) * width;              //   shifting numerator and
      d *= width;                       //   denominator and generating a
      x = arc4.g(1);                    //   new least-significant-byte.
    }
    while (n >= overflow) {             // To avoid rounding up, before adding
      n /= 2;                           //   last byte, shift everything
      d /= 2;                           //   right using integer math until
      x >>>= 1;                         //   we have exactly the desired bits.
    }
    return (n + x) / d;                 // Form the number within [0, 1).
  };

  prng.int32 = function() { return arc4.g(4) | 0; }
  prng.quick = function() { return arc4.g(4) / 0x100000000; }
  prng.double = prng;

  // Mix the randomness into accumulated entropy.
  mixkey(tostring(arc4.S), pool);

  // Calling convention: what to return as a function of prng, seed, is_math.
  return (options.pass || callback ||
      function(prng, seed, is_math_call, state) {
        if (state) {
          // Load the arc4 state from the given state if it has an S array.
          if (state.S) { copy(state, arc4); }
          // Only provide the .state method if requested via options.state.
          prng.state = function() { return copy(arc4, {}); }
        }

        // If called as a method of Math (Math.seedrandom()), mutate
        // Math.random because that is how seedrandom.js has worked since v1.0.
        if (is_math_call) { math[rngname] = prng; return seed; }

        // Otherwise, it is a newer calling convention, so return the
        // prng directly.
        else return prng;
      })(
  prng,
  shortseed,
  'global' in options ? options.global : (this == math),
  options.state);
}
math['seed' + rngname] = seedrandom;

//
// ARC4
//
// An ARC4 implementation.  The constructor takes a key in the form of
// an array of at most (width) integers that should be 0 <= x < (width).
//
// The g(count) method returns a pseudorandom integer that concatenates
// the next (count) outputs from ARC4.  Its return value is a number x
// that is in the range 0 <= x < (width ^ count).
//
function ARC4(key) {
  var t, keylen = key.length,
      me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];

  // The empty key [] is treated as [0].
  if (!keylen) { key = [keylen++]; }

  // Set up S using the standard key scheduling algorithm.
  while (i < width) {
    s[i] = i++;
  }
  for (i = 0; i < width; i++) {
    s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
    s[j] = t;
  }

  // The "g" method returns the next (count) outputs as one number.
  (me.g = function(count) {
    // Using instance members instead of closure state nearly doubles speed.
    var t, r = 0,
        i = me.i, j = me.j, s = me.S;
    while (count--) {
      t = s[i = mask & (i + 1)];
      r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
    }
    me.i = i; me.j = j;
    return r;
    // For robust unpredictability, the function call below automatically
    // discards an initial batch of values.  This is called RC4-drop[256].
    // See http://google.com/search?q=rsa+fluhrer+response&btnI
  })(width);
}

//
// copy()
// Copies internal state of ARC4 to or from a plain object.
//
function copy(f, t) {
  t.i = f.i;
  t.j = f.j;
  t.S = f.S.slice();
  return t;
};

//
// flatten()
// Converts an object tree to nested arrays of strings.
//
function flatten(obj, depth) {
  var result = [], typ = (typeof obj), prop;
  if (depth && typ == 'object') {
    for (prop in obj) {
      try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
    }
  }
  return (result.length ? result : typ == 'string' ? obj : obj + '\0');
}

//
// mixkey()
// Mixes a string seed into a key that is an array of integers, and
// returns a shortened string seed that is equivalent to the result key.
//
function mixkey(seed, key) {
  var stringseed = seed + '', smear, j = 0;
  while (j < stringseed.length) {
    key[mask & j] =
      mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
  }
  return tostring(key);
}

//
// autoseed()
// Returns an object for autoseeding, using window.crypto and Node crypto
// module if available.
//
function autoseed() {
  try {
    var out;
    if (nodecrypto && (out = nodecrypto.randomBytes)) {
      // The use of 'out' to remember randomBytes makes tight minified code.
      out = out(width);
    } else {
      out = new Uint8Array(width);
      (global.crypto || global.msCrypto).getRandomValues(out);
    }
    return tostring(out);
  } catch (e) {
    var browser = global.navigator,
        plugins = browser && browser.plugins;
    return [+new Date, global, plugins, global.screen, tostring(pool)];
  }
}

//
// tostring()
// Converts an array of charcodes to a string
//
function tostring(a) {
  return String.fromCharCode.apply(0, a);
}

//
// When seedrandom.js is loaded, we immediately mix a few bits
// from the built-in RNG into the entropy pool.  Because we do
// not want to interfere with deterministic PRNG state later,
// seedrandom will not call math.random on its own again after
// initialization.
//
mixkey(math.random(), pool);

//
// Nodejs and AMD support: export the implementation as a module using
// either convention.
//
if ((typeof module) == 'object' && module.exports) {
  module.exports = seedrandom;
  // When in node.js, try using crypto package for autoseeding.
  try {
    nodecrypto = require('crypto');
  } catch (ex) {}
} else if ((typeof define) == 'function' && define.amd) {
  define(function() { return seedrandom; });
}

// End anonymous scope, and pass initial values.
})(
  [],     // pool: entropy pool starts empty
  Math    // math: package containing random, pow, and seedrandom
);

},{"crypto":25}],22:[function(require,module,exports){
// angle.js <https://github.com/davidfig/anglejs>
// Released under MIT license <https://github.com/davidfig/angle/blob/master/LICENSE>
// Author: David Figatner
// Copyright (c) 2016-17 YOPEY YOPEY LLC

var _toDegreeConversion = 180 / Math.PI
var _toRadianConversion = Math.PI / 180

/** @constant {number} */
var UP = Math.PI / 2
var DOWN = 3 * Math.PI / 2
var LEFT = Math.PI
var RIGHT = 0

var NORTH = UP
var SOUTH = DOWN
var WEST = LEFT
var EAST = RIGHT

var PI_2 = Math.PI * 2
var PI_QUARTER = Math.PI / 4
var PI_HALF = Math.PI / 2

/**
 * converts from radians to degrees (all other functions expect radians)
 * @param {number} radians
 * @return {number} degrees
 */
function toDegrees(radians)
{
    return radians * _toDegreeConversion
}

/**
 * converts from degrees to radians (all other functions expect radians)
 * @param {number} degrees
 * @return {number} radians
 */
function toRadians(degrees)
{
    return degrees * _toRadianConversion
}

/**
 * returns whether the target angle is between angle1 and angle2 (in radians)
 * (based on: http://stackoverflow.com/questions/11406189/determine-if-angle-lies-between-2-other-angles)
 * @param {number} target angle
 * @param {number} angle1
 * @param {number} angle2
 * @return {boolean}
 */
function isAngleBetween(target, angle1, angle2)
{
    var rAngle = ((angle2 - angle1) % PI_2 + PI_2) % PI_2
    if (rAngle >= Math.PI)
    {
        var swap = angle1
        angle1 = angle2
        angle2 = swap
    }

    if (angle1 <= angle2)
    {
        return target >= angle1 && target <= angle2
    }
    else
    {
        return target >= angle1 || target <= angle2
    }
}

/**
 * returns +1 or -1 based on whether the difference between two angles is positive or negative (in radians)
 * @param {number} target angle
 * @param {number} source angle
 * @return {number} 1 or -1
 */
function differenceAnglesSign(target, source)
{
    function mod(a, n)
    {
        return (a % n + n) % n
    }

    var a = target - source
    return mod((a + Math.PI), PI_2) - Math.PI > 0 ? 1 : -1
}

/**
 * returns the normalized difference between two angles (in radians)
 * @param {number} a - first angle
 * @param {number} b - second angle
 * @return {number} normalized difference between a and b
 */
function differenceAngles(a, b)
{
    var c = Math.abs(a - b) % PI_2
    return c > Math.PI ? (PI_2 - c) : c
}

/**
 * returns a target angle that is the shortest way to rotate an object between start and to--may choose a negative angle
 * @param {number} start
 * @param {number} to
 * @return {number} shortest target angle
 */
function shortestAngle(start, to)
{
    var difference = differenceAngles(to, start)
    var sign = differenceAnglesSign(to, start)
    var delta = difference * sign
    return delta + start
}

/**
 * returns the normalized angle (0 - PI x 2)
 * @param {number} radians
 * @return {number} normalized angle in radians
 */
function normalize(radians)
{
    return radians - PI_2 * Math.floor(radians / PI_2)
}

/**
 * returns angle between two points (in radians)
 * @param {Point} [point1] {x: x, y: y}
 * @param {Point} [point2] {x: x, y: y}
 * @param {number} [x1]
 * @param {number} [y1]
 * @param {number} [x2]
 * @param {number} [y2]
 * @return {number} angle
 */
function angleTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */)
{
    if (arguments.length === 4)
    {
        return Math.atan2(arguments[3] - arguments[1], arguments[2] - arguments[0])
    }
    else
    {
        return Math.atan2(arguments[1].y - arguments[0].y, arguments[1].x - arguments[0].x)
    }
}

/**
 * returns distance between two points
 * @param {Point} [point1] {x: x, y: y}
 * @param {Point} [point2] {x: x, y: y}
 * @param {number} [x1]
 * @param {number} [y1]
 * @param {number} [x2]
 * @param {number} [y2]
 * @return {number} distance
 */
function distanceTwoPoints(/* (point1, point2) OR (x1, y1, x2, y2) */)
{
    if (arguments.length === 2)
    {
        return Math.sqrt(Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2))
    }
    else
    {
        return Math.sqrt(Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2))
    }
}

/**
 * returns the squared distance between two points
 * @param {Point} [point1] {x: x, y: y}
 * @param {Point} [point2] {x: x, y: y}
 * @param {number} [x1]
 * @param {number} [y1]
 * @param {number} [x2]
 * @param {number} [y2]
 * @return {number} squared distance
 */
function distanceTwoPointsSquared(/* (point1, point2) OR (x1, y1, x2, y2) */)
{
    if (arguments.length === 2)
    {
        return Math.pow(arguments[1].x - arguments[0].x, 2) + Math.pow(arguments[1].y - arguments[0].y, 2)
    }
    else
    {
        return Math.pow(arguments[2] - arguments[0], 2) + Math.pow(arguments[3] - arguments[1], 2)
    }
}

/**
 * returns the closest cardinal (N, S, E, W) to the given angle (in radians)
 * @param {number} angle
 * @return {number} closest cardinal in radians
 */
function closestAngle(angle)
{
    var left = differenceAngles(angle, LEFT)
    var right = differenceAngles(angle, RIGHT)
    var up = differenceAngles(angle, UP)
    var down = differenceAngles(angle, DOWN)
    if (left <= right && left <= up && left <= down)
    {
        return LEFT
    }
    else if (right <= up && right <= down)
    {
        return RIGHT
    }
    else if (up <= down)
    {
        return UP
    }
    else
    {
        return DOWN
    }
}

/**
 * checks whether angles a1 and a2 are equal (after normalizing)
 * @param {number} a1
 * @param {number} a2
 * @param {number} [wiggle] return true if the difference between the angles is <= wiggle
 * @return {boolean} a1 === a2
 */
function equals(a1, a2, wiggle)
{
    if (wiggle)
    {
        return differenceAngles(a1, a2) < wiggle
    }
    else
    {
        return normalize(a1) === normalize(a2)
    }
}

/**
 * return a text representation of the cardinal direction
 * @param {number} angle
 * @returns {string} UP, DOWN, LEFT, RIGHT, or NOT CARDINAL
 */
function explain(angle)
{
    switch (angle)
    {
        case UP: return 'UP'
        case DOWN: return 'DOWN'
        case LEFT: return 'LEFT'
        case RIGHT: return 'RIGHT'
        default: return 'NOT CARDINAL'
    }
}

module.exports = {
    UP: UP,
    DOWN: DOWN,
    LEFT: LEFT,
    RIGHT: RIGHT,
    NORTH: NORTH,
    SOUTH: SOUTH,
    WEST: WEST,
    EAST: EAST,
    PI_2: PI_2,
    PI_QUARTER: PI_QUARTER,
    PI_HALF: PI_HALF,

    toDegrees: toDegrees,
    toRadians: toRadians,
    isAngleBetween: isAngleBetween,
    differenceAnglesSign: differenceAnglesSign,
    differenceAngles: differenceAngles,
    shortestAngle: shortestAngle,
    normalize: normalize,
    angleTwoPoints: angleTwoPoints,
    distanceTwoPoints: distanceTwoPoints,
    distanceTwoPointsSquared: distanceTwoPointsSquared,
    closestAngle: closestAngle,
    equals: equals,
    explain: explain
}
},{}],23:[function(require,module,exports){
// yy-color
// by David Figatner
// MIT License
// (c) YOPEY YOPEY LLC 2017
// https://github.com/davidfig/color

var Random = require('yy-random')

/**
 * converts a #FFFFFF to 0x123456
 * @param  {string} color
 * @return {string}
 */
function poundToHex(color)
{
    return '0x' + parseInt(color.substr(1)).toString(16)
}

/**
 * converts a 0x123456 to #FFFFFF
 * @param  {string} color
 * @return {string}
 */
function hexToPound(color)
{
    return '#' + color.substr(2)
}

/**
 * converts a number to #FFFFFF
 * @param  {number} color
 * @return {string}
 */
function valueToPound(color)
{
    return '#' + color.toString(16)
}

/**
 * based on tinycolor
 * https://github.com/bgrins/TinyColor
 * BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE
 * @param {string} color
 * @returns {object}
 */
function hexToHsl (color)
{
    var rgb = this.hexToRgb(color),
        r = rgb.r,
        g = rgb.g,
        b = rgb.b
    var max = Math.max(r, g, b),
        min = Math.min(r, g, b)
    var h, s, l = (max + min) / 2

    if (max === min)
    {
        h = s = 0 // achromatic
    }
    else
    {
        var d = max - min
        s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
        switch (max)
        {
            case r: h = (g - b) / d + (g < b ? 6 : 0); break
            case g: h = (b - r) / d + 2; break
            case b: h = (r - g) / d + 4; break
        }

        h /= 6
    }

    return { h: h, s: s, l: l }
}

/** based on tinycolor
* https://github.com/bgrins/TinyColor
* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE
* @param {object|number} color {h, s, b} or h
* @param {number} [s]
* @param {number} [l]
* @returns number
*/
function hslToHex(color)
{
    var r, g, b, h, s, l
    if (arguments.length === 1)
    {
        h = color.h,
        s = color.s,
        l = color.l
    }
    else
    {
        h = arguments[0]
        s = arguments[1]
        l = arguments[2]
    }

    function hue2rgb(p, q, t) {
        if (t < 0) t += 1
        if (t > 1) t -= 1
        if (t < 1/6) return p + (q - p) * 6 * t
        if (t < 1/2) return q
        if (t < 2/3) return p + (q - p) * (2/3 - t) * 6
        return p
    }

    if (s === 0)
    {
        r = g = b = l // achromatic
    }
    else
    {
        var q = l < 0.5 ? l * (1 + s) : l + s - l * s
        var p = 2 * l - q
        r = hue2rgb(p, q, h + 1/3)
        g = hue2rgb(p, q, h)
        b = hue2rgb(p, q, h - 1/3)
    }

    return this.rgbToHex(r * 255, g * 255, b * 255)
}

/* darkens a color by the percentage
* @param {object} color in hex (0xabcdef)
* @param {number} amount
* @return {number}
*/
function darken(color, amount)
{
    return this.blend(amount, color, 0)
}

/** based on tinycolor
* https://github.com/bgrins/TinyColor
* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE
* @param {object} color
* @param {number} amount
*/
function saturate(color, amount)
{
    amount = (amount === 0) ? 0 : (amount || 10)
    var hsl = this.hexToHsl(color)
    hsl.s += amount / 100
    hsl.s = Math.min(1, Math.max(0, hsl.s))
    return this.hslToHex(hsl)
}

/** based on tinycolor
* https://github.com/bgrins/TinyColor
* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE
* @param {object} color
* @param {number} amount
*/
function desaturate(color, amount)
{
    amount = (amount === 0) ? 0 : (amount || 10)
    var hsl = this.hexToHsl(color)
    hsl.s -= amount / 100
    hsl.s = Math.min(1, Math.max(0, hsl.s))
    return this.hslToHex(hsl)
}

/**
 * blends two colors together
 * @param  {number} percent [0.0 - 1.0]
 * @param  {string} color1 first color in 0x123456 format
 * @param  {string} color2 second color in 0x123456 format
 * @return {number}
 */
function blend(percent, color1, color2)
{
    if (percent === 0)
    {
        return color1
    }
    if (percent === 1)
    {
        return color2
    }
    var r1 = color1 >> 16
    var g1 = color1 >> 8 & 0x0000ff
    var b1 = color1 & 0x0000ff
    var r2 = color2 >> 16
    var g2 = color2 >> 8 & 0x0000ff
    var b2 = color2 & 0x0000ff
    var percent1 = 1 - percent
    var r = percent1 * r1 + percent * r2
    var g = percent1 * g1 + percent * g2
    var b = percent1 * b1 + percent * b2
    return r << 16 | g << 8 | b
}

/**
 * returns a hex color into an rgb value
 * @param  {number} hex
 * @return {string}
 */
function hexToRgb(hex)
{
    if (hex === 0)
    {
        hex = '0x000000'
    }
    else if (typeof hex !== 'string')
    {
        var s = '000000' + hex.toString(16)
        hex = '0x' + s.substr(s.length - 6)
    }
    var result = /^0x?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
    return result ? {
        r: parseInt(result[1], 16),
        g: parseInt(result[2], 16),
        b: parseInt(result[3], 16)
    } : null
}

/**
 * rgb color to hex in the form of 0x123456
 * @param  {(number|string)} r first number or 'rgb(...)' string
 * @param  {(number|null)} g
 * @param  {(number|null)} b
 * @return {string}
 */
function rgbToHex(r, g, b)
{
    if (arguments.length === 1) {
        if (Array.isArray(arguments[0])) {
            var number = arguments[0]
            r = number[0]
            g = number[1]
            b = number[2]
        } else {
            var parse = r.replace(/( *rgb *\( *)|( )|(\) *;?)/,'')
            var numbers = parse.split(',')
            r = numbers[0]
            g = numbers[1]
            b = numbers[2]
        }
    }
    return '0x' + ((1 << 24) + (parseInt(r) << 16) + (parseInt(g) << 8) + parseInt(b)).toString(16).slice(1)
}

/**
 * returns a random color with balanced r, g, b values (i.e., r, g, b either have the same value or are 0)
 * @param {number} min value for random number
 * @param {number} max value for random number
 * @return {number} color
 */
function random(min, max)
{
    function random()
    {
        return Random.range(min, max)
    }

    var colors = [{r:1, g:1, b:1}, {r:1, g:1, b:0}, {r:1,g:0,b:1}, {r:0,g:1,b:1}, {r:1,g:0,b:0}, {r:0,g:1,b:0}, {r:0,g:0,b:1}]
    var color = Random.pick(colors)
    min = min || 0
    max = max || 255
    return this.rgbToHex(color.r ? random() : 0, color.g ? random() : 0, color.b ? random() : 0)
}

// h: 0-360, s: 0-1, l: 0-1
/**
 * returns a random color based on hsl
 * @param {number} hMin [0, 360]
 * @param {number} hMax [hMin, 360]
 * @param {number} sMin [0, 1]
 * @param {number} sMax [sMin, 1]
 * @param {number} lMin [0, 1]
 * @param {number} lMax [lMin, 1]
 */
function randomHSL(hMin, hMax, sMin, sMax, lMin, lMax)
{
    var color = {
        h: Random.range(hMin, hMax),
        s: Random.range(sMin, sMax, true),
        l: Random.range(lMin, lMax, true)
    }
    return this.hslToHex(color)
}

/**
 * returns random colors based on HSL with different hues
 * based on http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
 * @returns {number[]} colors in hex format (0x123456)
 */
function randomGoldenRatioHSL(count, saturation, luminosity)
{
    var goldenRatio = 0.618033988749895
    var h = Random.get(1, true)
    var colors = []
    for (var i = 0; i < count; i++)
    {
        colors.push(this.hslToHex(h, saturation, luminosity))
        h = (h + goldenRatio) % 1
    }
    return colors
}

module.exports = {
    poundToHex: poundToHex,
    hexToPound: hexToPound,
    valueToPound: valueToPound,
    hexToHsl: hexToHsl,
    hslToHex: hslToHex,
    hexToRgb: hexToRgb,
    rgbToHex: rgbToHex,
    darken: darken,
    saturate: saturate,
    desaturate: desaturate,
    blend: blend,
    random: random,
    randomHSL: randomHSL,
    randomGoldenRatioHSL: randomGoldenRatioHSL
}
},{"yy-random":24}],24:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

// yy-random
// by David Figatner
// MIT license
// copyright YOPEY YOPEY LLC 2016-17
// https://github.com/davidfig/random

var seedrandom = require('seedrandom');

var Random = function () {
    function Random() {
        _classCallCheck(this, Random);

        this.generator = Math.random;
    }

    /**
     * generates a seeded number
     * @param {number} seed
     * @param {object} [options]
     * @param {string} [PRNG="alea"] - name of algorithm, see https://github.com/davidbau/seedrandom
     * @param {boolean} [save=true]
     */


    _createClass(Random, [{
        key: 'seed',
        value: function seed(_seed, options) {
            options = options || {};
            this.generator = seedrandom[options.PRNG || 'alea'](_seed, { state: options.state });
            this.options = options;
        }

        /**
         * saves the state of the random generator
         * can only be used after Random.seed() is called
         * @returns {number} state
         */

    }, {
        key: 'save',
        value: function save() {
            if (this.generator !== Math.random) {
                return this.generator.state();
            }
        }

        /**
         * restores the state of the random generator
         * @param {number} state
         */

    }, {
        key: 'restore',
        value: function restore(state) {
            this.generator = seedrandom[this.options.PRNG || 'alea']('', { state: state });
        }

        /**
         * changes the generator to use the old Math.sin-based random function
         * based on : http://stackoverflow.com/questions/521295/javascript-random-seeds
         * (deprecated) Use only for compatibility purposes
         * @param {number} seed
         */

    }, {
        key: 'seedOld',
        value: function seedOld(seed) {
            this.generator = function () {
                var x = Math.sin(seed++) * 10000;
                return x - Math.floor(x);
            };
        }

        /**
         * create a separate random generator using the seed
         * @param {number} seed
         * @return {object}
         */

    }, {
        key: 'separateSeed',
        value: function separateSeed(seed) {
            var random = new Random();
            random.seed(seed);
            return random;
        }

        /**
         * resets the random number this.generator to Math.random()
         */

    }, {
        key: 'reset',
        value: function reset() {
            this.generator = Math.random;
        }

        /**
         * returns a random number using the this.generator between [0, ceiling - 1]
         * @param {number} ceiling
         * @param {boolean} [useFloat=false]
         * @return {number}
         */

    }, {
        key: 'get',
        value: function get(ceiling, useFloat) {
            var negative = ceiling < 0 ? -1 : 1;
            ceiling *= negative;
            var result = void 0;
            if (useFloat) {
                result = this.generator() * ceiling;
            } else {
                result = Math.floor(this.generator() * ceiling);
            }
            return result * negative;
        }

        /**
         * returns a random integer between 0 - Number.MAX_SAFE_INTEGER
         * @return {number}
         */

    }, {
        key: 'getHuge',
        value: function getHuge() {
            return this.get(Number.MAX_SAFE_INTEGER);
        }

        /**
         * random number [middle - range, middle + range]
         * @param {number} middle
         * @param {number} delta
         * @param {boolean} [useFloat=false]
         * @return {number}
         */

    }, {
        key: 'middle',
        value: function middle(_middle, delta, useFloat) {
            var half = delta / 2;
            return this.range(_middle - half, _middle + half, useFloat);
        }

        /**
         * random number [start, end]
         * @param {number} start
         * @param {number} end
         * @param {boolean} [useFloat=false] if true, then range is (start, end)--i.e., not inclusive to start and end
         * @return {number}
         */

    }, {
        key: 'range',
        value: function range(start, end, useFloat) {
            // case where there is no range
            if (end === start) {
                return end;
            }

            if (useFloat) {
                return this.get(end - start, true) + start;
            } else {
                var range = void 0;
                if (start < 0 && end > 0) {
                    range = -start + end + 1;
                } else if (start === 0 && end > 0) {
                    range = end + 1;
                } else if (start < 0 && end === 0) {
                    range = start - 1;
                    start = 1;
                } else if (start < 0 && end < 0) {
                    range = end - start - 1;
                } else {
                    range = end - start + 1;
                }
                return Math.floor(this.generator() * range) + start;
            }
        }

        /**
         * an array of random numbers between [start, end]
         * @param {number} start
         * @param {number} end
         * @param {number} count
         * @param {boolean} [useFloat=false]
         * @return {number[]}
         */

    }, {
        key: 'rangeMultiple',
        value: function rangeMultiple(start, end, count, useFloat) {
            var array = [];
            for (var i = 0; i < count; i++) {
                array.push(this.range(start, end, useFloat));
            }
            return array;
        }

        /**
         * an array of random numbers between [middle - range, middle + range]
         * @param {number} middle
         * @param {number} range
         * @param {number} count
         * @param {boolean} [useFloat=false]
         * @return {number[]}
         */

    }, {
        key: 'middleMultiple',
        value: function middleMultiple(middle, range, count, useFloat) {
            var array = [];
            for (var i = 0; i < count; i++) {
                array.push(middle(middle, range, useFloat));
            }
            return array;
        }

        /**
         * @param {number} [chance=0.5]
         * returns random sign (either +1 or -1)
         * @return {number}
         */

    }, {
        key: 'sign',
        value: function sign(chance) {
            chance = chance || 0.5;
            return this.generator() < chance ? 1 : -1;
        }

        /**
         * tells you whether a random chance was achieved
         * @param {number} [percent=0.5]
         * @return {boolean}
         */

    }, {
        key: 'chance',
        value: function chance(percent) {
            return this.generator() < (percent || 0.5);
        }

        /**
         * returns a random angle in radians [0 - 2 * Math.PI)
         */

    }, {
        key: 'angle',
        value: function angle() {
            return this.get(Math.PI * 2, true);
        }

        /**
         * Shuffle array (either in place or copied)
         * from http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
         * @param {Array} array
         * @param {boolean} [copy=false] whether to shuffle in place (default) or return a new shuffled array
         * @return {Array} a shuffled array
         */

    }, {
        key: 'shuffle',
        value: function shuffle(array, copy) {
            if (copy) {
                array = array.slice();
            }
            if (array.length === 0) {
                return array;
            }

            var currentIndex = array.length,
                temporaryValue = void 0,
                randomIndex = void 0;

            // While there remain elements to shuffle...
            while (0 !== currentIndex) {
                // Pick a remaining element...
                randomIndex = this.get(currentIndex);
                currentIndex -= 1;

                // And swap it with the current element.
                temporaryValue = array[currentIndex];
                array[currentIndex] = array[randomIndex];
                array[randomIndex] = temporaryValue;
            }
            return array;
        }

        /**
         * picks a random element from an array
         * @param {Array} array
         * @return {*}
         */

    }, {
        key: 'pick',
        value: function pick(array, remove) {
            if (!remove) {
                return array[this.get(array.length)];
            } else {
                var pick = this.get(array.length);
                var temp = array[pick];
                array.splice(pick, 1);
                return temp;
            }
        }

        /**
         * returns a random property from an object
         * from http://stackoverflow.com/questions/2532218/pick-random-property-from-a-javascript-object
         * @param {object} obj
         * @return {*}
         */

    }, {
        key: 'property',
        value: function property(obj) {
            var result;
            var count = 0;
            for (var prop in obj) {
                if (this.chance(1 / ++count)) {
                    result = prop;
                }
            }
            return result;
        }

        /**
         * creates a random set where each entry is a value between [min, max]
         * @param {number} min
         * @param {number} max
         * @param {number} amount of numbers in set
         * @param {number[]}
         */

    }, {
        key: 'set',
        value: function set(min, max, amount) {
            var set = [],
                all = [],
                i;
            for (i = min; i < max; i++) {
                all.push(i);
            }

            for (i = 0; i < amount; i++) {
                var found = this.get(all.length);
                set.push(all[found]);
                all.splice(found, 1);
            }
            return set;
        }

        /**
         * returns a set of numbers with a randomly even distribution (i.e., no overlapping and filling the space)
         * @param {number} start position
         * @param {number} end position
         * @param {number} count of non-start/end points
         * @param {boolean} [includeStart=false] includes start point (count++)
         * @param {boolean} [includeEnd=false] includes end point (count++)
         * @param {boolean} [useFloat=false]
         * @param {number[]}
         */

    }, {
        key: 'distribution',
        value: function distribution(start, end, count, includeStart, includeEnd, useFloat) {
            var interval = Math.floor((end - start) / count);
            var halfInterval = interval / 2;
            var quarterInterval = interval / 4;
            var set = [];
            if (includeStart) {
                set.push(start);
            }
            for (var i = 0; i < count; i++) {
                set.push(start + i * interval + halfInterval + this.range(-quarterInterval, quarterInterval, useFloat));
            }
            if (includeEnd) {
                set.push(end);
            }
            return set;
        }

        /**
         * returns a random number based on weighted probability between [min, max]
         * from http://stackoverflow.com/questions/22656126/javascript-random-number-with-weighted-probability
         * @param {number} min value
         * @param {number} max value
         * @param {number} target for average value
         * @param {number} stddev - standard deviation
         */

    }, {
        key: 'weightedProbabilityInt',
        value: function weightedProbabilityInt(min, max, target, stddev) {
            function normRand() {
                var x1 = void 0,
                    x2 = void 0,
                    rad = void 0;
                do {
                    x1 = 2 * this.get(1, true) - 1;
                    x2 = 2 * this.get(1, true) - 1;
                    rad = x1 * x1 + x2 * x2;
                } while (rad >= 1 || rad === 0);
                var c = Math.sqrt(-2 * Math.log(rad) / rad);
                return x1 * c;
            }

            stddev = stddev || 1;
            if (Math.random() < 0.81546) {
                while (true) {
                    var sample = normRand() * stddev + target;
                    if (sample >= min && sample <= max) {
                        return sample;
                    }
                }
            } else {
                return this.range(min, max);
            }
        }

        /*
         * returns a random hex color (0 - 0xffffff)
         * @return {number}
         */

    }, {
        key: 'color',
        value: function color() {
            return this.get(0xffffff);
        }
    }]);

    return Random;
}();

module.exports = new Random();

},{"seedrandom":14}],25:[function(require,module,exports){

},{}]},{},[3]);

(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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var utils = require('./utils');
var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Bounce, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {string} [options.sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right')
     * @param {number} [options.friction=0.5] friction to apply to decelerate if active
     * @param {number} [options.time=150] time in ms to finish bounce
     * @param {string|function} [ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
     * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
     * @fires bounce-start-x
     * @fires bounce.end-x
     * @fires bounce-start-y
     * @fires bounce-end-y
     */
    function Bounce(parent, options) {
        _classCallCheck(this, Bounce);

        var _this = _possibleConstructorReturn(this, (Bounce.__proto__ || Object.getPrototypeOf(Bounce)).call(this, parent));

        options = options || {};
        _this.time = options.time || 150;
        _this.ease = utils.ease(options.ease, 'easeInOutSine');
        _this.friction = options.friction || 0.5;
        options.sides = options.sides || 'all';
        if (options.sides) {
            if (options.sides === 'all') {
                _this.top = _this.bottom = _this.left = _this.right = true;
            } else if (options.sides === 'horizontal') {
                _this.right = _this.left = true;
            } else if (options.sides === 'vertical') {
                _this.top = _this.bottom = true;
            } else {
                _this.top = options.sides.indexOf('top') !== -1;
                _this.bottom = options.sides.indexOf('bottom') !== -1;
                _this.left = options.sides.indexOf('left') !== -1;
                _this.right = options.sides.indexOf('right') !== -1;
            }
        }
        _this.parseUnderflow(options.underflow || 'center');
        _this.last = {};
        return _this;
    }

    _createClass(Bounce, [{
        key: 'parseUnderflow',
        value: function parseUnderflow(clamp) {
            clamp = clamp.toLowerCase();
            if (clamp === 'center') {
                this.underflowX = 0;
                this.underflowY = 0;
            } else {
                this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0;
                this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0;
            }
        }
    }, {
        key: 'down',
        value: function down() {
            this.toX = this.toY = null;
        }
    }, {
        key: 'up',
        value: function up() {
            this.bounce();
        }
    }, {
        key: 'update',
        value: function update(elapsed) {
            if (this.paused) {
                return;
            }

            this.bounce();
            if (this.toX) {
                var toX = this.toX;
                toX.time += elapsed;
                this.parent.emit('moved', { viewport: this.parent, type: 'bounce-x' });
                if (toX.time >= this.time) {
                    this.parent.x = toX.end;
                    this.toX = null;
                    this.parent.emit('bounce-x-end', this.parent);
                } else {
                    this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.time);
                }
                this.parent.dirty = true;
            }
            if (this.toY) {
                var toY = this.toY;
                toY.time += elapsed;
                this.parent.emit('moved', { viewport: this.parent, type: 'bounce-y' });
                if (toY.time >= this.time) {
                    this.parent.y = toY.end;
                    this.toY = null;
                    this.parent.emit('bounce-y-end', this.parent);
                } else {
                    this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.time);
                }
                this.parent.dirty = true;
            }
        }
    }, {
        key: 'calcUnderflowX',
        value: function calcUnderflowX() {
            var x = void 0;
            switch (this.underflowX) {
                case -1:
                    x = 0;
                    break;
                case 1:
                    x = this.parent.screenWidth - this.parent.screenWorldWidth;
                    break;
                default:
                    x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;
            }
            return x;
        }
    }, {
        key: 'calcUnderflowY',
        value: function calcUnderflowY() {
            var y = void 0;
            switch (this.underflowY) {
                case -1:
                    y = 0;
                    break;
                case 1:
                    y = this.parent.screenHeight - this.parent.screenWorldHeight;
                    break;
                default:
                    y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;
            }
            return y;
        }
    }, {
        key: 'bounce',
        value: function bounce() {
            if (this.paused) {
                return;
            }

            var oob = void 0;
            var decelerate = this.parent.plugins['decelerate'];
            if (decelerate && (decelerate.x || decelerate.y)) {
                if (decelerate.x && decelerate.percentChangeX === decelerate.friction || decelerate.y && decelerate.percentChangeY === decelerate.friction) {
                    oob = this.parent.OOB();
                    if (oob.left && this.left || oob.right && this.right) {
                        decelerate.percentChangeX = this.friction;
                    }
                    if (oob.top && this.top || oob.bottom && this.bottom) {
                        decelerate.percentChangeY = this.friction;
                    }
                }
            }
            var drag = this.parent.plugins['drag'] || {};
            var pinch = this.parent.plugins['pinch'] || {};
            decelerate = decelerate || {};
            if (!drag.active && !pinch.active && (!this.toX || !this.toY) && (!decelerate.x || !decelerate.y)) {
                oob = oob || this.parent.OOB();
                var point = oob.cornerPoint;
                if (!this.toX && !decelerate.x) {
                    var x = null;
                    if (oob.left && this.left) {
                        x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : 0;
                    } else if (oob.right && this.right) {
                        x = this.parent.screenWorldWidth < this.parent.screenWidth ? this.calcUnderflowX() : -point.x;
                    }
                    if (x !== null && this.parent.x !== x) {
                        this.toX = { time: 0, start: this.parent.x, delta: x - this.parent.x, end: x };
                        this.parent.emit('bounce-x-start', this.parent);
                    }
                }
                if (!this.toY && !decelerate.y) {
                    var y = null;
                    if (oob.top && this.top) {
                        y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : 0;
                    } else if (oob.bottom && this.bottom) {
                        y = this.parent.screenWorldHeight < this.parent.screenHeight ? this.calcUnderflowY() : -point.y;
                    }
                    if (y !== null && this.parent.y !== y) {
                        this.toY = { time: 0, start: this.parent.y, delta: y - this.parent.y, end: y };
                        this.parent.emit('bounce-y-start', this.parent);
                    }
                }
            }
        }
    }, {
        key: 'reset',
        value: function reset() {
            this.toX = this.toY = null;
        }
    }]);

    return Bounce;
}(Plugin);

},{"./plugin":9,"./utils":12}],2:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(ClampZoom, _Plugin);

    /**
     * @private
     * @param {object} [options]
     * @param {number} [options.minWidth] minimum width
     * @param {number} [options.minHeight] minimum height
     * @param {number} [options.maxWidth] maximum width
     * @param {number} [options.maxHeight] maximum height
     */
    function ClampZoom(parent, options) {
        _classCallCheck(this, ClampZoom);

        var _this = _possibleConstructorReturn(this, (ClampZoom.__proto__ || Object.getPrototypeOf(ClampZoom)).call(this, parent));

        _this.minWidth = options.minWidth;
        _this.minHeight = options.minHeight;
        _this.maxWidth = options.maxWidth;
        _this.maxHeight = options.maxHeight;
        return _this;
    }

    _createClass(ClampZoom, [{
        key: 'resize',
        value: function resize() {
            this.clamp();
        }
    }, {
        key: 'clamp',
        value: function clamp() {
            if (this.paused) {
                return;
            }

            var width = this.parent.worldScreenWidth;
            var height = this.parent.worldScreenHeight;
            if (this.minWidth && width < this.minWidth) {
                this.parent.fitWidth(this.minWidth);
                width = this.parent.worldScreenWidth;
                height = this.parent.worldScreenHeight;
                this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });
            }
            if (this.maxWidth && width > this.maxWidth) {
                this.parent.fitWidth(this.maxWidth);
                width = this.parent.worldScreenWidth;
                height = this.parent.worldScreenHeight;
                this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });
            }
            if (this.minHeight && height < this.minHeight) {
                this.parent.fitHeight(this.minHeight);
                width = this.parent.worldScreenWidth;
                height = this.parent.worldScreenHeight;
                this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });
            }
            if (this.maxHeight && height > this.maxHeight) {
                this.parent.fitHeight(this.maxHeight);
                this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });
            }
        }
    }]);

    return ClampZoom;
}(Plugin);

},{"./plugin":9}],3:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');
var utils = require('./utils');

module.exports = function (_Plugin) {
    _inherits(clamp, _Plugin);

    /**
     * @private
     * @param {object} options
     * @param {(number|boolean)} [options.left] clamp left; true=0
     * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth
     * @param {(number|boolean)} [options.top] clamp top; true=0
     * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight
     * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set
     * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
     */
    function clamp(parent, options) {
        _classCallCheck(this, clamp);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (clamp.__proto__ || Object.getPrototypeOf(clamp)).call(this, parent));

        if (typeof options.direction === 'undefined') {
            _this.left = utils.defaults(options.left, null);
            _this.right = utils.defaults(options.right, null);
            _this.top = utils.defaults(options.top, null);
            _this.bottom = utils.defaults(options.bottom, null);
        } else {
            _this.left = options.direction === 'x' || options.direction === 'all';
            _this.right = options.direction === 'x' || options.direction === 'all';
            _this.top = options.direction === 'y' || options.direction === 'all';
            _this.bottom = options.direction === 'y' || options.direction === 'all';
        }
        _this.parseUnderflow(options.underflow || 'center');
        _this.move();
        return _this;
    }

    _createClass(clamp, [{
        key: 'parseUnderflow',
        value: function parseUnderflow(clamp) {
            clamp = clamp.toLowerCase();
            if (clamp === 'center') {
                this.underflowX = 0;
                this.underflowY = 0;
            } else {
                this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0;
                this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0;
            }
        }
    }, {
        key: 'move',
        value: function move() {
            this.update();
        }
    }, {
        key: 'update',
        value: function update() {
            if (this.paused) {
                return;
            }

            var decelerate = this.parent.plugins['decelerate'] || {};
            if (this.left !== null || this.right !== null) {
                var moved = void 0;
                if (this.parent.screenWorldWidth < this.parent.screenWidth) {
                    switch (this.underflowX) {
                        case -1:
                            if (this.parent.x !== 0) {
                                this.parent.x = 0;
                                moved = true;
                            }
                            break;
                        case 1:
                            if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth) {
                                this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth;
                                moved = true;
                            }
                            break;
                        default:
                            if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2) {
                                this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;
                                moved = true;
                            }
                    }
                } else {
                    if (this.left !== null) {
                        if (this.parent.left < (this.left === true ? 0 : this.left)) {
                            this.parent.x = -(this.left === true ? 0 : this.left) * this.parent.scale.x;
                            decelerate.x = 0;
                            moved = true;
                        }
                    }
                    if (this.right !== null) {
                        if (this.parent.right > (this.right === true ? this.parent.worldWidth : this.right)) {
                            this.parent.x = -(this.right === true ? this.parent.worldWidth : this.right) * this.parent.scale.x + this.parent.screenWidth;
                            decelerate.x = 0;
                            moved = true;
                        }
                    }
                }
                if (moved) {
                    this.parent.emit('moved', { viewport: this.parent, type: 'clamp-x' });
                }
            }
            if (this.top !== null || this.bottom !== null) {
                var _moved = void 0;
                if (this.parent.screenWorldHeight < this.parent.screenHeight) {
                    switch (this.underflowY) {
                        case -1:
                            if (this.parent.y !== 0) {
                                this.parent.y = 0;
                                _moved = true;
                            }
                            break;
                        case 1:
                            if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight) {
                                this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight;
                                _moved = true;
                            }
                            break;
                        default:
                            if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2) {
                                this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;
                                _moved = true;
                            }
                    }
                } else {
                    if (this.top !== null) {
                        if (this.parent.top < (this.top === true ? 0 : this.top)) {
                            this.parent.y = -(this.top === true ? 0 : this.top) * this.parent.scale.y;
                            decelerate.y = 0;
                            _moved = true;
                        }
                    }
                    if (this.bottom !== null) {
                        if (this.parent.bottom > (this.bottom === true ? this.parent.worldHeight : this.bottom)) {
                            this.parent.y = -(this.bottom === true ? this.parent.worldHeight : this.bottom) * this.parent.scale.y + this.parent.screenHeight;
                            decelerate.y = 0;
                            _moved = true;
                        }
                    }
                }
                if (_moved) {
                    this.parent.emit('moved', { viewport: this.parent, type: 'clamp-y' });
                }
            }
        }
    }]);

    return clamp;
}(Plugin);

},{"./plugin":9,"./utils":12}],4:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var utils = require('./utils');
var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Decelerate, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {number} [options.friction=0.95] percent to decelerate after movement
     * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active)
     * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration
     */
    function Decelerate(parent, options) {
        _classCallCheck(this, Decelerate);

        var _this = _possibleConstructorReturn(this, (Decelerate.__proto__ || Object.getPrototypeOf(Decelerate)).call(this, parent));

        options = options || {};
        _this.friction = options.friction || 0.95;
        _this.bounce = options.bounce || 0.5;
        _this.minSpeed = typeof options.minSpeed !== 'undefined' ? options.minSpeed : 0.01;
        _this.saved = [];
        return _this;
    }

    _createClass(Decelerate, [{
        key: 'down',
        value: function down() {
            this.saved = [];
            this.x = this.y = false;
        }
    }, {
        key: 'move',
        value: function move() {
            if (this.paused) {
                return;
            }

            var count = this.parent.countDownPointers();
            if (count === 1 || count > 1 && !this.parent.plugins['pinch']) {
                this.saved.push({ x: this.parent.x, y: this.parent.y, time: performance.now() });
                if (this.saved.length > 60) {
                    this.saved.splice(0, 30);
                }
            }
        }
    }, {
        key: 'up',
        value: function up() {
            if (this.parent.countDownPointers() === 0 && this.saved.length) {
                var now = performance.now();
                var _iteratorNormalCompletion = true;
                var _didIteratorError = false;
                var _iteratorError = undefined;

                try {
                    for (var _iterator = this.saved[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                        var save = _step.value;

                        if (save.time >= now - 100) {
                            var time = now - save.time;
                            this.x = (this.parent.x - save.x) / time;
                            this.y = (this.parent.y - save.y) / time;
                            this.percentChangeX = this.percentChangeY = this.friction;
                            break;
                        }
                    }
                } catch (err) {
                    _didIteratorError = true;
                    _iteratorError = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion && _iterator.return) {
                            _iterator.return();
                        }
                    } finally {
                        if (_didIteratorError) {
                            throw _iteratorError;
                        }
                    }
                }
            }
        }

        /**
         * manually activate plugin
         * @param {object} options
         * @param {number} [options.x]
         * @param {number} [options.y]
         */

    }, {
        key: 'activate',
        value: function activate(options) {
            options = options || {};
            if (typeof options.x !== 'undefined') {
                this.x = options.x;
                this.percentChangeX = this.friction;
            }
            if (typeof options.y !== 'undefined') {
                this.y = options.y;
                this.percentChangeY = this.friction;
            }
        }
    }, {
        key: 'update',
        value: function update(elapsed) {
            if (this.paused) {
                return;
            }

            var moved = void 0;
            if (this.x) {
                this.parent.x += this.x * elapsed;
                this.x *= this.percentChangeX;
                if (Math.abs(this.x) < this.minSpeed) {
                    this.x = 0;
                }
                moved = true;
            }
            if (this.y) {
                this.parent.y += this.y * elapsed;
                this.y *= this.percentChangeY;
                if (Math.abs(this.y) < this.minSpeed) {
                    this.y = 0;
                }
                moved = true;
            }
            if (moved) {
                this.parent.dirty = true;
                this.parent.emit('moved', { viewport: this.parent, type: 'decelerate' });
            }
        }
    }, {
        key: 'reset',
        value: function reset() {
            this.x = this.y = null;
        }
    }]);

    return Decelerate;
}(Plugin);

},{"./plugin":9,"./utils":12}],5:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var utils = require('./utils');
var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Drag, _Plugin);

    /**
     * enable one-finger touch to drag
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {string} [options.direction=all] direction to drag (all, x, or y)
     * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active)
     * @param {number} [options.wheelScroll=1] number of pixels to scroll with each wheel spin
     * @param {boolean} [options.reverse] reverse the direction of the wheel scroll
     * @param {boolean|string} [options.clampWheel] (true, x, or y) clamp wheel (to avoid weird bounce with mouse wheel)
     * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
     */
    function Drag(parent, options) {
        _classCallCheck(this, Drag);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (Drag.__proto__ || Object.getPrototypeOf(Drag)).call(this, parent));

        _this.moved = false;
        _this.wheelActive = utils.defaults(options.wheel, true);
        _this.wheelScroll = options.wheelScroll || 1;
        _this.reverse = options.reverse ? 1 : -1;
        _this.clampWheel = options.clampWheel;
        _this.xDirection = !options.direction || options.direction === 'all' || options.direction === 'x';
        _this.yDirection = !options.direction || options.direction === 'all' || options.direction === 'y';
        _this.parseUnderflow(options.underflow || 'center');
        return _this;
    }

    _createClass(Drag, [{
        key: 'parseUnderflow',
        value: function parseUnderflow(clamp) {
            clamp = clamp.toLowerCase();
            if (clamp === 'center') {
                this.underflowX = 0;
                this.underflowY = 0;
            } else {
                this.underflowX = clamp.indexOf('left') !== -1 ? -1 : clamp.indexOf('right') !== -1 ? 1 : 0;
                this.underflowY = clamp.indexOf('top') !== -1 ? -1 : clamp.indexOf('bottom') !== -1 ? 1 : 0;
            }
        }
    }, {
        key: 'down',
        value: function down(e) {
            if (this.paused) {
                return;
            }
            var count = this.parent.countDownPointers();
            if ((count === 1 || count > 1 && !this.parent.plugins['pinch']) && this.parent.parent) {
                var parent = this.parent.parent.toLocal(e.data.global);
                this.last = { x: e.data.global.x, y: e.data.global.y, parent: parent };
                this.current = e.data.pointerId;
            } else {
                this.last = null;
            }
        }
    }, {
        key: 'move',
        value: function move(e) {
            if (this.paused) {
                return;
            }
            if (this.last && this.current === e.data.pointerId) {
                var x = e.data.global.x;
                var y = e.data.global.y;
                var count = this.parent.countDownPointers();
                if (count === 1 || count > 1 && !this.parent.plugins['pinch']) {
                    var distX = x - this.last.x;
                    var distY = y - this.last.y;
                    if (this.moved || this.xDirection && this.parent.checkThreshold(distX) || this.yDirection && this.parent.checkThreshold(distY)) {
                        var newParent = this.parent.parent.toLocal(e.data.global);
                        if (this.xDirection) {
                            this.parent.x += newParent.x - this.last.parent.x;
                        }
                        if (this.yDirection) {
                            this.parent.y += newParent.y - this.last.parent.y;
                        }
                        this.last = { x: x, y: y, parent: newParent };
                        if (!this.moved) {
                            this.parent.emit('drag-start', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent });
                        }
                        this.moved = true;
                        this.parent.dirty = true;
                        this.parent.emit('moved', { viewport: this.parent, type: 'drag' });
                    }
                } else {
                    this.moved = false;
                }
            }
        }
    }, {
        key: 'up',
        value: function up() {
            var touches = this.parent.getTouchPointers();
            if (touches.length === 1) {
                var pointer = touches[0];
                if (pointer.last) {
                    var parent = this.parent.parent.toLocal(pointer.last);
                    this.last = { x: pointer.last.x, y: pointer.last.y, parent: parent };
                    this.current = pointer.last.data.pointerId;
                }
                this.moved = false;
            } else if (this.last) {
                if (this.moved) {
                    this.parent.emit('drag-end', { screen: this.last, world: this.parent.toWorld(this.last), viewport: this.parent });
                    this.last = this.moved = false;
                }
            }
        }
    }, {
        key: 'wheel',
        value: function wheel(e) {
            if (this.paused) {
                return;
            }

            if (this.wheelActive) {
                var wheel = this.parent.plugins['wheel'];
                if (!wheel) {
                    this.parent.x += e.deltaX * this.wheelScroll * this.reverse;
                    this.parent.y += e.deltaY * this.wheelScroll * this.reverse;
                    if (this.clampWheel) {
                        this.clamp();
                    }
                    this.parent.emit('wheel-scroll', this.parent);
                    this.parent.emit('moved', this.parent);
                    this.parent.dirty = true;
                    e.preventDefault();
                    return true;
                }
            }
        }
    }, {
        key: 'resume',
        value: function resume() {
            this.last = null;
            this.paused = false;
        }
    }, {
        key: 'clamp',
        value: function clamp() {
            var decelerate = this.parent.plugins['decelerate'] || {};
            if (this.clampWheel !== 'y') {
                if (this.parent.screenWorldWidth < this.parent.screenWidth) {
                    switch (this.underflowX) {
                        case -1:
                            this.parent.x = 0;
                            break;
                        case 1:
                            this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth;
                            break;
                        default:
                            this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;
                    }
                } else {
                    if (this.parent.left < 0) {
                        this.parent.x = 0;
                        decelerate.x = 0;
                    } else if (this.parent.right > this.parent.worldWidth) {
                        this.parent.x = -this.parent.worldWidth * this.parent.scale.x + this.parent.screenWidth;
                        decelerate.x = 0;
                    }
                }
            }
            if (this.clampWheel !== 'x') {
                if (this.parent.screenWorldHeight < this.parent.screenHeight) {
                    switch (this.underflowY) {
                        case -1:
                            this.parent.y = 0;
                            break;
                        case 1:
                            this.parent.y = this.parent.screenHeight - this.parent.screenWorldHeight;
                            break;
                        default:
                            this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;
                    }
                } else {
                    if (this.parent.top < 0) {
                        this.parent.y = 0;
                        decelerate.y = 0;
                    }
                    if (this.parent.bottom > this.parent.worldHeight) {
                        this.parent.y = -this.parent.worldHeight * this.parent.scale.y + this.parent.screenHeight;
                        decelerate.y = 0;
                    }
                }
            }
        }
    }, {
        key: 'active',
        get: function get() {
            return this.moved;
        }
    }]);

    return Drag;
}(Plugin);

},{"./plugin":9,"./utils":12}],6:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Follow, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate})
     * @param {object} [options]
     * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location)
     * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport
     */
    function Follow(parent, target, options) {
        _classCallCheck(this, Follow);

        var _this = _possibleConstructorReturn(this, (Follow.__proto__ || Object.getPrototypeOf(Follow)).call(this, parent));

        options = options || {};
        _this.speed = options.speed || 0;
        _this.target = target;
        _this.radius = options.radius;
        return _this;
    }

    _createClass(Follow, [{
        key: 'update',
        value: function update() {
            if (this.paused) {
                return;
            }

            var center = this.parent.center;
            var toX = this.target.x,
                toY = this.target.y;
            if (this.radius) {
                var distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2));
                if (distance > this.radius) {
                    var angle = Math.atan2(this.target.y - center.y, this.target.x - center.x);
                    toX = this.target.x - Math.cos(angle) * this.radius;
                    toY = this.target.y - Math.sin(angle) * this.radius;
                } else {
                    return;
                }
            }
            if (this.speed) {
                var deltaX = toX - center.x;
                var deltaY = toY - center.y;
                if (deltaX || deltaY) {
                    var _angle = Math.atan2(toY - center.y, toX - center.x);
                    var changeX = Math.cos(_angle) * this.speed;
                    var changeY = Math.sin(_angle) * this.speed;
                    var x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX;
                    var y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY;
                    this.parent.moveCenter(x, y);
                    this.parent.emit('moved', { viewport: this.parent, type: 'follow' });
                }
            } else {
                this.parent.moveCenter(toX, toY);
                this.parent.emit('moved', { viewport: this.parent, type: 'follow' });
            }
        }
    }]);

    return Follow;
}(Plugin);

},{"./plugin":9}],7:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var utils = require('./utils');
var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(MouseEdges, _Plugin);

    /**
     * Scroll viewport when mouse hovers near one of the edges.
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {number} [options.radius] distance from center of screen in screen pixels
     * @param {number} [options.distance] distance from all sides in screen pixels
     * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll)
     * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll)
     * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll)
     * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll)
     * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport
     * @param {boolean} [options.reverse] reverse direction of scroll
     * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed
     * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center))
     *
     * @event mouse-edge-start(Viewport) emitted when mouse-edge starts
     * @event mouse-edge-end(Viewport) emitted when mouse-edge ends
     */
    function MouseEdges(parent, options) {
        _classCallCheck(this, MouseEdges);

        var _this = _possibleConstructorReturn(this, (MouseEdges.__proto__ || Object.getPrototypeOf(MouseEdges)).call(this, parent));

        options = options || {};
        _this.options = options;
        _this.reverse = options.reverse ? 1 : -1;
        _this.noDecelerate = options.noDecelerate;
        _this.linear = options.linear;
        _this.radiusSquared = Math.pow(options.radius, 2);
        _this.resize();
        _this.speed = options.speed || 8;
        return _this;
    }

    _createClass(MouseEdges, [{
        key: 'resize',
        value: function resize() {
            var options = this.options;
            var distance = options.distance;
            if (utils.exists(distance)) {
                this.left = distance;
                this.top = distance;
                this.right = window.innerWidth - distance;
                this.bottom = window.innerHeight - distance;
            } else if (!this.radius) {
                this.left = utils.exists(options.left) ? options.left : null;
                this.top = utils.exists(options.top) ? options.top : null;
                this.right = utils.exists(options.right) ? window.innerWidth - options.right : null;
                this.bottom = utils.exists(options.bottom) ? window.innerHeight - options.bottom : null;
            }
        }
    }, {
        key: 'down',
        value: function down() {
            this.horizontal = this.vertical = null;
        }
    }, {
        key: 'move',
        value: function move(e) {
            if (e.data.identifier !== 'MOUSE' || e.data.buttons !== 0) {
                return;
            }
            var x = e.data.global.x;
            var y = e.data.global.y;

            if (this.radiusSquared) {
                var center = this.parent.toScreen(this.parent.center);
                var distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2);
                if (distance >= this.radiusSquared) {
                    var angle = Math.atan2(center.y - y, center.x - x);
                    if (this.linear) {
                        this.horizontal = Math.round(Math.cos(angle)) * this.speed * this.reverse * (60 / 1000);
                        this.vertical = Math.round(Math.sin(angle)) * this.speed * this.reverse * (60 / 1000);
                    } else {
                        this.horizontal = Math.cos(angle) * this.speed * this.reverse * (60 / 1000);
                        this.vertical = Math.sin(angle) * this.speed * this.reverse * (60 / 1000);
                    }
                } else {
                    if (this.horizontal) {
                        this.decelerateHorizontal();
                    }
                    if (this.vertical) {
                        this.decelerateVertical();
                    }
                    this.horizontal = this.vertical = 0;
                }
            } else {
                if (utils.exists(this.left) && x < this.left) {
                    this.horizontal = 1 * this.reverse * this.speed * (60 / 1000);
                } else if (utils.exists(this.right) && x > this.right) {
                    this.horizontal = -1 * this.reverse * this.speed * (60 / 1000);
                } else {
                    this.decelerateHorizontal();
                    this.horizontal = 0;
                }
                if (utils.exists(this.top) && y < this.top) {
                    this.vertical = 1 * this.reverse * this.speed * (60 / 1000);
                } else if (utils.exists(this.bottom) && y > this.bottom) {
                    this.vertical = -1 * this.reverse * this.speed * (60 / 1000);
                } else {
                    this.decelerateVertical();
                    this.vertical = 0;
                }
            }
        }
    }, {
        key: 'decelerateHorizontal',
        value: function decelerateHorizontal() {
            var decelerate = this.parent.plugins['decelerate'];
            if (this.horizontal && decelerate && !this.noDecelerate) {
                decelerate.activate({ x: this.horizontal * this.speed * this.reverse / (1000 / 60) });
            }
        }
    }, {
        key: 'decelerateVertical',
        value: function decelerateVertical() {
            var decelerate = this.parent.plugins['decelerate'];
            if (this.vertical && decelerate && !this.noDecelerate) {
                decelerate.activate({ y: this.vertical * this.speed * this.reverse / (1000 / 60) });
            }
        }
    }, {
        key: 'up',
        value: function up() {
            if (this.horizontal) {
                this.decelerateHorizontal();
            }
            if (this.vertical) {
                this.decelerateVertical();
            }
            this.horizontal = this.vertical = null;
        }
    }, {
        key: 'update',
        value: function update() {
            if (this.paused) {
                return;
            }

            if (this.horizontal || this.vertical) {
                var center = this.parent.center;
                if (this.horizontal) {
                    center.x += this.horizontal * this.speed;
                }
                if (this.vertical) {
                    center.y += this.vertical * this.speed;
                }
                this.parent.moveCenter(center);
                this.parent.emit('moved', { viewport: this.parent, type: 'mouse-edges' });
            }
        }
    }]);

    return MouseEdges;
}(Plugin);

},{"./plugin":9,"./utils":12}],8:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Pinch, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {boolean} [options.noDrag] disable two-finger dragging
     * @param {number} [options.percent=1.0] percent to modify pinch speed
     * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers
     */
    function Pinch(parent, options) {
        _classCallCheck(this, Pinch);

        var _this = _possibleConstructorReturn(this, (Pinch.__proto__ || Object.getPrototypeOf(Pinch)).call(this, parent));

        options = options || {};
        _this.percent = options.percent || 1.0;
        _this.noDrag = options.noDrag;
        _this.center = options.center;
        return _this;
    }

    _createClass(Pinch, [{
        key: 'down',
        value: function down() {
            if (this.parent.countDownPointers() >= 2) {
                this.active = true;
            }
        }
    }, {
        key: 'move',
        value: function move(e) {
            if (this.paused || !this.active) {
                return;
            }

            var x = e.data.global.x;
            var y = e.data.global.y;

            var pointers = this.parent.getTouchPointers();
            if (pointers.length >= 2) {
                var first = pointers[0];
                var second = pointers[1];
                var last = first.last && second.last ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) : null;
                if (first.pointerId === e.data.pointerId) {
                    first.last = { x: x, y: y, data: e.data };
                } else if (second.pointerId === e.data.pointerId) {
                    second.last = { x: x, y: y, data: e.data };
                }
                if (last) {
                    var oldPoint = void 0;
                    var point = { x: first.last.x + (second.last.x - first.last.x) / 2, y: first.last.y + (second.last.y - first.last.y) / 2 };
                    if (!this.center) {
                        oldPoint = this.parent.toLocal(point);
                    }
                    var dist = Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2));
                    var change = (dist - last) / this.parent.screenWidth * this.parent.scale.x * this.percent;
                    this.parent.scale.x += change;
                    this.parent.scale.y += change;
                    this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch' });
                    var clamp = this.parent.plugins['clamp-zoom'];
                    if (clamp) {
                        clamp.clamp();
                    }
                    if (this.center) {
                        this.parent.moveCenter(this.center);
                    } else {
                        var newPoint = this.parent.toGlobal(oldPoint);
                        this.parent.x += point.x - newPoint.x;
                        this.parent.y += point.y - newPoint.y;
                        this.parent.emit('moved', { viewport: this.parent, type: 'pinch' });
                    }
                    if (!this.noDrag && this.lastCenter) {
                        this.parent.x += point.x - this.lastCenter.x;
                        this.parent.y += point.y - this.lastCenter.y;
                        this.parent.emit('moved', { viewport: this.parent, type: 'pinch' });
                    }
                    this.lastCenter = point;
                    this.moved = true;
                } else {
                    if (!this.pinching) {
                        this.parent.emit('pinch-start', this.parent);
                        this.pinching = true;
                    }
                }
                this.parent.dirty = true;
            }
        }
    }, {
        key: 'up',
        value: function up() {
            if (this.pinching) {
                if (this.parent.touches.length <= 1) {
                    this.active = false;
                    this.lastCenter = null;
                    this.pinching = false;
                    this.moved = false;
                    this.parent.emit('pinch-end', this.parent);
                }
            }
        }
    }]);

    return Pinch;
}(Plugin);

},{"./plugin":9}],9:[function(require,module,exports){
"use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

module.exports = function () {
    function Plugin(parent) {
        _classCallCheck(this, Plugin);

        this.parent = parent;
        this.paused = false;
    }

    _createClass(Plugin, [{
        key: "down",
        value: function down() {}
    }, {
        key: "move",
        value: function move() {}
    }, {
        key: "up",
        value: function up() {}
    }, {
        key: "wheel",
        value: function wheel() {}
    }, {
        key: "update",
        value: function update() {}
    }, {
        key: "resize",
        value: function resize() {}
    }, {
        key: "reset",
        value: function reset() {}
    }, {
        key: "pause",
        value: function pause() {
            this.paused = true;
        }
    }, {
        key: "resume",
        value: function resume() {
            this.paused = false;
        }
    }]);

    return Plugin;
}();

},{}],10:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');
var utils = require('./utils');

module.exports = function (_Plugin) {
    _inherits(SnapZoom, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height)
     * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height)
     * @param {number} [options.time=1000]
     * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
     * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport
     * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport
     * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete
     * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input
     * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom
     * @param {boolean} [options.noMove] zoom but do not move
     *
     * @event snap-zoom-start(Viewport) emitted each time a fit animation starts
     * @event snap-zoom-end(Viewport) emitted each time fit reaches its target
     * @event snap-zoom-end(Viewport) emitted each time fit reaches its target
     */
    function SnapZoom(parent, options) {
        _classCallCheck(this, SnapZoom);

        var _this = _possibleConstructorReturn(this, (SnapZoom.__proto__ || Object.getPrototypeOf(SnapZoom)).call(this, parent));

        options = options || {};
        _this.width = options.width;
        _this.height = options.height;
        if (_this.width > 0) {
            _this.x_scale = parent._screenWidth / _this.width;
        }
        if (_this.height > 0) {
            _this.y_scale = parent._screenHeight / _this.height;
        }
        _this.xIndependent = utils.exists(_this.x_scale);
        _this.yIndependent = utils.exists(_this.y_scale);
        _this.x_scale = _this.xIndependent ? _this.x_scale : _this.y_scale;
        _this.y_scale = _this.yIndependent ? _this.y_scale : _this.x_scale;

        _this.time = utils.defaults(options.time, 1000);
        _this.ease = utils.ease(options.ease, 'easeInOutSine');
        _this.center = options.center;
        _this.noMove = options.noMove;
        _this.stopOnResize = options.stopOnResize;
        _this.removeOnInterrupt = options.removeOnInterrupt;
        _this.removeOnComplete = utils.defaults(options.removeOnComplete, true);
        _this.interrupt = utils.defaults(options.interrupt, true);
        if (_this.time === 0) {
            parent.container.scale.x = _this.x_scale;
            parent.container.scale.y = _this.y_scale;
            if (_this.removeOnComplete) {
                _this.parent.removePlugin('snap-zoom');
            }
        } else if (options.forceStart) {
            _this.createSnapping();
        }
        return _this;
    }

    _createClass(SnapZoom, [{
        key: 'createSnapping',
        value: function createSnapping() {
            var scale = this.parent.scale;
            this.snapping = { time: 0, startX: scale.x, startY: scale.y, deltaX: this.x_scale - scale.x, deltaY: this.y_scale - scale.y };
            this.parent.emit('snap-zoom-start', this.parent);
        }
    }, {
        key: 'resize',
        value: function resize() {
            this.snapping = null;

            if (this.width > 0) {
                this.x_scale = this.parent._screenWidth / this.width;
            }
            if (this.height > 0) {
                this.y_scale = this.parent._screenHeight / this.height;
            }
            this.x_scale = this.xIndependent ? this.x_scale : this.y_scale;
            this.y_scale = this.yIndependent ? this.y_scale : this.x_scale;
        }
    }, {
        key: 'reset',
        value: function reset() {
            this.snapping = null;
        }
    }, {
        key: 'wheel',
        value: function wheel() {
            if (this.removeOnInterrupt) {
                this.parent.removePlugin('snap-zoom');
            }
        }
    }, {
        key: 'down',
        value: function down() {
            if (this.removeOnInterrupt) {
                this.parent.removePlugin('snap-zoom');
            } else if (this.interrupt) {
                this.snapping = null;
            }
        }
    }, {
        key: 'update',
        value: function update(elapsed) {
            if (this.paused) {
                return;
            }
            if (this.interrupt && this.parent.countDownPointers() !== 0) {
                return;
            }

            var oldCenter = void 0;
            if (!this.center && !this.noMove) {
                oldCenter = this.parent.center;
            }
            if (!this.snapping) {
                if (this.parent.scale.x !== this.x_scale || this.parent.scale.y !== this.y_scale) {
                    this.createSnapping();
                }
            } else if (this.snapping) {
                var snapping = this.snapping;
                snapping.time += elapsed;
                if (snapping.time >= this.time) {
                    this.parent.scale.set(this.x_scale, this.y_scale);
                    if (this.removeOnComplete) {
                        this.parent.removePlugin('snap-zoom');
                    }
                    this.parent.emit('snap-zoom-end', this.parent);
                    this.snapping = null;
                } else {
                    var _snapping = this.snapping;
                    this.parent.scale.x = this.ease(_snapping.time, _snapping.startX, _snapping.deltaX, this.time);
                    this.parent.scale.y = this.ease(_snapping.time, _snapping.startY, _snapping.deltaY, this.time);
                }
                var clamp = this.parent.plugins['clamp-zoom'];
                if (clamp) {
                    clamp.clamp();
                }
                if (!this.noMove) {
                    if (!this.center) {
                        this.parent.moveCenter(oldCenter);
                    } else {
                        this.parent.moveCenter(this.center);
                    }
                }
            }
        }
    }, {
        key: 'resume',
        value: function resume() {
            this.snapping = null;
            _get(SnapZoom.prototype.__proto__ || Object.getPrototypeOf(SnapZoom.prototype), 'resume', this).call(this);
        }
    }]);

    return SnapZoom;
}(Plugin);

},{"./plugin":9,"./utils":12}],11:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');
var utils = require('./utils');

module.exports = function (_Plugin) {
    _inherits(Snap, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {number} x
     * @param {number} y
     * @param {object} [options]
     * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center
     * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active
     * @param {number} [options.time=1000]
     * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
     * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport
     * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete
     * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input
     * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location
     *
     * @event snap-start(Viewport) emitted each time a snap animation starts
     * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size
     * @event snap-end(Viewport) emitted each time snap reaches its target
     * @event snap-remove(Viewport) emitted if snap plugin is removed
     */
    function Snap(parent, x, y, options) {
        _classCallCheck(this, Snap);

        var _this = _possibleConstructorReturn(this, (Snap.__proto__ || Object.getPrototypeOf(Snap)).call(this, parent));

        options = options || {};
        _this.friction = options.friction || 0.8;
        _this.time = options.time || 1000;
        _this.ease = utils.ease(options.ease, 'easeInOutSine');
        _this.x = x;
        _this.y = y;
        _this.topLeft = options.topLeft;
        _this.interrupt = utils.defaults(options.interrupt, true);
        _this.removeOnComplete = options.removeOnComplete;
        _this.removeOnInterrupt = options.removeOnInterrupt;
        if (options.forceStart) {
            _this.startEase();
        }
        return _this;
    }

    _createClass(Snap, [{
        key: 'snapStart',
        value: function snapStart() {
            this.percent = 0;
            this.snapping = { time: 0 };
            var current = this.topLeft ? this.parent.corner : this.parent.center;
            this.deltaX = this.x - current.x;
            this.deltaY = this.y - current.y;
            this.startX = current.x;
            this.startY = current.y;
            this.parent.emit('snap-start', this.parent);
        }
    }, {
        key: 'wheel',
        value: function wheel() {
            if (this.removeOnInterrupt) {
                this.parent.removePlugin('snap');
            }
        }
    }, {
        key: 'down',
        value: function down() {
            if (this.removeOnInterrupt) {
                this.parent.removePlugin('snap');
            } else if (this.interrupt) {
                this.snapping = null;
            }
        }
    }, {
        key: 'up',
        value: function up() {
            if (this.parent.countDownPointers() === 0) {
                var decelerate = this.parent.plugins['decelerate'];
                if (decelerate && (decelerate.x || decelerate.y)) {
                    decelerate.percentChangeX = decelerate.percentChangeY = this.friction;
                }
            }
        }
    }, {
        key: 'update',
        value: function update(elapsed) {
            if (this.paused) {
                return;
            }
            if (this.interrupt && this.parent.countDownPointers() !== 0) {
                return;
            }
            if (!this.snapping) {
                var current = this.topLeft ? this.parent.corner : this.parent.center;
                if (current.x !== this.x || current.y !== this.y) {
                    this.snapStart();
                }
            } else {
                var snapping = this.snapping;
                snapping.time += elapsed;
                var finished = void 0,
                    x = void 0,
                    y = void 0;
                if (snapping.time > this.time) {
                    finished = true;
                    x = this.startX + this.deltaX;
                    y = this.startY + this.deltaY;
                } else {
                    var percent = this.ease(snapping.time, 0, 1, this.time);
                    x = this.startX + this.deltaX * percent;
                    y = this.startY + this.deltaY * percent;
                }
                if (this.topLeft) {
                    this.parent.moveCorner(x, y);
                } else {
                    this.parent.moveCenter(x, y);
                }
                this.parent.emit('moved', { viewport: this.parent, type: 'snap' });
                if (finished) {
                    if (this.removeOnComplete) {
                        this.parent.removePlugin('snap');
                    }
                    this.parent.emit('snap-end', this.parent);
                    this.snapping = null;
                }
            }
        }
    }]);

    return Snap;
}(Plugin);

},{"./plugin":9,"./utils":12}],12:[function(require,module,exports){
'use strict';

var Penner = require('penner');

function exists(a) {
    return a !== undefined && a !== null;
}

function defaults(a, defaults) {
    return a !== undefined && a !== null ? a : defaults;
}

/**
 * @param {(function|string)} [ease]
 * @param {string} defaults for pennr equation
 * @private
 * @returns {function} correct penner equation
 */
function ease(ease, defaults) {
    if (!exists(ease)) {
        return Penner[defaults];
    } else if (typeof ease === 'function') {
        return ease;
    } else if (typeof ease === 'string') {
        return Penner[ease];
    }
}

module.exports = {
    exists: exists,
    defaults: defaults,
    ease: ease
};

},{"penner":15}],13:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var utils = require('./utils');
var Drag = require('./drag');
var Pinch = require('./pinch');
var Clamp = require('./clamp');
var ClampZoom = require('./clamp-zoom');
var Decelerate = require('./decelerate');
var Bounce = require('./bounce');
var Snap = require('./snap');
var SnapZoom = require('./snap-zoom');
var Follow = require('./follow');
var Wheel = require('./wheel');
var MouseEdges = require('./mouse-edges');

var PLUGIN_ORDER = ['drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', 'snap-zoom', 'clamp-zoom', 'snap', 'clamp'];

var Viewport = function (_PIXI$Container) {
    _inherits(Viewport, _PIXI$Container);

    /**
     * @extends PIXI.Container
     * @extends EventEmitter
     * @param {object} [options]
     * @param {number} [options.screenWidth=window.innerWidth]
     * @param {number} [options.screenHeight=window.innerHeight]
     * @param {number} [options.worldWidth=this.width]
     * @param {number} [options.worldHeight=this.height]
     * @param {number} [options.threshold = 5] number of pixels to move to trigger an input event (e.g., drag, pinch)
     * @param {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)} [options.forceHitArea] change the default hitArea from world size to a new value
     * @param {PIXI.ticker.Ticker} [options.ticker=PIXI.ticker.shared] use this PIXI.ticker for updates
     * @param {PIXI.InteractionManager} [options.interaction=null] InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer postion relative to canvas location on screen
     * @param {HTMLElement} [options.divWheel=document.body] div to attach the wheel event
     * @fires clicked
     * @fires drag-start
     * @fires drag-end
     * @fires drag-remove
     * @fires pinch-start
     * @fires pinch-end
     * @fires pinch-remove
     * @fires snap-start
     * @fires snap-end
     * @fires snap-remove
     * @fires snap-zoom-start
     * @fires snap-zoom-end
     * @fires snap-zoom-remove
     * @fires bounce-x-start
     * @fires bounce-x-end
     * @fires bounce-y-start
     * @fires bounce-y-end
     * @fires bounce-remove
     * @fires wheel
     * @fires wheel-remove
     * @fires wheel-scroll
     * @fires wheel-scroll-remove
     * @fires mouse-edge-start
     * @fires mouse-edge-end
     * @fires mouse-edge-remove
     * @fires moved
     */
    function Viewport(options) {
        _classCallCheck(this, Viewport);

        options = options || {};

        var _this = _possibleConstructorReturn(this, (Viewport.__proto__ || Object.getPrototypeOf(Viewport)).call(this));

        _this.plugins = {};
        _this.pluginsList = [];
        _this._screenWidth = options.screenWidth;
        _this._screenHeight = options.screenHeight;
        _this._worldWidth = options.worldWidth;
        _this._worldHeight = options.worldHeight;
        _this.hitAreaFullScreen = utils.defaults(options.hitAreaFullScreen, true);
        _this.forceHitArea = options.forceHitArea;
        _this.threshold = utils.defaults(options.threshold, 5);
        _this.interaction = options.interaction || null;
        _this.div = options.divWheel || document.body;
        _this.listeners(_this.div);

        /**
         * active touch point ids on the viewport
         * @type {number[]}
         * @readonly
         */
        _this.touches = [];

        _this.ticker = options.ticker || PIXI.ticker.shared;
        _this.tickerFunction = function () {
            return _this.update();
        };
        _this.ticker.add(_this.tickerFunction);
        return _this;
    }

    /**
     * removes all event listeners from viewport
     * (useful for cleanup of wheel and ticker events when removing viewport)
     */


    _createClass(Viewport, [{
        key: 'removeListeners',
        value: function removeListeners() {
            this.ticker.remove(this.tickerFunction);
            this.div.removeEventListener('wheel', this.wheelFunction);
        }

        /**
         * overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners
         */

    }, {
        key: 'destroy',
        value: function destroy(options) {
            _get(Viewport.prototype.__proto__ || Object.getPrototypeOf(Viewport.prototype), 'destroy', this).call(this, options);
            this.removeListeners();
        }

        /**
         * update animations
         * @private
         */

    }, {
        key: 'update',
        value: function update() {
            if (!this.pause) {
                var _iteratorNormalCompletion = true;
                var _didIteratorError = false;
                var _iteratorError = undefined;

                try {
                    for (var _iterator = this.pluginsList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                        var plugin = _step.value;

                        plugin.update(this.ticker.elapsedMS);
                    }
                } catch (err) {
                    _didIteratorError = true;
                    _iteratorError = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion && _iterator.return) {
                            _iterator.return();
                        }
                    } finally {
                        if (_didIteratorError) {
                            throw _iteratorError;
                        }
                    }
                }
            }
            if (!this.forceHitArea) {
                this.hitArea.x = this.left;
                this.hitArea.y = this.top;
                this.hitArea.width = this.worldScreenWidth;
                this.hitArea.height = this.worldScreenHeight;
            }
        }

        /**
         * use this to set screen and world sizes--needed for pinch/wheel/clamp/bounce
         * @param {number} screenWidth
         * @param {number} screenHeight
         * @param {number} [worldWidth]
         * @param {number} [worldHeight]
         */

    }, {
        key: 'resize',
        value: function resize(screenWidth, screenHeight, worldWidth, worldHeight) {
            this._screenWidth = screenWidth || window.innerWidth;
            this._screenHeight = screenHeight || window.innerHeight;
            this._worldWidth = worldWidth;
            this._worldHeight = worldHeight;
            this.resizePlugins();
        }

        /**
         * called after a worldWidth/Height change
         * @private
         */

    }, {
        key: 'resizePlugins',
        value: function resizePlugins() {
            var _iteratorNormalCompletion2 = true;
            var _didIteratorError2 = false;
            var _iteratorError2 = undefined;

            try {
                for (var _iterator2 = this.pluginsList[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                    var plugin = _step2.value;

                    plugin.resize();
                }
            } catch (err) {
                _didIteratorError2 = true;
                _iteratorError2 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion2 && _iterator2.return) {
                        _iterator2.return();
                    }
                } finally {
                    if (_didIteratorError2) {
                        throw _iteratorError2;
                    }
                }
            }
        }

        /**
         * screen width in screen pixels
         * @type {number}
         */

    }, {
        key: 'listeners',


        /**
         * add input listeners
         * @private
         */
        value: function listeners(div) {
            var _this2 = this;

            this.interactive = true;
            if (!this.forceHitArea) {
                this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight);
            }
            this.on('pointerdown', this.down);
            this.on('pointermove', this.move);
            this.on('pointerup', this.up);
            this.on('pointerupoutside', this.up);
            this.on('pointercancel', this.up);
            this.on('pointerout', this.up);
            this.wheelFunction = function (e) {
                return _this2.handleWheel(e);
            };
            div.addEventListener('wheel', this.wheelFunction);
            this.leftDown = false;
        }

        /**
         * handle down events
         * @private
         */

    }, {
        key: 'down',
        value: function down(e) {
            if (this.pause) {
                return;
            }
            if (e.data.pointerType === 'mouse') {
                if (e.data.originalEvent.button == 0) {
                    this.leftDown = true;
                }
            } else {
                this.touches.push(e.data.pointerId);
            }

            if (this.countDownPointers() === 1) {
                this.last = { x: e.data.global.x, y: e.data.global.y

                    // clicked event does not fire if viewport is decelerating or bouncing
                };var decelerate = this.plugins['decelerate'];
                var bounce = this.plugins['bounce'];
                if ((!decelerate || !decelerate.x && !decelerate.y) && (!bounce || !bounce.toX && !bounce.toY)) {
                    this.clickedAvailable = true;
                }
            } else {
                this.clickedAvailable = false;
            }

            var _iteratorNormalCompletion3 = true;
            var _didIteratorError3 = false;
            var _iteratorError3 = undefined;

            try {
                for (var _iterator3 = this.pluginsList[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
                    var plugin = _step3.value;

                    plugin.down(e);
                }
            } catch (err) {
                _didIteratorError3 = true;
                _iteratorError3 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion3 && _iterator3.return) {
                        _iterator3.return();
                    }
                } finally {
                    if (_didIteratorError3) {
                        throw _iteratorError3;
                    }
                }
            }
        }

        /**
         * whether change exceeds threshold
         * @private
         * @param {number} change
         */

    }, {
        key: 'checkThreshold',
        value: function checkThreshold(change) {
            if (Math.abs(change) >= this.threshold) {
                return true;
            }
            return false;
        }

        /**
         * handle move events
         * @private
         */

    }, {
        key: 'move',
        value: function move(e) {
            if (this.pause) {
                return;
            }

            var _iteratorNormalCompletion4 = true;
            var _didIteratorError4 = false;
            var _iteratorError4 = undefined;

            try {
                for (var _iterator4 = this.pluginsList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
                    var plugin = _step4.value;

                    plugin.move(e);
                }
            } catch (err) {
                _didIteratorError4 = true;
                _iteratorError4 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion4 && _iterator4.return) {
                        _iterator4.return();
                    }
                } finally {
                    if (_didIteratorError4) {
                        throw _iteratorError4;
                    }
                }
            }

            if (this.clickedAvailable) {
                var distX = e.data.global.x - this.last.x;
                var distY = e.data.global.y - this.last.y;
                if (this.checkThreshold(distX) || this.checkThreshold(distY)) {
                    this.clickedAvailable = false;
                }
            }
        }

        /**
         * handle up events
         * @private
         */

    }, {
        key: 'up',
        value: function up(e) {
            if (this.pause) {
                return;
            }

            if (e.data.originalEvent instanceof MouseEvent && e.data.originalEvent.button == 0) {
                this.leftDown = false;
            }

            if (e.data.pointerType !== 'mouse') {
                for (var i = 0; i < this.touches.length; i++) {
                    if (this.touches[i] === e.data.pointerId) {
                        this.touches.splice(i, 1);
                        break;
                    }
                }
            }

            var _iteratorNormalCompletion5 = true;
            var _didIteratorError5 = false;
            var _iteratorError5 = undefined;

            try {
                for (var _iterator5 = this.pluginsList[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
                    var plugin = _step5.value;

                    plugin.up(e);
                }
            } catch (err) {
                _didIteratorError5 = true;
                _iteratorError5 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion5 && _iterator5.return) {
                        _iterator5.return();
                    }
                } finally {
                    if (_didIteratorError5) {
                        throw _iteratorError5;
                    }
                }
            }

            if (this.clickedAvailable && this.countDownPointers() === 0) {
                this.emit('clicked', { screen: this.last, world: this.toWorld(this.last), viewport: this });
                this.clickedAvailable = false;
            }
        }

        /**
         * gets pointer position if this.interaction is set
         * @param {UIEvent} evt
         * @private
         */

    }, {
        key: 'getPointerPosition',
        value: function getPointerPosition(evt) {
            var point = new PIXI.Point();
            if (this.interaction) {
                this.interaction.mapPositionToPoint(point, evt.clientX, evt.clientY);
            } else {
                point.x = evt.clientX;
                point.y = evt.clientY;
            }
            return point;
        }

        /**
         * handle wheel events
         * @private
         */

    }, {
        key: 'handleWheel',
        value: function handleWheel(e) {
            if (this.pause) {
                return;
            }

            // only handle wheel events where the mouse is over the viewport
            var point = this.toLocal(this.getPointerPosition(e));
            if (this.left <= point.x && point.x <= this.right && this.top <= point.y && point.y <= this.bottom) {
                var result = void 0;
                var _iteratorNormalCompletion6 = true;
                var _didIteratorError6 = false;
                var _iteratorError6 = undefined;

                try {
                    for (var _iterator6 = this.pluginsList[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
                        var plugin = _step6.value;

                        if (plugin.wheel(e)) {
                            result = true;
                        }
                    }
                } catch (err) {
                    _didIteratorError6 = true;
                    _iteratorError6 = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion6 && _iterator6.return) {
                            _iterator6.return();
                        }
                    } finally {
                        if (_didIteratorError6) {
                            throw _iteratorError6;
                        }
                    }
                }

                return result;
            }
        }

        /**
         * change coordinates from screen to world
         * @param {number|PIXI.Point} x
         * @param {number} [y]
         * @returns {PIXI.Point}
         */

    }, {
        key: 'toWorld',
        value: function toWorld() {
            if (arguments.length === 2) {
                var x = arguments[0];
                var y = arguments[1];
                return this.toLocal({ x: x, y: y });
            } else {
                return this.toLocal(arguments[0]);
            }
        }

        /**
         * change coordinates from world to screen
         * @param {number|PIXI.Point} x
         * @param {number} [y]
         * @returns {PIXI.Point}
         */

    }, {
        key: 'toScreen',
        value: function toScreen() {
            if (arguments.length === 2) {
                var x = arguments[0];
                var y = arguments[1];
                return this.toGlobal({ x: x, y: y });
            } else {
                var point = arguments[0];
                return this.toGlobal(point);
            }
        }

        /**
         * screen width in world coordinates
         * @type {number}
         * @readonly
         */

    }, {
        key: 'moveCenter',


        /**
         * move center of viewport to point
         * @param {(number|PIXI.PointLike)} x or point
         * @param {number} [y]
         * @return {Viewport} this
         */
        value: function moveCenter() /*x, y | PIXI.Point*/{
            var x = void 0,
                y = void 0;
            if (!isNaN(arguments[0])) {
                x = arguments[0];
                y = arguments[1];
            } else {
                x = arguments[0].x;
                y = arguments[0].y;
            }
            this.position.set((this.worldScreenWidth / 2 - x) * this.scale.x, (this.worldScreenHeight / 2 - y) * this.scale.y);
            this._reset();
            return this;
        }

        /**
         * top-left corner
         * @type {PIXI.PointLike}
         */

    }, {
        key: 'moveCorner',


        /**
         * move viewport's top-left corner; also clamps and resets decelerate and bounce (as needed)
         * @param {number|PIXI.Point} x|point
         * @param {number} y
         * @return {Viewport} this
         */
        value: function moveCorner() /*x, y | point*/{
            if (arguments.length === 1) {
                this.position.set(-arguments[0].x * this.scale.x, -arguments[0].y * this.scale.y);
            } else {
                this.position.set(-arguments[0] * this.scale.x, -arguments[1] * this.scale.y);
            }
            this._reset();
            return this;
        }

        /**
         * change zoom so the width fits in the viewport
         * @param {number} [width=this._worldWidth] in world coordinates
         * @param {boolean} [center] maintain the same center
         * @return {Viewport} this
         */

    }, {
        key: 'fitWidth',
        value: function fitWidth(width, center) {
            var save = void 0;
            if (center) {
                save = this.center;
            }
            width = width || this.worldWidth;
            this.scale.x = this.screenWidth / width;
            this.scale.y = this.scale.x;
            if (center) {
                this.moveCenter(save);
            }
            return this;
        }

        /**
         * change zoom so the height fits in the viewport
         * @param {number} [height=this._worldHeight] in world coordinates
         * @param {boolean} [center] maintain the same center of the screen after zoom
         * @return {Viewport} this
         */

    }, {
        key: 'fitHeight',
        value: function fitHeight(height, center) {
            var save = void 0;
            if (center) {
                save = this.center;
            }
            height = height || this.worldHeight;
            this.scale.y = this.screenHeight / height;
            this.scale.x = this.scale.y;
            if (center) {
                this.moveCenter(save);
            }
            return this;
        }

        /**
         * change zoom so it fits the entire world in the viewport
         * @param {boolean} [center] maintain the same center of the screen after zoom
         * @return {Viewport} this
         */

    }, {
        key: 'fitWorld',
        value: function fitWorld(center) {
            var save = void 0;
            if (center) {
                save = this.center;
            }
            this.scale.x = this._screenWidth / this._worldWidth;
            this.scale.y = this._screenHeight / this._worldHeight;
            if (this.scale.x < this.scale.y) {
                this.scale.y = this.scale.x;
            } else {
                this.scale.x = this.scale.y;
            }
            if (center) {
                this.moveCenter(save);
            }
            return this;
        }

        /**
         * change zoom so it fits the size or the entire world in the viewport
         * @param {boolean} [center] maintain the same center of the screen after zoom
         * @param {number} [width] desired width
         * @param {number} [height] desired height
         * @return {Viewport} this
         */

    }, {
        key: 'fit',
        value: function fit(center, width, height) {
            var save = void 0;
            if (center) {
                save = this.center;
            }
            width = width || this.worldWidth;
            height = height || this.worldHeight;
            this.scale.x = this.screenWidth / width;
            this.scale.y = this.screenHeight / height;
            if (this.scale.x < this.scale.y) {
                this.scale.y = this.scale.x;
            } else {
                this.scale.x = this.scale.y;
            }
            if (center) {
                this.moveCenter(save);
            }
            return this;
        }

        /**
         * zoom viewport by a certain percent (in both x and y direction)
         * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25)
         * @param {boolean} [center] maintain the same center of the screen after zoom
         * @return {Viewport} the viewport
         */

    }, {
        key: 'zoomPercent',
        value: function zoomPercent(percent, center) {
            var save = void 0;
            if (center) {
                save = this.center;
            }
            var scale = this.scale.x + this.scale.x * percent;
            this.scale.set(scale);
            if (center) {
                this.moveCenter(save);
            }
            return this;
        }

        /**
         * zoom viewport by increasing/decreasing width by a certain number of pixels
         * @param {number} change in pixels
         * @param {boolean} [center] maintain the same center of the screen after zoom
         * @return {Viewport} the viewport
         */

    }, {
        key: 'zoom',
        value: function zoom(change, center) {
            this.fitWidth(change + this.worldScreenWidth, center);
            return this;
        }

        /**
         * @param {object} [options]
         * @param {number} [options.width] the desired width to snap (to maintain aspect ratio, choose only width or height)
         * @param {number} [options.height] the desired height to snap (to maintain aspect ratio, choose only width or height)
         * @param {number} [options.time=1000]
         * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
         * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of the viewport
         * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport
         * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete
         * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input
         * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom
         */

    }, {
        key: 'snapZoom',
        value: function snapZoom(options) {
            this.plugins['snap-zoom'] = new SnapZoom(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * @private
         * @typedef OutOfBounds
         * @type {object}
         * @property {boolean} left
         * @property {boolean} right
         * @property {boolean} top
         * @property {boolean} bottom
         */

        /**
         * is container out of world bounds
         * @return {OutOfBounds}
         * @private
         */

    }, {
        key: 'OOB',
        value: function OOB() {
            var result = {};
            result.left = this.left < 0;
            result.right = this.right > this._worldWidth;
            result.top = this.top < 0;
            result.bottom = this.bottom > this._worldHeight;
            result.cornerPoint = {
                x: this._worldWidth * this.scale.x - this._screenWidth,
                y: this._worldHeight * this.scale.y - this._screenHeight
            };
            return result;
        }

        /**
         * world coordinates of the right edge of the screen
         * @type {number}
         */

    }, {
        key: 'countDownPointers',


        /**
         * count of mouse/touch pointers that are down on the viewport
         * @private
         * @return {number}
         */
        value: function countDownPointers() {
            return (this.leftDown ? 1 : 0) + this.touches.length;
        }

        /**
         * array of touch pointers that are down on the viewport
         * @private
         * @return {PIXI.InteractionTrackingData[]}
         */

    }, {
        key: 'getTouchPointers',
        value: function getTouchPointers() {
            var results = [];
            var pointers = this.trackedPointers;
            for (var key in pointers) {
                var pointer = pointers[key];
                if (this.touches.indexOf(pointer.pointerId) !== -1) {
                    results.push(pointer);
                }
            }
            return results;
        }

        /**
         * array of pointers that are down on the viewport
         * @private
         * @return {PIXI.InteractionTrackingData[]}
         */

    }, {
        key: 'getPointers',
        value: function getPointers() {
            var results = [];
            var pointers = this.trackedPointers;
            for (var key in pointers) {
                results.push(pointers[key]);
            }
            return results;
        }

        /**
         * clamps and resets bounce and decelerate (as needed) after manually moving viewport
         * @private
         */

    }, {
        key: '_reset',
        value: function _reset() {
            if (this.plugins['bounce']) {
                this.plugins['bounce'].reset();
                this.plugins['bounce'].bounce();
            }
            if (this.plugins['decelerate']) {
                this.plugins['decelerate'].reset();
            }
            if (this.plugins['snap']) {
                this.plugins['snap'].reset();
            }
            if (this.plugins['clamp']) {
                this.plugins['clamp'].update();
            }
            if (this.plugins['clamp-zoom']) {
                this.plugins['clamp-zoom'].clamp();
            }
            this.dirty = true;
        }

        // PLUGINS

        /**
         * removes installed plugin
         * @param {string} type of plugin (e.g., 'drag', 'pinch')
         */

    }, {
        key: 'removePlugin',
        value: function removePlugin(type) {
            if (this.plugins[type]) {
                this.plugins[type] = null;
                this.emit(type + '-remove');
                this.pluginsSort();
            }
        }

        /**
         * pause plugin
         * @param {string} type of plugin (e.g., 'drag', 'pinch')
         */

    }, {
        key: 'pausePlugin',
        value: function pausePlugin(type) {
            if (this.plugins[type]) {
                this.plugins[type].pause();
            }
        }

        /**
         * resume plugin
         * @param {string} type of plugin (e.g., 'drag', 'pinch')
         */

    }, {
        key: 'resumePlugin',
        value: function resumePlugin(type) {
            if (this.plugins[type]) {
                this.plugins[type].resume();
            }
        }

        /**
         * sort plugins for updates
         * @private
         */

    }, {
        key: 'pluginsSort',
        value: function pluginsSort() {
            this.pluginsList = [];
            var _iteratorNormalCompletion7 = true;
            var _didIteratorError7 = false;
            var _iteratorError7 = undefined;

            try {
                for (var _iterator7 = PLUGIN_ORDER[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
                    var plugin = _step7.value;

                    if (this.plugins[plugin]) {
                        this.pluginsList.push(this.plugins[plugin]);
                    }
                }
            } catch (err) {
                _didIteratorError7 = true;
                _iteratorError7 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion7 && _iterator7.return) {
                        _iterator7.return();
                    }
                } finally {
                    if (_didIteratorError7) {
                        throw _iteratorError7;
                    }
                }
            }
        }

        /**
         * enable one-finger touch to drag
         * @param {object} [options]
         * @param {string} [options.direction=all] direction to drag (all, x, or y)
         * @param {boolean} [options.wheel=true] use wheel to scroll in y direction (unless wheel plugin is active)
         * @param {number} [options.wheelScroll=10] number of pixels to scroll with each wheel spin
         * @param {boolean} [options.reverse] reverse the direction of the wheel scroll
         * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
         */

    }, {
        key: 'drag',
        value: function drag(options) {
            this.plugins['drag'] = new Drag(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * clamp to world boundaries or other provided boundaries
         * NOTES:
         *   clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping
         *   screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly
         * @param {object} [options]
         * @param {(number|boolean)} [options.left] clamp left; true=0
         * @param {(number|boolean)} [options.right] clamp right; true=viewport.worldWidth
         * @param {(number|boolean)} [options.top] clamp top; true=0
         * @param {(number|boolean)} [options.bottom] clamp bottom; true=viewport.worldHeight
         * @param {string} [options.direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set
         * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
         * @return {Viewport} this
         */

    }, {
        key: 'clamp',
        value: function clamp(options) {
            this.plugins['clamp'] = new Clamp(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * decelerate after a move
         * @param {object} [options]
         * @param {number} [options.friction=0.95] percent to decelerate after movement
         * @param {number} [options.bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active)
         * @param {number} [options.minSpeed=0.01] minimum velocity before stopping/reversing acceleration
         * @return {Viewport} this
         */

    }, {
        key: 'decelerate',
        value: function decelerate(options) {
            this.plugins['decelerate'] = new Decelerate(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * bounce on borders
         * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly
         * @param {object} [options]
         * @param {string} [options.sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right')
         * @param {number} [options.friction=0.5] friction to apply to decelerate if active
         * @param {number} [options.time=150] time in ms to finish bounce
         * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
         * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen
         * @return {Viewport} this
         */

    }, {
        key: 'bounce',
        value: function bounce(options) {
            this.plugins['bounce'] = new Bounce(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * enable pinch to zoom and two-finger touch to drag
         * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly
         * @param {number} [options.percent=1.0] percent to modify pinch speed
         * @param {boolean} [options.noDrag] disable two-finger dragging
         * @param {PIXI.Point} [options.center] place this point at center during zoom instead of center of two fingers
         * @return {Viewport} this
         */

    }, {
        key: 'pinch',
        value: function pinch(options) {
            this.plugins['pinch'] = new Pinch(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * snap to a point
         * @param {number} x
         * @param {number} y
         * @param {object} [options]
         * @param {boolean} [options.topLeft] snap to the top-left of viewport instead of center
         * @param {number} [options.friction=0.8] friction/frame to apply if decelerate is active
         * @param {number} [options.time=1000]
         * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)
         * @param {boolean} [options.interrupt=true] pause snapping with any user input on the viewport
         * @param {boolean} [options.removeOnComplete] removes this plugin after snapping is complete
         * @param {boolean} [options.removeOnInterrupt] removes this plugin if interrupted by any user input
         * @param {boolean} [options.forceStart] starts the snap immediately regardless of whether the viewport is at the desired location
        * @return {Viewport} this
         */

    }, {
        key: 'snap',
        value: function snap(x, y, options) {
            this.plugins['snap'] = new Snap(this, x, y, options);
            this.pluginsSort();
            return this;
        }

        /**
         * follow a target
         * @param {PIXI.DisplayObject} target to follow (object must include {x: x-coordinate, y: y-coordinate})
         * @param {object} [options]
         * @param {number} [options.speed=0] to follow in pixels/frame (0=teleport to location)
         * @param {number} [options.radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport
         * @return {Viewport} this
         */

    }, {
        key: 'follow',
        value: function follow(target, options) {
            this.plugins['follow'] = new Follow(this, target, options);
            this.pluginsSort();
            return this;
        }

        /**
         * zoom using mouse wheel
         * @param {object} [options]
         * @param {number} [options.percent=0.1] percent to scroll with each spin
         * @param {boolean} [options.reverse] reverse the direction of the scroll
         * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position
         * @return {Viewport} this
         */

    }, {
        key: 'wheel',
        value: function wheel(options) {
            this.plugins['wheel'] = new Wheel(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * enable clamping of zoom to constraints
         * NOTE: screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly
         * @param {object} [options]
         * @param {number} [options.minWidth] minimum width
         * @param {number} [options.minHeight] minimum height
         * @param {number} [options.maxWidth] maximum width
         * @param {number} [options.maxHeight] maximum height
         * @return {Viewport} this
         */

    }, {
        key: 'clampZoom',
        value: function clampZoom(options) {
            this.plugins['clamp-zoom'] = new ClampZoom(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen.
         * @param {object} [options]
         * @param {number} [options.radius] distance from center of screen in screen pixels
         * @param {number} [options.distance] distance from all sides in screen pixels
         * @param {number} [options.top] alternatively, set top distance (leave unset for no top scroll)
         * @param {number} [options.bottom] alternatively, set bottom distance (leave unset for no top scroll)
         * @param {number} [options.left] alternatively, set left distance (leave unset for no top scroll)
         * @param {number} [options.right] alternatively, set right distance (leave unset for no top scroll)
         * @param {number} [options.speed=8] speed in pixels/frame to scroll viewport
         * @param {boolean} [options.reverse] reverse direction of scroll
         * @param {boolean} [options.noDecelerate] don't use decelerate plugin even if it's installed
         * @param {boolean} [options.linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center))
         */

    }, {
        key: 'mouseEdges',
        value: function mouseEdges(options) {
            this.plugins['mouse-edges'] = new MouseEdges(this, options);
            this.pluginsSort();
            return this;
        }

        /**
         * pause viewport (including animation updates such as decelerate)
         * NOTE: when setting pause=true, all touches and mouse actions are cleared (i.e., if mousedown was active, it becomes inactive for purposes of the viewport)
         * @type {boolean}
         */

    }, {
        key: 'screenWidth',
        get: function get() {
            return this._screenWidth;
        },
        set: function set(value) {
            this._screenWidth = value;
        }

        /**
         * screen height in screen pixels
         * @type {number}
         */

    }, {
        key: 'screenHeight',
        get: function get() {
            return this._screenHeight;
        },
        set: function set(value) {
            this._screenHeight = value;
        }

        /**
         * world width in pixels
         * @type {number}
         */

    }, {
        key: 'worldWidth',
        get: function get() {
            if (this._worldWidth) {
                return this._worldWidth;
            } else {
                return this.width;
            }
        },
        set: function set(value) {
            this._worldWidth = value;
            this.resizePlugins();
        }

        /**
         * world height in pixels
         * @type {number}
         */

    }, {
        key: 'worldHeight',
        get: function get() {
            if (this._worldHeight) {
                return this._worldHeight;
            } else {
                return this.height;
            }
        },
        set: function set(value) {
            this._worldHeight = value;
            this.resizePlugins();
        }
    }, {
        key: 'worldScreenWidth',
        get: function get() {
            return this._screenWidth / this.scale.x;
        }

        /**
         * screen height in world coordinates
         * @type {number}
         * @readonly
         */

    }, {
        key: 'worldScreenHeight',
        get: function get() {
            return this._screenHeight / this.scale.y;
        }

        /**
         * world width in screen coordinates
         * @type {number}
         * @readonly
         */

    }, {
        key: 'screenWorldWidth',
        get: function get() {
            return this._worldWidth * this.scale.x;
        }

        /**
         * world height in screen coordinates
         * @type {number}
         * @readonly
         */

    }, {
        key: 'screenWorldHeight',
        get: function get() {
            return this._worldHeight * this.scale.y;
        }

        /**
         * get center of screen in world coordinates
         * @type {PIXI.PointLike}
         */

    }, {
        key: 'center',
        get: function get() {
            return { x: this.worldScreenWidth / 2 - this.x / this.scale.x, y: this.worldScreenHeight / 2 - this.y / this.scale.y };
        },
        set: function set(value) {
            this.moveCenter(value);
        }
    }, {
        key: 'corner',
        get: function get() {
            return { x: -this.x / this.scale.x, y: -this.y / this.scale.y };
        },
        set: function set(value) {
            this.moveCorner(value);
        }
    }, {
        key: 'right',
        get: function get() {
            return -this.x / this.scale.x + this.worldScreenWidth;
        },
        set: function set(value) {
            this.x = -value * this.scale.x + this.screenWidth;
            this._reset();
        }

        /**
         * world coordinates of the left edge of the screen
         * @type {number}
         */

    }, {
        key: 'left',
        get: function get() {
            return -this.x / this.scale.x;
        },
        set: function set(value) {
            this.x = -value * this.scale.x;
            this._reset();
        }

        /**
         * world coordinates of the top edge of the screen
         * @type {number}
         */

    }, {
        key: 'top',
        get: function get() {
            return -this.y / this.scale.y;
        },
        set: function set(value) {
            this.y = -value * this.scale.y;
            this._reset();
        }

        /**
         * world coordinates of the bottom edge of the screen
         * @type {number}
         */

    }, {
        key: 'bottom',
        get: function get() {
            return -this.y / this.scale.y + this.worldScreenHeight;
        },
        set: function set(value) {
            this.y = -value * this.scale.y + this.screenHeight;
            this._reset();
        }
        /**
         * determines whether the viewport is dirty (i.e., needs to be renderered to the screen because of a change)
         * @type {boolean}
         */

    }, {
        key: 'dirty',
        get: function get() {
            return this._dirty;
        },
        set: function set(value) {
            this._dirty = value;
        }

        /**
         * permanently changes the Viewport's hitArea
         * <p>NOTE: normally the hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, Viewport.worldScreenHeight)</p>
         * @type {(PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle)}
         */

    }, {
        key: 'forceHitArea',
        get: function get() {
            return this._forceHitArea;
        },
        set: function set(value) {
            if (value) {
                this._forceHitArea = value;
                this.hitArea = value;
            } else {
                this._forceHitArea = false;
                this.hitArea = new PIXI.Rectangle(0, 0, this.worldWidth, this.worldHeight);
            }
        }
    }, {
        key: 'pause',
        get: function get() {
            return this._pause;
        },
        set: function set(value) {
            this._pause = value;
            if (value) {
                this.touches = [];
                this.leftDown = false;
            }
        }
    }]);

    return Viewport;
}(PIXI.Container);

/**
 * fires after a mouse or touch click
 * @event Viewport#clicked
 * @type {object}
 * @property {PIXI.PointLike} screen
 * @property {PIXI.PointLike} world
 * @property {Viewport} viewport
 */

/**
 * fires when a drag starts
 * @event Viewport#drag-start
 * @type {object}
 * @property {PIXI.PointLike} screen
 * @property {PIXI.PointLike} world
 * @property {Viewport} viewport
 */

/**
 * fires when a drag ends
 * @event Viewport#drag-end
 * @type {object}
 * @property {PIXI.PointLike} screen
 * @property {PIXI.PointLike} world
 * @property {Viewport} viewport
 */

/**
 * fires when a pinch starts
 * @event Viewport#pinch-start
 * @type {Viewport}
 */

/**
 * fires when a pinch end
 * @event Viewport#pinch-end
 * @type {Viewport}
 */

/**
 * fires when a snap starts
 * @event Viewport#snap-start
 * @type {Viewport}
 */

/**
 * fires when a snap ends
 * @event Viewport#snap-end
 * @type {Viewport}
 */

/**
 * fires when a snap-zoom starts
 * @event Viewport#snap-zoom-start
 * @type {Viewport}
 */

/**
 * fires when a snap-zoom ends
 * @event Viewport#snap-zoom-end
 * @type {Viewport}
 */

/**
 * fires when a bounce starts in the x direction
 * @event Viewport#bounce-x-start
 * @type {Viewport}
 */

/**
 * fires when a bounce ends in the x direction
 * @event Viewport#bounce-x-end
 * @type {Viewport}
 */

/**
 * fires when a bounce starts in the y direction
 * @event Viewport#bounce-y-start
 * @type {Viewport}
 */

/**
 * fires when a bounce ends in the y direction
 * @event Viewport#bounce-y-end
 * @type {Viewport}
 */

/**
 * fires when for a mouse wheel event
 * @event Viewport#wheel
 * @type {object}
 * @property {object} wheel
 * @property {number} wheel.dx
 * @property {number} wheel.dy
 * @property {number} wheel.dz
 * @property {Viewport} viewport
 */

/**
 * fires when a wheel-scroll occurs
 * @event Viewport#wheel-scroll
 * @type {Viewport}
 */

/**
 * fires when a mouse-edge starts to scroll
 * @event Viewport#mouse-edge-start
 * @type {Viewport}
 */

/**
 * fires when the mouse-edge scrolling ends
 * @event Viewport#mouse-edge-end
 * @type {Viewport}
 */

/**
 * fires when viewport moves through UI interaction, deceleration, or follow
 * @event Viewport#moved
 * @type {object}
 * @property {Viewport} viewport
 * @property {string} type (drag, snap, pinch, follow, bounce-x, bounce-y, clamp-x, clamp-y, decelerate, mouse-edges, wheel)
 */

/**
 * fires when viewport moves through UI interaction, deceleration, or follow
 * @event Viewport#zoomed
 * @type {object}
 * @property {Viewport} viewport
 * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom)
 */

PIXI.extras.Viewport = Viewport;

module.exports = Viewport;

},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Plugin = require('./plugin');

module.exports = function (_Plugin) {
    _inherits(Wheel, _Plugin);

    /**
     * @private
     * @param {Viewport} parent
     * @param {object} [options]
     * @param {number} [options.percent=0.1] percent to scroll with each spin
     * @param {boolean} [options.reverse] reverse the direction of the scroll
     * @param {PIXI.Point} [options.center] place this point at center during zoom instead of current mouse position
     *
     * @event wheel({wheel: {dx, dy, dz}, event, viewport})
     */
    function Wheel(parent, options) {
        _classCallCheck(this, Wheel);

        var _this = _possibleConstructorReturn(this, (Wheel.__proto__ || Object.getPrototypeOf(Wheel)).call(this, parent));

        options = options || {};
        _this.percent = options.percent || 0.1;
        _this.center = options.center;
        _this.reverse = options.reverse;
        return _this;
    }

    _createClass(Wheel, [{
        key: 'wheel',
        value: function wheel(e) {
            if (this.paused) {
                return;
            }

            var change = void 0;
            if (this.reverse) {
                change = e.deltaY > 0 ? 1 + this.percent : 1 - this.percent;
            } else {
                change = e.deltaY > 0 ? 1 - this.percent : 1 + this.percent;
            }
            var point = this.parent.getPointerPosition(e);

            var oldPoint = void 0;
            if (!this.center) {
                oldPoint = this.parent.toLocal(point);
            }
            this.parent.scale.x *= change;
            this.parent.scale.y *= change;
            this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' });
            var clamp = this.parent.plugins['clamp-zoom'];
            if (clamp) {
                clamp.clamp();
            }

            if (this.center) {
                this.parent.moveCenter(this.center);
            } else {
                var newPoint = this.parent.toGlobal(oldPoint);
                this.parent.x += point.x - newPoint.x;
                this.parent.y += point.y - newPoint.y;
            }
            this.parent.emit('moved', { viewport: this.parent, type: 'wheel' });
            this.parent.emit('wheel', { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent });
            e.preventDefault();
        }
    }]);

    return Wheel;
}(Plugin);

},{"./plugin":9}],15:[function(require,module,exports){

/*
	Copyright © 2001 Robert Penner
	All rights reserved.

	Redistribution and use in source and binary forms, with or without modification, 
	are permitted provided that the following conditions are met:

	Redistributions of source code must retain the above copyright notice, this list of 
	conditions and the following disclaimer.
	Redistributions in binary form must reproduce the above copyright notice, this list 
	of conditions and the following disclaimer in the documentation and/or other materials 
	provided with the distribution.

	Neither the name of the author nor the names of contributors may be used to endorse 
	or promote products derived from this software without specific prior written permission.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
	EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
	MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
	GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
	AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
	NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
	OF THE POSSIBILITY OF SUCH DAMAGE.
 */

(function() {
  var penner, umd;

  umd = function(factory) {
    if (typeof exports === 'object') {
      return module.exports = factory;
    } else if (typeof define === 'function' && define.amd) {
      return define([], factory);
    } else {
      return this.penner = factory;
    }
  };

  penner = {
    linear: function(t, b, c, d) {
      return c * t / d + b;
    },
    easeInQuad: function(t, b, c, d) {
      return c * (t /= d) * t + b;
    },
    easeOutQuad: function(t, b, c, d) {
      return -c * (t /= d) * (t - 2) + b;
    },
    easeInOutQuad: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t + b;
      } else {
        return -c / 2 * ((--t) * (t - 2) - 1) + b;
      }
    },
    easeInCubic: function(t, b, c, d) {
      return c * (t /= d) * t * t + b;
    },
    easeOutCubic: function(t, b, c, d) {
      return c * ((t = t / d - 1) * t * t + 1) + b;
    },
    easeInOutCubic: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t + b;
      } else {
        return c / 2 * ((t -= 2) * t * t + 2) + b;
      }
    },
    easeInQuart: function(t, b, c, d) {
      return c * (t /= d) * t * t * t + b;
    },
    easeOutQuart: function(t, b, c, d) {
      return -c * ((t = t / d - 1) * t * t * t - 1) + b;
    },
    easeInOutQuart: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t * t + b;
      } else {
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
      }
    },
    easeInQuint: function(t, b, c, d) {
      return c * (t /= d) * t * t * t * t + b;
    },
    easeOutQuint: function(t, b, c, d) {
      return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
    },
    easeInOutQuint: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return c / 2 * t * t * t * t * t + b;
      } else {
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
      }
    },
    easeInSine: function(t, b, c, d) {
      return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
    },
    easeOutSine: function(t, b, c, d) {
      return c * Math.sin(t / d * (Math.PI / 2)) + b;
    },
    easeInOutSine: function(t, b, c, d) {
      return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
    },
    easeInExpo: function(t, b, c, d) {
      if (t === 0) {
        return b;
      } else {
        return c * Math.pow(2, 10 * (t / d - 1)) + b;
      }
    },
    easeOutExpo: function(t, b, c, d) {
      if (t === d) {
        return b + c;
      } else {
        return c * (-Math.pow(2, -10 * t / d) + 1) + b;
      }
    },
    easeInOutExpo: function(t, b, c, d) {
      if (t === 0) {
        b;
      }
      if (t === d) {
        b + c;
      }
      if ((t /= d / 2) < 1) {
        return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
      } else {
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
      }
    },
    easeInCirc: function(t, b, c, d) {
      return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
    },
    easeOutCirc: function(t, b, c, d) {
      return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
    },
    easeInOutCirc: function(t, b, c, d) {
      if ((t /= d / 2) < 1) {
        return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
      } else {
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
      }
    },
    easeInElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d) === 1) {
        b + c;
      }
      if (!p) {
        p = d * .3;
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
    },
    easeOutElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d) === 1) {
        b + c;
      }
      if (!p) {
        p = d * .3;
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
    },
    easeInOutElastic: function(t, b, c, d) {
      var a, p, s;
      s = 1.70158;
      p = 0;
      a = c;
      if (t === 0) {
        b;
      } else if ((t /= d / 2) === 2) {
        b + c;
      }
      if (!p) {
        p = d * (.3 * 1.5);
      }
      if (a < Math.abs(c)) {
        a = c;
        s = p / 4;
      } else {
        s = p / (2 * Math.PI) * Math.asin(c / a);
      }
      if (t < 1) {
        return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
      } else {
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
      }
    },
    easeInBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      return c * (t /= d) * t * ((s + 1) * t - s) + b;
    },
    easeOutBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    },
    easeInOutBack: function(t, b, c, d, s) {
      if (s === void 0) {
        s = 1.70158;
      }
      if ((t /= d / 2) < 1) {
        return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
      } else {
        return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
      }
    },
    easeInBounce: function(t, b, c, d) {
      var v;
      v = penner.easeOutBounce(d - t, 0, c, d);
      return c - v + b;
    },
    easeOutBounce: function(t, b, c, d) {
      if ((t /= d) < 1 / 2.75) {
        return c * (7.5625 * t * t) + b;
      } else if (t < 2 / 2.75) {
        return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;
      } else if (t < 2.5 / 2.75) {
        return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;
      } else {
        return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;
      }
    },
    easeInOutBounce: function(t, b, c, d) {
      var v;
      if (t < d / 2) {
        v = penner.easeInBounce(t * 2, 0, c, d);
        return v * .5 + b;
      } else {
        v = penner.easeOutBounce(t * 2 - d, 0, c, d);
        return v * .5 + c * .5 + b;
      }
    }
  };

  umd(penner);

}).call(this);

},{}]},{},[13]);

/*jslint plusplus: true, vars: true, indent: 2 */
/* convertPointFromPageToNode.js from
 <script src="https://gist.github.com/Yaffle/1145197.js"></script>

  convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y}
  returns coordinate in element's local coordinate system (works properly
  with css transforms without perspective projection)
  convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y}
  returns coordinate in window's coordinate system (works properly with
  css transforms without perspective projection)
*/

(function () {
    'use strict'

    var I = (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix() : new WebKitCSSMatrix()

    function Point(x, y, z) {
        this.x = x
        this.y = y
        this.z = z
    }

    Point.prototype.transformBy = function (matrix) {
        var tmp = matrix.multiply(I.translate(this.x, this.y, this.z))
        return new Point(tmp.m41, tmp.m42, tmp.m43)
    }

    function createMatrix(transform) {
        try {
            return (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix(transform) : new WebKitCSSMatrix(transform)
        } catch(e) {
            console.warn(transform)
            console.warn(e.toString())
            return I
        }
    }

    function getTransformationMatrix(element) {
        var transformationMatrix = I
        var x = element

        while (x != undefined && x !== x.ownerDocument.documentElement) {
            var computedStyle = window.getComputedStyle(x, undefined)
            var transform = computedStyle.transform || 'none'
            var c = transform === 'none' ? I : createMatrix(transform)
            transformationMatrix = c.multiply(transformationMatrix)
            x = x.parentNode
        }

        var w = element.offsetWidth
        var h = element.offsetHeight
        var i = 4
        var left = +Infinity
        var top = +Infinity
        while (--i >= 0) {
            var p = new Point(i === 0 || i === 1 ? 0 : w, i === 0 || i === 3 ? 0 : h,
                        0).transformBy(transformationMatrix)
            if (p.x < left) {
                left = p.x
            }
            if (p.y < top) {
                top = p.y
            }
        }
        var rect = element.getBoundingClientRect()
        transformationMatrix = I.translate(window.pageXOffset + rect.left - left,
                                        window.pageYOffset + rect.top - top, 0)
                            .multiply(transformationMatrix)
        return transformationMatrix
    }

    window.convertPointFromPageToNode = function (element, pageX, pageY) {
        return new Point(pageX, pageY, 0).transformBy(
                                    getTransformationMatrix(element).inverse())
    }

    window.convertPointFromNodeToPage = function (element, offsetX, offsetY) {
        return new Point(offsetX, offsetY, 0).transformBy(
                                    getTransformationMatrix(element))
    }

}());

(function () {

var module = {
    exports: null
};
/**
 * @constructor
 * @param {!{patterns: !Object, leftmin: !number, rightmin: !number}} language The language pattern file. Compatible with Hyphenator.js.
 */
function Hypher(language) {
    var exceptions = [],
        i = 0;
    /**
     * @type {!Hypher.TrieNode}
     */
    this.trie = this.createTrie(language['patterns']);

    /**
     * @type {!number}
     * @const
     */
    this.leftMin = language['leftmin'];

    /**
     * @type {!number}
     * @const
     */
    this.rightMin = language['rightmin'];

    /**
     * @type {!Object.<string, !Array.<string>>}
     */
    this.exceptions = {};

    if (language['exceptions']) {
        exceptions = language['exceptions'].split(/,\s?/g);

        for (; i < exceptions.length; i += 1) {
            this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp('(' + exceptions[i].split('\u2027').join(')(') + ')', 'i');
        }
    }
}

/**
 * @typedef {{_points: !Array.<number>}}
 */
Hypher.TrieNode;

/**
 * Creates a trie from a language pattern.
 * @private
 * @param {!Object} patternObject An object with language patterns.
 * @return {!Hypher.TrieNode} An object trie.
 */
Hypher.prototype.createTrie = function (patternObject) {
    var size = 0,
        i = 0,
        c = 0,
        p = 0,
        chars = null,
        points = null,
        codePoint = null,
        t = null,
        tree = {
            _points: []
        },
        patterns;

    for (size in patternObject) {
        if (patternObject.hasOwnProperty(size)) {
            patterns = patternObject[size].match(new RegExp('.{1,' + (+size) + '}', 'g'));

            for (i = 0; i < patterns.length; i += 1) {
                chars = patterns[i].replace(/[0-9]/g, '').split('');
                points = patterns[i].split(/\D/);
                t = tree;

                for (c = 0; c < chars.length; c += 1) {
                    codePoint = chars[c].charCodeAt(0);

                    if (!t[codePoint]) {
                        t[codePoint] = {};
                    }
                    t = t[codePoint];
                }

                t._points = [];

                for (p = 0; p < points.length; p += 1) {
                    t._points[p] = points[p] || 0;
                }
            }
        }
    }
    return tree;
};

/**
 * Hyphenates a text.
 *
 * @param {!string} str The text to hyphenate.
 * @return {!string} The same text with soft hyphens inserted in the right positions.
 */
Hypher.prototype.hyphenateText = function (str, minLength) {
    minLength = minLength || 4;

    // Regexp("\b", "g") splits on word boundaries,
    // compound separators and ZWNJ so we don't need
    // any special cases for those characters. Unfortunately
    // it does not support unicode word boundaries, so
    // we implement it manually.
    var words = str.split(/([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g);

    for (var i = 0; i < words.length; i += 1) {
        if (words[i].indexOf('/') !== -1) {
            // Don't insert a zero width space if the slash is at the beginning or end
            // of the text, or right after or before a space.
            if (i !== 0 && i !== words.length - 1 && !(/\s+\/|\/\s+/.test(words[i]))) {
                words[i] += '\u200B';
            }
        } else if (words[i].length > minLength) {
            words[i] = this.hyphenate(words[i]).join('\u00AD');
        }
    }
    return words.join('');
};

/**
 * Hyphenates a word.
 *
 * @param {!string} word The word to hyphenate
 * @return {!Array.<!string>} An array of word fragments indicating valid hyphenation points.
 */
Hypher.prototype.hyphenate = function (word) {
    var characters,
        characterPoints = [],
        originalCharacters,
        i,
        j,
        k,
        node,
        points = [],
        wordLength,
        lowerCaseWord = word.toLowerCase(),
        nodePoints,
        nodePointsLength,
        m = Math.max,
        trie = this.trie,
        result = [''];

    if (this.exceptions.hasOwnProperty(lowerCaseWord)) {
        return word.match(this.exceptions[lowerCaseWord]).slice(1);
    }

    if (word.indexOf('\u00AD') !== -1) {
        return [word];
    }

    word = '_' + word + '_';

    characters = word.toLowerCase().split('');
    originalCharacters = word.split('');
    wordLength = characters.length;

    for (i = 0; i < wordLength; i += 1) {
        points[i] = 0;
        characterPoints[i] = characters[i].charCodeAt(0);
    }

    for (i = 0; i < wordLength; i += 1) {
        node = trie;
        for (j = i; j < wordLength; j += 1) {
            node = node[characterPoints[j]];

            if (node) {
                nodePoints = node._points;
                if (nodePoints) {
                    for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) {
                        points[i + k] = m(points[i + k], nodePoints[k]);
                    }
                }
            } else {
                break;
            }
        }
    }

    for (i = 1; i < wordLength - 1; i += 1) {
        if (i > this.leftMin && i < (wordLength - this.rightMin) && points[i] % 2) {
            result.push(originalCharacters[i]);
        } else {
            result[result.length - 1] += originalCharacters[i];
        }
    }

    return result;
};

module.exports = Hypher;
window['Hypher'] = module.exports;

window['Hypher']['languages'] = {};
}());(function ($) {
    $.fn.hyphenate = function (language) {
        if (window['Hypher']['languages'][language]) {
            return this.each(function () {
                var i = 0, len = this.childNodes.length;
                for (; i < len; i += 1) {
                    if (this.childNodes[i].nodeType === 3) {
                        this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText(this.childNodes[i].nodeValue);
                    }
                }
            });
        }
    };
}(jQuery));
(function () {

var module = {
    exports: null
};

module.exports = {
	'id': 'de',
	'leftmin': 2,
	'rightmin': 2,
	'patterns': {
		3 : "2aaa1äa1ba1da1ga1j2aoa1öa1p2aqa1ßa2ua1xä1aä1bä1dä1gä1jä1k1äqä1ß1äxä1z1bibl21cacä3c1dc4h1cic1jc4k3co2cp2cs3cu1cy1de1did1ö1due1be1d4eee1fe1ge1ke1m2eoe1pe1qe1ße1te3üe1wey1e1z1fa1fä1fe1fi1fo1fö1fu1fü1fy2gd1geg1n1guh1j2hl2hnh1q2hr4hsh2ü2hwh1zi1a2iä2ici1d2ifi1ji1ßi1üj2u1ka1käkl21ko1kök1q2ks1kü1le1li4ln1lo1lö1ly1ma3mä1me1mi1mo1mö1mu1mü1my1na1nä1ne1nin1j1noo1b2oco1d2oi2ol2omo1qo2uo1vo1xö1bö1dö1e1öf2önöo1ö1ßö1vö1wö1zp2a1päp2e1php1j1puqu42rc1re1ri4rnr1q1ru1rü1ry1sa1sä1sc1se1si1so1sös1t1su1sü1ße1ßiß1j1ßu1ta1tä1tet1h1ti1to2tö2ts1tu2tü2ua2ucu1h2uiu1ju1lun12uou1q2usu1w1üb2üc2üdü1gü1k2ünü1ß2ütü1vü1zve2v2r2vsw2aw2ä2wnw2rw2ux1a1xe1xix1jx1q1xu2xyx1zy1by1ey1gy1hy1jy1ly1py1ry1vy1wy1yzä2zu1zw2",
		4 : "_ax4_äm3_ch2_en1_eu1_fs4_gd2_gs4_he2_ia4_in1_ks2_oa3_öd2_pf4_ph4_ps2_st4_th4_ts2_um3_ur1_xe3a1abaa1ca3au2abaab1ä1abd1abf1abg1abh2abi1abkab1l1abnab3r1abs2abu2abü1abw2aby1abz2aca2acc2acu1add2adf2adh5adj2ado2adp2adq2adu2a1eae2bae2cae2da2ekae2pa2eta2ewae2xaf1a2afe2afia2fö2agaag2n2agt2ah_2ahsa1huah1wa1hyaif2a2il2aisaje22ak_2akb2akc2akd4ako2aks1akza1laa1lä2ale2ali2aloa1lu4aly2am_2amä2amf2amk2amla2mö2amu1anb2ane1anf1anh2anj1anl2anna1nö1anra1nü1anwao1ia1opa1or2ap_2apa2apea2pfap2n2apr2ar_a1raa1rä1arb2are2arf2arh2ari2arr2arua2rü2arv2ary4asha2söa2süaße22a1tata1at2cat2eat2h3atmat1ö4atra3tü2au_2aub4auc2aue2aug2auj4aum4aunau1o2auu2auw2aux2auz2a1ü2a1v4avia2vr2a1wax2eays4ay3t2a1zaz2aaz2oaz2uäb2sä1ckä2daä2dräd2s2ä1eäf3läf3räf2säg2näh1aä3hi2ähm2ähsä1huäh1wä1imä1la2äleä1lu2ämläm2s2än_2äne2änsä1onä1paär1äär1c4äreä1röä2rü1ärzä3suä3teät2häu1cä2uf1äug4äul2äumä2un2äur1äuß4ä1v3bah3basb2ärb2äs4b1bb3bebb2sbbu12b1c3be_3bea3beb3bek3bel1bembe1o3bet1bezbge3bib23bilbiz24b1j2bl_b2leb2lo3blü2b1mbni2bo4abo2cboe1b1op2böfb1öl2b1qb2r42br_3brä3brü4b1sb3säb3scb4slb2söbss2bs2t4b3tb5teb4thbt4rbtü1bu2fbü1c2b1v2b1w3by1by3pbys2ca1h3camc4an3carcäs22c1ccch22cec2cefce1i2cek1cen1cer1cetce1u2c1f4ch_2chb2chc2chd2chf2chg2chh2chj2chk2chp4chs2cht4chü2chv4chw1chy2chzci1cci2s4ck_ck1ack1ä2ckb2ckc2ckd1cke2ckf2ckg2ckh1cki2ckk2ckm2ckp4cks2ckt1cku2ckv2ckw1cky2ckzclo1co2ccoi22c1qcre2cry2cs2ac2si4c1tcti22c1z3da_da1ad1afd1agda1sdä2u2d1cd3dhd5dodeg2d1eides1det2dga2d3gl3di_3dicdi2edi1p2d1j4d1ld3ladni2d1obdo2o2d1qd2r4d3rid3rö2d1s4dsb4dsld2södss4dst42d1td2thdto2d3tödt3rd3tüdu2fdu1idu1odur22düb3düf3dün2d1wdwa2dy2s2d1z2e1aea2ceak1eam3e2ase1ä22eba2ebl2ebre3bue1ce2ecle3cr2ected2eed2öee1eeeg2e1eie1en2ef_2efa2efe2efi2eflefs22efu2efüegd4e3gee2gn2egue1hee1hi2ehme1hoehs22ehte1hue1hüeh1we1hy4eibe2idei1ee4ilei1p2eire2it2eiu2e1jek2a1ekdek4nek2oek4r2ektek2ue1la2eli2eln2eloe1lü2elz2ema2emm2emüen3fe4nre4nten1ue1nüe1nye1ofe1ohe4ole1ore1ove1ö2e3pae3puer1ae1räer1cer3h2erie1roer1ö2eru2esbes2c2esf4eshes3l2esmes2ö2esp2esres3we3syes3ze3teet2he3tie3tö2etre3tü2etz2euf1euke1um2euneu1p2eut2eux2e1ve3vo2ewae3wä2eweew2s2ex_3exp2exuey4neys4e3ziez2wfab43facf4ahf2alf2arf3atfä1cf1äu2f1cfe2c3fewf1ex3fez2f1fff2efff4ff3lff2s3fi_fid2fi2ofi2r3fis3fiz2f1jf2l22fl_1fläf3löf4lü2föf2f1qf2r2f3ruf3rü4f1sf3scf3sifs2tf2süf3sy4f1tf2thf3töf3tü3fugf1umf2ur3fut2fübfü2r2f1v2f1w2f1zfz2afz2öfzu33ga_ga1c5gaiga1kgäs5gä4ugbi22g1cg1dag1dog1dögdt4gd1uge1cged4gef4g2el4g1gg3gegg4r2g1h4gh_gh2egh1lg2hugh1w2g1j4gl_2gls3glüg2ly2gn_gn2e2gng2gnp2gns2gnt2gnug2nüg2ny2gnzgo4a2goggo1igo1y2g1qg2r4gse2g4slgso2gsp4g4swg3sy2g1tg3tegt2sg3tügu1cgu2egu2t2gübgür1güs32g1v2g1w3haah1ahh1aph2as2h1c2heahe3x2hi_2hiahi2ehi2n2hio2hiuhlb4hld4hlg4hll2hlm2h2lo2h1mh2moh3möhm2sh2muh2nah2nähn2eh1nu2hodhoe42hoih2on2hoo2hop3hov1h2öhö2ch4örhr1chr3dhrf2hrg2h2rihrr4h3rüh2ryhrz2hss24h1th2thhto2h4tshtt4h3tühu1chu2n2hurhüs32h1vhvi23hyg3hyphz2o2ia_i4aai2ab2iaci2afi2ahi3aii2aji2ak2iali2am2iani2apia1q2iasi3au2iavi1ämiär22i1bib2oi2böice1idt4i2dyie1ci1eii1exif3lif3rif2s2i1gi2gli3go4i1hi3heih3mih3nih3rihs2ih1wi3i2ii4s2i1k4ikei2kni1la6ilbil2cilf22iloilv42im_2ime2imo2imt2imu2inein3f2inoi1nö2inp2inrin1ui1ny2i1oio1cio2dion2i2ori2oui2ovio2xi3ön2ip_i1pai1peiph2ip4li1pr2ips2ipu2i1qi1räir1cir2eir2i2irki1roi1rö2isb2iseis3ti2sü4itäi6tli3töi3tü2itzium12i1v2i1w2i1xi2xai3xi2i1zi2zöja1c2jatje2aje1cje2gje2pje3wji2ajit3ji2vjoa3jo2iju2kjus32j1v3ka_ka1ck2adk2agka2o3kask1ähk1änkär2kby42k3cki1c3kir2kiz2k3j4kl_k2lek1lu2kly2k1mk2n2k3nek3nu3knü3komk2onk2os3kowkö2fk1ölk2r4kst44k1tk2thktt2k3tükt3zku1ckuh12kübkü1c2k1v2k1w3la_1lad2laf1lai3lao1lawlay1lä1c1läd2läf4lät2l1blb2slb2u2l1c4l1dld3rldt43le_2lec3ledle2e3lehl2ek2leple2u3levl2ey2l1flf4u2l1glgd4l3go3li_3liali1cl2ie3ligli3l2limli2o3liu4l1j2l1klk2l4l1lllb4llg4llk4ll5mlln22l1mlm3plm3tlnd2l3nil1nul1nü3loklo2o2lox2löd4lög4löß2l1plp2fl3pu2l1q4l1s4l1tl2thl6tsltt2l3tü1luf4luo2lur3lux2lüb5lüd2l1v2l3wly3c3lynly1oly3u2l1zl2zölz1wm1abmae2ma1f3mas3maßm4aymb4lmby42m3c2m1dmd1ameb43mehme1o2meö3mesmeu13mi_mi1c3mig3mil3mit2m1jm3ka4m1lm3li4m1mmmd2mmm2mm3pmm2smoa33moh3mom3mos3motmo1ymö2c4mökm1öl2m1pm2pfm3pim3pu2m1q4m1sm3säm3scm3sem2süm3sy4m1tm2thm3tömtt2m3tümt3zmu1a3munm4us2müb3mün3müt2m1vmwa2my4s2m1z3na_n1af3nain1ar3nas3natn1au3näe3näs2näunby42n1cn2ck2n1dn2döndy33ne_2nec3nedn1efneg4ne2l3nenne2un2ew3nez2n1fnf2änff4n3finf4lnf2onf4rnf3s4n1gng3mn2gnn3hän3hen3hu3nian1idn4ie3niknin1n2ip2nitni3v3nix2n1k4n1nnn3fnng4n3ni3no_no1cn1of3nov3now3noz2nödn2ör2n1q6n1snsp4n3sy2n1tn3ton3tön4tsn3tun3tü1nu_1nud3nuenuf21nug1nuinu2n1nuo2nup2nur1nut1nuu1nux1nuz3nü_3nüs1nüt4n1w1ny_1nyhn1yo1nyr1nys1nyw2n1znz3so4aco4ado4aho2aro2aso4ato5au2obbob2e1objob1lo3cao1ceo1ck2odrodt4o2ecoen12ofa2ofiof3l2ofo2oft2o1go3ghogs2o1hao1häo1heo1hio1hooh1soh3to1huoh1wo3ieo1imo1inoi2r2o1j2o1kok4n4okrokt4o1lao1läol2io3loo1lu3olyoms2omy12ona2onä2onc2oneono1o1nuon3v1onyon3zoof2o1opo1oro1pao1pi2or_or1ao3räor1c4ore2orf2orh2orm2orq2orro3ru2osh2osio3sk2oso2o1to3tüoub4oug2o3uho3um2our2ouv2o1ü2ovi2ovo2o1wo3wiox2aox2eo2xu1oxyo1yo2o1zoz2eo3ziöb2l2ö1cödi3öf3lög3lög3rö1heö1huö1keök3r3öl_öls2öm2sön2eö3niön2sö1nuö1peör1cöru4ö2saö2spö2stö3su2ö1töt2höts2öze31pa_1paa1pacpag41pak1pap2paß1pat1pau3päd3pär3päs2p1b2p3cpda41pe_pe2a1pedpef4pei13pel1pem1pep3pet4pf_1pfäpff4pf3r2p1g4ph_ph2a2phä2phb4phd2phf4phg4phkph2l2phm2phn2phöph4r2phs2phz3pik1pilpi2o3pip3pispku22pl_3pläp4lo2p1n1p2opo1c3podpo2i3pokpo2wpo3xpö2c2p1ppp3lppt2p2r2p4rä2p1s4ps_p3sep2söp2st2p1tpt1ap3tep2thptt2ptü4pt3zpu1apub42puc2pur3put1püf2pülpün22p1v2p1w3py1pys4py3t2p1z1ra_r1abr2ad1raer2afr2air2alr2apr1arr2as2raß1rat1raür2ax4räf4räg2räh2rämrä2u2r1brbb2rb2orb2srb2ur1ce2r1dr2dördt43re_2reä3reg3rekre2u2reür1ew3rez2r1frf2u4r1gr1h42rh_2rha2rhä2rhö2rhsrid2r2ie3rigr2isr2itrix12r1j2r1krk4n4r1lrl2erl3t4r1mrm2urnd4r3nern3frng2r3nirn1ör1nur1nür1nyro1c2rof3roir2onr1or4roß2rox2röf4rögr1ök4röpr1örrp4erpf4r3porp3tr3pu2r1rrrb2rr1crr2or3ru4r1sr3sirs3lr3sor3sy4r1tr3tör4tsrtt4r3türt3zru1a3ruf4rug2rum3rut4ruz2rüb2r1v2r1w4r1xry2c2r1zrz2ö3sa_3saa3sams1an3sat3säl2sc_s2ci2scj4scl2scos2cr2scs2scusd4r3see3seh3seq3set2s1hsh2as3häsh3ns3hösh4rsib43sio2s1j4sk_4skbsk4lsk4n4skö4skss3läsl3bs3les3li4sna4snö3so_so4aso1c3sog3sol3somso3o3sos3sov3sow3sozsö2csö2fs1ös1sp22sp_s2pä2spls3pn4spy2s1q6s1sss3l6st_s2ta2stb2stdst2e2stf2stg4sth2stj2stk4stl4stm2stns2to1stö2stp2stqs2trst2u1stü2stv2stwsu2n3suv3süc3sün4s3v2s1ws3was3we1s4ysyl12s1zsz2os3zü2ß1c2ß1d2ß1f2ß1h2ß1l2ß1mß1o2ßos2ßst22ß1t2ß1ü2ß1v2ß1w2ß1z3ta_4taatah2t2ai2tam3tas3tav3tax4täbtä1c4täd3täe3täg2täh4tämt1äptä2st2ät2täx4t1ct4ckt3cr3te_2teh3ten3tes4th_th2e1thi2thk2thp2ths2thü2thvt2hy3tig3tik3tio3tip3tis3tiv2t1j4t3ltl4e3to_to1c3tod3tok3ton3too4toß3tow4töftö4l3tön4töß3töttpf42t1q2tr_3tritry14ts_ts1ot2söt3sy4t1tt3tit3tot3töttt4t3tut3tü2tub3tuc2tud3tue4tuf2tuh2tuk4tüb3tüf3tüm4t3v4t3wtwa21ty13typtys44t1ztz1ätz2öu1amu3auu1ayu1ämu1äu2u1bub2lub1ru1ce2u1d2u1eu2edu2eguen1u2ep2uffuf3luf3r2u1gugo3u2göu2gü2uh_uh1wu1ieu3iguk2au1keu1kiuk4nuk2öu1kuulb4ulg4u2lü1umf1umg1umk1uml4umm1umr1umz4un_u3ne2unk1unruns21unt1unw2unzu3ofuos2u1pau3piu1pr2ur_u1raurd22ure2urfu1röur3purt2u3ruurü2u2sü2u1ß2u1tu3teuto1u3töu3tüu1ü22u1xux2eux2oux3tu1ya2u1z2übc2übdübe2üb3lüb3rüd3rüf3lü2gnüg3süh1aü1heüh1iüh1süh3tü1huüh1wül1aül2cül4eü1luün2sünt2ü1nuü1peü1piür1aürr2ür2süs2aü2stva1cva1sv4at2v1b2v1dve3bve3cve3dve3gve3hve4ive3over1ves12veüve3v2v1g2v1hvi2cvig22v1k2v1m2v1n3vol3voyvö2c2v1pv3revs2e2v3t2v1v2v1w2v1z1waa1wag1wah1walwa2p1was1wäh1wäl1wäswbu22w1c2w1dwe2a1weg1wehwe2i1wet2w1g2w3h1widwi2ewik21wil2w1k2w1l2w1mwn3s1wohwot21wöc2w1pw3ro2w1sws2t2w1twti21wucwul2wus21wühwül2wün32w1w1xa_1xae2x1b2x1c4x1d2xekxe2lx1emx2en3xes2x1f2x1g2x1hxib4xi1cxi3gxil12x1l2x1m2x1nx1or4x1p2x1r4x1txt1äxt1uxu1axu2s2x1v2x1w3xy_3xys1yacy1äty1c2y1d4y2efy1f2ygi2yg2lyhr2y1i4y1k2yl3cynt2y1nuy1ofyom2y1osy1ouypa2ype2y2pfy3phypo3y3riyrr2yse1y1t2yu2ry1z2za1c3zahz1anz1as2z3czdä1ze1e2z1h2z1j3zolzo2oz1orz1öl2zön2z1qz3saz3shz3skz3sz2z1tz3töz3tüzu3azub4zud4zu3kzuz22züb2z1v4z1zzz2ö",
		5 : "_ab1a_abi4_ab3l_abo2_ack2_ag4n_ag4r_ag2u_ai2s_ang2_an3s_apo1_aps2_as3t_at4h_au3d_ät2s_by4t_dab4_de1i_de1s_dü1b_dys1_ei3k_eke2_enn2_er1e_erf4_er1i_es1p_et2s_eu3t_ext4_fe2i_fi2s_ga4t_ge3u_hi2s_im2a_im5m_in3e_ink4_inu1_ire3_is2a_jor3_ka2i_ki4e_kus2_li2f_ma3d_ma2i_me2e_ne4s_ni4e_nob4_nus2_ob1a_obe2_or2a_ort2_ozo4_pro1_ro4a_ro3m_rü1b_sch4_sha2_te2e_te2f_te2s_ti2a_tid1_ti2s_to2w_umo2_un3d_un3e_un3g_un3s_ur2i_ut2a_ut3r_übe4_vo4r_wa2s_wi4e_wor2_ya4l_za2s_zi2e_zwe2aa2beaa2gr4a2araart2aas5tab2äuab1ebabe1eabei12abela3ber2abet2abew3abfiab1irab1it2ableab3liab4loa2blua2bo_ab2of2abora3braa4brä2abrü2abs_abs2aab5scab3spabst4ab3szab1uraby4ta1cem2ach_ach1a2achba1che4achfa1chiach3lach3mach3na1choach3öach3ra4chta1chuach3ü2achvac1in2ada_ad2agada2m4adav1a2dä2ade_2aden4a3diad2obad3ru2ads2ad3stad3szad2t1ad4tead4tra2elaa2eleae2o3aes5ta2faka2fana3faraf4ata2faua2fexaf2fl2af3lafo1saf3raaf3räaf3reaf3röaf2spag1abag1arag1auag2diag2drag2duage1iag2er2agesag3gl1aggr2a2glag4laa4glöag4nuag4roagsa2ags3pag2th2a1haah4at2a1heahe1sa1h2iahin3ah2löahnt21ahorah1osa2h3öahr1aah3riaht3saian3aid2sai1e2aien3ai3g4a3ik_ai3keai3kuai2loa1indain4ea1ingai2saaiso2a3iv_aive3a3ivla3ivs2akal2akarak4at4a1kea2kefa2keu2a1ki2ak3lak4li2a1kr4akra3akroak3sh2akta2aktb2a1kua2kun4a3kü2ala_al1abal1afala2ga3lalal1ama2larala4s2alatal1aual1ämal2bralb3sal2däal2dral3dualen1ale2pale4talf4r3algi3almba2l1öal3öfal2ös1alphal2ufa2lumal1ural2zw2am2aamab4amad2ama3g2am4e4ame_a2meba3meta2mewa3miea3mis2ammlammu2am3pr2am2sam3sa1amt_am4töam2tu2ana_2anabana3ca3nak2anam2ananan1äs2anbuan3ch2and_2andua3nee2anfi4ang_2angf2anghang1l2angoang1r2a3ni2ank_an3klank1rankt42anmu3annäan1oda3nola3nos2anpr1ansä1ansc2ansk2ant_2anto1antr1antw2a1nuanu3s2anzb2anzg2anzs1anzü2anzwa1os3ao3t2a3ot_a2pefap2faa3pfla3phäa2pht2ap3la2pot3applap3pu2a3pua3ra_ar2ab2arb_4arba2arbiar2bl2arbr2arbt2arbu1ar1ca2reaa4rega2reha4reka3renare3uar2ewarf1rar2glar2gnar2iaar1ima3riuarm2äarn2e2a1roar1oba2rorar2rh2arsaarse32arsiar2st2arto2artsar1ufar1uhar1umarwa2ar2zä2arze1arztas3aua2s1äa2sca4as2ea2seba3ses2asisas1ora2s1pas2phas2pias2poa3spuas2stas3teas3tias3to2astraßen3at1abat2afat4agata3la3tama2tatat1aua2t1ä4ate_a2teb4atena2tep4atesat3ha3athl4a3ti4atorat3räat3reat2saat2seat2siat2soat3taatt3sa3tubatu2nat2zoau2draue2baue2sau2faauff43aufn4au1iau2isau3lüaun2eau1nua4unz2aup22ausc1ausd3ausf1ausg1auslau2so1ausr1ausü1ausz2aut_2aute1autoauz2wa3v4aawi3eax4am2a1yaa1yeuaysi1ä2b3lä1cheä1chiäch3lä2chrä1chuäck2eäf2fläge1iäge3sä2g3lä2g3räg4ra1ä2gy2ä3heähl1aähl2eäh3neäh3riä1is_ä1iskä2k3lä2k3rälbe2äl2bläl2p3ämt2eän5deän2dräne1sän2f52ängeän2glän2gr2ä3niänk2eän2kränk2säp2pläp2präp4stär4afäre2när2grärk2särm2sär1o2ärse2är4siär2stärt4eär2thär2zwä5s4eäse3tä2s1päss2eäs2stäs4träte2nät1obä2t3rät2saät2sääts3lät4trät2zwäu2bräude3äu3eläuf2eäug3läu2maäun2eäu1nuäu3seä3usgä3uskä3usnäu2späu2trba2bl2babs2b1afbais2ba2kabak1lbak1rbal2a2b1amban2ab1ang2banlban3tb1anzbar3bbar3nba2scba2stbau3gbau1sba1yobben3bbe4pbb2lö2b3d4bde1sbe3anbe3arbe3asb2ebe1be1cbedi4be1eh3bef4be3g2beil2b2einbe3li1ben_ben3nbe1ra3be1sbes2abe1ur3b2ew2b1ex2b5f4bfal22b1g2bges42b5h2bhut2bi3akbibe2bie2sbik2abil2abi2lubin2ebi2o1bio3dbi3onbiri1bi3seb1isobi2spb2it_b2itebi2tu2b1k4b3lad3blatb3leb3blemb4letb3leub2lie2bligb4lisb2litb4locb3los2blun3blut4b3n2bnis1bo5asb1ob3bo2blbo2brbo3d22b1ofbo3febo1is3bon_bond1bo2ne3bonsbo4räbor2sb1ortbo2scbo3thbo2xibö2b32b1p2bpa2gb4ra_b4rahbrä4u2bre_3brea2breg3bremb4rer2brigb4riob3rohb4ronb4rucbru4sbs3arbsat2b4särbs2äubs2cabs4cub3se_bse2bbsi4tbs2kubso2rbs2plb3stob3stöb3stübtal3btil4b4ts2bu2e3bu3libung4b2urgbu2sa2b3z22c1abca2chca2e3ca3g4cal3tca2pecar3ncas3tca1y2ceco4ce2drcen3gcere3ce3sh2ceta2chab2chaf1chaoch1äs1chef4chei2chic2chl2ch2lech2lu4ch2m2chn42chobcho2fch1ohch2r44chrech3rh2chuf2chuh2chum1cka_2ckac1ckag2ckalcka4r2ckau2ckeh2ckexck1imck1in3ckis2ck3l2ck3nck1o22ck3rckt2e3c4l2clet4co3chco2d2co3dicoff4co1itco2keco2lecol2oco2peco1racor3dco3recos3tco4te1c4r2cte3ecti4octur6cu2p32d1ab2d1acd2ac_dagi2dah3lda1ho3d4aida1inda1isdal2ada3löd1altdamo3d4ampd2an_d1ang2danw2d1apd2aph4dapp3darlda2rod3arrdar3sd1artda2rudas4tdat2a4datmdau3e2dauk2d1äh2d1äp2därzdä3us2d1b4dbu2cdco4r2d1d2ddar2de2adde3asde3b43de1cde1e4de3gldehe2de3hod2eicde2löd2en_dend2den3gd2enhde2nide1nude1ondepi2d4er_de3rude2sade2spde2sude1unde3us2dexp2d1f42d1g2dga3gd2ge_2d1h2d2hisdi4abdi2addi4amdi1cediet3dik2adin2adi2obdi2spdist2di2tadi2thdit3sdi2tu3di5vdi3z22d1k4d3l2edli2f2d3m24d5n2dnis1d2obadob4ld2obrdole4doll22doped2opp2dorc2dordd2orp2dortd2os_dos3sdost1dot6hdo3undö2l13d2ör2d3p2drag4d3rai2drädd4räh4dre_2dreg4drem2d3rhd4ri_d4ridd4ried4rifd4rikd4rild3robd3rocd4roid3roud5rubdrü1bd2sands1änd3seidse4td3shodso2rd2späds2pods2pud2steds2tids2tud2sundta2dd5teadt3hodt5s2du1ardub3l2d1uh2dumd2dumf2dumg2dumld2ump2dumrd1umsdung42dunrdun2s2duntdus3t2d1v2e3a2beab3lea2drea2g4ea3gaea3gleakt2ea2laeam1oea2nae2anoe3ar_ea2rae3arre3arveas3se3athea5tre3aug2ebedebe2i2ebeleb2en2ebeteb3loeb2lö2eb2oebot2ebö2seb4rueb2s1ebse22e3caech1äe1chiech3lech3mech3ne1chuech1weci6a2eckteco3dec1s4e3d2aed2dre3deiede2re3d2oeds2äed2suedu2se3dy3ee3a2eeb2lee2ceee1chee2ckeede3e1effeef4leef3see1imeel2ee1empeena2e2enäe2encee3nie2enoeen3see1rae1erde1erkee1röeert2e1erzee3s2ees3kee3taee2thee1u2e1e2xef1are2fate2fäue3fe_ef1emef2er2eff_1effief2flefi2s1efkue3fraef4rüef3soef3spe2fumege1ue2gloeg3nieg2thegus32e1ha2e1häeh2eceh2ele3hereh1läehle2eh3loeh3mue3holehr1äeh3rieh3sheh3übei2blei3de2eidn1eifrei3gl2eigt2eigu2eil_2eilbeil3d2eilne1impei4näein3kei3o2eip2fei3ree1irre2is_2eitäei3teei2theitt4e3ke_e3kene3kese3keye3k2lekt2oe3k2wela2cel1afela2h2elaoela4s2e1läel2da2ele_elea2ele2c2eleh2elei1eleke3lepel2ete3leu2elevele2x1elf_el3feelf4l1elfm1elfte3lieel3klel3leelm2ael5nae2lofe2lolelon2elö2selto22e1luel1ure2lyaelz2eema2keme2se2mop3empfem2saem2stem3t21emule2n1a4ena_2enace3nade4naf4enahe4nak4enam4enaten1äu2ene_2enem2enen2enesenf2aenf2uen3geen2gl1engpe3ni_e3nice2nide3niee3nio2enise3nit2enive2nofen1ohe3nolen1one3noteno2w2e1nöen3sp1entd1entn2entü1entw1entz2enut4enwüeo2fee1on_e1onde1onfe1onhe1onle1onre1onse1opee1opfeop4te3or_e3orbe3orse3orweo1s2e3os_eo3ulepa2gep3leep2paep4plep2prept2aepu2se3ra_era2ge1raie2rake1rale1rape2rare1rasera2ße1rawe1razer1äher1ämerb2eer3brer3da1erdber3de4ere_er1ebere2l2erer2ereserf2eerf4rerg3s2erhüe3ribe3rio2erk_erk3te3ro_er3oaer1ofer1ohe3rone3rose3rowerö2d2eröker3p4er3rä2errüers2aer3seers2ier3sker3sner3sper3sz4ertier3uzerü4bes3abes3ake3sceesch2es2eles2hues2ide2siles2ire4skees3kles3kue4skye3sote3spies3sces3se2essoe1stre1stues4tüeße2setab4et1am3etapet4atet1ähet2enete2oet3hüeti2m2e3toeto2bets2pet3suett1aet2thet2zäet2zweu1a2eu2gaeugs4euil4eu1ineu2käe3um_e3umbe3umleun2eeu1o2eur2eeu3speust4eut2heu2zw4everewä2se2we_e3wirewi2se3witex3atex1er1exis2ext_ex2tu2e3xye3z2aezi2sf1abefab5sfa2drfaib4fa2ke2fanb2fanf2fanlf1anp2fanrfan3s2fanw2f1ap3farifa3shf3aug3f4avfa2xa2f1b22f3d4fdie2f2echfe2drfe2eife1emfef4lf4eief1eisfel3tf2em_fem4m2fempfe2näfen3gfe2nof1entf2er_fe1raf2eref2ertf1erwfe2st3fete2fexpff3arff1auffe2eff3eiffe2mff4enf2fexff4laff4läff4lof3fluf3flüff3roff3röffs3t4f3g2fge3s2f1h2fi3atfien3fi3klfi2krfil3dfilg4fi3lif2inafi3nifin2sfi3olfi3rafis2afis2pfi3tu4f1k4f3ladf3lapf3länf4leef3lerflo2wf4luc2f3m2fma2d2f3n2fni2sfob2l2f1offoli3fo2nafon2efo2nu2f1opfo1ra3form2f1ök2f1ölför2s4f1p2f4racf5radfra4mf5rap2fre_f3recf3red2fregf3repf4reufri3dfri2e2frig1frisf3rocfro2sf3rotf2sanfs3arf4scefs4cofse4tf2sphfs1prfs3s4fs3thf4ta_f2tabft1afft1anft1arf3tatft3hoft1opft2s1ftsa2ftse4ft3stf2tumftwa4ft3z23f2uhfung42funt2gabfgab4r2gabz2gadlga1flga2kagal2ag4amo2ganbgan3d2ganh2ganl2ganwga1ny2garb2garc3gardg2arsga3ruga2saga2siga3spgas3sgat2a2gatmgat4rgau1cg2aukg1aus2g1äp2gärz2g1b2gber2gby4tgd1ing1d3rgd3s2ge3a2geb2ageb4rge1e2ge3ecge2esge1imge1irge2isge3lege3lügelz2ge3migem2uge3nagen3ggen3ngeo2rge1ouge3p4ge1ragerm4ge3sigest2ge5trge1ulge1ur2g1ex2g1f4gga4tg2g3lgg4log2g3n3gh2rgie3ggi2elgi2gugi3negi3tugi4us4g3k2g1labg1lac3glad3glätg2l4e2gle_3gleag3lecg3leg2glehg3len2glesg4lia2glib2glif2gligg2lik4gling2lio2glisg2lizglo3gg2lom2g1luglu2t2g1m2g2n2ag4na_2gnacg4nat3g2näg3neh2gneug2nieg2nifg4nin3g2nogno1r2g1of2g1ohgol2a2gord2gorggo2s1go3stgo3th2g1p2g4rebg4remg4rerg3retg3revgri2e3grif2grig2groc2grohgron4g4rosgro4ug4ruf2grut4g2s1gsa2gg3salgs3angs3arg3s2cg4scagsch4g4scogs2ehgsen1gs3ergse4tgsi2dg3silg3spigs3plgsrü2gs5s4gs3tag3stog3stögs3trg3stugs3tügti2mg5t4rgu3amgu1as2guedguet42g1uhgu1is3gummgu4stgut1agut3h2g3z2hab2ahab2eh2absha1kl2haleh1alph1amth2an_h2andh4ann2hanr2hantha2plha2pr2harbh2ardhasi1h1äff2h3b22h3d4hdan2he2adhe3behe2blhe3brhed2ghee4she2fä2heffhe2frhe2fuhe3guh1eieh1eifh1eighe2im4heioh1eiwhe3lihe3lohe2lö3hemdhe3mi3hemmh2en_he2näheng22henihe2nohen3z4he2ohe3onhe3ophe3phherg22hermhe3roh1eröhert2he3thhet2ih2e2uheu3ghe1y22h3f4hfi2s2h3g2hget42h1h2hi2achi1ce2hi3dh2idehi2krh1infh1inhhi3nohi4onhi3or2hip1hi2phhi2pih2i2rhi3rahi3rihirn1hi3rohir2shis2ahi2sehi2sthi1thhi3ti2h1k4h4lachla2nh1lash1lath3lädh1läsh1läuh3lebhle3eh3lerh3lesh3lexh2lieh2lifh2liph2lish2lith3lochl1ofhl1oph4lorh3löch2löshl3t2h3lufh3lukh1lüfh2mabh3magh3manh3marh4mäch4mähh4mälh4mäuh3me_hme1eh3menh4monhm3p4hm3sahms1phn1adh3namhn1anhn3d4h2nelhn3exh2nich2nidh2niehn1imhn1inh2niphn3k4h2norhnts2h2nuch2nulho2blho2efho4fa3hole4holo3holzhom2ehono3ho1rahor3dh1orgho3slho2spho4st2hot_ho3thh1o2xho1y2hö3ckhö2s1h3öst2h3p2hr1achr3adh1raih3räuh2rech3redh3refh3relh3rephre2th3revh3richri4eh3rinh2robh3rohh3rolh4ronh2rorh3rouhrs3khr2suhr4swhr2thh3ruhh4rübh2sanh2sauh2späh2sphh1stah1stoh2s1uh2t1ahta4nht2ash2tärht1ehhte2sh4thohtod1h3töpht4riht3röht2soht2sphtti2ht3z2hu2buhuko3hu2lähu2loh1umsh1unah1up_h1upshurg2hu3sahu2sohu2tihut2th4übsh3übuhvil4hwe1c2hy2thzug4iab4liaf4li3ak_i3akti5al_ia2läial3bial3dialk2i3allia2lui3am_i4amoian2ei3anni2anoi3anti3anzi3ar_ia2rai2ascia3shi2asiias3siast4i3at_i4ate1iatri3atsia3uni1är_i1ärsi1ät_i1ätaib1eiibe4nibi2ki3blai3blei4bräich1aich1äi1chei1chiich3lich3mi1choi1chuich1wi3damid2ani2deiidni3i2dol2i2drie3a2ie2bäie2blie2ckie2drie1e2iel3di1ell2i1eni3en_i3enai3endi2enei3enfi3enhi3enji3enki3enmi3enni3enöi3enpi3enrien2sie1nui3envi3enwi3enzie1o2i2erei4erii1ernie2röie3sui1ettieu2eie1unif1arif4atif1aui2fecife2iif2enif2flif4läi1flüif4rai1freif3seif3spif2taiga3iig1läig4nai4gnäig4noig4raig3säig4seig3soi2harihe1eihe4ni4is_i4i3ti2käri3ki_ik1ini2k3lik3noiko3si2kölik3räik3reik1s2ik3soik3szikt2eikt3ri2kuni3kusi1lä1il2daild1oil2drile2hil1el2ill_2illsil3öfi1lu2i2lumi3lusim4ati2megi2meji2meki2mew1immo1impoimp4s1impuim2stin2afin3ami3napina4sin1äsin3do2indrin3eii3nelin1euine2x2ingain2gl4inhei3nie2inigin2ir2inis2inn_2innlin1odin1orino3tin3suint2hin3zwi2odaio3e4iof4li2o3hio3k4i3ol_i3om_i3omsi3on_ion3di2onyi2o1pio4pfi3opsi3opti3or_i3orci3orpi3orsi3ortio3s2i2osti3ot_i3otsi3oz_i1ö2ki1ös_ipen3i3perip3fa2i1piipi2sip2plip3pui1r2ai3radirat2ir2bli3ree2irekir2glirg4sir2he2irigir4mäir2no1ironiro2sirr2hir3seir3shir2sti3sacis2api2saui2scaise3eisi2ais1opis1pais1peis3sais2stis4töis4tüit1amit1ani3tatit1auit2ärität22itelite4ni2texi5thr1itiii5tocit3rei3truit2sait2soit1uhitut4it2zä2i3u2i2vebive4niwur2ix2emiz1apiz1auize2niz4erizo2bi2z1wja3nejani1ja1stje3najet3tjo2b1job3rjoni1jo1rajord2jo2scjou4lju2blju3nijur2ok3a2aka3ar2kabh2kabska1frka1inka3kak1allkalo5k3amakand4kan2ekank42kanlk1anska3nu2kanw3kara2karbk2ardk2argk2arkk2arskar3tkaru2k2arwka3sekasi1kas3s2kattk1auskäse32k3b4kbo4nkbu2s2k3d2k1effkefi4kege2ke2glk1einkei1skeit2ke2lake2läkel1ek4eltk2en_ke2no2keo2ke2plk2er_k2erck2erlkerz2k6es_ket3ske1up2k3f42k1g22k1h4kho3mki3a4ki3drki2elki3k4ki3liki3lok2imik2in_k2ing2kinhk2inik2innkin3ski3orkio4skis2pkist2ki3zi2k1k44kla_k4lar4kle_4kleh2klic2kligk2link3lipk2lir4klizk4lopklö2sk2lötkluf23knabk4neiko2al2kobjkoff4ko1i2kol4ako3leko4muko3nu2kop_ko1pe2kops2kopzko3riko2spko2stko3ta2k1ouko2wek1o2x2k1p2k4rawk4raz2kre_2kreg2k3rh2krib2krip3kris2krufkrü1bk2sanks3ark2sauks2änksch4ks3hak3sofks1pak3speks2puks3s2k1stak1stek1stok1strk1stuk2s1uk3talkt1amkt1anktä3skte3ekt1eik2texkt3hokt1imk3topkt4rokt3s4kul2a4kulpkung42kuntku2roku2spkus3tku2sukür4s2k3z2kze3lla3ba2labb2labf2labg2labhlab2ol2abrl1abt3labu2labwla1celad2il1adl2ladm3ladul1advla2falaf3slaf3tla2gala2gnlago2l2akk2l1al4lall4lalpl2amil2amp2lanb2lanf2lanll1anp2lanslar3sla2ru4lasdla3se2lash2lasila2so2laspla2stlat2ala3telat2s1lauglawa41länd2läub2läuc2läue1läufl3bacl3blälb3lel2blil3blolb3salb3selb4sklb3splbs6tl3chel3chilch3llch3rlch3ülch1wlda2gld1all3daml3dasl3datld1auld1ärl2deil2dexldo2rld2osld2ö2l2dreld4rüld3sald3stld3thle2adle2bl4leddle3dele3eilef2ale2gäle2glleg4r4lehs4lehtl2eicl2eidl2eitlel3s4lemplem3sl2en_le2näl2enfle3nil2enkle1os3lepa3lepf3leprl2er_lerb4lerk2ler3tl1erzles2ele3shlesi1le3skles2t4lesw2lesy2leto4leud3leut2lexe2lexzl3fahlfe1elf3lolf2trlfur1lga3tlg3rel3gro2l1h23lhi_li3acli3akli3amli3arlia1sli3b4libi34lickli4ds3lie_lig4nli3keli2krlil2a3limol1inv2linzli4om3lis_li2spliss2lit2ali3telit2hli3tu2lixili2zalk3lolk4nelk4ralk2s1lk3sälks3tl3k2ülla2nl3lapll1aullch4ll3d4ll2emll2esl2lexll3l2ll1obl3lowll3shll5t4llu2fll1urll3z2lme2el2möllmpf4lms2tlna4rl3n4e2lobjl2obrlo1fllof4rloi4rlol2a2lopf2loptlo1ralo4rä2lorcl1ordlo3ro3lorq3los_lo4sa3loselo2talot4h2l1ovlo2velö2b3l2ö2fl1öhrlpi4plp3t42l3r2lre1slrut4lrü1bl3sacl2saul3sexl4shalsho2ls2pols3s2lst2al2stels4trls2tuls1uml2sunlsu3sl2tabltag4lt1aklt1ehlt2enlt3hol3thul2toblt1oplto2wlt1öll3törlt1ösl3trält3relt3sclt2solt1uhlu1anluba2lubs2lu2drlu2es2lufflu2golu2gu2l1uhlume22lumf2lumll2umpl1umsl1umw1lu2n2lunt2lunwl1urnl1urt2luselu2splu4stlu2tälüh1lly1ar2lymply3nolzo2flz3t2m2abe2mabk2mabs2mabtma2cima3damal3dmalu4mam3m2manbm2anfm2anh2manlm4ann2manzma2orm2app2marb4marrm1arzmat4cma3unma1yom1ähnmä1i2m1ärg2m1b2mbe2em3b4rm2d1äm2deimds2em2e1cmedi32medyme1efmega1m2eil3meldmell2m2en_m2ens2meou3mer_me1rame2ro3mersmes1ame4sä4mesume3th2m1ex2m1f4mfi4l4m1g22m1h4mi2admi3akmibi1mi3damie3lmi2ermi4etmi2kimi2ku4milzmi3nimi1nu3mir_mi3ra3miri3mirs3mirwmi2samise1mi2tami2th4mitz4m1k4m2mabmm1eimm3simm3spm2mummm2unmmül22m3n22mobj3m2odmo2dr4mog_mo2i32mol_mom2e3m2onmo3ne3mo2o2moptmo1ramork4m1o2xmp2flm3ponmp3ta2m3r2m2sanm4sapms1asm2saumsch2m4scom4sexmso2rm2späms2poms2pums3s2m3stoms4trms4tüms1ummt1abmt1akm3tammt1armt3homti2smt1ösm4ts1mt2samt2semt1um2m3uhmu3la2mulsmu3nim4unkmunt24munzmu3ra3musimu2spmus3tmu2sumuts32m1w2mwa4rmwel42n1abna2bä4nabg4nabhna2bln2abona2br4nabt3n2ac4naddn2ade3n2ag3n2ahn3ahnnai2en1aig2n1akna2ka3nakon2al_na2län4alena2lu2nalyn4am_3name3namon1an_4nanb2nanh2nani4nank2nanl3nannna3non1anp2nanr2nanw5nar_2narcn2ard4narg3narin2ark2narmn2arpn2as_4naspn4ata4natmnats14natt4naufn3aug5naui3n2äcn1ähn2n1ännä2scn2äss2n3b4nbe3nnbes4nbu2snch3mnd2agndat2nd1aun2dein2dobndo1cnd1opnd1orn2drönd3thndt4rn2dü4ne2apne3asne3atne2bl3necane1ckne2de2nee33nehm2n1ein2eid4neifne2ke3nelanel3bne3lin2em_n4en_n2enbn2encn2enhne2nin2enjnen3kne2non2ensn2envn2enwne2obne1os2nepfn2er_ne1ranere2n1erfn1erh3nerin1erkne2ron2erpn2erv3n2esn4es_nes4cnes1one2thneu1cneu3gneur22n1exnf1aknfo1snft2on2f1ung1adng3d4n3gefn3gerng3g4ng3hun2glon2glöng3neng1orngs3cng3tsn2gum2n1h4n3hann3harn3haunhe2rnib4lni2deni3drnie3bni1elnig2anig3rni3klni2kr3n2ilnim2o2ninfni2obni3okni3olni3ra3n2isni2tinit4sni3tunk2amn2kähnke2cnk2lonk2lunk4nan2knenk2öfn2köl2n3l22n1m4n2naunne2snn2exn2nofnn3scnn3senn2thnn1ur3nobl2no2dno3drn3olen2on_3nor_nor2a2norc3norh3norm3norsn1ortno3shno2täno2tr2nö2f2n3p4npa2gnpro1npsy32n3r2n3savns2cans1ebnse2tn3sexn3siln4sphn2sponsrü2ns3s2ns2tins2tunst2ün2styns2umnta3mnt4atnt1ämnte2bnte1ent1ehnt2enn3ternteu3nte3vn3thrnti3cntmo2nt3sants2onts2pnts2tntum4nt3z21nu1anu3arnubi11nu1cnu2esnu2fe2n1uhnu3k4n2um_2numf2numg3numm2numr2nuna2nunt3nu2snu3scnu3senu3slnu2ta2nü4bnür1c2n1v2n3ver2nymun2zadn2zann2zärnz1ecn2zornz2öln2zwö2o3a2o4abioa3deo4a3ioa3ke2obano3bar2obe_2obea2obewobi4t2o3boo3briob3skobs2pob3sz2o3buobu2s2o3bü2oby4och1ao1cheoch3loch3moch1ooch3roch1socht2o1chuoch1wo3ckeo3ckio2ckoo3d2aod2dro3debo3dexo3diro2donodo4so2dre2o3du2o1e2o4e3so2e3to3et_o3etsof1amof1auof2eno3feroffs2of2fuof1laof4läof4löof3raof3räof4rüofs1aof3thoga3dog2loo3g4nog3spohl1aoh3looh2lu3ohngoh2ni1ohnmo2h3öohr1aoh1ro2o1hyo1i2do2isco1ismoiss2oi1thoki2ook1läo2labol2arol4drole3eoler2ole3sol1exol2faol2flolf1rol2glol2grol2klolk3rol2of1olymol2zwo2mabo2mebome3co2melo2mepom2esom3maom3pfomtu3ona2bo2naeo3nalon1apon2auonbe3one2ion3f2ong4rong3s4o3nion3k2onli4o3nodono3sons1aonsi2ons3lons1pont2hont3s2onukoor3foo4skoo2tr2o1ö2opab4o3panopa5so1peco1pei2opf_op2fäo2pfeopf1l4oph2o3pheopin2op3li2o3poop4plop2pr2o1pr1opsiop3szo1rad2orak2oral3oramo1rasor1ätorb2l2orcaor2ce4orda1ordnor2do2ordr2ords2ordwore2hor1eror3gaor2glor2gn4oril2oritork2aork2s2o1ro2o1röorr4aor3rh2ors2or3shor3szor4töor2ufo2r3üo2ryaos3ados4anosa1sos4co2o3seose3eose2no3shoo4skaos3keo4skios2lo2os1pos2peos2saos4säos3to2osu42o3syo2tebote2s4ot2hot4heo2throt2inotli2ot4olot2oroto1so3traot2saot3scots1pot2thou2ceou2geou3glouri4outu4ove3so3wecoy1s4o3z2aozon1ö2bleö2b3röb2s3öch1lö2chröch2söcht4öd2stöf2flöh3riö3ig_ö2ko3öl1a2öl1eiöl1emöl4enöl1imöl1inöl3laöl1o2öl3saöl3szö2l1uölz2wönn2eön3scön3spöpf3lör3a2ör2drör2glör2klör1o2örs2eört2eör2trös2stös3teös2thös3trö2t3aöt2scöt2trözes4pa3dapa2drpa3ghpa1ho3pala1paläpa3li2paltpank42panl2pannpant2panz4papi23para1parc2parg1paro2parppa4stpat4cp3auf3pä2cpä2to2p1d2pea4rpech1pe2en2peicpe1im2pekupel3dpena41pennpe1rapere21perl3pero5perspe3sape2stp2fabp2fadp2fafpf1aip2feipf3lopf3lup2forpf1ra2pfs2pf3slpf3sz2pf3tpgra2p3hopph3t2phu4s2p1hüpi2a3pias4p4id2pi2el3pierpi3lepin2epi3oipi2pepi3ri4pisopi1thpit2s2pitz2p1k2pkur11p2l43p4lap5la_p5lad2ple_ple1cp4legp4lem2pligp4likp4liz2p3lu2p1m2po3b42p3ohpo3id3poin3p4olpo3li2pondpo1pepo2plpo3pt2pornpor3spos2epo3ta3potepö2blp2p1hpp1läp2plep2pripp3sa1prak1prax1präd1präg3präm3präs2pre_2prec1pred1preipri4e2prig1p4ro3prob2proc3prod3prog3proj3prot1prüf2prünps4anp3s2hps1idps2pop3staps2tup3stü3p2syps2zept2abpt3atpte4lp4tospto2wp2t3rpt3s2pt1um3p2typu2dr2p1uh2pundpun2s2puntput2spwa4r1queura2abr3aalra3ar2rabd2rabf2rabgra2br2rabs2rabt1rabyra1cer2ackr4ad_3radf3radlrad5tra2gn4raht2raic1rake3rakür4al_ral3bra3le2ralgr4aliralk2r4alsra2lu3ralyr2ammr2an_4ranc2ranf2ranl2ranr2rapfr2ara2rarbr2arkr2arpr4as_ras2ar4at_r3atlrat4r4rau_4raud2rauf2raug3raum3r2äd3rän_3räni3räns2r1ärr2är_rä3raräu2s4räutr2bakr3blärb2lörb4rirb3serbs1orb3sprby4tr1chirch3lrch3mrch3rrch1wr2ck1r2dafrd2amr4dapr2deir3denrd1itr2dobr3donrd1osrd4rird3tard3thrdwa4re2amre3asreb1rre2bür2ech3red_4reddre1elre1er3refe4reff3refl3refo5reg_rehl4r2ei_r2eie2reigr1einre3larel2ere3lorelu2r4em_r2emi4remur4en_r2enare2näre2nir2enzre3or3repe3repo4reppr1erfr1ergr1erkr1erlrer2nr2eror1erör1ertre2sa3rese3reso2ress3rest3resu2reulre2wi4rezirf2äurf2esrf4lör3flür3forrf4rurf4rürf2sarf2targ2abrg2anr2gnorg3spr2ha_r3herr2hoe2rholrhu2sri3amria1sri3atri1ceri1elri1euri2frrif3s5rig_5rigjrig1l4rigrrik1lr2imb2rimprim2s2rink3rinn2rint4r1irris2ari3so3rissri2strit4r5riturk2amr2kährk4lork2lur3krirk2sprk1strk2tark1uhrk2umrku2nr3l2arle2ar3lecrle2ir3letr3l2irli2sr3l2orm2ärrm3d2r3me_r2meorm2esrmo1srm3sarmt2arna2brna4nr2naurn3drr4nefrn2eirne2nr5nesrn2etr4nexr3nodr1nötrn1ur2robj2robsro3e4roh1lro1irro3lerol3s2roly4rom_4romm4romt3ronnrons2ro1pero3phr2oraro3shro2ßu3routrö2du1r2öh1r2öl3römir2ös_r2öse2r1p2r3p4ar2plirpro1rps3trr2abrr2arrr1ämr3r2er4rewrr2herrik2rro3mrr2strr2thr3r2ürrü1brs3abrs2anrs3arr3shors2klr4skor4skrr4skurs4nor4sobrs2p4rs3s2rs2thrs2tir3stor3störs2tur3swirtal2rt1amrt1ärrten1r2thirto1prt1orr5trirt2sorube2ru2drru2fa3ruinru1is4rumfru2mi4ruml4rumz2rund4runn2runwru3pr4r3urru2ra5ruroru2siru2strut3hru2zwrü1ch4rümmrz2anr2zarr2zasrz1idrz1oprz3terz2thr3zwä2s1absa2besa2blsa2br4sabss1adm3safasa2fe3safi3sagasag4nsa2gr3s2aisail22s1aksa2ka3saki3sakr4sakt3salo5samms1amps2an_s3anbs2and3sani2s1apsa2po3sapr2s1ar3saris3arrs1aspsat2a4satmsa2trsa3tss1a4u3sau_3sauc3saue3saum3saur2s3avsa2vos3ähns1ält2s1äm2s1är3s2ät3säul2säuß4s3b4sba4n2scams2cans2cap2scar2s1ce4sch_s4chä4schb4schc2schd2schf2schg2schh2schks4chls4chö2schp2schq4schss4chu3schü2schv2schz4s3d2sde1sseb4rse1ecse2glseg4rse3heseh1lseh1sseh3ts1ein3s2eks2el_s2elsse2nä3senkse2noseo2rs4er_3seraser3gs1erh3seriseru25ses_se3su2s1exse2xe4sexpsex3t4s3f4sflo44s3g2sha2k1shass3h2e3shi_3shidshi4rs3hoc4shof3shop3showsi2ad2siat5si1cs2ido3s4iesien3sie2ssi1f43s4igsig4nsi2kisik1lsi2krsik3ssi2ku3silosin1ision43s2issi2sasis3s3s2itsit3rsi3tusiv1asive3si2vr2s1k24skams3kar4skasskel1s4keps2kifs2kig4skirski1s3skiz4skom4skor4skow4sk3t2s1l23slal4slans2laws3lo_s3loe2s3m22s3n4snab4so3baso3et3softso3la3s2onsone22sopf3sor_s1orc3sorsso4rus4os_2s1ox2s1ök2spaa4spak4spap3spaß4spaus2paz3späh2spärs3pe_2spel4spet4s3pf2sphas4phäs3phespi2k4spil3spio4spis4spla4splä4sple2spod2spogs2poi2spok4spol4spr_3spru2s3ps2s4pt2spun2spup3spur4sput4s3r4sret3srü2ds5safs3sagss1ajs3sals3s2äs4sces4scoss1ecssoi4ss2poss3s4sst2ass2thss2tis3stü4sta_3staast2ac2stag3stah2stak2stax3s2tä4stäg2st3c2steas2ted4stee2stem4stens2tep2ster4stes2stetst3ev4stexs4thäs4this2thu2stia2stibs2ticsti2e2stig2stiks2til2stio2stis2stiv2sto_s3tob1stof4ston4stoo1stoß4stou2stow2stoz2stöt1stru1stub4stuc2stue3stuf3stuhstu2n3stüt4st3zsu1ansuba24subi3su1c2s1uhsu1issul2asul2isult23summ3sun_su4nes1unf4sunt3s2upsup3psu2ras1urtsu2s1su3sasu3shsu3sisus3s2sü4bsü2d1sweh24swie4swilsy4n34s3zas2zess2zis4s3zu4s3zw2ß1a22ß1b22ß1ec2ß1eißen3gße2niße2noße2roßer3t2ß3g2ßig4s2ß1in2ß1k4ßler32ß1n22ß1p22ß3r22ß1s22ß1um5taan4tab_2tabf2tabg2tabh2tabkta2br4tabsta2bü2tabw2tabz2t1ac3tacut1adatadi33taf_4tafft1afg3t2agt3agotai2ltai4r2takzta2latal3d3talo2talt3tameta2mit1amt3tan_2tanbta3ne4tanf2tang3tanit2ank4tanlt2anot1ansta2nuta3or2tapfta2pl2tarb4tark2taro2tartta2ruta3sata2tht3atlt4atmt1auk3taum4tägyt1ämt3tänzt2är_tä2ru4tätt2täuß4t3b2t3chat3chetch2itch3lt2chutch1w4t3d4tdun2te2a22teakte3alte3an3tebat2ech2teckte1emte2es2teff3teha3tehä3tei_teik43teiltekt25tel_3telatelb43telg3telk5teln3telp5tels3tem_tem3st6en_ten3ate2nät4enbten3gt4enhte2nit4enjt4enmten3n3terct4erit4erot3erötert2teru2t2estte2su3tet2t2et_4teth4tetl3teuf3teumte1unte2vite1xa4texp3text4t1f4tfi2l4t1g2tger22th4at2hagt3hait2hak2t3hä3thea2thebt2hect2hekt2hem1then3theot2hest2heut2hik4th3l4th3m2th3n1t2hot3hoft3horthou24t3hö2thub4thunti2ad3tib4ti1cetieg42tiehti1elti1etti1eu3tif_ti1fr4tift3tilgti2lötil3stilt4ti2lut2imiti3nat1inbt1infti1nuti3orti3plti1rhti2sptium2tive3ti2za4t3k45tlem6t5li4t3m24t5n4tnes2to4asto5at4tobjtob2ltode2toi4rto3la3tole4tolz2tomg3topo2topt3tor_to1ra4torct1ord3toret1orgto2rö3torsto2rut2orwto3sc3toseto4sktos2p4toss3totrtots23t4outo3un3töch4t1ökt1öst4t3p21t2r45tra_3trac3trag3trak3tral4traß5träc3träg4träs4träß4treb4trec3tref4treg2trekt4remt4rert4rett4reut3rev2trez2t3rh4trict4riptri2x3tro_3troe3tront4rop3troyt3röc2tröh3trös3trua4truktrum2t4rübt4rügts1adts1alt2sants1ast2sauts1emts3krtso2rt3sout2spät2spht2spots3s4t1st4ts2tut2s1u1tsubtt1abtt2actt1aktt2altta1st3telttes1tto1st3trott3rutt3rütts1ptt2untu3antuf2etuff3tu2istul2at2um_3tun_3tune3tungt1up_tu2rätur1c3turntu2rotu4rutu2satu2sotu3ta3tüch3tür_tür1c3türe3türg4tütztwi4ety2pat2za2tz1agtz1altz1artz1aut3ze_t2zortz2thtz1wätz1witz1wuu1a2bu1a2cuad4ru1al_u1albu1alfu1alru1alsu1altua2luu1ansu3ar_u1arsua3saua2thuat2iubau1u3b4iu2bopub3räu2bübuch1auch1äu1cheu1chiuch3luch3much3nu1chuuch3üuch1wu2ckiu3d2au2donud3rau3druue2ckue2enu2elaue2leueli4ue2miue2näue2niue2nou2ereu3errue2tau3fahuf1akuf3aru3fasuf1au2ufe_uff4luffs4u2fobufo2ruf3säuf4sou2fumug1afug1akuga4sug1auug3d2ug3huu2g1lug3lou4gluu2g3nug1orug3roug3seug3siuh1lauh1läuh2liuhme4uhr1auh3riuhrt4uh2ruuh4rüui2chui1emu4igeu1in_u1is_u3käuu1k2lu1k4ruk2tauku2sul1abul1amula2sul1ämul2drule4nule2tu2lexul3f4uli2kul3kaul2knull2aull3sulo2iul1orul2sauls3z2ultaul3thult3sul2vrulz2wuma4rum2enum1irumm2aum2suum3t2um2un2una_1unabun3acun4alun3at1unda1undd1undf2undg1undn1undv1undzune2bune2hung5hun2idunik4un2imuni2r2unisunks23unkuunna2uno4run2os2uns_un3se1unsiun3skun3spun3taun3trunt3s2untuu1o2bu3or_u3orsu1os_uote2u1pe2uper1up2faup2plup2prupt1oup4tru2rabu2rar2u1räur1änurch1ur3diure4nurf3turi2cur1imurk2s4u1rou3roluro1sur4swur2zaur2zäur2ziur2zou4safu3sepus3klu4skous3ocu3sohus1ouus1peu2spou2spuus2thus3tru1stuus2uru2tärut1egute2lut2esut2etu4tevutfi4ut2heu2thiu2thuuto3cut4orutos4ut3rüut3teutts2ut2zo2u1u2uufe22u1v4u2ve_uz1weuz3z4übe3cüber3ü1cheüch3lüd3a4üd1o4üd3s2üdsa1üd3t4ü2f1aüfer2üf2flü2f1iüf2toü2g3lüg4stühla2ühl2eüh3moüh3neühn2süh1roühs2püh4thül2laül2loül2löü2n1aün2daün2dründ3sünen3ün2faün2frünn2sün3scün3seün3spün2zaüp2plür2flür2frür3scür3seür3spürt2hüse3hüse3lüse1süss2eüs2stü2t3rüt2s1üt2tr2v1abval2s2vang2varb2v1auve3arveit4ve3lave3leve3live3love3maven2cve3neve3nive3növer3averd2vere2verf4verg4ve3river3kvert2ver3uve3tavete1ve3trve3x22v1f4vi3arvi2elvi2ervima2vi4navin2svi3savise4vi2spvis2u2v1l22v1obvo3gavo2gu2v1opvo2r1vor3avor3dvor3evor3gvo3ri2v3rav4ree2v3rov1stav3s2zvu2et2vumfwa5gewa3gowai2b2walb2walmwa3nawa3sawa3sewa3sh2wängwäs2c2w1b2we2bawe2blweb3swe2e4weed3we2fl2weiewe3niwerd2we2röwer2s1wesewe4stwet2s2w1eywie3lwin2e2wing1wi4rwi2sp1wisswi3th1wo1c1wolfwor3aw3s2kwun2s4wur_wur2s2xa2b1x2adxa1fl1x2agx3a2mx2anz1x2asx1e4gx2er_x2erexers22x3euxich2xide2xie3lxil2axi2loxi2lux2is1xis2cxi2sexis3sxi2su2x1k22x3s2x2t1axt2asx2tänxtfi4xt3s2x3turx1u2n2y1aby1al_y1a2myan2gy1anky2chiych3nyen4ny2erey2es_yes2pye2thygie5yke3nyk3s2y4le_yli4nyl3s2y2l1uyma4tym3p4ympi1y2n1oyno4dyon4iy1ontyp3any4p3sy3r2eyri2ayri1ey3r4oys2any3s2cy3s2hy4s3lysme3ys2poys1prys3t4y3s2zy2te_y2tesy3to1yure3zab3lz1a2dza3de2z1afza3grzale32z1amza2na3zani2zarb2zarcz1arm3zaubz3aug3zaun2z1äc3z2äh2z1ämz1ärgz1ärm4z3b4zbü1b2z3d2zdan2zeik4zelu25zen_zen3nze2no3zentz2er_zerk2z2ernzers2ze2säze3sczes1ezes1ize2spze2tr2z1ex2z1f42z1g2z2henzhir3zi3arzid3rzil2ezin2ezi2o3zi3opzirk22z3k42z1l22z1m2zme2e2z3n42z1ob2z1ofzo2gl2z1oh2zopezo2ri2z3ot2zö2f2z3p42z3r24z1s2zt3hozt3s2zu4chzudi4zu2elzu3f4zu3gl2zumf2zumg2zumlzun2ezung42zuntz1urkzu3s4zu5t2zür1cz1wac4zwahz1war2zwas4zwäl2zweg2zwet4zwirz2wit2z1woz1wörz1wur2z1wüz3z4az3z2o",
		6 : "_ab3ol_ab1or_akt2a_al3br_alt3s_ampe4_an3d2_angs4_ans2p_ans2t_an3th_ari1e_ark2a_ar2sc_as4ta_au2f3_au4s3_be3ra_boge2_da2r1_darm1_de2al_de1o2_des2e_de3sk_des2t_do2mo_do1pe_dorf1_ehe1i_ei3e2_ei4na_ei2sp_ei4st_ei4tr_el2bi_elb3s_em3m2_end3s_enns3_en2t3_en4tr_er2da_ere3c_es3ta_est2h_es3to_es5tr_eu3g4_eve4r_flug1_for2t_fu2sc_ge3ne_guss1_he3fe_he3ri_inn2e_kamp2_kle2i_kni4e_kopf1_le4ar_li4tu_ma3la_ma2st_mel2a_mi4t1_näs1c_no4th_oper4_oste2_ost3r_poka2_ram3s_reli1_ri2as_rom2a_rö2s1_se3ck_sen3s_ser2u_se2t1_si4te_ski1e_tal2e_ta2to_te3no_te4st_ti5ta_tite4_to4pl_tro2s_tu3ri_uf2e2_ufer1_un3a2_uni4t_uns4t_uro2p_ur3s2_wah4l4a1a2naa2r1aaar3f4aat4s3ab1aufab1eilabe2laab1erkab1erzab1ins1a2blaab5lag1a2bläab4le_3a2blö1a2bon2absarab3s2i2abst_ab3ste1abteia1chalach3auach1eia3cho_ach1orach3su4ach1wa1ckarack2ena2ckinack2seack3slacon4na3d2abad3amaa2d1an3a4dapade2aladefi4a2deina2deri4ade1sades4sadi3enad4resa2f1eca2fentaf1erlaf4fluaf3s2aaf3s2haf2t1aaf2teiaf2t3raf2tura2f3urag1a2da3gen_age4naage2saage4si3a2gitag4ne_a2g3rea2g3riag4samag4setag4spoag3staag3stea2gundahl3a2ahl3szah4n1aah3r2eahrta2ain3spai3s2e2a3kam1a2kazaken2nak3rauak5tan2aktikak2t3r2aktstal1ageal3amealami5al3ampal1anaal1ansal1anza3lar_a3lareal2armal3arral1asial1assal3augal2b1lalb3lial2bohalb3rualds2ta4l1eha2l1eia2l1ela2lengal1epoal1erl3alermal1etaal1etha2l1eua4leur3a2lexal2glial1insa2linvalk1ar1alkohalk3s2alks4tal2labal2laual3les1allgäal2lobalo2gaal1opeal1orc3alpe_al3sklal3sunal4takal3tamal2treal2trial2troalt2seal1umbame2n1amer2aa2meriame3rua4mesh2a3mirami3taami3ti2ammalam2meiam2minam3stram2t1aam2t1äam4tel2amtemam2t3ram4treanadi3an1algan3dacande2san2dexand2suand1uran3e2can2ei_an3eifan1e4kan1ethanft5san3f2uang1ar3angeb2angiean2gla4angs_an2i3d3a4nima4ninsan2keian4klöank3ra3an3naann2aban3n2ea2n1orans2enan2seuan3skrans1pa1anspran3s2z1antei1anthran2tro2anwet1anzeian2zwiar3abtara3d2a2r3al2a2rara2r1auar2bauar2bec2arbenar2bre2arbs2ar2droar1effar1ehra2reinar2erfa2reria2rerlar1intar2kalar2knear2korar4kriark1s4ark3saark3shar2lesar2nana2r1oparr3hear3s2har3staar3t2ear2thear3t2iartin2art3rear2z1was1alaa3schea3schia2schma3schua3s2hiasin2gaska3sa3skopas3s2aas3s2eas3s2ias2s1pass3tias3stras3stu2as3taas4tauas4tofast3räaswa2s3a2sylat1apfa2tausat3eiga2teliate2ru4athe1atil4sati2st4atmusatra4tat3romat4setat2s1pat4takat4tauat2teiatz1eratz3t2at2z1w2au1a2au2bliau2bloauf1an2aufe_2aufehauf1er2aufs_2auft_4augehaule2sau2malau2m1oaum3p2aum3s6au3n4aau2nio2au3r2au2sauau2spraus3s22auts4ava3t4äche1eäch2späch4stä2d1iaäft4s3äg3str2äh3t4äl2l1aämi3enäne2n1äng3seän2k3län2s1cänse3häp2s1cä2r3a2ä2r1eiär1intär2k3lärt2s3äse3g2äser2iäskop2ä3s2kräs6s1cä4s3t2äß1erkä4t1a2ät2e1iätein2ät2s1iät2s1pät2s3täum4s52ä3us_backs4b1a2drbah2nuba2k1iba2krabal3th3b2andban2drba3n2eban4klban2kr2b1ansbar3deba2reibar2enbar3zwba3s2abau3sp3b2ä1cbbens2bb3lerbbru2cbe2delbe2erkbe1erlbe1etabei1f4bei3k4bei3labe1indbei3scbeis2ebei1stbeit2sbe3lasbe3lecbe3leibe2letbel3label3szbel3t4ben3arbe3nei3ben3gbe3n2iben2sebenst4ben2su2bentbb2entib1ents2bentwben3unben3z2ber3ambe2ranbere4sber3nab1erntbe2robbe3ropbe3rumbe3slobes2pobess4ebes3szbe2tapbe3thabien3sbi2ke_bi2kes2b1inb2b1infbin3gl2b1intbi2solbi2s5tb2it2abla3b4b2lancb2latt2b3law3ble2a2b3legb3lein3ble4nb3leseble3sz2blich3blickbling43blitzbo3ch2bo2e3ibon2debo1r2abo2reibo4rigbo4s3pbot2st2b3radb4ra3k2b3refb3reif2b3repbri2er2b3rolbrust3bru2thb2s1adb3sandb3sel_bse2n1b3s2esb2s1ofb3s2pubst3acbst1akbs3tätbst3erb2stipb4stodbs4trib4stübb2s1unbu2chibul2la2b3umkbu3r4ibus1erbu2sinbu2s1pbu2s1ubzeit1carri1ca3t4hcha2ck2ch1akch2anb3chancch1ang4chanz4char_1characha2sc3chato4chatuch1ärm3chef_3chefi3chefsch1eimcher3ach1ess2cheta1ch1iachi3na4chind2chinf2chinhch1insch1int1chiruch1offch1orcchre3s1chron2chunt2ck3an4ckeffck1ehe4ck1eick1entcke2rack2ereck1erhck2ern2ckero2ck1id2ckunt2ck1upcon2nec1s4trcussi43d2abäda2ben3d2ablda2bredab4rüdach3ada2chodach1sdal3b2d1amma2d1amt2d1ana2dangedan4kldan2kr2d1ans2dantwd2anz_4danzida2r3a2darb2dar2mada3s2hdat4e2da3teidate4n4d3atl4daush2d1ämt2d1änd2d1ängde3a2tde4ca_de2cka2d1eff2d1ehrdein2ddein2sdel1ändel1ec2delek2delem2delfmdelle2de2lopde3lordel5scdel2sodel3t4dem2ar2d1empden3th2dentwdera2bde1radde2rapder2bl2derdbderer33derieder3m2de4ruhde4rumde3sacdesa2gde4samdes2äcde2sebde4sehde2seide4setde2sinde2sordes3s2de2sto2d1etwde1urlde2xisdha1s4di3e2ddi3enidie2thdige4sdil2s52d1imb2d1ind2d1inf2d1inh2d1ins2d1intdion3sdi4re_di2rendi2ris2d1irl2d1isrdi4t3rdle2ra2d1o2fdo2mardo5n4adoni1e2d1opfdor2fädor2fldor2fr2d1orgdo2riedor2tadö2s1c3d4ra_2d3rad2drahm3d4ramd3rand2d3rät2d3räud4rea_d4reas3d4rehd4reiv4d3ren2d3rep4d3rer4dres_d4resc3d4ria2d5ricd5riegd4rin_3d4rit4dritu2d3rod2d3rot2d3rovdrö2s13d4ruc2d3ruh2d5rutd2sau2d2s1efds2eigd2serhds1errd3s2had2s1imds2infd3skuld2s1opds1orids1pasd2sprods3tabd4stagd4stead3steid4stemds4tilds4tipds1umsds2zend4theidtran2du1alvdu2bli2d1ufe2d1umb2d3umkd2ums_2d1umvdund2a2d1unfdun3kedun2kl2d1url2dursadwest3ea3dereadli4e3aleiealti2eat4e2eater1eat3s2e3au2feau1ste3b2akebert4eb3lereb4leue3blieeb3reiebs3paeb3staeb3strebu2t12e3cheech1eie2cho_e2ch3rech3taech1uheck3seede2aledens1edi4aled2s1oed2s1pee2choeed3s2ee2lekee3lenee4nage1e2pie1erbtee3r2eeere2see4reteer2öse1ertree3r2uee4tateewa4re2f1adef1anae2fente3f4lu2e3f2oef3reaef3rolef3romef2tanege2raeg4saleg4stoegung4eh1ache3h2aleh2auseh1eff1e2hepehe1raeh1inteh1lameh2linehl2seehr1a2eh2reiehre3seh1ro2ehr1obehr1ofeh1stee2hunt2ei3a2ei2bareibu4tei2choei2d1aei3danei3dra4eien33eifrüeig2er2eigew2eigrueik2arei3kauei2lareilen1eil3f41eilzuei2moreim2plei2n1aei4nasein3dr2einduei4nelei2neu2einfoein3g2e1initein4szei2sa4eis2peeis4thei1stoei2sumei2tabei2tanei2tarei2troeit3umek1s4tek5triel3abiel2abte2l1akel4amiel4ampel1ansel1anze2l1apel3ariel1asiel1aspel2ast3elbiseld3s22e3lebe2l1el1e2leme3lem_el1empel1erdel1erfel1erkel1erl2eles2el1esse2l1ideli2neel1itael3lanel5le_el3linell3spel1opee2l1orelo2riel2sumelte2kel2t3re2l1umel3useel2zwae2m1ad3emanze3m2ene2m1imemi5naem1intemi3tiemma3uem2meiem3pflem2spren4amee4nanden3angen3areen2ascen3atte3nauee2n1ären4ce_en2dalend3siend3szend2umen1e2ce2neffe4neine2n1elene4lee2nerfe4nerhe4nerk4enerne4nerz1engad3engagen3g2ien3gloeng3see2n1inen3k2üeno2mae2n1openost3en1ö2den3sacen2sauen2sebens2el1ensemensen1en3skaens2po2enstoent4agen2teb1entfa3entgaen2thi3entlaenü1ste1o2b1e3p2f41episo1e2pocep2tale3rad_er3admeraf4aera1frer3aicer3alleran3de3raneer3anfe2ranher3anmer3apfe3rarie2rathe3ratie2ratme1rauber3aueerau2fer3augerb4sper3chl2erdece3recher1effer1eige2reiner1ele2e3reme3renae3renz4erer_e4rerl4ererne3reroer1errer1erse2rerter1erwer1esser1eul4erfür1ergolergs4t1erhabe2riat4e3ric4e3rieer1inber1inker1inter1ita1erklä2erkreern1oser1o2ber3onye4ro2rer3smoert2aker2thoerts2eeruf4ser1u4mer1underung4er1unses2aches3anze3s2ases3cape3schaes3evaes2haresi1eres3intes2kates4loges2ortes2sau4essemessi2aes2sofes2spues3stres3stuest1ake1stare1state3stele1stile2stipes4trie2s1umes3umse4teinet3haleti2tae4t1ofetons4e2treset4riget2tabet2teiet2t3ret4troett3szetwa4retze4seu2esceu4glae3um2seum4sceums1peum3steu4neie3un2geu2nioeun3ka3eu3roeu1staeu1stoeu1stre2velae2vent1e2xeme2x1inex2tinfa2benfa2chof1aderfa3l2afal2klfal3tefalt2sfan2gr2f1ankf1an3zfar2br2f3arcfarr3s3f4art2f3arzfa3s4afa2to32f1auff1ausb2f1ärmfä2ßerfeatu42f1eckfe1inifek2tafe2l1afel2drfe2lesfe2l1ofen3safer2anfe2rauferde3fer2erf1erfaf2erl_f4erpaf2ers_fest1afest3r2f1etafe4tagfeu4ruf2f3efffe1inf3f4räff3shoffs4trfi2kinfik1o2fi2kobfi2lesfi4linfil2ipfin3sp2f1intfi2s5tfit1o2fi2tor3f4läc2f5läd2f3läu2f3leb3f6limfli4ne2f5lon1f4lop1f4lot1f4lug4f3orgfo3rinfor4stfor2thfor3tu2f1o2xf3rand1f4ränfreik2frein42f3ricf4risc1f4ronfro2nafs1allfs4ammf2s1asf2sauff2sausf2sautfs1e2bf2s1emf2s1erf2si2df2s1o2f3spanfs1penf3s2plf2sprefs2prif2sprofs2pruf2stasf3steif2stipf3st4rf2s1unf2t1alft1e2hft1eigft1eisf4theif2t3rof2t3röf3t4ruft4samft3s2cft4sehfts3elfts2tift1url2f1unffun2klfun2ko2f1unmfu4re_fus2safus2stfzu4gaga2b5l2ga2dr2g1amtgan2gagan2grg3anla3g2ano2g1armga3r2og1arti2g1arzgas3eiga2sorga4spega4sprgas4taga4ste2g1auf2g1autg2d1aug2d1erge3g2l2g1eifge2in_gein2sge2intgein2vgei3shgelb1rge5lehgell2age3lorgels2tgel3szge3lumge4namge4nargen1ebge3necgen3szgen3th2gentwge2rabger2erger3noge1r2öge3r2ug1erwag2e1s23ge3scges4pige3steges3thge3t2a2getapge3t4ugge2ne3g2het3g2hiegi3alogi2e1igie1stgi2me_gi4mesgi2met2g1indgin2ga2g1insgi3t2ag2lade2g1lag3glanz2gläuf2g3leb4g5lerg3lese3g2lid3g2lie3g2lit3g2loa3g2lobg3loch3g4lok3g2lop3g2lotgne2tr4g3notgoa3li2gonis2g1ope2g1opfg2o1ragra2bigra2bl2gradl2g3rah2g3rak2g3räu2g5re_2g3recg4re2eg3reit2g3ric2g3röh2g3rui2g3rum3g4rup2g3rüc3g4rüng3s2ahg4saltgs3amags3augg4s3cegs4chig4s3crg3sel_gs3elig3selngs5erkg4setags4pieg4spingsrat4g3stang3starg4s3täg5stämg3stelg1steugst2heg3stirgs3tocg4stolgs3topgst4rig4sturgs4tücgu1an_gu1antgu4d3r2g1u2fgu1ins2g1unfg2ung_gunge2g2un4s2gunt22g1urlgurt3sgu2s3agus2spgus2stha2choha2delha4dinh1adle2h2al_ha2lauhal2bahalb3rhal2lahal2sthand3shan2krh4a3rah1arm_h2armehar2thh1arti2ha3sahat5t2h1aukthau2sahau2sc2hautohau2trhä3usphe1choh1echthe3ckehe2e3lhe2fanhe2f3lhe3friheim3phei4muheine2h1einkhe1ismhe1isthel1eche3lenhe4lof4h1emphend2she2nethenst2hen5trh1entshe2ral2heraphe3rasherb4she2relh1erfüh1erkeher3thher2zwhe1stahe2tapheter2he3t4she1x4ahfell1hi2angh1i4dihi3enshier1ihiers2hil2frh1induhin2enhi3n2ihin3n2hin3s22hi3rehl1anzh1lauth5len_hlen3ghl2ennhle2rahl1erghl1erwh4lerzh4lesihl1indh3listhlo2reh3losihl2sanhl2serhl3skuhl3slohme1inhmen2shme2rahn3eighn3einhne4n1hne4pfh3nerlh3nerzhn3s2khn1unfho2ch3ho2ckahock3tho2f3rhol1au4holdyhol3g4ho4lor3hol3sh1o2lyho2mecho2medho4seihotli42ho2w1h1raneh3rechh4rei_h3reich3r2enhr2erghr2erkhr2ermhr2erzh4rickh4rineh4rinhh4risth4romeh4romihr2sauhr2serhr4sethr2tabhr2tanhr2torhrt3rihr2trohrt2sahrt2sehr1umsh2s1ech3s2exh2s1ofhs2porh2spräh2sprohst2anh1stechst2heh1s2tih2storh1s4trhst3rih1stunhs2ungh3t2alht3aneh3tankh4tasyht3a2tht1e2ch2t1efhte2heh2teifh2temph2t1euh2t1exh4theihthe3uh2t1inh2tolyh2torgh4trefh2t3ruh2t3rühts2tihu2b1ahu2b3lhu4b3rhu2h1ahu2h1ihuk3t4hu2l3ahu2lerhu2lethu3m2ahung4shu3ni1hus4sahus2sphu2tabhu3t2hhühne4h2wallh1weibhy2pe_i4a3g2ia2l1ai3aleiial3laia2lorial3t4ial3z2ia2nali3and2ia3p2fi2a3spi3a4tai3at4hib2blii2beigi2beisibela2iben3aib3renib4stei2bunki2buntibu2s1ich1eii2chini3chloi2ch3ri3ck2eid2ab4i2d1au1i2deeidel2äide3soide3sp1i2dio1idol_i3d2scid2s1pie2breie2choie2fauief3f4ie2f3lie2froie4g5lie3g4nie2g3riegs3cie3lasiel3auiel1ecielo4biel3sziel3taiena2bi3e2näien1ebie3neri3en3gi3e2noien3scien3siiens2kien3szier3a2ie2rapie3resi3ereuierin3ier3k2i3ern_iers2tier3teies2spie1staie2t1aie4t1oie2triiet2seiet3zwifens2if1ergif1erhi1f4lai1frauif4reii1f4rüif2topift3szig2absig1artiga1s4ige4naig1erzi2g1imig3reiig4salig3sprig4stoig4stöig3strig3stüigung4i2h1ami2h1umi4i3a4ik1amtik1anzik1artik3atti2k1aui2k1eiike2l1ik1erfi2kindi3k4läi2k3raik2trei2l3abi2l1acil1a2di2l1akil1ansil1aspi2l1auil3ausild2eril2doril1e2cil1eheil1einil2f3lilf4s3ilie4ni2l1ipi3lip_i3lipsil3l2ail3l2iil2makil2mauil2mini2l1oril3t2hilung4i2manwima2tri2melei2melfi4meshi2metiim2meiim1orgim3pseim3staimt3s2in3a2ci4nacki2n1adin2arain2arsin4arti2n3auin2dalin2dan1indexind4riin3drü1indusin1ehein2erhi4neskine3un1info_1infosing1af1inhab2inhar2inhauin2i3dini3krini3sei3nitzin2nor1inntain3olsino1s4in1ö2dins2aminsch2in2seb2insenin3skr1insta1insufin3s2z1integin3t4rin5trii3n2umin3unzinvil4io2i3dio2naui3ons3ion4stiore4nipi3elipi3en1i2rakir2k3lirli4nir2makir2mauir2mumir2narirpla4irt2stiru2s1isage2is3arei2s1äni2schmi2s3crise3haise3hiise2n1is2endisen3si2serhiser2uis2hasi2s1idi2s1of3i2soti2sparis1picis2pitis2pori2sprois4sauis3stais3stoiss3tris3stuis2sumis4tabis4tamist2anis4teliste4nistes3is4tocis5törist4raist3reisum3piß1ersit1ab_ital1ait1altit2an_it1arti3tauci4t1axi2t1äsi2t1eii4teigit2eili4teinite2lai4tepoi2t1idit2innitmen2i2t1ofit3rafit3rasit3rauit3räuit3ricit3romit4ronit3runit2stoit2tebit4triitt2spi2t1umi2tunsit1urgitzes4it2z1wi2v1akiv1angi2v1eiiv1elti2v1urizei3ci2z1irjahr4sja3l2ajean2sjek2trje4s3tje2t1aje2t3hje2t3rjet3s2jugen2jut2e1kab2blka2ben2kabla2kabläka3b4r2k1abt2k3adaka1f4lkaf3t2kaken42kala_ka2lanka3leikal2kakal2krkal4trkan2alka2nau2kanda2k1angk2ans_k2anz_2k1apfka3r2i2k1armk2arp3kar2pfk2artaka2s3tka3tanka3t4hka4t3r4kaufrkau3t22kautok1ä2mikä2s1ckdamp22k1e1cke2he_kehr2s2k1eic2k1eig2keinhkel1acke3lagkel3b4ke2lenke2lerkell4e2k1empken3au2kenläkens2kken3szk2enteken3thk2entrk2entu2kentwke1radk2erkok1e2rok2ers_ke2selke4t1ake2t3h2k1e2xki1f4lki1f4r2k1intkis4to4k1lack4leidk3lem_2k3lerkle2ra2k3leukle3usk2lisc2klistklit2s2k3locklo2i3klost4klung42k1lüc2k5nerkno4bl2k5norkoh3lukol2k5ko3n2ekon3s4ko1r2a2k1orckot3s22k3radk3rats2kraum2k3rät2k3rec2kred_2k3refk3reick3reih2k3rick3ries3k4ronks1e2bk2s1emk2sentks1erlk2s1idk2s1ink2s1o2ks2pork1s2tik2stork2sträk2stumks2zenk2t1adkt1aktkta4rek2t1auk2tempk2tentkte3ruk2t1idkt1insk2t1ofkt1opekt4rankt3rask4trefktro1skt3runk2tuns2k1uhrku3l2eku3l2i2k3umlkum2s1kun4s4kunst32k1up_kur2blku2reikuri2ekur2spkur2stlab4ralab4ri2l3absla2ce_la2gio2la1hola2kesla2k1ila1k4lla3min1lammf2l1amtlamt4sla4munl1analla2nau3l2andlan2gl2lanhäl2anhe4lanli2l3ann4lansä2lantrlan2zwlap4pll3artila2saulast1ola4tel2l3athl2auf_lau2fol2aufz2lausl2lausr2lauto2l1ähnlä2s1cl4betal2b1idlb2latl4bre_lb3ritlbst3elb4stol2b3uflbzei2l3d2acl2d1akld1amml2da2rld3arild1arml2delel3der_ld1erpl2d1idl2d1iml2dranl3d4rul2d1umle2chile2gau3l2ei_lei2br4l1eigl2ein_l2eindl2eine2leinkl2eintl4eistlei2talekt2a2lektr3l2ela3lemesle4nad2lendul2e2nolen3szl1ents4lentzlen2zil2e1rale2ragle2raul1erfol2erfrl2erfül2erkal2erkol2erlel4ers_lers2klers2tl2ert_l2ertel2erzales2amle3serleste3le1stole2tat2le3thlet4tule3u2f2leurole2xislfang3l2f1ecl4feisl3f4läl3f4lulf3ramlgen2alge3ral2getilian2gli3chili2ckali3d2ali2deo2l1idolid3scli3enelien3slie2stli2grelik2spli3m2ali3n2alin3alli2nefli2nehli2nepli2nes2l1inflings52l1inh2l1injlink2sli2noll2ins_l2insal2insc2linsp2linst2l1intli3os_li2p3ali3s2a2l1islli2tallit1s2lit3szlizei3lk1alpl3k2anl3kar_lken3tl3k4lul2k3rol2k3rulk4ställ1abbl2labtll1affll1aktl3l2alll3amall2anwll1anzll1armll3augl2lausl2l1ämll1echlle3enl2l1efll1eiml3len_llen3gl3ler_lle2ral2lerzll1imbll1impll1insl2lobel2l1ofll1opfl3lor_l3lorel2l1oul2l3öfll3s2kll2sprllti2mllt5s2l2marclm1auslm1indlm1inslm3stelm3s2zln3are3l2ob_lo2berlob4ril1o2felo2gaulo3h2e2l1ohrlo2k3rl1o2lylo2minlo2n1olo3renlo4skelo2speloss2elo4stelo3thalo3thiloti4o2l3öfelpe2n3l2p1holrat4sl3s2all2sannl3sarel2s1ecl2s1emls1erels1ergl2serhls1erlls2logl3s2pil2sprol3s2pulstab6ls4tafl3stecl3steil3stell4stemls2tiel2stitls2zenlt1a2mlt3andlt1angl3tarblt1artl2t1aultbau1lt3elil5ten_lter3alt2erglt4erölte2thl2t1eul4theiltimo4l2t1ofl4t3ötltra3llt3räult4rielt3roclt3rosl2t3röl2t1umltu2ri4lu4b32l1ufelu2g1alu4g3llu2g3rlug3salug3splu1id_2l1una2l1unf2l1unilu2s1ulu2t1alu4teglu2toplu4t3rl2z3acl3z2anlz2erklz1indlz2wecm2ab4rma2d4rma4d2sma2ge_ma2gebma2gefma2gegma2gekma2gepma2getma2gevma2gew2m1aggma3g4n2m1agomai4se2m1aktmal1akma2lanma2lauma3lermali1emal3lo2malltma2nauman3d2ma2net2mansa2mansä2mansc2mantwmar3g2maro3dma3r2uma2tanma2telma5trimat3semat3sp2mausg4m1ändmä3t4rm2d1ummedie4mee2n12m1eif2m1eig3meistme3lamme2laume2lekme2lermelet42melf_mel2semel5t4mena2bme3nalmen3armen3aumen3glme3normen4skmen2somen3ta2mentnmer2er3merinme2sal4meser2me3shmes2stmeste2me1stome3t2amie3drmi2e1imien3smie2romie4timi2karmi3l2amilch1mild4s2m1impmin2enmin2eumin2ga3min2omi2t1rmit3s2mit5sami5tsumi2t1umk5re_m2m1akm2m1almm1angmm1anzm2m1aumme4namme2samm1inbmm1infmm1inhmm1insmm1intmmi3scmm3stamm3strmmüll1m4nesimode3smo2galmo2k1lmon2s3mon3su2m1opemo2rar2m1orcmor2drmo2rermos4tampf3limpf1ormp3strms3andm4s1efms1erwms1inims1orim2spedm2spotm2sprom4stagm3stelm3s2tims5träm3s2tumt3aremt1eltm2t1eum2t1immtmen2m2t3romt2sprmt1urtmu3cke4m3unfmu4s1amu2s1omut1aumut2stmvoll14n3absna2ch1nach3s4na2drna1f4rna2gemna2h1a3n2aldna2letnal3lanalmo2na2lopnal2phn2als_nal3t4n4amenna3m4n2n1amtnamt4sn1and24n1ang2n1ans2nantrnap2sina2r1an2arle4n3artna3r2unasyl2na3t4hnat4sanat4sc3n2aul4nausb4nausgn2auso4nauss4nausw2n1ä2mnär4s53nä1umnbe2inn2d1akn2danlnd1annnde2sendi2a3ndo2ben2d3ren2drobnd3rolnd3rosn2druind2sornd2spr2n1ebnne3ein4n1ehr3neigtnek3t42n1ele5neleb4nelek4nelemne3lennel4la3ne3lu2n1embn1e2mi2n3emp2n1emsnen3a2n1endgnen3einenen14nengb4nengs4nengtnens4enen3skn1entb4nentn5nentrn1ents4nentzne2n3u2n1epone2posne2ranne2rapne2raun1erbine2reb2nerfü3nergrn2erlin1ermän2ern_ne1rösn2ert_n1ertrne2rup2n1erzne3sanne3skane2s1pne1stanes3tine2tadne2tapn1etatne2taunet3han1e2tunet2zi2n1eupnfalt4nf5linnft4s3ng2absn2g1acn2g1akng2anfng1anzn2g1äln3g2enngen2an3gläsn2glicngrab6ng3ratng3rocngs3panich1s3n2id_nie4n3ni3eneni1eronifes3ni2grenig4spni2kalni2karni3ker4n1imp3n2in_n2in4a4n3ind4n1inhni2nor2n1insn2ins_4ninse4n1int2n1invni2s1eni3se_ni2s1pni3spinis3s4ni2s1uni3t4rni3tscnitts1n2k3adn2k1akn3k2aln2kansn2kausn2k1ärnk4ergnk1inhnk3lennk3lesn2klienk3lunn2k3ronks2eink3s2znk2taknk2tannkt1itnk4topnk2trunmen2snna2ben2nadan2n1annnen3gnn2erhnn2erknne2rönner2znnes1enne4stnn1o2rnn3s2pn2n1ufno2blano2leu3n2opano2radno1rakno3ral3n2os_no2s3pn2ostenost1r2nostvno3tabno2telno3t3hno4thano4thi2n1o2x4n1ö4lnräu3snre3sznrö2s1n2sangn2santn2sausn2s1änns1e2dns1entn2s1epns1erfns1ergn2serhns1ersnsfi4lnsho2fn2simpnsi4tensi2trns2kaln2s1opn4spatn3s2pins4piens3ponn4sprän4spronst1akn3starn3statns4tornstü1bn2s1unns2ungns4unrns4unsn4s3zint3absn3t2alnt1angnt2arbnt1arknt2armn2t1äunte3aunt1ebente3g6n2teignt4enent4ernnt4ersnt4ertnt2hern2t3hon3t4hunti3kln2tinfntini1nt2insn3ti1tnt4lemntmen2nto3ment3recn5trepnt4rign5tropn2t3rünt4saunt2sto3n4tu_ntu2ra2n3umb2n1ums2n3umz3nung_n3ungl2n1uninu4t3rn2z1aun2z1ännzdi1snzi2ganzig4snz1inin2zurkn2z1wan2z1wän2z1wuoa3cheoa3chioa4k1lo4a3lao4a3mi3oa3seo3b2al2o3b2äob3ein2o3b2iob3iteo2b3li2o3bloo2b3reob3s2hob2staocha2boche4boch1eioch3ö2och3teochu2fo2ckarock2erock3szodein3ode2n1odene4ode3sp2o3diaof1a2co2f1eiof2f1a1offizof2f5lof2f3r2o1f1rof4samof2speof2sprof2s1uof2teio2g1abog1alaog1ango2g1eiogi2erog1steohen3sohl3auoh3lecohl1eioh3lemoh3lenoh3lepohls2eoh2n1ooho2laoh1o2poh4rinoimmu4oka2laokale43o2kelok2s1po2l1akolars2ol1aufol4damol1eieol1eisol2fraoli3k4ol2kreol2lakol2lelolo3p2ol1ortol2strol2z1aol2zinom2anwom1arto2m1auo2m1eio3men_o2meruom1erzomiet1om1ingom1orgo4munto2narbon3ausone2n3onens2on1erbon1ergon1eröo3netton3g2lon2i3do4nikro4n1imon3ingonlo2con3n2eo2nokeon1orconsa2gon4samon2sebonse2lonst2hon3t2aoo2k3lo2p3adop3aktopa2leo1pe4nop2f3aop3fahopf3laop1flüopi5a4op5lago2p3le1op3t4or3a2bor4altor2ando2ranhor3arbor3attor1ändor2baror2dauor2deuor2ditor2dumore4aso2r1efor1eigo2reino2rerfor1ethor2fleorf3s42orgetor3g2h2orgiaorgi1eor3gle2o3ric4orie_o3rier4orin1or5ne_or3s4aor2täror2tefor2theor2torort3reo4r3un2o3s2ao3scheo2s1eio3s2hi2os2kl2os2koos3peco3s2poos2seios2s3oos4sonos2s3pos2s3tost1auos4teios2t3hos3tilost3räost3reost3ufo3s2zeo2ß1elota2goo5tarko3tarto2t1auot3augotei4not4em3otemp2ot5helo2t3hiot3hosot1opfoto2rao2t3reot3rinot4spaots2peot2sprot2t3rot4triou1f4lou4le_o3undsou3s2ioviso3owe2r11o2xidöbe2laöbe4liöh3l2eöl2k3löl2naröl2ungönizi1öp4s3tö2r3ecö2r1eiör2ergö2rerlör2f3lö2r1imörner2ör3s2kö2schaö2schlö2schwö2s1eiös2s1cöte4n3pa1f4rpa1k4lpak2topala3tpa2narpa3neipa2neu1pa2nopan3slpa5regpa5rek1park_par2klpar2kr1partn1partypar3z2pa3s2ppat4e2pa5t4rpa3unipä3ckepä2t3hpät3s4pekt4spe2letpe2lexpell2apell4epen3dape4nenpe2n1o3pensi1pensupen3z2per2anper4nape2robperwa4pes3s2p2f1akpf1ansp2fa4rpf3arepf3armp2f1au4p3fe_pf1eimpf1einp3fen_p2fentp3fer_pf2erwp3f2esp2f3läpf3leipf3lie2p1heiphen3dphen3sphi2ka2phthepi3as_pi3chlpiela2ping3s3pinsepi3onupi4pel3pirinpi3t2aplan3gpo2laupo4lorpo1o2bpo1ralpo1raupo4stapo4stäpo2stopos6trpo2t1upp3anlppe2n1p2p1f4p3p2hopp5lanp2p3rap2p3repre2e13preis2p3rer3p4res1prinz2prosspro1stp3steap3stelp3s2tipt3albp4t3ecp4t1eip4telept1in1pto3mept1urspul2sppu2s3t2r3aacra2barrab2blr2aber1r4abi2r3abwra2chura2dam2radapraf3arra2ferra3gle3r2ahmrail4l2r3airra2krera2kro2raktira2la2ral3abr3alar3r4aldral3larall2e2rallgr3alp_2ralper3al3trama3srambi2ra2mer1r2ami2r1amtramt4sr4andar4anderand3sr4aner1rangirani1eran2kr2r1anm2r1anpr2ans_r2ansp2rantr2r3anw3rareirar3f42r3arz2rato_rat2st3raub_rau2mi3rausc2rausgrau2spraut5srä2s1c3rätser2b1abrbal3arba3rerb1artrb1aufrb1echr4belärb1entr3b2larbla2dr2ble_rb3lerrb2linrb4seirb3skarb4stärb3strr1che_r1chenrch1s2rch3sprch3tar3d2acr2d1akr2d1alrdani1rd1antrd1anzrd2ei_rden3drde3rerde3sprdi3a2rdia4lrdo2berd3ratre2altre3at_re3atsre2b1are2b1lreb3ra4rechs2reck_2recki2reditre2hacre2h1ire2h1orei4bl4reifrrei3gareim2p4reingr3eink4reinr4re2ke2r1elbre3lei2r1elf2r1elt4rempfrena2bre3nal3rendiren3drren4gl2rengp2rengsr1ense2rentw3r4er_2r1erbr2erbr2r1erdr2erenr2erki2rerlö2r1ermre2robr2erse2rerspr2erte2rertr2r1erzrer5zer2erzy3r4es_ress2ere1stare2thyreu3g2re3uni2r1eurrewa4rrf1ältr2fentrf3licrf3linrf2s1ärf2s3trf3t4rr2g1ahr2g1akrge4anrge2blr2getor2glanr2gleur2g1obr2gregr2gresr2gretrg3rinrgs4tr3r4he_3r4henrho2i3rib2blri1cha2ridolrie2frriene4rien3srie2nuri1er_ri4ereri2f1ari2ferri2f1orim4scr2i3na2r1indri3n4erine1i2r1infrin2foring3lrin2gr2r1inh2rinitr1innu2r1insrin4sorin2sp2r1inv3risikri4s1pri3t2irit2trr3klaur2klisrk5nebr2k5nurk3räurk3rinrk2s1erk3shirk2tinrk2t3rrk3trark4trirk1unirlös3srl2s1prl3ster3m2agrma2larm1ansrm1anzrm1a2pr2maphr2m1efr2mider2m1imrm3starm3umsrn2andrn3anirn2a2rrn3arern3arirn3eifr4nerfr4nerkr4n1inr2n1opr2n1orrn3s2ärn3s2prn3s2zrn3t2ero2bei3rock_r2o3deroh3na3r2ohrro2madro2mer4ro1nyror3alro2ratro2reiro2r1oror3thro3s2iro3smoro3starost1rro4tagrote3iro2thoro4trirots2orot2taro3t2uro3untrö2b3lrpe2rerrer4srre2strr2n3ar2r3obrr3stur4samprs3anprs3antrsch2lr3schur3schwr2seinrse2n1rs2endrse4ners1erers1erörs1ersrs1erzrs1etars2kalrs2kanrs2kiers2kisr4s1opr4sordr2s3phrs2tecr3stier2stinr2stiprs4tobr4stotr3s4trr3s4türtals1rt1angrt1annrt1antrt1anzr2t1arrte1e2rt4eifr2telfr2temort1ersrt3holrt2humr2t1idr2tinfrto2rirt3recrt3rosrtrü2crt2spart2sprru2ckurude2aruf2s32r1uhrru1insru2m3ar2ums_2r1unar2unde2r1unf2runglrun2kr2r1unl2r1unm4r3untru2r1erus4stru3staru4teiru2t3rrü1benrwun3srz1a2cr5zenerz1engr3z2ofrzug2u3sabetsa3blesach3t2s1ada2s3affsa1f4r3s2al_sal2se2s1alt3s2alz4s1amnsam2tos2an2cs4and_3sang_2s3anh2s3anl2s3anssan4sk2s3anw3s4ar_3s2ara4s3arb3s2ard3s2ars4sartisa4ru24s3ath4s3atlsauri1s3ausw2s1änd3sänge2schak2schao3sche_2schefsch2en3sches4schexschi4es4chim3schis2schmö2schn_2schoxschs2e4sch3tscht2ascht4rsch2up3s4cop3sco4rsda3mese3at_s1echtsee3igseein2se1er_se1erö2s1effse2galse4helse2hinseh3rese2hüb2s1ei_2s1eie2s1eig2seinb4seing2seinh4seink2seinl2seinn4seinr2seinw4s1eis3s2eitse2l1ase3ladsela2gse3lamsel1ec4selem2self_s3elixse2l3ösel3szsel3trs4e3ma2s1emp3s2en_se4nagsen3gl3s2enise4nob3s2enss2ent_s2enti2sentw2sentzse2n3use5refser2ers2erfrs3erfüs2ergr2serhöse2robs2ers_2sersas4ert_s2ertase3rum3s4ervse2selse1stase2tatse1u2n3s2ha_4s3hansho4resi2achsi3enesi1errsi3gnusi2g3rsig4stsi2k1äsik3t42s1immsi3n4a2s1ind2s1infsing1asin3ghsin2gr4s1inhsini1e2s1inq2s1ins2s1int4s1invsi2s1esi2s1osi2s1psi2tausi2tra3skala4skanz3s2ki_3s2kik3skulpsla2vesler3s3s4lipsli4tuslo3be4s5not2s1o2bs1o2he4sohng2s1ohr4so2lyson3auson3säso1ral2s3ordso2rei4s1ostso3unt2s1ö2l2spala2spara4sparo3sparuspe3p4s1peri2sperl2speros2perr4spers3s2pez4spi4p3s2plis3p4lu4s3poss2potts2pracs2pran4sprax2spräm4spräs2spred2spres2sprob4sprüfsrat2ssrö2s1ssa3bos2sanos4sansss2antss3attsse3hass1erös3s2essse3tass1offs2s1opss1oris2spros3stelss4tipss2turss1ums2stabb3s4tad3staff2stale2stalkst1almst1alpst1ami4stan_sta4na3stand2stani2stans2stanws4tar_4staris4tarsst1asis3tat_2stauf2staum3staur2staus4stälts4tänd5stätts3täus4s5te_3s2tegste2gr3s4tehs2te2i3steig4steil1s2tel2stel_2steln2stels4stem_s5ten_st4ens4stermste4sts4teti3s2teu1steue4steufs2t3ho2stie_s2tiegs2tiel2stien3s2tif3s4tims4tinfs3tinnst1ins1stitu2sto3d4stod_s4toffs4t3om2stopo2stor_2store2storg2storis3tort2stose4stote2stöch2strad2strag4strai4strak2stral5straß2strua2strug3struk2strup2st3t43s4tud2stumt2stun_4stunn2stuntstu3rest3url2sturn2s3tus2stüch2stür_2stüre2stürg2stürs3s2tyl3su2b3su2cha2s1u2fsu1it_su2marsu2mau3s2umesu2mels3umfesum1o2su2mors3umsas3umst2s1uni2s1urlsüden24s3zeis2zena4szent4s3zet2ß1e2gße2l1aß2ers_2ßerseßge2bl2t1abb3tabel2taben3table2t3abn2t3abtta3d2s3taf2et1af4rta2ga24ta3gltag4sttah3leta3i2kta1insta1ir_t1a2kata2krotak6ta3taktb3t2al_ta3lagta3lakt1alb_t1albk3t4aletal2löta2mert1amplt1a2na4t2andt3ankl2tanwa2tanwät2anz_t1anzat1anzuta2pe_ta2pes2t1armt1artitar2to2t1arz4t1aspta2tanta2tautat3eita2temtat3heta2tom4tatue2t1auf4taufg4taufnt1ausb3tausct2auset1ausk4tausltaxi1s2t1ältt1ängs3t4ebbte3cha3technteck2ete2ckite2en3te1erwteg3ret3eifr2t1ein4teinf4teinnt3eis_t3eisb3te3letel1eb2telemtel1ente4leute2littell2ete2l1ö3telt4tel3tatel3thte2min2temme2tempfte4m1utena2bte4naste4nauten3dat6endit6endote2nefte2nettens2et4entat3entb4tentdt4ente4tentnten3zwt3e2pi3t4er_tera2bte1rafter3am4terbs4terbtte2relt4erfrte3ria3termi2ternct4ers_terst4ter3zatesa2cte2santesä2cte2selte2sprtes3s2te2tat3teur_2t1exz3t4ha_3thal_4t3hau1t2he_2t3heit4heint4henet4heni2therr3these2t3hil2t3himth4mag2t3hoc2t3hoht4hol_2t3hot1th2r2ti3a2mtiden2ti2deo3tief_3ti2erti2kamti2karti2kinti2kräti2larti2leiti2lel4t1imp3t2in_4t1indti3n2eting3lting3s2t1inj2t1int4t1invti2seiti1sta2ti3tuti2vanti2velti2v1oti2v3rtlung4tnes4s3tochtto4d1utom1e2to2mento2nauto2nehto2pakto2patto2rauto4ränto2relt3orga3torint1ort_3tost4to1sta3to3teto2thotouil44tractt3rad_6trahm5t4rai2trand3trankt3rann3transt3raset3rasi3träne4t5re_tre2brt3recht4reck6t3red5t4ree4trefe4trefot4rei_4treic2treift3reigt3reint3reis6treitt3reiz6t3relt4ren_3trendt3rent2trepe2trepot4reprt4res_3treuh5trieb2triegtri4er5triggt3rind4tringtri3ni4trinn4tripttrizi13t4roitro2ke4trom_tro2mi4troml2t3roo3tropf2t3röttrums15t4ruptru2thtrü1betrü1bu2t3rüct4sa4bt3s2act2s1aht4s3art2s1änts4cort3seiltse2n1t2s1erts1init2s1irt1slalt3spalts1parts2pedt3spekt3s2pit4stagts3takts4talt2stipt4stitts3tocts3tort2strits3türtta2bet2t1adtt2anttt1arttt1ebett1eiftt1eistte2lattel1otte2satte2sätt2häut2t3hott4roctt2sentt2sortt2spett2sprtt2stitu1almtu2chitu3fent3u2kr3t2ume2t3umf2t3umg2t3umk2t3umrtum2situm2so2t3umt2t3umz2t1una2t1und2t3unft3unga2tunif2t3unttu2re_tu2reitu2resturin1tück2s3tür3s3tütentze4n1tz2enetz1erltze2rotz2erst3ze2stzgel2tz1indtz1inttz2tinua2lauu3aletual2mau3a2louara2bu2be2cub3licu2b3luub2sanub2s1oub2spau1cha_uch1eiu3chesuch1iluch1inu2ch3ruch2souchst4u2ckemuder2eudert4udi3enuditi4ue2neruenge4uen2zuue2r3aue2r1äu3erehu3ereru3erexuer3g2uer2neue2r3ouer3scuer3t2u3erumue4teku2f1äsu2f1eiu2f1emu3fen_u2fentuf2ernuf2frouf1oriuf4sinuf2spouft3s2u2g1apu2g1eiug3ladu3g2löug4serug3spaug4sprug4spuug5stäug3strug3stüuhe3s6uh2reruh4rinuisi4nui4s5tukle1iuk2t3ruld2seu2l1elul1erful1erhul1erwule2saul1etaul1insul2lesul2p1hul4samuls2thul4trium1allum1anzu2maut1um3d2umer2aum1ins3umsatum4serum2simu2m1uru3n2amu2n3an2un2asun4dabun4deiun2didun2dorun2d3r4unds_und3spund3stun2ei_un3einunen2tun4es41unget1ungew1unglüun2g1rung3raung3riung4saun3ide1u2nifun3islu3n2it3u2nivun2keiun3n2eunvol2u1or3cu2pf2eu2pf1iu3rabaura2beur2anbur2anhu2r1auur3b2aur1effu2releu4r1epur1erhur1erwur2griurg3s4ur1iniur3insur1int1urlauur3sacur2sanur2sauur2serur4sinurst4rur2z1wus4annu2s1ecu2s1eiu3seiduse1rau2serpu2s1opu2spatus1picus2porus4sezus2sofu1stalus3tauust2inu2stunu2sturut1altut3a2mu2t1apu2t1arute4geut1ei_ut1eieutel1eute2n1u2tentu4t1exu2t3hout1opfu2topsut3reaut3s2aut2s1äut2spaut5t4lutu4reutu5ruut2z1wuve3räüb2s3tücht4eü3ckenück1erü3den_üden4güdwes2ü2f1eiü2h1eiühl1acüh3r2eühr3taü2mentün2fliün2g3lün3strü2r1eiü3r2o1ü2schlüs2s1cü2t1alva2teiva2t3hvatik2va2t3rvat3s4va2t1uveits32ve3muve3nalve3radve3rasver3b2ve4rekve4rinver3stver5te2ve3scves3tivi4a3tvie2w1vi2l1avi4leh2v1i2m2v1intvi3s2ovoll1avol2livo5rigv1steuwab2blwa3chewaffe2wa2g3nwah2liwal4dawal2tawal2towang4s1war2eware1iwart4ewass4e4webebwe2g1awe2g3lwe2g3rweg3s4wei4blwei2gawei3k4wei4trwel2t1wel4trwen3a4we2r3awer2bl1werbu1werduwerer2wer2fl1werk_wer2ka1werkewer2klwer2kuwer2tawer2to1wertswe2s1pwest1awes2thwest3rwes4tuwett3swi3ckawien2ewie2stwim2mawin2drwi3s2e1witzlwo2chawoche4woh2lewo2r3iwo4r3uwört2hwul3sewur2fa1wurstwus3te1wu4t1xe3lei3x2em_xen3s2x1i2doxin3s2xi2so2xis4täx1i2tuxtblo4x2t1eix4tentx2t3evy3chisyloni1y2p1iny1s4tyy2s1u22z3a2b2z3a2k2z1all2z3anf2z3anlz1artizar2tr2z1arzza1st42z3at3z1au2fzbübe32zecho2z1eck2z1effzei3lazeile42z1einzei3s4zeist4zei2trze2lenzell2azel3sz2z1empzens2ezent3sze2r3a2zerhöz2erl_2zerlö2z1erq2z1erzze3skuzes2spzes2stze2s3tze3sta2zettszger2azi3alozi1erhziers1zi1es_2z1impzin4er2z1inf2z1inhzin1itzin2sa2z1invzirk6szi3s2zzi1t2hzor4ne2z1oszz2t1auz4tehezt1inszt3reczu3ckezug1un2z1uhr2z1um_zumen22z1umszup2fizu3r2a2z1url2z1urs2z1urtz2wangz2weigz1weis2z1wel2z1wen2z1werz2werg2z1weszzi1s4",
		7 : "_al4tei_amt4s3_and4ri_an3gli_angst3_an4si__an4tag_ausch3_be3erb_be3r2e_berg3a_bo4s3k_bu4ser_da4rin_da4te__da4tes_de4in__dien4e_ebe2r1_en2d3r_en4tei_er4dan_er4dar_er4dei_er4der_es5t4e_fer4no_fi3est_fi4le__fi4len_ge5nar_ge3r2a_ge3r2e_ger4in_hau2t1_her3an_ho4met_ima4ge_ka2b5l_li4ve__lo3ver_lus4tr_men3t4_orts3e_pa4r1e_reb3s2_re3cha_rein4t_reli3e_res6tr_sali3e_sim3p4_sto4re_tage4s_ti4me__ti4mes_to4nin_tri3es_ul4mei_urin4s_ur3o2m_ve5n2e_wei4ta_wor4tu_zin4stab1er2raber4ziaber4zoab3essea4cherfa4cherka4cheröach1o2bach2t1oach1u2fa3d2ar3ade1r2aade3s2pade5str2ad3recaf4t5reage4neba4gentuage4ralage4selage2s3pag3esseags4toca2h1erhah4l1eiahner4eahre4s3ahr6tria3isch_ajekt4o1a2k4adak5t4riala5ch2a2l1angalb3einalb3eisal4berh3a2l1efa4l3einal3endsa2l1erfa2l1erha2l1ert3a2lerza2l1eskali4eneali4nalal3lenda2l1o2balt3eigalt3ricalt4stüalzer4zamen4seamp2fa2am4schlana4lin2ana1s4and4artandel4san2d3rüand4sasand3stean2f5laan2g1eian4gerwan2g3raan2k1anan2k3noan2k3rä3antennan3t4heant3rina3ra3lia2r1anga2r1ansa2r1anza2r3appar2b3unaren4seare3r2aa2r1erhar2f3raari3e4nari3erdari3ergarin3itark3amtar2k1arark3aueark3lagark4trear4merkar3m2ora2r1o2dar2r3adarre4n3ar4schla4schecasch3laa2s3e2ma2s1o2fas4s3eia1s4tasas6t3rea2t1aktater3s2ato4mana2t1ortat4schnatt3angat3t4häat2t3räat4zerkat4zerwat2z1inau2b1alauch3taau4ferkaup4terau2s1ahau4schmau4schoaus3erp3aussagaus4se_aus5triau2t1äuä3isch_äl4schlän3n4e2ä2r1eneär4mentäser4eiäse4renäskopf3ät4schlät4schräu4schmäus2s1cba2k1erban2k1aba2r1ambau3s2k2b1eierbei4ge_2b1eimebe1in2hbe2l1enben3dorben4spaben4sprben5t4rber4ei_be4rerkber4in_ber3issbe2s1erb3esst_be3s4ze4b1illubis2s1cb2i3tusbjek4to2b3leidbo2l1anbor2d1ibor2d3rbor2t3rbra1st42b3rat_2b3riemb4schanb6schefb4s1erfb4s1ersbst1a2bb2s3träbs3treubtast3rbu4schlbu4schmbu4schwbügel3eca3s2a3ch3a2bich3anst3chartache4fer4chelemche4ler4chents4chentwche3rei2ch1e4x3chines2ch1invch3leinch4sper2ch1unf4ckense4ckentw4ckerhö4ckerke2ck1err4ckerze2ck1eseck4stro2ck1um3com4te_comtes4cre4mes2d1alar2d1ammädan4ce_dan5kladan2k1odar2m1i2d1au2f2d1aus3delei4gde3leindel4lebdel4leide2l1obdel4sandel2s5edel2s1p4denergden4sende2re2bde4reckder3ediderer4tderin4f4derklä4derneuder3taudert4rades3eltde2sen1de4stredes4tumdeten4tdge4t1edie4nebdi3ens_die2s3cdi2s5tedi4tengd2o3r4ador2f1a2d3rast2d3rauc3d4reck2d3reic3d4riscdrunge3drü5cked4s1amtds3assid4schind2s1e2bd4seinsd2s1engd2s1entd2s1erfd2s1erkd2s1erzd4s1etad3s2kand2s1pard3stell2d1un3ddu4schndu4schrdu4schwe4aler_e3at5t4ebens3eebet2s3eb4scheeb4stätebs3temebs3t2hech1o2bede3n2eeden4seeden4speder3t2ed2s1esed2s3treein4see2f1e2be2f1i2de2f1insege4strehen6t3ehe3strehl3eineh4lenteh5l2erehr1e2cehr3erleienge44eigeno1ei2g3nei3k4laei4leineil3inseim3allei4nengein4fo_ein4fosein4hab3einkomei2n1o23einsate4inverekt4antekt3erfekt3ergela4bene2l3a2me2l1a2re2l1eine3leinee4leing2e3len_e4lensee2l1ente2l1erge2l1errell3ebeell3eiseller4nelt3eng3elternelt3s2kelt3s2pe2m3anfe2m1ansem2d3a2e2m1erw1e2metiem2p3leena3l2ien3d2acend4ortend3romend3s2pene4bene4n1enten4entr4e3ner_e2n1erd1e2nerge2n1erle2n1erre2n1erse2n1erte2n3erue2n1erwe4n3essenge3raeni3er_e2n1i4me2n1o2benob4lee2n1o2ren4terb3entspr4entwetenz3erte4ratemerd3erwer3echser1e2ckere4dite2r1e2h4e3rei_4e3ren_e4rensee4rentne2r3erfe2r1erher3e4tiere4vid3ergebn4ergehäe3ri3k44e3rin_e2r1ini3erlebnermen4serm3erse2r1o2pers4toder4tersert3ins3erweck6erweise4s3atoe2s3einese4lere3s2peke3s2pore3s4praess3erges2s1paestab4be4starb1e2stase1s2tecest3ories3tropeße3r2eeten3d2eter4höeter4tre4traume6t3recetsch3wet2t3auette4n1et4t1umeu3ereieu3g2ereve5r2iewinde3e2z1ennfa4chebfa2ch1ifäh2r1ufeh4lei2f1eing4f1einh2f1einw2fe2lekfe2l1erfel4sohfe4rangfer3erz4ferneufest3eifet2t3afeuer3effel2d1f2f3emifi1er2ffi2l1anfisch3o2f3leinflu4gerfor4teifor2t3r2f5raucf4schanf4scheff4s1ehrf2s1entf4s1etaf3s2kief2s1pasf3s2porf4stechf3s4telf3sternft1a2bef4t1entft4scheft4s3täft4stri2f1u2nifun2k3rfus2s1pfu2ß1er4gangeb2g3ankugas5tangebe4amge4lanzge4lessgel3stegel3t2agen4auggen2d1rgen3eidgen3erngen4samgen4ta_2g1entfge4renggerin4fgerin4tger4satger4stoges3aufges3eltge2s3erges3s2tgien2e12g3isel3g2laub2g1lauf4g3lein4g3lisc2gni2s13g2num_2g3rede2g3reic2g3rein2g3renng3riese2g3ringg4s3a2kg4schefg3s2eilg3s2pekg3s2porgst3entgst3errg4s3torgs4trat4gungew2g1unglguschi5gus4serhaf3f4lhalan4chal4beihal4t3rhar4mes2h1aufmhau4spahäu2s1chba2r3ahe4b1eihe5ch2ehe2f1eihef3ermheiler4heit4s3he2l3auh3e2lekhel3ershel4meihe4n3a2hen3endhen3erg2h3entwher3a2bhe4reck4hereighe4rerwh1er2foherin4fherin4sh3erlauhe2s5trhie4rinhif3f4rhi2l3a4hin4t1ahir4nerhlags4ohle3runhner3eih3nungeho2l1ei2hot3s2hrei4bah4r3eigh3re2s1h2r1etah3rieslhr2s1achr2s3anhr3schlhr2s1enhr4s1inhr4s1ofh2s1achh4schanhse4lerh2s1erlh2s1ingh2s1parhst3alth2s3tauh3steinh5stellhst3ranh3taktsh4t3alth4t3a2mh4t3assh2t1eimh2t1eish4tentfht3erfoht3erfüh2t1erhh4terklht3erscht3ersth2t1erzh4t1eseh4t1esshte3stah4t3rakht3randh2t3rath4t5rinh2t3rolh2t3rosh4t1rösht3spriht4stabhts4tieht4stürh2t1urshu2b3eihu2b1enhu2l3eihu4lenthu2l1inhut4zeni3alenti3alerfi3alerhi3a2leti3a4liai1ät3s4i2b1aufich4speich2t3rieb4stoieb4strie2f1akie2f1anie3g4rai2e2l1aien4erfienge4fien3s2eie3r2erie4rerfi2er5niier4sehier3staier3steies2s3tie2t3hoie4t1ö4i2f3armift3erkif4t3riift3s2pi2g1angi4gefari3g4neuig3steiig4strei2k1a4ki2k1anoi4kanzei2k1erhi2ker2li2k1etaik4leriik2o3p4ikt3erki2l3a2mi4lentsi2l1erfi2l1ergi2l1erril2f3reilig1a2ili4gabi2l1indil3l2eril4mangil2m3atil2z1arilz3erki2m1armimat5scima4turi2m1erfi2m1erzi2m1infi2m1insindes4ii2n1engin3erbei4nerbiiner4löing4sam3inkarninma4leinn4stains3ertin3skanin3stelin4s3umional3aion4spiir2m1eii4s1amtisch3ari3s2chei4schefi4schini2sch1lisch3leisch3obisch3reisch3rui4schwai4schwoisch3wuise3infi4seinti2s1ermi2s1essis4s1aci1s4tati1s4teui1s4tilit3a4reiten3s2iti4kaniti3k2ei2t1in1i2t3ranits1a2git2s1e4its3er1it2s1peit4stafi2v1enei2v1enti2z1enejek4terjektor4je2t1u2jugend3jung3s42k1a2bo2k3a2drka3len_ka4lenskal3eri2k1annakari3es2k1artikau2f1okauf4spke1in2d2k1eiseke4leim2ke2lek2ke3letkel3s2kk3enten2k1ents4kerfahk4erfamk3ergebk3er4hökerin4tker4kenker4neuker4zeu2k1i2dekie2l3o2ki3l2aki3n4o32k1inse4k1lastkle3ari4k3leit2k1o2fekop4fenkot4tak2k3räum2k3redekreier4k4s1amtk2s1ersk2s1erwk3stat4k2t3a2rk2t1erhk2t1ingkti4terk4torgakt3oriek2u3n2akuri4erku4schl4l3aben4l1a2bl2l1a2drla2g1oblan2d3rlang3s4l1a2po2la2r1anla2r1eila4rene3l2ar3glar3ini2l1ar3t3lasserla2t3ralat4tanlat2t3rlau2b3rlaub4se2l1ausslär2m1al2b1edel2b1insld3a2b1ld3a2ckl2d1a2dl2d3a2nld4arm_lecht4ele2g1asleh3r2elein4dulei4ßerleit3s22le2lekle2m1o24lendet4lenerg2l1ennilen4sem2l3entwlent4wäle2r3asler3engle4rers3lergehl3ergen2l1ergilerin4s2l1er2ö3l2erra2l1esellgeräu33lichem3licherliebe4slie2s3clik4ter2l1indulingst4lin2k1ali4schu2l1i4solkor2b1ll1a2bel2l1a2mlle4n3all3endul4lentsl4lerfol4lergoll3erntll3ertrl2l1indl2l1o2rll1ö4sellus5t6l2m3a2blm3einsl2m1e2pl2m1erz2l1o2bllos3t4r2l1ö4l3l2s1a2dl4s1ambl4schinl4schmül2s1e2bl2s1ersl2s1erwl2s1impls3ohnel4t3amel2t3atol2t1eislt4stablt4stocltu4ranluf2t1aluf2t1eluf2t5rlung4sclus4s3alus2s1cluss3erlus2s1olus2s1plus2s3tlus4stälus4t1alust3relut1o2fmach4trma4ges_ma4laktma4l3atma2l3ut2m1analman4ce_man3ers2m1angr4ma3r2oma3s2pa4m1aspemassen3mas4telma1s4trma2ta2b2m1au2fmäu2s1cmbast3emedien3mein4dame1i4so2m1e2miment4spme2r3apme4rensmerin4dmerin4tmerz4en4m1essames2s1omes2s1pme4t3römierer4mil4cheminde4sming3s4mi4schami4schnmi4schwmis2s1cmi2s5tem2m1ansmme4linm4mentwmme2ra2mme4recmmi1s4tmo4n1ermor2d3amoster4mpf3erpmpf3errms5trenm2t1erfm4t1ergm2t1erlm2t1ersm2t1ertm4t1etam2t1insmt3s2kamun2d1amül4lenmütter3na3chenna2l1a2na4lent4n1a2nana4schw4n1a2synauf4frn4austenbe3r2en3ce2n3n2d1anznde4al_nde4lännde4robn2d3ratn4d3runnd4stabnds3taune2e2i22ne2he_2nehen44n3eing4n3eink3ne3l2o4n1endb4n1endd4n1endf4n1endh4n1endk4n1endp4n1endt4n1endwne4nenenen4ge_nen4gen4n1entl4n3entwne2ra2bne3r4alne2r3am4nerbe_4nerben4n5erfonerfor42n3erhö2n1erlöner4mit4n1ernt3n2ers_2n3ersa4n3essine2t1akne2t1annett4scnfi4le_n2g3a2mn2g1andn2g1einnge4ramnge4zänn2g1i2dn3g2locngs5trinie3l2a3n2ing4ni4schwnitt4san4k3algn2k1insn2k1ortnk2s1aln4n1alln4nentsn2n1unfn2o3ble2n1ob2s2n3o2fenor2d5rno4t3eino2t3inno2t1opn2s1a2dn2s1alln2s1äusn6schefn4schronsen4spn2s1erkn2s1erön2s1erwn2s1erzn4s1etan2s1inin4sperin4stat_nst3eifn3stemmns4tentnst4erön4stracn4strien3t2a3cn4tanzan2t1eisn4t1essn2t1inhnton2s1nt3reifnt3riegntu4re_ntu4res1n2ung4n2z1a2gn4zensen4zentwn4zentznz3erwe2o3b4enoben3d4oben3seobe4riso2ch1ecocher4ko3d2e1iof2f1inoge2l1io2h1eiso2h1erto2h1erzoh4lergoh4lerwo3isch_ol2l3auoll1e2col2l1eiol4lerkoma4nero3m2eiso2m1indo2m1into2n1erdon3n2anont3antont3erwon4t3riop4ferdopi3er_o2r3almor2d3amor2d1irord3s2to4rientor2k3aror4mansor4mentor3n2o1oro3n2aor2t1akor4t1anor2t1auort3eigort3erfor2t3evort3insor4trauort3ricor2t1umo4sentsoss3andost1a2bos4t3amost3angos3tarros4ta4soster3eos4t1obost3ranost3roto2ß1enzo2ß1ereo2ß1erfo3t2e1iote2l1aote4leio2t1erwo2t1i2mot4terkoun4ge_our4ne_ozen4taöchs4tuögen2s1öl2f1eiö2r1e2lö3r2erzö2r1uneö2sch3mpa2r3afpar3akt2par2erpar4kampar4kaupe2l1a2pe3li4npe3n2alper2r1a2ph1erspil4zerpingen4pi2z1in3ple5n4po2p3akpo2p3arpor4tinpor4trepor6tripo2s3tepost3eipost3rap2p3a2bppe4lerp4t1entpt3ereip4t1erwp4t1erz2r1acetra4chebra4chinracht3rr3a2d3r3ra1k4l2r3alm_r4alt2hram4manram4m3uram2p3lran4dep4r3aneiran4spara2r1inra4schl2r3asph2r3attarau3e2nrau4man2raus5srbe3r2erchst4rr2d1elbrden4glrder4err2d1innre3alerrech3ar3reigewrei3l2arei3l2irei3necre1in2v2re2lek2r1entl2r1ents4r3entzr4ergen2r1ernä4r3erns4r3ernt3r2ers_2r1ersare2s2tu2r3evid2r3e2x1rfi4le_rfolg4srf4s1idrf2s3prr2g1a2drge4ralrge4taprgi4selr2g3ralrg5s2turi2d3anri3ers_ri3estiri2f1eirif4terri4generin4dexrin4diz4rinnta3r4ins_r4inspirin4tegrin4t5rri4schori4schwr3i2talr2k3reark4stecrkt3ersrk2t1o2rl2s3tor2m1aldr2n1anzr4n3eisr4n1enern3enser4n1ergrn4erhir4n1ertrol4lanro4nerbron4tanros2s1crre4aler2s1a2dr4s1amtr2s3angr3sch2er4stantrs4temprs4terbrst3ingrst3ranr2t1almrt3a4rer2t3attrtei3lartei1s4rten3s2rt3ereir4terfar4terfor4t3erhr2t1erkrter4rerte3s2kr2t1imar4t3rakr4treisrt4s1ehr2t1urtru3a2r3ruch3strun2d1arund3er2r1u2ni4r3uniorus2s1pru2t1o2rve4n1er2z1erfr2z1ergr2z1erkr2z1erwrz2t3ror3z2wecsa2cho22s1a2drsa4gentsa3i2k1sa2l1ids3ameri6s1amma2s3a2nasan4dri4s3antr4s3a2sy2s3aufb2s3ausb3s2ausesbe3r2es4ch2al4schanc4schangsch3ei_4schemp4schess4schiru4schle_sch6lit4schre_4schrinsch3rom4schrousch3s2k4schunt4schwetsch4wilsdien4e2s1echo2s1e2ckse2e1i4se2h1a2se4h1eise4herk5s4ein_sein4dusei3n2esein4fos4eins_4seinsp4seinstsel3ers2s1endl4s1entf2s3entg2s1entsser3a2dse2r3als3erbe_s3ereig2s1erfo4serfül4serken2s3ernt4s3eröf4sersehse4r1ufse3rund4se4tap4s1e2thsi3ach_siege4ssi2g1a2si2k1absik3erlsin3g4lsing3sasi4schuska4te_4skategska4tes4s3klassni3er_sni3ersso4l3eisol4lerson2s1o2s1orga5s2orgeso2r1o24s1o2ve4spensi3s2pi4e4spier43s4prec3sprosssrat4scss1a2cks4s1alas4s1albs4s3amts4s3angs4s3anzs3sa1s2s2s1egasse3infss3ersessquet4s3ta3li4s3tann3staus_st3a2ve4stechn3steilhstei4naste4mar6s5ter_3sterncs4t3ese3s4tett1s2ti2rst1i4sosto3s2t1s4trah4strans3s4tras4straum4s5träg4sträne4s5tref4streibst3renn2s4trig2s5trisst3rollstro4ma4st3run2s4t3s42stum2sstum4sc3s4tunds2t3uni2s3tuns2st3urtsuch4st3s4zene2ß1estrßi2g1a2ta2b1anta4bend2t1a2drta2g1eitahl3sk3t2aktuta4lensta2l1optan4gar2t1anme4t1anna3t2ans_4t3ansi4t3anspta4rens3t4a3rita2ta2bta2t3erta2t1um4t3ausg4t3auss4t1auswtbauer4tbe3r2e4teilhet3einget3einlate2l3abte2l1acte2l1autele4bete4l1ecte4l1ehte4leinte4lerd4t3elf_te2l1inte4losttel3s2kte2m1ei3temperte4na2dte4na2g4t3endf4t1endl4t3endpten3d4rten3eidten3ens4tenerg4t1eng_ten4glate4n3in4tensem4t3entw4t3entzte3ran_te2re2bter3endte4rengte4rerkterer4z4terfol4terfül3ter3g2t6ergru4terklä2t1erlöter4mert3erneuter4re_ter4sert4erst_t4erstit4erstute4r1ufter4wäh2t3erzbtes3tantest3eitestes4teu3ereteu3eriteu2r3a2t3e2xe2t1e2xi4thrin_4thrinsti4dendti3e4n3tie4recti4gerzti2ma2gtim2m1atin2g1at1in1ittin2k1l3t2ins_4t1inseti4que_ti4schatisch3w3ti3t2etle2r3atmen6t3tmo4desto2d1ertor3inttra3chatra4demtra4far2t3rams3t4ran_tre4ale3t4reib2t3reih4trenditre2t3r2t3rund3t4runkt3s2chat4schart3sch2et4schefts4chemtsch4lit4schrot2s1e2bt4seindt2s1engt2s1entt2s1i2dts4paret3s2pont3s2port4spreits3tätit2s3tepts3tradt4strants3traut2s3trät4streut4stropt2s3trütte4lebtte4lent3u2fertums5trtung4s5tu2r1ertu4schlt2z1e2ct2z1eiet2z1eistz3entsubal3l2ubi3os_u2b3rituch4spruch4toruch2t3ru4ckentu3ck2eruden3s2ue3reigue4rergue4rerku4erinnuer4neru3erunfu3eruntu2f1ä2ßu2f1erhu4ferleufs3temuf2t1ebu4gabteu2g1erfu2g1erlugge4stu2g3rüsu3isch_u3ischsuk2t1inulm3einu2m3a2ku2m1artu2m1ausument4su2m1ergu2m1erlu2m1erwumpf4lium2p3leum2s1peun2d1umun2k1a2unk4titunk2t3run2n3aduns4t1runte4riunvoll3up4t3a2upt3ergu2r3a2mu2r1anau2r1angurgros4ur3s2zeu2s1eseusi3er_us3partu2s1pasu3s2peku5s4pizust3abeu5strasus6trisute4leiuter4eruto4berut4schlut4schmut4schöutz3engut2z1inüch2s1cück3eriü4ckersück4speü3d2ensü2f1ergü2h1engü2h1erkü2h1erzühr3ei_ül2l1eiün2f1eiü2r1entüste3neva2t3a4va4t1inve4l1auvenen4dve3rand2ve3s2evid3s2tvie2h3avie4recvi2l1invollen4vormen4waffel3wah4lerwalt4stwar3stewa4schawä3schewe3cke_we3ckeswei3strwer4gelwe4r3iowest3eiwest1o2wim4m3uwolf4s3wol4lerwor2t3rxi2d1emx2t1e2dxtra3b4x2t3rany2l3a2myl4antezei2t1aze2l1a2ze2l1erze2l1inzel3t2hze4n3aczen4semzen4zerze2re2b2z1ergäz3erhalzerin4tzer4neb2z1ersazert1a2zert4anzer4tin4zerwei3z2erzazessen4zger4s1zin4ser4zinsufzon4terz3t2herzu2g1arzu4gentzwan2d1",
		8 : "_al1e2r1_al5l4en_anden6k_ar4m3ac_ar4t3ei_ber6gab_ber4g3r_de3r4en_einen6g_en4d3er_en5der__er4zen4_ka4t3io_lo4g3in_mode6ra_ost5end_oste6re_par3t4h_richt6e_sucher6_tan4k3la2ch1e2ca4ch3erwacht5ergach6tritack3sta43a2er2o1af4t3erlage4s3tiah4l3erhal4b3erw3a2l1e2bal2l3a4rall5erfaalli5er_al4t3erfam4t3ernand6spas3a4n1erban4g3erfan4g3erlan4g3erzang4s3poani5ers_an2t3a4ran2z1i4nar4t3ramau5ereinau4s3erwauster6mau4ten4gau4t3erhäs4s3erkbach7t4ebal4l3ehbe4r3eiwber6gan_ber3st4abe6steinbe4s3tolbote3n4ebst5einbbu4s3chach3e4ben6chergebcher6zie6ckergeb4d3achse2d1an3d22d1e4ben3d2e1i2mde2l1a2gde4l3augdel5sterde4n3endden4k3li4den4semde4r3eisde3r4erbde3r4erfde4r3ero4d3erhöh4d3ersatdest5altdest5ratdienst5r2d1in1it4d3innerdi4t3erldi4t3ermdi4t3ersd4s3tätid3s4tern2d1u2m1edu4sch3le3a4reneech3t4eiege4n3a2eg4se4r1ehr6erleei4b3uteei4d3errei2m1a2gein6karnein6stalei6schwuei4s3erwek4t3erzeld5erstel4d3erwe4ler4fae4ler4lae4l3ernäe4l3e4taelgi5er_elgi5ersel4l3einemen4t3he6mentspen4d3esse4n3ermoeni5ers_en5sch4eenst5alten4s3täten4t3rolen4z3erfen4z3ergen4z3erke2r3a4sie4r3eis_e4r3entferi3e4n3er6tereier4t3erfess4e3rees4t3enges4t3erhes4t3essestmo6deet4z3enteue6reifeut6schnfacher5ffal6schafal6schmfe4r3anzfrach6trf4s3tätif4s3tresf4s3tütef4t1e4tift4s3tanfzeiten6gas4t3el2g1eise2gel4b3ragel4b3rogel6dersge4l3ers4g3ereigge4ren4sge4r3entge4s3terglei4t5rgrammen6gros6selg3s4tatigs4t3rosgu4t3erhhaft4s3phal6lerfhau3f4lihau5steihau6terkhe4f3inghel4l3auhe2n1e2bhe4r3eishe4r3o4bhfel6lerhich6terho6ckerlhol6zeneh6rerlebh3s4terbh3t4akt_h4teil4zh4t3elith4t3entsht5erkenh6terneuh4t3erreh6terstaht6ersteht6raumeht4s3turhu4l3enghut4z3eria4l3ermie4n3a2gie4n3ergienst5räie4r3erziesen3s4ie4t3erhie4t3ertiker6fahi3l4aufbim4m3enti2n1e2bei4ner4trin2g1a2gin4n3ermin4s3tätir4m3untir4sch3wi4sch3eii5schingi6schwiri4s3etatiso6nendis4s3cheit4z3ergjah4r3eika4n1a4s6kantennkehr4s3o4ken4gagken5steiker6gebnkerin6stk3er4lauk3er4lebk6erlebe2k1er2zikeu6schlkor6dergkre1i2e4k4s3tanzk4t3erfolan2d3a22lat2t1alat4t3inl2d1e2seleben4s3lei6nerble4n3end5lentwet4l3ereigle4r3eim3l4ergew6lerwerbli4g3ers2l1in1itl6lergebl6lergen2l1or3g2l4s3ort_l4s3tätils6ternels6ternsl4te4leml4t1e4skl2t1o2rilu2g1e2blus6serflus6serklus6serslu4t3ergl2z1u4femagi5er_magi5ersmar6schmmar6schrma4t3erdmen6tanz4m3entwi4m3ergänmes6sergmp4f3ergmp4f3erz4m3ungebmu4r1u2fnacht6ra4n3a2mernavi5er_navi5ersn4d3entsnder5stene2n1e2bn4g3erseng4s3e4h2n3i2gelni4k3ingn4k3erfanseh5eren4s3ort_n4s3prien4s3tatens6terbenst5opfenten6te_nt4s3parober3in4ode6rat_ode6rateoh4l3erholl5endsoll5erweol4z3ernonderer5on4t3endopf5erdeopi5ers_or4d3engo2r1e2ckorsch5lior4t3entor4t3ereor4t3offor4t3räuos4s3enzo2ß1en2kö4sch3eipargel6dpä4t1e2hpä4t3entpe4l3inkp2f1in3spos4t3agrach6trärali5er_rali5ersran4d3errau4m3agräu5scher2b1a2der4b3lastrch6terwrderin6sr4d3erntrege4l3äre4h3entreister6re4n3end4r3erken4r3erlaurge4l3errgen4z3w4r3innerrkstati6rk4t3engrk4t3erfrk6terscrk4t3erwr2m1o2rirn3e4benrol3l4enrpe4r3inr6scherlr4s3ort_r6strangr4t3erler4t3ernäru6ckerlrun6derlrun6dersrun6derwr4z3entssa4l3erbsat4z3en6schlein2s1e2bense4l3erl4s1e2pos6sereignse4r3eimse4r3enk2s1i2deoson5ende2s1o2riesrücker6sse3in4tstel4l3äs4t3endss4t3engls4t3entfste6rersstes6se_5st4reif1s4tri2ksun6derhtan6zerhta4r3eretau3f4litau6schrtau6schwtblock5e4t1e2bentein3e4cte2m1o2rte2n1e2bte3n4ei_ten4t3riten6zerh4t3erde_te4r3eif6tergreiter4n3art6erscha6terwerbtes6terkti4v3erlto6ckenttrücker6t4s1amt4t4s3esset3s4terotta6gess2t1u2niotu2r1a2gtu2r1e4tu2ch1e4cu3erin4tuern3s4tu4g3reisun4d3erfund5erhau2r1an5sur3a4renu6schentusch5werusi5ers_u4t3ersaüge6leiswach6stuwach4t4rwahl5entwandels6we5cken_wein4s3aweis4s3pwel6schlwel6schrwel4t3a2wen4k3ri5werdensxpor6terx2t1er2fx2t1il2l2z1e2benzeit5endzei4t3er4z3ergebzer4n3ei4z3erstezer4t3agzer6terezer6trau",
		9 : "_char8me__er8stein_he6r5inn_men8schl_men8schw_os5t6alg_rü6cker6_wort5en6_wor8tendach8traumalli7ers_allkon8tral5s6terbausan8ne_äh4l3e4be6b5rechtebs3e4r3inchner8ei_dampf8erfden6s5taue6ch5erziee4r3en4ge6l5eier_erg3el4s3fal6l5erk6fel6ternfor4m3a4gforni7er_fzei8tendgot6t5erggrab8schegren6z5eihä6s5chenhe6rin6nuherin8terh6l3er4näh6t5erspaieler8gebi2k1e2r2eil4d3en4ti4sch3e4hkamp8ferfke6rin6nulan6d5erwlan6d5erzleis6s5erlepositi86mel6ternmorgen5s65n2en3t2aner8schlenich8tersn4n3er4wano6t5entrnsch7werdn5s6ternen5s6ternsos4s3en4kpapieren8ram6m5ersr8blasserres6s5erw6r5innenmris6t5ersr6st5eingrs4t3er4wr4t3er4lasfal6l5erspani7er_sse6r5atts4s3e4strsu6m5ents4t3a4genttblocken8tes6ter6gür4g3en4gvati8ons_vol6l5endwer6t5ermwin4d3e4czes6s5end",
		10 : "_er8brecht_os8ten8deder6t5en6deren8z7endgram8m7endhrei6b5e6cos6t5er6werein8s7trewel6t5en6dwin8n7ersczge8rin8nu",
		11 : "_er8stritt__spiege8leiach8träume_lei8t7er8scpapie8r7endpiegelei8en",
		12 : "ach8träumen_7sprechende_",
		13 : "_er8stritten_"
	},
	charSubstitution : {
		'ſ' : 's'
	}
};
var h = new window['Hypher'](module.exports);

if (typeof module.exports.id === 'string') {
    module.exports.id = [module.exports.id];
}

for (var i = 0; i < module.exports.id.length; i += 1) {
  window['Hypher']['languages'][module.exports.id[i]] = h;
}
}());

(function () {

var module = {
    exports: null
};

// The en-GB hyphenation patterns are retrieved from
// http://tug_org/svn/texhyphen/trunk/collaboration/repository/hyphenator/
module.exports = {
	'id': 'en-gb',
	'leftmin': 2,
	'rightmin': 3,
	'patterns': {
		3 : "sw2s2ym1p2chck1cl2cn2st24sss1rzz21moc1qcr2m5q2ct2byb1vcz2z5sd3bs1jbr4m3rs2hd2gbo2t3gd1jb1j1dosc2d1pdr2dt4m1v1dum3w2myd1vea2r2zr1we1bb2e2edn1az1irt2e1fe1j4aya4xr1q2av2tlzd4r2kr1jer1m1frh2r1fr2er1bqu44qft3ptr22ffy3wyv4y3ufl21fo1po2pn2ft3fut1wg1ba2ra4q2gh4ucm2ep5gp1fm5d2ap2aom1cg3p2gyuf2ha2h1bh1ch1d4nda2nhe22oz2oyo4xh1fh5h4hl2ot2hrun1h1wh2y2yp2aki2d2upie22ah2oo2igu4r2ii2omo1j2oiyn1lz42ip2iq2ir1aba4a2ocn3fuu4uv22ix1iz1jay1iy1h2lylx4l3wn5w2ji4jr4ng4jsy1gk1ck1fkk4y5fk1mkn21vok1pvr44vsk1t4vyk5vk1wl2aw5cn2ul3bw5fwh2wi2w1m1wowt4wy2wz4x1an1in1rn1ql3hxe4x1hx1ill24lsn3mlm2n1jx1ox3plr4x5wxx4",
		4 : "d3gr_fi2xy3ty1a2x5usy5acx1urxu4on2ielph2xti4ni2gx4thn2ilx1t2x1s25niql3rix4osxo4n1logn2ivx5om1locl3ro2lo_l3nel1n4_hi2l5rul1mexi4pl1max3io_ex1l1lu_ig3ll5tll3sll3p_in14n2kl1loll3mn3le_ew4n1n4nne4l1lixi4cll3fn3nil1lal5skls4p_eu14no_l4ivx3erx3enl1itx1eml1isx5eg3lirli1qxe2d3lik5lihx1ec1lig4y1bn1oun4ow4li_x3c4yb2il1g2l2fox2as1leyn3p42lev1letx2ag4ni_l1te_es1nhy2yc1l4n1sw3tow5tenho4ns2cwra42lerle5qn2si3womwol4l1try1d4lek42ledwl1in3suw3la4le_l3don1teldi2nth2lce4yda4l1c2l1tu4lu_l4by_od4lbe4lu1a4laz_oi4l4awnt2iwes4l4aul4asn2tjla4p_or1n1tr5wein1tun2tyn1h2w4ednu1awe4b5nuc_os13nudl4all4af_ov4w3drl4aey3eenu3iw1b45nukl4ac5laa4la_4lue3kyllu1in1gu4wabn1go_ph2v5vikur5_en12vv2ks4ty3enk3slv5rov5ri4k1sk3rung1n2vowy1erkol4ko5a4vonk2novo2l2vo_5lupn2gingh4k3lok3lik3lak2l2ng2aki4wvi2tkis4k1inki2l5kihk3holu1vke4g3kee4kedkdo4_sa2k5d2_eg4k1b4kav4kap4vim4ka3ovi4lk4ann3v2nve2vic2ka4lju1v4vi_ju5ljui4_sh2ygi2nfo4_st44jo_3jo2jil43jigl4vi2vel3veive3gjew3jeu42ve_4jesjeo2y3gljal43jac2ja__th44ly_2izz_ti22izo_do2i5yeix3oy3in2i1wn2x4i2vov4ad2ny25nyc5vacn1z24va_nzy4uy4aux2o2oa2o3ag2ivauve2u4vayle2i3um2ittly1c4obau3tu2itrob2i4obo_up12ithob5tuts2lym2ut2o_ve2oc2ait1a2isyo1clo1crut2ioct2is1pis1lo1cy4usto2doo2du4isblyp2n4ew2ab_2abai4saoe3a2abbus1pir2sir4qoe4do5eeir1ioep5o5eqo3er2usco1etir1a3lyr3lywipy43oeuo3evi3poab1ro3ex4ofo2o1gur1uo2ga2abyac2a3lyzi5oxo3gii3oti1orioe4ur2so2gui1od2io22acio1h2ur1o2inuo3hao3heohy44ma_oi4cins24inqoig4ac1r2ino2inn4inl4inkur1ioi4our2f4oisoi4t2iniynd4ok3lok5u2ind2inco1loyn2eo1mai2moom1iur2ca2doim1iil3v4iluon1co2nead1ril3f4onh2ik24iju4adyae5aija4i5in4aed2mahae5gihy4ae5pur1aae4s2i1h4igions2i1geyng42ont4af_4afe5maka4fui3fyu2pri3foon2zn1eru4po4agli2fe2i1foo1iu1ph4ieua2groo4moo2pyn4yi1er4iemie5ia1heah4n4iec2ai24ai_ai3aa1icne2p4idraig2oo2tu1peo1paop1iy1o2u1ouu3os4oplid1ayo3d2icuop1uor1a2ick4ich2a1ja4ju2mam4iceak5u4ibuunu44iboib1i2oreiav4i3aui3atun5ror1iun5o2alei5aii3ah2unniaf4i5ae2ormhy4thyr4hy3ohyn4hy2m2orthy2l1man2nedhuz4un2ihu4gh1th4alko1sch4skhsi42mapu1mu2h1shry4hri4hre41mar4h1pum2ph2ou4osp4osuy2ph4oth4ho_u1mi2h1mh1leh3la2ne_h4irhi2pu1mao4u2oub2h1in2a2mhi4l4oueu1lu2ulsoug4h1ic2hi_u1loul3mnde24ulln2daheu2ul2iou3mam1ihet12ounhep1ow1iows4ow5yyp1nox3ih4eiox5oypo1oy5aoys4u1la4ul_am2pu2izmav4h2ea4he_y2prhdu42m1ban2ao1zo_ch4mb4dy5pu4pa_ha4m1paru2ic5pau2ui2h4ac4ha_u4gon1cug5z2uft43gynu4fou3fl3ufa5gymmb2iue4tgy2b4anhnc1t2g1w5paw3gun2p1bu4edueb4p1c42guep5d2an1og5to2pe_gs4tgs4c2g1san2s2ped3grug4rou2dog4reud4g1gr2n1crgov12gou3gosud4e3goop4ee3goe5god3goc5goa2go_pe2fg2nog1niuc3lg1na2gn2an2y2pes3gluyr4r3pet5aowyr4s4ap_4apa3glo4pexyr5uu4ch2gl24y2s5gip2me_3gioap1i2ph_gi4g3gib4gi_uba41g2igh2tg3hoa2prphe44aps2medg2gegg4ame2g2g1gy3shu1alua5hu2ag2g1f3get2ua2ph2lge4o1pho2tz23gen4phs1gel1typ4gef2ge_g5d4me2m1phug1at4pi_p2iety4a4ty_p2ilt3wopim23gait2wi3gagn3b44ga_5piqar3har1i1tutfu4c4fu_1menp2l23tunna2vfs4p2f3s1pla1fr2tu1ifo3v4tufp4ly2p1myso53foo2arrme4par2stu1afo2n4tu_4po_t2tytt5s3pod2aru4poffo2e3foc4fo_ar5zas1ays1t3flu2asc3flo3flan2asas2et3ti2fin5poypph44f5hf3fr1pr2f1fif1fena5o3feufe4t4pry2ps22asotta4p3sh5fei3fecass2p1sits2its4ht2sc2fe_4t1s2f5d4f5b5faw5farp1st2pt2as1u2fa_1f2aeyl44ey_1expe1wre3whe1waevu4p4trp1tupub1puc4p4uneus44eumeuk5eue4p4uset5zyzy4z1a14p1wet2t2p4y4tovpy3e3pyg3pylpy5t2za__av44ra_r2adras2et2ae1su1namr2bat1orr2berb2ir1c2r2clrct4nak24re_rea4e2sc4es_2erza2to5tok2erurei4erk44erj1tog3toere1qre1vza2irf4lr1g2r2gez4as4ri_2ereto1b2erd2to_2erc4m3hri3ori5reph14mi_2au24au_m1ic4auc4t3me1paeo3mt1lieo2leof2eo3b4enur1lar1leaun2r1loen2sen1ot1laen3kzeb4r1mur2n24ene2end3tiurn5nrnt4ze4d4ro_r2od4roiroo4r2opelv4e1lur4owti4q1tip4roxrpe2r2ph1tior3puaw1i5nahaw5y4mijr3ri_as12eleay3mayn4ays2r5rurry5ek4l2az2m2ilaze4e2ize2iv4eis2ba_t1ineig24eifeid45bahba4ir2seehy21timeh5se5hoe1h2e2gr2efuef4lna2ceep1ee2mee1iee5gee2fr3su2na_rt3ced4g1basede23mytr1turu3ar2udr4ufe1clru2le1ceru2pb1c2ec2a2b1deb2te2bre4bl3myi4be_3beaeb2iebe4eb2b2bedzib5r1v2r2veeau3t1icmy3e5bee3bef2r2yry2tz2ie1bel2sa_2sabeap25saebe3meak1ea4gsa4g3sai4ti_5sak4beobe3q4eabmy4dd3zo3dyndyl25dyksa2l2d2y2d1wsa4mbe3w2b1fbfa44b1hb4ha2bi_1biazi5mdu3udu2ps3apb4ie3ducbif42ths2du_z4isb1ilmi3od4swds3m4bimd5sl1saumi3pz3li3dox4s3bd4osd2or3doosby3bip4bi5qbir44zo_s1cab2iss1cedo4jd4ob4do_5zoa2d1mmtu4d5lu2bl2d1losch2d1la2dl4tha42th_m5si4m1ss2co2t3f1diu2se_se2a4bly2b1m3texbmi44b1nm4ry4bo_3boa2sed5bobdil4bo5h3sei1didse2p1dia4di_d4hu3bon4d1hxys4dg4ami2t2d5f1boo3dexs2es1set3sev3sex3sey2s1fsfi4_an1d3eqde1ps4idsif4bow2si4g2sin5boyzo5p3sipde3gs1it3dec2de_d3di2tep3miute2od1d4d3c4zot23davs2k24sk_d1atske2d3ap4sksd1agb3sc2sl44da_5zumb5sicy4tbso2te2ltei4cys4cy4m2b1tcyl34bu_5bubte2g1cyc2cy_bun2cu5v5cuu1cuss2le1curt4edc4ufc1tyc1tu4te_c1trs1n2s2na2so_t1ca5mix4b3w4zy_4by_3byibys45byt2ca_2tc23soes2olc1te5cafsos45cai5cakc1al3sou4t3bt4axc2ta4m1lcry2sph2s1plc2res2pos4pym3pum3pocoz4cov14mo_sre22moc5cao1caps1sa3cooss3mcon11cars4sns1sos1su1takss3wmod13coe4st_1tai3tah3coc3coa4co_taf4c3nim2pist3cc1atste2mo1mc4kem4ons1th2cim3cau2tab2ta_3cayc1c44stl3cilc3ch3syn4cigci3f4ce_4ci_3chrs1tu1cho2ced4chm1sylch5k4stw4cefce5gs4tysy4d4su_sug3sy1c3sui4ch_m3pa2cem4sy_cew4ce2t1cepsu5zm4op2swo2s3vzzo3",
		5 : "n5tau2cenn3centsves45swee5cencsu5sus4urg1cen2sur3csu5pe3cerasun4a3cerdsum3i5cern5cesss4u2m1s2ulce4mo3cemi4celysy4bi4chab3chae3chaisui5ccelo45cellchec44ched3chee3chemsuf3fch1ersu3etsud4asuct44chessubt2ch5eusu4b13chewch5ex5chi_3chiasu5ansy4ce1styl3ceiv3chio5chip3cedi3cedestu4m5cedace4cicho3a5choc4chois4tud3chor3ceas2st3sstre43chots2tou3stonchow5cean3chur43chut5chyd3chyl3chym1c2i24ceab4ciaccia4mci3ca4cids4cie_ci3ers4toeci5etccle3cifi4ccip4ci3gast3lisyn5esyr5icat4ucim3aci3mes5tizs4thu4cinds4thac4atss4tec4cintci3olci5omci4pocisi4cit3rt2abockar5cka5tt5adeck5ifck4scc2atcs4teb3clasc2le22cle_c5lecc4at_clev3cli1mtad4icli2qclo4q4stakclue4clyp55clystad2rtae5n1c2o2case5car4vco5ba3tagrco3cico5custab23tail4cody2tairco5etco3grcar5mt4ais4col_col3atal2css5poco5lyta3lyco4met4anecomp4cap3uta4pass5liss1ins1sifs1siccon3scon3ts3siacapt4coop4co3orcop4eco3phco5plco3pocop4t2corassev3s5seus1sel1tard3corn4corotar3n5cort3cos_sre4ssreg5co5ta3tarr5cotytas3it3asmco3vacow5a5tassco5zic4anotas4t5craftat4rc4ran5spomcam4is4plysple2ca3maca3lys2pins2pids3phacal4m4speocri3lcron4so3vi4crousov5et5awacrym3cryo34c5s4csim5tawn43calcc3tacc4alaso5thct1an4soseca3gos3orycad4rc4teasor3os2o2ps4onect5esct5etct2ics2onaso3mo1so2mc3timsol3acaco3c4acesody4sod3oc5tio2s3odc3tittcas4tch5u4t1d4smo4dsmi3gc1tomc3tons3mensmas4b3utec2tres3man3bustc2tumte3cr2s1m4buss2s5lucslov5c2ulislo3cs3lits5leycu4mi5cunacun4e5cuni5cuolcu5pacu3pic3upl4tedds3lets5leabur3ebunt4cus5a3slauc3utr4tedobun4a4teeicy4bib4ulit3egoteg1rcy5noteg3us1latbsin41tellbsen4d4abr1d2acdach43tels3dact4b1s2sky3ld4aled4alg4bry_dam5a3damed3amida5mu3dangs5keybrum4d3ard5darms3ketbros4tem3as5kardat4ub4roa4teme4tenet5enm4tenob2ridteo5l4bre_5sivad3dlid3dyite3pe4s1ivde5awde4bisi4teb2ranbram44sismde1cr4dectded3i4sishs1is24bralde4gude3iosi4prtep5i4sio_1sio45sinkde5lo1d4emsin3is2ine4boxy1silibow3ssif5f4demybous4den4d4dened3enh4sidssi4de4sid_3bourde3oddeo3ldeon2si4cu5terd3sicc4s1ibde2pu5botishys44shu4d4eres3hon5shipsh3io1derider3k3dermsh5etsh1er4shab1teri2s1g4der3s5deru4des_de3sa5descbor4nter5k3terrdes4isexo23borides1psewo4de3sq2t2es5seum1de1t4tes_de5thde2tise5sh4ses_bor3d3septsep3atesi4t3esqdfol4tes4tteti4dgel4d4genbon4ebon4cdhot4bol4tbol3itet1rdi2ad3diarbol4e4d1ibd1ic_3sensdi4cedi3chd5iclsen5g1dictsem4osem2i5self4sele4boke5selasei3gd4ifo2boid3seedbod5i5dilldilo4di3luse4dabo5amdi1mi2d1indin4ese2cosec4a3di1odio4csea3wdip5t3diredi3riseas4di4s1d4iscs4eamb3lis3dissbli2q2s1d22s1cud3itos4coi2ditybli3oscof44blikscid5dix4i3bler4the_b3lan5dlefblag43dlewdlin45blac4b5k4bi5ve4d1n24bity4thea4thed4sceidog4abis4od4ol_s4ced5bismscav3sca2pd4ols5dom_1thei3theobi3ousbe4sdo5mos4bei4donybio5mbio3l4dor_dor4mdort41bi2ot4hersavi2dot1asaur52dousd4own4thi_th5lo2thm25binad3ral3dramdran4d4rassat1u3dreldres4sa2tedri4ed4rifs2a1td4romsas3s3sas_4d1s2th4mi3thotds4mi1th2rb2iledt5hobigu3bi5gadu1at5thurduch5sar5sdu4cosap3rbid5idu5en2santdu5indul3cd3uledul4lsan3adun4asamp43b2iddu3pl5durod5usesam5o5thymbi4b1dver2be3trsa3lube3sl3sale2bes_be1s2dy5ar5dy4e3thyrber5sdyll35dymi5berrdys3pberl4thys42beree1actbe5nuea5cue5addbe1neead1i1ti2ati3abben4deal3abel4tsad5osad5is3actean5i2t3ibsac4qe3appear3a5sacks3abl2belebe3labe3gube5grryp5arym4bry4goeas4t5rygmry5erbe3gobe4durvi4tr3veyr3vetr3vene4atube4doeav5ibed2it3ic_eaz5ibe3daebar43becube3caru3tirus4pe2beneb5et4bease5bile4bine4bisbdi4ve4bosrur4ibde4beb1rat2icie4bucru3putic1ut3id_run4trun4ge5camrun2eec3atr4umib3blir4umeech3ie4cibeci4ft4ida2b1b2ru3in3tidirue4lt5idsru4cerub3rr4ube1tif2ec1ror4tusti3fert5sirto5lr1t4oec1ulrt3li4tiffr2tize2dat3tigie4dede5dehrt3ivr2tinrth2ir5teue3deve5dew5barsr5tetr1ted4tigmr3tarrta4grt3abed1itedi2v5tigued3liedor4e4doxed1ror4suse2dulbar4nrs5liee4cers3ivee4doti4kabar4d5barbr4sitba4p1r3sioeem3ib4ansee4par4sileesi4ee3tot4illr5sieefal4rs3ibr3shir3sha5bangr3setb4anee4fugrsel4egel3egi5ae4gibe3glaeg3leeg4mir3secr3seat4ilte5gurban4abam4abal5utim1abal3abag4a5eidobaen43backr4sare4in_e3ince2inee1ingein5ir2sanei4p4eir3oazz4leis3ir2saleith4azyg4r4sagaz5eeaz3ar2r1s2ek3enek5isayth4e4lace5ladr3rymelam4r3ryi3tinnay5sirro4trrog5rrob3ay5larric4ax2idrrhe3rre2lele3orrap4el1ere1lesrra4h4r1r44tinst4intrpre4el5exrp5ise1lierph5ee3limav1isti3ocrp3atav3ige3livavas3r4oute3loae3locroul35rouero3tue2logro1te4rossr4osa4roreel3soror5dav5arelu4melus42t1ise5lyi3elytr4opr4rop_emar4tis4c5root1roomem5bie1me4e4meee4mele3mem3tissro1noro3murom4pe4miee2migro3lyro3laroid3e3mioro3ictis2te4miuro3gnro1fero3doava4ge2moge4moiro3cuem5om4emon5roccro5bre2morro4beav4abr5nute5mozrnuc4au3thr5nogr3noc3titlem3ume5muten3ace4nalrn3izrni5vr1nisrn3inr3nicrn5ibr5niaenct42t1ivr3neyr3netr3nelaus5pene5den3eern5are5nepe2nerr5nadr3nacrn3abt3iveen1et4aus_rmol4e3newen3gien3icr3mocrmil5en5inr5migaur4o5tleben3oieno2mrm4ieenov3aun3dr2micen3sprme2arm4asr2malr5madr3mac3tlefen2tor4litau3marlat33tlem5tlenen3uaen3ufen3uren5ut5enwa5tlewe4oche4odaaul4taul3ir3keyr3ketrk1ere5olutlin4eon4ae3onteop4te1or1r5kaseor3eeor5oeo1s2eo4toauc3oep4alaub5iepa4t4a2tyr2i4vr2ispris4cep5extmet2eph4ie2pige5pla2t3n2ri5orri4oprio4gatu4mrin4sr4inorin4e4rimse1p4u4rimmr4imbri2ma4rim_at1ulr4ileri2esera4gera4lri3erri5elrid4e2ricur4icl2riceri3boer3be2r2ib2a2tuer3cher3cltoas4ri5apri3am4toccat1ri4ered3r2hyrhos4tod4irgu5frg5lier3enr3gerr3geor5geee3reqer3erere4sa4trergal4r4gagat3rarfu4meret42a2tra5tozatos4ere4ver3exreur4er3glre3unre3tur3esq2res_er2ider3ierere4rer4aer3into5dore5phre1pe3reos3reogre3oce3river5iza3too4atoner3mer4enirene2rena4r3empr5em_re1le4ero_re1lam5ordreit3re3isre1inre3if2atolre2fe3reerree3mre1drre1de2r4ed4atogeru4beru5dre3cure3ce3reavr5eautol4ltolu5es5ames5an4atiure3agre3afr4ea_to5lye3seatom4be5seeat1itese4lr4dolrd3lie1shie5shurdi3ord2inr5digr4dier4desr2dares3imes3inr5dame4sitrc5titon4er5clor4clees4od3tonnrcis2rcil4eso3pe1sorr2cesrca4ston3ses4plr4bumr2bosrbit1r2binrbic4top4er4beses2sor3belrbe5ca4timrbar3e2stirb1anr4baga2tif4toreest4rrawn4tor5pra3sor4asktor4qr2aseras3cati2crare2eta3p4rarcran2tet4asra3mur5amnet5ayra3lyra3grra4de3tos_eter2r2acurac4aetex4e2th1r2abo2etia5rabera3bae5timet3inath5re3tir5quireti4u1quet2que_e2ton4quar5quaktos4ttot5uath3ipyr3etou4fet1ri5tourt3ousath3aet1ro4a2that5etetud4pu3tre4tumet4wetra5q3tray4ater4tre_4trede3urgeur5itren4pur3cpur5beut3ipu3pipun2tpun3i3puncev3atpun4aeve4n4trewpum4op4u4mpu5ere4vese1viapuch4e2vict2rieevid3ev5igpu5be2trilt2rit4trixe4viuevoc3p5tomp3tilata3st4rode4wage5wayew1erata3pew5ieew1inp5tiee3witatam4ex5icpt4ictro5ft2rotey4as2a2taey3s2p5tetp1tedez5ieas5uras4unfab4ip2tarfact2p4tan2f3agp4tad5falopt3abtro1v3psyc3troypso3mt4rucfar3itru3i2t4rytrys42asta3feast4silfeb5ras3ph2fed1as5orfe1lifem3i2t1t4p3sacf5enias4loas4la3feropro1l4pro_3ferrfer3v2fes_priv24priopren3aski43prempre1dfet4ot3tabpreb3as5iva3sit4pre_f5feta5siof5fiaf3ficf5fieffil3prar4ff4lepra5dffoc3prac1as3int5tanppi4ct5tast3tedfib5u4fic_ppet33fici4ficsppar34p1p2fiel4asep4p5oxi1fi2l4asedfin2apo1tefind3fin2ef1ing3p4os3portpor3pf3itapo4paas2crt3tlifle2s2ponyflin4t5toip4o2nasan2pom4eas4afa5ryta3ryot5torar3umt3tospo3caar2thar3soar2rhar4pupnos4tu5bufor5bar3oxtu5en5formplu2m2plesaro4ntu4is3plen3plegfrar44ple_fre4sar3odfruc42tum_3tumi4tumsf1tedtun4aft5es2p3k2p2itutu4netur4dtur4npis2sfug4ap4iscfun2gp4is_fur3npir4tfus5oar3guar5ghpi4pegadi4pip4at3wa4ar3en3gale3pi1op4innpin4e3galot3wit5pilo3piletwon4pig3n5tychpict4g5arcg4arepi4crpi3co4picagar5p5garr1ga4sgas5igas3o3piarar4bl3phyltyl5ig4at_2phy_phu5ity5mig4attgat5ugaud5ga5zaar3baara3va3rau5geal3gean2ge4d3gedi5gednar1at3type4gelege4li1tyr13phrage4lu2gelygem3i5gemoara3mph3ou3phorgen3oa3rajt5ziat5zie4gereph1is2ges_5gessphi4nua3ciget3aara2ga5quia5punua5lu1philg3ger4phic3phibg3gligglu3g5glyph3etg4grouan4og5haiuar3auar2dg4hosuar3iap5lia5pirph2angi4atu1b2igi5coap3in4phaeub5loub3ragi4orgi4otaph3igi5pag4i4s5gis_gi2t15gituu1c2aa5peug3laru5chrglec43glerap3alpe4wag4leypet3rpe2tia1pacaol3iglom34glopa5nyian5yap4ery3glyp2g1m4a5nuta3nurg4nabper3vp4eri4pere5percpe5ongn5eegn3eru4comg4niapen5upel5v4pelean3uluco5tgno4suc2trant4ruc3ubuc5ulu5cumgo4etgo4geu5dacg5oidgo3isgo2me5gonnpe2duud1algoph44gor_5gorg4gorsg4oryud5epgos4t1anth3pedsg1ousan2teu4derudev4grab43gram3pedigra2pudi3ogril43pedeu5doigro4gg5rongrop4ud5onan3scgru5ipe4coan5otan2osanor3g4stiu5doran2oeg4u2agu5ab5guan4annyg5uatan5no5gueu4aniuuen4ogu2magu4mi4anigpawk4uer3agur4ngur4u4gurypau3pani3fan3icues4san3euan4eagyn5ouga4cug2niug3uluhem3ui3alp5atohae3opas1t1p4ashag5uha5ichais4par3luid5ouil4apa3pypap3uhan2gpa3pepa4pahan4tpan3iha4pehap3lhar1ahar5bhar4dpan1ep4alspa3lohar3opain2paes4pad4rhat5ouil4to3zygozo5ihav5oana5kuin4san3aeuint4amyl5am3ului5pruis4t1head3hearui3vou4laba3mon4ulacu5lathe3doheek4ul4bohe3isul3caul4ch4uleaow5slow5shu5leehem1aow5in3amidow5hahem4pow1elhe3orulet4h1er_owd3lher2bowd4io5wayow3anow3ago1vish5erho5varouv5ah1erlouss42ouseh1ersoun2dul4evami2cul2fahet3ioul4tul4iaheum3ou5gihe4v4hev5ihex5oa3men3ambuu5lomhi4aram1atou5gaul4poh4iclh5ie_h1ierou3eth1iesama4gh3ifyhig4ohi5kaa5madoud5iou5coou5caa5lynhin4dou5brul1v45ou3aalv5uh2ins4o1trh4ioral1vahip3lum3amhir4ro4touhit4ahiv5aumar4u5masalu3bh3leth1l2ihli4aum2bio1t2oot4iv2h1n2o5tiaal3phho3anho4cou4micho5duho5epo4tedhold1o3taxo3tapot3ama5lowh2o4nos1uru4mos4ostaos4saos1pihon1o1hoodhoo5rh4opea4louo5sono5skeh4orno4sisos1inos5ifhosi4o3siaalos4os5eual1ora3looo2seta3lomoser4hr5erhres4um4paos5eohrim4h5rith3rodose5ga5loeo3secumpt4un5abun4aeht5aght5eeo4scio2schos4ceos4caht5eoht5esun2ce4aliuosar5un3doos3alosa5iory5phun4chunk4hun4thur3ior4unu1nicun4ie4or1uun3inal1in5aligal3ifal1iduni5por4schy1pehy3phuni1vor1ouun3iz2i1a2ia4blo5rooorm1ii2achiac3oa2letork5a5origa1leoun3kni2ag4ia3gnor3ifia3graleg4a3lec4ori_al3chor5gn4ialnor4fria5lyi5ambia3me5orexi3anti5apeia3phi2ardore4va5lavor3eiore3giat4uore3fal3atun3s4un5shun2tiibio4or4duib5lia1laei4bonibor4or4chi5bouib1riun3usoram4ic3acor5ali4calic1an2icariccu4akel4i5ceoa5ismich4io5raiora4g4icini5cioais1iic4lo2i2coico3cair3sair5pi5copop2ta2i1cri4crii4crui4cry1op1top5soopre4air5aop2plic3umopon4i5cut2i1cyuo3deain5oi5dayide4mo4poiain3iu1pato1phyid3ifi5digi5dili3dimo4pheo1phaidir4op1ero5peco4pabidi4vid3liid3olail3oai5guid3owu5peeid5riid3ulaid4aa5hoo2ieg2ie3gauper3i5ellahar22i1enien2da1h2aoo4sei2erio3opt4iernier2oi4erti3escagru5oon3iag3ri2i1eti4et_oo4leag5otook3iiev3au5pidiev3o4ag1nagli4if4fau5pola5giao5nuson5urifi4difi4n4i2fla5gheifoc5ont4rupre4af5tai3gadaev3a3igaraeth4i3geraet4aono3saes3ton5oionk4si3gonig1orig3oto1nioo5nigon3ifig1urae5siae3on4ura_aeco34uraead3umura2gik5anike4bi2l3aila4gon4id4a2duil4axil5dril4dui3lenon4guuras5on1eto3neoon1ee4oned4oneaad1owon5dyon3dril1ina3dos4onauon3aiil5iqona4do2mouil4moi5lonil3ouilth4il2trad3olil5uli5lumo4moi4adoi4ilymima4cim2agomni3im1alim5amom2naomme4om2itomil44adoeomi2co3mia3adjuome4gurc3ai5mogi3monim5ooome4dom4beo3mato2malo2macim5primpu4im1ulim5umin3abo4mabur4duadi4p4olytina4lol1ouin5amin3anin3apo3losol1or4olocur3eain3auin4aw4adilol3mia5difolle2ol2itolis4o5lifoli2eo1lia4inea4inedin5eeo3leuol1erine4so3lepo3leo4ineuinev5ol5chol4an4infu4ingaola4c4ingeur5ee4ingiad4haur1er4ingo4inguoith44adeeada3v4inico3isma5daiur3faac2too3inguril4ur1m4ac3ry4ino_in3oioil5i4inos4acou4oideo2i4d4acosurn5soi5chinse2o3ic_aco3din3si5insk4aco_ac3lio3ho4ack5aohab34acitacif4in5ulin5umin3unin3ura4cicuro4do5gyrur5oturph4iod5our3shio3gr4i1olio3maog4shio3moi5opeio3phi5opoiop4sa5cato4gro4ioreo2grio4got4iorlior4nio3sci3osei3osii4osoog2naur5taiot4aio5tho4gioio5tri4otyur1teo5geyac3alurth2ip3alipap4ogen1o3gasip1ato3gamurti4ur4vaofun4iphi4i4phuip3idi5pilip3ino4fulipir4ip5isab1uloflu42abs_ip3lou3sadi4pogus3agi4pomipon3i4powip2plab3omip4reoet4rip1uli5putus3alabli4i3quaab3laus4apoet3iira4co4et_ir4agus3atoes3t4abio2abiniray4ird3iire3air3ecir5eeirel4a3bieires4oelo4ab1icoe5icir4ima3bet5irizush5aoe5cuir5olir3omusil52abe4ir5taoe4biabay4us4pais5ado5dytis1alis3amis1anis3aris5av_za5ri2s3cod3ul_xy3lod5ruo3drouss4eod3liis2er5odizod5it4iseuod4ilodes4o5degode4co5cyt2isiais5icis3ie4isim_vo1c4isisis4keus1troc5uo2ismais1onocum4iso5pu5teooc1to5ispr2is1soc2te_vi2socre3u3tieiss4o4istao2cleu3tioo5chuoch4e4istho4cea4istloc5ago3cadis1tro4cab4istyi5sulis3urut3leutli4it5abita4c4itaiit3am_vec5it4asit3at_ur4oit3eeo3busob3ul_ura4_up3lo3braith5io5botith3rithy52itiao5bolob3ocit1ieit3ig4itim_un5uob1lio3blaob3iti5tiqut5smit3ivit4liit5lo4ito_it5ol2itonit1ou_un5sobe4lu4tul_un3goat5aoap5ioan4t4itueit1ulit1urit3us2i1u2_un3eiur5euven3oal4iiv1ati4vedu5vinoad5io3acto5ace_ul4luy5er2v3abives4iv3eti4vieiv3ifnyth4va1cavacu1iv1itva4geivoc3vag5rv1al_1vale_tor1vali25valu4izahiz3i2_til4iz5oivam4i_tho4va5mo5vannnwom4jac3ujag5u_te4mja5lonwin44vasev4at_jeop34vatuvect4_ta4m4velev1ellve1nejill55jis_4venu5ve3ojoc5ojoc5ujol4e_sis35verbju1di4ves__ses1ju3ninvi4tjut3a_se1qk4abinvel3kach4k3a4gkais5vi1b4vi4ca5vicuvign3vil3i5vimekar4i1kas_kaur42v1invin2evint4kcom43vi1oviol3kdol5vi5omke5dak5ede_rit2_rin4ken4dkeno4kep5tker5ak4erenu1trker4jker5okes4iket5anu4to5vi3pkfur4_re3w_re5uvire4kilo3vir3uk2in_3kind3nunc5numik3ingkin4ik2inskir3mkir4rv3ism3kis_k1ishkit5cvit2avit1rk5kervi3tu_re5ok5leak3lerk3let_re1mv3ity_re1ivi5zovolv41know3vorc4voreko5miko5pe3vorok5ro4_po2pv5ra4vrot4ks2miv3ure_pi2ev5verwag3owais4w3al_w3alswar4fwass4nu1men3ult5labrwas4tla2can4ulowa1tela4chla2conu4isw4bonla3cula4del5admw5die_out1nug4anu3enlag3r5lah4nud5i_oth54lale_osi4_or2o_or4ilam1ol5amu_ore4lan2d_or3dn5turntub5n3tua3weedweir4n5topwel3ilapi4n3tomn1t2o_op2i_on4ent3izla4tenti3pn3tign1tient4ibwent45laur_ome2_ol4d_of5twest3_oed5l4bit_ob3lw5hidl2catwid4elcen4n1thelch4el3darl3dedl3dehwi5ern4teol5dew_no4cl3dien3teln4tecwim2pld5li_ni4cwin2ecen3int1atnt1aln3swale3cawl1ernsta4_na5kle5drleg1an3s2t3leggn5sonleg3ons3ivwl4iensi2tlel5olelu5n3sion3sien3sid5lemml3emnle2mon4sicns3ibwon2tn3sh2n5seule1nen2seslen3on5seclen5ule3onleo4swoun4wp5inn4scun2sco_mis1_mi4enre3mnre4ix4ach4les_x4adenpri4x3aggnpos4npla4npil4leur5x3amil3eva5levexan5dle4wil5exaxano4lf5id_lyo3lf3on_lub3l4gall4gemlgi4al4gidl4goixas5pxcav3now3llias4lib1rl1ic_5lich_lo2pnove2nou5v2nousli4cul3ida3nounn4oug3lieul4ifel4ifoxcor5_li4p3notenot1a_li3oxec3r1l4illil4ilim2bno3splim4pnos4on4os_lin4dl4inenor4tn4oronop5i5nood4noneno2mo1nomi3linqnol4i3liogli4ollio3mliot4li3ou5liphlipt5x5edlx5edn_le2pl4iskno3la_le4ml2it_n5ol_no4fa3lithnoe4c3litrlit4uxer4gn4odyno4dinob4ln5obilk5atxer3on5nyi_ki4ex3ia_nnov3x4iasl5lasl4lawl5lebl1lecl1legl3leil1lellle5ml1lenl3lepl3leul3lev_is4o_is4c_ir3rx5ige_in3tllic4nlet4_in3ol5lie4n1l2l2linnk5ilnk5ifn3keyl5liolli5v_in2ixim3ank5ar_in3dllo2ql4lovnjam2_im5b_il4i_ig1n_idi2llun4l5lyal3lycl3lygl3lyhl3lyil5lymx4ime_hov3_ho2ll4mer_hi3bl5mipni3vox4it__he4ilneo4x4its5loadniv4ax4ode_hab2ni4ten5iss2locynis4onis4l_gos3n4isk4loi_lo5milom4mn4is_lon4expel43nipuni1ou5nioln4inu5ninnnin4jn4imelop4en3im1l3opm1lo1qnil4ax4tednik5e3nignn3igml4os_lo1soloss4_ga4mnift4nif4flo5tu5louplp1atlp3erxtre4l5phe_fo3cl2phol3piel3pitxur4b1y2ar_eye3_ex3a3yardl5samls5an4nicllsi4mls4isyas4i_eur4l1s2tni3ba3niac_es3tl5tar_es3pl4teiyca5mlth3inhyd5y3choltin4lti3tycom4lt4ory2cosnhab3_er2al4tusyder4_epi1luch4_eos5n2gumlu4cu_ent2lu1enlu5er_en3slu4ityel5olu4mo5lumpn4gry_en5c5lune_emp4n5gic_em3by5ettlusk5luss4_el2in5geen4gae_ei5rlut5r_ei3dygi5a_ec3t_eco3l4vorygo4i_dys3_du4c_do4eyl3osly4calyc4lyl5ouy1me4news3_de4wly4pay3meny5metnet1ry5miaym5inymot4yn4cim4acanet3an1est1nessn1escmact44mad_4mada4madsma4ge5magn2nes_yn3erma5ho3ma4i4mai_maid3_der2ner2vner5oyni4c_de1mneon4m3algneo3ln3end4n1enne2moyoun4n4ely2neleyp5alneis4man3a5negune3goneg3a3nedi_dav5m4ansne2coyper3m3aphy4petne4cl5neckn3earyph4en3dyind2wemar3vn4dunndu4bn2doundor4n5docnd1lin3diem4at_n1dicnd4hin5deznde4snde4ln1dedn3deayph3in3damm4atsn3daly4p1iy4poxyp5riyp4siypt3am5becn4cuny3ragm4besyr3atm2bicnct2oyr3icm4bisy5rigncoc4n1c2lm3blimbru4mbu3lmbur4yr3is_can1ys5agys5atmea5gn4cifme4bame4biy3s2c4med_n4cicn3chun3chon3chan5ceyme4dom5edy_bre2n5cetn3cer4melen1c2anbit4nbet4mel4tnbe4n_bov4ys1icys3in3men_2menaysi4o3nautnaus3me1nenat4rnati45meogys4sonas3s4merenas5p2me2snas5iys4tomes5qyz5er1me2tnam4nmet1e3nameza4bina3lyn5algmet3o_aus5_au3b_at3t_at3rza4tena5ivmi3co5nailm4ictzen4an5agom4idina4ginag4ami5fimig5an2ae_mi2gr_as4qmi5kaz5engm3ilanadi4nach4zer5a3millmi5lomil4t3m2immim5iz3et4_ari4_ar4e_ar5d5zic4_ap4i5my3c_any5z3ing3zlemz3ler_an3smu4sem5uncm2is_m4iscmi4semuff4zo3anmsol43zoo2_and2zo3olzo3onzo5op4mity_am2i_al1k_air3_ag5nmlun42m1m2_ag4amp5trmp3tompov5mpo2tmmig3_af3tmmis3mmob3m5mocmmor3mp3is4m1n2mnif4m4ninmni5omnis4mno5l_af3f_ae5d_ad3o_ad3em3pirmp1inmo4gom5pigm5oirmok4imol3amp5idz3zarm4phlmo3lyz5zasm4phe_ach4mona4z3ziemon1gmo4no_ace45most_ab4imo3spmop4t3morpz5zot",
		6 : "reit4i_ab3olmo5rel3moriam5orizmor5onm3orab3morse_acet3_aer3i_al5immo3sta2m1ous_al3le4monedm4pancm4pantmpath3_am5ar_am3pemper3izo5oti_am3phmo4mis_ana3b_ana3s_an5damog5rimp3ily_an4el_an4enmmut3ammin3u_an4glmmet4e_ant3am3medizing5imman4d_ar5abm5itanm3ists_ar5apmsel5fm3ist_5missimis3hamuck4e4misemmul1t2_ar4cimu5niomun3ismus5comirab4mus5kemu3til_at5ar1m4intmin3olm4initmin5ie_bas4i_be3di5myst4_be3lo_be5sm5min4d_bi4er_bo3lo_ca3de_cam5inac4te_cam3oyr5olona4d4amil4adnad4opyr3i4t_car4imid5onn4agen_ca4timid4inmi4cus_cer4imi3cul3micromi4cinmet3ri4naledyp5syfn4aliameti4cmeth4i4metedmeta3tna5nas_cit4anan4ta_co5itnan4to_co3pa4n4ard_co3ru_co3simes5enmer4iam5erannas5tenat5alna5tatn4ateena3thenath4l5mentsn4ati_nat5icn4ato_na3tomna4tosy4peroy4periy5peremend5oyoung5naut3imen4agna5vel4m5emeyo4gisnbeau4_de3linbene4mel3on_de3nomel5een4cal_yn4golncel4i_de3ra_de3rimega5tncer4en4ces_yn5ast3medityn5ap4nch4ie4medieynand5ynago43mediaym4phame5and_de3vem5blern4cles_dia3s_di4atmb5ist_din4anc4tin_dio5cm5bil5m4beryncu4lo_east5_ed5emncus4tmbat4t_elu5sn3da4c3m4attn4dalema3topnd3ancmat5omma3tognde3ciyes5tey3est__em5innd3enc_em5pyn3derlm4atit_en5tay4drouma3term4atenndic5undid5aydro5snd5ilynd4inend3ise_epi3d_er4i4nd5itynd3ler_er4o2_eros43mas1ty4collnd5ourndrag5ndram4n5dronmassi4y4colima3sonyclam4mar5rima3roone3aloma5ronne2b3umar5ol5maran_erot3_er4rima5nilych5isne4du4manic4man3dr_eth3e3m4an__eval3ne5lianeli4g_far4imal4limal3le_fen4dm3alismal3efmal5ed5male24nered_fin3gxtra3vner4r5mal3apxtra5d2mago4ma4cisne3sia5machy_fu5ganes3trmac3adnet3icne4toglys5erxtern3neut5rnev5erlypt5olymph5n4eys_lyc5osl5vet4xter3ixpoun4nfran3lv5atelu5tocxpo5n2_ge3ron3gerin5gerolut5an3lur3olu3oringio4gn5glemn3glien5gliol3unta_go3nolu2m5uxo4matluc5ralu2c5o_hama5l3t4ivltim4alti4ciltern3lt5antl4tangltan3en4icabni4cen_hem5anict5a_hy3loni4diol3phinni4ersximet4lot5atnif5ti_ico3s_in3e2loros4lo5rof_is4li_iso5ml4ored_ka5ro_kin3e5nimetn4inesl3onizl3onisloni4e3lonia_lab4olo5neyl5onellon4allo5gan3lo3drl3odis_la4me_lan5ixen4opnitch4loc5ulni3thon4itosni5tra_lep5rni3trinit4urloc3al5lob3al2m3odnivoc4niz5enlm3ing_lig3anjur5illoc5ulloc3an5kerol3linel3linal5lin__loc3anland5lli5col4liclllib4e_loph3_mac5ulli4anlli5amxa5met_math5llact4nni3killa4balk3erslk3er_lkal5ono5billiv5id_ment4_mi3gr_mirk4liv3erl5ivat5litia5liternois5il3it5a5lisselint5inom3al3lingu5lingtling3i3nonicw5sterws5ingnora4tnor5dinor4ianor4isnor3ma_mi5to_mo3bil4inasl4ina_wotch4word5ili5ger_mon3a5lidifl4idarlict4o_mu3ninova4l5licionov3el_mu3sili4cienow5erli4ani_myth3_nari4le5trenpoin4npo5lale5tra3les4sle3scon4quefler3otleros4ler3om_nast4le5rigl4eric3w4isens3cotle5recwin4tr_nec3tle5nielen4dolend4e_nom3ol5endalem5onn5sickl5emizlem3isns5ifins3ing_nos3tn3s2is4leledle3gransolu4le4ginn4soren4soryn3spirl3egan_obed5nstil4le5chansur4e_ob3elntab4unt3agew5est__oe5sont5and_om5el_on4cewel4liweliz4nt3ast_opt5ant5athnt3ati_or3eo3leaguld3ish_pal5in4tee_n4teesld4ine_pa5tald3estn4ter_n3terin5tern_pecu3war4tel5deral4cerenther5_ped3elav5atlat5usn4tic_ward5r_pend4n4tics_pep3tn3tid4_pi3la_plic4_plos4_po3lan5tillnt3ing_pop5lvo3tar_pur4rn4tis_nt3ismnt3istvo5raclat5al4laredlar5delar5anntoni4lan4tr_re3cantra3dnt3ralviv5orn3tratviv5alnt3rilv5itien5trymlan3etlan4er3landsvi5telland3i3land_lan3atlam4ievi3tal2v5istla4ic_la4gisla3gerlac5on5visiola5cerla5ceolabel4vi5ridlab5ar_re3ta5numerkin5et_rib5anu3tatn5utivkey4wok5erelkal4iska5limk2a5bunven4enven5o_ros3ajuscu4_sac5rjel5laja5panja2c5oi5vorevin5ta_sal4inym5itv5iniz5vinit3vinciiv3erii4ver_iv5elsoad5ervin4aciv5el_oak5ero3alesiv5ancoal5ino5alitit5uar_sanc5oar5eroar4se_sap5ait4titoat5eeoat5eri4tric_sa3vo4i5titob3ing2obi3o_sci3e4itio_it4insit4in_it5icuiti4coi5tholitha5lobrom4it3erait3entit3enci3tectit4ana3istry_sea3si4s1to5vider_sect4oc5ato4o3ce25vict2ocen5ovice3r_se3groch5ino3chon_sen3tvi4atroci3aboci4al5verseis4taliss4ivis5sanis4saliss5adi3s2phocu4luver4neislun4ocuss4ver3m4ocut5ris3incis5horocyt5ood3al_ish3op4ishioode4gao5dendo3dentish5eeod3icao4d1ieod3igais3harod1is2v5eriei2s3etis5ere4is3enis3ellod5olood5ousise5cr4i1secisci5cver3eiver5eaven4tris5chiis3agevent5oir5teeir5ochve5niair4is_ir2i4do3elecoelli4ir5essoe3o4pire5liven4doi5rasoven4alvel3liir4ae_ir4abiv4ellaip3plii4poliip3linip4itiip1i4tip4ine_su5daiphen3i1ph2ei3pendog5ar5v3eleripar3oi4oursi4our_iot5icio5staogoni45ioriz4ioritiora4mvel3atiod3i4ioact4_sul3tintu5m_tar5oin3til_tect45vateein4tee_tel5avast3av5a4sovar4isin3osiin5osei3nos_oi5ki5oil3eri5noleoin3de4vantlvanta4oin4tr_ter4pin3ionin4iciin5ia_oit4aling3um4ingliok4ine4ingleing5hain5galo4lacko5laliinfol4olan5dol5ast_thol45val4vole2c4ol5eciol5efiine5teole4onin3esi4in5eoo3lestin5egain5drool3icao3lice_ti5niol5ickol3icsol5id_va5lieo3lier_tri3dinde3tvager4oli5goo5linaol3ingoli5osol5ip4indes5inde5pin5darollim34vagedol4lyi3vag3ava5ceo4inataol3oido4lona_tro4vi3nas_in4ars_turb44ol1ubo3lumi_turi4ol3us_oly3phin3airin5aglin4ado4inaceimpot5im5pieo4maneomast4_tu5te_tu3toi3mos_im5mesomeg5aome3liom3enaomen4to3meriim5inoim4inei3m2ieomic5rom4ie_imat5uom4inyomiss4uv5eri_un5cei5m2asim3ageil5ureomoli3o2mo4nom5onyo4mos__un5chilit5uom5pil_un3d2il4iteil5ippo5nas__uni3c_uni3o4iliou_un3k4oncat3on4cho_un3t4u4t1raon3deru4to5sili4feili4eri5lienonec4ri3lici_ve5loon5ellil3iaron3essil3ia_ong3atilesi45u5tiz4o1niaon5iar2oni4conic5aut3istut5ismon3iesigu5iti4g5roi5gretigno5m4onneson5odiign5izono4miu5tiniut3ingo5nota_ver3nig3andu4tereon4ter_vis3ionton5if5teeon4treif5icsut5eniutch4eif3ic_u3taneoof3eriev3erook3eri5eutiiet3ieool5iei3est_i1es2ties3eloop4ieieri4ni3eresus5uri4idomioot3erooz5eridol3ausur4eo5paliopa5raopath5id4istopens4id1is43operaus4treidios4_vi5sooph4ieo5philop5holi3dicuus1to4iderm5op3iesop5ingo3p2itid3eraust3ilid3encopol3ii5cun4op5onyop5oriopoun4o2p5ovicu4luop5plioprac4op3ranict5icopro4lop5ropic4terust5igust4icicon3ous5tanic5olaor5adoich5olus3tacic5ado4oralsib3utaoran3eab5areorb3ini4boseorch3iibios4ib3eraor5eadore5arore5caab5beri5atomia5theoreo5lor3escore3shor3essusk5eru4s1inor5ett4iaritianch5i2a3loial5lii3alitab3erdor3ia_4orianori4cius5ianorien4ab3erria5demori5gaori4no4orio_or5ion4oriosia5crii2ac2rus4canor3n4a5ornisor3nitor3oneabi5onor5oseor5osohys3teorrel3orres3hyol5ior4seyor4stihyl5enort3anort3atort3erab3itaor3thior4thror4titort3izor4toror5traort3reh4warthu3siahu4minhu5merhu4matht4ineht4fooht3ensht3eniab4ituht3en_ab3otah3rym3osec3uhrom4ios5encosens43abouthre5maabu4loab3useho4tonosi4alosi4anos5ideo3sierhort5hho5roghorn5ihor5etab3usio3sophos3opoho2p5ro3specho5niohong3ioss5aros4sithon3eyur3theos4taros5teeos5tenac5ablur5tesos3tilac5ardost3orho5neuhon5emhom5inot3a4gurs3orho4magach5alho5lysurs5ero5ta5vurs5alhol3aroter4muroti4ho3donachro4ur5o4mach5urac5onro5thorurn3ero5tillurn3alh5micao3tivao5tiviur5lieo5toneo4tornhirr5ihio5looturi4oty3lehi5noph5inizhi5nieh2in2ehimos4hi5merhi5ma4h3ifi4url5erhi4cinur5ionur4iliur4ie_ac2t5roult5ih4et3ahes3trh5erwaound5aac5uatur3ettoun3troup5liour3erou5sanh4eron5ousiaher5omur1e2tur3ersova3lead5eni4ovatiad3icao4ver_over3bover3sov4eteadi4opadis4iovis5oo2v5oshere3ohere3aherb3iherb3aher4ashende5ur5diehe5mopa3ditihemis4he3menowi5neh3el3ohel4lihe5liuhe3lioh5elinhe5lat5admithe5delhec3t4adram4heast5ad3ulahdeac5ae4cithavel4ura4cipac4tepa5douhas4tehar4tipa3gan4pagataed5isu5quet4pairmpa5lanpal3inag4ariharge4pan5ac4agerihant3ah5anizh1ani4agi4asham5an4aginopara5sup3ingpa3rocpa3rolpar5onhagi3oag3onihaged5agor4apa3terpati4naha5raaid5erail3erhadi4epaul5egust5apa5vilg4uredg4uraspaw5kigui5ta5guit43guardaim5erai5neagrum4bpec4tugru3en5ped3agrim3a4grameped3isgour4igo5noma3ing_5gnorig4ni2ope5leogn4in_pen4at5p4encu5orospen5drpen4ic3p4ennal5ablg2n3ingn5edlalact4until4g5natial5ais5gnathala3map3eronalc3atald5riun4nagg5nateglu5tiglu5tepes4s3ale5ma4g5lodun5ketpet3eng5lis4gli5ong4letrg4letoal3ibrali4cigin5gigi5ganun3istph5al_gi4alluni3sogh5eniph5esiggrav3ggi4a5al5icsg5gedlun4ine3germ4phi5thgeo3logen5ti4phobla5linigen5italin5ophos3pgen4dugel5ligel4ing4atosg4ato_gat5ivgast3ral5ipegasol5ga5rotp5icalu3n2ergar3eeg5antsgan4trp4iestpi5etip5ifieg5ant_un4dus4ganed4alis_gan5atpi3lotgam4blun4diepin5et3pingegali4a5p4insga5lenga4dosga4ciefu5tilpir5acfu3sil4furedfu4minundi4cpiss5aunde4tpis4trft4inefti4etf4ter_un3dedpla5noun4dalalk5ieun4as_al4lab4pled_frant4frag5aunabu44plism4plistal4lagu4n3a4umu4lofore3tfor4difor5ayfo5ramfon4deallig4fo4liefo1l4ifoeti42p5oidpois5iump5tepo4ly1poly3spoman5flum4iump5lipon4acpon4ceump3er3ponifpon5taf3licaf5iteepo5pleal3ogrpor3ea4poredpori4ffir2m1fin4nial3ous5fininpos1s2fi3nalu4moraumi4fyu2m5iffight5fier4cfid3enfi5delal5penp4pene4ficalumen4tal3tiep4pledp5plerp5pletal5uedal3uesffor3effoni4ff3linf2f3isal5ver2a1ly4fet4inaman5dul3siffet4ala3mas_fest5ipres3aulph3op3reseulph3i5pricipri4es4pri4mam5atuam4binfest3ap5riolpri4osul4litfess3o4privafer5ompro3boul4lispro4chfe5rocpron4aul4latam5elopro3r2pros4iu5litypro3thfer3ee4feredu5litipsal5tfemin5fea3tup5sin_fant3iul5ishpsul3i4fan3aul3ingfa5lonu3linefa2c3ufa3cetpt5arcez5ersp5tenapt5enn5pteryez5er_ex4on_ew5ishamen4dp2t3inpt4inep3tisep5tisievol5eevis5oam3eraev5ishev4ileam5erle4viabpudi4ce4veriam5icapu4laramic5rpu5lisu5lentu1len4a3miliev5eliev3astpun5gieva2p3eval5eev4abieu3tereu5teneudio5am5ilypu3tat5ulcheet3udeet3tere4trima5mis_et4riaul5ardet4ranetra5mamor5aetra5getor3iet3onaamort3am5ose3quera4quere4ques_et5olo5quinauit5er3quito4quitueti4naeti4gie3ticuuisti4ethyl3ra3bolamp3liuis3erampo5luin4taet5enia5nadian3agerag5ouuinc5u3raillra5ist4raliaet3eeret3atiet3ater4andian3aliran4dura5neeui3libra3niara3noiet5aryan3arca5nastan4conrant5orapol5rap5toet3arieta5merar3efand5auug3uraan5delet3al_es4ur5e2s3ulrass5aan5difug5lifra5tapra5tatrat5eurath4erat3ifan5ditra5tocan5eeran3ellra4tosra5tuirat5umrat3urrav5aian3ganrav3itestud4ra3ziees5tooe3stocangov4rb3alian4gures5taue5starest3anesta4brbel5orb3entes4siless5eeessar5rbic5uan5ifor5binee5s2pres5potan5ionrbu5t4es5pitrcant54anityr4celean3omaan4scoans3ilrcha3irch3alan4suran2t2ar3cheor4cherud3iedr4chinrch3isr3chites3onaan3talan5tamrciz4ies3olae3s4mie3skinrcolo4rcrit5an4thies4itses4it_e5sion3anthrrd4an_es5iesr5de4lr3dens4anticrd5essrd5ianan4tiee5sickes5ic_rd3ingesi4anrd1is2rd5lere3sh4aes5encrd5ouse5seg5e3sectescut5esci5eant4ives5chees5canre5altre5ambre3anire5antre5ascreas3oeryth35erwauan4tusreb5ucre3calrec4ceer4vilan5tymre3chaan3um_an5umsap5aroerund5ert5izer4thire3disre4dolape5lireed5iu4cender4terer5tedre3finuccen5re5grare3grereg3rire3groreg3ulaph5emer4repaph5olaphyl3ero5stero5iser3oidern3it4reledre3liarel3icre5ligreli4qrel3liern3isrem5acap5icuub3linern3errem5ulu4bicuren5atr4endiap4ineren4eser4moirenic5ren4itub5blyre5num4eri2ta3planre5olare3olier4iscer3ioure4pereri4onrep5idre3pinre3plere4preeri4nauari4ner3iffre5reare3r2uapo3thre3scrre3selre3semre3serap5ronre5sitre3speapt5at4arabiara5bore5stu3retarre3tenar3agear5agire1t2ore5tonre3trare3trere5trier4ianer3ia_ergi3ver3ettrev3elrevi4ter3etser3et_ar3agoar3allaran4ger3esier5eseere5olr4geneeren4e5erende4remeer5elser5ellr5hel4rhe5oler5el_er3egrer3ealerdi4eerd5arerb5oser3batar5apaer5atuarb5etar4bidty4letri5cliri3colri5corri4craarb3lirid4aler3apyer3apier3aphera4doar4bularch5otwi5liri5gamaren5dri5l4aar5ettar3ev5ar5iff5tur5oequin4rima4gar4illrim3ate4putarimen4e3pur5ept3or5turitr4inetturf5iturb3aep5rimt4uranrins5itu5racep3rehtun5it5rioneepol3iepol3ari5p2ari5piear5iniep3licarm3erris4ise4peteris4paris4pear5mit4ristiri3tonr5it5rep5ertriv4alar3nalar3nisriv3enriv3il5ri5zoar5oidep5arceor4derk5atir5kellrk5enia5rotieol5ata5roucr3kiertud5ier5kin_r5kinsrks4meen4tusent5uptu5denr3l4icr3liner5linsen4tritu4binen5tiarma5cetuari4ent3arr4mancr4manor4marir4maryen4susars5alart5atarth4een4sumens5alrm4icar5m2iden3otyenit5ut4tupermin4erm3ingarth3rar5tizen5iere2n3euen4ettrmu3lie3nessen5esiener5var5un4as5conrn3ateas5cotrn5edlt3tlerr3nessrn5esttti3tuas3ectt5test3encept4tereen3as_rn4inee2n3arrn3isten4annash5ayem4preash5ilem5pesas5ilyempa5rask5erem3orras5ochrob3letstay4e3moniem3oloemod4uemo3birody4n4emnitem4maee4mitaem3ismem5ingem3inar4oledas4silassit5as4tatro5melro3mitas4tiaas3tisemet4eron4ac4ronalas4titron5chron4dorong5ir5onmeem5ero4asto2as3traas4trit5roto4atabiem3anaro3peltro3spem3agor5opteel5tieelp5inel5opsrosi4aro5solel5op_5troopros4tiatar3aro3tatata3t4ro4terelo4dieloc3uelo5caat3eautri3me4roussell5izel4labrow3erelit4ttri3lie4li4seli3onr3pentrp5er_el3ingat3echr3pholrp3ingat5eerrpol3ar2p5ouele3vi3tricuelev3at5ricla5tel_e5lesstres4sele5phel3enor4reo4el5eni4e4ledelea5grricu4tre5prate5lerri4oseld3ertre4moat3entat3eraelast3el5ancel5age4traddeiv3ereit5ertra4co4atesse4ins_to3warehyd5re5g4oneg5nabefut5arsell5rs3er_rs3ersa3thene4fiteath3odr4shier5si2ato3temto5stra5thonrs3ingeem5eree2l1ieed3ere4d5urrstor4to3s4ped3ulo4a3tiator5oitor5ered3imeed5igrrt3ageto5radr4tareed5icsto4posr4tedlr3tel4r5tendrt3enito5piaa2t3in4atinaat5ingede3teton5earth3rir1t4icr4ticlr5tietr5tilar5tilltom5osrt5ilyedes3tr3tinart3ingr3titirti5tue4delee5dansrt5lete5culito4mogec4titrt5ridecti4cec4teratit3urtwis4e4cremtoma4nec3ratec5oroec3oratom3acat4iviec3lipruis5iecip5i4toledec5ath5at5odrun4clruncu42t3oidrun2d4e4caporu5netecal5ea4topsec3adea4toryebus5iebot3oe4belstode5cat3ronat5rouat4tagru3tale4bel_eav5our4vanceavi4ervel4ie3atrirven4erv5er_t4nerer3vestat3uraeatit4e3atifeat5ieeat3ertmo4t5east5iat3urge1as1s3ryngoau5ceraud5ereas5erryth4iaudic4ear4tee5ar2rear4liear3ereap5eream3ersac4teeam4blea3logeal3eread3liead3ersain4teac4tedy4ad_sa5lacdwell3sa3lies4al4t5tletrdvert3sa5minault5id5un4cdum4be5tledrs4an4etlant4san5ifdu5ettau5reodu5elldu5eliau5rordrunk3tiv3isaus5erdri4g3aut3ars5ativti3tradrast4d5railsau5ciaut3erdossi4sa3voudo5simdon4atdom5itt3itisdomin5doman4tit5ildo4lonscar4cdol5ittith4edol3endo4c3u4s4ces5dlestt4istrdi4val1di1v2ditor3av3ageava5latish5idithe4av5alr3tisand4iterd4itas3disiadisen34d5irodi4oladi5nossec5andin5gisecon4dimet4di5mersed4itdi3gamdig3al3di3evdi4ersd5icurse3lecselen55dicul2s4emedic4tesemi5dav5antdic5oldic5amt3iristi5quaav3end5sentmti3pliav3ernti5omosep4side4voisep3tiser4antiol3aser4to4servode3vitde3visdev3ils5estade3tesdes3tid3est_sev3enaviol4aw5er_de3sidde3sectin3uetin4tedes4casfor5esfran5der5os3dero45dernesh4abiaw5ersder4miaw5nieay5sta3dererde5reg4deredde3raiderac4si4allsiast5tin3ets3icatdepen42s5icldeont5si5cul4tinedba5birdens5aside5lsid3enbalm5ideni4eba5lonsi4ersde1n2ade4mosde3morba5nan5tilindemo4nti4letsin5etbardi44demiedel5lisi5nolsi3nusba5romdeli4esi5o5sde3lat5de3isde4fy_bar3onde4cilsist3asist3otigi5odeb5itsit5omdeac3td3dlerd4derebas4tedaugh3dativ4dast5a3d4as2d1an4ts3kierba4th4sk5ily3baticba5tiod4a4gid5ache3ti2encys5toc3utivbat5on4cur4oti3diecur4er1c2ultb4batab4bonecul5abcu5itycub3atctro5tbcord4ti3colct5olo3smithbdeac5tic5asct5ivec4tityc4tituc3t2isbed5elc3tinict5ing4s3oid4te3loct4in_so5lansol4erso3lic3solvebe5dra5ti5bube3lit3some_bend5ac4ticsbe5nigson5atbicen5son5orc4tentbi4ers5soriosor4its5orizc2t5eec3tato5bilesct5antc5ta5gctac5u5c4ruscrost4spast45thoug3b2ill3sperms5pero4thoptcre4to5creti3spher4t5hoocre4p3sp5id_s5pierspil4lcre3atsp3ingspi5nith3oli4creancra4tecras3tbimet55crani5bin4d3spons3spoonspru5dbind3ecous5t3co3trth4is_srep5ucost3aco5rolco3rels5sam24coreds5sengs3sent5th4ioss3er_s5seriss3ers3thinkt5hillbin5etcon4iecon4eyth3eryss4in_s4siness4is_s3s2itss4ivicon4chth3ernco3mo4co5masssol3ut5herds4soreth5erc5colouco3logco3inc4c3oidco3difco3dicsta3bic4lotrs4talebin5i4s3tas_theo3lc3lingbi3re4ste5arste5atbi5rusbisul54s1teds4tedls4tedn4stereth5eas3bituas3terost5est5blastcine5a4cinabs3ti3a3sticks3ticuthal3ms4tilyst3ing5s4tir5cimenth5al_st3lercigar5ci3estch5ousstone3bla5tu5blespblim3as4tose4chotis4tray4chosostrep33strucstru5dbment4tew3arch5oid5chlorstur4echizz4ch3innch4in_ch3ily3chicoche5va3chetech4erltetr5och4eriche3olcha3pa4boledbon4iesu5ingces5trcest5oce3remcer4bites5tusu3pinsupra3sur4ascept3a5testesur3pltest3aboni4ft3ess_bon4spcent4ab3oratbor5eebor5etbor5icter5nobor5iocen5cice4metce5lomter3itt4erinsy4chrcel3aice3darcci3d4ter5ifsy5photer5idcav3ilter3iabot3an3tablica3t2rta3bolta4bout4a3cete3reota3chyta4cidc4atom3casu35t2adjta5dor5terel3cas3scashi4tage5ota5gogca3roucar5oocar5oncar3olcar3nicar3ifter5ecca3reeter3ebta5lept4aliat4alin2tere45tallut2alo43ter3bt4eragtera4c3brachtan5atbran4db4reas5taneltan5iet5aniz4b2rescap3tica5piltent4atark5ican4trte5nog5brief5tennaca3noec2an4eta3stabring5t4ateu3tatist4ato_tat4ouca5nartat3uttau3tobri4osca5lefcal5ar4tenarcab5inb5ut5obut4ivten4ag3butiob5utinbu5tarte5cha5technbus5sibusi4ete5d2abur4rite5monb4ulosb5rist5tegicb5tletbro4mab4stacbso3lubsol3e4teledtel5izbscon4ct4ina",
		7 : "mor4atobstupe5buf5ferb5u5nattch5ettm3orat4call5inmor5talcan5tarcan5tedcan4tictar5ia_brev5ettant5anca3ra5ctand5er_ad4din5ta3mettam5arit4eratocar5ameboun5tital4l3atal5entmonolo4cas5tigta5chom3teres4ta5blemcaulk4iccent5rcces4sacel5ib5mpel5licel5lincen5ded5ternit4sweredswell5icend5encend5ersvest5isvers5acen5tedt5esses_ama5tem5perercen5testest5ertest5intest5orcep5ticmpet5itchan5gi5cherin4choredchor5olmphal5os5toratblem5atston4iecil5lin4mologu4mologss4tern_ster4iaci5nesscla5rifclemat45static4molog_5therapmogast4ssolu4b4theredcon4aticond5erconta5dcor5dedcord5ermpol5itcost5ercraft5ispon5gicra5niuspital5spic5ulspers5a4thorescret5orspens5ac5tariabi4fid_4sor3iecter4iab5ertinberga5mc5ticiabend5erso5metesoma5toctifi4esolv5erc5tin5o_an4on_ct4ivittici5ar3ti3cint4icityc5torisc5toriz4ticulecull5ercull5inbattle5cur5ialmmel5lislang5idal5lersk5iness5kiest4tific_daun5tede5cantdefor5edel5ler_an3ti34dem4issim4plyb4aniti_ant4icde4mons_an4t5osid5eri5timet4dens5er5ti5nadden5titdeposi4zin4c3i_aph5orshil5lider5minsfact5otin5tedtint5erde5scalmis4tindes5ponse5renedevol5u4tionemdiat5omti5plexseo5logsent5eemi5racu_ar4isedic5tat4scuras4scura__ar4isi5scopic3s4cope5t4istedi5vineti5t4ando5linesca5lendom5inodot4tins5atorydress5oaus4tedtiv5allsassem4dropho4duci5ansant5risan5garaun4dresan4ded_ar5sendust5erault5erdvoc5ataul5tedearth5iea4soni4ryngoleassem4eat5enieat4iturv5ers_rus4t5urus5ticrust5eeatric5urust5at_as5sibrup5licminth5oecad5enruncul5ru4moreecent5oa5tivizecon4sc_ateli4_au3g4uec5rean_aur4e5ect5atiec4t5usrtil5le4at4is__av5erar4theneedeter5edi4alsr5terered5icala4t1i4lediges4at5icizediv5idtori4asrswear4ati5citat5icisedu5cerrstrat4eer4ineefact5oming5li_ba5sicef5ereemin4ersath5eteath5eromin4er__be5r4ae5ignitr5salizmind5err5salisejudic44traistmil5iestrarch4tra5ven_blaz5o4m5iliee4lates_bos5omat5enatelch5errrin5getrend5irri4fy_rran5gie4lesteel3et3o_boun4d_bra5chtri5fli_burn5ieli4ers_ca4ginrou5sel_can5tamigh5tiros5tita5talisro5stattro4pharop4ineemarc5aem5atizemat5ole4m3eraron4tonro5nateem4icisnaffil4romant4emig5rarol5iteass5iblassa5giemon5ola4sonedem5orise4moticempara54empli_en3am3o_cen5sot5tereren4cileen4d5alen4dedlttitud45n4a3grend5ritrn5atine5nellee5nereor4mite_r4ming_en3ig3rmet5icirma5tocr4m3atinannot4en4tersen4tifyarp5ersent5rinr5kiesteol5ar_eologi4aro4mas_clem5eriv5eliri5vallris5ternan5teda5rishi3mesti4epolit5tup5lettup5lic_cop5roepres5erink5erme5si4aring5ie_co5terrim5an4equi5noment5or4tut4ivna5turiera4cierig5ant5rifugaar4donear5dinarif5tiear5chetrift5er4erati_4eratimrick4enrich5omrica5tuaran5teer5esteer5estieres5trre5termar4aged_dea5coaract4irest5erre5stalapu5lareri4ciduant5isuant5itres5ist5er5ickapo5strer4imet_de5lecuar4t5iua5terneri5staren4ter5ernaclmend5errem5atoreman4d_del5egerre5laer5sinere5galiert5er_ert5ersrec4t3rr4e1c2rreci5simelt5er_deli5ran4tone_de5nitan4tinges5idenesi5diur4d1an4rcriti4es3ol3urci5nogant5abludi4cinrch4ieru5dinisrch5ateu5ditiorch5ardes3per3mel5lerrcen5eres5piraanis5teesplen5uen4teres4s3anest5ifi_de5resues5trin4cept_rav5elianel5li4r4atom5ra5tolan4donirat4in_r4as5teand5istrass5in5meg2a1et3al5oand5eerrar5ia_an3d4atrant5inuicent55rantelran5teduild5erran4gennch5oloetell5irad4inencid5enra5culorac5ulaet3er3aet5eria3ra3binet5itivui5val5amphi5gam5peri_de5sirqua5tio4e4trala4mium_et5ressetrib5aaminos4am5inizamini4fp5u5tis5ulchrepush4ieev5eratev5eren4ulenciever4erpu5lar_puff5erevictu4evis5in_de5sisfall5inncip5ie_di4al_fend5erpros5trpropyl5proph5eul4l5ibp3roc3apris5inpring5imbival5nco5pat5pressiyllab5iulp5ingpre5matylin5dem4b3ingnct4ivife5veriffec4te_du4al_pprob5am5bererum4bar__echin5fi5anceal5tatipparat5pout5ern4curviumi5liaumin4aru4minedu4m3ingpoult5epor5tieal4orim4poratopon4i4eflo5rical4lish_ed4it_foment4_ed4itialli5anplum4befor4m3a_el3ev3fratch4pla5t4oma5turem4atizafrost5ipis5tilmat4itifuel5ligal5lerpill5ingang5ergariz4aunho5lial5ipotgass5inph5oriz4phonedgest5atg5gererphant5ipha5gedgiv5en_5glass_unk5eripet5allal5endepes5tilpert5isper5tinper4os_al5ance5p4er3nperem5indeleg4gna5turndepre4aint5eruodent4pend5er4gogram_en4dedpearl5indes5crgth5enimas4tinpat4richad4inepas4tinnd5is4ihak4inehal5anthan4crohar5dieha5rismhar4tedaet4or_aerody5pag4atihaught5_er5em5hearch44urantiheav5enurb5ingoxic5olowhith4ur5den_ur5deniowel5lih5erettovid5ennd5ism_her5ialh5erineout5ishoun5ginound5elhet4tedact5oryu5ri5cuheumat5ur5ifieact5ileought5ihi3c4anuri4os_h4i4ersh4manicurl5ingact5atemast4ichnocen5_men5taaci4erso5thermmar4shimantel5ot5estaurpen5tach5isma5chinihol4is_ot4atioot4anico5talito5stome5acanthost5icaosten5tost5ageh4op4te3house3hras5eoy4chosen5ectom4abolicht5eneror5tes_man4icay5chedei5a4g5oori5cidialect4or5este_escal5iatur4aorator5_wine5s_vo5lutich5ingo5quial_etern5us5ticiic4tedloplast4ophy5laid4ines4operag2i4d1itoost5eriff5leronvo5lui4ficaconti5fiman5dar_vic5to_fal4lemament4mal4is__ver4ieila5telonical4i5later_feoff5ili4arl_va5ledil4ificond5ent_ur5eth5ond5arut4toneil5ine_on5ativonast5i_under5ompt5eromot5ivi4matedi4matin_fi5liaimpar5a_fil5tro5lunte4inalit_tular5olon5el5neringinator5_tro4ph_fis4c5inc4tua_trin4aol4lopeoli4f3eol5ies_mal5ari_tran4c_tit4isnerv5inval4iseol5icizinfilt5olat5erin4itud_gam5etxter4m3ink4inein4sch5_tell5evas5el5insect5insec5uinsolv5int5essvat4inaoher4erint5res_tamar5xtens5o_tact4iinvol5ui4omani_gen4et_gen5iave5linei5pheriip5torivel5lerir4alinvel5opiir4alliirassi4nfortu5irl5ingirwo4meo4ducts4lut5arv5en5ue_stat4o_si5gnoverde5v4v4ere4o4duct_odu5cerodis5iaocus5siis5onerist5encxotrop4_ser4ie5vialitist5entochro4n_gnost4_sec5tovi5cariocess4iis4t3iclum4brio5calli4is4tom4itioneit5ress3vili4av5ilisev5ilizevil5linoast5eritu4als_han4de_hast5ii4vers__sa5linlsi4fiai5vilit5ivist_5ivistsnvoc5at_ho5rol_rol4lakinema4ni4cul4nultim5_re5strloth4ie5la5collos5sienight5ilor4ife_re5spolor5iatntup5li5lo5pen_re5sen_res5ci_re5linnt5ressn4trant_re5garloom5erxhort4a_ran5gilong5invol4ubi_ra5cem_put4ten5tition4tiparlo4cus__pos5si_lash4e_len5tint5ing_nit5res_le5vanxecut5o_plica4n4tify__plast45latini_phon4illow5er_li4onslligat4_peri5nntic4u4_pen5dewall5ern5ticizwan5gliwank5erwar5dedward5ern5ticisnth5ine_lo4giawar5thinmater4_pec3t4_pa4tiowav4ine_lous5i_para5t_par5af_lov5ernmor5ti_orner4nt5ativ_or5che_ma5lin_mar5ti_or4at4le5ation5tasiswel4izint4ariun4t3antntan5eon4t3ancleav5erl3eb5rannel5li_nucle5_no5ticlem5enclen5darwill5in_ni5tronsec4tewing5er4lentio5l4eriannerv5a_nas5tinres5tr5le5tu5lev5itano5blemnovel5el3ic3onwol5ver_mor5tilift5erlight5ilimet4e_mo5lec5lin3ealin4er_lin4erslin4gern5ocula_min5uenobser4_met4er_me5rin_me5ridmas4ted",
		8 : "_musi5cobserv5anwith5erilect5icaweight5ica5laman_mal5ad5l5di5nestast5i4cntend5enntern5alnter5nat_perse5c_pe5titi_phe5nomxe5cutio5latiliz_librar5nt5ilati_les5son_po5lite_ac5tiva5latilisnis5tersnis5ter_tamorph5_pro5batvo5litiolan5tine_ref5eremophil5ila5melli_re5statca3r4i3c5lamandrcen5ter_5visecti5numentanvers5aniver5saliv5eling_salt5ercen5ters_ha5bilio4c5ativlunch5eois5terer_sev5era_glor5io_stra5tocham5perstor5ianstil5ler_ge5neti_sulph5a_tac5ticnform5eroin4t5erneuma5to_te5ra5tma5chinecine5mat_tri5bal_fran5ch_tri5sti_fi5n4it_troph5o_fin5essimparad5stant5iv_vent5il4o5nomicssor5ialight5ersight5er__evol5utm5ament_ont5ane_icotyle5orest5atiab5oliziab5olismod5ifiehrill5inothalam5oth5erinnduct5ivrth5ing_otherm5a5ot5inizov5elinghav5ersipass5ivessent5ermater5n4ain5dersuo5tatiopens5atipercent5slav5eriplant5er5sing5erfortu5naplumb5erpo5lemicpound5erffranch5ppress5oa5lumnia_domest5pref5ereprel5atea5marinepre5scina5m4aticpring5ertil4l5agmmand5er5sid5u4a_de5spoievol5utee5tometeetend5erting5ingmed5icatran5dishm5ed5ieset5allis_de5servsh5inessmlo5cutiuest5ratncent5rincarn5atdes5ignareact5ivr5ebratereced5ennbarric5sen5sorier5nalisuar5tersre4t4er3_custom5naugh5tirill5er_sen5sati5scripti_cotyle5e4p5rob5a5ri5netaun5chierin4t5errip5lica_art5icl5at5ressepend5entu4al5lir5ma5tolttitu5di_cent5ria5torianena5ture5na5geri_cas5ualromolec5elom5ateatitud5i_ca5pituround5ernac5tiva_at5omizrpass5intomat5oltrifu5gae4l3ica4rpret5erel5ativetrav5esttra5versat5ernisat5ernizefor5estath5erinef5initeto5talizto5talis_barri5c_authen5mass5ing",
		9 : "_bap5tismna5cious_econstit5na5ciousl_at5omisena5culari_cen5tena_clima5toepe5titionar5tisti_cri5ticirill5ingserpent5inrcen5tenaest5igati_de5scrib_de5signe_determ5ifals5ifiefan5tasizplas5ticiundeter5msmu5tatiopa5triciaosclero5s_fec5unda_ulti5matindeterm5ipart5ite_string5i5lutionizltramont5_re5storeter5iorit_invest5imonolog5introl5ler_lam5enta_po5sitio_para5dis_ora5tori_me5lodio"
	}
};
var h = new window['Hypher'](module.exports);

if (typeof module.exports.id === 'string') {
    module.exports.id = [module.exports.id];
}

for (var i = 0; i < module.exports.id.length; i += 1) {
  window['Hypher']['languages'][module.exports.id[i]] = h;
}
}());