From d8f8c640c05993b92706c4d7b417fa5a02f5f43c Mon Sep 17 00:00:00 2001 From: David Figatner Date: Thu, 15 Oct 2020 11:57:03 +0800 Subject: [PATCH] published 2.2.0 --- dist/scrollbox.es.js | 8 ++++ dist/scrollbox.es.js.map | 2 +- dist/scrollbox.js | 2 +- dist/scrollbox.js.map | 2 +- docs/index.js | 39 +------------------ docs/index.js.map | 2 +- docs/jsdoc/EventEmitter-.html | 2 +- docs/jsdoc/Scrollbox.html | 12 +++--- docs/jsdoc/index.html | 2 +- .../node_modules_eventemitter3_index.js.html | 2 +- ...es_eventemitter3_umd_eventemitter3.js.html | 2 +- docs/jsdoc/src_scrollbox.js.html | 10 ++++- 12 files changed, 32 insertions(+), 53 deletions(-) diff --git a/dist/scrollbox.es.js b/dist/scrollbox.es.js index 015e975..5ca0633 100644 --- a/dist/scrollbox.es.js +++ b/dist/scrollbox.es.js @@ -598,6 +598,10 @@ class Scrollbox extends Container { return this.content.top } + set scrollTop(top) { + this.content.top = top; + this._drawScrollbars(); + } /** * left coordinate of scrollbar @@ -606,6 +610,10 @@ class Scrollbox extends Container { return this.content.left } + set scrollLeft(left) { + this.content.left = left; + this._drawScrollbars(); + } /** * width of content area diff --git a/dist/scrollbox.es.js.map b/dist/scrollbox.es.js.map index e2d89f5..eeab825 100644 --- a/dist/scrollbox.es.js.map +++ b/dist/scrollbox.es.js.map @@ -1 +1 @@ -{"version":3,"file":"scrollbox.es.js","sources":["../node_modules/penner/penner.js","../src/scrollbox.js"],"sourcesContent":["\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n if (typeof exports === 'object') {\n return module.exports = factory;\n } else if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else {\n return this.penner = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if (t === 0) {\n b;\n }\n if (t === d) {\n b + c;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d / 2) === 2) {\n b + c;\n }\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(this);\n","import * as PIXI from 'pixi.js'\nimport { Viewport } from 'pixi-viewport'\nimport Penner from 'penner'\n\nconst scrollboxOptions = {\n 'boxWidth': 100,\n 'boxHeight': 100,\n 'scrollbarSize': 10,\n 'scrollbarBackground': 14540253,\n 'scrollbarBackgroundAlpha': 1,\n 'scrollbarForeground': 8947848,\n 'scrollbarForegroundAlpha': 1,\n 'dragScroll': true,\n 'stopPropagation': true,\n 'scrollbarOffsetHorizontal': 0,\n 'scrollbarOffsetVertical': 0,\n 'underflow': 'top-left',\n 'fadeScrollbar': false,\n 'fadeScrollbarTime': 1000,\n 'fadeScrollboxWait': 3000,\n 'fadeScrollboxEase': 'easeInOutSine',\n 'passiveWheel': false,\n 'clampWheel': true\n}\n\n/**\n * pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars\n */\nexport class Scrollbox extends PIXI.Container\n{\n /**\n * create a scrollbox\n * @param {object} options\n * @param {boolean} [options.dragScroll=true] user may drag the content area to scroll content\n * @param {string} [options.overflowX=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflowY=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflow] (none, scroll, hidden, auto) sets overflowX and overflowY to this value\n * @param {number} [options.boxWidth=100] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight=100] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollbarSize=10] size of scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetHorizontal=0] offset of horizontal scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetVertical=0] offset of vertical scrollbar (in pixels)\n * @param {boolean} [options.stopPropagation=true] call stopPropagation on any events that impact scrollbox\n * @param {number} [options.scrollbarBackground=0xdddddd] background color of scrollbar\n * @param {number} [options.scrollbarBackgroundAlpha=1] alpha of background of scrollbar\n * @param {number} [options.scrollbarForeground=0x888888] foreground color of scrollbar\n * @param {number} [options.scrollbarForegroundAlpha=1] alpha of foreground of scrollbar\n * @param {string} [options.underflow=top-left] what to do when content underflows the scrollbox size: none: do nothing; (left/right/center AND top/bottom/center); OR center (e.g., 'top-left', 'center', 'none', 'bottomright')\n * @param {boolean} [options.noTicker] do not use PIXI.Ticker (for fade to work properly you will need to manually call updateLoop(elapsed) on each frame)\n * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.Ticker for updates\n * @param {boolean} [options.fade] fade the scrollbar when not in use\n * @param {number} [options.fadeScrollbarTime=1000] time to fade scrollbar if options.fade is set\n * @param {number} [options.fadeScrollboxWait=3000] time to wait before fading the scrollbar if options.fade is set\n * @param {(string|function)} [options.fadeScrollboxEase=easeInOutSine] easing function to use for fading\n * @param {boolean} [options.passiveWheel=false] whether wheel events are propogated beyond the scrollbox (NOTE: default is now false)\n * @param {boolean} [options.clampWheel=true] wheel events should be clamped (to avoid weird bounce with mouse wheel)\n */\n constructor(options={})\n {\n super()\n this.options = Object.assign({}, scrollboxOptions, options)\n if (options.overflow) {\n this.options.overflowX = this.options.overflowY = options.overflow\n }\n this.ease = typeof this.options.fadeScrollboxEase === 'function' ? this.options.fadeScrollboxEase : Penner[this.options.fadeScrollboxEase]\n\n /**\n * content in placed in here\n * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/)\n * @type {Viewport}\n */\n this.content = this.addChild(new Viewport({ passiveWheel: this.options.passiveWheel, stopPropagation: this.options.stopPropagation, screenWidth: this.options.boxWidth, screenHeight: this.options.boxHeight }))\n this.content\n .decelerate()\n .on('moved', () => this._drawScrollbars())\n\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\n if (options.ticker)\n {\n this.options.ticker = options.ticker\n }\n else\n {\n // to avoid Rollup transforming our import, save pixi namespace in a variable\n // from here: https://github.com/pixijs/pixi.js/issues/5757\n let ticker\n const pixiNS = PIXI\n if (parseInt(/^(\\d+)\\./.exec(PIXI.VERSION)[1]) < 5)\n {\n ticker = pixiNS.ticker.shared;\n }\n else\n {\n ticker = pixiNS.Ticker.shared;\n }\n this.options.ticker = options.ticker || ticker\n }\n\n /**\n * graphics element for drawing the scrollbars\n * @type {PIXI.Graphics}\n */\n this.scrollbar = this.addChild(new PIXI.Graphics())\n this.scrollbar.interactive = true\n this.scrollbar.on('pointerdown', this.scrollbarDown, this)\n this.interactive = true\n this.on('pointermove', this.scrollbarMove, this)\n this.on('pointerup', this.scrollbarUp, this)\n this.on('pointercancel', this.scrollbarUp, this)\n this.on('pointerupoutside', this.scrollbarUp, this)\n this._maskContent = this.addChild(new PIXI.Graphics())\n this.update()\n\n if (!this.options.noTicker)\n {\n this.tickerFunction = () => this.updateLoop(Math.min(this.options.ticker.elapsedMS, 16.6667))\n this.options.ticker.add(this.tickerFunction)\n }\n }\n\n /**\n * offset of horizontal scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetHorizontal()\n {\n return this.options.scrollbarOffsetHorizontal\n }\n set scrollbarOffsetHorizontal(value)\n {\n this.options.scrollbarOffsetHorizontal = value\n }\n\n /**\n * offset of vertical scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetVertical()\n {\n return this.options.scrollbarOffsetVertical\n }\n set scrollbarOffsetVertical(value)\n {\n this.options.scrollbarOffsetVertical = value\n }\n\n /**\n * disable the scrollbox (if set to true this will also remove the mask)\n * @type {boolean}\n */\n get disable()\n {\n return this._disabled\n }\n set disable(value)\n {\n if (this._disabled !== value)\n {\n this._disabled = value\n this.update()\n }\n }\n\n /**\n * call stopPropagation on any events that impact scrollbox\n * @type {boolean}\n */\n get stopPropagation()\n {\n return this.options.stopPropagation\n }\n set stopPropagation(value)\n {\n this.options.stopPropagation = value\n }\n\n /**\n * user may drag the content area to scroll content\n * @type {boolean}\n */\n get dragScroll()\n {\n return this.options.dragScroll\n }\n set dragScroll(value)\n {\n this.options.dragScroll = value\n if (value)\n {\n this.content.drag()\n }\n else\n {\n if (typeof this.content.removePlugin !== 'undefined')\n {\n this.content.removePlugin('drag')\n }\n else\n {\n this.content.plugins.remove('drag')\n }\n }\n this.update()\n }\n\n /**\n * width of scrollbox including the scrollbar (if visible)- this changes the size and not the scale of the box\n * @type {number}\n */\n get boxWidth()\n {\n return this.options.boxWidth\n }\n set boxWidth(value)\n {\n this.options.boxWidth = value\n this.content.screenWidth = value\n this.update()\n }\n\n /**\n * sets overflowX and overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflow()\n {\n return this.options.overflow\n }\n set overflow(value)\n {\n this.options.overflow = value\n this.options.overflowX = value\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * sets overflowX to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowX()\n {\n return this.options.overflowX\n }\n set overflowX(value)\n {\n this.options.overflowX = value\n this.update()\n }\n\n /**\n * sets overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowY()\n {\n return this.options.overflowY\n }\n set overflowY(value)\n {\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * height of scrollbox including the scrollbar (if visible) - this changes the size and not the scale of the box\n * @type {number}\n */\n get boxHeight()\n {\n return this.options.boxHeight\n }\n set boxHeight(value)\n {\n this.options.boxHeight = value\n this.content.screenHeight = value\n this.update()\n }\n\n /**\n * scrollbar size in pixels\n * @type {number}\n */\n get scrollbarSize()\n {\n return this.options.scrollbarSize\n }\n set scrollbarSize(value)\n {\n this.options.scrollbarSize = value\n }\n\n /**\n * width of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentWidth()\n {\n return this.options.boxWidth - (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n }\n\n /**\n * height of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentHeight()\n {\n return this.options.boxHeight - (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n }\n\n /**\n * is the vertical scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarVertical()\n {\n return this._isScrollbarVertical\n }\n\n /**\n * is the horizontal scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarHorizontal()\n {\n return this._isScrollbarHorizontal\n }\n\n /**\n * top coordinate of scrollbar\n */\n get scrollTop()\n {\n return this.content.top\n }\n\n /**\n * left coordinate of scrollbar\n */\n get scrollLeft()\n {\n return this.content.left\n }\n\n /**\n * width of content area\n * if not set then it uses content.width to calculate width\n */\n get scrollWidth()\n {\n return this._scrollWidth || this.content.width\n }\n set scrollWidth(value)\n {\n this._scrollWidth = value\n }\n\n /**\n * height of content area\n * if not set then it uses content.height to calculate height\n */\n get scrollHeight()\n {\n return this._scrollHeight || this.content.height\n }\n set scrollHeight(value)\n {\n this._scrollHeight = value\n }\n\n /**\n * draws scrollbars\n * @private\n */\n _drawScrollbars()\n {\n this._isScrollbarHorizontal = this.overflowX === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowX) !== -1 ? false : this.scrollWidth > this.options.boxWidth\n this._isScrollbarVertical = this.overflowY === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowY) !== -1 ? false : this.scrollHeight > this.options.boxHeight\n this.scrollbar.clear()\n let options = {}\n options.left = 0\n options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0)\n options.top = 0\n options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n this.scrollbarTop = (this.content.top / height) * this.boxHeight\n this.scrollbarTop = this.scrollbarTop < 0 ? 0 : this.scrollbarTop\n this.scrollbarHeight = (this.boxHeight / height) * this.boxHeight\n this.scrollbarHeight = this.scrollbarTop + this.scrollbarHeight > this.boxHeight ? this.boxHeight - this.scrollbarTop : this.scrollbarHeight\n this.scrollbarLeft = (this.content.left / width) * this.boxWidth\n this.scrollbarLeft = this.scrollbarLeft < 0 ? 0 : this.scrollbarLeft\n this.scrollbarWidth = (this.boxWidth / width) * this.boxWidth\n this.scrollbarWidth = this.scrollbarWidth + this.scrollbarLeft > this.boxWidth ? this.boxWidth - this.scrollbarLeft : this.scrollbarWidth\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, 0, this.scrollbarSize, this.boxHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(0, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.boxWidth, this.scrollbarSize)\n .endFill()\n }\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, this.scrollbarTop, this.scrollbarSize, this.scrollbarHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.scrollbarLeft, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.scrollbarWidth, this.scrollbarSize)\n .endFill()\n }\n // this.content.forceHitArea = new PIXI.Rectangle(0, 0 , this.boxWidth, this.boxHeight)\n this.activateFade()\n }\n\n /**\n * draws mask layer\n * @private\n */\n _drawMask()\n {\n this._maskContent\n .beginFill(0)\n .drawRect(0, 0, this.boxWidth, this.boxHeight)\n .endFill()\n this.content.mask = this._maskContent\n }\n\n /**\n * call when scrollbox content changes\n */\n update()\n {\n this.content.mask = null\n this._maskContent.clear()\n if (!this._disabled)\n {\n this._drawScrollbars()\n this._drawMask()\n if (this.options.dragScroll)\n {\n const direction = this.isScrollbarHorizontal && this.isScrollbarVertical ? 'all' : this.isScrollbarHorizontal ? 'x' : 'y'\n if (direction !== null)\n {\n this.content\n .drag({ clampWheel: this.options.clampWheel, direction })\n .clamp({ direction, underflow: this.options.underflow })\n }\n }\n }\n }\n\n /**\n * called on each frame to update fade scrollbars (if enabled)\n * @param {number} elapsed since last frame in milliseconds (usually capped at 16.6667)\n */\n updateLoop(elapsed)\n {\n if (this.fade)\n {\n if (this.fade.wait > 0)\n {\n this.fade.wait -= elapsed\n if (this.fade.wait <= 0)\n {\n elapsed += this.fade.wait\n }\n else\n {\n return\n }\n }\n this.fade.duration += elapsed\n if (this.fade.duration >= this.options.fadeScrollbarTime)\n {\n this.fade = null\n this.scrollbar.alpha = 0\n }\n else\n {\n this.scrollbar.alpha = this.ease(this.fade.duration, 1, -1, this.options.fadeScrollbarTime)\n }\n this.content.dirty = true\n }\n }\n\n /**\n * dirty value (used for optimizing draws) for underlying viewport (scrollbox.content)\n * @type {boolean}\n */\n get dirty()\n {\n return this.content.dirty\n }\n set dirty(value)\n {\n this.content.dirty = value\n }\n\n /**\n * show the scrollbar and restart the timer for fade if options.fade is set\n */\n activateFade()\n {\n if (!this.fade && this.options.fade)\n {\n this.scrollbar.alpha = 1\n this.fade = { wait: this.options.fadeScrollboxWait, duration: 0 }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarDown(e)\n {\n const local = this.toLocal(e.data.global)\n if (this.isScrollbarHorizontal)\n {\n if (local.y > this.boxHeight - this.scrollbarSize)\n {\n if (local.x >= this.scrollbarLeft && local.x <= this.scrollbarLeft + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'horizontal', last: local }\n }\n else\n {\n if (local.x > this.scrollbarLeft)\n {\n this.content.left += this.content.worldScreenWidth\n this.update()\n }\n else\n {\n this.content.left -= this.content.worldScreenWidth\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n if (this.isScrollbarVertical)\n {\n if (local.x > this.boxWidth - this.scrollbarSize)\n {\n if (local.y >= this.scrollbarTop && local.y <= this.scrollbarTop + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'vertical', last: local }\n }\n else\n {\n if (local.y > this.scrollbarTop)\n {\n this.content.top += this.content.worldScreenHeight\n this.update()\n }\n else\n {\n this.content.top -= this.content.worldScreenHeight\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n }\n\n /**\n * handle pointer move on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarMove(e)\n {\n if (this.pointerDown)\n {\n if (this.pointerDown.type === 'horizontal')\n {\n const local = this.toLocal(e.data.global)\n this.content.left += local.x - this.pointerDown.last.x\n this.pointerDown.last = local\n this.update()\n }\n else if (this.pointerDown.type === 'vertical')\n {\n const local = this.toLocal(e.data.global)\n this.content.top += local.y - this.pointerDown.last.y\n this.pointerDown.last = local\n this.update()\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @private\n */\n scrollbarUp()\n {\n this.pointerDown = null\n }\n\n /**\n * resize the mask for the container\n * @param {object} options\n * @param {number} [options.boxWidth] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollWidth] set the width of the inside of the scrollbox (leave null to use content.width)\n * @param {number} [options.scrollHeight] set the height of the inside of the scrollbox (leave null to use content.height)\n */\n resize(options)\n {\n this.options.boxWidth = typeof options.boxWidth !== 'undefined' ? options.boxWidth : this.options.boxWidth\n this.options.boxHeight = typeof options.boxHeight !== 'undefined' ? options.boxHeight : this.options.boxHeight\n if (options.scrollWidth)\n {\n this.scrollWidth = options.scrollWidth\n }\n if (options.scrollHeight)\n {\n this.scrollHeight = options.scrollHeight\n }\n this.content.resize(this.options.boxWidth, this.options.boxHeight, this.scrollWidth, this.scrollHeight)\n this.update()\n }\n\n /**\n * ensure that the bounding box is visible\n * @param {number} x - relative to content's coordinate system\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n ensureVisible(x, y, width, height)\n {\n this.content.ensureVisible(x, y, width, height)\n this._drawScrollbars()\n }\n}"],"names":["this","PIXI.Container","Penner","PIXI.VERSION","PIXI.Graphics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YACI,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,YAAW;SACzC;QACD,IAAI,OAAO,CAAC,YAAY;QACxB;YACI,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,aAAY;SAC3C;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAC;QACvG,IAAI,CAAC,MAAM,GAAE;KAChB;;;;;;;;;IASD,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM;IACjC;QACI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAC;QAC/C,IAAI,CAAC,eAAe,GAAE;KACzB;;;;;"} \ No newline at end of file +{"version":3,"file":"scrollbox.es.js","sources":["../node_modules/penner/penner.js","../src/scrollbox.js"],"sourcesContent":["\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n if (typeof exports === 'object') {\n return module.exports = factory;\n } else if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else {\n return this.penner = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if (t === 0) {\n b;\n }\n if (t === d) {\n b + c;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d / 2) === 2) {\n b + c;\n }\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(this);\n","import * as PIXI from 'pixi.js'\nimport { Viewport } from 'pixi-viewport'\nimport Penner from 'penner'\n\nconst scrollboxOptions = {\n 'boxWidth': 100,\n 'boxHeight': 100,\n 'scrollbarSize': 10,\n 'scrollbarBackground': 14540253,\n 'scrollbarBackgroundAlpha': 1,\n 'scrollbarForeground': 8947848,\n 'scrollbarForegroundAlpha': 1,\n 'dragScroll': true,\n 'stopPropagation': true,\n 'scrollbarOffsetHorizontal': 0,\n 'scrollbarOffsetVertical': 0,\n 'underflow': 'top-left',\n 'fadeScrollbar': false,\n 'fadeScrollbarTime': 1000,\n 'fadeScrollboxWait': 3000,\n 'fadeScrollboxEase': 'easeInOutSine',\n 'passiveWheel': false,\n 'clampWheel': true\n}\n\n/**\n * pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars\n */\nexport class Scrollbox extends PIXI.Container\n{\n /**\n * create a scrollbox\n * @param {object} options\n * @param {boolean} [options.dragScroll=true] user may drag the content area to scroll content\n * @param {string} [options.overflowX=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflowY=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflow] (none, scroll, hidden, auto) sets overflowX and overflowY to this value\n * @param {number} [options.boxWidth=100] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight=100] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollbarSize=10] size of scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetHorizontal=0] offset of horizontal scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetVertical=0] offset of vertical scrollbar (in pixels)\n * @param {boolean} [options.stopPropagation=true] call stopPropagation on any events that impact scrollbox\n * @param {number} [options.scrollbarBackground=0xdddddd] background color of scrollbar\n * @param {number} [options.scrollbarBackgroundAlpha=1] alpha of background of scrollbar\n * @param {number} [options.scrollbarForeground=0x888888] foreground color of scrollbar\n * @param {number} [options.scrollbarForegroundAlpha=1] alpha of foreground of scrollbar\n * @param {string} [options.underflow=top-left] what to do when content underflows the scrollbox size: none: do nothing; (left/right/center AND top/bottom/center); OR center (e.g., 'top-left', 'center', 'none', 'bottomright')\n * @param {boolean} [options.noTicker] do not use PIXI.Ticker (for fade to work properly you will need to manually call updateLoop(elapsed) on each frame)\n * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.Ticker for updates\n * @param {boolean} [options.fade] fade the scrollbar when not in use\n * @param {number} [options.fadeScrollbarTime=1000] time to fade scrollbar if options.fade is set\n * @param {number} [options.fadeScrollboxWait=3000] time to wait before fading the scrollbar if options.fade is set\n * @param {(string|function)} [options.fadeScrollboxEase=easeInOutSine] easing function to use for fading\n * @param {boolean} [options.passiveWheel=false] whether wheel events are propogated beyond the scrollbox (NOTE: default is now false)\n * @param {boolean} [options.clampWheel=true] wheel events should be clamped (to avoid weird bounce with mouse wheel)\n */\n constructor(options={})\n {\n super()\n this.options = Object.assign({}, scrollboxOptions, options)\n if (options.overflow) {\n this.options.overflowX = this.options.overflowY = options.overflow\n }\n this.ease = typeof this.options.fadeScrollboxEase === 'function' ? this.options.fadeScrollboxEase : Penner[this.options.fadeScrollboxEase]\n\n /**\n * content in placed in here\n * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/)\n * @type {Viewport}\n */\n this.content = this.addChild(new Viewport({ passiveWheel: this.options.passiveWheel, stopPropagation: this.options.stopPropagation, screenWidth: this.options.boxWidth, screenHeight: this.options.boxHeight }))\n this.content\n .decelerate()\n .on('moved', () => this._drawScrollbars())\n\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\n if (options.ticker)\n {\n this.options.ticker = options.ticker\n }\n else\n {\n // to avoid Rollup transforming our import, save pixi namespace in a variable\n // from here: https://github.com/pixijs/pixi.js/issues/5757\n let ticker\n const pixiNS = PIXI\n if (parseInt(/^(\\d+)\\./.exec(PIXI.VERSION)[1]) < 5)\n {\n ticker = pixiNS.ticker.shared;\n }\n else\n {\n ticker = pixiNS.Ticker.shared;\n }\n this.options.ticker = options.ticker || ticker\n }\n\n /**\n * graphics element for drawing the scrollbars\n * @type {PIXI.Graphics}\n */\n this.scrollbar = this.addChild(new PIXI.Graphics())\n this.scrollbar.interactive = true\n this.scrollbar.on('pointerdown', this.scrollbarDown, this)\n this.interactive = true\n this.on('pointermove', this.scrollbarMove, this)\n this.on('pointerup', this.scrollbarUp, this)\n this.on('pointercancel', this.scrollbarUp, this)\n this.on('pointerupoutside', this.scrollbarUp, this)\n this._maskContent = this.addChild(new PIXI.Graphics())\n this.update()\n\n if (!this.options.noTicker)\n {\n this.tickerFunction = () => this.updateLoop(Math.min(this.options.ticker.elapsedMS, 16.6667))\n this.options.ticker.add(this.tickerFunction)\n }\n }\n\n /**\n * offset of horizontal scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetHorizontal()\n {\n return this.options.scrollbarOffsetHorizontal\n }\n set scrollbarOffsetHorizontal(value)\n {\n this.options.scrollbarOffsetHorizontal = value\n }\n\n /**\n * offset of vertical scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetVertical()\n {\n return this.options.scrollbarOffsetVertical\n }\n set scrollbarOffsetVertical(value)\n {\n this.options.scrollbarOffsetVertical = value\n }\n\n /**\n * disable the scrollbox (if set to true this will also remove the mask)\n * @type {boolean}\n */\n get disable()\n {\n return this._disabled\n }\n set disable(value)\n {\n if (this._disabled !== value)\n {\n this._disabled = value\n this.update()\n }\n }\n\n /**\n * call stopPropagation on any events that impact scrollbox\n * @type {boolean}\n */\n get stopPropagation()\n {\n return this.options.stopPropagation\n }\n set stopPropagation(value)\n {\n this.options.stopPropagation = value\n }\n\n /**\n * user may drag the content area to scroll content\n * @type {boolean}\n */\n get dragScroll()\n {\n return this.options.dragScroll\n }\n set dragScroll(value)\n {\n this.options.dragScroll = value\n if (value)\n {\n this.content.drag()\n }\n else\n {\n if (typeof this.content.removePlugin !== 'undefined')\n {\n this.content.removePlugin('drag')\n }\n else\n {\n this.content.plugins.remove('drag')\n }\n }\n this.update()\n }\n\n /**\n * width of scrollbox including the scrollbar (if visible)- this changes the size and not the scale of the box\n * @type {number}\n */\n get boxWidth()\n {\n return this.options.boxWidth\n }\n set boxWidth(value)\n {\n this.options.boxWidth = value\n this.content.screenWidth = value\n this.update()\n }\n\n /**\n * sets overflowX and overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflow()\n {\n return this.options.overflow\n }\n set overflow(value)\n {\n this.options.overflow = value\n this.options.overflowX = value\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * sets overflowX to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowX()\n {\n return this.options.overflowX\n }\n set overflowX(value)\n {\n this.options.overflowX = value\n this.update()\n }\n\n /**\n * sets overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowY()\n {\n return this.options.overflowY\n }\n set overflowY(value)\n {\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * height of scrollbox including the scrollbar (if visible) - this changes the size and not the scale of the box\n * @type {number}\n */\n get boxHeight()\n {\n return this.options.boxHeight\n }\n set boxHeight(value)\n {\n this.options.boxHeight = value\n this.content.screenHeight = value\n this.update()\n }\n\n /**\n * scrollbar size in pixels\n * @type {number}\n */\n get scrollbarSize()\n {\n return this.options.scrollbarSize\n }\n set scrollbarSize(value)\n {\n this.options.scrollbarSize = value\n }\n\n /**\n * width of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentWidth()\n {\n return this.options.boxWidth - (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n }\n\n /**\n * height of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentHeight()\n {\n return this.options.boxHeight - (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n }\n\n /**\n * is the vertical scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarVertical()\n {\n return this._isScrollbarVertical\n }\n\n /**\n * is the horizontal scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarHorizontal()\n {\n return this._isScrollbarHorizontal\n }\n\n /**\n * top coordinate of scrollbar\n */\n get scrollTop()\n {\n return this.content.top\n }\n set scrollTop(top) {\n this.content.top = top\n this._drawScrollbars()\n }\n\n /**\n * left coordinate of scrollbar\n */\n get scrollLeft()\n {\n return this.content.left\n }\n set scrollLeft(left) {\n this.content.left = left\n this._drawScrollbars()\n }\n\n /**\n * width of content area\n * if not set then it uses content.width to calculate width\n */\n get scrollWidth()\n {\n return this._scrollWidth || this.content.width\n }\n set scrollWidth(value)\n {\n this._scrollWidth = value\n }\n\n /**\n * height of content area\n * if not set then it uses content.height to calculate height\n */\n get scrollHeight()\n {\n return this._scrollHeight || this.content.height\n }\n set scrollHeight(value)\n {\n this._scrollHeight = value\n }\n\n /**\n * draws scrollbars\n * @private\n */\n _drawScrollbars()\n {\n this._isScrollbarHorizontal = this.overflowX === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowX) !== -1 ? false : this.scrollWidth > this.options.boxWidth\n this._isScrollbarVertical = this.overflowY === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowY) !== -1 ? false : this.scrollHeight > this.options.boxHeight\n this.scrollbar.clear()\n let options = {}\n options.left = 0\n options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0)\n options.top = 0\n options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n this.scrollbarTop = (this.content.top / height) * this.boxHeight\n this.scrollbarTop = this.scrollbarTop < 0 ? 0 : this.scrollbarTop\n this.scrollbarHeight = (this.boxHeight / height) * this.boxHeight\n this.scrollbarHeight = this.scrollbarTop + this.scrollbarHeight > this.boxHeight ? this.boxHeight - this.scrollbarTop : this.scrollbarHeight\n this.scrollbarLeft = (this.content.left / width) * this.boxWidth\n this.scrollbarLeft = this.scrollbarLeft < 0 ? 0 : this.scrollbarLeft\n this.scrollbarWidth = (this.boxWidth / width) * this.boxWidth\n this.scrollbarWidth = this.scrollbarWidth + this.scrollbarLeft > this.boxWidth ? this.boxWidth - this.scrollbarLeft : this.scrollbarWidth\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, 0, this.scrollbarSize, this.boxHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(0, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.boxWidth, this.scrollbarSize)\n .endFill()\n }\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, this.scrollbarTop, this.scrollbarSize, this.scrollbarHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.scrollbarLeft, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.scrollbarWidth, this.scrollbarSize)\n .endFill()\n }\n // this.content.forceHitArea = new PIXI.Rectangle(0, 0 , this.boxWidth, this.boxHeight)\n this.activateFade()\n }\n\n /**\n * draws mask layer\n * @private\n */\n _drawMask()\n {\n this._maskContent\n .beginFill(0)\n .drawRect(0, 0, this.boxWidth, this.boxHeight)\n .endFill()\n this.content.mask = this._maskContent\n }\n\n /**\n * call when scrollbox content changes\n */\n update()\n {\n this.content.mask = null\n this._maskContent.clear()\n if (!this._disabled)\n {\n this._drawScrollbars()\n this._drawMask()\n if (this.options.dragScroll)\n {\n const direction = this.isScrollbarHorizontal && this.isScrollbarVertical ? 'all' : this.isScrollbarHorizontal ? 'x' : 'y'\n if (direction !== null)\n {\n this.content\n .drag({ clampWheel: this.options.clampWheel, direction })\n .clamp({ direction, underflow: this.options.underflow })\n }\n }\n }\n }\n\n /**\n * called on each frame to update fade scrollbars (if enabled)\n * @param {number} elapsed since last frame in milliseconds (usually capped at 16.6667)\n */\n updateLoop(elapsed)\n {\n if (this.fade)\n {\n if (this.fade.wait > 0)\n {\n this.fade.wait -= elapsed\n if (this.fade.wait <= 0)\n {\n elapsed += this.fade.wait\n }\n else\n {\n return\n }\n }\n this.fade.duration += elapsed\n if (this.fade.duration >= this.options.fadeScrollbarTime)\n {\n this.fade = null\n this.scrollbar.alpha = 0\n }\n else\n {\n this.scrollbar.alpha = this.ease(this.fade.duration, 1, -1, this.options.fadeScrollbarTime)\n }\n this.content.dirty = true\n }\n }\n\n /**\n * dirty value (used for optimizing draws) for underlying viewport (scrollbox.content)\n * @type {boolean}\n */\n get dirty()\n {\n return this.content.dirty\n }\n set dirty(value)\n {\n this.content.dirty = value\n }\n\n /**\n * show the scrollbar and restart the timer for fade if options.fade is set\n */\n activateFade()\n {\n if (!this.fade && this.options.fade)\n {\n this.scrollbar.alpha = 1\n this.fade = { wait: this.options.fadeScrollboxWait, duration: 0 }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarDown(e)\n {\n const local = this.toLocal(e.data.global)\n if (this.isScrollbarHorizontal)\n {\n if (local.y > this.boxHeight - this.scrollbarSize)\n {\n if (local.x >= this.scrollbarLeft && local.x <= this.scrollbarLeft + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'horizontal', last: local }\n }\n else\n {\n if (local.x > this.scrollbarLeft)\n {\n this.content.left += this.content.worldScreenWidth\n this.update()\n }\n else\n {\n this.content.left -= this.content.worldScreenWidth\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n if (this.isScrollbarVertical)\n {\n if (local.x > this.boxWidth - this.scrollbarSize)\n {\n if (local.y >= this.scrollbarTop && local.y <= this.scrollbarTop + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'vertical', last: local }\n }\n else\n {\n if (local.y > this.scrollbarTop)\n {\n this.content.top += this.content.worldScreenHeight\n this.update()\n }\n else\n {\n this.content.top -= this.content.worldScreenHeight\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n }\n\n /**\n * handle pointer move on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarMove(e)\n {\n if (this.pointerDown)\n {\n if (this.pointerDown.type === 'horizontal')\n {\n const local = this.toLocal(e.data.global)\n this.content.left += local.x - this.pointerDown.last.x\n this.pointerDown.last = local\n this.update()\n }\n else if (this.pointerDown.type === 'vertical')\n {\n const local = this.toLocal(e.data.global)\n this.content.top += local.y - this.pointerDown.last.y\n this.pointerDown.last = local\n this.update()\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @private\n */\n scrollbarUp()\n {\n this.pointerDown = null\n }\n\n /**\n * resize the mask for the container\n * @param {object} options\n * @param {number} [options.boxWidth] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollWidth] set the width of the inside of the scrollbox (leave null to use content.width)\n * @param {number} [options.scrollHeight] set the height of the inside of the scrollbox (leave null to use content.height)\n */\n resize(options)\n {\n this.options.boxWidth = typeof options.boxWidth !== 'undefined' ? options.boxWidth : this.options.boxWidth\n this.options.boxHeight = typeof options.boxHeight !== 'undefined' ? options.boxHeight : this.options.boxHeight\n if (options.scrollWidth)\n {\n this.scrollWidth = options.scrollWidth\n }\n if (options.scrollHeight)\n {\n this.scrollHeight = options.scrollHeight\n }\n this.content.resize(this.options.boxWidth, this.options.boxHeight, this.scrollWidth, this.scrollHeight)\n this.update()\n }\n\n /**\n * ensure that the bounding box is visible\n * @param {number} x - relative to content's coordinate system\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n ensureVisible(x, y, width, height)\n {\n this.content.ensureVisible(x, y, width, height)\n this._drawScrollbars()\n }\n}"],"names":["this","PIXI.Container","Penner","PIXI.VERSION","PIXI.Graphics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,CAAC,WAAW;EACV,IAAI,MAAM,EAAE,GAAG,CAAC;;EAEhB,GAAG,GAAG,SAAS,OAAO,EAAE;IACtB,AAAiC;MAC/B,OAAO,cAAc,GAAG,OAAO,CAAC;KACjC,AAIA;GACF,CAAC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CAAC,WAAW;QACvB;YACI,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,YAAW;SACzC;QACD,IAAI,OAAO,CAAC,YAAY;QACxB;YACI,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,aAAY;SAC3C;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAC;QACvG,IAAI,CAAC,MAAM,GAAE;KAChB;;;;;;;;;IASD,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM;IACjC;QACI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAC;QAC/C,IAAI,CAAC,eAAe,GAAE;KACzB;;;;;"} \ No newline at end of file diff --git a/dist/scrollbox.js b/dist/scrollbox.js index f8f512e..e5b3cbe 100644 --- a/dist/scrollbox.js +++ b/dist/scrollbox.js @@ -1,2 +1,2 @@ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("pixi.js"),require("pixi-viewport")):"function"==typeof define&&define.amd?define(["exports","pixi.js","pixi-viewport"],i):i((t=t||self).Scrollbox={},t.PIXI,t.Viewport)}(this,function(t,i,o){"use strict";var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(t,i){return t(i={exports:{}},i.exports),i.exports}(function(t,i){(function(){var i;(function(i){t.exports=i})(i={linear:function(t,i,o,s){return o*t/s+i},easeInQuad:function(t,i,o,s){return o*(t/=s)*t+i},easeOutQuad:function(t,i,o,s){return-o*(t/=s)*(t-2)+i},easeInOutQuad:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t+i:-o/2*(--t*(t-2)-1)+i},easeInCubic:function(t,i,o,s){return o*(t/=s)*t*t+i},easeOutCubic:function(t,i,o,s){return o*((t=t/s-1)*t*t+1)+i},easeInOutCubic:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t+i:o/2*((t-=2)*t*t+2)+i},easeInQuart:function(t,i,o,s){return o*(t/=s)*t*t*t+i},easeOutQuart:function(t,i,o,s){return-o*((t=t/s-1)*t*t*t-1)+i},easeInOutQuart:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t*t+i:-o/2*((t-=2)*t*t*t-2)+i},easeInQuint:function(t,i,o,s){return o*(t/=s)*t*t*t*t+i},easeOutQuint:function(t,i,o,s){return o*((t=t/s-1)*t*t*t*t+1)+i},easeInOutQuint:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t*t*t+i:o/2*((t-=2)*t*t*t*t+2)+i},easeInSine:function(t,i,o,s){return-o*Math.cos(t/s*(Math.PI/2))+o+i},easeOutSine:function(t,i,o,s){return o*Math.sin(t/s*(Math.PI/2))+i},easeInOutSine:function(t,i,o,s){return-o/2*(Math.cos(Math.PI*t/s)-1)+i},easeInExpo:function(t,i,o,s){return 0===t?i:o*Math.pow(2,10*(t/s-1))+i},easeOutExpo:function(t,i,o,s){return t===s?i+o:o*(1-Math.pow(2,-10*t/s))+i},easeInOutExpo:function(t,i,o,s){return(t/=s/2)<1?o/2*Math.pow(2,10*(t-1))+i:o/2*(2-Math.pow(2,-10*--t))+i},easeInCirc:function(t,i,o,s){return-o*(Math.sqrt(1-(t/=s)*t)-1)+i},easeOutCirc:function(t,i,o,s){return o*Math.sqrt(1-(t=t/s-1)*t)+i},easeInOutCirc:function(t,i,o,s){return(t/=s/2)<1?-o/2*(Math.sqrt(1-t*t)-1)+i:o/2*(Math.sqrt(1-(t-=2)*t)+1)+i},easeInElastic:function(t,i,o,s){var r,e,l;return l=1.70158,0===t||(t/=s),(e=0)||(e=.3*s),(r=o)this._drawScrollbars()),t.ticker)this.options.ticker=t.ticker;else{let o;const s=i;o=parseInt(/^(\d+)\./.exec(i.VERSION)[1])<5?s.ticker.shared:s.Ticker.shared,this.options.ticker=t.ticker||o}this.scrollbar=this.addChild(new i.Graphics),this.scrollbar.interactive=!0,this.scrollbar.on("pointerdown",this.scrollbarDown,this),this.interactive=!0,this.on("pointermove",this.scrollbarMove,this),this.on("pointerup",this.scrollbarUp,this),this.on("pointercancel",this.scrollbarUp,this),this.on("pointerupoutside",this.scrollbarUp,this),this._maskContent=this.addChild(new i.Graphics),this.update(),this.options.noTicker||(this.tickerFunction=()=>this.updateLoop(Math.min(this.options.ticker.elapsedMS,16.6667)),this.options.ticker.add(this.tickerFunction))}get scrollbarOffsetHorizontal(){return this.options.scrollbarOffsetHorizontal}set scrollbarOffsetHorizontal(t){this.options.scrollbarOffsetHorizontal=t}get scrollbarOffsetVertical(){return this.options.scrollbarOffsetVertical}set scrollbarOffsetVertical(t){this.options.scrollbarOffsetVertical=t}get disable(){return this._disabled}set disable(t){this._disabled!==t&&(this._disabled=t,this.update())}get stopPropagation(){return this.options.stopPropagation}set stopPropagation(t){this.options.stopPropagation=t}get dragScroll(){return this.options.dragScroll}set dragScroll(t){this.options.dragScroll=t,t?this.content.drag():void 0!==this.content.removePlugin?this.content.removePlugin("drag"):this.content.plugins.remove("drag"),this.update()}get boxWidth(){return this.options.boxWidth}set boxWidth(t){this.options.boxWidth=t,this.content.screenWidth=t,this.update()}get overflow(){return this.options.overflow}set overflow(t){this.options.overflow=t,this.options.overflowX=t,this.options.overflowY=t,this.update()}get overflowX(){return this.options.overflowX}set overflowX(t){this.options.overflowX=t,this.update()}get overflowY(){return this.options.overflowY}set overflowY(t){this.options.overflowY=t,this.update()}get boxHeight(){return this.options.boxHeight}set boxHeight(t){this.options.boxHeight=t,this.content.screenHeight=t,this.update()}get scrollbarSize(){return this.options.scrollbarSize}set scrollbarSize(t){this.options.scrollbarSize=t}get contentWidth(){return this.options.boxWidth-(this.isScrollbarVertical?this.options.scrollbarSize:0)}get contentHeight(){return this.options.boxHeight-(this.isScrollbarHorizontal?this.options.scrollbarSize:0)}get isScrollbarVertical(){return this._isScrollbarVertical}get isScrollbarHorizontal(){return this._isScrollbarHorizontal}get scrollTop(){return this.content.top}get scrollLeft(){return this.content.left}get scrollWidth(){return this._scrollWidth||this.content.width}set scrollWidth(t){this._scrollWidth=t}get scrollHeight(){return this._scrollHeight||this.content.height}set scrollHeight(t){this._scrollHeight=t}_drawScrollbars(){this._isScrollbarHorizontal="scroll"===this.overflowX||-1===["hidden","none"].indexOf(this.overflowX)&&this.scrollWidth>this.options.boxWidth,this._isScrollbarVertical="scroll"===this.overflowY||-1===["hidden","none"].indexOf(this.overflowY)&&this.scrollHeight>this.options.boxHeight,this.scrollbar.clear();let t={left:0};t.right=this.scrollWidth+(this._isScrollbarVertical?this.options.scrollbarSize:0),t.top=0,t.bottom=this.scrollHeight+(this.isScrollbarHorizontal?this.options.scrollbarSize:0);const i=this.scrollWidth+(this.isScrollbarVertical?this.options.scrollbarSize:0),o=this.scrollHeight+(this.isScrollbarHorizontal?this.options.scrollbarSize:0);this.scrollbarTop=this.content.top/o*this.boxHeight,this.scrollbarTop=this.scrollbarTop<0?0:this.scrollbarTop,this.scrollbarHeight=this.boxHeight/o*this.boxHeight,this.scrollbarHeight=this.scrollbarTop+this.scrollbarHeight>this.boxHeight?this.boxHeight-this.scrollbarTop:this.scrollbarHeight,this.scrollbarLeft=this.content.left/i*this.boxWidth,this.scrollbarLeft=this.scrollbarLeft<0?0:this.scrollbarLeft,this.scrollbarWidth=this.boxWidth/i*this.boxWidth,this.scrollbarWidth=this.scrollbarWidth+this.scrollbarLeft>this.boxWidth?this.boxWidth-this.scrollbarLeft:this.scrollbarWidth,this.isScrollbarVertical&&this.scrollbar.beginFill(this.options.scrollbarBackground,this.options.scrollbarBackgroundAlpha).drawRect(this.boxWidth-this.scrollbarSize+this.options.scrollbarOffsetVertical,0,this.scrollbarSize,this.boxHeight).endFill(),this.isScrollbarHorizontal&&this.scrollbar.beginFill(this.options.scrollbarBackground,this.options.scrollbarBackgroundAlpha).drawRect(0,this.boxHeight-this.scrollbarSize+this.options.scrollbarOffsetHorizontal,this.boxWidth,this.scrollbarSize).endFill(),this.isScrollbarVertical&&this.scrollbar.beginFill(this.options.scrollbarForeground,this.options.scrollbarForegroundAlpha).drawRect(this.boxWidth-this.scrollbarSize+this.options.scrollbarOffsetVertical,this.scrollbarTop,this.scrollbarSize,this.scrollbarHeight).endFill(),this.isScrollbarHorizontal&&this.scrollbar.beginFill(this.options.scrollbarForeground,this.options.scrollbarForegroundAlpha).drawRect(this.scrollbarLeft,this.boxHeight-this.scrollbarSize+this.options.scrollbarOffsetHorizontal,this.scrollbarWidth,this.scrollbarSize).endFill(),this.activateFade()}_drawMask(){this._maskContent.beginFill(0).drawRect(0,0,this.boxWidth,this.boxHeight).endFill(),this.content.mask=this._maskContent}update(){if(this.content.mask=null,this._maskContent.clear(),!this._disabled&&(this._drawScrollbars(),this._drawMask(),this.options.dragScroll)){const t=this.isScrollbarHorizontal&&this.isScrollbarVertical?"all":this.isScrollbarHorizontal?"x":"y";null!==t&&this.content.drag({clampWheel:this.options.clampWheel,direction:t}).clamp({direction:t,underflow:this.options.underflow})}}updateLoop(t){if(this.fade){if(this.fade.wait>0){if(this.fade.wait-=t,!(this.fade.wait<=0))return;t+=this.fade.wait}this.fade.duration+=t,this.fade.duration>=this.options.fadeScrollbarTime?(this.fade=null,this.scrollbar.alpha=0):this.scrollbar.alpha=this.ease(this.fade.duration,1,-1,this.options.fadeScrollbarTime),this.content.dirty=!0}}get dirty(){return this.content.dirty}set dirty(t){this.content.dirty=t}activateFade(){!this.fade&&this.options.fade&&(this.scrollbar.alpha=1,this.fade={wait:this.options.fadeScrollboxWait,duration:0})}scrollbarDown(t){const i=this.toLocal(t.data.global);return this.isScrollbarHorizontal&&i.y>this.boxHeight-this.scrollbarSize?(i.x>=this.scrollbarLeft&&i.x<=this.scrollbarLeft+this.scrollbarWidth?this.pointerDown={type:"horizontal",last:i}:i.x>this.scrollbarLeft?(this.content.left+=this.content.worldScreenWidth,this.update()):(this.content.left-=this.content.worldScreenWidth,this.update()),void(this.options.stopPropagation&&t.stopPropagation())):this.isScrollbarVertical&&i.x>this.boxWidth-this.scrollbarSize?(i.y>=this.scrollbarTop&&i.y<=this.scrollbarTop+this.scrollbarWidth?this.pointerDown={type:"vertical",last:i}:i.y>this.scrollbarTop?(this.content.top+=this.content.worldScreenHeight,this.update()):(this.content.top-=this.content.worldScreenHeight,this.update()),void(this.options.stopPropagation&&t.stopPropagation())):void 0}scrollbarMove(t){if(this.pointerDown){if("horizontal"===this.pointerDown.type){const i=this.toLocal(t.data.global);this.content.left+=i.x-this.pointerDown.last.x,this.pointerDown.last=i,this.update()}else if("vertical"===this.pointerDown.type){const i=this.toLocal(t.data.global);this.content.top+=i.y-this.pointerDown.last.y,this.pointerDown.last=i,this.update()}this.options.stopPropagation&&t.stopPropagation()}}scrollbarUp(){this.pointerDown=null}resize(t){this.options.boxWidth=void 0!==t.boxWidth?t.boxWidth:this.options.boxWidth,this.options.boxHeight=void 0!==t.boxHeight?t.boxHeight:this.options.boxHeight,t.scrollWidth&&(this.scrollWidth=t.scrollWidth),t.scrollHeight&&(this.scrollHeight=t.scrollHeight),this.content.resize(this.options.boxWidth,this.options.boxHeight,this.scrollWidth,this.scrollHeight),this.update()}ensureVisible(t,i,o,s){this.content.ensureVisible(t,i,o,s),this._drawScrollbars()}},Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("pixi.js"),require("pixi-viewport")):"function"==typeof define&&define.amd?define(["exports","pixi.js","pixi-viewport"],i):i((t=t||self).Scrollbox={},t.PIXI,t.Viewport)}(this,function(t,i,o){"use strict";var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(t,i){return t(i={exports:{}},i.exports),i.exports}(function(t,i){(function(){var i;(function(i){t.exports=i})(i={linear:function(t,i,o,s){return o*t/s+i},easeInQuad:function(t,i,o,s){return o*(t/=s)*t+i},easeOutQuad:function(t,i,o,s){return-o*(t/=s)*(t-2)+i},easeInOutQuad:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t+i:-o/2*(--t*(t-2)-1)+i},easeInCubic:function(t,i,o,s){return o*(t/=s)*t*t+i},easeOutCubic:function(t,i,o,s){return o*((t=t/s-1)*t*t+1)+i},easeInOutCubic:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t+i:o/2*((t-=2)*t*t+2)+i},easeInQuart:function(t,i,o,s){return o*(t/=s)*t*t*t+i},easeOutQuart:function(t,i,o,s){return-o*((t=t/s-1)*t*t*t-1)+i},easeInOutQuart:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t*t+i:-o/2*((t-=2)*t*t*t-2)+i},easeInQuint:function(t,i,o,s){return o*(t/=s)*t*t*t*t+i},easeOutQuint:function(t,i,o,s){return o*((t=t/s-1)*t*t*t*t+1)+i},easeInOutQuint:function(t,i,o,s){return(t/=s/2)<1?o/2*t*t*t*t*t+i:o/2*((t-=2)*t*t*t*t+2)+i},easeInSine:function(t,i,o,s){return-o*Math.cos(t/s*(Math.PI/2))+o+i},easeOutSine:function(t,i,o,s){return o*Math.sin(t/s*(Math.PI/2))+i},easeInOutSine:function(t,i,o,s){return-o/2*(Math.cos(Math.PI*t/s)-1)+i},easeInExpo:function(t,i,o,s){return 0===t?i:o*Math.pow(2,10*(t/s-1))+i},easeOutExpo:function(t,i,o,s){return t===s?i+o:o*(1-Math.pow(2,-10*t/s))+i},easeInOutExpo:function(t,i,o,s){return(t/=s/2)<1?o/2*Math.pow(2,10*(t-1))+i:o/2*(2-Math.pow(2,-10*--t))+i},easeInCirc:function(t,i,o,s){return-o*(Math.sqrt(1-(t/=s)*t)-1)+i},easeOutCirc:function(t,i,o,s){return o*Math.sqrt(1-(t=t/s-1)*t)+i},easeInOutCirc:function(t,i,o,s){return(t/=s/2)<1?-o/2*(Math.sqrt(1-t*t)-1)+i:o/2*(Math.sqrt(1-(t-=2)*t)+1)+i},easeInElastic:function(t,i,o,s){var r,e,l;return l=1.70158,0===t||(t/=s),(e=0)||(e=.3*s),(r=o)this._drawScrollbars()),t.ticker)this.options.ticker=t.ticker;else{let o;const s=i;o=parseInt(/^(\d+)\./.exec(i.VERSION)[1])<5?s.ticker.shared:s.Ticker.shared,this.options.ticker=t.ticker||o}this.scrollbar=this.addChild(new i.Graphics),this.scrollbar.interactive=!0,this.scrollbar.on("pointerdown",this.scrollbarDown,this),this.interactive=!0,this.on("pointermove",this.scrollbarMove,this),this.on("pointerup",this.scrollbarUp,this),this.on("pointercancel",this.scrollbarUp,this),this.on("pointerupoutside",this.scrollbarUp,this),this._maskContent=this.addChild(new i.Graphics),this.update(),this.options.noTicker||(this.tickerFunction=()=>this.updateLoop(Math.min(this.options.ticker.elapsedMS,16.6667)),this.options.ticker.add(this.tickerFunction))}get scrollbarOffsetHorizontal(){return this.options.scrollbarOffsetHorizontal}set scrollbarOffsetHorizontal(t){this.options.scrollbarOffsetHorizontal=t}get scrollbarOffsetVertical(){return this.options.scrollbarOffsetVertical}set scrollbarOffsetVertical(t){this.options.scrollbarOffsetVertical=t}get disable(){return this._disabled}set disable(t){this._disabled!==t&&(this._disabled=t,this.update())}get stopPropagation(){return this.options.stopPropagation}set stopPropagation(t){this.options.stopPropagation=t}get dragScroll(){return this.options.dragScroll}set dragScroll(t){this.options.dragScroll=t,t?this.content.drag():void 0!==this.content.removePlugin?this.content.removePlugin("drag"):this.content.plugins.remove("drag"),this.update()}get boxWidth(){return this.options.boxWidth}set boxWidth(t){this.options.boxWidth=t,this.content.screenWidth=t,this.update()}get overflow(){return this.options.overflow}set overflow(t){this.options.overflow=t,this.options.overflowX=t,this.options.overflowY=t,this.update()}get overflowX(){return this.options.overflowX}set overflowX(t){this.options.overflowX=t,this.update()}get overflowY(){return this.options.overflowY}set overflowY(t){this.options.overflowY=t,this.update()}get boxHeight(){return this.options.boxHeight}set boxHeight(t){this.options.boxHeight=t,this.content.screenHeight=t,this.update()}get scrollbarSize(){return this.options.scrollbarSize}set scrollbarSize(t){this.options.scrollbarSize=t}get contentWidth(){return this.options.boxWidth-(this.isScrollbarVertical?this.options.scrollbarSize:0)}get contentHeight(){return this.options.boxHeight-(this.isScrollbarHorizontal?this.options.scrollbarSize:0)}get isScrollbarVertical(){return this._isScrollbarVertical}get isScrollbarHorizontal(){return this._isScrollbarHorizontal}get scrollTop(){return this.content.top}set scrollTop(t){this.content.top=t,this._drawScrollbars()}get scrollLeft(){return this.content.left}set scrollLeft(t){this.content.left=t,this._drawScrollbars()}get scrollWidth(){return this._scrollWidth||this.content.width}set scrollWidth(t){this._scrollWidth=t}get scrollHeight(){return this._scrollHeight||this.content.height}set scrollHeight(t){this._scrollHeight=t}_drawScrollbars(){this._isScrollbarHorizontal="scroll"===this.overflowX||-1===["hidden","none"].indexOf(this.overflowX)&&this.scrollWidth>this.options.boxWidth,this._isScrollbarVertical="scroll"===this.overflowY||-1===["hidden","none"].indexOf(this.overflowY)&&this.scrollHeight>this.options.boxHeight,this.scrollbar.clear();let t={left:0};t.right=this.scrollWidth+(this._isScrollbarVertical?this.options.scrollbarSize:0),t.top=0,t.bottom=this.scrollHeight+(this.isScrollbarHorizontal?this.options.scrollbarSize:0);const i=this.scrollWidth+(this.isScrollbarVertical?this.options.scrollbarSize:0),o=this.scrollHeight+(this.isScrollbarHorizontal?this.options.scrollbarSize:0);this.scrollbarTop=this.content.top/o*this.boxHeight,this.scrollbarTop=this.scrollbarTop<0?0:this.scrollbarTop,this.scrollbarHeight=this.boxHeight/o*this.boxHeight,this.scrollbarHeight=this.scrollbarTop+this.scrollbarHeight>this.boxHeight?this.boxHeight-this.scrollbarTop:this.scrollbarHeight,this.scrollbarLeft=this.content.left/i*this.boxWidth,this.scrollbarLeft=this.scrollbarLeft<0?0:this.scrollbarLeft,this.scrollbarWidth=this.boxWidth/i*this.boxWidth,this.scrollbarWidth=this.scrollbarWidth+this.scrollbarLeft>this.boxWidth?this.boxWidth-this.scrollbarLeft:this.scrollbarWidth,this.isScrollbarVertical&&this.scrollbar.beginFill(this.options.scrollbarBackground,this.options.scrollbarBackgroundAlpha).drawRect(this.boxWidth-this.scrollbarSize+this.options.scrollbarOffsetVertical,0,this.scrollbarSize,this.boxHeight).endFill(),this.isScrollbarHorizontal&&this.scrollbar.beginFill(this.options.scrollbarBackground,this.options.scrollbarBackgroundAlpha).drawRect(0,this.boxHeight-this.scrollbarSize+this.options.scrollbarOffsetHorizontal,this.boxWidth,this.scrollbarSize).endFill(),this.isScrollbarVertical&&this.scrollbar.beginFill(this.options.scrollbarForeground,this.options.scrollbarForegroundAlpha).drawRect(this.boxWidth-this.scrollbarSize+this.options.scrollbarOffsetVertical,this.scrollbarTop,this.scrollbarSize,this.scrollbarHeight).endFill(),this.isScrollbarHorizontal&&this.scrollbar.beginFill(this.options.scrollbarForeground,this.options.scrollbarForegroundAlpha).drawRect(this.scrollbarLeft,this.boxHeight-this.scrollbarSize+this.options.scrollbarOffsetHorizontal,this.scrollbarWidth,this.scrollbarSize).endFill(),this.activateFade()}_drawMask(){this._maskContent.beginFill(0).drawRect(0,0,this.boxWidth,this.boxHeight).endFill(),this.content.mask=this._maskContent}update(){if(this.content.mask=null,this._maskContent.clear(),!this._disabled&&(this._drawScrollbars(),this._drawMask(),this.options.dragScroll)){const t=this.isScrollbarHorizontal&&this.isScrollbarVertical?"all":this.isScrollbarHorizontal?"x":"y";null!==t&&this.content.drag({clampWheel:this.options.clampWheel,direction:t}).clamp({direction:t,underflow:this.options.underflow})}}updateLoop(t){if(this.fade){if(this.fade.wait>0){if(this.fade.wait-=t,!(this.fade.wait<=0))return;t+=this.fade.wait}this.fade.duration+=t,this.fade.duration>=this.options.fadeScrollbarTime?(this.fade=null,this.scrollbar.alpha=0):this.scrollbar.alpha=this.ease(this.fade.duration,1,-1,this.options.fadeScrollbarTime),this.content.dirty=!0}}get dirty(){return this.content.dirty}set dirty(t){this.content.dirty=t}activateFade(){!this.fade&&this.options.fade&&(this.scrollbar.alpha=1,this.fade={wait:this.options.fadeScrollboxWait,duration:0})}scrollbarDown(t){const i=this.toLocal(t.data.global);return this.isScrollbarHorizontal&&i.y>this.boxHeight-this.scrollbarSize?(i.x>=this.scrollbarLeft&&i.x<=this.scrollbarLeft+this.scrollbarWidth?this.pointerDown={type:"horizontal",last:i}:i.x>this.scrollbarLeft?(this.content.left+=this.content.worldScreenWidth,this.update()):(this.content.left-=this.content.worldScreenWidth,this.update()),void(this.options.stopPropagation&&t.stopPropagation())):this.isScrollbarVertical&&i.x>this.boxWidth-this.scrollbarSize?(i.y>=this.scrollbarTop&&i.y<=this.scrollbarTop+this.scrollbarWidth?this.pointerDown={type:"vertical",last:i}:i.y>this.scrollbarTop?(this.content.top+=this.content.worldScreenHeight,this.update()):(this.content.top-=this.content.worldScreenHeight,this.update()),void(this.options.stopPropagation&&t.stopPropagation())):void 0}scrollbarMove(t){if(this.pointerDown){if("horizontal"===this.pointerDown.type){const i=this.toLocal(t.data.global);this.content.left+=i.x-this.pointerDown.last.x,this.pointerDown.last=i,this.update()}else if("vertical"===this.pointerDown.type){const i=this.toLocal(t.data.global);this.content.top+=i.y-this.pointerDown.last.y,this.pointerDown.last=i,this.update()}this.options.stopPropagation&&t.stopPropagation()}}scrollbarUp(){this.pointerDown=null}resize(t){this.options.boxWidth=void 0!==t.boxWidth?t.boxWidth:this.options.boxWidth,this.options.boxHeight=void 0!==t.boxHeight?t.boxHeight:this.options.boxHeight,t.scrollWidth&&(this.scrollWidth=t.scrollWidth),t.scrollHeight&&(this.scrollHeight=t.scrollHeight),this.content.resize(this.options.boxWidth,this.options.boxHeight,this.scrollWidth,this.scrollHeight),this.update()}ensureVisible(t,i,o,s){this.content.ensureVisible(t,i,o,s),this._drawScrollbars()}},Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=scrollbox.js.map diff --git a/dist/scrollbox.js.map b/dist/scrollbox.js.map index 4d10b77..07b5428 100644 --- a/dist/scrollbox.js.map +++ b/dist/scrollbox.js.map @@ -1 +1 @@ -{"version":3,"file":"scrollbox.js","sources":["../node_modules/penner/penner.js","../src/scrollbox.js"],"sourcesContent":["\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n if (typeof exports === 'object') {\n return module.exports = factory;\n } else if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else {\n return this.penner = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if (t === 0) {\n b;\n }\n if (t === d) {\n b + c;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d / 2) === 2) {\n b + c;\n }\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(this);\n","import * as PIXI from 'pixi.js'\nimport { Viewport } from 'pixi-viewport'\nimport Penner from 'penner'\n\nconst scrollboxOptions = {\n 'boxWidth': 100,\n 'boxHeight': 100,\n 'scrollbarSize': 10,\n 'scrollbarBackground': 14540253,\n 'scrollbarBackgroundAlpha': 1,\n 'scrollbarForeground': 8947848,\n 'scrollbarForegroundAlpha': 1,\n 'dragScroll': true,\n 'stopPropagation': true,\n 'scrollbarOffsetHorizontal': 0,\n 'scrollbarOffsetVertical': 0,\n 'underflow': 'top-left',\n 'fadeScrollbar': false,\n 'fadeScrollbarTime': 1000,\n 'fadeScrollboxWait': 3000,\n 'fadeScrollboxEase': 'easeInOutSine',\n 'passiveWheel': false,\n 'clampWheel': true\n}\n\n/**\n * pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars\n */\nexport class Scrollbox extends PIXI.Container\n{\n /**\n * create a scrollbox\n * @param {object} options\n * @param {boolean} [options.dragScroll=true] user may drag the content area to scroll content\n * @param {string} [options.overflowX=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflowY=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflow] (none, scroll, hidden, auto) sets overflowX and overflowY to this value\n * @param {number} [options.boxWidth=100] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight=100] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollbarSize=10] size of scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetHorizontal=0] offset of horizontal scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetVertical=0] offset of vertical scrollbar (in pixels)\n * @param {boolean} [options.stopPropagation=true] call stopPropagation on any events that impact scrollbox\n * @param {number} [options.scrollbarBackground=0xdddddd] background color of scrollbar\n * @param {number} [options.scrollbarBackgroundAlpha=1] alpha of background of scrollbar\n * @param {number} [options.scrollbarForeground=0x888888] foreground color of scrollbar\n * @param {number} [options.scrollbarForegroundAlpha=1] alpha of foreground of scrollbar\n * @param {string} [options.underflow=top-left] what to do when content underflows the scrollbox size: none: do nothing; (left/right/center AND top/bottom/center); OR center (e.g., 'top-left', 'center', 'none', 'bottomright')\n * @param {boolean} [options.noTicker] do not use PIXI.Ticker (for fade to work properly you will need to manually call updateLoop(elapsed) on each frame)\n * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.Ticker for updates\n * @param {boolean} [options.fade] fade the scrollbar when not in use\n * @param {number} [options.fadeScrollbarTime=1000] time to fade scrollbar if options.fade is set\n * @param {number} [options.fadeScrollboxWait=3000] time to wait before fading the scrollbar if options.fade is set\n * @param {(string|function)} [options.fadeScrollboxEase=easeInOutSine] easing function to use for fading\n * @param {boolean} [options.passiveWheel=false] whether wheel events are propogated beyond the scrollbox (NOTE: default is now false)\n * @param {boolean} [options.clampWheel=true] wheel events should be clamped (to avoid weird bounce with mouse wheel)\n */\n constructor(options={})\n {\n super()\n this.options = Object.assign({}, scrollboxOptions, options)\n if (options.overflow) {\n this.options.overflowX = this.options.overflowY = options.overflow\n }\n this.ease = typeof this.options.fadeScrollboxEase === 'function' ? this.options.fadeScrollboxEase : Penner[this.options.fadeScrollboxEase]\n\n /**\n * content in placed in here\n * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/)\n * @type {Viewport}\n */\n this.content = this.addChild(new Viewport({ passiveWheel: this.options.passiveWheel, stopPropagation: this.options.stopPropagation, screenWidth: this.options.boxWidth, screenHeight: this.options.boxHeight }))\n this.content\n .decelerate()\n .on('moved', () => this._drawScrollbars())\n\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\n if (options.ticker)\n {\n this.options.ticker = options.ticker\n }\n else\n {\n // to avoid Rollup transforming our import, save pixi namespace in a variable\n // from here: https://github.com/pixijs/pixi.js/issues/5757\n let ticker\n const pixiNS = PIXI\n if (parseInt(/^(\\d+)\\./.exec(PIXI.VERSION)[1]) < 5)\n {\n ticker = pixiNS.ticker.shared;\n }\n else\n {\n ticker = pixiNS.Ticker.shared;\n }\n this.options.ticker = options.ticker || ticker\n }\n\n /**\n * graphics element for drawing the scrollbars\n * @type {PIXI.Graphics}\n */\n this.scrollbar = this.addChild(new PIXI.Graphics())\n this.scrollbar.interactive = true\n this.scrollbar.on('pointerdown', this.scrollbarDown, this)\n this.interactive = true\n this.on('pointermove', this.scrollbarMove, this)\n this.on('pointerup', this.scrollbarUp, this)\n this.on('pointercancel', this.scrollbarUp, this)\n this.on('pointerupoutside', this.scrollbarUp, this)\n this._maskContent = this.addChild(new PIXI.Graphics())\n this.update()\n\n if (!this.options.noTicker)\n {\n this.tickerFunction = () => this.updateLoop(Math.min(this.options.ticker.elapsedMS, 16.6667))\n this.options.ticker.add(this.tickerFunction)\n }\n }\n\n /**\n * offset of horizontal scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetHorizontal()\n {\n return this.options.scrollbarOffsetHorizontal\n }\n set scrollbarOffsetHorizontal(value)\n {\n this.options.scrollbarOffsetHorizontal = value\n }\n\n /**\n * offset of vertical scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetVertical()\n {\n return this.options.scrollbarOffsetVertical\n }\n set scrollbarOffsetVertical(value)\n {\n this.options.scrollbarOffsetVertical = value\n }\n\n /**\n * disable the scrollbox (if set to true this will also remove the mask)\n * @type {boolean}\n */\n get disable()\n {\n return this._disabled\n }\n set disable(value)\n {\n if (this._disabled !== value)\n {\n this._disabled = value\n this.update()\n }\n }\n\n /**\n * call stopPropagation on any events that impact scrollbox\n * @type {boolean}\n */\n get stopPropagation()\n {\n return this.options.stopPropagation\n }\n set stopPropagation(value)\n {\n this.options.stopPropagation = value\n }\n\n /**\n * user may drag the content area to scroll content\n * @type {boolean}\n */\n get dragScroll()\n {\n return this.options.dragScroll\n }\n set dragScroll(value)\n {\n this.options.dragScroll = value\n if (value)\n {\n this.content.drag()\n }\n else\n {\n if (typeof this.content.removePlugin !== 'undefined')\n {\n this.content.removePlugin('drag')\n }\n else\n {\n this.content.plugins.remove('drag')\n }\n }\n this.update()\n }\n\n /**\n * width of scrollbox including the scrollbar (if visible)- this changes the size and not the scale of the box\n * @type {number}\n */\n get boxWidth()\n {\n return this.options.boxWidth\n }\n set boxWidth(value)\n {\n this.options.boxWidth = value\n this.content.screenWidth = value\n this.update()\n }\n\n /**\n * sets overflowX and overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflow()\n {\n return this.options.overflow\n }\n set overflow(value)\n {\n this.options.overflow = value\n this.options.overflowX = value\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * sets overflowX to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowX()\n {\n return this.options.overflowX\n }\n set overflowX(value)\n {\n this.options.overflowX = value\n this.update()\n }\n\n /**\n * sets overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowY()\n {\n return this.options.overflowY\n }\n set overflowY(value)\n {\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * height of scrollbox including the scrollbar (if visible) - this changes the size and not the scale of the box\n * @type {number}\n */\n get boxHeight()\n {\n return this.options.boxHeight\n }\n set boxHeight(value)\n {\n this.options.boxHeight = value\n this.content.screenHeight = value\n this.update()\n }\n\n /**\n * scrollbar size in pixels\n * @type {number}\n */\n get scrollbarSize()\n {\n return this.options.scrollbarSize\n }\n set scrollbarSize(value)\n {\n this.options.scrollbarSize = value\n }\n\n /**\n * width of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentWidth()\n {\n return this.options.boxWidth - (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n }\n\n /**\n * height of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentHeight()\n {\n return this.options.boxHeight - (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n }\n\n /**\n * is the vertical scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarVertical()\n {\n return this._isScrollbarVertical\n }\n\n /**\n * is the horizontal scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarHorizontal()\n {\n return this._isScrollbarHorizontal\n }\n\n /**\n * top coordinate of scrollbar\n */\n get scrollTop()\n {\n return this.content.top\n }\n\n /**\n * left coordinate of scrollbar\n */\n get scrollLeft()\n {\n return this.content.left\n }\n\n /**\n * width of content area\n * if not set then it uses content.width to calculate width\n */\n get scrollWidth()\n {\n return this._scrollWidth || this.content.width\n }\n set scrollWidth(value)\n {\n this._scrollWidth = value\n }\n\n /**\n * height of content area\n * if not set then it uses content.height to calculate height\n */\n get scrollHeight()\n {\n return this._scrollHeight || this.content.height\n }\n set scrollHeight(value)\n {\n this._scrollHeight = value\n }\n\n /**\n * draws scrollbars\n * @private\n */\n _drawScrollbars()\n {\n this._isScrollbarHorizontal = this.overflowX === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowX) !== -1 ? false : this.scrollWidth > this.options.boxWidth\n this._isScrollbarVertical = this.overflowY === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowY) !== -1 ? false : this.scrollHeight > this.options.boxHeight\n this.scrollbar.clear()\n let options = {}\n options.left = 0\n options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0)\n options.top = 0\n options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n this.scrollbarTop = (this.content.top / height) * this.boxHeight\n this.scrollbarTop = this.scrollbarTop < 0 ? 0 : this.scrollbarTop\n this.scrollbarHeight = (this.boxHeight / height) * this.boxHeight\n this.scrollbarHeight = this.scrollbarTop + this.scrollbarHeight > this.boxHeight ? this.boxHeight - this.scrollbarTop : this.scrollbarHeight\n this.scrollbarLeft = (this.content.left / width) * this.boxWidth\n this.scrollbarLeft = this.scrollbarLeft < 0 ? 0 : this.scrollbarLeft\n this.scrollbarWidth = (this.boxWidth / width) * this.boxWidth\n this.scrollbarWidth = this.scrollbarWidth + this.scrollbarLeft > this.boxWidth ? this.boxWidth - this.scrollbarLeft : this.scrollbarWidth\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, 0, this.scrollbarSize, this.boxHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(0, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.boxWidth, this.scrollbarSize)\n .endFill()\n }\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, this.scrollbarTop, this.scrollbarSize, this.scrollbarHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.scrollbarLeft, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.scrollbarWidth, this.scrollbarSize)\n .endFill()\n }\n // this.content.forceHitArea = new PIXI.Rectangle(0, 0 , this.boxWidth, this.boxHeight)\n this.activateFade()\n }\n\n /**\n * draws mask layer\n * @private\n */\n _drawMask()\n {\n this._maskContent\n .beginFill(0)\n .drawRect(0, 0, this.boxWidth, this.boxHeight)\n .endFill()\n this.content.mask = this._maskContent\n }\n\n /**\n * call when scrollbox content changes\n */\n update()\n {\n this.content.mask = null\n this._maskContent.clear()\n if (!this._disabled)\n {\n this._drawScrollbars()\n this._drawMask()\n if (this.options.dragScroll)\n {\n const direction = this.isScrollbarHorizontal && this.isScrollbarVertical ? 'all' : this.isScrollbarHorizontal ? 'x' : 'y'\n if (direction !== null)\n {\n this.content\n .drag({ clampWheel: this.options.clampWheel, direction })\n .clamp({ direction, underflow: this.options.underflow })\n }\n }\n }\n }\n\n /**\n * called on each frame to update fade scrollbars (if enabled)\n * @param {number} elapsed since last frame in milliseconds (usually capped at 16.6667)\n */\n updateLoop(elapsed)\n {\n if (this.fade)\n {\n if (this.fade.wait > 0)\n {\n this.fade.wait -= elapsed\n if (this.fade.wait <= 0)\n {\n elapsed += this.fade.wait\n }\n else\n {\n return\n }\n }\n this.fade.duration += elapsed\n if (this.fade.duration >= this.options.fadeScrollbarTime)\n {\n this.fade = null\n this.scrollbar.alpha = 0\n }\n else\n {\n this.scrollbar.alpha = this.ease(this.fade.duration, 1, -1, this.options.fadeScrollbarTime)\n }\n this.content.dirty = true\n }\n }\n\n /**\n * dirty value (used for optimizing draws) for underlying viewport (scrollbox.content)\n * @type {boolean}\n */\n get dirty()\n {\n return this.content.dirty\n }\n set dirty(value)\n {\n this.content.dirty = value\n }\n\n /**\n * show the scrollbar and restart the timer for fade if options.fade is set\n */\n activateFade()\n {\n if (!this.fade && this.options.fade)\n {\n this.scrollbar.alpha = 1\n this.fade = { wait: this.options.fadeScrollboxWait, duration: 0 }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarDown(e)\n {\n const local = this.toLocal(e.data.global)\n if (this.isScrollbarHorizontal)\n {\n if (local.y > this.boxHeight - this.scrollbarSize)\n {\n if (local.x >= this.scrollbarLeft && local.x <= this.scrollbarLeft + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'horizontal', last: local }\n }\n else\n {\n if (local.x > this.scrollbarLeft)\n {\n this.content.left += this.content.worldScreenWidth\n this.update()\n }\n else\n {\n this.content.left -= this.content.worldScreenWidth\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n if (this.isScrollbarVertical)\n {\n if (local.x > this.boxWidth - this.scrollbarSize)\n {\n if (local.y >= this.scrollbarTop && local.y <= this.scrollbarTop + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'vertical', last: local }\n }\n else\n {\n if (local.y > this.scrollbarTop)\n {\n this.content.top += this.content.worldScreenHeight\n this.update()\n }\n else\n {\n this.content.top -= this.content.worldScreenHeight\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n }\n\n /**\n * handle pointer move on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarMove(e)\n {\n if (this.pointerDown)\n {\n if (this.pointerDown.type === 'horizontal')\n {\n const local = this.toLocal(e.data.global)\n this.content.left += local.x - this.pointerDown.last.x\n this.pointerDown.last = local\n this.update()\n }\n else if (this.pointerDown.type === 'vertical')\n {\n const local = this.toLocal(e.data.global)\n this.content.top += local.y - this.pointerDown.last.y\n this.pointerDown.last = local\n this.update()\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @private\n */\n scrollbarUp()\n {\n this.pointerDown = null\n }\n\n /**\n * resize the mask for the container\n * @param {object} options\n * @param {number} [options.boxWidth] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollWidth] set the width of the inside of the scrollbox (leave null to use content.width)\n * @param {number} [options.scrollHeight] set the height of the inside of the scrollbox (leave null to use content.height)\n */\n resize(options)\n {\n this.options.boxWidth = typeof options.boxWidth !== 'undefined' ? options.boxWidth : this.options.boxWidth\n this.options.boxHeight = typeof options.boxHeight !== 'undefined' ? options.boxHeight : this.options.boxHeight\n if (options.scrollWidth)\n {\n this.scrollWidth = options.scrollWidth\n }\n if (options.scrollHeight)\n {\n this.scrollHeight = options.scrollHeight\n }\n this.content.resize(this.options.boxWidth, this.options.boxHeight, this.scrollWidth, this.scrollHeight)\n this.update()\n }\n\n /**\n * ensure that the bounding box is visible\n * @param {number} x - relative to content's coordinate system\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n ensureVisible(x, y, width, height)\n {\n this.content.ensureVisible(x, y, width, height)\n this._drawScrollbars()\n }\n}"],"names":["penner","factory","module","umd","linear","t","b","c","d","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInSine","Math","cos","PI","easeOutSine","sin","easeInOutSine","easeInExpo","pow","easeOutExpo","easeInOutExpo","easeInCirc","sqrt","easeOutCirc","easeInOutCirc","easeInElastic","a","p","s","abs","asin","easeOutElastic","easeInOutElastic","easeInBack","easeOutBack","easeInOutBack","easeInBounce","easeOutBounce","easeInOutBounce","call","this","scrollboxOptions","boxWidth","boxHeight","scrollbarSize","scrollbarBackground","scrollbarBackgroundAlpha","scrollbarForeground","scrollbarForegroundAlpha","dragScroll","stopPropagation","scrollbarOffsetHorizontal","scrollbarOffsetVertical","underflow","fadeScrollbar","fadeScrollbarTime","fadeScrollboxWait","fadeScrollboxEase","passiveWheel","clampWheel","PIXI.Container","[object Object]","options","super","Object","assign","overflow","overflowX","overflowY","ease","Penner","content","addChild","Viewport","screenWidth","screenHeight","decelerate","on","_drawScrollbars","ticker","pixiNS","PIXI","parseInt","exec","PIXI.VERSION","shared","Ticker","scrollbar","PIXI.Graphics","interactive","scrollbarDown","scrollbarMove","scrollbarUp","_maskContent","update","noTicker","tickerFunction","updateLoop","min","elapsedMS","add","value","disable","_disabled","drag","removePlugin","plugins","remove","contentWidth","isScrollbarVertical","contentHeight","isScrollbarHorizontal","_isScrollbarVertical","_isScrollbarHorizontal","scrollTop","top","scrollLeft","left","scrollWidth","_scrollWidth","width","scrollHeight","_scrollHeight","height","indexOf","clear","right","bottom","scrollbarTop","scrollbarHeight","scrollbarLeft","scrollbarWidth","beginFill","drawRect","endFill","activateFade","mask","_drawMask","direction","clamp","elapsed","fade","wait","duration","alpha","dirty","e","local","toLocal","data","global","y","x","pointerDown","type","last","worldScreenWidth","worldScreenHeight","resize","ensureVisible"],"mappings":"wgBA4BA,WACE,IAAIA,GAEE,SAASC,GAEJC,UAAiBD,GAsO5BE,CA9NAH,EAAS,CACPI,OAAQ,SAASC,EAAGC,EAAGC,EAAGC,GACxB,OAAOD,EAAIF,EAAIG,EAAIF,GAErBG,WAAY,SAASJ,EAAGC,EAAGC,EAAGC,GAC5B,OAAOD,GAAKF,GAAKG,GAAKH,EAAIC,GAE5BI,YAAa,SAASL,EAAGC,EAAGC,EAAGC,GAC7B,OAAQD,GAAKF,GAAKG,IAAMH,EAAI,GAAKC,GAEnCK,cAAe,SAASN,EAAGC,EAAGC,EAAGC,GAC/B,OAAKH,GAAKG,EAAI,GAAK,EACVD,EAAI,EAAIF,EAAIA,EAAIC,GAEfC,EAAI,KAAQF,GAAMA,EAAI,GAAK,GAAKC,GAG5CM,YAAa,SAASP,EAAGC,EAAGC,EAAGC,GAC7B,OAAOD,GAAKF,GAAKG,GAAKH,EAAIA,EAAIC,GAEhCO,aAAc,SAASR,EAAGC,EAAGC,EAAGC,GAC9B,OAAOD,IAAMF,EAAIA,EAAIG,EAAI,GAAKH,EAAIA,EAAI,GAAKC,GAE7CQ,eAAgB,SAAST,EAAGC,EAAGC,EAAGC,GAChC,OAAKH,GAAKG,EAAI,GAAK,EACVD,EAAI,EAAIF,EAAIA,EAAIA,EAAIC,EAEpBC,EAAI,IAAMF,GAAK,GAAKA,EAAIA,EAAI,GAAKC,GAG5CS,YAAa,SAASV,EAAGC,EAAGC,EAAGC,GAC7B,OAAOD,GAAKF,GAAKG,GAAKH,EAAIA,EAA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AAQuF,OAAOtH,KAAKsB,QAAQpB,SAAUF,KAAKsB,QAAQnB,UAAWH,KAAK8E,YAAa9E,KAAKiF,cAC1FjF,KAAKsD,SAUTjC,cAAc2F,EAAGD,EAAG/B,EAAOG,GAEvBnF,KAAK+B,QAAQwF,cAAcP,EAAGD,EAAG/B,EAAOG,GACxCnF,KAAKsC"} \ No newline at end of file +{"version":3,"file":"scrollbox.js","sources":["../node_modules/penner/penner.js","../src/scrollbox.js"],"sourcesContent":["\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n if (typeof exports === 'object') {\n return module.exports = factory;\n } else if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else {\n return this.penner = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if (t === 0) {\n b;\n }\n if (t === d) {\n b + c;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d / 2) === 2) {\n b + c;\n }\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(this);\n","import * as PIXI from 'pixi.js'\nimport { Viewport } from 'pixi-viewport'\nimport Penner from 'penner'\n\nconst scrollboxOptions = {\n 'boxWidth': 100,\n 'boxHeight': 100,\n 'scrollbarSize': 10,\n 'scrollbarBackground': 14540253,\n 'scrollbarBackgroundAlpha': 1,\n 'scrollbarForeground': 8947848,\n 'scrollbarForegroundAlpha': 1,\n 'dragScroll': true,\n 'stopPropagation': true,\n 'scrollbarOffsetHorizontal': 0,\n 'scrollbarOffsetVertical': 0,\n 'underflow': 'top-left',\n 'fadeScrollbar': false,\n 'fadeScrollbarTime': 1000,\n 'fadeScrollboxWait': 3000,\n 'fadeScrollboxEase': 'easeInOutSine',\n 'passiveWheel': false,\n 'clampWheel': true\n}\n\n/**\n * pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars\n */\nexport class Scrollbox extends PIXI.Container\n{\n /**\n * create a scrollbox\n * @param {object} options\n * @param {boolean} [options.dragScroll=true] user may drag the content area to scroll content\n * @param {string} [options.overflowX=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflowY=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflow] (none, scroll, hidden, auto) sets overflowX and overflowY to this value\n * @param {number} [options.boxWidth=100] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight=100] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollbarSize=10] size of scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetHorizontal=0] offset of horizontal scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetVertical=0] offset of vertical scrollbar (in pixels)\n * @param {boolean} [options.stopPropagation=true] call stopPropagation on any events that impact scrollbox\n * @param {number} [options.scrollbarBackground=0xdddddd] background color of scrollbar\n * @param {number} [options.scrollbarBackgroundAlpha=1] alpha of background of scrollbar\n * @param {number} [options.scrollbarForeground=0x888888] foreground color of scrollbar\n * @param {number} [options.scrollbarForegroundAlpha=1] alpha of foreground of scrollbar\n * @param {string} [options.underflow=top-left] what to do when content underflows the scrollbox size: none: do nothing; (left/right/center AND top/bottom/center); OR center (e.g., 'top-left', 'center', 'none', 'bottomright')\n * @param {boolean} [options.noTicker] do not use PIXI.Ticker (for fade to work properly you will need to manually call updateLoop(elapsed) on each frame)\n * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.Ticker for updates\n * @param {boolean} [options.fade] fade the scrollbar when not in use\n * @param {number} [options.fadeScrollbarTime=1000] time to fade scrollbar if options.fade is set\n * @param {number} [options.fadeScrollboxWait=3000] time to wait before fading the scrollbar if options.fade is set\n * @param {(string|function)} [options.fadeScrollboxEase=easeInOutSine] easing function to use for fading\n * @param {boolean} [options.passiveWheel=false] whether wheel events are propogated beyond the scrollbox (NOTE: default is now false)\n * @param {boolean} [options.clampWheel=true] wheel events should be clamped (to avoid weird bounce with mouse wheel)\n */\n constructor(options={})\n {\n super()\n this.options = Object.assign({}, scrollboxOptions, options)\n if (options.overflow) {\n this.options.overflowX = this.options.overflowY = options.overflow\n }\n this.ease = typeof this.options.fadeScrollboxEase === 'function' ? this.options.fadeScrollboxEase : Penner[this.options.fadeScrollboxEase]\n\n /**\n * content in placed in here\n * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/)\n * @type {Viewport}\n */\n this.content = this.addChild(new Viewport({ passiveWheel: this.options.passiveWheel, stopPropagation: this.options.stopPropagation, screenWidth: this.options.boxWidth, screenHeight: this.options.boxHeight }))\n this.content\n .decelerate()\n .on('moved', () => this._drawScrollbars())\n\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\n if (options.ticker)\n {\n this.options.ticker = options.ticker\n }\n else\n {\n // to avoid Rollup transforming our import, save pixi namespace in a variable\n // from here: https://github.com/pixijs/pixi.js/issues/5757\n let ticker\n const pixiNS = PIXI\n if (parseInt(/^(\\d+)\\./.exec(PIXI.VERSION)[1]) < 5)\n {\n ticker = pixiNS.ticker.shared;\n }\n else\n {\n ticker = pixiNS.Ticker.shared;\n }\n this.options.ticker = options.ticker || ticker\n }\n\n /**\n * graphics element for drawing the scrollbars\n * @type {PIXI.Graphics}\n */\n this.scrollbar = this.addChild(new PIXI.Graphics())\n this.scrollbar.interactive = true\n this.scrollbar.on('pointerdown', this.scrollbarDown, this)\n this.interactive = true\n this.on('pointermove', this.scrollbarMove, this)\n this.on('pointerup', this.scrollbarUp, this)\n this.on('pointercancel', this.scrollbarUp, this)\n this.on('pointerupoutside', this.scrollbarUp, this)\n this._maskContent = this.addChild(new PIXI.Graphics())\n this.update()\n\n if (!this.options.noTicker)\n {\n this.tickerFunction = () => this.updateLoop(Math.min(this.options.ticker.elapsedMS, 16.6667))\n this.options.ticker.add(this.tickerFunction)\n }\n }\n\n /**\n * offset of horizontal scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetHorizontal()\n {\n return this.options.scrollbarOffsetHorizontal\n }\n set scrollbarOffsetHorizontal(value)\n {\n this.options.scrollbarOffsetHorizontal = value\n }\n\n /**\n * offset of vertical scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetVertical()\n {\n return this.options.scrollbarOffsetVertical\n }\n set scrollbarOffsetVertical(value)\n {\n this.options.scrollbarOffsetVertical = value\n }\n\n /**\n * disable the scrollbox (if set to true this will also remove the mask)\n * @type {boolean}\n */\n get disable()\n {\n return this._disabled\n }\n set disable(value)\n {\n if (this._disabled !== value)\n {\n this._disabled = value\n this.update()\n }\n }\n\n /**\n * call stopPropagation on any events that impact scrollbox\n * @type {boolean}\n */\n get stopPropagation()\n {\n return this.options.stopPropagation\n }\n set stopPropagation(value)\n {\n this.options.stopPropagation = value\n }\n\n /**\n * user may drag the content area to scroll content\n * @type {boolean}\n */\n get dragScroll()\n {\n return this.options.dragScroll\n }\n set dragScroll(value)\n {\n this.options.dragScroll = value\n if (value)\n {\n this.content.drag()\n }\n else\n {\n if (typeof this.content.removePlugin !== 'undefined')\n {\n this.content.removePlugin('drag')\n }\n else\n {\n this.content.plugins.remove('drag')\n }\n }\n this.update()\n }\n\n /**\n * width of scrollbox including the scrollbar (if visible)- this changes the size and not the scale of the box\n * @type {number}\n */\n get boxWidth()\n {\n return this.options.boxWidth\n }\n set boxWidth(value)\n {\n this.options.boxWidth = value\n this.content.screenWidth = value\n this.update()\n }\n\n /**\n * sets overflowX and overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflow()\n {\n return this.options.overflow\n }\n set overflow(value)\n {\n this.options.overflow = value\n this.options.overflowX = value\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * sets overflowX to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowX()\n {\n return this.options.overflowX\n }\n set overflowX(value)\n {\n this.options.overflowX = value\n this.update()\n }\n\n /**\n * sets overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowY()\n {\n return this.options.overflowY\n }\n set overflowY(value)\n {\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * height of scrollbox including the scrollbar (if visible) - this changes the size and not the scale of the box\n * @type {number}\n */\n get boxHeight()\n {\n return this.options.boxHeight\n }\n set boxHeight(value)\n {\n this.options.boxHeight = value\n this.content.screenHeight = value\n this.update()\n }\n\n /**\n * scrollbar size in pixels\n * @type {number}\n */\n get scrollbarSize()\n {\n return this.options.scrollbarSize\n }\n set scrollbarSize(value)\n {\n this.options.scrollbarSize = value\n }\n\n /**\n * width of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentWidth()\n {\n return this.options.boxWidth - (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n }\n\n /**\n * height of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentHeight()\n {\n return this.options.boxHeight - (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n }\n\n /**\n * is the vertical scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarVertical()\n {\n return this._isScrollbarVertical\n }\n\n /**\n * is the horizontal scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarHorizontal()\n {\n return this._isScrollbarHorizontal\n }\n\n /**\n * top coordinate of scrollbar\n */\n get scrollTop()\n {\n return this.content.top\n }\n set scrollTop(top) {\n this.content.top = top\n this._drawScrollbars()\n }\n\n /**\n * left coordinate of scrollbar\n */\n get scrollLeft()\n {\n return this.content.left\n }\n set scrollLeft(left) {\n this.content.left = left\n this._drawScrollbars()\n }\n\n /**\n * width of content area\n * if not set then it uses content.width to calculate width\n */\n get scrollWidth()\n {\n return this._scrollWidth || this.content.width\n }\n set scrollWidth(value)\n {\n this._scrollWidth = value\n }\n\n /**\n * height of content area\n * if not set then it uses content.height to calculate height\n */\n get scrollHeight()\n {\n return this._scrollHeight || this.content.height\n }\n set scrollHeight(value)\n {\n this._scrollHeight = value\n }\n\n /**\n * draws scrollbars\n * @private\n */\n _drawScrollbars()\n {\n this._isScrollbarHorizontal = this.overflowX === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowX) !== -1 ? false : this.scrollWidth > this.options.boxWidth\n this._isScrollbarVertical = this.overflowY === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowY) !== -1 ? false : this.scrollHeight > this.options.boxHeight\n this.scrollbar.clear()\n let options = {}\n options.left = 0\n options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0)\n options.top = 0\n options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n this.scrollbarTop = (this.content.top / height) * this.boxHeight\n this.scrollbarTop = this.scrollbarTop < 0 ? 0 : this.scrollbarTop\n this.scrollbarHeight = (this.boxHeight / height) * this.boxHeight\n this.scrollbarHeight = this.scrollbarTop + this.scrollbarHeight > this.boxHeight ? this.boxHeight - this.scrollbarTop : this.scrollbarHeight\n this.scrollbarLeft = (this.content.left / width) * this.boxWidth\n this.scrollbarLeft = this.scrollbarLeft < 0 ? 0 : this.scrollbarLeft\n this.scrollbarWidth = (this.boxWidth / width) * this.boxWidth\n this.scrollbarWidth = this.scrollbarWidth + this.scrollbarLeft > this.boxWidth ? this.boxWidth - this.scrollbarLeft : this.scrollbarWidth\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, 0, this.scrollbarSize, this.boxHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(0, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.boxWidth, this.scrollbarSize)\n .endFill()\n }\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, this.scrollbarTop, this.scrollbarSize, this.scrollbarHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.scrollbarLeft, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.scrollbarWidth, this.scrollbarSize)\n .endFill()\n }\n // this.content.forceHitArea = new PIXI.Rectangle(0, 0 , this.boxWidth, this.boxHeight)\n this.activateFade()\n }\n\n /**\n * draws mask layer\n * @private\n */\n _drawMask()\n {\n this._maskContent\n .beginFill(0)\n .drawRect(0, 0, this.boxWidth, this.boxHeight)\n .endFill()\n this.content.mask = this._maskContent\n }\n\n /**\n * call when scrollbox content changes\n */\n update()\n {\n this.content.mask = null\n this._maskContent.clear()\n if (!this._disabled)\n {\n this._drawScrollbars()\n this._drawMask()\n if (this.options.dragScroll)\n {\n const direction = this.isScrollbarHorizontal && this.isScrollbarVertical ? 'all' : this.isScrollbarHorizontal ? 'x' : 'y'\n if (direction !== null)\n {\n this.content\n .drag({ clampWheel: this.options.clampWheel, direction })\n .clamp({ direction, underflow: this.options.underflow })\n }\n }\n }\n }\n\n /**\n * called on each frame to update fade scrollbars (if enabled)\n * @param {number} elapsed since last frame in milliseconds (usually capped at 16.6667)\n */\n updateLoop(elapsed)\n {\n if (this.fade)\n {\n if (this.fade.wait > 0)\n {\n this.fade.wait -= elapsed\n if (this.fade.wait <= 0)\n {\n elapsed += this.fade.wait\n }\n else\n {\n return\n }\n }\n this.fade.duration += elapsed\n if (this.fade.duration >= this.options.fadeScrollbarTime)\n {\n this.fade = null\n this.scrollbar.alpha = 0\n }\n else\n {\n this.scrollbar.alpha = this.ease(this.fade.duration, 1, -1, this.options.fadeScrollbarTime)\n }\n this.content.dirty = true\n }\n }\n\n /**\n * dirty value (used for optimizing draws) for underlying viewport (scrollbox.content)\n * @type {boolean}\n */\n get dirty()\n {\n return this.content.dirty\n }\n set dirty(value)\n {\n this.content.dirty = value\n }\n\n /**\n * show the scrollbar and restart the timer for fade if options.fade is set\n */\n activateFade()\n {\n if (!this.fade && this.options.fade)\n {\n this.scrollbar.alpha = 1\n this.fade = { wait: this.options.fadeScrollboxWait, duration: 0 }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarDown(e)\n {\n const local = this.toLocal(e.data.global)\n if (this.isScrollbarHorizontal)\n {\n if (local.y > this.boxHeight - this.scrollbarSize)\n {\n if (local.x >= this.scrollbarLeft && local.x <= this.scrollbarLeft + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'horizontal', last: local }\n }\n else\n {\n if (local.x > this.scrollbarLeft)\n {\n this.content.left += this.content.worldScreenWidth\n this.update()\n }\n else\n {\n this.content.left -= this.content.worldScreenWidth\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n if (this.isScrollbarVertical)\n {\n if (local.x > this.boxWidth - this.scrollbarSize)\n {\n if (local.y >= this.scrollbarTop && local.y <= this.scrollbarTop + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'vertical', last: local }\n }\n else\n {\n if (local.y > this.scrollbarTop)\n {\n this.content.top += this.content.worldScreenHeight\n this.update()\n }\n else\n {\n this.content.top -= this.content.worldScreenHeight\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n }\n\n /**\n * handle pointer move on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarMove(e)\n {\n if (this.pointerDown)\n {\n if (this.pointerDown.type === 'horizontal')\n {\n const local = this.toLocal(e.data.global)\n this.content.left += local.x - this.pointerDown.last.x\n this.pointerDown.last = local\n this.update()\n }\n else if (this.pointerDown.type === 'vertical')\n {\n const local = this.toLocal(e.data.global)\n this.content.top += local.y - this.pointerDown.last.y\n this.pointerDown.last = local\n this.update()\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @private\n */\n scrollbarUp()\n {\n this.pointerDown = null\n }\n\n /**\n * resize the mask for the container\n * @param {object} options\n * @param {number} [options.boxWidth] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollWidth] set the width of the inside of the scrollbox (leave null to use content.width)\n * @param {number} [options.scrollHeight] set the height of the inside of the scrollbox (leave null to use content.height)\n */\n resize(options)\n {\n this.options.boxWidth = typeof options.boxWidth !== 'undefined' ? options.boxWidth : this.options.boxWidth\n this.options.boxHeight = typeof options.boxHeight !== 'undefined' ? options.boxHeight : this.options.boxHeight\n if (options.scrollWidth)\n {\n this.scrollWidth = options.scrollWidth\n }\n if (options.scrollHeight)\n {\n this.scrollHeight = options.scrollHeight\n }\n this.content.resize(this.options.boxWidth, this.options.boxHeight, this.scrollWidth, this.scrollHeight)\n this.update()\n }\n\n /**\n * ensure that the bounding box is visible\n * @param {number} x - relative to content's coordinate system\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n ensureVisible(x, y, width, height)\n {\n this.content.ensureVisible(x, y, width, height)\n this._drawScrollbars()\n }\n}"],"names":["penner","factory","module","umd","linear","t","b","c","d","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInSine","Math","cos","PI","easeOutSine","sin","easeInOutSine","easeInExpo","pow","easeOutExpo","easeInOutExpo","easeInCirc","sqrt","easeOutCirc","easeInOutCirc","easeInElastic","a","p","s","abs","asin","easeOutElastic","easeInOutElastic","easeInBack","easeOutBack","easeInOutBack","easeInBounce","easeOutBounce","easeInOutBounce","call","this","scrollboxOptions","boxWidth","boxHeight","scrollbarSize","scrollbarBackground","scrollbarBackgroundAlpha","scrollbarForeground","scrollbarForegroundAlpha","dragScroll","stopPropagation","scrollbarOffsetHorizontal","scrollbarOffsetVertical","underflow","fadeScrollbar","fadeScrollbarTime","fadeScrollboxWait","fadeScrollboxEase","passiveWheel","clampWheel","PIXI.Container","[object Object]","options","super","Object","assign","overflow","overflowX","overflowY","ease","Penner","content","addChild","Viewport","screenWidth","screenHeight","decelerate","on","_drawScrollbars","ticker","pixiNS","PIXI","parseInt","exec","PIXI.VERSION","shared","Ticker","scrollbar","PIXI.Graphics","interactive","scrollbarDown","scrollbarMove","scrollbarUp","_maskContent","update","noTicker","tickerFunction","updateLoop","min","elapsedMS","add","value","disable","_disabled","drag","removePlugin","plugins","remove","contentWidth","isScrollbarVertical","contentHeight","isScrollbarHorizontal","_isScrollbarVertical","_isScrollbarHorizontal","scrollTop","top","scrollLeft","left","scrollWidth","_scrollWidth","width","scrollHeight","_scrollHeight","height","indexOf","clear","right","bottom","scrollbarTop","scrollbarHeight","scrollbarLeft","scrollbarWidth","beginFill","drawRect","endFill","activateFade","mask","_drawMask","direction","clamp","elapsed","fade","wait","duration","alpha","dirty","e","local","toLocal","data","global","y","x","pointerDown","type","last","worldScreenWidth","worldScreenHeight","resize","ensureVisible"],"mappings":"wgBA4BA,WACE,IAAIA,GAEE,SAASC,GAEJC,UAAiBD,GAsO5BE,CA9NAH,EAAS,CACPI,OAAQ,SAASC,EAAGC,EAAGC,EAAGC,GACxB,OAAOD,EAAIF,EAAIG,EAAIF,GAErBG,WAAY,SAASJ,EAAGC,EAAGC,EAAGC,GAC5B,OAAOD,GAAKF,GAAKG,GAAKH,EAAIC,GAE5BI,YAAa,SAASL,EAAGC,EAAGC,EAAGC,GAC7B,OAAQD,GAAKF,GAAKG,IAAMH,EAAI,GAAKC,GAEnCK,cAAe,SAASN,EAAGC,EAAGC,EAAGC,GAC/B,OAAKH,GAAKG,EAAI,GAAK,EACVD,EAAI,EAAIF,EAAIA,EAAIC,GAEfC,EAAI,KAAQF,GAAMA,EAAI,GAAK,GAAKC,GAG5CM,YAAa,SAASP,EAAGC,EAAGC,EAAGC,GAC7B,OAAOD,GAAKF,GAAKG,GAAKH,EAAIA,EAAIC,GAEhCO,aAAc,SAASR,EAAGC,EAAGC,EAAGC,GAC9B,OAAOD,IAAMF,EAAIA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,KAAKiH,YAAYE,KAAOR,EACxB3G,KAAKsD,SAELtD,KAAKsB,QAAQZ,iBAEbgG,EAAEhG,mBASdW,cAEIrB,KAAKiH,YAAc,KAWvB5F,OAAOC,GAEHtB,KAAKsB,QAAQpB,cAAuC,IAArBoB,EAAQpB,SAA2BoB,EAAQpB,SAAWF,KAAKsB,QAAQpB,SAClGF,KAAKsB,QAAQnB,eAAyC,IAAtBmB,EAAQnB,UAA4BmB,EAAQnB,UAAYH,KAAKsB,QAAQnB,UACjGmB,EAAQwD,cAER9E,KAAK8E,YAAcxD,EAAQwD,aAE3BxD,EAAQ2D,eAERjF,KAAKiF,aAAe3D,EAAQ2D,cAEhCjF,KAAK+B,QAAQuF,OAAOtH,KAAKsB,QAAQpB,SAAUF,KAAKsB,QAAQnB,UAAWH,KAAK8E,YAAa9E,KAAKiF,cAC1FjF,KAAKsD,SAUTjC,cAAc2F,EAAGD,EAAG/B,EAAOG,GAEvBnF,KAAK+B,QAAQwF,cAAcP,EAAGD,EAAG/B,EAAOG,GACxCnF,KAAKsC"} \ No newline at end of file diff --git a/docs/index.js b/docs/index.js index 2e51f64..6794583 100644 --- a/docs/index.js +++ b/docs/index.js @@ -598,7 +598,6 @@ { window.Int32Array = Array; } - //# sourceMappingURL=polyfill.es.js.map 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,l=/\bAndroid(?:.+)SD4930UR\b/i,b=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,f=/Windows Phone/i,u=/\bWindows(?:.+)ARM\b/i,c=/BlackBerry/i,s=/BB10/i,v=/Opera Mini/i,h=/\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(l,i),tablet:!m(l,i)&&m(b,i),device:m(l,i)||m(b,i)},android:{phone:!m(f,i)&&m(l,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(l,i)&&!m(a,i)&&(m(b,i)||m(p,i)),device:!m(f,i)&&(m(l,i)||m(b,i)||m(a,i)||m(p,i))},windows:{phone:m(f,i),tablet:m(u,i),device:m(f,i)||m(u,i)},other:{blackberry:m(c,i),blackberry10:m(s,i),opera:m(v,i),firefox:m(w,i),chrome:m(h,i),device:m(c,i)||m(s,i)||m(v,i)||m(w,i)||m(h,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}module.exports&&"undefined"==typeof window?module.exports=i:module.exports&&"undefined"!=typeof window?module.exports=i():e.isMobile=i();}(commonjsGlobal); @@ -915,7 +914,6 @@ */ ROUND_PIXELS: false, }; - //# sourceMappingURL=settings.es.js.map var eventemitter3 = createCommonjsModule(function (module) { @@ -3480,7 +3478,6 @@ MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; })(MASK_TYPES || (MASK_TYPES = {})); - //# sourceMappingURL=constants.es.js.map /*! * @pixi/utils - v5.2.0 @@ -4435,7 +4432,6 @@ warnings[message] = true; } - //# sourceMappingURL=utils.es.js.map var utils_es = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -6376,7 +6372,6 @@ }; return RoundedRectangle; }()); - //# sourceMappingURL=math.es.js.map /*! * @pixi/display - v5.2.0 @@ -8270,7 +8265,6 @@ // performance increase to avoid using call.. (10x faster) Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; - //# sourceMappingURL=display.es.js.map /*! * @pixi/accessibility - v5.2.0 @@ -8957,7 +8951,6 @@ this.children = null; this.renderer = null; }; - //# sourceMappingURL=accessibility.es.js.map var accessibility_es = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -9160,7 +9153,6 @@ */ run: { value: Runner.prototype.emit }, }); - //# sourceMappingURL=runner.es.js.map /*! * @pixi/ticker - v5.2.0 @@ -9983,7 +9975,6 @@ }; return TickerPlugin; }()); - //# sourceMappingURL=ticker.es.js.map /*! * @pixi/core - v5.2.0 @@ -23020,7 +23011,6 @@ // Setup the default BatchRenderer plugin, this is what // we'll actually export at the root level var BatchRenderer = BatchPluginFactory.create(); - //# sourceMappingURL=core.es.js.map /*! * @pixi/extract - v5.2.0 @@ -23292,7 +23282,6 @@ } } }; - //# sourceMappingURL=extract.es.js.map var extract_es = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -25803,7 +25792,6 @@ return InteractionManager; }(eventemitter3)); - //# sourceMappingURL=interaction.es.js.map var interaction_es = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -29619,7 +29607,6 @@ * @member {PIXI.Point} */ Graphics._TEMP_POINT = new Point(); - //# sourceMappingURL=graphics.es.js.map /*! * @pixi/sprite - v5.2.0 @@ -30295,7 +30282,6 @@ return Sprite; }(Container)); - //# sourceMappingURL=sprite.es.js.map /*! * @pixi/text - v5.2.0 @@ -32567,7 +32553,6 @@ return Text; }(Sprite)); - //# sourceMappingURL=text.es.js.map /*! * @pixi/prepare - v5.2.0 @@ -33272,7 +33257,6 @@ { return Date.now() - this.frameStart < this.maxMilliseconds; }; - //# sourceMappingURL=prepare.es.js.map var prepare_es = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -33506,7 +33490,6 @@ }; Application.registerPlugin(ResizePlugin); - //# sourceMappingURL=app.es.js.map var parseUri = function parseURI (str, opts) { opts = opts || {}; @@ -36032,7 +36015,6 @@ return Loader; }; - //# sourceMappingURL=resource-loader.esm.js.map /*! * @pixi/loaders - v5.2.0 @@ -36334,7 +36316,6 @@ * @memberof PIXI */ var LoaderResource = Resource$1; - //# sourceMappingURL=loaders.es.js.map /*! * @pixi/particles - v5.2.0 @@ -37303,7 +37284,6 @@ return ParticleRenderer; }(ObjectRenderer)); - //# sourceMappingURL=particles.es.js.map /*! * @pixi/spritesheet - v5.2.0 @@ -37712,7 +37692,6 @@ return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); }; - //# sourceMappingURL=spritesheet.es.js.map /*! * @pixi/sprite-tiling - v5.2.0 @@ -38209,7 +38188,6 @@ return TilingSpriteRenderer; }(ObjectRenderer)); - //# sourceMappingURL=sprite-tiling.es.js.map /*! * @pixi/text-bitmap - v5.2.0 @@ -39035,7 +39013,6 @@ } } }; - //# sourceMappingURL=text-bitmap.es.js.map /*! * @pixi/filter-alpha - v5.2.0 @@ -39100,7 +39077,6 @@ return AlphaFilter; }(Filter)); - //# sourceMappingURL=filter-alpha.es.js.map /*! * @pixi/filter-blur - v5.2.0 @@ -39526,7 +39502,6 @@ return BlurFilter; }(Filter)); - //# sourceMappingURL=filter-blur.es.js.map /*! * @pixi/filter-color-matrix - v5.2.0 @@ -40125,7 +40100,6 @@ // Americanized alias ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; - //# sourceMappingURL=filter-color-matrix.es.js.map /*! * @pixi/filter-displacement - v5.2.0 @@ -40243,7 +40217,6 @@ return DisplacementFilter; }(Filter)); - //# sourceMappingURL=filter-displacement.es.js.map /*! * @pixi/filter-fxaa - v5.2.0 @@ -40281,7 +40254,6 @@ return FXAAFilter; }(Filter)); - //# sourceMappingURL=filter-fxaa.es.js.map /*! * @pixi/filter-noise - v5.2.0 @@ -40361,7 +40333,6 @@ return NoiseFilter; }(Filter)); - //# sourceMappingURL=filter-noise.es.js.map /*! * @pixi/mixin-cache-as-bitmap - v5.2.0 @@ -40787,7 +40758,6 @@ this.cacheAsBitmap = false; this.destroy(options); }; - //# sourceMappingURL=mixin-cache-as-bitmap.es.js.map /*! * @pixi/mixin-get-child-by-name - v5.2.0 @@ -40825,7 +40795,6 @@ return null; }; - //# sourceMappingURL=mixin-get-child-by-name.es.js.map /*! * @pixi/mixin-get-global-position - v5.2.0 @@ -40863,7 +40832,6 @@ return point; }; - //# sourceMappingURL=mixin-get-global-position.es.js.map /*! * @pixi/mesh - v5.2.0 @@ -41642,7 +41610,6 @@ return MeshGeometry; }(Geometry)); - //# sourceMappingURL=mesh.es.js.map /*! * @pixi/mesh-extras - v5.2.0 @@ -42433,7 +42400,6 @@ return NineSlicePlane; }(SimplePlane)); - //# sourceMappingURL=mesh-extras.es.js.map /*! * @pixi/sprite-animated - v5.2.0 @@ -42876,7 +42842,6 @@ return AnimatedSprite; }(Sprite)); - //# sourceMappingURL=sprite-animated.es.js.map /*! * pixi.js - v5.2.0 @@ -44214,7 +44179,6 @@ FXAAFilter: FXAAFilter, NoiseFilter: NoiseFilter, }; - //# sourceMappingURL=pixi.es.js.map var PIXI = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -51015,8 +50979,7 @@ this.bottom = y + height; } } - } - //# sourceMappingURL=viewport.es.js.map + } var penner$1 = createCommonjsModule(function (module, exports) { /* diff --git a/docs/index.js.map b/docs/index.js.map index 655dae6..2cc268f 100644 --- a/docs/index.js.map +++ b/docs/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../node_modules/rollup-plugin-node-globals/src/global.js","../node_modules/es6-promise-polyfill/promise.js","../node_modules/object-assign/index.js","../node_modules/@pixi/polyfill/lib/polyfill.es.js","../node_modules/ismobilejs/dist/isMobile.min.js","../node_modules/@pixi/settings/lib/settings.es.js","../node_modules/eventemitter3/index.js","../node_modules/earcut/src/earcut.js","../node_modules/@joseph184/rollup-plugin-node-builtins/src/es6/punycode.js","../node_modules/process-es6/browser.js","../node_modules/@joseph184/rollup-plugin-node-builtins/src/es6/util.js","../node_modules/@joseph184/rollup-plugin-node-builtins/src/es6/qs.js","../node_modules/@joseph184/rollup-plugin-node-builtins/src/es6/url.js","../node_modules/@pixi/constants/lib/constants.es.js","../node_modules/@pixi/utils/lib/utils.es.js","../node_modules/@pixi/math/lib/math.es.js","../node_modules/@pixi/display/lib/display.es.js","../node_modules/@pixi/accessibility/lib/accessibility.es.js","../node_modules/@pixi/runner/lib/runner.es.js","../node_modules/@pixi/ticker/lib/ticker.es.js","../node_modules/@pixi/core/lib/core.es.js","../node_modules/@pixi/extract/lib/extract.es.js","../node_modules/@pixi/interaction/lib/interaction.es.js","../node_modules/@pixi/graphics/lib/graphics.es.js","../node_modules/@pixi/sprite/lib/sprite.es.js","../node_modules/@pixi/text/lib/text.es.js","../node_modules/@pixi/prepare/lib/prepare.es.js","../node_modules/@pixi/app/lib/app.es.js","../node_modules/parse-uri/index.js","../node_modules/mini-signals/lib/mini-signals.js","../node_modules/resource-loader/dist/resource-loader.esm.js","../node_modules/@pixi/loaders/lib/loaders.es.js","../node_modules/@pixi/particles/lib/particles.es.js","../node_modules/@pixi/spritesheet/lib/spritesheet.es.js","../node_modules/@pixi/sprite-tiling/lib/sprite-tiling.es.js","../node_modules/@pixi/text-bitmap/lib/text-bitmap.es.js","../node_modules/@pixi/filter-alpha/lib/filter-alpha.es.js","../node_modules/@pixi/filter-blur/lib/filter-blur.es.js","../node_modules/@pixi/filter-color-matrix/lib/filter-color-matrix.es.js","../node_modules/@pixi/filter-displacement/lib/filter-displacement.es.js","../node_modules/@pixi/filter-fxaa/lib/filter-fxaa.es.js","../node_modules/@pixi/filter-noise/lib/filter-noise.es.js","../node_modules/@pixi/mixin-cache-as-bitmap/lib/mixin-cache-as-bitmap.es.js","../node_modules/@pixi/mixin-get-child-by-name/lib/mixin-get-child-by-name.es.js","../node_modules/@pixi/mixin-get-global-position/lib/mixin-get-global-position.es.js","../node_modules/@pixi/mesh/lib/mesh.es.js","../node_modules/@pixi/mesh-extras/lib/mesh-extras.es.js","../node_modules/@pixi/sprite-animated/lib/sprite-animated.es.js","../node_modules/pixi.js/lib/pixi.es.js","../node_modules/tinycolor2/tinycolor.js","../node_modules/yy-counter/counter.js","../node_modules/yy-fps/index.js","../node_modules/seedrandom/lib/alea.js","../node_modules/seedrandom/lib/xor128.js","../node_modules/seedrandom/lib/xorwow.js","../node_modules/seedrandom/lib/xorshift7.js","../node_modules/seedrandom/lib/xor4096.js","../node_modules/seedrandom/lib/tychei.js","../node_modules/@joseph184/rollup-plugin-node-builtins/src/es6/empty.js","../node_modules/seedrandom/seedrandom.js","../node_modules/seedrandom/index.js","../node_modules/yy-random/index.js","../node_modules/pixi-viewport/dist/viewport.es.js","../node_modules/penner/penner.js","../src/scrollbox.js","../node_modules/fork-me-github/dist/index.js","../node_modules/highlight.js/lib/highlight.js","../node_modules/highlight.js/lib/languages/1c.js","../node_modules/highlight.js/lib/languages/abnf.js","../node_modules/highlight.js/lib/languages/accesslog.js","../node_modules/highlight.js/lib/languages/actionscript.js","../node_modules/highlight.js/lib/languages/ada.js","../node_modules/highlight.js/lib/languages/angelscript.js","../node_modules/highlight.js/lib/languages/apache.js","../node_modules/highlight.js/lib/languages/applescript.js","../node_modules/highlight.js/lib/languages/arcade.js","../node_modules/highlight.js/lib/languages/cpp.js","../node_modules/highlight.js/lib/languages/arduino.js","../node_modules/highlight.js/lib/languages/armasm.js","../node_modules/highlight.js/lib/languages/xml.js","../node_modules/highlight.js/lib/languages/asciidoc.js","../node_modules/highlight.js/lib/languages/aspectj.js","../node_modules/highlight.js/lib/languages/autohotkey.js","../node_modules/highlight.js/lib/languages/autoit.js","../node_modules/highlight.js/lib/languages/avrasm.js","../node_modules/highlight.js/lib/languages/awk.js","../node_modules/highlight.js/lib/languages/axapta.js","../node_modules/highlight.js/lib/languages/bash.js","../node_modules/highlight.js/lib/languages/basic.js","../node_modules/highlight.js/lib/languages/bnf.js","../node_modules/highlight.js/lib/languages/brainfuck.js","../node_modules/highlight.js/lib/languages/cal.js","../node_modules/highlight.js/lib/languages/capnproto.js","../node_modules/highlight.js/lib/languages/ceylon.js","../node_modules/highlight.js/lib/languages/clean.js","../node_modules/highlight.js/lib/languages/clojure.js","../node_modules/highlight.js/lib/languages/clojure-repl.js","../node_modules/highlight.js/lib/languages/cmake.js","../node_modules/highlight.js/lib/languages/coffeescript.js","../node_modules/highlight.js/lib/languages/coq.js","../node_modules/highlight.js/lib/languages/cos.js","../node_modules/highlight.js/lib/languages/crmsh.js","../node_modules/highlight.js/lib/languages/crystal.js","../node_modules/highlight.js/lib/languages/cs.js","../node_modules/highlight.js/lib/languages/csp.js","../node_modules/highlight.js/lib/languages/css.js","../node_modules/highlight.js/lib/languages/d.js","../node_modules/highlight.js/lib/languages/markdown.js","../node_modules/highlight.js/lib/languages/dart.js","../node_modules/highlight.js/lib/languages/delphi.js","../node_modules/highlight.js/lib/languages/diff.js","../node_modules/highlight.js/lib/languages/django.js","../node_modules/highlight.js/lib/languages/dns.js","../node_modules/highlight.js/lib/languages/dockerfile.js","../node_modules/highlight.js/lib/languages/dos.js","../node_modules/highlight.js/lib/languages/dsconfig.js","../node_modules/highlight.js/lib/languages/dts.js","../node_modules/highlight.js/lib/languages/dust.js","../node_modules/highlight.js/lib/languages/ebnf.js","../node_modules/highlight.js/lib/languages/elixir.js","../node_modules/highlight.js/lib/languages/elm.js","../node_modules/highlight.js/lib/languages/ruby.js","../node_modules/highlight.js/lib/languages/erb.js","../node_modules/highlight.js/lib/languages/erlang-repl.js","../node_modules/highlight.js/lib/languages/erlang.js","../node_modules/highlight.js/lib/languages/excel.js","../node_modules/highlight.js/lib/languages/fix.js","../node_modules/highlight.js/lib/languages/flix.js","../node_modules/highlight.js/lib/languages/fortran.js","../node_modules/highlight.js/lib/languages/fsharp.js","../node_modules/highlight.js/lib/languages/gams.js","../node_modules/highlight.js/lib/languages/gauss.js","../node_modules/highlight.js/lib/languages/gcode.js","../node_modules/highlight.js/lib/languages/gherkin.js","../node_modules/highlight.js/lib/languages/glsl.js","../node_modules/highlight.js/lib/languages/gml.js","../node_modules/highlight.js/lib/languages/go.js","../node_modules/highlight.js/lib/languages/golo.js","../node_modules/highlight.js/lib/languages/gradle.js","../node_modules/highlight.js/lib/languages/groovy.js","../node_modules/highlight.js/lib/languages/haml.js","../node_modules/highlight.js/lib/languages/handlebars.js","../node_modules/highlight.js/lib/languages/haskell.js","../node_modules/highlight.js/lib/languages/haxe.js","../node_modules/highlight.js/lib/languages/hsp.js","../node_modules/highlight.js/lib/languages/htmlbars.js","../node_modules/highlight.js/lib/languages/http.js","../node_modules/highlight.js/lib/languages/hy.js","../node_modules/highlight.js/lib/languages/inform7.js","../node_modules/highlight.js/lib/languages/ini.js","../node_modules/highlight.js/lib/languages/irpf90.js","../node_modules/highlight.js/lib/languages/isbl.js","../node_modules/highlight.js/lib/languages/java.js","../node_modules/highlight.js/lib/languages/javascript.js","../node_modules/highlight.js/lib/languages/jboss-cli.js","../node_modules/highlight.js/lib/languages/json.js","../node_modules/highlight.js/lib/languages/julia.js","../node_modules/highlight.js/lib/languages/julia-repl.js","../node_modules/highlight.js/lib/languages/kotlin.js","../node_modules/highlight.js/lib/languages/lasso.js","../node_modules/highlight.js/lib/languages/ldif.js","../node_modules/highlight.js/lib/languages/leaf.js","../node_modules/highlight.js/lib/languages/less.js","../node_modules/highlight.js/lib/languages/lisp.js","../node_modules/highlight.js/lib/languages/livecodeserver.js","../node_modules/highlight.js/lib/languages/livescript.js","../node_modules/highlight.js/lib/languages/llvm.js","../node_modules/highlight.js/lib/languages/lsl.js","../node_modules/highlight.js/lib/languages/lua.js","../node_modules/highlight.js/lib/languages/makefile.js","../node_modules/highlight.js/lib/languages/mathematica.js","../node_modules/highlight.js/lib/languages/matlab.js","../node_modules/highlight.js/lib/languages/maxima.js","../node_modules/highlight.js/lib/languages/mel.js","../node_modules/highlight.js/lib/languages/mercury.js","../node_modules/highlight.js/lib/languages/mipsasm.js","../node_modules/highlight.js/lib/languages/mizar.js","../node_modules/highlight.js/lib/languages/perl.js","../node_modules/highlight.js/lib/languages/mojolicious.js","../node_modules/highlight.js/lib/languages/monkey.js","../node_modules/highlight.js/lib/languages/moonscript.js","../node_modules/highlight.js/lib/languages/n1ql.js","../node_modules/highlight.js/lib/languages/nginx.js","../node_modules/highlight.js/lib/languages/nimrod.js","../node_modules/highlight.js/lib/languages/nix.js","../node_modules/highlight.js/lib/languages/nsis.js","../node_modules/highlight.js/lib/languages/objectivec.js","../node_modules/highlight.js/lib/languages/ocaml.js","../node_modules/highlight.js/lib/languages/openscad.js","../node_modules/highlight.js/lib/languages/oxygene.js","../node_modules/highlight.js/lib/languages/parser3.js","../node_modules/highlight.js/lib/languages/pf.js","../node_modules/highlight.js/lib/languages/pgsql.js","../node_modules/highlight.js/lib/languages/php.js","../node_modules/highlight.js/lib/languages/plaintext.js","../node_modules/highlight.js/lib/languages/pony.js","../node_modules/highlight.js/lib/languages/powershell.js","../node_modules/highlight.js/lib/languages/processing.js","../node_modules/highlight.js/lib/languages/profile.js","../node_modules/highlight.js/lib/languages/prolog.js","../node_modules/highlight.js/lib/languages/properties.js","../node_modules/highlight.js/lib/languages/protobuf.js","../node_modules/highlight.js/lib/languages/puppet.js","../node_modules/highlight.js/lib/languages/purebasic.js","../node_modules/highlight.js/lib/languages/python.js","../node_modules/highlight.js/lib/languages/q.js","../node_modules/highlight.js/lib/languages/qml.js","../node_modules/highlight.js/lib/languages/r.js","../node_modules/highlight.js/lib/languages/reasonml.js","../node_modules/highlight.js/lib/languages/rib.js","../node_modules/highlight.js/lib/languages/roboconf.js","../node_modules/highlight.js/lib/languages/routeros.js","../node_modules/highlight.js/lib/languages/rsl.js","../node_modules/highlight.js/lib/languages/ruleslanguage.js","../node_modules/highlight.js/lib/languages/rust.js","../node_modules/highlight.js/lib/languages/sas.js","../node_modules/highlight.js/lib/languages/scala.js","../node_modules/highlight.js/lib/languages/scheme.js","../node_modules/highlight.js/lib/languages/scilab.js","../node_modules/highlight.js/lib/languages/scss.js","../node_modules/highlight.js/lib/languages/shell.js","../node_modules/highlight.js/lib/languages/smali.js","../node_modules/highlight.js/lib/languages/smalltalk.js","../node_modules/highlight.js/lib/languages/sml.js","../node_modules/highlight.js/lib/languages/sqf.js","../node_modules/highlight.js/lib/languages/sql.js","../node_modules/highlight.js/lib/languages/stan.js","../node_modules/highlight.js/lib/languages/stata.js","../node_modules/highlight.js/lib/languages/step21.js","../node_modules/highlight.js/lib/languages/stylus.js","../node_modules/highlight.js/lib/languages/subunit.js","../node_modules/highlight.js/lib/languages/swift.js","../node_modules/highlight.js/lib/languages/taggerscript.js","../node_modules/highlight.js/lib/languages/yaml.js","../node_modules/highlight.js/lib/languages/tap.js","../node_modules/highlight.js/lib/languages/tcl.js","../node_modules/highlight.js/lib/languages/tex.js","../node_modules/highlight.js/lib/languages/thrift.js","../node_modules/highlight.js/lib/languages/tp.js","../node_modules/highlight.js/lib/languages/twig.js","../node_modules/highlight.js/lib/languages/typescript.js","../node_modules/highlight.js/lib/languages/vala.js","../node_modules/highlight.js/lib/languages/vbnet.js","../node_modules/highlight.js/lib/languages/vbscript.js","../node_modules/highlight.js/lib/languages/vbscript-html.js","../node_modules/highlight.js/lib/languages/verilog.js","../node_modules/highlight.js/lib/languages/vhdl.js","../node_modules/highlight.js/lib/languages/vim.js","../node_modules/highlight.js/lib/languages/x86asm.js","../node_modules/highlight.js/lib/languages/xl.js","../node_modules/highlight.js/lib/languages/xquery.js","../node_modules/highlight.js/lib/languages/zephir.js","../node_modules/highlight.js/lib/index.js","highlight.js","code.js"],"sourcesContent":["export default (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});\n","(function(global){\n\n//\n// Check for native Promise and it has correct interface\n//\n\nvar NativePromise = global['Promise'];\nvar nativePromiseSupported =\n NativePromise &&\n // Some of these methods are missing from\n // Firefox/Chrome experimental implementations\n 'resolve' in NativePromise &&\n 'reject' in NativePromise &&\n 'all' in NativePromise &&\n 'race' in NativePromise &&\n // Older version of the spec had a resolver object\n // as the arg rather than a function\n (function(){\n var resolve;\n new NativePromise(function(r){ resolve = r; });\n return typeof resolve === 'function';\n })();\n\n\n//\n// export if necessary\n//\n\nif (typeof exports !== 'undefined' && exports)\n{\n // node.js\n exports.Promise = nativePromiseSupported ? NativePromise : Promise;\n exports.Polyfill = Promise;\n}\nelse\n{\n // AMD\n if (typeof define == 'function' && define.amd)\n {\n define(function(){\n return nativePromiseSupported ? NativePromise : Promise;\n });\n }\n else\n {\n // in browser add to global\n if (!nativePromiseSupported)\n global['Promise'] = Promise;\n }\n}\n\n\n//\n// Polyfill\n//\n\nvar PENDING = 'pending';\nvar SEALED = 'sealed';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\nvar NOOP = function(){};\n\nfunction isArray(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n}\n\n// async calls\nvar asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush(){\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++)\n asyncQueue[i][0](asyncQueue[i][1]);\n\n // reset async asyncQueue\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg){\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer)\n {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch(e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber){\n var owner = subscriber.owner;\n var settled = owner.state_;\n var value = owner.data_; \n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function')\n {\n settled = FULFILLED;\n try {\n value = callback(value);\n } catch(e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value))\n {\n if (settled === FULFILLED)\n resolve(promise, value);\n\n if (settled === REJECTED)\n reject(promise, value);\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value)\n throw new TypeError('A promises callback cannot return that same promise.');\n\n if (value && (typeof value === 'function' || typeof value === 'object'))\n {\n var then = value.then; // then should be retrived only once\n\n if (typeof then === 'function')\n {\n then.call(value, function(val){\n if (!resolved)\n {\n resolved = true;\n\n if (value !== val)\n resolve(promise, val);\n else\n fulfill(promise, val);\n }\n }, function(reason){\n if (!resolved)\n {\n resolved = true;\n\n reject(promise, reason);\n }\n });\n\n return true;\n }\n }\n } catch (e) {\n if (!resolved)\n reject(promise, e);\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value){\n if (promise === value || !handleThenable(promise, value))\n fulfill(promise, value);\n}\n\nfunction fulfill(promise, value){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = value;\n\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = reason;\n\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n var callbacks = promise.then_;\n promise.then_ = undefined;\n\n for (var i = 0; i < callbacks.length; i++) {\n invokeCallback(callbacks[i]);\n }\n}\n\nfunction publishFulfillment(promise){\n promise.state_ = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise){\n promise.state_ = REJECTED;\n publish(promise);\n}\n\n/**\n* @class\n*/\nfunction Promise(resolver){\n if (typeof resolver !== 'function')\n throw new TypeError('Promise constructor takes a function argument');\n\n if (this instanceof Promise === false)\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n\n this.then_ = [];\n\n invokeResolver(resolver, this);\n}\n\nPromise.prototype = {\n constructor: Promise,\n\n state_: PENDING,\n then_: null,\n data_: undefined,\n\n then: function(onFulfillment, onRejection){\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if (this.state_ === FULFILLED || this.state_ === REJECTED)\n {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n }\n else\n {\n // subscribe\n this.then_.push(subscriber);\n }\n\n return subscriber.then;\n },\n\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nPromise.all = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.all().');\n\n return new Class(function(resolve, reject){\n var results = [];\n var remaining = 0;\n\n function resolver(index){\n remaining++;\n return function(value){\n results[index] = value;\n if (!--remaining)\n resolve(results);\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolver(i), reject);\n else\n results[i] = promise;\n }\n\n if (!remaining)\n resolve(results);\n });\n};\n\nPromise.race = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.race().');\n\n return new Class(function(resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolve, reject);\n else\n resolve(promise);\n }\n });\n};\n\nPromise.resolve = function(value){\n var Class = this;\n\n if (value && typeof value === 'object' && value.constructor === Class)\n return value;\n\n return new Class(function(resolve){\n resolve(value);\n });\n};\n\nPromise.reject = function(reason){\n var Class = this;\n\n return new Class(function(resolve, reject){\n reject(reason);\n });\n};\n\n})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : this);\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/*!\n * @pixi/polyfill - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/polyfill is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Polyfill } from 'es6-promise-polyfill';\nimport objectAssign from 'object-assign';\n\n// Support for IE 9 - 11 which does not include Promises\nif (!window.Promise)\n{\n window.Promise = Polyfill;\n}\n\n// References:\n\nif (!Object.assign)\n{\n Object.assign = objectAssign;\n}\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\n\nvar ONE_FRAME_TIME = 16;\n\n// Date.now\nif (!(Date.now && Date.prototype.getTime))\n{\n Date.now = function now()\n {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(commonjsGlobal.performance && commonjsGlobal.performance.now))\n{\n var startTime = Date.now();\n\n if (!commonjsGlobal.performance)\n {\n commonjsGlobal.performance = {};\n }\n\n commonjsGlobal.performance.now = function () { return Date.now() - startTime; };\n}\n\n// requestAnimationFrame\nvar lastTime = Date.now();\nvar vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (var x = 0; x < vendors.length && !commonjsGlobal.requestAnimationFrame; ++x)\n{\n var p = vendors[x];\n\n commonjsGlobal.requestAnimationFrame = commonjsGlobal[(p + \"RequestAnimationFrame\")];\n commonjsGlobal.cancelAnimationFrame = commonjsGlobal[(p + \"CancelAnimationFrame\")] || commonjsGlobal[(p + \"CancelRequestAnimationFrame\")];\n}\n\nif (!commonjsGlobal.requestAnimationFrame)\n{\n commonjsGlobal.requestAnimationFrame = function (callback) {\n if (typeof callback !== 'function')\n {\n throw new TypeError((callback + \"is not a function\"));\n }\n\n var currentTime = Date.now();\n var delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return setTimeout(function () {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!commonjsGlobal.cancelAnimationFrame)\n{\n commonjsGlobal.cancelAnimationFrame = function (id) { return clearTimeout(id); };\n}\n\n// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x)\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n\n// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value)\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n\nif (!window.ArrayBuffer)\n{\n window.ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n window.Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n window.Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n window.Uint16Array = Array;\n}\n\nif (!window.Uint8Array)\n{\n window.Uint8Array = Array;\n}\n\nif (!window.Int32Array)\n{\n window.Int32Array = Array;\n}\n//# sourceMappingURL=polyfill.es.js.map\n","!function(e){var n=/iPhone/i,t=/iPod/i,r=/iPad/i,a=/\\bAndroid(?:.+)Mobile\\b/i,p=/Android/i,l=/\\bAndroid(?:.+)SD4930UR\\b/i,b=/\\bAndroid(?:.+)(?:KF[A-Z]{2,4})\\b/i,f=/Windows Phone/i,u=/\\bWindows(?:.+)ARM\\b/i,c=/BlackBerry/i,s=/BB10/i,v=/Opera Mini/i,h=/\\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(l,i),tablet:!m(l,i)&&m(b,i),device:m(l,i)||m(b,i)},android:{phone:!m(f,i)&&m(l,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(l,i)&&!m(a,i)&&(m(b,i)||m(p,i)),device:!m(f,i)&&(m(l,i)||m(b,i)||m(a,i)||m(p,i))},windows:{phone:m(f,i),tablet:m(u,i),device:m(f,i)||m(u,i)},other:{blackberry:m(c,i),blackberry10:m(s,i),opera:m(v,i),firefox:m(w,i),chrome:m(h,i),device:m(c,i)||m(s,i)||m(v,i)||m(w,i)||m(h,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\"!=typeof module&&module.exports&&\"undefined\"==typeof window?module.exports=i:\"undefined\"!=typeof module&&module.exports&&\"undefined\"!=typeof window?module.exports=i():\"function\"==typeof define&&define.amd?define([],e.isMobile=i()):e.isMobile=i()}(this);","/*!\n * @pixi/settings - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/settings is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport isMobile from 'ismobilejs';\nexport { default as isMobile } from 'ismobilejs';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nfunction maxRecommendedTextures(max)\n{\n var allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n allowMax = false;\n\n if (isMobile.apple.device)\n {\n var match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n var majorVersion = parseInt(match[1], 10);\n\n // All texture units can be used on devices that support ios 11 or above\n if (majorVersion >= 11)\n {\n allowMax = true;\n }\n }\n }\n if (isMobile.android.device)\n {\n var match$1 = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match$1)\n {\n var majorVersion$1 = parseInt(match$1[1], 10);\n\n // All texture units can be used on devices that support Android 7 (Nougat) or above\n if (majorVersion$1 >= 7)\n {\n allowMax = true;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nfunction canUploadSameBuffer()\n{\n return !isMobile.apple.device;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nvar settings = {\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} forceFXAA=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n forceFXAA: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n\nexport { settings };\n//# sourceMappingURL=settings.es.js.map\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n 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);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.4.1 by @mathias */\n\n\n/** Highest positive signed 32-bit float value */\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nvar regexPunycode = /^xn--/;\nvar regexNonASCII = /[^\\x20-\\x7E]/; // unprintable ASCII chars + non-ASCII chars\nvar regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nvar errors = {\n 'overflow': 'Overflow: input needs wider integers to process',\n 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n 'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nvar baseMinusTMin = base - tMin;\nvar floor = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type) {\n throw new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n var length = array.length;\n var result = [];\n while (length--) {\n result[length] = fn(array[length]);\n }\n return result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n var parts = string.split('@');\n var result = '';\n if (parts.length > 1) {\n // In email addresses, only the domain name should be punycoded. Leave\n // the local part (i.e. everything up to `@`) intact.\n result = parts[0] + '@';\n string = parts[1];\n }\n // Avoid `split(regex)` for IE8 compatibility. See #17.\n string = string.replace(regexSeparators, '\\x2E');\n var labels = string.split('.');\n var encoded = map(labels, fn).join('.');\n return result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n var output = [],\n counter = 0,\n length = string.length,\n value,\n extra;\n while (counter < length) {\n value = string.charCodeAt(counter++);\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // high surrogate, and there is a next character\n extra = string.charCodeAt(counter++);\n if ((extra & 0xFC00) == 0xDC00) { // low surrogate\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // unmatched surrogate; only append this code unit, in case the next\n // code unit is the high surrogate of a surrogate pair\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nfunction ucs2encode(array) {\n return map(array, function(value) {\n var output = '';\n if (value > 0xFFFF) {\n value -= 0x10000;\n output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n value = 0xDC00 | value & 0x3FF;\n }\n output += stringFromCharCode(value);\n return output;\n }).join('');\n}\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nfunction basicToDigit(codePoint) {\n if (codePoint - 48 < 10) {\n return codePoint - 22;\n }\n if (codePoint - 65 < 26) {\n return codePoint - 65;\n }\n if (codePoint - 97 < 26) {\n return codePoint - 97;\n }\n return base;\n}\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nfunction digitToBasic(digit, flag) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n}\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nfunction adapt(delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n for ( /* no initialization */ ; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor(delta / baseMinusTMin);\n }\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n}\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nexport function decode(input) {\n // Don't use UCS-2\n var output = [],\n inputLength = input.length,\n out,\n i = 0,\n n = initialN,\n bias = initialBias,\n basic,\n j,\n index,\n oldi,\n w,\n k,\n digit,\n t,\n /** Cached calculation results */\n baseMinusT;\n\n // Handle the basic code points: let `basic` be the number of input code\n // points before the last delimiter, or `0` if there is none, then copy\n // the first basic code points to the output.\n\n basic = input.lastIndexOf(delimiter);\n if (basic < 0) {\n basic = 0;\n }\n\n for (j = 0; j < basic; ++j) {\n // if it's not a basic code point\n if (input.charCodeAt(j) >= 0x80) {\n error('not-basic');\n }\n output.push(input.charCodeAt(j));\n }\n\n // Main decoding loop: start just after the last delimiter if any basic code\n // points were copied; start at the beginning otherwise.\n\n for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */ ) {\n\n // `index` is the index of the next character to be consumed.\n // Decode a generalized variable-length integer into `delta`,\n // which gets added to `i`. The overflow checking is easier\n // if we increase `i` as we go, then subtract off its starting\n // value at the end to obtain `delta`.\n for (oldi = i, w = 1, k = base; /* no condition */ ; k += base) {\n\n if (index >= inputLength) {\n error('invalid-input');\n }\n\n digit = basicToDigit(input.charCodeAt(index++));\n\n if (digit >= base || digit > floor((maxInt - i) / w)) {\n error('overflow');\n }\n\n i += digit * w;\n t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n if (digit < t) {\n break;\n }\n\n baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT)) {\n error('overflow');\n }\n\n w *= baseMinusT;\n\n }\n\n out = output.length + 1;\n bias = adapt(i - oldi, out, oldi == 0);\n\n // `i` was supposed to wrap around from `out` to `0`,\n // incrementing `n` each time, so we'll fix that now:\n if (floor(i / out) > maxInt - n) {\n error('overflow');\n }\n\n n += floor(i / out);\n i %= out;\n\n // Insert `n` at position `i` of the output\n output.splice(i++, 0, n);\n\n }\n\n return ucs2encode(output);\n}\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nexport function encode(input) {\n var n,\n delta,\n handledCPCount,\n basicLength,\n bias,\n j,\n m,\n q,\n k,\n t,\n currentValue,\n output = [],\n /** `inputLength` will hold the number of code points in `input`. */\n inputLength,\n /** Cached calculation results */\n handledCPCountPlusOne,\n baseMinusT,\n qMinusT;\n\n // Convert the input in UCS-2 to Unicode\n input = ucs2decode(input);\n\n // Cache the length\n inputLength = input.length;\n\n // Initialize the state\n n = initialN;\n delta = 0;\n bias = initialBias;\n\n // Handle the basic code points\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n handledCPCount = basicLength = output.length;\n\n // `handledCPCount` is the number of code points that have been handled;\n // `basicLength` is the number of basic code points.\n\n // Finish the basic string - if it is not empty - with a delimiter\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n\n // All non-basic code points < n have been handled already. Find the next\n // larger one:\n for (m = maxInt, j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's state to ,\n // but guard against overflow\n handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n error('overflow');\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue < n && ++delta > maxInt) {\n error('overflow');\n }\n\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer\n for (q = delta, k = base; /* no condition */ ; k += base) {\n t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n if (q < t) {\n break;\n }\n qMinusT = q - t;\n baseMinusT = base - t;\n output.push(\n stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n );\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q, 0)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n\n }\n return output.join('');\n}\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nexport function toUnicode(input) {\n return mapDomain(input, function(string) {\n return regexPunycode.test(string) ?\n decode(string.slice(4).toLowerCase()) :\n string;\n });\n}\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nexport function toASCII(input) {\n return mapDomain(input, function(string) {\n return regexNonASCII.test(string) ?\n 'xn--' + encode(string) :\n string;\n });\n}\nexport var version = '1.4.1';\n/**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n\nexport var ucs2 = {\n decode: ucs2decode,\n encode: ucs2encode\n};\nexport default {\n version: version,\n ucs2: ucs2,\n toASCII: toASCII,\n toUnicode: toUnicode,\n encode: encode,\n decode: decode\n}\n","// shim for using process in browser\n// based off https://github.com/defunctzombie/node-process/blob/master/browser.js\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\nvar cachedSetTimeout = defaultSetTimout;\nvar cachedClearTimeout = defaultClearTimeout;\nif (typeof global.setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n}\nif (typeof global.clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n}\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\nexport function nextTick(fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nexport var title = 'browser';\nexport var platform = 'browser';\nexport var browser = true;\nexport var env = {};\nexport var argv = [];\nexport var version = ''; // empty string to avoid regexp issues\nexport var versions = {};\nexport var release = {};\nexport var config = {};\n\nfunction noop() {}\n\nexport var on = noop;\nexport var addListener = noop;\nexport var once = noop;\nexport var off = noop;\nexport var removeListener = noop;\nexport var removeAllListeners = noop;\nexport var emit = noop;\n\nexport function binding(name) {\n throw new Error('process.binding is not supported');\n}\n\nexport function cwd () { return '/' }\nexport function chdir (dir) {\n throw new Error('process.chdir is not supported');\n};\nexport function umask() { return 0; }\n\n// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js\nvar performance = global.performance || {}\nvar performanceNow =\n performance.now ||\n performance.mozNow ||\n performance.msNow ||\n performance.oNow ||\n performance.webkitNow ||\n function(){ return (new Date()).getTime() }\n\n// generate timestamp or delta\n// see http://nodejs.org/api/process.html#process_process_hrtime\nexport function hrtime(previousTimestamp){\n var clocktime = performanceNow.call(performance)*1e-3\n var seconds = Math.floor(clocktime)\n var nanoseconds = Math.floor((clocktime%1)*1e9)\n if (previousTimestamp) {\n seconds = seconds - previousTimestamp[0]\n nanoseconds = nanoseconds - previousTimestamp[1]\n if (nanoseconds<0) {\n seconds--\n nanoseconds += 1e9\n }\n }\n return [seconds,nanoseconds]\n}\n\nvar startTime = new Date();\nexport function uptime() {\n var currentTime = new Date();\n var dif = currentTime - startTime;\n return dif / 1000;\n}\n\nexport default {\n nextTick: nextTick,\n title: title,\n browser: browser,\n env: env,\n argv: argv,\n version: version,\n versions: versions,\n on: on,\n addListener: addListener,\n once: once,\n off: off,\n removeListener: removeListener,\n removeAllListeners: removeAllListeners,\n emit: emit,\n binding: binding,\n cwd: cwd,\n chdir: chdir,\n umask: umask,\n hrtime: hrtime,\n platform: platform,\n release: release,\n config: config,\n uptime: uptime\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\nfunction stringifyPrimitive(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n}\n\nexport function stringify (obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n\nexport function parse(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\nexport default {\n encode: stringify,\n stringify: stringify,\n decode: parse,\n parse: parse\n}\nexport {stringify as encode, parse as decode};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\nimport {toASCII} from 'punycode';\nimport {isObject,isString,isNullOrUndefined,isNull} from 'util';\nimport {parse as qsParse,stringify as qsStringify} from 'querystring';\nexport {\n urlParse as parse,\n urlResolve as resolve,\n urlResolveObject as resolveObject,\n urlFormat as format\n};\nexport default {\n parse: urlParse,\n resolve: urlResolve,\n resolveObject: urlResolveObject,\n format: urlFormat,\n Url: Url\n}\nexport function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n return parse(this, url, parseQueryString, slashesDenoteHost);\n}\n\nfunction parse(self, url, parseQueryString, slashesDenoteHost) {\n if (!isString(url)) {\n throw new TypeError('Parameter \\'url\\' must be a string, not ' + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n self.path = rest;\n self.href = rest;\n self.pathname = simplePath[1];\n if (simplePath[2]) {\n self.search = simplePath[2];\n if (parseQueryString) {\n self.query = qsParse(self.search.substr(1));\n } else {\n self.query = self.search.substr(1);\n }\n } else if (parseQueryString) {\n self.search = '';\n self.query = {};\n }\n return self;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n self.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n self.slashes = true;\n }\n }\n var i, hec, l, p;\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (i = 0; i < hostEndingChars.length; i++) {\n hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n self.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (i = 0; i < nonHostChars.length; i++) {\n hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n self.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n parseHost(self);\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n self.hostname = self.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = self.hostname[0] === '[' &&\n self.hostname[self.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = self.hostname.split(/\\./);\n for (i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n self.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (self.hostname.length > hostnameMaxLen) {\n self.hostname = '';\n } else {\n // hostnames are always lower case.\n self.hostname = self.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n self.hostname = toASCII(self.hostname);\n }\n\n p = self.port ? ':' + self.port : '';\n var h = self.hostname || '';\n self.host = h + p;\n self.href += self.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n self.hostname = self.hostname.substr(1, self.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n self.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n self.search = rest.substr(qm);\n self.query = rest.substr(qm + 1);\n if (parseQueryString) {\n self.query = qsParse(self.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n self.search = '';\n self.query = {};\n }\n if (rest) self.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n self.hostname && !self.pathname) {\n self.pathname = '/';\n }\n\n //to support http.request\n if (self.pathname || self.search) {\n p = self.pathname || '';\n var s = self.search || '';\n self.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n self.href = format(self);\n return self;\n}\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (isString(obj)) obj = parse({}, obj);\n return format(obj);\n}\n\nfunction format(self) {\n var auth = self.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = self.protocol || '',\n pathname = self.pathname || '',\n hash = self.hash || '',\n host = false,\n query = '';\n\n if (self.host) {\n host = auth + self.host;\n } else if (self.hostname) {\n host = auth + (self.hostname.indexOf(':') === -1 ?\n self.hostname :\n '[' + this.hostname + ']');\n if (self.port) {\n host += ':' + self.port;\n }\n }\n\n if (self.query &&\n isObject(self.query) &&\n Object.keys(self.query).length) {\n query = qsStringify(self.query);\n }\n\n var search = self.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (self.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n}\n\nUrl.prototype.format = function() {\n return format(this);\n}\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n var relPath;\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n relPath = relative.pathname && relative.pathname.split('/') || [];\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n var authInHost;\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!isNull(result.pathname) || !isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!isNull(result.pathname) || !isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n return parseHost(this);\n};\n\nfunction parseHost(self) {\n var host = self.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n self.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) self.hostname = host;\n}\n","/*!\n * @pixi/constants - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/constants is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nvar ENV;\n(function (ENV) {\n ENV[ENV[\"WEBGL_LEGACY\"] = 0] = \"WEBGL_LEGACY\";\n ENV[ENV[\"WEBGL\"] = 1] = \"WEBGL\";\n ENV[ENV[\"WEBGL2\"] = 2] = \"WEBGL2\";\n})(ENV || (ENV = {}));\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nvar RENDERER_TYPE;\n(function (RENDERER_TYPE) {\n RENDERER_TYPE[RENDERER_TYPE[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n RENDERER_TYPE[RENDERER_TYPE[\"WEBGL\"] = 1] = \"WEBGL\";\n RENDERER_TYPE[RENDERER_TYPE[\"CANVAS\"] = 2] = \"CANVAS\";\n})(RENDERER_TYPE || (RENDERER_TYPE = {}));\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nvar BLEND_MODES;\n(function (BLEND_MODES) {\n BLEND_MODES[BLEND_MODES[\"NORMAL\"] = 0] = \"NORMAL\";\n BLEND_MODES[BLEND_MODES[\"ADD\"] = 1] = \"ADD\";\n BLEND_MODES[BLEND_MODES[\"MULTIPLY\"] = 2] = \"MULTIPLY\";\n BLEND_MODES[BLEND_MODES[\"SCREEN\"] = 3] = \"SCREEN\";\n BLEND_MODES[BLEND_MODES[\"OVERLAY\"] = 4] = \"OVERLAY\";\n BLEND_MODES[BLEND_MODES[\"DARKEN\"] = 5] = \"DARKEN\";\n BLEND_MODES[BLEND_MODES[\"LIGHTEN\"] = 6] = \"LIGHTEN\";\n BLEND_MODES[BLEND_MODES[\"COLOR_DODGE\"] = 7] = \"COLOR_DODGE\";\n BLEND_MODES[BLEND_MODES[\"COLOR_BURN\"] = 8] = \"COLOR_BURN\";\n BLEND_MODES[BLEND_MODES[\"HARD_LIGHT\"] = 9] = \"HARD_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"SOFT_LIGHT\"] = 10] = \"SOFT_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"DIFFERENCE\"] = 11] = \"DIFFERENCE\";\n BLEND_MODES[BLEND_MODES[\"EXCLUSION\"] = 12] = \"EXCLUSION\";\n BLEND_MODES[BLEND_MODES[\"HUE\"] = 13] = \"HUE\";\n BLEND_MODES[BLEND_MODES[\"SATURATION\"] = 14] = \"SATURATION\";\n BLEND_MODES[BLEND_MODES[\"COLOR\"] = 15] = \"COLOR\";\n BLEND_MODES[BLEND_MODES[\"LUMINOSITY\"] = 16] = \"LUMINOSITY\";\n BLEND_MODES[BLEND_MODES[\"NORMAL_NPM\"] = 17] = \"NORMAL_NPM\";\n BLEND_MODES[BLEND_MODES[\"ADD_NPM\"] = 18] = \"ADD_NPM\";\n BLEND_MODES[BLEND_MODES[\"SCREEN_NPM\"] = 19] = \"SCREEN_NPM\";\n BLEND_MODES[BLEND_MODES[\"NONE\"] = 20] = \"NONE\";\n BLEND_MODES[BLEND_MODES[\"SRC_OVER\"] = 0] = \"SRC_OVER\";\n BLEND_MODES[BLEND_MODES[\"SRC_IN\"] = 21] = \"SRC_IN\";\n BLEND_MODES[BLEND_MODES[\"SRC_OUT\"] = 22] = \"SRC_OUT\";\n BLEND_MODES[BLEND_MODES[\"SRC_ATOP\"] = 23] = \"SRC_ATOP\";\n BLEND_MODES[BLEND_MODES[\"DST_OVER\"] = 24] = \"DST_OVER\";\n BLEND_MODES[BLEND_MODES[\"DST_IN\"] = 25] = \"DST_IN\";\n BLEND_MODES[BLEND_MODES[\"DST_OUT\"] = 26] = \"DST_OUT\";\n BLEND_MODES[BLEND_MODES[\"DST_ATOP\"] = 27] = \"DST_ATOP\";\n BLEND_MODES[BLEND_MODES[\"ERASE\"] = 26] = \"ERASE\";\n BLEND_MODES[BLEND_MODES[\"SUBTRACT\"] = 28] = \"SUBTRACT\";\n BLEND_MODES[BLEND_MODES[\"XOR\"] = 29] = \"XOR\";\n})(BLEND_MODES || (BLEND_MODES = {}));\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nvar DRAW_MODES;\n(function (DRAW_MODES) {\n DRAW_MODES[DRAW_MODES[\"POINTS\"] = 0] = \"POINTS\";\n DRAW_MODES[DRAW_MODES[\"LINES\"] = 1] = \"LINES\";\n DRAW_MODES[DRAW_MODES[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n DRAW_MODES[DRAW_MODES[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(DRAW_MODES || (DRAW_MODES = {}));\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nvar FORMATS;\n(function (FORMATS) {\n FORMATS[FORMATS[\"RGBA\"] = 6408] = \"RGBA\";\n FORMATS[FORMATS[\"RGB\"] = 6407] = \"RGB\";\n FORMATS[FORMATS[\"ALPHA\"] = 6406] = \"ALPHA\";\n FORMATS[FORMATS[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n FORMATS[FORMATS[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n FORMATS[FORMATS[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n FORMATS[FORMATS[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n})(FORMATS || (FORMATS = {}));\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nvar TARGETS;\n(function (TARGETS) {\n TARGETS[TARGETS[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n TARGETS[TARGETS[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n})(TARGETS || (TARGETS = {}));\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nvar TYPES;\n(function (TYPES) {\n TYPES[TYPES[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n TYPES[TYPES[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n TYPES[TYPES[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n TYPES[TYPES[\"FLOAT\"] = 5126] = \"FLOAT\";\n TYPES[TYPES[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n})(TYPES || (TYPES = {}));\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nvar SCALE_MODES;\n(function (SCALE_MODES) {\n SCALE_MODES[SCALE_MODES[\"NEAREST\"] = 0] = \"NEAREST\";\n SCALE_MODES[SCALE_MODES[\"LINEAR\"] = 1] = \"LINEAR\";\n})(SCALE_MODES || (SCALE_MODES = {}));\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nvar WRAP_MODES;\n(function (WRAP_MODES) {\n WRAP_MODES[WRAP_MODES[\"CLAMP\"] = 33071] = \"CLAMP\";\n WRAP_MODES[WRAP_MODES[\"REPEAT\"] = 10497] = \"REPEAT\";\n WRAP_MODES[WRAP_MODES[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n})(WRAP_MODES || (WRAP_MODES = {}));\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nvar MIPMAP_MODES;\n(function (MIPMAP_MODES) {\n MIPMAP_MODES[MIPMAP_MODES[\"OFF\"] = 0] = \"OFF\";\n MIPMAP_MODES[MIPMAP_MODES[\"POW2\"] = 1] = \"POW2\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON\"] = 2] = \"ON\";\n})(MIPMAP_MODES || (MIPMAP_MODES = {}));\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nvar ALPHA_MODES;\n(function (ALPHA_MODES) {\n ALPHA_MODES[ALPHA_MODES[\"NPM\"] = 0] = \"NPM\";\n ALPHA_MODES[ALPHA_MODES[\"UNPACK\"] = 1] = \"UNPACK\";\n ALPHA_MODES[ALPHA_MODES[\"PMA\"] = 2] = \"PMA\";\n ALPHA_MODES[ALPHA_MODES[\"NO_PREMULTIPLIED_ALPHA\"] = 0] = \"NO_PREMULTIPLIED_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ON_UPLOAD\"] = 1] = \"PREMULTIPLY_ON_UPLOAD\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ALPHA\"] = 2] = \"PREMULTIPLY_ALPHA\";\n})(ALPHA_MODES || (ALPHA_MODES = {}));\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nvar GC_MODES;\n(function (GC_MODES) {\n GC_MODES[GC_MODES[\"AUTO\"] = 0] = \"AUTO\";\n GC_MODES[GC_MODES[\"MANUAL\"] = 1] = \"MANUAL\";\n})(GC_MODES || (GC_MODES = {}));\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @static\n * @enum {string}\n * @constant\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nvar PRECISION;\n(function (PRECISION) {\n PRECISION[\"LOW\"] = \"lowp\";\n PRECISION[\"MEDIUM\"] = \"mediump\";\n PRECISION[\"HIGH\"] = \"highp\";\n})(PRECISION || (PRECISION = {}));\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nvar MASK_TYPES;\n(function (MASK_TYPES) {\n MASK_TYPES[MASK_TYPES[\"NONE\"] = 0] = \"NONE\";\n MASK_TYPES[MASK_TYPES[\"SCISSOR\"] = 1] = \"SCISSOR\";\n MASK_TYPES[MASK_TYPES[\"STENCIL\"] = 2] = \"STENCIL\";\n MASK_TYPES[MASK_TYPES[\"SPRITE\"] = 3] = \"SPRITE\";\n})(MASK_TYPES || (MASK_TYPES = {}));\n\nexport { ALPHA_MODES, BLEND_MODES, DRAW_MODES, ENV, FORMATS, GC_MODES, MASK_TYPES, MIPMAP_MODES, PRECISION, RENDERER_TYPE, SCALE_MODES, TARGETS, TYPES, WRAP_MODES };\n//# sourceMappingURL=constants.es.js.map\n","/*!\n * @pixi/utils - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/utils is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { settings } from '@pixi/settings';\nexport { isMobile } from '@pixi/settings';\nexport { default as EventEmitter } from 'eventemitter3';\nexport { default as earcut } from 'earcut';\nimport _url from 'url';\nexport { default as url } from 'url';\nimport { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nvar saidHello = false;\nvar VERSION = '5.2.0';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nfunction skipHello()\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nfunction sayHello(type)\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n var args = [\n (\"\\n %c %c %c PixiJS \" + VERSION + \" - ✰ \" + type + \" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n\"),\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;' ];\n\n window.console.log.apply(console, args);\n }\n else if (window.console)\n {\n window.console.log((\"PixiJS \" + VERSION + \" - \" + type + \" - http://www.pixijs.com/\"));\n }\n\n saidHello = true;\n}\n\nvar supported;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nfunction isWebGLSupported()\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported()\n {\n var contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n var canvas = document.createElement('canvas');\n var gl = canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions);\n\n var success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n var loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nfunction hex2rgb(hex, out)\n{\n out = out || [];\n\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nfunction hex2string(hex)\n{\n hex = hex.toString(16);\n hex = '000000'.substr(0, 6 - hex.length) + hex;\n\n return (\"#\" + hex);\n}\n\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nfunction string2hex(string)\n{\n if (typeof string === 'string' && string[0] === '#')\n {\n string = string.substr(1);\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nfunction rgb2hex(rgb)\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @param {Array} [array] - The array to output into.\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes()\n{\n var pm = [];\n var npm = [];\n\n for (var i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n var array = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nvar premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode supposed blend mode\n * @param {boolean} premultiplied whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nfunction correctBlendMode(blendMode, premultiplied)\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb input rgb\n * @param {number} alpha alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nfunction premultiplyRgba(rgb, alpha, out, premultiply)\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint integer RGB\n * @param {number} alpha floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nfunction premultiplyTint(tint, alpha)\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n var R = ((tint >> 16) & 0xFF);\n var G = ((tint >> 8) & 0xFF);\n var B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint input tint\n * @param {number} alpha alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nfunction premultiplyTintToRgba(tint, alpha, out, premultiply)\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nfunction createIndicesForQuads(size, outBuffer)\n{\n if ( outBuffer === void 0 ) outBuffer = null;\n\n // the total number of indices in our array, there are 6 points per quad.\n var totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error((\"Out buffer length is incorrect, got \" + (outBuffer.length) + \" and expected \" + totalIndices));\n }\n\n // fill the indices with the quads to draw\n for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n\n/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr Array to remove elements from\n * @param {number} startIdx starting index\n * @param {number} removeCount how many to remove\n */\nfunction removeItems(arr, startIdx, removeCount)\n{\n var length = arr.length;\n var i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n var len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n\nvar nextUid = 0;\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nfunction uid()\n{\n return ++nextUid;\n}\n\n/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nfunction sign(n)\n{\n if (n === 0) { return 0; }\n\n return n < 0 ? -1 : 1;\n}\n\n// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v input value\n * @return {number}\n */\nfunction nextPow2(v)\n{\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v input value\n * @return {boolean} `true` if value is power of two\n */\nfunction isPow2(v)\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v input value\n * @return {number} logarithm base 2\n */\nfunction log2(v)\n{\n var r = (v > 0xFFFF) << 4;\n\n v >>>= r;\n\n var shift = (v > 0xFF) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar ProgramCache = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar TextureCache = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\n\nvar BaseTextureCache = Object.create(null);\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nfunction destroyTextureCache()\n{\n var key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nfunction clearTextureCache()\n{\n var key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nfunction trimCanvas(canvas)\n{\n // https://gist.github.com/remy/784508\n\n var width = canvas.width;\n var height = canvas.height;\n\n var context = canvas.getContext('2d');\n var imageData = context.getImageData(0, 0, width, height);\n var pixels = imageData.data;\n var len = pixels.length;\n\n var bound = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n var data = null;\n var i;\n var x;\n var y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height: height,\n width: width,\n data: data,\n };\n}\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nvar CanvasRenderTarget = function CanvasRenderTarget(width, height, resolution)\n{\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n};\n\nvar prototypeAccessors = { width: { configurable: true },height: { configurable: true } };\n\n/**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\nCanvasRenderTarget.prototype.clear = function clear ()\n{\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n};\n\n/**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\nCanvasRenderTarget.prototype.resize = function resize (width, height)\n{\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n};\n\n/**\n * Destroys this canvas.\n *\n */\nCanvasRenderTarget.prototype.destroy = function destroy ()\n{\n this.context = null;\n this.canvas = null;\n};\n\n/**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\nprototypeAccessors.width.get = function ()\n{\n return this.canvas.width;\n};\n\nprototypeAccessors.width.set = function (val) // eslint-disable-line require-jsdoc\n{\n this.canvas.width = val;\n};\n\n/**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\nprototypeAccessors.height.get = function ()\n{\n return this.canvas.height;\n};\n\nprototypeAccessors.height.set = function (val) // eslint-disable-line require-jsdoc\n{\n this.canvas.height = val;\n};\n\nObject.defineProperties( CanvasRenderTarget.prototype, prototypeAccessors );\n\n/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nvar DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n\n/**\n * Typedef for decomposeDataUri return object.\n *\n * @memberof PIXI.utils\n * @typedef {object} DecomposedDataUri\n * @property {string} mediaType Media type, eg. `image`\n * @property {string} subType Sub type, eg. `png`\n * @property {string} encoding Data encoding, eg. `base64`\n * @property {string} data The actual data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nfunction decomposeDataUri(dataUri)\n{\n var dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n\nvar tempAnchor;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nfunction determineCrossOrigin(url, loc)\n{\n if ( loc === void 0 ) loc = window.location;\n\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = _url.parse(tempAnchor.href);\n\n var samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n\n // if cross origin\n if (url.hostname !== loc.hostname || !samePort || url.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nfunction getResolutionOfUrl(url, defaultValue)\n{\n var resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n\n// A map of warning messages already fired\nvar warnings = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nfunction deprecation(version, message, ignoreDepth)\n{\n if ( ignoreDepth === void 0 ) ignoreDepth = 3;\n\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n var stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', (message + \"\\nDeprecated since v\" + version));\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n (message + \"\\nDeprecated since v\" + version)\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', (message + \"\\nDeprecated since v\" + version));\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n\n/**\n * Generalized convenience utilities for PIXI.\n * @example\n * // Extend PIXI's internal Event Emitter.\n * class MyEmitter extends PIXI.utils.EventEmitter {\n * constructor() {\n * super();\n * console.log(\"Emitter created!\");\n * }\n * }\n *\n * // Get info on current device\n * console.log(PIXI.utils.isMobile);\n *\n * // Convert hex color to string\n * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: \"#ff00ff\"\n * @namespace PIXI.utils\n */\n\nexport { BaseTextureCache, CanvasRenderTarget, DATA_URI, ProgramCache, TextureCache, clearTextureCache, correctBlendMode, createIndicesForQuads, decomposeDataUri, deprecation, destroyTextureCache, determineCrossOrigin, getResolutionOfUrl, hex2rgb, hex2string, isPow2, isWebGLSupported, log2, nextPow2, premultiplyBlendMode, premultiplyRgba, premultiplyTint, premultiplyTintToRgba, removeItems, rgb2hex, sayHello, sign, skipHello, string2hex, trimCanvas, uid };\n//# sourceMappingURL=utils.es.js.map\n","/*!\n * @pixi/math - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/math is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Common interface for points. Both Point and ObservablePoint implement it\n * @memberof PIXI\n * @interface IPoint\n */\n/**\n * X coord\n * @memberof PIXI.IPoint#\n * @member {number} x\n */\n/**\n * Y coord\n * @memberof PIXI.IPoint#\n * @member {number} y\n */\n/**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @method set\n * @memberof PIXI.IPoint#\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n */\n/**\n * Copies x and y from the given point\n * @method copyFrom\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPoint} p - The point to copy from\n * @returns {this} Returns itself.\n */\n/**\n * Copies x and y into the given point\n * @method copyTo\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n/**\n * Returns true if the given point is equal to this point\n *\n * @method equals\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPoint} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nvar Point = /** @class */ (function () {\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function Point(x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n Point.prototype.clone = function () {\n return new Point(this.x, this.y);\n };\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPoint} p - The point to copy from\n * @returns {this} Returns itself.\n */\n Point.prototype.copyFrom = function (p) {\n this.set(p.x, p.y);\n return this;\n };\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n Point.prototype.copyTo = function (p) {\n p.set(this.x, this.y);\n return p;\n };\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPoint} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n Point.prototype.equals = function (p) {\n return (p.x === this.x) && (p.y === this.y);\n };\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n */\n Point.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n this.x = x;\n this.y = y;\n };\n return Point;\n}());\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nvar ObservablePoint = /** @class */ (function () {\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function ObservablePoint(cb, scope, x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n this._x = x;\n this._y = y;\n this.cb = cb;\n this.scope = scope;\n }\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n ObservablePoint.prototype.clone = function (cb, scope) {\n if (cb === void 0) { cb = this.cb; }\n if (scope === void 0) { scope = this.scope; }\n return new ObservablePoint(cb, scope, this._x, this._y);\n };\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n */\n ObservablePoint.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n if (this._x !== x || this._y !== y) {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n };\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPoint} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n ObservablePoint.prototype.copyFrom = function (p) {\n if (this._x !== p.x || this._y !== p.y) {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n return this;\n };\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n ObservablePoint.prototype.copyTo = function (p) {\n p.set(this._x, this._y);\n return p;\n };\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPoint} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n ObservablePoint.prototype.equals = function (p) {\n return (p.x === this._x) && (p.y === this._y);\n };\n Object.defineProperty(ObservablePoint.prototype, \"x\", {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get: function () {\n return this._x;\n },\n set: function (value) {\n if (this._x !== value) {\n this._x = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ObservablePoint.prototype, \"y\", {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get: function () {\n return this._y;\n },\n set: function (value) {\n if (this._y !== value) {\n this._y = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: true,\n configurable: true\n });\n return ObservablePoint;\n}());\n\n/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nvar PI_2 = Math.PI * 2;\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nvar RAD_TO_DEG = 180 / Math.PI;\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nvar DEG_TO_RAD = Math.PI / 180;\nvar SHAPES;\n(function (SHAPES) {\n SHAPES[SHAPES[\"POLY\"] = 0] = \"POLY\";\n SHAPES[SHAPES[\"RECT\"] = 1] = \"RECT\";\n SHAPES[SHAPES[\"CIRC\"] = 2] = \"CIRC\";\n SHAPES[SHAPES[\"ELIP\"] = 3] = \"ELIP\";\n SHAPES[SHAPES[\"RREC\"] = 4] = \"RREC\";\n})(SHAPES || (SHAPES = {}));\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nvar Matrix = /** @class */ (function () {\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n function Matrix(a, b, c, d, tx, ty) {\n if (a === void 0) { a = 1; }\n if (b === void 0) { b = 0; }\n if (c === void 0) { c = 0; }\n if (d === void 0) { d = 1; }\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n this.array = null;\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n Matrix.prototype.fromArray = function (array) {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n };\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.set = function (a, b, c, d, tx, ty) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n return this;\n };\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n Matrix.prototype.toArray = function (transpose, out) {\n if (!this.array) {\n this.array = new Float32Array(9);\n }\n var array = out || this.array;\n if (transpose) {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n return array;\n };\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.Point} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n Matrix.prototype.apply = function (pos, newPos) {\n newPos = newPos || new Point();\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n return newPos;\n };\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.Point} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n Matrix.prototype.applyInverse = function (pos, newPos) {\n newPos = newPos || new Point();\n var id = 1 / ((this.a * this.d) + (this.c * -this.b));\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n return newPos;\n };\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x How much to translate x by\n * @param {number} y How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.translate = function (x, y) {\n this.tx += x;\n this.ty += y;\n return this;\n };\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x The amount to scale horizontally\n * @param {number} y The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.scale = function (x, y) {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n return this;\n };\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.rotate = function (angle) {\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var a1 = this.a;\n var c1 = this.c;\n var tx1 = this.tx;\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n return this;\n };\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.append = function (matrix) {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n return this;\n };\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n return this;\n };\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.prepend = function (matrix) {\n var tx1 = this.tx;\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {\n var a1 = this.a;\n var c1 = this.c;\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n return this;\n };\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n Matrix.prototype.decompose = function (transform) {\n // sort out rotation / skew..\n var a = this.a;\n var b = this.b;\n var c = this.c;\n var d = this.d;\n var skewX = -Math.atan2(-c, d);\n var skewY = Math.atan2(b, a);\n var delta = Math.abs(skewX + skewY);\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n return transform;\n };\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.invert = function () {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n var tx1 = this.tx;\n var n = (a1 * d1) - (b1 * c1);\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n return this;\n };\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n Matrix.prototype.identity = function () {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n return this;\n };\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n Matrix.prototype.clone = function () {\n var matrix = new Matrix();\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n Matrix.prototype.copyTo = function (matrix) {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n Matrix.prototype.copyFrom = function (matrix) {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n return this;\n };\n Object.defineProperty(Matrix, \"IDENTITY\", {\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n get: function () {\n return new Matrix();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Matrix, \"TEMP_MATRIX\", {\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n get: function () {\n return new Matrix();\n },\n enumerable: true,\n configurable: true\n });\n return Matrix;\n}());\n\n// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\nvar ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nvar uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nvar rotationCayley = [];\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nvar rotationMatrices = [];\n/*\n * Alias for {@code Math.sign}.\n */\nvar signum = Math.sign;\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init() {\n for (var i = 0; i < 16; i++) {\n var row = [];\n rotationCayley.push(row);\n for (var j = 0; j < 16; j++) {\n /* Multiplies rotation matrices i and j. */\n var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n /* Finds rotation matrix matching the product and pushes it. */\n for (var k = 0; k < 16; k++) {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy) {\n row.push(k);\n break;\n }\n }\n }\n }\n for (var i = 0; i < 16; i++) {\n var mat = new Matrix();\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\ninit();\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nvar groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: function (ind) { return ux[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: function (ind) { return uy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: function (ind) { return vx[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: function (ind) { return vy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: function (rotation) {\n if (rotation & 8) // true only if between 8 & 15 (reflections)\n {\n return rotation & 15; // or rotation % 16\n }\n return (-rotation) & 7; // or (8 - rotation) % 8\n },\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); },\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); },\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: function (rotation) { return rotation ^ 4; },\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: function (rotation) { return (rotation & 3) === 2; },\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: function (dx, dy) {\n if (Math.abs(dx) * 2 <= Math.abs(dy)) {\n if (dy >= 0) {\n return groupD8.S;\n }\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx)) {\n if (dx > 0) {\n return groupD8.E;\n }\n return groupD8.W;\n }\n else if (dy > 0) {\n if (dx > 0) {\n return groupD8.SE;\n }\n return groupD8.SW;\n }\n else if (dx > 0) {\n return groupD8.NE;\n }\n return groupD8.NW;\n },\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: function (matrix, rotation, tx, ty) {\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n // Packer used \"rotation\", we use \"inv(rotation)\"\n var mat = rotationMatrices[groupD8.inv(rotation)];\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nvar Transform = /** @class */ (function () {\n function Transform() {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n /**\n * Called when a value changes.\n *\n * @protected\n */\n Transform.prototype.onChange = function () {\n this._localID++;\n };\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n Transform.prototype.updateSkew = function () {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n this._localID++;\n };\n /**\n * Updates the local transformation matrix.\n */\n Transform.prototype.updateLocalTransform = function () {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n };\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n Transform.prototype.updateTransform = function (parentTransform) {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n if (this._parentID !== parentTransform._worldID) {\n // concat the parent matrix with the objects transform.\n var pt = parentTransform.worldTransform;\n var wt = this.worldTransform;\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n this._parentID = parentTransform._worldID;\n // update the id of the transform..\n this._worldID++;\n }\n };\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n Transform.prototype.setFromMatrix = function (matrix) {\n matrix.decompose(this);\n this._localID++;\n };\n Object.defineProperty(Transform.prototype, \"rotation\", {\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get: function () {\n return this._rotation;\n },\n set: function (value) {\n if (this._rotation !== value) {\n this._rotation = value;\n this.updateSkew();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n Transform.IDENTITY = new Transform();\n return Transform;\n}());\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nvar Rectangle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n function Rectangle(x, y, width, height) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n Object.defineProperty(Rectangle.prototype, \"left\", {\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.x;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"right\", {\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.x + this.width;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"top\", {\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.y;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"bottom\", {\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get: function () {\n return this.y + this.height;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rectangle, \"EMPTY\", {\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n get: function () {\n return new Rectangle(0, 0, 0, 0);\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n Rectangle.prototype.clone = function () {\n return new Rectangle(this.x, this.y, this.width, this.height);\n };\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.copyFrom = function (rectangle) {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n return this;\n };\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n Rectangle.prototype.copyTo = function (rectangle) {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n return rectangle;\n };\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n Rectangle.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x < this.x + this.width) {\n if (y >= this.y && y < this.y + this.height) {\n return true;\n }\n }\n return false;\n };\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.pad = function (paddingX, paddingY) {\n if (paddingX === void 0) { paddingX = 0; }\n if (paddingY === void 0) { paddingY = paddingX; }\n this.x -= paddingX;\n this.y -= paddingY;\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n return this;\n };\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.fit = function (rectangle) {\n var x1 = Math.max(this.x, rectangle.x);\n var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.max(this.y, rectangle.y);\n var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n return this;\n };\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.ceil = function (resolution, eps) {\n if (resolution === void 0) { resolution = 1; }\n if (eps === void 0) { eps = 0.001; }\n var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n return this;\n };\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n Rectangle.prototype.enlarge = function (rectangle) {\n var x1 = Math.min(this.x, rectangle.x);\n var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.min(this.y, rectangle.y);\n var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n return this;\n };\n return Rectangle;\n}());\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nvar Circle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n function Circle(x, y, radius) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (radius === void 0) { radius = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n Circle.prototype.clone = function () {\n return new Circle(this.x, this.y, this.radius);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n Circle.prototype.contains = function (x, y) {\n if (this.radius <= 0) {\n return false;\n }\n var r2 = this.radius * this.radius;\n var dx = (this.x - x);\n var dy = (this.y - y);\n dx *= dx;\n dy *= dy;\n return (dx + dy <= r2);\n };\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n Circle.prototype.getBounds = function () {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n };\n return Circle;\n}());\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nvar Ellipse = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n function Ellipse(x, y, halfWidth, halfHeight) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (halfWidth === void 0) { halfWidth = 0; }\n if (halfHeight === void 0) { halfHeight = 0; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n Ellipse.prototype.clone = function () {\n return new Ellipse(this.x, this.y, this.width, this.height);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n Ellipse.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n // normalize the coords to an ellipse with center 0,0\n var normx = ((x - this.x) / this.width);\n var normy = ((y - this.y) / this.height);\n normx *= normx;\n normy *= normy;\n return (normx + normy <= 1);\n };\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n Ellipse.prototype.getBounds = function () {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n };\n return Ellipse;\n}());\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nvar Polygon = /** @class */ (function () {\n /**\n * @param {PIXI.Point[]|number[]|number[][]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n function Polygon() {\n var arguments$1 = arguments;\n\n var points = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n points[_i] = arguments$1[_i];\n }\n if (Array.isArray(points[0])) {\n points = points[0];\n }\n // if this is an array of points, convert it to a flat array of numbers\n if (points[0] instanceof Point) {\n points = points;\n var p = [];\n for (var i = 0, il = points.length; i < il; i++) {\n p.push(points[i].x, points[i].y);\n }\n points = p;\n }\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = points;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n Polygon.prototype.clone = function () {\n var points = this.points.slice();\n var polygon = new Polygon(points);\n polygon.closeStroke = this.closeStroke;\n return polygon;\n };\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n Polygon.prototype.contains = function (x, y) {\n var inside = false;\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n var length = this.points.length / 2;\n for (var i = 0, j = length - 1; i < length; j = i++) {\n var xi = this.points[i * 2];\n var yi = this.points[(i * 2) + 1];\n var xj = this.points[j * 2];\n var yj = this.points[(j * 2) + 1];\n var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n if (intersect) {\n inside = !inside;\n }\n }\n return inside;\n };\n return Polygon;\n}());\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nvar RoundedRectangle = /** @class */ (function () {\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n function RoundedRectangle(x, y, width, height, radius) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n if (radius === void 0) { radius = 20; }\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n RoundedRectangle.prototype.clone = function () {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n };\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n RoundedRectangle.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width) {\n if (y >= this.y && y <= this.y + this.height) {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) {\n return true;\n }\n var dx = x - (this.x + this.radius);\n var dy = y - (this.y + this.radius);\n var radius2 = this.radius * this.radius;\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2) {\n return true;\n }\n }\n }\n return false;\n };\n return RoundedRectangle;\n}());\n\n/**\n * Math classes and utilities mixed into PIXI namespace.\n *\n * @lends PIXI\n */\n\nexport { Circle, DEG_TO_RAD, Ellipse, Matrix, ObservablePoint, PI_2, Point, Polygon, RAD_TO_DEG, Rectangle, RoundedRectangle, SHAPES, Transform, groupD8 };\n//# sourceMappingURL=math.es.js.map\n","/*!\n * @pixi/display - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/display is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { settings } from '@pixi/settings';\nimport { Rectangle, RAD_TO_DEG, DEG_TO_RAD, Transform } from '@pixi/math';\nimport { EventEmitter, removeItems } from '@pixi/utils';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nvar Bounds = function Bounds()\n{\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n};\n\n/**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\nBounds.prototype.isEmpty = function isEmpty ()\n{\n return this.minX > this.maxX || this.minY > this.maxY;\n};\n\n/**\n * Clears the bounds and resets.\n *\n */\nBounds.prototype.clear = function clear ()\n{\n this.updateID++;\n\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n};\n\n/**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\nBounds.prototype.getRectangle = function getRectangle (rect)\n{\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n};\n\n/**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.Point} point - The point to add.\n */\nBounds.prototype.addPoint = function addPoint (point)\n{\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n};\n\n/**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\nBounds.prototype.addQuad = function addQuad (vertices)\n{\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n var x = vertices[0];\n var y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n};\n\n/**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\nBounds.prototype.addFrame = function addFrame (transform, x0, y0, x1, y1)\n{\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n};\n\n/**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\nBounds.prototype.addFrameMatrix = function addFrameMatrix (matrix, x0, y0, x1, y1)\n{\n var a = matrix.a;\n var b = matrix.b;\n var c = matrix.c;\n var d = matrix.d;\n var tx = matrix.tx;\n var ty = matrix.ty;\n\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n var x = (a * x0) + (c * y0) + tx;\n var y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n};\n\n/**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\nBounds.prototype.addVertexData = function addVertexData (vertexData, beginOffset, endOffset)\n{\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n for (var i = beginOffset; i < endOffset; i += 2)\n {\n var x = vertexData[i];\n var y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n};\n\n/**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\nBounds.prototype.addVertices = function addVertices (transform, vertices, beginOffset, endOffset)\n{\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n};\n\n/**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX] - x padding\n * @param {number} [padY] - y padding\n */\nBounds.prototype.addVerticesMatrix = function addVerticesMatrix (matrix, vertices, beginOffset, endOffset, padX, padY)\n{\n var a = matrix.a;\n var b = matrix.b;\n var c = matrix.c;\n var d = matrix.d;\n var tx = matrix.tx;\n var ty = matrix.ty;\n\n padX = padX || 0;\n padY = padY || 0;\n\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n for (var i = beginOffset; i < endOffset; i += 2)\n {\n var rawX = vertices[i];\n var rawY = vertices[i + 1];\n var x = (a * rawX) + (c * rawY) + tx;\n var y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n};\n\n/**\n * Adds other Bounds\n *\n * @param {PIXI.Bounds} bounds - TODO\n */\nBounds.prototype.addBounds = function addBounds (bounds)\n{\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n};\n\n/**\n * Adds other Bounds, masked with Bounds\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Bounds} mask - TODO\n */\nBounds.prototype.addBoundsMask = function addBoundsMask (bounds, mask)\n{\n var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n};\n\n/**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty\n *\n * @param {PIXI.Bounds} bounds other bounds\n * @param {PIXI.Matrix} matrix multiplicator\n */\nBounds.prototype.addBoundsMatrix = function addBoundsMatrix (bounds, matrix)\n{\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n};\n\n/**\n * Adds other Bounds, masked with Rectangle\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\nBounds.prototype.addBoundsArea = function addBoundsArea (bounds, area)\n{\n var _minX = bounds.minX > area.x ? bounds.minX : area.x;\n var _minY = bounds.minY > area.y ? bounds.minY : area.y;\n var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n var minX = this.minX;\n var minY = this.minY;\n var maxX = this.maxX;\n var maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n};\n\n/**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\nBounds.prototype.pad = function pad (paddingX, paddingY)\n{\n paddingX = paddingX || 0;\n paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0);\n\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n};\n\n/**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\nBounds.prototype.addFramePad = function addFramePad (x0, y0, x1, y1, padX, padY)\n{\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n};\n\n// _tempDisplayObjectParent = new DisplayObject();\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should be extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar DisplayObject = /*@__PURE__*/(function (EventEmitter) {\n function DisplayObject()\n {\n EventEmitter.call(this);\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n * @readonly\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n this._boundsID = 0;\n this._lastBoundsID = -1;\n this._boundsRect = null;\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Graphics|PIXI.Sprite|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n if ( EventEmitter ) DisplayObject.__proto__ = EventEmitter;\n DisplayObject.prototype = Object.create( EventEmitter && EventEmitter.prototype );\n DisplayObject.prototype.constructor = DisplayObject;\n\n 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 } };\n\n /**\n * @protected\n * @member {PIXI.DisplayObject}\n */\n DisplayObject.mixin = function mixin (source)\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n var keys = Object.keys(source);\n\n // loop through properties\n for (var i = 0; i < keys.length; ++i)\n {\n var propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n };\n\n prototypeAccessors._tempDisplayObjectParent.get = function ()\n {\n if (this.tempDisplayObjectParent === null)\n {\n this.tempDisplayObjectParent = new DisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n };\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n DisplayObject.prototype.updateTransform = function updateTransform ()\n {\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n this._bounds.updateID++;\n };\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform ()\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n };\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n DisplayObject.prototype.getBounds = function getBounds (skipUpdate, rect)\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._boundsID !== this._lastBoundsID)\n {\n this.calculateBounds();\n this._lastBoundsID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n };\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n DisplayObject.prototype.getLocalBounds = function getLocalBounds (rect)\n {\n var transformRef = this.transform;\n var parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n var bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n return bounds;\n };\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPoint} position - The world origin to calculate from.\n * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.IPoint} A point object representing the position of this object.\n */\n DisplayObject.prototype.toGlobal = function toGlobal (position, point, skipUpdate)\n {\n if ( skipUpdate === void 0 ) skipUpdate = false;\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply(position, point);\n };\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPoint} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.IPoint} A point object representing the position of this object\n */\n DisplayObject.prototype.toLocal = function toLocal (position, from, point, skipUpdate)\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse(position, point);\n };\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n DisplayObject.prototype.render = function render (renderer) // eslint-disable-line no-unused-vars\n {\n // OVERWRITE;\n };\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n DisplayObject.prototype.setParent = function setParent (container)\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n };\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n DisplayObject.prototype.setTransform = function setTransform (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY)\n {\n if ( x === void 0 ) x = 0;\n if ( y === void 0 ) y = 0;\n if ( scaleX === void 0 ) scaleX = 1;\n if ( scaleY === void 0 ) scaleY = 1;\n if ( rotation === void 0 ) rotation = 0;\n if ( skewX === void 0 ) skewX = 0;\n if ( skewY === void 0 ) skewY = 0;\n if ( pivotX === void 0 ) pivotX = 0;\n if ( pivotY === void 0 ) pivotY = 0;\n\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n };\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n DisplayObject.prototype.destroy = function destroy ()\n {\n this.removeAllListeners();\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this._currentBounds = null;\n this._mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n };\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n prototypeAccessors.x.get = function ()\n {\n return this.position.x;\n };\n\n prototypeAccessors.x.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.x = value;\n };\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n prototypeAccessors.y.get = function ()\n {\n return this.position.y;\n };\n\n prototypeAccessors.y.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.y = value;\n };\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n prototypeAccessors.worldTransform.get = function ()\n {\n return this.transform.worldTransform;\n };\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n prototypeAccessors.localTransform.get = function ()\n {\n return this.transform.localTransform;\n };\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.IPoint}\n */\n prototypeAccessors.position.get = function ()\n {\n return this.transform.position;\n };\n\n prototypeAccessors.position.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.copyFrom(value);\n };\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.IPoint}\n */\n prototypeAccessors.scale.get = function ()\n {\n return this.transform.scale;\n };\n\n prototypeAccessors.scale.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.scale.copyFrom(value);\n };\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.IPoint}\n */\n prototypeAccessors.pivot.get = function ()\n {\n return this.transform.pivot;\n };\n\n prototypeAccessors.pivot.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.pivot.copyFrom(value);\n };\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n prototypeAccessors.skew.get = function ()\n {\n return this.transform.skew;\n };\n\n prototypeAccessors.skew.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.skew.copyFrom(value);\n };\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n prototypeAccessors.rotation.get = function ()\n {\n return this.transform.rotation;\n };\n\n prototypeAccessors.rotation.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.rotation = value;\n };\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n prototypeAccessors.angle.get = function ()\n {\n return this.transform.rotation * RAD_TO_DEG;\n };\n\n prototypeAccessors.angle.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.transform.rotation = value * DEG_TO_RAD;\n };\n\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n prototypeAccessors.zIndex.get = function ()\n {\n return this._zIndex;\n };\n\n prototypeAccessors.zIndex.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n };\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n prototypeAccessors.worldVisible.get = function ()\n {\n var item = this;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n };\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Graphics|PIXI.Sprite|null}\n */\n prototypeAccessors.mask.get = function ()\n {\n return this._mask;\n };\n\n prototypeAccessors.mask.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (this._mask)\n {\n var maskObject = this._mask.maskObject || this._mask;\n\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n var maskObject$1 = this._mask.maskObject || this._mask;\n\n maskObject$1.renderable = false;\n maskObject$1.isMask = true;\n }\n };\n\n Object.defineProperties( DisplayObject.prototype, prototypeAccessors );\n\n return DisplayObject;\n}(EventEmitter));\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n\nfunction sortChildren(a, b)\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nvar Container = /*@__PURE__*/(function (DisplayObject) {\n function Container()\n {\n DisplayObject.call(this);\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n if ( DisplayObject ) Container.__proto__ = DisplayObject;\n Container.prototype = Object.create( DisplayObject && DisplayObject.prototype );\n Container.prototype.constructor = Container;\n\n var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n Container.prototype.onChildrenChange = function onChildrenChange ()\n {\n /* empty */\n };\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n Container.prototype.addChild = function addChild (child)\n {\n var arguments$1 = arguments;\n\n var argumentsLength = arguments.length;\n\n // if there is only one argument we can bypass looping through the them\n if (argumentsLength > 1)\n {\n // loop through the arguments property and add all children\n // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes\n for (var i = 0; i < argumentsLength; i++)\n {\n this.addChild(arguments$1[i]);\n }\n }\n else\n {\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return child;\n };\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n Container.prototype.addChildAt = function addChildAt (child, index)\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error((child + \"addChildAt: The index \" + index + \" supplied is out of bounds \" + (this.children.length)));\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n };\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n Container.prototype.swapChildren = function swapChildren (child, child2)\n {\n if (child === child2)\n {\n return;\n }\n\n var index1 = this.getChildIndex(child);\n var index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n };\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n Container.prototype.getChildIndex = function getChildIndex (child)\n {\n var index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n };\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n Container.prototype.setChildIndex = function setChildIndex (child, index)\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error((\"The index \" + index + \" supplied is out of bounds \" + (this.children.length)));\n }\n\n var currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n };\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n Container.prototype.getChildAt = function getChildAt (index)\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error((\"getChildAt: Index (\" + index + \") does not exist.\"));\n }\n\n return this.children[index];\n };\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n Container.prototype.removeChild = function removeChild (child)\n {\n var arguments$1 = arguments;\n\n var argumentsLength = arguments.length;\n\n // if there is only one argument we can bypass looping through the them\n if (argumentsLength > 1)\n {\n // loop through the arguments property and add all children\n // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes\n for (var i = 0; i < argumentsLength; i++)\n {\n this.removeChild(arguments$1[i]);\n }\n }\n else\n {\n var index = this.children.indexOf(child);\n\n if (index === -1) { return null; }\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return child;\n };\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n Container.prototype.removeChildAt = function removeChildAt (index)\n {\n var child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n };\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n Container.prototype.removeChildren = function removeChildren (beginIndex, endIndex)\n {\n if ( beginIndex === void 0 ) beginIndex = 0;\n\n var begin = beginIndex;\n var end = typeof endIndex === 'number' ? endIndex : this.children.length;\n var range = end - begin;\n var removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (var i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (var i$1 = 0; i$1 < removed.length; ++i$1)\n {\n removed[i$1].emit('removed', this);\n this.emit('childRemoved', removed[i$1], this, i$1);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n };\n\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n Container.prototype.sortChildren = function sortChildren$1 ()\n {\n var sortRequired = false;\n\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n var child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n };\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n Container.prototype.updateTransform = function updateTransform ()\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n var child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n };\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n Container.prototype.calculateBounds = function calculateBounds ()\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (var i = 0; i < this.children.length; i++)\n {\n var child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n var maskObject = child._mask.maskObject || child._mask;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._lastBoundsID = this._boundsID;\n };\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n Container.prototype._calculateBounds = function _calculateBounds ()\n {\n // FILL IN//\n };\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype.render = function render (renderer)\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n };\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype.renderAdvanced = function renderAdvanced (renderer)\n {\n renderer.batch.flush();\n\n var filters = this.filters;\n var mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (var i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (var i$1 = 0, j = this.children.length; i$1 < j; i$1++)\n {\n this.children[i$1].render(renderer);\n }\n\n renderer.batch.flush();\n\n if (mask)\n {\n renderer.mask.pop(this, this._mask);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n };\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Container.prototype._render = function _render (renderer) // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n };\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n Container.prototype.destroy = function destroy (options)\n {\n DisplayObject.prototype.destroy.call(this);\n\n this.sortDirty = false;\n\n var destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n var oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (var i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n };\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n return this.scale.x * this.getLocalBounds().width;\n };\n\n prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc\n {\n var width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n };\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n return this.scale.y * this.getLocalBounds().height;\n };\n\n prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc\n {\n var height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n };\n\n Object.defineProperties( Container.prototype, prototypeAccessors );\n\n return Container;\n}(DisplayObject));\n\n// performance increase to avoid using call.. (10x faster)\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n\nexport { Bounds, Container, DisplayObject };\n//# sourceMappingURL=display.es.js.map\n","/*!\n * @pixi/accessibility - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/accessibility is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { DisplayObject } from '@pixi/display';\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.accessibility.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI.accessibility\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibility.accessibleTarget\n * );\n */\nvar accessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: false,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n};\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nvar KEY_CODE_TAB = 9;\n\nvar DIV_TOUCH_SIZE = 100;\nvar DIV_TOUCH_POS_X = 0;\nvar DIV_TOUCH_POS_Y = 0;\nvar DIV_TOUCH_ZINDEX = 2;\n\nvar DIV_HOOK_SIZE = 1;\nvar DIV_HOOK_POS_X = -1000;\nvar DIV_HOOK_POS_Y = -1000;\nvar DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI.accessibility\n */\nvar AccessibilityManager = function AccessibilityManager(renderer)\n{\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n var div = document.createElement('div');\n\n div.style.width = DIV_TOUCH_SIZE + \"px\";\n div.style.height = DIV_TOUCH_SIZE + \"px\";\n div.style.position = 'absolute';\n div.style.top = DIV_TOUCH_POS_X + \"px\";\n div.style.left = DIV_TOUCH_POS_Y + \"px\";\n div.style.zIndex = DIV_TOUCH_ZINDEX;\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n /**\n * A flag\n * @type {boolean}\n * @readonly\n */\n this.isActive = false;\n\n /**\n * A flag\n * @type {boolean}\n * @readonly\n */\n this.isMobileAccessibility = false;\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n};\n\n/**\n * Creates the touch hooks.\n *\n * @private\n */\nAccessibilityManager.prototype.createTouchHook = function createTouchHook ()\n{\n var this$1 = this;\n\n var hookDiv = document.createElement('button');\n\n hookDiv.style.width = DIV_HOOK_SIZE + \"px\";\n hookDiv.style.height = DIV_HOOK_SIZE + \"px\";\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = DIV_HOOK_POS_X + \"px\";\n hookDiv.style.left = DIV_HOOK_POS_Y + \"px\";\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX;\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'HOOK DIV';\n\n hookDiv.addEventListener('focus', function () {\n this$1.isMobileAccessibility = true;\n this$1.activate();\n this$1.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n};\n\n/**\n * Destroys the touch hooks.\n *\n * @private\n */\nAccessibilityManager.prototype.destroyTouchHook = function destroyTouchHook ()\n{\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n};\n\n/**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\nAccessibilityManager.prototype.activate = function activate ()\n{\n if (this.isActive)\n {\n return;\n }\n\n this.isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.on('postrender', this.update, this);\n\n if (this.renderer.view.parentNode)\n {\n this.renderer.view.parentNode.appendChild(this.div);\n }\n};\n\n/**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\nAccessibilityManager.prototype.deactivate = function deactivate ()\n{\n if (!this.isActive || this.isMobileAccessibility)\n {\n return;\n }\n\n this.isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n};\n\n/**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\nAccessibilityManager.prototype.updateAccessibleObjects = function updateAccessibleObjects (displayObject)\n{\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n var children = displayObject.children;\n\n for (var i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i]);\n }\n};\n\n/**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\nAccessibilityManager.prototype.update = function update ()\n{\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n // update children...\n this.updateAccessibleObjects(this.renderer._lastObjectRendered);\n\n var rect = this.renderer.view.getBoundingClientRect();\n var sx = rect.width / this.renderer.width;\n var sy = rect.height / this.renderer.height;\n\n var div = this.div;\n\n div.style.left = (rect.left) + \"px\";\n div.style.top = (rect.top) + \"px\";\n div.style.width = (this.renderer.width) + \"px\";\n div.style.height = (this.renderer.height) + \"px\";\n\n for (var i = 0; i < this.children.length; i++)\n {\n var child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n\n if (this.children.length === 0)\n {\n this.deactivate();\n }\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n var hitArea = child.hitArea;\n var wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = ((wt.tx + (hitArea.x * wt.a)) * sx) + \"px\";\n div.style.top = ((wt.ty + (hitArea.y * wt.d)) * sy) + \"px\";\n\n div.style.width = (hitArea.width * wt.a * sx) + \"px\";\n div.style.height = (hitArea.height * wt.d * sy) + \"px\";\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = (hitArea.x * sx) + \"px\";\n div.style.top = (hitArea.y * sy) + \"px\";\n\n div.style.width = (hitArea.width * sx) + \"px\";\n div.style.height = (hitArea.height * sy) + \"px\";\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) { this.updateDebugHTML(div); }\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n};\n\n/**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLDivElement} div\n */\nAccessibilityManager.prototype.updateDebugHTML = function updateDebugHTML (div)\n{\n div.innerHTML = \"type: \" + (div.type) + \"
title : \" + (div.title) + \"
tabIndex: \" + (div.tabIndex);\n};\n\n/**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\nAccessibilityManager.prototype.capHitArea = function capHitArea (hitArea)\n{\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n if (hitArea.x + hitArea.width > this.renderer.width)\n {\n hitArea.width = this.renderer.width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > this.renderer.height)\n {\n hitArea.height = this.renderer.height - hitArea.y;\n }\n};\n\n/**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\nAccessibilityManager.prototype.addChild = function addChild (displayObject)\n{\n //this.activate();\n\n var div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = DIV_TOUCH_SIZE + \"px\";\n div.style.height = DIV_TOUCH_SIZE + \"px\";\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX;\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = \"displayObject \" + (displayObject.tabIndex);\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) { this.updateDebugHTML(div); }\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n};\n\n/**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\nAccessibilityManager.prototype._onClick = function _onClick (e)\n{\n var interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);\n interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);\n interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);\n};\n\n/**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\nAccessibilityManager.prototype._onFocus = function _onFocus (e)\n{\n if (!e.target.getAttribute('aria-live', 'off'))\n {\n e.target.setAttribute('aria-live', 'assertive');\n }\n var interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);\n};\n\n/**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\nAccessibilityManager.prototype._onFocusOut = function _onFocusOut (e)\n{\n if (!e.target.getAttribute('aria-live', 'off'))\n {\n e.target.setAttribute('aria-live', 'polite');\n }\n var interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);\n};\n\n/**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\nAccessibilityManager.prototype._onKeyDown = function _onKeyDown (e)\n{\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n};\n\n/**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\nAccessibilityManager.prototype._onMouseMove = function _onMouseMove (e)\n{\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n};\n\n/**\n * Destroys the accessibility manager\n *\n */\nAccessibilityManager.prototype.destroy = function destroy ()\n{\n this.destroyTouchHook();\n this.div = null;\n\n for (var i = 0; i < this.children.length; i++)\n {\n this.children[i].div = null;\n }\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n};\n\n/**\n * This namespace contains an accessibility plugin for allowing interaction via the keyboard.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @namespace PIXI.accessibility\n */\n\nexport { AccessibilityManager, accessibleTarget };\n//# sourceMappingURL=accessibility.es.js.map\n","/*!\n * @pixi/runner - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/runner is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nvar Runner = /** @class */ (function () {\n /**\n * @param {string} name the function name that will be executed on the listeners added to this Runner.\n */\n function Runner(name) {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) {\n if (arguments.length > 8) {\n throw new Error('max arguments reached');\n }\n var _a = this, name = _a.name, items = _a.items;\n this._aliasCount++;\n for (var i = 0, len = items.length; i < len; i++) {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n if (items === this.items) {\n this._aliasCount--;\n }\n return this;\n };\n Runner.prototype.ensureNonAliasedItems = function () {\n if (this._aliasCount > 0 && this.items.length > 1) {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n };\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n Runner.prototype.add = function (item) {\n if (item[this._name]) {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n return this;\n };\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n Runner.prototype.remove = function (item) {\n var index = this.items.indexOf(item);\n if (index !== -1) {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n return this;\n };\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n Runner.prototype.contains = function (item) {\n return this.items.indexOf(item) !== -1;\n };\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n Runner.prototype.removeAll = function () {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n return this;\n };\n /**\n * Remove all references, don't use after this.\n */\n Runner.prototype.destroy = function () {\n this.removeAll();\n this.items = null;\n this._name = null;\n };\n Object.defineProperty(Runner.prototype, \"empty\", {\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n get: function () {\n return this.items.length === 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Runner.prototype, \"name\", {\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n get: function () {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n return Runner;\n}());\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n\nexport { Runner };\n//# sourceMappingURL=runner.es.js.map\n","/*!\n * @pixi/ticker - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/ticker is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\n/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.interaction.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.prepare.BasePrepare} utility.\n */\nvar UPDATE_PRIORITY;\n(function (UPDATE_PRIORITY) {\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"INTERACTION\"] = 50] = \"INTERACTION\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"HIGH\"] = 25] = \"HIGH\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"NORMAL\"] = 0] = \"NORMAL\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"LOW\"] = -25] = \"LOW\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"UTILITY\"] = -50] = \"UTILITY\";\n})(UPDATE_PRIORITY || (UPDATE_PRIORITY = {}));\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nvar TickerListener = /** @class */ (function () {\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n function TickerListener(fn, context, priority, once) {\n if (context === void 0) { context = null; }\n if (priority === void 0) { priority = 0; }\n if (once === void 0) { once = false; }\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n TickerListener.prototype.match = function (fn, context) {\n if (context === void 0) { context = null; }\n return this.fn === fn && this.context === context;\n };\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n TickerListener.prototype.emit = function (deltaTime) {\n if (this.fn) {\n if (this.context) {\n this.fn.call(this.context, deltaTime);\n }\n else {\n this.fn(deltaTime);\n }\n }\n var redirect = this.next;\n if (this.once) {\n this.destroy(true);\n }\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed) {\n this.next = null;\n }\n return redirect;\n };\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n TickerListener.prototype.connect = function (previous) {\n this.previous = previous;\n if (previous.next) {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n };\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n TickerListener.prototype.destroy = function (hard) {\n if (hard === void 0) { hard = false; }\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n // Disconnect, hook up next and previous\n if (this.previous) {\n this.previous.next = this.next;\n }\n if (this.next) {\n this.next.previous = this.previous;\n }\n // Redirect to the next item\n var redirect = this.next;\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n return redirect;\n };\n return TickerListener;\n}());\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nvar Ticker = /** @class */ (function () {\n function Ticker() {\n var _this = this;\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / settings.TARGET_FPMS;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = function (time) {\n _this._requestId = null;\n if (_this.started) {\n // Invoke listeners now\n _this.update(time);\n // Listener side effects may have modified ticker state.\n if (_this.started && _this._requestId === null && _this._head.next) {\n _this._requestId = requestAnimationFrame(_this._tick);\n }\n }\n };\n }\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n Ticker.prototype._requestIfNeeded = function () {\n if (this._requestId === null && this._head.next) {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n };\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n Ticker.prototype._cancelIfNeeded = function () {\n if (this._requestId !== null) {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n };\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n Ticker.prototype._startIfPossible = function () {\n if (this.started) {\n this._requestIfNeeded();\n }\n else if (this.autoStart) {\n this.start();\n }\n };\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.add = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority));\n };\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.addOnce = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority, true));\n };\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype._addListener = function (listener) {\n // For attaching to head\n var current = this._head.next;\n var previous = this._head;\n // Add the first item\n if (!current) {\n listener.connect(previous);\n }\n else {\n // Go from highest to lowest priority\n while (current) {\n if (listener.priority > current.priority) {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n // Not yet connected\n if (!listener.previous) {\n listener.connect(previous);\n }\n }\n this._startIfPossible();\n return this;\n };\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n Ticker.prototype.remove = function (fn, context) {\n var listener = this._head.next;\n while (listener) {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context)) {\n listener = listener.destroy();\n }\n else {\n listener = listener.next;\n }\n }\n if (!this._head.next) {\n this._cancelIfNeeded();\n }\n return this;\n };\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n Ticker.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this._requestIfNeeded();\n }\n };\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n Ticker.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this._cancelIfNeeded();\n }\n };\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n Ticker.prototype.destroy = function () {\n if (!this._protected) {\n this.stop();\n var listener = this._head.next;\n while (listener) {\n listener = listener.destroy(true);\n }\n this._head.destroy();\n this._head = null;\n }\n };\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n Ticker.prototype.update = function (currentTime) {\n if (currentTime === void 0) { currentTime = performance.now(); }\n var elapsedMS;\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n if (currentTime > this.lastTime) {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS) {\n elapsedMS = this._maxElapsedMS;\n }\n elapsedMS *= this.speed;\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS) {\n var delta = currentTime - this._lastFrame | 0;\n if (delta < this._minElapsedMS) {\n return;\n }\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n var head = this._head;\n // Invoke listeners added to internal emitter\n var listener = head.next;\n while (listener) {\n listener = listener.emit(this.deltaTime);\n }\n if (!head.next) {\n this._cancelIfNeeded();\n }\n }\n else {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n this.lastTime = currentTime;\n };\n Object.defineProperty(Ticker.prototype, \"FPS\", {\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return 1000 / this.elapsedMS;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"minFPS\", {\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get: function () {\n return 1000 / this._maxElapsedMS;\n },\n set: function (fps) {\n // Minimum must be below the maxFPS\n var minFPS = Math.min(this.maxFPS, fps);\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n this._maxElapsedMS = 1 / minFPMS;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"maxFPS\", {\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get: function () {\n if (this._minElapsedMS) {\n return Math.round(1000 / this._minElapsedMS);\n }\n return 0;\n },\n set: function (fps) {\n if (fps === 0) {\n this._minElapsedMS = 0;\n }\n else {\n // Max must be at least the minFPS\n var maxFPS = Math.max(this.minFPS, fps);\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Ticker, \"shared\", {\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._shared) {\n var shared = Ticker._shared = new Ticker();\n shared.autoStart = true;\n shared._protected = true;\n }\n return Ticker._shared;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Ticker, \"system\", {\n /**\n * The system ticker instance used by {@link PIXI.interaction.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._system) {\n var system = Ticker._system = new Ticker();\n system.autoStart = true;\n system._protected = true;\n }\n return Ticker._system;\n },\n enumerable: true,\n configurable: true\n });\n return Ticker;\n}());\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nvar TickerPlugin = /** @class */ (function () {\n function TickerPlugin() {\n }\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n TickerPlugin.init = function (options) {\n var _this = this;\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n // Create ticker setter\n Object.defineProperty(this, 'ticker', {\n set: function (ticker) {\n if (this._ticker) {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker) {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get: function () {\n return this._ticker;\n },\n });\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = function () {\n _this._ticker.stop();\n };\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = function () {\n _this._ticker.start();\n };\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n // Start the rendering\n if (options.autoStart) {\n this.start();\n }\n };\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n TickerPlugin.destroy = function () {\n if (this._ticker) {\n var oldTicker = this._ticker;\n this.ticker = null;\n oldTicker.destroy();\n }\n };\n return TickerPlugin;\n}());\n\nexport { Ticker, TickerPlugin, UPDATE_PRIORITY };\n//# sourceMappingURL=ticker.es.js.map\n","/*!\n * @pixi/core - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/core is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Runner } from '@pixi/runner';\nimport { determineCrossOrigin, isPow2, BaseTextureCache, TextureCache, uid, EventEmitter, getResolutionOfUrl, nextPow2, isMobile, ProgramCache, removeItems, hex2string, hex2rgb, deprecation, isWebGLSupported, sayHello, premultiplyBlendMode, log2, premultiplyTint } from '@pixi/utils';\nimport { ALPHA_MODES, SCALE_MODES, FORMATS, TYPES, TARGETS, DRAW_MODES, ENV, MASK_TYPES, PRECISION, BLEND_MODES, GC_MODES, MIPMAP_MODES, WRAP_MODES, RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { Ticker } from '@pixi/ticker';\nimport { groupD8, Rectangle, Point, Matrix } from '@pixi/math';\nimport { Container } from '@pixi/display';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nvar Resource = function Resource(width, height)\n{\n if ( width === void 0 ) width = 0;\n if ( height === void 0 ) height = 0;\n\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n\n /**\n * Mini-runner for handling resize events\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new Runner('setRealSize', 2);\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new Runner('update');\n\n /**\n * Handle internal errors, such as loading errors\n *\n * @member {Runner}\n * @private\n */\n this.onError = new Runner('onError', 1);\n};\n\nvar prototypeAccessors = { valid: { configurable: true },width: { configurable: true },height: { configurable: true } };\n\n/**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\nResource.prototype.bind = function bind (baseTexture)\n{\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.run(this._width, this._height);\n }\n};\n\n/**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\nResource.prototype.unbind = function unbind (baseTexture)\n{\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n};\n\n/**\n * Trigger a resize event\n * @param {number} width X dimension\n * @param {number} height Y dimension\n */\nResource.prototype.resize = function resize (width, height)\n{\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.run(width, height);\n }\n};\n\n/**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\nprototypeAccessors.valid.get = function ()\n{\n return !!this._width && !!this._height;\n};\n\n/**\n * Has been updated trigger event\n */\nResource.prototype.update = function update ()\n{\n if (!this.destroyed)\n {\n this.onUpdate.run();\n }\n};\n\n/**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\nResource.prototype.load = function load ()\n{\n return Promise.resolve();\n};\n\n/**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\nprototypeAccessors.width.get = function ()\n{\n return this._width;\n};\n\n/**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\nprototypeAccessors.height.get = function ()\n{\n return this._height;\n};\n\n/**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} true is success\n */\nResource.prototype.upload = function upload (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars\n{\n return false;\n};\n\n/**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\nResource.prototype.style = function style (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars\n{\n return false;\n};\n\n/**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\nResource.prototype.dispose = function dispose ()\n{\n // override\n};\n\n/**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\nResource.prototype.destroy = function destroy ()\n{\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n};\n\nObject.defineProperties( Resource.prototype, prototypeAccessors );\n\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nvar BaseImageResource = /*@__PURE__*/(function (Resource) {\n function BaseImageResource(source)\n {\n var width = source.naturalWidth || source.videoWidth || source.width;\n var height = source.naturalHeight || source.videoHeight || source.height;\n\n Resource.call(this, width, height);\n\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n this.source = source;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n this.noSubImage = false;\n }\n\n if ( Resource ) BaseImageResource.__proto__ = Resource;\n BaseImageResource.prototype = Object.create( Resource && Resource.prototype );\n BaseImageResource.prototype.constructor = BaseImageResource;\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n BaseImageResource.crossOrigin = function crossOrigin (element, url, crossorigin)\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n };\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n BaseImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture, source)\n {\n var gl = renderer.gl;\n var width = baseTexture.realWidth;\n var height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n\n return true;\n };\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n BaseImageResource.prototype.update = function update ()\n {\n if (this.destroyed)\n {\n return;\n }\n\n var width = this.source.naturalWidth || this.source.videoWidth || this.source.width;\n var height = this.source.naturalHeight || this.source.videoHeight || this.source.height;\n\n this.resize(width, height);\n\n Resource.prototype.update.call(this);\n };\n\n /**\n * Destroy this BaseImageResource\n * @override\n * @param {PIXI.BaseTexture} [fromTexture] Optional base texture\n * @return {boolean} Destroy was successful\n */\n BaseImageResource.prototype.dispose = function dispose ()\n {\n this.source = null;\n };\n\n return BaseImageResource;\n}(Resource));\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nvar ImageResource = /*@__PURE__*/(function (BaseImageResource) {\n function ImageResource(source, options)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n var imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n BaseImageResource.call(this, source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n /**\n * URL of the image source\n * @member {string}\n */\n this.url = source.src;\n\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n this._process = null;\n\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n this.preserveBitmap = false;\n\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n if (options.premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n this.premultiplyAlpha = options.premultiplyAlpha;\n }\n\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n this.bitmap = null;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n if ( BaseImageResource ) ImageResource.__proto__ = BaseImageResource;\n ImageResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );\n ImageResource.prototype.constructor = ImageResource;\n\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap=true] whether process image into bitmap\n * @returns {Promise}\n */\n ImageResource.prototype.load = function load (createBitmap)\n {\n var this$1 = this;\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise(function (resolve) {\n this$1.url = this$1.source.src;\n var ref = this$1;\n var source = ref.source;\n\n var completed = function () {\n if (this$1.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this$1.resize(source.width, source.height);\n this$1._load = null;\n\n if (this$1.createBitmap)\n {\n resolve(this$1.process());\n }\n else\n {\n resolve(this$1);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = function (event) { return this$1.onError.run(event); };\n }\n });\n\n return this._load;\n };\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n ImageResource.prototype.process = function process ()\n {\n var this$1 = this;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n this._process = window.createImageBitmap(this.source,\n 0, 0, this.source.width, this.source.height,\n {\n premultiplyAlpha: this.premultiplyAlpha === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then(function (bitmap) {\n if (this$1.destroyed)\n {\n return Promise.reject();\n }\n this$1.bitmap = bitmap;\n this$1.update();\n this$1._process = null;\n\n return Promise.resolve(this$1);\n });\n\n return this._process;\n };\n\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n ImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture)\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n var flag = true;\n\n for (var key in baseTexture._glTextures)\n {\n var otherTex = baseTexture._glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n };\n\n /**\n * Destroys this texture\n * @override\n */\n ImageResource.prototype.dispose = function dispose ()\n {\n this.source.onload = null;\n this.source.onerror = null;\n\n BaseImageResource.prototype.dispose.call(this);\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n };\n\n return ImageResource;\n}(BaseImageResource));\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nvar INSTALLED = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nfunction autoDetectResource(source, options)\n{\n if (!source)\n {\n return null;\n }\n\n var extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n var result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (var i = INSTALLED.length - 1; i >= 0; --i)\n {\n var ResourcePlugin = INSTALLED[i];\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n // When in doubt: probably an image\n // might be appropriate to throw an error or return null\n return new ImageResource(source, options);\n}\n\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nvar BufferResource = /*@__PURE__*/(function (Resource) {\n function BufferResource(source, options)\n {\n var ref = options || {};\n var width = ref.width;\n var height = ref.height;\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n Resource.call(this, width, height);\n\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n this.data = source;\n }\n\n if ( Resource ) BufferResource.__proto__ = Resource;\n BufferResource.prototype = Object.create( Resource && Resource.prototype );\n BufferResource.prototype.constructor = BufferResource;\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture Reference to parent texture\n * @param {PIXI.GLTexture} glTexture glTexture\n * @returns {boolean} true is success\n */\n BufferResource.prototype.upload = function upload (renderer, baseTexture, glTexture)\n {\n var gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n };\n\n /**\n * Destroy and don't use after this\n * @override\n */\n BufferResource.prototype.dispose = function dispose ()\n {\n this.data = null;\n };\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n BufferResource.test = function test (source)\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n };\n\n return BufferResource;\n}(Resource));\n\nvar defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nvar BaseTexture = /*@__PURE__*/(function (EventEmitter) {\n function BaseTexture(resource, options)\n {\n if ( resource === void 0 ) resource = null;\n if ( options === void 0 ) options = null;\n\n EventEmitter.call(this);\n\n options = options || {};\n\n var alphaMode = options.alphaMode;\n var mipmap = options.mipmap;\n var anisotropicLevel = options.anisotropicLevel;\n var scaleMode = options.scaleMode;\n var width = options.width;\n var height = options.height;\n var wrapMode = options.wrapMode;\n var format = options.format;\n var type = options.type;\n var target = options.target;\n var resolution = options.resolution;\n var resourceOptions = options.resourceOptions;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = width || 0;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = height || 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n\n /**\n * How the texture wraps\n * @member {number}\n */\n this.wrapMode = wrapMode || settings.WRAP_MODE;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n this.format = format || FORMATS.RGBA;\n\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n this.type = type || TYPES.UNSIGNED_BYTE;\n\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n this.target = target || TARGETS.TEXTURE_2D;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n if (options.premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n this.premultiplyAlpha = options.premultiplyAlpha;\n }\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {string}\n * @protected\n */\n this.uid = uid();\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n this.touched = 0;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n this._glTextures = {};\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n this.dirtyStyleId = 0;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n this.cacheId = null;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n this.valid = width > 0 && height > 0;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n this.textureCacheIds = [];\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n this.destroyed = false;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n this.resource = null;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchEnabled = 0;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchLocation = 0;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n if ( EventEmitter ) BaseTexture.__proto__ = EventEmitter;\n BaseTexture.prototype = Object.create( EventEmitter && EventEmitter.prototype );\n BaseTexture.prototype.constructor = BaseTexture;\n\n var prototypeAccessors = { realWidth: { configurable: true },realHeight: { configurable: true } };\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n prototypeAccessors.realWidth.get = function ()\n {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n };\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n prototypeAccessors.realHeight.get = function ()\n {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n };\n\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setStyle = function setStyle (scaleMode, mipmap)\n {\n var dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n };\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width Visual width\n * @param {number} height Visual height\n * @param {number} [resolution] Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setSize = function setSize (width, height, resolution)\n {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n\n return this;\n };\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth Full rendered width\n * @param {number} realHeight Full rendered height\n * @param {number} [resolution] Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setRealSize = function setRealSize (realWidth, realHeight, resolution)\n {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n };\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n BaseTexture.prototype._refreshPOT = function _refreshPOT ()\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n };\n\n /**\n * Changes resolution\n *\n * @param {number} [resolution] res\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResolution = function setResolution (resolution)\n {\n var oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n };\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResource = function setResource (resource)\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n };\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n BaseTexture.prototype.update = function update ()\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n };\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n BaseTexture.prototype.onError = function onError (event)\n {\n this.emit('error', this, event);\n };\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n BaseTexture.prototype.destroy = function destroy ()\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n };\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseTexture.prototype.dispose = function dispose ()\n {\n this.emit('dispose', this);\n };\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n BaseTexture.from = function from (source, options, strict)\n {\n if ( strict === void 0 ) strict = settings.STRICT_TEXTURE_CACHE;\n\n var isFrame = typeof source === 'string';\n var cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!source._pixiId)\n {\n source._pixiId = \"pixiid_\" + (uid());\n }\n\n cacheId = source._pixiId;\n }\n\n var baseTexture = BaseTextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error((\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in BaseTextureCache.\"));\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n };\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n BaseTexture.fromBuffer = function fromBuffer (buffer, width, height, options)\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n var resource = new BufferResource(buffer, { width: width, height: height });\n var type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type }));\n };\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n BaseTexture.addToCache = function addToCache (baseTexture, id)\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn((\"BaseTexture added to the cache with an id [\" + id + \"] that already had an entry\"));\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n };\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n BaseTexture.removeFromCache = function removeFromCache (baseTexture)\n {\n if (typeof baseTexture === 'string')\n {\n var baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (var i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n };\n\n Object.defineProperties( BaseTexture.prototype, prototypeAccessors );\n\n return BaseTexture;\n}(EventEmitter));\n\n/**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\nBaseTexture._globalBatch = 0;\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nvar ArrayResource = /*@__PURE__*/(function (Resource) {\n function ArrayResource(source, options)\n {\n options = options || {};\n\n var urls;\n var length = source;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n\n Resource.call(this, options.width, options.height);\n\n /**\n * Collection of resources.\n * @member {Array}\n * @readonly\n */\n this.items = [];\n\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n this.itemDirtyIds = [];\n\n for (var i = 0; i < length; i++)\n {\n var partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n this.itemDirtyIds.push(-1);\n }\n\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n this.length = length;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (urls)\n {\n for (var i$1 = 0; i$1 < length; i$1++)\n {\n this.addResourceAt(autoDetectResource(urls[i$1], options), i$1);\n }\n }\n }\n\n if ( Resource ) ArrayResource.__proto__ = Resource;\n ArrayResource.prototype = Object.create( Resource && Resource.prototype );\n ArrayResource.prototype.constructor = ArrayResource;\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n ArrayResource.prototype.dispose = function dispose ()\n {\n for (var i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n };\n\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n ArrayResource.prototype.addResourceAt = function addResourceAt (resource, index)\n {\n var baseTexture = this.items[index];\n\n if (!baseTexture)\n {\n throw new Error((\"Index \" + index + \" is out of bounds\"));\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n };\n\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n ArrayResource.prototype.bind = function bind (baseTexture)\n {\n Resource.prototype.bind.call(this, baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n\n for (var i = 0; i < this.length; i++)\n {\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n };\n\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n ArrayResource.prototype.unbind = function unbind (baseTexture)\n {\n Resource.prototype.unbind.call(this, baseTexture);\n\n for (var i = 0; i < this.length; i++)\n {\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n };\n\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n ArrayResource.prototype.load = function load ()\n {\n var this$1 = this;\n\n if (this._load)\n {\n return this._load;\n }\n\n var resources = this.items.map(function (item) { return item.resource; });\n\n // TODO: also implement load part-by-part strategy\n var promises = resources.map(function (item) { return item.load(); });\n\n this._load = Promise.all(promises)\n .then(function () {\n var ref = resources[0];\n var width = ref.width;\n var height = ref.height;\n\n this$1.resize(width, height);\n\n return Promise.resolve(this$1);\n }\n );\n\n return this._load;\n };\n\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n ArrayResource.prototype.upload = function upload (renderer, texture, glTexture)\n {\n var ref = this;\n var length = ref.length;\n var itemDirtyIds = ref.itemDirtyIds;\n var items = ref.items;\n var gl = renderer.gl;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n texture.format,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n\n for (var i = 0; i < length; i++)\n {\n var item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n texture.type,\n item.resource.source\n );\n }\n }\n }\n\n return true;\n };\n\n return ArrayResource;\n}(Resource));\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nvar CanvasResource = /*@__PURE__*/(function (BaseImageResource) {\n function CanvasResource () {\n BaseImageResource.apply(this, arguments);\n }\n\n if ( BaseImageResource ) CanvasResource.__proto__ = BaseImageResource;\n CanvasResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );\n CanvasResource.prototype.constructor = CanvasResource;\n\n CanvasResource.test = function test (source)\n {\n var OffscreenCanvas = window.OffscreenCanvas;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return source instanceof HTMLCanvasElement;\n };\n\n return CanvasResource;\n}(BaseImageResource));\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n */\nvar CubeResource = /*@__PURE__*/(function (ArrayResource) {\n function CubeResource(source, options)\n {\n options = options || {};\n\n ArrayResource.call(this, source, options);\n\n if (this.length !== CubeResource.SIDES)\n {\n throw new Error((\"Invalid length. Got \" + (this.length) + \", expected 6\"));\n }\n\n for (var i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n if ( ArrayResource ) CubeResource.__proto__ = ArrayResource;\n CubeResource.prototype = Object.create( ArrayResource && ArrayResource.prototype );\n CubeResource.prototype.constructor = CubeResource;\n\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n CubeResource.prototype.bind = function bind (baseTexture)\n {\n ArrayResource.prototype.bind.call(this, baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n };\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n CubeResource.prototype.upload = function upload (renderer, baseTexture, glTexture)\n {\n var dirty = this.itemDirtyIds;\n\n for (var i = 0; i < CubeResource.SIDES; i++)\n {\n var side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n dirty[i] = side.dirtyId;\n if (side.valid)\n {\n side.resource.upload(renderer, side, glTexture);\n }\n }\n }\n\n return true;\n };\n\n return CubeResource;\n}(ArrayResource));\n\n/**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\nCubeResource.SIDES = 6;\n\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] Start loading right away.\n */\nvar SVGResource = /*@__PURE__*/(function (BaseImageResource) {\n function SVGResource(source, options)\n {\n options = options || {};\n\n BaseImageResource.call(this, document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n this.svg = source;\n\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n this.scale = options.scale || 1;\n\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideWidth = options.width;\n\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideHeight = options.height;\n\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n this._resolve = null;\n\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n this._crossorigin = options.crossorigin;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n if ( BaseImageResource ) SVGResource.__proto__ = BaseImageResource;\n SVGResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );\n SVGResource.prototype.constructor = SVGResource;\n\n SVGResource.prototype.load = function load ()\n {\n var this$1 = this;\n\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise(function (resolve) {\n // Save this until after load is finished\n this$1._resolve = function () {\n this$1.resize(this$1.source.width, this$1.source.height);\n resolve(this$1);\n };\n\n // Convert SVG inline string to data-uri\n if ((/^\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nvar VideoResource = /*@__PURE__*/(function (BaseImageResource) {\n function VideoResource(source, options)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n var videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n BaseImageResource.crossOrigin(videoElement, (source[0].src || source[0]), options.crossorigin);\n\n // array of objects or strings\n for (var i = 0; i < source.length; ++i)\n {\n var sourceElement = document.createElement('source');\n\n var ref = source[i];\n var src = ref.src;\n var mime = ref.mime;\n\n src = src || source[i];\n\n var baseSrc = src.split('?').shift().toLowerCase();\n var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || (\"video/\" + ext);\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n BaseImageResource.call(this, source);\n\n this.noSubImage = true;\n this._autoUpdate = true;\n this._isAutoUpdating = false;\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = options.autoPlay !== false;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n if ( BaseImageResource ) VideoResource.__proto__ = BaseImageResource;\n VideoResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );\n VideoResource.prototype.constructor = VideoResource;\n\n var prototypeAccessors = { autoUpdate: { configurable: true },updateFPS: { configurable: true } };\n\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n VideoResource.prototype.update = function update (deltaTime)\n {\n if ( deltaTime === void 0 ) deltaTime = 0;\n\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n BaseImageResource.prototype.update.call(this, deltaTime);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n };\n\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n VideoResource.prototype.load = function load ()\n {\n var this$1 = this;\n\n if (this._load)\n {\n return this._load;\n }\n\n var source = this.source;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n source.complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise(function (resolve) {\n if (this$1.valid)\n {\n resolve(this$1);\n }\n else\n {\n this$1._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n };\n\n /**\n * Handle video error events.\n *\n * @private\n */\n VideoResource.prototype._onError = function _onError ()\n {\n this.source.removeEventListener('error', this._onError, true);\n this.onError.run(event);\n };\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n VideoResource.prototype._isSourcePlaying = function _isSourcePlaying ()\n {\n var source = this.source;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n };\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n VideoResource.prototype._isSourceReady = function _isSourceReady ()\n {\n return this.source.readyState === 3 || this.source.readyState === 4;\n };\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n VideoResource.prototype._onPlayStart = function _onPlayStart ()\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (!this._isAutoUpdating && this.autoUpdate)\n {\n Ticker.shared.add(this.update, this);\n this._isAutoUpdating = true;\n }\n };\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n VideoResource.prototype._onPlayStop = function _onPlayStop ()\n {\n if (this._isAutoUpdating)\n {\n Ticker.shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n };\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n VideoResource.prototype._onCanPlay = function _onCanPlay ()\n {\n var ref = this;\n var source = ref.source;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n var valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n };\n\n /**\n * Destroys this texture\n * @override\n */\n VideoResource.prototype.dispose = function dispose ()\n {\n if (this._isAutoUpdating)\n {\n Ticker.shared.remove(this.update, this);\n }\n\n if (this.source)\n {\n this.source.removeEventListener('error', this._onError, true);\n this.source.pause();\n this.source.src = '';\n this.source.load();\n }\n BaseImageResource.prototype.dispose.call(this);\n };\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n prototypeAccessors.autoUpdate.get = function ()\n {\n return this._autoUpdate;\n };\n\n prototypeAccessors.autoUpdate.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isAutoUpdating)\n {\n Ticker.shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n else if (this._autoUpdate && !this._isAutoUpdating)\n {\n Ticker.shared.add(this.update, this);\n this._isAutoUpdating = true;\n }\n }\n };\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n prototypeAccessors.updateFPS.get = function ()\n {\n return this._updateFPS;\n };\n\n prototypeAccessors.updateFPS.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n };\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n VideoResource.test = function test (source, extension)\n {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n };\n\n Object.defineProperties( VideoResource.prototype, prototypeAccessors );\n\n return VideoResource;\n}(BaseImageResource));\n\n/**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\nVideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nvar ImageBitmapResource = /*@__PURE__*/(function (BaseImageResource) {\n function ImageBitmapResource () {\n BaseImageResource.apply(this, arguments);\n }\n\n if ( BaseImageResource ) ImageBitmapResource.__proto__ = BaseImageResource;\n ImageBitmapResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype );\n ImageBitmapResource.prototype.constructor = ImageBitmapResource;\n\n ImageBitmapResource.test = function test (source)\n {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n };\n\n return ImageBitmapResource;\n}(BaseImageResource));\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nvar index = ({\n INSTALLED: INSTALLED,\n autoDetectResource: autoDetectResource,\n ArrayResource: ArrayResource,\n BufferResource: BufferResource,\n CanvasResource: CanvasResource,\n CubeResource: CubeResource,\n ImageResource: ImageResource,\n ImageBitmapResource: ImageBitmapResource,\n SVGResource: SVGResource,\n VideoResource: VideoResource,\n Resource: Resource,\n BaseImageResource: BaseImageResource\n});\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nvar System = function System(renderer)\n{\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n};\n\n/**\n * Generic destroy methods to be overridden by the subclass\n */\nSystem.prototype.destroy = function destroy ()\n{\n this.renderer = null;\n};\n\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nvar DepthResource = /*@__PURE__*/(function (BufferResource) {\n function DepthResource () {\n BufferResource.apply(this, arguments);\n }\n\n if ( BufferResource ) DepthResource.__proto__ = BufferResource;\n DepthResource.prototype = Object.create( BufferResource && BufferResource.prototype );\n DepthResource.prototype.constructor = DepthResource;\n\n DepthResource.prototype.upload = function upload (renderer, baseTexture, glTexture)\n {\n var gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n gl.DEPTH_COMPONENT16, // Needed for depth to render properly in webgl2.0\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n\n return true;\n };\n\n return DepthResource;\n}(BufferResource));\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nvar Framebuffer = function Framebuffer(width, height)\n{\n this.width = Math.ceil(width || 100);\n this.height = Math.ceil(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer', 2);\n};\n\nvar prototypeAccessors$1 = { colorTexture: { configurable: true } };\n\n/**\n * Reference to the colorTexture.\n *\n * @member {PIXI.Texture[]}\n * @readonly\n */\nprototypeAccessors$1.colorTexture.get = function ()\n{\n return this.colorTextures[0];\n};\n\n/**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.Texture} [texture] - Texture to add to the array\n */\nFramebuffer.prototype.addColorTexture = function addColorTexture (index, texture)\n{\n if ( index === void 0 ) index = 0;\n\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, { scaleMode: 0,\n resolution: 1,\n mipmap: false,\n width: this.width,\n height: this.height });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n};\n\n/**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.Texture} [texture] - Texture to add\n */\nFramebuffer.prototype.addDepthTexture = function addDepthTexture (texture)\n{\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { scaleMode: 0,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: false,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT });\n /* eslint-disable max-len */\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n};\n\n/**\n * Enable depth on the frame buffer\n */\nFramebuffer.prototype.enableDepth = function enableDepth ()\n{\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n};\n\n/**\n * Enable stencil on the frame buffer\n */\nFramebuffer.prototype.enableStencil = function enableStencil ()\n{\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n};\n\n/**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\nFramebuffer.prototype.resize = function resize (width, height)\n{\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height) { return; }\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (var i = 0; i < this.colorTextures.length; i++)\n {\n var texture = this.colorTextures[i];\n var resolution = texture.resolution;\n\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n var resolution$1 = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution$1, height / resolution$1);\n }\n};\n\n/**\n * disposes WebGL resources that are connected to this geometry\n */\nFramebuffer.prototype.dispose = function dispose ()\n{\n this.disposeRunner.run(this, false);\n};\n\nObject.defineProperties( Framebuffer.prototype, prototypeAccessors$1 );\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nvar BaseRenderTexture = /*@__PURE__*/(function (BaseTexture) {\n function BaseRenderTexture(options)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n var width$1 = arguments[0];\n var height$1 = arguments[1];\n var scaleMode = arguments[2];\n var resolution = arguments[3];\n\n options = { width: width$1, height: height$1, scaleMode: scaleMode, resolution: resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n BaseTexture.call(this, null, options);\n\n var ref = options || {};\n var width = ref.width;\n var height = ref.height;\n\n // Set defaults\n this.mipmap = false;\n this.width = Math.ceil(width) || 100;\n this.height = Math.ceil(height) || 100;\n this.valid = true;\n\n /**\n * A reference to the canvas render target (we only need one as this can be shared across renderers)\n *\n * @protected\n * @member {object}\n */\n this._canvasRenderTarget = null;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)\n .addColorTexture(0, this);\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\n\n if ( BaseTexture ) BaseRenderTexture.__proto__ = BaseTexture;\n BaseRenderTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype );\n BaseRenderTexture.prototype.constructor = BaseRenderTexture;\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n BaseRenderTexture.prototype.resize = function resize (width, height)\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n };\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseRenderTexture.prototype.dispose = function dispose ()\n {\n this.framebuffer.dispose();\n\n BaseTexture.prototype.dispose.call(this);\n };\n\n /**\n * Destroys this texture.\n *\n */\n BaseRenderTexture.prototype.destroy = function destroy ()\n {\n BaseTexture.prototype.destroy.call(this, true);\n\n this.framebuffer = null;\n };\n\n return BaseRenderTexture;\n}(BaseTexture));\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nvar TextureUvs = function TextureUvs()\n{\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n};\n\n/**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\nTextureUvs.prototype.set = function set (frame, baseFrame, rotate)\n{\n var tw = baseFrame.width;\n var th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n var w2 = frame.width / 2 / tw;\n var h2 = frame.height / 2 / th;\n\n // coordinates of center\n var cX = (frame.x / tw) + w2;\n var cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n};\n\nvar DEFAULT_UVS = new TextureUvs();\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar Texture = /*@__PURE__*/(function (EventEmitter) {\n function Texture(baseTexture, frame, orig, trim, rotate, anchor)\n {\n EventEmitter.call(this);\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates)\n *\n * @member {boolean}\n */\n this.requiresUpdate = false;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n this._uvs = DEFAULT_UVS;\n\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n if ( EventEmitter ) Texture.__proto__ = EventEmitter;\n Texture.prototype = Object.create( EventEmitter && EventEmitter.prototype );\n Texture.prototype.constructor = Texture;\n\n var prototypeAccessors = { resolution: { configurable: true },frame: { configurable: true },rotate: { configurable: true },width: { configurable: true },height: { configurable: true } };\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n Texture.prototype.update = function update ()\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n };\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n Texture.prototype.onBaseTextureUpdated = function onBaseTextureUpdated (baseTexture)\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n };\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well\n */\n Texture.prototype.destroy = function destroy (destroyBase)\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n var ref = this.baseTexture;\n var resource = ref.resource;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n };\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n Texture.prototype.clone = function clone ()\n {\n return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor);\n };\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n Texture.prototype.updateUvs = function updateUvs ()\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n };\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n Texture.from = function from (source, options, strict)\n {\n if ( options === void 0 ) options = {};\n if ( strict === void 0 ) strict = settings.STRICT_TEXTURE_CACHE;\n\n var isFrame = typeof source === 'string';\n var cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!source._pixiId)\n {\n source._pixiId = \"pixiid_\" + (uid());\n }\n\n cacheId = source._pixiId;\n }\n\n var texture = TextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error((\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in TextureCache.\"));\n }\n\n if (!texture)\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n };\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n Texture.fromBuffer = function fromBuffer (buffer, width, height, options)\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n };\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n Texture.fromLoader = function fromLoader (source, imageUrl, name)\n {\n var resource = new ImageResource(source);\n\n resource.url = imageUrl;\n\n var baseTexture = new BaseTexture(resource, {\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n });\n\n var texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n };\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n Texture.addToCache = function addToCache (texture, id)\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn((\"Texture added to the cache with an id [\" + id + \"] that already had an entry\"));\n }\n\n TextureCache[id] = texture;\n }\n };\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n Texture.removeFromCache = function removeFromCache (texture)\n {\n if (typeof texture === 'string')\n {\n var textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n var index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (var i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n };\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n prototypeAccessors.resolution.get = function ()\n {\n return this.baseTexture.resolution;\n };\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n prototypeAccessors.frame.get = function ()\n {\n return this._frame;\n };\n\n prototypeAccessors.frame.set = function (frame) // eslint-disable-line require-jsdoc\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n var x = frame.x;\n var y = frame.y;\n var width = frame.width;\n var height = frame.height;\n var xNotFit = x + width > this.baseTexture.width;\n var yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n var relationship = xNotFit && yNotFit ? 'and' : 'or';\n var errorX = \"X: \" + x + \" + \" + width + \" = \" + (x + width) + \" > \" + (this.baseTexture.width);\n var errorY = \"Y: \" + y + \" + \" + height + \" = \" + (y + height) + \" > \" + (this.baseTexture.height);\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + errorX + \" \" + relationship + \" \" + errorY);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n };\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n prototypeAccessors.rotate.get = function ()\n {\n return this._rotate;\n };\n\n prototypeAccessors.rotate.set = function (rotate) // eslint-disable-line require-jsdoc\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n };\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n return this.orig.width;\n };\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n return this.orig.height;\n };\n\n Object.defineProperties( Texture.prototype, prototypeAccessors );\n\n return Texture;\n}(EventEmitter));\n\nfunction createWhiteTexture()\n{\n var canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n var context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex)\n{\n tex.destroy = function _emptyDestroy() { /* empty */ };\n tex.on = function _emptyOn() { /* empty */ };\n tex.once = function _emptyOnce() { /* empty */ };\n tex.emit = function _emptyEmit() { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create(800, 600);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nvar RenderTexture = /*@__PURE__*/(function (Texture) {\n function RenderTexture(baseRenderTexture, frame)\n {\n // support for legacy..\n var _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n var width = arguments[1];\n var height = arguments[2];\n var scaleMode = arguments[3];\n var resolution = arguments[4];\n\n // we have an old render texture..\n console.warn((\"Please use RenderTexture.create(\" + width + \", \" + height + \") instead of the ctor directly.\"));\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width: width,\n height: height,\n scaleMode: scaleMode,\n resolution: resolution,\n });\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n Texture.call(this, baseRenderTexture, frame);\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n this.filterFrame = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n if ( Texture ) RenderTexture.__proto__ = Texture;\n RenderTexture.prototype = Object.create( Texture && Texture.prototype );\n RenderTexture.prototype.constructor = RenderTexture;\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n RenderTexture.prototype.resize = function resize (width, height, resizeBaseTexture)\n {\n if ( resizeBaseTexture === void 0 ) resizeBaseTexture = true;\n\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n };\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n RenderTexture.prototype.setResolution = function setResolution (resolution)\n {\n var ref = this;\n var baseTexture = ref.baseTexture;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n };\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n RenderTexture.create = function create (options)\n {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n };\n\n return RenderTexture;\n}(Texture));\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nvar RenderTexturePool = function RenderTexturePool(textureOptions)\n{\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n};\n\n/**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth width of texture in pixels\n * @param {number} realHeight height of texture in pixels\n * @returns {RenderTexture}\n */\nRenderTexturePool.prototype.createTexture = function createTexture (realWidth, realHeight)\n{\n var baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n};\n\n/**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\nRenderTexturePool.prototype.getOptimalTexture = function getOptimalTexture (minWidth, minHeight, resolution)\n{\n if ( resolution === void 0 ) resolution = 1;\n\n var key = RenderTexturePool.SCREEN_KEY;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n var renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n};\n\n/**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input renderTexture from which size and resolution will be copied\n * @param {number} [resolution] override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\nRenderTexturePool.prototype.getFilterTexture = function getFilterTexture (input, resolution)\n{\n var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n};\n\n/**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\nRenderTexturePool.prototype.returnTexture = function returnTexture (renderTexture)\n{\n var key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n};\n\n/**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\nRenderTexturePool.prototype.returnFilterTexture = function returnFilterTexture (renderTexture)\n{\n this.returnTexture(renderTexture);\n};\n\n/**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] destroy all stored textures\n */\nRenderTexturePool.prototype.clear = function clear (destroyTextures)\n{\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (var i in this.texturePool)\n {\n var textures = this.texturePool[i];\n\n if (textures)\n {\n for (var j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n};\n\n/**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\nRenderTexturePool.prototype.setScreenSize = function setScreenSize (size)\n{\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n var screenKey = RenderTexturePool.SCREEN_KEY;\n var textures = this.texturePool[screenKey];\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n if (textures)\n {\n for (var j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n};\n\n/**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\nRenderTexturePool.SCREEN_KEY = 'screen';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nvar Attribute = function Attribute(buffer, size, normalized, type, stride, start, instance)\n{\n if ( normalized === void 0 ) normalized = false;\n if ( type === void 0 ) type = 5126;\n\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n};\n\n/**\n * Destroys the Attribute.\n */\nAttribute.prototype.destroy = function destroy ()\n{\n this.buffer = null;\n};\n\n/**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer the id of the buffer that this attribute will look for\n * @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\n * @param {Boolean} [normalized=false] should the data be normalized.\n * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data)\n * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\nAttribute.from = function from (buffer, size, normalized, type, stride)\n{\n return new Attribute(buffer, size, normalized, type, stride);\n};\n\nvar UID = 0;\n/* eslint-disable max-len */\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nvar Buffer = function Buffer(data, _static, index)\n{\n if ( _static === void 0 ) _static = true;\n if ( index === void 0 ) index = false;\n\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer|ArrayBufferView}\n */\n this.data = data || new Float32Array(1);\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n\n this._updateID = 0;\n\n this.index = index;\n\n this.static = _static;\n\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer', 2);\n};\n\n// TODO could explore flagging only a partial upload?\n/**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] the data to update in the buffer.\n */\nBuffer.prototype.update = function update (data)\n{\n this.data = data || this.data;\n this._updateID++;\n};\n\n/**\n * disposes WebGL resources that are connected to this geometry\n */\nBuffer.prototype.dispose = function dispose ()\n{\n this.disposeRunner.run(this, false);\n};\n\n/**\n * Destroys the buffer\n */\nBuffer.prototype.destroy = function destroy ()\n{\n this.dispose();\n\n this.data = null;\n};\n\n/**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\nBuffer.from = function from (data)\n{\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n};\n\nfunction getBufferType(array)\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n\n/* eslint-disable object-shorthand */\nvar map = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nfunction interleaveTypedArrays(arrays, sizes)\n{\n var outSize = 0;\n var stride = 0;\n var views = {};\n\n for (var i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n var buffer = new ArrayBuffer(outSize * 4);\n\n var out = null;\n var littleOffset = 0;\n\n for (var i$1 = 0; i$1 < arrays.length; i$1++)\n {\n var size = sizes[i$1];\n var array = arrays[i$1];\n\n var type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (var j = 0; j < array.length; j++)\n {\n var indexStart = ((j / size | 0) * stride) + littleOffset;\n var index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n\nvar byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 };\nvar UID$1 = 0;\n\n/* eslint-disable object-shorthand */\nvar map$1 = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nvar Geometry = function Geometry(buffers, attributes)\n{\n if ( buffers === void 0 ) buffers = [];\n if ( attributes === void 0 ) attributes = {};\n\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n\n this.id = UID$1++;\n\n this.instanced = false;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry', 2);\n\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n};\n\n/**\n*\n* Adds an attribute to the geometry\n*\n* @param {String} id - the name of the attribute (matching up to a shader)\n* @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.\n* @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\n* @param {Boolean} [normalized=false] should the data be normalized.\n* @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n* @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data)\n* @param {Number} [start=0] How far into the array to start reading values (used for interleaving data)\n*\n* @return {PIXI.Geometry} returns self, useful for chaining.\n*/\nGeometry.prototype.addAttribute = function addAttribute (id, buffer, size, normalized, type, stride, start, instance)\n{\n if ( normalized === void 0 ) normalized = false;\n if ( instance === void 0 ) instance = false;\n\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!buffer.data)\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n var ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (var i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n var bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n};\n\n/**\n * returns the requested attribute\n *\n * @param {String} id the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\nGeometry.prototype.getAttribute = function getAttribute (id)\n{\n return this.attributes[id];\n};\n\n/**\n * returns the requested buffer\n *\n * @param {String} id the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\nGeometry.prototype.getBuffer = function getBuffer (id)\n{\n return this.buffers[this.getAttribute(id).buffer];\n};\n\n/**\n*\n* Adds an index buffer to the geometry\n* 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.\n*\n* @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.\n* @return {PIXI.Geometry} returns self, useful for chaining.\n*/\nGeometry.prototype.addIndex = function addIndex (buffer)\n{\n if (!buffer.data)\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.index = true;\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n};\n\n/**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\nGeometry.prototype.getIndex = function getIndex ()\n{\n return this.indexBuffer;\n};\n\n/**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\nGeometry.prototype.interleave = function interleave ()\n{\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) { return this; }\n\n // assume already that no buffers are interleaved\n var arrays = [];\n var sizes = [];\n var interleavedBuffer = new Buffer();\n var i;\n\n for (i in this.attributes)\n {\n var attribute = this.attributes[i];\n\n var buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n};\n\nGeometry.prototype.getSize = function getSize ()\n{\n for (var i in this.attributes)\n {\n var attribute = this.attributes[i];\n var buffer = this.buffers[attribute.buffer];\n\n return buffer.data.length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n};\n\n/**\n * disposes WebGL resources that are connected to this geometry\n */\nGeometry.prototype.dispose = function dispose ()\n{\n this.disposeRunner.run(this, false);\n};\n\n/**\n * Destroys the geometry.\n */\nGeometry.prototype.destroy = function destroy ()\n{\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n};\n\n/**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\nGeometry.prototype.clone = function clone ()\n{\n var geometry = new Geometry();\n\n for (var i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice());\n }\n\n for (var i$1 in this.attributes)\n {\n var attrib = this.attributes[i$1];\n\n geometry.attributes[i$1] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n\n return geometry;\n};\n\n/**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\nGeometry.merge = function merge (geometries)\n{\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n var geometryOut = new Geometry();\n\n var arrays = [];\n var sizes = [];\n var offsets = [];\n\n var geometry;\n\n // pass one.. get sizes..\n for (var i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (var j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (var i$1 = 0; i$1 < geometry.buffers.length; i$1++)\n {\n // TODO types!\n arrays[i$1] = new map$1[getBufferType(geometry.buffers[i$1].data)](sizes[i$1]);\n geometryOut.buffers[i$1] = new Buffer(arrays[i$1]);\n }\n\n // pass to set data..\n for (var i$2 = 0; i$2 < geometries.length; i$2++)\n {\n geometry = geometries[i$2];\n\n for (var j$1 = 0; j$1 < geometry.buffers.length; j$1++)\n {\n arrays[j$1].set(geometry.buffers[j$1].data, offsets[j$1]);\n offsets[j$1] += geometry.buffers[j$1].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n\n var offset = 0;\n var stride = 0;\n var offset2 = 0;\n var bufferIndexToCount = 0;\n\n // get a buffer\n for (var i$3 = 0; i$3 < geometry.buffers.length; i$3++)\n {\n if (geometry.buffers[i$3] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i$3;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (var i$4 in geometry.attributes)\n {\n var attribute = geometry.attributes[i$4];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (var i$5 = 0; i$5 < geometries.length; i$5++)\n {\n var indexBufferData = geometries[i$5].indexBuffer.data;\n\n for (var j$2 = 0; j$2 < indexBufferData.length; j$2++)\n {\n geometryOut.indexBuffer.data[j$2 + offset2] += offset;\n }\n\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n};\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nvar Quad = /*@__PURE__*/(function (Geometry) {\n function Quad()\n {\n Geometry.call(this);\n\n this.addAttribute('aVertexPosition', [\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ])\n .addIndex([0, 1, 3, 2]);\n }\n\n if ( Geometry ) Quad.__proto__ = Geometry;\n Quad.prototype = Object.create( Geometry && Geometry.prototype );\n Quad.prototype.constructor = Quad;\n\n return Quad;\n}(Geometry));\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nvar QuadUv = /*@__PURE__*/(function (Geometry) {\n function QuadUv()\n {\n Geometry.call(this);\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1 ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n if ( Geometry ) QuadUv.__proto__ = Geometry;\n QuadUv.prototype = Object.create( Geometry && Geometry.prototype );\n QuadUv.prototype.constructor = QuadUv;\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n QuadUv.prototype.map = function map (targetTextureFrame, destinationFrame)\n {\n var x = 0; // destinationFrame.x / targetTextureFrame.width;\n var y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n };\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n QuadUv.prototype.invalidate = function invalidate ()\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n };\n\n return QuadUv;\n}(Geometry));\n\nvar UID$2 = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nvar UniformGroup = function UniformGroup(uniforms, _static)\n{\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID$2++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n};\n\nUniformGroup.prototype.update = function update ()\n{\n this.dirtyId++;\n};\n\nUniformGroup.prototype.add = function add (name, uniforms, _static)\n{\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n};\n\nUniformGroup.from = function from (uniforms, _static)\n{\n return new UniformGroup(uniforms, _static);\n};\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nvar FilterState = function FilterState()\n{\n this.renderTexture = null;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new Rectangle();\n\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n};\n\n/**\n * clears the state\n * @private\n */\nFilterState.prototype.clear = function clear ()\n{\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n};\n\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar FilterSystem = /*@__PURE__*/(function (System) {\n function FilterSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n this.defaultFilterStack = [{}];\n\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n this.texturePool = new RenderTexturePool();\n\n this.texturePool.setScreenSize(renderer.view);\n\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n this.statePool = [];\n\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n this.quad = new Quad();\n\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n this.quadUv = new QuadUv();\n\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n this.tempRect = new Rectangle();\n\n /**\n * Active state\n * @member {object}\n */\n this.activeState = {};\n\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n this.globalUniforms = new UniformGroup({\n outputFrame: this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this._pixelsWidth = renderer.view.width;\n this._pixelsHeight = renderer.view.height;\n }\n\n if ( System ) FilterSystem.__proto__ = System;\n FilterSystem.prototype = Object.create( System && System.prototype );\n FilterSystem.prototype.constructor = FilterSystem;\n\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n FilterSystem.prototype.push = function push (target, filters)\n {\n var renderer = this.renderer;\n var filterStack = this.defaultFilterStack;\n var state = this.statePool.pop() || new FilterState();\n\n var resolution = filters[0].resolution;\n var padding = filters[0].padding;\n var autoFit = filters[0].autoFit;\n var legacy = filters[0].legacy;\n\n for (var i = 1; i < filters.length; i++)\n {\n var filter = filters[i];\n\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // and the largest amount of padding!\n padding = Math.max(padding, filter.padding);\n // only auto fit if all filters are autofit\n autoFit = autoFit || filter.autoFit;\n\n legacy = legacy || filter.legacy;\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n\n state.legacy = legacy;\n\n state.target = target;\n\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n if (autoFit)\n {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame);// /, state.destinationFrame);\n renderer.renderTexture.clear();\n };\n\n /**\n * Pops off the filter and applies it.\n *\n */\n FilterSystem.prototype.pop = function pop ()\n {\n var filterStack = this.defaultFilterStack;\n var state = filterStack.pop();\n var filters = state.filters;\n\n this.activeState = state;\n\n var globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n var inputSize = globalUniforms.inputSize;\n var inputPixel = globalUniforms.inputPixel;\n var inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n var filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n var lastState = filterStack[filterStack.length - 1];\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, false, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n var flip = state.renderTexture;\n var flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n var i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, true, state);\n\n var t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, false, state);\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n state.clear();\n this.statePool.push(state);\n };\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it\n */\n FilterSystem.prototype.applyFilter = function applyFilter (filter, input, output, clear)\n {\n var renderer = this.renderer;\n\n renderer.renderTexture.bind(output, output ? output.filterFrame : null);\n\n if (clear)\n {\n // gl.disable(gl.SCISSOR_TEST);\n renderer.renderTexture.clear();\n // gl.enable(gl.SCISSOR_TEST);\n }\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n };\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n FilterSystem.prototype.calculateSpriteMatrix = function calculateSpriteMatrix (outputMatrix, sprite)\n {\n var ref = this.activeState;\n var sourceFrame = ref.sourceFrame;\n var destinationFrame = ref.destinationFrame;\n var ref$1 = sprite._texture;\n var orig = ref$1.orig;\n var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n };\n\n /**\n * Destroys this Filter System.\n */\n FilterSystem.prototype.destroy = function destroy ()\n {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n };\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n FilterSystem.prototype.getOptimalFilterTexture = function getOptimalFilterTexture (minWidth, minHeight, resolution)\n {\n if ( resolution === void 0 ) resolution = 1;\n\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n };\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] renderTexture from which size and resolution will be copied\n * @param {number} [resolution] override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n FilterSystem.prototype.getFilterTexture = function getFilterTexture (input, resolution)\n {\n if (typeof input === 'number')\n {\n var swap = input;\n\n input = resolution;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n };\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n FilterSystem.prototype.returnFilterTexture = function returnFilterTexture (renderTexture)\n {\n this.texturePool.returnTexture(renderTexture);\n };\n\n /**\n * Empties the texture pool.\n */\n FilterSystem.prototype.emptyPool = function emptyPool ()\n {\n this.texturePool.clear(true);\n };\n\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n FilterSystem.prototype.resize = function resize ()\n {\n this.texturePool.setScreenSize(this.renderer.view);\n };\n\n return FilterSystem;\n}(System));\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nvar ObjectRenderer = function ObjectRenderer(renderer)\n{\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n};\n\n/**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\nObjectRenderer.prototype.flush = function flush ()\n{\n // flush!\n};\n\n/**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\nObjectRenderer.prototype.destroy = function destroy ()\n{\n this.renderer = null;\n};\n\n/**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\nObjectRenderer.prototype.start = function start ()\n{\n // set the shader..\n};\n\n/**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\nObjectRenderer.prototype.stop = function stop ()\n{\n this.flush();\n};\n\n/**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\nObjectRenderer.prototype.render = function render (object) // eslint-disable-line no-unused-vars\n{\n // render the object\n};\n\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar BatchSystem = /*@__PURE__*/(function (System) {\n function BatchSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(renderer);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n }\n\n if ( System ) BatchSystem.__proto__ = System;\n BatchSystem.prototype = Object.create( System && System.prototype );\n BatchSystem.prototype.constructor = BatchSystem;\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n BatchSystem.prototype.setObjectRenderer = function setObjectRenderer (objectRenderer)\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n };\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n BatchSystem.prototype.flush = function flush ()\n {\n this.setObjectRenderer(this.emptyRenderer);\n };\n\n /**\n * Reset the system to an empty renderer\n */\n BatchSystem.prototype.reset = function reset ()\n {\n this.setObjectRenderer(this.emptyRenderer);\n };\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param arr\n * @param maxTextures\n */\n BatchSystem.prototype.copyBoundTextures = function copyBoundTextures (arr, maxTextures)\n {\n var ref = this.renderer.texture;\n var boundTextures = ref.boundTextures;\n\n for (var i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n };\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures current state of bound textures\n * @param {number} batchId marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures number of texture locations to manipulate\n */\n BatchSystem.prototype.boundArray = function boundArray (texArray, boundTextures, batchId, maxTextures)\n {\n var elements = texArray.elements;\n var ids = texArray.ids;\n var count = texArray.count;\n var j = 0;\n\n for (var i = 0; i < count; i++)\n {\n var tex = elements[i];\n var loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n var bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n };\n\n return BatchSystem;\n}(System));\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can *only* be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nvar CONTEXT_UID = 0;\n\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar ContextSystem = /*@__PURE__*/(function (System) {\n function ContextSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n this.webGLVersion = 1;\n\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n this.extensions = {};\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n if ( System ) ContextSystem.__proto__ = System;\n ContextSystem.prototype = Object.create( System && System.prototype );\n ContextSystem.prototype.constructor = ContextSystem;\n\n var prototypeAccessors = { isLost: { configurable: true } };\n\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n prototypeAccessors.isLost.get = function ()\n {\n return (!this.gl || this.gl.isContextLost());\n };\n\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl new webgl context\n */\n ContextSystem.prototype.contextChange = function contextChange (gl)\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n };\n\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n ContextSystem.prototype.initFromContext = function initFromContext (gl)\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID++;\n this.renderer.runners.contextChange.run(gl);\n };\n\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n ContextSystem.prototype.initFromOptions = function initFromOptions (options)\n {\n var gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n };\n\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n ContextSystem.prototype.createContext = function createContext (canvas, options)\n {\n var gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl;\n\n this.getExtensions();\n\n return gl;\n };\n\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n ContextSystem.prototype.getExtensions = function getExtensions ()\n {\n // time to set up default extensions that Pixi uses.\n var ref = this;\n var gl = ref.gl;\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBKIT_WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n };\n\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n ContextSystem.prototype.handleContextLost = function handleContextLost (event)\n {\n event.preventDefault();\n };\n\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n ContextSystem.prototype.handleContextRestored = function handleContextRestored ()\n {\n this.renderer.runners.contextChange.run(this.gl);\n };\n\n ContextSystem.prototype.destroy = function destroy ()\n {\n var view = this.renderer.view;\n\n // remove listeners\n view.removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n };\n\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n ContextSystem.prototype.postrender = function postrender ()\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n };\n\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n ContextSystem.prototype.validateContext = function validateContext (gl)\n {\n var attributes = gl.getContextAttributes();\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable max-len */\n\n /* eslint-disable no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable no-console */\n\n /* eslint-enable max-len */\n }\n };\n\n Object.defineProperties( ContextSystem.prototype, prototypeAccessors );\n\n return ContextSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar FramebufferSystem = /*@__PURE__*/(function (System) {\n function FramebufferSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n }\n\n if ( System ) FramebufferSystem.__proto__ = System;\n FramebufferSystem.prototype = Object.create( System && System.prototype );\n FramebufferSystem.prototype.constructor = FramebufferSystem;\n\n var prototypeAccessors = { size: { configurable: true } };\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n FramebufferSystem.prototype.contextChange = function contextChange ()\n {\n var gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n var nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = function (activeTextures) { return nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures); };\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = function () {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n };\n\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n FramebufferSystem.prototype.bind = function bind (framebuffer, frame)\n {\n var ref = this;\n var gl = ref.gl;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (var i = 0; i < framebuffer.colorTextures.length; i++)\n {\n if (framebuffer.colorTextures[i].texturePart)\n {\n this.renderer.texture.unbind(framebuffer.colorTextures[i].texture);\n }\n else\n {\n this.renderer.texture.unbind(framebuffer.colorTextures[i]);\n }\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n };\n\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n FramebufferSystem.prototype.setViewport = function setViewport (x, y, width, height)\n {\n var v = this.viewport;\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n };\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n prototypeAccessors.size.get = function ()\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n };\n\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n */\n FramebufferSystem.prototype.clear = function clear (r, g, b, a)\n {\n var ref = this;\n var gl = ref.gl;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n };\n\n /**\n * Initialize framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.initFramebuffer = function initFramebuffer (framebuffer)\n {\n var ref = this;\n var gl = ref.gl;\n\n // TODO - make this a class?\n var fbo = {\n framebuffer: gl.createFramebuffer(),\n stencil: null,\n dirtyId: 0,\n dirtyFormat: 0,\n dirtySize: 0,\n };\n\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n };\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.resizeFramebuffer = function resizeFramebuffer (framebuffer)\n {\n var ref = this;\n var gl = ref.gl;\n\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n var colorTextures = framebuffer.colorTextures;\n\n for (var i = 0; i < colorTextures.length; i++)\n {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n };\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.updateFramebuffer = function updateFramebuffer (framebuffer)\n {\n var ref = this;\n var gl = ref.gl;\n\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n var colorTextures = framebuffer.colorTextures;\n\n var count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n var activeTextures = [];\n\n for (var i = 0; i < count; i++)\n {\n var texture = framebuffer.colorTextures[i];\n\n if (texture.texturePart)\n {\n this.renderer.texture.bind(texture.texture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X + texture.side,\n texture.texture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n else\n {\n this.renderer.texture.bind(texture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n gl.TEXTURE_2D,\n texture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n var writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n var depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n }\n\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))\n {\n fbo.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture)\n { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n };\n\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeFramebuffer = function disposeFramebuffer (framebuffer, contextLost)\n {\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n var gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n var index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n };\n\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeAll = function disposeAll (contextLost)\n {\n var list = this.managedFramebuffers;\n\n this.managedFramebuffers = [];\n\n for (var i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n };\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n FramebufferSystem.prototype.forceStencil = function forceStencil ()\n {\n var framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n framebuffer.enableStencil();\n\n var w = framebuffer.width;\n var h = framebuffer.height;\n var gl = this.gl;\n var stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n };\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n FramebufferSystem.prototype.reset = function reset ()\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n };\n\n Object.defineProperties( FramebufferSystem.prototype, prototypeAccessors );\n\n return FramebufferSystem;\n}(System));\n\nvar GLBuffer = function GLBuffer(buffer)\n{\n this.buffer = buffer;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n};\n\nvar byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar GeometrySystem = /*@__PURE__*/(function (System) {\n function GeometrySystem(renderer)\n {\n System.call(this, renderer);\n\n this._activeGeometry = null;\n this._activeVao = null;\n\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n this.hasVao = true;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n this.hasInstance = true;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n this.canUseUInt32ElementIndex = false;\n\n /**\n * A cache of currently bound buffer,\n * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER\n * @member {Object.}\n * @readonly\n */\n this.boundBuffers = {};\n\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedGeometries = {};\n\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedBuffers = {};\n }\n\n if ( System ) GeometrySystem.__proto__ = System;\n GeometrySystem.prototype = Object.create( System && System.prototype );\n GeometrySystem.prototype.constructor = GeometrySystem;\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n GeometrySystem.prototype.contextChange = function contextChange ()\n {\n this.disposeAll(true);\n\n var gl = this.gl = this.renderer.gl;\n var context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (!gl.createVertexArray)\n {\n // webgl 1!\n var nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = function () { return nativeVaoExtension.createVertexArrayOES(); };\n\n gl.bindVertexArray = function (vao) { return nativeVaoExtension.bindVertexArrayOES(vao); };\n\n gl.deleteVertexArray = function (vao) { return nativeVaoExtension.deleteVertexArrayOES(vao); };\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = function () {\n // empty\n };\n\n gl.bindVertexArray = function () {\n // empty\n };\n\n gl.deleteVertexArray = function () {\n // empty\n };\n }\n }\n\n if (!gl.vertexAttribDivisor)\n {\n var instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = function (a, b) { return instanceExt.vertexAttribDivisorANGLE(a, b); };\n\n gl.drawElementsInstanced = function (a, b, c, d, e) { return instanceExt.drawElementsInstancedANGLE(a, b, c, d, e); };\n\n gl.drawArraysInstanced = function (a, b, c, d) { return instanceExt.drawArraysInstancedANGLE(a, b, c, d); };\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n };\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry instance of geometry to bind\n * @param {PIXI.Shader} [shader] instance of shader to use vao for\n */\n GeometrySystem.prototype.bind = function bind (geometry, shader)\n {\n shader = shader || this.renderer.shader.shader;\n\n var ref = this;\n var gl = ref.gl;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n }\n\n var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n };\n\n /**\n * Reset and unbind any active VAO and geometry\n */\n GeometrySystem.prototype.reset = function reset ()\n {\n this.unbind();\n };\n\n /**\n * Update buffers\n * @protected\n */\n GeometrySystem.prototype.updateBuffers = function updateBuffers ()\n {\n var geometry = this._activeGeometry;\n var ref = this;\n var gl = ref.gl;\n\n for (var i = 0; i < geometry.buffers.length; i++)\n {\n var buffer = geometry.buffers[i];\n\n var glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n\n if (buffer._updateID !== glBuffer.updateID)\n {\n glBuffer.updateID = buffer._updateID;\n\n // TODO can cache this on buffer! maybe added a getter / setter?\n var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n\n this._boundBuffer = glBuffer;\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else\n {\n var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n };\n\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n GeometrySystem.prototype.checkCompatibility = function checkCompatibility (geometry, program)\n {\n // geometry must have at least all the attributes that the shader requires.\n var geometryAttributes = geometry.attributes;\n var shaderAttributes = program.attributeData;\n\n for (var j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error((\"shader and geometry incompatible, geometry missing the \\\"\" + j + \"\\\" attribute\"));\n }\n }\n };\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry to get signature from\n * @param {PIXI.Program} program to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n GeometrySystem.prototype.getSignature = function getSignature (geometry, program)\n {\n var attribs = geometry.attributes;\n var shaderAttributes = program.attributeData;\n\n var strings = ['g', geometry.id];\n\n for (var i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i);\n }\n }\n\n return strings.join('-');\n };\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n */\n GeometrySystem.prototype.initGeometryVao = function initGeometryVao (geometry, program)\n {\n this.checkCompatibility(geometry, program);\n\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n\n var signature = this.getSignature(geometry, program);\n\n var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n var vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n var tempStride = {};\n var tempStart = {};\n\n for (var j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (var j$1 in attributes)\n {\n if (!attributes[j$1].size && program.attributeData[j$1])\n {\n attributes[j$1].size = program.attributeData[j$1].size;\n }\n else if (!attributes[j$1].size)\n {\n console.warn((\"PIXI Geometry attribute '\" + j$1 + \"' size cannot be determined (likely the bound shader does not have the attribute)\")); // eslint-disable-line\n }\n\n tempStride[attributes[j$1].buffer] += attributes[j$1].size * byteSizeMap$1[attributes[j$1].type];\n }\n\n for (var j$2 in attributes)\n {\n var attribute = attributes[j$2];\n var attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (var i = 0; i < buffers.length; i++)\n {\n var buffer = buffers[i];\n\n if (!buffer._glBuffers[CONTEXT_UID])\n {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n };\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer buffer with data\n * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray\n */\n GeometrySystem.prototype.disposeBuffer = function disposeBuffer (buffer, contextLost)\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n var glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n var gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n };\n\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray\n */\n GeometrySystem.prototype.disposeGeometry = function disposeGeometry (geometry, contextLost)\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var gl = this.gl;\n var buffers = geometry.buffers;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n for (var i = 0; i < buffers.length; i++)\n {\n var buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n\n if (!contextLost)\n {\n for (var vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n var vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n };\n\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] If context was lost, we suppress `gl.delete` calls\n */\n GeometrySystem.prototype.disposeAll = function disposeAll (contextLost)\n {\n var all = Object.keys(this.managedGeometries);\n\n for (var i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (var i$1 = 0; i$1 < all.length; i$1++)\n {\n this.disposeBuffer(this.managedBuffers[all[i$1]], contextLost);\n }\n };\n\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n GeometrySystem.prototype.activateVao = function activateVao (geometry, program)\n {\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n\n var lastBuffer = null;\n\n // add a new one!\n for (var j in attributes)\n {\n var attribute = attributes[j];\n var buffer = buffers[attribute.buffer];\n var glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n\n lastBuffer = glBuffer;\n }\n\n var location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n };\n\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n GeometrySystem.prototype.draw = function draw (type, size, start, instanceCount)\n {\n var ref = this;\n var gl = ref.gl;\n var geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n };\n\n /**\n * Unbind/reset everything\n * @protected\n */\n GeometrySystem.prototype.unbind = function unbind ()\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n };\n\n return GeometrySystem;\n}(System));\n\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nvar MaskData = function MaskData(maskObject)\n{\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = MASK_TYPES.NONE;\n\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n};\n\n/**\n * resets the mask data after popMask()\n */\nMaskData.prototype.reset = function reset ()\n{\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n};\n\n/**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\nMaskData.prototype.copyCountersOrReset = function copyCountersOrReset (maskAbove)\n{\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n};\n\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nfunction compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations)\n{\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n var program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations)\n {\n for (var i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl, type, src)\n{\n var shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n console.warn(src);\n console.error(gl.getShaderInfoLog(shader));\n\n return null;\n }\n\n return shader;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nfunction defaultValue(type, size)\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n\nfunction booleanArray(size)\n{\n var array = new Array(size);\n\n for (var i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\nvar unknownContext = {};\nvar context = unknownContext;\n\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nfunction getTestContext()\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n var canvas = document.createElement('canvas');\n\n var gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || canvas.getContext('experimental-webgl', {});\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n\nvar maxFragmentPrecision;\n\nfunction getMaxFragmentPrecision()\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n var gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nfunction setPrecision(src, requestedPrecision, maxSupportedPrecision)\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n var precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return (\"precision \" + precision + \" float;\\n\" + src);\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n\nvar GLSL_TO_SIZE = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param type {String}\n * @return {Number}\n */\nfunction mapSize(type)\n{\n return GLSL_TO_SIZE[type];\n}\n\nvar GL_TABLE = null;\n\nvar GL_TO_GLSL_TYPES = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\nfunction mapType(gl, type)\n{\n if (!GL_TABLE)\n {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (var i = 0; i < typeNames.length; ++i)\n {\n var tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nvar GLSL_TO_SINGLE_SETTERS_CACHED = {\n\n float: \"\\n if(cv !== v)\\n {\\n cv.v = v;\\n gl.uniform1f(location, v)\\n }\",\n\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 }\",\n\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 }\",\n\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nvar GLSL_TO_ARRAY_SETTERS = {\n\n float: \"gl.uniform1fv(location, v)\",\n\n vec2: \"gl.uniform2fv(location, v)\",\n vec3: \"gl.uniform3fv(location, v)\",\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nfunction generateUniformsSync(group, uniformData)\n{\n var textureCount = 0;\n var func = \"var v = null;\\n var cv = null\\n var gl = renderer.gl\";\n\n for (var i in group.uniforms)\n {\n var data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i].group)\n {\n func += \"\\n renderer.shader.syncUniformGroup(uv.\" + i + \");\\n \";\n }\n\n continue;\n }\n\n // TODO && uniformData[i].value !== 0 <-- do we still need this?\n if (data.type === 'float' && data.size === 1)\n {\n 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\";\n }\n /* eslint-disable max-len */\n else if ((data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray)\n /* eslint-disable max-len */\n {\n 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\";\n\n textureCount++;\n }\n else if (data.type === 'mat3' && data.size === 1)\n {\n if (group.uniforms[i].a !== undefined)\n {\n // TODO and some smart caching dirty ids here!\n func += \"\\n gl.uniformMatrix3fv(ud.\" + i + \".location, false, uv.\" + i + \".toArray(true));\\n \\n\";\n }\n else\n {\n func += \"\\n gl.uniformMatrix3fv(ud.\" + i + \".location, false, uv.\" + i + \");\\n \\n\";\n }\n }\n else if (data.type === 'vec2' && data.size === 1)\n {\n // TODO - do we need both here?\n // maybe we can get away with only using points?\n if (group.uniforms[i].x !== undefined)\n {\n 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\";\n }\n else\n {\n 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\";\n }\n }\n else if (data.type === 'vec4' && data.size === 1)\n {\n // TODO - do we need both here?\n // maybe we can get away with only using points?\n if (group.uniforms[i].width !== undefined)\n {\n 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\";\n }\n else\n {\n 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\";\n }\n }\n else\n {\n var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n var template = templateType[data.type].replace('location', (\"ud.\" + i + \".location\"));\n\n func += \"\\n cv = ud.\" + i + \".value;\\n v = uv.\" + i + \";\\n \" + template + \";\\n\";\n }\n }\n\n return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func\n}\n\nvar fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}' ].join('\\n');\n\nfunction checkMaxIfStatementsInShader(maxIfs, gl)\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n var shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n\nfunction generateIfTestSrc(maxIfs)\n{\n var src = '';\n\n for (var i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += \"if(test == \" + i + \".0){}\";\n }\n }\n\n return src;\n}\n\n// Cache the result to prevent running this over and over\nvar unsafeEval;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nfunction unsafeEvalSupported()\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n\nvar defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\\n}\";\n\nvar 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\";\n\n// import * as from '../systems/shader/shader';\n\nvar UID$3 = 0;\n\nvar nameCache = {};\n\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nvar Program = function Program(vertexSrc, fragmentSrc, name)\n{\n if ( name === void 0 ) name = 'pixi-shader';\n\n this.id = UID$3++;\n\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += \"-\" + (nameCache[name]);\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = \"#define SHADER_NAME \" + name + \"\\n\" + (this.vertexSrc);\n this.fragmentSrc = \"#define SHADER_NAME \" + name + \"\\n\" + (this.fragmentSrc);\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n};\n\nvar staticAccessors = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } };\n\n/**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\nProgram.prototype.extractData = function extractData (vertexSrc, fragmentSrc)\n{\n var gl = getTestContext();\n\n if (gl)\n {\n var program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n\n gl.deleteProgram(program);\n }\n else\n {\n this.uniformData = {};\n this.attributeData = {};\n }\n};\n\n/**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\nProgram.prototype.getAttributeData = function getAttributeData (program, gl)\n{\n var attributes = {};\n var attributesArray = [];\n\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (var i = 0; i < totalAttributes; i++)\n {\n var attribData = gl.getActiveAttrib(program, i);\n var type = mapType(gl, attribData.type);\n\n /*eslint-disable */\n var data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n\n attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow\n\n for (var i$1 = 0; i$1 < attributesArray.length; i$1++)\n {\n attributesArray[i$1].location = i$1;\n }\n\n return attributes;\n};\n\n/**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\nProgram.prototype.getUniformData = function getUniformData (program, gl)\n{\n var uniforms = {};\n\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n\n for (var i = 0; i < totalUniforms; i++)\n {\n var uniformData = gl.getActiveUniform(program, i);\n var name = uniformData.name.replace(/\\[.*?\\]/, '');\n\n var isArray = uniformData.name.match(/\\[.*?\\]/, '');\n var type = mapType(gl, uniformData.type);\n\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray:isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n\n return uniforms;\n};\n\n/**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\nstaticAccessors.defaultVertexSrc.get = function ()\n{\n return defaultVertex;\n};\n\n/**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\nstaticAccessors.defaultFragmentSrc.get = function ()\n{\n return defaultFragment;\n};\n\n/**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\nProgram.from = function from (vertexSrc, fragmentSrc, name)\n{\n var key = vertexSrc + fragmentSrc;\n\n var program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n};\n\nObject.defineProperties( Program, staticAccessors );\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nvar Shader = function Shader(program, uniforms)\n{\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (var i in program.uniformData)\n {\n if (this.uniformGroup.uniforms[i] instanceof Array)\n {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n};\n\nvar prototypeAccessors$2 = { uniforms: { configurable: true } };\n\n// TODO move to shader system..\nShader.prototype.checkUniformExists = function checkUniformExists (name, group)\n{\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (var i in group.uniforms)\n {\n var uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n};\n\nShader.prototype.destroy = function destroy ()\n{\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n};\n\n/**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\nprototypeAccessors$2.uniforms.get = function ()\n{\n return this.uniformGroup.uniforms;\n};\n\n/**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\nShader.from = function from (vertexSrc, fragmentSrc, uniforms)\n{\n var program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n};\n\nObject.defineProperties( Shader.prototype, prototypeAccessors$2 );\n\n/* eslint-disable max-len */\n\nvar BLEND = 0;\nvar OFFSET = 1;\nvar CULLING = 2;\nvar DEPTH_TEST = 3;\nvar WINDING = 4;\n\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nvar State = function State()\n{\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n // this.depthTest = true;\n};\n\nvar prototypeAccessors$3 = { blend: { configurable: true },offsets: { configurable: true },culling: { configurable: true },depthTest: { configurable: true },clockwiseFrontFace: { configurable: true },blendMode: { configurable: true },polygonOffset: { configurable: true } };\n\n/**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\nprototypeAccessors$3.blend.get = function ()\n{\n return !!(this.data & (1 << BLEND));\n};\n\nprototypeAccessors$3.blend.set = function (value) // eslint-disable-line require-jsdoc\n{\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n};\n\n/**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\nprototypeAccessors$3.offsets.get = function ()\n{\n return !!(this.data & (1 << OFFSET));\n};\n\nprototypeAccessors$3.offsets.set = function (value) // eslint-disable-line require-jsdoc\n{\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n};\n\n/**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\nprototypeAccessors$3.culling.get = function ()\n{\n return !!(this.data & (1 << CULLING));\n};\n\nprototypeAccessors$3.culling.set = function (value) // eslint-disable-line require-jsdoc\n{\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n};\n\n/**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\nprototypeAccessors$3.depthTest.get = function ()\n{\n return !!(this.data & (1 << DEPTH_TEST));\n};\n\nprototypeAccessors$3.depthTest.set = function (value) // eslint-disable-line require-jsdoc\n{\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n};\n\n/**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\nprototypeAccessors$3.clockwiseFrontFace.get = function ()\n{\n return !!(this.data & (1 << WINDING));\n};\n\nprototypeAccessors$3.clockwiseFrontFace.set = function (value) // eslint-disable-line require-jsdoc\n{\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n};\n\n/**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\nprototypeAccessors$3.blendMode.get = function ()\n{\n return this._blendMode;\n};\n\nprototypeAccessors$3.blendMode.set = function (value) // eslint-disable-line require-jsdoc\n{\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n};\n\n/**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\nprototypeAccessors$3.polygonOffset.get = function ()\n{\n return this._polygonOffset;\n};\n\nprototypeAccessors$3.polygonOffset.set = function (value) // eslint-disable-line require-jsdoc\n{\n this.offsets = !!value;\n this._polygonOffset = value;\n};\n\nState.for2d = function for2d ()\n{\n var state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n};\n\nObject.defineProperties( State.prototype, prototypeAccessors$3 );\n\nvar 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\";\n\nvar defaultFragment$1 = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}\\n\";\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nvar Filter = /*@__PURE__*/(function (Shader) {\n function Filter(vertexSrc, fragmentSrc, uniforms)\n {\n var program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n Shader.call(this, program, uniforms);\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n this.legacy = !!this.program.attributeData.aTextureCoord;\n\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n this.state = new State();\n }\n\n if ( Shader ) Filter.__proto__ = Shader;\n Filter.prototype = Object.create( Shader && Shader.prototype );\n Filter.prototype.constructor = Filter;\n\n var prototypeAccessors = { blendMode: { configurable: true } };\n var staticAccessors = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } };\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n Filter.prototype.apply = function apply (filterManager, input, output, clear, currentState)\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clear, currentState);\n\n // or just do a regular render..\n };\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n prototypeAccessors.blendMode.get = function ()\n {\n return this.state.blendMode;\n };\n\n prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.state.blendMode = value;\n };\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n staticAccessors.defaultVertexSrc.get = function ()\n {\n return defaultVertex$1;\n };\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n staticAccessors.defaultFragmentSrc.get = function ()\n {\n return defaultFragment$1;\n };\n\n Object.defineProperties( Filter.prototype, prototypeAccessors );\n Object.defineProperties( Filter, staticAccessors );\n\n return Filter;\n}(Shader));\n\n/**\n * Used for caching shader IDs\n *\n * @static\n * @type {object}\n * @protected\n */\nFilter.SOURCE_KEY_MAP = {};\n\nvar 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\";\n\nvar 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\";\n\nvar tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nvar TextureMatrix = function TextureMatrix(texture, clampMargin)\n{\n this._texture = texture;\n\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = -1;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n};\n\nvar prototypeAccessors$4 = { texture: { configurable: true } };\n\n/**\n * texture property\n * @member {PIXI.Texture}\n */\nprototypeAccessors$4.texture.get = function ()\n{\n return this._texture;\n};\n\nprototypeAccessors$4.texture.set = function (value) // eslint-disable-line require-jsdoc\n{\n this._texture = value;\n this._updateID = -1;\n};\n\n/**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\nTextureMatrix.prototype.multiplyUvs = function multiplyUvs (uvs, out)\n{\n if (out === undefined)\n {\n out = uvs;\n }\n\n var mat = this.mapCoord;\n\n for (var i = 0; i < uvs.length; i += 2)\n {\n var x = uvs[i];\n var y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n};\n\n/**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\nTextureMatrix.prototype.update = function update (forceUpdate)\n{\n var tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._updateID === tex._updateID)\n {\n return false;\n }\n\n this._updateID = tex._updateID;\n\n var uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n var orig = tex.orig;\n var trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n var texBase = tex.baseTexture;\n var frame = this.uClampFrame;\n var margin = this.clampMargin / texBase.resolution;\n var offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n};\n\nObject.defineProperties( TextureMatrix.prototype, prototypeAccessors$4 );\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nvar SpriteMaskFilter = /*@__PURE__*/(function (Filter) {\n function SpriteMaskFilter(sprite)\n {\n var maskMatrix = new Matrix();\n\n Filter.call(this, vertex, fragment);\n\n sprite.renderable = false;\n\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n this.maskSprite = sprite;\n\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n this.maskMatrix = maskMatrix;\n }\n\n if ( Filter ) SpriteMaskFilter.__proto__ = Filter;\n SpriteMaskFilter.prototype = Object.create( Filter && Filter.prototype );\n SpriteMaskFilter.prototype.constructor = SpriteMaskFilter;\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it.\n */\n SpriteMaskFilter.prototype.apply = function apply (filterManager, input, output, clear)\n {\n var maskSprite = this.maskSprite;\n var tex = this.maskSprite.texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.transform)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.transform = new TextureMatrix(tex, 0.0);\n }\n tex.transform.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.transform.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.transform.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clear);\n };\n\n return SpriteMaskFilter;\n}(Filter));\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar MaskSystem = /*@__PURE__*/(function (System) {\n function MaskSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * Target to mask\n * @member {PIXI.DisplayObject}\n * @readonly\n */\n this.scissorRenderTarget = null;\n\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n this.enableScissor = false;\n\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n this.alphaMaskPool = [];\n\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n this.maskDataPool = [];\n\n this.maskStack = [];\n\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n this.alphaMaskIndex = 0;\n }\n\n if ( System ) MaskSystem.__proto__ = System;\n MaskSystem.prototype = Object.create( System && System.prototype );\n MaskSystem.prototype.constructor = MaskSystem;\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n MaskSystem.prototype.setMaskStack = function setMaskStack (maskStack)\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n };\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n MaskSystem.prototype.push = function push (target, maskData)\n {\n if (!maskData.isMaskData)\n {\n var d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskData;\n maskData = d;\n }\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n };\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n MaskSystem.prototype.pop = function pop (target)\n {\n var maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n };\n\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n MaskSystem.prototype.detect = function detect (maskData)\n {\n var maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n\n return;\n }\n maskData.type = MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect())\n {\n var matrix = maskObject.worldTransform;\n\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n\n var rotX = Math.atan2(matrix.b, matrix.a);\n var rotXY = Math.atan2(matrix.d, matrix.c);\n\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n\n if (rotX === 0 && rotXY === 9000)\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n }\n };\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n MaskSystem.prototype.pushSpriteMask = function pushSpriteMask (maskData)\n {\n var maskObject = maskData.maskObject;\n var target = maskData._target;\n var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n var stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n };\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n MaskSystem.prototype.popSpriteMask = function popSpriteMask ()\n {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n };\n\n return MaskSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar AbstractMaskSystem = /*@__PURE__*/(function (System) {\n function AbstractMaskSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n this.glConst = 0;\n }\n\n if ( System ) AbstractMaskSystem.__proto__ = System;\n AbstractMaskSystem.prototype = Object.create( System && System.prototype );\n AbstractMaskSystem.prototype.constructor = AbstractMaskSystem;\n\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n AbstractMaskSystem.prototype.getStackLength = function getStackLength ()\n {\n return this.maskStack.length;\n };\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n AbstractMaskSystem.prototype.setMaskStack = function setMaskStack (maskStack)\n {\n var ref = this.renderer;\n var gl = ref.gl;\n var curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n var newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n };\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n AbstractMaskSystem.prototype._useCurrent = function _useCurrent ()\n {\n // OVERWRITE;\n };\n\n /**\n * Destroys the mask stack.\n *\n */\n AbstractMaskSystem.prototype.destroy = function destroy ()\n {\n System.prototype.destroy.call(this, this);\n\n this.maskStack = null;\n };\n\n return AbstractMaskSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar ScissorSystem = /*@__PURE__*/(function (AbstractMaskSystem) {\n function ScissorSystem(renderer)\n {\n AbstractMaskSystem.call(this, renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n if ( AbstractMaskSystem ) ScissorSystem.__proto__ = AbstractMaskSystem;\n ScissorSystem.prototype = Object.create( AbstractMaskSystem && AbstractMaskSystem.prototype );\n ScissorSystem.prototype.constructor = ScissorSystem;\n\n ScissorSystem.prototype.getStackLength = function getStackLength ()\n {\n var maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n };\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n ScissorSystem.prototype.push = function push (maskData)\n {\n var maskObject = maskData.maskObject;\n\n maskObject.renderable = true;\n\n var prevData = maskData._scissorRect;\n var bounds = maskObject.getBounds(true);\n var ref = this.renderer;\n var gl = ref.gl;\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n bounds.fit(prevData);\n }\n else\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n };\n\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n ScissorSystem.prototype.pop = function pop ()\n {\n var ref = this.renderer;\n var gl = ref.gl;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n };\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n ScissorSystem.prototype._useCurrent = function _useCurrent ()\n {\n var rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n var rt = this.renderer.renderTexture.current;\n var ref = this.renderer.projection;\n var transform = ref.transform;\n var sourceFrame = ref.sourceFrame;\n var destinationFrame = ref.destinationFrame;\n var resolution = rt ? rt.resolution : this.renderer.resolution;\n var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n var width = rect.width * resolution;\n var height = rect.height * resolution;\n\n if (transform)\n {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt)\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n\n this.renderer.gl.scissor(x, y, width, height);\n };\n\n return ScissorSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar StencilSystem = /*@__PURE__*/(function (AbstractMaskSystem) {\n function StencilSystem(renderer)\n {\n AbstractMaskSystem.call(this, renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n if ( AbstractMaskSystem ) StencilSystem.__proto__ = AbstractMaskSystem;\n StencilSystem.prototype = Object.create( AbstractMaskSystem && AbstractMaskSystem.prototype );\n StencilSystem.prototype.constructor = StencilSystem;\n\n StencilSystem.prototype.getStackLength = function getStackLength ()\n {\n var maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n };\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n StencilSystem.prototype.push = function push (maskData)\n {\n var maskObject = maskData.maskObject;\n var ref = this.renderer;\n var gl = ref.gl;\n var prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n };\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n StencilSystem.prototype.pop = function pop (maskObject)\n {\n var gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n };\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n StencilSystem.prototype._useCurrent = function _useCurrent ()\n {\n var gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n };\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n StencilSystem.prototype._getBitwiseMask = function _getBitwiseMask ()\n {\n return (1 << this.getStackLength()) - 1;\n };\n\n return StencilSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nvar ProjectionSystem = /*@__PURE__*/(function (System) {\n function ProjectionSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = null;\n\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.defaultFrame = null;\n\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n }\n\n if ( System ) ProjectionSystem.__proto__ = System;\n ProjectionSystem.prototype = Object.create( System && System.prototype );\n ProjectionSystem.prototype.constructor = ProjectionSystem;\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n ProjectionSystem.prototype.update = function update (destinationFrame, sourceFrame, resolution, root)\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n var renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n };\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n ProjectionSystem.prototype.calculateProjection = function calculateProjection (destinationFrame, sourceFrame, resolution, root)\n {\n var pm = this.projectionMatrix;\n\n // I don't think we will need this line..\n // pm.identity();\n\n if (!root)\n {\n pm.a = (1 / destinationFrame.width * 2) * resolution;\n pm.d = (1 / destinationFrame.height * 2) * resolution;\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -1 - (sourceFrame.y * pm.d);\n }\n else\n {\n pm.a = (1 / destinationFrame.width * 2) * resolution;\n pm.d = (-1 / destinationFrame.height * 2) * resolution;\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = 1 - (sourceFrame.y * pm.d);\n }\n };\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n ProjectionSystem.prototype.setTransform = function setTransform ()// matrix)\n {\n // this._activeRenderTarget.transform = matrix;\n };\n\n return ProjectionSystem;\n}(System));\n\nvar tempRect = new Rectangle();\n\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nvar RenderTextureSystem = /*@__PURE__*/(function (System) {\n function RenderTextureSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n this.clearColor = renderer._backgroundColorRgba;\n\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n this.defaultMaskStack = [];\n\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n this.current = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = new Rectangle();\n }\n\n if ( System ) RenderTextureSystem.__proto__ = System;\n RenderTextureSystem.prototype = Object.create( System && System.prototype );\n RenderTextureSystem.prototype.constructor = RenderTextureSystem;\n\n /**\n * Bind the current render texture\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n RenderTextureSystem.prototype.bind = function bind (renderTexture, sourceFrame, destinationFrame)\n {\n if ( renderTexture === void 0 ) renderTexture = null;\n\n this.current = renderTexture;\n\n var renderer = this.renderer;\n\n var resolution;\n\n if (renderTexture)\n {\n var baseTexture = renderTexture.baseTexture;\n\n resolution = baseTexture.resolution;\n\n if (!destinationFrame)\n {\n tempRect.width = baseTexture.realWidth;\n tempRect.height = baseTexture.realHeight;\n\n destinationFrame = tempRect;\n }\n\n if (!sourceFrame)\n {\n sourceFrame = destinationFrame;\n }\n\n this.renderer.framebuffer.bind(baseTexture.framebuffer, destinationFrame);\n\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, false);\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n // TODO these validation checks happen deeper down..\n // thing they can be avoided..\n if (!destinationFrame)\n {\n tempRect.width = renderer.width;\n tempRect.height = renderer.height;\n\n destinationFrame = tempRect;\n }\n\n if (!sourceFrame)\n {\n sourceFrame = destinationFrame;\n }\n\n renderer.framebuffer.bind(null, destinationFrame);\n\n // TODO store this..\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, true);\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n\n this.destinationFrame.x = destinationFrame.x / resolution;\n this.destinationFrame.y = destinationFrame.y / resolution;\n\n this.destinationFrame.width = destinationFrame.width / resolution;\n this.destinationFrame.height = destinationFrame.height / resolution;\n\n if (sourceFrame === destinationFrame)\n {\n this.sourceFrame.copyFrom(this.destinationFrame);\n }\n };\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @return {PIXI.Renderer} Returns itself.\n */\n RenderTextureSystem.prototype.clear = function clear (clearColor)\n {\n if (this.current)\n {\n clearColor = clearColor || this.current.baseTexture.clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n };\n\n RenderTextureSystem.prototype.resize = function resize ()// screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n };\n\n /**\n * Resets renderTexture state\n */\n RenderTextureSystem.prototype.reset = function reset ()\n {\n this.bind(null);\n };\n\n return RenderTextureSystem;\n}(System));\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nvar GLProgram = function GLProgram(program, uniformData)\n{\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n};\n\n/**\n * Destroys this program\n */\nGLProgram.prototype.destroy = function destroy ()\n{\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n};\n\nvar UID$4 = 0;\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar ShaderSystem = /*@__PURE__*/(function (System) {\n function ShaderSystem(renderer)\n {\n System.call(this, renderer);\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n this.cache = {};\n\n this.id = UID$4++;\n }\n\n if ( System ) ShaderSystem.__proto__ = System;\n ShaderSystem.prototype = Object.create( System && System.prototype );\n ShaderSystem.prototype.constructor = ShaderSystem;\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n ShaderSystem.prototype.systemCheck = function systemCheck ()\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n };\n\n ShaderSystem.prototype.contextChange = function contextChange (gl)\n {\n this.gl = gl;\n this.reset();\n };\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} dontSync - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n ShaderSystem.prototype.bind = function bind (shader, dontSync)\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n var program = shader.program;\n var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n this.syncUniformGroup(shader.uniformGroup);\n }\n\n return glProgram;\n };\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n ShaderSystem.prototype.setUniforms = function setUniforms (uniforms)\n {\n var shader = this.shader.program;\n var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n };\n\n ShaderSystem.prototype.syncUniformGroup = function syncUniformGroup (group)\n {\n var glProgram = this.getglProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])\n {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram);\n }\n };\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n ShaderSystem.prototype.syncUniforms = function syncUniforms (group, glProgram)\n {\n var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer);\n };\n\n ShaderSystem.prototype.createSyncGroups = function createSyncGroups (group)\n {\n var id = this.getSignature(group, this.shader.program.uniformData);\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n };\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group the uniform group to get signature of\n * @param {Object} uniformData uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n ShaderSystem.prototype.getSignature = function getSignature (group, uniformData)\n {\n var uniforms = group.uniforms;\n\n var strings = [];\n\n for (var i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n };\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n ShaderSystem.prototype.getglProgram = function getglProgram ()\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n };\n\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n ShaderSystem.prototype.generateShader = function generateShader (shader)\n {\n var gl = this.gl;\n\n var program = shader.program;\n\n var attribMap = {};\n\n for (var i in program.attributeData)\n {\n attribMap[i] = program.attributeData[i].location;\n }\n\n var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n var uniformData = {};\n\n for (var i$1 in program.uniformData)\n {\n var data = program.uniformData[i$1];\n\n uniformData[i$1] = {\n location: gl.getUniformLocation(shaderProgram, i$1),\n value: defaultValue(data.type, data.size),\n };\n }\n\n var glProgram = new GLProgram(shaderProgram, uniformData);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n };\n\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n ShaderSystem.prototype.reset = function reset ()\n {\n this.program = null;\n this.shader = null;\n };\n\n /**\n * Destroys this System and removes all its textures\n */\n ShaderSystem.prototype.destroy = function destroy ()\n {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n };\n\n return ShaderSystem;\n}(System));\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nfunction mapWebGLBlendModesToPixi(gl, array)\n{\n if ( array === void 0 ) array = [];\n\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n\nvar BLEND$1 = 0;\nvar OFFSET$1 = 1;\nvar CULLING$1 = 2;\nvar DEPTH_TEST$1 = 3;\nvar WINDING$1 = 4;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar StateSystem = /*@__PURE__*/(function (System) {\n function StateSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = null;\n\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n this.stateId = 0;\n\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n this.polygonOffset = 0;\n\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n this.blendMode = BLEND_MODES.NONE;\n\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n this._blendEq = false;\n\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n this.map = [];\n\n // map functions for when we set state..\n this.map[BLEND$1] = this.setBlend;\n this.map[OFFSET$1] = this.setOffset;\n this.map[CULLING$1] = this.setCullFace;\n this.map[DEPTH_TEST$1] = this.setDepthTest;\n this.map[WINDING$1] = this.setFrontFace;\n\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n this.checks = [];\n\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n this.defaultState = new State();\n this.defaultState.blend = true;\n this.defaultState.depth = true;\n }\n\n if ( System ) StateSystem.__proto__ = System;\n StateSystem.prototype = Object.create( System && System.prototype );\n StateSystem.prototype.constructor = StateSystem;\n\n StateSystem.prototype.contextChange = function contextChange (gl)\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n };\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n StateSystem.prototype.set = function set (state)\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n var diff = this.stateId ^ state.data;\n var i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (var i$1 = 0; i$1 < this.checks.length; i$1++)\n {\n this.checks[i$1](this, state);\n }\n };\n\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n StateSystem.prototype.forceState = function forceState (state)\n {\n state = state || this.defaultState;\n for (var i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (var i$1 = 0; i$1 < this.checks.length; i$1++)\n {\n this.checks[i$1](this, state);\n }\n\n this.stateId = state.data;\n };\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n StateSystem.prototype.setBlend = function setBlend (value)\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n };\n\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n StateSystem.prototype.setOffset = function setOffset (value)\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n };\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n StateSystem.prototype.setDepthTest = function setDepthTest (value)\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n };\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n StateSystem.prototype.setCullFace = function setCullFace (value)\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n };\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n StateSystem.prototype.setFrontFace = function setFrontFace (value)\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n };\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n StateSystem.prototype.setBlendMode = function setBlendMode (value)\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n var mode = this.blendModes[value];\n var gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n };\n\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n StateSystem.prototype.setPolygonOffset = function setPolygonOffset (value, scale)\n {\n this.gl.polygonOffset(value, scale);\n };\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n StateSystem.prototype.reset = function reset ()\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(0);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n };\n\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func the checking function to add or remove\n * @param {boolean} value should the check function be added or removed.\n */\n StateSystem.prototype.updateCheck = function updateCheck (func, value)\n {\n var index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n };\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System the System to perform the state check on\n * @param {PIXI.State} state the state that the blendMode will pulled from\n */\n StateSystem.checkBlendMode = function checkBlendMode (system, state)\n {\n system.setBlendMode(state.blendMode);\n };\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System the System to perform the state check on\n * @param {PIXI.State} state the state that the blendMode will pulled from\n */\n StateSystem.checkPolygonOffset = function checkPolygonOffset (system, state)\n {\n system.setPolygonOffset(state.polygonOffset, 0);\n };\n\n return StateSystem;\n}(System));\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nvar TextureGCSystem = /*@__PURE__*/(function (System) {\n function TextureGCSystem(renderer)\n {\n System.call(this, renderer);\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n\n if ( System ) TextureGCSystem.__proto__ = System;\n TextureGCSystem.prototype = Object.create( System && System.prototype );\n TextureGCSystem.prototype.constructor = TextureGCSystem;\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.postrender = function postrender ()\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n };\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.run = function run ()\n {\n var tm = this.renderer.texture;\n var managedTextures = tm.managedTextures;\n var wasRemoved = false;\n\n for (var i = 0; i < managedTextures.length; i++)\n {\n var texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!texture.framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n var j = 0;\n\n for (var i$1 = 0; i$1 < managedTextures.length; i$1++)\n {\n if (managedTextures[i$1] !== null)\n {\n managedTextures[j++] = managedTextures[i$1];\n }\n }\n\n managedTextures.length = j;\n }\n };\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n TextureGCSystem.prototype.unload = function unload (displayObject)\n {\n var tm = this.renderer.textureSystem;\n\n // only destroy non generated textures\n if (displayObject._texture && displayObject._texture._glRenderTargets)\n {\n tm.destroyTexture(displayObject._texture);\n }\n\n for (var i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n };\n\n return TextureGCSystem;\n}(System));\n\n/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nvar GLTexture = function GLTexture(texture)\n{\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n};\n\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nvar TextureSystem = /*@__PURE__*/(function (System) {\n function TextureSystem(renderer)\n {\n System.call(this, renderer);\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n }\n\n if ( System ) TextureSystem.__proto__ = System;\n TextureSystem.prototype = Object.create( System && System.prototype );\n TextureSystem.prototype.constructor = TextureSystem;\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n TextureSystem.prototype.contextChange = function contextChange ()\n {\n var gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (var i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n var emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (var i$1 = 0; i$1 < 6; i$1++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i$1, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (var i$2 = 0; i$2 < this.boundTextures.length; i$2++)\n {\n this.bind(null, i$2);\n }\n };\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n TextureSystem.prototype.bind = function bind (texture, location)\n {\n if ( location === void 0 ) location = 0;\n\n var ref = this;\n var gl = ref.gl;\n\n if (texture)\n {\n texture = texture.baseTexture || texture;\n\n if (texture.valid)\n {\n texture.touched = this.renderer.textureGC.count;\n\n var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n };\n\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n TextureSystem.prototype.reset = function reset ()\n {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n\n for (var i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n };\n\n /**\n * Unbind a texture\n * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind\n */\n TextureSystem.prototype.unbind = function unbind (texture)\n {\n var ref = this;\n var gl = ref.gl;\n var boundTextures = ref.boundTextures;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (var i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (var i$1 = 0; i$1 < boundTextures.length; i$1++)\n {\n if (boundTextures[i$1] === texture)\n {\n if (this.currentLocation !== i$1)\n {\n gl.activeTexture(gl.TEXTURE0 + i$1);\n this.currentLocation = i$1;\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[texture.target].texture);\n boundTextures[i$1] = null;\n }\n }\n };\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.initTexture = function initTexture (texture)\n {\n var glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n };\n\n TextureSystem.prototype.initTextureType = function initTextureType (texture, glTexture)\n {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2)\n {\n return;\n }\n var gl = this.renderer.gl;\n\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === TYPES.HALF_FLOAT)\n {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA16F;\n }\n };\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.updateTexture = function updateTexture (texture)\n {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n var renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n ;\n else\n {\n // default, renderTexture-like logic\n var width = texture.realWidth;\n var height = texture.realHeight;\n var gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n };\n\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n TextureSystem.prototype.destroyTexture = function destroyTexture (texture, skipRemove)\n {\n var ref = this;\n var gl = ref.gl;\n\n texture = texture.baseTexture || texture;\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n var i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n };\n\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n TextureSystem.prototype.updateTextureStyle = function updateTextureStyle (texture)\n {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = 0;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n ;\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n };\n\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n TextureSystem.prototype.setStyle = function setStyle (texture, glTexture)\n {\n var gl = this.gl;\n\n if (glTexture.mipmap)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST);\n };\n\n return TextureSystem;\n}(System));\n\n/**\n * Systems are individual components to the Renderer pipeline.\n * @namespace PIXI.systems\n */\n\nvar systems = ({\n FilterSystem: FilterSystem,\n BatchSystem: BatchSystem,\n ContextSystem: ContextSystem,\n FramebufferSystem: FramebufferSystem,\n GeometrySystem: GeometrySystem,\n MaskSystem: MaskSystem,\n ScissorSystem: ScissorSystem,\n StencilSystem: StencilSystem,\n ProjectionSystem: ProjectionSystem,\n RenderTextureSystem: RenderTextureSystem,\n ShaderSystem: ShaderSystem,\n StateSystem: StateSystem,\n TextureGCSystem: TextureGCSystem,\n TextureSystem: TextureSystem\n});\n\nvar tempMatrix = new Matrix();\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar AbstractRenderer = /*@__PURE__*/(function (EventEmitter) {\n function AbstractRenderer(system, options)\n {\n EventEmitter.call(this);\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n // Deprecation notice for renderer roundPixels option\n if (options.roundPixels)\n {\n settings.ROUND_PIXELS = options.roundPixels;\n deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = RENDERER_TYPE.UNKNOWN;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n this.autoDensity = options.autoDensity || options.autoResize || false;\n // autoResize is deprecated, provides fallback support\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * This temporary display object used as the parent of the currently being rendered item.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._tempDisplayObjectParent = new Container();\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = this._tempDisplayObjectParent;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n if ( EventEmitter ) AbstractRenderer.__proto__ = EventEmitter;\n AbstractRenderer.prototype = Object.create( EventEmitter && EventEmitter.prototype );\n AbstractRenderer.prototype.constructor = AbstractRenderer;\n\n var prototypeAccessors = { width: { configurable: true },height: { configurable: true },backgroundColor: { configurable: true } };\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n AbstractRenderer.prototype.initPlugins = function initPlugins (staticMap)\n {\n for (var o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n };\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n prototypeAccessors.width.get = function ()\n {\n return this.view.width;\n };\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n prototypeAccessors.height.get = function ()\n {\n return this.view.height;\n };\n\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n AbstractRenderer.prototype.resize = function resize (screenWidth, screenHeight)\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoDensity)\n {\n this.view.style.width = screenWidth + \"px\";\n this.view.style.height = screenHeight + \"px\";\n }\n };\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {number} scaleMode - Should be one of the scaleMode consts.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n AbstractRenderer.prototype.generateTexture = function generateTexture (displayObject, scaleMode, resolution, region)\n {\n region = region || displayObject.getLocalBounds();\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) { region.width = 1; }\n if (region.height === 0) { region.height = 1; }\n\n var renderTexture = RenderTexture.create(region.width | 0, region.height | 0, scaleMode, resolution);\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n };\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n AbstractRenderer.prototype.destroy = function destroy (removeView)\n {\n for (var o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n this.plugins = null;\n\n this.type = RENDERER_TYPE.UNKNOWN;\n\n this.view = null;\n\n this.screen = null;\n\n this.resolution = 0;\n\n this.transparent = false;\n\n this.autoDensity = false;\n\n this.blendModes = null;\n\n this.options = null;\n\n this.preserveDrawingBuffer = false;\n this.clearBeforeRender = false;\n\n this._backgroundColor = 0;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n\n this._tempDisplayObjectParent = null;\n this._lastObjectRendered = null;\n };\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n prototypeAccessors.backgroundColor.get = function ()\n {\n return this._backgroundColor;\n };\n\n prototypeAccessors.backgroundColor.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n };\n\n Object.defineProperties( AbstractRenderer.prototype, prototypeAccessors );\n\n return AbstractRenderer;\n}(EventEmitter));\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nvar Renderer = /*@__PURE__*/(function (AbstractRenderer) {\n function Renderer(options)\n {\n if ( options === void 0 ) options = {};\n\n AbstractRenderer.call(this, 'WebGL', options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n /**\n * The type of this renderer as a standardized const\n *\n * @member {number}\n * @see PIXI.RENDERER_TYPE\n */\n this.type = RENDERER_TYPE.WEBGL;\n\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n // TODO legacy!\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange', 1),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize', 2),\n };\n\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n if ( AbstractRenderer ) Renderer.__proto__ = AbstractRenderer;\n Renderer.prototype = Object.create( AbstractRenderer && AbstractRenderer.prototype );\n Renderer.prototype.constructor = Renderer;\n\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n Renderer.create = function create (options)\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n };\n\n Renderer.prototype.addSystem = function addSystem (ClassRef, name)\n {\n if (!name)\n {\n name = ClassRef.name;\n }\n\n var system = new ClassRef(this);\n\n if (this[name])\n {\n throw new Error((\"Whoops! The name \\\"\" + name + \"\\\" is already in use\"));\n }\n\n this[name] = system;\n\n for (var i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n };\n\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n Renderer.prototype.render = function render (displayObject, renderTexture, clear, transform, skipUpdateTransform)\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.run();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n var cacheParent = displayObject.parent;\n\n displayObject.parent = this._tempDisplayObjectParent;\n displayObject.updateTransform();\n displayObject.parent = cacheParent;\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.run();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n };\n\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n Renderer.prototype.resize = function resize (screenWidth, screenHeight)\n {\n AbstractRenderer.prototype.resize.call(this, screenWidth, screenHeight);\n\n this.runners.resize.run(screenWidth, screenHeight);\n };\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n Renderer.prototype.reset = function reset ()\n {\n this.runners.reset.run();\n\n return this;\n };\n\n /**\n * Clear the frame buffer\n */\n Renderer.prototype.clear = function clear ()\n {\n this.framebuffer.bind();\n this.framebuffer.clear();\n };\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n Renderer.prototype.destroy = function destroy (removeView)\n {\n this.runners.destroy.run();\n\n for (var r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n AbstractRenderer.prototype.destroy.call(this, removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n };\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.Renderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.extract.Extract} extract Extract image data from renderer.\n * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.prepare.Prepare} prepare Pre-render display objects.\n */\n\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n Renderer.registerPlugin = function registerPlugin (pluginName, ctor)\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n };\n\n return Renderer;\n}(AbstractRenderer));\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native.\n * FXAA is faster, but may not always look as great **webgl only**\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nfunction autoDetectRenderer(options)\n{\n return Renderer.create(options);\n}\n\nvar _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}\";\n\nvar 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\";\n\n/**\n * A Texture that depends on six other resources.\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nvar CubeTexture = /*@__PURE__*/(function (BaseTexture) {\n function CubeTexture () {\n BaseTexture.apply(this, arguments);\n }\n\n if ( BaseTexture ) CubeTexture.__proto__ = BaseTexture;\n CubeTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype );\n CubeTexture.prototype.constructor = CubeTexture;\n\n CubeTexture.from = function from (resources, options)\n {\n return new CubeTexture(new CubeResource(resources, options));\n };\n\n return CubeTexture;\n}(BaseTexture));\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nvar BatchDrawCall = function BatchDrawCall()\n{\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n};\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nvar BatchTextureArray = function BatchTextureArray()\n{\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n};\n\nBatchTextureArray.prototype.clear = function clear ()\n{\n for (var i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n};\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nvar ViewableBuffer = function ViewableBuffer(size)\n{\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n};\n\nvar prototypeAccessors$5 = { int8View: { configurable: true },uint8View: { configurable: true },int16View: { configurable: true },uint16View: { configurable: true },int32View: { configurable: true } };\n\n/**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\nprototypeAccessors$5.int8View.get = function ()\n{\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n};\n\n/**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\nprototypeAccessors$5.uint8View.get = function ()\n{\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n};\n\n/**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\nprototypeAccessors$5.int16View.get = function ()\n{\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n};\n\n/**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\nprototypeAccessors$5.uint16View.get = function ()\n{\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n};\n\n/**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\nprototypeAccessors$5.int32View.get = function ()\n{\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n};\n\n/**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n *`uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\nViewableBuffer.prototype.view = function view (type)\n{\n return this[(type + \"View\")];\n};\n\n/**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\nViewableBuffer.prototype.destroy = function destroy ()\n{\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n};\n\nViewableBuffer.sizeOf = function sizeOf (type)\n{\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error((type + \" isn't a valid view type\"));\n }\n};\n\nObject.defineProperties( ViewableBuffer.prototype, prototypeAccessors$5 );\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nvar AbstractBatchRenderer = /*@__PURE__*/(function (ObjectRenderer) {\n function AbstractBatchRenderer(renderer)\n {\n ObjectRenderer.call(this, renderer);\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n this.shaderGenerator = null;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n this.geometryClass = null;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n this.vertexSize = null;\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._vertexCount = 0;\n\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._indexCount = 0;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n this._bufferedElements = [];\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n this._bufferedTextures = [];\n\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n this._bufferSize = 0;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n this._shader = null;\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n this._packedGeometries = [];\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n this._packedGeometryPoolSize = 2;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n this._flushId = 0;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n this._aBuffers = {};\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n this._iBuffers = {};\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n if ( ObjectRenderer ) AbstractBatchRenderer.__proto__ = ObjectRenderer;\n AbstractBatchRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );\n AbstractBatchRenderer.prototype.constructor = AbstractBatchRenderer;\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n AbstractBatchRenderer.prototype.contextChange = function contextChange ()\n {\n var gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (var i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n };\n\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n AbstractBatchRenderer.prototype.initFlushBuffers = function initFlushBuffers ()\n {\n var _drawCallPool = AbstractBatchRenderer._drawCallPool;\n var _textureArrayPool = AbstractBatchRenderer._textureArrayPool;\n // max draw calls\n var MAX_SPRITES = this.size / 4;\n // max texture arrays\n var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (var i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n };\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n AbstractBatchRenderer.prototype.onPrerender = function onPrerender ()\n {\n this._flushId = 0;\n };\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n AbstractBatchRenderer.prototype.render = function render (element)\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n };\n\n AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function buildTexturesAndDrawCalls ()\n {\n var ref = this;\n var textures = ref._bufferedTextures;\n var MAX_TEXTURES = ref.MAX_TEXTURES;\n var textureArrays = AbstractBatchRenderer._textureArrayPool;\n var batch = this.renderer.batch;\n var boundTextures = this._tempBoundTextures;\n var touch = this.renderer.textureGC.count;\n\n var TICK = ++BaseTexture._globalBatch;\n var countTexArrays = 0;\n var texArray = textureArrays[0];\n var start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (var i = 0; i < this._bufferSize; ++i)\n {\n var tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (var i$1 = 0; i$1 < boundTextures.length; i$1++)\n {\n boundTextures[i$1] = null;\n }\n BaseTexture._globalBatch = TICK;\n };\n\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n AbstractBatchRenderer.prototype.buildDrawCalls = function buildDrawCalls (texArray, start, finish)\n {\n var ref = this;\n var elements = ref._bufferedElements;\n var _attributeBuffer = ref._attributeBuffer;\n var _indexBuffer = ref._indexBuffer;\n var vertexSize = ref.vertexSize;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n\n var dcIndex = this._dcIndex;\n var aIndex = this._aIndex;\n var iIndex = this._iIndex;\n\n var drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (var i = start; i < finish; ++i)\n {\n var sprite = elements[i];\n var tex = sprite._texture.baseTexture;\n var spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n };\n\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n AbstractBatchRenderer.prototype.bindAndClearTexArray = function bindAndClearTexArray (texArray)\n {\n var textureSystem = this.renderer.texture;\n\n for (var j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n };\n\n AbstractBatchRenderer.prototype.updateGeometry = function updateGeometry ()\n {\n var ref = this;\n var packedGeometries = ref._packedGeometries;\n var attributeBuffer = ref._attributeBuffer;\n var indexBuffer = ref._indexBuffer;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n };\n\n AbstractBatchRenderer.prototype.drawBatches = function drawBatches ()\n {\n var dcCount = this._dcIndex;\n var ref = this.renderer;\n var gl = ref.gl;\n var stateSystem = ref.state;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n\n var curTexArray = null;\n\n // Upload textures and do the draw calls\n for (var i = 0; i < dcCount; i++)\n {\n var ref$1 = drawCalls[i];\n var texArray = ref$1.texArray;\n var type = ref$1.type;\n var size = ref$1.size;\n var start = ref$1.start;\n var blend = ref$1.blend;\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n stateSystem.setBlendMode(blend);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n };\n\n /**\n * Renders the content _now_ and empties the current batch.\n */\n AbstractBatchRenderer.prototype.flush = function flush ()\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n };\n\n /**\n * Starts a new sprite batch.\n */\n AbstractBatchRenderer.prototype.start = function start ()\n {\n this.renderer.state.set(this.state);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n };\n\n /**\n * Stops and flushes the current batch.\n */\n AbstractBatchRenderer.prototype.stop = function stop ()\n {\n this.flush();\n };\n\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n AbstractBatchRenderer.prototype.destroy = function destroy ()\n {\n for (var i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n ObjectRenderer.prototype.destroy.call(this);\n };\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n AbstractBatchRenderer.prototype.getAttributeBuffer = function getAttributeBuffer (size)\n {\n // 8 vertices is enough for 2 quads\n var roundedP2 = nextPow2(Math.ceil(size / 8));\n var roundedSizeIndex = log2(roundedP2);\n var roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n var buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n };\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * has atleast `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n AbstractBatchRenderer.prototype.getIndexBuffer = function getIndexBuffer (size)\n {\n // 12 indices is enough for 2 quads\n var roundedP2 = nextPow2(Math.ceil(size / 12));\n var roundedSizeIndex = log2(roundedP2);\n var roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n var buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n };\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n AbstractBatchRenderer.prototype.packInterleavedGeometry = function packInterleavedGeometry (element, attributeBuffer, indexBuffer, aIndex, iIndex)\n {\n var uint32View = attributeBuffer.uint32View;\n var float32View = attributeBuffer.float32View;\n\n var packedVertices = aIndex / this.vertexSize;\n var uvs = element.uvs;\n var indicies = element.indices;\n var vertexData = element.vertexData;\n var textureId = element._texture.baseTexture._batchLocation;\n\n var alpha = Math.min(element.worldAlpha, 1.0);\n var argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (var i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (var i$1 = 0; i$1 < indicies.length; i$1++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i$1];\n }\n };\n\n return AbstractBatchRenderer;\n}(ObjectRenderer));\n\n/**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\nAbstractBatchRenderer._drawCallPool = [];\n\n/**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\nAbstractBatchRenderer._textureArrayPool = [];\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nvar BatchShaderGenerator = function BatchShaderGenerator(vertexSrc, fragTemplate)\n{\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n};\n\nBatchShaderGenerator.prototype.generateShader = function generateShader (maxTextures)\n{\n if (!this.programCache[maxTextures])\n {\n var sampleValues = new Int32Array(maxTextures);\n\n for (var i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n var fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, (\"\" + maxTextures));\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n var uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n};\n\nBatchShaderGenerator.prototype.generateSampleSrc = function generateSampleSrc (maxTextures)\n{\n var src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (var i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += \"if(vTextureId < \" + i + \".5)\";\n }\n\n src += '\\n{';\n src += \"\\n\\tcolor = texture2D(uSamplers[\" + i + \"], vTextureCoord);\";\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n};\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nvar BatchGeometry = /*@__PURE__*/(function (Geometry) {\n function BatchGeometry(_static)\n {\n if ( _static === void 0 ) _static = false;\n\n Geometry.call(this);\n\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._buffer = new Buffer(null, _static, false);\n\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n\n if ( Geometry ) BatchGeometry.__proto__ = Geometry;\n BatchGeometry.prototype = Object.create( Geometry && Geometry.prototype );\n BatchGeometry.prototype.constructor = BatchGeometry;\n\n return BatchGeometry;\n}(Geometry));\n\nvar 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\";\n\nvar 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\";\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nvar BatchPluginFactory = function BatchPluginFactory () {};\n\nvar staticAccessors$1 = { defaultVertexSrc: { configurable: true },defaultFragmentTemplate: { configurable: true } };\n\nBatchPluginFactory.create = function create (options)\n{\n var ref = Object.assign({\n vertex: defaultVertex$2,\n fragment: defaultFragment$2,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n var vertex = ref.vertex;\n var fragment = ref.fragment;\n var vertexSize = ref.vertexSize;\n var geometryClass = ref.geometryClass;\n\n return /*@__PURE__*/(function (AbstractBatchRenderer) {\n function BatchPlugin(renderer)\n {\n AbstractBatchRenderer.call(this, renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n\n if ( AbstractBatchRenderer ) BatchPlugin.__proto__ = AbstractBatchRenderer;\n BatchPlugin.prototype = Object.create( AbstractBatchRenderer && AbstractBatchRenderer.prototype );\n BatchPlugin.prototype.constructor = BatchPlugin;\n\n return BatchPlugin;\n }(AbstractBatchRenderer));\n};\n\n/**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\nstaticAccessors$1.defaultVertexSrc.get = function ()\n{\n return defaultVertex$2;\n};\n\n/**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\nstaticAccessors$1.defaultFragmentTemplate.get = function ()\n{\n return defaultFragment$2;\n};\n\nObject.defineProperties( BatchPluginFactory, staticAccessors$1 );\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nvar BatchRenderer = BatchPluginFactory.create();\n\nexport { AbstractBatchRenderer, AbstractRenderer, Attribute, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchPluginFactory, BatchRenderer, BatchShaderGenerator, BatchTextureArray, Buffer, CubeTexture, Filter, Framebuffer, GLProgram, GLTexture, Geometry, MaskData, ObjectRenderer, Program, Quad, QuadUv, RenderTexture, RenderTexturePool, Renderer, Shader, SpriteMaskFilter, State, System, Texture, TextureMatrix, TextureUvs, UniformGroup, ViewableBuffer, autoDetectRenderer, checkMaxIfStatementsInShader, defaultFilter as defaultFilterVertex, _default as defaultVertex, index as resources, systems };\n//# sourceMappingURL=core.es.js.map\n","/*!\n * @pixi/extract - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/extract is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { RenderTexture } from '@pixi/core';\nimport { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\n\nvar TEMP_RECT = new Rectangle();\nvar BYTES_PER_PIXEL = 4;\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`\n *\n * @class\n * @memberof PIXI.extract\n */\nvar Extract = function Extract(renderer)\n{\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.extract.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.extract.Extract\n */\n renderer.extract = this;\n};\n\n/**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\nExtract.prototype.image = function image (target, format, quality)\n{\n var image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n};\n\n/**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\nExtract.prototype.base64 = function base64 (target, format, quality)\n{\n return this.canvas(target).toDataURL(format, quality);\n};\n\n/**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\nExtract.prototype.canvas = function canvas (target)\n{\n var renderer = this.renderer;\n var resolution;\n var frame;\n var flipY = false;\n var renderTexture;\n var generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n var width = Math.floor((frame.width * resolution) + 1e-4);\n var height = Math.floor((frame.height * resolution) + 1e-4);\n\n var canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n var gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n var canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n canvasBuffer.context.scale(1, -1);\n canvasBuffer.context.drawImage(canvasBuffer.canvas, 0, -height);\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n};\n\n/**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\nExtract.prototype.pixels = function pixels (target)\n{\n var renderer = this.renderer;\n var resolution;\n var frame;\n var renderTexture;\n var generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n var width = frame.width * resolution;\n var height = frame.height * resolution;\n\n var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n var gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n};\n\n/**\n * Destroys the extract\n *\n */\nExtract.prototype.destroy = function destroy ()\n{\n this.renderer.extract = null;\n this.renderer = null;\n};\n\n/**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\nExtract.arrayPostDivide = function arrayPostDivide (pixels, out)\n{\n for (var i = 0; i < pixels.length; i += 4)\n {\n var alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n};\n\n/**\n * This namespace provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @namespace PIXI.extract\n */\n\nexport { Extract };\n//# sourceMappingURL=extract.es.js.map\n","/*!\n * @pixi/interaction - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/interaction is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Point } from '@pixi/math';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject } from '@pixi/display';\nimport { EventEmitter } from '@pixi/utils';\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI.interaction\n */\nvar InteractionData = function InteractionData()\n{\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n};\n\nvar prototypeAccessors = { pointerId: { configurable: true } };\n\n/**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\nprototypeAccessors.pointerId.get = function ()\n{\n return this.identifier;\n};\n\n/**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\nInteractionData.prototype.getLocalPosition = function getLocalPosition (displayObject, point, globalPos)\n{\n return displayObject.worldTransform.applyInverse(globalPos || this.global, point);\n};\n\n/**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event The normalized event data\n */\nInteractionData.prototype.copyEvent = function copyEvent (event)\n{\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if (event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which;\n this.width = event.width;\n this.height = event.height;\n this.tiltX = event.tiltX;\n this.tiltY = event.tiltY;\n this.pointerType = event.pointerType;\n this.pressure = event.pressure;\n this.rotationAngle = event.rotationAngle;\n this.twist = event.twist || 0;\n this.tangentialPressure = event.tangentialPressure || 0;\n};\n\n/**\n * Resets the data for pooling.\n */\nInteractionData.prototype.reset = function reset ()\n{\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n};\n\nObject.defineProperties( InteractionData.prototype, prototypeAccessors );\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI.interaction\n */\nvar InteractionEvent = function InteractionEvent()\n{\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.interaction.InteractionData}\n */\n this.data = null;\n};\n\n/**\n * Prevents event from reaching any objects other than the current object.\n *\n */\nInteractionEvent.prototype.stopPropagation = function stopPropagation ()\n{\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n};\n\n/**\n * Resets the event.\n */\nInteractionEvent.prototype.reset = function reset ()\n{\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n};\n\n/**\n * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI.interaction\n */\nvar InteractionTrackingData = function InteractionTrackingData(pointerId)\n{\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n};\n\nvar prototypeAccessors$1 = { pointerId: { configurable: true },flags: { configurable: true },none: { configurable: true },over: { configurable: true },rightDown: { configurable: true },leftDown: { configurable: true } };\n\n/**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\nInteractionTrackingData.prototype._doSet = function _doSet (flag, yn)\n{\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n};\n\n/**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\nprototypeAccessors$1.pointerId.get = function ()\n{\n return this._pointerId;\n};\n\n/**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\nprototypeAccessors$1.flags.get = function ()\n{\n return this._flags;\n};\n\nprototypeAccessors$1.flags.set = function (flags) // eslint-disable-line require-jsdoc\n{\n this._flags = flags;\n};\n\n/**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\nprototypeAccessors$1.none.get = function ()\n{\n return this._flags === this.constructor.FLAGS.NONE;\n};\n\n/**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\nprototypeAccessors$1.over.get = function ()\n{\n return (this._flags & this.constructor.FLAGS.OVER) !== 0;\n};\n\nprototypeAccessors$1.over.set = function (yn) // eslint-disable-line require-jsdoc\n{\n this._doSet(this.constructor.FLAGS.OVER, yn);\n};\n\n/**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\nprototypeAccessors$1.rightDown.get = function ()\n{\n return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0;\n};\n\nprototypeAccessors$1.rightDown.set = function (yn) // eslint-disable-line require-jsdoc\n{\n this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn);\n};\n\n/**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\nprototypeAccessors$1.leftDown.get = function ()\n{\n return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0;\n};\n\nprototypeAccessors$1.leftDown.set = function (yn) // eslint-disable-line require-jsdoc\n{\n this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn);\n};\n\nObject.defineProperties( InteractionTrackingData.prototype, prototypeAccessors$1 );\n\nInteractionTrackingData.FLAGS = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n});\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI.interaction\n */\nvar TreeSearch = function TreeSearch()\n{\n this._tempPoint = new Point();\n};\n\n/**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\nTreeSearch.prototype.recursiveFindHit = function recursiveFindHit (interactionEvent, displayObject, func, hitTest, interactive)\n{\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n var point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n var hit = false;\n var interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n var hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && displayObject.children)\n {\n var children = displayObject.children;\n\n for (var i = children.length - 1; i >= 0; i--)\n {\n var child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && displayObject.containsPoint)\n {\n if (displayObject.containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n};\n\n/**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\nTreeSearch.prototype.findHit = function findHit (interactionEvent, displayObject, func, hitTest)\n{\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n};\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI.interaction\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interaction.interactiveTarget\n * );\n */\nvar interactiveTarget = {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode()\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) { this._trackedPointers = {}; }\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\nDisplayObject.mixin(interactiveTarget);\n\nvar MOUSE_POINTER_ID = 1;\n\n// helpers for hitTest() - only used inside hitTest()\nvar hitTestEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI.interaction\n */\nvar InteractionManager = /*@__PURE__*/(function (EventEmitter) {\n function InteractionManager(renderer, options)\n {\n EventEmitter.call(this);\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.interaction.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.interaction.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.interaction.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.interaction.InteractionManager#mousedown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.interaction.InteractionManager#mouseup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.interaction.InteractionManager#click\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightclick\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}.\n *\n * @event PIXI.interaction.InteractionManager#mouseupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}.\n *\n * @event PIXI.interaction.InteractionManager#rightupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.interaction.InteractionManager#mousemove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.interaction.InteractionManager#mouseover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.interaction.InteractionManager#mouseout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.interaction.InteractionManager#pointerdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.interaction.InteractionManager#pointerup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.interaction.InteractionManager#pointercancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.interaction.InteractionManager#pointertap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.interaction.InteractionManager#pointerupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.interaction.InteractionManager#pointermove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.interaction.InteractionManager#pointerover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.interaction.InteractionManager#pointerout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchstart\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchend\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.interaction.InteractionManager#touchcancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.interaction.InteractionManager#tap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}.\n *\n * @event PIXI.interaction.InteractionManager#touchendoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchmove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n if ( EventEmitter ) InteractionManager.__proto__ = EventEmitter;\n InteractionManager.prototype = Object.create( EventEmitter && EventEmitter.prototype );\n InteractionManager.prototype.constructor = InteractionManager;\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n InteractionManager.prototype.hitTest = function hitTest (globalPoint, root)\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.renderer._lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n };\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n InteractionManager.prototype.setTargetElement = function setTargetElement (element, resolution)\n {\n if ( resolution === void 0 ) resolution = 1;\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n };\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n InteractionManager.prototype.addEvents = function addEvents ()\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n Ticker.system.add(this.update, this, UPDATE_PRIORITY.INTERACTION);\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = 'none';\n this.interactionDOMElement.style['-ms-touch-action'] = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n this.interactionDOMElement.style['touch-action'] = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n };\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n InteractionManager.prototype.removeEvents = function removeEvents ()\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n Ticker.system.remove(this.update, this);\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = '';\n this.interactionDOMElement.style['-ms-touch-action'] = '';\n }\n else if (this.supportsPointerEvents)\n {\n this.interactionDOMElement.style['touch-action'] = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n };\n\n /**\n * Updates the state of interactive objects.\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since last tick\n */\n InteractionManager.prototype.update = function update (deltaTime)\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this.didMove)\n {\n this.didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (var k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n var interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n var interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.renderer._lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n };\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n InteractionManager.prototype.setCursorMode = function setCursorMode (mode)\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n var style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n };\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n InteractionManager.prototype.dispatchEvent = function dispatchEvent (displayObject, eventString, eventData)\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if (displayObject[eventString])\n {\n displayObject[eventString](eventData);\n }\n }\n };\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n InteractionManager.prototype.delayDispatchEvent = function delayDispatchEvent (displayObject, eventString, eventData)\n {\n this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData });\n };\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.Point} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint (point, x, y)\n {\n var rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n var resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier;\n };\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n InteractionManager.prototype.processInteractive = function processInteractive (interactionEvent, displayObject, func, hitTest)\n {\n var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n var delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n var delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (var i = 0; i < delayedLen; i++)\n {\n var ref = delayedEvents[i];\n var displayObject$1 = ref.displayObject;\n var eventString = ref.eventString;\n var eventData = ref.eventData;\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject$1)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject$1, eventString, eventData);\n }\n\n return hit;\n };\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n InteractionManager.prototype.onPointerDown = function onPointerDown (originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }\n\n var events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && events[0].isNormalized)\n {\n var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n var eventLen = events.length;\n\n for (var i = 0; i < eventLen; i++)\n {\n var event = events[i];\n\n var interactionData = this.getInteractionDataForPointerId(event);\n\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n var isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n };\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerDown = function processPointerDown (interactionEvent, displayObject, hit)\n {\n var data = interactionEvent.data;\n var id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n var isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n };\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n InteractionManager.prototype.onPointerComplete = function onPointerComplete (originalEvent, cancelled, func)\n {\n var events = this.normalizeToPointerData(originalEvent);\n\n var eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (var i = 0; i < eventLen; i++)\n {\n var event = events[i];\n\n var interactionData = this.getInteractionDataForPointerId(event);\n\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : (\"pointerup\" + eventAppend), interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n var isRightButton = event.button === 2;\n\n this.emit(isRightButton ? (\"rightup\" + eventAppend) : (\"mouseup\" + eventAppend), interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : (\"touchend\" + eventAppend), interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId, interactionData);\n }\n }\n };\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n InteractionManager.prototype.onPointerCancel = function onPointerCancel (event)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch') { return; }\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n };\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n InteractionManager.prototype.processPointerCancel = function processPointerCancel (interactionEvent, displayObject)\n {\n var data = interactionEvent.data;\n\n var id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n };\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n InteractionManager.prototype.onPointerUp = function onPointerUp (event)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch') { return; }\n\n this.onPointerComplete(event, false, this.processPointerUp);\n };\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerUp = function processPointerUp (interactionEvent, displayObject, hit)\n {\n var data = interactionEvent.data;\n\n var id = interactionEvent.data.identifier;\n\n var trackingData = displayObject.trackedPointers[id];\n\n var isTouch = data.pointerType === 'touch';\n\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n var isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n var isRightButton = data.button === 2;\n\n var flags = InteractionTrackingData.FLAGS;\n\n var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n var isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) { this.dispatchEvent(displayObject, 'touchend', interactionEvent); }\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); }\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n };\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n InteractionManager.prototype.onPointerMove = function onPointerMove (originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }\n\n var events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this.didMove = true;\n\n this.cursor = null;\n }\n\n var eventLen = events.length;\n\n for (var i = 0; i < eventLen; i++)\n {\n var event = events[i];\n\n var interactionData = this.getInteractionDataForPointerId(event);\n\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') { this.emit('touchmove', interactionEvent); }\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mousemove', interactionEvent); }\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n };\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerMove = function processPointerMove (interactionEvent, displayObject, hit)\n {\n var data = interactionEvent.data;\n\n var isTouch = data.pointerType === 'touch';\n\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); }\n if (isMouse) { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); }\n }\n };\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n InteractionManager.prototype.onPointerOut = function onPointerOut (originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; }\n\n var events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n var event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n var interactionData = this.getInteractionDataForPointerId(event);\n\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n };\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n InteractionManager.prototype.processPointerOverOut = function processPointerOverOut (interactionEvent, displayObject, hit)\n {\n var data = interactionEvent.data;\n\n var id = interactionEvent.data.identifier;\n\n var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n var trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) { return; }\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n };\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n InteractionManager.prototype.onPointerOver = function onPointerOver (originalEvent)\n {\n var events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n var event = events[0];\n\n var interactionData = this.getInteractionDataForPointerId(event);\n\n var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n };\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier\n */\n InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId (event)\n {\n var pointerId = event.pointerId;\n\n var interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n };\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId (pointerId)\n {\n var interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n };\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in\n */\n InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent (interactionEvent, pointerEvent, interactionData)\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n pointerEvent.globalX = interactionData.global.x;\n pointerEvent.globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n };\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData (event)\n {\n var normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (var i = 0, li = event.changedTouches.length; i < li; i++)\n {\n var touch = event.changedTouches[i];\n\n if (typeof touch.button === 'undefined') { touch.button = event.touches.length ? 1 : 0; }\n if (typeof touch.buttons === 'undefined') { touch.buttons = event.touches.length ? 1 : 0; }\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') { touch.width = touch.radiusX || 1; }\n if (typeof touch.height === 'undefined') { touch.height = touch.radiusY || 1; }\n if (typeof touch.tiltX === 'undefined') { touch.tiltX = 0; }\n if (typeof touch.tiltY === 'undefined') { touch.tiltY = 0; }\n if (typeof touch.pointerType === 'undefined') { touch.pointerType = 'touch'; }\n if (typeof touch.pointerId === 'undefined') { touch.pointerId = touch.identifier || 0; }\n if (typeof touch.pressure === 'undefined') { touch.pressure = touch.force || 0.5; }\n if (typeof touch.twist === 'undefined') { touch.twist = 0; }\n if (typeof touch.tangentialPressure === 'undefined') { touch.tangentialPressure = 0; }\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') { touch.layerX = touch.offsetX = touch.clientX; }\n if (typeof touch.layerY === 'undefined') { touch.layerY = touch.offsetY = touch.clientY; }\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n if (typeof event.isPrimary === 'undefined') { event.isPrimary = true; }\n if (typeof event.width === 'undefined') { event.width = 1; }\n if (typeof event.height === 'undefined') { event.height = 1; }\n if (typeof event.tiltX === 'undefined') { event.tiltX = 0; }\n if (typeof event.tiltY === 'undefined') { event.tiltY = 0; }\n if (typeof event.pointerType === 'undefined') { event.pointerType = 'mouse'; }\n if (typeof event.pointerId === 'undefined') { event.pointerId = MOUSE_POINTER_ID; }\n if (typeof event.pressure === 'undefined') { event.pressure = 0.5; }\n if (typeof event.twist === 'undefined') { event.twist = 0; }\n if (typeof event.tangentialPressure === 'undefined') { event.tangentialPressure = 0; }\n\n // mark the mouse event as normalized, just so that we know we did it\n event.isNormalized = true;\n\n normalizedEvents.push(event);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents;\n };\n\n /**\n * Destroys the interaction manager\n *\n */\n InteractionManager.prototype.destroy = function destroy ()\n {\n this.removeEvents();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n };\n\n return InteractionManager;\n}(EventEmitter));\n\n/**\n * This namespace contains a renderer plugin for handling mouse, pointer, and touch events.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @namespace PIXI.interaction\n */\n\nexport { InteractionData, InteractionEvent, InteractionManager, InteractionTrackingData, interactiveTarget };\n//# sourceMappingURL=interaction.es.js.map\n","/*!\n * @pixi/graphics - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/graphics is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Texture, BaseTexture, BatchDrawCall, BatchTextureArray, BatchGeometry, UniformGroup, Shader, State } from '@pixi/core';\nimport { SHAPES, Point, Polygon, PI_2, Matrix, Rectangle, RoundedRectangle, Circle, Ellipse } from '@pixi/math';\nimport { earcut, hex2rgb, premultiplyTint, deprecation } from '@pixi/utils';\nimport { WRAP_MODES, DRAW_MODES, BLEND_MODES } from '@pixi/constants';\nimport { Bounds, Container } from '@pixi/display';\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nvar GRAPHICS_CURVES = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n _segmentsCount: function _segmentsCount(length, defaultSegments)\n {\n if ( defaultSegments === void 0 ) defaultSegments = 20;\n\n if (!this.adaptive)\n {\n return defaultSegments;\n }\n\n var result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nvar FillStyle = function FillStyle()\n{\n this.reset();\n};\n\n/**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\nFillStyle.prototype.clone = function clone ()\n{\n var obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n};\n\n/**\n * Reset\n */\nFillStyle.prototype.reset = function reset ()\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.color = 0xFFFFFF;\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.alpha = 1;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {string}\n * @default 0\n */\n this.texture = Texture.WHITE;\n\n /**\n * The transform aplpied to the texture.\n *\n * @member {string}\n * @default 0\n */\n this.matrix = null;\n\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n this.visible = false;\n};\n\n/**\n * Destroy and don't use after this\n */\nFillStyle.prototype.destroy = function destroy ()\n{\n this.texture = null;\n this.matrix = null;\n};\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildPoly = {\n\n build: function build(graphicsData)\n {\n graphicsData.points = graphicsData.shape.points.slice();\n },\n\n triangulate: function triangulate(graphicsData, graphicsGeometry)\n {\n var points = graphicsData.points;\n var holes = graphicsData.holes;\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n var holeArray = [];\n // Process holes..\n\n for (var i = 0; i < holes.length; i++)\n {\n var hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n var triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n var vertPos = verts.length / 2;\n\n for (var i$1 = 0; i$1 < triangles.length; i$1 += 3)\n {\n indices.push(triangles[i$1] + vertPos);\n indices.push(triangles[i$1 + 1] + vertPos);\n indices.push(triangles[i$1 + 2] + vertPos);\n }\n\n for (var i$2 = 0; i$2 < points.length; i$2++)\n {\n verts.push(points[i$2]);\n }\n }\n },\n};\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildCircle = {\n\n build: function build(graphicsData)\n {\n // need to convert points to a nice regular data\n var circleData = graphicsData.shape;\n var points = graphicsData.points;\n var x = circleData.x;\n var y = circleData.y;\n var width;\n var height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n width = circleData.width;\n height = circleData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(circleData.width + circleData.height));\n\n totalSegs /= 2.3;\n\n var seg = (Math.PI * 2) / totalSegs;\n\n for (var i = 0; i < totalSegs; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(\n points[0],\n points[1]\n );\n },\n\n triangulate: function triangulate(graphicsData, graphicsGeometry)\n {\n var points = graphicsData.points;\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n\n var vertPos = verts.length / 2;\n var center = vertPos;\n\n verts.push(graphicsData.shape.x, graphicsData.shape.y);\n\n for (var i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildRectangle = {\n\n build: function build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n var rectData = graphicsData.shape;\n var x = rectData.x;\n var y = rectData.y;\n var width = rectData.width;\n var height = rectData.height;\n\n var points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate: function triangulate(graphicsData, graphicsGeometry)\n {\n var points = graphicsData.points;\n var verts = graphicsGeometry.points;\n\n var vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nvar buildRoundedRectangle = {\n\n build: function build(graphicsData)\n {\n var rrectData = graphicsData.shape;\n var points = graphicsData.points;\n var x = rrectData.x;\n var y = rrectData.y;\n var width = rrectData.width;\n var height = rrectData.height;\n\n var radius = rrectData.radius;\n\n points.length = 0;\n\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n\n triangulate: function triangulate(graphicsData, graphicsGeometry)\n {\n var points = graphicsData.points;\n\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n\n var vecPos = verts.length / 2;\n\n var triangles = earcut(points, null, 2);\n\n for (var i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (var i$1 = 0, j$1 = points.length; i$1 < j$1; i$1++)\n {\n verts.push(points[i$1], points[++i$1]);\n }\n },\n};\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1, n2, perc)\n{\n var diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out)\n{\n if ( out === void 0 ) out = [];\n\n var n = 20;\n var points = out;\n\n var xa = 0;\n var ya = 0;\n var xb = 0;\n var yb = 0;\n var x = 0;\n var y = 0;\n\n for (var i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildLine(graphicsData, graphicsGeometry)\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData, graphicsGeometry)\n{\n var shape = graphicsData.shape;\n var points = graphicsData.points || shape.points.slice();\n var eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n var style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n var firstPoint = new Point(points[0], points[1]);\n var lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n var midPointX = lastPoint.x + ((firstPoint.x - lastPoint.x) * 0.5);\n var midPointY = lastPoint.y + ((firstPoint.y - lastPoint.y) * 0.5);\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n var verts = graphicsGeometry.points;\n var length = points.length / 2;\n var indexCount = points.length;\n var indexStart = verts.length / 2;\n\n // DRAW the Line\n var width = style.width / 2;\n\n // sort color\n var p1x = points[0];\n var p1y = points[1];\n var p2x = points[2];\n var p2y = points[3];\n var p3x = 0;\n var p3y = 0;\n\n var perpx = -(p1y - p2y);\n var perpy = p1x - p2x;\n var perp2x = 0;\n var perp2y = 0;\n var perp3x = 0;\n var perp3y = 0;\n\n var dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n var ratio = style.alignment;// 0.5;\n var r1 = (1 - ratio) * 2;\n var r2 = ratio * 2;\n\n // start\n verts.push(\n p1x - (perpx * r1),\n p1y - (perpy * r1));\n\n verts.push(\n p1x + (perpx * r2),\n p1y + (perpy * r2));\n\n for (var i = 1; i < length - 1; ++i)\n {\n p1x = points[(i - 1) * 2];\n p1y = points[((i - 1) * 2) + 1];\n\n p2x = points[i * 2];\n p2y = points[(i * 2) + 1];\n\n p3x = points[(i + 1) * 2];\n p3y = points[((i + 1) * 2) + 1];\n\n perpx = -(p1y - p2y);\n perpy = p1x - p2x;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp2x = -(p2y - p3y);\n perp2y = p2x - p3x;\n\n dist = Math.sqrt((perp2x * perp2x) + (perp2y * perp2y));\n perp2x /= dist;\n perp2y /= dist;\n perp2x *= width;\n perp2y *= width;\n\n var a1 = (-perpy + p1y) - (-perpy + p2y);\n var b1 = (-perpx + p2x) - (-perpx + p1x);\n var c1 = ((-perpx + p1x) * (-perpy + p2y)) - ((-perpx + p2x) * (-perpy + p1y));\n var a2 = (-perp2y + p3y) - (-perp2y + p2y);\n var b2 = (-perp2x + p2x) - (-perp2x + p3x);\n var c2 = ((-perp2x + p3x) * (-perp2y + p2y)) - ((-perp2x + p2x) * (-perp2y + p3y));\n\n var denom = (a1 * b2) - (a2 * b1);\n\n if (Math.abs(denom) < 0.1)\n {\n denom += 10.1;\n verts.push(\n p2x - (perpx * r1),\n p2y - (perpy * r1));\n\n verts.push(\n p2x + (perpx * r2),\n p2y + (perpy * r2));\n\n continue;\n }\n\n var px = ((b1 * c2) - (b2 * c1)) / denom;\n var py = ((a2 * c1) - (a1 * c2)) / denom;\n var pdist = ((px - p2x) * (px - p2x)) + ((py - p2y) * (py - p2y));\n\n if (pdist > (196 * width * width))\n {\n perp3x = perpx - perp2x;\n perp3y = perpy - perp2y;\n\n dist = Math.sqrt((perp3x * perp3x) + (perp3y * perp3y));\n perp3x /= dist;\n perp3y /= dist;\n perp3x *= width;\n perp3y *= width;\n\n verts.push(p2x - (perp3x * r1), p2y - (perp3y * r1));\n\n verts.push(p2x + (perp3x * r2), p2y + (perp3y * r2));\n\n verts.push(p2x - (perp3x * r2 * r1), p2y - (perp3y * r1));\n\n indexCount++;\n }\n else\n {\n verts.push(p2x + ((px - p2x) * r1), p2y + ((py - p2y) * r1));\n\n verts.push(p2x - ((px - p2x) * r2), p2y - ((py - p2y) * r2));\n }\n }\n\n p1x = points[(length - 2) * 2];\n p1y = points[((length - 2) * 2) + 1];\n\n p2x = points[(length - 1) * 2];\n p2y = points[((length - 1) * 2) + 1];\n\n perpx = -(p1y - p2y);\n perpy = p1x - p2x;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(p2x - (perpx * r1), p2y - (perpy * r1));\n\n verts.push(p2x + (perpx * r2), p2y + (perpy * r2));\n\n var indices = graphicsGeometry.indices;\n\n // indices.push(indexStart);\n\n for (var i$1 = 0; i$1 < indexCount - 2; ++i$1)\n {\n indices.push(indexStart, indexStart + 1, indexStart + 2);\n\n indexStart++;\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData, graphicsGeometry)\n{\n var i = 0;\n\n var shape = graphicsData.shape;\n var points = graphicsData.points || shape.points;\n var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) { return; }\n\n var verts = graphicsGeometry.points;\n var indices = graphicsGeometry.indices;\n var length = points.length / 2;\n\n var startIndex = verts.length / 2;\n var currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a complex polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n */\nfunction buildComplexPoly(graphicsData, webGLData)\n{\n // TODO - no need to copy this as it gets turned into a Float32Array anyways..\n var points = graphicsData.points.slice();\n\n if (points.length < 6)\n {\n return;\n }\n\n // get first and last point.. figure out the middle!\n var indices = webGLData.indices;\n\n webGLData.points = points;\n webGLData.alpha = graphicsData.fillAlpha;\n webGLData.color = hex2rgb(graphicsData.fillColor);\n\n // calculate the bounds..\n var minX = Infinity;\n var maxX = -Infinity;\n\n var minY = Infinity;\n var maxY = -Infinity;\n\n var x = 0;\n var y = 0;\n\n // get size..\n for (var i = 0; i < points.length; i += 2)\n {\n x = points[i];\n y = points[i + 1];\n\n minX = x < minX ? x : minX;\n maxX = x > maxX ? x : maxX;\n\n minY = y < minY ? y : minY;\n maxY = y > maxY ? y : maxY;\n }\n\n // add a quad to the end cos there is no point making another buffer!\n points.push(minX, minY,\n maxX, minY,\n maxX, maxY,\n minX, maxY);\n\n // push a quad onto the end..\n\n // TODO - this ain't needed!\n var length = points.length / 2;\n\n for (var i$1 = 0; i$1 < length; i$1++)\n {\n indices.push(i$1);\n }\n}\n\n/**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number} n - Number of segments approximating the bezier curve\n * @param {number[]} [path=[]] - Path array to push points into\n * @return {number[]} Array of points of the curve\n */\nfunction bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, path)\n{\n if ( path === void 0 ) path = [];\n\n var dt = 0;\n var dt2 = 0;\n var dt3 = 0;\n var t2 = 0;\n var t3 = 0;\n\n path.push(fromX, fromY);\n\n for (var i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n path.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n\n return path;\n}\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nvar Star = /*@__PURE__*/(function (Polygon) {\n function Star(x, y, points, radius, innerRadius, rotation)\n {\n innerRadius = innerRadius || radius / 2;\n\n var startAngle = (-1 * Math.PI / 2) + rotation;\n var len = points * 2;\n var delta = PI_2 / len;\n var polygon = [];\n\n for (var i = 0; i < len; i++)\n {\n var r = i % 2 ? innerRadius : radius;\n var angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n Polygon.call(this, polygon);\n }\n\n if ( Polygon ) Star.__proto__ = Polygon;\n Star.prototype = Object.create( Polygon && Polygon.prototype );\n Star.prototype.constructor = Star;\n\n return Star;\n}(Polygon));\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nvar ArcUtils = function ArcUtils () {};\n\nArcUtils.curveTo = function curveTo (x1, y1, x2, y2, radius, points)\n{\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n\n var a1 = fromY - y1;\n var b1 = fromX - x1;\n var a2 = y2 - y1;\n var b2 = x2 - x1;\n var mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n var dd = (a1 * a1) + (b1 * b1);\n var cc = (a2 * a2) + (b2 * b2);\n var tt = (a1 * a2) + (b1 * b2);\n var k1 = radius * Math.sqrt(dd) / mm;\n var k2 = radius * Math.sqrt(cc) / mm;\n var j1 = k1 * tt / dd;\n var j2 = k2 * tt / cc;\n var cx = (k1 * b2) + (k2 * b1);\n var cy = (k1 * a2) + (k2 * a1);\n var px = b1 * (k2 + j1);\n var py = a1 * (k2 + j1);\n var qx = b2 * (k1 + j2);\n var qy = a2 * (k1 + j2);\n var startAngle = Math.atan2(py - cy, px - cx);\n var endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius: radius,\n startAngle: startAngle,\n endAngle: endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n};\n\n/**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number} n - Number of segments\n * @param {number[]} points - Collection of points to add to\n */\nArcUtils.arc = function arc (startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points)\n{\n var sweep = endAngle - startAngle;\n var n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n var theta = (sweep) / (n * 2);\n var theta2 = theta * 2;\n var cTheta = Math.cos(theta);\n var sTheta = Math.sin(theta);\n var segMinus = n - 1;\n var remainder = (segMinus % 1) / segMinus;\n\n for (var i = 0; i <= segMinus; ++i)\n {\n var real = i + (remainder * i);\n var angle = ((theta) + startAngle + (theta2 * real));\n var c = Math.cos(angle);\n var s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n};\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nvar BezierUtils = function BezierUtils () {};\n\nBezierUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n{\n var n = 10;\n var result = 0.0;\n var t = 0.0;\n var t2 = 0.0;\n var t3 = 0.0;\n var nt = 0.0;\n var nt2 = 0.0;\n var nt3 = 0.0;\n var x = 0.0;\n var y = 0.0;\n var dx = 0.0;\n var dy = 0.0;\n var prevX = fromX;\n var prevY = fromY;\n\n for (var i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n};\n\n/**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\nBezierUtils.curveTo = function curveTo (cpX, cpY, cpX2, cpY2, toX, toY, points)\n{\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n\n points.length -= 2;\n\n var n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n var dt = 0;\n var dt2 = 0;\n var dt3 = 0;\n var t2 = 0;\n var t3 = 0;\n\n points.push(fromX, fromY);\n\n for (var i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n};\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nvar QuadraticUtils = function QuadraticUtils () {};\n\nQuadraticUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, toX, toY)\n{\n var ax = fromX - (2.0 * cpX) + toX;\n var ay = fromY - (2.0 * cpY) + toY;\n var bx = (2.0 * cpX) - (2.0 * fromX);\n var by = (2.0 * cpY) - (2.0 * fromY);\n var a = 4.0 * ((ax * ax) + (ay * ay));\n var b = 4.0 * ((ax * bx) + (ay * by));\n var c = (bx * bx) + (by * by);\n\n var s = 2.0 * Math.sqrt(a + b + c);\n var a2 = Math.sqrt(a);\n var a32 = 2.0 * a * a2;\n var c2 = 2.0 * Math.sqrt(c);\n var ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n};\n\n/**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\nQuadraticUtils.curveTo = function curveTo (cpX, cpY, toX, toY, points)\n{\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n\n var n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n var xa = 0;\n var ya = 0;\n\n for (var i = 1; i <= n; ++i)\n {\n var j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n};\n\n/**\n * A structure to hold interim batch objects.\n *\n */\nvar BatchPart = function BatchPart()\n{\n this.reset();\n};\n\n/**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\nBatchPart.prototype.begin = function begin (style, startIndex, attribStart)\n{\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n};\n\n/**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\nBatchPart.prototype.end = function end (endIndex, endAttrib)\n{\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n};\n\nBatchPart.prototype.reset = function reset ()\n{\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n};\n\n/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace PIXI.graphicsUtils\n */\n\n/**\n * Map of fill commands for each shape type.\n *\n * @member {Object}\n */\nvar FILL_COMMANDS = {};\nFILL_COMMANDS[SHAPES.POLY] = buildPoly;\nFILL_COMMANDS[SHAPES.CIRC] = buildCircle;\nFILL_COMMANDS[SHAPES.ELIP] = buildCircle;\nFILL_COMMANDS[SHAPES.RECT] = buildRectangle;\nFILL_COMMANDS[SHAPES.RREC] = buildRoundedRectangle;\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @type {Array}\n */\nvar BATCH_POOL = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @type {Array}\n */\nvar DRAW_CALL_POOL = [];\n\nvar index = ({\n buildPoly: buildPoly,\n buildCircle: buildCircle,\n buildRectangle: buildRectangle,\n buildRoundedRectangle: buildRoundedRectangle,\n FILL_COMMANDS: FILL_COMMANDS,\n BATCH_POOL: BATCH_POOL,\n DRAW_CALL_POOL: DRAW_CALL_POOL,\n buildLine: buildLine,\n buildComplexPoly: buildComplexPoly,\n bezierCurveTo: bezierCurveTo,\n Star: Star,\n ArcUtils: ArcUtils,\n BezierUtils: BezierUtils,\n QuadraticUtils: QuadraticUtils,\n BatchPart: BatchPart\n});\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nvar GraphicsData = function GraphicsData(shape, fillStyle, lineStyle, matrix)\n{\n if ( fillStyle === void 0 ) fillStyle = null;\n if ( lineStyle === void 0 ) lineStyle = null;\n if ( matrix === void 0 ) matrix = null;\n\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n};\n\n/**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\nGraphicsData.prototype.clone = function clone ()\n{\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n};\n\n/**\n * Destroys the Graphics data.\n */\nGraphicsData.prototype.destroy = function destroy ()\n{\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n};\n\nvar tmpPoint = new Point();\nvar tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nvar GraphicsGeometry = /*@__PURE__*/(function (BatchGeometry) {\n function GraphicsGeometry()\n {\n BatchGeometry.call(this);\n\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n this.points = [];\n\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n this.colors = [];\n\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n this.uvs = [];\n\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n this.indices = [];\n\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n this.textureIds = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n this.graphicsData = [];\n\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n this.dirty = 0;\n\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n this.batchDirty = -1;\n\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n this.cacheDirty = -1;\n\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n this.clearDirty = 0;\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n this.drawCalls = [];\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {BatchPart[]}\n * @protected\n */\n this.batches = [];\n\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n this.shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n this.boundsDirty = -1;\n\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n this.boundsPadding = 0;\n\n this.batchable = false;\n\n this.indicesUint16 = null;\n\n this.uvsFloat32 = null;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n this.closePointEps = 1e-4;\n }\n\n if ( BatchGeometry ) GraphicsGeometry.__proto__ = BatchGeometry;\n GraphicsGeometry.prototype = Object.create( BatchGeometry && BatchGeometry.prototype );\n GraphicsGeometry.prototype.constructor = GraphicsGeometry;\n\n var prototypeAccessors = { bounds: { configurable: true } };\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n prototypeAccessors.bounds.get = function ()\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n };\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n GraphicsGeometry.prototype.invalidate = function invalidate ()\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (var i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].textures.length = 0;\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (var i$1 = 0; i$1 < this.batches.length; i$1++)\n {\n var batch = this.batches[i$1];\n\n batch.start = 0;\n batch.attribStart = 0;\n batch.style = null;\n BATCH_POOL.push(batch);\n }\n\n this.batches.length = 0;\n };\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n GraphicsGeometry.prototype.clear = function clear ()\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n };\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n GraphicsGeometry.prototype.drawShape = function drawShape (shape, fillStyle, lineStyle, matrix)\n {\n var data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n };\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n GraphicsGeometry.prototype.drawHole = function drawHole (shape, matrix)\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n var data = new GraphicsData(shape, null, null, matrix);\n\n var lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n };\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n GraphicsGeometry.prototype.destroy = function destroy (options)\n {\n BatchGeometry.prototype.destroy.call(this, options);\n\n // destroy each of the GraphicsData objects\n for (var i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n };\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.Point} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n GraphicsGeometry.prototype.containsPoint = function containsPoint (point)\n {\n var graphicsData = this.graphicsData;\n\n for (var i = 0; i < graphicsData.length; ++i)\n {\n var data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n var hitHole = false;\n\n if (data.holes)\n {\n for (var i$1 = 0; i$1 < data.holes.length; i$1++)\n {\n var hole = data.holes[i$1];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n };\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n */\n GraphicsGeometry.prototype.updateBatches = function updateBatches ()\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n var uvs = this.uvs;\n var graphicsData = this.graphicsData;\n\n var batchPart = null;\n\n var currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (var i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n var data = graphicsData[i];\n var fillStyle = data.fillStyle;\n var lineStyle = data.lineStyle;\n var command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (var j = 0; j < 2; j++)\n {\n var style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) { continue; }\n\n var nextTexture = style.texture.baseTexture;\n var index$1 = this.indices.length;\n var attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index$1, attribIndex);\n\n if (batchPart.size > 0)\n {\n batchPart = null;\n }\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index$1, attribIndex);\n this.batches.push(batchPart);\n\n currentStyle = style;\n }\n\n var start = this.points.length / 2;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n var size = (this.points.length / 2) - start;\n\n this.addUvs(this.points, uvs, style.texture, start, size, style.matrix);\n }\n }\n\n if (!batchPart)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n var index = this.indices.length;\n var attrib = this.points.length / 2;\n\n batchPart.end(index, attrib);\n\n this.indicesUint16 = new Uint16Array(this.indices);\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n };\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n GraphicsGeometry.prototype._compareStyles = function _compareStyles (styleA, styleB)\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!styleA.native !== !!styleB.native)\n {\n return false;\n }\n\n return true;\n };\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n GraphicsGeometry.prototype.validateBatching = function validateBatching ()\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (var i = 0, l = this.graphicsData.length; i < l; i++)\n {\n var data = this.graphicsData[i];\n var fill = data.fillStyle;\n var line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) { return false; }\n if (line && !line.texture.baseTexture.valid) { return false; }\n }\n\n return true;\n };\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n GraphicsGeometry.prototype.packBatches = function packBatches ()\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n var batches = this.batches;\n\n for (var i = 0, l = batches.length; i < l; i++)\n {\n var batch = batches[i];\n\n for (var j = 0; j < batch.size; j++)\n {\n var index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n };\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n GraphicsGeometry.prototype.isBatchable = function isBatchable ()\n {\n var batches = this.batches;\n\n for (var i = 0; i < batches.length; i++)\n {\n if (batches[i].style.native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n };\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n GraphicsGeometry.prototype.buildDrawCalls = function buildDrawCalls ()\n {\n var TICK = ++BaseTexture._globalBatch;\n\n for (var i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].textures.length = 0;\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n var colors = this.colors;\n var textureIds = this.textureIds;\n\n var currentGroup = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.textures = new BatchTextureArray();\n }\n currentGroup.textures.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n var textureCount = 0;\n var currentTexture = null;\n var textureId = 0;\n var native = false;\n var drawMode = DRAW_MODES.TRIANGLES;\n\n var index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (var i$1 = 0; i$1 < this.batches.length; i$1++)\n {\n var data = this.batches[i$1];\n\n // TODO add some full on MAX_TEXTURE CODE..\n var MAX_TEXTURES = 8;\n\n var style = data.style;\n\n var nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.textures = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.textures.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n nextTexture.touched = 1;// touch;\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n\n currentGroup.textures.elements[currentGroup.textures.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize);\n this.addTextureIds(textureIds, textureId, data.attribSize);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n };\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n GraphicsGeometry.prototype.packAttributes = function packAttributes ()\n {\n var verts = this.points;\n var uvs = this.uvs;\n var colors = this.colors;\n var textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n var glPoints = new ArrayBuffer(verts.length * 3 * 4);\n var f32 = new Float32Array(glPoints);\n var u32 = new Uint32Array(glPoints);\n\n var p = 0;\n\n for (var i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n };\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n GraphicsGeometry.prototype.processFill = function processFill (data)\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n var command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n };\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n GraphicsGeometry.prototype.processLine = function processLine (data)\n {\n buildLine(data, this);\n\n for (var i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n };\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n GraphicsGeometry.prototype.processHoles = function processHoles (holes)\n {\n for (var i = 0; i < holes.length; i++)\n {\n var hole = holes[i];\n var command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n };\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n GraphicsGeometry.prototype.calculateBounds = function calculateBounds ()\n {\n var bounds = this._bounds;\n var sequenceBounds = tmpBounds;\n var curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (var i = 0; i < this.graphicsData.length; i++)\n {\n var data = this.graphicsData[i];\n var shape = data.shape;\n var type = data.type;\n var lineStyle = data.lineStyle;\n var nextMatrix = data.matrix || Matrix.IDENTITY;\n var lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n var alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n sequenceBounds.addFramePad(shape.x, shape.y, shape.x + shape.width, shape.y + shape.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n sequenceBounds.addFramePad(shape.x, shape.y, shape.x, shape.y,\n shape.radius + lineWidth, shape.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n sequenceBounds.addFramePad(shape.x, shape.y, shape.x, shape.y,\n shape.width + lineWidth, shape.height + lineWidth);\n }\n else\n {\n // adding directly to the bounds\n bounds.addVerticesMatrix(curMatrix, shape.points, 0, shape.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n };\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n GraphicsGeometry.prototype.transformPoints = function transformPoints (points, matrix)\n {\n for (var i = 0; i < points.length / 2; i++)\n {\n var x = points[(i * 2)];\n var y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n };\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n */\n GraphicsGeometry.prototype.addColors = function addColors (colors, color, alpha, size)\n {\n // TODO use the premultiply bits Ivan added\n var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n var rgba = premultiplyTint(rgb, alpha);\n\n while (size-- > 0)\n {\n colors.push(rgba);\n }\n };\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n */\n GraphicsGeometry.prototype.addTextureIds = function addTextureIds (textureIds, id, size)\n {\n while (size-- > 0)\n {\n textureIds.push(id);\n }\n };\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n GraphicsGeometry.prototype.addUvs = function addUvs (verts, uvs, texture, start, size, matrix)\n {\n var index = 0;\n var uvsStart = uvs.length;\n var frame = texture.frame;\n\n while (index < size)\n {\n var x = verts[(start + index) * 2];\n var y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n var baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n };\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs array\n * @param {PIXI.Texture} texture region\n * @param {number} start starting index for uvs\n * @param {number} size how many points to adjust\n */\n GraphicsGeometry.prototype.adjustUvs = function adjustUvs (uvs, texture, start, size)\n {\n var baseTexture = texture.baseTexture;\n var eps = 1e-6;\n var finish = start + (size * 2);\n var frame = texture.frame;\n var scaleX = frame.width / baseTexture.width;\n var scaleY = frame.height / baseTexture.height;\n var offsetX = frame.x / frame.width;\n var offsetY = frame.y / frame.height;\n var minX = Math.floor(uvs[start] + eps);\n var minY = Math.floor(uvs[start + 1] + eps);\n\n for (var i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (var i$1 = start; i$1 < finish; i$1 += 2)\n {\n uvs[i$1] = (uvs[i$1] + offsetX) * scaleX;\n uvs[i$1 + 1] = (uvs[i$1 + 1] + offsetY) * scaleY;\n }\n };\n\n Object.defineProperties( GraphicsGeometry.prototype, prototypeAccessors );\n\n return GraphicsGeometry;\n}(BatchGeometry));\n\n/**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\nGraphicsGeometry.BATCHABLE_SIZE = 100;\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nvar LineStyle = /*@__PURE__*/(function (FillStyle) {\n function LineStyle () {\n FillStyle.apply(this, arguments);\n }\n\n if ( FillStyle ) LineStyle.__proto__ = FillStyle;\n LineStyle.prototype = Object.create( FillStyle && FillStyle.prototype );\n LineStyle.prototype.constructor = LineStyle;\n\n LineStyle.prototype.clone = function clone ()\n {\n var obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n\n return obj;\n };\n /**\n * Reset the line style to default.\n */\n LineStyle.prototype.reset = function reset ()\n {\n FillStyle.prototype.reset.call(this);\n\n // Override default line style color\n this.color = 0x0;\n\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n this.width = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner).\n *\n * @member {number}\n * @default 0\n */\n this.alignment = 0.5;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n this.native = false;\n };\n\n return LineStyle;\n}(FillStyle));\n\nvar temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nvar DEFAULT_SHADERS = {};\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Graphics = /*@__PURE__*/(function (Container) {\n function Graphics(geometry)\n {\n if ( geometry === void 0 ) geometry = null;\n\n Container.call(this);\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n this.geometry = geometry || new GraphicsGeometry();\n\n this.geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = State.for2d();\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n this._fillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n this._lineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n this._matrix = null;\n\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n this._holeMode = false;\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n this.currentPath = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n this.batches = [];\n\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchTint = -1;\n\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n this.vertexData = null;\n\n this._transformID = -1;\n this.batchDirty = -1;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n if ( Container ) Graphics.__proto__ = Container;\n Graphics.prototype = Object.create( Container && Container.prototype );\n Graphics.prototype.constructor = Graphics;\n\n var prototypeAccessors = { blendMode: { configurable: true },tint: { configurable: true },fill: { configurable: true },line: { configurable: true } };\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that the only the properties of the object are cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n Graphics.prototype.clone = function clone ()\n {\n this.finishPoly();\n\n return new Graphics(this.geometry);\n };\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n prototypeAccessors.blendMode.set = function (value)\n {\n this.state.blendMode = value;\n };\n\n prototypeAccessors.blendMode.get = function ()\n {\n return this.state.blendMode;\n };\n\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n prototypeAccessors.tint.get = function ()\n {\n return this._tint;\n };\n prototypeAccessors.tint.set = function (value)\n {\n this._tint = value;\n };\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n prototypeAccessors.fill.get = function ()\n {\n return this._fillStyle;\n };\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n prototypeAccessors.line.get = function ()\n {\n return this._lineStyle;\n };\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineStyle = function lineStyle (options)\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n var args = arguments;\n\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n\n return this.lineTextureStyle(options);\n };\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineTextureStyle = function lineTextureStyle (options)\n {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number')\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n\n var width = arguments[0];\n var texture = arguments[1];\n var color = arguments[2];\n var alpha = arguments[3];\n var matrix = arguments[4];\n var alignment = arguments[5];\n var native = arguments[6];\n\n options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native };\n\n // Remove undefined keys\n Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; });\n }\n\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n var visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible: visible }, options);\n }\n\n return this;\n };\n\n /**\n * Start a polygon object internally\n * @protected\n */\n Graphics.prototype.startPoly = function startPoly ()\n {\n if (this.currentPath)\n {\n var points = this.currentPath.points;\n var len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n };\n\n /**\n * Finish the polygon object.\n * @protected\n */\n Graphics.prototype.finishPoly = function finishPoly ()\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n };\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.moveTo = function moveTo (x, y)\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n };\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.lineTo = function lineTo (x, y)\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n var points = this.currentPath.points;\n var fromX = points[points.length - 2];\n var fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n };\n\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n Graphics.prototype._initCurve = function _initCurve (x, y)\n {\n if ( x === void 0 ) x = 0;\n if ( y === void 0 ) y = 0;\n\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n };\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.quadraticCurveTo = function quadraticCurveTo (cpX, cpY, toX, toY)\n {\n this._initCurve();\n\n var points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n };\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.bezierCurveTo = function bezierCurveTo (cpX, cpY, cpX2, cpY2, toX, toY)\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n };\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius)\n {\n this._initCurve(x1, y1);\n\n var points = this.currentPath.points;\n\n var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n var cx = result.cx;\n var cy = result.cy;\n var radius$1 = result.radius;\n var startAngle = result.startAngle;\n var endAngle = result.endAngle;\n var anticlockwise = result.anticlockwise;\n\n this.arc(cx, cy, radius$1, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n };\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.arc = function arc (cx, cy, radius, startAngle, endAngle, anticlockwise)\n {\n if ( anticlockwise === void 0 ) anticlockwise = false;\n\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n var sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n var startX = cx + (Math.cos(startAngle) * radius);\n var startY = cy + (Math.sin(startAngle) * radius);\n var eps = this.geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n var points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n var xDiff = Math.abs(points[points.length - 2] - startX);\n var yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n ;\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n };\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.beginFill = function beginFill (color, alpha)\n {\n if ( color === void 0 ) color = 0;\n if ( alpha === void 0 ) alpha = 1;\n\n return this.beginTextureFill({ texture: Texture.WHITE, color: color, alpha: alpha });\n };\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.beginTextureFill = function beginTextureFill (options)\n {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof Texture)\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n\n var texture = arguments[0];\n var color = arguments[1];\n var alpha = arguments[2];\n var matrix = arguments[3];\n\n options = { texture: texture, color: color, alpha: alpha, matrix: matrix };\n\n // Remove undefined keys\n Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; });\n }\n\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n var visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible: visible }, options);\n }\n\n return this;\n };\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.endFill = function endFill ()\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n };\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawRect = function drawRect (x, y, width, height)\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n };\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawRoundedRect = function drawRoundedRect (x, y, width, height, radius)\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n };\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawCircle = function drawCircle (x, y, radius)\n {\n return this.drawShape(new Circle(x, y, radius));\n };\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawEllipse = function drawEllipse (x, y, width, height)\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n };\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawPolygon = function drawPolygon (path)\n {\n var arguments$1 = arguments;\n\n // prevents an argument assignment deopt\n // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments\n var points = path;\n\n var closeStroke = true;// !!this._fillStyle;\n\n // check if data has points..\n if (points.points)\n {\n closeStroke = points.closeStroke;\n points = points.points;\n }\n\n if (!Array.isArray(points))\n {\n // prevents an argument leak deopt\n // see section 3.2: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments\n points = new Array(arguments.length);\n\n for (var i = 0; i < points.length; ++i)\n {\n points[i] = arguments$1[i]; // eslint-disable-line prefer-rest-params\n }\n }\n\n var shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n };\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawShape = function drawShape (shape)\n {\n if (!this._holeMode)\n {\n this.geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this.geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n };\n\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.drawStar = function drawStar (x, y, points, radius, innerRadius, rotation)\n {\n if ( rotation === void 0 ) rotation = 0;\n\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation));\n };\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n Graphics.prototype.clear = function clear ()\n {\n this.geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n };\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n Graphics.prototype.isFastRect = function isFastRect ()\n {\n return this.geometry.graphicsData.length === 1\n && this.geometry.graphicsData[0].shape.type === SHAPES.RECT\n && !this.geometry.graphicsData[0].lineWidth;\n };\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._render = function _render (renderer)\n {\n this.finishPoly();\n\n var geometry = this.geometry;\n\n // batch part..\n // batch it!\n geometry.updateBatches();\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n };\n\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n Graphics.prototype._populateBatches = function _populateBatches ()\n {\n var geometry = this.geometry;\n var blendMode = this.blendMode;\n\n this.batches = [];\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (var i = 0, l = geometry.batches.length; i < l; i++)\n {\n var gI = geometry.batches[i];\n var color = gI.style.color;\n var vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n var uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n var indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n var batch = {\n vertexData: vertexData,\n blendMode: blendMode,\n indices: indices,\n uvs: uvs,\n _batchRGB: hex2rgb(color),\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n };\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._renderBatched = function _renderBatched (renderer)\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (var i = 0, l = this.batches.length; i < l; i++)\n {\n var batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n };\n\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._renderDirect = function _renderDirect (renderer)\n {\n var shader = this._resolveDirectShader(renderer);\n\n var geometry = this.geometry;\n var tint = this.tint;\n var worldAlpha = this.worldAlpha;\n var uniforms = shader.uniforms;\n var drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (var i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n };\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n Graphics.prototype._renderDrawCallDirect = function _renderDrawCallDirect (renderer, drawCall)\n {\n var textures = drawCall.textures;\n var type = drawCall.type;\n var size = drawCall.size;\n var start = drawCall.start;\n var groupTextureCount = textures.count;\n\n for (var j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(textures.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n };\n\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Graphics.prototype._resolveDirectShader = function _resolveDirectShader (renderer)\n {\n var shader = this.shader;\n\n var pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n var sampleValues = new Int32Array(16);\n\n for (var i = 0; i < 16; i++)\n {\n sampleValues[i] = i;\n }\n\n var uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n var program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n };\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n Graphics.prototype._calculateBounds = function _calculateBounds ()\n {\n this.finishPoly();\n\n var geometry = this.geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n var ref = geometry.bounds;\n var minX = ref.minX;\n var minY = ref.minY;\n var maxX = ref.maxX;\n var maxY = ref.maxY;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n };\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.Point} point - the point to test\n * @return {boolean} the result of the test\n */\n Graphics.prototype.containsPoint = function containsPoint (point)\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this.geometry.containsPoint(Graphics._TEMP_POINT);\n };\n\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n Graphics.prototype.calculateTints = function calculateTints ()\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n var tintRGB = hex2rgb(this.tint, temp);\n\n for (var i = 0; i < this.batches.length; i++)\n {\n var batch = this.batches[i];\n\n var batchTint = batch._batchRGB;\n\n var r = (tintRGB[0] * batchTint[0]) * 255;\n var g = (tintRGB[1] * batchTint[1]) * 255;\n var b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n var color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n };\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n Graphics.prototype.calculateVertices = function calculateVertices ()\n {\n if (this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n\n var data = this.geometry.points;// batch.vertexDataOriginal;\n var vertexData = this.vertexData;\n\n var count = 0;\n\n for (var i = 0; i < data.length; i += 2)\n {\n var x = data[i];\n var y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n };\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.closePath = function closePath ()\n {\n var currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n\n return this;\n };\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.setMatrix = function setMatrix (matrix)\n {\n this._matrix = matrix;\n\n return this;\n };\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.beginHole = function beginHole ()\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n };\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n Graphics.prototype.endHole = function endHole ()\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n };\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n Graphics.prototype.destroy = function destroy (options)\n {\n Container.prototype.destroy.call(this, options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this.geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n Container.prototype.destroy.call(this, options);\n };\n\n Object.defineProperties( Graphics.prototype, prototypeAccessors );\n\n return Graphics;\n}(Container));\n\n/**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\nGraphics._TEMP_POINT = new Point();\n\nexport { FillStyle, GRAPHICS_CURVES, Graphics, GraphicsData, GraphicsGeometry, LineStyle, index as graphicsUtils };\n//# sourceMappingURL=graphics.es.js.map\n","/*!\n * @pixi/sprite - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/sprite is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Point, Rectangle, ObservablePoint } from '@pixi/math';\nimport { sign } from '@pixi/utils';\nimport { Texture } from '@pixi/core';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\n\nvar tempPoint = new Point();\nvar indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Sprite = /*@__PURE__*/(function (Container) {\n function Sprite(texture)\n {\n Container.call(this);\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @private\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @private\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n this._tintRGB = null;\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * The shader that will be used to render the sprite. Set to null to remove a current shader.\n *\n * @member {PIXI.Filter|PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n this.size = 4;\n this.start = 0;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n if ( Container ) Sprite.__proto__ = Container;\n Sprite.prototype = Object.create( Container && Container.prototype );\n Sprite.prototype.constructor = Sprite;\n\n var prototypeAccessors = { roundPixels: { configurable: true },width: { configurable: true },height: { configurable: true },anchor: { configurable: true },tint: { configurable: true },texture: { configurable: true } };\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @private\n */\n Sprite.prototype._onTextureUpdate = function _onTextureUpdate ()\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n };\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n Sprite.prototype._onAnchorUpdate = function _onAnchorUpdate ()\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n };\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n Sprite.prototype.calculateVertices = function calculateVertices ()\n {\n var texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n var vertexData = this.vertexData;\n var trim = texture.trim;\n var orig = texture.orig;\n var anchor = this._anchor;\n\n var w0 = 0;\n var w1 = 0;\n var h0 = 0;\n var h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n for (var i = 0; i < 8; i++)\n {\n vertexData[i] = Math.round(vertexData[i]);\n }\n }\n };\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n Sprite.prototype.calculateTrimmedVertices = function calculateTrimmedVertices ()\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n var texture = this._texture;\n var vertexData = this.vertexTrimmedData;\n var orig = texture.orig;\n var anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n\n var w1 = -anchor._x * orig.width;\n var w0 = w1 + orig.width;\n\n var h1 = -anchor._y * orig.height;\n var h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n };\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n Sprite.prototype._render = function _render (renderer)\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n };\n\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n Sprite.prototype._calculateBounds = function _calculateBounds ()\n {\n var trim = this._texture.trim;\n var orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n };\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n Sprite.prototype.getLocalBounds = function getLocalBounds (rect)\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return Container.prototype.getLocalBounds.call(this, rect);\n };\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.Point} point - the point to test\n * @return {boolean} the result of the test\n */\n Sprite.prototype.containsPoint = function containsPoint (point)\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n var width = this._texture.orig.width;\n var height = this._texture.orig.height;\n var x1 = -width * this.anchor.x;\n var y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n };\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n Sprite.prototype.destroy = function destroy (options)\n {\n Container.prototype.destroy.call(this, options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n var destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n this.shader = null;\n };\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n Sprite.from = function from (source, options)\n {\n var texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n };\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n prototypeAccessors.roundPixels.set = function (value)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n };\n\n prototypeAccessors.roundPixels.get = function ()\n {\n return this._roundPixels;\n };\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n };\n\n prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc\n {\n var s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n };\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n };\n\n prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc\n {\n var s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n };\n\n /**\n * The anchor sets the origin point of the text. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n prototypeAccessors.anchor.get = function ()\n {\n return this._anchor;\n };\n\n prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._anchor.copyFrom(value);\n };\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n prototypeAccessors.tint.get = function ()\n {\n return this._tint;\n };\n\n prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n };\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n prototypeAccessors.texture.get = function ()\n {\n return this._texture;\n };\n\n prototypeAccessors.texture.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n };\n\n Object.defineProperties( Sprite.prototype, prototypeAccessors );\n\n return Sprite;\n}(Container));\n\nexport { Sprite };\n//# sourceMappingURL=sprite.es.js.map\n","/*!\n * @pixi/text - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/text is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Sprite } from '@pixi/sprite';\nimport { Texture } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { Rectangle } from '@pixi/math';\nimport { hex2string, hex2rgb, string2hex, trimCanvas, sign } from '@pixi/utils';\n\n/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nvar TEXT_GRADIENT = {\n LINEAR_VERTICAL: 0,\n LINEAR_HORIZONTAL: 1,\n};\n\n// disabling eslint for now, going to rewrite this in v5\n\nvar defaultStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nvar genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui' ];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nvar TextStyle = function TextStyle(style)\n{\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n};\n\nvar prototypeAccessors = { 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 } };\n\n/**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\nTextStyle.prototype.clone = function clone ()\n{\n var clonedProperties = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n};\n\n/**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\nTextStyle.prototype.reset = function reset ()\n{\n deepCopyProperties(this, defaultStyle, defaultStyle);\n};\n\n/**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\nprototypeAccessors.align.get = function ()\n{\n return this._align;\n};\nprototypeAccessors.align.set = function (align) // eslint-disable-line require-jsdoc\n{\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n};\n\n/**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\nprototypeAccessors.breakWords.get = function ()\n{\n return this._breakWords;\n};\nprototypeAccessors.breakWords.set = function (breakWords) // eslint-disable-line require-jsdoc\n{\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n};\n\n/**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\nprototypeAccessors.dropShadow.get = function ()\n{\n return this._dropShadow;\n};\nprototypeAccessors.dropShadow.set = function (dropShadow) // eslint-disable-line require-jsdoc\n{\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n};\n\n/**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\nprototypeAccessors.dropShadowAlpha.get = function ()\n{\n return this._dropShadowAlpha;\n};\nprototypeAccessors.dropShadowAlpha.set = function (dropShadowAlpha) // eslint-disable-line require-jsdoc\n{\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n};\n\n/**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\nprototypeAccessors.dropShadowAngle.get = function ()\n{\n return this._dropShadowAngle;\n};\nprototypeAccessors.dropShadowAngle.set = function (dropShadowAngle) // eslint-disable-line require-jsdoc\n{\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n};\n\n/**\n * Set a shadow blur radius\n *\n * @member {number}\n */\nprototypeAccessors.dropShadowBlur.get = function ()\n{\n return this._dropShadowBlur;\n};\nprototypeAccessors.dropShadowBlur.set = function (dropShadowBlur) // eslint-disable-line require-jsdoc\n{\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n};\n\n/**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\nprototypeAccessors.dropShadowColor.get = function ()\n{\n return this._dropShadowColor;\n};\nprototypeAccessors.dropShadowColor.set = function (dropShadowColor) // eslint-disable-line require-jsdoc\n{\n var outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n};\n\n/**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\nprototypeAccessors.dropShadowDistance.get = function ()\n{\n return this._dropShadowDistance;\n};\nprototypeAccessors.dropShadowDistance.set = function (dropShadowDistance) // eslint-disable-line require-jsdoc\n{\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n};\n\n/**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\nprototypeAccessors.fill.get = function ()\n{\n return this._fill;\n};\nprototypeAccessors.fill.set = function (fill) // eslint-disable-line require-jsdoc\n{\n var outputColor = getColor(fill);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n};\n\n/**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\nprototypeAccessors.fillGradientType.get = function ()\n{\n return this._fillGradientType;\n};\nprototypeAccessors.fillGradientType.set = function (fillGradientType) // eslint-disable-line require-jsdoc\n{\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n};\n\n/**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\nprototypeAccessors.fillGradientStops.get = function ()\n{\n return this._fillGradientStops;\n};\nprototypeAccessors.fillGradientStops.set = function (fillGradientStops) // eslint-disable-line require-jsdoc\n{\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n};\n\n/**\n * The font family\n *\n * @member {string|string[]}\n */\nprototypeAccessors.fontFamily.get = function ()\n{\n return this._fontFamily;\n};\nprototypeAccessors.fontFamily.set = function (fontFamily) // eslint-disable-line require-jsdoc\n{\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n};\n\n/**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\nprototypeAccessors.fontSize.get = function ()\n{\n return this._fontSize;\n};\nprototypeAccessors.fontSize.set = function (fontSize) // eslint-disable-line require-jsdoc\n{\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n};\n\n/**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\nprototypeAccessors.fontStyle.get = function ()\n{\n return this._fontStyle;\n};\nprototypeAccessors.fontStyle.set = function (fontStyle) // eslint-disable-line require-jsdoc\n{\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n};\n\n/**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\nprototypeAccessors.fontVariant.get = function ()\n{\n return this._fontVariant;\n};\nprototypeAccessors.fontVariant.set = function (fontVariant) // eslint-disable-line require-jsdoc\n{\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n};\n\n/**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\nprototypeAccessors.fontWeight.get = function ()\n{\n return this._fontWeight;\n};\nprototypeAccessors.fontWeight.set = function (fontWeight) // eslint-disable-line require-jsdoc\n{\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n};\n\n/**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\nprototypeAccessors.letterSpacing.get = function ()\n{\n return this._letterSpacing;\n};\nprototypeAccessors.letterSpacing.set = function (letterSpacing) // eslint-disable-line require-jsdoc\n{\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n};\n\n/**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\nprototypeAccessors.lineHeight.get = function ()\n{\n return this._lineHeight;\n};\nprototypeAccessors.lineHeight.set = function (lineHeight) // eslint-disable-line require-jsdoc\n{\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n};\n\n/**\n * The space between lines\n *\n * @member {number}\n */\nprototypeAccessors.leading.get = function ()\n{\n return this._leading;\n};\nprototypeAccessors.leading.set = function (leading) // eslint-disable-line require-jsdoc\n{\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n};\n\n/**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\nprototypeAccessors.lineJoin.get = function ()\n{\n return this._lineJoin;\n};\nprototypeAccessors.lineJoin.set = function (lineJoin) // eslint-disable-line require-jsdoc\n{\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n};\n\n/**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\nprototypeAccessors.miterLimit.get = function ()\n{\n return this._miterLimit;\n};\nprototypeAccessors.miterLimit.set = function (miterLimit) // eslint-disable-line require-jsdoc\n{\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n};\n\n/**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\nprototypeAccessors.padding.get = function ()\n{\n return this._padding;\n};\nprototypeAccessors.padding.set = function (padding) // eslint-disable-line require-jsdoc\n{\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n};\n\n/**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\nprototypeAccessors.stroke.get = function ()\n{\n return this._stroke;\n};\nprototypeAccessors.stroke.set = function (stroke) // eslint-disable-line require-jsdoc\n{\n var outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n};\n\n/**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\nprototypeAccessors.strokeThickness.get = function ()\n{\n return this._strokeThickness;\n};\nprototypeAccessors.strokeThickness.set = function (strokeThickness) // eslint-disable-line require-jsdoc\n{\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n};\n\n/**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\nprototypeAccessors.textBaseline.get = function ()\n{\n return this._textBaseline;\n};\nprototypeAccessors.textBaseline.set = function (textBaseline) // eslint-disable-line require-jsdoc\n{\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n};\n\n/**\n * Trim transparent borders\n *\n * @member {boolean}\n */\nprototypeAccessors.trim.get = function ()\n{\n return this._trim;\n};\nprototypeAccessors.trim.set = function (trim) // eslint-disable-line require-jsdoc\n{\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n};\n\n/**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\nprototypeAccessors.whiteSpace.get = function ()\n{\n return this._whiteSpace;\n};\nprototypeAccessors.whiteSpace.set = function (whiteSpace) // eslint-disable-line require-jsdoc\n{\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n};\n\n/**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\nprototypeAccessors.wordWrap.get = function ()\n{\n return this._wordWrap;\n};\nprototypeAccessors.wordWrap.set = function (wordWrap) // eslint-disable-line require-jsdoc\n{\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n};\n\n/**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\nprototypeAccessors.wordWrapWidth.get = function ()\n{\n return this._wordWrapWidth;\n};\nprototypeAccessors.wordWrapWidth.set = function (wordWrapWidth) // eslint-disable-line require-jsdoc\n{\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n};\n\n/**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\nTextStyle.prototype.toFontString = function toFontString ()\n{\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n var fontSizeString = (typeof this.fontSize === 'number') ? ((this.fontSize) + \"px\") : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n var fontFamilies = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (var i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n var fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = \"\\\"\" + fontFamily + \"\\\"\";\n }\n fontFamilies[i] = fontFamily;\n }\n\n return ((this.fontStyle) + \" \" + (this.fontVariant) + \" \" + (this.fontWeight) + \" \" + fontSizeString + \" \" + (fontFamilies.join(',')));\n};\n\nObject.defineProperties( TextStyle.prototype, prototypeAccessors );\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color)\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if ( typeof color === 'string' )\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color)\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (var i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 First array to compare\n * @param {Array} array2 Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1, array2)\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (var i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target Target object to copy properties into\n * @param {Object} source Source object for the properties to copy\n * @param {string} propertyObj Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target, source, propertyObj) {\n for (var prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nvar TextMetrics = function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties)\n{\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n};\n\n/**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\nTextMetrics.measureText = function measureText (text, style, wordWrap, canvas)\n{\n if ( canvas === void 0 ) canvas = TextMetrics._canvas;\n\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n var font = style.toFontString();\n var fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize;\n fontProperties.ascent = style.fontSize;\n }\n\n var context = canvas.getContext('2d');\n\n context.font = font;\n\n var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n var lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n var lineWidths = new Array(lines.length);\n var maxLineWidth = 0;\n\n for (var i = 0; i < lines.length; i++)\n {\n var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n var width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n};\n\n/**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\nTextMetrics.wordWrap = function wordWrap (text, style, canvas)\n{\n if ( canvas === void 0 ) canvas = TextMetrics._canvas;\n\n var context = canvas.getContext('2d');\n\n var width = 0;\n var line = '';\n var lines = '';\n\n var cache = {};\n var letterSpacing = style.letterSpacing;\n var whiteSpace = style.whiteSpace;\n\n // How to handle whitespaces\n var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n var canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n var wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n var tokens = TextMetrics.tokenize(text);\n\n for (var i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n var token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n var currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n var characters = token.split('');\n\n // loop the characters\n for (var j = 0; j < characters.length; j++)\n {\n var char = characters[j];\n\n var k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n var nextChar = characters[j + k];\n var lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n var isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n};\n\n/**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\nTextMetrics.addLine = function addLine (line, newLine)\n{\n if ( newLine === void 0 ) newLine = true;\n\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? (line + \"\\n\") : line;\n\n return line;\n};\n\n/**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key The key\n * @param {number} letterSpacing The letter spacing\n * @param {object} cache The cache\n * @param {CanvasRenderingContext2D} context The canvas context\n * @return {number} The from cache.\n */\nTextMetrics.getFromCache = function getFromCache (key, letterSpacing, cache, context)\n{\n var width = cache[key];\n\n if (width === undefined)\n {\n var spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n};\n\n/**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\nTextMetrics.collapseSpaces = function collapseSpaces (whiteSpace)\n{\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n};\n\n/**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace The white space\n * @return {boolean} should collapse\n */\nTextMetrics.collapseNewlines = function collapseNewlines (whiteSpace)\n{\n return (whiteSpace === 'normal');\n};\n\n/**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text The text\n * @return {string} trimmed string\n */\nTextMetrics.trimRight = function trimRight (text)\n{\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (var i = text.length - 1; i >= 0; i--)\n {\n var char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n};\n\n/**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char The character\n * @return {boolean} True if newline, False otherwise.\n */\nTextMetrics.isNewline = function isNewline (char)\n{\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n};\n\n/**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char The character\n * @return {boolean} True if whitespace, False otherwise.\n */\nTextMetrics.isBreakingSpace = function isBreakingSpace (char)\n{\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n};\n\n/**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text The text\n * @return {string[]} A tokenized array\n */\nTextMetrics.tokenize = function tokenize (text)\n{\n var tokens = [];\n var token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (var i = 0; i < text.length; i++)\n {\n var char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n};\n\n/**\n * This method exists to be easily overridden\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @private\n * @param {string} token The token\n * @param {boolean} breakWords The style attr break words\n * @return {boolean} whether to break word or not\n */\nTextMetrics.canBreakWords = function canBreakWords (token, breakWords)\n{\n return breakWords;\n};\n\n/**\n * This method exists to be easily overridden\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @private\n * @param {string} char The character\n * @param {string} nextChar The next character\n * @param {string} token The token/word the characters are from\n * @param {number} index The index in the token of the char\n * @param {boolean} breakWords The style attr break words\n * @return {boolean} whether to break word or not\n */\nTextMetrics.canBreakChars = function canBreakChars (char, nextChar, token, index, breakWords) // eslint-disable-line no-unused-vars\n{\n return true;\n};\n\n/**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\nTextMetrics.measureFont = function measureFont (font)\n{\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n var properties = {};\n\n var canvas = TextMetrics._canvas;\n var context = TextMetrics._context;\n\n context.font = font;\n\n var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n var width = Math.ceil(context.measureText(metricsString).width);\n var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n var height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n var imagedata = context.getImageData(0, 0, width, height).data;\n var pixels = imagedata.length;\n var line = width * 4;\n\n var i = 0;\n var idx = 0;\n var stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (var j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (var j$1 = 0; j$1 < line; j$1 += 4)\n {\n if (imagedata[idx + j$1] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n};\n\n/**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\nTextMetrics.clearMetrics = function clearMetrics (font)\n{\n if ( font === void 0 ) font = '';\n\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n};\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nvar canvas = (function () {\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n var c = new OffscreenCanvas(0, 0);\n\n return c.getContext('2d') ? c : document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D ];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000 ];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n\n/* eslint max-depth: [2, 8] */\n\nvar defaultDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar Text = /*@__PURE__*/(function (Sprite) {\n function Text(text, style, canvas)\n {\n canvas = canvas || document.createElement('canvas');\n\n canvas.width = 3;\n canvas.height = 3;\n\n var texture = Texture.from(canvas);\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n Sprite.call(this, texture);\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n this._resolution = settings.RESOLUTION;\n this._autoResolution = true;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n if ( Sprite ) Text.__proto__ = Sprite;\n Text.prototype = Object.create( Sprite && Sprite.prototype );\n Text.prototype.constructor = Text;\n\n var prototypeAccessors = { width: { configurable: true },height: { configurable: true },style: { configurable: true },text: { configurable: true },resolution: { configurable: true } };\n\n /**\n * Renders text and updates it when needed.\n *\n * @private\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n Text.prototype.updateText = function updateText (respectDirty)\n {\n var style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n var context = this.context;\n var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n var width = measured.width;\n var height = measured.height;\n var lines = measured.lines;\n var lineHeight = measured.lineHeight;\n var lineWidths = measured.lineWidths;\n var maxLineWidth = measured.maxLineWidth;\n var fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n\n context.scale(this._resolution, this._resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n var linePositionX;\n var linePositionY;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n var passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (var i = 0; i < passesCount; ++i)\n {\n var isShadowPass = style.dropShadow && i === 0;\n var dsOffsetText = isShadowPass ? height * 2 : 0; // we only want the drop shadow, so put text way off-screen\n var dsOffsetShadow = dsOffsetText * this.resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n var dropShadowColor = style.dropShadowColor;\n var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n context.shadowColor = \"rgba(\" + (rgb[0] * 255) + \",\" + (rgb[1] * 255) + \",\" + (rgb[2] * 255) + \",\" + (style.dropShadowAlpha) + \")\";\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines);\n context.strokeStyle = style.stroke;\n\n context.shadowColor = 0;\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n // draw lines line by line\n for (var i$1 = 0; i$1 < lines.length; i$1++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i$1 * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i$1];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i$1]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i$1],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i$1],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n\n this.updateTexture();\n };\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n Text.prototype.drawLetterSpacing = function drawLetterSpacing (text, x, y, isStroke)\n {\n if ( isStroke === void 0 ) isStroke = false;\n\n var style = this._style;\n\n // letterSpacing of 0 means normal\n var letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n var currentPosition = x;\n\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n var stringArray = Array.from ? Array.from(text) : text.split('');\n var previousWidth = this.context.measureText(text).width;\n var currentWidth = 0;\n\n for (var i = 0; i < stringArray.length; ++i)\n {\n var currentChar = stringArray[i];\n\n if (isStroke)\n {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n };\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n Text.prototype.updateTexture = function updateTexture ()\n {\n var canvas = this.canvas;\n\n if (this._style.trim)\n {\n var trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n var texture = this._texture;\n var style = this._style;\n var padding = style.trim ? 0 : style.padding;\n var baseTexture = texture.baseTexture;\n\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n\n this.dirty = false;\n };\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The renderer\n */\n Text.prototype._render = function _render (renderer)\n {\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n Sprite.prototype._render.call(this, renderer);\n };\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n Text.prototype.getLocalBounds = function getLocalBounds (rect)\n {\n this.updateText(true);\n\n return Sprite.prototype.getLocalBounds.call(this, rect);\n };\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n Text.prototype._calculateBounds = function _calculateBounds ()\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n };\n\n /**\n * Method to be called upon a TextStyle change.\n * @private\n */\n Text.prototype._onStyleChange = function _onStyleChange ()\n {\n this.dirty = true;\n };\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n Text.prototype._generateFillStyle = function _generateFillStyle (style, lines)\n {\n if (!Array.isArray(style.fill))\n {\n return style.fill;\n }\n else if (style.fill.length === 1)\n {\n return style.fill[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n var gradient;\n var totalIterations;\n var currentIteration;\n var stop;\n\n var width = Math.ceil(this.canvas.width / this._resolution);\n var height = Math.ceil(this.canvas.height / this._resolution);\n\n // make a copy of the style settings, so we can manipulate them later\n var fill = style.fill.slice();\n var fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n var lengthPlus1 = fill.length + 1;\n\n for (var i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(style.fill[0]);\n fillGradientStops.unshift(0);\n\n fill.push(style.fill[style.fill.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, 0, width / 2, height);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n totalIterations = (fill.length + 1) * lines.length;\n currentIteration = 0;\n for (var i$1 = 0; i$1 < lines.length; i$1++)\n {\n currentIteration += 1;\n for (var j = 0; j < fill.length; j++)\n {\n if (typeof fillGradientStops[j] === 'number')\n {\n stop = (fillGradientStops[j] / lines.length) + (i$1 / lines.length);\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[j]);\n currentIteration++;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(0, height / 2, width, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n totalIterations = fill.length + 1;\n currentIteration = 1;\n\n for (var i$2 = 0; i$2 < fill.length; i$2++)\n {\n if (typeof fillGradientStops[i$2] === 'number')\n {\n stop = fillGradientStops[i$2];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i$2]);\n currentIteration++;\n }\n }\n\n return gradient;\n };\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n Text.prototype.destroy = function destroy (options)\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n Sprite.prototype.destroy.call(this, options);\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n };\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n };\n\n prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.updateText(true);\n\n var s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n };\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n };\n\n prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.updateText(true);\n\n var s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n };\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n prototypeAccessors.style.get = function ()\n {\n return this._style;\n };\n\n prototypeAccessors.style.set = function (style) // eslint-disable-line require-jsdoc\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n };\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n prototypeAccessors.text.get = function ()\n {\n return this._text;\n };\n\n prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n };\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n prototypeAccessors.resolution.get = function ()\n {\n return this._resolution;\n };\n\n prototypeAccessors.resolution.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._autoResolution = false;\n\n if (this._resolution === value)\n {\n return;\n }\n\n this._resolution = value;\n this.dirty = true;\n };\n\n Object.defineProperties( Text.prototype, prototypeAccessors );\n\n return Text;\n}(Sprite));\n\nexport { TEXT_GRADIENT, Text, TextMetrics, TextStyle };\n//# sourceMappingURL=text.es.js.map\n","/*!\n * @pixi/prepare - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/prepare is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { settings } from '@pixi/settings';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { Container } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\n/**\n * CountLimiter limits the number of items handled by a {@link PIXI.prepare.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI.prepare\n */\nvar CountLimiter = function CountLimiter(maxItemsPerFrame)\n{\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n};\n\n/**\n * Resets any counting properties to start fresh on a new frame.\n */\nCountLimiter.prototype.beginFrame = function beginFrame ()\n{\n this.itemsLeft = this.maxItemsPerFrame;\n};\n\n/**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\nCountLimiter.prototype.allowedToUpload = function allowedToUpload ()\n{\n return this.itemsLeft-- > 0;\n};\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.prepare.Prepare} and {@link PIXI.prepare.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI.prepare\n */\nvar BasePrepare = function BasePrepare(renderer)\n{\n var this$1 = this;\n\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter}\n */\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {PIXI.prepare.CanvasPrepare|PIXI.Renderer}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = function () {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this$1.queue)\n {\n return;\n }\n this$1.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n};\n\n/**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\nBasePrepare.prototype.upload = function upload (item, done)\n{\n if (typeof item === 'function')\n {\n done = item;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n};\n\n/**\n * Handle tick update\n *\n * @private\n */\nBasePrepare.prototype.tick = function tick ()\n{\n setTimeout(this.delayedTick, 0);\n};\n\n/**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\nBasePrepare.prototype.prepareItems = function prepareItems ()\n{\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n var item = this.queue[0];\n var uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (var i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n var completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (var i$1 = 0, len$1 = completes.length; i$1 < len$1; i$1++)\n {\n completes[i$1]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n};\n\n/**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.\n */\nBasePrepare.prototype.registerFindHook = function registerFindHook (addHook)\n{\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n};\n\n/**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.\n */\nBasePrepare.prototype.registerUploadHook = function registerUploadHook (uploadHook)\n{\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n};\n\n/**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {PIXI.prepare.BasePrepare} Instance of plugin for chaining.\n */\nBasePrepare.prototype.add = function add (item)\n{\n // Add additional hooks for finding elements on special\n // types of objects that\n for (var i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (var i$1 = item.children.length - 1; i$1 >= 0; i$1--)\n {\n this.add(item.children[i$1]);\n }\n }\n\n return this;\n};\n\n/**\n * Destroys the plugin, don't use after this.\n *\n */\nBasePrepare.prototype.destroy = function destroy ()\n{\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n};\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findMultipleBaseTextures(item, queue)\n{\n var result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (var i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n var baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item, queue)\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n var texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item, queue)\n{\n if (item._texture && item._texture instanceof Texture)\n {\n var texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(helper, item)\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(helper, item)\n{\n if (item instanceof TextStyle)\n {\n var font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item, queue)\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n var texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item, queue)\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`\n *\n * @class\n * @extends PIXI.prepare.BasePrepare\n * @memberof PIXI.prepare\n */\nvar Prepare = /*@__PURE__*/(function (BasePrepare) {\n function Prepare(renderer)\n {\n BasePrepare.call(this, renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n\n if ( BasePrepare ) Prepare.__proto__ = BasePrepare;\n Prepare.prototype = Object.create( BasePrepare && BasePrepare.prototype );\n Prepare.prototype.constructor = Prepare;\n\n return Prepare;\n}(BasePrepare));\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer, item)\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[renderer.CONTEXT_UID])\n {\n renderer.texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer, item)\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n var geometry = item.geometry;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n var batches = geometry.batches;\n\n // upload all textures found in styles\n for (var i = 0; i < batches.length; i++)\n {\n var ref = batches[i].style;\n var texture = ref.texture;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n renderer.geometry.bind(geometry, item._resolveDirectShader());\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item, queue)\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI.prepare\n */\nvar TimeLimiter = function TimeLimiter(maxMilliseconds)\n{\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n};\n\n/**\n * Resets any counting properties to start fresh on a new frame.\n */\nTimeLimiter.prototype.beginFrame = function beginFrame ()\n{\n this.frameStart = Date.now();\n};\n\n/**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\nTimeLimiter.prototype.allowedToUpload = function allowedToUpload ()\n{\n return Date.now() - this.frameStart < this.maxMilliseconds;\n};\n\n/**\n * The prepare namespace provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n * @namespace PIXI.prepare\n */\n\nexport { BasePrepare, CountLimiter, Prepare, TimeLimiter };\n//# sourceMappingURL=prepare.es.js.map\n","/*!\n * @pixi/app - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/app is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nvar Application = function Application(options)\n{\n var this$1 = this;\n\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n // install plugins here\n Application._plugins.forEach(function (plugin) {\n plugin.init.call(this$1, options);\n });\n};\n\nvar prototypeAccessors = { view: { configurable: true },screen: { configurable: true } };\n\n/**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\nApplication.registerPlugin = function registerPlugin (plugin)\n{\n Application._plugins.push(plugin);\n};\n\n/**\n * Render the current stage.\n */\nApplication.prototype.render = function render ()\n{\n this.renderer.render(this.stage);\n};\n\n/**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\nprototypeAccessors.view.get = function ()\n{\n return this.renderer.view;\n};\n\n/**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\nprototypeAccessors.screen.get = function ()\n{\n return this.renderer.screen;\n};\n\n/**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\nApplication.prototype.destroy = function destroy (removeView, stageOptions)\n{\n var this$1 = this;\n\n // Destroy plugins in the opposite order\n // which they were constructed\n var plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach(function (plugin) {\n plugin.destroy.call(this$1);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n\n this._options = null;\n};\n\nObject.defineProperties( Application.prototype, prototypeAccessors );\n\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nvar ResizePlugin = function ResizePlugin () {};\n\nResizePlugin.init = function init (options)\n{\n var this$1 = this;\n\n /**\n * The element or window to resize the application to.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo',\n {\n set: function set(dom)\n {\n window.removeEventListener('resize', this.resize);\n this._resizeTo = dom;\n if (dom)\n {\n window.addEventListener('resize', this.resize);\n this.resize();\n }\n },\n get: function get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * If `resizeTo` is set, calling this function\n * will resize to the width and height of that element.\n * @method PIXI.Application#resize\n */\n this.resize = function () {\n if (this$1._resizeTo)\n {\n // Resize to the window\n if (this$1._resizeTo === window)\n {\n this$1.renderer.resize(\n window.innerWidth,\n window.innerHeight\n );\n }\n // Resize to other HTML entities\n else\n {\n this$1.renderer.resize(\n this$1._resizeTo.clientWidth,\n this$1._resizeTo.clientHeight\n );\n }\n }\n };\n\n // On resize\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n};\n\n/**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\nResizePlugin.destroy = function destroy ()\n{\n this.resizeTo = null;\n this.resize = null;\n};\n\nApplication.registerPlugin(ResizePlugin);\n\nexport { Application };\n//# sourceMappingURL=app.es.js.map\n","'use strict'\n\nmodule.exports = function parseURI (str, opts) {\n opts = opts || {}\n\n var o = {\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _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; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/*!\n * resource-loader - v3.0.1\n * https://github.com/pixijs/pixi-sound\n * Compiled Tue, 02 Jul 2019 14:06:18 UTC\n *\n * resource-loader is licensed under the MIT license.\n * http://www.opensource.org/licenses/mit-license\n */\nimport parseUri from 'parse-uri';\nimport Signal from 'mini-signals';\n\n/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() {}\n/* empty */\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n\n\nfunction eachSeries(array, iterator, callback, deferNext) {\n var i = 0;\n var len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(function () {\n iterator(array[i++], next);\n }, 1);\n } else {\n iterator(array[i++], next);\n }\n })();\n}\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\n\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n var callFn = fn;\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\n\n\nfunction queue(worker, concurrency) {\n if (concurrency == null) {\n // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n } else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n var workers = 0;\n var q = {\n _tasks: [],\n concurrency: concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push: function push(data, callback) {\n _insert(data, false, callback);\n },\n kill: function kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift: function unshift(data, callback) {\n _insert(data, true, callback);\n },\n process: function process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n var task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length: function length() {\n return q._tasks.length;\n },\n running: function running() {\n return workers;\n },\n idle: function idle() {\n return q._tasks.length + workers === 0;\n },\n pause: function pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume: function resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false; // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n\n for (var w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n }\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') {\n // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) {\n // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(function () {\n return q.drain();\n }, 1);\n return;\n }\n\n var item = {\n data: data,\n callback: typeof callback === 'function' ? callback : _noop\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n } else {\n q._tasks.push(item);\n }\n\n setTimeout(function () {\n return q.process();\n }, 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) {\n // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= q.concurrency - q.buffer) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n\nvar async = ({\n eachSeries: eachSeries,\n queue: queue\n});\n\n// a simple in-memory cache for resources\nvar cache = {};\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\n\nfunction caching(resource, next) {\n var _this = this;\n\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n } // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(function () {\n return cache[_this.url] = _this.data;\n });\n }\n\n next();\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nvar useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest()));\nvar tempAnchor = null; // some status constants\n\nvar STATUS_NONE = 0;\nvar STATUS_OK = 200;\nvar STATUS_EMPTY = 204;\nvar STATUS_IE_BUG_EMPTY = 1223;\nvar STATUS_TYPE_OK = 2; // noop\n\nfunction _noop$1() {}\n/* empty */\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\n\n\nvar Resource =\n/*#__PURE__*/\nfunction () {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n ;\n\n Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n ;\n\n function Resource(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n\n this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work.\n\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n\n\n this.name = name;\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n\n this.url = url;\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n\n this.extension = this._getExtension();\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n\n this.data = null;\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n\n this.timeout = options.timeout || 0;\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n\n this.loadType = options.loadType || this._determineLoadType();\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n\n this.xhrType = options.xhrType;\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n\n this.metadata = options.metadata || {};\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n\n this.error = null;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n\n this.xhr = null;\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n\n this.children = [];\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n\n this.type = Resource.TYPE.UNKNOWN;\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n\n this.progressChunk = 0;\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n\n this._dequeue = _noop$1;\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n\n this._onLoadBinding = null;\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n\n this._elementTimer = 0;\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundComplete = this.complete.bind(this);\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnError = this._onError.bind(this);\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnProgress = this._onProgress.bind(this);\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n\n this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks\n\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n\n this.onStart = new Signal();\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n\n this.onProgress = new Signal();\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onComplete = new Signal();\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onAfterMiddleware = new Signal();\n }\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n\n\n var _proto = Resource.prototype;\n\n /**\n * Marks the resource as complete.\n *\n */\n _proto.complete = function complete() {\n this._clearEvents();\n\n this._finish();\n }\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n ;\n\n _proto.abort = function abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n } // store error\n\n\n this.error = new Error(message); // clear events before calling aborts\n\n this._clearEvents(); // abort the actual loading\n\n\n if (this.xhr) {\n this.xhr.abort();\n } else if (this.xdr) {\n this.xdr.abort();\n } else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n } // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n } // done now.\n\n\n this._finish();\n }\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n ;\n\n _proto.load = function load(cb) {\n var _this = this;\n\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(function () {\n return cb(_this);\n }, 1);\n }\n\n return;\n } else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this); // if unset, determine the value\n\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n\n this._loadElement('image');\n\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n\n this._loadSourceElement('audio');\n\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n\n this._loadSourceElement('video');\n\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n } else {\n this._loadXhr();\n }\n\n break;\n }\n }\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n ;\n\n _proto._hasFlag = function _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n ;\n\n _proto._setFlag = function _setFlag(flag, value) {\n this._flags = value ? this._flags | flag : this._flags & ~flag;\n }\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n ;\n\n _proto._clearEvents = function _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n } else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n /**\n * Finalizes the load.\n *\n * @private\n */\n ;\n\n _proto._finish = function _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n ;\n\n _proto._loadElement = function _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n ;\n\n _proto._loadSourceElement = function _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(\"Unsupported element: \" + type);\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n } else if (Array.isArray(this.url)) {\n var mimeTypes = this.metadata.mimeType;\n\n for (var i = 0; i < this.url.length; ++i) {\n this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes));\n }\n } else {\n var _mimeTypes = this.metadata.mimeType;\n this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes));\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n ;\n\n _proto._loadXhr = function _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url\n\n xhr.open('GET', this.url, true);\n xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n } else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n xhr.send();\n }\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n ;\n\n _proto._loadXdr = function _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n\n setTimeout(function () {\n return xdr.send();\n }, 1);\n }\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n ;\n\n _proto._createSource = function _createSource(type, url, mime) {\n if (!mime) {\n mime = type + \"/\" + this._getExtension(url);\n }\n\n var source = document.createElement('source');\n source.src = url;\n source.type = mime;\n return source;\n }\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n ;\n\n _proto._onError = function _onError(event) {\n this.abort(\"Failed to load element using: \" + event.target.nodeName);\n }\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n ;\n\n _proto._onProgress = function _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n ;\n\n _proto._onTimeout = function _onTimeout() {\n this.abort(\"Load timed out.\");\n }\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnError = function _xhrOnError() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request failed. Status: \" + xhr.status + \", text: \\\"\" + xhr.statusText + \"\\\"\");\n }\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnTimeout = function _xhrOnTimeout() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request timed out.\");\n }\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n ;\n\n _proto._xhrOnAbort = function _xhrOnAbort() {\n var xhr = this.xhr;\n this.abort(reqType(xhr) + \" Request was aborted by the user.\");\n }\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n ;\n\n _proto._xhrOnLoad = function _xhrOnLoad() {\n var xhr = this.xhr;\n var text = '';\n var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n } // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n\n\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n var statusType = status / 100 | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n } // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n } catch (e) {\n this.abort(\"Error trying to parse loaded json: \" + e);\n return;\n }\n } // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n var domparser = new DOMParser();\n this.data = domparser.parseFromString(text, 'text/xml');\n } else {\n var div = document.createElement('div');\n div.innerHTML = text;\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n } catch (e) {\n this.abort(\"Error trying to parse loaded xml: \" + e);\n return;\n }\n } // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n } else {\n this.abort(\"[\" + xhr.status + \"] \" + xhr.statusText + \": \" + xhr.responseURL);\n return;\n }\n\n this.complete();\n }\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n ;\n\n _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n\n\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n } // default is window.location\n\n\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n } // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n\n\n tempAnchor.href = url;\n url = parseUri(tempAnchor.href, {\n strictMode: true\n });\n var samePort = !url.port && loc.port === '' || url.port === loc.port;\n var protocol = url.protocol ? url.protocol + \":\" : ''; // if cross origin\n\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n ;\n\n _proto._determineXhrType = function _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n ;\n\n _proto._determineLoadType = function _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n ;\n\n _proto._getExtension = function _getExtension() {\n var url = this.url;\n var ext = '';\n\n if (this.isDataUrl) {\n var slashIndex = url.indexOf('/');\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n } else {\n var queryStart = url.indexOf('?');\n var hashStart = url.indexOf('#');\n var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length);\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n ;\n\n _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n\n default:\n return 'text/plain';\n }\n };\n\n _createClass(Resource, [{\n key: \"isDataUrl\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: \"isComplete\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: \"isLoading\",\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n }]);\n\n return Resource;\n}();\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\n\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: 1 << 0,\n COMPLETE: 1 << 1,\n LOADING: 1 << 2\n};\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6\n};\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4\n};\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\n\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n\n /** Blob */\n BLOB: 'blob',\n\n /** Document */\n DOCUMENT: 'document',\n\n /** Object */\n JSON: 'json',\n\n /** String */\n TEXT: 'text'\n};\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE,\n // for SVG data urls\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO\n};\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER\n}; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\n\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\n\n\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nvar _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\n\nfunction encodeBinary(input) {\n var output = '';\n var inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n var bytebuffer = [0, 0, 0];\n var encodedCharIndexes = [0, 0, 0, 0];\n\n for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n } else {\n bytebuffer[jnx] = 0;\n }\n } // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n\n\n 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)\n\n 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)\n\n encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3)\n\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly\n\n var paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break;\n // No padding - proceed\n } // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n\n\n for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) {\n output += _keyStr.charAt(encodedCharIndexes[_jnx]);\n }\n }\n\n return output;\n}\n\nvar Url = window.URL || window.webkitURL;\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\n\nfunction parsing(resource, next) {\n if (!resource.data) {\n next();\n return;\n } // if this was an XHR load of a blob\n\n\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url\n\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = \"data:\" + type + \";base64,\" + encodeBinary(resource.xhr.responseText);\n resource.type = Resource.TYPE.IMAGE; // wait until the image loads and then callback\n\n resource.data.onload = function () {\n resource.data.onload = null;\n next();\n }; // next will be called on load\n\n\n return;\n }\n } // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n var src = Url.createObjectURL(resource.data);\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n resource.type = Resource.TYPE.IMAGE; // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n\n resource.data.onload = function () {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n next();\n }; // next will be called on load.\n\n\n return;\n }\n }\n\n next();\n}\n\n/**\n * @namespace middleware\n */\n\nvar index = ({\n caching: caching,\n parsing: parsing\n});\n\nvar MAX_PROGRESS = 100;\nvar rgxExtractUrlHash = /(#[\\w-]+)?$/;\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\n\nvar Loader =\n/*#__PURE__*/\nfunction () {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n function Loader(baseUrl, concurrency) {\n var _this = this;\n\n if (baseUrl === void 0) {\n baseUrl = '';\n }\n\n if (concurrency === void 0) {\n concurrency = 10;\n }\n\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n\n this.progress = 0;\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n\n this.loading = false;\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n\n this.defaultQueryString = '';\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n\n this._beforeMiddleware = [];\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n\n this._afterMiddleware = [];\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n\n this._resourcesParsing = [];\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n\n this._boundLoadResource = function (r, d) {\n return _this._loadResource(r, d);\n };\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n\n\n this._queue = queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n\n\n this.resources = {};\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n\n this.onProgress = new Signal();\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n\n this.onError = new Signal();\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n\n this.onLoad = new Signal();\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n\n this.onStart = new Signal();\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n\n this.onComplete = new Signal(); // Add default before middleware\n\n for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n } // Add default after middleware\n\n\n for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) {\n this.use(Loader._defaultAfterMiddleware[_i]);\n }\n }\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n /**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n\n var _proto = Loader.prototype;\n\n _proto.add = function add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (var i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n } // if an object is passed instead of params\n\n\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n } // case where no name is passed shift all args over by one.\n\n\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n } // now that we shifted make sure we have a proper url.\n\n\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n } // options are optional so people might pass a function and no options\n\n\n if (typeof options === 'function') {\n cb = options;\n options = null;\n } // if loading already you can only add resources that have a parent.\n\n\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n } // check if resource already exists.\n\n\n if (this.resources[name]) {\n throw new Error(\"Resource named \\\"\" + name + \"\\\" already exists.\");\n } // add base url if this isn't an absolute url\n\n\n url = this._prepareUrl(url); // create the store the resource\n\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n } // if actively loading, make sure to adjust progress chunks for that parent and its children\n\n\n if (this.loading) {\n var parent = options.parentResource;\n var incompleteChildren = [];\n\n for (var _i2 = 0; _i2 < parent.children.length; ++_i2) {\n if (!parent.children[_i2].isComplete) {\n incompleteChildren.push(parent.children[_i2]);\n }\n }\n\n var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n\n var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) {\n incompleteChildren[_i3].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n } // add the resource to the queue\n\n\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.pre = function pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.use = function use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n ;\n\n _proto.reset = function reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n\n this._queue.pause(); // abort all resource loads\n\n\n for (var k in this.resources) {\n var res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n return this;\n }\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n ;\n\n _proto.load = function load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n } // if the queue has already started we are done here\n\n\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n\n this._onComplete();\n } else {\n // distribute progress chunks\n var numTasks = this._queue._tasks.length;\n var chunk = MAX_PROGRESS / numTasks;\n\n for (var i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n } // notify we are starting\n\n\n this._onStart(); // start loading\n\n\n this._queue.resume();\n }\n\n return this;\n }\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n ;\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _proto._prepareUrl = function _prepareUrl(url) {\n var parsedUrl = parseUri(url, {\n strictMode: true\n });\n var result; // absolute url, just use it as is.\n\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') {\n result = this.baseUrl + \"/\" + url;\n } else {\n result = this.baseUrl + url;\n } // if we need to add a default querystring, there is a bit more work\n\n\n if (this.defaultQueryString) {\n var hash = rgxExtractUrlHash.exec(result)[0];\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += \"&\" + this.defaultQueryString;\n } else {\n result += \"?\" + this.defaultQueryString;\n }\n\n result += hash;\n }\n\n return result;\n }\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n ;\n\n _proto._loadResource = function _loadResource(resource, dequeue) {\n var _this2 = this;\n\n resource._dequeue = dequeue; // run before middleware\n\n eachSeries(this._beforeMiddleware, function (fn, next) {\n fn.call(_this2, resource, function () {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n }, function () {\n if (resource.isComplete) {\n _this2._onLoad(resource);\n } else {\n resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2);\n resource.load();\n }\n }, true);\n }\n /**\n * Called once loading has started.\n *\n * @private\n */\n ;\n\n _proto._onStart = function _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n ;\n\n _proto._onComplete = function _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n ;\n\n _proto._onLoad = function _onLoad(resource) {\n var _this3 = this;\n\n resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed\n\n this._resourcesParsing.push(resource);\n\n resource._dequeue(); // run all the after middleware for this resource\n\n\n eachSeries(this._afterMiddleware, function (fn, next) {\n fn.call(_this3, resource, next);\n }, function () {\n resource.onAfterMiddleware.dispatch(resource);\n _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk);\n\n _this3.onProgress.dispatch(_this3, resource);\n\n if (resource.error) {\n _this3.onError.dispatch(resource.error, _this3, resource);\n } else {\n _this3.onLoad.dispatch(_this3, resource);\n }\n\n _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check\n\n\n if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) {\n _this3._onComplete();\n }\n }, true);\n };\n\n _createClass(Loader, [{\n key: \"concurrency\",\n get: function get() {\n return this._queue.concurrency;\n } // eslint-disable-next-line require-jsdoc\n ,\n set: function set(concurrency) {\n this._queue.concurrency = concurrency;\n }\n }]);\n\n return Loader;\n}();\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\n\n\nLoader._defaultBeforeMiddleware = [];\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\n\nLoader._defaultAfterMiddleware = [];\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\n\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\n\n\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\nexport { Loader, Resource, async, encodeBinary, index as middleware };\n//# sourceMappingURL=resource-loader.esm.js.map\n","/*!\n * @pixi/loaders - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/loaders is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Resource, Loader as Loader$1, middleware } from 'resource-loader';\nimport { EventEmitter } from '@pixi/utils';\nimport { Texture } from '@pixi/core';\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar TextureLoader = function TextureLoader () {};\n\nTextureLoader.use = function use (resource, next)\n{\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n};\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nvar Loader = /*@__PURE__*/(function (ResourceLoader) {\n function Loader(baseUrl, concurrency)\n {\n var this$1 = this;\n\n ResourceLoader.call(this, baseUrl, concurrency);\n EventEmitter.call(this);\n\n for (var i = 0; i < Loader._plugins.length; ++i)\n {\n var plugin = Loader._plugins[i];\n var pre = plugin.pre;\n var use = plugin.use;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n // Compat layer, translate the new v2 signals into old v1 events.\n this.onStart.add(function (l) { return this$1.emit('start', l); });\n this.onProgress.add(function (l, r) { return this$1.emit('progress', l, r); });\n this.onError.add(function (e, l, r) { return this$1.emit('error', e, l, r); });\n this.onLoad.add(function (l, r) { return this$1.emit('load', l, r); });\n this.onComplete.add(function (l, r) { return this$1.emit('complete', l, r); });\n\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n }\n\n if ( ResourceLoader ) Loader.__proto__ = ResourceLoader;\n Loader.prototype = Object.create( ResourceLoader && ResourceLoader.prototype );\n Loader.prototype.constructor = Loader;\n\n var staticAccessors = { shared: { configurable: true } };\n\n /**\n * Destroy the loader, removes references.\n * @private\n */\n Loader.prototype.destroy = function destroy ()\n {\n if (!this._protected)\n {\n this.removeAllListeners();\n this.reset();\n }\n };\n\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n staticAccessors.shared.get = function ()\n {\n var shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n };\n\n Object.defineProperties( Loader, staticAccessors );\n\n return Loader;\n}(Loader$1));\n\n// Copy EE3 prototype (mixin)\nObject.assign(Loader.prototype, EventEmitter.prototype);\n\n/**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\nLoader._plugins = [];\n\n/**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\nLoader.registerPlugin = function registerPlugin(plugin)\n{\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n};\n\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: middleware.parsing });\n\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n\n/**\n * @memberof PIXI.Loader#\n * @member {object} onStart\n */\n\n/**\n * @memberof PIXI.Loader#\n * @member {object} onProgress\n */\n\n/**\n * @memberof PIXI.Loader#\n * @member {object} onError\n */\n\n/**\n * @memberof PIXI.Loader#\n * @member {object} onLoad\n */\n\n/**\n * @memberof PIXI.Loader#\n * @member {object} onComplete\n */\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nvar AppLoaderPlugin = function AppLoaderPlugin () {};\n\nAppLoaderPlugin.init = function init (options)\n{\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n};\n\n/**\n * Called when application destroyed\n * @private\n */\nAppLoaderPlugin.destroy = function destroy ()\n{\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n};\n\n/**\n * Reference to **{@link https://github.com/englercj/resource-loader\n * resource-loader}**'s Resource class.\n * @see http://englercj.github.io/resource-loader/Resource.html\n * @class LoaderResource\n * @memberof PIXI\n */\nvar LoaderResource = Resource;\n\nexport { AppLoaderPlugin, Loader, LoaderResource, TextureLoader };\n//# sourceMappingURL=loaders.es.js.map\n","/*!\n * @pixi/particles - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/particles is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { BLEND_MODES, TYPES } from '@pixi/constants';\nimport { hex2rgb, createIndicesForQuads, correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { Container } from '@pixi/display';\nimport { Geometry, Buffer, ObjectRenderer, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar ParticleContainer = /*@__PURE__*/(function (Container) {\n function ParticleContainer(maxSize, properties, batchSize, autoResize)\n {\n if ( maxSize === void 0 ) maxSize = 1500;\n if ( batchSize === void 0 ) batchSize = 16384;\n if ( autoResize === void 0 ) autoResize = false;\n\n Container.call(this);\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n var maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {Array}\n * @private\n */\n this._buffers = null;\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n if ( Container ) ParticleContainer.__proto__ = Container;\n ParticleContainer.prototype = Object.create( Container && Container.prototype );\n ParticleContainer.prototype.constructor = ParticleContainer;\n\n var prototypeAccessors = { tint: { configurable: true } };\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n ParticleContainer.prototype.setProperties = function setProperties (properties)\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n };\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n ParticleContainer.prototype.updateTransform = function updateTransform ()\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n // PIXI.Container.prototype.updateTransform.call( this );\n };\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n prototypeAccessors.tint.get = function ()\n {\n return this._tint;\n };\n\n prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n };\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n ParticleContainer.prototype.render = function render (renderer)\n {\n var this$1 = this;\n\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = this.children[0]._texture.baseTexture;\n if (!this.baseTexture.valid)\n {\n this.baseTexture.once('update', function () { return this$1.onChildrenChange(0); });\n }\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n };\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n ParticleContainer.prototype.onChildrenChange = function onChildrenChange (smallestChildIndex)\n {\n var bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n };\n\n ParticleContainer.prototype.dispose = function dispose ()\n {\n if (this._buffers)\n {\n for (var i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n\n this._buffers = null;\n }\n };\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n ParticleContainer.prototype.destroy = function destroy (options)\n {\n Container.prototype.destroy.call(this, options);\n\n this.dispose();\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n };\n\n Object.defineProperties( ParticleContainer.prototype, prototypeAccessors );\n\n return ParticleContainer;\n}(Container));\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nvar ParticleBuffer = function ParticleBuffer(properties, dynamicPropertyFlags, size)\n{\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (var i = 0; i < properties.length; ++i)\n {\n var property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n};\n\n/**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\nParticleBuffer.prototype.initBuffers = function initBuffers ()\n{\n var geometry = this.geometry;\n\n var dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (var i = 0; i < this.dynamicProperties.length; ++i)\n {\n var property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n var staticOffset = 0;\n\n this.staticStride = 0;\n\n for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1)\n {\n var property$1 = this.staticProperties[i$1];\n\n property$1.offset = staticOffset;\n staticOffset += property$1.size;\n this.staticStride += property$1.size;\n }\n\n var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2)\n {\n var property$2 = this.dynamicProperties[i$2];\n\n geometry.addAttribute(\n property$2.attributeName,\n this.dynamicBuffer,\n 0,\n property$2.type === TYPES.UNSIGNED_BYTE,\n property$2.type,\n this.dynamicStride * 4,\n property$2.offset * 4\n );\n }\n\n for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3)\n {\n var property$3 = this.staticProperties[i$3];\n\n geometry.addAttribute(\n property$3.attributeName,\n this.staticBuffer,\n 0,\n property$3.type === TYPES.UNSIGNED_BYTE,\n property$3.type,\n this.staticStride * 4,\n property$3.offset * 4\n );\n }\n};\n\n/**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\nParticleBuffer.prototype.uploadDynamic = function uploadDynamic (children, startIndex, amount)\n{\n for (var i = 0; i < this.dynamicProperties.length; i++)\n {\n var property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n};\n\n/**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\nParticleBuffer.prototype.uploadStatic = function uploadStatic (children, startIndex, amount)\n{\n for (var i = 0; i < this.staticProperties.length; i++)\n {\n var property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n};\n\n/**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\nParticleBuffer.prototype.destroy = function destroy ()\n{\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n // this.dynamicBuffer.destroy();\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n // this.staticBuffer.destroy();\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n};\n\nvar vertex = \"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\";\n\nvar fragment = \"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}\";\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nvar ParticleRenderer = /*@__PURE__*/(function (ObjectRenderer) {\n function ParticleRenderer(renderer)\n {\n ObjectRenderer.call(this, renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n } ];\n\n this.shader = Shader.from(vertex, fragment, {});\n }\n\n if ( ObjectRenderer ) ParticleRenderer.__proto__ = ObjectRenderer;\n ParticleRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );\n ParticleRenderer.prototype.constructor = ParticleRenderer;\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n ParticleRenderer.prototype.render = function render (container)\n {\n var children = container.children;\n var maxSize = container._maxSize;\n var batchSize = container._batchSize;\n var renderer = this.renderer;\n var totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n var buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n var baseTexture = children[0]._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.renderer.state.setBlendMode(correctBlendMode(container.blendMode, baseTexture.alphaMode));\n\n var gl = renderer.gl;\n\n var m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n var updateStatic = false;\n\n // now lets upload and render the buffers..\n for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n var amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n var buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n var bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n };\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n ParticleRenderer.prototype.generateBuffers = function generateBuffers (container)\n {\n var buffers = [];\n var size = container._maxSize;\n var batchSize = container._batchSize;\n var dynamicPropertyFlags = container._properties;\n\n for (var i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n };\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer (container)\n {\n var batchSize = container._batchSize;\n var dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n };\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadVertices = function uploadVertices (children, startIndex, amount, array, stride, offset)\n {\n var w0 = 0;\n var w1 = 0;\n var h0 = 0;\n var h1 = 0;\n\n for (var i = 0; i < amount; ++i)\n {\n var sprite = children[startIndex + i];\n var texture = sprite._texture;\n var sx = sprite.scale.x;\n var sy = sprite.scale.y;\n var trim = texture.trim;\n var orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n };\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadPosition = function uploadPosition (children, startIndex, amount, array, stride, offset)\n {\n for (var i = 0; i < amount; i++)\n {\n var spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n };\n\n /**\n * Uploads the rotiation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadRotation = function uploadRotation (children, startIndex, amount, array, stride, offset)\n {\n for (var i = 0; i < amount; i++)\n {\n var spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n };\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadUvs = function uploadUvs (children, startIndex, amount, array, stride, offset)\n {\n for (var i = 0; i < amount; ++i)\n {\n var textureUvs = children[startIndex + i]._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n };\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n ParticleRenderer.prototype.uploadTint = function uploadTint (children, startIndex, amount, array, stride, offset)\n {\n for (var i = 0; i < amount; ++i)\n {\n var sprite = children[startIndex + i];\n var premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n var alpha = sprite.alpha;\n // we dont call extra function if alpha is 1.0, that's faster\n var argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha)\n : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n };\n\n /**\n * Destroys the ParticleRenderer.\n */\n ParticleRenderer.prototype.destroy = function destroy ()\n {\n ObjectRenderer.prototype.destroy.call(this);\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n };\n\n return ParticleRenderer;\n}(ObjectRenderer));\n\nexport { ParticleContainer, ParticleRenderer };\n//# sourceMappingURL=particles.es.js.map\n","/*!\n * @pixi/spritesheet - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/spritesheet is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Rectangle } from '@pixi/math';\nimport { Texture } from '@pixi/core';\nimport { getResolutionOfUrl, url } from '@pixi/utils';\nimport { LoaderResource } from '@pixi/loaders';\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nvar Spritesheet = function Spritesheet(baseTexture, data, resolutionFilename)\n{\n if ( resolutionFilename === void 0 ) resolutionFilename = null;\n\n /**\n * Reference to ths source texture\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(\n resolutionFilename\n || (this.baseTexture.resource ? this.baseTexture.resource.url : null)\n );\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n};\n\nvar staticAccessors = { BATCH_SIZE: { configurable: true } };\n\n/**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\nstaticAccessors.BATCH_SIZE.get = function ()\n{\n return 1000;\n};\n\nSpritesheet.prototype._updateResolution = function _updateResolution (resolutionFilename)\n{\n var scale = this.data.meta.scale;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n var resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n};\n\n/**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\nSpritesheet.prototype.parse = function parse (callback)\n{\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n};\n\n/**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\nSpritesheet.prototype._processFrames = function _processFrames (initialFrameIndex)\n{\n var frameIndex = initialFrameIndex;\n var maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n var i = this._frameKeys[frameIndex];\n var data = this._frames[i];\n var rect = data.frame;\n\n if (rect)\n {\n var frame = null;\n var trim = null;\n var sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n var orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n};\n\n/**\n * Parse animations config\n *\n * @private\n */\nSpritesheet.prototype._processAnimations = function _processAnimations ()\n{\n var animations = this.data.animations || {};\n\n for (var animName in animations)\n {\n this.animations[animName] = [];\n for (var i = 0; i < animations[animName].length; i++)\n {\n var frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n};\n\n/**\n * The parse has completed.\n *\n * @private\n */\nSpritesheet.prototype._parseComplete = function _parseComplete ()\n{\n var callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n};\n\n/**\n * Begin the next batch of textures.\n *\n * @private\n */\nSpritesheet.prototype._nextBatch = function _nextBatch ()\n{\n var this$1 = this;\n\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(function () {\n if (this$1._batchIndex * Spritesheet.BATCH_SIZE < this$1._frameKeys.length)\n {\n this$1._nextBatch();\n }\n else\n {\n this$1._processAnimations();\n this$1._parseComplete();\n }\n }, 0);\n};\n\n/**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well\n */\nSpritesheet.prototype.destroy = function destroy (destroyBase)\n{\n if ( destroyBase === void 0 ) destroyBase = false;\n\n for (var i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this.baseTexture.destroy();\n }\n this.baseTexture = null;\n};\n\nObject.defineProperties( Spritesheet, staticAccessors );\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar SpritesheetLoader = function SpritesheetLoader () {};\n\nSpritesheetLoader.use = function use (resource, next)\n{\n var imageResourceName = (resource.name) + \"_image\";\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || this.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n var resourcePath = SpritesheetLoader.getResourcePath(resource, this.baseUrl);\n\n // load the image for this sheet\n this.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n var spritesheet = new Spritesheet(\n res.texture.baseTexture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(function () {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n};\n\n/**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\nSpritesheetLoader.getResourcePath = function getResourcePath (resource, baseUrl)\n{\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n};\n\nexport { Spritesheet, SpritesheetLoader };\n//# sourceMappingURL=spritesheet.es.js.map\n","/*!\n * @pixi/sprite-tiling - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/sprite-tiling is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Texture, TextureMatrix, ObjectRenderer, Shader, QuadUv } from '@pixi/core';\nimport { Point, Rectangle, Transform, Matrix } from '@pixi/math';\nimport { TextureCache, premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\nimport { Sprite } from '@pixi/sprite';\nimport { WRAP_MODES } from '@pixi/constants';\n\nvar tempPoint = new Point();\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar TilingSprite = /*@__PURE__*/(function (Sprite) {\n function TilingSprite(texture, width, height)\n {\n if ( width === void 0 ) width = 100;\n if ( height === void 0 ) height = 100;\n\n Sprite.call(this, texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n this.tileTransform = new Transform();\n\n // /// private\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * Canvas pattern\n *\n * @type {CanvasPattern}\n * @private\n */\n this._canvasPattern = null;\n\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = texture.uvMatrix || new TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n\n if ( Sprite ) TilingSprite.__proto__ = Sprite;\n TilingSprite.prototype = Object.create( Sprite && Sprite.prototype );\n TilingSprite.prototype.constructor = TilingSprite;\n\n var prototypeAccessors = { clampMargin: { configurable: true },tileScale: { configurable: true },tilePosition: { configurable: true },width: { configurable: true },height: { configurable: true } };\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n prototypeAccessors.clampMargin.get = function ()\n {\n return this.uvMatrix.clampMargin;\n };\n\n prototypeAccessors.clampMargin.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n };\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n prototypeAccessors.tileScale.get = function ()\n {\n return this.tileTransform.scale;\n };\n\n prototypeAccessors.tileScale.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.tileTransform.scale.copyFrom(value);\n };\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n prototypeAccessors.tilePosition.get = function ()\n {\n return this.tileTransform.position;\n };\n\n prototypeAccessors.tilePosition.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.tileTransform.position.copyFrom(value);\n };\n\n /**\n * @private\n */\n TilingSprite.prototype._onTextureUpdate = function _onTextureUpdate ()\n {\n if (this.uvMatrix)\n {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n };\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n TilingSprite.prototype._render = function _render (renderer)\n {\n // tweak our texture temporarily..\n var texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n };\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n TilingSprite.prototype._calculateBounds = function _calculateBounds ()\n {\n var minX = this._width * -this._anchor._x;\n var minY = this._height * -this._anchor._y;\n var maxX = this._width * (1 - this._anchor._x);\n var maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n };\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n TilingSprite.prototype.getLocalBounds = function getLocalBounds (rect)\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return Sprite.prototype.getLocalBounds.call(this, rect);\n };\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.Point} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n TilingSprite.prototype.containsPoint = function containsPoint (point)\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n var width = this._width;\n var height = this._height;\n var x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n var y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n };\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n TilingSprite.prototype.destroy = function destroy (options)\n {\n Sprite.prototype.destroy.call(this, options);\n\n this.tileTransform = null;\n this.uvMatrix = null;\n };\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {number|string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n TilingSprite.from = function from (source, width, height)\n {\n return new TilingSprite(Texture.from(source), width, height);\n };\n\n /**\n * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId\n * The frame ids are created when a Texture packer file has been loaded\n *\n * @static\n * @param {string} frameId - The frame Id of the texture in the cache\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId\n */\n TilingSprite.fromFrame = function fromFrame (frameId, width, height)\n {\n var texture = TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error((\"The frameId \\\"\" + frameId + \"\\\" does not exist in the texture cache \" + (this)));\n }\n\n return new TilingSprite(texture, width, height);\n };\n\n /**\n * Helper function that creates a sprite that will contain a texture based on an image url\n * If the image is not in the texture cache it will be loaded\n *\n * @static\n * @param {string} imageId - The image url of the texture\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @param {Object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id\n */\n TilingSprite.fromImage = function fromImage (imageId, width, height, options)\n {\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object')\n {\n options = {\n scaleMode: arguments[4],\n resourceOptions: {\n crossorigin: arguments[3],\n },\n };\n }\n\n return new TilingSprite(Texture.from(imageId, options), width, height);\n };\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n return this._width;\n };\n\n prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._width = value;\n };\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n return this._height;\n };\n\n prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._height = value;\n };\n\n Object.defineProperties( TilingSprite.prototype, prototypeAccessors );\n\n return TilingSprite;\n}(Sprite));\n\nvar vertex = \"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\";\n\nvar fragment = \"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 = vTextureCoord - floor(vTextureCoord - uClampOffset);\\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\\n\\n vec4 texSample = texture2D(uSampler, coord);\\n gl_FragColor = texSample * uColor;\\n}\\n\";\n\nvar 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\";\n\nvar tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nvar TilingSpriteRenderer = /*@__PURE__*/(function (ObjectRenderer) {\n function TilingSpriteRenderer(renderer)\n {\n ObjectRenderer.call(this, renderer);\n\n var uniforms = { globals: this.renderer.globalUniforms };\n\n this.shader = Shader.from(vertex, fragment, uniforms);\n\n this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);\n\n this.quad = new QuadUv();\n }\n\n if ( ObjectRenderer ) TilingSpriteRenderer.__proto__ = ObjectRenderer;\n TilingSpriteRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype );\n TilingSpriteRenderer.prototype.constructor = TilingSpriteRenderer;\n\n /**\n *\n * @param {PIXI.TilingSprite} ts tilingSprite to be rendered\n */\n TilingSpriteRenderer.prototype.render = function render (ts)\n {\n var renderer = this.renderer;\n var quad = this.quad;\n\n var vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.invalidate();\n\n var tex = ts._texture;\n var baseTex = tex.baseTexture;\n var lt = ts.tileTransform.localTransform;\n var uv = ts.uvMatrix;\n var isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n var shader = isSimple ? this.simpleShader : this.shader;\n\n var w = tex.width;\n var h = tex.height;\n var W = ts._width;\n var H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);// , renderer.shader.getGLShader());\n\n renderer.state.setBlendMode(correctBlendMode(ts.blendMode, baseTex.alphaMode));\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n };\n\n return TilingSpriteRenderer;\n}(ObjectRenderer));\n\nexport { TilingSprite, TilingSpriteRenderer };\n//# sourceMappingURL=sprite-tiling.es.js.map\n","/*!\n * @pixi/text-bitmap - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/text-bitmap is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { Point, Rectangle, ObservablePoint } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Sprite } from '@pixi/sprite';\nimport { removeItems, getResolutionOfUrl } from '@pixi/utils';\nimport { LoaderResource } from '@pixi/loaders';\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone.\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * You can generate the fnt files using\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar BitmapText = /*@__PURE__*/(function (Container) {\n function BitmapText(text, style)\n {\n var this$1 = this;\n if ( style === void 0 ) style = {};\n\n Container.call(this);\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {PIXI.Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._font = {\n tint: style.tint !== undefined ? style.tint : 0xFFFFFF,\n align: style.align || 'left',\n name: null,\n size: 0,\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = 0;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align.\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = 0;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(function () { this$1.dirty = true; }, this, 0, 0);\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n this.roundPixels = settings.ROUND_PIXELS;\n\n this.updateText();\n }\n\n if ( Container ) BitmapText.__proto__ = Container;\n BitmapText.prototype = Object.create( Container && Container.prototype );\n BitmapText.prototype.constructor = BitmapText;\n\n 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 } };\n\n /**\n * Renders text and updates it when needed\n *\n * @private\n */\n BitmapText.prototype.updateText = function updateText ()\n {\n var data = BitmapText.fonts[this._font.name];\n var scale = this._font.size / data.size;\n var pos = new Point();\n var chars = [];\n var lineWidths = [];\n var text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n var textLength = text.length;\n var maxWidth = this._maxWidth * data.size / this._font.size;\n\n var prevCharCode = null;\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var line = 0;\n var lastBreakPos = -1;\n var lastBreakWidth = 0;\n var spacesRemoved = 0;\n var maxLineHeight = 0;\n\n for (var i = 0; i < textLength; i++)\n {\n var charCode = text.charCodeAt(i);\n var char = text.charAt(i);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n var charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({\n texture: charData.texture,\n line: line,\n charCode: charCode,\n position: new Point(pos.x + charData.xOffset + (this._letterSpacing / 2), pos.y + charData.yOffset),\n });\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n var lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n var lineAlignOffsets = [];\n\n for (var i$1 = 0; i$1 <= line; i$1++)\n {\n var alignOffset = 0;\n\n if (this._font.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i$1];\n }\n else if (this._font.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i$1]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (var i$2 = 0; i$2 < lenChars; i$2++)\n {\n var c = this._glyphs[i$2]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i$2].texture;\n }\n else\n {\n c = new Sprite(chars[i$2].texture);\n c.roundPixels = this.roundPixels;\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i$2].position.x + lineAlignOffsets[chars[i$2].line]) * scale;\n c.position.y = chars[i$2].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (var i$3 = lenChars; i$3 < this._glyphs.length; ++i$3)\n {\n this.removeChild(this._glyphs[i$3]);\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n for (var i$4 = 0; i$4 < lenChars; i$4++)\n {\n this._glyphs[i$4].x -= this._textWidth * this.anchor.x;\n this._glyphs[i$4].y -= this._textHeight * this.anchor.y;\n }\n }\n this._maxLineHeight = maxLineHeight * scale;\n };\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n BitmapText.prototype.updateTransform = function updateTransform ()\n {\n this.validate();\n this.containerUpdateTransform();\n };\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n BitmapText.prototype.getLocalBounds = function getLocalBounds ()\n {\n this.validate();\n\n return Container.prototype.getLocalBounds.call(this);\n };\n\n /**\n * Updates text when needed\n *\n * @private\n */\n BitmapText.prototype.validate = function validate ()\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n };\n\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n */\n prototypeAccessors.tint.get = function ()\n {\n return this._font.tint;\n };\n\n prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n };\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n prototypeAccessors.align.get = function ()\n {\n return this._font.align;\n };\n\n prototypeAccessors.align.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._font.align = value || 'left';\n\n this.dirty = true;\n };\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n prototypeAccessors.anchor.get = function ()\n {\n return this._anchor;\n };\n\n prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n };\n\n /**\n * The font descriptor of the BitmapText object.\n *\n * @member {object}\n */\n prototypeAccessors.font.get = function ()\n {\n return this._font;\n };\n\n prototypeAccessors.font.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (!value)\n {\n return;\n }\n\n if (typeof value === 'string')\n {\n value = value.split(' ');\n\n this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' ');\n this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size;\n }\n else\n {\n this._font.name = value.name;\n this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n };\n\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n prototypeAccessors.text.get = function ()\n {\n return this._text;\n };\n\n prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n };\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n prototypeAccessors.maxWidth.get = function ()\n {\n return this._maxWidth;\n };\n\n prototypeAccessors.maxWidth.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n };\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n prototypeAccessors.maxLineHeight.get = function ()\n {\n this.validate();\n\n return this._maxLineHeight;\n };\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n prototypeAccessors.textWidth.get = function ()\n {\n this.validate();\n\n return this._textWidth;\n };\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n prototypeAccessors.letterSpacing.get = function ()\n {\n return this._letterSpacing;\n };\n\n prototypeAccessors.letterSpacing.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n };\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n prototypeAccessors.textHeight.get = function ()\n {\n this.validate();\n\n return this._textHeight;\n };\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @static\n * @param {XMLDocument} xml - The XML document data.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page.\n * If providing an object, the key is the `` element's `file` attribute in the FNT file.\n * @return {Object} Result font object with font, size, lineHeight and char fields.\n */\n BitmapText.registerFont = function registerFont (xml, textures)\n {\n var data = {};\n var info = xml.getElementsByTagName('info')[0];\n var common = xml.getElementsByTagName('common')[0];\n var pages = xml.getElementsByTagName('page');\n var res = getResolutionOfUrl(pages[0].getAttribute('file'), settings.RESOLUTION);\n var pagesTextures = {};\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) / res;\n data.chars = {};\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (var i = 0; i < pages.length; i++)\n {\n var id = pages[i].getAttribute('id');\n var file = pages[i].getAttribute('file');\n\n pagesTextures[id] = textures instanceof Array ? textures[i] : textures[file];\n }\n\n // parse letters\n var letters = xml.getElementsByTagName('char');\n\n for (var i$1 = 0; i$1 < letters.length; i$1++)\n {\n var letter = letters[i$1];\n var charCode = parseInt(letter.getAttribute('id'), 10);\n var page = letter.getAttribute('page') || 0;\n var textureRect = new Rectangle(\n (parseInt(letter.getAttribute('x'), 10) / res) + (pagesTextures[page].frame.x / res),\n (parseInt(letter.getAttribute('y'), 10) / res) + (pagesTextures[page].frame.y / res),\n parseInt(letter.getAttribute('width'), 10) / res,\n parseInt(letter.getAttribute('height'), 10) / res\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letter.getAttribute('xoffset'), 10) / res,\n yOffset: parseInt(letter.getAttribute('yoffset'), 10) / res,\n xAdvance: parseInt(letter.getAttribute('xadvance'), 10) / res,\n kerning: {},\n texture: new Texture(pagesTextures[page].baseTexture, textureRect),\n page: page,\n };\n }\n\n // parse kernings\n var kernings = xml.getElementsByTagName('kerning');\n\n for (var i$2 = 0; i$2 < kernings.length; i$2++)\n {\n var kerning = kernings[i$2];\n var first = parseInt(kerning.getAttribute('first'), 10) / res;\n var second = parseInt(kerning.getAttribute('second'), 10) / res;\n var amount = parseInt(kerning.getAttribute('amount'), 10) / res;\n\n if (data.chars[second])\n {\n data.chars[second].kerning[first] = amount;\n }\n }\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n BitmapText.fonts[data.font] = data;\n\n return data;\n };\n\n Object.defineProperties( BitmapText.prototype, prototypeAccessors );\n\n return BitmapText;\n}(Container));\n\nBitmapText.fonts = {};\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nvar BitmapFontLoader = function BitmapFontLoader () {};\n\nBitmapFontLoader.parse = function parse (resource, texture)\n{\n resource.bitmapFont = BitmapText.registerFont(resource.data, texture);\n};\n\n/**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\nBitmapFontLoader.add = function add ()\n{\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT);\n};\n\n/**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url Path to get directory for\n */\nBitmapFontLoader.dirname = function dirname (url)\n{\n var dir = url\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n};\n\n/**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\nBitmapFontLoader.use = function use (resource, next)\n{\n // skip if no data or not xml data\n if (!resource.data || resource.type !== LoaderResource.TYPE.XML)\n {\n next();\n\n return;\n }\n\n // skip if not bitmap font data, using some silly duck-typing\n if (resource.data.getElementsByTagName('page').length === 0\n || resource.data.getElementsByTagName('info').length === 0\n || resource.data.getElementsByTagName('info')[0].getAttribute('face') === null\n )\n {\n next();\n\n return;\n }\n\n var xmlUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (xmlUrl === '.')\n {\n xmlUrl = '';\n }\n\n if (this.baseUrl && xmlUrl)\n {\n // if baseurl has a trailing slash then add one to xmlUrl so the replace works below\n if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/')\n {\n xmlUrl += '/';\n }\n }\n }\n\n // remove baseUrl from xmlUrl\n xmlUrl = xmlUrl.replace(this.baseUrl, '');\n\n // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/')\n {\n xmlUrl += '/';\n }\n\n var pages = resource.data.getElementsByTagName('page');\n var textures = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n var completed = function (page) {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === pages.length)\n {\n BitmapFontLoader.parse(resource, textures);\n next();\n }\n };\n\n for (var i = 0; i < pages.length; ++i)\n {\n var pageFile = pages[i].getAttribute('file');\n var url = xmlUrl + pageFile;\n var exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (var name in this.resources)\n {\n var bitmapResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n var options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile: pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n};\n\nexport { BitmapFontLoader, BitmapText };\n//# sourceMappingURL=text-bitmap.es.js.map\n","/*!\n * @pixi/filter-alpha - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-alpha is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter, defaultVertex } from '@pixi/core';\n\nvar fragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float uAlpha;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\\n}\\n\";\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar AlphaFilter = /*@__PURE__*/(function (Filter) {\n function AlphaFilter(alpha)\n {\n if ( alpha === void 0 ) alpha = 1.0;\n\n Filter.call(this, defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n if ( Filter ) AlphaFilter.__proto__ = Filter;\n AlphaFilter.prototype = Object.create( Filter && Filter.prototype );\n AlphaFilter.prototype.constructor = AlphaFilter;\n\n var prototypeAccessors = { alpha: { configurable: true } };\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n prototypeAccessors.alpha.get = function ()\n {\n return this.uniforms.uAlpha;\n };\n\n prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uAlpha = value;\n };\n\n Object.defineProperties( AlphaFilter.prototype, prototypeAccessors );\n\n return AlphaFilter;\n}(Filter));\n\nexport { AlphaFilter };\n//# sourceMappingURL=filter-alpha.es.js.map\n","/*!\n * @pixi/filter-blur - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-blur is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\n\nvar 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 }\";\n\nfunction generateBlurVertSource(kernelSize, x)\n{\n var halfLength = Math.ceil(kernelSize / 2);\n\n var vertSource = vertTemplate;\n\n var blurLoop = '';\n var template;\n // let value;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (var i = 0; i < kernelSize; i++)\n {\n var blur = template.replace('%index%', i);\n\n // value = i;\n\n // if(i >= halfLength)\n // {\n // value = kernelSize - i - 1;\n // }\n\n blur = blur.replace('%sampleIndex%', ((i - (halfLength - 1)) + \".0\"));\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize);\n\n return vertSource;\n}\n\nvar GAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nvar fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}' ].join('\\n');\n\nfunction generateBlurFragSource(kernelSize)\n{\n var kernel = GAUSSIAN_VALUES[kernelSize];\n var halfLength = kernel.length;\n\n var fragSource = fragTemplate;\n\n var blurLoop = '';\n var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n var value;\n\n for (var i = 0; i < kernelSize; i++)\n {\n var blur = template.replace('%index%', i);\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value]);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize);\n\n return fragSource;\n}\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar BlurFilterPass = /*@__PURE__*/(function (Filter) {\n function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize)\n {\n kernelSize = kernelSize || 5;\n var vertSrc = generateBlurVertSource(kernelSize, horizontal);\n var fragSrc = generateBlurFragSource(kernelSize);\n\n Filter.call(\n // vertex shader\n this, vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this._quality = 0;\n\n this.quality = quality || 4;\n\n this.blur = strength || 8;\n }\n\n if ( Filter ) BlurFilterPass.__proto__ = Filter;\n BlurFilterPass.prototype = Object.create( Filter && Filter.prototype );\n BlurFilterPass.prototype.constructor = BlurFilterPass;\n\n var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true } };\n\n BlurFilterPass.prototype.apply = function apply (filterManager, input, output, clear)\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clear);\n }\n else\n {\n var renderTarget = filterManager.getFilterTexture();\n var renderer = filterManager.renderer;\n\n var flip = input;\n var flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, false);\n\n for (var i = 1; i < this.passes - 1; i++)\n {\n renderer.renderTexture.bind(flip, flip.filterFrame);\n\n this.uniforms.uSampler = flop;\n\n var temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clear);\n filterManager.returnFilterTexture(renderTarget);\n }\n };\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n prototypeAccessors.blur.get = function ()\n {\n return this.strength;\n };\n\n prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n };\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n prototypeAccessors.quality.get = function ()\n {\n return this._quality;\n };\n\n prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._quality = value;\n this.passes = value;\n };\n\n Object.defineProperties( BlurFilterPass.prototype, prototypeAccessors );\n\n return BlurFilterPass;\n}(Filter));\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar BlurFilter = /*@__PURE__*/(function (Filter) {\n function BlurFilter(strength, quality, resolution, kernelSize)\n {\n Filter.call(this);\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution || settings.RESOLUTION;\n this.quality = quality || 4;\n this.blur = strength || 8;\n\n this.repeatEdgePixels = false;\n }\n\n if ( Filter ) BlurFilter.__proto__ = Filter;\n BlurFilter.prototype = Object.create( Filter && Filter.prototype );\n BlurFilter.prototype.constructor = BlurFilter;\n\n var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true },blurX: { configurable: true },blurY: { configurable: true },blendMode: { configurable: true },repeatEdgePixels: { configurable: true } };\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n */\n BlurFilter.prototype.apply = function apply (filterManager, input, output, clear)\n {\n var xStrength = Math.abs(this.blurXFilter.strength);\n var yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n var renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, true);\n this.blurYFilter.apply(filterManager, renderTarget, output, clear);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clear);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clear);\n }\n };\n\n BlurFilter.prototype.updatePadding = function updatePadding ()\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n };\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n prototypeAccessors.blur.get = function ()\n {\n return this.blurXFilter.blur;\n };\n\n prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n };\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n prototypeAccessors.quality.get = function ()\n {\n return this.blurXFilter.quality;\n };\n\n prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n };\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n prototypeAccessors.blurX.get = function ()\n {\n return this.blurXFilter.blur;\n };\n\n prototypeAccessors.blurX.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n };\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n prototypeAccessors.blurY.get = function ()\n {\n return this.blurYFilter.blur;\n };\n\n prototypeAccessors.blurY.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n };\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n prototypeAccessors.blendMode.get = function ()\n {\n return this.blurYFilter.blendMode;\n };\n\n prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.blurYFilter.blendMode = value;\n };\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {bool}\n * @default false\n */\n prototypeAccessors.repeatEdgePixels.get = function ()\n {\n return this._repeatEdgePixels;\n };\n\n prototypeAccessors.repeatEdgePixels.set = function (value)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n };\n\n Object.defineProperties( BlurFilter.prototype, prototypeAccessors );\n\n return BlurFilter;\n}(Filter));\n\nexport { BlurFilter, BlurFilterPass };\n//# sourceMappingURL=filter-blur.es.js.map\n","/*!\n * @pixi/filter-color-matrix - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-color-matrix is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter, defaultFilterVertex } from '@pixi/core';\n\nvar fragment = \"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\";\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar ColorMatrixFilter = /*@__PURE__*/(function (Filter) {\n function ColorMatrixFilter()\n {\n var uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n Filter.call(this, defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n if ( Filter ) ColorMatrixFilter.__proto__ = Filter;\n ColorMatrixFilter.prototype = Object.create( Filter && Filter.prototype );\n ColorMatrixFilter.prototype.constructor = ColorMatrixFilter;\n\n var prototypeAccessors = { matrix: { configurable: true },alpha: { configurable: true } };\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype._loadMatrix = function _loadMatrix (matrix, multiply)\n {\n if ( multiply === void 0 ) multiply = false;\n\n var newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix);\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n };\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n ColorMatrixFilter.prototype._multiply = function _multiply (out, a, b)\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n };\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n ColorMatrixFilter.prototype._colorMatrix = function _colorMatrix (matrix)\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n var m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m;\n };\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.brightness = function brightness (b, multiply)\n {\n var matrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.greyscale = function greyscale (scale, multiply)\n {\n var matrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.blackAndWhite = function blackAndWhite (multiply)\n {\n var matrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.hue = function hue (rotation, multiply)\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n var cosR = Math.cos(rotation);\n var sinR = Math.sin(rotation);\n var sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n var w = 1 / 3;\n var sqrW = sqrt(w); // weight is\n\n var a00 = cosR + ((1.0 - cosR) * w);\n var a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n var a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n var a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n var a11 = cosR + (w * (1.0 - cosR));\n var a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n var a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n var a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n var a22 = cosR + (w * (1.0 - cosR));\n\n var matrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.contrast = function contrast (amount, multiply)\n {\n var v = (amount || 0) + 1;\n var o = -0.5 * (v - 1);\n\n var matrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.saturate = function saturate (amount, multiply)\n {\n if ( amount === void 0 ) amount = 0;\n\n var x = (amount * 2 / 3) + 1;\n var y = ((x - 1) * -0.5);\n\n var matrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n ColorMatrixFilter.prototype.desaturate = function desaturate () // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n };\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.negative = function negative (multiply)\n {\n var matrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.sepia = function sepia (multiply)\n {\n var matrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.technicolor = function technicolor (multiply)\n {\n var matrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.polaroid = function polaroid (multiply)\n {\n var matrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.toBGR = function toBGR (multiply)\n {\n var matrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.kodachrome = function kodachrome (multiply)\n {\n var matrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.browni = function browni (multiply)\n {\n var matrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.vintage = function vintage (multiply)\n {\n var matrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {string} lightColor - Tone values, example: `0xFFE580`\n * @param {string} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.colorTone = function colorTone (desaturation, toned, lightColor, darkColor, multiply)\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n var lR = ((lightColor >> 16) & 0xFF) / 255;\n var lG = ((lightColor >> 8) & 0xFF) / 255;\n var lB = (lightColor & 0xFF) / 255;\n\n var dR = ((darkColor >> 16) & 0xFF) / 255;\n var dG = ((darkColor >> 8) & 0xFF) / 255;\n var dB = (darkColor & 0xFF) / 255;\n\n var matrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.night = function night (intensity, multiply)\n {\n intensity = intensity || 0.1;\n var matrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.predator = function predator (amount, multiply)\n {\n var matrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n ColorMatrixFilter.prototype.lsd = function lsd (multiply)\n {\n var matrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, multiply);\n };\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n ColorMatrixFilter.prototype.reset = function reset ()\n {\n var matrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0 ];\n\n this._loadMatrix(matrix, false);\n };\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n prototypeAccessors.matrix.get = function ()\n {\n return this.uniforms.m;\n };\n\n prototypeAccessors.matrix.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.m = value;\n };\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n prototypeAccessors.alpha.get = function ()\n {\n return this.uniforms.uAlpha;\n };\n\n prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uAlpha = value;\n };\n\n Object.defineProperties( ColorMatrixFilter.prototype, prototypeAccessors );\n\n return ColorMatrixFilter;\n}(Filter));\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n\nexport { ColorMatrixFilter };\n//# sourceMappingURL=filter-color-matrix.es.js.map\n","/*!\n * @pixi/filter-displacement - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-displacement is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\n\nvar vertex = \"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\";\n\nvar fragment = \"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\";\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar DisplacementFilter = /*@__PURE__*/(function (Filter) {\n function DisplacementFilter(sprite, scale)\n {\n var maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n Filter.call(this, vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n if ( Filter ) DisplacementFilter.__proto__ = Filter;\n DisplacementFilter.prototype = Object.create( Filter && Filter.prototype );\n DisplacementFilter.prototype.constructor = DisplacementFilter;\n\n var prototypeAccessors = { map: { configurable: true } };\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {boolean} clear - Should the output be cleared before rendering to it.\n */\n DisplacementFilter.prototype.apply = function apply (filterManager, input, output, clear)\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n var wt = this.maskSprite.transform.worldTransform;\n var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clear);\n };\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n prototypeAccessors.map.get = function ()\n {\n return this.uniforms.mapSampler;\n };\n\n prototypeAccessors.map.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.mapSampler = value;\n };\n\n Object.defineProperties( DisplacementFilter.prototype, prototypeAccessors );\n\n return DisplacementFilter;\n}(Filter));\n\nexport { DisplacementFilter };\n//# sourceMappingURL=filter-displacement.es.js.map\n","/*!\n * @pixi/filter-fxaa - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-fxaa is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter } from '@pixi/core';\n\nvar vertex = \"\\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\";\n\nvar fragment = \"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\";\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nvar FXAAFilter = /*@__PURE__*/(function (Filter) {\n function FXAAFilter()\n {\n // TODO - needs work\n Filter.call(this, vertex, fragment);\n }\n\n if ( Filter ) FXAAFilter.__proto__ = Filter;\n FXAAFilter.prototype = Object.create( Filter && Filter.prototype );\n FXAAFilter.prototype.constructor = FXAAFilter;\n\n return FXAAFilter;\n}(Filter));\n\nexport { FXAAFilter };\n//# sourceMappingURL=filter-fxaa.es.js.map\n","/*!\n * @pixi/filter-noise - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/filter-noise is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Filter, defaultFilterVertex } from '@pixi/core';\n\nvar fragment = \"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\";\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nvar NoiseFilter = /*@__PURE__*/(function (Filter) {\n function NoiseFilter(noise, seed)\n {\n if ( noise === void 0 ) noise = 0.5;\n if ( seed === void 0 ) seed = Math.random();\n\n Filter.call(this, defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n if ( Filter ) NoiseFilter.__proto__ = Filter;\n NoiseFilter.prototype = Object.create( Filter && Filter.prototype );\n NoiseFilter.prototype.constructor = NoiseFilter;\n\n var prototypeAccessors = { noise: { configurable: true },seed: { configurable: true } };\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n prototypeAccessors.noise.get = function ()\n {\n return this.uniforms.uNoise;\n };\n\n prototypeAccessors.noise.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uNoise = value;\n };\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n prototypeAccessors.seed.get = function ()\n {\n return this.uniforms.uSeed;\n };\n\n prototypeAccessors.seed.set = function (value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uSeed = value;\n };\n\n Object.defineProperties( NoiseFilter.prototype, prototypeAccessors );\n\n return NoiseFilter;\n}(Filter));\n\nexport { NoiseFilter };\n//# sourceMappingURL=filter-noise.es.js.map\n","/*!\n * @pixi/mixin-cache-as-bitmap - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { RenderTexture, BaseTexture, Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { DisplayObject } from '@pixi/display';\nimport { Matrix } from '@pixi/math';\nimport { uid } from '@pixi/utils';\nimport { settings } from '@pixi/settings';\n\nvar _tempMatrix = new Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = false;\n\n// figured theres no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nvar CacheData = function CacheData()\n{\n this.textureCacheId = null;\n\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalHitTest = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.sprite = null;\n};\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get: function get()\n {\n return this._cacheAsBitmap;\n },\n set: function set(value)\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n var data;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCached = function _renderCached(renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._render(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer)\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n var cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n var bounds = this.getLocalBounds().clone();\n\n // add some padding!\n if (this.filters)\n {\n var padding = this.filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n var cachedRenderTexture = renderer.renderTexture.current;\n var cachedSourceFrame = renderer.renderTexture.sourceFrame;\n var cachedProjectionTransform = renderer.projection.transform;\n\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n var renderTexture = RenderTexture.create(bounds.width, bounds.height);\n\n var textureCacheId = \"cacheAsBitmap_\" + (uid());\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n var m = _tempMatrix;\n\n m.tx = -bounds.x;\n m.ty = -bounds.y;\n\n // reset\n this.transform.worldTransform.identity();\n\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n\n renderer.render(this, renderTexture, true, m, true);\n\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);\n\n // renderer.filterManager.filterStack = stack;\n\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n var cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = renderer._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer)\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n var bounds = this.getLocalBounds();\n\n var cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n var cachedRenderTarget = renderer.context;\n\n bounds.ceil(settings.RESOLUTION);\n\n var renderTexture = RenderTexture.create(bounds.width, bounds.height);\n\n var textureCacheId = \"cacheAsBitmap_\" + (uid());\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n var m = _tempMatrix;\n\n this.transform.localTransform.copyTo(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n // renderTexture.render(this, m, true);\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n var cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = renderer._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds()\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite._calculateBounds();\n this._lastBoundsID = this._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds()\n{\n return this._cacheData.sprite.getLocalBounds();\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject()\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options)\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n//# sourceMappingURL=mixin-cache-as-bitmap.es.js.map\n","/*!\n * @pixi/mixin-get-child-by-name - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/mixin-get-child-by-name is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { DisplayObject, Container } from '@pixi/display';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\nDisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\nContainer.prototype.getChildByName = function getChildByName(name)\n{\n for (var i = 0; i < this.children.length; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n return null;\n};\n//# sourceMappingURL=mixin-get-child-by-name.es.js.map\n","/*!\n * @pixi/mixin-get-global-position - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/mixin-get-global-position is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { DisplayObject } from '@pixi/display';\nimport { Point } from '@pixi/math';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\nDisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate)\n{\n if ( point === void 0 ) point = new Point();\n if ( skipUpdate === void 0 ) skipUpdate = false;\n\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n//# sourceMappingURL=mixin-get-global-position.es.js.map\n","/*!\n * @pixi/mesh - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/mesh is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { State, Shader, Program, TextureMatrix, Geometry, Buffer } from '@pixi/core';\nimport { Point, Polygon, Matrix } from '@pixi/math';\nimport { DRAW_MODES, BLEND_MODES, TYPES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { premultiplyTintToRgba } from '@pixi/utils';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nvar MeshBatchUvs = function MeshBatchUvs(uvBuffer, uvMatrix)\n{\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n};\n\n/**\n * updates\n *\n * @param {boolean} forceUpdate - force the update\n */\nMeshBatchUvs.prototype.update = function update (forceUpdate)\n{\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID)\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n var data = this.uvBuffer.data;\n\n if (!this.data || this.data.length !== data.length)\n {\n this.data = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n};\n\nvar tempPoint = new Point();\nvar tempPolygon = new Polygon();\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nvar Mesh = /*@__PURE__*/(function (Container) {\n function Mesh(geometry, shader, state, drawMode)// vertices, uvs, indices, drawMode)\n {\n if ( drawMode === void 0 ) drawMode = DRAW_MODES.TRIANGLES;\n\n Container.call(this);\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n this.geometry = geometry;\n\n geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n this.shader = shader;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = state || State.for2d();\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n this.drawMode = drawMode;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n this.start = 0;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n this.size = 0;\n\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n this.uvs = null;\n\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n this.indices = null;\n\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n this.vertexData = new Float32Array(1);\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n this.vertexDirty = 0;\n\n this._transformID = -1;\n\n // Inherited from DisplayMode, set defaults\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n this.batchUvs = null;\n }\n\n if ( Container ) Mesh.__proto__ = Container;\n Mesh.prototype = Object.create( Container && Container.prototype );\n Mesh.prototype.constructor = Mesh;\n\n var prototypeAccessors = { uvBuffer: { configurable: true },verticesBuffer: { configurable: true },material: { configurable: true },blendMode: { configurable: true },roundPixels: { configurable: true },tint: { configurable: true },texture: { configurable: true } };\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n prototypeAccessors.uvBuffer.get = function ()\n {\n return this.geometry.buffers[1];\n };\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n prototypeAccessors.verticesBuffer.get = function ()\n {\n return this.geometry.buffers[0];\n };\n\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n prototypeAccessors.material.set = function (value)\n {\n this.shader = value;\n };\n\n prototypeAccessors.material.get = function ()\n {\n return this.shader;\n };\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n prototypeAccessors.blendMode.set = function (value)\n {\n this.state.blendMode = value;\n };\n\n prototypeAccessors.blendMode.get = function ()\n {\n return this.state.blendMode;\n };\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n prototypeAccessors.roundPixels.set = function (value)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n };\n\n prototypeAccessors.roundPixels.get = function ()\n {\n return this._roundPixels;\n };\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n prototypeAccessors.tint.get = function ()\n {\n return this.shader.tint;\n };\n\n prototypeAccessors.tint.set = function (value)\n {\n this.shader.tint = value;\n };\n\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n prototypeAccessors.texture.get = function ()\n {\n return this.shader.texture;\n };\n\n prototypeAccessors.texture.set = function (value)\n {\n this.shader.texture = value;\n };\n\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._render = function _render (renderer)\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n var vertices = this.geometry.buffers[0].data;\n\n // TODO benchmark check for attribute size..\n if (this.shader.batchable && this.drawMode === DRAW_MODES.TRIANGLES && vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n };\n\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._renderDefault = function _renderDefault (renderer)\n {\n var shader = this.shader;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n if (shader.program.uniformData.translationMatrix)\n {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n };\n\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n Mesh.prototype._renderToBatch = function _renderToBatch (renderer)\n {\n var geometry = this.geometry;\n\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n\n var pluginName = this.material.pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n };\n\n /**\n * Updates vertexData field based on transform and vertices\n */\n Mesh.prototype.calculateVertices = function calculateVertices ()\n {\n var geometry = this.geometry;\n var vertices = geometry.buffers[0].data;\n\n if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n var wt = this.transform.worldTransform;\n var a = wt.a;\n var b = wt.b;\n var c = wt.c;\n var d = wt.d;\n var tx = wt.tx;\n var ty = wt.ty;\n\n var vertexData = this.vertexData;\n\n for (var i = 0; i < vertexData.length / 2; i++)\n {\n var x = vertices[(i * 2)];\n var y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n for (var i$1 = 0; i$1 < vertexData.length; i$1++)\n {\n vertexData[i$1] = Math.round(vertexData[i$1]);\n }\n }\n\n this.vertexDirty = geometry.vertexDirtyId;\n };\n\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n Mesh.prototype.calculateUvs = function calculateUvs ()\n {\n var geomUvs = this.geometry.buffers[1];\n\n if (!this.shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data;\n }\n };\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n Mesh.prototype._calculateBounds = function _calculateBounds ()\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n };\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.Point} point the point to test\n * @return {boolean} the result of the test\n */\n Mesh.prototype.containsPoint = function containsPoint (point)\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n var vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n var points = tempPolygon.points;\n var indices = this.geometry.getIndex().data;\n var len = indices.length;\n var step = this.drawMode === 4 ? 3 : 1;\n\n for (var i = 0; i + 2 < len; i += step)\n {\n var ind0 = indices[i] * 2;\n var ind1 = indices[i + 1] * 2;\n var ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n };\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n Mesh.prototype.destroy = function destroy (options)\n {\n Container.prototype.destroy.call(this, options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n this.geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n };\n\n Object.defineProperties( Mesh.prototype, prototypeAccessors );\n\n return Mesh;\n}(Container));\n\n/**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\nMesh.BATCHABLE_SIZE = 100;\n\nvar vertex = \"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\";\n\nvar fragment = \"varying vec2 vTextureCoord;\\nuniform vec4 uColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\\n}\\n\";\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nvar MeshMaterial = /*@__PURE__*/(function (Shader) {\n function MeshMaterial(uSampler, options)\n {\n var uniforms = {\n uSampler: uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n Shader.call(this, options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n if ( Shader ) MeshMaterial.__proto__ = Shader;\n MeshMaterial.prototype = Object.create( Shader && Shader.prototype );\n MeshMaterial.prototype.constructor = MeshMaterial;\n\n var prototypeAccessors = { texture: { configurable: true },alpha: { configurable: true },tint: { configurable: true } };\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n prototypeAccessors.texture.get = function ()\n {\n return this.uniforms.uSampler;\n };\n prototypeAccessors.texture.set = function (value)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n };\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n prototypeAccessors.alpha.set = function (value)\n {\n if (value === this._alpha) { return; }\n\n this._alpha = value;\n this._colorDirty = true;\n };\n prototypeAccessors.alpha.get = function ()\n {\n return this._alpha;\n };\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n prototypeAccessors.tint.set = function (value)\n {\n if (value === this._tint) { return; }\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n };\n prototypeAccessors.tint.get = function ()\n {\n return this._tint;\n };\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n MeshMaterial.prototype.update = function update ()\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n var baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode);\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n };\n\n Object.defineProperties( MeshMaterial.prototype, prototypeAccessors );\n\n return MeshMaterial;\n}(Shader));\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nvar MeshGeometry = /*@__PURE__*/(function (Geometry) {\n function MeshGeometry(vertices, uvs, index)\n {\n Geometry.call(this);\n\n var verticesBuffer = new Buffer(vertices);\n var uvsBuffer = new Buffer(uvs, true);\n var indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n if ( Geometry ) MeshGeometry.__proto__ = Geometry;\n MeshGeometry.prototype = Object.create( Geometry && Geometry.prototype );\n MeshGeometry.prototype.constructor = MeshGeometry;\n\n var prototypeAccessors = { vertexDirtyId: { configurable: true } };\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n prototypeAccessors.vertexDirtyId.get = function ()\n {\n return this.buffers[0]._updateID;\n };\n\n Object.defineProperties( MeshGeometry.prototype, prototypeAccessors );\n\n return MeshGeometry;\n}(Geometry));\n\nexport { Mesh, MeshBatchUvs, MeshGeometry, MeshMaterial };\n//# sourceMappingURL=mesh.es.js.map\n","/*!\n * @pixi/mesh-extras - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/mesh-extras is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { MeshGeometry, Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\n\nvar PlaneGeometry = /*@__PURE__*/(function (MeshGeometry) {\n function PlaneGeometry(width, height, segWidth, segHeight)\n {\n if ( width === void 0 ) width = 100;\n if ( height === void 0 ) height = 100;\n if ( segWidth === void 0 ) segWidth = 10;\n if ( segHeight === void 0 ) segHeight = 10;\n\n MeshGeometry.call(this);\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n if ( MeshGeometry ) PlaneGeometry.__proto__ = MeshGeometry;\n PlaneGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype );\n PlaneGeometry.prototype.constructor = PlaneGeometry;\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n PlaneGeometry.prototype.build = function build ()\n {\n var total = this.segWidth * this.segHeight;\n var verts = [];\n var uvs = [];\n var indices = [];\n\n var segmentsX = this.segWidth - 1;\n var segmentsY = this.segHeight - 1;\n\n var sizeX = (this.width) / segmentsX;\n var sizeY = (this.height) / segmentsY;\n\n for (var i = 0; i < total; i++)\n {\n var x = (i % this.segWidth);\n var y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n var totalSub = segmentsX * segmentsY;\n\n for (var i$1 = 0; i$1 < totalSub; i$1++)\n {\n var xpos = i$1 % segmentsX;\n var ypos = (i$1 / segmentsX) | 0;\n\n var value = (ypos * this.segWidth) + xpos;\n var value2 = (ypos * this.segWidth) + xpos + 1;\n var value3 = ((ypos + 1) * this.segWidth) + xpos;\n var value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n };\n\n return PlaneGeometry;\n}(MeshGeometry));\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nvar RopeGeometry = /*@__PURE__*/(function (MeshGeometry) {\n function RopeGeometry(width, points, textureScale)\n {\n if ( width === void 0 ) width = 200;\n if ( textureScale === void 0 ) textureScale = 0;\n\n MeshGeometry.call(this, new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this.width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n if ( MeshGeometry ) RopeGeometry.__proto__ = MeshGeometry;\n RopeGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype );\n RopeGeometry.prototype.constructor = RopeGeometry;\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n RopeGeometry.prototype.build = function build ()\n {\n var points = this.points;\n\n if (!points) { return; }\n\n var vertexBuffer = this.getBuffer('aVertexPosition');\n var uvBuffer = this.getBuffer('aTextureCoord');\n var indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n var uvs = uvBuffer.data;\n var indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n var amount = 0;\n var prev = points[0];\n var textureWidth = this.width * this.textureScale;\n var total = points.length; // - 1;\n\n for (var i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n var index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n var dx = prev.x - points[i].x;\n var dy = prev.y - points[i].y;\n var distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n var indexCount = 0;\n\n for (var i$1 = 0; i$1 < total - 1; i$1++)\n {\n var index$1 = i$1 * 2;\n\n indices[indexCount++] = index$1;\n indices[indexCount++] = index$1 + 1;\n indices[indexCount++] = index$1 + 2;\n\n indices[indexCount++] = index$1 + 2;\n indices[indexCount++] = index$1 + 1;\n indices[indexCount++] = index$1 + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n };\n\n /**\n * refreshes vertices of Rope mesh\n */\n RopeGeometry.prototype.updateVertices = function updateVertices ()\n {\n var points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n var lastPoint = points[0];\n var nextPoint;\n var perpX = 0;\n var perpY = 0;\n\n var vertices = this.buffers[0].data;\n var total = points.length;\n\n for (var i = 0; i < total; i++)\n {\n var point = points[i];\n var index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n var num = this.textureScale > 0 ? this.textureScale * this.width / 2 : this.width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n };\n\n RopeGeometry.prototype.update = function update ()\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n };\n\n return RopeGeometry;\n}(MeshGeometry));\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nvar SimpleRope = /*@__PURE__*/(function (Mesh) {\n function SimpleRope(texture, points, textureScale)\n {\n if ( textureScale === void 0 ) textureScale = 0;\n\n var ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n var meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n Mesh.call(this, ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n if ( Mesh ) SimpleRope.__proto__ = Mesh;\n SimpleRope.prototype = Object.create( Mesh && Mesh.prototype );\n SimpleRope.prototype.constructor = SimpleRope;\n\n SimpleRope.prototype._render = function _render (renderer)\n {\n if (this.autoUpdate\n || this.geometry.width !== this.shader.texture.height)\n {\n this.geometry.width = this.shader.texture.height;\n this.geometry.update();\n }\n\n Mesh.prototype._render.call(this, renderer);\n };\n\n return SimpleRope;\n}(Mesh));\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nvar SimplePlane = /*@__PURE__*/(function (Mesh) {\n function SimplePlane(texture, verticesX, verticesY)\n {\n var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n var meshMaterial = new MeshMaterial(Texture.WHITE);\n\n Mesh.call(this, planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n if ( Mesh ) SimplePlane.__proto__ = Mesh;\n SimplePlane.prototype = Object.create( Mesh && Mesh.prototype );\n SimplePlane.prototype.constructor = SimplePlane;\n\n var prototypeAccessors = { texture: { configurable: true } };\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n SimplePlane.prototype.textureUpdated = function textureUpdated ()\n {\n this._textureID = this.shader.texture._updateID;\n\n this.geometry.width = this.shader.texture.width;\n this.geometry.height = this.shader.texture.height;\n\n this.geometry.build();\n };\n\n prototypeAccessors.texture.set = function (value)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n };\n\n prototypeAccessors.texture.get = function ()\n {\n return this.shader.texture;\n };\n\n SimplePlane.prototype._render = function _render (renderer)\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n Mesh.prototype._render.call(this, renderer);\n };\n\n Object.defineProperties( SimplePlane.prototype, prototypeAccessors );\n\n return SimplePlane;\n}(Mesh));\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nvar SimpleMesh = /*@__PURE__*/(function (Mesh) {\n function SimpleMesh(texture, vertices, uvs, indices, drawMode)\n {\n if ( texture === void 0 ) texture = Texture.EMPTY;\n\n var geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n var meshMaterial = new MeshMaterial(texture);\n\n Mesh.call(this, geometry, meshMaterial, null, drawMode);\n\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n if ( Mesh ) SimpleMesh.__proto__ = Mesh;\n SimpleMesh.prototype = Object.create( Mesh && Mesh.prototype );\n SimpleMesh.prototype.constructor = SimpleMesh;\n\n var prototypeAccessors = { vertices: { configurable: true } };\n\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n prototypeAccessors.vertices.get = function ()\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n };\n prototypeAccessors.vertices.set = function (value)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n };\n\n SimpleMesh.prototype._render = function _render (renderer)\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n Mesh.prototype._render.call(this, renderer);\n };\n\n Object.defineProperties( SimpleMesh.prototype, prototypeAccessors );\n\n return SimpleMesh;\n}(Mesh));\n\nvar DEFAULT_BORDER_SIZE = 10;\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *
\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nvar NineSlicePlane = /*@__PURE__*/(function (SimplePlane) {\n function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight)\n {\n SimplePlane.call(this, Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n if ( SimplePlane ) NineSlicePlane.__proto__ = SimplePlane;\n NineSlicePlane.prototype = Object.create( SimplePlane && SimplePlane.prototype );\n NineSlicePlane.prototype.constructor = NineSlicePlane;\n\n var prototypeAccessors = { vertices: { configurable: true },width: { configurable: true },height: { configurable: true },leftWidth: { configurable: true },rightWidth: { configurable: true },topHeight: { configurable: true },bottomHeight: { configurable: true } };\n\n NineSlicePlane.prototype.textureUpdated = function textureUpdated ()\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n };\n\n prototypeAccessors.vertices.get = function ()\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n };\n\n prototypeAccessors.vertices.set = function (value)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n };\n\n /**\n * Updates the horizontal vertices.\n *\n */\n NineSlicePlane.prototype.updateHorizontalVertices = function updateHorizontalVertices ()\n {\n var vertices = this.vertices;\n\n var h = this._topHeight + this._bottomHeight;\n var scale = this._height > h ? 1.0 : this._height / h;\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n };\n\n /**\n * Updates the vertical vertices.\n *\n */\n NineSlicePlane.prototype.updateVerticalVertices = function updateVerticalVertices ()\n {\n var vertices = this.vertices;\n\n var w = this._leftWidth + this._rightWidth;\n var scale = this._width > w ? 1.0 : this._width / w;\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n };\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n prototypeAccessors.width.get = function ()\n {\n return this._width;\n };\n\n prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._width = value;\n this._refresh();\n };\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n prototypeAccessors.height.get = function ()\n {\n return this._height;\n };\n\n prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._height = value;\n this._refresh();\n };\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n prototypeAccessors.leftWidth.get = function ()\n {\n return this._leftWidth;\n };\n\n prototypeAccessors.leftWidth.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._leftWidth = value;\n this._refresh();\n };\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n prototypeAccessors.rightWidth.get = function ()\n {\n return this._rightWidth;\n };\n\n prototypeAccessors.rightWidth.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._rightWidth = value;\n this._refresh();\n };\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n prototypeAccessors.topHeight.get = function ()\n {\n return this._topHeight;\n };\n\n prototypeAccessors.topHeight.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._topHeight = value;\n this._refresh();\n };\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n prototypeAccessors.bottomHeight.get = function ()\n {\n return this._bottomHeight;\n };\n\n prototypeAccessors.bottomHeight.set = function (value) // eslint-disable-line require-jsdoc\n {\n this._bottomHeight = value;\n this._refresh();\n };\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n NineSlicePlane.prototype._refresh = function _refresh ()\n {\n var texture = this.texture;\n\n var uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n var _uvw = 1.0 / this._origWidth;\n var _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n };\n\n Object.defineProperties( NineSlicePlane.prototype, prototypeAccessors );\n\n return NineSlicePlane;\n}(SimplePlane));\n\nexport { NineSlicePlane, PlaneGeometry, RopeGeometry, SimpleMesh, SimplePlane, SimpleRope };\n//# sourceMappingURL=mesh-extras.es.js.map\n","/*!\n * @pixi/sprite-animated - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * @pixi/sprite-animated is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nvar AnimatedSprite = /*@__PURE__*/(function (Sprite) {\n function AnimatedSprite(textures, autoUpdate)\n {\n Sprite.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n this._textures = null;\n\n /**\n * @type {number[]}\n * @private\n */\n this._durations = null;\n\n this.textures = textures;\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate !== false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * Function to call when an AnimatedSprite finishes playing.\n *\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * Function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * Function to call when `loop` is true, and an AnimatedSprite is played and loops around to start again.\n *\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n this.playing = false;\n }\n\n if ( Sprite ) AnimatedSprite.__proto__ = Sprite;\n AnimatedSprite.prototype = Object.create( Sprite && Sprite.prototype );\n AnimatedSprite.prototype.constructor = AnimatedSprite;\n\n var prototypeAccessors = { totalFrames: { configurable: true },textures: { configurable: true },currentFrame: { configurable: true } };\n\n /**\n * Stops the AnimatedSprite.\n *\n */\n AnimatedSprite.prototype.stop = function stop ()\n {\n if (!this.playing)\n {\n return;\n }\n\n this.playing = false;\n if (this._autoUpdate)\n {\n Ticker.shared.remove(this.update, this);\n }\n };\n\n /**\n * Plays the AnimatedSprite.\n *\n */\n AnimatedSprite.prototype.play = function play ()\n {\n if (this.playing)\n {\n return;\n }\n\n this.playing = true;\n if (this._autoUpdate)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n }\n };\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n AnimatedSprite.prototype.gotoAndStop = function gotoAndStop (frameNumber)\n {\n this.stop();\n\n var previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n };\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n AnimatedSprite.prototype.gotoAndPlay = function gotoAndPlay (frameNumber)\n {\n var previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n };\n\n /**\n * Updates the object transform for rendering.\n *\n * @private\n * @param {number} deltaTime - Time since last tick.\n */\n AnimatedSprite.prototype.update = function update (deltaTime)\n {\n var elapsed = this.animationSpeed * deltaTime;\n var previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n var lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n var sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n };\n\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n AnimatedSprite.prototype.updateTexture = function updateTexture ()\n {\n this._texture = this._textures[this.currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n };\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n AnimatedSprite.prototype.destroy = function destroy (options)\n {\n this.stop();\n Sprite.prototype.destroy.call(this, options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n };\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {AnimatedSprite} The new animated sprite with the specified frames.\n */\n AnimatedSprite.fromFrames = function fromFrames (frames)\n {\n var textures = [];\n\n for (var i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n };\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n AnimatedSprite.fromImages = function fromImages (images)\n {\n var textures = [];\n\n for (var i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n };\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n prototypeAccessors.totalFrames.get = function ()\n {\n return this._textures.length;\n };\n\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]}\n */\n prototypeAccessors.textures.get = function ()\n {\n return this._textures;\n };\n\n prototypeAccessors.textures.set = function (value) // eslint-disable-line require-jsdoc\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value;\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (var i = 0; i < value.length; i++)\n {\n this._textures.push(value[i].texture);\n this._durations.push(value[i].time);\n }\n }\n this.gotoAndStop(0);\n this.updateTexture();\n };\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n prototypeAccessors.currentFrame.get = function ()\n {\n var currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n };\n\n Object.defineProperties( AnimatedSprite.prototype, prototypeAccessors );\n\n return AnimatedSprite;\n}(Sprite));\n\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n\nexport { AnimatedSprite };\n//# sourceMappingURL=sprite-animated.es.js.map\n","/*!\n * pixi.js - v5.2.0\n * Compiled Wed, 06 Nov 2019 02:32:43 UTC\n *\n * pixi.js is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport '@pixi/polyfill';\nimport { AccessibilityManager } from '@pixi/accessibility';\nimport * as accessibility from '@pixi/accessibility';\nexport { accessibility };\nimport { Extract } from '@pixi/extract';\nimport * as extract from '@pixi/extract';\nexport { extract };\nimport { InteractionManager } from '@pixi/interaction';\nimport * as interaction from '@pixi/interaction';\nexport { interaction };\nimport { Prepare } from '@pixi/prepare';\nimport * as prepare from '@pixi/prepare';\nexport { prepare };\nimport { deprecation } from '@pixi/utils';\nimport * as utils from '@pixi/utils';\nexport { utils };\nimport { Application } from '@pixi/app';\nexport * from '@pixi/app';\nimport { Renderer, BatchRenderer } from '@pixi/core';\nexport * from '@pixi/core';\nimport { Loader, AppLoaderPlugin } from '@pixi/loaders';\nexport * from '@pixi/loaders';\nimport { ParticleRenderer } from '@pixi/particles';\nexport * from '@pixi/particles';\nimport { SpritesheetLoader } from '@pixi/spritesheet';\nexport * from '@pixi/spritesheet';\nimport { TilingSpriteRenderer } from '@pixi/sprite-tiling';\nexport * from '@pixi/sprite-tiling';\nimport { BitmapFontLoader } from '@pixi/text-bitmap';\nexport * from '@pixi/text-bitmap';\nimport { TickerPlugin } from '@pixi/ticker';\nexport * from '@pixi/ticker';\nimport { AlphaFilter } from '@pixi/filter-alpha';\nimport { BlurFilter, BlurFilterPass } from '@pixi/filter-blur';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { DisplacementFilter } from '@pixi/filter-displacement';\nimport { FXAAFilter } from '@pixi/filter-fxaa';\nimport { NoiseFilter } from '@pixi/filter-noise';\nimport '@pixi/mixin-cache-as-bitmap';\nimport '@pixi/mixin-get-child-by-name';\nimport '@pixi/mixin-get-global-position';\nexport * from '@pixi/constants';\nexport * from '@pixi/display';\nexport * from '@pixi/graphics';\nexport * from '@pixi/math';\nexport * from '@pixi/mesh';\nexport * from '@pixi/mesh-extras';\nexport * from '@pixi/runner';\nexport * from '@pixi/sprite';\nexport * from '@pixi/sprite-animated';\nexport * from '@pixi/text';\nexport * from '@pixi/settings';\n\nvar v5 = '5.0.0';\n\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\nfunction useDeprecated()\n{\n var PIXI = this;\n\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get: function get()\n {\n deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get: function get()\n {\n deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get: function get()\n {\n deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get: function get()\n {\n deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n\n return PIXI.Renderer;\n },\n },\n\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get: function get()\n {\n deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n\n return PIXI.Loader.shared;\n },\n },\n\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get: function get()\n {\n deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n\n return PIXI.systems.FilterSystem;\n },\n },\n\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get: function get()\n {\n deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n\n return PIXI.canvasUtils;\n },\n },\n\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get: function get()\n {\n deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n\n return PIXI.groupD8;\n },\n },\n });\n\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get: function get()\n {\n deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get: function get()\n {\n deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get: function get()\n {\n deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n\n return PIXI.BitmapText;\n },\n },\n });\n\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get: function get()\n {\n deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n\n return PIXI.SVGResource.getSize;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n\n return PIXI.MeshRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get: function get()\n {\n deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n\n return PIXI.ParticleRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get: function get()\n {\n deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get: function get()\n {\n deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n\n return PIXI.Ticker.shared;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @see PIXI.BitmapFontLoader.parse\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has moved to PIXI.BitmapFontLoader.parse');\n\n return PIXI.BitmapFontLoader.parse;\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get: function get()\n {\n deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware)\n {\n deprecation(v5,\n 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'\n );\n\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.extract.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get: function get()\n {\n deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.extract.Extract');\n\n return PIXI.extract.Extract;\n },\n });\n\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.prepare.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get: function get()\n {\n deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.prepare.Prepare');\n\n return PIXI.prepare.Prepare;\n },\n });\n\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer)\n {\n deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n\n this._render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer)\n {\n deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer)\n {\n deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer)\n {\n deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n\n this.renderAdvanced(renderer);\n };\n\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get: function get()\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n\n return 0;\n },\n set: function set()\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n\n var BaseTexture = PIXI.BaseTexture;\n\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTexture.prototype.loadSource = function loadSource(image)\n {\n deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n\n var resource = PIXI.resources.autoDetectResource(image);\n\n resource.internal = true;\n\n this.setResource(resource);\n this.update();\n };\n\n var baseTextureIdDeprecation = false;\n\n Object.defineProperties(BaseTexture.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get: function get()\n {\n deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resource.ImageResource#url\n */\n imageUrl: {\n get: function get()\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n return this.resource && this.resource.url;\n },\n\n set: function set(imageUrl)\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n if (this.resource)\n {\n this.resource.url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get: function get()\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n\n return this.resource && this.resource.source;\n },\n set: function set(source)\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n\n if (this.resource)\n {\n this.resource.source = source;\n }\n },\n },\n\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get: function get()\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set: function set(value)\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get: function get()\n {\n if (!baseTextureIdDeprecation)\n {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n\n return this._batchLocation;\n },\n set: function set(value)\n {\n this._batchLocation = value;\n },\n },\n });\n\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTexture.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale)\n {\n deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n\n var resourceOptions = { scale: scale, crossorigin: crossorigin };\n\n return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });\n };\n\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTexture.fromCanvas = function fromCanvas(canvas, scaleMode)\n {\n deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n\n return BaseTexture.from(canvas, { scaleMode: scaleMode });\n };\n\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTexture.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale)\n {\n deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n\n var resourceOptions = { scale: scale, crossorigin: crossorigin };\n\n return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions });\n };\n\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get: function get()\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set: function set(value)\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(p)\n {\n deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(p)\n {\n deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(p)\n {\n deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(p)\n {\n deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n\n return this.copyTo(p);\n };\n\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(s)\n {\n deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n\n return this.set(s);\n };\n\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget: function getRenderTarget(clear, resolution)\n {\n deprecation(v5,\n 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'\n );\n\n return this.getFilterTexture(resolution);\n },\n\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget: function returnRenderTarget(renderTexture)\n {\n deprecation(v5,\n 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture'\n );\n\n this.returnFilterTexture(renderTexture);\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix: function calculateScreenSpaceMatrix(outputMatrix)\n {\n deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n\n var mappedMatrix = outputMatrix.identity();\n var ref = this.activeState;\n var sourceFrame = ref.sourceFrame;\n var destinationFrame = ref.destinationFrame;\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n\n return mappedMatrix;\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix: function calculateNormalizedScreenSpaceMatrix(outputMatrix)\n {\n deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n\n var ref = this.activeState;\n var sourceFrame = ref.sourceFrame;\n var destinationFrame = ref.destinationFrame;\n var mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n\n var translateScaleX = (destinationFrame.width / sourceFrame.width);\n var translateScaleY = (destinationFrame.height / sourceFrame.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n },\n });\n\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get: function get()\n {\n deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get: function get()\n {\n deprecation(v5, 'PIXI.RenderTexture.size property has been removed');\n\n return this._frame;\n },\n },\n });\n\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n var BlurXFilter = /*@__PURE__*/(function (superclass) {\n function BlurXFilter(strength, quality, resolution, kernelSize)\n {\n deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n superclass.call(this, true, strength, quality, resolution, kernelSize);\n }\n\n if ( superclass ) BlurXFilter.__proto__ = superclass;\n BlurXFilter.prototype = Object.create( superclass && superclass.prototype );\n BlurXFilter.prototype.constructor = BlurXFilter;\n\n return BlurXFilter;\n }(PIXI.filters.BlurFilterPass));\n\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n var BlurYFilter = /*@__PURE__*/(function (superclass) {\n function BlurYFilter(strength, quality, resolution, kernelSize)\n {\n deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n superclass.call(this, false, strength, quality, resolution, kernelSize);\n }\n\n if ( superclass ) BlurYFilter.__proto__ = superclass;\n BlurYFilter.prototype = Object.create( superclass && superclass.prototype );\n BlurYFilter.prototype.constructor = BlurYFilter;\n\n return BlurYFilter;\n }(PIXI.filters.BlurFilterPass));\n\n Object.assign(PIXI.filters, {\n BlurXFilter: BlurXFilter,\n BlurYFilter: BlurYFilter,\n });\n\n var Sprite = PIXI.Sprite;\n var Texture = PIXI.Texture;\n var Graphics = PIXI.Graphics;\n\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!Graphics.prototype.generateCanvasTexture)\n {\n Graphics.prototype.generateCanvasTexture = function generateCanvasTexture()\n {\n deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(PIXI.Graphics.prototype, 'graphicsData', {\n get: function get()\n {\n deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n\n return this.geometry.graphicsData;\n },\n });\n\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name, source, crossorigin, scaleMode)\n {\n deprecation(v5, (\"PIXI.Sprite.\" + name + \" method is deprecated, use PIXI.Sprite.from\"));\n\n return Sprite.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin: crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n Sprite.fromImage = spriteFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n Sprite.fromSVG = spriteFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n Sprite.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n Sprite.fromVideo = spriteFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n Sprite.fromFrame = spriteFrom.bind(null, 'fromFrame');\n\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name, source, crossorigin, scaleMode)\n {\n deprecation(v5, (\"PIXI.Texture.\" + name + \" method is deprecated, use PIXI.Texture.from\"));\n\n return Texture.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin: crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n Texture.fromImage = textureFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n Texture.fromSVG = textureFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n Texture.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n Texture.fromVideo = textureFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n Texture.fromFrame = textureFrom.bind(null, 'fromFrame');\n\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get: function get()\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n return this.autoDensity;\n },\n set: function set(value)\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n this.autoDensity = value;\n },\n });\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get: function get()\n {\n deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n\n return this.texture;\n },\n });\n\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin: function mixin()\n {\n deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin: function delayMixin()\n {\n deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins: function performMixins()\n {\n deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n}\n\n// Install renderer plugins\nRenderer.registerPlugin('accessibility', AccessibilityManager);\nRenderer.registerPlugin('extract', Extract);\nRenderer.registerPlugin('interaction', InteractionManager);\nRenderer.registerPlugin('particle', ParticleRenderer);\nRenderer.registerPlugin('prepare', Prepare);\nRenderer.registerPlugin('batch', BatchRenderer);\nRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n\nLoader.registerPlugin(BitmapFontLoader);\nLoader.registerPlugin(SpritesheetLoader);\n\nApplication.registerPlugin(TickerPlugin);\nApplication.registerPlugin(AppLoaderPlugin);\n\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nvar VERSION = '5.2.0';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nvar filters = {\n AlphaFilter: AlphaFilter,\n BlurFilter: BlurFilter,\n BlurFilterPass: BlurFilterPass,\n ColorMatrixFilter: ColorMatrixFilter,\n DisplacementFilter: DisplacementFilter,\n FXAAFilter: FXAAFilter,\n NoiseFilter: NoiseFilter,\n};\n\nexport { VERSION, filters, useDeprecated };\n//# sourceMappingURL=pixi.es.js.map\n","// TinyColor v1.4.1\n// https://github.com/bgrins/TinyColor\n// Brian Grinstead, MIT License\n\n(function(Math) {\n\nvar trimLeft = /^\\s+/,\n trimRight = /\\s+$/,\n tinyCounter = 0,\n mathRound = Math.round,\n mathMin = Math.min,\n mathMax = Math.max,\n mathRandom = Math.random;\n\nfunction tinycolor (color, opts) {\n\n color = (color) ? color : '';\n opts = opts || { };\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n\n var rgb = inputToRGB(color);\n this._originalInput = color,\n this._r = rgb.r,\n this._g = rgb.g,\n this._b = rgb.b,\n this._a = rgb.a,\n this._roundA = mathRound(100*this._a) / 100,\n this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) { this._r = mathRound(this._r); }\n if (this._g < 1) { this._g = mathRound(this._g); }\n if (this._b < 1) { this._b = mathRound(this._b); }\n\n this._ok = rgb.ok;\n this._tc_id = tinyCounter++;\n}\n\ntinycolor.prototype = {\n isDark: function() {\n return this.getBrightness() < 128;\n },\n isLight: function() {\n return !this.isDark();\n },\n isValid: function() {\n return this._ok;\n },\n getOriginalInput: function() {\n return this._originalInput;\n },\n getFormat: function() {\n return this._format;\n },\n getAlpha: function() {\n return this._a;\n },\n getBrightness: function() {\n //http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n getLuminance: function() {\n //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B;\n RsRGB = rgb.r/255;\n GsRGB = rgb.g/255;\n BsRGB = rgb.b/255;\n\n if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}\n if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}\n if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}\n return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);\n },\n setAlpha: function(value) {\n this._a = boundAlpha(value);\n this._roundA = mathRound(100*this._a) / 100;\n return this;\n },\n toHsv: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };\n },\n toHsvString: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);\n return (this._a == 1) ?\n \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" :\n \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \"+ this._roundA + \")\";\n },\n toHsl: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };\n },\n toHslString: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);\n return (this._a == 1) ?\n \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" :\n \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \"+ this._roundA + \")\";\n },\n toHex: function(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function(allow3Char) {\n return '#' + this.toHex(allow3Char);\n },\n toHex8: function(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function(allow4Char) {\n return '#' + this.toHex8(allow4Char);\n },\n toRgb: function() {\n return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };\n },\n toRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \")\" :\n \"rgba(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function() {\n return { r: mathRound(bound01(this._r, 255) * 100) + \"%\", g: mathRound(bound01(this._g, 255) * 100) + \"%\", b: mathRound(bound01(this._b, 255) * 100) + \"%\", a: this._a };\n },\n toPercentageRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%)\" :\n \"rgba(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function() {\n if (this._a === 0) {\n return \"transparent\";\n }\n\n if (this._a < 1) {\n return false;\n }\n\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function(secondColor) {\n var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n\n return \"progid:DXImageTransform.Microsoft.gradient(\"+gradientType+\"startColorstr=\"+hex8String+\",endColorstr=\"+secondHex8String+\")\";\n },\n toString: function(format) {\n var formatSet = !!format;\n format = format || this._format;\n\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n\n return formattedString || this.toHexString();\n },\n clone: function() {\n return tinycolor(this.toString());\n },\n\n _applyModification: function(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function() {\n return this._applyModification(lighten, arguments);\n },\n brighten: function() {\n return this._applyModification(brighten, arguments);\n },\n darken: function() {\n return this._applyModification(darken, arguments);\n },\n desaturate: function() {\n return this._applyModification(desaturate, arguments);\n },\n saturate: function() {\n return this._applyModification(saturate, arguments);\n },\n greyscale: function() {\n return this._applyModification(greyscale, arguments);\n },\n spin: function() {\n return this._applyModification(spin, arguments);\n },\n\n _applyCombination: function(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function() {\n return this._applyCombination(analogous, arguments);\n },\n complement: function() {\n return this._applyCombination(complement, arguments);\n },\n monochromatic: function() {\n return this._applyCombination(monochromatic, arguments);\n },\n splitcomplement: function() {\n return this._applyCombination(splitcomplement, arguments);\n },\n triad: function() {\n return this._applyCombination(triad, arguments);\n },\n tetrad: function() {\n return this._applyCombination(tetrad, arguments);\n }\n};\n\n// If input is an object, force 1 into \"1.0\" to handle ratios properly\n// String input requires \"1.0\" as input, so 1 will be treated as 1\ntinycolor.fromRatio = function(color, opts) {\n if (typeof color == \"object\") {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color[i];\n }\n else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n\n return tinycolor(color, opts);\n};\n\n// Given a string or object, convert that input to RGB\n// Possible string inputs:\n//\n// \"red\"\n// \"#f00\" or \"f00\"\n// \"#ff0000\" or \"ff0000\"\n// \"#ff000000\" or \"ff000000\"\n// \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n// \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n// \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n// \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n// \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n// \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n// \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n//\nfunction inputToRGB(color) {\n\n var rgb = { r: 0, g: 0, b: 0 };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n\n if (typeof color == \"string\") {\n color = stringInputToObject(color);\n }\n\n if (typeof color == \"object\") {\n if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {\n s = convertToPercentage(color.s);\n v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, s, v);\n ok = true;\n format = \"hsv\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {\n s = convertToPercentage(color.s);\n l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n\n if (color.hasOwnProperty(\"a\")) {\n a = color.a;\n }\n }\n\n a = boundAlpha(a);\n\n return {\n ok: ok,\n format: color.format || format,\n r: mathMin(255, mathMax(rgb.r, 0)),\n g: mathMin(255, mathMax(rgb.g, 0)),\n b: mathMin(255, mathMax(rgb.b, 0)),\n a: a\n };\n}\n\n\n// Conversion Functions\n// --------------------\n\n// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n// \n\n// `rgbToRgb`\n// Handle bounds / percentage checking to conform to CSS color spec\n// \n// *Assumes:* r, g, b in [0, 255] or [0, 1]\n// *Returns:* { r, g, b } in [0, 255]\nfunction rgbToRgb(r, g, b){\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n}\n\n// `rgbToHsl`\n// Converts an RGB color value to HSL.\n// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n// *Returns:* { h, s, l } in [0,1]\nfunction rgbToHsl(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min) {\n h = s = 0; // achromatic\n }\n else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n\n h /= 6;\n }\n\n return { h: h, s: s, l: l };\n}\n\n// `hslToRgb`\n// Converts an HSL color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n\n function hue2rgb(p, q, t) {\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n if(s === 0) {\n r = g = b = l; // achromatic\n }\n else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHsv`\n// Converts an RGB color value to HSV\n// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n// *Returns:* { h, s, v } in [0,1]\nfunction rgbToHsv(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, v = max;\n\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if(max == min) {\n h = 0; // achromatic\n }\n else {\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h, s: s, v: v };\n}\n\n// `hsvToRgb`\n// Converts an HSV color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\n function hsvToRgb(h, s, v) {\n\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n\n var i = Math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHex`\n// Converts an RGB color to hex\n// Assumes r, g, and b are contained in the set [0, 255]\n// Returns a 3 or 6 character hex\nfunction rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToHex`\n// Converts an RGBA color plus alpha transparency to hex\n// Assumes r, g, b are contained in the set [0, 255] and\n// a in [0, 1]. Returns a 4 or 8 character rgba hex\nfunction rgbaToHex(r, g, b, a, allow4Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16)),\n pad2(convertDecimalToHex(a))\n ];\n\n // Return a 4 character hex if possible\n if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToArgbHex`\n// Converts an RGBA color to an ARGB Hex8 string\n// Rarely used, but required for \"toFilter()\"\nfunction rgbaToArgbHex(r, g, b, a) {\n\n var hex = [\n pad2(convertDecimalToHex(a)),\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n return hex.join(\"\");\n}\n\n// `equals`\n// Can be called with any tinycolor input\ntinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) { return false; }\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n};\n\ntinycolor.random = function() {\n return tinycolor.fromRatio({\n r: mathRandom(),\n g: mathRandom(),\n b: mathRandom()\n });\n};\n\n\n// Modification Functions\n// ----------------------\n// Thanks to less.js for some of the basics here\n// \n\nfunction desaturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction saturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction greyscale(color) {\n return tinycolor(color).desaturate(100);\n}\n\nfunction lighten (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\nfunction brighten(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var rgb = tinycolor(color).toRgb();\n rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));\n rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));\n rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));\n return tinycolor(rgb);\n}\n\nfunction darken (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\n// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n// Values outside of this range will be wrapped into this range.\nfunction spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}\n\n// Combination Functions\n// ---------------------\n// Thanks to jQuery xColor for some of the ideas behind these\n// \n\nfunction complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n}\n\nfunction triad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction tetrad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),\n tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})\n ];\n}\n\nfunction analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n\n for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n}\n\nfunction monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h, s = hsv.s, v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n\n while (results--) {\n ret.push(tinycolor({ h: h, s: s, v: v}));\n v = (v + modification) % 1;\n }\n\n return ret;\n}\n\n// Utility Functions\n// ---------------------\n\ntinycolor.mix = function(color1, color2, amount) {\n amount = (amount === 0) ? 0 : (amount || 50);\n\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n\n var p = amount / 100;\n\n var rgba = {\n r: ((rgb2.r - rgb1.r) * p) + rgb1.r,\n g: ((rgb2.g - rgb1.g) * p) + rgb1.g,\n b: ((rgb2.b - rgb1.b) * p) + rgb1.b,\n a: ((rgb2.a - rgb1.a) * p) + rgb1.a\n };\n\n return tinycolor(rgba);\n};\n\n\n// Readability Functions\n// ---------------------\n// false\n// tinycolor.isReadable(\"#000\", \"#111\",{level:\"AA\",size:\"large\"}) => false\ntinycolor.isReadable = function(color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n\n out = false;\n\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n\n};\n\n// `mostReadable`\n// Given a base color and a list of possible foreground or background\n// colors for that base, returns the most readable color.\n// Optionally returns Black or White if the most readable color is unreadable.\n// *Example*\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:false}).toHexString(); // \"#112255\"\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:true}).toHexString(); // \"#ffffff\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"large\"}).toHexString(); // \"#faf3f3\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"small\"}).toHexString(); // \"#ffffff\"\ntinycolor.mostReadable = function(baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size ;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors ;\n level = args.level;\n size = args.size;\n\n for (var i= 0; i < colorList.length ; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n\n if (tinycolor.isReadable(baseColor, bestColor, {\"level\":level,\"size\":size}) || !includeFallbackColors) {\n return bestColor;\n }\n else {\n args.includeFallbackColors=false;\n return tinycolor.mostReadable(baseColor,[\"#fff\", \"#000\"],args);\n }\n};\n\n\n// Big List of Colors\n// ------------------\n// \nvar names = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n};\n\n// Make it easy to access colors via `hexNames[hex]`\nvar hexNames = tinycolor.hexNames = flip(names);\n\n\n// Utilities\n// ---------\n\n// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\nfunction flip(o) {\n var flipped = { };\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n}\n\n// Return a valid alpha value [0,1] with all invalid values being set to 1\nfunction boundAlpha(a) {\n a = parseFloat(a);\n\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n\n return a;\n}\n\n// Take input from [0, n] and return it as [0, 1]\nfunction bound01(n, max) {\n if (isOnePointZero(n)) { n = \"100%\"; }\n\n var processPercent = isPercentage(n);\n n = mathMin(max, mathMax(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if ((Math.abs(n - max) < 0.000001)) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return (n % max) / parseFloat(max);\n}\n\n// Force a number between 0 and 1\nfunction clamp01(val) {\n return mathMin(1, mathMax(0, val));\n}\n\n// Parse a base-16 hex value into a base-10 integer\nfunction parseIntFromHex(val) {\n return parseInt(val, 16);\n}\n\n// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n// \nfunction isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf('.') != -1 && parseFloat(n) === 1;\n}\n\n// Check to see if string passed in is a percentage\nfunction isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}\n\n// Force a hex value to have 2 characters\nfunction pad2(c) {\n return c.length == 1 ? '0' + c : '' + c;\n}\n\n// Replace a decimal with it's percentage value\nfunction convertToPercentage(n) {\n if (n <= 1) {\n n = (n * 100) + \"%\";\n }\n\n return n;\n}\n\n// Converts a decimal to a hex value\nfunction convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n}\n// Converts a hex value to a decimal\nfunction convertHexToDecimal(h) {\n return (parseIntFromHex(h) / 255);\n}\n\nvar matchers = (function() {\n\n // \n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n\n // \n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n})();\n\n// `isValidCSSUnit`\n// Take in a single string / number and check to see if it looks like a CSS unit\n// (see `matchers` above for definition).\nfunction isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}\n\n// `stringInputToObject`\n// Permissive string parsing. Take in a number of formats, and output an object\n// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\nfunction stringInputToObject(color) {\n\n color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n }\n else if (color == 'transparent') {\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\" };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if ((match = matchers.rgb.exec(color))) {\n return { r: match[1], g: match[2], b: match[3] };\n }\n if ((match = matchers.rgba.exec(color))) {\n return { r: match[1], g: match[2], b: match[3], a: match[4] };\n }\n if ((match = matchers.hsl.exec(color))) {\n return { h: match[1], s: match[2], l: match[3] };\n }\n if ((match = matchers.hsla.exec(color))) {\n return { h: match[1], s: match[2], l: match[3], a: match[4] };\n }\n if ((match = matchers.hsv.exec(color))) {\n return { h: match[1], s: match[2], v: match[3] };\n }\n if ((match = matchers.hsva.exec(color))) {\n return { h: match[1], s: match[2], v: match[3], a: match[4] };\n }\n if ((match = matchers.hex8.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex6.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n if ((match = matchers.hex4.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n a: convertHexToDecimal(match[4] + '' + match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex3.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n\n return false;\n}\n\nfunction validateWCAG2Parms(parms) {\n // return valid WCAG2 parms for isReadable.\n // If input parms are invalid, return {\"level\":\"AA\", \"size\":\"small\"}\n var level, size;\n parms = parms || {\"level\":\"AA\", \"size\":\"small\"};\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return {\"level\":level, \"size\":size};\n}\n\n// Node: Export function\nif (typeof module !== \"undefined\" && module.exports) {\n module.exports = tinycolor;\n}\n// AMD/requirejs: Define the module\nelse if (typeof define === 'function' && define.amd) {\n define(function () {return tinycolor;});\n}\n// Browser: Expose to window\nelse {\n window.tinycolor = tinycolor;\n}\n\n})(Math);\n","// yy-counter\n// In-browser counter to watch changeable values like counters or FPS\n// David Figatner\n// (c) YOPEY YOPEY LLC 2017\n// MIT License\n// https://github.com/davidfig/counter\n\nmodule.exports = class Counter\n{\n /**\n * @param {object} [options]\n * @param {string} [options.side=rightbottom] side to place the panel (combination of right/left and bottom/top)\n * @param {number} [options.padding=7px]\n * @param {string} [options.color=white]\n * @param {string} [options.background=rgba(0,0,0,0.5)]\n * @param {*} {options.xxx} where xxx is a CSS style for the div\n */\n constructor(options)\n {\n options = options || {}\n options.side = options.side || 'rightbottom'\n options.side.toLowerCase()\n options.padding = options.padding || '7px'\n options.color = options.color || 'white'\n options.background = options.background || 'rgba(0,0,0,0.5)'\n this.div = document.createElement('div')\n Counter.findParent(options.side).appendChild(this.div)\n for (let style in options)\n {\n if (style !== 'parent' && style !== 'side')\n {\n this.div.style[style] = options[style]\n }\n }\n }\n\n /**\n * find the parent div for one of the corners\n * @param {string} [options.side] side to place the panel (combination of right/left and bottom/top)\n * @return {HTMLElement}\n */\n static findParent(side)\n {\n const styles = []\n let name = 'yy-counter-'\n if (side.indexOf('left') !== -1)\n {\n name += 'left-'\n styles['left'] = 0\n }\n else\n {\n name += 'right-'\n styles['right'] = 0\n }\n if (side.indexOf('top') !== -1)\n {\n name += 'top'\n styles['top'] = 0\n }\n else\n {\n name += 'bottom'\n styles['bottom'] = 0\n }\n const test = document.getElementById(name)\n if (test)\n {\n return test\n }\n const container = document.createElement('div')\n container.id = name\n container.style.overflow = 'hidden'\n container.style.position = 'fixed'\n container.style.zIndex = 10000\n container.style.pointerEvents = 'none'\n container.style.userSelect = 'none'\n for (let style in styles)\n {\n container.style[style] = styles[style]\n }\n document.body.appendChild(container)\n return container\n }\n\n /**\n * replaces the innerHTML of the console\n * @param {string|number} text1\n * @param {string|number} [text2]\n * @param {string|number} [...textn] any number of arguments\n */\n log()\n {\n let s = ''\n for (let arg of arguments)\n {\n s += '
' + arg + '
'\n }\n this.div.innerHTML = s\n }\n\n /**\n * appends to the innerHTML of the console\n * @param {string|number} text1\n * @param {string|number} [text2]\n * @param {string|number} [...textn] any number of arguments\n */\n append()\n {\n let s = this.div.innerHTML\n for (let arg of arguments)\n {\n s += '
' + arg + '
'\n }\n this.div.innerHTML = s\n }\n}","'use strict';\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Color = require('tinycolor2');\nvar Counter = require('yy-counter');\n\nvar STYLES = {\n 'background': 'rgba(0, 0, 0, 0.5)',\n 'color': 'white'\n};\n\nvar STYLES_FPS = {\n 'padding': '0.1em 0.5em'\n};\n\nvar STYLES_METER = {};\n\nmodule.exports = function () {\n /**\r\n * @param {object} [options]\r\n * @param {boolean} [options.meter=true] include a meter with the FPS\r\n * @param {string} [options.side=bottom-right] include any combination of left/right and top/bottom\r\n * @param {number} [options.FPS=60] desired FPS\r\n * @param {number} [options.tolerance=1] minimum tolerance for fluctuations in FPS number\r\n * @param {number} [options.meterWidth=100] width of meter div\r\n * @param {number} [options.meterHeight=25] height of meter div\r\n * @param {number} [options.meterLineHeight=4] height of meter line\r\n * @param {styles[]} [options.styles] CSS styles to apply to the div (in javascript format)\r\n * @param {styles[]} [options.stylesFPS] CSS styles to apply to the FPS text (in javascript format)\r\n * @param {styles[]} [options.stylesMeter] CSS styles to apply to the FPS meter (in javascript format)\r\n * @param {string} [options.text=\" FPS\"] change the text to the right of the FPS\r\n */\n function FPS(options) {\n _classCallCheck(this, FPS);\n\n this.options = options || {};\n this.tolerance = this.options.tolerance || 1;\n this.FPS = this.options.FPS || 60;\n this.meterWidth = this.options.meterWidth || 100;\n this.meterHeight = this.options.meterHeight || 25;\n this.meterLineHeight = this.options.meterLineHeight || 4;\n this.div = document.createElement('div');\n Counter.findParent(this.options.side || 'bottom-right').appendChild(this.div);\n this.style(this.div, STYLES, this.options.styles);\n this.divFPS();\n this.meter = typeof this.options.meter === 'undefined' || this.options.meter;\n this.lastTime = 0;\n this.frameNumber = 0;\n this.lastUpdate = 0;\n this.lastFPS = '--';\n }\n\n /**\r\n * change desired FPS\r\n * @type {number}\r\n */\n\n\n _createClass(FPS, [{\n key: 'remove',\n\n\n /**\r\n * remove meter from DOM\r\n */\n value: function remove() {\n this.div.remove();\n }\n\n /**\r\n * @type {boolean} meter (the FPS graph) is on or off\r\n */\n\n }, {\n key: 'style',\n value: function style(div, style1, style2) {\n for (var style in style1) {\n div.style[style] = style1[style];\n }\n if (style2) {\n for (var _style in style2) {\n div.style[_style] = style2[_style];\n }\n }\n }\n\n /**\r\n * create div for text FPS\r\n * @private\r\n * @param {HTMLElement} div\r\n * @param {object} options (see contructor)\r\n */\n\n }, {\n key: 'divFPS',\n value: function divFPS() {\n var div = this.div;\n var options = this.options;\n var divFPS = document.createElement('div');\n div.appendChild(divFPS);\n this.fpsSpan = document.createElement('span');\n divFPS.appendChild(this.fpsSpan);\n var span = document.createElement('span');\n divFPS.appendChild(span);\n span.innerText = typeof options.text !== 'undefined' ? options.text : ' FPS';\n this.style(div, STYLES_FPS, options.stylesFPS);\n }\n\n /**\r\n * create div for FPS meter\r\n * @private\r\n * @param {HTMLElement} div\r\n * @param {object} options (see contructor)\r\n */\n\n }, {\n key: 'divMeter',\n value: function divMeter() {\n var div = this.div;\n var options = this.options;\n if (!this.meterCanvas) {\n this.meterCanvas = document.createElement('canvas');\n div.appendChild(this.meterCanvas);\n this.meterCanvas.width = this.meterWidth;\n this.meterCanvas.height = this.meterHeight;\n this.meterCanvas.style.width = div.width + 'px';\n this.meterCanvas.style.height = div.height + 'px';\n this.style(this.meterCanvas, STYLES_METER, options.stylesMeter);\n } else {\n this.meterCanvas.style.display = 'block';\n }\n }\n\n /**\r\n * call this at the start of the frame to calculate FPS\r\n */\n\n }, {\n key: 'frame',\n value: function frame() {\n this.frameNumber++;\n var currentTime = performance.now() - this.lastTime;\n\n // skip large differences to remove garbage\n if (currentTime > 500) {\n if (this.lastTime !== 0) {\n this.lastFPS = Math.floor(this.frameNumber / (currentTime / 1000));\n if (this.lastFPS >= this.FPS - this.tolerance && this.lastFPS <= this.FPS + this.tolerance) {\n this.lastFPS = this.FPS;\n }\n }\n this.lastTime = performance.now();\n this.frameNumber = 0;\n }\n this.fpsSpan.innerText = this.lastFPS;\n if (this.meterCanvas && this.lastFPS !== '--') {\n this.meterUpdate(this.lastFPS / this.FPS);\n }\n }\n }, {\n key: 'meterUpdate',\n value: function meterUpdate(percent) {\n var c = this.meterCanvas.getContext('2d');\n var data = c.getImageData(0, 0, this.meterCanvas.width, this.meterCanvas.height);\n c.putImageData(data, -1, 0);\n c.clearRect(this.meterCanvas.width - 1, 0, 1, this.meterCanvas.height);\n if (percent < 0.5) {\n c.fillStyle = Color.mix('#ff0000', '0xffa500', percent * 200).toHexString();\n } else {\n c.fillStyle = Color.mix('#ffa500', '#00ff00', (percent - 0.5) * 200).toHexString();\n }\n var height = (this.meterCanvas.height - this.meterLineHeight) * (1 - percent);\n c.fillRect(this.meterCanvas.width - 1, height, 1, this.meterLineHeight);\n }\n }, {\n key: 'side',\n value: function side(options) {\n if (options.side) {\n options.side = options.side.toLowerCase();\n if (options.side.indexOf('left') !== -1) {\n STYLES['left'] = 0;\n delete STYLES['right'];\n } else {\n STYLES['right'] = 0;\n delete STYLES['left'];\n }\n if (options.side.indexOf('top') !== -1) {\n STYLES['top'] = 0;\n delete STYLES['bottom'];\n } else {\n STYLES['bottom'] = 0;\n delete STYLES['top'];\n }\n } else {\n STYLES['right'] = 0;\n STYLES['bottom'] = 0;\n }\n }\n }, {\n key: 'fps',\n get: function get() {\n return this.FPS;\n },\n set: function set(value) {\n this.FPS = value;\n }\n }, {\n key: 'meter',\n get: function get() {\n return this._meter;\n },\n set: function set(value) {\n if (value) {\n this.divMeter();\n } else if (this.meterCanvas) {\n this.meterCanvas.style.display = 'none';\n }\n }\n }]);\n\n return FPS;\n}();\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZwcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxJQUFNLFFBQVEsUUFBUSxZQUFSLENBQWQ7QUFDQSxJQUFNLFVBQVUsUUFBUSxZQUFSLENBQWhCOztBQUVBLElBQU0sU0FBUztBQUNYLGtCQUFjLG9CQURIO0FBRVgsYUFBUztBQUZFLENBQWY7O0FBS0EsSUFBTSxhQUFhO0FBQ2YsZUFBVztBQURJLENBQW5COztBQUlBLElBQU0sZUFBZSxFQUFyQjs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ICAgIGlmICh2YWx1ZSlcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIHRoaXMuZGl2TWV0ZXIoKVxyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIGlmICh0aGlzLm1ldGVyQ2FudmFzKVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgdGhpcy5tZXRlckNhbnZhcy5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnXHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHN0eWxlKGRpdiwgc3R5bGUxLCBzdHlsZTIpXHJcbiAgICB7XHJcbiAgICAgICAgZm9yIChsZXQgc3R5bGUgaW4gc3R5bGUxKVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgZGl2LnN0eWxlW3N0eWxlXSA9IHN0eWxlMVtzdHlsZV1cclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKHN0eWxlMilcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGZvciAobGV0IHN0eWxlIGluIHN0eWxlMilcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgZGl2LnN0eWxlW3N0eWxlXSA9IHN0eWxlMltzdHlsZV1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIGNyZWF0ZSBkaXYgZm9yIHRleHQgRlBTXHJcbiAgICAgKiBAcHJpdmF0ZVxyXG4gICAgICogQHBhcmFtIHtIVE1MRWxlbWVudH0gZGl2XHJcbiAgICAgKiBAcGFyYW0ge29iamVjdH0gb3B0aW9ucyAoc2VlIGNvbnRydWN0b3IpXHJcbiAgICAgKi9cclxuICAgIGRpdkZQUygpXHJcbiAgICB7XHJcbiAgICAgICAgY29uc3QgZGl2ID0gdGhpcy5kaXZcclxuICAgICAgICBjb25zdCBvcHRpb25zID0gdGhpcy5vcHRpb25zXHJcbiAgICAgICAgY29uc3QgZGl2RlBTID0gZG9jdW1lbnQuY3JlYXRlRWxlbWV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HRoIC0gMSwgMCwgMSwgdGhpcy5tZXRlckNhbnZhcy5oZWlnaHQpXHJcbiAgICAgICAgaWYgKHBlcmNlbnQgPCAwLjUpXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBjLmZpbGxTdHlsZSA9IENvbG9yLm1peCgnI2ZmMDAwMCcsICcweGZmYTUwMCcsIHBlcmNlbnQgKiAyMDApLnRvSGV4U3RyaW5nKClcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgYy5maWxsU3R5bGUgPSBDb2xvci5taXgoJyNmZmE1MDAnLCAnIzAwZmYwMCcsIChwZXJjZW50IC0gMC41KSAqIDIwMCkudG9IZXhTdHJpbmcoKVxyXG4gICAgICAgIH1cclxuICAgICAgICBjb25zdCBoZWlnaHQgPSAodGhpcy5tZXRlckNhbnZhcy5oZWlnaHQgLSB0aGlzLm1ldGVyTGluZUhlaWdodCkgKiAoMSAtIHBlcmNlbnQpXHJcbiAgICAgICAgYy5maWxsUmVjdCh0aGlzLm1ldGVyQ2FudmFzLndpZHRoIC0gMSwgaGVpZ2h0LCAxLCB0aGlzLm1ldGVyTGluZUhlaWdodClcclxuICAgIH1cclxuXHJcbiAgICBzaWRlKG9wdGlvbnMpXHJcbiAgICB7XHJcbiAgICAgICAgaWYgKG9wdGlvbnMuc2lkZSlcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIG9wdGlvbnMuc2lkZSA9IG9wdGlvbnMuc2lkZS50b0xvd2VyQ2FzZSgpXHJcbiAgICAgICAgICAgIGlmIChvcHRpb25zLnNpZGUuaW5kZXhPZignbGVmdCcpICE9PSAtMSlcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgU1RZTEVTWydsZWZ0J10gPSAwXHJcbiAgICAgICAgICAgICAgICBkZWxldGUgU1RZTEVTWydyaWdodCddXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICBTVFlMRVNbJ3JpZ2h0J10gPSAwXHJcbiAgICAgICAgICAgICAgICBkZWxldGUgU1RZTEVTWydsZWZ0J11cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAob3B0aW9ucy5zaWRlLmluZGV4T2YoJ3RvcCcpICE9PSAtMSlcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgU1RZTEVTWyd0b3AnXSA9IDBcclxuICAgICAgICAgICAgICAgIGRlbGV0ZSBTVFlMRVNbJ2JvdHRvbSddXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICBTVFlMRVNbJ2JvdHRvbSddID0gMFxyXG4gICAgICAgICAgICAgICAgZGVsZXRlIFNUWUxFU1sndG9wJ11cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBTVFlMRVNbJ3JpZ2h0J10gPSAwXHJcbiAgICAgICAgICAgIFNUWUxFU1snYm90dG9tJ10gPSAwXHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG59Il19","// A port of an algorithm by Johannes Baagøe , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","export default {};\n","/*\nCopyright 2014 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\n// Detect the global object, even if operating in strict mode.\n// http://stackoverflow.com/a/14387057/265298\nvar global = (0, eval)('this'),\n width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n","'use strict';\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// yy-random\n// by David Figatner\n// MIT license\n// copyright YOPEY YOPEY LLC 2016-17\n// https://github.com/davidfig/random\n\nvar seedrandom = require('seedrandom');\n\nvar Random = function () {\n function Random() {\n _classCallCheck(this, Random);\n\n this.generator = Math.random;\n }\n\n /**\r\n * generates a seeded number\r\n * @param {number} seed\r\n * @param {object} [options]\r\n * @param {string} [PRNG=\"alea\"] - name of algorithm, see https://github.com/davidbau/seedrandom\r\n * @param {(boolean|string)} [state] - can include the state returned from save()\r\n */\n\n\n _createClass(Random, [{\n key: 'seed',\n value: function seed(_seed, options) {\n options = options || {};\n this.generator = seedrandom[options.PRNG || 'alea'](_seed, { state: options.state });\n this.options = options;\n }\n\n /**\r\n * saves the state of the random generator\r\n * can only be used after Random.seed() is called with options.state = true\r\n * @returns {number} state\r\n */\n\n }, {\n key: 'save',\n value: function save() {\n if (this.generator !== Math.random) {\n return this.generator.state();\n }\n }\n\n /**\r\n * restores the state of the random generator\r\n * @param {number} state\r\n */\n\n }, {\n key: 'restore',\n value: function restore(state) {\n this.generator = seedrandom[this.options.PRNG || 'alea']('', { state: state });\n }\n\n /**\r\n * changes the generator to use the old Math.sin-based random function\r\n * based on : http://stackoverflow.com/questions/521295/javascript-random-seeds\r\n * (deprecated) Use only for compatibility purposes\r\n * @param {number} seed\r\n */\n\n }, {\n key: 'seedOld',\n value: function seedOld(seed) {\n this.generator = function () {\n var x = Math.sin(seed++) * 10000;\n return x - Math.floor(x);\n };\n }\n\n /**\r\n * create a separate random generator using the seed\r\n * @param {number} seed\r\n * @return {object}\r\n */\n\n }, {\n key: 'separateSeed',\n value: function separateSeed(seed) {\n var random = new Random();\n random.seed(seed);\n return random;\n }\n\n /**\r\n * resets the random number this.generator to Math.random()\r\n */\n\n }, {\n key: 'reset',\n value: function reset() {\n this.generator = Math.random;\n }\n\n /**\r\n * returns a random number using the this.generator between [0, ceiling - 1]\r\n * @param {number} ceiling\r\n * @param {boolean} [useFloat=false]\r\n * @return {number}\r\n */\n\n }, {\n key: 'get',\n value: function get(ceiling, useFloat) {\n var negative = ceiling < 0 ? -1 : 1;\n ceiling *= negative;\n var result = void 0;\n if (useFloat) {\n result = this.generator() * ceiling;\n } else {\n result = Math.floor(this.generator() * ceiling);\n }\n return result * negative;\n }\n\n /**\r\n * returns a random integer between 0 - Number.MAX_SAFE_INTEGER\r\n * @return {number}\r\n */\n\n }, {\n key: 'getHuge',\n value: function getHuge() {\n return this.get(Number.MAX_SAFE_INTEGER);\n }\n\n /**\r\n * random number [middle - range, middle + range]\r\n * @param {number} middle\r\n * @param {number} delta\r\n * @param {boolean} [useFloat=false]\r\n * @return {number}\r\n */\n\n }, {\n key: 'middle',\n value: function middle(_middle, delta, useFloat) {\n var half = delta / 2;\n return this.range(_middle - half, _middle + half, useFloat);\n }\n\n /**\r\n * random number [start, end]\r\n * @param {number} start\r\n * @param {number} end\r\n * @param {boolean} [useFloat=false] if true, then range is (start, end)--i.e., not inclusive to start and end\r\n * @return {number}\r\n */\n\n }, {\n key: 'range',\n value: function range(start, end, useFloat) {\n // case where there is no range\n if (end === start) {\n return end;\n }\n\n if (useFloat) {\n return this.get(end - start, true) + start;\n } else {\n var range = void 0;\n if (start < 0 && end > 0) {\n range = -start + end + 1;\n } else if (start === 0 && end > 0) {\n range = end + 1;\n } else if (start < 0 && end === 0) {\n range = start - 1;\n start = 1;\n } else if (start < 0 && end < 0) {\n range = end - start - 1;\n } else {\n range = end - start + 1;\n }\n return Math.floor(this.generator() * range) + start;\n }\n }\n\n /**\r\n * an array of random numbers between [start, end]\r\n * @param {number} start\r\n * @param {number} end\r\n * @param {number} count\r\n * @param {boolean} [useFloat=false]\r\n * @return {number[]}\r\n */\n\n }, {\n key: 'rangeMultiple',\n value: function rangeMultiple(start, end, count, useFloat) {\n var array = [];\n for (var i = 0; i < count; i++) {\n array.push(this.range(start, end, useFloat));\n }\n return array;\n }\n\n /**\r\n * an array of random numbers between [middle - range, middle + range]\r\n * @param {number} middle\r\n * @param {number} range\r\n * @param {number} count\r\n * @param {boolean} [useFloat=false]\r\n * @return {number[]}\r\n */\n\n }, {\n key: 'middleMultiple',\n value: function middleMultiple(middle, range, count, useFloat) {\n var array = [];\n for (var i = 0; i < count; i++) {\n array.push(middle(middle, range, useFloat));\n }\n return array;\n }\n\n /**\r\n * @param {number} [chance=0.5]\r\n * returns random sign (either +1 or -1)\r\n * @return {number}\r\n */\n\n }, {\n key: 'sign',\n value: function sign(chance) {\n chance = chance || 0.5;\n return this.generator() < chance ? 1 : -1;\n }\n\n /**\r\n * tells you whether a random chance was achieved\r\n * @param {number} [percent=0.5]\r\n * @return {boolean}\r\n */\n\n }, {\n key: 'chance',\n value: function chance(percent) {\n return this.generator() < (percent || 0.5);\n }\n\n /**\r\n * returns a random angle in radians [0 - 2 * Math.PI)\r\n */\n\n }, {\n key: 'angle',\n value: function angle() {\n return this.get(Math.PI * 2, true);\n }\n\n /**\r\n * Shuffle array (either in place or copied)\r\n * from http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array\r\n * @param {Array} array\r\n * @param {boolean} [copy=false] whether to shuffle in place (default) or return a new shuffled array\r\n * @return {Array} a shuffled array\r\n */\n\n }, {\n key: 'shuffle',\n value: function shuffle(array, copy) {\n if (copy) {\n array = array.slice();\n }\n if (array.length === 0) {\n return array;\n }\n\n var currentIndex = array.length,\n temporaryValue = void 0,\n randomIndex = void 0;\n\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n // Pick a remaining element...\n randomIndex = this.get(currentIndex);\n currentIndex -= 1;\n\n // And swap it with the current element.\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n return array;\n }\n\n /**\r\n * picks a random element from an array\r\n * @param {Array} array\r\n * @return {*}\r\n */\n\n }, {\n key: 'pick',\n value: function pick(array, remove) {\n if (!remove) {\n return array[this.get(array.length)];\n } else {\n var pick = this.get(array.length);\n var temp = array[pick];\n array.splice(pick, 1);\n return temp;\n }\n }\n\n /**\r\n * returns a random property from an object\r\n * from http://stackoverflow.com/questions/2532218/pick-random-property-from-a-javascript-object\r\n * @param {object} obj\r\n * @return {*}\r\n */\n\n }, {\n key: 'property',\n value: function property(obj) {\n var result;\n var count = 0;\n for (var prop in obj) {\n if (this.chance(1 / ++count)) {\n result = prop;\n }\n }\n return result;\n }\n\n /**\r\n * creates a random set where each entry is a value between [min, max]\r\n * @param {number} min\r\n * @param {number} max\r\n * @param {number} amount of numbers in set\r\n * @param {number[]}\r\n */\n\n }, {\n key: 'set',\n value: function set(min, max, amount) {\n var set = [],\n all = [],\n i;\n for (i = min; i < max; i++) {\n all.push(i);\n }\n\n for (i = 0; i < amount; i++) {\n var found = this.get(all.length);\n set.push(all[found]);\n all.splice(found, 1);\n }\n return set;\n }\n\n /**\r\n * returns a set of numbers with a randomly even distribution (i.e., no overlapping and filling the space)\r\n * @param {number} start position\r\n * @param {number} end position\r\n * @param {number} count of non-start/end points\r\n * @param {boolean} [includeStart=false] includes start point (count++)\r\n * @param {boolean} [includeEnd=false] includes end point (count++)\r\n * @param {boolean} [useFloat=false]\r\n * @param {number[]}\r\n */\n\n }, {\n key: 'distribution',\n value: function distribution(start, end, count, includeStart, includeEnd, useFloat) {\n var interval = Math.floor((end - start) / count);\n var halfInterval = interval / 2;\n var quarterInterval = interval / 4;\n var set = [];\n if (includeStart) {\n set.push(start);\n }\n for (var i = 0; i < count; i++) {\n set.push(start + i * interval + halfInterval + this.range(-quarterInterval, quarterInterval, useFloat));\n }\n if (includeEnd) {\n set.push(end);\n }\n return set;\n }\n\n /**\r\n * returns a random number based on weighted probability between [min, max]\r\n * from http://stackoverflow.com/questions/22656126/javascript-random-number-with-weighted-probability\r\n * @param {number} min value\r\n * @param {number} max value\r\n * @param {number} target for average value\r\n * @param {number} stddev - standard deviation\r\n */\n\n }, {\n key: 'weightedProbabilityInt',\n value: function weightedProbabilityInt(min, max, target, stddev) {\n function normRand() {\n var x1 = void 0,\n x2 = void 0,\n rad = void 0;\n do {\n x1 = 2 * this.get(1, true) - 1;\n x2 = 2 * this.get(1, true) - 1;\n rad = x1 * x1 + x2 * x2;\n } while (rad >= 1 || rad === 0);\n var c = Math.sqrt(-2 * Math.log(rad) / rad);\n return x1 * c;\n }\n\n stddev = stddev || 1;\n if (Math.random() < 0.81546) {\n while (true) {\n var sample = normRand() * stddev + target;\n if (sample >= min && sample <= max) {\n return sample;\n }\n }\n } else {\n return this.range(min, max);\n }\n }\n\n /*\r\n * returns a random hex color (0 - 0xffffff)\r\n * @return {number}\r\n */\n\n }, {\n key: 'color',\n value: function color() {\n return this.get(0xffffff);\n }\n }]);\n\n return Random;\n}();\n\nmodule.exports = new Random();\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJhbmRvbS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLElBQU0sYUFBYSxRQUFRLFlBQVIsQ0FBbkI7O0lBRU0sTTtBQUVGLHNCQUNBO0FBQUE7O0FBQ0ksYUFBSyxTQUFMLEdBQWlCLEtBQUssTUFBdEI7QUFDSDs7QUFFRDs7Ozs7Ozs7Ozs7NkJBT0ssSyxFQUFNLE8sRUFDWDtBQUNJLHNCQUFVLFdBQVcsRUFBckI7QUFDQSxpQkFBSyxTQUFMLEdBQWlCLFdBQVcsUUFBUSxJQUFSLElBQWdCLE1BQTNCLEVBQW1DLEtBQW5DLEVBQXlDLEVBQUUsT0FBTyxRQUFRLEtBQWpCLEVBQXpDLENBQWpCO0FBQ0EsaUJBQUssT0FBTCxHQUFlLE9BQWY7QUFDSDs7QUFFRDs7Ozs7Ozs7K0JBTUE7QUFDSSxnQkFBSSxLQUFLL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dCBpbmNsdXNpdmUgdG8gc3RhcnQgYW5kIGVuZFxyXG4gICAgICogQHJldHVybiB7bnVtYmVyfVxyXG4gICAgICovXHJcbiAgICByYW5nZShzdGFydCwgZW5kLCB1c2VGbG9hdClcclxuICAgIHtcclxuICAgICAgICAvLyBjYXNlIHdoZXJlIHRoZXJlIGlzIG5vIHJhbmdlXHJcbiAgICAgICAgaWYgKGVuZCA9PT0gc3RhcnQpXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICByZXR1cm4gZW5kXHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAodXNlRmxvYXQpXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5nZXQoZW5kIC0gc3RhcnQsIHRydWUpICsgc3RhcnRcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgbGV0IHJhbmdlXHJcbiAgICAgICAgICAgIGlmIChzdGFydCA8IDAgJiYgZW5kID4gMClcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgcmFuZ2UgPSAtc3RhcnQgKyBlbmQgKyAxXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAoc3RhcnQgPT09IDAgJiYgZW5kID4gMClcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgcmFuZ2UgPSBlbmQgKyAxXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAoc3RhcnQgPCAwICYmIGVuZCA9PT0gMClcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgcmFuZ2UgPSBzdGFydCAtIDFcclxuICAgICAgICAgICAgICAgIHN0YXJ0ID0gMVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0IDwgMCAmJiBlbmQgPCAwKVxyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICByYW5nZSA9IGVuZCAtIHN0YXJ0IC0gMVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgcmFuZ2UgPSBlbmQgLSBzdGFydCArIDFcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcih0aGlzLmdlbmVyYXRvcigpICogcmFuZ2UpICsgc3RhcnRcclxuICAgICAgICB9XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBhbiBhcnJheSBvZiByYW5kb20gbnVtYmVycyBiZXR3ZWVuIFtzdGFydCwgZW5kXVxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHN0YXJ0XHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gZW5kXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gY291bnRcclxuICAgICAqIEBwYXJhbSB7Ym9vbGVhbn0gW3VzZUZsb2F0PWZhbHNlXVxyXG4gICAgICogQHJldHVybiB7bnVtYmVyW119XHJcbiAgICAgKi9cclxuICAgIHJhbmdlTXVsdGlwbGUoc3RhcnQsIGVuZCwgY291bnQsIHVzZUZsb2F0KVxyXG4gICAge1xyXG4gICAgICAgIHZhciBhcnJheSA9IFtdXHJcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgYXJyYXkucHVzaCh0aGlzLnJhbmdlKHN0YXJ0LCBlbmQsIHVzZUZsb2F0KSlcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIGFycmF5XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBhbiBhcnJheSBvZiByYW5kb20gbnVtYmVycyBiZXR3ZWVuIFttaWRkbGUgLSByYW5nZSwgbWlkZGxlICsgcmFuZ2VdXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWlkZGxlXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gcmFuZ2VcclxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjb3VudFxyXG4gICAgICogQHBhcmFtIHtib29sZWFufSBbdXNlRmxvYXQ9ZmFsc2VdXHJcbiAgICAgKiBAcmV0dXJuIHtudW1iZXJbXX1cclxuICAgICAqL1xyXG4gICAgbWlkZGxlTXVsdGlwbGUobWlkZGxlLCByYW5nZSwgY291bnQsIHVzZUZsb2F0KVxyXG4gICAge1xyXG4gICAgICAgIGNvbnN0IGFycmF5ID0gW11cclxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGNvdW50OyBpKyspXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBhcnJheS5wdXNoKG1pZGRsZShtaWRkbGUsIHJhbmdlLCB1c2VGbG9hdCkpXHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBhcnJheVxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IFtjaGFuY2U9MC41XVxyXG4gICAgICogcmV0dXJucyByYW5kb20gc2lnbiAoZWl0aGVyICsxIG9yIC0xKVxyXG4gICAgICogQHJldHVybiB7bnVtYmVyfVxyXG4gICAgICovXHJcbiAgICBzaWduKGNoYW5jZSlcclxuICAgIHtcclxuICAgICAgICBjaGFuY2UgPSBjaGFuY2UgfHwgMC41XHJcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2VuZXJhdG9yKCkgPCBjaGFuY2UgPyAxIDogLTFcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIHRlbGxzIHlvdSB3aGV0aGVyIGEgcmFuZG9tIGNoYW5jZSB3YXMgYWNoaWV2ZWRcclxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBbcGVyY2VudD0wLjVdXHJcbiAgICAgKiBAcmV0dXJuIHtib29sZWFufVxyXG4gICAgICovXHJcbiAgICBjaGFuY2UocGVyY2VudClcclxuICAgIHtcclxuICAgICAgICByZXR1cm4gdGhpcy5nZW5lcmF0b3IoKSA8IChwZXJjZW50IHx8IDAuNSlcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIHJldHVybnMgYSByYW5kb20gYW5nbGUgaW4gcmFkaWFucyBbMCAtIDIgKiBNYXRoLlBJKVxyXG4gICAgICovXHJcbiAgICBhbmdsZSgpXHJcbiAgICB7XHJcbiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KE1hdGguUEkgKiAyLCB0cnVlKVxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogU2h1ZmZsZSBhcnJheSAoZWl0aGVyIGluIHBsYWNlIG9yIGNvcGllZClcclxuICAgICAqIGZyb20gaHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL3F1ZXN0aW9ucy8yNDUwOTU0L2hvdy10by1yYW5kb21pemUtc2h1ZmZsZS1hLWphdmFzY3JpcHQtYXJyYXlcclxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5XHJcbiAgICAgKiBAcGFyYW0ge2Jvb2xlYW59IFtjb3B5PWZhbHNlXSB3aGV0aGVyIHRvIHNodWZmbGUgaW4gcGxhY2UgKGRlZmF1bHQpIG9yIHJldHVybiBhIG5ldyBzaHVmZmxlZCBhcnJheVxyXG4gICAgICogQHJldHVybiB7QXJyYXl9IGEgc2h1ZmZsZWQgYXJyYXlcclxuICAgICAqL1xyXG4gICAgc2h1ZmZsZShhcnJheSwgY29weSlcclxuICAgIHtcclxuICAgICAgICBpZiAoY29weSlcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGFycmF5ID0gYXJyYXkuc2xpY2UoKVxyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoYXJyYXkubGVuZ3RoID09PSAwKVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgcmV0dXJuIGFycmF5XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBsZXQgY3VycmVudEluZGV4ID0gYXJyYXkubGVuZ3RoLCB0ZW1wb3JhcnlWYWx1ZSwgcmFuZG9tSW5kZXhcclxuXHJcbiAgICAgICAgLy8gV2hpbGUgdGhlcmUgcmVtYWluIGVsZW1lbnRzIHRvIHNodWZmbGUuLi5cclxuICAgICAgICB3aGlsZSAoMCAhPT0gY3VycmVudEluZGV4KVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgLy8gUGljayBhIHJlbWFpbmluZyBlbGVtZW50Li4uXHJcbiAgICAgICAgICAgIHJhbmRvbUluZGV4ID0gdGhpcy5nZXQoY3VycmVudEluZGV4KVxyXG4gICAgICAgICAgICBjdXJyZW50SW5kZXggLT0gMVxyXG5cclxuICAgICAgICAgICAgLy8gQW5kIHN3YXAgaXQgd2l0aCB0aGUgY3VycmVudCBlbGVtZW50LlxyXG4gICAgICAgICAgICB0ZW1wb3JhcnlWYWx1ZSA9IGFycmF5W2N1cnJlbnRJbmRleF1cclxuICAgICAgICAgICAgYXJyYXlbY3VycmVudEluZGV4XSA9IGFycmF5W3JhbmRvbUluZGV4XVxyXG4gICAgICAgICAgICBhcnJheVtyYW5kb21JbmRleF0gPSB0ZW1wb3JhcnlWYWx1ZVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gYXJyYXlcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIHBpY2tzIGEgcmFuZG9tIGVsZW1lbnQgZnJvbSBhbiBhcnJheVxyXG4gICAgICogQHBhcmFtIHtBcnJheX0gYXJyYXlcclxuICAgICAqIEByZXR1cm4geyp9XHJcbiAgICAgKi9cclxuICAgIHBpY2soYXJyYXksIHJlbW92ZSlcclxuICAgIHtcclxuICAgICAgICBpZiAoIXJlbW92ZSlcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIHJldHVybiBhcnJheVt0aGlzLmdldChhcnJheS5sZW5ndGgpXVxyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBjb25zdCBwaWNrID0gdGhpcy5nZXQoYXJyYXkubGVuZ3RoKVxyXG4gICAgICAgICAgICBjb25zdCB0ZW1wID0gYXJyYXlbcGlja11cclxuICAgICAgICAgICAgYXJyYXkuc3BsaWNlKHBpY2ssIDEpXHJcbiAgICAgICAgICAgIHJldHVybiB0ZW1wXHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogcmV0dXJucyBhIHJhbmRvbSBwcm9wZXJ0eSBmcm9tIGFuIG9iamVjdFxyXG4gICAgICogZnJvbSBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzI1MzIyMTgvcGljay1yYW5kb20tcHJvcGVydHktZnJvbS1hLWphdmFzY3JpcHQtb2JqZWN0XHJcbiAgICAgKiBAcGFyYW0ge29iamVjdH0gb2JqXHJcbiAgICAgKiBAcmV0dXJuIHsqfVxyXG4gICAgICovXHJcbiAgICBwcm9wZXJ0eShvYmopXHJcbiAgICB7XHJcbiAgICAgICAgdmFyIHJlc3VsdFxyXG4gICAgICAgIHZhciBjb3VudCA9IDBcclxuICAgICAgICBmb3IgKHZhciBwcm9wIGluIG9iailcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGlmICh0aGlzLmNoYW5jZSgxIC8gKytjb3VudCkpXHJcbiAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHByb3BcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gcmVzdWx0XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBjcmVhdGVzIGEgcmFuZG9tIHNldCB3aGVyZSBlYWNoIGVudHJ5IGlzIGEgdmFsdWUgYmV0d2VlbiBbbWluLCBtYXhdXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWluXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWF4XHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gYW1vdW50IG9mIG51bWJlcnMgaW4gc2V0XHJcbiAgICAgKiBAcGFyYW0ge251bWJlcltdfVxyXG4gICAgICovXHJcbiAgICBzZXQobWluLCBtYXgsIGFtb3VudClcclxuICAgIHtcclxuICAgICAgICB2YXIgc2V0ID0gW10sIGFsbCA9IFtdLCBpXHJcbiAgICAgICAgZm9yIChpID0gbWluOyBpIDwgbWF4OyBpKyspXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBhbGwucHVzaChpKVxyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGFtb3VudDsgaSsrKVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgdmFyIGZvdW5kID0gdGhpcy5nZXQoYWxsLmxlbmd0aClcclxuICAgICAgICAgICAgc2V0LnB1c2goYWxsW2ZvdW5kXSlcclxuICAgICAgICAgICAgYWxsLnNwbGljZShmb3VuZCwgMSlcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHNldFxyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKipcclxuICAgICAqIHJldHVybnMgYSBzZXQgb2YgbnVtYmVycyB3aXRoIGEgcmFuZG9tbHkgZXZlbiBkaXN0cmlidXRpb24gKGkuZS4sIG5vIG92ZXJsYXBwaW5nIGFuZCBmaWxsaW5nIHRoZSBzcGFjZSlcclxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBzdGFydCBwb3NpdGlvblxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGVuZCBwb3NpdGlvblxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGNvdW50IG9mIG5vbi1zdGFydC9lbmQgcG9pbnRzXHJcbiAgICAgKiBAcGFyYW0ge2Jvb2xlYW59IFtpbmNsdWRlU3RhcnQ9ZmFsc2VdIGluY2x1ZGVzIHN0YXJ0IHBvaW50IChjb3VudCsrKVxyXG4gICAgICogQHBhcmFtIHtib29sZWFufSBbaW5jbHVkZUVuZD1mYWxzZV0gaW5jbHVkZXMgZW5kIHBvaW50IChjb3VudCsrKVxyXG4gICAgICogQHBhcmFtIHtib29sZWFufSBbdXNlRmxvYXQ9ZmFsc2VdXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcltdfVxyXG4gICAgICovXHJcbiAgICBkaXN0cmlidXRpb24oc3RhcnQsIGVuZCwgY291bnQsIGluY2x1ZGVTdGFydCwgaW5jbHVkZUVuZCwgdXNlRmxvYXQpXHJcbiAgICB7XHJcbiAgICAgICAgdmFyIGludGVydmFsID0gTWF0aC5mbG9vcigoZW5kIC0gc3RhcnQpIC8gY291bnQpXHJcbiAgICAgICAgdmFyIGhhbGZJbnRlcnZhbCA9IGludGVydmFsIC8gMlxyXG4gICAgICAgIHZhciBxdWFydGVySW50ZXJ2YWwgPSBpbnRlcnZhbCAvIDRcclxuICAgICAgICB2YXIgc2V0ID0gW11cclxuICAgICAgICBpZiAoaW5jbHVkZVN0YXJ0KVxyXG4gICAgICAgIHtcclxuICAgICAgICAgICAgc2V0LnB1c2goc3RhcnQpXHJcbiAgICAgICAgfVxyXG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY291bnQ7IGkrKylcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIHNldC5wdXNoKHN0YXJ0ICsgaSAqIGludGVydmFsICsgaGFsZkludGVydmFsICsgdGhpcy5yYW5nZSgtcXVhcnRlckludGVydmFsLCBxdWFydGVySW50ZXJ2YWwsIHVzZUZsb2F0KSlcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKGluY2x1ZGVFbmQpXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBzZXQucHVzaChlbmQpXHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBzZXRcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIHJldHVybnMgYSByYW5kb20gbnVtYmVyIGJhc2VkIG9uIHdlaWdodGVkIHByb2JhYmlsaXR5IGJldHdlZW4gW21pbiwgbWF4XVxyXG4gICAgICogZnJvbSBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzIyNjU2MTI2L2phdmFzY3JpcHQtcmFuZG9tLW51bWJlci13aXRoLXdlaWdodGVkLXByb2JhYmlsaXR5XHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWluIHZhbHVlXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbWF4IHZhbHVlXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gdGFyZ2V0IGZvciBhdmVyYWdlIHZhbHVlXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gc3RkZGV2IC0gc3RhbmRhcmQgZGV2aWF0aW9uXHJcbiAgICAgKi9cclxuICAgIHdlaWdodGVkUHJvYmFiaWxpdHlJbnQobWluLCBtYXgsIHRhcmdldCwgc3RkZGV2KVxyXG4gICAge1xyXG4gICAgICAgIGZ1bmN0aW9uIG5vcm1SYW5kKClcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGxldCB4MSwgeDIsIHJhZFxyXG4gICAgICAgICAgICBkb1xyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICB4MSA9IDIgKiB0aGlzLmdldCgxLCB0cnVlKSAtIDFcclxuICAgICAgICAgICAgICAgIHgyID0gMiAqIHRoaXMuZ2V0KDEsIHRydWUpIC0gMVxyXG4gICAgICAgICAgICAgICAgcmFkID0geDEgKiB4MSArIHgyICogeDJcclxuICAgICAgICAgICAgfSB3aGlsZSAocmFkID49IDEgfHwgcmFkID09PSAwKVxyXG4gICAgICAgICAgICBjb25zdCBjID0gTWF0aC5zcXJ0KC0yICogTWF0aC5sb2cocmFkKSAvIHJhZClcclxuICAgICAgICAgICAgcmV0dXJuIHgxICogY1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgc3RkZGV2ID0gc3RkZGV2IHx8IDFcclxuICAgICAgICBpZiAoTWF0aC5yYW5kb20oKSA8IDAuODE1NDYpXHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICB3aGlsZSAodHJ1ZSlcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgY29uc3Qgc2FtcGxlID0gKChub3JtUmFuZCgpICogc3RkZGV2KSArIHRhcmdldClcclxuICAgICAgICAgICAgICAgIGlmIChzYW1wbGUgPj0gbWluICYmIHNhbXBsZSA8PSBtYXgpXHJcbiAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNhbXBsZVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2VcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnJhbmdlKG1pbiwgbWF4KVxyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICAvKlxyXG4gICAgICogcmV0dXJucyBhIHJhbmRvbSBoZXggY29sb3IgKDAgLSAweGZmZmZmZilcclxuICAgICAqIEByZXR1cm4ge251bWJlcn1cclxuICAgICAqL1xyXG4gICAgY29sb3IoKVxyXG4gICAge1xyXG4gICAgICAgIHJldHVybiB0aGlzLmdldCgweGZmZmZmZilcclxuICAgIH1cclxufVxyXG5cclxubW9kdWxlLmV4cG9ydHMgPSBuZXcgUmFuZG9tKCkiXX0=","import * as PIXI from 'pixi.js';\nimport { Rectangle, Point, Container, VERSION } from 'pixi.js';\n\n/**\r\n * @typedef ViewportTouch\r\n * @property {number} id\r\n * @property {PIXI.Point} last\r\n*/\r\n\r\n/**\r\n * handles all input for Viewport\r\n * @private\r\n */\r\nclass InputManager\r\n{\r\n constructor(viewport)\r\n {\r\n this.viewport = viewport;\r\n\r\n /**\r\n * list of active touches on viewport\r\n * @type {ViewportTouch[]}\r\n */\r\n this.touches = [];\r\n this.addListeners();\r\n }\r\n\r\n /**\r\n * add input listeners\r\n * @private\r\n */\r\n addListeners()\r\n {\r\n this.viewport.interactive = true;\r\n if (!this.viewport.forceHitArea)\r\n {\r\n this.viewport.hitArea = new Rectangle(0, 0, this.viewport.worldWidth, this.viewport.worldHeight);\r\n }\r\n this.viewport.on('pointerdown', this.down, this);\r\n this.viewport.on('pointermove', this.move, this);\r\n this.viewport.on('pointerup', this.up, this);\r\n this.viewport.on('pointerupoutside', this.up, this);\r\n this.viewport.on('pointercancel', this.up, this);\r\n this.viewport.on('pointerout', this.up, this);\r\n this.wheelFunction = (e) => this.handleWheel(e);\r\n this.viewport.options.divWheel.addEventListener('wheel', this.wheelFunction, { passive: this.viewport.options.passiveWheel });\r\n this.isMouseDown = false;\r\n }\r\n\r\n /**\r\n * removes all event listeners from viewport\r\n * (useful for cleanup of wheel when removing viewport)\r\n */\r\n destroy()\r\n {\r\n this.viewport.options.divWheel.removeEventListener('wheel', this.wheelFunction);\r\n }\r\n\r\n /**\r\n * handle down events for viewport\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n */\r\n down(event)\r\n {\r\n if (this.viewport.pause || !this.viewport.worldVisible)\r\n {\r\n return\r\n }\r\n if (event.data.pointerType === 'mouse')\r\n {\r\n this.isMouseDown = true;\r\n }\r\n else if (!this.get(event.data.pointerId))\r\n {\r\n this.touches.push({ id: event.data.pointerId, last: null });\r\n }\r\n if (this.count() === 1)\r\n {\r\n this.last = event.data.global.clone();\r\n\r\n // clicked event does not fire if viewport is decelerating or bouncing\r\n const decelerate = this.viewport.plugins.get('decelerate');\r\n const bounce = this.viewport.plugins.get('bounce');\r\n if ((!decelerate || !decelerate.isActive()) && (!bounce || !bounce.isActive()))\r\n {\r\n this.clickedAvailable = true;\r\n }\r\n else\r\n {\r\n this.clickedAvailable = false;\r\n }\r\n }\r\n else\r\n {\r\n this.clickedAvailable = false;\r\n }\r\n\r\n const stop = this.viewport.plugins.down(event);\r\n if (stop && this.viewport.options.stopPropagation)\r\n {\r\n event.stopPropagation();\r\n }\r\n }\r\n\r\n /**\r\n * @param {number} change\r\n * @returns whether change exceeds threshold\r\n */\r\n checkThreshold(change)\r\n {\r\n if (Math.abs(change) >= this.viewport.threshold)\r\n {\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n /**\r\n * handle move events for viewport\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n */\r\n move(event)\r\n {\r\n if (this.viewport.pause || !this.viewport.worldVisible)\r\n {\r\n return\r\n }\r\n\r\n const stop = this.viewport.plugins.move(event);\r\n\r\n if (this.clickedAvailable)\r\n {\r\n const distX = event.data.global.x - this.last.x;\r\n const distY = event.data.global.y - this.last.y;\r\n if (this.checkThreshold(distX) || this.checkThreshold(distY))\r\n {\r\n this.clickedAvailable = false;\r\n }\r\n }\r\n\r\n if (stop && this.viewport.options.stopPropagation)\r\n {\r\n event.stopPropagation();\r\n }\r\n }\r\n\r\n /**\r\n * handle up events for viewport\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n */\r\n up(event)\r\n {\r\n if (this.viewport.pause || !this.viewport.worldVisible)\r\n {\r\n return\r\n }\r\n\r\n if (event.data.pointerType === 'mouse')\r\n {\r\n this.isMouseDown = false;\r\n }\r\n\r\n if (event.data.pointerType !== 'mouse')\r\n {\r\n this.remove(event.data.pointerId);\r\n }\r\n\r\n const stop = this.viewport.plugins.up(event);\r\n\r\n if (this.clickedAvailable && this.count() === 0)\r\n {\r\n this.viewport.emit('clicked', { screen: this.last, world: this.viewport.toWorld(this.last), viewport: this });\r\n this.clickedAvailable = false;\r\n }\r\n\r\n if (stop && this.viewport.options.stopPropagation)\r\n {\r\n event.stopPropagation();\r\n }\r\n }\r\n\r\n /**\r\n * gets pointer position if this.interaction is set\r\n * @param {WheelEvent} event\r\n * @return {PIXI.Point}\r\n */\r\n getPointerPosition(event)\r\n {\r\n let point = new Point();\r\n if (this.viewport.options.interaction)\r\n {\r\n this.viewport.options.interaction.mapPositionToPoint(point, event.clientX, event.clientY);\r\n }\r\n else\r\n {\r\n point.x = event.clientX;\r\n point.y = event.clientY;\r\n }\r\n return point\r\n }\r\n\r\n /**\r\n * handle wheel events\r\n * @param {WheelEvent} event\r\n */\r\n handleWheel(event)\r\n {\r\n if (this.viewport.pause || !this.viewport.worldVisible)\r\n {\r\n return\r\n }\r\n\r\n // only handle wheel events where the mouse is over the viewport\r\n const point = this.viewport.toLocal(this.getPointerPosition(event));\r\n if (this.viewport.left <= point.x && point.x <= this.viewport.right && this.viewport.top <= point.y && point.y <= this.viewport.bottom)\r\n {\r\n const stop = this.viewport.plugins.wheel(event);\r\n if (stop)\r\n {\r\n event.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n pause()\r\n {\r\n this.touches = [];\r\n this.isMouseDown = false;\r\n }\r\n\r\n /**\r\n * get touch by id\r\n * @param {number} id\r\n * @return {ViewportTouch}\r\n */\r\n get(id)\r\n {\r\n for (let touch of this.touches)\r\n {\r\n if (touch.id === id)\r\n {\r\n return touch\r\n }\r\n }\r\n return null\r\n }\r\n\r\n /**\r\n * remove touch by number\r\n * @param {number} id\r\n */\r\n remove(id)\r\n {\r\n for (let i = 0; i < this.touches.length; i++)\r\n {\r\n if (this.touches[i].id === id)\r\n {\r\n this.touches.splice(i, 1);\r\n return\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns {number} count of mouse/touch pointers that are down on the viewport\r\n */\r\n count()\r\n {\r\n return (this.isMouseDown ? 1 : 0) + this.touches.length\r\n }\r\n}\n\nconst PLUGIN_ORDER = ['drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', 'snap-zoom', 'clamp-zoom', 'snap', 'clamp'];\r\n\r\n/**\r\n * Use this to access current plugins or add user-defined plugins\r\n */\r\nclass PluginManager\r\n{\r\n /**\r\n * instantiated by Viewport\r\n * @param {Viewport} viewport\r\n */\r\n constructor(viewport)\r\n {\r\n this.viewport = viewport;\r\n this.list = [];\r\n this.plugins = {};\r\n }\r\n\r\n /**\r\n * Inserts a named plugin or a user plugin into the viewport\r\n * default plugin order: 'drag', 'pinch', 'wheel', 'follow', 'mouse-edges', 'decelerate', 'bounce', 'snap-zoom', 'clamp-zoom', 'snap', 'clamp'\r\n * @param {string} name of plugin\r\n * @param {Plugin} plugin - instantiated Plugin class\r\n * @param {number} index to insert userPlugin (otherwise inserts it at the end)\r\n */\r\n add(name, plugin, index = PLUGIN_ORDER.length)\r\n {\r\n this.plugins[name] = plugin;\r\n const current = PLUGIN_ORDER.indexOf(name);\r\n if (current !== -1)\r\n {\r\n PLUGIN_ORDER.splice(current, 1);\r\n }\r\n PLUGIN_ORDER.splice(index, 0, name);\r\n this.sort();\r\n }\r\n\r\n /**\r\n * get plugin\r\n * @param {string} name of plugin\r\n * @return {Plugin}\r\n */\r\n get(name)\r\n {\r\n return this.plugins[name]\r\n }\r\n\r\n /**\r\n * update all active plugins\r\n * @private\r\n * @param {number} elapsed type in milliseconds since last update\r\n */\r\n update(elapsed)\r\n {\r\n for (let plugin of this.list)\r\n {\r\n plugin.update(elapsed);\r\n }\r\n }\r\n\r\n /**\r\n * resize all active plugins\r\n * @private\r\n */\r\n resize()\r\n {\r\n for (let plugin of this.list)\r\n {\r\n plugin.resize();\r\n }\r\n }\r\n\r\n /**\r\n * clamps and resets bounce and decelerate (as needed) after manually moving viewport\r\n */\r\n reset()\r\n {\r\n if (this.plugins['bounce'])\r\n {\r\n this.plugins['bounce'].reset();\r\n this.plugins['bounce'].bounce();\r\n }\r\n if (this.plugins['decelerate'])\r\n {\r\n this.plugins['decelerate'].reset();\r\n }\r\n if (this.plugins['snap'])\r\n {\r\n this.plugins['snap'].reset();\r\n }\r\n if (this.plugins['clamp'])\r\n {\r\n this.plugins['clamp'].update();\r\n }\r\n if (this.plugins['clamp-zoom'])\r\n {\r\n this.plugins['clamp-zoom'].clamp();\r\n }\r\n }\r\n\r\n /**\r\n * removes installed plugin\r\n * @param {string} name of plugin (e.g., 'drag', 'pinch')\r\n */\r\n remove(name)\r\n {\r\n if (this.plugins[name])\r\n {\r\n this.plugins[name] = null;\r\n this.viewport.emit(name + '-remove');\r\n this.sort();\r\n }\r\n }\r\n\r\n /**\r\n * pause plugin\r\n * @param {string} name of plugin (e.g., 'drag', 'pinch')\r\n */\r\n pause(name)\r\n {\r\n if (this.plugins[name])\r\n {\r\n this.plugins[name].pause();\r\n }\r\n }\r\n\r\n /**\r\n * resume plugin\r\n * @param {string} name of plugin (e.g., 'drag', 'pinch')\r\n */\r\n resume(name)\r\n {\r\n if (this.plugins[name])\r\n {\r\n this.plugins[name].resume();\r\n }\r\n }\r\n\r\n /**\r\n * sort plugins according to PLUGIN_ORDER\r\n * @private\r\n */\r\n sort()\r\n {\r\n this.list = [];\r\n for (let plugin of PLUGIN_ORDER)\r\n {\r\n if (this.plugins[plugin])\r\n {\r\n this.list.push(this.plugins[plugin]);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * handle down for all plugins\r\n * @private\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n down(event)\r\n {\r\n let stop = false;\r\n for (let plugin of this.list)\r\n {\r\n if (plugin.down(event))\r\n {\r\n stop = true;\r\n }\r\n }\r\n return stop\r\n }\r\n\r\n /**\r\n * handle move for all plugins\r\n * @private\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n move(event)\r\n {\r\n let stop = false;\r\n for (let plugin of this.viewport.plugins.list)\r\n {\r\n if (plugin.move(event))\r\n {\r\n stop = true;\r\n }\r\n }\r\n return stop\r\n }\r\n\r\n /**\r\n * handle up for all plugins\r\n * @private\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n up(event)\r\n {\r\n let stop = false;\r\n for (let plugin of this.list)\r\n {\r\n if (plugin.up(event))\r\n {\r\n stop = true;\r\n }\r\n }\r\n return stop\r\n }\r\n\r\n /**\r\n * handle wheel event for all plugins\r\n * @private\r\n * @param {WheelEvent} event\r\n * @returns {boolean}\r\n */\r\n wheel(e)\r\n {\r\n let result = false;\r\n for (let plugin of this.list)\r\n {\r\n if (plugin.wheel(e))\r\n {\r\n result = true;\r\n }\r\n }\r\n return result\r\n }\r\n}\n\n/**\r\n * derive this class to create user-defined plugins\r\n */\r\nclass Plugin\r\n{\r\n /**\r\n * @param {Viewport} parent\r\n */\r\n constructor(parent)\r\n {\r\n this.parent = parent;\r\n this.paused = false;\r\n }\r\n\r\n /** called when plugin is removed */\r\n destroy() {}\r\n\r\n /**\r\n * handler for pointerdown PIXI event\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n down()\r\n {\r\n return false\r\n }\r\n\r\n /**\r\n * handler for pointermove PIXI event\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n move()\r\n {\r\n return false\r\n }\r\n\r\n /**\r\n * handler for pointerup PIXI event\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n up()\r\n {\r\n return false\r\n }\r\n\r\n /**\r\n * handler for wheel event on div\r\n * @param {WheelEvent} event\r\n * @returns {boolean}\r\n */\r\n wheel()\r\n {\r\n return false\r\n }\r\n\r\n /**\r\n * called on each tick\r\n * @param {number} elapsed time in millisecond since last update\r\n */\r\n update() { }\r\n\r\n /** called when the viewport is resized */\r\n resize() { }\r\n\r\n /** called when the viewport is manually moved */\r\n reset() { }\r\n\r\n /** pause the plugin */\r\n pause()\r\n {\r\n this.paused = true;\r\n }\r\n\r\n /** un-pause the plugin */\r\n resume()\r\n {\r\n this.paused = false;\r\n }\r\n}\n\n/**\r\n * @typedef {object} LastDrag\r\n * @property {number} x\r\n * @property {number} y\r\n * @property {PIXI.Point} parent\r\n */\r\n\r\n/**\r\n * @typedef DragOptions\r\n * @property {string} [direction=all] direction to drag\r\n * @property {boolean} [wheel=true] use wheel to scroll in y direction(unless wheel plugin is active)\r\n * @property {number} [wheelScroll=1] number of pixels to scroll with each wheel spin\r\n * @property {boolean} [reverse] reverse the direction of the wheel scroll\r\n * @property {(boolean|string)} [clampWheel=false] clamp wheel(to avoid weird bounce with mouse wheel)\r\n * @property {string} [underflow=center] where to place world if too small for screen\r\n * @property {number} [factor=1] factor to multiply drag to increase the speed of movement\r\n * @property {string} [mouseButtons=all] changes which mouse buttons trigger drag, use: 'all', 'left', right' 'middle', or some combination, like, 'middle-right'; you may want to set viewport.options.disableOnContextMenu if you want to use right-click dragging\r\n * @property {string[]} [keyToPress=null] array containing {@link key|https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code} codes of keys that can be pressed for the drag to be triggered, e.g.: ['ShiftLeft', 'ShiftRight'}.\r\n * @property {boolean} [ignoreKeyToPressOnTouch=false] ignore keyToPress for touch events\r\n */\r\n\r\nconst dragOptions = {\r\n direction: 'all',\r\n wheel: true,\r\n wheelScroll: 1,\r\n reverse: false,\r\n clampWheel: false,\r\n underflow: 'center',\r\n factor: 1,\r\n mouseButtons: 'all',\r\n keyToPress: null,\r\n ignoreKeyToPressOnTouch: false\r\n};\r\n\r\n/**\r\n * @private\r\n */\r\nclass Drag extends Plugin\r\n{\r\n /**\r\n * @param {Viewport} parent\r\n * @param {DragOptions} options\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, dragOptions, options);\r\n this.moved = false;\r\n this.reverse = this.options.reverse ? 1 : -1;\r\n this.xDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'x';\r\n this.yDirection = !this.options.direction || this.options.direction === 'all' || this.options.direction === 'y';\r\n this.keyIsPressed = false;\r\n\r\n this.parseUnderflow();\r\n this.mouseButtons(this.options.mouseButtons);\r\n if (this.options.keyToPress) {\r\n this.handleKeyPresses(this.options.keyToPress);\r\n }\r\n }\r\n\r\n /**\r\n * Handles keypress events and set the keyIsPressed boolean accordingly\r\n * @param {array} codes - key codes that can be used to trigger drag event\r\n */\r\n handleKeyPresses(codes)\r\n {\r\n parent.addEventListener(\"keydown\", e => {\r\n if (codes.includes(e.code))\r\n this.keyIsPressed = true;\r\n });\r\n\r\n parent.addEventListener(\"keyup\", e => {\r\n if (codes.includes(e.code))\r\n this.keyIsPressed = false;\r\n });\r\n }\r\n\r\n /**\r\n * initialize mousebuttons array\r\n * @param {string} buttons\r\n */\r\n mouseButtons(buttons)\r\n {\r\n if (!buttons || buttons === 'all')\r\n {\r\n this.mouse = [true, true, true];\r\n }\r\n else\r\n {\r\n this.mouse = [\r\n buttons.indexOf('left') === -1 ? false : true,\r\n buttons.indexOf('middle') === -1 ? false : true,\r\n buttons.indexOf('right') === -1 ? false : true\r\n ];\r\n }\r\n }\r\n\r\n parseUnderflow()\r\n {\r\n const clamp = this.options.underflow.toLowerCase();\r\n if (clamp === 'center')\r\n {\r\n this.underflowX = 0;\r\n this.underflowY = 0;\r\n }\r\n else\r\n {\r\n this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0;\r\n this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0;\r\n }\r\n }\r\n\r\n /**\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n checkButtons(event)\r\n {\r\n const isMouse = event.data.pointerType === 'mouse';\r\n const count = this.parent.input.count();\r\n if ((count === 1) || (count > 1 && !this.parent.plugins.get('pinch')))\r\n {\r\n if (!isMouse || this.mouse[event.data.button])\r\n {\r\n return true\r\n }\r\n }\r\n return false\r\n }\r\n\r\n /**\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n checkKeyPress(event)\r\n {\r\n if (!this.options.keyToPress || this.keyIsPressed || (this.options.ignoreKeyToPressOnTouch && event.data.pointerType === 'touch'))\r\n return true\r\n\r\n return false\r\n }\r\n\r\n /**\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n */\r\n down(event)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n if (this.checkButtons(event) && this.checkKeyPress(event))\r\n {\r\n this.last = { x: event.data.global.x, y: event.data.global.y };\r\n this.current = event.data.pointerId;\r\n return true\r\n }\r\n else\r\n {\r\n this.last = null;\r\n }\r\n }\r\n\r\n get active()\r\n {\r\n return this.moved\r\n }\r\n\r\n /**\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n */\r\n move(event)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n if (this.last && this.current === event.data.pointerId)\r\n {\r\n const x = event.data.global.x;\r\n const y = event.data.global.y;\r\n const count = this.parent.input.count();\r\n if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch')))\r\n {\r\n const distX = x - this.last.x;\r\n const distY = y - this.last.y;\r\n if (this.moved || ((this.xDirection && this.parent.input.checkThreshold(distX)) || (this.yDirection && this.parent.input.checkThreshold(distY))))\r\n {\r\n const newPoint = { x, y };\r\n if (this.xDirection)\r\n {\r\n this.parent.x += (newPoint.x - this.last.x) * this.options.factor;\r\n }\r\n if (this.yDirection)\r\n {\r\n this.parent.y += (newPoint.y - this.last.y) * this.options.factor;\r\n }\r\n this.last = newPoint;\r\n if (!this.moved)\r\n {\r\n this.parent.emit('drag-start', { screen: new Point(this.last.x, this.last.y), world: this.parent.toWorld(new Point(this.last.x, this.last.y)), viewport: this.parent});\r\n }\r\n this.moved = true;\r\n this.parent.emit('moved', { viewport: this.parent, type: 'drag' });\r\n return true\r\n }\r\n }\r\n else\r\n {\r\n this.moved = false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n up()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n const touches = this.parent.input.touches;\r\n if (touches.length === 1)\r\n {\r\n const pointer = touches[0];\r\n if (pointer.last)\r\n {\r\n this.last = { x: pointer.last.x, y: pointer.last.y };\r\n this.current = pointer.id;\r\n }\r\n this.moved = false;\r\n return true\r\n }\r\n else if (this.last)\r\n {\r\n if (this.moved)\r\n {\r\n const screen = new Point(this.last.x, this.last.y);\r\n this.parent.emit('drag-end', {screen, world: this.parent.toWorld(screen), viewport: this.parent});\r\n this.last = null;\r\n this.moved = false;\r\n return true\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @param {WheelEvent} event\r\n * @returns {boolean}\r\n */\r\n wheel(event)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n if (this.options.wheel)\r\n {\r\n const wheel = this.parent.plugins.get('wheel');\r\n if (!wheel)\r\n {\r\n if (this.xDirection)\r\n {\r\n this.parent.x += event.deltaX * this.options.wheelScroll * this.reverse;\r\n }\r\n if (this.yDirection)\r\n {\r\n this.parent.y += event.deltaY * this.options.wheelScroll * this.reverse;\r\n }\r\n if (this.options.clampWheel)\r\n {\r\n this.clamp();\r\n }\r\n this.parent.emit('wheel-scroll', this.parent);\r\n this.parent.emit('moved', { viewport: this.parent, type: 'wheel' });\r\n if (!this.parent.options.passiveWheel)\r\n {\r\n event.preventDefault();\r\n }\r\n return true\r\n }\r\n }\r\n }\r\n\r\n resume()\r\n {\r\n this.last = null;\r\n this.paused = false;\r\n }\r\n\r\n clamp()\r\n {\r\n const decelerate = this.parent.plugins.get('decelerate') || {};\r\n if (this.options.clampWheel !== 'y')\r\n {\r\n if (this.parent.screenWorldWidth < this.parent.screenWidth)\r\n {\r\n switch (this.underflowX)\r\n {\r\n case -1:\r\n this.parent.x = 0;\r\n break\r\n case 1:\r\n this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth);\r\n break\r\n default:\r\n this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;\r\n }\r\n }\r\n else\r\n {\r\n if (this.parent.left < 0)\r\n {\r\n this.parent.x = 0;\r\n decelerate.x = 0;\r\n }\r\n else if (this.parent.right > this.parent.worldWidth)\r\n {\r\n this.parent.x = -this.parent.worldWidth * this.parent.scale.x + this.parent.screenWidth;\r\n decelerate.x = 0;\r\n }\r\n }\r\n }\r\n if (this.options.clampWheel !== 'x')\r\n {\r\n if (this.parent.screenWorldHeight < this.parent.screenHeight)\r\n {\r\n switch (this.underflowY)\r\n {\r\n case -1:\r\n this.parent.y = 0;\r\n break\r\n case 1:\r\n this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight);\r\n break\r\n default:\r\n this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;\r\n }\r\n }\r\n else\r\n {\r\n if (this.parent.top < 0)\r\n {\r\n this.parent.y = 0;\r\n decelerate.y = 0;\r\n }\r\n if (this.parent.bottom > this.parent.worldHeight)\r\n {\r\n this.parent.y = -this.parent.worldHeight * this.parent.scale.y + this.parent.screenHeight;\r\n decelerate.y = 0;\r\n }\r\n }\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef {object} PinchOptions\r\n * @property {boolean} [noDrag] disable two-finger dragging\r\n * @property {number} [percent=1.0] percent to modify pinch speed\r\n * @property {PIXI.Point} [center] place this point at center during zoom instead of center of two fingers\r\n */\r\n\r\nconst pinchOptions = {\r\n noDrag: false,\r\n percent: 1.0,\r\n center: null\r\n};\r\n\r\nclass Pinch extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {PinchOptions} [options]\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, pinchOptions, options);\r\n }\r\n\r\n down()\r\n {\r\n if (this.parent.input.count() >= 2)\r\n {\r\n this.active = true;\r\n return true\r\n }\r\n }\r\n\r\n move(e)\r\n {\r\n if (this.paused || !this.active)\r\n {\r\n return\r\n }\r\n\r\n const x = e.data.global.x;\r\n const y = e.data.global.y;\r\n\r\n const pointers = this.parent.input.touches;\r\n if (pointers.length >= 2)\r\n {\r\n const first = pointers[0];\r\n const second = pointers[1];\r\n const last = (first.last && second.last) ? Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2)) : null;\r\n if (first.id === e.data.pointerId)\r\n {\r\n first.last = { x, y, data: e.data };\r\n }\r\n else if (second.id === e.data.pointerId)\r\n {\r\n second.last = { x, y, data: e.data };\r\n }\r\n if (last)\r\n {\r\n let oldPoint;\r\n const point = { x: first.last.x + (second.last.x - first.last.x) / 2, y: first.last.y + (second.last.y - first.last.y) / 2 };\r\n if (!this.options.center)\r\n {\r\n oldPoint = this.parent.toLocal(point);\r\n }\r\n const dist = Math.sqrt(Math.pow(second.last.x - first.last.x, 2) + Math.pow(second.last.y - first.last.y, 2));\r\n const change = ((dist - last) / this.parent.screenWidth) * this.parent.scale.x * this.options.percent;\r\n this.parent.scale.x += change;\r\n this.parent.scale.y += change;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'pinch' });\r\n const clamp = this.parent.plugins.get('clamp-zoom');\r\n if (clamp)\r\n {\r\n clamp.clamp();\r\n }\r\n if (this.options.center)\r\n {\r\n this.parent.moveCenter(this.options.center);\r\n }\r\n else\r\n {\r\n const newPoint = this.parent.toGlobal(oldPoint);\r\n this.parent.x += point.x - newPoint.x;\r\n this.parent.y += point.y - newPoint.y;\r\n this.parent.emit('moved', { viewport: this.parent, type: 'pinch' });\r\n }\r\n if (!this.options.noDrag && this.lastCenter)\r\n {\r\n this.parent.x += point.x - this.lastCenter.x;\r\n this.parent.y += point.y - this.lastCenter.y;\r\n this.parent.emit('moved', { viewport: this.parent, type: 'pinch' });\r\n }\r\n this.lastCenter = point;\r\n this.moved = true;\r\n }\r\n else\r\n {\r\n if (!this.pinching)\r\n {\r\n this.parent.emit('pinch-start', this.parent);\r\n this.pinching = true;\r\n }\r\n }\r\n return true\r\n }\r\n }\r\n\r\n up()\r\n {\r\n if (this.pinching)\r\n {\r\n if (this.parent.input.touches.length <= 1)\r\n {\r\n this.active = false;\r\n this.lastCenter = null;\r\n this.pinching = false;\r\n this.moved = false;\r\n this.parent.emit('pinch-end', this.parent);\r\n return true\r\n }\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef ClampOptions\r\n * @property {(number|boolean)} [left=false] clamp left; true = 0\r\n * @property {(number|boolean)} [right=false] clamp right; true = viewport.worldWidth\r\n * @property {(number|boolean)} [top=false] clamp top; true = 0\r\n * @property {(number|boolean)} [bottom=false] clamp bottom; true = viewport.worldHeight\r\n * @property {string} [direction] (all, x, or y) using clamps of [0, viewport.worldWidth/viewport.worldHeight]; replaces left/right/top/bottom if set\r\n * @property {string} [underflow=center] where to place world if too small for screen (e.g., top-right, center, none, bottomleft)\r\n */\r\n\r\nconst clampOptions =\r\n{\r\n left: false,\r\n right: false,\r\n top: false,\r\n bottom: false,\r\n direction: null,\r\n underflow: 'center'\r\n};\r\n\r\nclass Clamp extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {ClampOptions} [options]\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, clampOptions, options);\r\n if (this.options.direction)\r\n {\r\n this.options.left = this.options.direction === 'x' || this.options.direction === 'all' ? true : null;\r\n this.options.right = this.options.direction === 'x' || this.options.direction === 'all' ? true : null;\r\n this.options.top = this.options.direction === 'y' || this.options.direction === 'all' ? true : null;\r\n this.options.bottom = this.options.direction === 'y' || this.options.direction === 'all' ? true : null;\r\n }\r\n this.parseUnderflow();\r\n this.last = { x: null, y: null, scaleX: null, scaleY: null };\r\n this.update();\r\n }\r\n\r\n parseUnderflow()\r\n {\r\n const clamp = this.options.underflow.toLowerCase();\r\n if (clamp === 'none')\r\n {\r\n this.noUnderflow = true;\r\n }\r\n else if (clamp === 'center')\r\n {\r\n this.underflowX = this.underflowY = 0;\r\n this.noUnderflow = false;\r\n }\r\n else\r\n {\r\n this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0;\r\n this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0;\r\n this.noUnderflow = false;\r\n }\r\n }\r\n\r\n /**\r\n * handle move events\r\n * @param {PIXI.interaction.InteractionEvent} event\r\n * @returns {boolean}\r\n */\r\n move()\r\n {\r\n this.update();\r\n return false\r\n }\r\n\r\n update()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n // only clamp on change\r\n if (this.parent.x === this.last.x && this.parent.y === this.last.y && this.parent.scale.x === this.last.scaleX && this.parent.scale.y === this.last.scaleY)\r\n {\r\n return\r\n }\r\n const original = { x: this.parent.x, y: this.parent.y };\r\n const decelerate = this.parent.plugins['decelerate'] || {};\r\n if (this.options.left !== null || this.options.right !== null)\r\n {\r\n let moved = false;\r\n if (this.parent.screenWorldWidth < this.parent.screenWidth)\r\n {\r\n if (!this.noUnderflow)\r\n {\r\n switch (this.underflowX)\r\n {\r\n case -1:\r\n if (this.parent.x !== 0)\r\n {\r\n this.parent.x = 0;\r\n moved = true;\r\n }\r\n break\r\n case 1:\r\n if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth)\r\n {\r\n this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth;\r\n moved = true;\r\n }\r\n break\r\n default:\r\n if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2)\r\n {\r\n this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;\r\n moved = true;\r\n }\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if (this.options.left !== null)\r\n {\r\n if (this.parent.left < (this.options.left === true ? 0 : this.options.left))\r\n {\r\n this.parent.x = -(this.options.left === true ? 0 : this.options.left) * this.parent.scale.x;\r\n decelerate.x = 0;\r\n moved = true;\r\n }\r\n }\r\n if (this.options.right !== null)\r\n {\r\n if (this.parent.right > (this.options.right === true ? this.parent.worldWidth : this.options.right))\r\n {\r\n this.parent.x = -(this.options.right === true ? this.parent.worldWidth : this.options.right) * this.parent.scale.x + this.parent.screenWidth;\r\n decelerate.x = 0;\r\n moved = true;\r\n }\r\n }\r\n }\r\n if (moved)\r\n {\r\n this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-x' });\r\n }\r\n }\r\n if (this.options.top !== null || this.options.bottom !== null)\r\n {\r\n let moved = false;\r\n if (this.parent.screenWorldHeight < this.parent.screenHeight)\r\n {\r\n if (!this.noUnderflow)\r\n {\r\n switch (this.underflowY)\r\n {\r\n case -1:\r\n if (this.parent.y !== 0)\r\n {\r\n this.parent.y = 0;\r\n moved = true;\r\n }\r\n break\r\n case 1:\r\n if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight)\r\n {\r\n this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight);\r\n moved = true;\r\n }\r\n break\r\n default:\r\n if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2)\r\n {\r\n this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;\r\n moved = true;\r\n }\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if (this.options.top !== null)\r\n {\r\n if (this.parent.top < (this.options.top === true ? 0 : this.options.top))\r\n {\r\n this.parent.y = -(this.options.top === true ? 0 : this.options.top) * this.parent.scale.y;\r\n decelerate.y = 0;\r\n moved = true;\r\n }\r\n }\r\n if (this.options.bottom !== null)\r\n {\r\n if (this.parent.bottom > (this.options.bottom === true ? this.parent.worldHeight : this.options.bottom))\r\n {\r\n this.parent.y = -(this.options.bottom === true ? this.parent.worldHeight : this.options.bottom) * this.parent.scale.y + this.parent.screenHeight;\r\n decelerate.y = 0;\r\n moved = true;\r\n }\r\n }\r\n }\r\n if (moved)\r\n {\r\n this.parent.emit('moved', { viewport: this.parent, original, type: 'clamp-y' });\r\n }\r\n }\r\n this.last.x = this.parent.x;\r\n this.last.y = this.parent.y;\r\n this.last.scaleX = this.parent.scale.x;\r\n this.last.scaleY = this.parent.scale.y;\r\n }\r\n}\n\n/**\r\n * @typedef {object} ClampZoomOptions\r\n * @property {number} [minWidth] minimum width\r\n * @property {number} [minHeight] minimum height\r\n * @property {number} [maxWidth] maximum width\r\n * @property {number} [maxHeight] maximum height\r\n */\r\n\r\nconst clampZoomOptions = {\r\n minWidth: null,\r\n minHeight: null,\r\n maxWidth: null,\r\n maxHeight: null\r\n};\r\n\r\nclass ClampZoom extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {ClampZoomOptions} [options]\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, clampZoomOptions, options);\r\n this.clamp();\r\n }\r\n\r\n resize()\r\n {\r\n this.clamp();\r\n }\r\n\r\n clamp()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n let width = this.parent.worldScreenWidth;\r\n let height = this.parent.worldScreenHeight;\r\n if (this.options.minWidth !== null && width < this.options.minWidth)\r\n {\r\n const original = this.parent.scale.x;\r\n this.parent.fitWidth(this.options.minWidth, false, false, true);\r\n this.parent.scale.y *= this.parent.scale.x / original;\r\n width = this.parent.worldScreenWidth;\r\n height = this.parent.worldScreenHeight;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });\r\n }\r\n if (this.options.maxWidth !== null && width > this.options.maxWidth)\r\n {\r\n const original = this.parent.scale.x;\r\n this.parent.fitWidth(this.options.maxWidth, false, false, true);\r\n this.parent.scale.y *= this.parent.scale.x / original;\r\n width = this.parent.worldScreenWidth;\r\n height = this.parent.worldScreenHeight;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });\r\n }\r\n if (this.options.minHeight !== null && height < this.options.minHeight)\r\n {\r\n const original = this.parent.scale.y;\r\n this.parent.fitHeight(this.options.minHeight, false, false, true);\r\n this.parent.scale.x *= this.parent.scale.y / original;\r\n width = this.parent.worldScreenWidth;\r\n height = this.parent.worldScreenHeight;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });\r\n }\r\n if (this.options.maxHeight !== null && height > this.options.maxHeight)\r\n {\r\n const original = this.parent.scale.y;\r\n this.parent.fitHeight(this.options.maxHeight, false, false, true);\r\n this.parent.scale.x *= this.parent.scale.y / original;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'clamp-zoom' });\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef {object} DecelerateOptions\r\n * @property {number} [friction=0.95] percent to decelerate after movement\r\n * @property {number} [bounce=0.8] percent to decelerate when past boundaries (only applicable when viewport.bounce() is active)\r\n * @property {number} [minSpeed=0.01] minimum velocity before stopping/reversing acceleration\r\n */\r\n\r\nconst decelerateOptions = {\r\n friction: 0.95,\r\n bounce: 0.8,\r\n minSpeed: 0.01\r\n};\r\n\r\nclass Decelerate extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {DecelerateOptions} [options]\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, decelerateOptions, options);\r\n this.saved = [];\r\n this.reset();\r\n this.parent.on('moved', data => this.moved(data));\r\n }\r\n\r\n destroy()\r\n {\r\n this.parent;\r\n }\r\n\r\n down()\r\n {\r\n this.saved = [];\r\n this.x = this.y = false;\r\n }\r\n\r\n isActive()\r\n {\r\n return this.x || this.y\r\n }\r\n\r\n move()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n const count = this.parent.input.count();\r\n if (count === 1 || (count > 1 && !this.parent.plugins.get('pinch')))\r\n {\r\n this.saved.push({ x: this.parent.x, y: this.parent.y, time: performance.now() });\r\n if (this.saved.length > 60)\r\n {\r\n this.saved.splice(0, 30);\r\n }\r\n }\r\n }\r\n\r\n moved(data)\r\n {\r\n if (this.saved.length)\r\n {\r\n const last = this.saved[this.saved.length - 1];\r\n if (data.type === 'clamp-x')\r\n {\r\n if (last.x === data.original.x)\r\n {\r\n last.x = this.parent.x;\r\n }\r\n }\r\n else if (data.type === 'clamp-y')\r\n {\r\n if (last.y === data.original.y)\r\n {\r\n last.y = this.parent.y;\r\n }\r\n }\r\n }\r\n }\r\n\r\n up()\r\n {\r\n if (this.parent.input.count() === 0 && this.saved.length)\r\n {\r\n const now = performance.now();\r\n for (let save of this.saved)\r\n {\r\n if (save.time >= now - 100)\r\n {\r\n const time = now - save.time;\r\n this.x = (this.parent.x - save.x) / time;\r\n this.y = (this.parent.y - save.y) / time;\r\n this.percentChangeX = this.percentChangeY = this.options.friction;\r\n break\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * manually activate plugin\r\n * @param {object} options\r\n * @param {number} [options.x]\r\n * @param {number} [options.y]\r\n */\r\n activate(options)\r\n {\r\n options = options || {};\r\n if (typeof options.x !== 'undefined')\r\n {\r\n this.x = options.x;\r\n this.percentChangeX = this.options.friction;\r\n }\r\n if (typeof options.y !== 'undefined')\r\n {\r\n this.y = options.y;\r\n this.percentChangeY = this.options.friction;\r\n }\r\n }\r\n\r\n update(elapsed)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n let moved;\r\n if (this.x)\r\n {\r\n this.parent.x += this.x * elapsed;\r\n this.x *= this.percentChangeX;\r\n if (Math.abs(this.x) < this.options.minSpeed)\r\n {\r\n this.x = 0;\r\n }\r\n moved = true;\r\n }\r\n if (this.y)\r\n {\r\n this.parent.y += this.y * elapsed;\r\n this.y *= this.percentChangeY;\r\n if (Math.abs(this.y) < this.options.minSpeed)\r\n {\r\n this.y = 0;\r\n }\r\n moved = true;\r\n }\r\n if (moved)\r\n {\r\n this.parent.emit('moved', { viewport: this.parent, type: 'decelerate' });\r\n }\r\n }\r\n\r\n reset()\r\n {\r\n this.x = this.y = null;\r\n }\r\n}\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar penner = createCommonjsModule(function (module, exports) {\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n {\n return module.exports = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) ; else if ((t /= d) === 1) ;\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) ; else if ((t /= d) === 1) ;\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) ; else if ((t /= d / 2) === 2) ;\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(commonjsGlobal);\n});\n\n/**\r\n * returns correct Penner equation using string or Function\r\n * @param {(function|string)} [ease]\r\n * @param {defaults} default penner equation to use if none is provided\r\n */\r\nfunction ease(ease, defaults)\r\n{\r\n if (!ease)\r\n {\r\n return penner[defaults]\r\n }\r\n else if (typeof ease === 'function')\r\n {\r\n return ease\r\n }\r\n else if (typeof ease === 'string')\r\n {\r\n return penner[ease]\r\n }\r\n}\n\n/**\r\n * @typedef {options} BounceOptions\r\n * @property {string} [sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right')\r\n * @property {number} [friction=0.5] friction to apply to decelerate if active\r\n * @property {number} [time=150] time in ms to finish bounce\r\n * @property {string|function} [ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)\r\n * @property {string} [underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen\r\n */\r\n\r\nconst bounceOptions = {\r\n sides: 'all',\r\n friction: 0.5,\r\n time: 150,\r\n ease: 'easeInOutSine',\r\n underflow: 'center'\r\n};\r\n\r\nclass Bounce extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {BounceOptions} [options]\r\n * @fires bounce-start-x\r\n * @fires bounce.end-x\r\n * @fires bounce-start-y\r\n * @fires bounce-end-y\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, bounceOptions, options);\r\n this.ease = ease(this.options.ease, 'easeInOutSine');\r\n if (this.options.sides)\r\n {\r\n if (this.options.sides === 'all')\r\n {\r\n this.top = this.bottom = this.left = this.right = true;\r\n }\r\n else if (this.options.sides === 'horizontal')\r\n {\r\n this.right = this.left = true;\r\n }\r\n else if (this.options.sides === 'vertical')\r\n {\r\n this.top = this.bottom = true;\r\n }\r\n else\r\n {\r\n this.top = this.options.sides.indexOf('top') !== -1;\r\n this.bottom = this.options.sides.indexOf('bottom') !== -1;\r\n this.left = this.options.sides.indexOf('left') !== -1;\r\n this.right = this.options.sides.indexOf('right') !== -1;\r\n }\r\n }\r\n this.parseUnderflow();\r\n this.last = {};\r\n this.reset();\r\n }\r\n\r\n parseUnderflow()\r\n {\r\n const clamp = this.options.underflow.toLowerCase();\r\n if (clamp === 'center')\r\n {\r\n this.underflowX = 0;\r\n this.underflowY = 0;\r\n }\r\n else\r\n {\r\n this.underflowX = (clamp.indexOf('left') !== -1) ? -1 : (clamp.indexOf('right') !== -1) ? 1 : 0;\r\n this.underflowY = (clamp.indexOf('top') !== -1) ? -1 : (clamp.indexOf('bottom') !== -1) ? 1 : 0;\r\n }\r\n }\r\n\r\n isActive()\r\n {\r\n return this.toX !== null || this.toY !== null\r\n }\r\n\r\n down()\r\n {\r\n this.toX = this.toY = null;\r\n }\r\n\r\n up()\r\n {\r\n this.bounce();\r\n }\r\n\r\n update(elapsed)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n this.bounce();\r\n if (this.toX)\r\n {\r\n const toX = this.toX;\r\n toX.time += elapsed;\r\n this.parent.emit('moved', { viewport: this.parent, type: 'bounce-x' });\r\n if (toX.time >= this.options.time)\r\n {\r\n this.parent.x = toX.end;\r\n this.toX = null;\r\n this.parent.emit('bounce-x-end', this.parent);\r\n }\r\n else\r\n {\r\n this.parent.x = this.ease(toX.time, toX.start, toX.delta, this.options.time);\r\n }\r\n }\r\n if (this.toY)\r\n {\r\n const toY = this.toY;\r\n toY.time += elapsed;\r\n this.parent.emit('moved', { viewport: this.parent, type: 'bounce-y' });\r\n if (toY.time >= this.options.time)\r\n {\r\n this.parent.y = toY.end;\r\n this.toY = null;\r\n this.parent.emit('bounce-y-end', this.parent);\r\n }\r\n else\r\n {\r\n this.parent.y = this.ease(toY.time, toY.start, toY.delta, this.options.time);\r\n }\r\n }\r\n }\r\n\r\n calcUnderflowX()\r\n {\r\n let x;\r\n switch (this.underflowX)\r\n {\r\n case -1:\r\n x = 0;\r\n break\r\n case 1:\r\n x = (this.parent.screenWidth - this.parent.screenWorldWidth);\r\n break\r\n default:\r\n x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2;\r\n }\r\n return x\r\n }\r\n\r\n calcUnderflowY()\r\n {\r\n let y;\r\n switch (this.underflowY)\r\n {\r\n case -1:\r\n y = 0;\r\n break\r\n case 1:\r\n y = (this.parent.screenHeight - this.parent.screenWorldHeight);\r\n break\r\n default:\r\n y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2;\r\n }\r\n return y\r\n }\r\n\r\n bounce()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n let oob;\r\n let decelerate = this.parent.plugins.get('decelerate');\r\n if (decelerate && (decelerate.x || decelerate.y))\r\n {\r\n if ((decelerate.x && decelerate.percentChangeX === decelerate.options.friction) || (decelerate.y && decelerate.percentChangeY === decelerate.options.friction))\r\n {\r\n oob = this.parent.OOB();\r\n if ((oob.left && this.left) || (oob.right && this.right))\r\n {\r\n decelerate.percentChangeX = this.options.friction;\r\n }\r\n if ((oob.top && this.top) || (oob.bottom && this.bottom))\r\n {\r\n decelerate.percentChangeY = this.options.friction;\r\n }\r\n }\r\n }\r\n const drag = this.parent.plugins.get('drag') || {};\r\n const pinch = this.parent.plugins.get('pinch') || {};\r\n decelerate = decelerate || {};\r\n if (!drag.active && !pinch.active && ((!this.toX || !this.toY) && (!decelerate.x || !decelerate.y)))\r\n {\r\n oob = oob || this.parent.OOB();\r\n const point = oob.cornerPoint;\r\n if (!this.toX && !decelerate.x)\r\n {\r\n let x = null;\r\n if (oob.left && this.left)\r\n {\r\n x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : 0;\r\n }\r\n else if (oob.right && this.right)\r\n {\r\n x = (this.parent.screenWorldWidth < this.parent.screenWidth) ? this.calcUnderflowX() : -point.x;\r\n }\r\n if (x !== null && this.parent.x !== x)\r\n {\r\n this.toX = { time: 0, start: this.parent.x, delta: x - this.parent.x, end: x };\r\n this.parent.emit('bounce-x-start', this.parent);\r\n }\r\n }\r\n if (!this.toY && !decelerate.y)\r\n {\r\n let y = null;\r\n if (oob.top && this.top)\r\n {\r\n y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : 0;\r\n }\r\n else if (oob.bottom && this.bottom)\r\n {\r\n y = (this.parent.screenWorldHeight < this.parent.screenHeight) ? this.calcUnderflowY() : -point.y;\r\n }\r\n if (y !== null && this.parent.y !== y)\r\n {\r\n this.toY = { time: 0, start: this.parent.y, delta: y - this.parent.y, end: y };\r\n this.parent.emit('bounce-y-start', this.parent);\r\n }\r\n }\r\n }\r\n }\r\n\r\n reset()\r\n {\r\n this.toX = this.toY = null;\r\n }\r\n}\n\n/**\r\n * @typedef SnapOptions\r\n * @property {boolean} [topLeft] snap to the top-left of viewport instead of center\r\n * @property {number} [friction=0.8] friction/frame to apply if decelerate is active\r\n * @property {number} [time=1000]\r\n * @property {string|function} [ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)\r\n * @property {boolean} [interrupt=true] pause snapping with any user input on the viewport\r\n * @property {boolean} [removeOnComplete] removes this plugin after snapping is complete\r\n * @property {boolean} [removeOnInterrupt] removes this plugin if interrupted by any user input\r\n * @property {boolean} [forceStart] starts the snap immediately regardless of whether the viewport is at the desired location\r\n */\r\n\r\nconst snapOptions = {\r\n topLeft: false,\r\n friction: 0.8,\r\n time: 1000,\r\n ease: 'easeInOutSine',\r\n interrupt: true,\r\n removeOnComplete: false,\r\n removeOnInterrupt: false,\r\n forceStart: false\r\n};\r\n\r\nclass Snap extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {SnapOptions} [options]\r\n * @event snap-start(Viewport) emitted each time a snap animation starts\r\n * @event snap-restart(Viewport) emitted each time a snap resets because of a change in viewport size\r\n * @event snap-end(Viewport) emitted each time snap reaches its target\r\n * @event snap-remove(Viewport) emitted if snap plugin is removed\r\n */\r\n constructor(parent, x, y, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, snapOptions, options);\r\n this.ease = ease(options.ease, 'easeInOutSine');\r\n this.x = x;\r\n this.y = y;\r\n if (this.options.forceStart)\r\n {\r\n this.snapStart();\r\n }\r\n }\r\n\r\n snapStart()\r\n {\r\n this.percent = 0;\r\n this.snapping = { time: 0 };\r\n const current = this.options.topLeft ? this.parent.corner : this.parent.center;\r\n this.deltaX = this.x - current.x;\r\n this.deltaY = this.y - current.y;\r\n this.startX = current.x;\r\n this.startY = current.y;\r\n this.parent.emit('snap-start', this.parent);\r\n }\r\n\r\n wheel()\r\n {\r\n if (this.options.removeOnInterrupt)\r\n {\r\n this.parent.plugins.remove('snap');\r\n }\r\n }\r\n\r\n down()\r\n {\r\n if (this.options.removeOnInterrupt)\r\n {\r\n this.parent.plugins.remove('snap');\r\n }\r\n else if (this.options.interrupt)\r\n {\r\n this.snapping = null;\r\n }\r\n }\r\n\r\n up()\r\n {\r\n if (this.parent.input.count() === 0)\r\n {\r\n const decelerate = this.parent.plugins.get('decelerate');\r\n if (decelerate && (decelerate.x || decelerate.y))\r\n {\r\n decelerate.percentChangeX = decelerate.percentChangeY = this.options.friction;\r\n }\r\n }\r\n }\r\n\r\n update(elapsed)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n if (this.options.interrupt && this.parent.input.count() !== 0)\r\n {\r\n return\r\n }\r\n if (!this.snapping)\r\n {\r\n const current = this.options.topLeft ? this.parent.corner : this.parent.center;\r\n if (current.x !== this.x || current.y !== this.y)\r\n {\r\n this.snapStart();\r\n }\r\n }\r\n else\r\n {\r\n const snapping = this.snapping;\r\n snapping.time += elapsed;\r\n let finished, x, y;\r\n if (snapping.time > this.options.time)\r\n {\r\n finished = true;\r\n x = this.startX + this.deltaX;\r\n y = this.startY + this.deltaY;\r\n }\r\n else\r\n {\r\n const percent = this.ease(snapping.time, 0, 1, this.options.time);\r\n x = this.startX + this.deltaX * percent;\r\n y = this.startY + this.deltaY * percent;\r\n }\r\n if (this.options.topLeft)\r\n {\r\n this.parent.moveCorner(x, y);\r\n }\r\n else\r\n {\r\n this.parent.moveCenter(x, y);\r\n }\r\n this.parent.emit('moved', { viewport: this.parent, type: 'snap' });\r\n if (finished)\r\n {\r\n if (this.options.removeOnComplete)\r\n {\r\n this.parent.plugins.remove('snap');\r\n }\r\n this.parent.emit('snap-end', this.parent);\r\n this.snapping = null;\r\n }\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef {Object} SnapZoomOptions\r\n * @property {number} [width=0] the desired width to snap (to maintain aspect ratio, choose only width or height)\r\n * @property {number} [height=0] the desired height to snap (to maintain aspect ratio, choose only width or height)\r\n * @property {number} [time=1000] time for snapping in ms\r\n * @property {(string|function)} [ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)\r\n * @property {PIXI.Point} [center] place this point at center during zoom instead of center of the viewport\r\n * @property {boolean} [interrupt=true] pause snapping with any user input on the viewport\r\n * @property {boolean} [removeOnComplete] removes this plugin after snapping is complete\r\n * @property {boolean} [removeOnInterrupt] removes this plugin if interrupted by any user input\r\n * @property {boolean} [forceStart] starts the snap immediately regardless of whether the viewport is at the desired zoom\r\n * @property {boolean} [noMove] zoom but do not move\r\n */\r\n\r\nconst snapZoomOptions = {\r\n width: 0,\r\n height: 0,\r\n time: 1000,\r\n ease: 'easeInOutSine',\r\n center: null,\r\n interrupt: true,\r\n removeOnComplete: false,\r\n removeOnInterrupts: false,\r\n forceStart: false,\r\n noMove: false\r\n};\r\nclass SnapZoom extends Plugin\r\n{\r\n /**\r\n * @param {Viewport} parent\r\n * @param {SnapZoomOptions} options\r\n * @event snap-zoom-start(Viewport) emitted each time a fit animation starts\r\n * @event snap-zoom-end(Viewport) emitted each time fit reaches its target\r\n * @event snap-zoom-end(Viewport) emitted each time fit reaches its target\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, snapZoomOptions, options);\r\n this.ease = ease(this.options.ease);\r\n if (this.options.width > 0)\r\n {\r\n this.xScale = parent.screenWidth / this.options.width;\r\n }\r\n if (this.options.height > 0)\r\n {\r\n this.yScale = parent.screenHeight / this.options.height;\r\n }\r\n this.xIndependent = this.xScale ? true : false;\r\n this.yIndependent = this.yScale ? true : false;\r\n this.xScale = this.xIndependent ? this.xScale : this.yScale;\r\n this.yScale = this.yIndependent ? this.yScale : this.xScale;\r\n\r\n if (this.options.time === 0)\r\n {\r\n parent.container.scale.x = this.xScale;\r\n parent.container.scale.y = this.yScale;\r\n if (this.options.removeOnComplete)\r\n {\r\n this.parent.plugins.remove('snap-zoom');\r\n }\r\n }\r\n else if (options.forceStart)\r\n {\r\n this.createSnapping();\r\n }\r\n }\r\n\r\n createSnapping()\r\n {\r\n const scale = this.parent.scale;\r\n this.snapping = { time: 0, startX: scale.x, startY: scale.y, deltaX: this.xScale - scale.x, deltaY: this.yScale - scale.y };\r\n this.parent.emit('snap-zoom-start', this.parent);\r\n }\r\n\r\n resize()\r\n {\r\n this.snapping = null;\r\n\r\n if (this.options.width > 0)\r\n {\r\n this.xScale = this.parent.screenWidth / this.options.width;\r\n }\r\n if (this.options.height > 0)\r\n {\r\n this.yScale = this.parent.screenHeight / this.options.height;\r\n }\r\n this.xScale = this.xIndependent ? this.xScale : this.yScale;\r\n this.yScale = this.yIndependent ? this.yScale : this.xScale;\r\n }\r\n\r\n reset()\r\n {\r\n this.snapping = null;\r\n }\r\n\r\n wheel()\r\n {\r\n if (this.options.removeOnInterrupt)\r\n {\r\n this.parent.plugins.remove('snap-zoom');\r\n }\r\n }\r\n\r\n down()\r\n {\r\n if (this.options.removeOnInterrupt)\r\n {\r\n this.parent.plugins.remove('snap-zoom');\r\n }\r\n else if (this.options.interrupt)\r\n {\r\n this.snapping = null;\r\n }\r\n }\r\n\r\n update(elapsed)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n if (this.options.interrupt && this.parent.input.count() !== 0)\r\n {\r\n return\r\n }\r\n\r\n let oldCenter;\r\n if (!this.options.center && !this.options.noMove)\r\n {\r\n oldCenter = this.parent.center;\r\n }\r\n if (!this.snapping)\r\n {\r\n if (this.parent.scale.x !== this.xScale || this.parent.scale.y !== this.yScale)\r\n {\r\n this.createSnapping();\r\n }\r\n }\r\n else if (this.snapping)\r\n {\r\n const snapping = this.snapping;\r\n snapping.time += elapsed;\r\n if (snapping.time >= this.options.time)\r\n {\r\n this.parent.scale.set(this.xScale, this.yScale);\r\n if (this.options.removeOnComplete)\r\n {\r\n this.parent.plugins.remove('snap-zoom');\r\n }\r\n this.parent.emit('snap-zoom-end', this.parent);\r\n this.snapping = null;\r\n }\r\n else\r\n {\r\n const snapping = this.snapping;\r\n this.parent.scale.x = this.ease(snapping.time, snapping.startX, snapping.deltaX, this.options.time);\r\n this.parent.scale.y = this.ease(snapping.time, snapping.startY, snapping.deltaY, this.options.time);\r\n }\r\n const clamp = this.parent.plugins.get('clamp-zoom');\r\n if (clamp)\r\n {\r\n clamp.clamp();\r\n }\r\n if (!this.options.noMove)\r\n {\r\n if (!this.options.center)\r\n {\r\n this.parent.moveCenter(oldCenter);\r\n }\r\n else\r\n {\r\n this.parent.moveCenter(this.options.center);\r\n }\r\n }\r\n }\r\n }\r\n\r\n resume()\r\n {\r\n this.snapping = null;\r\n super.resume();\r\n }\r\n}\n\n/**\r\n * @typedef {object} FollowOptions\r\n * @property {number} [speed=0] to follow in pixels/frame (0=teleport to location)\r\n * @property {number} [acceleration] set acceleration to accelerate and decelerate at this rate; speed cannot be 0 to use acceleration\r\n * @property {number} [radius] radius (in world coordinates) of center circle where movement is allowed without moving the viewport\r\n */\r\n\r\nconst followOptions = {\r\n speed: 0,\r\n acceleration: null,\r\n radius: null\r\n};\r\n\r\nclass Follow extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {PIXI.DisplayObject} target to follow\r\n * @param {FollowOptions} [options]\r\n */\r\n constructor(parent, target, options = {})\r\n {\r\n super(parent);\r\n this.target = target;\r\n this.options = Object.assign({}, followOptions, options);\r\n this.velocity = { x: 0, y: 0 };\r\n }\r\n\r\n update(elapsed)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n const center = this.parent.center;\r\n let toX = this.target.x,\r\n toY = this.target.y;\r\n if (this.options.radius)\r\n {\r\n const distance = Math.sqrt(Math.pow(this.target.y - center.y, 2) + Math.pow(this.target.x - center.x, 2));\r\n if (distance > this.options.radius)\r\n {\r\n const angle = Math.atan2(this.target.y - center.y, this.target.x - center.x);\r\n toX = this.target.x - Math.cos(angle) * this.options.radius;\r\n toY = this.target.y - Math.sin(angle) * this.options.radius;\r\n }\r\n else\r\n {\r\n return\r\n }\r\n }\r\n\r\n const deltaX = toX - center.x;\r\n const deltaY = toY - center.y;\r\n if (deltaX || deltaY)\r\n {\r\n if (this.options.speed)\r\n {\r\n if (this.options.acceleration)\r\n {\r\n const angle = Math.atan2(toY - center.y, toX - center.x);\r\n const distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\r\n if (distance)\r\n {\r\n const decelerationDistance = (Math.pow(this.velocity.x, 2) + Math.pow(this.velocity.y, 2)) / (2 * this.options.acceleration);\r\n if (distance > decelerationDistance)\r\n {\r\n this.velocity = {\r\n x: Math.min(this.velocity.x + this.options.acceleration * elapsed, this.options.speed),\r\n y: Math.min(this.velocity.y + this.options.acceleration * elapsed, this.options.speed)\r\n };\r\n }\r\n else\r\n {\r\n this.velocity = {\r\n x: Math.max(this.velocity.x - this.options.acceleration * this.options.speed, 0),\r\n y: Math.max(this.velocity.y - this.options.acceleration * this.options.speed, 0)\r\n };\r\n }\r\n const changeX = Math.cos(angle) * this.velocity.x;\r\n const changeY = Math.sin(angle) * this.velocity.y;\r\n const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX;\r\n const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY;\r\n this.parent.moveCenter(x, y);\r\n this.parent.emit('moved', { viewport: this.parent, type: 'follow' });\r\n }\r\n }\r\n else\r\n {\r\n const angle = Math.atan2(toY - center.y, toX - center.x);\r\n const changeX = Math.cos(angle) * this.options.speed;\r\n const changeY = Math.sin(angle) * this.options.speed;\r\n const x = Math.abs(changeX) > Math.abs(deltaX) ? toX : center.x + changeX;\r\n const y = Math.abs(changeY) > Math.abs(deltaY) ? toY : center.y + changeY;\r\n this.parent.moveCenter(x, y);\r\n this.parent.emit('moved', { viewport: this.parent, type: 'follow' });\r\n }\r\n }\r\n else\r\n {\r\n this.parent.moveCenter(toX, toY);\r\n this.parent.emit('moved', { viewport: this.parent, type: 'follow' });\r\n }\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef WheelOptions\r\n * @property {number} [percent=0.1] percent to scroll with each spin\r\n * @property {number} [smooth] smooth the zooming by providing the number of frames to zoom between wheel spins\r\n * @property {boolean} [interrupt=true] stop smoothing with any user input on the viewport\r\n * @property {boolean} [reverse] reverse the direction of the scroll\r\n * @property {PIXI.Point} [center] place this point at center during zoom instead of current mouse position\r\n */\r\n\r\nconst wheelOptions = {\r\n percent: 0.1,\r\n smooth: false,\r\n interrupt: true,\r\n reverse: false,\r\n center: null\r\n};\r\n\r\nclass Wheel extends Plugin\r\n{\r\n /**\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {WheelOptions} [options]\r\n * @event wheel({wheel: {dx, dy, dz}, event, viewport})\r\n */\r\n constructor(parent, options = {})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, wheelOptions, options);\r\n }\r\n\r\n down()\r\n {\r\n if (this.options.interrupt)\r\n {\r\n this.smoothing = null;\r\n }\r\n }\r\n\r\n update()\r\n {\r\n if (this.smoothing)\r\n {\r\n const point = this.smoothingCenter;\r\n const change = this.smoothing;\r\n let oldPoint;\r\n if (!this.options.center)\r\n {\r\n oldPoint = this.parent.toLocal(point);\r\n }\r\n this.parent.scale.x += change.x;\r\n this.parent.scale.y += change.y;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' });\r\n const clamp = this.parent.plugins.get('clamp-zoom');\r\n if (clamp)\r\n {\r\n clamp.clamp();\r\n }\r\n if (this.options.center)\r\n {\r\n this.parent.moveCenter(this.options.center);\r\n }\r\n else\r\n {\r\n const newPoint = this.parent.toGlobal(oldPoint);\r\n this.parent.x += point.x - newPoint.x;\r\n this.parent.y += point.y - newPoint.y;\r\n }\r\n this.smoothingCount++;\r\n if (this.smoothingCount >= this.options.smooth)\r\n {\r\n this.smoothing = null;\r\n }\r\n }\r\n }\r\n\r\n wheel(e)\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n let point = this.parent.input.getPointerPosition(e);\r\n const sign = this.options.reverse ? -1 : 1;\r\n const step = sign * -e.deltaY * (e.deltaMode ? 120 : 1) / 500;\r\n const change = Math.pow(2, (1 + this.options.percent) * step);\r\n if (this.options.smooth)\r\n {\r\n const original = {\r\n x: this.smoothing ? this.smoothing.x * (this.options.smooth - this.smoothingCount) : 0,\r\n y: this.smoothing ? this.smoothing.y * (this.options.smooth - this.smoothingCount) : 0\r\n };\r\n this.smoothing = {\r\n x: ((this.parent.scale.x + original.x) * change - this.parent.scale.x) / this.options.smooth,\r\n y: ((this.parent.scale.y + original.y) * change - this.parent.scale.y) / this.options.smooth\r\n };\r\n this.smoothingCount = 0;\r\n this.smoothingCenter = point;\r\n }\r\n else\r\n {\r\n let oldPoint;\r\n if (!this.options.center)\r\n {\r\n oldPoint = this.parent.toLocal(point);\r\n }\r\n this.parent.scale.x *= change;\r\n this.parent.scale.y *= change;\r\n this.parent.emit('zoomed', { viewport: this.parent, type: 'wheel' });\r\n const clamp = this.parent.plugins.get('clamp-zoom');\r\n if (clamp)\r\n {\r\n clamp.clamp();\r\n }\r\n if (this.options.center)\r\n {\r\n this.parent.moveCenter(this.options.center);\r\n }\r\n else\r\n {\r\n const newPoint = this.parent.toGlobal(oldPoint);\r\n this.parent.x += point.x - newPoint.x;\r\n this.parent.y += point.y - newPoint.y;\r\n }\r\n }\r\n this.parent.emit('moved', { viewport: this.parent, type: 'wheel' });\r\n this.parent.emit('wheel', { wheel: { dx: e.deltaX, dy: e.deltaY, dz: e.deltaZ }, event: e, viewport: this.parent });\r\n if (!this.parent.options.passiveWheel)\r\n {\r\n return true\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef MouseEdgesOptions\r\n * @property {number} [radius] distance from center of screen in screen pixels\r\n * @property {number} [distance] distance from all sides in screen pixels\r\n * @property {number} [top] alternatively, set top distance (leave unset for no top scroll)\r\n * @property {number} [bottom] alternatively, set bottom distance (leave unset for no top scroll)\r\n * @property {number} [left] alternatively, set left distance (leave unset for no top scroll)\r\n * @property {number} [right] alternatively, set right distance (leave unset for no top scroll)\r\n * @property {number} [speed=8] speed in pixels/frame to scroll viewport\r\n * @property {boolean} [reverse] reverse direction of scroll\r\n * @property {boolean} [noDecelerate] don't use decelerate plugin even if it's installed\r\n * @property {boolean} [linear] if using radius, use linear movement (+/- 1, +/- 1) instead of angled movement (Math.cos(angle from center), Math.sin(angle from center))\r\n * @property {boolean} [allowButtons] allows plugin to continue working even when there's a mousedown event\r\n */\r\n\r\nconst mouseEdgesOptions = {\r\n radius: null,\r\n distance: null,\r\n top: null,\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n speed: 8,\r\n reverse: false,\r\n noDecelerate: false,\r\n linear: false,\r\n allowButtons: false\r\n};\r\n\r\nclass MouseEdges extends Plugin\r\n{\r\n /**\r\n * Scroll viewport when mouse hovers near one of the edges.\r\n * @private\r\n * @param {Viewport} parent\r\n * @param {MouseEdgeOptions} [options]\r\n * @event mouse-edge-start(Viewport) emitted when mouse-edge starts\r\n * @event mouse-edge-end(Viewport) emitted when mouse-edge ends\r\n */\r\n constructor(parent, options={})\r\n {\r\n super(parent);\r\n this.options = Object.assign({}, mouseEdgesOptions, options);\r\n this.reverse = this.options.reverse ? 1 : -1;\r\n this.radiusSquared = Math.pow(this.options.radius, 2);\r\n this.resize();\r\n }\r\n\r\n resize()\r\n {\r\n const distance = this.options.distance;\r\n if (distance !== null)\r\n {\r\n this.left = distance;\r\n this.top = distance;\r\n this.right = this.parent.worldScreenWidth - distance;\r\n this.bottom = this.parent.worldScreenHeight - distance;\r\n }\r\n else if (!this.radius)\r\n {\r\n this.left = this.options.left;\r\n this.top = this.options.top;\r\n this.right = this.options.right === null ? null : this.parent.worldScreenWidth - this.options.right;\r\n this.bottom = this.options.bottom === null ? null : this.parent.worldScreenHeight - this.options.bottom;\r\n }\r\n }\r\n\r\n down()\r\n {\r\n if (!this.options.allowButtons)\r\n {\r\n this.horizontal = this.vertical = null;\r\n }\r\n }\r\n\r\n move(event)\r\n {\r\n if ((event.data.pointerType !== 'mouse' && event.data.identifier !== 1) || (!this.options.allowButtons && event.data.buttons !== 0))\r\n {\r\n return\r\n }\r\n const x = event.data.global.x;\r\n const y = event.data.global.y;\r\n\r\n if (this.radiusSquared)\r\n {\r\n const center = this.parent.toScreen(this.parent.center);\r\n const distance = Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2);\r\n if (distance >= this.radiusSquared)\r\n {\r\n const angle = Math.atan2(center.y - y, center.x - x);\r\n if (this.options.linear)\r\n {\r\n this.horizontal = Math.round(Math.cos(angle)) * this.options.speed * this.reverse * (60 / 1000);\r\n this.vertical = Math.round(Math.sin(angle)) * this.options.speed * this.reverse * (60 / 1000);\r\n }\r\n else\r\n {\r\n this.horizontal = Math.cos(angle) * this.options.speed * this.reverse * (60 / 1000);\r\n this.vertical = Math.sin(angle) * this.options.speed * this.reverse * (60 / 1000);\r\n }\r\n }\r\n else\r\n {\r\n if (this.horizontal)\r\n {\r\n this.decelerateHorizontal();\r\n }\r\n if (this.vertical)\r\n {\r\n this.decelerateVertical();\r\n }\r\n this.horizontal = this.vertical = 0;\r\n }\r\n }\r\n else\r\n {\r\n if (this.left !== null && x < this.left)\r\n {\r\n this.horizontal = 1 * this.reverse * this.options.speed * (60 / 1000);\r\n }\r\n else if (this.right !== null && x > this.right)\r\n {\r\n this.horizontal = -1 * this.reverse * this.options.speed * (60 / 1000);\r\n }\r\n else\r\n {\r\n this.decelerateHorizontal();\r\n this.horizontal = 0;\r\n }\r\n if (this.top !== null && y < this.top)\r\n {\r\n this.vertical = 1 * this.reverse * this.options.speed * (60 / 1000);\r\n }\r\n else if (this.bottom !== null && y > this.bottom)\r\n {\r\n this.vertical = -1 * this.reverse * this.options.speed * (60 / 1000);\r\n }\r\n else\r\n {\r\n this.decelerateVertical();\r\n this.vertical = 0;\r\n }\r\n }\r\n }\r\n\r\n decelerateHorizontal()\r\n {\r\n const decelerate = this.parent.plugins.get('decelerate');\r\n if (this.horizontal && decelerate && !this.options.noDecelerate)\r\n {\r\n decelerate.activate({ x: (this.horizontal * this.options.speed * this.reverse) / (1000 / 60) });\r\n }\r\n }\r\n\r\n decelerateVertical()\r\n {\r\n const decelerate = this.parent.plugins.get('decelerate');\r\n if (this.vertical && decelerate && !this.options.noDecelerate)\r\n {\r\n decelerate.activate({ y: (this.vertical * this.options.speed * this.reverse) / (1000 / 60)});\r\n }\r\n }\r\n\r\n up()\r\n {\r\n if (this.horizontal)\r\n {\r\n this.decelerateHorizontal();\r\n }\r\n if (this.vertical)\r\n {\r\n this.decelerateVertical();\r\n }\r\n this.horizontal = this.vertical = null;\r\n }\r\n\r\n update()\r\n {\r\n if (this.paused)\r\n {\r\n return\r\n }\r\n\r\n if (this.horizontal || this.vertical)\r\n {\r\n const center = this.parent.center;\r\n if (this.horizontal)\r\n {\r\n center.x += this.horizontal * this.options.speed;\r\n }\r\n if (this.vertical)\r\n {\r\n center.y += this.vertical * this.options.speed;\r\n }\r\n this.parent.moveCenter(center);\r\n this.parent.emit('moved', { viewport: this.parent, type: 'mouse-edges' });\r\n }\r\n }\r\n}\n\n/**\r\n * @typedef {object} ViewportOptions\r\n * @property {number} [screenWidth=window.innerWidth]\r\n * @property {number} [screenHeight=window.innerHeight]\r\n * @property {number} [worldWidth=this.width]\r\n * @property {number} [worldHeight=this.height]\r\n * @property {number} [threshold=5] number of pixels to move to trigger an input event (e.g., drag, pinch) or disable a clicked event\r\n * @property {boolean} [passiveWheel=true] whether the 'wheel' event is set to passive (note: if false, e.preventDefault() will be called when wheel is used over the viewport)\r\n * @property {boolean} [stopPropagation=false] whether to stopPropagation of events that impact the viewport (except wheel events, see options.passiveWheel)\r\n * @property {HitArea} [forceHitArea] change the default hitArea from world size to a new value\r\n * @property {boolean} [noTicker] set this if you want to manually call update() function on each frame\r\n * @property {PIXI.Ticker} [ticker=PIXI.Ticker.shared] use this PIXI.ticker for updates\r\n * @property {PIXI.InteractionManager} [interaction=null] InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer postion relative to canvas location on screen\r\n * @property {HTMLElement} [divWheel=document.body] div to attach the wheel event\r\n * @property {boolean} [disableOnContextMenu] remove oncontextmenu=() => {} from the divWheel element\r\n */\r\n\r\nconst viewportOptions = {\r\n screenWidth: window.innerWidth,\r\n screenHeight: window.innerHeight,\r\n worldWidth: null,\r\n worldHeight: null,\r\n threshold: 5,\r\n passiveWheel: true,\r\n stopPropagation: false,\r\n forceHitArea: null,\r\n noTicker: false,\r\n interaction: null,\r\n disableOnContextMenu: false\r\n};\r\n\r\n/**\r\n * Main class to use when creating a Viewport\r\n */\r\nclass Viewport extends Container\r\n{\r\n /**\r\n * @param {ViewportOptions} [options]\r\n * @fires clicked\r\n * @fires drag-start\r\n * @fires drag-end\r\n * @fires drag-remove\r\n * @fires pinch-start\r\n * @fires pinch-end\r\n * @fires pinch-remove\r\n * @fires snap-start\r\n * @fires snap-end\r\n * @fires snap-remove\r\n * @fires snap-zoom-start\r\n * @fires snap-zoom-end\r\n * @fires snap-zoom-remove\r\n * @fires bounce-x-start\r\n * @fires bounce-x-end\r\n * @fires bounce-y-start\r\n * @fires bounce-y-end\r\n * @fires bounce-remove\r\n * @fires wheel\r\n * @fires wheel-remove\r\n * @fires wheel-scroll\r\n * @fires wheel-scroll-remove\r\n * @fires mouse-edge-start\r\n * @fires mouse-edge-end\r\n * @fires mouse-edge-remove\r\n * @fires moved\r\n * @fires moved-end\r\n * @fires zoomed\r\n * @fires zoomed-end\r\n * @fires frame-end\r\n */\r\n constructor(options = {})\r\n {\r\n super();\r\n this.options = Object.assign({}, viewportOptions, options);\r\n\r\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\r\n if (options.ticker)\r\n {\r\n this.options.ticker = options.ticker;\r\n }\r\n else\r\n {\r\n // to avoid Rollup transforming our import, save pixi namespace in a variable\r\n // from here: https://github.com/pixijs/pixi.js/issues/5757\r\n let ticker;\r\n const pixiNS = PIXI;\r\n if (parseInt(/^(\\d+)\\./.exec(VERSION)[1]) < 5)\r\n {\r\n ticker = pixiNS.ticker.shared;\r\n }\r\n else\r\n {\r\n ticker = pixiNS.Ticker.shared;\r\n }\r\n this.options.ticker = options.ticker || ticker;\r\n }\r\n\r\n /** @type {number} */\r\n this.screenWidth = this.options.screenWidth;\r\n\r\n /** @type {number} */\r\n this.screenHeight = this.options.screenHeight;\r\n\r\n this._worldWidth = this.options.worldWidth;\r\n this._worldHeight = this.options.worldHeight;\r\n this.forceHitArea = this.options.forceHitArea;\r\n\r\n /**\r\n * number of pixels to move to trigger an input event (e.g., drag, pinch) or disable a clicked event\r\n * @type {number}\r\n */\r\n this.threshold = this.options.threshold;\r\n\r\n this.options.divWheel = this.options.divWheel || document.body;\r\n\r\n if (this.options.disableOnContextMenu)\r\n {\r\n this.options.divWheel.oncontextmenu = e => e.preventDefault();\r\n }\r\n\r\n if (!this.options.noTicker)\r\n {\r\n this.tickerFunction = () => this.update(this.options.ticker.elapsedMS);\r\n this.options.ticker.add(this.tickerFunction);\r\n }\r\n\r\n this.input = new InputManager(this);\r\n\r\n /**\r\n * Use this to add user plugins or access existing plugins (e.g., to pause, resume, or remove them)\r\n * @type {PluginManager}\r\n */\r\n this.plugins = new PluginManager(this);\r\n }\r\n\r\n /**\r\n * overrides PIXI.Container's destroy to also remove the 'wheel' and PIXI.Ticker listeners\r\n * @param {(object|boolean)} [options] - Options parameter. A boolean will act as if all options have been set to that value\r\n * @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.\r\n * @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\r\n * @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 */\r\n destroy(options)\r\n {\r\n if (!this.options.noTicker)\r\n {\r\n this.options.ticker.remove(this.tickerFunction);\r\n }\r\n this.input.destroy();\r\n super.destroy(options);\r\n }\r\n\r\n /**\r\n * update viewport on each frame\r\n * by default, you do not need to call this unless you set options.noTicker=true\r\n * @param {number} elapsed time in milliseconds since last update\r\n */\r\n update(elapsed)\r\n {\r\n if (!this.pause)\r\n {\r\n this.plugins.update(elapsed);\r\n\r\n if (this.lastViewport)\r\n {\r\n // check for moved-end event\r\n if (this.lastViewport.x !== this.x || this.lastViewport.y !== this.y)\r\n {\r\n this.moving = true;\r\n }\r\n else\r\n {\r\n if (this.moving)\r\n {\r\n this.emit('moved-end', this);\r\n this.moving = false;\r\n }\r\n }\r\n // check for zoomed-end event\r\n if (this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y)\r\n {\r\n this.zooming = true;\r\n }\r\n else\r\n {\r\n if (this.zooming)\r\n {\r\n this.emit('zoomed-end', this);\r\n this.zooming = false;\r\n }\r\n }\r\n }\r\n\r\n if (!this.forceHitArea)\r\n {\r\n this._hitAreaDefault = new Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight);\r\n this.hitArea = this._hitAreaDefault;\r\n }\r\n\r\n this._dirty = this._dirty || !this.lastViewport ||\r\n this.lastViewport.x !== this.x || this.lastViewport.y !== this.y ||\r\n this.lastViewport.scaleX !== this.scale.x || this.lastViewport.scaleY !== this.scale.y;\r\n\r\n this.lastViewport = {\r\n x: this.x,\r\n y: this.y,\r\n scaleX: this.scale.x,\r\n scaleY: this.scale.y\r\n };\r\n this.emit('frame-end', this);\r\n }\r\n }\r\n\r\n /**\r\n * use this to set screen and world sizes--needed for pinch/wheel/clamp/bounce\r\n * @param {number} [screenWidth=window.innerWidth]\r\n * @param {number} [screenHeight=window.innerHeight]\r\n * @param {number} [worldWidth]\r\n * @param {number} [worldHeight]\r\n */\r\n resize(screenWidth = window.innerWidth, screenHeight = window.innerHeight, worldWidth, worldHeight)\r\n {\r\n this.screenWidth = screenWidth;\r\n this.screenHeight = screenHeight;\r\n if (typeof worldWidth !== 'undefined')\r\n {\r\n this._worldWidth = worldWidth;\r\n }\r\n if (typeof worldHeight !== 'undefined')\r\n {\r\n this._worldHeight = worldHeight;\r\n }\r\n this.plugins.resize();\r\n }\r\n\r\n /**\r\n * world width in pixels\r\n * @type {number}\r\n */\r\n get worldWidth()\r\n {\r\n if (this._worldWidth)\r\n {\r\n return this._worldWidth\r\n }\r\n else\r\n {\r\n return this.width / this.scale.x\r\n }\r\n }\r\n set worldWidth(value)\r\n {\r\n this._worldWidth = value;\r\n this.plugins.resize();\r\n }\r\n\r\n /**\r\n * world height in pixels\r\n * @type {number}\r\n */\r\n get worldHeight()\r\n {\r\n if (this._worldHeight)\r\n {\r\n return this._worldHeight\r\n }\r\n else\r\n {\r\n return this.height / this.scale.y\r\n }\r\n }\r\n set worldHeight(value)\r\n {\r\n this._worldHeight = value;\r\n this.plugins.resize();\r\n }\r\n\r\n /**\r\n * get visible bounds of viewport\r\n * @returns {PIXI.Rectangle}\r\n */\r\n getVisibleBounds()\r\n {\r\n return new Rectangle(this.left, this.top, this.worldScreenWidth, this.worldScreenHeight)\r\n }\r\n\r\n /**\r\n * change coordinates from screen to world\r\n * @param {(number|PIXI.Point)} x or point\r\n * @param {number} [y]\r\n * @return {PIXI.Point}\r\n */\r\n toWorld(x, y)\r\n {\r\n if (arguments.length === 2)\r\n {\r\n return this.toLocal(new Point(x, y))\r\n }\r\n else\r\n {\r\n return this.toLocal(x)\r\n }\r\n }\r\n\r\n /**\r\n * change coordinates from world to screen\r\n * @param {(number|PIXI.Point)} x or point\r\n * @param {number} [y]\r\n * @return {PIXI.Point}\r\n */\r\n toScreen(x, y)\r\n {\r\n if (arguments.length === 2)\r\n {\r\n return this.toGlobal(new Point(x, y))\r\n }\r\n else\r\n {\r\n return this.toGlobal(x)\r\n }\r\n }\r\n\r\n /**\r\n * screen width in world coordinates\r\n * @type {number}\r\n */\r\n get worldScreenWidth()\r\n {\r\n return this.screenWidth / this.scale.x\r\n }\r\n\r\n /**\r\n * screen height in world coordinates\r\n * @type {number}\r\n */\r\n get worldScreenHeight()\r\n {\r\n return this.screenHeight / this.scale.y\r\n }\r\n\r\n /**\r\n * world width in screen coordinates\r\n * @type {number}\r\n */\r\n get screenWorldWidth()\r\n {\r\n return this.worldWidth * this.scale.x\r\n }\r\n\r\n /**\r\n * world height in screen coordinates\r\n * @type {number}\r\n */\r\n get screenWorldHeight()\r\n {\r\n return this.worldHeight * this.scale.y\r\n }\r\n\r\n /**\r\n * center of screen in world coordinates\r\n * @type {PIXI.Point}\r\n */\r\n get center()\r\n {\r\n return new Point(this.worldScreenWidth / 2 - this.x / this.scale.x, this.worldScreenHeight / 2 - this.y / this.scale.y)\r\n }\r\n set center(value)\r\n {\r\n this.moveCenter(value);\r\n }\r\n\r\n /**\r\n * move center of viewport to point\r\n * @param {(number|PIXI.Point)} x or point\r\n * @param {number} [y]\r\n * @return {Viewport} this\r\n */\r\n moveCenter()\r\n {\r\n let x, y;\r\n if (!isNaN(arguments[0]))\r\n {\r\n x = arguments[0];\r\n y = arguments[1];\r\n }\r\n else\r\n {\r\n x = arguments[0].x;\r\n y = arguments[0].y;\r\n }\r\n this.position.set((this.worldScreenWidth / 2 - x) * this.scale.x, (this.worldScreenHeight / 2 - y) * this.scale.y);\r\n this.plugins.reset();\r\n this.dirty = true;\r\n return this\r\n }\r\n\r\n /**\r\n * top-left corner of Viewport\r\n * @type {PIXI.Point}\r\n */\r\n get corner()\r\n {\r\n return new Point(-this.x / this.scale.x, -this.y / this.scale.y)\r\n }\r\n set corner(value)\r\n {\r\n this.moveCorner(value);\r\n }\r\n\r\n /**\r\n * move viewport's top-left corner; also clamps and resets decelerate and bounce (as needed)\r\n * @param {(number|PIXI.Point)} x or point\r\n * @param {number} [y]\r\n * @return {Viewport} this\r\n */\r\n moveCorner(x, y)\r\n {\r\n if (arguments.length === 1)\r\n {\r\n this.position.set(-x.x * this.scale.x, -x.y * this.scale.y);\r\n }\r\n else\r\n {\r\n this.position.set(-x * this.scale.x, -y * this.scale.y);\r\n }\r\n this.plugins.reset();\r\n return this\r\n }\r\n\r\n /**\r\n * change zoom so the width fits in the viewport\r\n * @param {number} [width=this.worldWidth] in world coordinates\r\n * @param {boolean} [center] maintain the same center\r\n * @param {boolean} [scaleY=true] whether to set scaleY=scaleX\r\n * @param {boolean} [noClamp] whether to disable clamp-zoom\r\n * @returns {Viewport} this\r\n */\r\n fitWidth(width, center, scaleY = true, noClamp)\r\n {\r\n let save;\r\n if (center)\r\n {\r\n save = this.center;\r\n }\r\n this.scale.x = this.screenWidth / width;\r\n\r\n if (scaleY)\r\n {\r\n this.scale.y = this.scale.x;\r\n }\r\n\r\n const clampZoom = this.plugins.get('clamp-zoom');\r\n if (!noClamp && clampZoom)\r\n {\r\n clampZoom.clamp();\r\n }\r\n\r\n if (center)\r\n {\r\n this.moveCenter(save);\r\n }\r\n return this\r\n }\r\n\r\n /**\r\n * change zoom so the height fits in the viewport\r\n * @param {number} [height=this.worldHeight] in world coordinates\r\n * @param {boolean} [center] maintain the same center of the screen after zoom\r\n * @param {boolean} [scaleX=true] whether to set scaleX = scaleY\r\n * @param {boolean} [noClamp] whether to disable clamp-zoom\r\n * @returns {Viewport} this\r\n */\r\n fitHeight(height, center, scaleX = true, noClamp)\r\n {\r\n let save;\r\n if (center)\r\n {\r\n save = this.center;\r\n }\r\n this.scale.y = this.screenHeight / height;\r\n\r\n if (scaleX)\r\n {\r\n this.scale.x = this.scale.y;\r\n }\r\n\r\n const clampZoom = this.plugins.get('clamp-zoom');\r\n if (!noClamp && clampZoom)\r\n {\r\n clampZoom.clamp();\r\n }\r\n\r\n if (center)\r\n {\r\n this.moveCenter(save);\r\n }\r\n return this\r\n }\r\n\r\n /**\r\n * change zoom so it fits the entire world in the viewport\r\n * @param {boolean} center maintain the same center of the screen after zoom\r\n * @returns {Viewport} this\r\n */\r\n fitWorld(center)\r\n {\r\n let save;\r\n if (center)\r\n {\r\n save = this.center;\r\n }\r\n this.scale.x = this.screenWidth / this.worldWidth;\r\n this.scale.y = this.screenHeight / this.worldHeight;\r\n if (this.scale.x < this.scale.y)\r\n {\r\n this.scale.y = this.scale.x;\r\n }\r\n else\r\n {\r\n this.scale.x = this.scale.y;\r\n }\r\n\r\n const clampZoom = this.plugins.get('clamp-zoom');\r\n if (clampZoom)\r\n {\r\n clampZoom.clamp();\r\n }\r\n\r\n if (center)\r\n {\r\n this.moveCenter(save);\r\n }\r\n return this\r\n }\r\n\r\n /**\r\n * change zoom so it fits the size or the entire world in the viewport\r\n * @param {boolean} [center] maintain the same center of the screen after zoom\r\n * @param {number} [width=this.worldWidth] desired width\r\n * @param {number} [height=this.worldHeight] desired height\r\n * @returns {Viewport} this\r\n */\r\n fit(center, width = this.worldWidth, height = this.worldHeight)\r\n {\r\n let save;\r\n if (center)\r\n {\r\n save = this.center;\r\n }\r\n this.scale.x = this.screenWidth / width;\r\n this.scale.y = this.screenHeight / height;\r\n if (this.scale.x < this.scale.y)\r\n {\r\n this.scale.y = this.scale.x;\r\n }\r\n else\r\n {\r\n this.scale.x = this.scale.y;\r\n }\r\n const clampZoom = this.plugins.get('clamp-zoom');\r\n if (clampZoom)\r\n {\r\n clampZoom.clamp();\r\n }\r\n if (center)\r\n {\r\n this.moveCenter(save);\r\n }\r\n return this\r\n }\r\n\r\n /**\r\n * zoom viewport to specific value\r\n * @param {number} scale value (e.g., 1 would be 100%, 0.25 would be 25%)\r\n * @param {boolean} [center] maintain the same center of the screen after zoom\r\n * @return {Viewport} this\r\n */\r\n setZoom(scale, center)\r\n {\r\n let save;\r\n if (center)\r\n {\r\n save = this.center;\r\n }\r\n this.scale.set(scale);\r\n const clampZoom = this.plugins.get('clamp-zoom');\r\n if (clampZoom)\r\n {\r\n clampZoom.clamp();\r\n }\r\n if (center)\r\n {\r\n this.moveCenter(save);\r\n }\r\n return this\r\n }\r\n\r\n /**\r\n * zoom viewport by a certain percent (in both x and y direction)\r\n * @param {number} percent change (e.g., 0.25 would increase a starting scale of 1.0 to 1.25)\r\n * @param {boolean} [center] maintain the same center of the screen after zoom\r\n * @return {Viewport} this\r\n */\r\n zoomPercent(percent, center)\r\n {\r\n return this.setZoom(this.scale.x + this.scale.x * percent, center)\r\n }\r\n\r\n /**\r\n * zoom viewport by increasing/decreasing width by a certain number of pixels\r\n * @param {number} change in pixels\r\n * @param {boolean} [center] maintain the same center of the screen after zoom\r\n * @return {Viewport} this\r\n */\r\n zoom(change, center)\r\n {\r\n this.fitWidth(change + this.worldScreenWidth, center);\r\n return this\r\n }\r\n\r\n /**\r\n * changes scale of viewport and maintains center of viewport--same as calling setScale(scale, true)\r\n * @type {number}\r\n */\r\n set scaled(scale)\r\n {\r\n this.setZoom(scale, true);\r\n }\r\n get scaled()\r\n {\r\n return this.scale.x\r\n }\r\n\r\n /**\r\n * @param {SnapZoomOptions} options\r\n */\r\n snapZoom(options)\r\n {\r\n this.plugins.add('snap-zoom', new SnapZoom(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * is container out of world bounds\r\n * @returns {OutOfBounds}\r\n */\r\n OOB()\r\n {\r\n return {\r\n left: this.left < 0,\r\n right: this.right > this._worldWidth,\r\n top: this.top < 0,\r\n bottom: this.bottom > this._worldHeight,\r\n cornerPoint: new Point(\r\n this._worldWidth * this.scale.x - this.screenWidth,\r\n this._worldHeight * this.scale.y - this.screenHeight\r\n )\r\n }\r\n }\r\n\r\n /**\r\n * world coordinates of the right edge of the screen\r\n * @type {number}\r\n */\r\n get right()\r\n {\r\n return -this.x / this.scale.x + this.worldScreenWidth\r\n }\r\n set right(value)\r\n {\r\n this.x = -value * this.scale.x + this.screenWidth;\r\n this.plugins.reset();\r\n }\r\n\r\n /**\r\n * world coordinates of the left edge of the screen\r\n * @type { number }\r\n */\r\n get left()\r\n {\r\n return -this.x / this.scale.x\r\n }\r\n set left(value)\r\n {\r\n this.x = -value * this.scale.x;\r\n this.plugins.reset();\r\n }\r\n\r\n /**\r\n * world coordinates of the top edge of the screen\r\n * @type {number}\r\n */\r\n get top()\r\n {\r\n return -this.y / this.scale.y\r\n }\r\n set top(value)\r\n {\r\n this.y = -value * this.scale.y;\r\n this.plugins.reset();\r\n }\r\n\r\n /**\r\n * world coordinates of the bottom edge of the screen\r\n * @type {number}\r\n */\r\n get bottom()\r\n {\r\n return -this.y / this.scale.y + this.worldScreenHeight\r\n }\r\n set bottom(value)\r\n {\r\n this.y = -value * this.scale.y + this.screenHeight;\r\n this.plugins.reset();\r\n }\r\n\r\n /**\r\n * determines whether the viewport is dirty (i.e., needs to be renderered to the screen because of a change)\r\n * @type {boolean}\r\n */\r\n get dirty()\r\n {\r\n return this._dirty\r\n }\r\n set dirty(value)\r\n {\r\n this._dirty = value;\r\n }\r\n\r\n /**\r\n * permanently changes the Viewport's hitArea\r\n * NOTE: if not set then hitArea = PIXI.Rectangle(Viewport.left, Viewport.top, Viewport.worldScreenWidth, Viewport.worldScreenHeight)\r\n * @returns {HitArea}\r\n */\r\n get forceHitArea()\r\n {\r\n return this._forceHitArea\r\n }\r\n set forceHitArea(value)\r\n {\r\n if (value)\r\n {\r\n this._forceHitArea = value;\r\n this.hitArea = value;\r\n }\r\n else\r\n {\r\n this._forceHitArea = null;\r\n this.hitArea = new Rectangle(0, 0, this.worldWidth, this.worldHeight);\r\n }\r\n }\r\n\r\n /**\r\n * enable one-finger touch to drag\r\n * NOTE: if you expect users to use right-click dragging, you should enable viewport.options.disableOnContextMenu to avoid the context menu popping up on each right-click drag\r\n * @param {DragOptions} [options]\r\n * @returns {Viewport} this\r\n */\r\n drag(options)\r\n {\r\n this.plugins.add('drag', new Drag(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * clamp to world boundaries or other provided boundaries\r\n * NOTES:\r\n * clamp is disabled if called with no options; use { direction: 'all' } for all edge clamping\r\n * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly\r\n * @param {ClampOptions} [options]\r\n * @returns {Viewport} this\r\n */\r\n clamp(options)\r\n {\r\n this.plugins.add('clamp', new Clamp(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * decelerate after a move\r\n * NOTE: this fires 'moved' event during deceleration\r\n * @param {DecelerateOptions} [options]\r\n * @return {Viewport} this\r\n */\r\n decelerate(options)\r\n {\r\n this.plugins.add('decelerate', new Decelerate(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * bounce on borders\r\n * NOTES:\r\n * screenWidth, screenHeight, worldWidth, and worldHeight needs to be set for this to work properly\r\n * fires 'moved', 'bounce-x-start', 'bounce-y-start', 'bounce-x-end', and 'bounce-y-end' events\r\n * @param {object} [options]\r\n * @param {string} [options.sides=all] all, horizontal, vertical, or combination of top, bottom, right, left (e.g., 'top-bottom-right')\r\n * @param {number} [options.friction=0.5] friction to apply to decelerate if active\r\n * @param {number} [options.time=150] time in ms to finish bounce\r\n * @param {string|function} [options.ease=easeInOutSine] ease function or name (see http://easings.net/ for supported names)\r\n * @param {string} [options.underflow=center] (top/bottom/center and left/right/center, or center) where to place world if too small for screen\r\n * @return {Viewport} this\r\n */\r\n bounce(options)\r\n {\r\n this.plugins.add('bounce', new Bounce(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * enable pinch to zoom and two-finger touch to drag\r\n * @param {PinchOptions} [options]\r\n * @return {Viewport} this\r\n */\r\n pinch(options)\r\n {\r\n this.plugins.add('pinch', new Pinch(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * snap to a point\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {SnapOptions} [options]\r\n * @return {Viewport} this\r\n */\r\n snap(x, y, options)\r\n {\r\n this.plugins.add('snap', new Snap(this, x, y, options));\r\n return this\r\n }\r\n\r\n /**\r\n * follow a target\r\n * NOTES:\r\n * uses the (x, y) as the center to follow; for PIXI.Sprite to work properly, use sprite.anchor.set(0.5)\r\n * options.acceleration is not perfect as it doesn't know the velocity of the target\r\n * it adds acceleration to the start of movement and deceleration to the end of movement when the target is stopped\r\n * fires 'moved' event\r\n * @param {PIXI.DisplayObject} target to follow\r\n * @param {FollowOptions} [options]\r\n * @returns {Viewport} this\r\n */\r\n follow(target, options)\r\n {\r\n this.plugins.add('follow', new Follow(this, target, options));\r\n return this\r\n }\r\n\r\n /**\r\n * zoom using mouse wheel\r\n * @param {WheelOptions} [options]\r\n * @return {Viewport} this\r\n */\r\n wheel(options)\r\n {\r\n this.plugins.add('wheel', new Wheel(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * enable clamping of zoom to constraints\r\n * @param {ClampZoomOptions} [options]\r\n * @return {Viewport} this\r\n */\r\n clampZoom(options)\r\n {\r\n this.plugins.add('clamp-zoom', new ClampZoom(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * Scroll viewport when mouse hovers near one of the edges or radius-distance from center of screen.\r\n * NOTE: fires 'moved' event\r\n * @param {MouseEdgesOptions} [options]\r\n */\r\n mouseEdges(options)\r\n {\r\n this.plugins.add('mouse-edges', new MouseEdges(this, options));\r\n return this\r\n }\r\n\r\n /**\r\n * pause viewport (including animation updates such as decelerate)\r\n * @type {boolean}\r\n */\r\n get pause()\r\n {\r\n return this._pause\r\n }\r\n set pause(value)\r\n {\r\n this._pause = value;\r\n this.lastViewport = null;\r\n this.moving = false;\r\n this.zooming = false;\r\n if (value)\r\n {\r\n this.input.pause();\r\n }\r\n }\r\n\r\n /**\r\n * move the viewport so the bounding box is visible\r\n * @param {number} x - left\r\n * @param {number} y - top\r\n * @param {number} width\r\n * @param {number} height\r\n */\r\n ensureVisible(x, y, width, height)\r\n {\r\n if (x < this.left)\r\n {\r\n this.left = x;\r\n }\r\n else if (x + width > this.right)\r\n {\r\n this.right = x + width;\r\n }\r\n if (y < this.top)\r\n {\r\n this.top = y;\r\n }\r\n else if (y + height > this.bottom)\r\n {\r\n this.bottom = y + height;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * fires after a mouse or touch click\r\n * @event Viewport#clicked\r\n * @type {object}\r\n * @property {PIXI.Point} screen\r\n * @property {PIXI.Point} world\r\n * @property {Viewport} viewport\r\n */\r\n\r\n/**\r\n * fires when a drag starts\r\n * @event Viewport#drag-start\r\n * @type {object}\r\n * @property {PIXI.Point} screen\r\n * @property {PIXI.Point} world\r\n * @property {Viewport} viewport\r\n */\r\n\r\n/**\r\n * fires when a drag ends\r\n * @event Viewport#drag-end\r\n * @type {object}\r\n * @property {PIXI.Point} screen\r\n * @property {PIXI.Point} world\r\n * @property {Viewport} viewport\r\n */\r\n\r\n/**\r\n * fires when a pinch starts\r\n * @event Viewport#pinch-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a pinch end\r\n * @event Viewport#pinch-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a snap starts\r\n * @event Viewport#snap-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a snap ends\r\n * @event Viewport#snap-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a snap-zoom starts\r\n * @event Viewport#snap-zoom-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a snap-zoom ends\r\n * @event Viewport#snap-zoom-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a bounce starts in the x direction\r\n * @event Viewport#bounce-x-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a bounce ends in the x direction\r\n * @event Viewport#bounce-x-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a bounce starts in the y direction\r\n * @event Viewport#bounce-y-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a bounce ends in the y direction\r\n * @event Viewport#bounce-y-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when for a mouse wheel event\r\n * @event Viewport#wheel\r\n * @type {object}\r\n * @property {object} wheel\r\n * @property {number} wheel.dx\r\n * @property {number} wheel.dy\r\n * @property {number} wheel.dz\r\n * @property {Viewport} viewport\r\n */\r\n\r\n/**\r\n * fires when a wheel-scroll occurs\r\n * @event Viewport#wheel-scroll\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when a mouse-edge starts to scroll\r\n * @event Viewport#mouse-edge-start\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when the mouse-edge scrolling ends\r\n * @event Viewport#mouse-edge-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when viewport moves through UI interaction, deceleration, or follow\r\n * @event Viewport#moved\r\n * @type {object}\r\n * @property {Viewport} viewport\r\n * @property {string} type (drag, snap, pinch, follow, bounce-x, bounce-y, clamp-x, clamp-y, decelerate, mouse-edges, wheel)\r\n */\r\n\r\n/**\r\n * fires when viewport moves through UI interaction, deceleration, or follow\r\n * @event Viewport#zoomed\r\n * @type {object}\r\n * @property {Viewport} viewport\r\n * @property {string} type (drag-zoom, pinch, wheel, clamp-zoom)\r\n */\r\n\r\n/**\r\n * fires when viewport stops moving\r\n * @event Viewport#moved-end\r\n * @type {Viewport}\r\n */\r\n\r\n/**\r\n * fires when viewport stops zooming\r\n * @event Viewport#zoomed-end\r\n * @type {Viewport}\r\n */\r\n\r\n /**\r\n * fires at the end of an update frame\r\n * @event Viewport#frame-end\r\n * @type {Viewport}\r\n */\r\n\r\n/** @typedef HitArea {(PIXI.Rectangle | PIXI.Circle | PIXI.Ellipse | PIXI.Polygon | PIXI.RoundedRectangle)} */\r\n\r\n/**\r\n * @typedef {Object} OutOfBounds\r\n * @private\r\n * @property {boolean} left\r\n * @property {boolean} right\r\n * @property {boolean} top\r\n * @property {boolean} bottom\r\n * @property {PIXI.Point} cornerPoint\r\n */\r\n\r\n/**\r\n * @typedef {Object} LastViewport\r\n * @private\r\n * @property {number} x\r\n * @property {number} y\r\n * @property {number} scaleX\r\n * @property {number} scaleY\r\n */\n\nexport { Plugin, Viewport };\n//# sourceMappingURL=viewport.es.js.map\n","\n/*\n\tCopyright © 2001 Robert Penner\n\tAll rights reserved.\n\n\tRedistribution and use in source and binary forms, with or without modification, \n\tare permitted provided that the following conditions are met:\n\n\tRedistributions of source code must retain the above copyright notice, this list of \n\tconditions and the following disclaimer.\n\tRedistributions in binary form must reproduce the above copyright notice, this list \n\tof conditions and the following disclaimer in the documentation and/or other materials \n\tprovided with the distribution.\n\n\tNeither the name of the author nor the names of contributors may be used to endorse \n\tor promote products derived from this software without specific prior written permission.\n\n\tTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY \n\tEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\tMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n\tCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\tEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n\tGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n\tAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n\tNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n\tOF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function() {\n var penner, umd;\n\n umd = function(factory) {\n if (typeof exports === 'object') {\n return module.exports = factory;\n } else if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else {\n return this.penner = factory;\n }\n };\n\n penner = {\n linear: function(t, b, c, d) {\n return c * t / d + b;\n },\n easeInQuad: function(t, b, c, d) {\n return c * (t /= d) * t + b;\n },\n easeOutQuad: function(t, b, c, d) {\n return -c * (t /= d) * (t - 2) + b;\n },\n easeInOutQuad: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t + b;\n } else {\n return -c / 2 * ((--t) * (t - 2) - 1) + b;\n }\n },\n easeInCubic: function(t, b, c, d) {\n return c * (t /= d) * t * t + b;\n },\n easeOutCubic: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n },\n easeInOutCubic: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t + 2) + b;\n }\n },\n easeInQuart: function(t, b, c, d) {\n return c * (t /= d) * t * t * t + b;\n },\n easeOutQuart: function(t, b, c, d) {\n return -c * ((t = t / d - 1) * t * t * t - 1) + b;\n },\n easeInOutQuart: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t + b;\n } else {\n return -c / 2 * ((t -= 2) * t * t * t - 2) + b;\n }\n },\n easeInQuint: function(t, b, c, d) {\n return c * (t /= d) * t * t * t * t + b;\n },\n easeOutQuint: function(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\n },\n easeInOutQuint: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return c / 2 * t * t * t * t * t + b;\n } else {\n return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;\n }\n },\n easeInSine: function(t, b, c, d) {\n return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n },\n easeOutSine: function(t, b, c, d) {\n return c * Math.sin(t / d * (Math.PI / 2)) + b;\n },\n easeInOutSine: function(t, b, c, d) {\n return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n },\n easeInExpo: function(t, b, c, d) {\n if (t === 0) {\n return b;\n } else {\n return c * Math.pow(2, 10 * (t / d - 1)) + b;\n }\n },\n easeOutExpo: function(t, b, c, d) {\n if (t === d) {\n return b + c;\n } else {\n return c * (-Math.pow(2, -10 * t / d) + 1) + b;\n }\n },\n easeInOutExpo: function(t, b, c, d) {\n if (t === 0) {\n b;\n }\n if (t === d) {\n b + c;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n } else {\n return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;\n }\n },\n easeInCirc: function(t, b, c, d) {\n return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;\n },\n easeOutCirc: function(t, b, c, d) {\n return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;\n },\n easeInOutCirc: function(t, b, c, d) {\n if ((t /= d / 2) < 1) {\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n } else {\n return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;\n }\n },\n easeInElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n },\n easeOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d) === 1) {\n b + c;\n }\n if (!p) {\n p = d * .3;\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;\n },\n easeInOutElastic: function(t, b, c, d) {\n var a, p, s;\n s = 1.70158;\n p = 0;\n a = c;\n if (t === 0) {\n b;\n } else if ((t /= d / 2) === 2) {\n b + c;\n }\n if (!p) {\n p = d * (.3 * 1.5);\n }\n if (a < Math.abs(c)) {\n a = c;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(c / a);\n }\n if (t < 1) {\n return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;\n } else {\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;\n }\n },\n easeInBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\n },\n easeOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n },\n easeInOutBack: function(t, b, c, d, s) {\n if (s === void 0) {\n s = 1.70158;\n }\n if ((t /= d / 2) < 1) {\n return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\n } else {\n return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\n }\n },\n easeInBounce: function(t, b, c, d) {\n var v;\n v = penner.easeOutBounce(d - t, 0, c, d);\n return c - v + b;\n },\n easeOutBounce: function(t, b, c, d) {\n if ((t /= d) < 1 / 2.75) {\n return c * (7.5625 * t * t) + b;\n } else if (t < 2 / 2.75) {\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b;\n } else if (t < 2.5 / 2.75) {\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;\n }\n },\n easeInOutBounce: function(t, b, c, d) {\n var v;\n if (t < d / 2) {\n v = penner.easeInBounce(t * 2, 0, c, d);\n return v * .5 + b;\n } else {\n v = penner.easeOutBounce(t * 2 - d, 0, c, d);\n return v * .5 + c * .5 + b;\n }\n }\n };\n\n umd(penner);\n\n}).call(this);\n","import * as PIXI from 'pixi.js'\nimport { Viewport } from 'pixi-viewport'\nimport Penner from 'penner'\n\nconst scrollboxOptions = {\n 'boxWidth': 100,\n 'boxHeight': 100,\n 'scrollbarSize': 10,\n 'scrollbarBackground': 14540253,\n 'scrollbarBackgroundAlpha': 1,\n 'scrollbarForeground': 8947848,\n 'scrollbarForegroundAlpha': 1,\n 'dragScroll': true,\n 'stopPropagation': true,\n 'scrollbarOffsetHorizontal': 0,\n 'scrollbarOffsetVertical': 0,\n 'underflow': 'top-left',\n 'fadeScrollbar': false,\n 'fadeScrollbarTime': 1000,\n 'fadeScrollboxWait': 3000,\n 'fadeScrollboxEase': 'easeInOutSine',\n 'passiveWheel': false,\n 'clampWheel': true\n}\n\n/**\n * pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars\n */\nexport class Scrollbox extends PIXI.Container\n{\n /**\n * create a scrollbox\n * @param {object} options\n * @param {boolean} [options.dragScroll=true] user may drag the content area to scroll content\n * @param {string} [options.overflowX=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflowY=auto] (none, scroll, hidden, auto) this changes whether the scrollbar is shown\n * @param {string} [options.overflow] (none, scroll, hidden, auto) sets overflowX and overflowY to this value\n * @param {number} [options.boxWidth=100] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight=100] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollbarSize=10] size of scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetHorizontal=0] offset of horizontal scrollbar (in pixels)\n * @param {number} [options.scrollbarOffsetVertical=0] offset of vertical scrollbar (in pixels)\n * @param {boolean} [options.stopPropagation=true] call stopPropagation on any events that impact scrollbox\n * @param {number} [options.scrollbarBackground=0xdddddd] background color of scrollbar\n * @param {number} [options.scrollbarBackgroundAlpha=1] alpha of background of scrollbar\n * @param {number} [options.scrollbarForeground=0x888888] foreground color of scrollbar\n * @param {number} [options.scrollbarForegroundAlpha=1] alpha of foreground of scrollbar\n * @param {string} [options.underflow=top-left] what to do when content underflows the scrollbox size: none: do nothing; (left/right/center AND top/bottom/center); OR center (e.g., 'top-left', 'center', 'none', 'bottomright')\n * @param {boolean} [options.noTicker] do not use PIXI.Ticker (for fade to work properly you will need to manually call updateLoop(elapsed) on each frame)\n * @param {PIXI.Ticker} [options.ticker=PIXI.Ticker.shared] use this PIXI.Ticker for updates\n * @param {boolean} [options.fade] fade the scrollbar when not in use\n * @param {number} [options.fadeScrollbarTime=1000] time to fade scrollbar if options.fade is set\n * @param {number} [options.fadeScrollboxWait=3000] time to wait before fading the scrollbar if options.fade is set\n * @param {(string|function)} [options.fadeScrollboxEase=easeInOutSine] easing function to use for fading\n * @param {boolean} [options.passiveWheel=false] whether wheel events are propogated beyond the scrollbox (NOTE: default is now false)\n * @param {boolean} [options.clampWheel=true] wheel events should be clamped (to avoid weird bounce with mouse wheel)\n */\n constructor(options={})\n {\n super()\n this.options = Object.assign({}, scrollboxOptions, options)\n if (options.overflow) {\n this.options.overflowX = this.options.overflowY = options.overflow\n }\n this.ease = typeof this.options.fadeScrollboxEase === 'function' ? this.options.fadeScrollboxEase : Penner[this.options.fadeScrollboxEase]\n\n /**\n * content in placed in here\n * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/)\n * @type {Viewport}\n */\n this.content = this.addChild(new Viewport({ passiveWheel: this.options.passiveWheel, stopPropagation: this.options.stopPropagation, screenWidth: this.options.boxWidth, screenHeight: this.options.boxHeight }))\n this.content\n .decelerate()\n .on('moved', () => this._drawScrollbars())\n\n // needed to pull this out of viewportOptions because of pixi.js v4 support (which changed from PIXI.ticker.shared to PIXI.Ticker.shared...sigh)\n if (options.ticker)\n {\n this.options.ticker = options.ticker\n }\n else\n {\n // to avoid Rollup transforming our import, save pixi namespace in a variable\n // from here: https://github.com/pixijs/pixi.js/issues/5757\n let ticker\n const pixiNS = PIXI\n if (parseInt(/^(\\d+)\\./.exec(PIXI.VERSION)[1]) < 5)\n {\n ticker = pixiNS.ticker.shared;\n }\n else\n {\n ticker = pixiNS.Ticker.shared;\n }\n this.options.ticker = options.ticker || ticker\n }\n\n /**\n * graphics element for drawing the scrollbars\n * @type {PIXI.Graphics}\n */\n this.scrollbar = this.addChild(new PIXI.Graphics())\n this.scrollbar.interactive = true\n this.scrollbar.on('pointerdown', this.scrollbarDown, this)\n this.interactive = true\n this.on('pointermove', this.scrollbarMove, this)\n this.on('pointerup', this.scrollbarUp, this)\n this.on('pointercancel', this.scrollbarUp, this)\n this.on('pointerupoutside', this.scrollbarUp, this)\n this._maskContent = this.addChild(new PIXI.Graphics())\n this.update()\n\n if (!this.options.noTicker)\n {\n this.tickerFunction = () => this.updateLoop(Math.min(this.options.ticker.elapsedMS, 16.6667))\n this.options.ticker.add(this.tickerFunction)\n }\n }\n\n /**\n * offset of horizontal scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetHorizontal()\n {\n return this.options.scrollbarOffsetHorizontal\n }\n set scrollbarOffsetHorizontal(value)\n {\n this.options.scrollbarOffsetHorizontal = value\n }\n\n /**\n * offset of vertical scrollbar (in pixels)\n * @type {number}\n */\n get scrollbarOffsetVertical()\n {\n return this.options.scrollbarOffsetVertical\n }\n set scrollbarOffsetVertical(value)\n {\n this.options.scrollbarOffsetVertical = value\n }\n\n /**\n * disable the scrollbox (if set to true this will also remove the mask)\n * @type {boolean}\n */\n get disable()\n {\n return this._disabled\n }\n set disable(value)\n {\n if (this._disabled !== value)\n {\n this._disabled = value\n this.update()\n }\n }\n\n /**\n * call stopPropagation on any events that impact scrollbox\n * @type {boolean}\n */\n get stopPropagation()\n {\n return this.options.stopPropagation\n }\n set stopPropagation(value)\n {\n this.options.stopPropagation = value\n }\n\n /**\n * user may drag the content area to scroll content\n * @type {boolean}\n */\n get dragScroll()\n {\n return this.options.dragScroll\n }\n set dragScroll(value)\n {\n this.options.dragScroll = value\n if (value)\n {\n this.content.drag()\n }\n else\n {\n if (typeof this.content.removePlugin !== 'undefined')\n {\n this.content.removePlugin('drag')\n }\n else\n {\n this.content.plugins.remove('drag')\n }\n }\n this.update()\n }\n\n /**\n * width of scrollbox including the scrollbar (if visible)- this changes the size and not the scale of the box\n * @type {number}\n */\n get boxWidth()\n {\n return this.options.boxWidth\n }\n set boxWidth(value)\n {\n this.options.boxWidth = value\n this.content.screenWidth = value\n this.update()\n }\n\n /**\n * sets overflowX and overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflow()\n {\n return this.options.overflow\n }\n set overflow(value)\n {\n this.options.overflow = value\n this.options.overflowX = value\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * sets overflowX to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowX()\n {\n return this.options.overflowX\n }\n set overflowX(value)\n {\n this.options.overflowX = value\n this.update()\n }\n\n /**\n * sets overflowY to (scroll, hidden, auto) changing whether the scrollbar is shown\n * scroll = always show scrollbar\n * hidden = hide overflow and do not show scrollbar\n * auto = if content is larger than box size, then show scrollbar\n * @type {string}\n */\n get overflowY()\n {\n return this.options.overflowY\n }\n set overflowY(value)\n {\n this.options.overflowY = value\n this.update()\n }\n\n /**\n * height of scrollbox including the scrollbar (if visible) - this changes the size and not the scale of the box\n * @type {number}\n */\n get boxHeight()\n {\n return this.options.boxHeight\n }\n set boxHeight(value)\n {\n this.options.boxHeight = value\n this.content.screenHeight = value\n this.update()\n }\n\n /**\n * scrollbar size in pixels\n * @type {number}\n */\n get scrollbarSize()\n {\n return this.options.scrollbarSize\n }\n set scrollbarSize(value)\n {\n this.options.scrollbarSize = value\n }\n\n /**\n * width of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentWidth()\n {\n return this.options.boxWidth - (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n }\n\n /**\n * height of scrollbox less the scrollbar (if visible)\n * @type {number}\n * @readonly\n */\n get contentHeight()\n {\n return this.options.boxHeight - (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n }\n\n /**\n * is the vertical scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarVertical()\n {\n return this._isScrollbarVertical\n }\n\n /**\n * is the horizontal scrollbar visible\n * @type {boolean}\n * @readonly\n */\n get isScrollbarHorizontal()\n {\n return this._isScrollbarHorizontal\n }\n\n /**\n * top coordinate of scrollbar\n */\n get scrollTop()\n {\n return this.content.top\n }\n set scrollTop(top) {\n this.content.top = top\n this._drawScrollbars()\n }\n\n /**\n * left coordinate of scrollbar\n */\n get scrollLeft()\n {\n return this.content.left\n }\n set scrollLeft(left) {\n this.content.left = left\n this._drawScrollbars()\n }\n\n /**\n * width of content area\n * if not set then it uses content.width to calculate width\n */\n get scrollWidth()\n {\n return this._scrollWidth || this.content.width\n }\n set scrollWidth(value)\n {\n this._scrollWidth = value\n }\n\n /**\n * height of content area\n * if not set then it uses content.height to calculate height\n */\n get scrollHeight()\n {\n return this._scrollHeight || this.content.height\n }\n set scrollHeight(value)\n {\n this._scrollHeight = value\n }\n\n /**\n * draws scrollbars\n * @private\n */\n _drawScrollbars()\n {\n this._isScrollbarHorizontal = this.overflowX === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowX) !== -1 ? false : this.scrollWidth > this.options.boxWidth\n this._isScrollbarVertical = this.overflowY === 'scroll' ? true : ['hidden', 'none'].indexOf(this.overflowY) !== -1 ? false : this.scrollHeight > this.options.boxHeight\n this.scrollbar.clear()\n let options = {}\n options.left = 0\n options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0)\n options.top = 0\n options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0)\n const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0)\n this.scrollbarTop = (this.content.top / height) * this.boxHeight\n this.scrollbarTop = this.scrollbarTop < 0 ? 0 : this.scrollbarTop\n this.scrollbarHeight = (this.boxHeight / height) * this.boxHeight\n this.scrollbarHeight = this.scrollbarTop + this.scrollbarHeight > this.boxHeight ? this.boxHeight - this.scrollbarTop : this.scrollbarHeight\n this.scrollbarLeft = (this.content.left / width) * this.boxWidth\n this.scrollbarLeft = this.scrollbarLeft < 0 ? 0 : this.scrollbarLeft\n this.scrollbarWidth = (this.boxWidth / width) * this.boxWidth\n this.scrollbarWidth = this.scrollbarWidth + this.scrollbarLeft > this.boxWidth ? this.boxWidth - this.scrollbarLeft : this.scrollbarWidth\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, 0, this.scrollbarSize, this.boxHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarBackground, this.options.scrollbarBackgroundAlpha)\n .drawRect(0, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.boxWidth, this.scrollbarSize)\n .endFill()\n }\n if (this.isScrollbarVertical)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.boxWidth - this.scrollbarSize + this.options.scrollbarOffsetVertical, this.scrollbarTop, this.scrollbarSize, this.scrollbarHeight)\n .endFill()\n }\n if (this.isScrollbarHorizontal)\n {\n this.scrollbar\n .beginFill(this.options.scrollbarForeground, this.options.scrollbarForegroundAlpha)\n .drawRect(this.scrollbarLeft, this.boxHeight - this.scrollbarSize + this.options.scrollbarOffsetHorizontal, this.scrollbarWidth, this.scrollbarSize)\n .endFill()\n }\n // this.content.forceHitArea = new PIXI.Rectangle(0, 0 , this.boxWidth, this.boxHeight)\n this.activateFade()\n }\n\n /**\n * draws mask layer\n * @private\n */\n _drawMask()\n {\n this._maskContent\n .beginFill(0)\n .drawRect(0, 0, this.boxWidth, this.boxHeight)\n .endFill()\n this.content.mask = this._maskContent\n }\n\n /**\n * call when scrollbox content changes\n */\n update()\n {\n this.content.mask = null\n this._maskContent.clear()\n if (!this._disabled)\n {\n this._drawScrollbars()\n this._drawMask()\n if (this.options.dragScroll)\n {\n const direction = this.isScrollbarHorizontal && this.isScrollbarVertical ? 'all' : this.isScrollbarHorizontal ? 'x' : 'y'\n if (direction !== null)\n {\n this.content\n .drag({ clampWheel: this.options.clampWheel, direction })\n .clamp({ direction, underflow: this.options.underflow })\n }\n }\n }\n }\n\n /**\n * called on each frame to update fade scrollbars (if enabled)\n * @param {number} elapsed since last frame in milliseconds (usually capped at 16.6667)\n */\n updateLoop(elapsed)\n {\n if (this.fade)\n {\n if (this.fade.wait > 0)\n {\n this.fade.wait -= elapsed\n if (this.fade.wait <= 0)\n {\n elapsed += this.fade.wait\n }\n else\n {\n return\n }\n }\n this.fade.duration += elapsed\n if (this.fade.duration >= this.options.fadeScrollbarTime)\n {\n this.fade = null\n this.scrollbar.alpha = 0\n }\n else\n {\n this.scrollbar.alpha = this.ease(this.fade.duration, 1, -1, this.options.fadeScrollbarTime)\n }\n this.content.dirty = true\n }\n }\n\n /**\n * dirty value (used for optimizing draws) for underlying viewport (scrollbox.content)\n * @type {boolean}\n */\n get dirty()\n {\n return this.content.dirty\n }\n set dirty(value)\n {\n this.content.dirty = value\n }\n\n /**\n * show the scrollbar and restart the timer for fade if options.fade is set\n */\n activateFade()\n {\n if (!this.fade && this.options.fade)\n {\n this.scrollbar.alpha = 1\n this.fade = { wait: this.options.fadeScrollboxWait, duration: 0 }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarDown(e)\n {\n const local = this.toLocal(e.data.global)\n if (this.isScrollbarHorizontal)\n {\n if (local.y > this.boxHeight - this.scrollbarSize)\n {\n if (local.x >= this.scrollbarLeft && local.x <= this.scrollbarLeft + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'horizontal', last: local }\n }\n else\n {\n if (local.x > this.scrollbarLeft)\n {\n this.content.left += this.content.worldScreenWidth\n this.update()\n }\n else\n {\n this.content.left -= this.content.worldScreenWidth\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n if (this.isScrollbarVertical)\n {\n if (local.x > this.boxWidth - this.scrollbarSize)\n {\n if (local.y >= this.scrollbarTop && local.y <= this.scrollbarTop + this.scrollbarWidth)\n {\n this.pointerDown = { type: 'vertical', last: local }\n }\n else\n {\n if (local.y > this.scrollbarTop)\n {\n this.content.top += this.content.worldScreenHeight\n this.update()\n }\n else\n {\n this.content.top -= this.content.worldScreenHeight\n this.update()\n }\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n return\n }\n }\n }\n\n /**\n * handle pointer move on scrollbar\n * @param {PIXI.interaction.InteractionEvent} e\n * @private\n */\n scrollbarMove(e)\n {\n if (this.pointerDown)\n {\n if (this.pointerDown.type === 'horizontal')\n {\n const local = this.toLocal(e.data.global)\n this.content.left += local.x - this.pointerDown.last.x\n this.pointerDown.last = local\n this.update()\n }\n else if (this.pointerDown.type === 'vertical')\n {\n const local = this.toLocal(e.data.global)\n this.content.top += local.y - this.pointerDown.last.y\n this.pointerDown.last = local\n this.update()\n }\n if (this.options.stopPropagation)\n {\n e.stopPropagation()\n }\n }\n }\n\n /**\n * handle pointer down on scrollbar\n * @private\n */\n scrollbarUp()\n {\n this.pointerDown = null\n }\n\n /**\n * resize the mask for the container\n * @param {object} options\n * @param {number} [options.boxWidth] width of scrollbox including scrollbar (in pixels)\n * @param {number} [options.boxHeight] height of scrollbox including scrollbar (in pixels)\n * @param {number} [options.scrollWidth] set the width of the inside of the scrollbox (leave null to use content.width)\n * @param {number} [options.scrollHeight] set the height of the inside of the scrollbox (leave null to use content.height)\n */\n resize(options)\n {\n this.options.boxWidth = typeof options.boxWidth !== 'undefined' ? options.boxWidth : this.options.boxWidth\n this.options.boxHeight = typeof options.boxHeight !== 'undefined' ? options.boxHeight : this.options.boxHeight\n if (options.scrollWidth)\n {\n this.scrollWidth = options.scrollWidth\n }\n if (options.scrollHeight)\n {\n this.scrollHeight = options.scrollHeight\n }\n this.content.resize(this.options.boxWidth, this.options.boxHeight, this.scrollWidth, this.scrollHeight)\n this.update()\n }\n\n /**\n * ensure that the bounding box is visible\n * @param {number} x - relative to content's coordinate system\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n ensureVisible(x, y, width, height)\n {\n this.content.ensureVisible(x, y, width, height)\n this._drawScrollbars()\n }\n}","'use strict';\n\n// Programatically add fork me on github ribbon from javascript without making changes to CSS, HTML, or adding image files\n// by David Figatner\n// copyright 2018 YOPEY YOPEY LLC\n// MIT license\n// based on https://github.com/simonwhitaker/github-fork-ribbon-css (MIT license)\n\nvar RIBBON = {\n width: '12.1em',\n height: '12.1em',\n overflow: 'hidden',\n top: 0,\n right: 0,\n zIndex: 9999,\n pointerEvents: 'none',\n fontSize: '13px',\n textDecoration: 'none',\n textIndent: '-999999px'\n};\n\nvar BEFORE_AFTER = [['position', 'absolute'], ['display', 'block'], ['width', '15.38em'], ['height', '1.54em'], ['top', '3.23em'], ['right', '-3.23em'], ['-webkit-box-sizing', 'content-box'], ['-moz-box-sizing', 'content-box'], ['box-sizing', 'content-box'], ['-webkit-transform', 'rotate(45deg)'], ['-moz-transform', 'rotate(45deg)'], ['-ms-Transform', 'rotate(45deg)'], ['-o-transform', 'rotate(45deg)'], ['transform', 'rotate(45deg)']];\n\nvar BEFORE = [['content', '\"\"'], ['padding', '.38em 0'], ['background-color', '#a00'], ['background-image', '-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)))'], ['background-image', '-webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))'], ['background-image', '-moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))'], ['background-image', '-ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))'], ['background-image', '-o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))'], ['background-image', 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15))'], ['box-shadow', '0 .15em .23em 0 rgba(0, 0, 0, 0.5)'], ['pointer-events', 'auto']];\n\nvar AFTER = [['content', 'attr(data-ribbon)'], ['color', '#fff'], ['font', '700 1em \"Helvetica Neue\", Helvetica, Arial, sans-serif'], ['line-height', '1.54em'], ['text-decoration', 'none'], ['text-shadow', '0 -.08em rgba(0, 0, 0, 0.5)'], ['text-align', 'center'], ['text-indent', '0'], ['padding', '.15em 0'], ['margin', '.15em 0'], ['border-width', '.08em 0'], ['border-style', 'dotted'], ['border-color', '#fff'], ['border-color', 'rgba(255, 255, 255, 0.7)']];\n\n/**\n * Programmatically add \"Fork me Github\" Ribbon using inline CSS\n * Based on CSS from https,//github.com/simonwhitaker/github-fork-ribbon-css\n * @param {string} [url] - do not need to include if URL is called from https://username.github.io/project/html\n * @param {object} [options]\n * @param {HTMLElement} [options.parent=document.body]\n * @param {boolean} [options.fixed]\n * @param {string} [options.corner=topright] some combination of top/bottom, and left/right\n * @param {string} [options.text=fork me on github] text to show\n * @param {string} [options.background=#a00] color for ribbon\n */\nmodule.exports = function forkMe(url, options) {\n options = options || {};\n var a = document.createElement('a');\n if (url) {\n a.href = url;\n } else {\n var username = window.location.hostname.split('.')[0];\n var project = window.location.pathname.split('/')[1];\n a.href = 'https://github.com/' + username + '/' + project;\n }\n\n a.title = a.innerText = options.text || 'fork me on github';\n a.setAttribute('data-ribbon', options.text || 'fork me on github');\n a.className = 'github-fork-ribbon-' + Math.round(Math.random() * 100000);\n if (options.parent) {\n options.parent.appendChild(a);\n } else {\n document.body.appendChild(a);\n }\n a.style.position = options.fixed ? 'fixed' : 'absolute';\n if (options.background) {\n BEFORE[2][1] = options.background;\n }\n if (options.color) {\n AFTER[1][1] = options.color;\n }\n for (var _style in RIBBON) {\n a.style[_style] = RIBBON[_style];\n }\n var beforeAfter = '{';\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = BEFORE_AFTER[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _style2 = _step.value;\n\n beforeAfter += _style2[0] + ':' + _style2[1] + ';';\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var before = beforeAfter;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = BEFORE[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var _style3 = _step2.value;\n\n before += _style3[0] + ':' + _style3[1] + ';';\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var after = beforeAfter;\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = AFTER[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _style4 = _step3.value;\n\n after += _style4[0] + ':' + _style4[1] + ';';\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var bottom = void 0,\n left = void 0;\n if (options.side) {\n bottom = options.side.toLowerCase().indexOf('bottom') !== -1;\n left = options.side.toLowerCase().indexOf('left') !== -1;\n }\n if (bottom) {\n a.style.top = 'auto';\n a.style.bottom = 0;\n before += 'top:auto;bottom:3.23em;';\n after += 'top:auto;bottom:3.23em;';\n }\n if (left) {\n a.style.right = 'auto';\n a.style.left = 0;\n before += 'right:auto;left:-3.23em;';\n after += 'right:auto;left:-3.23em;';\n }\n if (left && !bottom || !left && bottom) {\n before += 'transform:rotate(-45deg);';\n after += 'transform:rotate(-45deg);';\n }\n var style = document.createElement('style');\n document.head.appendChild(style);\n var sheet = style.sheet;\n sheet.insertRule('.' + a.className + '::before' + before + '}');\n sheet.insertRule('.' + a.className + '::after' + after + '}');\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW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ucy5iYWNrZ3JvdW5kXG4gICAgfVxuICAgIGlmIChvcHRpb25zLmNvbG9yKVxuICAgIHtcbiAgICAgICAgQUZURVJbMV1bMV0gPSBvcHRpb25zLmNvbG9yXG4gICAgfVxuICAgIGZvciAobGV0IHN0eWxlIGluIFJJQkJPTilcbiAgICB7XG4gICAgICAgIGEuc3R5bGVbc3R5bGVdID0gUklCQk9OW3N0eWxlXVxuICAgIH1cbiAgICBsZXQgYmVmb3JlQWZ0ZXIgPSAneydcbiAgICBmb3IgKGxldCBzdHlsZSBvZiBCRUZPUkVfQUZURVIpXG4gICAge1xuICAgICAgICBiZWZvcmVBZnRlciArPSBzdHlsZVswXSArICc6JyArIHN0eWxlWzFdICsgJzsnXG4gICAgfVxuICAgIGxldCBiZWZvcmUgPSBiZWZvcmVBZnRlclxuICAgIGZvciAobGV0IHN0eWxlIG9mIEJFRk9SRSlcbiAgICB7XG4gICAgICAgIGJlZm9yZSArPSBzdHlsZVswXSArICc6JyArIHN0eWxlWzFdICsgJzsnXG4gICAgfVxuICAgIGxldCBhZnRlciA9IGJlZm9yZUFmdGVyXG4gICAgZm9yIChsZXQgc3R5bGUgb2YgQUZURVIpXG4gICAge1xuICAgICAgICBhZnRlciArPSBzdHlsZVswXSArICc6JyArIHN0eWxlWzFdICsgJzsnXG4gICAgfVxuICAgIGxldCBib3R0b20sIGxlZnRcbiAgICBpZiAob3B0aW9ucy5zaWRlKVxuICAgIHtcbiAgICAgICAgYm90dG9tID0gb3B0aW9ucy5zaWRlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZignYm90dG9tJykgIT09IC0xXG4gICAgICAgIGxlZnQgPSBvcHRpb25zLnNpZGUudG9Mb3dlckNhc2UoKS5pbmRleE9mKCdsZWZ0JykgIT09IC0xXG4gICAgfVxuICAgIGlmIChib3R0b20pXG4gICAge1xuICAgICAgICBhLnN0eWxlLnRvcCA9ICdhdXRvJ1xuICAgICAgICBhLnN0eWxlLmJvdHRvbSA9IDBcbiAgICAgICAgYmVmb3JlICs9ICd0b3A6YXV0bztib3R0b206My4yM2VtOydcbiAgICAgICAgYWZ0ZXIgKz0gJ3RvcDphdXRvO2JvdHRvbTozLjIzZW07J1xuICAgIH1cbiAgICBpZiAobGVmdClcbiAgICB7XG4gICAgICAgIGEuc3R5bGUucmlnaHQgPSAnYXV0bydcbiAgICAgICAgYS5zdHlsZS5sZWZ0ID0gMFxuICAgICAgICBiZWZvcmUgKz0gJ3JpZ2h0OmF1dG87bGVmdDotMy4yM2VtOydcbiAgICAgICAgYWZ0ZXIgKz0gJ3JpZ2h0OmF1dG87bGVmdDotMy4yM2VtOydcbiAgICB9XG4gICAgaWYgKChsZWZ0ICYmICFib3R0b20pIHx8ICghbGVmdCAmJiBib3R0b20pKVxuICAgIHtcbiAgICAgICAgYmVmb3JlICs9ICd0cmFuc2Zvcm06cm90YXRlKC00NWRlZyk7J1xuICAgICAgICBhZnRlciArPSAndHJhbnNmb3JtOnJvdGF0ZSgtNDVkZWcpOydcbiAgICB9XG4gICAgY29uc3Qgc3R5bGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzdHlsZScpXG4gICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChzdHlsZSlcbiAgICBjb25zdCBzaGVldCA9IHN0eWxlLnNoZWV0XG4gICAgc2hlZXQuaW5zZXJ0UnVsZSgnLicgKyBhLmNsYXNzTmFtZSArICc6OmJlZm9yZScgKyBiZWZvcmUgKyAnfScpXG4gICAgc2hlZXQuaW5zZXJ0UnVsZSgnLicgKyBhLmNsYXNzTmFtZSArICc6OmFmdGVyJyArIGFmdGVyICsgJ30nKVxufSJdfQ==","/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n(function(factory) {\n\n // Find the global object for export to both the browser and web workers.\n var globalObject = typeof window === 'object' && window ||\n typeof self === 'object' && self;\n\n // Setup highlight.js for different environments. First is Node.js or\n // CommonJS.\n // `nodeType` is checked to ensure that `exports` is not a HTML element.\n if(typeof exports !== 'undefined' && !exports.nodeType) {\n factory(exports);\n } else if(globalObject) {\n // Export hljs globally even when using AMD for cases when this script\n // is loaded with others that may still expect a global hljs.\n globalObject.hljs = factory({});\n\n // Finally register the global hljs with AMD.\n if(typeof define === 'function' && define.amd) {\n define([], function() {\n return globalObject.hljs;\n });\n }\n }\n\n}(function(hljs) {\n // Convenience variables for build-in objects\n var ArrayProto = [],\n objectKeys = Object.keys;\n\n // Global internal variables used within the highlight.js library.\n var languages = {},\n aliases = {};\n\n // Regular expressions used throughout the highlight.js library.\n var noHighlightRe = /^(no-?highlight|plain|text)$/i,\n languagePrefixRe = /\\blang(?:uage)?-([\\w-]+)\\b/i,\n fixMarkupRe = /((^(<[^>]+>|\\t|)+|(?:\\n)))/gm;\n\n // The object will be assigned by the build tool. It used to synchronize API\n // of external language files with minified version of the highlight.js library.\n var API_REPLACES;\n\n var spanEndTag = '';\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n var options = {\n classPrefix: 'hljs-',\n tabReplace: null,\n useBR: false,\n languages: undefined\n };\n\n // keywords that should have no default relevance value\n var COMMON_KEYWORDS = 'of and for in not or if then'.split(' ')\n\n\n /* Utility functions */\n\n function escape(value) {\n return value.replace(/&/g, '&').replace(//g, '>');\n }\n\n function tag(node) {\n return node.nodeName.toLowerCase();\n }\n\n function testRe(re, lexeme) {\n var match = re && re.exec(lexeme);\n return match && match.index === 0;\n }\n\n function isNotHighlighted(language) {\n return noHighlightRe.test(language);\n }\n\n function blockLanguage(block) {\n var i, match, length, _class;\n var classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n match = languagePrefixRe.exec(classes);\n if (match) {\n return getLanguage(match[1]) ? match[1] : 'no-highlight';\n }\n\n classes = classes.split(/\\s+/);\n\n for (i = 0, length = classes.length; i < length; i++) {\n _class = classes[i];\n\n if (isNotHighlighted(_class) || getLanguage(_class)) {\n return _class;\n }\n }\n }\n\n function inherit(parent) { // inherit(parent, override_obj, override_obj, ...)\n var key;\n var result = {};\n var objects = Array.prototype.slice.call(arguments, 1);\n\n for (key in parent)\n result[key] = parent[key];\n objects.forEach(function(obj) {\n for (key in obj)\n result[key] = obj[key];\n });\n return result;\n }\n\n /* Stream merging */\n\n function nodeStream(node) {\n var result = [];\n (function _nodeStream(node, offset) {\n for (var child = node.firstChild; child; child = child.nextSibling) {\n if (child.nodeType === 3)\n offset += child.nodeValue.length;\n else if (child.nodeType === 1) {\n result.push({\n event: 'start',\n offset: offset,\n node: child\n });\n offset = _nodeStream(child, offset);\n // Prevent void elements from having an end tag that would actually\n // double them in the output. There are more void elements in HTML\n // but we list only those realistically expected in code display.\n if (!tag(child).match(/br|hr|img|input/)) {\n result.push({\n event: 'stop',\n offset: offset,\n node: child\n });\n }\n }\n }\n return offset;\n })(node, 0);\n return result;\n }\n\n function mergeStreams(original, highlighted, value) {\n var processed = 0;\n var result = '';\n var nodeStack = [];\n\n function selectStream() {\n if (!original.length || !highlighted.length) {\n return original.length ? original : highlighted;\n }\n if (original[0].offset !== highlighted[0].offset) {\n return (original[0].offset < highlighted[0].offset) ? original : highlighted;\n }\n\n /*\n To avoid starting the stream just before it should stop the order is\n ensured that original always starts first and closes last:\n\n if (event1 == 'start' && event2 == 'start')\n return original;\n if (event1 == 'start' && event2 == 'stop')\n return highlighted;\n if (event1 == 'stop' && event2 == 'start')\n return original;\n if (event1 == 'stop' && event2 == 'stop')\n return highlighted;\n\n ... which is collapsed to:\n */\n return highlighted[0].event === 'start' ? original : highlighted;\n }\n\n function open(node) {\n function attr_str(a) {return ' ' + a.nodeName + '=\"' + escape(a.value).replace('\"', '"') + '\"';}\n result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>';\n }\n\n function close(node) {\n result += '';\n }\n\n function render(event) {\n (event.event === 'start' ? open : close)(event.node);\n }\n\n while (original.length || highlighted.length) {\n var stream = selectStream();\n result += escape(value.substring(processed, stream[0].offset));\n processed = stream[0].offset;\n if (stream === original) {\n /*\n On any opening or closing tag of the original markup we first close\n the entire highlighted node stack, then render the original tag along\n with all the following original tags at the same offset and then\n reopen all the tags on the highlighted stack.\n */\n nodeStack.reverse().forEach(close);\n do {\n render(stream.splice(0, 1)[0]);\n stream = selectStream();\n } while (stream === original && stream.length && stream[0].offset === processed);\n nodeStack.reverse().forEach(open);\n } else {\n if (stream[0].event === 'start') {\n nodeStack.push(stream[0].node);\n } else {\n nodeStack.pop();\n }\n render(stream.splice(0, 1)[0]);\n }\n }\n return result + escape(value.substr(processed));\n }\n\n /* Initialization */\n\n function dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts)\n }\n\n function expand_or_clone_mode(mode) {\n if (mode.variants && !mode.cached_variants) {\n mode.cached_variants = mode.variants.map(function(variant) {\n return inherit(mode, {variants: null}, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentually \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cached_variants)\n return mode.cached_variants;\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode))\n return [inherit(mode, { starts: mode.starts ? inherit(mode.starts) : null })]\n\n // no special dependency issues, just return ourselves\n return [mode]\n }\n\n function restoreLanguageApi(obj) {\n if(API_REPLACES && !obj.langApiRestored) {\n obj.langApiRestored = true;\n for(var key in API_REPLACES)\n obj[key] && (obj[API_REPLACES[key]] = obj[key]);\n (obj.contains || []).concat(obj.variants || []).forEach(restoreLanguageApi);\n }\n }\n\n function compileKeywords(rawKeywords, case_insensitive) {\n var compiled_keywords = {};\n\n if (typeof rawKeywords === 'string') { // string\n splitAndCompile('keyword', rawKeywords);\n } else {\n objectKeys(rawKeywords).forEach(function (className) {\n splitAndCompile(className, rawKeywords[className]);\n });\n }\n return compiled_keywords;\n\n // ---\n\n function splitAndCompile(className, str) {\n if (case_insensitive) {\n str = str.toLowerCase();\n }\n str.split(' ').forEach(function(keyword) {\n var pair = keyword.split('|');\n compiled_keywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];\n });\n };\n }\n\n function scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore)\n return Number(providedScore)\n\n return commonKeyword(keyword) ? 0 : 1;\n }\n\n function commonKeyword(word) {\n return COMMON_KEYWORDS.indexOf(word.toLowerCase()) != -1\n }\n\n function compileLanguage(language) {\n\n function reStr(re) {\n return (re && re.source) || re;\n }\n\n function langRe(value, global) {\n return new RegExp(\n reStr(value),\n 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')\n );\n }\n\n function reCountMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n }\n\n // joinRe logically computes regexps.join(separator), but fixes the\n // backreferences so they continue to match.\n // it also places each individual regular expression into it's own\n // match group, keeping track of the sequencing of those match groups\n // is currently an exercise for the caller. :-)\n function joinRe(regexps, separator) {\n // backreferenceRe matches an open parenthesis or backreference. To avoid\n // an incorrect parse, it additionally matches the following:\n // - [...] elements, where the meaning of parentheses and escapes change\n // - other escape sequences, so we do not misparse escape sequences as\n // interesting elements\n // - non-matching or lookahead parentheses, which do not capture. These\n // follow the '(' with a '?'.\n var backreferenceRe = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n var numCaptures = 0;\n var ret = '';\n for (var i = 0; i < regexps.length; i++) {\n numCaptures += 1;\n var offset = numCaptures;\n var re = reStr(regexps[i]);\n if (i > 0) {\n ret += separator;\n }\n ret += \"(\";\n while (re.length > 0) {\n var match = backreferenceRe.exec(re);\n if (match == null) {\n ret += re;\n break;\n }\n ret += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] == '\\\\' && match[1]) {\n // Adjust the backreference.\n ret += '\\\\' + String(Number(match[1]) + offset);\n } else {\n ret += match[0];\n if (match[0] == '(') {\n numCaptures++;\n }\n }\n }\n ret += \")\";\n }\n return ret;\n }\n\n function buildModeRegex(mode) {\n\n var matchIndexes = {};\n var matcherRe;\n var regexes = [];\n var matcher = {};\n var matchAt = 1;\n\n function addRule(rule, regex) {\n matchIndexes[matchAt] = rule;\n regexes.push([rule, regex]);\n matchAt += reCountMatchGroups(regex) + 1;\n }\n\n var term;\n for (var i=0; i < mode.contains.length; i++) {\n var re;\n term = mode.contains[i];\n if (term.beginKeywords) {\n re = '\\\\.?(?:' + term.begin + ')\\\\.?';\n } else {\n re = term.begin;\n }\n addRule(term, re);\n }\n if (mode.terminator_end)\n addRule(\"end\", mode.terminator_end);\n if (mode.illegal)\n addRule(\"illegal\", mode.illegal);\n\n var terminators = regexes.map(function(el) { return el[1] });\n matcherRe = langRe(joinRe(terminators, '|'), true);\n\n matcher.lastIndex = 0;\n matcher.exec = function(s) {\n var rule;\n\n if( regexes.length === 0) return null;\n\n matcherRe.lastIndex = matcher.lastIndex;\n var match = matcherRe.exec(s);\n if (!match) { return null; }\n\n for(var i = 0; i';\n\n return openSpan + insideSpan + closeSpan;\n }\n\n function processKeywords() {\n var keyword_match, last_index, match, result;\n\n if (!top.keywords)\n return escape(mode_buffer);\n\n result = '';\n last_index = 0;\n top.lexemesRe.lastIndex = 0;\n match = top.lexemesRe.exec(mode_buffer);\n\n while (match) {\n result += escape(mode_buffer.substring(last_index, match.index));\n keyword_match = keywordMatch(top, match);\n if (keyword_match) {\n relevance += keyword_match[1];\n result += buildSpan(keyword_match[0], escape(match[0]));\n } else {\n result += escape(match[0]);\n }\n last_index = top.lexemesRe.lastIndex;\n match = top.lexemesRe.exec(mode_buffer);\n }\n return result + escape(mode_buffer.substr(last_index));\n }\n\n function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string';\n if (explicit && !languages[top.subLanguage]) {\n return escape(mode_buffer);\n }\n\n var result = explicit ?\n highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) :\n highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined);\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Usecase in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n if (explicit) {\n continuations[top.subLanguage] = result.top;\n }\n return buildSpan(result.language, result.value, false, true);\n }\n\n function processBuffer() {\n result += (top.subLanguage != null ? processSubLanguage() : processKeywords());\n mode_buffer = '';\n }\n\n function startNewMode(mode) {\n result += mode.className? buildSpan(mode.className, '', true): '';\n top = Object.create(mode, {parent: {value: top}});\n }\n\n\n function doBeginMatch(match) {\n var lexeme = match[0];\n var new_mode = match.rule;\n\n if (new_mode && new_mode.endSameAsBegin) {\n new_mode.endRe = escapeRe( lexeme );\n }\n\n if (new_mode.skip) {\n mode_buffer += lexeme;\n } else {\n if (new_mode.excludeBegin) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (!new_mode.returnBegin && !new_mode.excludeBegin) {\n mode_buffer = lexeme;\n }\n }\n startNewMode(new_mode, lexeme);\n return new_mode.returnBegin ? 0 : lexeme.length;\n }\n\n function doEndMatch(match) {\n var lexeme = match[0];\n var end_mode = endOfMode(top, lexeme);\n if (!end_mode) { return; }\n\n var origin = top;\n if (origin.skip) {\n mode_buffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n mode_buffer = lexeme;\n }\n }\n do {\n if (top.className) {\n result += spanEndTag;\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== end_mode.parent);\n if (end_mode.starts) {\n if (end_mode.endSameAsBegin) {\n end_mode.starts.endRe = end_mode.endRe;\n }\n startNewMode(end_mode.starts, '');\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n var lastMatch = {};\n function processLexeme(text_before_match, match) {\n\n var lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n mode_buffer += text_before_match;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type==\"begin\" && match.type==\"end\" && lastMatch.index == match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n mode_buffer += value.slice(match.index, match.index + 1)\n return 1;\n }\n lastMatch = match;\n\n if (match.type===\"begin\") {\n return doBeginMatch(match);\n } else if (match.type===\"illegal\" && !ignore_illegals) {\n // illegal match, we do not continue processing\n throw new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.className || '') + '\"');\n } else if (match.type===\"end\") {\n var processed = doEndMatch(match);\n if (processed != undefined)\n return processed;\n }\n\n /*\n Why might be find ourselves here? Only one occasion now. An end match that was\n triggered but could not be completed. When might this happen? When an `endSameasBegin`\n rule sets the end rule to a specific match. Since the overall mode termination rule that's\n being used to scan the text isn't recompiled that means that any match that LOOKS like\n the end (but is not, because it is not an exact match to the beginning) will\n end up here. A definite end match, but when `doEndMatch` tries to \"reapply\"\n the end rule and fails to match, we wind up here, and just silently ignore the end.\n\n This causes no real harm other than stopping a few times too many.\n */\n\n mode_buffer += lexeme;\n return lexeme.length;\n }\n\n var language = getLanguage(name);\n if (!language) {\n throw new Error('Unknown language: \"' + name + '\"');\n }\n\n compileLanguage(language);\n var top = continuation || language;\n var continuations = {}; // keep continuations for sub-languages\n var result = '', current;\n for(current = top; current !== language; current = current.parent) {\n if (current.className) {\n result = buildSpan(current.className, '', true) + result;\n }\n }\n var mode_buffer = '';\n var relevance = 0;\n try {\n var match, count, index = 0;\n while (true) {\n top.terminators.lastIndex = index;\n match = top.terminators.exec(value);\n if (!match)\n break;\n count = processLexeme(value.substring(index, match.index), match);\n index = match.index + count;\n }\n processLexeme(value.substr(index));\n for(current = top; current.parent; current = current.parent) { // close dangling modes\n if (current.className) {\n result += spanEndTag;\n }\n }\n return {\n relevance: relevance,\n value: result,\n illegal:false,\n language: name,\n top: top\n };\n } catch (e) {\n if (e.message && e.message.indexOf('Illegal') !== -1) {\n return {\n illegal: true,\n relevance: 0,\n value: escape(value)\n };\n } else {\n throw e;\n }\n }\n }\n\n /*\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - second_best (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n */\n function highlightAuto(text, languageSubset) {\n languageSubset = languageSubset || options.languages || objectKeys(languages);\n var result = {\n relevance: 0,\n value: escape(text)\n };\n var second_best = result;\n languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) {\n var current = highlight(name, text, false);\n current.language = name;\n if (current.relevance > second_best.relevance) {\n second_best = current;\n }\n if (current.relevance > result.relevance) {\n second_best = result;\n result = current;\n }\n });\n if (second_best.language) {\n result.second_best = second_best;\n }\n return result;\n }\n\n /*\n Post-processing of the highlighted markup:\n\n - replace TABs with something more useful\n - replace real line-breaks with '
' for non-pre containers\n\n */\n function fixMarkup(value) {\n return !(options.tabReplace || options.useBR)\n ? value\n : value.replace(fixMarkupRe, function(match, p1) {\n if (options.useBR && match === '\\n') {\n return '
';\n } else if (options.tabReplace) {\n return p1.replace(/\\t/g, options.tabReplace);\n }\n return '';\n });\n }\n\n function buildClassName(prevClassName, currentLang, resultLang) {\n var language = currentLang ? aliases[currentLang] : resultLang,\n result = [prevClassName.trim()];\n\n if (!prevClassName.match(/\\bhljs\\b/)) {\n result.push('hljs');\n }\n\n if (prevClassName.indexOf(language) === -1) {\n result.push(language);\n }\n\n return result.join(' ').trim();\n }\n\n /*\n Applies highlighting to a DOM node containing code. Accepts a DOM node and\n two optional parameters for fixMarkup.\n */\n function highlightBlock(block) {\n var node, originalStream, result, resultNode, text;\n var language = blockLanguage(block);\n\n if (isNotHighlighted(language))\n return;\n\n if (options.useBR) {\n node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');\n node.innerHTML = block.innerHTML.replace(/\\n/g, '').replace(//g, '\\n');\n } else {\n node = block;\n }\n text = node.textContent;\n result = language ? highlight(language, text, true) : highlightAuto(text);\n\n originalStream = nodeStream(node);\n if (originalStream.length) {\n resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');\n resultNode.innerHTML = result.value;\n result.value = mergeStreams(originalStream, nodeStream(resultNode), text);\n }\n result.value = fixMarkup(result.value);\n\n block.innerHTML = result.value;\n block.className = buildClassName(block.className, language, result.language);\n block.result = {\n language: result.language,\n re: result.relevance\n };\n if (result.second_best) {\n block.second_best = {\n language: result.second_best.language,\n re: result.second_best.relevance\n };\n }\n }\n\n /*\n Updates highlight.js global options with values passed in the form of an object.\n */\n function configure(user_options) {\n options = inherit(options, user_options);\n }\n\n /*\n Applies highlighting to all
..
blocks on a page.\n */\n function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n ArrayProto.forEach.call(blocks, highlightBlock);\n }\n\n /*\n Attaches highlighting to the page load event.\n */\n function initHighlightingOnLoad() {\n addEventListener('DOMContentLoaded', initHighlighting, false);\n addEventListener('load', initHighlighting, false);\n }\n\n function registerLanguage(name, language) {\n var lang = languages[name] = language(hljs);\n restoreLanguageApi(lang);\n lang.rawDefinition = language.bind(null,hljs);\n\n if (lang.aliases) {\n lang.aliases.forEach(function(alias) {aliases[alias] = name;});\n }\n }\n\n function listLanguages() {\n return objectKeys(languages);\n }\n\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n function autoDetection(name) {\n var lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /* Interface definition */\n\n hljs.highlight = highlight;\n hljs.highlightAuto = highlightAuto;\n hljs.fixMarkup = fixMarkup;\n hljs.highlightBlock = highlightBlock;\n hljs.configure = configure;\n hljs.initHighlighting = initHighlighting;\n hljs.initHighlightingOnLoad = initHighlightingOnLoad;\n hljs.registerLanguage = registerLanguage;\n hljs.listLanguages = listLanguages;\n hljs.getLanguage = getLanguage;\n hljs.autoDetection = autoDetection;\n hljs.inherit = inherit;\n\n // Common regexps\n hljs.IDENT_RE = '[a-zA-Z]\\\\w*';\n hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\n hljs.NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\n hljs.C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\n hljs.BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\n hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n // Common modes\n hljs.BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n };\n hljs.APOS_STRING_MODE = {\n className: 'string',\n begin: '\\'', end: '\\'',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.QUOTE_STRING_MODE = {\n className: 'string',\n begin: '\"', end: '\"',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n };\n hljs.COMMENT = function (begin, end, inherits) {\n var mode = hljs.inherit(\n {\n className: 'comment',\n begin: begin, end: end,\n contains: []\n },\n inherits || {}\n );\n mode.contains.push(hljs.PHRASAL_WORDS_MODE);\n mode.contains.push({\n className: 'doctag',\n begin: '(?:TODO|FIXME|NOTE|BUG|XXX):',\n relevance: 0\n });\n return mode;\n };\n hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$');\n hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\\\*', '\\\\*/');\n hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$');\n hljs.NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE,\n relevance: 0\n };\n hljs.C_NUMBER_MODE = {\n className: 'number',\n begin: hljs.C_NUMBER_RE,\n relevance: 0\n };\n hljs.BINARY_NUMBER_MODE = {\n className: 'number',\n begin: hljs.BINARY_NUMBER_RE,\n relevance: 0\n };\n hljs.CSS_NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE + '(' +\n '%|em|ex|ch|rem' +\n '|vw|vh|vmin|vmax' +\n '|cm|mm|in|pt|pc|px' +\n '|deg|grad|rad|turn' +\n '|s|ms' +\n '|Hz|kHz' +\n '|dpi|dpcm|dppx' +\n ')?',\n relevance: 0\n };\n hljs.REGEXP_MODE = {\n className: 'regexp',\n begin: /\\//, end: /\\/[gimuy]*/,\n illegal: /\\n/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n {\n begin: /\\[/, end: /\\]/,\n relevance: 0,\n contains: [hljs.BACKSLASH_ESCAPE]\n }\n ]\n };\n hljs.TITLE_MODE = {\n className: 'title',\n begin: hljs.IDENT_RE,\n relevance: 0\n };\n hljs.UNDERSCORE_TITLE_MODE = {\n className: 'title',\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n hljs.METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n\n return hljs;\n}));\n","module.exports = function(hljs){\n\n // общий паттерн для определения идентификаторов\n var UNDERSCORE_IDENT_RE = '[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]+';\n \n // v7 уникальные ключевые слова, отсутствующие в v8 ==> keyword\n var v7_keywords =\n 'далее ';\n\n // v8 ключевые слова ==> keyword\n var v8_keywords =\n 'возврат вызватьисключение выполнить для если и из или иначе иначеесли исключение каждого конецесли ' +\n 'конецпопытки конеццикла не новый перейти перем по пока попытка прервать продолжить тогда цикл экспорт ';\n\n // keyword : ключевые слова\n var KEYWORD = v7_keywords + v8_keywords;\n \n // v7 уникальные директивы, отсутствующие в v8 ==> meta-keyword\n var v7_meta_keywords =\n 'загрузитьизфайла ';\n\n // v8 ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях ==> meta-keyword\n var v8_meta_keywords =\n 'вебклиент вместо внешнеесоединение клиент конецобласти мобильноеприложениеклиент мобильноеприложениесервер ' +\n 'наклиенте наклиентенасервере наклиентенасерверебезконтекста насервере насерверебезконтекста область перед ' +\n 'после сервер толстыйклиентобычноеприложение толстыйклиентуправляемоеприложение тонкийклиент ';\n\n // meta-keyword : ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях\n var METAKEYWORD = v7_meta_keywords + v8_meta_keywords;\n\n // v7 системные константы ==> built_in\n var v7_system_constants =\n 'разделительстраниц разделительстрок символтабуляции ';\n \n // v7 уникальные методы глобального контекста, отсутствующие в v8 ==> built_in\n var v7_global_context_methods =\n 'ansitooem oemtoansi ввестивидсубконто ввестиперечисление ввестипериод ввестиплансчетов выбранныйплансчетов ' +\n 'датагод датамесяц датачисло заголовоксистемы значениевстроку значениеизстроки каталогиб каталогпользователя ' +\n 'кодсимв конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца ' +\n 'коннедели лог лог10 максимальноеколичествосубконто названиеинтерфейса названиенабораправ назначитьвид ' +\n 'назначитьсчет найтиссылки началопериодаби началостандартногоинтервала начгода начквартала начмесяца ' +\n 'начнедели номерднягода номерднянедели номернеделигода обработкаожидания основнойжурналрасчетов ' +\n 'основнойплансчетов основнойязык очиститьокносообщений периодстр получитьвремята получитьдатута ' +\n 'получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта ' +\n 'префиксавтонумерации пропись пустоезначение разм разобратьпозициюдокумента рассчитатьрегистрына ' +\n 'рассчитатьрегистрыпо симв создатьобъект статусвозврата стрколичествострок сформироватьпозициюдокумента ' +\n 'счетпокоду текущеевремя типзначения типзначениястр установитьтана установитьтапо фиксшаблон шаблон ';\n \n // v8 методы глобального контекста ==> built_in\n var v8_global_context_methods =\n 'acos asin atan base64значение base64строка cos exp log log10 pow sin sqrt tan xmlзначение xmlстрока ' +\n 'xmlтип xmlтипзнч активноеокно безопасныйрежим безопасныйрежимразделенияданных булево ввестидату ввестизначение ' +\n 'ввестистроку ввестичисло возможностьчтенияxml вопрос восстановитьзначение врег выгрузитьжурналрегистрации ' +\n 'выполнитьобработкуоповещения выполнитьпроверкуправдоступа вычислить год данныеформывзначение дата день деньгода ' +\n 'деньнедели добавитьмесяц заблокироватьданныедляредактирования заблокироватьработупользователя завершитьработусистемы ' +\n 'загрузитьвнешнююкомпоненту закрытьсправку записатьjson записатьxml записатьдатуjson записьжурналарегистрации ' +\n 'заполнитьзначениясвойств запроситьразрешениепользователя запуститьприложение запуститьсистему зафиксироватьтранзакцию ' +\n 'значениевданныеформы значениевстрокувнутр значениевфайл значениезаполнено значениеизстрокивнутр значениеизфайла ' +\n 'изxmlтипа импортмоделиxdto имякомпьютера имяпользователя инициализироватьпредопределенныеданные информацияобошибке ' +\n 'каталогбиблиотекимобильногоустройства каталогвременныхфайлов каталогдокументов каталогпрограммы кодироватьстроку ' +\n 'кодлокализацииинформационнойбазы кодсимвола командасистемы конецгода конецдня конецквартала конецмесяца конецминуты ' +\n 'конецнедели конецчаса конфигурациябазыданныхизмененадинамически конфигурацияизменена копироватьданныеформы ' +\n 'копироватьфайл краткоепредставлениеошибки лев макс местноевремя месяц мин минута монопольныйрежим найти ' +\n 'найтинедопустимыесимволыxml найтиокнопонавигационнойссылке найтипомеченныенаудаление найтипоссылкам найтифайлы ' +\n 'началогода началодня началоквартала началомесяца началоминуты началонедели началочаса начатьзапросразрешенияпользователя ' +\n 'начатьзапускприложения начатькопированиефайла начатьперемещениефайла начатьподключениевнешнейкомпоненты ' +\n 'начатьподключениерасширенияработыскриптографией начатьподключениерасширенияработысфайлами начатьпоискфайлов ' +\n 'начатьполучениекаталогавременныхфайлов начатьполучениекаталогадокументов начатьполучениерабочегокаталогаданныхпользователя ' +\n 'начатьполучениефайлов начатьпомещениефайла начатьпомещениефайлов начатьсозданиедвоичныхданныхизфайла начатьсозданиекаталога ' +\n 'начатьтранзакцию начатьудалениефайлов начатьустановкувнешнейкомпоненты начатьустановкурасширенияработыскриптографией ' +\n 'начатьустановкурасширенияработысфайлами неделягода необходимостьзавершениясоединения номерсеансаинформационнойбазы ' +\n 'номерсоединенияинформационнойбазы нрег нстр обновитьинтерфейс обновитьнумерациюобъектов обновитьповторноиспользуемыезначения ' +\n 'обработкапрерыванияпользователя объединитьфайлы окр описаниеошибки оповестить оповеститьобизменении ' +\n 'отключитьобработчикзапросанастроекклиенталицензирования отключитьобработчикожидания отключитьобработчикоповещения ' +\n 'открытьзначение открытьиндекссправки открытьсодержаниесправки открытьсправку открытьформу открытьформумодально ' +\n 'отменитьтранзакцию очиститьжурналрегистрации очиститьнастройкипользователя очиститьсообщения параметрыдоступа ' +\n 'перейтипонавигационнойссылке переместитьфайл подключитьвнешнююкомпоненту ' +\n 'подключитьобработчикзапросанастроекклиенталицензирования подключитьобработчикожидания подключитьобработчикоповещения ' +\n 'подключитьрасширениеработыскриптографией подключитьрасширениеработысфайлами подробноепредставлениеошибки ' +\n 'показатьвводдаты показатьвводзначения показатьвводстроки показатьвводчисла показатьвопрос показатьзначение ' +\n 'показатьинформациюобошибке показатьнакарте показатьоповещениепользователя показатьпредупреждение полноеимяпользователя ' +\n 'получитьcomобъект получитьxmlтип получитьадреспоместоположению получитьблокировкусеансов получитьвремязавершенияспящегосеанса ' +\n 'получитьвремязасыпанияпассивногосеанса получитьвремяожиданияблокировкиданных получитьданныевыбора ' +\n 'получитьдополнительныйпараметрклиенталицензирования получитьдопустимыекодылокализации получитьдопустимыечасовыепояса ' +\n 'получитьзаголовокклиентскогоприложения получитьзаголовоксистемы получитьзначенияотборажурналарегистрации ' +\n 'получитьидентификаторконфигурации получитьизвременногохранилища получитьимявременногофайла ' +\n 'получитьимяклиенталицензирования получитьинформациюэкрановклиента получитьиспользованиежурналарегистрации ' +\n 'получитьиспользованиесобытияжурналарегистрации получитькраткийзаголовокприложения получитьмакетоформления ' +\n 'получитьмаскувсефайлы получитьмаскувсефайлыклиента получитьмаскувсефайлысервера получитьместоположениепоадресу ' +\n 'получитьминимальнуюдлинупаролейпользователей получитьнавигационнуюссылку получитьнавигационнуюссылкуинформационнойбазы ' +\n 'получитьобновлениеконфигурациибазыданных получитьобновлениепредопределенныхданныхинформационнойбазы получитьобщиймакет ' +\n 'получитьобщуюформу получитьокна получитьоперативнуюотметкувремени получитьотключениебезопасногорежима ' +\n 'получитьпараметрыфункциональныхопцийинтерфейса получитьполноеимяпредопределенногозначения ' +\n 'получитьпредставлениянавигационныхссылок получитьпроверкусложностипаролейпользователей получитьразделительпути ' +\n 'получитьразделительпутиклиента получитьразделительпутисервера получитьсеансыинформационнойбазы ' +\n 'получитьскоростьклиентскогосоединения получитьсоединенияинформационнойбазы получитьсообщенияпользователю ' +\n 'получитьсоответствиеобъектаиформы получитьсоставстандартногоинтерфейсаodata получитьструктурухранениябазыданных ' +\n 'получитьтекущийсеансинформационнойбазы получитьфайл получитьфайлы получитьформу получитьфункциональнуюопцию ' +\n 'получитьфункциональнуюопциюинтерфейса получитьчасовойпоясинформационнойбазы пользователиос поместитьвовременноехранилище ' +\n 'поместитьфайл поместитьфайлы прав праводоступа предопределенноезначение представлениекодалокализации представлениепериода ' +\n 'представлениеправа представлениеприложения представлениесобытияжурналарегистрации представлениечасовогопояса предупреждение ' +\n 'прекратитьработусистемы привилегированныйрежим продолжитьвызов прочитатьjson прочитатьxml прочитатьдатуjson пустаястрока ' +\n 'рабочийкаталогданныхпользователя разблокироватьданныедляредактирования разделитьфайл разорватьсоединениесвнешнимисточникомданных ' +\n 'раскодироватьстроку рольдоступна секунда сигнал символ скопироватьжурналрегистрации смещениелетнеговремени ' +\n 'смещениестандартноговремени соединитьбуферыдвоичныхданных создатькаталог создатьфабрикуxdto сокрл сокрлп сокрп сообщить ' +\n 'состояние сохранитьзначение сохранитьнастройкипользователя сред стрдлина стрзаканчиваетсяна стрзаменить стрнайти стрначинаетсяс ' +\n 'строка строкасоединенияинформационнойбазы стрполучитьстроку стрразделить стрсоединить стрсравнить стрчисловхождений '+\n 'стрчислострок стршаблон текущаядата текущаядатасеанса текущаяуниверсальнаядата текущаяуниверсальнаядатавмиллисекундах ' +\n 'текущийвариантинтерфейсаклиентскогоприложения текущийвариантосновногошрифтаклиентскогоприложения текущийкодлокализации ' +\n 'текущийрежимзапуска текущийязык текущийязыксистемы тип типзнч транзакцияактивна трег удалитьданныеинформационнойбазы ' +\n 'удалитьизвременногохранилища удалитьобъекты удалитьфайлы универсальноевремя установитьбезопасныйрежим ' +\n 'установитьбезопасныйрежимразделенияданных установитьблокировкусеансов установитьвнешнююкомпоненту ' +\n 'установитьвремязавершенияспящегосеанса установитьвремязасыпанияпассивногосеанса установитьвремяожиданияблокировкиданных ' +\n 'установитьзаголовокклиентскогоприложения установитьзаголовоксистемы установитьиспользованиежурналарегистрации ' +\n 'установитьиспользованиесобытияжурналарегистрации установитькраткийзаголовокприложения ' +\n 'установитьминимальнуюдлинупаролейпользователей установитьмонопольныйрежим установитьнастройкиклиенталицензирования ' +\n 'установитьобновлениепредопределенныхданныхинформационнойбазы установитьотключениебезопасногорежима ' +\n 'установитьпараметрыфункциональныхопцийинтерфейса установитьпривилегированныйрежим ' +\n 'установитьпроверкусложностипаролейпользователей установитьрасширениеработыскриптографией ' +\n 'установитьрасширениеработысфайлами установитьсоединениесвнешнимисточникомданных установитьсоответствиеобъектаиформы ' +\n 'установитьсоставстандартногоинтерфейсаodata установитьчасовойпоясинформационнойбазы установитьчасовойпояссеанса ' +\n 'формат цел час часовойпояс часовойпояссеанса число числопрописью этоадресвременногохранилища ';\n\n // v8 свойства глобального контекста ==> built_in\n var v8_global_context_property =\n 'wsссылки библиотекакартинок библиотекамакетовоформлениякомпоновкиданных библиотекастилей бизнеспроцессы ' +\n 'внешниеисточникиданных внешниеобработки внешниеотчеты встроенныепокупки главныйинтерфейс главныйстиль ' +\n 'документы доставляемыеуведомления журналыдокументов задачи информацияобинтернетсоединении использованиерабочейдаты ' +\n 'историяработыпользователя константы критерииотбора метаданные обработки отображениерекламы отправкадоставляемыхуведомлений ' +\n 'отчеты панельзадачос параметрзапуска параметрысеанса перечисления планывидоврасчета планывидовхарактеристик ' +\n 'планыобмена планысчетов полнотекстовыйпоиск пользователиинформационнойбазы последовательности проверкавстроенныхпокупок ' +\n 'рабочаядата расширенияконфигурации регистрыбухгалтерии регистрынакопления регистрырасчета регистрысведений ' +\n 'регламентныезадания сериализаторxdto справочники средствагеопозиционирования средствакриптографии средствамультимедиа ' +\n 'средстваотображениярекламы средствапочты средствателефонии фабрикаxdto файловыепотоки фоновыезадания хранилищанастроек ' +\n 'хранилищевариантовотчетов хранилищенастроекданныхформ хранилищеобщихнастроек хранилищепользовательскихнастроекдинамическихсписков ' +\n 'хранилищепользовательскихнастроекотчетов хранилищесистемныхнастроек ';\n\n // built_in : встроенные или библиотечные объекты (константы, классы, функции)\n var BUILTIN =\n v7_system_constants +\n v7_global_context_methods + v8_global_context_methods +\n v8_global_context_property;\n \n // v8 системные наборы значений ==> class\n var v8_system_sets_of_values =\n 'webцвета windowsцвета windowsшрифты библиотекакартинок рамкистиля символы цветастиля шрифтыстиля ';\n\n // v8 системные перечисления - интерфейсные ==> class\n var v8_system_enums_interface =\n 'автоматическоесохранениеданныхформывнастройках автонумерациявформе автораздвижениесерий ' +\n 'анимациядиаграммы вариантвыравниванияэлементовизаголовков вариантуправлениявысотойтаблицы ' +\n 'вертикальнаяпрокруткаформы вертикальноеположение вертикальноеположениеэлемента видгруппыформы ' +\n 'виддекорацииформы виддополненияэлементаформы видизмененияданных видкнопкиформы видпереключателя ' +\n 'видподписейкдиаграмме видполяформы видфлажка влияниеразмеранапузырекдиаграммы горизонтальноеположение ' +\n 'горизонтальноеположениеэлемента группировкаколонок группировкаподчиненныхэлементовформы ' +\n 'группыиэлементы действиеперетаскивания дополнительныйрежимотображения допустимыедействияперетаскивания ' +\n 'интервалмеждуэлементамиформы использованиевывода использованиеполосыпрокрутки ' +\n 'используемоезначениеточкибиржевойдиаграммы историявыборапривводе источникзначенийоситочекдиаграммы ' +\n 'источникзначенияразмерапузырькадиаграммы категориягруппыкоманд максимумсерий начальноеотображениедерева ' +\n 'начальноеотображениесписка обновлениетекстаредактирования ориентациядендрограммы ориентациядиаграммы ' +\n 'ориентацияметокдиаграммы ориентацияметоксводнойдиаграммы ориентацияэлементаформы отображениевдиаграмме ' +\n 'отображениевлегендедиаграммы отображениегруппыкнопок отображениезаголовкашкалыдиаграммы ' +\n 'отображениезначенийсводнойдиаграммы отображениезначенияизмерительнойдиаграммы ' +\n 'отображениеинтерваладиаграммыганта отображениекнопки отображениекнопкивыбора отображениеобсужденийформы ' +\n 'отображениеобычнойгруппы отображениеотрицательныхзначенийпузырьковойдиаграммы отображениепанелипоиска ' +\n 'отображениеподсказки отображениепредупрежденияприредактировании отображениеразметкиполосырегулирования ' +\n 'отображениестраницформы отображениетаблицы отображениетекстазначениядиаграммыганта ' +\n 'отображениеуправленияобычнойгруппы отображениефигурыкнопки палитрацветовдиаграммы поведениеобычнойгруппы ' +\n 'поддержкамасштабадендрограммы поддержкамасштабадиаграммыганта поддержкамасштабасводнойдиаграммы ' +\n 'поисквтаблицепривводе положениезаголовкаэлементаформы положениекартинкикнопкиформы ' +\n 'положениекартинкиэлементаграфическойсхемы положениекоманднойпанелиформы положениекоманднойпанелиэлементаформы ' +\n 'положениеопорнойточкиотрисовки положениеподписейкдиаграмме положениеподписейшкалызначенийизмерительнойдиаграммы ' +\n 'положениесостоянияпросмотра положениестрокипоиска положениетекстасоединительнойлинии положениеуправленияпоиском ' +\n 'положениешкалывремени порядокотображенияточекгоризонтальнойгистограммы порядоксерийвлегендедиаграммы ' +\n 'размеркартинки расположениезаголовкашкалыдиаграммы растягиваниеповертикалидиаграммыганта ' +\n 'режимавтоотображениясостояния режимвводастроктаблицы режимвыборанезаполненного режимвыделениядаты ' +\n 'режимвыделениястрокитаблицы режимвыделениятаблицы режимизмененияразмера режимизменениясвязанногозначения ' +\n 'режимиспользованиядиалогапечати режимиспользованияпараметракоманды режиммасштабированияпросмотра ' +\n 'режимосновногоокнаклиентскогоприложения режимоткрытияокнаформы режимотображениявыделения ' +\n 'режимотображениягеографическойсхемы режимотображениязначенийсерии режимотрисовкисеткиграфическойсхемы ' +\n 'режимполупрозрачностидиаграммы режимпробеловдиаграммы режимразмещениянастранице режимредактированияколонки ' +\n 'режимсглаживаниядиаграммы режимсглаживанияиндикатора режимсписказадач сквозноевыравнивание ' +\n 'сохранениеданныхформывнастройках способзаполнениятекстазаголовкашкалыдиаграммы ' +\n 'способопределенияограничивающегозначениядиаграммы стандартнаягруппакоманд стандартноеоформление ' +\n 'статусоповещенияпользователя стильстрелки типаппроксимациилиниитрендадиаграммы типдиаграммы ' +\n 'типединицышкалывремени типимпортасерийслоягеографическойсхемы типлиниигеографическойсхемы типлиниидиаграммы ' +\n 'типмаркерагеографическойсхемы типмаркерадиаграммы типобластиоформления ' +\n 'типорганизацииисточникаданныхгеографическойсхемы типотображениясериислоягеографическойсхемы ' +\n 'типотображенияточечногообъектагеографическойсхемы типотображенияшкалыэлементалегендыгеографическойсхемы ' +\n 'типпоискаобъектовгеографическойсхемы типпроекциигеографическойсхемы типразмещенияизмерений ' +\n 'типразмещенияреквизитовизмерений типрамкиэлементауправления типсводнойдиаграммы ' +\n 'типсвязидиаграммыганта типсоединениязначенийпосериямдиаграммы типсоединенияточекдиаграммы ' +\n 'типсоединительнойлинии типстороныэлементаграфическойсхемы типформыотчета типшкалырадарнойдиаграммы ' +\n 'факторлиниитрендадиаграммы фигуракнопки фигурыграфическойсхемы фиксациявтаблице форматдняшкалывремени ' +\n 'форматкартинки ширинаподчиненныхэлементовформы ';\n\n // v8 системные перечисления - свойства прикладных объектов ==> class\n var v8_system_enums_objects_properties =\n 'виддвижениябухгалтерии виддвижениянакопления видпериодарегистрарасчета видсчета видточкимаршрутабизнеспроцесса ' +\n 'использованиеагрегатарегистранакопления использованиегруппиэлементов использованиережимапроведения ' +\n 'использованиесреза периодичностьагрегатарегистранакопления режимавтовремя режимзаписидокумента режимпроведениядокумента ';\n\n // v8 системные перечисления - планы обмена ==> class\n var v8_system_enums_exchange_plans =\n 'авторегистрацияизменений допустимыйномерсообщения отправкаэлементаданных получениеэлементаданных ';\n\n // v8 системные перечисления - табличный документ ==> class\n var v8_system_enums_tabular_document =\n 'использованиерасшифровкитабличногодокумента ориентациястраницы положениеитоговколоноксводнойтаблицы ' +\n 'положениеитоговстроксводнойтаблицы положениетекстаотносительнокартинки расположениезаголовкагруппировкитабличногодокумента ' +\n 'способчтениязначенийтабличногодокумента типдвустороннейпечати типзаполненияобластитабличногодокумента ' +\n 'типкурсоровтабличногодокумента типлиниирисункатабличногодокумента типлинииячейкитабличногодокумента ' +\n 'типнаправленияпереходатабличногодокумента типотображениявыделениятабличногодокумента типотображениялинийсводнойтаблицы ' +\n 'типразмещениятекстатабличногодокумента типрисункатабличногодокумента типсмещениятабличногодокумента ' +\n 'типузоратабличногодокумента типфайлатабличногодокумента точностьпечати чередованиерасположениястраниц ';\n\n // v8 системные перечисления - планировщик ==> class\n var v8_system_enums_sheduler =\n 'отображениевремениэлементовпланировщика ';\n\n // v8 системные перечисления - форматированный документ ==> class\n var v8_system_enums_formatted_document =\n 'типфайлаформатированногодокумента ';\n\n // v8 системные перечисления - запрос ==> class\n var v8_system_enums_query =\n 'обходрезультатазапроса типзаписизапроса ';\n\n // v8 системные перечисления - построитель отчета ==> class\n var v8_system_enums_report_builder =\n 'видзаполнениярасшифровкипостроителяотчета типдобавленияпредставлений типизмеренияпостроителяотчета типразмещенияитогов ';\n\n // v8 системные перечисления - работа с файлами ==> class\n var v8_system_enums_files =\n 'доступкфайлу режимдиалогавыборафайла режимоткрытияфайла ';\n\n // v8 системные перечисления - построитель запроса ==> class\n var v8_system_enums_query_builder =\n 'типизмеренияпостроителязапроса ';\n\n // v8 системные перечисления - анализ данных ==> class\n var v8_system_enums_data_analysis =\n 'видданныханализа методкластеризации типединицыинтервалавременианализаданных типзаполнениятаблицырезультатаанализаданных ' +\n 'типиспользованиячисловыхзначенийанализаданных типисточникаданныхпоискаассоциаций типколонкианализаданныхдереворешений ' +\n 'типколонкианализаданныхкластеризация типколонкианализаданныхобщаястатистика типколонкианализаданныхпоискассоциаций ' +\n 'типколонкианализаданныхпоискпоследовательностей типколонкимоделипрогноза типмерырасстоянияанализаданных ' +\n 'типотсеченияправилассоциации типполяанализаданных типстандартизациианализаданных типупорядочиванияправилассоциациианализаданных ' +\n 'типупорядочиванияшаблоновпоследовательностейанализаданных типупрощениядереварешений ';\n\n // v8 системные перечисления - xml, json, xs, dom, xdto, web-сервисы ==> class\n var v8_system_enums_xml_json_xs_dom_xdto_ws =\n 'wsнаправлениепараметра вариантxpathxs вариантзаписидатыjson вариантпростоготипаxs видгруппымоделиxs видфасетаxdto ' +\n 'действиепостроителяdom завершенностьпростоготипаxs завершенностьсоставноготипаxs завершенностьсхемыxs запрещенныеподстановкиxs ' +\n 'исключениягруппподстановкиxs категорияиспользованияатрибутаxs категорияограниченияидентичностиxs категорияограниченияпространствименxs ' +\n 'методнаследованияxs модельсодержимогоxs назначениетипаxml недопустимыеподстановкиxs обработкапробельныхсимволовxs обработкасодержимогоxs ' +\n 'ограничениезначенияxs параметрыотбораузловdom переносстрокjson позициявдокументеdom пробельныесимволыxml типатрибутаxml типзначенияjson ' +\n 'типканоническогоxml типкомпонентыxs типпроверкиxml типрезультатаdomxpath типузлаdom типузлаxml формаxml формапредставленияxs ' +\n 'форматдатыjson экранированиесимволовjson ';\n\n // v8 системные перечисления - система компоновки данных ==> class\n var v8_system_enums_data_composition_system =\n 'видсравнениякомпоновкиданных действиеобработкирасшифровкикомпоновкиданных направлениесортировкикомпоновкиданных ' +\n 'расположениевложенныхэлементоврезультатакомпоновкиданных расположениеитоговкомпоновкиданных расположениегруппировкикомпоновкиданных ' +\n 'расположениеполейгруппировкикомпоновкиданных расположениеполякомпоновкиданных расположениереквизитовкомпоновкиданных ' +\n 'расположениересурсовкомпоновкиданных типбухгалтерскогоостаткакомпоновкиданных типвыводатекстакомпоновкиданных ' +\n 'типгруппировкикомпоновкиданных типгруппыэлементовотборакомпоновкиданных типдополненияпериодакомпоновкиданных ' +\n 'типзаголовкаполейкомпоновкиданных типмакетагруппировкикомпоновкиданных типмакетаобластикомпоновкиданных типостаткакомпоновкиданных ' +\n 'типпериодакомпоновкиданных типразмещениятекстакомпоновкиданных типсвязинаборовданныхкомпоновкиданных типэлементарезультатакомпоновкиданных ' +\n 'расположениелегендыдиаграммыкомпоновкиданных типпримененияотборакомпоновкиданных режимотображенияэлементанастройкикомпоновкиданных ' +\n 'режимотображениянастроеккомпоновкиданных состояниеэлементанастройкикомпоновкиданных способвосстановлениянастроеккомпоновкиданных ' +\n 'режимкомпоновкирезультата использованиепараметракомпоновкиданных автопозицияресурсовкомпоновкиданных '+\n 'вариантиспользованиягруппировкикомпоновкиданных расположениересурсоввдиаграммекомпоновкиданных фиксациякомпоновкиданных ' +\n 'использованиеусловногооформлениякомпоновкиданных ';\n\n // v8 системные перечисления - почта ==> class\n var v8_system_enums_email =\n 'важностьинтернетпочтовогосообщения обработкатекстаинтернетпочтовогосообщения способкодированияинтернетпочтовоговложения ' +\n 'способкодированиянеasciiсимволовинтернетпочтовогосообщения типтекстапочтовогосообщения протоколинтернетпочты ' +\n 'статусразборапочтовогосообщения ';\n\n // v8 системные перечисления - журнал регистрации ==> class\n var v8_system_enums_logbook =\n 'режимтранзакциизаписижурналарегистрации статустранзакциизаписижурналарегистрации уровеньжурналарегистрации ';\n\n // v8 системные перечисления - криптография ==> class\n var v8_system_enums_cryptography =\n 'расположениехранилищасертификатовкриптографии режимвключениясертификатовкриптографии режимпроверкисертификатакриптографии ' +\n 'типхранилищасертификатовкриптографии ';\n\n // v8 системные перечисления - ZIP ==> class\n var v8_system_enums_zip =\n 'кодировкаименфайловвzipфайле методсжатияzip методшифрованияzip режимвосстановленияпутейфайловzip режимобработкиподкаталоговzip ' +\n 'режимсохраненияпутейzip уровеньсжатияzip ';\n\n // v8 системные перечисления - \n // Блокировка данных, Фоновые задания, Автоматизированное тестирование,\n // Доставляемые уведомления, Встроенные покупки, Интернет, Работа с двоичными данными ==> class\n var v8_system_enums_other =\n 'звуковоеоповещение направлениепереходакстроке позициявпотоке порядокбайтов режимблокировкиданных режимуправленияблокировкойданных ' +\n 'сервисвстроенныхпокупок состояниефоновогозадания типподписчикадоставляемыхуведомлений уровеньиспользованиязащищенногосоединенияftp ';\n\n // v8 системные перечисления - схема запроса ==> class\n var v8_system_enums_request_schema =\n 'направлениепорядкасхемызапроса типдополненияпериодамисхемызапроса типконтрольнойточкисхемызапроса типобъединениясхемызапроса ' +\n 'типпараметрадоступнойтаблицысхемызапроса типсоединениясхемызапроса ';\n\n // v8 системные перечисления - свойства объектов метаданных ==> class\n var v8_system_enums_properties_of_metadata_objects =\n 'httpметод автоиспользованиеобщегореквизита автопрефиксномеразадачи вариантвстроенногоязыка видиерархии видрегистранакопления ' +\n 'видтаблицывнешнегоисточникаданных записьдвиженийприпроведении заполнениепоследовательностей индексирование ' +\n 'использованиебазыпланавидоврасчета использованиебыстроговыбора использованиеобщегореквизита использованиеподчинения ' +\n 'использованиеполнотекстовогопоиска использованиеразделяемыхданныхобщегореквизита использованиереквизита ' +\n 'назначениеиспользованияприложения назначениерасширенияконфигурации направлениепередачи обновлениепредопределенныхданных ' +\n 'оперативноепроведение основноепредставлениевидарасчета основноепредставлениевидахарактеристики основноепредставлениезадачи ' +\n 'основноепредставлениепланаобмена основноепредставлениесправочника основноепредставлениесчета перемещениеграницыприпроведении ' +\n 'периодичностьномерабизнеспроцесса периодичностьномерадокумента периодичностьрегистрарасчета периодичностьрегистрасведений ' +\n 'повторноеиспользованиевозвращаемыхзначений полнотекстовыйпоискпривводепостроке принадлежностьобъекта проведение ' +\n 'разделениеаутентификацииобщегореквизита разделениеданныхобщегореквизита разделениерасширенийконфигурацииобщегореквизита '+\n 'режимавтонумерацииобъектов режимзаписирегистра режимиспользованиямодальности ' +\n 'режимиспользованиясинхронныхвызововрасширенийплатформыивнешнихкомпонент режимповторногоиспользованиясеансов ' +\n 'режимполученияданныхвыборапривводепостроке режимсовместимости режимсовместимостиинтерфейса ' +\n 'режимуправленияблокировкойданныхпоумолчанию сериикодовпланавидовхарактеристик сериикодовпланасчетов ' +\n 'сериикодовсправочника созданиепривводе способвыбора способпоискастрокипривводепостроке способредактирования ' +\n 'типданныхтаблицывнешнегоисточникаданных типкодапланавидоврасчета типкодасправочника типмакета типномерабизнеспроцесса ' +\n 'типномерадокумента типномеразадачи типформы удалениедвижений ';\n\n // v8 системные перечисления - разные ==> class\n var v8_system_enums_differents =\n 'важностьпроблемыприменениярасширенияконфигурации вариантинтерфейсаклиентскогоприложения вариантмасштабаформклиентскогоприложения ' +\n 'вариантосновногошрифтаклиентскогоприложения вариантстандартногопериода вариантстандартнойдатыначала видграницы видкартинки ' +\n 'видотображенияполнотекстовогопоиска видрамки видсравнения видцвета видчисловогозначения видшрифта допустимаядлина допустимыйзнак ' +\n 'использованиеbyteordermark использованиеметаданныхполнотекстовогопоиска источникрасширенийконфигурации клавиша кодвозвратадиалога ' +\n 'кодировкаxbase кодировкатекста направлениепоиска направлениесортировки обновлениепредопределенныхданных обновлениеприизмененииданных ' +\n 'отображениепанелиразделов проверказаполнения режимдиалогавопрос режимзапускаклиентскогоприложения режимокругления режимоткрытияформприложения ' +\n 'режимполнотекстовогопоиска скоростьклиентскогосоединения состояниевнешнегоисточникаданных состояниеобновленияконфигурациибазыданных ' +\n 'способвыборасертификатаwindows способкодированиястроки статуссообщения типвнешнейкомпоненты типплатформы типповеденияклавишиenter ' +\n 'типэлементаинформацииовыполненииобновленияконфигурациибазыданных уровеньизоляциитранзакций хешфункция частидаты';\n\n // class: встроенные наборы значений, системные перечисления (содержат дочерние значения, обращения к которым через разыменование)\n var CLASS =\n v8_system_sets_of_values +\n v8_system_enums_interface +\n v8_system_enums_objects_properties +\n v8_system_enums_exchange_plans +\n v8_system_enums_tabular_document +\n v8_system_enums_sheduler +\n v8_system_enums_formatted_document +\n v8_system_enums_query +\n v8_system_enums_report_builder +\n v8_system_enums_files +\n v8_system_enums_query_builder +\n v8_system_enums_data_analysis +\n v8_system_enums_xml_json_xs_dom_xdto_ws +\n v8_system_enums_data_composition_system +\n v8_system_enums_email +\n v8_system_enums_logbook +\n v8_system_enums_cryptography +\n v8_system_enums_zip +\n v8_system_enums_other +\n v8_system_enums_request_schema +\n v8_system_enums_properties_of_metadata_objects +\n v8_system_enums_differents;\n\n // v8 общие объекты (у объектов есть конструктор, экземпляры создаются методом НОВЫЙ) ==> type\n var v8_shared_object =\n 'comобъект ftpсоединение httpзапрос httpсервисответ httpсоединение wsопределения wsпрокси xbase анализданных аннотацияxs ' +\n 'блокировкаданных буфердвоичныхданных включениеxs выражениекомпоновкиданных генераторслучайныхчисел географическаясхема ' +\n 'географическиекоординаты графическаясхема группамоделиxs данныерасшифровкикомпоновкиданных двоичныеданные дендрограмма ' +\n 'диаграмма диаграммаганта диалогвыборафайла диалогвыборацвета диалогвыборашрифта диалограсписаниярегламентногозадания ' +\n 'диалогредактированиястандартногопериода диапазон документdom документhtml документацияxs доставляемоеуведомление ' +\n 'записьdom записьfastinfoset записьhtml записьjson записьxml записьzipфайла записьданных записьтекста записьузловdom ' +\n 'запрос защищенноесоединениеopenssl значенияполейрасшифровкикомпоновкиданных извлечениетекста импортxs интернетпочта ' +\n 'интернетпочтовоесообщение интернетпочтовыйпрофиль интернетпрокси интернетсоединение информациядляприложенияxs ' +\n 'использованиеатрибутаxs использованиесобытияжурналарегистрации источникдоступныхнастроеккомпоновкиданных ' +\n 'итераторузловdom картинка квалификаторыдаты квалификаторыдвоичныхданных квалификаторыстроки квалификаторычисла ' +\n 'компоновщикмакетакомпоновкиданных компоновщикнастроеккомпоновкиданных конструктормакетаоформлениякомпоновкиданных ' +\n 'конструкторнастроеккомпоновкиданных конструкторформатнойстроки линия макеткомпоновкиданных макетобластикомпоновкиданных ' +\n 'макетоформлениякомпоновкиданных маскаxs менеджеркриптографии наборсхемxml настройкикомпоновкиданных настройкисериализацииjson ' +\n 'обработкакартинок обработкарасшифровкикомпоновкиданных обходдереваdom объявлениеатрибутаxs объявлениенотацииxs ' +\n 'объявлениеэлементаxs описаниеиспользованиясобытиядоступжурналарегистрации ' +\n 'описаниеиспользованиясобытияотказвдоступежурналарегистрации описаниеобработкирасшифровкикомпоновкиданных ' +\n 'описаниепередаваемогофайла описаниетипов определениегруппыатрибутовxs определениегруппымоделиxs ' +\n 'определениеограниченияидентичностиxs определениепростоготипаxs определениесоставноготипаxs определениетипадокументаdom ' +\n 'определенияxpathxs отборкомпоновкиданных пакетотображаемыхдокументов параметрвыбора параметркомпоновкиданных ' +\n 'параметрызаписиjson параметрызаписиxml параметрычтенияxml переопределениеxs планировщик полеанализаданных ' +\n 'полекомпоновкиданных построительdom построительзапроса построительотчета построительотчетаанализаданных ' +\n 'построительсхемxml поток потоквпамяти почта почтовоесообщение преобразованиеxsl преобразованиекканоническомуxml ' +\n 'процессорвыводарезультатакомпоновкиданныхвколлекциюзначений процессорвыводарезультатакомпоновкиданныхвтабличныйдокумент ' +\n 'процессоркомпоновкиданных разыменовательпространствименdom рамка расписаниерегламентногозадания расширенноеимяxml ' +\n 'результатчтенияданных своднаядиаграмма связьпараметравыбора связьпотипу связьпотипукомпоновкиданных сериализаторxdto ' +\n 'сертификатклиентаwindows сертификатклиентафайл сертификаткриптографии сертификатыудостоверяющихцентровwindows ' +\n 'сертификатыудостоверяющихцентровфайл сжатиеданных системнаяинформация сообщениепользователю сочетаниеклавиш ' +\n 'сравнениезначений стандартнаядатаначала стандартныйпериод схемаxml схемакомпоновкиданных табличныйдокумент ' +\n 'текстовыйдокумент тестируемоеприложение типданныхxml уникальныйидентификатор фабрикаxdto файл файловыйпоток ' +\n 'фасетдлиныxs фасетколичестваразрядовдробнойчастиxs фасетмаксимальноговключающегозначенияxs ' +\n 'фасетмаксимальногоисключающегозначенияxs фасетмаксимальнойдлиныxs фасетминимальноговключающегозначенияxs ' +\n 'фасетминимальногоисключающегозначенияxs фасетминимальнойдлиныxs фасетобразцаxs фасетобщегоколичестваразрядовxs ' +\n 'фасетперечисленияxs фасетпробельныхсимволовxs фильтрузловdom форматированнаястрока форматированныйдокумент ' +\n 'фрагментxs хешированиеданных хранилищезначения цвет чтениеfastinfoset чтениеhtml чтениеjson чтениеxml чтениеzipфайла ' +\n 'чтениеданных чтениетекста чтениеузловdom шрифт элементрезультатакомпоновкиданных ';\n\n // v8 универсальные коллекции значений ==> type\n var v8_universal_collection =\n 'comsafearray деревозначений массив соответствие списокзначений структура таблицазначений фиксированнаяструктура ' +\n 'фиксированноесоответствие фиксированныймассив ';\n\n // type : встроенные типы\n var TYPE =\n v8_shared_object +\n v8_universal_collection;\n\n // literal : примитивные типы\n var LITERAL = 'null истина ложь неопределено';\n \n // number : числа\n var NUMBERS = hljs.inherit(hljs.NUMBER_MODE);\n\n // string : строки\n var STRINGS = {\n className: 'string',\n begin: '\"|\\\\|', end: '\"|$',\n contains: [{begin: '\"\"'}]\n };\n\n // number : даты\n var DATE = {\n begin: \"'\", end: \"'\", excludeBegin: true, excludeEnd: true,\n contains: [\n {\n className: 'number',\n begin: '\\\\d{4}([\\\\.\\\\\\\\/:-]?\\\\d{2}){0,5}'\n }\n ]\n };\n \n // comment : комментарии\n var COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE);\n \n // meta : инструкции препроцессора, директивы компиляции\n var META = {\n className: 'meta',\n lexemes: UNDERSCORE_IDENT_RE,\n begin: '#|&', end: '$',\n keywords: {'meta-keyword': KEYWORD + METAKEYWORD},\n contains: [\n COMMENTS\n ]\n };\n \n // symbol : метка goto\n var SYMBOL = {\n className: 'symbol',\n begin: '~', end: ';|:', excludeEnd: true\n }; \n \n // function : объявление процедур и функций\n var FUNCTION = {\n className: 'function',\n lexemes: UNDERSCORE_IDENT_RE,\n variants: [\n {begin: 'процедура|функция', end: '\\\\)', keywords: 'процедура функция'},\n {begin: 'конецпроцедуры|конецфункции', keywords: 'конецпроцедуры конецфункции'}\n ],\n contains: [\n {\n begin: '\\\\(', end: '\\\\)', endsParent : true,\n contains: [\n {\n className: 'params',\n lexemes: UNDERSCORE_IDENT_RE,\n begin: UNDERSCORE_IDENT_RE, end: ',', excludeEnd: true, endsWithParent: true,\n keywords: {\n keyword: 'знач',\n literal: LITERAL\n },\n contains: [\n NUMBERS,\n STRINGS,\n DATE\n ]\n },\n COMMENTS\n ]\n },\n hljs.inherit(hljs.TITLE_MODE, {begin: UNDERSCORE_IDENT_RE})\n ]\n };\n\n return {\n case_insensitive: true,\n lexemes: UNDERSCORE_IDENT_RE,\n keywords: {\n keyword: KEYWORD,\n built_in: BUILTIN,\n class: CLASS,\n type: TYPE,\n literal: LITERAL\n },\n contains: [\n META,\n FUNCTION,\n COMMENTS,\n SYMBOL,\n NUMBERS,\n STRINGS,\n DATE\n ] \n }\n};","module.exports = function(hljs) {\n var regexes = {\n ruleDeclaration: \"^[a-zA-Z][a-zA-Z0-9-]*\",\n unexpectedChars: \"[!@#$^&',?+~`|:]\"\n };\n\n var keywords = [\n \"ALPHA\",\n \"BIT\",\n \"CHAR\",\n \"CR\",\n \"CRLF\",\n \"CTL\",\n \"DIGIT\",\n \"DQUOTE\",\n \"HEXDIG\",\n \"HTAB\",\n \"LF\",\n \"LWSP\",\n \"OCTET\",\n \"SP\",\n \"VCHAR\",\n \"WSP\"\n ];\n\n var commentMode = hljs.COMMENT(\";\", \"$\");\n\n var terminalBinaryMode = {\n className: \"symbol\",\n begin: /%b[0-1]+(-[0-1]+|(\\.[0-1]+)+){0,1}/\n };\n\n var terminalDecimalMode = {\n className: \"symbol\",\n begin: /%d[0-9]+(-[0-9]+|(\\.[0-9]+)+){0,1}/\n };\n\n var terminalHexadecimalMode = {\n className: \"symbol\",\n begin: /%x[0-9A-F]+(-[0-9A-F]+|(\\.[0-9A-F]+)+){0,1}/,\n };\n\n var caseSensitivityIndicatorMode = {\n className: \"symbol\",\n begin: /%[si]/\n };\n\n var ruleDeclarationMode = {\n className: \"attribute\",\n begin: regexes.ruleDeclaration + '(?=\\\\s*=)',\n };\n\n return {\n illegal: regexes.unexpectedChars,\n keywords: keywords.join(\" \"),\n contains: [\n ruleDeclarationMode,\n commentMode,\n terminalBinaryMode,\n terminalDecimalMode,\n terminalHexadecimalMode,\n caseSensitivityIndicatorMode,\n hljs.QUOTE_STRING_MODE,\n hljs.NUMBER_MODE\n ]\n };\n};","module.exports = function(hljs) {\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods\n var HTTP_VERBS = [\n \"GET\", \"POST\", \"HEAD\", \"PUT\", \"DELETE\", \"CONNECT\", \"OPTIONS\", \"PATCH\", \"TRACE\"\n ]\n return {\n contains: [\n // IP\n {\n className: 'number',\n begin: '^\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}(:\\\\d{1,5})?\\\\b',\n relevance:5\n },\n // Other numbers\n {\n className: 'number',\n begin: '\\\\b\\\\d+\\\\b',\n relevance: 0\n },\n // Requests\n {\n className: 'string',\n begin: '\"(' + HTTP_VERBS.join(\"|\") + ')', end: '\"',\n keywords: HTTP_VERBS.join(\" \"),\n illegal: '\\\\n',\n relevance: 5,\n contains: [{\n begin: 'HTTP/[12]\\\\.\\\\d',\n relevance:5\n }]\n },\n // Dates\n {\n className: 'string',\n // dates must have a certain length, this prevents matching\n // simple array accesses a[123] and [] and other common patterns\n // found in other languages\n begin: /\\[\\d[^\\]\\n]{8,}\\]/,\n illegal: '\\\\n',\n relevance: 1\n },\n {\n className: 'string',\n begin: /\\[/, end: /\\]/,\n illegal: '\\\\n',\n relevance: 0\n },\n // User agent / relevance boost\n {\n className: 'string',\n begin: '\"Mozilla/\\\\d\\\\.\\\\d \\\\\\(', end: '\"',\n illegal: '\\\\n',\n relevance: 3\n },\n // Strings\n {\n className: 'string',\n begin: '\"', end: '\"',\n illegal: '\\\\n',\n relevance: 0\n }\n ]\n };\n};","module.exports = function(hljs) {\n var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';\n var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)';\n\n var AS3_REST_ARG_MODE = {\n className: 'rest_arg',\n begin: '[.]{3}', end: IDENT_RE,\n relevance: 10\n };\n\n return {\n aliases: ['as'],\n keywords: {\n keyword: 'as break case catch class const continue default delete do dynamic each ' +\n 'else extends final finally for function get if implements import in include ' +\n 'instanceof interface internal is namespace native new override package private ' +\n 'protected public return set static super switch this throw try typeof use var void ' +\n 'while with',\n literal: 'true false null undefined'\n },\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'class',\n beginKeywords: 'package', end: '{',\n contains: [hljs.TITLE_MODE]\n },\n {\n className: 'class',\n beginKeywords: 'class interface', end: '{', excludeEnd: true,\n contains: [\n {\n beginKeywords: 'extends implements'\n },\n hljs.TITLE_MODE\n ]\n },\n {\n className: 'meta',\n beginKeywords: 'import include', end: ';',\n keywords: {'meta-keyword': 'import include'}\n },\n {\n className: 'function',\n beginKeywords: 'function', end: '[{;]', excludeEnd: true,\n illegal: '\\\\S',\n contains: [\n hljs.TITLE_MODE,\n {\n className: 'params',\n begin: '\\\\(', end: '\\\\)',\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n AS3_REST_ARG_MODE\n ]\n },\n {\n begin: ':\\\\s*' + IDENT_FUNC_RETURN_TYPE_RE\n }\n ]\n },\n hljs.METHOD_GUARD\n ],\n illegal: /#/\n };\n};","module.exports = // We try to support full Ada2012\n//\n// We highlight all appearances of types, keywords, literals (string, char, number, bool)\n// and titles (user defined function/procedure/package)\n// CSS classes are set accordingly\n//\n// Languages causing problems for language detection:\n// xml (broken by Foo : Bar type), elm (broken by Foo : Bar type), vbscript-html (broken by body keyword)\n// sql (ada default.txt has a lot of sql keywords)\n\nfunction(hljs) {\n // Regular expression for Ada numeric literals.\n // stolen form the VHDL highlighter\n\n // Decimal literal:\n var INTEGER_RE = '\\\\d(_|\\\\d)*';\n var EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;\n var DECIMAL_LITERAL_RE = INTEGER_RE + '(\\\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';\n\n // Based literal:\n var BASED_INTEGER_RE = '\\\\w+';\n var BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';\n\n var NUMBER_RE = '\\\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';\n\n // Identifier regex\n var ID_REGEX = '[A-Za-z](_?[A-Za-z0-9.])*';\n\n // bad chars, only allowed in literals\n var BAD_CHARS = '[]{}%#\\'\\\"'\n\n // Ada doesn't have block comments, only line comments\n var COMMENTS = hljs.COMMENT('--', '$');\n\n // variable declarations of the form\n // Foo : Bar := Baz;\n // where only Bar will be highlighted\n var VAR_DECLS = {\n // TODO: These spaces are not required by the Ada syntax\n // however, I have yet to see handwritten Ada code where\n // someone does not put spaces around :\n begin: '\\\\s+:\\\\s+', end: '\\\\s*(:=|;|\\\\)|=>|$)',\n // endsWithParent: true,\n // returnBegin: true,\n illegal: BAD_CHARS,\n contains: [\n {\n // workaround to avoid highlighting\n // named loops and declare blocks\n beginKeywords: 'loop for declare others',\n endsParent: true,\n },\n {\n // properly highlight all modifiers\n className: 'keyword',\n beginKeywords: 'not null constant access function procedure in out aliased exception'\n },\n {\n className: 'type',\n begin: ID_REGEX,\n endsParent: true,\n relevance: 0,\n }\n ]\n };\n\n return {\n case_insensitive: true,\n keywords: {\n keyword:\n 'abort else new return abs elsif not reverse abstract end ' +\n 'accept entry select access exception of separate aliased exit or some ' +\n 'all others subtype and for out synchronized array function overriding ' +\n 'at tagged generic package task begin goto pragma terminate ' +\n 'body private then if procedure type case in protected constant interface ' +\n 'is raise use declare range delay limited record when delta loop rem while ' +\n 'digits renames with do mod requeue xor',\n literal:\n 'True False',\n },\n contains: [\n COMMENTS,\n // strings \"foobar\"\n {\n className: 'string',\n begin: /\"/, end: /\"/,\n contains: [{begin: /\"\"/, relevance: 0}]\n },\n // characters ''\n {\n // character literals always contain one char\n className: 'string',\n begin: /'.'/\n },\n {\n // number literals\n className: 'number',\n begin: NUMBER_RE,\n relevance: 0\n },\n {\n // Attributes\n className: 'symbol',\n begin: \"'\" + ID_REGEX,\n },\n {\n // package definition, maybe inside generic\n className: 'title',\n begin: '(\\\\bwith\\\\s+)?(\\\\bprivate\\\\s+)?\\\\bpackage\\\\s+(\\\\bbody\\\\s+)?', end: '(is|$)',\n keywords: 'package body',\n excludeBegin: true,\n excludeEnd: true,\n illegal: BAD_CHARS\n },\n {\n // function/procedure declaration/definition\n // maybe inside generic\n begin: '(\\\\b(with|overriding)\\\\s+)?\\\\b(function|procedure)\\\\s+', end: '(\\\\bis|\\\\bwith|\\\\brenames|\\\\)\\\\s*;)',\n keywords: 'overriding function procedure with is renames return',\n // we need to re-match the 'function' keyword, so that\n // the title mode below matches only exactly once\n returnBegin: true,\n contains:\n [\n COMMENTS,\n {\n // name of the function/procedure\n className: 'title',\n begin: '(\\\\bwith\\\\s+)?\\\\b(function|procedure)\\\\s+',\n end: '(\\\\(|\\\\s+|$)',\n excludeBegin: true,\n excludeEnd: true,\n illegal: BAD_CHARS\n },\n // 'self'\n // // parameter types\n VAR_DECLS,\n {\n // return type\n className: 'type',\n begin: '\\\\breturn\\\\s+', end: '(\\\\s+|;|$)',\n keywords: 'return',\n excludeBegin: true,\n excludeEnd: true,\n // we are done with functions\n endsParent: true,\n illegal: BAD_CHARS\n\n },\n ]\n },\n {\n // new type declarations\n // maybe inside generic\n className: 'type',\n begin: '\\\\b(sub)?type\\\\s+', end: '\\\\s+',\n keywords: 'type',\n excludeBegin: true,\n illegal: BAD_CHARS\n },\n\n // see comment above the definition\n VAR_DECLS,\n\n // no markup\n // relevance boosters for small snippets\n // {begin: '\\\\s*=>\\\\s*'},\n // {begin: '\\\\s*:=\\\\s*'},\n // {begin: '\\\\s+:=\\\\s+'},\n ]\n };\n};","module.exports = function(hljs) {\n var builtInTypeMode = {\n className: 'built_in',\n begin: '\\\\b(void|bool|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|string|ref|array|double|float|auto|dictionary)'\n };\n\n var objectHandleMode = {\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+@'\n };\n\n var genericMode = {\n className: 'keyword',\n begin: '<', end: '>',\n contains: [ builtInTypeMode, objectHandleMode ]\n };\n\n builtInTypeMode.contains = [ genericMode ];\n objectHandleMode.contains = [ genericMode ];\n\n return {\n aliases: [ 'asc' ],\n\n keywords:\n 'for in|0 break continue while do|0 return if else case switch namespace is cast ' +\n 'or and xor not get|0 in inout|10 out override set|0 private public const default|0 ' +\n 'final shared external mixin|10 enum typedef funcdef this super import from interface ' +\n 'abstract|0 try catch protected explicit property',\n\n // avoid close detection with C# and JS\n illegal: '(^using\\\\s+[A-Za-z0-9_\\\\.]+;$|\\\\bfunction\\s*[^\\\\(])',\n\n contains: [\n { // 'strings'\n className: 'string',\n begin: '\\'', end: '\\'',\n illegal: '\\\\n',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n relevance: 0\n },\n\n { // \"strings\"\n className: 'string',\n begin: '\"', end: '\"',\n illegal: '\\\\n',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n relevance: 0\n },\n\n // \"\"\"heredoc strings\"\"\"\n {\n className: 'string',\n begin: '\"\"\"', end: '\"\"\"'\n },\n\n hljs.C_LINE_COMMENT_MODE, // single-line comments\n hljs.C_BLOCK_COMMENT_MODE, // comment blocks\n\n { // interface or namespace declaration\n beginKeywords: 'interface namespace', end: '{',\n illegal: '[;.\\\\-]',\n contains: [\n { // interface or namespace name\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+'\n }\n ]\n },\n\n { // class declaration\n beginKeywords: 'class', end: '{',\n illegal: '[;.\\\\-]',\n contains: [\n { // class name\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+',\n contains: [\n {\n begin: '[:,]\\\\s*',\n contains: [\n {\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+'\n }\n ]\n }\n ]\n }\n ]\n },\n\n builtInTypeMode, // built-in types\n objectHandleMode, // object handles\n\n { // literals\n className: 'literal',\n begin: '\\\\b(null|true|false)'\n },\n\n { // numbers\n className: 'number',\n begin: '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?f?|\\\\.\\\\d+f?)([eE][-+]?\\\\d+f?)?)'\n }\n ]\n };\n};","module.exports = function(hljs) {\n var NUMBER = {className: 'number', begin: '[\\\\$%]\\\\d+'};\n return {\n aliases: ['apacheconf'],\n case_insensitive: true,\n contains: [\n hljs.HASH_COMMENT_MODE,\n {className: 'section', begin: ''},\n {\n className: 'attribute',\n begin: /\\w+/,\n relevance: 0,\n // keywords aren’t needed for highlighting per se, they only boost relevance\n // for a very generally defined mode (starts with a word, ends with line-end\n keywords: {\n nomarkup:\n 'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +\n 'sethandler errordocument loadmodule options header listen serverroot ' +\n 'servername'\n },\n starts: {\n end: /$/,\n relevance: 0,\n keywords: {\n literal: 'on off all'\n },\n contains: [\n {\n className: 'meta',\n begin: '\\\\s\\\\[', end: '\\\\]$'\n },\n {\n className: 'variable',\n begin: '[\\\\$%]\\\\{', end: '\\\\}',\n contains: ['self', NUMBER]\n },\n NUMBER,\n hljs.QUOTE_STRING_MODE\n ]\n }\n }\n ],\n illegal: /\\S/\n };\n};","module.exports = function(hljs) {\n var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: ''});\n var PARAMS = {\n className: 'params',\n begin: '\\\\(', end: '\\\\)',\n contains: ['self', hljs.C_NUMBER_MODE, STRING]\n };\n var COMMENT_MODE_1 = hljs.COMMENT('--', '$');\n var COMMENT_MODE_2 = hljs.COMMENT(\n '\\\\(\\\\*',\n '\\\\*\\\\)',\n {\n contains: ['self', COMMENT_MODE_1] //allow nesting\n }\n );\n var COMMENTS = [\n COMMENT_MODE_1,\n COMMENT_MODE_2,\n hljs.HASH_COMMENT_MODE\n ];\n\n return {\n aliases: ['osascript'],\n keywords: {\n keyword:\n 'about above after against and around as at back before beginning ' +\n 'behind below beneath beside between but by considering ' +\n 'contain contains continue copy div does eighth else end equal ' +\n 'equals error every exit fifth first for fourth from front ' +\n 'get given global if ignoring in into is it its last local me ' +\n 'middle mod my ninth not of on onto or over prop property put ref ' +\n 'reference repeat returning script second set seventh since ' +\n 'sixth some tell tenth that the|0 then third through thru ' +\n 'timeout times to transaction try until where while whose with ' +\n 'without',\n literal:\n 'AppleScript false linefeed return pi quote result space tab true',\n built_in:\n 'alias application boolean class constant date file integer list ' +\n 'number real record string text ' +\n 'activate beep count delay launch log offset read round ' +\n 'run say summarize write ' +\n 'character characters contents day frontmost id item length ' +\n 'month name paragraph paragraphs rest reverse running time version ' +\n 'weekday word words year'\n },\n contains: [\n STRING,\n hljs.C_NUMBER_MODE,\n {\n className: 'built_in',\n begin:\n '\\\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +\n 'mount volume|path to|(close|open for) access|(get|set) eof|' +\n 'current date|do shell script|get volume settings|random number|' +\n 'set volume|system attribute|system info|time to GMT|' +\n '(load|run|store) script|scripting components|' +\n 'ASCII (character|number)|localized string|' +\n 'choose (application|color|file|file name|' +\n 'folder|from list|remote application|URL)|' +\n 'display (alert|dialog))\\\\b|^\\\\s*return\\\\b'\n },\n {\n className: 'literal',\n begin:\n '\\\\b(text item delimiters|current application|missing value)\\\\b'\n },\n {\n className: 'keyword',\n begin:\n '\\\\b(apart from|aside from|instead of|out of|greater than|' +\n \"isn't|(doesn't|does not) (equal|come before|come after|contain)|\" +\n '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +\n 'contained by|comes (before|after)|a (ref|reference)|POSIX file|' +\n 'POSIX path|(date|time) string|quoted form)\\\\b'\n },\n {\n beginKeywords: 'on',\n illegal: '[${=;\\\\n]',\n contains: [hljs.UNDERSCORE_TITLE_MODE, PARAMS]\n }\n ].concat(COMMENTS),\n illegal: '//|->|=>|\\\\[\\\\['\n };\n};","module.exports = function(hljs) {\n var IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';\n var KEYWORDS = {\n keyword:\n 'if for while var new function do return void else break',\n literal:\n 'BackSlash DoubleQuote false ForwardSlash Infinity NaN NewLine null PI SingleQuote Tab TextFormatting true undefined',\n built_in:\n 'Abs Acos Angle Attachments Area AreaGeodetic Asin Atan Atan2 Average Bearing Boolean Buffer BufferGeodetic ' +\n 'Ceil Centroid Clip Console Constrain Contains Cos Count Crosses Cut Date DateAdd ' +\n 'DateDiff Day Decode DefaultValue Dictionary Difference Disjoint Distance DistanceGeodetic Distinct ' +\n 'DomainCode DomainName Equals Exp Extent Feature FeatureSet FeatureSetByAssociation FeatureSetById FeatureSetByPortalItem ' +\n 'FeatureSetByRelationshipName FeatureSetByTitle FeatureSetByUrl Filter First Floor Geometry GroupBy Guid HasKey Hour IIf IndexOf ' +\n 'Intersection Intersects IsEmpty IsNan IsSelfIntersecting Length LengthGeodetic Log Max Mean Millisecond Min Minute Month ' +\n 'MultiPartToSinglePart Multipoint NextSequenceValue Now Number OrderBy Overlaps Point Polygon ' +\n 'Polyline Portal Pow Random Relate Reverse RingIsClockWise Round Second SetGeometry Sin Sort Sqrt Stdev Sum ' +\n 'SymmetricDifference Tan Text Timestamp Today ToLocal Top Touches ToUTC TrackCurrentTime ' +\n 'TrackGeometryWindow TrackIndex TrackStartTime TrackWindow TypeOf Union UrlEncode Variance ' +\n 'Weekday When Within Year '\n };\n var EXPRESSIONS;\n var SYMBOL = {\n className: 'symbol',\n begin: '\\\\$[datastore|feature|layer|map|measure|sourcefeature|sourcelayer|targetfeature|targetlayer|value|view]+'\n };\n var NUMBER = {\n className: 'number',\n variants: [\n { begin: '\\\\b(0[bB][01]+)' },\n { begin: '\\\\b(0[oO][0-7]+)' },\n { begin: hljs.C_NUMBER_RE }\n ],\n relevance: 0\n };\n var SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{', end: '\\\\}',\n keywords: KEYWORDS,\n contains: [] // defined later\n };\n var TEMPLATE_STRING = {\n className: 'string',\n begin: '`', end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n SUBST.contains = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n TEMPLATE_STRING,\n NUMBER,\n hljs.REGEXP_MODE\n ];\n var PARAMS_CONTAINS = SUBST.contains.concat([\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]);\n\n return {\n aliases: ['arcade'],\n keywords: KEYWORDS,\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n TEMPLATE_STRING,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n SYMBOL,\n NUMBER,\n { // object attr container\n begin: /[{,]\\s*/, relevance: 0,\n contains: [\n {\n begin: IDENT_RE + '\\\\s*:', returnBegin: true,\n relevance: 0,\n contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}]\n }\n ]\n },\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(return)\\\\b)\\\\s*',\n keywords: 'return',\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n begin: '(\\\\(.*?\\\\)|' + IDENT_RE + ')\\\\s*=>', returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: IDENT_RE\n },\n {\n begin: /\\(\\s*\\)/,\n },\n {\n begin: /\\(/, end: /\\)/,\n excludeBegin: true, excludeEnd: true,\n keywords: KEYWORDS,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n }\n ],\n relevance: 0\n },\n {\n className: 'function',\n beginKeywords: 'function', end: /\\{/, excludeEnd: true,\n contains: [\n hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}),\n {\n className: 'params',\n begin: /\\(/, end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n contains: PARAMS_CONTAINS\n }\n ],\n illegal: /\\[|%/\n },\n {\n begin: /\\$[(.]/\n }\n ],\n illegal: /#(?!!)/\n };\n};","module.exports = function(hljs) {\n var CPP_PRIMITIVE_TYPES = {\n className: 'keyword',\n begin: '\\\\b[a-z\\\\d_]*_t\\\\b'\n };\n\n // https://en.cppreference.com/w/cpp/language/escape\n // \\\\ \\x \\xFF \\u2837 \\u00323747 \\374\n var CHARACTER_ESCAPES = '\\\\\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\\\S)'\n var STRINGS = {\n className: 'string',\n variants: [\n {\n begin: '(u8?|U|L)?\"', end: '\"',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n },\n {\n begin: '(u8?|U|L)?\\'(' + CHARACTER_ESCAPES + \"|.)\", end: '\\'',\n illegal: '.'\n },\n { begin: /(?:u8?|U|L)?R\"([^()\\\\ ]{0,16})\\((?:.|\\n)*?\\)\\1\"/ }\n ]\n };\n\n var NUMBERS = {\n className: 'number',\n variants: [\n { begin: '\\\\b(0b[01\\']+)' },\n { begin: '(-?)\\\\b([\\\\d\\']+(\\\\.[\\\\d\\']*)?|\\\\.[\\\\d\\']+)(u|U|l|L|ul|UL|f|F|b|B)' },\n { begin: '(-?)(\\\\b0[xX][a-fA-F0-9\\']+|(\\\\b[\\\\d\\']+(\\\\.[\\\\d\\']*)?|\\\\.[\\\\d\\']+)([eE][-+]?[\\\\d\\']+)?)' }\n ],\n relevance: 0\n };\n\n var PREPROCESSOR = {\n className: 'meta',\n begin: /#\\s*[a-z]+\\b/, end: /$/,\n keywords: {\n 'meta-keyword':\n 'if else elif endif define undef warning error line ' +\n 'pragma ifdef ifndef include'\n },\n contains: [\n {\n begin: /\\\\\\n/, relevance: 0\n },\n hljs.inherit(STRINGS, {className: 'meta-string'}),\n {\n className: 'meta-string',\n begin: /<[^\\n>]*>/, end: /$/,\n illegal: '\\\\n',\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n\n var FUNCTION_TITLE = hljs.IDENT_RE + '\\\\s*\\\\(';\n\n var CPP_KEYWORDS = {\n keyword: 'int float while private char catch import module export virtual operator sizeof ' +\n 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +\n 'unsigned long volatile static protected bool template mutable if public friend ' +\n 'do goto auto void enum else break extern using asm case typeid ' +\n 'short reinterpret_cast|10 default double register explicit signed typename try this ' +\n 'switch continue inline delete alignof constexpr consteval constinit decltype ' +\n 'concept co_await co_return co_yield requires ' +\n 'noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary ' +\n 'atomic_bool atomic_char atomic_schar ' +\n 'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +\n 'atomic_ullong new throw return ' +\n 'and or not',\n built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +\n 'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' +\n 'unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos ' +\n 'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +\n 'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +\n 'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +\n 'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +\n 'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +\n 'vfprintf vprintf vsprintf endl initializer_list unique_ptr',\n literal: 'true false nullptr NULL'\n };\n\n var EXPRESSION_CONTAINS = [\n CPP_PRIMITIVE_TYPES,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n NUMBERS,\n STRINGS\n ];\n\n return {\n aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'],\n keywords: CPP_KEYWORDS,\n illegal: '',\n keywords: CPP_KEYWORDS,\n contains: ['self', CPP_PRIMITIVE_TYPES]\n },\n {\n begin: hljs.IDENT_RE + '::',\n keywords: CPP_KEYWORDS\n },\n {\n // This mode covers expression context where we can't expect a function\n // definition and shouldn't highlight anything that looks like one:\n // `return some()`, `else if()`, `(x*sum(1, 2))`\n variants: [\n {begin: /=/, end: /;/},\n {begin: /\\(/, end: /\\)/},\n {beginKeywords: 'new throw return else', end: /;/}\n ],\n keywords: CPP_KEYWORDS,\n contains: EXPRESSION_CONTAINS.concat([\n {\n begin: /\\(/, end: /\\)/,\n keywords: CPP_KEYWORDS,\n contains: EXPRESSION_CONTAINS.concat(['self']),\n relevance: 0\n }\n ]),\n relevance: 0\n },\n {\n className: 'function',\n begin: '(' + hljs.IDENT_RE + '[\\\\*&\\\\s]+)+' + FUNCTION_TITLE,\n returnBegin: true, end: /[{;=]/,\n excludeEnd: true,\n keywords: CPP_KEYWORDS,\n illegal: /[^\\w\\s\\*&]/,\n contains: [\n {\n begin: FUNCTION_TITLE, returnBegin: true,\n contains: [hljs.TITLE_MODE],\n relevance: 0\n },\n {\n className: 'params',\n begin: /\\(/, end: /\\)/,\n keywords: CPP_KEYWORDS,\n relevance: 0,\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n STRINGS,\n NUMBERS,\n CPP_PRIMITIVE_TYPES,\n // Count matching parentheses.\n {\n begin: /\\(/, end: /\\)/,\n keywords: CPP_KEYWORDS,\n relevance: 0,\n contains: [\n 'self',\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n STRINGS,\n NUMBERS,\n CPP_PRIMITIVE_TYPES\n ]\n }\n ]\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n PREPROCESSOR\n ]\n },\n {\n className: 'class',\n beginKeywords: 'class struct', end: /[{;:]/,\n contains: [\n {begin: //, contains: ['self']}, // skip generic stuff\n hljs.TITLE_MODE\n ]\n }\n ]),\n exports: {\n preprocessor: PREPROCESSOR,\n strings: STRINGS,\n keywords: CPP_KEYWORDS\n }\n };\n};","module.exports = function(hljs) {\n\n\tvar ARDUINO_KW = {\n keyword:\n 'boolean byte word String',\n built_in:\n 'setup loop' +\n 'KeyboardController MouseController SoftwareSerial ' +\n 'EthernetServer EthernetClient LiquidCrystal ' +\n 'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' +\n 'HttpClient RobotMotor WiFiClient GSMScanner ' +\n 'FileSystem Scheduler GSMServer YunClient YunServer ' +\n 'IPAddress GSMClient GSMModem Keyboard Ethernet ' +\n 'Console GSMBand Esplora Stepper Process ' +\n 'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' +\n 'Client Server GSMPIN FileIO Bridge Serial ' +\n 'EEPROM Stream Mouse Audio Servo File Task ' +\n 'GPRS WiFi Wire TFT GSM SPI SD ' +\n 'runShellCommandAsynchronously analogWriteResolution ' +\n 'retrieveCallingNumber printFirmwareVersion ' +\n 'analogReadResolution sendDigitalPortPair ' +\n 'noListenOnLocalhost readJoystickButton setFirmwareVersion ' +\n 'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' +\n 'scrollDisplayLeft writeMicroseconds delayMicroseconds ' +\n 'beginTransmission getSignalStrength runAsynchronously ' +\n 'getAsynchronously listenOnLocalhost getCurrentCarrier ' +\n 'readAccelerometer messageAvailable sendDigitalPorts ' +\n 'lineFollowConfig countryNameWrite runShellCommand ' +\n 'readStringUntil rewindDirectory readTemperature ' +\n 'setClockDivider readLightSensor endTransmission ' +\n 'analogReference detachInterrupt countryNameRead ' +\n 'attachInterrupt encryptionType readBytesUntil ' +\n 'robotNameWrite readMicrophone robotNameRead cityNameWrite ' +\n 'userNameWrite readJoystickY readJoystickX mouseReleased ' +\n 'openNextFile scanNetworks noInterrupts digitalWrite ' +\n 'beginSpeaker mousePressed isActionDone mouseDragged ' +\n 'displayLogos noAutoscroll addParameter remoteNumber ' +\n 'getModifiers keyboardRead userNameRead waitContinue ' +\n 'processInput parseCommand printVersion readNetworks ' +\n 'writeMessage blinkVersion cityNameRead readMessage ' +\n 'setDataMode parsePacket isListening setBitOrder ' +\n 'beginPacket isDirectory motorsWrite drawCompass ' +\n 'digitalRead clearScreen serialEvent rightToLeft ' +\n 'setTextSize leftToRight requestFrom keyReleased ' +\n 'compassRead analogWrite interrupts WiFiServer ' +\n 'disconnect playMelody parseFloat autoscroll ' +\n 'getPINUsed setPINUsed setTimeout sendAnalog ' +\n 'readSlider analogRead beginWrite createChar ' +\n 'motorsStop keyPressed tempoWrite readButton ' +\n 'subnetMask debugPrint macAddress writeGreen ' +\n 'randomSeed attachGPRS readString sendString ' +\n 'remotePort releaseAll mouseMoved background ' +\n 'getXChange getYChange answerCall getResult ' +\n 'voiceCall endPacket constrain getSocket writeJSON ' +\n 'getButton available connected findUntil readBytes ' +\n 'exitValue readGreen writeBlue startLoop IPAddress ' +\n 'isPressed sendSysex pauseMode gatewayIP setCursor ' +\n 'getOemKey tuneWrite noDisplay loadImage switchPIN ' +\n 'onRequest onReceive changePIN playFile noBuffer ' +\n 'parseInt overflow checkPIN knobRead beginTFT ' +\n 'bitClear updateIR bitWrite position writeRGB ' +\n 'highByte writeRed setSpeed readBlue noStroke ' +\n 'remoteIP transfer shutdown hangCall beginSMS ' +\n 'endWrite attached maintain noCursor checkReg ' +\n 'checkPUK shiftOut isValid shiftIn pulseIn ' +\n 'connect println localIP pinMode getIMEI ' +\n 'display noBlink process getBand running beginSD ' +\n 'drawBMP lowByte setBand release bitRead prepare ' +\n 'pointTo readRed setMode noFill remove listen ' +\n 'stroke detach attach noTone exists buffer ' +\n 'height bitSet circle config cursor random ' +\n 'IRread setDNS endSMS getKey micros ' +\n 'millis begin print write ready flush width ' +\n 'isPIN blink clear press mkdir rmdir close ' +\n 'point yield image BSSID click delay ' +\n 'read text move peek beep rect line open ' +\n 'seek fill size turn stop home find ' +\n 'step tone sqrt RSSI SSID ' +\n 'end bit tan cos sin pow map abs max ' +\n 'min get run put',\n literal:\n 'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' +\n 'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' +\n 'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' +\n 'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' +\n 'DEFAULT OUTPUT INPUT HIGH LOW'\n };\n\n var ARDUINO = hljs.getLanguage('cpp').rawDefinition();\n\n var kws = ARDUINO.keywords;\n\n kws.keyword += ' ' + ARDUINO_KW.keyword;\n kws.literal += ' ' + ARDUINO_KW.literal;\n kws.built_in += ' ' + ARDUINO_KW.built_in;\n\n return ARDUINO;\n};","module.exports = function(hljs) {\n //local labels: %?[FB]?[AT]?\\d{1,2}\\w+\n return {\n case_insensitive: true,\n aliases: ['arm'],\n lexemes: '\\\\.?' + hljs.IDENT_RE,\n keywords: {\n meta:\n //GNU preprocs\n '.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg '+\n //ARM directives\n 'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ',\n built_in:\n 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 '+ //standard registers\n 'pc lr sp ip sl sb fp '+ //typical regs plus backward compatibility\n 'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 '+ //more regs and fp\n 'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 '+ //coprocessor regs\n 'c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 '+ //more coproc\n 'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 '+ //advanced SIMD NEON regs\n\n //program status registers\n 'cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf '+\n 'spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf '+\n\n //NEON and VFP registers\n 's0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 '+\n 's16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 '+\n 'd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 '+\n 'd16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 ' +\n\n '{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @'\n },\n contains: [\n {\n className: 'keyword',\n begin: '\\\\b('+ //mnemonics\n 'adc|'+\n '(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|'+\n 'and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|'+\n 'bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|'+\n 'setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|'+\n 'ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|'+\n 'mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|'+\n 'mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|'+\n 'mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|'+\n 'rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|'+\n 'stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|'+\n '[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|'+\n 'wfe|wfi|yield'+\n ')'+\n '(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?'+ //condition codes\n '[sptrx]?' , //legal postfixes\n end: '\\\\s'\n },\n hljs.COMMENT('[;@]', '$', {relevance: 0}),\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '\\'',\n end: '[^\\\\\\\\]\\'',\n relevance: 0\n },\n {\n className: 'title',\n begin: '\\\\|', end: '\\\\|',\n illegal: '\\\\n',\n relevance: 0\n },\n {\n className: 'number',\n variants: [\n {begin: '[#$=]?0x[0-9a-f]+'}, //hex\n {begin: '[#$=]?0b[01]+'}, //bin\n {begin: '[#$=]\\\\d+'}, //literal\n {begin: '\\\\b\\\\d+'} //bare number\n ],\n relevance: 0\n },\n {\n className: 'symbol',\n variants: [\n {begin: '^[a-z_\\\\.\\\\$][a-z0-9_\\\\.\\\\$]+'}, //ARM syntax\n {begin: '^\\\\s*[a-z_\\\\.\\\\$][a-z0-9_\\\\.\\\\$]+:'}, //GNU ARM syntax\n {begin: '[=#]\\\\w+' } //label reference\n ],\n relevance: 0\n }\n ]\n };\n};","module.exports = function(hljs) {\n var XML_IDENT_RE = '[A-Za-z0-9\\\\._:-]+';\n var TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/}\n ]\n }\n ]\n }\n ]\n };\n return {\n aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],\n case_insensitive: true,\n contains: [\n {\n className: 'meta',\n begin: '',\n relevance: 10,\n contains: [{begin: '\\\\[', end: '\\\\]'}]\n },\n hljs.COMMENT(\n '',\n {\n relevance: 10\n }\n ),\n {\n begin: '<\\\\!\\\\[CDATA\\\\[', end: '\\\\]\\\\]>',\n relevance: 10\n },\n {\n className: 'meta',\n begin: /<\\?xml/, end: /\\?>/, relevance: 10\n },\n {\n begin: /<\\?(php)?/, end: /\\?>/,\n subLanguage: 'php',\n contains: [\n // We don't want the php closing tag ?> to close the PHP block when\n // inside any of the following blocks:\n {begin: '/\\\\*', end: '\\\\*/', skip: true},\n {begin: 'b\"', end: '\"', skip: true},\n {begin: 'b\\'', end: '\\'', skip: true},\n hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null, className: null, contains: null, skip: true}),\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null, className: null, contains: null, skip: true})\n ]\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')', end: '>',\n keywords: {name: 'style'},\n contains: [TAG_INTERNALS],\n starts: {\n end: '', returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n },\n {\n className: 'tag',\n // See the comment in the ', returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n },\n {\n className: 'tag',\n // See the comment in the