mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
1 line
No EOL
916 KiB
Text
1 line
No EOL
916 KiB
Text
{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","src/index.js","node_modules/async/lib/async.js","node_modules/browserify/node_modules/path-browserify/index.js","node_modules/browserify/node_modules/process/browser.js","node_modules/browserify/node_modules/punycode/punycode.js","node_modules/browserify/node_modules/querystring-es3/decode.js","node_modules/browserify/node_modules/querystring-es3/encode.js","node_modules/browserify/node_modules/querystring-es3/index.js","node_modules/browserify/node_modules/url/url.js","node_modules/earcut/src/earcut.js","node_modules/eventemitter3/index.js","node_modules/object-assign/index.js","node_modules/resource-loader/node_modules/async/lib/async.js","node_modules/resource-loader/src/Loader.js","node_modules/resource-loader/src/Resource.js","node_modules/resource-loader/src/b64.js","node_modules/resource-loader/src/index.js","node_modules/resource-loader/src/middlewares/caching/memory.js","node_modules/resource-loader/src/middlewares/parsing/blob.js","package.json","src/core/const.js","src/core/display/Container.js","src/core/display/DisplayObject.js","src/core/graphics/Graphics.js","src/core/graphics/GraphicsData.js","src/core/graphics/webgl/GraphicsRenderer.js","src/core/graphics/webgl/WebGLGraphicsData.js","src/core/index.js","src/core/math/Matrix.js","src/core/math/Point.js","src/core/math/index.js","src/core/math/shapes/Circle.js","src/core/math/shapes/Ellipse.js","src/core/math/shapes/Polygon.js","src/core/math/shapes/Rectangle.js","src/core/math/shapes/RoundedRectangle.js","src/core/particles/ParticleContainer.js","src/core/particles/webgl/ParticleBuffer.js","src/core/particles/webgl/ParticleRenderer.js","src/core/particles/webgl/ParticleShader.js","src/core/renderers/SystemRenderer.js","src/core/renderers/canvas/CanvasRenderer.js","src/core/renderers/canvas/utils/CanvasBuffer.js","src/core/renderers/canvas/utils/CanvasGraphics.js","src/core/renderers/canvas/utils/CanvasMaskManager.js","src/core/renderers/canvas/utils/CanvasTinter.js","src/core/renderers/webgl/WebGLRenderer.js","src/core/renderers/webgl/filters/AbstractFilter.js","src/core/renderers/webgl/filters/FXAAFilter.js","src/core/renderers/webgl/filters/SpriteMaskFilter.js","src/core/renderers/webgl/managers/BlendModeManager.js","src/core/renderers/webgl/managers/FilterManager.js","src/core/renderers/webgl/managers/MaskManager.js","src/core/renderers/webgl/managers/ShaderManager.js","src/core/renderers/webgl/managers/StencilManager.js","src/core/renderers/webgl/managers/WebGLManager.js","src/core/renderers/webgl/shaders/ComplexPrimitiveShader.js","src/core/renderers/webgl/shaders/PrimitiveShader.js","src/core/renderers/webgl/shaders/Shader.js","src/core/renderers/webgl/shaders/TextureShader.js","src/core/renderers/webgl/utils/ObjectRenderer.js","src/core/renderers/webgl/utils/Quad.js","src/core/renderers/webgl/utils/RenderTarget.js","src/core/renderers/webgl/utils/StencilMaskStack.js","src/core/sprites/Sprite.js","src/core/sprites/webgl/SpriteRenderer.js","src/core/text/Text.js","src/core/textures/BaseTexture.js","src/core/textures/RenderTexture.js","src/core/textures/Texture.js","src/core/textures/TextureUvs.js","src/core/textures/VideoBaseTexture.js","src/core/ticker/Ticker.js","src/core/ticker/index.js","src/core/utils/index.js","src/core/utils/pluginTarget.js","src/deprecation.js","src/extras/BitmapText.js","src/extras/MovieClip.js","src/extras/TilingSprite.js","src/extras/cacheAsBitmap.js","src/extras/getChildByName.js","src/extras/getGlobalPosition.js","src/extras/index.js","src/filters/ascii/AsciiFilter.js","src/filters/bloom/BloomFilter.js","src/filters/blur/BlurDirFilter.js","src/filters/blur/BlurFilter.js","src/filters/blur/BlurXFilter.js","src/filters/blur/BlurYFilter.js","src/filters/blur/SmartBlurFilter.js","src/filters/color/ColorMatrixFilter.js","src/filters/color/ColorStepFilter.js","src/filters/convolution/ConvolutionFilter.js","src/filters/crosshatch/CrossHatchFilter.js","src/filters/displacement/DisplacementFilter.js","src/filters/dot/DotScreenFilter.js","src/filters/dropshadow/BlurYTintFilter.js","src/filters/dropshadow/DropShadowFilter.js","src/filters/gray/GrayFilter.js","src/filters/index.js","src/filters/invert/InvertFilter.js","src/filters/noise/NoiseFilter.js","src/filters/normal/NormalMapFilter.js","src/filters/pixelate/PixelateFilter.js","src/filters/rgb/RGBSplitFilter.js","src/filters/sepia/SepiaFilter.js","src/filters/shockwave/ShockwaveFilter.js","src/filters/tiltshift/TiltShiftAxisFilter.js","src/filters/tiltshift/TiltShiftFilter.js","src/filters/tiltshift/TiltShiftXFilter.js","src/filters/tiltshift/TiltShiftYFilter.js","src/filters/twist/TwistFilter.js","src/interaction/InteractionData.js","src/interaction/InteractionManager.js","src/interaction/index.js","src/interaction/interactiveTarget.js","src/loaders/bitmapFontParser.js","src/loaders/index.js","src/loaders/loader.js","src/loaders/spritesheetParser.js","src/loaders/textureParser.js","src/mesh/Mesh.js","src/mesh/Rope.js","src/mesh/index.js","src/mesh/webgl/MeshRenderer.js","src/mesh/webgl/MeshShader.js","src/polyfill/Object.assign.js","src/polyfill/index.js","src/polyfill/requestAnimationFrame.js"],"names":[],"mappings":"AAAA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACnmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AChOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACnmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5pCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACl4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7eA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACljBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACngBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACj1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"pixi.js","sourceRoot":"./","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","// run the polyfills\nrequire('./polyfill');\n\nvar core = module.exports = require('./core');\n\n// add core plugins.\ncore.extras = require('./extras');\ncore.filters = require('./filters');\ncore.interaction = require('./interaction');\ncore.loaders = require('./loaders');\ncore.mesh = require('./mesh');\n\n// export a premade loader instance\n/**\n * A premade instance of the loader that can be used to loader resources.\n *\n * @name loader\n * @memberof PIXI\n * @property {PIXI.loaders.Loader}\n */\ncore.loader = new core.loaders.Loader();\n\n// mixin the deprecation features.\nObject.assign(core, require('./deprecation'));\n\n// Always export pixi globally.\nglobal.PIXI = core;\n","/*!\n * async\n * https://github.com/caolan/async\n *\n * Copyright 2010-2014 Caolan McMahon\n * Released under the MIT license\n */\n/*jshint onevar: false, indent:4 */\n/*global setImmediate: false, setTimeout: false, console: false */\n(function () {\n\n var async = {};\n\n // global on the server, window in the browser\n var root, previous_async;\n\n root = this;\n if (root != null) {\n previous_async = root.async;\n }\n\n async.noConflict = function () {\n root.async = previous_async;\n return async;\n };\n\n function only_once(fn) {\n var called = false;\n return function() {\n if (called) throw new Error(\"Callback was already called.\");\n called = true;\n fn.apply(root, arguments);\n }\n }\n\n //// cross-browser compatiblity functions ////\n\n var _toString = Object.prototype.toString;\n\n var _isArray = Array.isArray || function (obj) {\n return _toString.call(obj) === '[object Array]';\n };\n\n var _each = function (arr, iterator) {\n if (arr.forEach) {\n return arr.forEach(iterator);\n }\n for (var i = 0; i < arr.length; i += 1) {\n iterator(arr[i], i, arr);\n }\n };\n\n var _map = function (arr, iterator) {\n if (arr.map) {\n return arr.map(iterator);\n }\n var results = [];\n _each(arr, function (x, i, a) {\n results.push(iterator(x, i, a));\n });\n return results;\n };\n\n var _reduce = function (arr, iterator, memo) {\n if (arr.reduce) {\n return arr.reduce(iterator, memo);\n }\n _each(arr, function (x, i, a) {\n memo = iterator(memo, x, i, a);\n });\n return memo;\n };\n\n var _keys = function (obj) {\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n keys.push(k);\n }\n }\n return keys;\n };\n\n //// exported async module functions ////\n\n //// nextTick implementation with browser-compatible fallback ////\n if (typeof process === 'undefined' || !(process.nextTick)) {\n if (typeof setImmediate === 'function') {\n async.nextTick = function (fn) {\n // not a direct alias for IE10 compatibility\n setImmediate(fn);\n };\n async.setImmediate = async.nextTick;\n }\n else {\n async.nextTick = function (fn) {\n setTimeout(fn, 0);\n };\n async.setImmediate = async.nextTick;\n }\n }\n else {\n async.nextTick = process.nextTick;\n if (typeof setImmediate !== 'undefined') {\n async.setImmediate = function (fn) {\n // not a direct alias for IE10 compatibility\n setImmediate(fn);\n };\n }\n else {\n async.setImmediate = async.nextTick;\n }\n }\n\n async.each = function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length) {\n return callback();\n }\n var completed = 0;\n _each(arr, function (x) {\n iterator(x, only_once(done) );\n });\n function done(err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n if (completed >= arr.length) {\n callback();\n }\n }\n }\n };\n async.forEach = async.each;\n\n async.eachSeries = function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length) {\n return callback();\n }\n var completed = 0;\n var iterate = function () {\n iterator(arr[completed], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n iterate();\n }\n }\n });\n };\n iterate();\n };\n async.forEachSeries = async.eachSeries;\n\n async.eachLimit = function (arr, limit, iterator, callback) {\n var fn = _eachLimit(limit);\n fn.apply(null, [arr, iterator, callback]);\n };\n async.forEachLimit = async.eachLimit;\n\n var _eachLimit = function (limit) {\n\n return function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length || limit <= 0) {\n return callback();\n }\n var completed = 0;\n var started = 0;\n var running = 0;\n\n (function replenish () {\n if (completed >= arr.length) {\n return callback();\n }\n\n while (running < limit && started < arr.length) {\n started += 1;\n running += 1;\n iterator(arr[started - 1], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n running -= 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n replenish();\n }\n }\n });\n }\n })();\n };\n };\n\n\n var doParallel = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.each].concat(args));\n };\n };\n var doParallelLimit = function(limit, fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [_eachLimit(limit)].concat(args));\n };\n };\n var doSeries = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.eachSeries].concat(args));\n };\n };\n\n\n var _asyncMap = function (eachfn, arr, iterator, callback) {\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n if (!callback) {\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err) {\n callback(err);\n });\n });\n } else {\n var results = [];\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err, v) {\n results[x.index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n async.map = doParallel(_asyncMap);\n async.mapSeries = doSeries(_asyncMap);\n async.mapLimit = function (arr, limit, iterator, callback) {\n return _mapLimit(limit)(arr, iterator, callback);\n };\n\n var _mapLimit = function(limit) {\n return doParallelLimit(limit, _asyncMap);\n };\n\n // reduce only has a series version, as doing reduce in parallel won't\n // work in many situations.\n async.reduce = function (arr, memo, iterator, callback) {\n async.eachSeries(arr, function (x, callback) {\n iterator(memo, x, function (err, v) {\n memo = v;\n callback(err);\n });\n }, function (err) {\n callback(err, memo);\n });\n };\n // inject alias\n async.inject = async.reduce;\n // foldl alias\n async.foldl = async.reduce;\n\n async.reduceRight = function (arr, memo, iterator, callback) {\n var reversed = _map(arr, function (x) {\n return x;\n }).reverse();\n async.reduce(reversed, memo, iterator, callback);\n };\n // foldr alias\n async.foldr = async.reduceRight;\n\n var _filter = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.filter = doParallel(_filter);\n async.filterSeries = doSeries(_filter);\n // select alias\n async.select = async.filter;\n async.selectSeries = async.filterSeries;\n\n var _reject = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (!v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.reject = doParallel(_reject);\n async.rejectSeries = doSeries(_reject);\n\n var _detect = function (eachfn, arr, iterator, main_callback) {\n eachfn(arr, function (x, callback) {\n iterator(x, function (result) {\n if (result) {\n main_callback(x);\n main_callback = function () {};\n }\n else {\n callback();\n }\n });\n }, function (err) {\n main_callback();\n });\n };\n async.detect = doParallel(_detect);\n async.detectSeries = doSeries(_detect);\n\n async.some = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (v) {\n main_callback(true);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(false);\n });\n };\n // any alias\n async.any = async.some;\n\n async.every = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (!v) {\n main_callback(false);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(true);\n });\n };\n // all alias\n async.all = async.every;\n\n async.sortBy = function (arr, iterator, callback) {\n async.map(arr, function (x, callback) {\n iterator(x, function (err, criteria) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, {value: x, criteria: criteria});\n }\n });\n }, function (err, results) {\n if (err) {\n return callback(err);\n }\n else {\n var fn = function (left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n };\n callback(null, _map(results.sort(fn), function (x) {\n return x.value;\n }));\n }\n });\n };\n\n async.auto = function (tasks, callback) {\n callback = callback || function () {};\n var keys = _keys(tasks);\n var remainingTasks = keys.length\n if (!remainingTasks) {\n return callback();\n }\n\n var results = {};\n\n var listeners = [];\n var addListener = function (fn) {\n listeners.unshift(fn);\n };\n var removeListener = function (fn) {\n for (var i = 0; i < listeners.length; i += 1) {\n if (listeners[i] === fn) {\n listeners.splice(i, 1);\n return;\n }\n }\n };\n var taskComplete = function () {\n remainingTasks--\n _each(listeners.slice(0), function (fn) {\n fn();\n });\n };\n\n addListener(function () {\n if (!remainingTasks) {\n var theCallback = callback;\n // prevent final callback from calling itself if it errors\n callback = function () {};\n\n theCallback(null, results);\n }\n });\n\n _each(keys, function (k) {\n var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];\n var taskCallback = function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n if (err) {\n var safeResults = {};\n _each(_keys(results), function(rkey) {\n safeResults[rkey] = results[rkey];\n });\n safeResults[k] = args;\n callback(err, safeResults);\n // stop subsequent errors hitting callback multiple times\n callback = function () {};\n }\n else {\n results[k] = args;\n async.setImmediate(taskComplete);\n }\n };\n var requires = task.slice(0, Math.abs(task.length - 1)) || [];\n var ready = function () {\n return _reduce(requires, function (a, x) {\n return (a && results.hasOwnProperty(x));\n }, true) && !results.hasOwnProperty(k);\n };\n if (ready()) {\n task[task.length - 1](taskCallback, results);\n }\n else {\n var listener = function () {\n if (ready()) {\n removeListener(listener);\n task[task.length - 1](taskCallback, results);\n }\n };\n addListener(listener);\n }\n });\n };\n\n async.retry = function(times, task, callback) {\n var DEFAULT_TIMES = 5;\n var attempts = [];\n // Use defaults if times not passed\n if (typeof times === 'function') {\n callback = task;\n task = times;\n times = DEFAULT_TIMES;\n }\n // Make sure times is a number\n times = parseInt(times, 10) || DEFAULT_TIMES;\n var wrappedTask = function(wrappedCallback, wrappedResults) {\n var retryAttempt = function(task, finalAttempt) {\n return function(seriesCallback) {\n task(function(err, result){\n seriesCallback(!err || finalAttempt, {err: err, result: result});\n }, wrappedResults);\n };\n };\n while (times) {\n attempts.push(retryAttempt(task, !(times-=1)));\n }\n async.series(attempts, function(done, data){\n data = data[data.length - 1];\n (wrappedCallback || callback)(data.err, data.result);\n });\n }\n // If a callback is passed, run this as a controll flow\n return callback ? wrappedTask() : wrappedTask\n };\n\n async.waterfall = function (tasks, callback) {\n callback = callback || function () {};\n if (!_isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {};\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n };\n\n var _parallel = function(eachfn, tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n eachfn.map(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n eachfn.each(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.parallel = function (tasks, callback) {\n _parallel({ map: async.map, each: async.each }, tasks, callback);\n };\n\n async.parallelLimit = function(tasks, limit, callback) {\n _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);\n };\n\n async.series = function (tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n async.mapSeries(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n async.eachSeries(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n };\n return fn;\n };\n return makeCallback(0);\n };\n\n async.apply = function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function () {\n return fn.apply(\n null, args.concat(Array.prototype.slice.call(arguments))\n );\n };\n };\n\n var _concat = function (eachfn, arr, fn, callback) {\n var r = [];\n eachfn(arr, function (x, cb) {\n fn(x, function (err, y) {\n r = r.concat(y || []);\n cb(err);\n });\n }, function (err) {\n callback(err, r);\n });\n };\n async.concat = doParallel(_concat);\n async.concatSeries = doSeries(_concat);\n\n async.whilst = function (test, iterator, callback) {\n if (test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.whilst(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doWhilst = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (test.apply(null, args)) {\n async.doWhilst(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.until = function (test, iterator, callback) {\n if (!test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.until(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doUntil = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (!test.apply(null, args)) {\n async.doUntil(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.queue = function (worker, concurrency) {\n if (concurrency === undefined) {\n concurrency = 1;\n }\n function _insert(q, data, pos, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n callback: typeof callback === 'function' ? callback : null\n };\n\n if (pos) {\n q.tasks.unshift(item);\n } else {\n q.tasks.push(item);\n }\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n\n var workers = 0;\n var q = {\n tasks: [],\n concurrency: concurrency,\n saturated: null,\n empty: null,\n drain: null,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(q, data, false, callback);\n },\n kill: function () {\n q.drain = null;\n q.tasks = [];\n },\n unshift: function (data, callback) {\n _insert(q, data, true, callback);\n },\n process: function () {\n if (!q.paused && workers < q.concurrency && q.tasks.length) {\n var task = q.tasks.shift();\n if (q.empty && q.tasks.length === 0) {\n q.empty();\n }\n workers += 1;\n var next = function () {\n workers -= 1;\n if (task.callback) {\n task.callback.apply(task, arguments);\n }\n if (q.drain && q.tasks.length + workers === 0) {\n q.drain();\n }\n q.process();\n };\n var cb = only_once(next);\n worker(task.data, cb);\n }\n },\n length: function () {\n return q.tasks.length;\n },\n running: function () {\n return workers;\n },\n idle: function() {\n return q.tasks.length + workers === 0;\n },\n pause: function () {\n if (q.paused === true) { return; }\n q.paused = true;\n q.process();\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n q.process();\n }\n };\n return q;\n };\n \n async.priorityQueue = function (worker, concurrency) {\n \n function _compareTasks(a, b){\n return a.priority - b.priority;\n };\n \n function _binarySearch(sequence, item, compare) {\n var beg = -1,\n end = sequence.length - 1;\n while (beg < end) {\n var mid = beg + ((end - beg + 1) >>> 1);\n if (compare(item, sequence[mid]) >= 0) {\n beg = mid;\n } else {\n end = mid - 1;\n }\n }\n return beg;\n }\n \n function _insert(q, data, priority, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n priority: priority,\n callback: typeof callback === 'function' ? callback : null\n };\n \n q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n \n // Start with a normal queue\n var q = async.queue(worker, concurrency);\n \n // Override push to accept second parameter representing priority\n q.push = function (data, priority, callback) {\n _insert(q, data, priority, callback);\n };\n \n // Remove unshift function\n delete q.unshift;\n\n return q;\n };\n\n async.cargo = function (worker, payload) {\n var working = false,\n tasks = [];\n\n var cargo = {\n tasks: tasks,\n payload: payload,\n saturated: null,\n empty: null,\n drain: null,\n drained: true,\n push: function (data, callback) {\n if (!_isArray(data)) {\n data = [data];\n }\n _each(data, function(task) {\n tasks.push({\n data: task,\n callback: typeof callback === 'function' ? callback : null\n });\n cargo.drained = false;\n if (cargo.saturated && tasks.length === payload) {\n cargo.saturated();\n }\n });\n async.setImmediate(cargo.process);\n },\n process: function process() {\n if (working) return;\n if (tasks.length === 0) {\n if(cargo.drain && !cargo.drained) cargo.drain();\n cargo.drained = true;\n return;\n }\n\n var ts = typeof payload === 'number'\n ? tasks.splice(0, payload)\n : tasks.splice(0, tasks.length);\n\n var ds = _map(ts, function (task) {\n return task.data;\n });\n\n if(cargo.empty) cargo.empty();\n working = true;\n worker(ds, function () {\n working = false;\n\n var args = arguments;\n _each(ts, function (data) {\n if (data.callback) {\n data.callback.apply(null, args);\n }\n });\n\n process();\n });\n },\n length: function () {\n return tasks.length;\n },\n running: function () {\n return working;\n }\n };\n return cargo;\n };\n\n var _console_fn = function (name) {\n return function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n fn.apply(null, args.concat([function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (typeof console !== 'undefined') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n }\n else if (console[name]) {\n _each(args, function (x) {\n console[name](x);\n });\n }\n }\n }]));\n };\n };\n async.log = _console_fn('log');\n async.dir = _console_fn('dir');\n /*async.info = _console_fn('info');\n async.warn = _console_fn('warn');\n async.error = _console_fn('error');*/\n\n async.memoize = function (fn, hasher) {\n var memo = {};\n var queues = {};\n hasher = hasher || function (x) {\n return x;\n };\n var memoized = function () {\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n var key = hasher.apply(null, args);\n if (key in memo) {\n async.nextTick(function () {\n callback.apply(null, memo[key]);\n });\n }\n else if (key in queues) {\n queues[key].push(callback);\n }\n else {\n queues[key] = [callback];\n fn.apply(null, args.concat([function () {\n memo[key] = arguments;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, arguments);\n }\n }]));\n }\n };\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n };\n\n async.unmemoize = function (fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n };\n\n async.times = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.map(counter, iterator, callback);\n };\n\n async.timesSeries = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.mapSeries(counter, iterator, callback);\n };\n\n async.seq = function (/* functions... */) {\n var fns = arguments;\n return function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n async.reduce(fns, args, function (newargs, fn, cb) {\n fn.apply(that, newargs.concat([function () {\n var err = arguments[0];\n var nextargs = Array.prototype.slice.call(arguments, 1);\n cb(err, nextargs);\n }]))\n },\n function (err, results) {\n callback.apply(that, [err].concat(results));\n });\n };\n };\n\n async.compose = function (/* functions... */) {\n return async.seq.apply(null, Array.prototype.reverse.call(arguments));\n };\n\n var _applyEach = function (eachfn, fns /*args...*/) {\n var go = function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n return eachfn(fns, function (fn, cb) {\n fn.apply(that, args.concat([cb]));\n },\n callback);\n };\n if (arguments.length > 2) {\n var args = Array.prototype.slice.call(arguments, 2);\n return go.apply(this, args);\n }\n else {\n return go;\n }\n };\n async.applyEach = doParallel(_applyEach);\n async.applyEachSeries = doSeries(_applyEach);\n\n async.forever = function (fn, callback) {\n function next(err) {\n if (err) {\n if (callback) {\n return callback(err);\n }\n throw err;\n }\n fn(next);\n }\n next();\n };\n\n // Node.js\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = async;\n }\n // AMD / RequireJS\n else if (typeof define !== 'undefined' && define.amd) {\n define([], function () {\n return async;\n });\n }\n // included directly via <script> tag\n else {\n root.async = async;\n }\n\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// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n draining = true;\n var currentQueue;\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n var i = -1;\n while (++i < len) {\n currentQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\nprocess.nextTick = function (fun) {\n queue.push(fun);\n if (!draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*! http://mths.be/punycode v1.2.4 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /\\x2E|\\u3002|\\uFF0E|\\uFF61/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\twhile (length--) {\n\t\t\tarray[length] = fn(array[length]);\n\t\t}\n\t\treturn array;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings.\n\t * @private\n\t * @param {String} domain The domain name.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\treturn map(string.split(regexSeparators), fn).join('.');\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <http://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols to a Punycode string of ASCII-only\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name to Unicode. Only the\n\t * Punycoded parts of the domain name will be converted, i.e. it doesn't\n\t * matter if you call it on a string that has already been converted to\n\t * Unicode.\n\t * @memberOf punycode\n\t * @param {String} domain The Punycode domain name to convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(domain) {\n\t\treturn mapDomain(domain, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name to Punycode. Only the\n\t * non-ASCII parts of the domain name will be converted, i.e. it doesn't\n\t * matter if you call it with a domain that's already in ASCII.\n\t * @memberOf punycode\n\t * @param {String} domain The domain name to convert, as a Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name.\n\t */\n\tfunction toASCII(domain) {\n\t\treturn mapDomain(domain, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.2.4',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <http://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\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'use strict';\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}\n\nmodule.exports = function(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};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\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'use strict';\n\nvar stringifyPrimitive = function(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\nmodule.exports = function(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\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\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","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\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\nvar punycode = require('punycode');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction 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 // 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 querystring = require('querystring');\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}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\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 var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.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 this.slashes = true;\n }\n }\n\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 (var i = 0; i < hostEndingChars.length; i++) {\n var 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 this.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 (var i = 0; i < nonHostChars.length; i++) {\n var 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 this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var 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 this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a puny coded representation of \"domain\".\n // It only converts the part of the domain name that\n // has non ASCII characters. I.e. it dosent matter if\n // you call it with a domain that already is in ASCII.\n var domainArray = this.hostname.split('.');\n var newOut = [];\n for (var i = 0; i < domainArray.length; ++i) {\n var s = domainArray[i];\n newOut.push(s.match(/[^A-Za-z0-9_-]/) ?\n 'xn--' + punycode.encode(s) : s);\n }\n this.hostname = newOut.join('.');\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.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 (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\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 this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\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 = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.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 (this.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\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 Object.keys(this).forEach(function(k) {\n result[k] = this[k];\n }, this);\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 Object.keys(relative).forEach(function(k) {\n if (k !== 'protocol')\n result[k] = relative[k];\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\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 Object.keys(relative).forEach(function(k) {\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 var 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 relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\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\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 especialy happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var 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) && (last === '.' || last === '..') ||\n 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 especialy happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var 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 var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n\nfunction isString(arg) {\n return typeof arg === \"string\";\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isNull(arg) {\n return arg === null;\n}\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\n","'use strict';\n\nmodule.exports = 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 = filterPoints(data, linkedList(data, 0, outerLen, dim, true)),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\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 size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(data, outerNode, triangles, dim, minX, minY, size);\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 sum = 0,\n i, j, last;\n\n // calculate original winding order of a polygon ring\n for (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\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(data, start, end) {\n if (!end) end = start;\n\n var node = start,\n again;\n do {\n again = false;\n\n if (equals(data, node.i, node.next.i) || orient(data, node.prev.i, node.i, node.next.i) === 0) {\n\n // remove node\n node.prev.next = node.next;\n node.next.prev = node.prev;\n\n if (node.prevZ) node.prevZ.nextZ = node.nextZ;\n if (node.nextZ) node.nextZ.prevZ = node.prevZ;\n\n node = end = node.prev;\n\n if (node === node.next) return null;\n again = true;\n\n } else {\n node = node.next;\n }\n } while (again || node !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(data, ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && minX !== undefined) indexCurve(data, ear, minX, minY, size);\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 (isEar(data, ear, minX, minY, size)) {\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 // remove ear node\n next.prev = prev;\n prev.next = next;\n\n if (ear.prevZ) ear.prevZ.nextZ = ear.nextZ;\n if (ear.nextZ) ear.nextZ.prevZ = ear.prevZ;\n\n // skipping the next vertice 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(data, filterPoints(data, ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(data, ear, triangles, dim);\n earcutLinked(data, ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(data, ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(data, ear, minX, minY, size) {\n\n var a = ear.prev.i,\n b = ear.i,\n c = ear.next.i,\n\n ax = data[a], ay = data[a + 1],\n bx = data[b], by = data[b + 1],\n cx = data[c], cy = data[c + 1],\n\n abd = ax * by - ay * bx,\n acd = ax * cy - ay * cx,\n cbd = cx * by - cy * bx,\n A = abd - acd - cbd;\n\n if (A <= 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 // the code below is a bit verbose and repetitive but this is done for performance\n\n var cay = cy - ay,\n acx = ax - cx,\n aby = ay - by,\n bax = bx - ax,\n i, px, py, s, t, k, node;\n\n // if we use z-order curve hashing, iterate through the curve\n if (minX !== undefined) {\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n minTY = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n maxTX = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n maxTY = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy),\n\n // z-order range for the current triangle bbox;\n minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n node = ear.nextZ;\n\n while (node && node.z <= maxZ) {\n i = node.i;\n node = node.nextZ;\n if (i === a || i === c) continue;\n\n px = data[i];\n py = data[i + 1];\n\n s = cay * px + acx * py - acd;\n if (s >= 0) {\n t = aby * px + bax * py + abd;\n if (t >= 0) {\n k = A - s - t;\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) return false;\n }\n }\n }\n\n // then look for points in decreasing z-order\n node = ear.prevZ;\n\n while (node && node.z >= minZ) {\n i = node.i;\n node = node.prevZ;\n if (i === a || i === c) continue;\n\n px = data[i];\n py = data[i + 1];\n\n s = cay * px + acx * py - acd;\n if (s >= 0) {\n t = aby * px + bax * py + abd;\n if (t >= 0) {\n k = A - s - t;\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) return false;\n }\n }\n }\n\n // if we don't use z-order curve hash, simply iterate through all other points\n } else {\n node = ear.next.next;\n\n while (node !== ear.prev) {\n i = node.i;\n node = node.next;\n\n px = data[i];\n py = data[i + 1];\n\n s = cay * px + acx * py - acd;\n if (s >= 0) {\n t = aby * px + bax * py + abd;\n if (t >= 0) {\n k = A - s - t;\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) return false;\n }\n }\n }\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(data, start, triangles, dim) {\n var node = start;\n do {\n var a = node.prev,\n b = node.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (a.i !== b.i && intersects(data, a.i, node.i, node.next.i, b.i) &&\n locallyInside(data, a, b) && locallyInside(data, b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(node.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n a.next = b;\n b.prev = a;\n\n var az = node.prevZ,\n bz = node.nextZ && node.nextZ.nextZ;\n\n if (az) az.nextZ = bz;\n if (bz) bz.prevZ = az;\n\n node = start = b;\n }\n node = node.next;\n } while (node !== start);\n\n return node;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(data, start, triangles, dim, minX, minY, size) {\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(data, 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(data, a, a.next);\n c = filterPoints(data, c, c.next);\n\n // run earcut on each half\n earcutLinked(data, a, triangles, dim, minX, minY, size);\n earcutLinked(data, c, triangles, dim, minX, minY, size);\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 = filterPoints(data, linkedList(data, start, end, dim, false));\n if (list) queue.push(getLeftmost(data, list));\n }\n\n queue.sort(function (a, b) {\n return data[a.i] - data[b.i];\n });\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(data, queue[i], outerNode);\n outerNode = filterPoints(data, outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(data, holeNode, outerNode) {\n outerNode = findHoleBridge(data, holeNode, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, holeNode);\n filterPoints(data, b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(data, holeNode, outerNode) {\n var node = outerNode,\n i = holeNode.i,\n px = data[i],\n py = data[i + 1],\n qMax = -Infinity,\n mNode, a, b;\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 a = node.i;\n b = node.next.i;\n\n if (py <= data[a + 1] && py >= data[b + 1]) {\n var qx = data[a] + (py - data[a + 1]) * (data[b] - data[a]) / (data[b + 1] - data[a + 1]);\n if (qx <= px && qx > qMax) {\n qMax = qx;\n mNode = data[a] < data[b] ? node : node.next;\n }\n }\n node = node.next;\n } while (node !== outerNode);\n\n if (!mNode) return null;\n\n // look for points strictly 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 bx = data[mNode.i],\n by = data[mNode.i + 1],\n pbd = px * by - py * bx,\n pcd = px * py - py * qMax,\n cpy = py - py,\n pcx = px - qMax,\n pby = py - by,\n bpx = bx - px,\n A = pbd - pcd - (qMax * by - py * bx),\n sign = A <= 0 ? -1 : 1,\n stop = mNode,\n tanMin = Infinity,\n mx, my, amx, s, t, tan;\n\n node = mNode.next;\n\n while (node !== stop) {\n\n mx = data[node.i];\n my = data[node.i + 1];\n amx = px - mx;\n\n if (amx >= 0 && mx >= bx) {\n s = (cpy * mx + pcx * my - pcd) * sign;\n if (s >= 0) {\n t = (pby * mx + bpx * my + pbd) * sign;\n\n if (t >= 0 && A * sign - s - t >= 0) {\n tan = Math.abs(py - my) / amx; // tangential\n if (tan < tanMin && locallyInside(data, node, holeNode)) {\n mNode = node;\n tanMin = tan;\n }\n }\n }\n }\n\n node = node.next;\n }\n\n return mNode;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(data, start, minX, minY, size) {\n var node = start;\n\n do {\n if (node.z === null) node.z = zOrder(data[node.i], data[node.i + 1], minX, minY, size);\n node.prevZ = node.prev;\n node.nextZ = node.next;\n node = node.next;\n } while (node !== start);\n\n node.prevZ.nextZ = null;\n node.prevZ = null;\n\n sortLinked(node);\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\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q;\n q = q.nextZ;\n qSize--;\n } else if (qSize === 0 || !q) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else if (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 size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into (0..1000) integer range\n x = 1000 * (x - minX) / size;\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 = 1000 * (y - minY) / size;\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(data, start) {\n var node = start,\n leftmost = start;\n do {\n if (data[node.i] < data[leftmost.i]) leftmost = node;\n node = node.next;\n } while (node !== start);\n\n return leftmost;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(data, a, b) {\n return !intersectsPolygon(data, a, a.i, b.i) &&\n locallyInside(data, a, b) && locallyInside(data, b, a) &&\n middleInside(data, a, a.i, b.i);\n}\n\n// winding order of triangle formed by 3 given points\nfunction orient(data, p, q, r) {\n var o = (data[q + 1] - data[p + 1]) * (data[r] - data[q]) - (data[q] - data[p]) * (data[r + 1] - data[q + 1]);\n return o > 0 ? 1 :\n o < 0 ? -1 : 0;\n}\n\n// check if two points are equal\nfunction equals(data, p1, p2) {\n return data[p1] === data[p2] && data[p1 + 1] === data[p2 + 1];\n}\n\n// check if two segments intersect\nfunction intersects(data, p1, q1, p2, q2) {\n return orient(data, p1, q1, p2) !== orient(data, p1, q1, q2) &&\n orient(data, p2, q2, p1) !== orient(data, p2, q2, q1);\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(data, start, a, b) {\n var node = start;\n do {\n var p1 = node.i,\n p2 = node.next.i;\n\n if (p1 !== a && p2 !== a && p1 !== b && p2 !== b && intersects(data, p1, p2, a, b)) return true;\n\n node = node.next;\n } while (node !== start);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(data, a, b) {\n return orient(data, a.prev.i, a.i, a.next.i) === -1 ?\n orient(data, a.i, b.i, a.next.i) !== -1 && orient(data, a.i, a.prev.i, b.i) !== -1 :\n orient(data, a.i, b.i, a.prev.i) === -1 || orient(data, a.i, a.next.i, b.i) === -1;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(data, start, a, b) {\n var node = start,\n inside = false,\n px = (data[a] + data[b]) / 2,\n py = (data[a + 1] + data[b + 1]) / 2;\n do {\n var p1 = node.i,\n p2 = node.next.i;\n\n if (((data[p1 + 1] > py) !== (data[p2 + 1] > py)) &&\n (px < (data[p2] - data[p1]) * (py - data[p1 + 1]) / (data[p2 + 1] - data[p1 + 1]) + data[p1]))\n inside = !inside;\n\n node = node.next;\n } while (node !== start);\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),\n b2 = new Node(b.i),\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, last) {\n var node = new Node(i);\n\n if (!last) {\n node.prev = node;\n node.next = node;\n\n } else {\n node.next = last.next;\n node.prev = last;\n last.next.prev = node;\n last.next = node;\n }\n return node;\n}\n\nfunction Node(i) {\n // vertex coordinates\n this.i = i;\n\n // previous and next vertice 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","'use strict';\n\n//\n// We store our EE objects in a plain object whose properties are event names.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// `~` to make sure that the built-in object properties are not overridden or\n// used as an attack vector.\n// We also assume that `Object.create(null)` is available when the event name\n// is an ES6 Symbol.\n//\nvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\n/**\n * Representation of a single EventEmitter function.\n *\n * @param {Function} fn Event handler to be called.\n * @param {Mixed} context Context for function execution.\n * @param {Boolean} once Only emit once\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal EventEmitter interface that is molded against the Node.js\n * EventEmitter interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() { /* Nothing to set */ }\n\n/**\n * Holds the assigned EventEmitters by name.\n *\n * @type {Object}\n * @private\n */\nEventEmitter.prototype._events = undefined;\n\n/**\n * Return a list of assigned event listeners.\n *\n * @param {String} event The events that should be listed.\n * @param {Boolean} exists We only need to know if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events && this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (this._events[evt].fn) return [this._events[evt].fn];\n\n for (var i = 0, l = this._events[evt].length, ee = new Array(l); i < l; i++) {\n ee[i] = this._events[evt][i].fn;\n }\n\n return ee;\n};\n\n/**\n * Emit an event to all registered event listeners.\n *\n * @param {String} event The name of the event.\n * @returns {Boolean} Indication if we've emitted an event.\n * @api 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 || !this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if ('function' === typeof 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 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 * Register a new EventListener for the given event.\n *\n * @param {String} event Name of the event.\n * @param {Functon} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Add an EventListener that's only called once.\n *\n * @param {String} event Name of the event.\n * @param {Function} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Remove event listeners.\n *\n * @param {String} event The event we want to remove.\n * @param {Function} fn The listener that we need to find.\n * @param {Mixed} context Only remove listeners matching this context.\n * @param {Boolean} once Only remove once listeners.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return this;\n\n var listeners = this._events[evt]\n , events = [];\n\n if (fn) {\n if (listeners.fn) {\n if (\n listeners.fn !== fn\n || (once && !listeners.once)\n || (context && listeners.context !== context)\n ) {\n events.push(listeners);\n }\n } else {\n for (var i = 0, 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\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) {\n this._events[evt] = events.length === 1 ? events[0] : events;\n } else {\n delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners or only the listeners for the specified event.\n *\n * @param {String} event The event want to remove all listeners for.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n if (!this._events) return this;\n\n if (event) delete this._events[prefix ? prefix + event : event];\n else this._events = prefix ? {} : Object.create(null);\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// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Expose the module.\n//\nmodule.exports = EventEmitter;\n","'use strict';\n\nfunction ToObject(val) {\n\tif (val == null) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nmodule.exports = Object.assign || function (target, source) {\n\tvar from;\n\tvar keys;\n\tvar to = ToObject(target);\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = arguments[s];\n\t\tkeys = Object.keys(Object(from));\n\n\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\tto[keys[i]] = from[keys[i]];\n\t\t}\n\t}\n\n\treturn to;\n};\n","/*!\n * async\n * https://github.com/caolan/async\n *\n * Copyright 2010-2014 Caolan McMahon\n * Released under the MIT license\n */\n/*jshint onevar: false, indent:4 */\n/*global setImmediate: false, setTimeout: false, console: false */\n(function () {\n\n var async = {};\n\n // global on the server, window in the browser\n var root, previous_async;\n\n root = this;\n if (root != null) {\n previous_async = root.async;\n }\n\n async.noConflict = function () {\n root.async = previous_async;\n return async;\n };\n\n function only_once(fn) {\n var called = false;\n return function() {\n if (called) throw new Error(\"Callback was already called.\");\n called = true;\n fn.apply(root, arguments);\n }\n }\n\n //// cross-browser compatiblity functions ////\n\n var _toString = Object.prototype.toString;\n\n var _isArray = Array.isArray || function (obj) {\n return _toString.call(obj) === '[object Array]';\n };\n\n var _each = function (arr, iterator) {\n if (arr.forEach) {\n return arr.forEach(iterator);\n }\n for (var i = 0; i < arr.length; i += 1) {\n iterator(arr[i], i, arr);\n }\n };\n\n var _map = function (arr, iterator) {\n if (arr.map) {\n return arr.map(iterator);\n }\n var results = [];\n _each(arr, function (x, i, a) {\n results.push(iterator(x, i, a));\n });\n return results;\n };\n\n var _reduce = function (arr, iterator, memo) {\n if (arr.reduce) {\n return arr.reduce(iterator, memo);\n }\n _each(arr, function (x, i, a) {\n memo = iterator(memo, x, i, a);\n });\n return memo;\n };\n\n var _keys = function (obj) {\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n keys.push(k);\n }\n }\n return keys;\n };\n\n //// exported async module functions ////\n\n //// nextTick implementation with browser-compatible fallback ////\n if (typeof process === 'undefined' || !(process.nextTick)) {\n if (typeof setImmediate === 'function') {\n async.nextTick = function (fn) {\n // not a direct alias for IE10 compatibility\n setImmediate(fn);\n };\n async.setImmediate = async.nextTick;\n }\n else {\n async.nextTick = function (fn) {\n setTimeout(fn, 0);\n };\n async.setImmediate = async.nextTick;\n }\n }\n else {\n async.nextTick = process.nextTick;\n if (typeof setImmediate !== 'undefined') {\n async.setImmediate = function (fn) {\n // not a direct alias for IE10 compatibility\n setImmediate(fn);\n };\n }\n else {\n async.setImmediate = async.nextTick;\n }\n }\n\n async.each = function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length) {\n return callback();\n }\n var completed = 0;\n _each(arr, function (x) {\n iterator(x, only_once(done) );\n });\n function done(err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n if (completed >= arr.length) {\n callback();\n }\n }\n }\n };\n async.forEach = async.each;\n\n async.eachSeries = function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length) {\n return callback();\n }\n var completed = 0;\n var iterate = function () {\n iterator(arr[completed], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n iterate();\n }\n }\n });\n };\n iterate();\n };\n async.forEachSeries = async.eachSeries;\n\n async.eachLimit = function (arr, limit, iterator, callback) {\n var fn = _eachLimit(limit);\n fn.apply(null, [arr, iterator, callback]);\n };\n async.forEachLimit = async.eachLimit;\n\n var _eachLimit = function (limit) {\n\n return function (arr, iterator, callback) {\n callback = callback || function () {};\n if (!arr.length || limit <= 0) {\n return callback();\n }\n var completed = 0;\n var started = 0;\n var running = 0;\n\n (function replenish () {\n if (completed >= arr.length) {\n return callback();\n }\n\n while (running < limit && started < arr.length) {\n started += 1;\n running += 1;\n iterator(arr[started - 1], function (err) {\n if (err) {\n callback(err);\n callback = function () {};\n }\n else {\n completed += 1;\n running -= 1;\n if (completed >= arr.length) {\n callback();\n }\n else {\n replenish();\n }\n }\n });\n }\n })();\n };\n };\n\n\n var doParallel = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.each].concat(args));\n };\n };\n var doParallelLimit = function(limit, fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [_eachLimit(limit)].concat(args));\n };\n };\n var doSeries = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return fn.apply(null, [async.eachSeries].concat(args));\n };\n };\n\n\n var _asyncMap = function (eachfn, arr, iterator, callback) {\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n if (!callback) {\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err) {\n callback(err);\n });\n });\n } else {\n var results = [];\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (err, v) {\n results[x.index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n async.map = doParallel(_asyncMap);\n async.mapSeries = doSeries(_asyncMap);\n async.mapLimit = function (arr, limit, iterator, callback) {\n return _mapLimit(limit)(arr, iterator, callback);\n };\n\n var _mapLimit = function(limit) {\n return doParallelLimit(limit, _asyncMap);\n };\n\n // reduce only has a series version, as doing reduce in parallel won't\n // work in many situations.\n async.reduce = function (arr, memo, iterator, callback) {\n async.eachSeries(arr, function (x, callback) {\n iterator(memo, x, function (err, v) {\n memo = v;\n callback(err);\n });\n }, function (err) {\n callback(err, memo);\n });\n };\n // inject alias\n async.inject = async.reduce;\n // foldl alias\n async.foldl = async.reduce;\n\n async.reduceRight = function (arr, memo, iterator, callback) {\n var reversed = _map(arr, function (x) {\n return x;\n }).reverse();\n async.reduce(reversed, memo, iterator, callback);\n };\n // foldr alias\n async.foldr = async.reduceRight;\n\n var _filter = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.filter = doParallel(_filter);\n async.filterSeries = doSeries(_filter);\n // select alias\n async.select = async.filter;\n async.selectSeries = async.filterSeries;\n\n var _reject = function (eachfn, arr, iterator, callback) {\n var results = [];\n arr = _map(arr, function (x, i) {\n return {index: i, value: x};\n });\n eachfn(arr, function (x, callback) {\n iterator(x.value, function (v) {\n if (!v) {\n results.push(x);\n }\n callback();\n });\n }, function (err) {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n };\n async.reject = doParallel(_reject);\n async.rejectSeries = doSeries(_reject);\n\n var _detect = function (eachfn, arr, iterator, main_callback) {\n eachfn(arr, function (x, callback) {\n iterator(x, function (result) {\n if (result) {\n main_callback(x);\n main_callback = function () {};\n }\n else {\n callback();\n }\n });\n }, function (err) {\n main_callback();\n });\n };\n async.detect = doParallel(_detect);\n async.detectSeries = doSeries(_detect);\n\n async.some = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (v) {\n main_callback(true);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(false);\n });\n };\n // any alias\n async.any = async.some;\n\n async.every = function (arr, iterator, main_callback) {\n async.each(arr, function (x, callback) {\n iterator(x, function (v) {\n if (!v) {\n main_callback(false);\n main_callback = function () {};\n }\n callback();\n });\n }, function (err) {\n main_callback(true);\n });\n };\n // all alias\n async.all = async.every;\n\n async.sortBy = function (arr, iterator, callback) {\n async.map(arr, function (x, callback) {\n iterator(x, function (err, criteria) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, {value: x, criteria: criteria});\n }\n });\n }, function (err, results) {\n if (err) {\n return callback(err);\n }\n else {\n var fn = function (left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n };\n callback(null, _map(results.sort(fn), function (x) {\n return x.value;\n }));\n }\n });\n };\n\n async.auto = function (tasks, callback) {\n callback = callback || function () {};\n var keys = _keys(tasks);\n var remainingTasks = keys.length\n if (!remainingTasks) {\n return callback();\n }\n\n var results = {};\n\n var listeners = [];\n var addListener = function (fn) {\n listeners.unshift(fn);\n };\n var removeListener = function (fn) {\n for (var i = 0; i < listeners.length; i += 1) {\n if (listeners[i] === fn) {\n listeners.splice(i, 1);\n return;\n }\n }\n };\n var taskComplete = function () {\n remainingTasks--\n _each(listeners.slice(0), function (fn) {\n fn();\n });\n };\n\n addListener(function () {\n if (!remainingTasks) {\n var theCallback = callback;\n // prevent final callback from calling itself if it errors\n callback = function () {};\n\n theCallback(null, results);\n }\n });\n\n _each(keys, function (k) {\n var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];\n var taskCallback = function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n if (err) {\n var safeResults = {};\n _each(_keys(results), function(rkey) {\n safeResults[rkey] = results[rkey];\n });\n safeResults[k] = args;\n callback(err, safeResults);\n // stop subsequent errors hitting callback multiple times\n callback = function () {};\n }\n else {\n results[k] = args;\n async.setImmediate(taskComplete);\n }\n };\n var requires = task.slice(0, Math.abs(task.length - 1)) || [];\n var ready = function () {\n return _reduce(requires, function (a, x) {\n return (a && results.hasOwnProperty(x));\n }, true) && !results.hasOwnProperty(k);\n };\n if (ready()) {\n task[task.length - 1](taskCallback, results);\n }\n else {\n var listener = function () {\n if (ready()) {\n removeListener(listener);\n task[task.length - 1](taskCallback, results);\n }\n };\n addListener(listener);\n }\n });\n };\n\n async.retry = function(times, task, callback) {\n var DEFAULT_TIMES = 5;\n var attempts = [];\n // Use defaults if times not passed\n if (typeof times === 'function') {\n callback = task;\n task = times;\n times = DEFAULT_TIMES;\n }\n // Make sure times is a number\n times = parseInt(times, 10) || DEFAULT_TIMES;\n var wrappedTask = function(wrappedCallback, wrappedResults) {\n var retryAttempt = function(task, finalAttempt) {\n return function(seriesCallback) {\n task(function(err, result){\n seriesCallback(!err || finalAttempt, {err: err, result: result});\n }, wrappedResults);\n };\n };\n while (times) {\n attempts.push(retryAttempt(task, !(times-=1)));\n }\n async.series(attempts, function(done, data){\n data = data[data.length - 1];\n (wrappedCallback || callback)(data.err, data.result);\n });\n }\n // If a callback is passed, run this as a controll flow\n return callback ? wrappedTask() : wrappedTask\n };\n\n async.waterfall = function (tasks, callback) {\n callback = callback || function () {};\n if (!_isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {};\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n };\n\n var _parallel = function(eachfn, tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n eachfn.map(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n eachfn.each(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.parallel = function (tasks, callback) {\n _parallel({ map: async.map, each: async.each }, tasks, callback);\n };\n\n async.parallelLimit = function(tasks, limit, callback) {\n _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);\n };\n\n async.series = function (tasks, callback) {\n callback = callback || function () {};\n if (_isArray(tasks)) {\n async.mapSeries(tasks, function (fn, callback) {\n if (fn) {\n fn(function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n callback.call(null, err, args);\n });\n }\n }, callback);\n }\n else {\n var results = {};\n async.eachSeries(_keys(tasks), function (k, callback) {\n tasks[k](function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length <= 1) {\n args = args[0];\n }\n results[k] = args;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n };\n\n async.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n };\n return fn;\n };\n return makeCallback(0);\n };\n\n async.apply = function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function () {\n return fn.apply(\n null, args.concat(Array.prototype.slice.call(arguments))\n );\n };\n };\n\n var _concat = function (eachfn, arr, fn, callback) {\n var r = [];\n eachfn(arr, function (x, cb) {\n fn(x, function (err, y) {\n r = r.concat(y || []);\n cb(err);\n });\n }, function (err) {\n callback(err, r);\n });\n };\n async.concat = doParallel(_concat);\n async.concatSeries = doSeries(_concat);\n\n async.whilst = function (test, iterator, callback) {\n if (test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.whilst(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doWhilst = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (test.apply(null, args)) {\n async.doWhilst(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.until = function (test, iterator, callback) {\n if (!test()) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n async.until(test, iterator, callback);\n });\n }\n else {\n callback();\n }\n };\n\n async.doUntil = function (iterator, test, callback) {\n iterator(function (err) {\n if (err) {\n return callback(err);\n }\n var args = Array.prototype.slice.call(arguments, 1);\n if (!test.apply(null, args)) {\n async.doUntil(iterator, test, callback);\n }\n else {\n callback();\n }\n });\n };\n\n async.queue = function (worker, concurrency) {\n if (concurrency === undefined) {\n concurrency = 1;\n }\n function _insert(q, data, pos, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n callback: typeof callback === 'function' ? callback : null\n };\n\n if (pos) {\n q.tasks.unshift(item);\n } else {\n q.tasks.push(item);\n }\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n\n var workers = 0;\n var q = {\n tasks: [],\n concurrency: concurrency,\n saturated: null,\n empty: null,\n drain: null,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(q, data, false, callback);\n },\n kill: function () {\n q.drain = null;\n q.tasks = [];\n },\n unshift: function (data, callback) {\n _insert(q, data, true, callback);\n },\n process: function () {\n if (!q.paused && workers < q.concurrency && q.tasks.length) {\n var task = q.tasks.shift();\n if (q.empty && q.tasks.length === 0) {\n q.empty();\n }\n workers += 1;\n var next = function () {\n workers -= 1;\n if (task.callback) {\n task.callback.apply(task, arguments);\n }\n if (q.drain && q.tasks.length + workers === 0) {\n q.drain();\n }\n q.process();\n };\n var cb = only_once(next);\n worker(task.data, cb);\n }\n },\n length: function () {\n return q.tasks.length;\n },\n running: function () {\n return workers;\n },\n idle: function() {\n return q.tasks.length + workers === 0;\n },\n pause: function () {\n if (q.paused === true) { return; }\n q.paused = true;\n q.process();\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n q.process();\n }\n };\n return q;\n };\n \n async.priorityQueue = function (worker, concurrency) {\n \n function _compareTasks(a, b){\n return a.priority - b.priority;\n };\n \n function _binarySearch(sequence, item, compare) {\n var beg = -1,\n end = sequence.length - 1;\n while (beg < end) {\n var mid = beg + ((end - beg + 1) >>> 1);\n if (compare(item, sequence[mid]) >= 0) {\n beg = mid;\n } else {\n end = mid - 1;\n }\n }\n return beg;\n }\n \n function _insert(q, data, priority, callback) {\n if (!q.started){\n q.started = true;\n }\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length == 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n if (q.drain) {\n q.drain();\n }\n });\n }\n _each(data, function(task) {\n var item = {\n data: task,\n priority: priority,\n callback: typeof callback === 'function' ? callback : null\n };\n \n q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);\n\n if (q.saturated && q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n \n // Start with a normal queue\n var q = async.queue(worker, concurrency);\n \n // Override push to accept second parameter representing priority\n q.push = function (data, priority, callback) {\n _insert(q, data, priority, callback);\n };\n \n // Remove unshift function\n delete q.unshift;\n\n return q;\n };\n\n async.cargo = function (worker, payload) {\n var working = false,\n tasks = [];\n\n var cargo = {\n tasks: tasks,\n payload: payload,\n saturated: null,\n empty: null,\n drain: null,\n drained: true,\n push: function (data, callback) {\n if (!_isArray(data)) {\n data = [data];\n }\n _each(data, function(task) {\n tasks.push({\n data: task,\n callback: typeof callback === 'function' ? callback : null\n });\n cargo.drained = false;\n if (cargo.saturated && tasks.length === payload) {\n cargo.saturated();\n }\n });\n async.setImmediate(cargo.process);\n },\n process: function process() {\n if (working) return;\n if (tasks.length === 0) {\n if(cargo.drain && !cargo.drained) cargo.drain();\n cargo.drained = true;\n return;\n }\n\n var ts = typeof payload === 'number'\n ? tasks.splice(0, payload)\n : tasks.splice(0, tasks.length);\n\n var ds = _map(ts, function (task) {\n return task.data;\n });\n\n if(cargo.empty) cargo.empty();\n working = true;\n worker(ds, function () {\n working = false;\n\n var args = arguments;\n _each(ts, function (data) {\n if (data.callback) {\n data.callback.apply(null, args);\n }\n });\n\n process();\n });\n },\n length: function () {\n return tasks.length;\n },\n running: function () {\n return working;\n }\n };\n return cargo;\n };\n\n var _console_fn = function (name) {\n return function (fn) {\n var args = Array.prototype.slice.call(arguments, 1);\n fn.apply(null, args.concat([function (err) {\n var args = Array.prototype.slice.call(arguments, 1);\n if (typeof console !== 'undefined') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n }\n else if (console[name]) {\n _each(args, function (x) {\n console[name](x);\n });\n }\n }\n }]));\n };\n };\n async.log = _console_fn('log');\n async.dir = _console_fn('dir');\n /*async.info = _console_fn('info');\n async.warn = _console_fn('warn');\n async.error = _console_fn('error');*/\n\n async.memoize = function (fn, hasher) {\n var memo = {};\n var queues = {};\n hasher = hasher || function (x) {\n return x;\n };\n var memoized = function () {\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n var key = hasher.apply(null, args);\n if (key in memo) {\n async.nextTick(function () {\n callback.apply(null, memo[key]);\n });\n }\n else if (key in queues) {\n queues[key].push(callback);\n }\n else {\n queues[key] = [callback];\n fn.apply(null, args.concat([function () {\n memo[key] = arguments;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, arguments);\n }\n }]));\n }\n };\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n };\n\n async.unmemoize = function (fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n };\n\n async.times = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.map(counter, iterator, callback);\n };\n\n async.timesSeries = function (count, iterator, callback) {\n var counter = [];\n for (var i = 0; i < count; i++) {\n counter.push(i);\n }\n return async.mapSeries(counter, iterator, callback);\n };\n\n async.seq = function (/* functions... */) {\n var fns = arguments;\n return function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n async.reduce(fns, args, function (newargs, fn, cb) {\n fn.apply(that, newargs.concat([function () {\n var err = arguments[0];\n var nextargs = Array.prototype.slice.call(arguments, 1);\n cb(err, nextargs);\n }]))\n },\n function (err, results) {\n callback.apply(that, [err].concat(results));\n });\n };\n };\n\n async.compose = function (/* functions... */) {\n return async.seq.apply(null, Array.prototype.reverse.call(arguments));\n };\n\n var _applyEach = function (eachfn, fns /*args...*/) {\n var go = function () {\n var that = this;\n var args = Array.prototype.slice.call(arguments);\n var callback = args.pop();\n return eachfn(fns, function (fn, cb) {\n fn.apply(that, args.concat([cb]));\n },\n callback);\n };\n if (arguments.length > 2) {\n var args = Array.prototype.slice.call(arguments, 2);\n return go.apply(this, args);\n }\n else {\n return go;\n }\n };\n async.applyEach = doParallel(_applyEach);\n async.applyEachSeries = doSeries(_applyEach);\n\n async.forever = function (fn, callback) {\n function next(err) {\n if (err) {\n if (callback) {\n return callback(err);\n }\n throw err;\n }\n fn(next);\n }\n next();\n };\n\n // Node.js\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = async;\n }\n // AMD / RequireJS\n else if (typeof define !== 'undefined' && define.amd) {\n define([], function () {\n return async;\n });\n }\n // included directly via <script> tag\n else {\n root.async = async;\n }\n\n}());\n","var async = require('async'),\n urlParser = require('url'),\n Resource = require('./Resource'),\n EventEmitter = require('eventemitter3');\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n * @param [baseUrl=''] {string} The base url for all resources loaded by this loader.\n * @param [concurrency=10] {number} The number of resources to load concurrently.\n */\nfunction Loader(baseUrl, concurrency) {\n EventEmitter.call(this);\n\n concurrency = concurrency || 10;\n\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl || '';\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n */\n this.loading = false;\n\n /**\n * The percentage of total progress that a single resource represents.\n *\n * @member {number}\n */\n this._progressChunk = 0;\n\n /**\n * The middleware to run before loading each resource.\n *\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n */\n this._boundLoadResource = this._loadResource.bind(this);\n\n /**\n * The `_onLoad` function bound with this object context.\n *\n * @private\n * @member {function}\n */\n this._boundOnLoad = this._onLoad.bind(this);\n\n /**\n * The resource buffer that fills until `load` is called to start loading resources.\n *\n * @private\n * @member {Resource[]}\n */\n this._buffer = [];\n\n /**\n * Used to track load completion.\n *\n * @private\n * @member {number}\n */\n this._numToLoad = 0;\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object<string, Resource>}\n */\n this.resources = {};\n\n /**\n * Emitted once per loaded or errored resource.\n *\n * @event progress\n * @memberof Loader#\n */\n\n /**\n * Emitted once per errored resource.\n *\n * @event error\n * @memberof Loader#\n */\n\n /**\n * Emitted once per loaded resource.\n *\n * @event load\n * @memberof Loader#\n */\n\n /**\n * Emitted when the loader begins to process the queue.\n *\n * @event start\n * @memberof Loader#\n */\n\n /**\n * Emitted when the queued resources all load.\n *\n * @event complete\n * @memberof Loader#\n */\n}\n\nLoader.prototype = Object.create(EventEmitter.prototype);\nLoader.prototype.constructor = Loader;\nmodule.exports = Loader;\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 *\n * @alias enqueue\n * @param [name] {string} The name of the resource to load, if not passed the url is used.\n * @param url {string} The url for this resource, relative to the baseUrl of this loader.\n * @param [options] {object} The options for the load.\n * @param [options.crossOrigin] {boolean} Is this request cross-origin? Default is to determine automatically.\n * @param [options.loadType=Resource.LOAD_TYPE.XHR] {Resource.XHR_LOAD_TYPE} How should this resource be loaded?\n * @param [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] {Resource.XHR_RESPONSE_TYPE} How should the data being\n * loaded be interpreted when using XHR?\n * @param [callback] {function} Function to call when this specific resource completes loading.\n * @return {Loader}\n */\nLoader.prototype.add = Loader.prototype.enqueue = function (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 }\n\n // if an object is passed instead of params\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 }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error('Resource with name \"' + name + '\" already exists.');\n }\n\n // add base url if this isn't an absolute url\n url = this._handleBaseUrl(url);\n\n // create the store the resource\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].once('afterMiddleware', cb);\n }\n\n this._numToLoad++;\n\n // if already loading add it to the worker queue\n if (this._queue.started) {\n this._queue.push(this.resources[name]);\n this._progressChunk = (100 - this.progress) / (this._queue.length() + this._queue.running());\n }\n // otherwise buffer it to be added to the queue later\n else {\n this._buffer.push(this.resources[name]);\n this._progressChunk = 100 / this._buffer.length;\n }\n\n return this;\n};\n\nLoader.prototype._handleBaseUrl = function (url) {\n var parsedUrl = urlParser.parse(url);\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || parsedUrl.pathname.indexOf('//') === 0) {\n return url;\n }\n\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n if (\n this.baseUrl.length &&\n this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 &&\n url.lastIndexOf('/') !== url.length - 1\n ) {\n return this.baseUrl + '/' + url;\n }\n else {\n return this.baseUrl + url;\n }\n};\n\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @alias pre\n * @param middleware {function} The middleware function to register.\n * @return {Loader}\n */\nLoader.prototype.before = Loader.prototype.pre = function (fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @alias use\n * @param middleware {function} The middleware function to register.\n * @return {Loader}\n */\nLoader.prototype.after = Loader.prototype.use = function (fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n};\n\n/**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {Loader}\n */\nLoader.prototype.reset = function () {\n // this.baseUrl = baseUrl || '';\n\n this.progress = 0;\n\n this.loading = false;\n\n this._progressChunk = 0;\n\n // this._beforeMiddleware.length = 0;\n // this._afterMiddleware.length = 0;\n\n this._buffer.length = 0;\n\n this._numToLoad = 0;\n\n this._queue.kill();\n this._queue.started = false;\n\n this.resources = {};\n};\n\n/**\n * Starts loading the queued resources.\n *\n * @fires start\n * @param [callback] {function} Optional callback that will be bound to the `complete` event.\n * @return {Loader}\n */\nLoader.prototype.load = function (cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.once('complete', cb);\n }\n\n // if the queue has already started we are done here\n if (this._queue.started) {\n return this;\n }\n\n // notify of start\n this.emit('start', this);\n\n // start the internal queue\n for (var i = 0; i < this._buffer.length; ++i) {\n this._queue.push(this._buffer[i]);\n }\n\n // empty the buffer\n this._buffer.length = 0;\n\n return this;\n};\n\n/**\n * Loads a single resource.\n *\n * @fires progress\n * @private\n */\nLoader.prototype._loadResource = function (resource, dequeue) {\n var self = this;\n\n resource._dequeue = dequeue;\n\n this._runMiddleware(resource, this._beforeMiddleware, function () {\n // resource.on('progress', self.emit.bind(self, 'progress'));\n\n resource.load(self._boundOnLoad);\n });\n};\n\n/**\n * Called once each resource has loaded.\n *\n * @fires complete\n * @private\n */\nLoader.prototype._onComplete = function () {\n this.emit('complete', this, this.resources);\n};\n\n/**\n * Called each time a resources is loaded.\n *\n * @fires progress\n * @fires error\n * @fires load\n * @private\n */\nLoader.prototype._onLoad = function (resource) {\n this.progress += this._progressChunk;\n\n this.emit('progress', this, resource);\n\n if (resource.error) {\n this.emit('error', resource.error, this, resource);\n }\n else {\n this.emit('load', this, resource);\n }\n\n // run middleware, this *must* happen before dequeue so sub-assets get added properly\n this._runMiddleware(resource, this._afterMiddleware, function () {\n resource.emit('afterMiddleware', resource);\n\n this._numToLoad--;\n\n // do completion check\n if (this._numToLoad === 0) {\n this._onComplete();\n }\n });\n\n // remove this resource from the async queue\n resource._dequeue();\n};\n\n/**\n * Run middleware functions on a resource.\n *\n * @private\n */\nLoader.prototype._runMiddleware = function (resource, fns, cb) {\n var self = this;\n\n async.eachSeries(fns, function (fn, next) {\n fn.call(self, resource, next);\n }, cb.bind(this, resource));\n};\n\nLoader.LOAD_TYPE = Resource.LOAD_TYPE;\nLoader.XHR_READY_STATE = Resource.XHR_READY_STATE;\nLoader.XHR_RESPONSE_TYPE = Resource.XHR_RESPONSE_TYPE;\n","var EventEmitter = require('eventemitter3'),\n _url = require('url'),\n // tests is CORS is supported in XHR, if not we need to use XDR\n useXdr = !!(window.XDomainRequest && !('withCredentials' in (new XMLHttpRequest()))),\n tempAnchor = null;\n\n/**\n * Manages the state and loading of a single resource represented by\n * a single URL.\n *\n * @class\n * @param name {string} The name of the resource to load.\n * @param url {string|string[]} The url for this resource, for audio/video loads you can pass an array of sources.\n * @param [options] {object} The options for the load.\n * @param [options.crossOrigin] {boolean} Is this request cross-origin? Default is to determine automatically.\n * @param [options.loadType=Resource.LOAD_TYPE.XHR] {Resource.LOAD_TYPE} How should this resource be loaded?\n * @param [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] {Resource.XHR_RESPONSE_TYPE} How should the data being\n * loaded be interpreted when using XHR?\n */\nfunction Resource(name, url, options) {\n EventEmitter.call(this);\n\n options = options || {};\n\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 /**\n * The name of this resource.\n *\n * @member {string}\n * @readonly\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @member {string}\n * @readonly\n */\n this.url = url;\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @member {boolean}\n * @readonly\n */\n this.isDataUrl = this.url.indexOf('data:') === 0;\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : null;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * The error that occurred while loading (if any).\n *\n * @member {Error}\n * @readonly\n */\n this.error = null;\n\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 * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * Describes if this resource was loaded as json. Only valid after the resource\n * has completely loaded.\n *\n * @member {boolean}\n */\n this.isJson = false;\n\n /**\n * Describes if this resource was loaded as xml. Only valid after the resource\n * has completely loaded.\n *\n * @member {boolean}\n */\n this.isXml = false;\n\n /**\n * Describes if this resource was loaded as an image tag. Only valid after the resource\n * has completely loaded.\n *\n * @member {boolean}\n */\n this.isImage = false;\n\n /**\n * Describes if this resource was loaded as an audio tag. Only valid after the resource\n * has completely loaded.\n *\n * @member {boolean}\n */\n this.isAudio = false;\n\n /**\n * Describes if this resource was loaded as a video tag. Only valid after the resource\n * has completely loaded.\n *\n * @member {boolean}\n */\n this.isVideo = false;\n\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 * @member {function}\n * @private\n */\n this._dequeue = null;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @member {function}\n * @private\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @member {function}\n * @private\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @member {function}\n * @private\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n this._boundXdrOnTimeout = this._xdrOnTimeout.bind(this);\n\n /**\n * Emitted when the resource beings to load.\n *\n * @event start\n * @memberof Resource#\n */\n\n /**\n * Emitted 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 * @event progress\n * @memberof Resource#\n */\n\n /**\n * Emitted once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * @event complete\n * @memberof Resource#\n */\n}\n\nResource.prototype = Object.create(EventEmitter.prototype);\nResource.prototype.constructor = Resource;\nmodule.exports = Resource;\n\n/**\n * Marks the resource as complete.\n *\n * @fires complete\n */\nResource.prototype.complete = function () {\n // TODO: Clean this up in a wrapper or something...gross....\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError);\n this.data.removeEventListener('load', this._boundComplete);\n this.data.removeEventListener('progress', this._boundOnProgress);\n this.data.removeEventListener('canplaythrough', this._boundComplete);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort);\n this.xhr.removeEventListener('progress', this._boundOnProgress);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad);\n }\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 this.emit('complete', this);\n};\n\n/**\n * Kicks off loading of this resource.\n *\n * @fires start\n * @param [callback] {function} Optional callback to call once the resource is loaded.\n */\nResource.prototype.load = function (cb) {\n this.emit('start', this);\n\n // if a callback is set, listen for complete event\n if (cb) {\n this.once('complete', cb);\n }\n\n // if unset, determine the value\n if (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._loadImage();\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this._loadElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this._loadElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n }\n else {\n this._loadXhr();\n }\n break;\n }\n};\n\n/**\n * Loads this resources using an Image object.\n *\n * @private\n */\nResource.prototype._loadImage = function () {\n this.data = new Image();\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n this.data.src = this.url;\n\n this.isImage = true;\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\n/**\n * Loads this resources using an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n */\nResource.prototype._loadElement = function (type) {\n this.data = document.createElement(type);\n\n if (Array.isArray(this.url)) {\n for (var i = 0; i < this.url.length; ++i) {\n this.data.appendChild(this._createSource(type, this.url[i]));\n }\n }\n else {\n this.data.appendChild(this._createSource(type, this.url));\n }\n\n this['is' + type[0].toUpperCase() + type.substring(1)] = true;\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\n this.data.load();\n};\n\n/**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\nResource.prototype._loadXhr = function () {\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();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\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 }\n else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n};\n\n/**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\nResource.prototype._loadXdr = function () {\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();\n\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 xdr.timeout = 5000;\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXdrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost\n // if multiple XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(function () {\n xdr.send();\n }, 0);\n};\n\n/**\n * Creates a source used in loading via an element.\n *\n * @param type {string} The element type (video or audio).\n * @param url {string} The source URL to load from.\n * @param [mime] {string} The mime type of the video\n * @private\n */\nResource.prototype._createSource = function (type, url, mime) {\n if (!mime) {\n mime = type + '/' + url.substr(url.lastIndexOf('.') + 1);\n }\n\n var source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n};\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 */\nResource.prototype._onError = function (event) {\n this.error = new Error('Failed to load element using ' + event.target.nodeName);\n this.complete();\n};\n\n/**\n * Called if a load progress event fires for xhr/xdr.\n *\n * @fires progress\n * @param event {XMLHttpRequestProgressEvent|Event}\n * @private\n */\nResource.prototype._onProgress = function (event) {\n if (event && event.lengthComputable) {\n this.emit('progress', this, event.loaded / event.total);\n }\n};\n\n/**\n * Called if an error event fires for xhr/xdr.\n *\n * @param event {XMLHttpRequestErrorEvent|Event}\n * @private\n */\nResource.prototype._xhrOnError = function () {\n this.error = new Error(\n reqType(this.xhr) + ' Request failed. ' +\n 'Status: ' + this.xhr.status + ', text: \"' + this.xhr.statusText + '\"'\n );\n\n this.complete();\n};\n\n/**\n * Called if an abort event fires for xhr.\n *\n * @param event {XMLHttpRequestAbortEvent}\n * @private\n */\nResource.prototype._xhrOnAbort = function () {\n this.error = new Error(reqType(this.xhr) + ' Request was aborted by the user.');\n this.complete();\n};\n\n/**\n * Called if a timeout event fires for xdr.\n *\n * @param event {Event}\n * @private\n */\nResource.prototype._xdrOnTimeout = function () {\n this.error = new Error(reqType(this.xhr) + ' Request timed out.');\n this.complete();\n};\n\n/**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @param event {XMLHttpRequestLoadEvent|Event}\n * @private\n */\nResource.prototype._xhrOnLoad = function () {\n var xhr = this.xhr,\n status = xhr.status !== undefined ? xhr.status : 200; //XDR has no `.status`, assume 200.\n\n // status can be 0 when using the file:// protocol, also check if a response was found\n if (status === 200 || status === 204 || (status === 0 && xhr.responseText.length > 0)) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = xhr.responseText;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(xhr.responseText);\n this.isJson = true;\n } catch(e) {\n this.error = new Error('Error trying to parse loaded json:', e);\n }\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(xhr.responseText, 'text/xml');\n }\n else {\n var div = document.createElement('div');\n div.innerHTML = xhr.responseText;\n this.data = div;\n }\n this.isXml = true;\n } catch (e) {\n this.error = new Error('Error trying to parse loaded xml:', e);\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || xhr.responseText;\n }\n }\n else {\n this.error = new Error('[' + xhr.status + ']' + xhr.statusText + ':' + xhr.responseURL);\n }\n\n this.complete();\n};\n\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\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 url {string} The url to test.\n * @param [location=window.location] {object} The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nResource.prototype._determineCrossOrigin = function (url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\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 return 'anonymous';\n }\n\n return '';\n};\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 */\nResource.prototype._determineXhrType = function () {\n return Resource._xhrTypeMap[this._getExtension()] || Resource.XHR_RESPONSE_TYPE.TEXT;\n};\n\nResource.prototype._determineLoadType = function () {\n return Resource._loadTypeMap[this._getExtension()] || Resource.LOAD_TYPE.XHR;\n};\n\nResource.prototype._getExtension = function () {\n var url = this.url,\n ext;\n\n if (this.isDataUrl) {\n var slashIndex = url.indexOf('/');\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else {\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext;\n};\n\n/**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @return {string} The mime type to use.\n */\nResource.prototype._getMimeFromXhrType = function (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 default:\n return 'text/plain';\n\n }\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @constant\n * @property {object} LOAD_TYPE\n * @property {number} LOAD_TYPE.XHR - Uses XMLHttpRequest to load the resource.\n * @property {number} LOAD_TYPE.IMAGE - Uses an `Image` object to load the resource.\n * @property {number} LOAD_TYPE.AUDIO - Uses an `Audio` object to load the resource.\n * @property {number} LOAD_TYPE.VIDEO - Uses a `Video` object to load the resource.\n */\nResource.LOAD_TYPE = {\n XHR: 1,\n IMAGE: 2,\n AUDIO: 3,\n VIDEO: 4\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @constant\n * @property {object} XHR_READY_STATE\n * @property {number} XHR_READY_STATE.UNSENT - open()has not been called yet.\n * @property {number} XHR_READY_STATE.OPENED - send()has not been called yet.\n * @property {number} XHR_READY_STATE.HEADERS_RECEIVED - send() has been called, and headers and status are available.\n * @property {number} XHR_READY_STATE.LOADING - Downloading; responseText holds partial data.\n * @property {number} XHR_READY_STATE.DONE - The operation is complete.\n */\nResource.XHR_READY_STATE = {\n UNSENT: 0,\n OPENED: 1,\n HEADERS_RECEIVED: 2,\n LOADING: 3,\n DONE: 4\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @constant\n * @property {object} XHR_RESPONSE_TYPE\n * @property {string} XHR_RESPONSE_TYPE.DEFAULT - defaults to text\n * @property {string} XHR_RESPONSE_TYPE.BUFFER - ArrayBuffer\n * @property {string} XHR_RESPONSE_TYPE.BLOB - Blob\n * @property {string} XHR_RESPONSE_TYPE.DOCUMENT - Document\n * @property {string} XHR_RESPONSE_TYPE.JSON - Object\n * @property {string} XHR_RESPONSE_TYPE.TEXT - String\n */\nResource.XHR_RESPONSE_TYPE = {\n DEFAULT: 'text',\n BUFFER: 'arraybuffer',\n BLOB: 'blob',\n DOCUMENT: 'document',\n JSON: 'json',\n TEXT: 'text'\n};\n\nResource._loadTypeMap = {\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};\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 'tsx': Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n 'svg': Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\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\n // json\n 'json': Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n 'text': Resource.XHR_RESPONSE_TYPE.TEXT,\n 'txt': Resource.XHR_RESPONSE_TYPE.TEXT\n};\n\n/**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param extname {string} The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param loadType {Resource.LOAD_TYPE} The load type to set it to.\n */\nResource.setExtensionLoadType = function (extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n};\n\n/**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param extname {string} The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param xhrType {Resource.XHR_RESPONSE_TYPE} The xhr type to set it to.\n */\nResource.setExtensionXhrType = function (extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\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","module.exports = {\n\n // private property\n _keyStr: \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",\n\n encodeBinary: function (input) {\n var output = \"\";\n var bytebuffer;\n var encodedCharIndexes = new Array(4);\n var inx = 0;\n var jnx = 0;\n var paddingBytes = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n bytebuffer = new Array(3);\n for (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 }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n paddingBytes = inx - (input.length - 1);\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; // No padding - proceed\n }\n\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 for (jnx = 0; jnx < encodedCharIndexes.length; jnx++) {\n output += this._keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n return output;\n }\n};\n","module.exports = require('./Loader');\n\nmodule.exports.Resource = require('./Resource');\n\nmodule.exports.middleware = {\n caching: {\n memory: require('./middlewares/caching/memory')\n },\n parsing: {\n blob: require('./middlewares/parsing/blob')\n }\n};\n","// a simple in-memory cache for resources\nvar cache = {};\n\nmodule.exports = function () {\n return function (resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete();\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.once('complete', function () {\n cache[this.url] = this.data;\n });\n\n next();\n }\n };\n};\n","var Resource = require('../../Resource'),\n b64 = require('../../b64');\n\nwindow.URL = window.URL || window.webkitURL;\n\n// a middleware for transforming XHR loaded Blobs into more useful objects\n\nmodule.exports = function () {\n return function (resource, next) {\n if (!resource.data) {\n return next();\n }\n\n // if this was an XHR load of a blob\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');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = 'data:' + type + ';base64,' + b64.encodeBinary(resource.xhr.responseText);\n\n resource.isImage = true;\n\n // wait until the image loads and then callback\n resource.data.onload = function () {\n resource.data.onload = null;\n\n next();\n };\n }\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\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.isImage = true;\n\n // cleanup the no longer used blob after the image loads\n resource.data.onload = function () {\n URL.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n }\n }\n else {\n next();\n }\n };\n};\n","module.exports={\n \"name\": \"pixi.js\",\n \"version\": \"3.0.6\",\n \"description\": \"Pixi.js is a fast lightweight 2D library that works across all devices.\",\n \"author\": \"Mat Groves\",\n \"contributors\": [\n \"Chad Engler <chad@pantherdev.com>\",\n \"Richard Davey <rdavey@gmail.com>\"\n ],\n \"main\": \"./src/index.js\",\n \"homepage\": \"http://goodboydigital.com/\",\n \"bugs\": \"https://github.com/GoodBoyDigital/pixi.js/issues\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/GoodBoyDigital/pixi.js.git\"\n },\n \"scripts\": {\n \"test\": \"gulp && testem ci\",\n \"docs\": \"jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md\"\n },\n \"dependencies\": {\n \"async\": \"^0.9.0\",\n \"brfs\": \"^1.4.0\",\n \"earcut\": \"^2.0.0\",\n \"eventemitter3\": \"^1.1.0\",\n \"object-assign\": \"^2.0.0\",\n \"resource-loader\": \"^1.6.0\"\n },\n \"devDependencies\": {\n \"browserify\": \"^9.0.8\",\n \"chai\": \"^2.2.0\",\n \"del\": \"^1.1.1\",\n \"gulp\": \"^3.8.11\",\n \"gulp-cached\": \"^1.0.4\",\n \"gulp-concat\": \"^2.5.2\",\n \"gulp-debug\": \"^2.0.1\",\n \"gulp-jshint\": \"^1.10.0\",\n \"gulp-mirror\": \"^0.4.0\",\n \"gulp-plumber\": \"^1.0.0\",\n \"gulp-rename\": \"^1.2.2\",\n \"gulp-sourcemaps\": \"^1.5.2\",\n \"gulp-uglify\": \"^1.2.0\",\n \"gulp-util\": \"^3.0.4\",\n \"jaguarjs-jsdoc\": \"git+https://github.com/davidshimjs/jaguarjs-jsdoc.git\",\n \"jsdoc\": \"^3.3.0-beta3\",\n \"jshint-summary\": \"^0.4.0\",\n \"minimist\": \"^1.1.1\",\n \"mocha\": \"^2.2.4\",\n \"require-dir\": \"^0.3.0\",\n \"run-sequence\": \"^1.0.2\",\n \"testem\": \"^0.8.2\",\n \"vinyl-buffer\": \"^1.0.0\",\n \"vinyl-source-stream\": \"^1.1.0\",\n \"watchify\": \"^3.1.2\"\n },\n \"browserify\": {\n \"transform\": [\n \"brfs\"\n ]\n }\n}\n","/**\n * Constant values used in pixi\n *\n * @lends PIXI\n */\nvar CONST = {\n /**\n * String of the current PIXI version\n *\n * @static\n * @constant\n * @property {string} VERSION\n */\n VERSION: require('../../package.json').version,\n\n /**\n * @property {number} PI_2 - Two Pi\n * @constant\n * @static\n */\n PI_2: Math.PI * 2,\n\n /**\n * @property {number} RAD_TO_DEG - Constant conversion factor for converting radians to degrees\n * @constant\n * @static\n */\n RAD_TO_DEG: 180 / Math.PI,\n\n /**\n * @property {Number} DEG_TO_RAD - Constant conversion factor for converting degrees to radians\n * @constant\n * @static\n */\n DEG_TO_RAD: Math.PI / 180,\n\n /**\n * Target frames per millisecond.\n *\n * @static\n * @constant\n * @property {number} TARGET_FPMS=0.06\n */\n TARGET_FPMS: 0.06,\n\n /**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @constant\n * @property {object} RENDERER_TYPE\n * @property {number} RENDERER_TYPE.UNKNOWN\n * @property {number} RENDERER_TYPE.WEBGL\n * @property {number} RENDERER_TYPE.CANVAS\n */\n RENDERER_TYPE: {\n UNKNOWN: 0,\n WEBGL: 1,\n CANVAS: 2\n },\n\n /**\n * Various blend modes supported by PIXI. IMPORTANT - The WebGL renderer only supports\n * the NORMAL, ADD, MULTIPLY and SCREEN blend modes. Anything else will silently act like\n * NORMAL.\n *\n * @static\n * @constant\n * @property {object} BLEND_MODES\n * @property {number} BLEND_MODES.NORMAL\n * @property {number} BLEND_MODES.ADD\n * @property {number} BLEND_MODES.MULTIPLY\n * @property {number} BLEND_MODES.SCREEN\n * @property {number} BLEND_MODES.OVERLAY\n * @property {number} BLEND_MODES.DARKEN\n * @property {number} BLEND_MODES.LIGHTEN\n * @property {number} BLEND_MODES.COLOR_DODGE\n * @property {number} BLEND_MODES.COLOR_BURN\n * @property {number} BLEND_MODES.HARD_LIGHT\n * @property {number} BLEND_MODES.SOFT_LIGHT\n * @property {number} BLEND_MODES.DIFFERENCE\n * @property {number} BLEND_MODES.EXCLUSION\n * @property {number} BLEND_MODES.HUE\n * @property {number} BLEND_MODES.SATURATION\n * @property {number} BLEND_MODES.COLOR\n * @property {number} BLEND_MODES.LUMINOSITY\n */\n BLEND_MODES: {\n NORMAL: 0,\n ADD: 1,\n MULTIPLY: 2,\n SCREEN: 3,\n OVERLAY: 4,\n DARKEN: 5,\n LIGHTEN: 6,\n COLOR_DODGE: 7,\n COLOR_BURN: 8,\n HARD_LIGHT: 9,\n SOFT_LIGHT: 10,\n DIFFERENCE: 11,\n EXCLUSION: 12,\n HUE: 13,\n SATURATION: 14,\n COLOR: 15,\n LUMINOSITY: 16\n },\n\n /**\n * The scale modes that are supported by pixi.\n *\n * The DEFAULT 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 * @static\n * @constant\n * @property {object} SCALE_MODES\n * @property {number} SCALE_MODES.DEFAULT=LINEAR\n * @property {number} SCALE_MODES.LINEAR Smooth scaling\n * @property {number} SCALE_MODES.NEAREST Pixelating scaling\n */\n SCALE_MODES: {\n DEFAULT: 0,\n LINEAR: 0,\n NEAREST: 1\n },\n\n /**\n * The prefix that denotes a URL is for a retina asset\n *\n * @static\n * @constant\n * @property {string} RETINA_PREFIX\n */\n //example: '@2x',\n RETINA_PREFIX: /@(.+)x/,\n\n RESOLUTION:1,\n\n FILTER_RESOLUTION:1,\n\n /**\n * The default render options if none are supplied to {@link PIXI.WebGLRenderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @constant\n * @property {object} DEFAULT_RENDER_OPTIONS\n * @property {HTMLCanvasElement} DEFAULT_RENDER_OPTIONS.view=null\n * @property {boolean} DEFAULT_RENDER_OPTIONS.transparent=false\n * @property {boolean} DEFAULT_RENDER_OPTIONS.antialias=false\n * @property {boolean} DEFAULT_RENDER_OPTIONS.forceFXAA=false\n * @property {boolean} DEFAULT_RENDER_OPTIONS.preserveDrawingBuffer=false\n * @property {number} DEFAULT_RENDER_OPTIONS.resolution=1\n * @property {number} DEFAULT_RENDER_OPTIONS.backgroundColor=0x000000\n * @property {boolean} DEFAULT_RENDER_OPTIONS.clearBeforeRender=true\n * @property {boolean} DEFAULT_RENDER_OPTIONS.autoResize=false\n */\n DEFAULT_RENDER_OPTIONS: {\n view: null,\n resolution: 1,\n antialias: false,\n forceFXAA: false,\n autoResize: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false\n },\n\n /**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @property {object} SHAPES\n * @property {object} SHAPES.POLY=0\n * @property {object} SHAPES.RECT=1\n * @property {object} SHAPES.CIRC=2\n * @property {object} SHAPES.ELIP=3\n * @property {object} SHAPES.RREC=4\n */\n SHAPES: {\n POLY: 0,\n RECT: 1,\n CIRC: 2,\n ELIP: 3,\n RREC: 4\n },\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n SPRITE_BATCH_SIZE: 2000 //nice balance between mobile and desktop machines\n};\n\nmodule.exports = CONST;\n","var math = require('../math'),\n DisplayObject = require('./DisplayObject'),\n RenderTexture = require('../textures/RenderTexture'),\n _tempMatrix = new math.Matrix();\n\n/**\n * A Container represents a collection of display objects.\n * It is the base class of all display objects that act as a container for other objects.\n *\n *```js\n * var container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nfunction Container()\n{\n DisplayObject.call(this);\n\n /**\n * The array of children of this container.\n *\n * @member {DisplayObject[]}\n * @readonly\n */\n this.children = [];\n}\n\n// constructor\nContainer.prototype = Object.create(DisplayObject.prototype);\nContainer.prototype.constructor = Container;\nmodule.exports = Container;\n\nObject.defineProperties(Container.prototype, {\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof PIXI.Container#\n */\n width: {\n get: function ()\n {\n return this.scale.x * this.getLocalBounds().width;\n },\n set: function (value)\n {\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\n this._width = value;\n }\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 * @memberof PIXI.Container#\n */\n height: {\n get: function ()\n {\n return this.scale.y * this.getLocalBounds().height;\n },\n set: function (value)\n {\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});\n\n/**\n * Adds a child to the container.\n *\n * @param child {DisplayObject} The DisplayObject to add to the container\n * @return {DisplayObject} The child that was added.\n */\nContainer.prototype.addChild = function (child)\n{\n return this.addChildAt(child, this.children.length);\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 child {DisplayObject} The child to add\n * @param index {Number} The index to place the child in\n * @return {DisplayObject} The child that was added.\n */\nContainer.prototype.addChildAt = function (child, index)\n{\n // prevent adding self as child\n if (child === this)\n {\n return child;\n }\n\n if (index >= 0 && index <= this.children.length)\n {\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n\n this.children.splice(index, 0, child);\n return child;\n }\n else\n {\n throw new Error(child + 'addChildAt: The index '+ index +' supplied is out of bounds ' + this.children.length);\n }\n};\n\n/**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param child {DisplayObject}\n * @param child2 {DisplayObject}\n */\nContainer.prototype.swapChildren = function (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 if (index1 < 0 || index2 < 0)\n {\n throw new Error('swapChildren: Both the supplied DisplayObjects must be children of the caller.');\n }\n\n this.children[index1] = child2;\n this.children[index2] = child;\n};\n\n/**\n * Returns the index position of a child DisplayObject instance\n *\n * @param child {DisplayObject} The DisplayObject instance to identify\n * @return {Number} The index position of the child display object to identify\n */\nContainer.prototype.getChildIndex = function (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 child {DisplayObject} The child DisplayObject instance for which you want to change the index number\n * @param index {Number} The resulting index number for the child display object\n */\nContainer.prototype.setChildIndex = function (child, index)\n{\n if (index < 0 || index >= this.children.length)\n {\n throw new Error('The supplied index is out of bounds');\n }\n\n var currentIndex = this.getChildIndex(child);\n\n this.children.splice(currentIndex, 1); //remove from old position\n this.children.splice(index, 0, child); //add at new position\n};\n\n/**\n * Returns the child at the specified index\n *\n * @param index {Number} The index to get the child at\n * @return {DisplayObject} The child at the given index, if any.\n */\nContainer.prototype.getChildAt = function (index)\n{\n if (index < 0 || index >= this.children.length)\n {\n throw new Error('getChildAt: Supplied index ' + index + ' does not exist in the child list, or the supplied DisplayObject is not a child of the caller');\n }\n\n return this.children[index];\n};\n\n/**\n * Removes a child from the container.\n *\n * @param child {DisplayObject} The DisplayObject to remove\n * @return {DisplayObject} The child that was removed.\n */\nContainer.prototype.removeChild = function (child)\n{\n var index = this.children.indexOf(child);\n\n if (index === -1)\n {\n return;\n }\n\n return this.removeChildAt(index);\n};\n\n/**\n * Removes a child from the specified index position.\n *\n * @param index {Number} The index to get the child from\n * @return {DisplayObject} The child that was removed.\n */\nContainer.prototype.removeChildAt = function (index)\n{\n var child = this.getChildAt(index);\n\n child.parent = null;\n this.children.splice(index, 1);\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 beginIndex {Number} The beginning position. Default value is 0.\n * @param endIndex {Number} The ending position. Default value is size of the container.\n */\nContainer.prototype.removeChildren = function (beginIndex, endIndex)\n{\n var begin = beginIndex || 0;\n var end = typeof endIndex === 'number' ? endIndex : this.children.length;\n var range = end - begin;\n\n if (range > 0 && range <= end)\n {\n var removed = this.children.splice(begin, range);\n\n for (var i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n else\n {\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\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 static / complicated and needs to be reused multiple times.\n *\n * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture.\n * @param resolution {Number} The resolution of the texture being generated\n * @param scaleMode {Number} See {@link SCALE_MODES} for possible values\n * @return {Texture} a texture of the display object\n */\nContainer.prototype.generateTexture = function (renderer, resolution, scaleMode)\n{\n var bounds = this.getLocalBounds();\n\n var renderTexture = new RenderTexture(renderer, bounds.width | 0, bounds.height | 0, renderer, scaleMode, resolution);\n\n _tempMatrix.tx = -bounds.x;\n _tempMatrix.ty = -bounds.y;\n\n renderTexture.render(this, _tempMatrix);\n\n return renderTexture;\n};\n\n/*\n * Updates the transform on all children of this container for rendering\n *\n * @private\n */\nContainer.prototype.updateTransform = function ()\n{\n if (!this.visible)\n {\n return;\n }\n\n this.displayObjectUpdateTransform();\n\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].updateTransform();\n }\n};\n\n// performance increase to avoid using call.. (10x faster)\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n\n/**\n * Retrieves the bounds of the Container as a rectangle. The bounds calculation takes all visible children into consideration.\n *\n * @return {Rectangle} The rectangular bounding area\n */\nContainer.prototype.getBounds = function ()\n{\n if(!this._currentBounds)\n {\n\n if (this.children.length === 0)\n {\n return math.Rectangle.EMPTY;\n }\n\n // TODO the bounds have already been calculated this render session so return what we have\n\n var minX = Infinity;\n var minY = Infinity;\n\n var maxX = -Infinity;\n var maxY = -Infinity;\n\n var childBounds;\n var childMaxX;\n var childMaxY;\n\n var childVisible = false;\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 continue;\n }\n\n childVisible = true;\n\n childBounds = this.children[i].getBounds();\n\n minX = minX < childBounds.x ? minX : childBounds.x;\n minY = minY < childBounds.y ? minY : childBounds.y;\n\n childMaxX = childBounds.width + childBounds.x;\n childMaxY = childBounds.height + childBounds.y;\n\n maxX = maxX > childMaxX ? maxX : childMaxX;\n maxY = maxY > childMaxY ? maxY : childMaxY;\n }\n\n if (!childVisible)\n {\n return math.Rectangle.EMPTY;\n }\n\n var bounds = this._bounds;\n\n bounds.x = minX;\n bounds.y = minY;\n bounds.width = maxX - minX;\n bounds.height = maxY - minY;\n\n this._currentBounds = bounds;\n }\n\n return this._currentBounds;\n};\n\nContainer.prototype.containerGetBounds = Container.prototype.getBounds;\n\n/**\n * Retrieves the non-global local bounds of the Container as a rectangle.\n * The calculation takes all visible children into consideration.\n *\n * @return {Rectangle} The rectangular bounding area\n */\nContainer.prototype.getLocalBounds = function ()\n{\n var matrixCache = this.worldTransform;\n\n this.worldTransform = math.Matrix.IDENTITY;\n\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].updateTransform();\n }\n\n this.worldTransform = matrixCache;\n\n this._currentBounds = null;\n\n return this.getBounds( math.Matrix.IDENTITY );\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer} The renderer\n */\nContainer.prototype.renderWebGL = function (renderer)\n{\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 var i, j;\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || this._filters)\n {\n renderer.currentRenderer.flush();\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (this._filters)\n {\n renderer.filterManager.pushFilter(this, this._filters);\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this, this._mask);\n }\n\n renderer.currentRenderer.start();\n\n // add this object to the batch, only rendered if it has a texture.\n this._renderWebGL(renderer);\n\n // now loop through the children and make sure they get rendered\n for (i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].renderWebGL(renderer);\n }\n\n renderer.currentRenderer.flush();\n\n if (this._mask)\n {\n renderer.maskManager.popMask(this, this._mask);\n }\n\n if (this._filters)\n {\n renderer.filterManager.popFilter();\n\n }\n renderer.currentRenderer.start();\n }\n else\n {\n this._renderWebGL(renderer);\n\n // simple render children!\n for (i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderWebGL(renderer);\n }\n }\n};\n\n/**\n * To be overridden by the subclass\n *\n * @param renderer {WebGLRenderer} The renderer\n * @private\n */\nContainer.prototype._renderWebGL = function (renderer) // jshint unused:false\n{\n // this is where content itself gets rendered...\n};\n\n/**\n * To be overridden by the subclass\n *\n * @param renderer {CanvasRenderer} The renderer\n * @private\n */\nContainer.prototype._renderCanvas = function (renderer) // jshint unused:false\n{\n // this is where content itself gets rendered...\n};\n\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer} The renderer\n */\nContainer.prototype.renderCanvas = function (renderer)\n{\n // if not visible or the alpha is 0 then no need to render this\n if (!this.visible || this.alpha <= 0 || !this.renderable)\n {\n return;\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this._mask, renderer);\n }\n\n this._renderCanvas(renderer);\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderCanvas(renderer);\n }\n\n if (this._mask)\n {\n renderer.maskManager.popMask(renderer);\n }\n};\n\n/**\n * Destroys the container\n * @param [destroyChildren=false] {boolean} if set to true, all the children will have their destroy method called as well\n */\nContainer.prototype.destroy = function (destroyChildren)\n{\n DisplayObject.prototype.destroy.call(this);\n\n if (destroyChildren)\n {\n for (var i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].destroy(destroyChildren);\n }\n }\n\n this.removeChildren();\n\n this.children = null;\n};\n","var math = require('../math'),\n RenderTexture = require('../textures/RenderTexture'),\n EventEmitter = require('eventemitter3'),\n CONST = require('../const'),\n _tempMatrix = new math.Matrix();\n\n/**\n * The base class for all objects that are rendered on the screen.\n * This is an abstract class and should not be used on its own rather it should be extended.\n *\n * @class\n * @extends EventEmitter\n * @memberof PIXI\n */\nfunction DisplayObject()\n{\n EventEmitter.call(this);\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {Point}\n */\n this.position = new math.Point();\n\n /**\n * The scale factor of the object.\n *\n * @member {Point}\n */\n this.scale = new math.Point(1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around\n *\n * @member {Point}\n */\n this.pivot = new math.Point(0, 0);\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n this.rotation = 0;\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 * @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 * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {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 * Current transform of the object based on world (parent) factors\n *\n * @member {Matrix}\n * @readOnly\n */\n this.worldTransform = new math.Matrix();\n\n /**\n * The area the filter is applied to. This is used as more of an optimisation\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle\n *\n * @member {Rectangle}\n */\n this.filterArea = null;\n\n /**\n * cached sin rotation\n *\n * @member {number}\n * @private\n */\n this._sr = 0;\n\n /**\n * cached cos rotation\n *\n * @member {number}\n * @private\n */\n this._cr = 1;\n\n /**\n * The original, cached bounds of the object\n *\n * @member {Rectangle}\n * @private\n */\n this._bounds = new math.Rectangle(0, 0, 1, 1);\n\n /**\n * The most up-to-date bounds of the object\n *\n * @member {Rectangle}\n * @private\n */\n this._currentBounds = null;\n\n /**\n * The original, cached mask of the object\n *\n * @member {Rectangle}\n * @private\n */\n this._mask = null;\n\n //TODO rename to _isMask\n // this.isMask = false;\n\n /**\n * Cached internal flag.\n *\n * @member {boolean}\n * @private\n */\n this._cacheAsBitmap = false;\n this._cachedObject = null;\n}\n\n// constructor\nDisplayObject.prototype = Object.create(EventEmitter.prototype);\nDisplayObject.prototype.constructor = DisplayObject;\nmodule.exports = DisplayObject;\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n * @memberof DisplayObject#\n */\n x: {\n get: function ()\n {\n return this.position.x;\n },\n set: function (value)\n {\n this.position.x = value;\n }\n },\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n *\n * @member {number}\n * @memberof DisplayObject#\n */\n y: {\n get: function ()\n {\n return this.position.y;\n },\n set: function (value)\n {\n this.position.y = value;\n }\n },\n\n /**\n * Indicates if the sprite is globally visible.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @readonly\n */\n worldVisible: {\n get: function ()\n {\n var item = this;\n\n do {\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 /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it.\n * In PIXI a regular mask must be a PIXI.Graphics object. This allows for much faster masking in canvas as it utilises shape clipping.\n * To remove a mask, set this property to null.\n *\n * @member {Graphics}\n * @property {Graphics}\n * @memberof PIXI.DisplayObject#\n */\n mask: {\n get: function ()\n {\n return this._mask;\n },\n set: function (value)\n {\n if (this._mask)\n {\n this._mask.renderable = true;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n this._mask.renderable = false;\n }\n }\n },\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 {Filter[]}\n * @memberof PIXI.DisplayObject#\n */\n filters: {\n get: function ()\n {\n return this._filters && this._filters.slice();\n },\n set: function (value)\n {\n this._filters = value && value.slice();\n }\n }\n\n});\n\n/*\n * Updates the object transform for rendering\n *\n * TODO - Optimization pass!\n */\nDisplayObject.prototype.updateTransform = function ()\n{\n\n // create some matrix refs for easy access\n var pt = this.parent.worldTransform;\n var wt = this.worldTransform;\n\n // temporary matrix variables\n var a, b, c, d, tx, ty;\n\n // so if rotation is between 0 then we can simplify the multiplication process...\n if (this.rotation % CONST.PI_2)\n {\n // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes\n if (this.rotation !== this.rotationCache)\n {\n this.rotationCache = this.rotation;\n this._sr = Math.sin(this.rotation);\n this._cr = Math.cos(this.rotation);\n }\n\n // get the matrix values of the displayobject based on its transform properties..\n a = this._cr * this.scale.x;\n b = this._sr * this.scale.x;\n c = -this._sr * this.scale.y;\n d = this._cr * this.scale.y;\n tx = this.position.x;\n ty = this.position.y;\n\n // check for pivot.. not often used so geared towards that fact!\n if (this.pivot.x || this.pivot.y)\n {\n tx -= this.pivot.x * a + this.pivot.y * c;\n ty -= this.pivot.x * b + this.pivot.y * d;\n }\n\n // concat the parent matrix with the objects transform.\n wt.a = a * pt.a + b * pt.c;\n wt.b = a * pt.b + b * pt.d;\n wt.c = c * pt.a + d * pt.c;\n wt.d = c * pt.b + d * pt.d;\n wt.tx = tx * pt.a + ty * pt.c + pt.tx;\n wt.ty = tx * pt.b + ty * pt.d + pt.ty;\n }\n else\n {\n // lets do the fast version as we know there is no rotation..\n a = this.scale.x;\n d = this.scale.y;\n\n tx = this.position.x - this.pivot.x * a;\n ty = this.position.y - this.pivot.y * d;\n\n wt.a = a * pt.a;\n wt.b = a * pt.b;\n wt.c = d * pt.c;\n wt.d = d * pt.d;\n wt.tx = tx * pt.a + ty * pt.c + pt.tx;\n wt.ty = tx * pt.b + ty * pt.d + pt.ty;\n }\n\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n // reset the bounds each time this is called!\n this._currentBounds = null;\n};\n\n// performance increase to avoid using call.. (10x faster)\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n\n/**\n *\n *\n * Retrieves the bounds of the displayObject as a rectangle object\n *\n * @param matrix {Matrix}\n * @return {Rectangle} the rectangular bounding area\n */\nDisplayObject.prototype.getBounds = function (matrix) // jshint unused:false\n{\n return math.Rectangle.EMPTY;\n};\n\n/**\n * Retrieves the local bounds of the displayObject as a rectangle object\n *\n * @return {Rectangle} the rectangular bounding area\n */\nDisplayObject.prototype.getLocalBounds = function ()\n{\n return this.getBounds(math.Matrix.IDENTITY);\n};\n\n/**\n * Calculates the global position of the display object\n *\n * @param position {Point} The world origin to calculate from\n * @return {Point} A point object representing the position of this object\n */\nDisplayObject.prototype.toGlobal = function (position)\n{\n // don't need to update the lot\n this.displayObjectUpdateTransform();\n return this.worldTransform.apply(position);\n};\n\n/**\n * Calculates the local position of the display object relative to another point\n *\n * @param position {Point} The world origin to calculate from\n * @param [from] {DisplayObject} The DisplayObject to calculate the global position from\n * @return {Point} A point object representing the position of this object\n */\nDisplayObject.prototype.toLocal = function (position, from)\n{\n if (from)\n {\n position = from.toGlobal(position);\n }\n\n // don't need to update the lot\n this.displayObjectUpdateTransform();\n return this.worldTransform.applyInverse(position);\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer} The renderer\n * @private\n */\nDisplayObject.prototype.renderWebGL = function (renderer) // jshint unused:false\n{\n // OVERWRITE;\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer} The renderer\n * @private\n */\nDisplayObject.prototype.renderCanvas = function (renderer) // jshint unused:false\n{\n // OVERWRITE;\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 static / complicated and needs to be reused multiple times.\n *\n * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture.\n * @param scaleMode {Number} See {@link SCALE_MODES} for possible values\n * @param resolution {Number} The resolution of the texture being generated\n * @return {Texture} a texture of the display object\n */\nDisplayObject.prototype.generateTexture = function (renderer, scaleMode, resolution)\n{\n var bounds = this.getLocalBounds();\n\n var renderTexture = new RenderTexture(renderer, bounds.width | 0, bounds.height | 0, scaleMode, resolution);\n\n _tempMatrix.tx = -bounds.x;\n _tempMatrix.ty = -bounds.y;\n\n renderTexture.render(this, _tempMatrix);\n\n return renderTexture;\n};\n\n/**\n * Base destroy method for generic display objects\n *\n */\nDisplayObject.prototype.destroy = function ()\n{\n\n this.position = null;\n this.scale = null;\n this.pivot = null;\n\n this.parent = null;\n\n this._bounds = null;\n this._currentBounds = null;\n this._mask = null;\n\n this.worldTransform = null;\n this.filterArea = null;\n};\n","var Container = require('../display/Container'),\n Texture = require('../textures/Texture'),\n CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'),\n CanvasGraphics = require('../renderers/canvas/utils/CanvasGraphics'),\n GraphicsData = require('./GraphicsData'),\n math = require('../math'),\n CONST = require('../const'),\n tempPoint = new math.Point();\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 * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nfunction Graphics()\n{\n Container.call(this);\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.fillAlpha = 1;\n\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n this.lineWidth = 0;\n\n /**\n * The color of any lines drawn.\n *\n * @member {string}\n * @default 0\n */\n this.lineColor = 0;\n\n /**\n * Graphics data\n *\n * @member {GraphicsData[]}\n * @private\n */\n this.graphicsData = [];\n\n /**\n * The tint applied to the graphic shape. This is a hex value. Apply a value of 0xFFFFFF to reset the tint.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n this.tint = 0xFFFFFF;\n\n /**\n * The previous tint applied to the graphic shape. Used to compare to the current tint and check if theres change.\n *\n * @member {number}\n * @private\n * @default 0xFFFFFF\n */\n this._prevTint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of blendModes.NORMAL to reset the blend mode.\n *\n * @member {number}\n * @default CONST.BLEND_MODES.NORMAL;\n */\n this.blendMode = CONST.BLEND_MODES.NORMAL;\n\n /**\n * Current path\n *\n * @member {GraphicsData}\n * @private\n */\n this.currentPath = null;\n\n /**\n * Array containing some WebGL-related properties used by the WebGL renderer.\n *\n * @member {object<number, object>}\n * @private\n */\n // TODO - _webgl should use a prototype object, not a random undocumented object...\n this._webGL = {};\n\n /**\n * Whether this shape is being used as a mask.\n *\n * @member {boolean}\n */\n this.isMask = false;\n\n /**\n * The bounds' padding used for bounds calculation.\n *\n * @member {number}\n */\n this.boundsPadding = 0;\n\n /**\n * A cache of the local bounds to prevent recalculation.\n *\n * @member {Rectangle}\n * @private\n */\n this._localBounds = new math.Rectangle(0,0,1,1);\n\n /**\n * Used to detect if the graphics object has changed. If this is set to true then the graphics\n * object will be recalculated.\n *\n * @member {boolean}\n * @private\n */\n this.dirty = true;\n\n /**\n * Used to detect if the WebGL graphics object has changed. If this is set to true then the\n * graphics object will be recalculated.\n *\n * @member {boolean}\n * @private\n */\n this.glDirty = false;\n\n this.boundsDirty = true;\n\n /**\n * Used to detect if the cached sprite object needs to be updated.\n *\n * @member {boolean}\n * @private\n */\n this.cachedSpriteDirty = false;\n}\n\n// constructor\nGraphics.prototype = Object.create(Container.prototype);\nGraphics.prototype.constructor = Graphics;\nmodule.exports = Graphics;\n\nObject.defineProperties(Graphics.prototype, {\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 * @member {boolean}\n * @memberof Graphics#\n * @default false\n * @private\n */\n\n});\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 {Graphics}\n */\nGraphics.prototype.clone = function ()\n{\n var clone = new Graphics();\n\n clone.renderable = this.renderable;\n clone.fillAlpha = this.fillAlpha;\n clone.lineWidth = this.lineWidth;\n clone.lineColor = this.lineColor;\n clone.tint = this.tint;\n clone.blendMode = this.blendMode;\n clone.isMask = this.isMask;\n clone.boundsPadding = this.boundsPadding;\n clone.dirty = this.dirty;\n clone.glDirty = this.glDirty;\n clone.cachedSpriteDirty = this.cachedSpriteDirty;\n\n // copy graphics data\n for (var i = 0; i < this.graphicsData.length; ++i)\n {\n clone.graphicsData.push(this.graphicsData[i].clone());\n }\n\n clone.currentPath = clone.graphicsData[clone.graphicsData.length - 1];\n\n clone.updateLocalBounds();\n\n return clone;\n};\n\n/**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.\n *\n * @param lineWidth {number} width of the line to draw, will update the objects stored style\n * @param color {number} color of the line to draw, will update the objects stored style\n * @param alpha {number} alpha of the line to draw, will update the objects stored style\n * @return {Graphics}\n */\nGraphics.prototype.lineStyle = function (lineWidth, color, alpha)\n{\n this.lineWidth = lineWidth || 0;\n this.lineColor = color || 0;\n this.lineAlpha = (alpha === undefined) ? 1 : alpha;\n\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length)\n {\n // halfway through a line? start a new one!\n this.drawShape( new math.Polygon( this.currentPath.shape.points.slice(-2) ));\n }\n else\n {\n // otherwise its empty so lets just set the line properties\n this.currentPath.lineWidth = this.lineWidth;\n this.currentPath.lineColor = this.lineColor;\n this.currentPath.lineAlpha = this.lineAlpha;\n }\n }\n\n return this;\n};\n\n/**\n * Moves the current drawing position to x, y.\n *\n * @param x {number} the X coordinate to move to\n * @param y {number} the Y coordinate to move to\n * @return {Graphics}\n */\nGraphics.prototype.moveTo = function (x, y)\n{\n this.drawShape(new math.Polygon([x,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 x {number} the X coordinate to draw to\n * @param y {number} the Y coordinate to draw to\n * @return {Graphics}\n */\nGraphics.prototype.lineTo = function (x, y)\n{\n this.currentPath.shape.points.push(x, y);\n this.dirty = true;\n\n return this;\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 cpX {number} Control point x\n * @param cpY {number} Control point y\n * @param toX {number} Destination point x\n * @param toY {number} Destination point y\n * @return {Graphics}\n */\nGraphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY)\n{\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points = [0, 0];\n }\n }\n else\n {\n this.moveTo(0,0);\n }\n\n var xa,\n ya,\n n = 20,\n points = this.currentPath.shape.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n var fromX = points[points.length-2];\n var fromY = points[points.length-1];\n\n var j = 0;\n for (var i = 1; i <= n; ++i)\n {\n 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 this.dirty = this.boundsDirty = true;\n\n return this;\n};\n\n/**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param cpX {number} Control point x\n * @param cpY {number} Control point y\n * @param cpX2 {number} Second Control point x\n * @param cpY2 {number} Second Control point y\n * @param toX {number} Destination point x\n * @param toY {number} Destination point y\n * @return {Graphics}\n */\nGraphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY)\n{\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points = [0, 0];\n }\n }\n else\n {\n this.moveTo(0,0);\n }\n\n var n = 20,\n dt,\n dt2,\n dt3,\n t2,\n t3,\n points = this.currentPath.shape.points;\n\n var fromX = points[points.length-2];\n var fromY = points[points.length-1];\n\n var j = 0;\n\n for (var i = 1; 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( 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 this.dirty = this.boundsDirty = true;\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 x1 {number} The x-coordinate of the beginning of the arc\n * @param y1 {number} The y-coordinate of the beginning of the arc\n * @param x2 {number} The x-coordinate of the end of the arc\n * @param y2 {number} The y-coordinate of the end of the arc\n * @param radius {number} The radius of the arc\n * @return {Graphics}\n */\nGraphics.prototype.arcTo = function (x1, y1, x2, y2, radius)\n{\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points.push(x1, y1);\n }\n }\n else\n {\n this.moveTo(x1, y1);\n }\n\n var points = this.currentPath.shape.points,\n fromX = points[points.length-2],\n fromY = points[points.length-1],\n a1 = fromY - y1,\n b1 = fromX - x1,\n a2 = y2 - y1,\n b2 = x2 - x1,\n 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 else\n {\n var dd = a1 * a1 + b1 * b1,\n cc = a2 * a2 + b2 * b2,\n tt = a1 * a2 + b1 * b2,\n k1 = radius * Math.sqrt(dd) / mm,\n k2 = radius * Math.sqrt(cc) / mm,\n j1 = k1 * tt / dd,\n j2 = k2 * tt / cc,\n cx = k1 * b2 + k2 * b1,\n cy = k1 * a2 + k2 * a1,\n px = b1 * (k2 + j1),\n py = a1 * (k2 + j1),\n qx = b2 * (k1 + j2),\n qy = a2 * (k1 + j2),\n startAngle = Math.atan2(py - cy, px - cx),\n endAngle = Math.atan2(qy - cy, qx - cx);\n\n this.arc(cx + x1, cy + y1, radius, startAngle, endAngle, b1 * a2 > b2 * a1);\n }\n\n this.dirty = this.boundsDirty = true;\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 cx {number} The x-coordinate of the center of the circle\n * @param cy {number} The y-coordinate of the center of the circle\n * @param radius {number} The radius of the circle\n * @param startAngle {number} The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)\n * @param endAngle {number} The ending angle, in radians\n * @param anticlockwise {boolean} Optional. Specifies whether the drawing should be counterclockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.\n * @return {Graphics}\n */\nGraphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise)\n{\n anticlockwise = anticlockwise || false;\n\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if( !anticlockwise && endAngle <= startAngle )\n {\n endAngle += Math.PI * 2;\n }\n else if( anticlockwise && startAngle <= endAngle )\n {\n startAngle += Math.PI * 2;\n }\n\n var sweep = anticlockwise ? (startAngle - endAngle) * -1 : (endAngle - startAngle);\n var segs = Math.ceil(Math.abs(sweep) / (Math.PI * 2)) * 40;\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\n if (this.currentPath)\n {\n if (anticlockwise && this.filling)\n {\n this.currentPath.shape.points.push(cx, cy);\n }\n else\n {\n this.currentPath.shape.points.push(startX, startY);\n }\n }\n else\n {\n if (anticlockwise && this.filling)\n {\n\n this.moveTo(cx, cy);\n }\n else\n {\n this.moveTo(startX, startY);\n }\n }\n\n var points = this.currentPath.shape.points;\n\n var theta = sweep/(segs*2);\n var theta2 = theta*2;\n\n var cTheta = Math.cos(theta);\n var sTheta = Math.sin(theta);\n\n var segMinus = segs - 1;\n\n var remainder = ( segMinus % 1 ) / segMinus;\n\n for(var i=0; i<=segMinus; i++)\n {\n var real = i + remainder * i;\n\n\n var angle = ((theta) + startAngle + (theta2 * real));\n\n var c = Math.cos(angle);\n var s = -Math.sin(angle);\n\n points.push(( (cTheta * c) + (sTheta * s) ) * radius + cx,\n ( (cTheta * -s) + (sTheta * c) ) * radius + cy);\n }\n\n this.dirty = this.boundsDirty = true;\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 color {number} the color of the fill\n * @param alpha {number} the alpha of the fill\n * @return {Graphics}\n */\nGraphics.prototype.beginFill = function (color, alpha)\n{\n this.filling = true;\n this.fillColor = color || 0;\n this.fillAlpha = (alpha === undefined) ? 1 : alpha;\n\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length <= 2)\n {\n this.currentPath.fill = this.filling;\n this.currentPath.fillColor = this.fillColor;\n this.currentPath.fillAlpha = this.fillAlpha;\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 {Graphics}\n */\nGraphics.prototype.endFill = function ()\n{\n this.filling = false;\n this.fillColor = null;\n this.fillAlpha = 1;\n\n return this;\n};\n\n/**\n *\n * @param x {number} The X coord of the top-left of the rectangle\n * @param y {number} The Y coord of the top-left of the rectangle\n * @param width {number} The width of the rectangle\n * @param height {number} The height of the rectangle\n * @return {Graphics}\n */\nGraphics.prototype.drawRect = function ( x, y, width, height )\n{\n this.drawShape(new math.Rectangle(x,y, width, height));\n\n return this;\n};\n\n/**\n *\n * @param x {number} The X coord of the top-left of the rectangle\n * @param y {number} The Y coord of the top-left of the rectangle\n * @param width {number} The width of the rectangle\n * @param height {number} The height of the rectangle\n * @param radius {number} Radius of the rectangle corners\n */\nGraphics.prototype.drawRoundedRect = function ( x, y, width, height, radius )\n{\n this.drawShape(new math.RoundedRectangle(x, y, width, height, radius));\n\n return this;\n};\n\n/**\n * Draws a circle.\n *\n * @param x {number} The X coordinate of the center of the circle\n * @param y {number} The Y coordinate of the center of the circle\n * @param radius {number} The radius of the circle\n * @return {Graphics}\n */\nGraphics.prototype.drawCircle = function (x, y, radius)\n{\n this.drawShape(new math.Circle(x,y, radius));\n\n return this;\n};\n\n/**\n * Draws an ellipse.\n *\n * @param x {number} The X coordinate of the center of the ellipse\n * @param y {number} The Y coordinate of the center of the ellipse\n * @param width {number} The half width of the ellipse\n * @param height {number} The half height of the ellipse\n * @return {Graphics}\n */\nGraphics.prototype.drawEllipse = function (x, y, width, height)\n{\n this.drawShape(new math.Ellipse(x, y, width, height));\n\n return this;\n};\n\n/**\n * Draws a polygon using the given path.\n *\n * @param path {Array} The path data used to construct the polygon.\n * @return {Graphics}\n */\nGraphics.prototype.drawPolygon = function (path)\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 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[i];\n }\n }\n\n this.drawShape(new math.Polygon(points));\n\n return this;\n};\n\n/**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {Graphics}\n */\nGraphics.prototype.clear = function ()\n{\n this.lineWidth = 0;\n this.filling = false;\n\n this.dirty = true;\n this.clearDirty = true;\n this.graphicsData = [];\n\n return this;\n};\n\n/**\n * Useful function that returns a texture of the graphics object that can then be used to create sprites\n * This can be quite useful if your geometry is complicated and needs to be reused multiple times.\n *\n * @param resolution {number} The resolution of the texture being generated\n * @param scaleMode {number} Should be one of the scaleMode consts\n * @return {Texture} a texture of the graphics object\n */\nGraphics.prototype.generateTexture = function (renderer, resolution, scaleMode)\n{\n\n resolution = resolution || 1;\n\n var bounds = this.getLocalBounds();\n\n var canvasBuffer = new CanvasBuffer(bounds.width * resolution, bounds.height * resolution);\n\n var texture = Texture.fromCanvas(canvasBuffer.canvas, scaleMode);\n texture.baseTexture.resolution = resolution;\n\n canvasBuffer.context.scale(resolution, resolution);\n\n canvasBuffer.context.translate(-bounds.x,-bounds.y);\n\n CanvasGraphics.renderGraphics(this, canvasBuffer.context);\n\n return texture;\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer}\n * @private\n */\nGraphics.prototype._renderWebGL = function (renderer)\n{\n // if the sprite is not visible or the alpha is 0 then no need to render this element\n\n // this code may still be needed so leaving for now..\n //\n /*\n if (this._cacheAsBitmap)\n {\n if (this.dirty || this.cachedSpriteDirty)\n {\n this._generateCachedSprite();\n\n // we will also need to update the texture on the gpu too!\n this.updateCachedSpriteTexture();\n\n this.cachedSpriteDirty = false;\n this.dirty = false;\n }\n\n this._cachedSprite.worldAlpha = this.worldAlpha;\n\n Sprite.prototype.renderWebGL.call(this._cachedSprite, renderer);\n\n return;\n }\n\n */\n\n if (this.glDirty)\n {\n this.dirty = true;\n this.glDirty = false;\n }\n\n renderer.setObjectRenderer(renderer.plugins.graphics);\n renderer.plugins.graphics.render(this);\n\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer}\n * @private\n */\nGraphics.prototype._renderCanvas = function (renderer)\n{\n if (this.isMask === true)\n {\n return;\n }\n\n // if the tint has changed, set the graphics object to dirty.\n if (this._prevTint !== this.tint) {\n this.dirty = true;\n this._prevTint = this.tint;\n }\n\n // this code may still be needed so leaving for now..\n //\n /*\n if (this._cacheAsBitmap)\n {\n if (this.dirty || this.cachedSpriteDirty)\n {\n this._generateCachedSprite();\n\n // we will also need to update the texture\n this.updateCachedSpriteTexture();\n\n this.cachedSpriteDirty = false;\n this.dirty = false;\n }\n\n this._cachedSprite.alpha = this.alpha;\n\n Sprite.prototype._renderCanvas.call(this._cachedSprite, renderer);\n\n return;\n }\n */\n var context = renderer.context;\n var transform = this.worldTransform;\n\n if (this.blendMode !== renderer.currentBlendMode)\n {\n renderer.currentBlendMode = this.blendMode;\n context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode];\n }\n\n var resolution = renderer.resolution;\n context.setTransform(\n transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution\n );\n\n CanvasGraphics.renderGraphics(this, context);\n};\n\n/**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @return {Rectangle} the rectangular bounding area\n */\nGraphics.prototype.getBounds = function (matrix)\n{\n if(!this._currentBounds)\n {\n\n // return an empty object if the item is a mask!\n if (!this.renderable)\n {\n return math.Rectangle.EMPTY;\n }\n\n if (this.boundsDirty)\n {\n this.updateLocalBounds();\n\n this.glDirty = true;\n this.cachedSpriteDirty = true;\n this.boundsDirty = false;\n }\n\n var bounds = this._localBounds;\n\n var w0 = bounds.x;\n var w1 = bounds.width + bounds.x;\n\n var h0 = bounds.y;\n var h1 = bounds.height + bounds.y;\n\n var worldTransform = matrix || this.worldTransform;\n\n var a = worldTransform.a;\n var b = worldTransform.b;\n var c = worldTransform.c;\n var d = worldTransform.d;\n var tx = worldTransform.tx;\n var ty = worldTransform.ty;\n\n var x1 = a * w1 + c * h1 + tx;\n var y1 = d * h1 + b * w1 + ty;\n\n var x2 = a * w0 + c * h1 + tx;\n var y2 = d * h1 + b * w0 + ty;\n\n var x3 = a * w0 + c * h0 + tx;\n var y3 = d * h0 + b * w0 + ty;\n\n var x4 = a * w1 + c * h0 + tx;\n var y4 = d * h0 + b * w1 + ty;\n\n var maxX = x1;\n var maxY = y1;\n\n var minX = x1;\n var minY = y1;\n\n minX = x2 < minX ? x2 : minX;\n minX = x3 < minX ? x3 : minX;\n minX = x4 < minX ? x4 : minX;\n\n minY = y2 < minY ? y2 : minY;\n minY = y3 < minY ? y3 : minY;\n minY = y4 < minY ? y4 : minY;\n\n maxX = x2 > maxX ? x2 : maxX;\n maxX = x3 > maxX ? x3 : maxX;\n maxX = x4 > maxX ? x4 : maxX;\n\n maxY = y2 > maxY ? y2 : maxY;\n maxY = y3 > maxY ? y3 : maxY;\n maxY = y4 > maxY ? y4 : maxY;\n\n this._bounds.x = minX;\n this._bounds.width = maxX - minX;\n\n this._bounds.y = minY;\n this._bounds.height = maxY - minY;\n\n this._currentBounds = this._bounds;\n }\n\n return this._currentBounds;\n};\n\n/**\n* Tests if a point is inside this graphics object\n*\n* @param point {Point} the point to test\n* @return {boolean} the result of the test\n*/\nGraphics.prototype.containsPoint = function( point )\n{\n this.worldTransform.applyInverse(point, tempPoint);\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.fill)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if ( data.shape.contains( tempPoint.x, tempPoint.y ) )\n {\n return true;\n }\n }\n }\n\n return false;\n};\n\n/**\n * Update the bounds of the object\n *\n */\nGraphics.prototype.updateLocalBounds = function ()\n{\n var minX = Infinity;\n var maxX = -Infinity;\n\n var minY = Infinity;\n var maxY = -Infinity;\n\n if (this.graphicsData.length)\n {\n var shape, points, x, y, w, h;\n\n for (var i = 0; i < this.graphicsData.length; i++)\n {\n var data = this.graphicsData[i];\n var type = data.type;\n var lineWidth = data.lineWidth;\n shape = data.shape;\n\n if (type === CONST.SHAPES.RECT || type === CONST.SHAPES.RREC)\n {\n x = shape.x - lineWidth/2;\n y = shape.y - lineWidth/2;\n w = shape.width + lineWidth;\n h = shape.height + lineWidth;\n\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === CONST.SHAPES.CIRC)\n {\n x = shape.x;\n y = shape.y;\n w = shape.radius + lineWidth/2;\n h = shape.radius + lineWidth/2;\n\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === CONST.SHAPES.ELIP)\n {\n x = shape.x;\n y = shape.y;\n w = shape.width + lineWidth/2;\n h = shape.height + lineWidth/2;\n\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else\n {\n // POLY\n points = shape.points;\n\n for (var j = 0; j < points.length; j += 2)\n {\n x = points[j];\n y = points[j+1];\n\n minX = x-lineWidth < minX ? x-lineWidth : minX;\n maxX = x+lineWidth > maxX ? x+lineWidth : maxX;\n\n minY = y-lineWidth < minY ? y-lineWidth : minY;\n maxY = y+lineWidth > maxY ? y+lineWidth : maxY;\n }\n }\n }\n }\n else\n {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n\n var padding = this.boundsPadding;\n\n this._localBounds.x = minX - padding;\n this._localBounds.width = (maxX - minX) + padding * 2;\n\n this._localBounds.y = minY - padding;\n this._localBounds.height = (maxY - minY) + padding * 2;\n};\n\n/**\n * Generates the cached sprite when the sprite has cacheAsBitmap = true\n *\n * @private\n */\n/*\nGraphics.prototype._generateCachedSprite = function ()\n{\n var bounds = this.getLocalBounds();\n\n if (!this._cachedSprite)\n {\n var canvasBuffer = new CanvasBuffer(bounds.width, bounds.height);\n var texture = Texture.fromCanvas(canvasBuffer.canvas);\n\n this._cachedSprite = new Sprite(texture);\n this._cachedSprite.buffer = canvasBuffer;\n\n this._cachedSprite.worldTransform = this.worldTransform;\n }\n else\n {\n this._cachedSprite.buffer.resize(bounds.width, bounds.height);\n }\n\n // leverage the anchor to account for the offset of the element\n this._cachedSprite.anchor.x = -( bounds.x / bounds.width );\n this._cachedSprite.anchor.y = -( bounds.y / bounds.height );\n\n // this._cachedSprite.buffer.context.save();\n this._cachedSprite.buffer.context.translate(-bounds.x,-bounds.y);\n\n // make sure we set the alpha of the graphics to 1 for the render..\n this.worldAlpha = 1;\n\n // now render the graphic..\n CanvasGraphics.renderGraphics(this, this._cachedSprite.buffer.context);\n\n this._cachedSprite.alpha = this.alpha;\n};\n*/\n/**\n * Updates texture size based on canvas size\n *\n * @private\n */\n/*\nGraphics.prototype.updateCachedSpriteTexture = function ()\n{\n var cachedSprite = this._cachedSprite;\n var texture = cachedSprite.texture;\n var canvas = cachedSprite.buffer.canvas;\n\n texture.baseTexture.width = canvas.width;\n texture.baseTexture.height = canvas.height;\n texture.crop.width = texture.frame.width = canvas.width;\n texture.crop.height = texture.frame.height = canvas.height;\n\n cachedSprite._width = canvas.width;\n cachedSprite._height = canvas.height;\n\n // update the dirty base textures\n texture.baseTexture.dirty();\n};*/\n\n/**\n * Destroys a previous cached sprite.\n *\n */\n/*\nGraphics.prototype.destroyCachedSprite = function ()\n{\n this._cachedSprite.texture.destroy(true);\n\n // let the gc collect the unused sprite\n // TODO could be object pooled!\n this._cachedSprite = null;\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 shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.\n * @return {GraphicsData} The generated GraphicsData object.\n */\nGraphics.prototype.drawShape = function (shape)\n{\n if (this.currentPath)\n {\n // check current path!\n if (this.currentPath.shape.points.length <= 2)\n {\n this.graphicsData.pop();\n }\n }\n\n this.currentPath = null;\n\n var data = new GraphicsData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.filling, shape);\n\n this.graphicsData.push(data);\n\n if (data.type === CONST.SHAPES.POLY)\n {\n data.shape.closed = this.filling;\n this.currentPath = data;\n }\n\n this.dirty = this.boundsDirty = true;\n\n return data;\n};\n\nGraphics.prototype.destroy = function () {\n Container.prototype.destroy.apply(this, arguments);\n\n // destroy each of the GraphicsData objects\n for (var i = 0; i < this.graphicsData.length; ++i) {\n this.graphicsData[i].destroy();\n }\n\n // for each webgl data entry, destroy the WebGLGraphicsData\n for (var id in this._webgl) {\n for (var j = 0; j < this._webgl[id].data.length; ++j) {\n this._webgl[id].data[j].destroy();\n }\n }\n\n this.graphicsData = null;\n\n this.currentPath = null;\n this._webgl = null;\n this._localBounds = null;\n};\n","/**\n * A GraphicsData object.\n *\n * @class\n * @memberof PIXI\n * @param lineWidth {number} the width of the line to draw\n * @param lineColor {number} the color of the line to draw\n * @param lineAlpha {number} the alpha of the line to draw\n * @param fillColor {number} the color of the fill\n * @param fillAlpha {number} the alpha of the fill\n * @param fill {boolean} whether or not the shape is filled with a colour\n * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.\n */\nfunction GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape)\n{\n /*\n * @member {number} the width of the line to draw\n */\n this.lineWidth = lineWidth;\n\n /*\n * @member {number} the color of the line to draw\n */\n this.lineColor = lineColor;\n /*\n * @member {number} the alpha of the line to draw\n */\n this.lineAlpha = lineAlpha;\n /*\n * @member {number} cached tint of the line to draw\n */\n this._lineTint = lineColor;\n\n /*\n * @member {number} the color of the fill\n */\n this.fillColor = fillColor;\n\n /*\n * @member {number} the alpha of the fill\n */\n this.fillAlpha = fillAlpha;\n\n /*\n * @member {number} cached tint of the fill\n */\n this._fillTint = fillColor;\n\n /*\n * @member {boolean} whether or not the shape is filled with a colour\n */\n this.fill = fill;\n\n /*\n * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.\n */\n this.shape = shape;\n\n /*\n * @member {number} The type of the shape, see the Const.Shapes file for all the existing types,\n */\n this.type = shape.type;\n}\n\nGraphicsData.prototype.constructor = GraphicsData;\nmodule.exports = GraphicsData;\n\n/**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {GraphicsData}\n */\nGraphicsData.prototype.clone = function ()\n{\n return new GraphicsData(\n this.lineWidth,\n this.lineColor,\n this.lineAlpha,\n this.fillColor,\n this.fillAlpha,\n this.fill,\n this.shape\n );\n};\n\nGraphicsData.prototype.destroy = function () {\n this.shape = null;\n};\n","var utils = require('../../utils'),\n math = require('../../math'),\n CONST = require('../../const'),\n ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'),\n WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'),\n WebGLGraphicsData = require('./WebGLGraphicsData'),\n earcut = require('earcut');\n\n/**\n * Renders the graphics object.\n *\n * @class\n * @private\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n * @param renderer {WebGLRenderer} The renderer this object renderer works for.\n */\nfunction GraphicsRenderer(renderer)\n{\n ObjectRenderer.call(this, renderer);\n\n this.graphicsDataPool = [];\n\n this.primitiveShader = null;\n this.complexPrimitiveShader = null;\n}\n\nGraphicsRenderer.prototype = Object.create(ObjectRenderer.prototype);\nGraphicsRenderer.prototype.constructor = GraphicsRenderer;\nmodule.exports = GraphicsRenderer;\n\nWebGLRenderer.registerPlugin('graphics', GraphicsRenderer);\n\n/**\n * Called when there is a WebGL context change\n *\n * @private\n *\n */\nGraphicsRenderer.prototype.onContextChange = function()\n{\n\n};\n\n/**\n * Destroys this renderer.\n *\n */\nGraphicsRenderer.prototype.destroy = function () {\n ObjectRenderer.prototype.destroy.call(this);\n\n for (var i = 0; i < this.graphicsDataPool.length; ++i) {\n this.graphicsDataPool[i].destroy();\n }\n\n this.graphicsDataPool = null;\n};\n\n/**\n * Renders a graphics object.\n *\n * @param graphics {Graphics} The graphics object to render.\n */\nGraphicsRenderer.prototype.render = function(graphics)\n{\n var renderer = this.renderer;\n var gl = renderer.gl;\n\n var shader = renderer.shaderManager.plugins.primitiveShader,\n webGLData;\n\n if (graphics.dirty)\n {\n this.updateGraphics(graphics, gl);\n }\n\n var webGL = graphics._webGL[gl.id];\n\n // This could be speeded up for sure!\n\n renderer.blendModeManager.setBlendMode( graphics.blendMode );\n\n// var matrix = graphics.worldTransform.clone();\n// var matrix = renderer.currentRenderTarget.projectionMatrix.clone();\n// matrix.append(graphics.worldTransform);\n\n for (var i = 0; i < webGL.data.length; i++)\n {\n if (webGL.data[i].mode === 1)\n {\n webGLData = webGL.data[i];\n\n renderer.stencilManager.pushStencil(graphics, webGLData, renderer);\n\n gl.uniform1f(renderer.shaderManager.complexPrimitiveShader.uniforms.alpha._location, graphics.worldAlpha * webGLData.alpha);\n\n // render quad..\n gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 );\n\n renderer.stencilManager.popStencil(graphics, webGLData, renderer);\n }\n else\n {\n webGLData = webGL.data[i];\n\n\n shader = renderer.shaderManager.primitiveShader;\n\n renderer.shaderManager.setShader( shader );//activatePrimitiveShader();\n\n gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, graphics.worldTransform.toArray(true));\n\n gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, renderer.currentRenderTarget.projectionMatrix.toArray(true));\n\n gl.uniform3fv(shader.uniforms.tint._location, utils.hex2rgb(graphics.tint));\n\n gl.uniform1f(shader.uniforms.alpha._location, graphics.worldAlpha);\n\n\n gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer);\n\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0);\n gl.vertexAttribPointer(shader.attributes.aColor, 4, gl.FLOAT, false,4 * 6, 2 * 4);\n\n // set the index buffer!\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, webGLData.indexBuffer);\n gl.drawElements(gl.TRIANGLE_STRIP, webGLData.indices.length, gl.UNSIGNED_SHORT, 0 );\n }\n }\n};\n\n/**\n * Updates the graphics object\n *\n * @private\n * @param graphicsData {Graphics} The graphics object to update\n */\nGraphicsRenderer.prototype.updateGraphics = function(graphics)\n{\n var gl = this.renderer.gl;\n\n // get the contexts graphics object\n var webGL = graphics._webGL[gl.id];\n\n // if the graphics object does not exist in the webGL context time to create it!\n if (!webGL)\n {\n webGL = graphics._webGL[gl.id] = {lastIndex:0, data:[], gl:gl};\n }\n\n // flag the graphics as not dirty as we are about to update it...\n graphics.dirty = false;\n\n var i;\n\n // if the user cleared the graphics object we will need to clear every object\n if (graphics.clearDirty)\n {\n graphics.clearDirty = false;\n\n // loop through and return all the webGLDatas to the object pool so than can be reused later on\n for (i = 0; i < webGL.data.length; i++)\n {\n var graphicsData = webGL.data[i];\n graphicsData.reset();\n this.graphicsDataPool.push( graphicsData );\n }\n\n // clear the array and reset the index..\n webGL.data = [];\n webGL.lastIndex = 0;\n }\n\n var webGLData;\n\n // loop through the graphics datas and construct each one..\n // if the object is a complex fill then the new stencil buffer technique will be used\n // other wise graphics objects will be pushed into a batch..\n for (i = webGL.lastIndex; i < graphics.graphicsData.length; i++)\n {\n var data = graphics.graphicsData[i];\n\n if (data.type === CONST.SHAPES.POLY)\n {\n // need to add the points the the graphics object..\n data.points = data.shape.points.slice();\n if (data.shape.closed)\n {\n // close the poly if the value is true!\n if (data.points[0] !== data.points[data.points.length-2] || data.points[1] !== data.points[data.points.length-1])\n {\n data.points.push(data.points[0], data.points[1]);\n }\n }\n\n // MAKE SURE WE HAVE THE CORRECT TYPE..\n if (data.fill)\n {\n if (data.points.length >= 6)\n {\n if (data.points.length < 6 * 2)\n {\n webGLData = this.switchMode(webGL, 0);\n\n var canDrawUsingSimple = this.buildPoly(data, webGLData);\n // console.log(canDrawUsingSimple);\n\n if (!canDrawUsingSimple)\n {\n // console.log(\"<>>>\")\n webGLData = this.switchMode(webGL, 1);\n this.buildComplexPoly(data, webGLData);\n }\n\n }\n else\n {\n webGLData = this.switchMode(webGL, 1);\n this.buildComplexPoly(data, webGLData);\n }\n }\n }\n\n if (data.lineWidth > 0)\n {\n webGLData = this.switchMode(webGL, 0);\n this.buildLine(data, webGLData);\n }\n }\n else\n {\n webGLData = this.switchMode(webGL, 0);\n\n if (data.type === CONST.SHAPES.RECT)\n {\n this.buildRectangle(data, webGLData);\n }\n else if (data.type === CONST.SHAPES.CIRC || data.type === CONST.SHAPES.ELIP)\n {\n this.buildCircle(data, webGLData);\n }\n else if (data.type === CONST.SHAPES.RREC)\n {\n this.buildRoundedRectangle(data, webGLData);\n }\n }\n\n webGL.lastIndex++;\n }\n\n // upload all the dirty data...\n for (i = 0; i < webGL.data.length; i++)\n {\n webGLData = webGL.data[i];\n\n if (webGLData.dirty)\n {\n webGLData.upload();\n }\n }\n};\n\n/**\n *\n *\n * @private\n * @param webGL {WebGLRenderingContext} the current WebGL drawing context\n * @param type {number} TODO @Alvin\n */\nGraphicsRenderer.prototype.switchMode = function (webGL, type)\n{\n var webGLData;\n\n if (!webGL.data.length)\n {\n webGLData = this.graphicsDataPool.pop() || new WebGLGraphicsData(webGL.gl);\n webGLData.mode = type;\n webGL.data.push(webGLData);\n }\n else\n {\n webGLData = webGL.data[webGL.data.length-1];\n\n if ((webGLData.points.length > 320000) || webGLData.mode !== type || type === 1)\n {\n webGLData = this.graphicsDataPool.pop() || new WebGLGraphicsData(webGL.gl);\n webGLData.mode = type;\n webGL.data.push(webGLData);\n }\n }\n\n webGLData.dirty = true;\n\n return webGLData;\n};\n\n/**\n * Builds a rectangle to draw\n *\n * @private\n * @param graphicsData {Graphics} The graphics object containing all the necessary properties\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildRectangle = function (graphicsData, webGLData)\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 if (graphicsData.fill)\n {\n var color = utils.hex2rgb(graphicsData.fillColor);\n var alpha = graphicsData.fillAlpha;\n\n var r = color[0] * alpha;\n var g = color[1] * alpha;\n var b = color[2] * alpha;\n\n var verts = webGLData.points;\n var indices = webGLData.indices;\n\n var vertPos = verts.length/6;\n\n // start\n verts.push(x, y);\n verts.push(r, g, b, alpha);\n\n verts.push(x + width, y);\n verts.push(r, g, b, alpha);\n\n verts.push(x , y + height);\n verts.push(r, g, b, alpha);\n\n verts.push(x + width, y + height);\n verts.push(r, g, b, alpha);\n\n // insert 2 dead triangles..\n indices.push(vertPos, vertPos, vertPos+1, vertPos+2, vertPos+3, vertPos+3);\n }\n\n if (graphicsData.lineWidth)\n {\n var tempPoints = graphicsData.points;\n\n graphicsData.points = [x, y,\n x + width, y,\n x + width, y + height,\n x, y + height,\n x, y];\n\n\n this.buildLine(graphicsData, webGLData);\n\n graphicsData.points = tempPoints;\n }\n};\n\n/**\n * Builds a rounded rectangle to draw\n *\n * @private\n * @param graphicsData {Graphics} The graphics object containing all the necessary properties\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildRoundedRectangle = function (graphicsData, webGLData)\n{\n var rrectData = graphicsData.shape;\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 var recPoints = [];\n recPoints.push(x, y + radius);\n this.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints);\n this.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints);\n this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints);\n this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints);\n\n // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n\n if (graphicsData.fill)\n {\n var color = utils.hex2rgb(graphicsData.fillColor);\n var alpha = graphicsData.fillAlpha;\n\n var r = color[0] * alpha;\n var g = color[1] * alpha;\n var b = color[2] * alpha;\n\n var verts = webGLData.points;\n var indices = webGLData.indices;\n\n var vecPos = verts.length/6;\n\n var triangles = earcut(recPoints, null, 2);\n\n var i = 0;\n for (i = 0; i < triangles.length; 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 (i = 0; i < recPoints.length; i++)\n {\n verts.push(recPoints[i], recPoints[++i], r, g, b, alpha);\n }\n }\n\n if (graphicsData.lineWidth)\n {\n var tempPoints = graphicsData.points;\n\n graphicsData.points = recPoints;\n\n this.buildLine(graphicsData, webGLData);\n\n graphicsData.points = tempPoints;\n }\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 * @private\n * @param fromX {number} Origin point x\n * @param fromY {number} Origin point x\n * @param cpX {number} Control point x\n * @param cpY {number} Control point y\n * @param toX {number} Destination point x\n * @param toY {number} Destination point y\n * @param [out] {number[]} The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nGraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out)\n{\n var xa,\n ya,\n xb,\n yb,\n x,\n y,\n n = 20,\n points = out || [];\n\n function getPt(n1 , n2, perc) {\n var diff = n2 - n1;\n\n return n1 + ( diff * perc );\n }\n\n var j = 0;\n for (var i = 0; i <= n; i++ ) {\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 circle to draw\n *\n * @private\n * @param graphicsData {Graphics} The graphics object to draw\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildCircle = function (graphicsData, webGLData)\n{\n // need to convert points to a nice regular data\n var circleData = graphicsData.shape;\n var x = circleData.x;\n var y = circleData.y;\n var width;\n var height;\n\n // TODO - bit hacky??\n if (graphicsData.type === CONST.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 var totalSegs = 40;\n var seg = (Math.PI * 2) / totalSegs ;\n\n var i = 0;\n\n if (graphicsData.fill)\n {\n var color = utils.hex2rgb(graphicsData.fillColor);\n var alpha = graphicsData.fillAlpha;\n\n var r = color[0] * alpha;\n var g = color[1] * alpha;\n var b = color[2] * alpha;\n\n var verts = webGLData.points;\n var indices = webGLData.indices;\n\n var vecPos = verts.length/6;\n\n indices.push(vecPos);\n\n for (i = 0; i < totalSegs + 1 ; i++)\n {\n verts.push(x,y, r, g, b, alpha);\n\n verts.push(x + Math.sin(seg * i) * width,\n y + Math.cos(seg * i) * height,\n r, g, b, alpha);\n\n indices.push(vecPos++, vecPos++);\n }\n\n indices.push(vecPos-1);\n }\n\n if (graphicsData.lineWidth)\n {\n var tempPoints = graphicsData.points;\n\n graphicsData.points = [];\n\n for (i = 0; i < totalSegs + 1; i++)\n {\n graphicsData.points.push(x + Math.sin(seg * i) * width,\n y + Math.cos(seg * i) * height);\n }\n\n this.buildLine(graphicsData, webGLData);\n\n graphicsData.points = tempPoints;\n }\n};\n\n/**\n * Builds a line to draw\n *\n * @private\n * @param graphicsData {Graphics} The graphics object containing all the necessary properties\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildLine = function (graphicsData, webGLData)\n{\n // TODO OPTIMISE!\n var i = 0;\n var points = graphicsData.points;\n\n if (points.length === 0)\n {\n return;\n }\n\n // if the line width is an odd number add 0.5 to align to a whole pixel\n if (graphicsData.lineWidth%2)\n {\n for (i = 0; i < points.length; i++)\n {\n points[i] += 0.5;\n }\n }\n\n // get first and last point.. figure out the middle!\n var firstPoint = new math.Point(points[0], points[1]);\n var lastPoint = new math.Point(points[points.length - 2], points[points.length - 1]);\n\n // if the first point is the last point - gonna have issues :)\n if (firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n points.pop();\n points.pop();\n\n lastPoint = new math.Point(points[points.length - 2], points[points.length - 1]);\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 = webGLData.points;\n var indices = webGLData.indices;\n var length = points.length / 2;\n var indexCount = points.length;\n var indexStart = verts.length/6;\n\n // DRAW the Line\n var width = graphicsData.lineWidth / 2;\n\n // sort color\n var color = utils.hex2rgb(graphicsData.lineColor);\n var alpha = graphicsData.lineAlpha;\n var r = color[0] * alpha;\n var g = color[1] * alpha;\n var b = color[2] * alpha;\n\n var px, py, p1x, p1y, p2x, p2y, p3x, p3y;\n var perpx, perpy, perp2x, perp2y, perp3x, perp3y;\n var a1, b1, c1, a2, b2, c2;\n var denom, pdist, dist;\n\n p1x = points[0];\n p1y = points[1];\n\n p2x = points[2];\n p2y = points[3];\n\n perpx = -(p1y - p2y);\n perpy = p1x - p2x;\n\n dist = Math.sqrt(perpx*perpx + perpy*perpy);\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n // start\n verts.push(p1x - perpx , p1y - perpy,\n r, g, b, alpha);\n\n verts.push(p1x + perpx , p1y + perpy,\n r, g, b, alpha);\n\n for (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 a1 = (-perpy + p1y) - (-perpy + p2y);\n b1 = (-perpx + p2x) - (-perpx + p1x);\n c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y);\n a2 = (-perp2y + p3y) - (-perp2y + p2y);\n b2 = (-perp2x + p2x) - (-perp2x + p3x);\n c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y);\n\n denom = a1*b2 - a2*b1;\n\n if (Math.abs(denom) < 0.1 )\n {\n\n denom+=10.1;\n verts.push(p2x - perpx , p2y - perpy,\n r, g, b, alpha);\n\n verts.push(p2x + perpx , p2y + perpy,\n r, g, b, alpha);\n\n continue;\n }\n\n px = (b1*c2 - b2*c1)/denom;\n py = (a2*c1 - a1*c2)/denom;\n\n\n pdist = (px -p2x) * (px -p2x) + (py -p2y) + (py -p2y);\n\n\n if (pdist > 140 * 140)\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, p2y -perp3y);\n verts.push(r, g, b, alpha);\n\n verts.push(p2x + perp3x, p2y +perp3y);\n verts.push(r, g, b, alpha);\n\n verts.push(p2x - perp3x, p2y -perp3y);\n verts.push(r, g, b, alpha);\n\n indexCount++;\n }\n else\n {\n\n verts.push(px , py);\n verts.push(r, g, b, alpha);\n\n verts.push(p2x - (px-p2x), p2y - (py - p2y));\n verts.push(r, g, b, alpha);\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 , p2y - perpy);\n verts.push(r, g, b, alpha);\n\n verts.push(p2x + perpx , p2y + perpy);\n verts.push(r, g, b, alpha);\n\n indices.push(indexStart);\n\n for (i = 0; i < indexCount; i++)\n {\n indices.push(indexStart++);\n }\n\n indices.push(indexStart-1);\n};\n\n/**\n * Builds a complex polygon to draw\n *\n * @private\n * @param graphicsData {Graphics} The graphics object containing all the necessary properties\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildComplexPoly = function (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 webGLData.points = points;\n webGLData.alpha = graphicsData.fillAlpha;\n webGLData.color = utils.hex2rgb(graphicsData.fillColor);\n\n // calclate the bounds..\n var minX = Infinity;\n var maxX = -Infinity;\n\n var minY = Infinity;\n var maxY = -Infinity;\n\n var x,y;\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 aint needed!\n var length = points.length / 2;\n for (i = 0; i < length; i++)\n {\n indices.push( i );\n }\n\n};\n\n/**\n * Builds a polygon to draw\n *\n * @private\n * @param graphicsData {WebGLGraphicsData} The graphics object containing all the necessary properties\n * @param webGLData {object} an object containing all the webGL-specific information to create this shape\n */\nGraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData)\n{\n var points = graphicsData.points;\n\n if (points.length < 6)\n {\n return;\n }\n\n // get first and last point.. figure out the middle!\n var verts = webGLData.points;\n var indices = webGLData.indices;\n\n var length = points.length / 2;\n\n // sort color\n var color = utils.hex2rgb(graphicsData.fillColor);\n var alpha = graphicsData.fillAlpha;\n var r = color[0] * alpha;\n var g = color[1] * alpha;\n var b = color[2] * alpha;\n\n var triangles = earcut(points, null, 2);\n\n if (!triangles) {\n return false;\n }\n\n var vertPos = verts.length / 6;\n\n var i = 0;\n\n for (i = 0; i < triangles.length; i+=3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i+1] + vertPos);\n indices.push(triangles[i+2] +vertPos);\n indices.push(triangles[i+2] + vertPos);\n }\n\n for (i = 0; i < length; i++)\n {\n verts.push(points[i * 2], points[i * 2 + 1],\n r, g, b, alpha);\n }\n\n return true;\n};\n","/**\n * An object containing WebGL specific properties to be used by the WebGL renderer\n *\n * @class\n * @memberof PIXI\n * @param gl {WebGLRenderingContext} the current WebGL drawing context\n * @private\n */\nfunction WebGLGraphicsData(gl) {\n\n /**\n * The current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n //TODO does this need to be split before uploding??\n /**\n * An array of color components (r,g,b)\n * @member {Array}\n */\n this.color = [0,0,0]; // color split!\n\n /**\n * An array of points to draw\n * @member {Array}\n */\n this.points = [];\n\n /**\n * The indices of the vertices\n * @member {Array}\n */\n this.indices = [];\n /**\n * The main buffer\n * @member {WebGLBuffer}\n */\n this.buffer = gl.createBuffer();\n\n /**\n * The index buffer\n * @member {WebGLBuffer}\n */\n this.indexBuffer = gl.createBuffer();\n\n /**\n * todo @alvin\n * @member {number}\n */\n this.mode = 1;\n\n /**\n * The alpha of the graphics\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * Whether this graphics is dirty or not\n * @member {boolean}\n */\n this.dirty = true;\n\n this.glPoints = null;\n this.glIndices = null;\n}\n\nWebGLGraphicsData.prototype.constructor = WebGLGraphicsData;\nmodule.exports = WebGLGraphicsData;\n\n/**\n * Resets the vertices and the indices\n */\nWebGLGraphicsData.prototype.reset = function () {\n this.points.length = 0;\n this.indices.length = 0;\n};\n\n/**\n * Binds the buffers and uploads the data\n */\nWebGLGraphicsData.prototype.upload = function () {\n var gl = this.gl;\n\n// this.lastIndex = graphics.graphicsData.length;\n this.glPoints = new Float32Array(this.points);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);\n gl.bufferData(gl.ARRAY_BUFFER, this.glPoints, gl.STATIC_DRAW);\n\n this.glIndices = new Uint16Array(this.indices);\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndices, gl.STATIC_DRAW);\n\n this.dirty = false;\n};\n\nWebGLGraphicsData.prototype.destroy = function () {\n this.gl = null;\n this.color = null;\n this.points = null;\n this.indices = null;\n\n this.gl.deleteBuffer(this.buffer);\n this.gl.deleteBuffer(this.indexBuffer);\n\n this.buffer = null;\n this.indexBuffer = null;\n\n this.glPoints = null;\n this.glIndices = null;\n};\n","/**\n * @file Main export of the PIXI core library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI\n */\n// export core and const. We assign core to const so that the non-reference types in const remain in-tact\nvar core = module.exports = Object.assign(require('./const'), require('./math'), {\n // utils\n utils: require('./utils'),\n math: require('./math'),\n ticker: require('./ticker'),\n\n // display\n DisplayObject: require('./display/DisplayObject'),\n Container: require('./display/Container'),\n\n // sprites\n Sprite: require('./sprites/Sprite'),\n ParticleContainer: require('./particles/ParticleContainer'),\n SpriteRenderer: require('./sprites/webgl/SpriteRenderer'),\n ParticleRenderer: require('./particles/webgl/ParticleRenderer'),\n\n // text\n Text: require('./text/Text'),\n\n // primitives\n Graphics: require('./graphics/Graphics'),\n GraphicsData: require('./graphics/GraphicsData'),\n GraphicsRenderer: require('./graphics/webgl/GraphicsRenderer'),\n\n // textures\n Texture: require('./textures/Texture'),\n BaseTexture: require('./textures/BaseTexture'),\n RenderTexture: require('./textures/RenderTexture'),\n VideoBaseTexture: require('./textures/VideoBaseTexture'),\n TextureUvs: require('./textures/TextureUvs'),\n\n // renderers - canvas\n CanvasRenderer: require('./renderers/canvas/CanvasRenderer'),\n CanvasGraphics: require('./renderers/canvas/utils/CanvasGraphics'),\n CanvasBuffer: require('./renderers/canvas/utils/CanvasBuffer'),\n\n // renderers - webgl\n WebGLRenderer: require('./renderers/webgl/WebGLRenderer'),\n ShaderManager: require('./renderers/webgl/managers/ShaderManager'),\n Shader: require('./renderers/webgl/shaders/Shader'),\n ObjectRenderer: require('./renderers/webgl/utils/ObjectRenderer'),\n RenderTarget: require('./renderers/webgl/utils/RenderTarget'),\n\n // filters - webgl\n AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'),\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 * @param width=800 {number} the width of the renderers view\n * @param height=600 {number} the height of the renderers view\n * @param [options] {object} The optional renderer parameters\n * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional\n * @param [options.transparent=false] {boolean} If the render view is transparent, default false\n * @param [options.antialias=false] {boolean} sets antialias (only applicable in chrome at the moment)\n * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param [options.resolution=1] {number} the resolution of the renderer, retina would be 2\n * @param [noWebGL=false] {boolean} prevents selection of WebGL renderer, even if such is present\n *\n * @return {WebGLRenderer|CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\n autoDetectRenderer: function (width, height, options, noWebGL)\n {\n width = width || 800;\n height = height || 600;\n\n if (!noWebGL && core.utils.isWebGLSupported())\n {\n return new core.WebGLRenderer(width, height, options);\n }\n\n return new core.CanvasRenderer(width, height, options);\n }\n});\n","var Point = require('./Point');\n\n/**\n * The pixi Matrix class as an object, which makes it a lot faster,\n * here is a representation of it :\n * | a | b | tx|\n * | c | d | ty|\n * | 0 | 0 | 1 |\n *\n * @class\n * @memberof PIXI\n */\nfunction Matrix()\n{\n /**\n * @member {number}\n * @default 1\n */\n this.a = 1;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = 0;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = 1;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = 0;\n}\n\nMatrix.prototype.constructor = Matrix;\nmodule.exports = Matrix;\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 array {number[]} The array that the matrix will be populated from.\n */\nMatrix.prototype.fromArray = function (array)\n{\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/**\n * Creates an array from the current Matrix object.\n *\n * @param transpose {boolean} Whether we need to transpose the matrix or not\n * @return {number[]} the newly created array which contains the matrix\n */\nMatrix.prototype.toArray = function (transpose)\n{\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n var array = this.array;\n\n if (transpose)\n {\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 {\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\n return array;\n};\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 pos {Point} The origin\n * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input)\n * @return {Point} The new point, transformed through this matrix\n */\nMatrix.prototype.apply = function (pos, newPos)\n{\n newPos = newPos || new Point();\n\n var x = pos.x;\n var y = pos.y;\n\n newPos.x = this.a * x + this.c * y + this.tx;\n newPos.y = this.b * x + this.d * y + this.ty;\n\n return newPos;\n};\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 pos {Point} The origin\n * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input)\n * @return {Point} The new point, inverse-transformed through this matrix\n */\nMatrix.prototype.applyInverse = function (pos, newPos)\n{\n newPos = newPos || new Point();\n\n var id = 1 / (this.a * this.d + this.c * -this.b);\n\n var x = pos.x;\n var y = pos.y;\n\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\n return newPos;\n};\n\n/**\n * Translates the matrix on the x and y.\n *\n * @param {number} x\n * @param {number} y\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.translate = function (x, y)\n{\n this.tx += x;\n this.ty += y;\n\n return this;\n};\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 {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.scale = function (x, y)\n{\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\n return this;\n};\n\n\n/**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.rotate = function (angle)\n{\n var cos = Math.cos( angle );\n var sin = Math.sin( angle );\n\n var a1 = this.a;\n var c1 = this.c;\n var tx1 = this.tx;\n\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\n return this;\n};\n\n/**\n * Appends the given Matrix to this Matrix.\n *\n * @param {Matrix} matrix\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.append = function (matrix)\n{\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n\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\n this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx;\n this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty;\n\n return this;\n};\n\n/**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {Matrix} matrix\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.prepend = function(matrix)\n{\n var tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\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\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\n return this;\n};\n\n/**\n * Inverts this matrix\n *\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.invert = function()\n{\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\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\n return this;\n};\n\n\n/**\n * Resets this Matix to an identity (default) matrix.\n *\n * @return {Matrix} This matrix. Good for chaining method calls.\n */\nMatrix.prototype.identity = function ()\n{\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\n return this;\n};\n\n/**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {Matrix} A copy of this matrix. Good for chaining method calls.\n */\nMatrix.prototype.clone = function ()\n{\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\n return matrix;\n};\n\n/**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @return {Matrix} The matrix given in parameter with its values updated.\n */\nMatrix.prototype.copy = function (matrix)\n{\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\n return matrix;\n};\n\n/**\n * A default (identity) matrix\n */\nMatrix.IDENTITY = new Matrix();\n/**\n * A temp matrix\n */\nMatrix.TEMP_MATRIX = new Matrix();\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 * @param [x=0] {number} position of the point on the x axis\n * @param [y=0] {number} position of the point on the y axis\n */\nfunction Point(x, y)\n{\n /**\n * @member {number}\n * @default 0\n */\n this.x = x || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y || 0;\n}\n\nPoint.prototype.constructor = Point;\nmodule.exports = Point;\n\n/**\n * Creates a clone of this point\n *\n * @return {Point} a copy of the point\n */\nPoint.prototype.clone = function ()\n{\n return new Point(this.x, this.y);\n};\n\n/**\n * Copies x and y from the given point\n *\n * @param p {Point}\n */\nPoint.prototype.copy = function (p) {\n this.set(p.x, p.y);\n};\n\n/**\n * Returns true if the given point is equal to this point\n *\n * @param p {Point}\n * @returns {boolean}\n */\nPoint.prototype.equals = function (p) {\n return (p.x === this.x) && (p.y === this.y);\n};\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 [x=0] {number} position of the point on the x axis\n * @param [y=0] {number} position of the point on the y axis\n */\nPoint.prototype.set = function (x, y)\n{\n this.x = x || 0;\n this.y = y || ( (y !== 0) ? this.x : 0 ) ;\n};\n","module.exports = {\n Point: require('./Point'),\n Matrix: require('./Matrix'),\n\n Circle: require('./shapes/Circle'),\n Ellipse: require('./shapes/Ellipse'),\n Polygon: require('./shapes/Polygon'),\n Rectangle: require('./shapes/Rectangle'),\n RoundedRectangle: require('./shapes/RoundedRectangle')\n};\n","var Rectangle = require('./Rectangle'),\n CONST = require('../../const');\n\n/**\n * The Circle object can be used to specify a hit area for displayObjects\n *\n * @class\n * @memberof PIXI\n * @param x {number} The X coordinate of the center of this circle\n * @param y {number} The Y coordinate of the center of this circle\n * @param radius {number} The radius of the circle\n */\nfunction Circle(x, y, radius)\n{\n /**\n * @member {number}\n * @default 0\n */\n this.x = x || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius || 0;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n */\n this.type = CONST.SHAPES.CIRC;\n}\n\nCircle.prototype.constructor = Circle;\nmodule.exports = Circle;\n\n/**\n * Creates a clone of this Circle instance\n *\n * @return {Circle} a copy of the Circle\n */\nCircle.prototype.clone = function ()\n{\n return new Circle(this.x, this.y, this.radius);\n};\n\n/**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param x {number} The X coordinate of the point to test\n * @param y {number} The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\nCircle.prototype.contains = function (x, y)\n{\n if (this.radius <= 0)\n {\n return false;\n }\n\n var dx = (this.x - x),\n dy = (this.y - y),\n r2 = this.radius * this.radius;\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n};\n\n/**\n* Returns the framing rectangle of the circle as a Rectangle object\n*\n* @return {Rectangle} the framing rectangle\n*/\nCircle.prototype.getBounds = function ()\n{\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n};\n","var Rectangle = require('./Rectangle'),\n CONST = require('../../const');\n\n/**\n * The Ellipse object can be used to specify a hit area for displayObjects\n *\n * @class\n * @memberof PIXI\n * @param x {number} The X coordinate of the center of the ellipse\n * @param y {number} The Y coordinate of the center of the ellipse\n * @param width {number} The half width of this ellipse\n * @param height {number} The half height of this ellipse\n */\nfunction Ellipse(x, y, width, height)\n{\n /**\n * @member {number}\n * @default 0\n */\n this.x = x || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height || 0;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n */\n this.type = CONST.SHAPES.ELIP;\n}\n\nEllipse.prototype.constructor = Ellipse;\nmodule.exports = Ellipse;\n\n/**\n * Creates a clone of this Ellipse instance\n *\n * @return {Ellipse} a copy of the ellipse\n */\nEllipse.prototype.clone = function ()\n{\n return new Ellipse(this.x, this.y, this.width, this.height);\n};\n\n/**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param x {number} The X coordinate of the point to test\n * @param y {number} The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\nEllipse.prototype.contains = function (x, y)\n{\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n //normalize the coords to an ellipse with center 0,0\n var normx = ((x - this.x) / this.width),\n normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n};\n\n/**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {Rectangle} the framing rectangle\n */\nEllipse.prototype.getBounds = function ()\n{\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n};\n","var Point = require('../Point'),\n CONST = require('../../const');\n\n/**\n * @class\n * @memberof PIXI\n * @param points {Point[]|number[]|...Point|...number} This can be an array of Points that form the polygon,\n * a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be\n * all the points of the polygon e.g. `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the\n * arguments passed can be flat x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are\n * Numbers.\n */\nfunction Polygon(points_)\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 = points_;\n\n //if points isn't an array, use arguments as the array\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 a = 0; a < points.length; ++a) {\n points[a] = arguments[a];\n }\n }\n\n // if this is an array of points, convert it to a flat array of numbers\n if (points[0] instanceof Point)\n {\n var p = [];\n for (var i = 0, il = points.length; i < il; i++)\n {\n p.push(points[i].x, points[i].y);\n }\n\n points = p;\n }\n\n this.closed = true;\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = points;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n */\n this.type = CONST.SHAPES.POLY;\n}\n\nPolygon.prototype.constructor = Polygon;\nmodule.exports = Polygon;\n\n/**\n * Creates a clone of this polygon\n *\n * @return {Polygon} a copy of the polygon\n */\nPolygon.prototype.clone = function ()\n{\n return new Polygon(this.points.slice());\n};\n\n/**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param x {number} The X coordinate of the point to test\n * @param y {number} The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\nPolygon.prototype.contains = function (x, y)\n{\n var inside = false;\n\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\n for (var i = 0, j = length - 1; i < length; j = i++)\n {\n var xi = this.points[i * 2], yi = this.points[i * 2 + 1],\n xj = this.points[j * 2], yj = this.points[j * 2 + 1],\n intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n};\n","var CONST = require('../../const');\n\n/**\n * the Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n * @param x {number} The X coordinate of the upper-left corner of the rectangle\n * @param y {number} The Y coordinate of the upper-left corner of the rectangle\n * @param width {number} The overall width of this rectangle\n * @param height {number} The overall height of this rectangle\n */\nfunction Rectangle(x, y, width, height)\n{\n /**\n * @member {number}\n * @default 0\n */\n this.x = x || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height || 0;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n */\n this.type = CONST.SHAPES.RECT;\n}\n\nRectangle.prototype.constructor = Rectangle;\nmodule.exports = Rectangle;\n\n/**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n */\nRectangle.EMPTY = new Rectangle(0, 0, 0, 0);\n\n\n/**\n * Creates a clone of this Rectangle\n *\n * @return {Rectangle} a copy of the rectangle\n */\nRectangle.prototype.clone = function ()\n{\n return new Rectangle(this.x, this.y, this.width, this.height);\n};\n\n/**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param x {number} The X coordinate of the point to test\n * @param y {number} The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\nRectangle.prototype.contains = function (x, y)\n{\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n};\n","var CONST = require('../../const');\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n * @param x {number} The X coordinate of the upper-left corner of the rounded rectangle\n * @param y {number} The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width {number} The overall width of this rounded rectangle\n * @param height {number} The overall height of this rounded rectangle\n * @param radius {number} Controls the radius of the rounded corners\n */\nfunction RoundedRectangle(x, y, width, height, radius)\n{\n /**\n * @member {number}\n * @default 0\n */\n this.x = x || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width || 0;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height || 0;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius || 20;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n */\n this.type = CONST.SHAPES.RREC;\n}\n\nRoundedRectangle.prototype.constructor = RoundedRectangle;\nmodule.exports = RoundedRectangle;\n\n/**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {RoundedRectangle} a copy of the rounded rectangle\n */\nRoundedRectangle.prototype.clone = function ()\n{\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n};\n\n/**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param x {number} The X coordinate of the point to test\n * @param y {number} The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\nRoundedRectangle.prototype.contains = function (x, y)\n{\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n};\n","var Container = require('../display/Container'),\n CONST = require('../const');\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. The tradeoff of the ParticleContainer is that advanced\n * functionality will not work. ParticleContainer implements only the basic object transform (position, scale, rotation).\n * Any other functionality like tinting, masking, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use :\n *\n * ```js\n * var container = new ParticleContainer();\n *\n * for (var i = 0; i < 100; ++i)\n * {\n * var sprite = new PIXI.Sprite.fromImage(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be renderer at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n *\n * @param [size=15000] {number} The number of images in the SpriteBatch before it flushes.\n * @param [properties] {object} The properties of children that should be uploaded to the gpu and applied.\n * @param [properties.scale=false] {boolean} When true, scale be uploaded and applied.\n * @param [properties.position=true] {boolean} When true, position be uploaded and applied.\n * @param [properties.rotation=false] {boolean} When true, rotation be uploaded and applied.\n * @param [properties.uvs=false] {boolean} When true, uvs be uploaded and applied.\n * @param [properties.alpha=false] {boolean} When true, alpha be uploaded and applied.\n */\nfunction ParticleContainer(size, properties)\n{\n Container.call(this);\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {array}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._size = size || 15000;\n\n /**\n * @member {WebGLBuffer}\n * @private\n */\n this._buffers = null;\n\n /**\n * @member {boolean}\n * @private\n */\n this._updateStatic = false;\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 blendModes.NORMAL to reset the blend mode.\n *\n * @member {number}\n * @default CONST.BLEND_MODES.NORMAL;\n */\n this.blendMode = CONST.BLEND_MODES.NORMAL;\n\n /**\n * Used for canvas renderering. If true then the elements will be positioned at the nearest pixel. This provides a nice speed boost.\n *\n * @member {boolean}\n * @default true;\n */\n this.roundPixels = true;\n\n this.setProperties(properties);\n}\n\nParticleContainer.prototype = Object.create(Container.prototype);\nParticleContainer.prototype.constructor = ParticleContainer;\nmodule.exports = ParticleContainer;\n\n/**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param properties {object} The properties to be uploaded\n */\nParticleContainer.prototype.setProperties = function(properties)\n{\n if ( properties ) {\n this._properties[0] = 'scale' in properties ? !!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] = 'alpha' in properties ? !!properties.alpha : this._properties[4];\n }\n};\n\n/**\n * Updates the object transform for rendering\n *\n * @private\n */\nParticleContainer.prototype.updateTransform = function ()\n{\n\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n // PIXI.Container.prototype.updateTransform.call( this );\n};\n\n/**\n * Renders the container using the WebGL renderer\n *\n * @param renderer {WebGLRenderer} The webgl renderer\n * @private\n */\nParticleContainer.prototype.renderWebGL = function (renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n renderer.setObjectRenderer( renderer.plugins.particle );\n renderer.plugins.particle.render( this );\n};\n\n/**\n * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param child {DisplayObject} The child to add\n * @param index {Number} The index to place the child in\n * @return {DisplayObject} The child that was added.\n */\nParticleContainer.prototype.addChildAt = function (child, index)\n{\n // prevent adding self as child\n if (child === this)\n {\n return child;\n }\n\n if (index >= 0 && index <= this.children.length)\n {\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n\n this.children.splice(index, 0, child);\n\n this._updateStatic = true;\n\n return child;\n }\n else\n {\n throw new Error(child + 'addChildAt: The index '+ index +' supplied is out of bounds ' + this.children.length);\n }\n};\n\n/**\n * Removes a child from the specified index position.\n *\n * @param index {Number} The index to get the child from\n * @return {DisplayObject} The child that was removed.\n */\nParticleContainer.prototype.removeChildAt = function (index)\n{\n var child = this.getChildAt(index);\n\n child.parent = null;\n this.children.splice(index, 1);\n this._updateStatic = true;\n\n return child;\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer} The canvas renderer\n * @private\n */\nParticleContainer.prototype.renderCanvas = function (renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n var context = renderer.context;\n var transform = this.worldTransform;\n var isRotated = true;\n\n var positionX = 0;\n var positionY = 0;\n\n var finalWidth = 0;\n var finalHeight = 0;\n\n context.globalAlpha = this.worldAlpha;\n\n this.displayObjectUpdateTransform();\n\n for (var i = 0; i < this.children.length; ++i)\n {\n var child = this.children[i];\n\n if (!child.visible)\n {\n continue;\n }\n\n var frame = child.texture.frame;\n\n context.globalAlpha = this.worldAlpha * child.alpha;\n\n if (child.rotation % (Math.PI * 2) === 0)\n {\n // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call\n if (isRotated)\n {\n context.setTransform(\n transform.a,\n transform.b,\n transform.c,\n transform.d,\n transform.tx,\n transform.ty\n );\n\n isRotated = false;\n }\n\n positionX = ((child.anchor.x) * (-frame.width * child.scale.x) + child.position.x + 0.5);\n positionY = ((child.anchor.y) * (-frame.height * child.scale.y) + child.position.y + 0.5);\n\n finalWidth = frame.width * child.scale.x;\n finalHeight = frame.height * child.scale.y;\n\n }\n else\n {\n if (!isRotated)\n {\n isRotated = true;\n }\n\n child.displayObjectUpdateTransform();\n\n var childTransform = child.worldTransform;\n\n if (renderer.roundPixels)\n {\n context.setTransform(\n childTransform.a,\n childTransform.b,\n childTransform.c,\n childTransform.d,\n childTransform.tx | 0,\n childTransform.ty | 0\n );\n }\n else\n {\n context.setTransform(\n childTransform.a,\n childTransform.b,\n childTransform.c,\n childTransform.d,\n childTransform.tx,\n childTransform.ty\n );\n }\n\n positionX = ((child.anchor.x) * (-frame.width) + 0.5);\n positionY = ((child.anchor.y) * (-frame.height) + 0.5);\n\n finalWidth = frame.width;\n finalHeight = frame.height;\n }\n\n context.drawImage(\n child.texture.baseTexture.source,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n positionX,\n positionY,\n finalWidth,\n finalHeight\n );\n }\n};\n\n/**\n * Destroys the container\n *\n * @param [destroyChildren=false] {boolean} if set to true, all the children will have their destroy method called as well\n */\nParticleContainer.prototype.destroy = function () {\n Container.prototype.destroy.apply(this, arguments);\n\n if (this._buffers) {\n for (var i = 0; i < this._buffers.length; ++i) {\n this._buffers.destroy();\n }\n }\n\n this._properties = null;\n this._buffers = null;\n};\n","\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original pixi version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer\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 *\n * @class\n * @private\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this sprite batch works for.\n */\nfunction ParticleBuffer(gl, properties, size)\n{\n /**\n * the current WebGL drawing context\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n /**\n *\n *\n * @member {number}\n */\n this.vertSize = 2;\n\n /**\n *\n *\n * @member {number}\n */\n this.vertByteSize = this.vertSize * 4;\n\n /**\n * The number of images in the SpriteBatch before it flushes.\n *\n * @member {number}\n */\n this.size = size;\n\n /**\n *\n *\n * @member {Array}\n */\n this.dynamicProperties = [];\n\n /**\n *\n *\n * @member {Array}\n */\n this.staticProperties = [];\n\n for (var i = 0; i < properties.length; i++)\n {\n var property = properties[i];\n\n if(property.dynamic)\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\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n\n this.initBuffers();\n\n}\n\nParticleBuffer.prototype.constructor = ParticleBuffer;\nmodule.exports = ParticleBuffer;\n\n/**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n * @param gl {WebGLRenderingContext} the current WebGL drawing context\n */\nParticleBuffer.prototype.initBuffers = function ()\n{\n var gl = this.gl;\n var i;\n var property;\n\n var dynamicOffset = 0;\n this.dynamicStride = 0;\n\n for (i = 0; i < this.dynamicProperties.length; i++)\n {\n property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n this.dynamicData = new Float32Array( this.size * this.dynamicStride * 4);\n this.dynamicBuffer = gl.createBuffer();\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.dynamicBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, this.dynamicData, gl.DYNAMIC_DRAW);\n\n\n // static //\n var staticOffset = 0;\n this.staticStride = 0;\n\n for (i = 0; i < this.staticProperties.length; i++)\n {\n property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n this.staticData = new Float32Array( this.size * this.staticStride * 4);\n this.staticBuffer = gl.createBuffer();\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.staticBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, this.staticData, gl.DYNAMIC_DRAW);\n\n};\n\nParticleBuffer.prototype.uploadDynamic = function(children, startIndex, amount)\n{\n var gl = this.gl;\n\n for (var i = 0; i < this.dynamicProperties.length; i++)\n {\n var property = this.dynamicProperties[i];\n property.uploadFunction(children, startIndex, amount, this.dynamicData, this.dynamicStride, property.offset);\n }\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.dynamicBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.dynamicData);\n};\n\nParticleBuffer.prototype.uploadStatic = function(children, startIndex, amount)\n{\n var gl = this.gl;\n\n for (var i = 0; i < this.staticProperties.length; i++)\n {\n var property = this.staticProperties[i];\n property.uploadFunction(children, startIndex, amount, this.staticData, this.staticStride, property.offset);\n }\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.staticBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staticData);\n};\n\n/**\n * Starts a new sprite batch.\n *\n */\nParticleBuffer.prototype.bind = function ()\n{\n var gl = this.gl;\n var i, property;\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.dynamicBuffer);\n\n for (i = 0; i < this.dynamicProperties.length; i++)\n {\n property = this.dynamicProperties[i];\n gl.vertexAttribPointer(property.attribute, property.size, gl.FLOAT, false, this.dynamicStride * 4, property.offset * 4);\n }\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.staticBuffer);\n\n for (i = 0; i < this.staticProperties.length; i++)\n {\n property = this.staticProperties[i];\n gl.vertexAttribPointer(property.attribute, property.size, gl.FLOAT, false, this.staticStride * 4, property.offset * 4);\n }\n};\n\n/**\n * Destroys the SpriteBatch.\n *\n */\nParticleBuffer.prototype.destroy = function ()\n{\n this.dynamicProperties = null;\n this.dynamicData = null;\n this.gl.deleteBuffer(this.dynamicBuffer);\n\n this.staticProperties = null;\n this.staticData = null;\n this.gl.deleteBuffer(this.staticBuffer);\n};\n","var ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'),\n WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'),\n ParticleShader = require('./ParticleShader'),\n ParticleBuffer = require('./ParticleBuffer'),\n math = require('../../math');\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original pixi version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer\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 *\n * @class\n * @private\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this sprite batch works for.\n */\nfunction ParticleRenderer(renderer)\n{\n ObjectRenderer.call(this, renderer);\n\n /**\n * The number of images in the Particle before it flushes.\n *\n * @member {number}\n */\n this.size = 15000;//CONST.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop\n\n var numIndices = this.size * 6;\n\n /**\n * Holds the indices\n *\n * @member {Uint16Array}\n */\n this.indices = new Uint16Array(numIndices);\n\n for (var i=0, j=0; i < numIndices; i += 6, j += 4)\n {\n this.indices[i + 0] = j + 0;\n this.indices[i + 1] = j + 1;\n this.indices[i + 2] = j + 2;\n this.indices[i + 3] = j + 0;\n this.indices[i + 4] = j + 2;\n this.indices[i + 5] = j + 3;\n }\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {Shader}\n */\n this.shader = null;\n\n this.indexBuffer = null;\n\n this.properties = null;\n\n this.tempMatrix = new math.Matrix();\n}\n\nParticleRenderer.prototype = Object.create(ObjectRenderer.prototype);\nParticleRenderer.prototype.constructor = ParticleRenderer;\nmodule.exports = ParticleRenderer;\n\nWebGLRenderer.registerPlugin('particle', ParticleRenderer);\n\n/**\n * When there is a WebGL context change\n *\n * @private\n *\n */\nParticleRenderer.prototype.onContextChange = function ()\n{\n var gl = this.renderer.gl;\n\n // setup default shader\n this.shader = new ParticleShader(this.renderer.shaderManager);\n\n this.indexBuffer = gl.createBuffer();\n\n // 65535 is max index, so 65535 / 6 = 10922.\n\n //upload the index data\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);\n\n this.properties = [\n // verticesData\n {\n attribute:this.shader.attributes.aVertexPosition,\n dynamic:false,\n size:2,\n uploadFunction:this.uploadVertices,\n offset:0\n },\n // positionData\n {\n attribute:this.shader.attributes.aPositionCoord,\n dynamic:true,\n size:2,\n uploadFunction:this.uploadPosition,\n offset:0\n },\n // rotationData\n {\n attribute:this.shader.attributes.aRotation,\n dynamic:false,\n size:1,\n uploadFunction:this.uploadRotation,\n offset:0\n },\n // uvsData\n {\n attribute:this.shader.attributes.aTextureCoord,\n dynamic:false,\n size:2,\n uploadFunction:this.uploadUvs,\n offset:0\n },\n // alphaData\n {\n attribute:this.shader.attributes.aColor,\n dynamic:false,\n size:1,\n uploadFunction:this.uploadAlpha,\n offset:0\n }\n ];\n};\n\n/**\n * Starts a new sprite batch.\n *\n */\nParticleRenderer.prototype.start = function ()\n{\n var gl = this.renderer.gl;\n\n // bind the main texture\n gl.activeTexture(gl.TEXTURE0);\n\n // bind the buffers\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\n var shader = this.shader;\n\n this.renderer.shaderManager.setShader(shader);\n};\n\n\n/**\n * Renders the sprite object.\n *\n * @param container {Container|Sprite} the sprite to render using this ParticleRenderer\n */\nParticleRenderer.prototype.render = function ( container )\n{\n var children = container.children,\n totalChildren = children.length,\n maxSize = container._size;\n\n if(totalChildren === 0)\n {\n return;\n }\n else if(totalChildren > maxSize)\n {\n totalChildren = maxSize;\n }\n\n if(!container._buffers)\n {\n container._buffers = this.generateBuffers( container );\n }\n\n\n\n // if the uvs have not updated then no point rendering just yet!\n this.renderer.blendModeManager.setBlendMode(container.blendMode);\n\n var gl = this.renderer.gl;\n\n var m = container.worldTransform.copy( this.tempMatrix );\n m.prepend( this.renderer.currentRenderTarget.projectionMatrix );\n gl.uniformMatrix3fv(this.shader.uniforms.projectionMatrix._location, false, m.toArray(true));\n gl.uniform1f(this.shader.uniforms.uAlpha._location, container.worldAlpha);\n\n\n // if this variable is true then we will upload the static contents as well as the dynamic contens\n var uploadStatic = container._updateStatic;\n\n // make sure the texture is bound..\n var baseTexture = children[0]._texture.baseTexture;\n\n if (!baseTexture._glTextures[gl.id])\n {\n // if the texture has not updated then lets not upload any static properties\n if(!this.renderer.updateTexture(baseTexture))\n {\n return;\n }\n\n if(!this.properties[0].dynamic || !this.properties[3].dynamic)\n {\n uploadStatic = true;\n }\n }\n else\n {\n gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id]);\n }\n\n // now lets upload and render the buffers..\n var j = 0;\n for (var i = 0; i < totalChildren; i+=this.size)\n {\n var amount = ( totalChildren - i);\n if(amount > this.size)\n {\n amount = this.size;\n }\n\n var buffer = container._buffers[j++];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n // we only upload the static content when we have to!\n if(uploadStatic)\n {\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n buffer.bind( this.shader );\n\n // now draw those suckas!\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n this.renderer.drawCount++;\n }\n\n container._updateStatic = false;\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 container {Container|Sprite} the sprite to render using this ParticleRenderer\n */\nParticleRenderer.prototype.generateBuffers = function ( container )\n{\n var gl = this.renderer.gl,\n buffers = [],\n size = container._size,\n i;\n\n // update the properties to match the state of the container..\n for (i = 0; i < container._properties.length; i++)\n {\n this.properties[i].dynamic = container._properties[i];\n }\n\n for (i = 0; i < size; i += this.size)\n {\n buffers.push( new ParticleBuffer(gl, this.properties, this.size, this.shader) );\n }\n\n return buffers;\n};\n\n\n/**\n *\n * @param children {Array} the array of display objects to render\n * @param startIndex {number} the index to start from in the children array\n * @param amount {number} the amount of children that will have their vertices uploaded\n * @param array {Array}\n * @param stride {number}\n * @param offset {number}\n */\nParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset)\n{\n var sprite,\n texture,\n trim,\n sx,\n sy,\n w0, w1, h0, h1;\n\n for (var i = 0; i < amount; i++) {\n\n sprite = children[startIndex + i];\n texture = sprite._texture;\n sx = sprite.scale.x;\n sy = sprite.scale.y;\n\n if (texture.trim)\n {\n // if the sprite is trimmed then we need to add the extra space before transforming the sprite coords..\n trim = texture.trim;\n\n w1 = trim.x - sprite.anchor.x * trim.width;\n w0 = w1 + texture.crop.width;\n\n h1 = trim.y - sprite.anchor.y * trim.height;\n h0 = h1 + texture.crop.height;\n }\n else\n {\n w0 = (texture._frame.width ) * (1-sprite.anchor.x);\n w1 = (texture._frame.width ) * -sprite.anchor.x;\n\n h0 = texture._frame.height * (1-sprite.anchor.y);\n h1 = texture._frame.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/**\n *\n * @param children {Array} the array of display objects to render\n * @param startIndex {number} the index to start from in the children array\n * @param amount {number} the amount of children that will have their positions uploaded\n * @param array {Array}\n * @param stride {number}\n * @param offset {number}\n */\nParticleRenderer.prototype.uploadPosition = function (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/**\n *\n * @param children {Array} the array of display objects to render\n * @param startIndex {number} the index to start from in the children array\n * @param amount {number} the amount of children that will have their rotation uploaded\n * @param array {Array}\n * @param stride {number}\n * @param offset {number}\n */\nParticleRenderer.prototype.uploadRotation = function (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\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 *\n * @param children {Array} the array of display objects to render\n * @param startIndex {number} the index to start from in the children array\n * @param amount {number} the amount of children that will have their Uvs uploaded\n * @param array {Array}\n * @param stride {number}\n * @param offset {number}\n */\nParticleRenderer.prototype.uploadUvs = function (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 *\n * @param children {Array} the array of display objects to render\n * @param startIndex {number} the index to start from in the children array\n * @param amount {number} the amount of children that will have their alpha uploaded\n * @param array {Array}\n * @param stride {number}\n * @param offset {number}\n */\nParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset)\n{\n for (var i = 0; i < amount; i++)\n {\n var spriteAlpha = children[startIndex + i].alpha;\n\n array[offset] = spriteAlpha;\n array[offset + stride] = spriteAlpha;\n array[offset + stride * 2] = spriteAlpha;\n array[offset + stride * 3] = spriteAlpha;\n\n offset += stride * 4;\n }\n};\n\n\n/**\n * Destroys the Particle.\n *\n */\nParticleRenderer.prototype.destroy = function ()\n{\n if (this.renderer.gl) {\n this.renderer.gl.deleteBuffer(this.indexBuffer);\n }\n\n ObjectRenderer.prototype.destroy.apply(this, arguments);\n\n this.shader.destroy();\n\n this.indices = null;\n this.tempMatrix = null;\n};\n","var TextureShader = require('../../renderers/webgl/shaders/TextureShader');\n\n/**\n * @class\n * @extends PIXI.TextureShader\n * @memberof PIXI\n * @param shaderManager {ShaderManager} The webgl shader manager this shader works for.\n */\nfunction ParticleShader(shaderManager)\n{\n TextureShader.call(this,\n shaderManager,\n // vertex shader\n [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n 'attribute float aColor;',\n\n 'attribute vec2 aPositionCoord;',\n 'attribute vec2 aScale;',\n 'attribute float aRotation;',\n\n 'uniform mat3 projectionMatrix;',\n\n 'varying vec2 vTextureCoord;',\n 'varying float vColor;',\n\n 'void main(void){',\n ' vec2 v = aVertexPosition;',\n\n ' v.x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);',\n ' v.y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);',\n ' v = v + aPositionCoord;',\n\n ' gl_Position = vec4((projectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);',\n\n ' vTextureCoord = aTextureCoord;',\n ' vColor = aColor;',\n '}'\n ].join('\\n'),\n // hello\n [\n 'precision lowp float;',\n\n 'varying vec2 vTextureCoord;',\n 'varying float vColor;',\n\n 'uniform sampler2D uSampler;',\n 'uniform float uAlpha;',\n\n 'void main(void){',\n ' gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor * uAlpha ;',\n '}'\n ].join('\\n'),\n // custom uniforms\n {\n uAlpha: { type: '1f', value: 1 }\n },\n // custom attributes\n {\n aPositionCoord: 0,\n // aScale: 0,\n aRotation: 0\n }\n );\n\n // TEMP HACK\n\n}\n\nParticleShader.prototype = Object.create(TextureShader.prototype);\nParticleShader.prototype.constructor = ParticleShader;\n\nmodule.exports = ParticleShader;\n","var utils = require('../utils'),\n math = require('../math'),\n CONST = require('../const'),\n EventEmitter = require('eventemitter3');\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should be used for browsers that do not support webGL.\n * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything :)\n *\n * @class\n * @memberof PIXI\n * @param system {string} The name of the system this renderer is for.\n * @param [width=800] {number} the width of the canvas view\n * @param [height=600] {number} the height of the canvas view\n * @param [options] {object} The optional renderer parameters\n * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional\n * @param [options.transparent=false] {boolean} If the render view is transparent, default false\n * @param [options.autoResize=false] {boolean} If the render view is automatically resized, default false\n * @param [options.antialias=false] {boolean} sets antialias (only applicable in chrome at the moment)\n * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2\n * @param [options.clearBeforeRender=true] {boolean} This sets if the CanvasRenderer will clear the canvas or\n * not before the new render pass.\n */\nfunction SystemRenderer(system, width, height, options)\n{\n EventEmitter.call(this);\n\n utils.sayHello(system);\n\n // prepare options\n if (options)\n {\n for (var i in CONST.DEFAULT_RENDER_OPTIONS)\n {\n if (typeof options[i] === 'undefined')\n {\n options[i] = CONST.DEFAULT_RENDER_OPTIONS[i];\n }\n }\n }\n else\n {\n options = CONST.DEFAULT_RENDER_OPTIONS;\n }\n\n /**\n * The type of the renderer.\n *\n * @member {RENDERER_TYPE}\n * @default CONT.RENDERER_TYPE.UNKNOWN\n */\n this.type = CONST.RENDERER_TYPE.UNKNOWN;\n\n /**\n * The width of the canvas view\n *\n * @member {number}\n * @default 800\n */\n this.width = width || 800;\n\n /**\n * The height of the canvas view\n *\n * @member {number}\n * @default 600\n */\n this.height = height || 600;\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 of the renderer\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution;\n\n /**\n * Whether the render view is transparent\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether the render view should be resized automatically\n *\n * @member {boolean}\n */\n this.autoResize = options.autoResize || false;\n\n /**\n * Tracks the blend modes useful for this renderer.\n *\n * @member {object<string, mixed>}\n */\n this.blendModes = null;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of 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 Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.\n * If the scene is transparent Pixi will use clearRect to clear the canvas every frame.\n * Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.\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 * @private\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @private\n */\n this._backgroundColorRgb = [0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @private\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 * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObjectParent = {worldTransform:new math.Matrix(), worldAlpha:1, children:[]};\n\n //\n this._lastObjectRendered = this._tempDisplayObjectParent;\n}\n\n// constructor\nSystemRenderer.prototype = Object.create(EventEmitter.prototype);\nSystemRenderer.prototype.constructor = SystemRenderer;\nmodule.exports = SystemRenderer;\n\nObject.defineProperties(SystemRenderer.prototype, {\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n * @memberof SystemRenderer#\n */\n backgroundColor:\n {\n get: function ()\n {\n return this._backgroundColor;\n },\n set: function (val)\n {\n this._backgroundColor = val;\n this._backgroundColorString = utils.hex2string(val);\n utils.hex2rgb(val, this._backgroundColorRgb);\n }\n }\n});\n\n/**\n * Resizes the canvas view to the specified width and height\n *\n * @param width {number} the new width of the canvas view\n * @param height {number} the new height of the canvas view\n */\nSystemRenderer.prototype.resize = function (width, height) {\n this.width = width * this.resolution;\n this.height = height * this.resolution;\n\n this.view.width = this.width;\n this.view.height = this.height;\n\n if (this.autoResize)\n {\n this.view.style.width = this.width / this.resolution + 'px';\n this.view.style.height = this.height / this.resolution + 'px';\n }\n};\n\n/**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param [removeView=false] {boolean} Removes the Canvas element from the DOM.\n */\nSystemRenderer.prototype.destroy = function (removeView) {\n if (removeView && this.view.parent)\n {\n this.view.parent.removeChild(this.view);\n }\n\n this.type = CONST.RENDERER_TYPE.UNKNOWN;\n\n this.width = 0;\n this.height = 0;\n\n this.view = null;\n\n this.resolution = 0;\n\n this.transparent = false;\n\n this.autoResize = false;\n\n this.blendModes = null;\n\n this.preserveDrawingBuffer = false;\n this.clearBeforeRender = false;\n\n this._backgroundColor = 0;\n this._backgroundColorRgb = null;\n this._backgroundColorString = null;\n};\n","var SystemRenderer = require('../SystemRenderer'),\n CanvasMaskManager = require('./utils/CanvasMaskManager'),\n utils = require('../../utils'),\n math = require('../../math'),\n CONST = require('../../const');\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should be used for browsers that do not support webGL.\n * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything :)\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.SystemRenderer\n * @param [width=800] {number} the width of the canvas view\n * @param [height=600] {number} the height of the canvas view\n * @param [options] {object} The optional renderer parameters\n * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional\n * @param [options.transparent=false] {boolean} If the render view is transparent, default false\n * @param [options.autoResize=false] {boolean} If the render view is automatically resized, default false\n * @param [options.antialias=false] {boolean} sets antialias (only applicable in chrome at the moment)\n * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2\n * @param [options.clearBeforeRender=true] {boolean} This sets if the CanvasRenderer will clear the canvas or\n * not before the new render pass.\n */\nfunction CanvasRenderer(width, height, options)\n{\n SystemRenderer.call(this, 'Canvas', width, height, options);\n\n this.type = CONST.RENDERER_TYPE.CANVAS;\n\n /**\n * The canvas 2d context that everything is drawn with.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.view.getContext('2d', { alpha: this.transparent });\n\n /**\n * Boolean flag controlling canvas refresh.\n *\n * @member {boolean}\n */\n this.refresh = true;\n\n /**\n * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.\n *\n * @member {CanvasMaskManager}\n */\n this.maskManager = new CanvasMaskManager();\n\n /**\n * If true Pixi will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Handy for crisp pixel art and speed on legacy devices.\n *\n * @member {boolean}\n */\n this.roundPixels = false;\n\n /**\n * Tracks the active scale mode for this renderer.\n *\n * @member {SCALE_MODE}\n */\n this.currentScaleMode = CONST.SCALE_MODES.DEFAULT;\n\n /**\n * Tracks the active blend mode for this renderer.\n *\n * @member {SCALE_MODE}\n */\n this.currentBlendMode = CONST.BLEND_MODES.NORMAL;\n\n /**\n * The canvas property used to set the canvas smoothing property.\n *\n * @member {string}\n */\n this.smoothProperty = 'imageSmoothingEnabled';\n\n if (!this.context.imageSmoothingEnabled)\n {\n if (this.context.webkitImageSmoothingEnabled)\n {\n this.smoothProperty = 'webkitImageSmoothingEnabled';\n }\n else if (this.context.mozImageSmoothingEnabled)\n {\n this.smoothProperty = 'mozImageSmoothingEnabled';\n }\n else if (this.context.oImageSmoothingEnabled)\n {\n this.smoothProperty = 'oImageSmoothingEnabled';\n }\n else if (this.context.msImageSmoothingEnabled)\n {\n this.smoothProperty = 'msImageSmoothingEnabled';\n }\n }\n\n this.initPlugins();\n\n this._mapBlendModes();\n\n /**\n * This temporary display object used as the parent of the currently being rendered item\n *\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObjectParent = {\n worldTransform: new math.Matrix(),\n worldAlpha: 1\n };\n\n\n this.resize(width, height);\n}\n\n// constructor\nCanvasRenderer.prototype = Object.create(SystemRenderer.prototype);\nCanvasRenderer.prototype.constructor = CanvasRenderer;\nmodule.exports = CanvasRenderer;\nutils.pluginTarget.mixin(CanvasRenderer);\n\n/**\n * Renders the object to this canvas view\n *\n * @param object {DisplayObject} the object to be rendered\n */\nCanvasRenderer.prototype.render = function (object)\n{\n var cacheParent = object.parent;\n\n this._lastObjectRendered = object;\n\n object.parent = this._tempDisplayObjectParent;\n\n // update the scene graph\n object.updateTransform();\n\n object.parent = cacheParent;\n\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n\n this.context.globalAlpha = 1;\n\n this.currentBlendMode = CONST.BLEND_MODES.NORMAL;\n this.context.globalCompositeOperation = this.blendModes[CONST.BLEND_MODES.NORMAL];\n\n if (navigator.isCocoonJS && this.view.screencanvas)\n {\n this.context.fillStyle = 'black';\n this.context.clear();\n }\n\n if (this.clearBeforeRender)\n {\n if (this.transparent)\n {\n this.context.clearRect(0, 0, this.width, this.height);\n }\n else\n {\n this.context.fillStyle = this._backgroundColorString;\n this.context.fillRect(0, 0, this.width , this.height);\n }\n }\n\n this.renderDisplayObject(object, this.context);\n};\n\n/**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param [removeView=false] {boolean} Removes the Canvas element from the DOM.\n */\nCanvasRenderer.prototype.destroy = function (removeView)\n{\n this.destroyPlugins();\n\n // call the base destroy\n SystemRenderer.prototype.destroy.call(this, removeView);\n\n this.context = null;\n\n this.refresh = true;\n\n this.maskManager.destroy();\n this.maskManager = null;\n\n this.roundPixels = false;\n\n this.currentScaleMode = 0;\n this.currentBlendMode = 0;\n\n this.smoothProperty = null;\n};\n\n/**\n * Renders a display object\n *\n * @param displayObject {DisplayObject} The displayObject to render\n * @private\n */\nCanvasRenderer.prototype.renderDisplayObject = function (displayObject, context)\n{\n var tempContext = this.context;\n\n this.context = context;\n displayObject.renderCanvas(this);\n this.context = tempContext;\n};\n\n/**\n * Maps Pixi blend modes to canvas blend modes.\n *\n * @private\n */\nCanvasRenderer.prototype._mapBlendModes = function ()\n{\n if (!this.blendModes)\n {\n this.blendModes = {};\n\n if (utils.canUseNewCanvasBlendModes())\n {\n this.blendModes[CONST.BLEND_MODES.NORMAL] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.ADD] = 'lighter'; //IS THIS OK???\n this.blendModes[CONST.BLEND_MODES.MULTIPLY] = 'multiply';\n this.blendModes[CONST.BLEND_MODES.SCREEN] = 'screen';\n this.blendModes[CONST.BLEND_MODES.OVERLAY] = 'overlay';\n this.blendModes[CONST.BLEND_MODES.DARKEN] = 'darken';\n this.blendModes[CONST.BLEND_MODES.LIGHTEN] = 'lighten';\n this.blendModes[CONST.BLEND_MODES.COLOR_DODGE] = 'color-dodge';\n this.blendModes[CONST.BLEND_MODES.COLOR_BURN] = 'color-burn';\n this.blendModes[CONST.BLEND_MODES.HARD_LIGHT] = 'hard-light';\n this.blendModes[CONST.BLEND_MODES.SOFT_LIGHT] = 'soft-light';\n this.blendModes[CONST.BLEND_MODES.DIFFERENCE] = 'difference';\n this.blendModes[CONST.BLEND_MODES.EXCLUSION] = 'exclusion';\n this.blendModes[CONST.BLEND_MODES.HUE] = 'hue';\n this.blendModes[CONST.BLEND_MODES.SATURATION] = 'saturate';\n this.blendModes[CONST.BLEND_MODES.COLOR] = 'color';\n this.blendModes[CONST.BLEND_MODES.LUMINOSITY] = 'luminosity';\n }\n else\n {\n // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'\n this.blendModes[CONST.BLEND_MODES.NORMAL] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.ADD] = 'lighter'; //IS THIS OK???\n this.blendModes[CONST.BLEND_MODES.MULTIPLY] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.SCREEN] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.OVERLAY] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.DARKEN] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.LIGHTEN] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.COLOR_DODGE] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.COLOR_BURN] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.HARD_LIGHT] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.SOFT_LIGHT] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.DIFFERENCE] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.EXCLUSION] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.HUE] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.SATURATION] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.COLOR] = 'source-over';\n this.blendModes[CONST.BLEND_MODES.LUMINOSITY] = 'source-over';\n }\n }\n};\n","/**\n * Creates a Canvas element of the given size.\n *\n * @class\n * @memberof PIXI\n * @param width {number} the width for the newly created canvas\n * @param height {number} the height for the newly created canvas\n */\nfunction CanvasBuffer(width, height)\n{\n /**\n * The Canvas object that belongs to this CanvasBuffer.\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.canvas.width = width;\n this.canvas.height = height;\n}\n\nCanvasBuffer.prototype.constructor = CanvasBuffer;\nmodule.exports = CanvasBuffer;\n\nObject.defineProperties(CanvasBuffer.prototype, {\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n * @memberof CanvasBuffer#\n */\n width: {\n get: function ()\n {\n return this.canvas.width;\n },\n set: function (val)\n {\n this.canvas.width = val;\n }\n },\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n * @memberof CanvasBuffer#\n */\n height: {\n get: function ()\n {\n return this.canvas.height;\n },\n set: function (val)\n {\n this.canvas.height = val;\n }\n }\n});\n\n/**\n * Clears the canvas that was created by the CanvasBuffer class.\n *\n * @private\n */\nCanvasBuffer.prototype.clear = function ()\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 width {number} the new width of the canvas\n * @param height {number} the new height of the canvas\n */\nCanvasBuffer.prototype.resize = function (width, height)\n{\n this.canvas.width = width;\n this.canvas.height = height;\n};\n\n/**\n * Destroys this canvas.\n *\n */\nCanvasBuffer.prototype.destroy = function ()\n{\n this.context = null;\n this.canvas = null;\n};\n","var CONST = require('../../../const');\n\n/**\n * A set of functions used by the canvas renderer to draw the primitive graphics data.\n * @static\n * @class\n * @memberof PIXI\n */\nvar CanvasGraphics = {};\nmodule.exports = CanvasGraphics;\n\n/*\n * Renders a Graphics object to a canvas.\n *\n * @param graphics {Graphics} the actual graphics object to render\n * @param context {CanvasRenderingContext2D} the 2d drawing method of the canvas\n */\nCanvasGraphics.renderGraphics = function (graphics, context)\n{\n var worldAlpha = graphics.worldAlpha;\n\n if (graphics.dirty)\n {\n this.updateGraphicsTint(graphics);\n graphics.dirty = false;\n }\n\n for (var i = 0; i < graphics.graphicsData.length; i++)\n {\n var data = graphics.graphicsData[i];\n var shape = data.shape;\n\n var fillColor = data._fillTint;\n var lineColor = data._lineTint;\n\n context.lineWidth = data.lineWidth;\n\n if (data.type === CONST.SHAPES.POLY)\n {\n context.beginPath();\n\n var points = shape.points;\n\n context.moveTo(points[0], points[1]);\n\n for (var j=1; j < points.length/2; j++)\n {\n context.lineTo(points[j * 2], points[j * 2 + 1]);\n }\n\n if (shape.closed)\n {\n context.lineTo(points[0], points[1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length-2] && points[1] === points[points.length-1])\n {\n context.closePath();\n }\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);\n context.stroke();\n }\n }\n else if (data.type === CONST.SHAPES.RECT)\n {\n\n if (data.fillColor || data.fillColor === 0)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);\n context.fillRect(shape.x, shape.y, shape.width, shape.height);\n\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);\n context.strokeRect(shape.x, shape.y, shape.width, shape.height);\n }\n }\n else if (data.type === CONST.SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.beginPath();\n context.arc(shape.x, shape.y, shape.radius,0,2*Math.PI);\n context.closePath();\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);\n context.stroke();\n }\n }\n else if (data.type === CONST.SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n var w = shape.width * 2;\n var h = shape.height * 2;\n\n var x = shape.x - w/2;\n var y = shape.y - h/2;\n\n context.beginPath();\n\n var kappa = 0.5522848,\n ox = (w / 2) * kappa, // control point offset horizontal\n oy = (h / 2) * kappa, // control point offset vertical\n xe = x + w, // x-end\n ye = y + h, // y-end\n xm = x + w / 2, // x-middle\n ym = y + h / 2; // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n\n context.closePath();\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);\n context.stroke();\n }\n }\n else if (data.type === CONST.SHAPES.RREC)\n {\n var rx = shape.x;\n var ry = shape.y;\n var width = shape.width;\n var height = shape.height;\n var radius = shape.radius;\n\n var maxRadius = Math.min(width, height) / 2 | 0;\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.beginPath();\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n\n if (data.fillColor || data.fillColor === 0)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);\n context.fill();\n\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);\n context.stroke();\n }\n }\n }\n};\n\n/*\n * Renders a graphics mask\n *\n * @private\n * @param graphics {Graphics} the graphics which will be used as a mask\n * @param context {CanvasRenderingContext2D} the context 2d method of the canvas\n */\nCanvasGraphics.renderGraphicsMask = function (graphics, context)\n{\n var len = graphics.graphicsData.length;\n\n if (len === 0)\n {\n return;\n }\n\n context.beginPath();\n\n for (var i = 0; i < len; i++)\n {\n var data = graphics.graphicsData[i];\n var shape = data.shape;\n\n if (data.type === CONST.SHAPES.POLY)\n {\n\n var points = shape.points;\n\n context.moveTo(points[0], points[1]);\n\n for (var j=1; j < points.length/2; j++)\n {\n context.lineTo(points[j * 2], points[j * 2 + 1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length-2] && points[1] === points[points.length-1])\n {\n context.closePath();\n }\n\n }\n else if (data.type === CONST.SHAPES.RECT)\n {\n context.rect(shape.x, shape.y, shape.width, shape.height);\n context.closePath();\n }\n else if (data.type === CONST.SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n }\n else if (data.type === CONST.SHAPES.ELIP)\n {\n\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n var w = shape.width * 2;\n var h = shape.height * 2;\n\n var x = shape.x - w/2;\n var y = shape.y - h/2;\n\n var kappa = 0.5522848,\n ox = (w / 2) * kappa, // control point offset horizontal\n oy = (h / 2) * kappa, // control point offset vertical\n xe = x + w, // x-end\n ye = y + h, // y-end\n xm = x + w / 2, // x-middle\n ym = y + h / 2; // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n }\n else if (data.type === CONST.SHAPES.RREC)\n {\n\n var rx = shape.x;\n var ry = shape.y;\n var width = shape.width;\n var height = shape.height;\n var radius = shape.radius;\n\n var maxRadius = Math.min(width, height) / 2 | 0;\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n }\n }\n};\n\n/*\n * Updates the tint of a graphics object\n *\n * @private\n * @param graphics {Graphics} the graphics that will have its tint updated\n * \n */\nCanvasGraphics.updateGraphicsTint = function (graphics)\n{\n if (graphics.tint === 0xFFFFFF)\n {\n return;\n }\n\n var tintR = (graphics.tint >> 16 & 0xFF) / 255;\n var tintG = (graphics.tint >> 8 & 0xFF) / 255;\n var tintB = (graphics.tint & 0xFF)/ 255;\n\n for (var i = 0; i < graphics.graphicsData.length; i++)\n {\n var data = graphics.graphicsData[i];\n\n var fillColor = data.fillColor | 0;\n var lineColor = data.lineColor | 0;\n\n /*\n var colorR = (fillColor >> 16 & 0xFF) / 255;\n var colorG = (fillColor >> 8 & 0xFF) / 255;\n var colorB = (fillColor & 0xFF) / 255;\n\n colorR *= tintR;\n colorG *= tintG;\n colorB *= tintB;\n\n fillColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255);\n\n colorR = (lineColor >> 16 & 0xFF) / 255;\n colorG = (lineColor >> 8 & 0xFF) / 255;\n colorB = (lineColor & 0xFF) / 255;\n\n colorR *= tintR;\n colorG *= tintG;\n colorB *= tintB;\n\n lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255);\n */\n\n // super inline cos im an optimization NAZI :)\n data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (fillColor & 0xFF) / 255 * tintB*255);\n data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (lineColor & 0xFF) / 255 * tintB*255);\n\n }\n};\n\n","var CanvasGraphics = require('./CanvasGraphics');\n\n/**\n * A set of functions used to handle masking.\n *\n * @class\n * @memberof PIXI\n */\nfunction CanvasMaskManager()\n{}\n\nCanvasMaskManager.prototype.constructor = CanvasMaskManager;\nmodule.exports = CanvasMaskManager;\n\n/**\n * This method adds it to the current stack of masks.\n *\n * @param maskData {object} the maskData that will be pushed\n * @param renderer {WebGLRenderer|CanvasRenderer} The renderer context to use.\n */\nCanvasMaskManager.prototype.pushMask = function (maskData, renderer)\n{\n\n renderer.context.save();\n\n var cacheAlpha = maskData.alpha;\n var transform = maskData.worldTransform;\n var resolution = renderer.resolution;\n\n renderer.context.setTransform(\n transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution\n );\n\n //TODO suport sprite alpha masks??\n //lots of effort required. If demand is great enough..\n if(!maskData.texture)\n {\n CanvasGraphics.renderGraphicsMask(maskData, renderer.context);\n renderer.context.clip();\n }\n\n maskData.worldAlpha = cacheAlpha;\n};\n\n/**\n * Restores the current drawing context to the state it was before the mask was applied.\n *\n * @param renderer {WebGLRenderer|CanvasRenderer} The renderer context to use.\n */\nCanvasMaskManager.prototype.popMask = function (renderer)\n{\n renderer.context.restore();\n};\n\nCanvasMaskManager.prototype.destroy = function () {};\n","var utils = require('../../../utils');\n\n/**\n * Utility methods for Sprite/Texture tinting.\n * @static\n * @class\n * @memberof PIXI\n */\nvar CanvasTinter = {};\nmodule.exports = CanvasTinter;\n\n/**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @param sprite {Sprite} the sprite to tint\n * @param color {number} the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\nCanvasTinter.getTintedTexture = function (sprite, color)\n{\n var texture = sprite.texture;\n\n color = CanvasTinter.roundColor(color);\n\n var stringColor = '#' + ('00000' + ( color | 0).toString(16)).substr(-6);\n\n texture.tintCache = texture.tintCache || {};\n\n if (texture.tintCache[stringColor])\n {\n return texture.tintCache[stringColor];\n }\n\n // clone texture..\n var canvas = CanvasTinter.canvas || document.createElement('canvas');\n\n //CanvasTinter.tintWithPerPixel(texture, stringColor, canvas);\n CanvasTinter.tintMethod(texture, color, canvas);\n\n if (CanvasTinter.convertTintToImage)\n {\n // is this better?\n var tintImage = new Image();\n tintImage.src = canvas.toDataURL();\n\n texture.tintCache[stringColor] = tintImage;\n }\n else\n {\n texture.tintCache[stringColor] = canvas;\n // if we are not converting the texture to an image then we need to lose the reference to the canvas\n CanvasTinter.canvas = null;\n }\n\n return canvas;\n};\n\n/**\n * Tint a texture using the 'multiply' operation.\n *\n * @param texture {Texture} the texture to tint\n * @param color {number} the color to use to tint the sprite with\n * @param canvas {HTMLCanvasElement} the current canvas\n */\nCanvasTinter.tintWithMultiply = function (texture, color, canvas)\n{\n var context = canvas.getContext( '2d' );\n\n var crop = texture.crop;\n\n canvas.width = crop.width;\n canvas.height = crop.height;\n\n context.fillStyle = '#' + ('00000' + ( color | 0).toString(16)).substr(-6);\n\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'multiply';\n\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n context.globalCompositeOperation = 'destination-atop';\n\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n};\n\n/**\n * Tint a texture using the 'overlay' operation.\n *\n * @param texture {Texture} the texture to tint\n * @param color {number} the color to use to tint the sprite with\n * @param canvas {HTMLCanvasElement} the current canvas\n */\nCanvasTinter.tintWithOverlay = function (texture, color, canvas)\n{\n var context = canvas.getContext( '2d' );\n\n var crop = texture.crop;\n\n canvas.width = crop.width;\n canvas.height = crop.height;\n\n context.globalCompositeOperation = 'copy';\n context.fillStyle = '#' + ('00000' + ( color | 0).toString(16)).substr(-6);\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'destination-atop';\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n // context.globalCompositeOperation = 'copy';\n};\n\n/**\n * Tint a texture pixel per pixel.\n *\n * @param texture {Texture} the texture to tint\n * @param color {number} the color to use to tint the sprite with\n * @param canvas {HTMLCanvasElement} the current canvas\n */\nCanvasTinter.tintWithPerPixel = function (texture, color, canvas)\n{\n var context = canvas.getContext( '2d' );\n\n var crop = texture.crop;\n\n canvas.width = crop.width;\n canvas.height = crop.height;\n\n context.globalCompositeOperation = 'copy';\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n var rgbValues = utils.hex2rgb(color);\n var r = rgbValues[0], g = rgbValues[1], b = rgbValues[2];\n\n var pixelData = context.getImageData(0, 0, crop.width, crop.height);\n\n var pixels = pixelData.data;\n\n for (var i = 0; i < pixels.length; i += 4)\n {\n pixels[i+0] *= r;\n pixels[i+1] *= g;\n pixels[i+2] *= b;\n }\n\n context.putImageData(pixelData, 0, 0);\n};\n\n/**\n * Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel.\n *\n * @param color {number} the color to round, should be a hex color\n */\nCanvasTinter.roundColor = function (color)\n{\n var step = CanvasTinter.cacheStepsPerColorChannel;\n\n var rgbValues = utils.hex2rgb(color);\n\n rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step);\n rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step);\n rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step);\n\n return utils.rgb2hex(rgbValues);\n};\n\n/**\n * Number of steps which will be used as a cap when rounding colors.\n *\n * @member\n */\nCanvasTinter.cacheStepsPerColorChannel = 8;\n\n/**\n * Tint cache boolean flag.\n *\n * @member\n */\nCanvasTinter.convertTintToImage = false;\n\n/**\n * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.\n *\n * @member\n */\nCanvasTinter.canUseMultiply = utils.canUseNewCanvasBlendModes();\n\n/**\n * The tinting method that will be used.\n *\n */\nCanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel;\n","var SystemRenderer = require('../SystemRenderer'),\n ShaderManager = require('./managers/ShaderManager'),\n MaskManager = require('./managers/MaskManager'),\n StencilManager = require('./managers/StencilManager'),\n FilterManager = require('./managers/FilterManager'),\n BlendModeManager = require('./managers/BlendModeManager'),\n RenderTarget = require('./utils/RenderTarget'),\n ObjectRenderer = require('./utils/ObjectRenderer'),\n FXAAFilter = require('./filters/FXAAFilter'),\n utils = require('../../utils'),\n CONST = require('../../const');\n\n/**\n * The WebGLRenderer draws the scene and all its content onto a webGL enabled canvas. This renderer\n * should be used for browsers that support webGL. This Render works by automatically managing webGLBatchs.\n * 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.SystemRenderer\n * @param [width=0] {number} the width of the canvas view\n * @param [height=0] {number} the height of the canvas view\n * @param [options] {object} The optional renderer parameters\n * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional\n * @param [options.transparent=false] {boolean} If the render view is transparent, default false\n * @param [options.autoResize=false] {boolean} If the render view is automatically resized, default false\n * @param [options.antialias=false] {boolean} sets antialias. If not available natively then FXAA antialiasing is used\n * @param [options.forceFXAA=false] {boolean} forces FXAA antialiasing to be used over native. FXAA is faster, but may not always lok as great\n * @param [options.resolution=1] {number} the resolution of the renderer retina would be 2\n * @param [options.clearBeforeRender=true] {boolean} This sets if the CanvasRenderer will clear the canvas or\n * not before the new render pass.\n * @param [options.preserveDrawingBuffer=false] {boolean} enables drawing buffer preservation, enable this if\n * you need to call toDataUrl on the webgl context.\n */\nfunction WebGLRenderer(width, height, options)\n{\n options = options || {};\n\n SystemRenderer.call(this, 'WebGL', width, height, options);\n\n /**\n * The type of this renderer as a standardised const\n *\n * @member {number}\n *\n */\n this.type = CONST.RENDERER_TYPE.WEBGL;\n\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n this.view.addEventListener('webglcontextlost', this.handleContextLost, false);\n this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n\n //TODO possibility to force FXAA as it may offer better performance?\n /**\n * Does it use FXAA ?\n *\n * @member {boolean}\n * @private\n */\n this._useFXAA = !!options.forceFXAA && options.antialias;\n\n /**\n * The fxaa filter\n *\n * @member {FXAAFilter}\n * @private\n */\n this._FXAAFilter = null;\n\n /**\n * The options passed in to create a new webgl context.\n *\n * @member {object}\n * @private\n */\n this._contextOptions = {\n alpha: this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer\n };\n\n /**\n * Counter for the number of draws made each frame\n *\n * @member {number}\n */\n this.drawCount = 0;\n\n /**\n * Deals with managing the shader programs and their attribs.\n *\n * @member {ShaderManager}\n */\n this.shaderManager = new ShaderManager(this);\n\n /**\n * Manages the masks using the stencil buffer.\n *\n * @member {MaskManager}\n */\n this.maskManager = new MaskManager(this);\n\n /**\n * Manages the stencil buffer.\n *\n * @member {StencilManager}\n */\n this.stencilManager = new StencilManager(this);\n\n /**\n * Manages the filters.\n *\n * @member {FilterManager}\n */\n this.filterManager = new FilterManager(this);\n\n\n /**\n * Manages the blendModes\n * @member {BlendModeManager}\n */\n this.blendModeManager = new BlendModeManager(this);\n\n /**\n * Holds the current render target\n * @member {Object}\n */\n this.currentRenderTarget = null;\n\n /**\n * object renderer @alvin\n * @member {ObjectRenderer}\n */\n this.currentRenderer = new ObjectRenderer(this);\n\n this.initPlugins();\n\n // initialize the context so it is ready for the managers.\n this._createContext();\n this._initContext();\n\n // map some webGL blend modes..\n this._mapBlendModes();\n\n /**\n * An array of render targets\n * @member {Array}\n * @private\n */\n this._renderTargetStack = [];\n}\n\n// constructor\nWebGLRenderer.prototype = Object.create(SystemRenderer.prototype);\nWebGLRenderer.prototype.constructor = WebGLRenderer;\nmodule.exports = WebGLRenderer;\nutils.pluginTarget.mixin(WebGLRenderer);\n\nWebGLRenderer.glContextId = 0;\n\nWebGLRenderer.prototype._createContext = function () {\n var gl = this.view.getContext('webgl', this._contextOptions) || this.view.getContext('experimental-webgl', this._contextOptions);\n this.gl = gl;\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 this.glContextId = WebGLRenderer.glContextId++;\n gl.id = this.glContextId;\n gl.renderer = this;\n};\n\n/**\n * Creates the WebGL context\n * @private\n */\nWebGLRenderer.prototype._initContext = function ()\n{\n var gl = this.gl;\n\n // set up the default pixi settings..\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.CULL_FACE);\n gl.enable(gl.BLEND);\n\n this.renderTarget = new RenderTarget(gl, this.width, this.height, null, this.resolution, true);\n\n this.setRenderTarget(this.renderTarget);\n\n this.emit('context', gl);\n\n // setup the width/height properties and gl viewport\n this.resize(this.width, this.height);\n\n if(!this._useFXAA)\n {\n this._useFXAA = (this._contextOptions.antialias && ! gl.getContextAttributes().antialias);\n }\n\n\n if(this._useFXAA)\n {\n window.console.warn('FXAA antialiasing being used instead of native antialiasing');\n this._FXAAFilter = [new FXAAFilter()];\n }\n};\n\n/**\n * Renders the object to its webGL view\n *\n * @param object {DisplayObject} the object to be rendered\n */\nWebGLRenderer.prototype.render = function (object)\n{\n // no point rendering if our context has been blown up!\n if (this.gl.isContextLost())\n {\n return;\n }\n\n this.drawCount = 0;\n\n this._lastObjectRendered = object;\n\n if(this._useFXAA)\n {\n this._FXAAFilter[0].uniforms.resolution.value.x = this.width;\n this._FXAAFilter[0].uniforms.resolution.value.y = this.height;\n object.filterArea = this.renderTarget.size;\n object.filters = this._FXAAFilter;\n }\n\n var cacheParent = object.parent;\n object.parent = this._tempDisplayObjectParent;\n\n // update the scene graph\n object.updateTransform();\n\n object.parent = cacheParent;\n\n var gl = this.gl;\n\n // make sure we are bound to the main frame buffer\n this.setRenderTarget(this.renderTarget);\n\n if (this.clearBeforeRender)\n {\n if (this.transparent)\n {\n gl.clearColor(0, 0, 0, 0);\n }\n else\n {\n gl.clearColor(this._backgroundColorRgb[0], this._backgroundColorRgb[1], this._backgroundColorRgb[2], 1);\n }\n\n gl.clear(gl.COLOR_BUFFER_BIT);\n }\n\n this.renderDisplayObject(object, this.renderTarget);//this.projection);\n};\n\n/**\n * Renders a Display Object.\n *\n * @param displayObject {DisplayObject} The DisplayObject to render\n * @param renderTarget {RenderTarget} The render target to use to render this display object\n *\n */\nWebGLRenderer.prototype.renderDisplayObject = function (displayObject, renderTarget, clear)//projection, buffer)\n{\n // TODO is this needed...\n //this.blendModeManager.setBlendMode(CONST.BLEND_MODES.NORMAL);\n this.setRenderTarget(renderTarget);\n\n if(clear)\n {\n renderTarget.clear();\n }\n\n // start the filter manager\n this.filterManager.setFilterStack( renderTarget.filterStack );\n\n // render the scene!\n displayObject.renderWebGL(this);\n\n // finish the current renderer..\n this.currentRenderer.flush();\n};\n\n/**\n * Changes the current renderer to the one given in parameter\n *\n * @param objectRenderer {Object} TODO @alvin\n *\n */\nWebGLRenderer.prototype.setObjectRenderer = function (objectRenderer)\n{\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n this.currentRenderer.start();\n};\n\n/**\n * Changes the current render target to the one given in parameter\n *\n * @param renderTarget {RenderTarget} the new render target\n *\n */\nWebGLRenderer.prototype.setRenderTarget = function (renderTarget)\n{\n if( this.currentRenderTarget === renderTarget)\n {\n return;\n }\n // TODO - maybe down the line this should be a push pos thing? Leaving for now though.\n this.currentRenderTarget = renderTarget;\n this.currentRenderTarget.activate();\n this.stencilManager.setMaskStack( renderTarget.stencilMaskStack );\n};\n\n\n/**\n * Resizes the webGL view to the specified width and height.\n *\n * @param width {number} the new width of the webGL view\n * @param height {number} the new height of the webGL view\n */\nWebGLRenderer.prototype.resize = function (width, height)\n{\n SystemRenderer.prototype.resize.call(this, width, height);\n\n this.filterManager.resize(width, height);\n this.renderTarget.resize(width, height);\n\n if(this.currentRenderTarget === this.renderTarget)\n {\n this.renderTarget.activate();\n this.gl.viewport(0, 0, this.width, this.height);\n }\n};\n\n/**\n * Updates and/or Creates a WebGL texture for the renderer's context.\n *\n * @param texture {BaseTexture|Texture} the texture to update\n */\nWebGLRenderer.prototype.updateTexture = function (texture)\n{\n texture = texture.baseTexture || texture;\n\n if (!texture.hasLoaded)\n {\n return;\n }\n\n var gl = this.gl;\n\n if (!texture._glTextures[gl.id])\n {\n texture._glTextures[gl.id] = gl.createTexture();\n texture.on('update', this.updateTexture, this);\n texture.on('dispose', this.destroyTexture, this);\n }\n\n\n gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultipliedAlpha);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === CONST.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n\n\n if (texture.mipmap && texture.isPowerOfTwo)\n {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n else\n {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n if (!texture.isPowerOfTwo)\n {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n }\n else\n {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n }\n\n return texture._glTextures[gl.id];\n};\n\n/**\n * Deletes the texture from WebGL\n *\n * @param texture {BaseTexture|Texture} the texture to destroy\n */\nWebGLRenderer.prototype.destroyTexture = function (texture)\n{\n texture = texture.baseTexture || texture;\n\n if (!texture.hasLoaded)\n {\n return;\n }\n\n if (texture._glTextures[this.gl.id])\n {\n this.gl.deleteTexture(texture._glTextures[this.gl.id]);\n }\n};\n\n/**\n * Handles a lost webgl context\n *\n * @param event {Event}\n * @private\n */\nWebGLRenderer.prototype.handleContextLost = function (event)\n{\n event.preventDefault();\n};\n\n/**\n * Handles a restored webgl context\n *\n * @param event {Event}\n * @private\n */\nWebGLRenderer.prototype.handleContextRestored = function ()\n{\n this._initContext();\n\n // empty all the old gl textures as they are useless now\n for (var key in utils.BaseTextureCache)\n {\n utils.BaseTextureCache[key]._glTextures.length = 0;\n }\n};\n\n/**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param [removeView=false] {boolean} Removes the Canvas element from the DOM.\n */\nWebGLRenderer.prototype.destroy = function (removeView)\n{\n this.destroyPlugins();\n\n // remove listeners\n this.view.removeEventListener('webglcontextlost', this.handleContextLost);\n this.view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n // call base destroy\n SystemRenderer.prototype.destroy.call(this, removeView);\n\n this.uuid = 0;\n\n // destroy the managers\n this.shaderManager.destroy();\n this.maskManager.destroy();\n this.stencilManager.destroy();\n this.filterManager.destroy();\n\n this.shaderManager = null;\n this.maskManager = null;\n this.filterManager = null;\n this.blendModeManager = null;\n\n this.handleContextLost = null;\n this.handleContextRestored = null;\n\n this._contextOptions = null;\n\n this.drawCount = 0;\n\n this.gl = null;\n};\n\n/**\n * Maps Pixi blend modes to WebGL blend modes.\n *\n * @private\n */\nWebGLRenderer.prototype._mapBlendModes = function ()\n{\n var gl = this.gl;\n\n if (!this.blendModes)\n {\n this.blendModes = {};\n\n this.blendModes[CONST.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.ADD] = [gl.SRC_ALPHA, gl.DST_ALPHA];\n this.blendModes[CONST.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.SCREEN] = [gl.SRC_ALPHA, gl.ONE];\n this.blendModes[CONST.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n this.blendModes[CONST.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n }\n};\n","var DefaultShader = require('../shaders/TextureShader');\n\n/**\n * This is the base class for creating a PIXI filter. Currently only WebGL supports filters.\n * If you want to make a custom filter this should be your base class.\n *\n * @class\n * @memberof PIXI\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 uniforms {object} An object containing the uniforms for this filter.\n */\nfunction AbstractFilter(vertexSrc, fragmentSrc, uniforms)\n{\n\n /**\n * An array of shaders\n * @member {Shader[]}\n * @private\n */\n this.shaders = [];\n\n /**\n * The extra padding that the filter might need\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The uniforms as an object\n * @member {object}\n */\n this.uniforms = uniforms || {};\n\n\n /**\n * The code of the vertex shader\n * @member {string[]}\n * @private\n */\n this.vertexSrc = vertexSrc || DefaultShader.defaultVertexSrc;\n\n /**\n * The code of the frament shader\n * @member {string[]}\n * @private\n */\n this.fragmentSrc = fragmentSrc || DefaultShader.defaultFragmentSrc;\n\n //TODO a reminder - would be cool to have lower res filters as this would give better performance.\n\n //typeof fragmentSrc === 'string' ? fragmentSrc.split('') : (fragmentSrc || []);\n\n}\n\nAbstractFilter.prototype.constructor = AbstractFilter;\nmodule.exports = AbstractFilter;\n\n/*\n * Grabs a shader from the current renderer\n * @param renderer {WebGLRenderer} The renderer to retrieve the shader from\n *\n */\nAbstractFilter.prototype.getShader = function (renderer)\n{\n var gl = renderer.gl;\n\n var shader = this.shaders[gl.id];\n\n if (!shader)\n {\n shader = new DefaultShader(renderer.shaderManager,\n this.vertexSrc,\n this.fragmentSrc,\n this.uniforms,\n this.attributes\n );\n\n this.shaders[gl.id] = shader;\n }\n\n return shader;\n};\n\n/*\n * Applies the filter\n * @param renderer {WebGLRenderer} The renderer to retrieve the filter from\n * @param input {RenderTarget}\n * @param output {RenderTarget}\n * @param clear {boolean} Whether or not we want to clear the outputTarget\n */\nAbstractFilter.prototype.applyFilter = function (renderer, input, output, clear)\n{\n var shader = this.getShader(renderer);\n\n renderer.filterManager.applyFilter(shader, input, output, clear);\n};\n\n/**\n * Syncs a uniform between the class object and the shaders.\n *\n */\nAbstractFilter.prototype.syncUniform = function (uniform)\n{\n for (var i = 0, j = this.shaders.length; i < j; ++i)\n {\n this.shaders[i].syncUniform(uniform);\n }\n};\n\n/*\nAbstractFilter.prototype.apply = function (frameBuffer)\n{\n // TODO :)\n};\n*/\n","var AbstractFilter = require('./AbstractFilter');\n// @see https://github.com/substack/brfs/issues/25\n\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 * From:\n * https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI\n *\n */\nfunction FXAAFilter()\n{\n AbstractFilter.call(this,\n // vertex shader\n \"\\nprecision mediump float;\\n\\nattribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform mat3 projectionMatrix;\\nuniform vec2 resolution;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nvarying vec2 vResolution;\\n\\n//texcoords computed in vertex step\\n//to avoid dependent texture reads\\nvarying vec2 v_rgbNW;\\nvarying vec2 v_rgbNE;\\nvarying vec2 v_rgbSW;\\nvarying vec2 v_rgbSE;\\nvarying vec2 v_rgbM;\\n\\n\\nvoid texcoords(vec2 fragCoord, vec2 resolution,\\n out vec2 v_rgbNW, out vec2 v_rgbNE,\\n out vec2 v_rgbSW, out vec2 v_rgbSE,\\n out vec2 v_rgbM) {\\n vec2 inverseVP = 1.0 / resolution.xy;\\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 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n vResolution = resolution;\\n\\n //compute the texture coords and send them to varyings\\n texcoords(aTextureCoord * resolution, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\n\\n/**\\nBasic FXAA implementation based on the code on geeks3d.com with the\\nmodification that the texture2DLod stuff was removed since it's\\nunsupported by WebGL.\\n\\n--\\n\\nFrom:\\nhttps://github.com/mitsuhiko/webgl-meincraft\\n\\nCopyright (c) 2011 by Armin Ronacher.\\n\\nSome rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are\\nmet:\\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\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\\n\\\"AS IS\\\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF 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 resolution,\\n vec2 v_rgbNW, vec2 v_rgbNE,\\n vec2 v_rgbSW, vec2 v_rgbSE,\\n vec2 v_rgbM) {\\n vec4 color;\\n mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);\\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\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying vec2 vResolution;\\n\\n//texcoords computed in vertex step\\n//to avoid dependent texture reads\\nvarying vec2 v_rgbNW;\\nvarying vec2 v_rgbNE;\\nvarying vec2 v_rgbSW;\\nvarying vec2 v_rgbSE;\\nvarying vec2 v_rgbM;\\n\\nuniform sampler2D uSampler;\\n\\n\\nvoid main(void){\\n\\n gl_FragColor = fxaa(uSampler, vTextureCoord * vResolution, vResolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\\n\\n}\\n\",\n // uniforms\n {\n resolution: { type: 'v2', value: { x: 1, y: 1 } }\n }\n );\n\n}\n\nFXAAFilter.prototype = Object.create(AbstractFilter.prototype);\nFXAAFilter.prototype.constructor = FXAAFilter;\nmodule.exports = FXAAFilter;\n\nFXAAFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var filterManager = renderer.filterManager;\n\n var shader = this.getShader( renderer );\n // draw the filter...\n filterManager.applyFilter(shader, input, output);\n};\n","var AbstractFilter = require('./AbstractFilter'),\n math = require('../../../math');\n\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The SpriteMaskFilter class\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI\n * @param sprite {Sprite} the target sprite\n */\nfunction SpriteMaskFilter(sprite)\n{\n var maskMatrix = new math.Matrix();\n\n AbstractFilter.call(this,\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n \"precision lowp float;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\nuniform float alpha;\\nuniform sampler2D mask;\\n\\nvoid main(void)\\n{\\n // check clip! this will stop the mask bleeding out from the edges\\n vec2 text = abs( vMaskCoord - 0.5 );\\n text = step(0.5, text);\\n float clip = 1.0 - max(text.y, text.x);\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 masky = texture2D(mask, vMaskCoord);\\n original *= (masky.r * masky.a * alpha * clip);\\n gl_FragColor = original;\\n}\\n\",\n {\n mask: { type: 'sampler2D', value: sprite._texture },\n alpha: { type: 'f', value: 1},\n otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }\n }\n );\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n}\n\nSpriteMaskFilter.prototype = Object.create(AbstractFilter.prototype);\nSpriteMaskFilter.prototype.constructor = SpriteMaskFilter;\nmodule.exports = SpriteMaskFilter;\n\n/**\n * Applies the filter ? @alvin\n *\n * @param renderer {WebGLRenderer} A reference to the WebGL renderer\n * @param input {RenderTarget}\n * @param output {RenderTarget}\n */\nSpriteMaskFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var filterManager = renderer.filterManager;\n\n this.uniforms.mask.value = this.maskSprite._texture;\n\n filterManager.calculateMappedMatrix(input.frame, this.maskSprite, this.maskMatrix);\n\n this.uniforms.otherMatrix.value = this.maskMatrix.toArray(true);\n this.uniforms.alpha.value = this.maskSprite.worldAlpha;\n\n var shader = this.getShader(renderer);\n // draw the filter...\n filterManager.applyFilter(shader, input, output);\n};\n\n\nObject.defineProperties(SpriteMaskFilter.prototype, {\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {Texture}\n * @memberof SpriteMaskFilter#\n */\n map: {\n get: function ()\n {\n return this.uniforms.mask.value;\n },\n set: function (value)\n {\n this.uniforms.mask.value = value;\n }\n },\n\n /**\n * The offset used to move the displacement map.\n *\n * @member {Point}\n * @memberof SpriteMaskFilter#\n */\n offset: {\n get: function()\n {\n return this.uniforms.offset.value;\n },\n set: function(value)\n {\n this.uniforms.offset.value = value;\n }\n }\n});\n","var WebGLManager = require('./WebGLManager');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.WebGlManager\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction BlendModeManager(renderer)\n{\n WebGLManager.call(this, renderer);\n\n /**\n * @member {number}\n */\n this.currentBlendMode = 99999;\n}\n\nBlendModeManager.prototype = Object.create(WebGLManager.prototype);\nBlendModeManager.prototype.constructor = BlendModeManager;\nmodule.exports = BlendModeManager;\n\n/**\n * Sets-up the given blendMode from WebGL's point of view.\n *\n * @param blendMode {number} the blendMode, should be a Pixi const, such as BlendModes.ADD\n */\nBlendModeManager.prototype.setBlendMode = function (blendMode)\n{\n if (this.currentBlendMode === blendMode)\n {\n return false;\n }\n\n this.currentBlendMode = blendMode;\n\n var mode = this.renderer.blendModes[this.currentBlendMode];\n this.renderer.gl.blendFunc(mode[0], mode[1]);\n\n return true;\n};\n","var WebGLManager = require('./WebGLManager'),\n RenderTarget = require('../utils/RenderTarget'),\n CONST = require('../../../const'),\n Quad = require('../utils/Quad'),\n math = require('../../../math');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.WebGLManager\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction FilterManager(renderer)\n{\n WebGLManager.call(this, renderer);\n\n /**\n * @member {any[]}\n */\n this.filterStack = [];\n\n this.filterStack.push({\n renderTarget:renderer.currentRenderTarget,\n filter:[],\n bounds:null\n });\n\n /**\n * @member {any[]}\n */\n this.texturePool = [];\n\n // listen for context and update necessary buffers\n //TODO make this dynamic!\n //TODO test this out by forces power of two?\n this.textureSize = new math.Rectangle( 0, 0, renderer.width, renderer.height );\n\n this.currentFrame = null;\n}\n\nFilterManager.prototype = Object.create(WebGLManager.prototype);\nFilterManager.prototype.constructor = FilterManager;\nmodule.exports = FilterManager;\n\n\n/**\n * Called when there is a WebGL context change.\n *\n */\nFilterManager.prototype.onContextChange = function ()\n{\n this.texturePool.length = 0;\n\n var gl = this.renderer.gl;\n this.quad = new Quad(gl);\n};\n\n/**\n * @param renderer {WebGLRenderer}\n * @param buffer {ArrayBuffer}\n */\nFilterManager.prototype.setFilterStack = function ( filterStack )\n{\n this.filterStack = filterStack;\n};\n\n/**\n * Applies the filter and adds it to the current filter stack.\n *\n * @param filterBlock {object} the filter that will be pushed to the current filter stack\n */\nFilterManager.prototype.pushFilter = function (target, filters)\n{\n // get the bounds of the object..\n // TODO replace clone with a copy to save object creation\n var bounds = target.filterArea ? target.filterArea.clone() : target.getBounds();\n \n //bounds = bounds.clone();\n\n // round off the rectangle to get a nice smoooooooth filter :)\n bounds.x = bounds.x | 0;\n bounds.y = bounds.y | 0;\n bounds.width = bounds.width | 0;\n bounds.height = bounds.height | 0;\n\n\n // padding!\n var padding = filters[0].padding | 0;\n bounds.x -= padding;\n bounds.y -= padding;\n bounds.width += padding * 2;\n bounds.height += padding * 2;\n\n\n if(this.renderer.currentRenderTarget.transform)\n {\n //TODO this will break if the renderTexture transform is anything other than a translation.\n //Will need to take the full matrix transform into acount..\n var transform = this.renderer.currentRenderTarget.transform;\n\n bounds.x += transform.tx;\n bounds.y += transform.ty;\n\n this.capFilterArea( bounds );\n\n bounds.x -= transform.tx;\n bounds.y -= transform.ty;\n }\n else\n {\n this.capFilterArea( bounds );\n }\n\n if(bounds.width > 0 && bounds.height > 0)\n {\n this.currentFrame = bounds;\n\n var texture = this.getRenderTarget();\n\n this.renderer.setRenderTarget(texture);\n\n // clear the texture..\n texture.clear();\n\n // TODO get rid of object creation!\n this.filterStack.push({\n renderTarget: texture,\n filter: filters\n });\n\n }\n else\n {\n // push somthing on to the stack that is empty\n this.filterStack.push({\n renderTarget: null,\n filter: filters\n });\n }\n};\n\n\n/**\n * Removes the last filter from the filter stack and returns it.\n *\n */\nFilterManager.prototype.popFilter = function ()\n{\n var filterData = this.filterStack.pop();\n var previousFilterData = this.filterStack[this.filterStack.length-1];\n\n var input = filterData.renderTarget;\n\n // if the renderTarget is null then we don't apply the filter as its offscreen\n if(!filterData.renderTarget)\n {\n return;\n }\n\n var output = previousFilterData.renderTarget;\n\n // use program\n var gl = this.renderer.gl;\n\n\n this.currentFrame = input.frame;\n\n this.quad.map(this.textureSize, input.frame);\n\n\n // TODO.. this probably only needs to be done once!\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quad.vertexBuffer);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.quad.indexBuffer);\n\n var filters = filterData.filter;\n\n // assuming all filters follow the correct format??\n gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0);\n gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 2 * 4 * 4);\n gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aColor, 4, gl.FLOAT, false, 0, 4 * 4 * 4);\n\n // restore the normal blendmode!\n this.renderer.blendModeManager.setBlendMode(CONST.BLEND_MODES.NORMAL);\n\n if (filters.length === 1)\n {\n // TODO (cengler) - There has to be a better way then setting this each time?\n if (filters[0].uniforms.dimensions)\n {\n filters[0].uniforms.dimensions.value[0] = this.renderer.width;\n filters[0].uniforms.dimensions.value[1] = this.renderer.height;\n filters[0].uniforms.dimensions.value[2] = this.quad.vertices[0];\n filters[0].uniforms.dimensions.value[3] = this.quad.vertices[5];\n }\n\n filters[0].applyFilter( this.renderer, input, output );\n this.returnRenderTarget( input );\n\n }\n else\n {\n var flipTexture = input;\n var flopTexture = this.getRenderTarget(true);\n\n for (var i = 0; i < filters.length-1; i++)\n {\n var filter = filters[i];\n\n // TODO (cengler) - There has to be a better way then setting this each time?\n if (filter.uniforms.dimensions)\n {\n filter.uniforms.dimensions.value[0] = this.renderer.width;\n filter.uniforms.dimensions.value[1] = this.renderer.height;\n filter.uniforms.dimensions.value[2] = this.quad.vertices[0];\n filter.uniforms.dimensions.value[3] = this.quad.vertices[5];\n }\n\n filter.applyFilter( this.renderer, flipTexture, flopTexture );\n\n var temp = flipTexture;\n flipTexture = flopTexture;\n flopTexture = temp;\n }\n\n filters[filters.length-1].applyFilter( this.renderer, flipTexture, output );\n\n this.returnRenderTarget( flipTexture );\n this.returnRenderTarget( flopTexture );\n }\n\n return filterData.filter;\n};\n\n/**\n * Grabs an render target from the internal pool\n *\n * @param clear {boolean} Whether or not we need to clear the RenderTarget\n * @return {RenderTarget}\n */\nFilterManager.prototype.getRenderTarget = function ( clear )\n{\n var renderTarget = this.texturePool.pop() || new RenderTarget(this.renderer.gl, this.textureSize.width, this.textureSize.height, CONST.SCALE_MODES.LINEAR, this.renderer.resolution * CONST.FILTER_RESOLUTION);\n renderTarget.frame = this.currentFrame;\n\n if (clear)\n {\n renderTarget.clear(true);\n }\n\n return renderTarget;\n};\n\n/*\n * Returns a RenderTarget to the internal pool\n * @param renderTarget {RenderTarget} The RenderTarget we want to return to the pool\n */\nFilterManager.prototype.returnRenderTarget = function (renderTarget)\n{\n this.texturePool.push( renderTarget );\n};\n\n/*\n * Applies the filter\n * @param shader {Shader} The shader to upload\n * @param inputTarget {RenderTarget}\n * @param outputTarget {RenderTarget}\n * @param clear {boolean} Whether or not we want to clear the outputTarget\n */\nFilterManager.prototype.applyFilter = function (shader, inputTarget, outputTarget, clear)\n{\n var gl = this.renderer.gl;\n\n this.renderer.setRenderTarget(outputTarget);\n\n if (clear)\n {\n outputTarget.clear();\n }\n\n // set the shader\n this.renderer.shaderManager.setShader(shader);\n\n // TODO (cengler) - Can this be cached and not `toArray`ed each frame?\n shader.uniforms.projectionMatrix.value = this.renderer.currentRenderTarget.projectionMatrix.toArray(true);\n\n //TODO can this be optimised?\n shader.syncUniforms();\n/*\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0);\n gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 2 * 4 * 4);\n gl.vertexAttribPointer(shader.attributes.aColor, 4, gl.FLOAT, false, 0, 4 * 4 * 4);\n*/\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, inputTarget.texture);\n\n gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\n};\n\n/*\n * Calculates the mapped matrix\n * @param filterArea {Rectangle} The filter area\n * @param sprite {Sprite} the target sprite\n * @param outputMatrix {Matrix} @alvin\n */\n// TODO playing around here.. this is temporary - (will end up in the shader)\nFilterManager.prototype.calculateMappedMatrix = function (filterArea, sprite, outputMatrix)\n{\n var worldTransform = sprite.worldTransform.copy(math.Matrix.TEMP_MATRIX),\n texture = sprite._texture.baseTexture;\n\n var mappedMatrix = outputMatrix.identity();\n\n // scale..\n var ratio = this.textureSize.height / this.textureSize.width;\n\n mappedMatrix.translate(filterArea.x / this.textureSize.width, filterArea.y / this.textureSize.height );\n\n mappedMatrix.scale(1 , ratio);\n\n var translateScaleX = (this.textureSize.width / texture.width);\n var translateScaleY = (this.textureSize.height / texture.height);\n\n worldTransform.tx /= texture.width * translateScaleX;\n worldTransform.ty /= texture.width * translateScaleX;\n\n worldTransform.invert();\n\n mappedMatrix.prepend(worldTransform);\n\n // apply inverse scale..\n mappedMatrix.scale(1 , 1/ratio);\n\n mappedMatrix.scale( translateScaleX , translateScaleY );\n\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n\n // Keeping the orginal as a reminder to me on how this works!\n //\n // var m = new math.Matrix();\n\n // // scale..\n // var ratio = this.textureSize.height / this.textureSize.width;\n\n // m.translate(filterArea.x / this.textureSize.width, filterArea.y / this.textureSize.height);\n\n\n // m.scale(1 , ratio);\n\n\n // var transform = wt.clone();\n\n // var translateScaleX = (this.textureSize.width / 620);\n // var translateScaleY = (this.textureSize.height / 380);\n\n // transform.tx /= 620 * translateScaleX;\n // transform.ty /= 620 * translateScaleX;\n\n // transform.invert();\n\n // transform.append(m);\n\n // // apply inverse scale..\n // transform.scale(1 , 1/ratio);\n\n // transform.scale( translateScaleX , translateScaleY );\n\n // return transform;\n};\n\n/*\n * Constrains the filter area to the texture size\n * @param filterArea {Rectangle} The filter area we want to cap\n */\nFilterManager.prototype.capFilterArea = function (filterArea)\n{\n if (filterArea.x < 0)\n {\n filterArea.width += filterArea.x;\n filterArea.x = 0;\n }\n\n if (filterArea.y < 0)\n {\n filterArea.height += filterArea.y;\n filterArea.y = 0;\n }\n\n if ( filterArea.x + filterArea.width > this.textureSize.width )\n {\n filterArea.width = this.textureSize.width - filterArea.x;\n }\n\n if ( filterArea.y + filterArea.height > this.textureSize.height )\n {\n filterArea.height = this.textureSize.height - filterArea.y;\n }\n};\n\n/*\n * Resizes all the render targets in the pool\n * @param width {number} the new width\n * @param height {number} the new height\n */\nFilterManager.prototype.resize = function ( width, height )\n{\n this.textureSize.width = width;\n this.textureSize.height = height;\n\n for (var i = 0; i < this.texturePool.length; i++)\n {\n this.texturePool[i].resize( width, height );\n }\n};\n\n/**\n * Destroys the filter and removes it from the filter stack.\n *\n */\nFilterManager.prototype.destroy = function ()\n{\n this.filterStack = null;\n this.offsetY = 0;\n\n // destroy textures\n for (var i = 0; i < this.texturePool.length; i++)\n {\n this.texturePool[i].destroy();\n }\n\n this.texturePool = null;\n};\n","var WebGLManager = require('./WebGLManager'),\n AlphaMaskFilter = require('../filters/SpriteMaskFilter');\n\n/**\n * @class\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction MaskManager(renderer)\n{\n WebGLManager.call(this, renderer);\n\n this.stencilStack = [];\n this.reverse = true;\n this.count = 0;\n\n this.alphaMaskPool = [];\n}\n\nMaskManager.prototype = Object.create(WebGLManager.prototype);\nMaskManager.prototype.constructor = MaskManager;\nmodule.exports = MaskManager;\n\n/**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param graphics {Graphics}\n * @param webGLData {any[]}\n */\nMaskManager.prototype.pushMask = function (target, maskData)\n{\n if (maskData.texture)\n {\n this.pushSpriteMask(target, maskData);\n }\n else\n {\n this.pushStencilMask(target, maskData);\n }\n\n};\n\n/**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * @param target {RenderTarget}\n * @param maskData {any[]}\n */\nMaskManager.prototype.popMask = function (target, maskData)\n{\n if (maskData.texture)\n {\n this.popSpriteMask(target, maskData);\n }\n else\n {\n this.popStencilMask(target, maskData);\n }\n};\n\n/**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param target {RenderTarget}\n * @param maskData {any[]}\n */\nMaskManager.prototype.pushSpriteMask = function (target, maskData)\n{\n var alphaMaskFilter = this.alphaMaskPool.pop();\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = [new AlphaMaskFilter(maskData)];\n }\n\n alphaMaskFilter[0].maskSprite = maskData;\n this.renderer.filterManager.pushFilter(target, alphaMaskFilter);\n};\n\n/**\n * Removes the last filter from the filter stack and doesn't return it.\n *\n */\nMaskManager.prototype.popSpriteMask = function ()\n{\n var filters = this.renderer.filterManager.popFilter();\n\n this.alphaMaskPool.push(filters);\n};\n\n\n/**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param target {RenderTarget}\n * @param maskData {any[]}\n */\nMaskManager.prototype.pushStencilMask = function (target, maskData)\n{\n this.renderer.stencilManager.pushMask(maskData);\n};\n\n/**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param target {RenderTarget}\n * @param maskData {any[]}\n */\nMaskManager.prototype.popStencilMask = function (target, maskData)\n{\n this.renderer.stencilManager.popMask(maskData);\n};\n\n","var WebGLManager = require('./WebGLManager'),\n TextureShader = require('../shaders/TextureShader'),\n ComplexPrimitiveShader = require('../shaders/ComplexPrimitiveShader'),\n PrimitiveShader = require('../shaders/PrimitiveShader'),\n utils = require('../../../utils');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.WebGLManager\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction ShaderManager(renderer)\n{\n WebGLManager.call(this, renderer);\n\n /**\n * @member {number}\n */\n this.maxAttibs = 10;\n\n /**\n * @member {any[]}\n */\n this.attribState = [];\n\n /**\n * @member {any[]}\n */\n this.tempAttribState = [];\n\n for (var i = 0; i < this.maxAttibs; i++)\n {\n this.attribState[i] = false;\n }\n\n /**\n * @member {any[]}\n */\n this.stack = [];\n\n /**\n * @member {number}\n * @private\n */\n this._currentId = -1;\n\n /**\n * @member {Shader}\n * @private\n */\n this.currentShader = null;\n\n// this.initPlugins();\n}\n\nShaderManager.prototype = Object.create(WebGLManager.prototype);\nShaderManager.prototype.constructor = ShaderManager;\nutils.pluginTarget.mixin(ShaderManager);\n\nmodule.exports = ShaderManager;\n\n/**\n * Called when there is a WebGL context change.\n *\n */\nShaderManager.prototype.onContextChange = function ()\n{\n this.initPlugins();\n\n var gl = this.renderer.gl;\n\n // get the maximum number of attribute correctly as this tends to vary\n this.maxAttibs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\n this.attribState = [];\n\n for (var i = 0; i < this.maxAttibs; i++)\n {\n this.attribState[i] = false;\n }\n\n // TODO - Why are these not plugins? We can't decouple primitives unless they are....\n this.defaultShader = new TextureShader(this);\n this.primitiveShader = new PrimitiveShader(this);\n this.complexPrimitiveShader = new ComplexPrimitiveShader(this);\n};\n\n/**\n * Takes the attributes given in parameters and uploads them.\n *\n * @param attribs {Array} attribs\n */\nShaderManager.prototype.setAttribs = function (attribs)\n{\n // reset temp state\n var i;\n\n for (i = 0; i < this.tempAttribState.length; i++)\n {\n this.tempAttribState[i] = false;\n }\n\n // set the new attribs\n for (var a in attribs)\n {\n this.tempAttribState[attribs[a]] = true;\n }\n\n var gl = this.renderer.gl;\n\n for (i = 0; i < this.attribState.length; i++)\n {\n if (this.attribState[i] !== this.tempAttribState[i])\n {\n this.attribState[i] = this.tempAttribState[i];\n\n if (this.attribState[i])\n {\n gl.enableVertexAttribArray(i);\n }\n else\n {\n gl.disableVertexAttribArray(i);\n }\n }\n }\n};\n\n/**\n * Sets the current shader.\n *\n * @param shader {Shader} the shader to upload\n */\nShaderManager.prototype.setShader = function (shader)\n{\n if (this._currentId === shader.uuid)\n {\n return false;\n }\n\n this._currentId = shader.uuid;\n\n this.currentShader = shader;\n\n this.renderer.gl.useProgram(shader.program);\n this.setAttribs(shader.attributes);\n\n return true;\n};\n\n/**\n * Destroys this object.\n *\n */\nShaderManager.prototype.destroy = function ()\n{\n WebGLManager.prototype.destroy.call(this);\n\n this.destroyPlugins();\n\n this.attribState = null;\n\n this.tempAttribState = null;\n};\n","var WebGLManager = require('./WebGLManager'),\n utils = require('../../../utils');\n\n/**\n * @class\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction WebGLMaskManager(renderer)\n{\n WebGLManager.call(this, renderer);\n this.stencilMaskStack = null;\n}\n\nWebGLMaskManager.prototype = Object.create(WebGLManager.prototype);\nWebGLMaskManager.prototype.constructor = WebGLMaskManager;\nmodule.exports = WebGLMaskManager;\n\n/**\n * Changes the mask stack that is used by this manager\n * @param stencilMaskStack {StencilMaskStack} The mask stack \n *\n */\nWebGLMaskManager.prototype.setMaskStack = function ( stencilMaskStack )\n{\n this.stencilMaskStack = stencilMaskStack;\n\n var gl = this.renderer.gl;\n\n if (stencilMaskStack.stencilStack.length === 0)\n {\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n gl.enable(gl.STENCIL_TEST);\n }\n};\n\n/**\n * Applies the Mask and adds it to the current filter stack. @alvin\n * \n * @param graphics {Graphics}\n * @param webGLData {any[]}\n */\nWebGLMaskManager.prototype.pushStencil = function (graphics, webGLData)\n{\n this.renderer.currentRenderTarget.attachStencilBuffer();\n\n var gl = this.renderer.gl,\n sms = this.stencilMaskStack;\n\n this.bindGraphics(graphics, webGLData, this.renderer);\n\n if (sms.stencilStack.length === 0)\n {\n gl.enable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n sms.reverse = true;\n sms.count = 0;\n }\n\n sms.stencilStack.push(webGLData);\n\n var level = sms.count;\n\n gl.colorMask(false, false, false, false);\n\n gl.stencilFunc(gl.ALWAYS,0,0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INVERT);\n\n // draw the triangle strip!\n\n if (webGLData.mode === 1)\n {\n gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 );\n\n if (sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR);\n }\n\n // draw a quad to increment..\n gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 );\n\n if (sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL,0xFF-(level+1), 0xFF);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level+1, 0xFF);\n }\n\n sms.reverse = !sms.reverse;\n }\n else\n {\n if (!sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR);\n }\n\n gl.drawElements(gl.TRIANGLE_STRIP, webGLData.indices.length, gl.UNSIGNED_SHORT, 0 );\n\n if (!sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL,0xFF-(level+1), 0xFF);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level+1, 0xFF);\n }\n }\n\n gl.colorMask(true, true, true, true);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP);\n\n sms.count++;\n};\n\n/**\n * TODO this does not belong here!\n *\n * @param graphics {Graphics}\n * @param webGLData {Array}\n */\nWebGLMaskManager.prototype.bindGraphics = function (graphics, webGLData)\n{\n //if (this._currentGraphics === graphics)return;\n this._currentGraphics = graphics;\n\n var gl = this.renderer.gl;\n\n // bind the graphics object..\n var shader;// = this.renderer.shaderManager.plugins.primitiveShader;\n\n if (webGLData.mode === 1)\n {\n shader = this.renderer.shaderManager.complexPrimitiveShader;\n\n this.renderer.shaderManager.setShader(shader);\n\n gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, graphics.worldTransform.toArray(true));\n\n gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, this.renderer.currentRenderTarget.projectionMatrix.toArray(true));\n\n gl.uniform3fv(shader.uniforms.tint._location, utils.hex2rgb(graphics.tint));\n\n gl.uniform3fv(shader.uniforms.color._location, webGLData.color);\n\n gl.uniform1f(shader.uniforms.alpha._location, graphics.worldAlpha);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer);\n\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 4 * 2, 0);\n\n\n // now do the rest..\n // set the index buffer!\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, webGLData.indexBuffer);\n }\n else\n {\n //this.renderer.shaderManager.activatePrimitiveShader();\n shader = this.renderer.shaderManager.primitiveShader;\n\n this.renderer.shaderManager.setShader( shader );\n\n gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, graphics.worldTransform.toArray(true));\n\n gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, this.renderer.currentRenderTarget.projectionMatrix.toArray(true));\n\n gl.uniform3fv(shader.uniforms.tint._location, utils.hex2rgb(graphics.tint));\n\n gl.uniform1f(shader.uniforms.alpha._location, graphics.worldAlpha);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer);\n\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0);\n gl.vertexAttribPointer(shader.attributes.aColor, 4, gl.FLOAT, false,4 * 6, 2 * 4);\n\n // set the index buffer!\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, webGLData.indexBuffer);\n }\n};\n\n/**\n * TODO @alvin\n * @param graphics {Graphics}\n * @param webGLData {Array}\n */\nWebGLMaskManager.prototype.popStencil = function (graphics, webGLData)\n{\n var gl = this.renderer.gl,\n sms = this.stencilMaskStack;\n\n sms.stencilStack.pop();\n\n sms.count--;\n\n if (sms.stencilStack.length === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n\n }\n else\n {\n\n var level = sms.count;\n\n this.bindGraphics(graphics, webGLData, this.renderer);\n\n gl.colorMask(false, false, false, false);\n\n if (webGLData.mode === 1)\n {\n sms.reverse = !sms.reverse;\n\n if (sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL, 0xFF - (level+1), 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level+1, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR);\n }\n\n // draw a quad to increment..\n gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 );\n\n gl.stencilFunc(gl.ALWAYS,0,0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INVERT);\n\n // draw the triangle strip!\n gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 );\n\n if (!sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL,0xFF-(level), 0xFF);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level, 0xFF);\n }\n\n }\n else\n {\n // console.log(\"<<>>\")\n if (!sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL, 0xFF - (level+1), 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level+1, 0xFF);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR);\n }\n\n gl.drawElements(gl.TRIANGLE_STRIP, webGLData.indices.length, gl.UNSIGNED_SHORT, 0 );\n\n if (!sms.reverse)\n {\n gl.stencilFunc(gl.EQUAL,0xFF-(level), 0xFF);\n }\n else\n {\n gl.stencilFunc(gl.EQUAL,level, 0xFF);\n }\n }\n\n gl.colorMask(true, true, true, true);\n gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP);\n\n\n }\n};\n\n/**\n * Destroys the mask stack.\n *\n */\nWebGLMaskManager.prototype.destroy = function ()\n{\n WebGLManager.prototype.destroy.call(this);\n\n this.stencilMaskStack.stencilStack = null;\n};\n\n/**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param maskData {any[]} The mask data structure to use\n */\nWebGLMaskManager.prototype.pushMask = function (maskData)\n{\n\n\n this.renderer.setObjectRenderer(this.renderer.plugins.graphics);\n\n if (maskData.dirty)\n {\n this.renderer.plugins.graphics.updateGraphics(maskData, this.renderer.gl);\n }\n\n if (!maskData._webGL[this.renderer.gl.id].data.length)\n {\n return;\n }\n\n this.pushStencil(maskData, maskData._webGL[this.renderer.gl.id].data[0], this.renderer);\n};\n\n/**\n * Removes the last filter from the filter stack and doesn't return it.\n *\n * @param maskData {any[]}\n */\nWebGLMaskManager.prototype.popMask = function (maskData)\n{\n this.renderer.setObjectRenderer(this.renderer.plugins.graphics);\n\n this.popStencil(maskData, maskData._webGL[this.renderer.gl.id].data[0], this.renderer);\n};\n\n","/**\n * @class\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction WebGLManager(renderer)\n{\n /**\n * The renderer this manager works for.\n *\n * @member {WebGLRenderer}\n */\n this.renderer = renderer;\n\n this.renderer.on('context', this.onContextChange, this);\n}\n\nWebGLManager.prototype.constructor = WebGLManager;\nmodule.exports = WebGLManager;\n\n/**\n * Generic method called when there is a WebGL context change.\n *\n */\nWebGLManager.prototype.onContextChange = function ()\n{\n\t// do some codes init!\n};\n\n/**\n * Generic destroy methods to be overridden by the subclass\n *\n */\nWebGLManager.prototype.destroy = function ()\n{\n this.renderer.off('context', this.onContextChange, this);\n\n this.renderer = null;\n};\n","var Shader = require('./Shader');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n * @param shaderManager {ShaderManager} The webgl shader manager this shader works for.\n */\nfunction ComplexPrimitiveShader(shaderManager)\n{\n Shader.call(this,\n shaderManager,\n // vertex shader\n [\n 'attribute vec2 aVertexPosition;',\n\n 'uniform mat3 translationMatrix;',\n 'uniform mat3 projectionMatrix;',\n\n 'uniform vec3 tint;',\n 'uniform float alpha;',\n 'uniform vec3 color;',\n\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vColor = vec4(color * alpha * tint, alpha);',//\" * vec4(tint * alpha, alpha);',\n '}'\n ].join('\\n'),\n // fragment shader\n [\n 'precision mediump float;',\n\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_FragColor = vColor;',\n '}'\n ].join('\\n'),\n // custom uniforms\n {\n tint: { type: '3f', value: [0, 0, 0] },\n alpha: { type: '1f', value: 0 },\n color: { type: '3f', value: [0,0,0] },\n translationMatrix: { type: 'mat3', value: new Float32Array(9) },\n projectionMatrix: { type: 'mat3', value: new Float32Array(9) }\n },\n // attributes\n {\n aVertexPosition:0\n }\n );\n}\n\nComplexPrimitiveShader.prototype = Object.create(Shader.prototype);\nComplexPrimitiveShader.prototype.constructor = ComplexPrimitiveShader;\nmodule.exports = ComplexPrimitiveShader;\n","var Shader = require('./Shader');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n * @param shaderManager {ShaderManager} The webgl shader manager this shader works for.\n */\nfunction PrimitiveShader(shaderManager)\n{\n Shader.call(this,\n shaderManager,\n // vertex shader\n [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec4 aColor;',\n\n 'uniform mat3 translationMatrix;',\n 'uniform mat3 projectionMatrix;',\n\n 'uniform float alpha;',\n 'uniform float flipY;',\n 'uniform vec3 tint;',\n\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vColor = aColor * vec4(tint * alpha, alpha);',\n '}'\n ].join('\\n'),\n // fragment shader\n [\n 'precision mediump float;',\n\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_FragColor = vColor;',\n '}'\n ].join('\\n'),\n // custom uniforms\n {\n tint: { type: '3f', value: [0, 0, 0] },\n alpha: { type: '1f', value: 0 },\n translationMatrix: { type: 'mat3', value: new Float32Array(9) },\n projectionMatrix: { type: 'mat3', value: new Float32Array(9) }\n },\n // custom attributes\n {\n aVertexPosition:0,\n aColor:0\n }\n );\n}\n\nPrimitiveShader.prototype = Object.create(Shader.prototype);\nPrimitiveShader.prototype.constructor = PrimitiveShader;\nmodule.exports = PrimitiveShader;\n","/*global console */\nvar utils = require('../../../utils');\n\n/**\n * @class\n * @memberof PIXI\n * @param shaderManager {ShaderManager} The webgl shader manager this shader works for.\n * @param [vertexSrc] {string} The source of the vertex shader.\n * @param [fragmentSrc] {string} The source of the fragment shader.\n * @param [uniforms] {object} Uniforms for this shader.\n * @param [attributes] {object} Attributes for this shader.\n */\nfunction Shader(shaderManager, vertexSrc, fragmentSrc, uniforms, attributes)\n{\n if (!vertexSrc || !fragmentSrc)\n {\n throw new Error('Pixi.js Error. Shader requires vertexSrc and fragmentSrc');\n }\n\n /**\n * A unique id\n * @member {number}\n * @readonly\n */\n this.uuid = utils.uuid();\n\n /**\n * The current WebGL drawing context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = shaderManager.renderer.gl;\n\n //TODO maybe we should pass renderer rather than shader manger?? food for thought..\n this.shaderManager = shaderManager;\n\n /**\n * The WebGL program.\n *\n * @member {WebGLProgram}\n * @readonly\n */\n this.program = null;\n\n /**\n * The uniforms as an object\n * @member {object}\n * @private\n */\n this.uniforms = uniforms || {};\n\n /**\n * The attributes as an object\n * @member {object}\n * @private\n */\n this.attributes = attributes || {};\n\n /**\n * Internal texture counter\n * @member {number}\n * @private\n */\n this.textureCount = 1;\n\n /**\n * The vertex shader as an array of strings\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * The fragment shader as an array of strings\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc;\n\n this.init();\n}\n\nShader.prototype.constructor = Shader;\nmodule.exports = Shader;\n\n/*\n * Creates the shader and uses it\n *\n */\nShader.prototype.init = function ()\n{\n this.compile();\n\n this.gl.useProgram(this.program);\n\n this.cacheUniformLocations(Object.keys(this.uniforms));\n this.cacheAttributeLocations(Object.keys(this.attributes));\n};\n\n/*\n * Caches the locations of the uniform for reuse\n * @param keys {string} the uniforms to cache\n */\nShader.prototype.cacheUniformLocations = function (keys)\n{\n for (var i = 0; i < keys.length; ++i)\n {\n this.uniforms[keys[i]]._location = this.gl.getUniformLocation(this.program, keys[i]);\n }\n};\n\n/*\n * Caches the locations of the attribute for reuse\n * @param keys {string} the attributes to cache\n */\nShader.prototype.cacheAttributeLocations = function (keys)\n{\n for (var i = 0; i < keys.length; ++i)\n {\n this.attributes[keys[i]] = this.gl.getAttribLocation(this.program, keys[i]);\n }\n\n // TODO: Check if this is needed anymore...\n\n // Begin worst hack eva //\n\n // WHY??? ONLY on my chrome pixel the line above returns -1 when using filters?\n // maybe its something to do with the current state of the gl context.\n // I'm convinced this is a bug in the chrome browser as there is NO reason why this should be returning -1 especially as it only manifests on my chrome pixel\n // If theres any webGL people that know why could happen please help :)\n // if (this.attributes.aColor === -1){\n // this.attributes.aColor = 2;\n // }\n\n // End worst hack eva //\n};\n\n/*\n * Attaches the shaders and creates the program\n * @return {WebGLProgram}\n */\nShader.prototype.compile = function ()\n{\n var gl = this.gl;\n\n var glVertShader = this._glCompile(gl.VERTEX_SHADER, this.vertexSrc);\n var glFragShader = this._glCompile(gl.FRAGMENT_SHADER, this.fragmentSrc);\n\n var program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\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 (this.program = program);\n};\n\n/*\nShader.prototype.buildSync = function ()\n{\n // var str = \"\"\n\n // str = \"Shader.prototype.syncUniforms = function()\";\n // str += \"{\\n\";\n\n for (var key in this.uniforms)\n {\n var uniform = this.uniforms[key];\n\n Object.defineProperty(this, key, {\n\n get: function ()\n {\n return uniform.value\n },\n set: function (value)\n {\n this.setUniform(uniform, value);\n }\n });\n\n console.log( makePropSetter( key, \" bloop\", uniform.type ) )\n // Object.def\n // location = uniform._location,\n // value = uniform.value,\n //i, il;\n\n // str += \"gl.uniform1i(this.uniforms.\"+ key +\"._location, this.uniforms.\" + key + \".value );\\n\"\n\n }\n\n}*/\n\n/**\n* Adds a new uniform\n*\n* @param uniform {Object} the new uniform to attach\n*/\nShader.prototype.syncUniform = function (uniform)\n{\n var location = uniform._location,\n value = uniform.value,\n gl = this.gl,\n i, il;\n\n switch (uniform.type)\n {\n // single int value\n case 'i':\n case '1i':\n gl.uniform1i(location, value);\n break;\n\n // single float value\n case 'f':\n case '1f':\n gl.uniform1f(location, value);\n break;\n\n // Float32Array(2) or JS Arrray\n case '2f':\n gl.uniform2f(location, value[0], value[1]);\n break;\n\n // Float32Array(3) or JS Arrray\n case '3f':\n gl.uniform3f(location, value[0], value[1], value[2]);\n break;\n\n // Float32Array(4) or JS Arrray\n case '4f':\n gl.uniform4f(location, value[0], value[1], value[2], value[3]);\n break;\n\n // a 2D Point object\n case 'v2':\n gl.uniform2f(location, value.x, value.y);\n break;\n\n // a 3D Point object\n case 'v3':\n gl.uniform3f(location, value.x, value.y, value.z);\n break;\n\n // a 4D Point object\n case 'v4':\n gl.uniform4f(location, value.x, value.y, value.z, value.w);\n break;\n\n // Int32Array or JS Array\n case '1iv':\n gl.uniform1iv(location, value);\n break;\n\n // Int32Array or JS Array\n case '2iv':\n gl.uniform2iv(location, value);\n break;\n\n // Int32Array or JS Array\n case '3iv':\n gl.uniform3iv(location, value);\n break;\n\n // Int32Array or JS Array\n case '4iv':\n gl.uniform4iv(location, value);\n break;\n\n // Float32Array or JS Array\n case '1fv':\n gl.uniform1fv(location, value);\n break;\n\n // Float32Array or JS Array\n case '2fv':\n gl.uniform2fv(location, value);\n break;\n\n // Float32Array or JS Array\n case '3fv':\n gl.uniform3fv(location, value);\n break;\n\n // Float32Array or JS Array\n case '4fv':\n gl.uniform4fv(location, value);\n break;\n\n // Float32Array or JS Array\n case 'm2':\n case 'mat2':\n case 'Matrix2fv':\n gl.uniformMatrix2fv(location, uniform.transpose, value);\n break;\n\n // Float32Array or JS Array\n case 'm3':\n case 'mat3':\n case 'Matrix3fv':\n\n gl.uniformMatrix3fv(location, uniform.transpose, value);\n break;\n\n // Float32Array or JS Array\n case 'm4':\n case 'mat4':\n case 'Matrix4fv':\n gl.uniformMatrix4fv(location, uniform.transpose, value);\n break;\n\n // a Color Value\n case 'c':\n if (typeof value === 'number')\n {\n value = utils.hex2rgb(value);\n }\n\n gl.uniform3f(location, value[0], value[1], value[2]);\n break;\n\n // flat array of integers (JS or typed array)\n case 'iv1':\n gl.uniform1iv(location, value);\n break;\n\n // flat array of integers with 3 x N size (JS or typed array)\n case 'iv':\n gl.uniform3iv(location, value);\n break;\n\n // flat array of floats (JS or typed array)\n case 'fv1':\n gl.uniform1fv(location, value);\n break;\n\n // flat array of floats with 3 x N size (JS or typed array)\n case 'fv':\n gl.uniform3fv(location, value);\n break;\n\n // array of 2D Point objects\n case 'v2v':\n if (!uniform._array)\n {\n uniform._array = new Float32Array(2 * value.length);\n }\n\n for (i = 0, il = value.length; i < il; ++i)\n {\n uniform._array[i * 2] = value[i].x;\n uniform._array[i * 2 + 1] = value[i].y;\n }\n\n gl.uniform2fv(location, uniform._array);\n break;\n\n // array of 3D Point objects\n case 'v3v':\n if (!uniform._array)\n {\n uniform._array = new Float32Array(3 * value.length);\n }\n\n for (i = 0, il = value.length; i < il; ++i)\n {\n uniform._array[i * 3] = value[i].x;\n uniform._array[i * 3 + 1] = value[i].y;\n uniform._array[i * 3 + 2] = value[i].z;\n\n }\n\n gl.uniform3fv(location, uniform._array);\n break;\n\n // array of 4D Point objects\n case 'v4v':\n if (!uniform._array)\n {\n uniform._array = new Float32Array(4 * value.length);\n }\n\n for (i = 0, il = value.length; i < il; ++i)\n {\n uniform._array[i * 4] = value[i].x;\n uniform._array[i * 4 + 1] = value[i].y;\n uniform._array[i * 4 + 2] = value[i].z;\n uniform._array[i * 4 + 3] = value[i].w;\n\n }\n\n gl.uniform4fv(location, uniform._array);\n break;\n\n // PIXI.Texture\n case 't':\n case 'sampler2D':\n\n if (!uniform.value || !uniform.value.baseTexture.hasLoaded)\n {\n break;\n }\n\n // activate this texture\n gl.activeTexture(gl['TEXTURE' + this.textureCount]);\n\n var texture = uniform.value.baseTexture._glTextures[gl.id];\n\n if (!texture)\n {\n this.initSampler2D(uniform);\n\n // set the textur to the newly created one..\n texture = uniform.value.baseTexture._glTextures[gl.id];\n }\n\n // bind the texture\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n // set uniform to texture index\n gl.uniform1i(uniform._location, this.textureCount);\n\n // increment next texture id\n this.textureCount++;\n\n break;\n\n default:\n console.warn('Pixi.js Shader Warning: Unknown uniform type: ' + uniform.type);\n }\n};\n\n/*\n * Updates the shader uniform values.\n */\nShader.prototype.syncUniforms = function ()\n{\n this.textureCount = 1;\n\n for (var key in this.uniforms)\n {\n this.syncUniform(this.uniforms[key]);\n }\n};\n\n\n/**\n * Initialises a Sampler2D uniform (which may only be available later on after initUniforms once the texture has loaded)\n *\n */\nShader.prototype.initSampler2D = function (uniform)\n{\n var gl = this.gl;\n\n var texture = uniform.value.baseTexture;\n\n if(!texture.hasLoaded)\n {\n return;\n }\n\n\n\n if (uniform.textureData)\n {\n\n //TODO move this...\n var data = uniform.textureData;\n\n texture._glTextures[gl.id] = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultipliedAlpha);\n // GLTexture = mag linear, min linear_mipmap_linear, wrap repeat + gl.generateMipmap(gl.TEXTURE_2D);\n // GLTextureLinear = mag/min linear, wrap clamp\n // GLTextureNearestRepeat = mag/min NEAREST, wrap repeat\n // GLTextureNearest = mag/min nearest, wrap clamp\n // AudioTexture = whatever + luminance + width 512, height 2, border 0\n // KeyTexture = whatever + luminance + width 256, height 2, border 0\n\n // magFilter can be: gl.LINEAR, gl.LINEAR_MIPMAP_LINEAR or gl.NEAREST\n // wrapS/T can be: gl.CLAMP_TO_EDGE or gl.REPEAT\n\n gl.texImage2D(gl.TEXTURE_2D, 0, data.luminance ? gl.LUMINANCE : gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, data.magFilter ? data.magFilter : gl.LINEAR );\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, data.wrapS ? data.wrapS : gl.CLAMP_TO_EDGE );\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, data.wrapS ? data.wrapS : gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, data.wrapT ? data.wrapT : gl.CLAMP_TO_EDGE);\n }\n else\n {\n this.shaderManager.renderer.updateTexture(texture);\n }\n};\n\n/**\n * Destroys the shader.\n *\n */\nShader.prototype.destroy = function ()\n{\n this.gl.deleteProgram(this.program);\n\n this.gl = null;\n this.uniforms = null;\n this.attributes = null;\n\n this.vertexSrc = null;\n this.fragmentSrc = null;\n};\n\nShader.prototype._glCompile = function (type, src)\n{\n var shader = this.gl.createShader(type);\n\n this.gl.shaderSource(shader, src);\n this.gl.compileShader(shader);\n\n if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS))\n {\n console.log(this.gl.getShaderInfoLog(shader));\n return null;\n }\n\n return shader;\n};\n","var Shader = require('./Shader');\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n * @param shaderManager {ShaderManager} The webgl shader manager this shader works for.\n * @param [vertexSrc] {string} The source of the vertex shader.\n * @param [fragmentSrc] {string} The source of the fragment shader.\n * @param [customUniforms] {object} Custom uniforms to use to augment the built-in ones.\n * @param [fragmentSrc] {string} The source of the fragment shader.\n */\nfunction TextureShader(shaderManager, vertexSrc, fragmentSrc, customUniforms, customAttributes)\n{\n var uniforms = {\n\n uSampler: { type: 'sampler2D', value: 0 },\n projectionMatrix: { type: 'mat3', value: new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]) }\n };\n\n if (customUniforms)\n {\n for (var u in customUniforms)\n {\n uniforms[u] = customUniforms[u];\n }\n }\n\n\n var attributes = {\n aVertexPosition: 0,\n aTextureCoord: 0,\n aColor: 0\n };\n\n if (customAttributes)\n {\n for (var a in customAttributes)\n {\n attributes[a] = customAttributes[a];\n }\n }\n\n /**\n * The vertex shader.\n * @member {Array}\n */\n vertexSrc = vertexSrc || TextureShader.defaultVertexSrc;\n\n /**\n * The fragment shader.\n * @member {Array}\n */\n fragmentSrc = fragmentSrc || TextureShader.defaultFragmentSrc;\n\n Shader.call(this, shaderManager, vertexSrc, fragmentSrc, uniforms, attributes);\n}\n\n// constructor\nTextureShader.prototype = Object.create(Shader.prototype);\nTextureShader.prototype.constructor = TextureShader;\nmodule.exports = TextureShader;\n\nTextureShader.defaultVertexSrc = [\n 'precision lowp float;',\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n 'attribute vec4 aColor;',\n\n 'uniform mat3 projectionMatrix;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vTextureCoord = aTextureCoord;',\n ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);',\n '}'\n].join('\\n');\n\nTextureShader.defaultFragmentSrc = [\n 'precision lowp float;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'uniform sampler2D uSampler;',\n\n 'void main(void){',\n ' gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;',\n '}'\n].join('\\n');\n","var WebGLManager = require('../managers/WebGLManager');\n\n/**\n * Base for a common object renderer that can be used as a system renderer plugin.\n *\n * @class\n * @extends PIXI.WebGLManager\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this object renderer works for.\n */\nfunction ObjectRenderer(renderer)\n{\n WebGLManager.call(this, renderer);\n}\n\n\nObjectRenderer.prototype = Object.create(WebGLManager.prototype);\nObjectRenderer.prototype.constructor = ObjectRenderer;\nmodule.exports = ObjectRenderer;\n\n/**\n * Starts the renderer and sets the shader\n *\n */\nObjectRenderer.prototype.start = function ()\n{\n // set the shader..\n};\n\n/**\n * Stops the renderer\n *\n */\nObjectRenderer.prototype.stop = function ()\n{\n this.flush();\n};\n\n/**\n * flushes\n *\n */\nObjectRenderer.prototype.flush = function ()\n{\n // flush!\n};\n\n/**\n * Renders an object\n *\n */\nObjectRenderer.prototype.render = function (object) // jshint unused:false\n{\n // render the object\n};\n","/**\n * Helper class to create a quad\n * @class\n * @memberof PIXI\n * @param gl {WebGLRenderingContext} The gl context for this quad to use.\n */\nfunction Quad(gl)\n{\n /*\n * the current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n// this.textures = new TextureUvs();\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n 0,0,\n 200,0,\n 200,200,\n 0,200\n ]);\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\n// var white = (0xFFFFFF >> 16) + (0xFFFFFF & 0xff00) + ((0xFFFFFF & 0xff) << 16) + (1 * 255 << 24);\n //TODO convert this to a 32 unsigned int array\n /**\n * The color components of the triangles\n *\n * @member {Float32Array}\n */\n this.colors = new Float32Array([\n 1,1,1,1,\n 1,1,1,1,\n 1,1,1,1,\n 1,1,1,1\n ]);\n\n /*\n * @member {Uint16Array} An array containing the indices of the vertices\n */\n this.indices = new Uint16Array([\n 0, 1, 2, 0, 3, 2\n ]);\n\n /*\n * @member {WebGLBuffer} The vertex buffer\n */\n this.vertexBuffer = gl.createBuffer();\n\n /*\n * @member {WebGLBuffer} The index buffer\n */\n this.indexBuffer = gl.createBuffer();\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, (8 + 8 + 16) * 4, gl.DYNAMIC_DRAW);\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);\n\n this.upload();\n}\n\nQuad.prototype.constructor = Quad;\n\n/**\n * Maps two Rectangle to the quad\n * @param rect {Rectangle} the first rectangle\n * @param rect2 {Rectangle} the second rectangle\n */\nQuad.prototype.map = function(rect, rect2)\n{\n var x = 0; //rect2.x / rect.width;\n var y = 0; //rect2.y / rect.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + rect2.width / rect.width;\n this.uvs[3] = y;\n\n this.uvs[4] = x + rect2.width / rect.width;\n this.uvs[5] = y + rect2.height / rect.height;\n\n this.uvs[6] = x;\n this.uvs[7] = y + rect2.height / rect.height;\n\n /// -----\n x = rect2.x;\n y = rect2.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + rect2.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + rect2.width;\n this.vertices[5] = y + rect2.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + rect2.height;\n\n this.upload();\n};\n\n/**\n * Binds the buffer and uploads the data\n */\nQuad.prototype.upload = function()\n{\n var gl = this.gl;\n\n // TODO could probably be pushed into one upload!\n gl.bindBuffer( gl.ARRAY_BUFFER, this.vertexBuffer );\n\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);\n\n gl.bufferSubData(gl.ARRAY_BUFFER, 8 * 4, this.uvs);\n\n gl.bufferSubData(gl.ARRAY_BUFFER, (8 + 8) * 4, this.colors);\n};\n\nmodule.exports = Quad;\n\n\n","var math = require('../../../math'),\n utils = require('../../../utils'),\n CONST = require('../../../const'),\n //StencilManager = require('../managers/StencilManager'),\n StencilMaskStack = require('./StencilMaskStack');\n\n/**\n * @author Mat Groves http://matgroves.com/ @Doormat23\n */\n\n/**\n * @class\n * @memberof PIXI\n * @param gl {WebGLRenderingContext} the current WebGL drawing context\n * @param width {number} the horizontal range of the filter\n * @param height {number} the vertical range of the filter\n * @param scaleMode {number} See {{#crossLink \"PIXI/scaleModes:property\"}}PIXI.scaleModes{{/crossLink}} for possible values\n * @param resolution {number} the current resolution\n * @param root {boolean} Whether this object is the root element or not\n */\nvar RenderTarget = function(gl, width, height, scaleMode, resolution, root)\n{\n //TODO Resolution could go here ( eg low res blurs )\n\n /**\n * The current WebGL drawing context\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n // next time to create a frame buffer and texture\n\n /**\n * A frame buffer\n * @member {WebGLFrameBuffer}\n */\n this.frameBuffer = null;\n\n /**\n * @member {Texture}\n */\n this.texture = null;\n\n /**\n * The size of the object as a rectangle\n * @member {Rectangle}\n */\n this.size = new math.Rectangle(0, 0, 1, 1);\n\n /**\n * The current resolution\n * @member {number}\n */\n this.resolution = resolution || CONST.RESOLUTION;\n\n /**\n * The projection matrix\n * @member {Matrix}\n */\n this.projectionMatrix = new math.Matrix();\n\n /**\n * The object's transform\n * @member {Matrix}\n */\n this.transform = null;\n\n /**\n *\n * @member {Rectangle}\n */\n this.frame = null;\n\n /**\n * The stencil buffer stores masking data for the render target\n * @member {WebGLRenderBuffer}\n */\n this.stencilBuffer = null;\n\n /**\n * The data structure for the stencil masks\n * @member {StencilMaskStack}\n */\n this.stencilMaskStack = new StencilMaskStack();\n\n /**\n * Stores filter data for the render target\n * @member {Array}\n */\n this.filterStack = [\n {\n renderTarget:this,\n filter:[],\n bounds:this.size\n }\n ];\n\n\n /**\n * The scale mode\n * @member {number}\n * @default CONST.SCALE_MODES.DEFAULT\n */\n this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT;\n\n /**\n * Whether this object is the root element or not\n * @member {boolean}\n */\n this.root = root;\n\n if (!this.root)\n {\n // this.flipY = true;\n this.frameBuffer = gl.createFramebuffer();\n\n /*\n A frame buffer needs a target to render to..\n create a texture and bind it attach it to the framebuffer..\n */\n\n this.texture = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n // set the scale properties of the texture..\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, scaleMode === CONST.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, scaleMode === CONST.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n\n // check to see if the texture is a power of two!\n var isPowerOfTwo = utils.isPowerOfTwo(width, height);\n\n //TODO for 99% of use cases if a texture is power of two we should tile the texture...\n if (!isPowerOfTwo)\n {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n }\n else\n {\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n }\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer );\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture, 0);\n }\n\n\n this.resize(width, height);\n};\n\nRenderTarget.prototype.constructor = RenderTarget;\nmodule.exports = RenderTarget;\n\n/**\n* Clears the filter texture.\n*\n*/\nRenderTarget.prototype.clear = function(bind)\n{\n var gl = this.gl;\n if(bind)\n {\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer);\n }\n\n gl.clearColor(0,0,0,0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n};\n\n/**\n* Binds the stencil buffer.\n*\n*/\nRenderTarget.prototype.attachStencilBuffer = function()\n{\n\n if ( this.stencilBuffer )\n {\n return;\n }\n\n /*\n The stencil buffer is used for masking in pixi\n lets create one and then add attach it to the framebuffer..\n */\n if (!this.root)\n {\n var gl = this.gl;\n\n this.stencilBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencilBuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.stencilBuffer);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.size.width * this.resolution , this.size.height * this.resolution );\n }\n};\n\n/**\n* Binds the buffers and initialises the viewport.\n*\n*/\nRenderTarget.prototype.activate = function()\n{\n //TOOD refactor usage of frame..\n var gl = this.gl;\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer);\n\n var projectionFrame = this.frame || this.size;\n\n // TODO add a dirty flag to this of a setter for the frame?\n this.calculateProjection( projectionFrame );\n\n if(this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n gl.viewport(0,0, projectionFrame.width * this.resolution, projectionFrame.height * this.resolution);\n};\n\n/**\n* Updates the projection matrix based on a projection frame (which is a rectangle)\n*\n*/\nRenderTarget.prototype.calculateProjection = function( projectionFrame )\n{\n var pm = this.projectionMatrix;\n\n pm.identity();\n\n if (!this.root)\n {\n pm.a = 1 / projectionFrame.width*2;\n pm.d = 1 / projectionFrame.height*2;\n\n pm.tx = -1 - projectionFrame.x * pm.a;\n pm.ty = -1 - projectionFrame.y * pm.d;\n }\n else\n {\n pm.a = 1 / projectionFrame.width*2;\n pm.d = -1 / projectionFrame.height*2;\n\n pm.tx = -1 - projectionFrame.x * pm.a;\n pm.ty = 1 - projectionFrame.y * pm.d;\n }\n};\n\n\n/**\n * Resizes the texture to the specified width and height\n *\n * @param width {Number} the new width of the texture\n * @param height {Number} the new height of the texture\n */\nRenderTarget.prototype.resize = function(width, height)\n{\n width = width | 0;\n height = height | 0;\n\n if (this.size.width === width && this.size.height === height) {\n return;\n }\n\n this.size.width = width;\n this.size.height = height;\n\n if (!this.root)\n {\n var gl = this.gl;\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width * this.resolution, height * this.resolution , 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n if (this.stencilBuffer )\n {\n // update the stencil buffer width and height\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencilBuffer);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width * this.resolution, height * this.resolution );\n }\n }\n\n var projectionFrame = this.frame || this.size;\n\n this.calculateProjection( projectionFrame );\n};\n\n/**\n * Destroys the render target.\n *\n */\nRenderTarget.prototype.destroy = function()\n{\n var gl = this.gl;\n gl.deleteFramebuffer( this.frameBuffer );\n gl.deleteTexture( this.texture );\n\n this.frameBuffer = null;\n this.texture = null;\n};\n","/**\n * Generic Mask Stack data structure\n * @class\n * @memberof PIXI\n * @param renderer {WebGLRenderer} The renderer this manager works for.\n */\nfunction StencilMaskStack()\n{\n\t/**\n * The actual stack\n *\n * @member {Array}\n */\n this.stencilStack = [];\n\n /**\n * TODO @alvin\n *\n * @member {boolean}\n */\n this.reverse = true;\n\n /**\n * Internal count\n *\n * @member {number}\n */\n this.count = 0;\n}\n\nStencilMaskStack.prototype.constructor = StencilMaskStack;\nmodule.exports = StencilMaskStack;\n","var math = require('../math'),\n Texture = require('../textures/Texture'),\n Container = require('../display/Container'),\n CanvasTinter = require('../renderers/canvas/utils/CanvasTinter'),\n utils = require('../utils'),\n CONST = require('../const'),\n tempPoint = new math.Point();\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 * var sprite = new PIXI.Sprite.fromImage('assets/image.png');\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n * @param texture {Texture} The texture for this sprite\n */\nfunction Sprite(texture)\n{\n Container.call(this);\n\n /**\n * The anchor sets the origin point of the texture.\n * The default is 0,0 this means the texture's origin is the top left\n * Setting the anchor to 0.5,0.5 means the texture's origin is centered\n * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner\n *\n * @member {Point}\n */\n this.anchor = new math.Point();\n\n /**\n * The texture that the sprite is using\n *\n * @member {Texture}\n * @private\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @member {number}\n * @private\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @member {number}\n * @private\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 * @member {number}\n * @default [0xFFFFFF]\n */\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of blendModes.NORMAL to reset the blend mode.\n *\n * @member {number}\n * @default CONST.BLEND_MODES.NORMAL;\n */\n this.blendMode = CONST.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 {AbstractFilter}\n */\n this.shader = null;\n\n /**\n * An internal cached value of the tint.\n *\n * @member {number}\n * @default [0xFFFFFF]\n */\n this.cachedTint = 0xFFFFFF;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n}\n\n// constructor\nSprite.prototype = Object.create(Container.prototype);\nSprite.prototype.constructor = Sprite;\nmodule.exports = Sprite;\n\nObject.defineProperties(Sprite.prototype, {\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof PIXI.Sprite#\n */\n width: {\n get: function ()\n {\n return this.scale.x * this.texture._frame.width;\n },\n set: function (value)\n {\n this.scale.x = value / this.texture._frame.width;\n this._width = value;\n }\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 * @memberof PIXI.Sprite#\n */\n height: {\n get: function ()\n {\n return this.scale.y * this.texture._frame.height;\n },\n set: function (value)\n {\n this.scale.y = value / this.texture._frame.height;\n this._height = value;\n }\n },\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n * @memberof PIXI.Sprite#\n */\n texture: {\n get: function ()\n {\n return this._texture;\n },\n set: function (value)\n {\n if (this._texture === value)\n {\n return;\n }\n\n this._texture = value;\n this.cachedTint = 0xFFFFFF;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.hasLoaded)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n }\n});\n\n/**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @private\n */\nSprite.prototype._onTextureUpdate = function ()\n{\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = this._width / this.texture.frame.width;\n }\n\n if (this._height)\n {\n this.scale.y = this._height / this.texture.frame.height;\n }\n};\n\n/**\n*\n* Renders the object using the WebGL renderer\n*\n* @param renderer {WebGLRenderer}\n* @private\n*/\nSprite.prototype._renderWebGL = function (renderer)\n{\n renderer.setObjectRenderer(renderer.plugins.sprite);\n renderer.plugins.sprite.render(this);\n};\n\n/**\n * Returns the bounds of the Sprite as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n * @param matrix {Matrix} the transformation matrix of the sprite\n * @return {Rectangle} the framing rectangle\n */\nSprite.prototype.getBounds = function (matrix)\n{\n if(!this._currentBounds)\n {\n\n var width = this._texture._frame.width;\n var height = this._texture._frame.height;\n\n var w0 = width * (1-this.anchor.x);\n var w1 = width * -this.anchor.x;\n\n var h0 = height * (1-this.anchor.y);\n var h1 = height * -this.anchor.y;\n\n var worldTransform = matrix || this.worldTransform ;\n\n var a = worldTransform.a;\n var b = worldTransform.b;\n var c = worldTransform.c;\n var d = worldTransform.d;\n var tx = worldTransform.tx;\n var ty = worldTransform.ty;\n\n var minX,\n maxX,\n minY,\n maxY;\n\n\n if (b === 0 && c === 0)\n {\n // scale may be negative!\n if (a < 0)\n {\n a *= -1;\n }\n\n if (d < 0)\n {\n d *= -1;\n }\n\n // this means there is no rotation going on right? RIGHT?\n // if thats the case then we can avoid checking the bound values! yay\n minX = a * w1 + tx;\n maxX = a * w0 + tx;\n minY = d * h1 + ty;\n maxY = d * h0 + ty;\n }\n else\n {\n var x1 = a * w1 + c * h1 + tx;\n var y1 = d * h1 + b * w1 + ty;\n\n var x2 = a * w0 + c * h1 + tx;\n var y2 = d * h1 + b * w0 + ty;\n\n var x3 = a * w0 + c * h0 + tx;\n var y3 = d * h0 + b * w0 + ty;\n\n var x4 = a * w1 + c * h0 + tx;\n var y4 = d * h0 + b * w1 + ty;\n\n minX = x1;\n minX = x2 < minX ? x2 : minX;\n minX = x3 < minX ? x3 : minX;\n minX = x4 < minX ? x4 : minX;\n\n minY = y1;\n minY = y2 < minY ? y2 : minY;\n minY = y3 < minY ? y3 : minY;\n minY = y4 < minY ? y4 : minY;\n\n maxX = x1;\n maxX = x2 > maxX ? x2 : maxX;\n maxX = x3 > maxX ? x3 : maxX;\n maxX = x4 > maxX ? x4 : maxX;\n\n maxY = y1;\n maxY = y2 > maxY ? y2 : maxY;\n maxY = y3 > maxY ? y3 : maxY;\n maxY = y4 > maxY ? y4 : maxY;\n }\n\n // check for children\n if(this.children.length)\n {\n var childBounds = this.containerGetBounds();\n\n w0 = childBounds.x;\n w1 = childBounds.x + childBounds.width;\n h0 = childBounds.y;\n h1 = childBounds.y + childBounds.height;\n\n minX = (minX < w0) ? minX : w0;\n minY = (minY < h0) ? minY : h0;\n\n maxX = (maxX > w1) ? maxX : w1;\n maxY = (maxY > h1) ? maxY : h1;\n }\n\n var bounds = this._bounds;\n\n bounds.x = minX;\n bounds.width = maxX - minX;\n\n bounds.y = minY;\n bounds.height = maxY - minY;\n\n // store a reference so that if this function gets called again in the render cycle we do not have to recalculate\n this._currentBounds = bounds;\n }\n\n return this._currentBounds;\n};\n\nSprite.prototype.getLocalBounds = function ()\n{\n this._bounds.x = -this._texture._frame.width * this.anchor.x;\n this._bounds.y = -this._texture._frame.height * this.anchor.y;\n this._bounds.width = this._texture._frame.width;\n this._bounds.height = this._texture._frame.height;\n return this._bounds;\n};\n\n/**\n* Tests if a point is inside this sprite\n*\n* @param point {Point} the point to test\n* @return {boolean} the result of the test\n*/\nSprite.prototype.containsPoint = function( point )\n{\n this.worldTransform.applyInverse(point, tempPoint);\n\n var width = this._texture._frame.width;\n var height = this._texture._frame.height;\n var x1 = -width * this.anchor.x;\n var y1;\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* Renders the object using the Canvas renderer\n*\n* @param renderer {CanvasRenderer} The renderer\n* @private\n*/\nSprite.prototype._renderCanvas = function (renderer)\n{\n if (this.texture.crop.width <= 0 || this.texture.crop.height <= 0)\n {\n return;\n }\n\n if (this.blendMode !== renderer.currentBlendMode)\n {\n renderer.currentBlendMode = this.blendMode;\n renderer.context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode];\n }\n\n // Ignore null sources\n if (this.texture.valid)\n {\n var texture = this._texture,\n wt = this.worldTransform,\n dx,\n dy,\n width,\n height;\n\n renderer.context.globalAlpha = this.worldAlpha;\n\n // If smoothingEnabled is supported and we need to change the smoothing property for this texture\n if (renderer.smoothProperty && renderer.currentScaleMode !== texture.baseTexture.scaleMode)\n {\n renderer.currentScaleMode = texture.baseTexture.scaleMode;\n renderer.context[renderer.smoothProperty] = (renderer.currentScaleMode === CONST.SCALE_MODES.LINEAR);\n }\n\n // If the texture is trimmed we offset by the trim x/y, otherwise we use the frame dimensions\n\n if(texture.rotate)\n {\n\n // cheeky rotation!\n var a = wt.a;\n var b = wt.b;\n\n wt.a = -wt.c;\n wt.b = -wt.d;\n wt.c = a;\n wt.d = b;\n\n width = texture.crop.height;\n height = texture.crop.width;\n\n dx = (texture.trim) ? texture.trim.y - this.anchor.y * texture.trim.height : this.anchor.y * -texture._frame.height;\n dy = (texture.trim) ? texture.trim.x - this.anchor.x * texture.trim.width : this.anchor.x * -texture._frame.width;\n }\n else\n {\n width = texture.crop.width;\n height = texture.crop.height;\n\n dx = (texture.trim) ? texture.trim.x - this.anchor.x * texture.trim.width : this.anchor.x * -texture._frame.width;\n dy = (texture.trim) ? texture.trim.y - this.anchor.y * texture.trim.height : this.anchor.y * -texture._frame.height;\n }\n\n\n\n // Allow for pixel rounding\n if (renderer.roundPixels)\n {\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n (wt.tx * renderer.resolution) | 0,\n (wt.ty * renderer.resolution) | 0\n );\n\n dx = dx | 0;\n dy = dy | 0;\n }\n else\n {\n\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n\n\n }\n\n var resolution = texture.baseTexture.resolution;\n\n if (this.tint !== 0xFFFFFF)\n {\n if (this.cachedTint !== this.tint)\n {\n this.cachedTint = this.tint;\n\n // TODO clean up caching - how to clean up the caches?\n this.tintedTexture = CanvasTinter.getTintedTexture(this, this.tint);\n }\n\n renderer.context.drawImage(\n this.tintedTexture,\n 0,\n 0,\n width * resolution,\n height * resolution,\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n }\n else\n {\n renderer.context.drawImage(\n texture.baseTexture.source,\n texture.crop.x * resolution,\n texture.crop.y * resolution,\n width * resolution,\n height * resolution,\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n }\n }\n};\n\n/**\n * Destroys this sprite and optionally its texture\n *\n * @param [destroyTexture=false] {boolean} Should it destroy the current texture of the sprite as well\n * @param [destroyBaseTexture=false] {boolean} Should it destroy the base texture of the sprite as well\n */\nSprite.prototype.destroy = function (destroyTexture, destroyBaseTexture)\n{\n Container.prototype.destroy.call(this);\n\n this.anchor = null;\n\n if (destroyTexture)\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 sprite that will contain 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 frameId {String} The frame Id of the texture in the cache\n * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId\n * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter\n * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values\n */\nSprite.fromFrame = function (frameId)\n{\n var texture = utils.TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error('The frameId \"' + frameId + '\" does not exist in the texture cache');\n }\n\n return new Sprite(texture);\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 imageId {String} The image url of the texture\n * @return {Sprite} A new Sprite using a texture from the texture cache matching the image id\n */\nSprite.fromImage = function (imageId, crossorigin, scaleMode)\n{\n return new Sprite(Texture.fromImage(imageId, crossorigin, scaleMode));\n};\n","var ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'),\n WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'),\n CONST = require('../../const');\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original pixi version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's SpriteRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/SpriteRenderer.java\n */\n\n/**\n *\n * @class\n * @private\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n * @param renderer {WebGLRenderer} The renderer this sprite batch works for.\n */\nfunction SpriteRenderer(renderer)\n{\n ObjectRenderer.call(this, renderer);\n\n /**\n *\n *\n * @member {number}\n */\n this.vertSize = 5;\n\n /**\n *\n *\n * @member {number}\n */\n this.vertByteSize = this.vertSize * 4;\n\n /**\n * The number of images in the SpriteBatch before it flushes.\n *\n * @member {number}\n */\n this.size = CONST.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop\n\n // the total number of bytes in our batch\n var numVerts = this.size * 4 * this.vertByteSize;\n // the total number of indices in our batch\n var numIndices = this.size * 6;\n\n /**\n * Holds the vertices\n *\n * @member {ArrayBuffer}\n */\n this.vertices = new ArrayBuffer(numVerts);\n\n /**\n * View on the vertices as a Float32Array\n *\n * @member {Float32Array}\n */\n this.positions = new Float32Array(this.vertices);\n\n /**\n * Holds the color components\n *\n * @member {Uint32Array}\n */\n this.colors = new Uint32Array(this.vertices);\n\n /**\n * Holds the indices\n *\n * @member {Uint16Array}\n */\n this.indices = new Uint16Array(numIndices);\n\n /**\n *\n *\n * @member {number}\n */\n this.lastIndexCount = 0;\n\n for (var i=0, j=0; i < numIndices; i += 6, j += 4)\n {\n this.indices[i + 0] = j + 0;\n this.indices[i + 1] = j + 1;\n this.indices[i + 2] = j + 2;\n this.indices[i + 3] = j + 0;\n this.indices[i + 4] = j + 2;\n this.indices[i + 5] = j + 3;\n }\n\n /**\n *\n *\n * @member {boolean}\n */\n this.drawing = false;\n\n /**\n *\n *\n * @member {number}\n */\n this.currentBatchSize = 0;\n\n /**\n *\n *\n * @member {BaseTexture}\n */\n this.currentBaseTexture = null;\n\n /**\n *\n *\n * @member {Array}\n */\n this.textures = [];\n\n /**\n *\n *\n * @member {Array}\n */\n this.blendModes = [];\n\n /**\n *\n *\n * @member {Array}\n */\n this.shaders = [];\n\n /**\n *\n *\n * @member {Array}\n */\n this.sprites = [];\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {Shader}\n */\n this.shader = null;\n\n}\n\nSpriteRenderer.prototype = Object.create(ObjectRenderer.prototype);\nSpriteRenderer.prototype.constructor = SpriteRenderer;\nmodule.exports = SpriteRenderer;\n\nWebGLRenderer.registerPlugin('sprite', SpriteRenderer);\n\n/**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n * @param gl {WebGLRenderingContext} the current WebGL drawing context\n */\nSpriteRenderer.prototype.onContextChange = function ()\n{\n var gl = this.renderer.gl;\n\n // setup default shader\n this.shader = this.renderer.shaderManager.defaultShader;\n\n // create a couple of buffers\n this.vertexBuffer = gl.createBuffer();\n this.indexBuffer = gl.createBuffer();\n\n // 65535 is max index, so 65535 / 6 = 10922.\n\n //upload the index data\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, this.vertices, gl.DYNAMIC_DRAW);\n\n this.currentBlendMode = 99999;\n};\n\n/**\n * Renders the sprite object.\n *\n * @param sprite {Sprite} the sprite to render when using this spritebatch\n */\nSpriteRenderer.prototype.render = function (sprite)\n{\n var texture = sprite._texture;\n\n //TODO set blend modes..\n // check texture..\n if (this.currentBatchSize >= this.size)\n {\n this.flush();\n this.currentBaseTexture = texture.baseTexture;\n }\n\n // get the uvs for the texture\n var uvs = texture._uvs;\n\n // if the uvs have not updated then no point rendering just yet!\n if (!uvs)\n {\n return;\n }\n\n // TODO trim??\n var aX = sprite.anchor.x;\n var aY = sprite.anchor.y;\n\n var w0, w1, h0, h1;\n\n if (texture.trim)\n {\n // if the sprite is trimmed then we need to add the extra space before transforming the sprite coords..\n var trim = texture.trim;\n\n w1 = trim.x - aX * trim.width;\n w0 = w1 + texture.crop.width;\n\n h1 = trim.y - aY * trim.height;\n h0 = h1 + texture.crop.height;\n\n }\n else\n {\n w0 = (texture._frame.width ) * (1-aX);\n w1 = (texture._frame.width ) * -aX;\n\n h0 = texture._frame.height * (1-aY);\n h1 = texture._frame.height * -aY;\n }\n\n var index = this.currentBatchSize * this.vertByteSize;\n\n var worldTransform = sprite.worldTransform;\n\n var a = worldTransform.a;\n var b = worldTransform.b;\n var c = worldTransform.c;\n var d = worldTransform.d;\n var tx = worldTransform.tx;\n var ty = worldTransform.ty;\n\n var colors = this.colors;\n var positions = this.positions;\n\n if (this.renderer.roundPixels)\n {\n // xy\n positions[index] = a * w1 + c * h1 + tx | 0;\n positions[index+1] = d * h1 + b * w1 + ty | 0;\n\n // xy\n positions[index+5] = a * w0 + c * h1 + tx | 0;\n positions[index+6] = d * h1 + b * w0 + ty | 0;\n\n // xy\n positions[index+10] = a * w0 + c * h0 + tx | 0;\n positions[index+11] = d * h0 + b * w0 + ty | 0;\n\n // xy\n positions[index+15] = a * w1 + c * h0 + tx | 0;\n positions[index+16] = d * h0 + b * w1 + ty | 0;\n }\n else\n {\n // xy\n positions[index] = a * w1 + c * h1 + tx;\n positions[index+1] = d * h1 + b * w1 + ty;\n\n // xy\n positions[index+5] = a * w0 + c * h1 + tx;\n positions[index+6] = d * h1 + b * w0 + ty;\n\n // xy\n positions[index+10] = a * w0 + c * h0 + tx;\n positions[index+11] = d * h0 + b * w0 + ty;\n\n // xy\n positions[index+15] = a * w1 + c * h0 + tx;\n positions[index+16] = d * h0 + b * w1 + ty;\n }\n\n // uv\n positions[index+2] = uvs.x0;\n positions[index+3] = uvs.y0;\n\n // uv\n positions[index+7] = uvs.x1;\n positions[index+8] = uvs.y1;\n\n // uv\n positions[index+12] = uvs.x2;\n positions[index+13] = uvs.y2;\n\n // uv\n positions[index+17] = uvs.x3;\n positions[index+18] = uvs.y3;\n\n // color and alpha\n var tint = sprite.tint;\n colors[index+4] = colors[index+9] = colors[index+14] = colors[index+19] = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + (sprite.worldAlpha * 255 << 24);\n\n // increment the batchsize\n this.sprites[this.currentBatchSize++] = sprite;\n};\n\n/**\n * Renders the content and empties the current batch.\n *\n */\nSpriteRenderer.prototype.flush = function ()\n{\n // If the batch is length 0 then return as there is nothing to draw\n if (this.currentBatchSize === 0)\n {\n return;\n }\n\n var gl = this.renderer.gl;\n var shader;\n\n // upload the verts to the buffer\n if (this.currentBatchSize > ( this.size * 0.5 ) )\n {\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);\n }\n else\n {\n var view = this.positions.subarray(0, this.currentBatchSize * this.vertByteSize);\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, view);\n }\n\n var nextTexture, nextBlendMode, nextShader;\n var batchSize = 0;\n var start = 0;\n\n var currentBaseTexture = null;\n var currentBlendMode = this.renderer.blendModeManager.currentBlendMode;\n var currentShader = null;\n\n var blendSwap = false;\n var shaderSwap = false;\n var sprite;\n\n for (var i = 0, j = this.currentBatchSize; i < j; i++)\n {\n\n sprite = this.sprites[i];\n\n nextTexture = sprite._texture.baseTexture;\n nextBlendMode = sprite.blendMode;\n nextShader = sprite.shader || this.shader;\n\n blendSwap = currentBlendMode !== nextBlendMode;\n shaderSwap = currentShader !== nextShader; // should I use uuidS???\n\n if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap)\n {\n this.renderBatch(currentBaseTexture, batchSize, start);\n\n start = i;\n batchSize = 0;\n currentBaseTexture = nextTexture;\n\n if (blendSwap)\n {\n currentBlendMode = nextBlendMode;\n this.renderer.blendModeManager.setBlendMode( currentBlendMode );\n }\n\n if (shaderSwap)\n {\n currentShader = nextShader;\n\n\n\n shader = currentShader.shaders ? currentShader.shaders[gl.id] : currentShader;\n\n if (!shader)\n {\n shader = currentShader.getShader(this.renderer);\n\n }\n\n // set shader function???\n this.renderer.shaderManager.setShader(shader);\n\n //TODO - i KNOW this can be optimised! Once v3 is stable il look at this next...\n shader.uniforms.projectionMatrix.value = this.renderer.currentRenderTarget.projectionMatrix.toArray(true);\n //Make this a little more dynamic / intelligent!\n shader.syncUniforms();\n\n //TODO investigate some kind of texture state managment??\n // need to make sure this texture is the active one for all the batch swaps..\n gl.activeTexture(gl.TEXTURE0);\n\n // both thease only need to be set if they are changing..\n // set the projection\n //gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, this.renderer.currentRenderTarget.projectionMatrix.toArray(true));\n\n\n }\n }\n\n batchSize++;\n }\n\n this.renderBatch(currentBaseTexture, batchSize, start);\n\n // then reset the batch!\n this.currentBatchSize = 0;\n};\n\n/**\n * Draws the currently batches sprites.\n *\n * @private\n * @param texture {Texture}\n * @param size {number}\n * @param startIndex {number}\n */\nSpriteRenderer.prototype.renderBatch = function (texture, size, startIndex)\n{\n if (size === 0)\n {\n return;\n }\n\n var gl = this.renderer.gl;\n\n if (!texture._glTextures[gl.id])\n {\n this.renderer.updateTexture(texture);\n }\n else\n {\n // bind the current texture\n gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);\n }\n\n // now draw those suckas!\n gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2);\n\n // increment the draw count\n this.renderer.drawCount++;\n};\n\n/**\n * Starts a new sprite batch.\n *\n */\nSpriteRenderer.prototype.start = function ()\n{\n var gl = this.renderer.gl;\n\n // bind the main texture\n\n\n // bind the buffers\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\n // this is the same for each shader?\n var stride = this.vertByteSize;\n gl.vertexAttribPointer(this.shader.attributes.aVertexPosition, 2, gl.FLOAT, false, stride, 0);\n gl.vertexAttribPointer(this.shader.attributes.aTextureCoord, 2, gl.FLOAT, false, stride, 2 * 4);\n\n // color attributes will be interpreted as unsigned bytes and normalized\n gl.vertexAttribPointer(this.shader.attributes.aColor, 4, gl.UNSIGNED_BYTE, true, stride, 4 * 4);\n};\n\n/**\n * Destroys the SpriteBatch.\n *\n */\nSpriteRenderer.prototype.destroy = function ()\n{\n this.renderer.gl.deleteBuffer(this.vertexBuffer);\n this.renderer.gl.deleteBuffer(this.indexBuffer);\n\n this.shader.destroy();\n\n this.renderer = null;\n\n this.vertices = null;\n this.positions = null;\n this.colors = null;\n this.indices = null;\n\n this.vertexBuffer = null;\n this.indexBuffer = null;\n\n this.currentBaseTexture = null;\n\n this.drawing = false;\n\n this.textures = null;\n this.blendModes = null;\n this.shaders = null;\n this.sprites = null;\n this.shader = null;\n};\n","var Sprite = require('../sprites/Sprite'),\n Texture = require('../textures/Texture'),\n math = require('../math'),\n utils = require('../utils'),\n CONST = require('../const');\n\n/**\n * A Text Object will create a line or multiple lines of text. To split a line you can use '\\n' in your text string,\n * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object.\n *\n * A Text can be created directly from a string and a style object\n *\n * ```js\n * var text = new PIXI.Text('This is a pixi text',{font : '24px Arial', fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n * @param text {string} The copy that you would like the text to display\n * @param [style] {object} The style parameters\n * @param [style.font] {string} default 'bold 20px Arial' The style and size of the font\n * @param [style.fill='black'] {String|Number} A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke] {String|Number} A canvas fillstyle that will be used on the text stroke e.g 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap, it needs wordWrap to be set to true\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/4] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped on top or bottom. Adding some padding will\n * prevent this from happening by adding padding to the top and bottom of text height.\n * @param [style.textBaseline='alphabetic'] {string} The baseline of the text that is rendered.\n * @param [style.lineJoin='miter'] {string} The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Default is 'miter' (creates a sharp corner).\n * @param [style.miterLimit=10] {number} The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n */\nfunction Text(text, style, resolution)\n{\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {HTMLCanvasElement}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution of the canvas.\n * @member {number}\n */\n this.resolution = resolution || CONST.RESOLUTION;\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 var texture = Texture.fromCanvas(this.canvas);\n texture.trim = new math.Rectangle();\n Sprite.call(this, texture);\n\n this.text = text;\n this.style = style;\n}\n\n// constructor\nText.prototype = Object.create(Sprite.prototype);\nText.prototype.constructor = Text;\nmodule.exports = Text;\n\nText.fontPropertiesCache = {};\nText.fontPropertiesCanvas = document.createElement('canvas');\nText.fontPropertiesContext = Text.fontPropertiesCanvas.getContext('2d');\n\nObject.defineProperties(Text.prototype, {\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof Text#\n */\n width: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.x * this._texture._frame.width;\n },\n set: function (value)\n {\n this.scale.x = value / this._texture._frame.width;\n this._width = value;\n }\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 * @memberof Text#\n */\n height: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.y * this._texture._frame.height;\n },\n set: function (value)\n {\n this.scale.y = value / this._texture._frame.height;\n this._height = value;\n }\n },\n\n /**\n * Set the style of the text\n *\n * @param [style] {object} The style parameters\n * @param [style.font='bold 20pt Arial'] {string} The style and size of the font\n * @param [style.fill='black'] {string|number} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke='black'] {string|number} A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string|number} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/6] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped on top or bottom. Adding some padding will\n * prevent this from happening by adding padding to the top and bottom of text height.\n * @param [style.textBaseline='alphabetic'] {string} The baseline of the text that is rendered.\n * @param [style.lineJoin='miter'] {string} The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Default is 'miter' (creates a sharp corner).\n * @param [style.miterLimit=10] {number} The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @memberof Text#\n */\n style: {\n get: function ()\n {\n return this._style;\n },\n set: function (style)\n {\n style = style || {};\n\n if (typeof style.fill === 'number') {\n style.fill = utils.hex2string(style.fill);\n }\n\n if (typeof style.stroke === 'number') {\n style.stroke = utils.hex2string(style.stroke);\n }\n\n if (typeof style.dropShadowColor === 'number') {\n style.dropShadowColor = utils.hex2string(style.dropShadowColor);\n }\n\n style.font = style.font || 'bold 20pt Arial';\n style.fill = style.fill || 'black';\n style.align = style.align || 'left';\n style.stroke = style.stroke || 'black'; //provide a default, see: https://github.com/GoodBoyDigital/pixi.js/issues/136\n style.strokeThickness = style.strokeThickness || 0;\n style.wordWrap = style.wordWrap || false;\n style.wordWrapWidth = style.wordWrapWidth || 100;\n\n style.dropShadow = style.dropShadow || false;\n style.dropShadowColor = style.dropShadowColor || '#000000';\n style.dropShadowAngle = style.dropShadowAngle || Math.PI / 6;\n style.dropShadowDistance = style.dropShadowDistance || 5;\n\n style.padding = style.padding || 0;\n\n style.textBaseline = style.textBaseline || 'alphabetic';\n\n style.lineJoin = style.lineJoin || 'miter';\n style.miterLimit = style.miterLimit || 10;\n\n this._style = style;\n this.dirty = true;\n }\n },\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @param text {string} The copy that you would like the text to display\n * @memberof Text#\n */\n text: {\n get: function()\n {\n return this._text;\n },\n set: function (text){\n text = text.toString() || ' ';\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nText.prototype.updateText = function ()\n{\n var style = this._style;\n this.context.font = style.font;\n\n // word wrap\n // preserve original text\n var outputText = style.wordWrap ? this.wordWrap(this._text) : this._text;\n\n // split text into lines\n var lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n\n // calculate text width\n var lineWidths = new Array(lines.length);\n var maxLineWidth = 0;\n var fontProperties = this.determineFontProperties(style.font);\n for (var i = 0; i < lines.length; i++)\n {\n var lineWidth = this.context.measureText(lines[i]).width;\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n\n var width = maxLineWidth + style.strokeThickness;\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n this.canvas.width = ( width + this.context.lineWidth ) * this.resolution;\n\n // calculate text height\n var lineHeight = this.style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n\n var height = lineHeight * lines.length;\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n this.canvas.height = ( height + this._style.padding * 2 ) * this.resolution;\n\n this.context.scale( this.resolution, this.resolution);\n\n if (navigator.isCocoonJS)\n {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n }\n\n //this.context.fillStyle=\"#FF0000\";\n //this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\n this.context.font = style.font;\n this.context.strokeStyle = style.stroke;\n this.context.lineWidth = style.strokeThickness;\n this.context.textBaseline = style.textBaseline;\n this.context.lineJoin = style.lineJoin;\n this.context.miterLimit = style.miterLimit;\n\n var linePositionX;\n var linePositionY;\n\n if (style.dropShadow)\n {\n this.context.fillStyle = style.dropShadowColor;\n\n var xShadowOffset = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n var yShadowOffset = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX + xShadowOffset, linePositionY + yShadowOffset + this._style.padding);\n }\n }\n }\n\n //set canvas text styles\n this.context.fillStyle = style.fill;\n\n //draw lines line by line\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.context.strokeText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n }\n\n this.updateTexture();\n};\n\n/**\n * Updates texture size based on canvas size\n *\n * @private\n */\nText.prototype.updateTexture = function ()\n{\n var texture = this._texture;\n\n texture.baseTexture.hasLoaded = true;\n texture.baseTexture.resolution = this.resolution;\n\n texture.baseTexture.width = this.canvas.width / this.resolution;\n texture.baseTexture.height = this.canvas.height / this.resolution;\n texture.crop.width = texture._frame.width = this.canvas.width / this.resolution;\n texture.crop.height = texture._frame.height = this.canvas.height / this.resolution;\n\n texture.trim.x = 0;\n texture.trim.y = -this._style.padding;\n\n texture.trim.width = texture._frame.width;\n texture.trim.height = texture._frame.height - this._style.padding*2;\n\n this._width = this.canvas.width / this.resolution;\n this._height = this.canvas.height / this.resolution;\n\n texture.baseTexture.emit('update', texture.baseTexture);\n\n this.dirty = false;\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer}\n */\nText.prototype.renderWebGL = function (renderer)\n{\n if (this.dirty)\n {\n //this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n Sprite.prototype.renderWebGL.call(this, renderer);\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer}\n * @private\n */\nText.prototype._renderCanvas = function (renderer)\n{\n if (this.dirty)\n {\n // this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n Sprite.prototype._renderCanvas.call(this, renderer);\n};\n\n/**\n * Calculates the ascent, descent and fontSize of a given fontStyle\n *\n * @param fontStyle {object}\n * @private\n */\nText.prototype.determineFontProperties = function (fontStyle)\n{\n var properties = Text.fontPropertiesCache[fontStyle];\n\n if (!properties)\n {\n properties = {};\n\n var canvas = Text.fontPropertiesCanvas;\n var context = Text.fontPropertiesContext;\n\n context.font = fontStyle;\n\n var width = Math.ceil(context.measureText('|MÉq').width);\n var baseline = Math.ceil(context.measureText('M').width);\n var height = 2 * baseline;\n\n baseline = baseline * 1.4 | 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 = fontStyle;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText('|MÉq', 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, j;\n\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 (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 (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.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n Text.fontPropertiesCache[fontStyle] = properties;\n }\n\n return properties;\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 * @param text {string}\n * @private\n */\nText.prototype.wordWrap = function (text)\n{\n // Greedy wrapping algorithm that will wrap words as the line grows longer\n // than its horizontal bounds.\n var result = '';\n var lines = text.split('\\n');\n var wordWrapWidth = this._style.wordWrapWidth;\n for (var i = 0; i < lines.length; i++)\n {\n var spaceLeft = wordWrapWidth;\n var words = lines[i].split(' ');\n for (var j = 0; j < words.length; j++)\n {\n var wordWidth = this.context.measureText(words[j]).width;\n var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width;\n if (j === 0 || wordWidthWithSpace > spaceLeft)\n {\n // Skip printing the newline if it's the first word of the line that is\n // greater than the word wrap width.\n if (j > 0)\n {\n result += '\\n';\n }\n result += words[j];\n spaceLeft = wordWrapWidth - wordWidth;\n }\n else\n {\n spaceLeft -= wordWidthWithSpace;\n result += ' ' + words[j];\n }\n }\n\n if (i < lines.length-1)\n {\n result += '\\n';\n }\n }\n return result;\n};\n\n/**\n * Returns the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n * @param matrix {Matrix} the transformation matrix of the Text\n * @return {Rectangle} the framing rectangle\n */\nText.prototype.getBounds = function (matrix)\n{\n if (this.dirty)\n {\n this.updateText();\n }\n\n return Sprite.prototype.getBounds.call(this, matrix);\n};\n\n/**\n * Destroys this text object.\n *\n * @param [destroyBaseTexture=true] {boolean} whether to destroy the base texture as well\n */\nText.prototype.destroy = function (destroyBaseTexture)\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 this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture);\n};\n","var utils = require('../utils'),\n CONST = require('../const'),\n EventEmitter = require('eventemitter3');\n\n/**\n * A texture stores the information that represents an image. All textures have a base texture.\n *\n * @class\n * @memberof PIXI\n * @param source {Image|Canvas} the source object of the texture.\n * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values\n * @param resolution {number} the resolution of the texture for devices with different pixel ratios\n */\nfunction BaseTexture(source, scaleMode, resolution)\n{\n EventEmitter.call(this);\n\n this.uuid = utils.uuid();\n\n /**\n * The Resolution of the texture.\n *\n * @member {number}\n */\n this.resolution = resolution || 1;\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @member {number}\n * @readOnly\n */\n this.width = 100;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @member {number}\n * @readOnly\n */\n this.height = 100;\n\n // TODO docs\n // used to store the actual dimensions of the source\n /**\n * Used to store the actual width of the source of this texture\n *\n * @member {number}\n * @readOnly\n */\n this.realWidth = 100;\n /**\n * Used to store the actual height of the source of this texture\n *\n * @member {number}\n * @readOnly\n */\n this.realHeight = 100;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {{number}}\n * @default scaleModes.LINEAR\n */\n this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT;\n\n /**\n * Set to true once the base texture has successfully loaded.\n *\n * This is never true if the underlying source fails to load or has no texture data.\n *\n * @member {boolean}\n * @readOnly\n */\n this.hasLoaded = false;\n\n /**\n * Set to true if the source is currently loading.\n *\n * If an Image source is loading the 'loaded' or 'error' event will be\n * dispatched when the operation ends. An underyling source that is\n * immediately-available bypasses loading entirely.\n *\n * @member {boolean}\n * @readonly\n */\n this.isLoading = false;\n\n /**\n * The image source that is used to create the texture.\n *\n * TODO: Make this a setter that calls loadSource();\n *\n * @member {Image|Canvas}\n * @readonly\n */\n this.source = null; // set in loadSource, if at all\n\n /**\n * Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)\n *\n * @member {boolean}\n * @default true\n */\n this.premultipliedAlpha = true;\n\n /**\n * @member {string}\n */\n this.imageUrl = null;\n\n /**\n * Wether or not the texture is a power of two, try to use power of two textures as much as you can\n * @member {boolean}\n * @private\n */\n this.isPowerOfTwo = false;\n\n // used for webGL\n\n /**\n *\n * Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used\n * Also the texture must be a power of two size to work\n *\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * A map of renderer IDs to webgl textures\n *\n * @member {object<number, WebGLTexture>}\n * @private\n */\n this._glTextures = [];\n\n // if no source passed don't try to load\n if (source)\n {\n this.loadSource(source);\n }\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @event loaded\n * @memberof PIXI.BaseTexture#\n * @protected\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @event error\n * @memberof PIXI.BaseTexture#\n * @protected\n */\n}\n\nBaseTexture.prototype = Object.create(EventEmitter.prototype);\nBaseTexture.prototype.constructor = BaseTexture;\nmodule.exports = BaseTexture;\n\n/**\n * Updates the texture on all the webgl renderers, this also assumes the src has changed.\n *\n * @fires update\n */\nBaseTexture.prototype.update = function ()\n{\n this.realWidth = this.source.naturalWidth || this.source.width;\n this.realHeight = this.source.naturalHeight || this.source.height;\n\n this.width = this.realWidth / this.resolution;\n this.height = this.realHeight / this.resolution;\n\n this.isPowerOfTwo = utils.isPowerOfTwo(this.realWidth, this.realHeight);\n\n this.emit('update', this);\n};\n\n/**\n * Load a source.\n *\n * If the source is not-immediately-available, such as an image that needs to be\n * downloaded, then the 'loaded' or 'error' event will be dispatched in the future\n * and `hasLoaded` will remain false after this call.\n *\n * The logic state after calling `loadSource` directly or indirectly (eg. `fromImage`, `new BaseTexture`) is:\n *\n * if (texture.hasLoaded)\n {\n * // texture ready for use\n * } else if (texture.isLoading)\n {\n * // listen to 'loaded' and/or 'error' events on texture\n * } else {\n * // not loading, not going to load UNLESS the source is reloaded\n * // (it may still make sense to listen to the events)\n * }\n *\n * @protected\n * @param source {Image|Canvas} the source object of the texture.\n */\nBaseTexture.prototype.loadSource = function (source)\n{\n var wasLoading = this.isLoading;\n this.hasLoaded = false;\n this.isLoading = false;\n\n if (wasLoading && this.source)\n {\n this.source.onload = null;\n this.source.onerror = null;\n }\n\n this.source = source;\n\n // Apply source if loaded. Otherwise setup appropriate loading monitors.\n if ((this.source.complete || this.source.getContext) && this.source.width && this.source.height)\n {\n this._sourceLoaded();\n }\n else if (!source.getContext)\n {\n\n // Image fail / not ready\n this.isLoading = true;\n\n var scope = this;\n\n source.onload = function ()\n {\n source.onload = null;\n source.onerror = null;\n\n if (!scope.isLoading)\n {\n return;\n }\n\n scope.isLoading = false;\n scope._sourceLoaded();\n\n scope.emit('loaded', scope);\n };\n\n source.onerror = function ()\n {\n source.onload = null;\n source.onerror = null;\n\n if (!scope.isLoading)\n {\n return;\n }\n\n scope.isLoading = false;\n scope.emit('error', scope);\n };\n\n // Per http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element\n // \"The value of `complete` can thus change while a script is executing.\"\n // So complete needs to be re-checked after the callbacks have been added..\n // NOTE: complete will be true if the image has no src so best to check if the src is set.\n if (source.complete && source.src)\n {\n this.isLoading = false;\n\n // ..and if we're complete now, no need for callbacks\n source.onload = null;\n source.onerror = null;\n\n if (source.width && source.height)\n {\n this._sourceLoaded();\n\n // If any previous subscribers possible\n if (wasLoading)\n {\n this.emit('loaded', this);\n }\n }\n else\n {\n // If any previous subscribers possible\n if (wasLoading)\n {\n this.emit('error', this);\n }\n }\n }\n }\n};\n\n/**\n * Used internally to update the width, height, and some other tracking vars once\n * a source has successfully loaded.\n *\n * @private\n */\nBaseTexture.prototype._sourceLoaded = function ()\n{\n this.hasLoaded = true;\n this.update();\n};\n\n/**\n * Destroys this base texture\n *\n */\nBaseTexture.prototype.destroy = function ()\n{\n if (this.imageUrl)\n {\n delete utils.BaseTextureCache[this.imageUrl];\n delete utils.TextureCache[this.imageUrl];\n\n this.imageUrl = null;\n\n if (!navigator.isCocoonJS)\n {\n this.source.src = '';\n }\n }\n else if (this.source && this.source._pixiId)\n {\n delete utils.BaseTextureCache[this.source._pixiId];\n }\n\n this.source = null;\n\n this.dispose();\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 */\nBaseTexture.prototype.dispose = function ()\n{\n this.emit('dispose', this);\n\n this._glTextures.length = 0;\n};\n\n/**\n * Changes the source image of the texture.\n * The original source must be an Image element.\n *\n * @param newSrc {string} the path of the image\n */\nBaseTexture.prototype.updateSourceImage = function (newSrc)\n{\n this.source.src = newSrc;\n\n this.loadSource(this.source);\n};\n\n/**\n * Helper function that creates a base texture from the given image url.\n * If the image is not in the base texture cache it will be created and loaded.\n *\n * @static\n * @param imageUrl {string} The image url of the texture\n * @param [crossorigin=(auto)] {boolean} Should use anonymous CORS? Defaults to true if the URL is not a data-URI.\n * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values\n * @return BaseTexture\n */\nBaseTexture.fromImage = function (imageUrl, crossorigin, scaleMode)\n{\n var baseTexture = utils.BaseTextureCache[imageUrl];\n\n if (crossorigin === undefined && imageUrl.indexOf('data:') !== 0)\n {\n crossorigin = true;\n }\n\n if (!baseTexture)\n {\n // new Image() breaks tex loading in some versions of Chrome.\n // See https://code.google.com/p/chromium/issues/detail?id=238071\n var image = new Image();//document.createElement('img');\n if (crossorigin)\n {\n image.crossOrigin = '';\n }\n\n baseTexture = new BaseTexture(image, scaleMode);\n baseTexture.imageUrl = imageUrl;\n\n image.src = imageUrl;\n\n utils.BaseTextureCache[imageUrl] = baseTexture;\n\n // if there is an @2x at the end of the url we are going to assume its a highres image\n baseTexture.resolution = utils.getResolutionOfUrl(imageUrl);\n }\n\n return baseTexture;\n};\n\n/**\n * Helper function that creates a base texture from the given canvas element.\n *\n * @static\n * @param canvas {Canvas} The canvas element source of the texture\n * @param scaleMode {number} See {{#crossLink \"PIXI/scaleModes:property\"}}scaleModes{{/crossLink}} for possible values\n * @return BaseTexture\n */\nBaseTexture.fromCanvas = function (canvas, scaleMode)\n{\n if (!canvas._pixiId)\n {\n canvas._pixiId = 'canvas_' + utils.uuid();\n }\n\n var baseTexture = utils.BaseTextureCache[canvas._pixiId];\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(canvas, scaleMode);\n utils.BaseTextureCache[canvas._pixiId] = baseTexture;\n }\n\n return baseTexture;\n};\n","var BaseTexture = require('./BaseTexture'),\n Texture = require('./Texture'),\n RenderTarget = require('../renderers/webgl/utils/RenderTarget'),\n FilterManager = require('../renderers/webgl/managers/FilterManager'),\n CanvasBuffer = require('../renderers/canvas/utils/CanvasBuffer'),\n math = require('../math'),\n CONST = require('../const'),\n tempMatrix = new math.Matrix();\n\n/**\n * A RenderTexture is a special texture that allows any Pixi 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 * A RenderTexture 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 * var renderTexture = new PIXI.RenderTexture(800, 600);\n * var sprite = PIXI.Sprite.fromImage(\"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 * renderTexture.render(sprite);\n * ```\n *\n * The Sprite in this case will be rendered to a position of 0,0. To render this sprite at its actual\n * position a Container should be used:\n *\n * ```js\n * var doc = new Container();\n *\n * doc.addChild(sprite);\n *\n * renderTexture.render(doc); // Renders to center of renderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used for this RenderTexture\n * @param [width=100] {number} The width of the render texture\n * @param [height=100] {number} The height of the render texture\n * @param [scaleMode] {number} See {@link SCALE_MODES} for possible values\n * @param [resolution=1] {number} The resolution of the texture being generated\n */\nfunction RenderTexture(renderer, width, height, scaleMode, resolution)\n{\n if (!renderer)\n {\n throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.');\n }\n\n width = width || 100;\n height = height || 100;\n resolution = resolution || CONST.RESOLUTION;\n\n /**\n * The base texture object that this texture uses\n *\n * @member {BaseTexture}\n */\n var baseTexture = new BaseTexture();\n baseTexture.width = width;\n baseTexture.height = height;\n baseTexture.resolution = resolution;\n baseTexture.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT;\n baseTexture.hasLoaded = true;\n\n\n Texture.call(this,\n baseTexture,\n new math.Rectangle(0, 0, width, height)\n );\n\n\n /**\n * The with of the render texture\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The height of the render texture\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * The Resolution of the texture.\n *\n * @member {number}\n */\n this.resolution = resolution;\n\n /**\n * The framing rectangle of the render texture\n *\n * @member {Rectangle}\n */\n //this._frame = new math.Rectangle(0, 0, this.width * this.resolution, this.height * this.resolution);\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 {Rectangle}\n */\n //this.crop = new math.Rectangle(0, 0, this.width * this.resolution, this.height * this.resolution);\n\n /**\n * Draw/render the given DisplayObject onto the texture.\n *\n * The displayObject and descendents are transformed during this operation.\n * If `updateTransform` is true then the transformations will be restored before the\n * method returns. Otherwise it is up to the calling code to correctly use or reset\n * the transformed display objects.\n *\n * The display object is always rendered with a worldAlpha value of 1.\n *\n * @method\n * @param displayObject {DisplayObject} The display object to render this texture on\n * @param [matrix] {Matrix} Optional matrix to apply to the display object before rendering.\n * @param [clear=false] {boolean} If true the texture will be cleared before the displayObject is drawn\n * @param [updateTransform=true] {boolean} If true the displayObject's worldTransform/worldAlpha and all children\n * transformations will be restored. Not restoring this information will be a little faster.\n */\n this.render = null;\n\n /**\n * The renderer this RenderTexture uses. A RenderTexture can only belong to one renderer at the moment if its webGL.\n *\n * @member {CanvasRenderer|WebGLRenderer}\n */\n this.renderer = renderer;\n\n if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL)\n {\n var gl = this.renderer.gl;\n\n this.textureBuffer = new RenderTarget(gl, this.width, this.height, baseTexture.scaleMode, this.resolution);//, this.baseTexture.scaleMode);\n this.baseTexture._glTextures[gl.id] = this.textureBuffer.texture;\n\n //TODO refactor filter manager.. as really its no longer a manager if we use it here..\n this.filterManager = new FilterManager(this.renderer);\n this.filterManager.onContextChange();\n this.filterManager.resize(width, height);\n this.render = this.renderWebGL;\n\n // the creation of a filter manager unbinds the buffers..\n this.renderer.currentRenderer.start();\n this.renderer.currentRenderTarget.activate();\n }\n else\n {\n\n this.render = this.renderCanvas;\n this.textureBuffer = new CanvasBuffer(this.width* this.resolution, this.height* this.resolution);\n this.baseTexture.source = this.textureBuffer.canvas;\n }\n\n /**\n * @member {boolean}\n */\n this.valid = true;\n\n this._updateUvs();\n}\n\nRenderTexture.prototype = Object.create(Texture.prototype);\nRenderTexture.prototype.constructor = RenderTexture;\nmodule.exports = RenderTexture;\n\n/**\n * Resizes the RenderTexture.\n *\n * @param width {number} The width to resize to.\n * @param height {number} The height to resize to.\n * @param updateBase {boolean} Should the baseTexture.width and height values be resized as well?\n */\nRenderTexture.prototype.resize = function (width, height, updateBase)\n{\n if (width === this.width && height === this.height)\n {\n return;\n }\n\n this.valid = (width > 0 && height > 0);\n\n this.width = this._frame.width = this.crop.width = width;\n this.height = this._frame.height = this.crop.height = height;\n\n if (updateBase)\n {\n this.baseTexture.width = this.width;\n this.baseTexture.height = this.height;\n }\n\n if (!this.valid)\n {\n return;\n }\n\n this.textureBuffer.resize(this.width, this.height);\n\n if(this.filterManager)\n {\n this.filterManager.resize(this.width, this.height);\n }\n};\n\n/**\n * Clears the RenderTexture.\n *\n */\nRenderTexture.prototype.clear = function ()\n{\n if (!this.valid)\n {\n return;\n }\n\n if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL)\n {\n this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);\n }\n\n this.textureBuffer.clear();\n};\n\n/**\n * Internal method assigned to the `render` property if using a CanvasRenderer.\n *\n * @private\n * @param displayObject {DisplayObject} The display object to render this texture on\n * @param [matrix] {Matrix} Optional matrix to apply to the display object before rendering.\n * @param [clear=false] {boolean} If true the texture will be cleared before the displayObject is drawn\n * @param [updateTransform=true] {boolean} If true the displayObject's worldTransform/worldAlpha and all children\n * transformations will be restored. Not restoring this information will be a little faster.\n */\nRenderTexture.prototype.renderWebGL = function (displayObject, matrix, clear, updateTransform)\n{\n if (!this.valid)\n {\n return;\n }\n\n\n updateTransform = (updateTransform !== undefined) ? updateTransform : true;//!updateTransform;\n\n this.textureBuffer.transform = matrix;\n\n //TODO not a fan that this is here... it will move!\n this.textureBuffer.activate();\n \n // setWorld Alpha to ensure that the object is renderer at full opacity\n displayObject.worldAlpha = displayObject.alpha;\n\n if (updateTransform)\n {\n\n // reset the matrix of the displatyObject..\n displayObject.worldTransform.identity();\n\n displayObject.currentBounds = null;\n\n // Time to update all the children of the displayObject with the new matrix..\n var children = displayObject.children;\n var i, j;\n\n for (i = 0, j = children.length; i < j; ++i)\n {\n children[i].updateTransform();\n }\n }\n\n //TODO rename textureBuffer to renderTarget..\n var temp = this.renderer.filterManager;\n\n this.renderer.filterManager = this.filterManager;\n this.renderer.renderDisplayObject(displayObject, this.textureBuffer, clear);\n\n this.renderer.filterManager = temp;\n};\n\n\n/**\n * Internal method assigned to the `render` property if using a CanvasRenderer.\n *\n * @private\n * @param displayObject {DisplayObject} The display object to render this texture on\n * @param [matrix] {Matrix} Optional matrix to apply to the display object before rendering.\n * @param [clear] {boolean} If true the texture will be cleared before the displayObject is drawn\n */\nRenderTexture.prototype.renderCanvas = function (displayObject, matrix, clear, updateTransform)\n{\n if (!this.valid)\n {\n return;\n }\n\n updateTransform = !!updateTransform;\n var cachedWt = displayObject.worldTransform;\n\n var wt = tempMatrix;\n\n wt.identity();\n\n if (matrix)\n {\n wt.append(matrix);\n }\n\n displayObject.worldTransform = wt;\n\n // setWorld Alpha to ensure that the object is renderer at full opacity\n displayObject.worldAlpha = 1;\n\n // Time to update all the children of the displayObject with the new matrix..\n var children = displayObject.children;\n var i, j;\n\n for (i = 0, j = children.length; i < j; ++i)\n {\n children[i].updateTransform();\n }\n\n if (clear)\n {\n this.textureBuffer.clear();\n }\n\n displayObject.worldTransform = cachedWt;\n\n// this.textureBuffer.\n var context = this.textureBuffer.context;\n\n var realResolution = this.renderer.resolution;\n\n this.renderer.resolution = this.resolution;\n\n this.renderer.renderDisplayObject(displayObject, context);\n\n this.renderer.resolution = realResolution;\n // context.setTransform(1, 0, 0, 1, 0, 0);\n // context.fillStyle =\"#FF0000\"\n// context.fillRect(0, 0, 800, 600);\n\n};\n\n/**\n * Destroys this texture\n *\n * @param destroyBase {boolean} Whether to destroy the base texture as well\n */\nRenderTexture.prototype.destroy = function ()\n{\n Texture.prototype.destroy.call(this, true);\n\n this.textureBuffer.destroy();\n\n // destroy the filtermanager..\n if(this.filterManager)\n {\n this.filterManager.destroy();\n }\n\n this.renderer = null;\n};\n\n/**\n * Will return a HTML Image of the texture\n *\n * @return {Image}\n */\nRenderTexture.prototype.getImage = function ()\n{\n var image = new Image();\n image.src = this.getBase64();\n return image;\n};\n\n/**\n * Will return a a base64 encoded string of this texture. It works by calling RenderTexture.getCanvas and then running toDataURL on that.\n *\n * @return {string} A base64 encoded string of the texture.\n */\nRenderTexture.prototype.getBase64 = function ()\n{\n return this.getCanvas().toDataURL();\n};\n\n/**\n * Creates a Canvas element, renders this RenderTexture to it and then returns it.\n *\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\nRenderTexture.prototype.getCanvas = function ()\n{\n if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL)\n {\n var gl = this.renderer.gl;\n var width = this.textureBuffer.size.width;\n var height = this.textureBuffer.size.height;\n\n var webGLPixels = new Uint8Array(4 * width * height);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n var tempCanvas = new CanvasBuffer(width, height);\n var canvasData = tempCanvas.context.getImageData(0, 0, width, height);\n canvasData.data.set(webGLPixels);\n\n tempCanvas.context.putImageData(canvasData, 0, 0);\n\n return tempCanvas.canvas;\n }\n else\n {\n return this.textureBuffer.canvas;\n }\n};\n\n/**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included).\n *\n * @return {Uint8ClampedArray}\n */\nRenderTexture.prototype.getPixels = function ()\n{\n var width, height;\n\n if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL)\n {\n var gl = this.renderer.gl;\n width = this.textureBuffer.size.width;\n height = this.textureBuffer.size.height;\n\n var webGLPixels = new Uint8Array(4 * width * height);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n return webGLPixels;\n }\n else\n {\n width = this.textureBuffer.canvas.width;\n height = this.textureBuffer.canvas.height;\n\n return this.textureBuffer.canvas.getContext('2d').getImageData(0, 0, width, height).data;\n }\n};\n\n/**\n * Will return a one-dimensional array containing the pixel data of a pixel within the texture in RGBA order, with integer values between 0 and 255 (included).\n *\n * @param x {number} The x coordinate of the pixel to retrieve.\n * @param y {number} The y coordinate of the pixel to retrieve.\n * @return {Uint8ClampedArray}\n */\nRenderTexture.prototype.getPixel = function (x, y)\n{\n if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL)\n {\n var gl = this.renderer.gl;\n\n var webGLPixels = new Uint8Array(4);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);\n gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n return webGLPixels;\n }\n else\n {\n return this.textureBuffer.canvas.getContext('2d').getImageData(x, y, 1, 1).data;\n }\n};\n","var BaseTexture = require('./BaseTexture'),\n VideoBaseTexture = require('./VideoBaseTexture'),\n TextureUvs = require('./TextureUvs'),\n EventEmitter = require('eventemitter3'),\n math = require('../math'),\n utils = require('../utils');\n\n/**\n * A texture stores the information that represents an image or part of an image. It cannot be added\n * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided 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 * var texture = PIXI.Texture.fromImage('assets/image.png');\n * var sprite1 = new PIXI.Sprite(texture);\n * var sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * @class\n * @memberof PIXI\n * @param baseTexture {BaseTexture} The base texture source to create the texture from\n * @param [frame] {Rectangle} The rectangle frame of the texture to show\n * @param [crop] {Rectangle} The area of original texture\n * @param [trim] {Rectangle} Trimmed texture rectangle\n * @param [rotate] {boolean} indicates whether the texture should be rotated by 90 degrees ( used by texture packer )\n */\nfunction Texture(baseTexture, frame, crop, trim, rotate)\n{\n EventEmitter.call(this);\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new math.Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n // console.log(frame);\n\n /**\n * The base texture that this texture uses.\n *\n * @member {BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * The frame specifies the region of the base texture that this texture uses\n *\n * @member {Rectangle}\n * @private\n */\n this._frame = frame;\n\n /**\n * The texture trim data.\n *\n * @member {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.\n *\n * @member {TextureUvs}\n * @private\n */\n this._uvs = null;\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n this.width = 0;\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n this.height = 0;\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 {Rectangle}\n */\n this.crop = crop || frame;//new math.Rectangle(0, 0, 1, 1);\n\n /**\n * Indicates whether the texture should be rotated by 90 degrees\n *\n * @private\n * @member {boolean}\n */\n this.rotate = !!rotate;\n\n if (baseTexture.hasLoaded)\n {\n if (this.noFrame)\n {\n frame = new math.Rectangle(0, 0, baseTexture.width, baseTexture.height);\n\n // if there is no frame we should monitor for any base texture changes..\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n this.frame = frame;\n }\n else\n {\n baseTexture.once('loaded', this.onBaseTextureLoaded, this);\n }\n\n /**\n * Fired when the texture is updated. This happens if the frame or the baseTexture is updated.\n *\n * @event update\n * @memberof PIXI.Texture#\n * @protected\n */\n}\n\nTexture.prototype = Object.create(EventEmitter.prototype);\nTexture.prototype.constructor = Texture;\nmodule.exports = Texture;\n\nObject.defineProperties(Texture.prototype, {\n frame: {\n get: function ()\n {\n return this._frame;\n },\n set: function (frame)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n this.width = frame.width;\n this.height = frame.height;\n\n\n\n if (!this.trim && !this.rotate && (frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height))\n {\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this);\n }\n\n //this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;\n this.valid = frame && frame.width && frame.height && this.baseTexture.hasLoaded;\n\n if (this.trim)\n {\n\n this.width = this.trim.width;\n this.height = this.trim.height;\n this._frame.width = this.trim.width;\n this._frame.height = this.trim.height;\n }\n else\n {\n this.crop = frame;\n }\n\n if (this.valid)\n {\n this._updateUvs();\n }\n }\n }\n});\n\n/**\n * Updates this texture on the gpu.\n *\n */\nTexture.prototype.update = function ()\n{\n this.baseTexture.update();\n};\n\n/**\n * Called when the base texture is loaded\n *\n * @private\n */\nTexture.prototype.onBaseTextureLoaded = function (baseTexture)\n{\n // TODO this code looks confusing.. boo to abusing getters and setterss!\n if (this.noFrame)\n {\n this.frame = new math.Rectangle(0, 0, baseTexture.width, baseTexture.height);\n }\n else\n {\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n};\n\nTexture.prototype.onBaseTextureUpdated = function (baseTexture)\n{\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n\n this.emit('update', this);\n};\n\n/**\n * Destroys this texture\n *\n * @param destroyBase {boolean} Whether to destroy the base texture as well\n */\nTexture.prototype.destroy = function (destroyBase)\n{\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n this.baseTexture.off('loaded', this.onBaseTextureLoaded, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.crop = null;\n\n this.valid = false;\n};\n\nTexture.prototype.clone = function ()\n{\n return new Texture(this.baseTexture, this.frame, this.crop, this.trim, this.rotate);\n};\n\n/**\n * Updates the internal WebGL UV cache.\n *\n * @private\n */\nTexture.prototype._updateUvs = function ()\n{\n if (!this._uvs)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this.crop, this.baseTexture, this.rotate);\n};\n\n/**\n * Helper function that creates a Texture object from the given image url.\n * If the image is not in the texture cache it will be created and loaded.\n *\n * @static\n * @param imageUrl {string} The image url of the texture\n * @param crossorigin {boolean} Whether requests should be treated as crossorigin\n * @param scaleMode {number} See {{#crossLink \"PIXI/scaleModes:property\"}}scaleModes{{/crossLink}} for possible values\n * @return {Texture} The newly created texture\n */\nTexture.fromImage = function (imageUrl, crossorigin, scaleMode)\n{\n var texture = utils.TextureCache[imageUrl];\n\n if (!texture)\n {\n texture = new Texture(BaseTexture.fromImage(imageUrl, crossorigin, scaleMode));\n utils.TextureCache[imageUrl] = texture;\n }\n\n return texture;\n};\n\n/**\n * Helper function that creates a sprite that will contain 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 frameId {String} The frame Id of the texture in the cache\n * @return {Texture} The newly created texture\n */\nTexture.fromFrame = function (frameId)\n{\n var texture = utils.TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error('The frameId \"' + frameId + '\" does not exist in the texture cache');\n }\n\n return texture;\n};\n\n/**\n * Helper function that creates a new Texture based on the given canvas element.\n *\n * @static\n * @param canvas {Canvas} The canvas element source of the texture\n * @param scaleMode {number} See {{#crossLink \"PIXI/scaleModes:property\"}}scaleModes{{/crossLink}} for possible values\n * @return {Texture}\n */\nTexture.fromCanvas = function (canvas, scaleMode)\n{\n return new Texture(BaseTexture.fromCanvas(canvas, scaleMode));\n};\n\n/**\n * Helper function that creates a new Texture based on the given video element.\n *\n * @static\n * @param video {HTMLVideoElement}\n * @param scaleMode {number} See {{#crossLink \"PIXI/scaleModes:property\"}}scaleModes{{/crossLink}} for possible values\n * @return {Texture} A Texture\n */\nTexture.fromVideo = function (video, scaleMode)\n{\n if (typeof video === 'string')\n {\n return Texture.fromVideoUrl(video, scaleMode);\n }\n else\n {\n return new Texture(VideoBaseTexture.fromVideo(video, scaleMode));\n }\n};\n\n/**\n * Helper function that creates a new Texture based on the video url.\n *\n * @static\n * @param videoUrl {string}\n * @param scaleMode {number} See {{@link SCALE_MODES}} for possible values\n * @return {Texture} A Texture\n */\nTexture.fromVideoUrl = function (videoUrl, scaleMode)\n{\n return new Texture(VideoBaseTexture.fromUrl(videoUrl, scaleMode));\n};\n\n/**\n * Adds a texture to the global utils.TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param texture {Texture} The Texture to add to the cache.\n * @param id {string} The id that the texture will be stored against.\n */\nTexture.addTextureToCache = function (texture, id)\n{\n utils.TextureCache[id] = texture;\n};\n\n/**\n * Remove a texture from the global utils.TextureCache.\n *\n * @static\n * @param id {string} The id of the texture to be removed\n * @return {Texture} The texture that was removed\n */\nTexture.removeTextureFromCache = function (id)\n{\n var texture = utils.TextureCache[id];\n\n delete utils.TextureCache[id];\n delete utils.BaseTextureCache[id];\n\n return texture;\n};\n\nTexture.EMPTY = new Texture(new BaseTexture());\n","\n/**\n * A standard object to store the Uvs of a texture\n *\n * @class\n * @private\n */\nfunction TextureUvs()\n{\n this.x0 = 0;\n this.y0 = 0;\n\n this.x1 = 1;\n this.y1 = 0;\n\n this.x2 = 1;\n this.y2 = 1;\n\n this.x3 = 0;\n this.y3 = 1;\n}\n\nmodule.exports = TextureUvs;\n\n/**\n * Sets the texture Uvs based on the given frame information\n * @param frame {Rectangle}\n * @param baseFrame {Rectangle}\n * @param rotate {boolean} Whether or not the frame is rotated\n * @private\n */\nTextureUvs.prototype.set = function (frame, baseFrame, rotate)\n{\n var tw = baseFrame.width;\n var th = baseFrame.height;\n\n if(rotate)\n {\n this.x0 = (frame.x + frame.height) / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.height) / tw;\n this.y1 = (frame.y + frame.width) / th;\n\n this.x2 = frame.x / tw;\n this.y2 = (frame.y + frame.width) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = frame.y / th;\n }\n else\n {\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","var BaseTexture = require('./BaseTexture'),\n utils = require('../utils');\n\n/**\n * A texture of a [playing] Video.\n *\n * Video base textures mimic Pixi BaseTexture.from.... method in their creation process.\n *\n * This can be used in several ways, such as:\n *\n * ```js\n * var texture = PIXI.VideoBaseTexture.fromUrl('http://mydomain.com/video.mp4');\n *\n * var texture = PIXI.VideoBaseTexture.fromUrl({ src: 'http://mydomain.com/video.mp4', mime: 'video/mp4' });\n *\n * var texture = PIXI.VideoBaseTexture.fromUrls(['/video.webm', '/video.mp4']);\n *\n * var texture = PIXI.VideoBaseTexture.fromUrls([\n * { src: '/video.webm', mime: 'video/webm' },\n * { src: '/video.mp4', mime: 'video/mp4' }\n * ]);\n * ```\n *\n * See the [\"deus\" demo](http://www.goodboydigital.com/pixijs/examples/deus/).\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n * @param source {HTMLVideoElement}\n * @param [scaleMode] {number} See {@link SCALE_MODES} for possible values\n */\nfunction VideoBaseTexture(source, scaleMode)\n{\n if (!source)\n {\n throw new Error('No video source element specified.');\n }\n\n // hook in here to check if video is already available.\n // BaseTexture looks for a source.complete boolean, plus width & height.\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) && source.width && source.height)\n {\n source.complete = true;\n }\n\n BaseTexture.call(this, source, scaleMode);\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n * @default true\n */\n this.autoUpdate = false;\n\n this._onUpdate = this._onUpdate.bind(this);\n this._onCanPlay = this._onCanPlay.bind(this);\n\n if (!source.complete)\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n\n // started playing..\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n }\n\n this.__loaded = false;\n}\n\nVideoBaseTexture.prototype = Object.create(BaseTexture.prototype);\nVideoBaseTexture.prototype.constructor = VideoBaseTexture;\nmodule.exports = VideoBaseTexture;\n\n/**\n * The internal update loop of the video base texture, only runs when autoUpdate is set to true\n * @private\n */\nVideoBaseTexture.prototype._onUpdate = function ()\n{\n if (this.autoUpdate)\n {\n window.requestAnimationFrame(this._onUpdate);\n this.update();\n }\n};\n\n/**\n * Runs the update loop when the video is ready to play\n * @private\n */\nVideoBaseTexture.prototype._onPlayStart = function ()\n{\n if (!this.autoUpdate)\n {\n window.requestAnimationFrame(this._onUpdate);\n this.autoUpdate = true;\n }\n};\n\n/**\n * Fired when a pause event is triggered, stops the update loop\n * @private\n */\nVideoBaseTexture.prototype._onPlayStop = function ()\n{\n this.autoUpdate = false;\n};\n\n/**\n * Fired when the video is loaded and ready to play\n * @private\n */\nVideoBaseTexture.prototype._onCanPlay = function ()\n{\n this.hasLoaded = true;\n\n if (this.source)\n {\n this.source.removeEventListener('canplay', this._onCanPlay);\n this.source.removeEventListener('canplaythrough', this._onCanPlay);\n\n this.width = this.source.videoWidth;\n this.height = this.source.videoHeight;\n\n this.source.play();\n\n // prevent multiple loaded dispatches..\n if (!this.__loaded)\n {\n this.__loaded = true;\n this.emit('loaded', this);\n }\n }\n};\n\n/**\n * Destroys this texture\n *\n */\nVideoBaseTexture.prototype.destroy = function ()\n{\n if (this.source && this.source._pixiId)\n {\n delete utils.BaseTextureCache[ this.source._pixiId ];\n delete this.source._pixiId;\n }\n\n BaseTexture.prototype.destroy.call(this);\n};\n\n/**\n * Mimic Pixi BaseTexture.from.... method.\n *\n * @static\n * @param video {HTMLVideoElement}\n * @param scaleMode {number} See {@link SCALE_MODES} for possible values\n * @return {VideoBaseTexture}\n */\nVideoBaseTexture.fromVideo = function (video, scaleMode)\n{\n if (!video._pixiId)\n {\n video._pixiId = 'video_' + utils.uuid();\n }\n\n var baseTexture = utils.BaseTextureCache[video._pixiId];\n\n if (!baseTexture)\n {\n baseTexture = new VideoBaseTexture(video, scaleMode);\n utils.BaseTextureCache[ video._pixiId ] = baseTexture;\n }\n\n return baseTexture;\n};\n\n/**\n * Helper function that creates a new BaseTexture based on the given video element.\n * This BaseTexture can then be used to create a texture\n *\n * @static\n * @param videoSrc {string|object|string[]|object[]} The URL(s) for the video.\n * @param [videoSrc.src] {string} One of the source urls for the video\n * @param [videoSrc.mime] {string} The mimetype of the video (e.g. 'video/mp4'). If not specified\n * the url's extension will be used as the second part of the mime type.\n * @param scaleMode {number} See {@link SCALE_MODES} for possible values\n * @return {VideoBaseTexture}\n */\nVideoBaseTexture.fromUrl = function (videoSrc, scaleMode)\n{\n var video = document.createElement('video');\n\n // array of objects or strings\n if (Array.isArray(videoSrc))\n {\n for (var i = 0; i < videoSrc.length; ++i)\n {\n video.appendChild(createSource(videoSrc.src || videoSrc, videoSrc.mime));\n }\n }\n // single object or string\n else\n {\n video.appendChild(createSource(videoSrc.src || videoSrc, videoSrc.mime));\n }\n\n video.load();\n video.play();\n\n return VideoBaseTexture.fromVideo(video, scaleMode);\n};\n\nVideoBaseTexture.fromUrls = VideoBaseTexture.fromUrl;\n\nfunction createSource(path, type)\n{\n if (!type)\n {\n type = 'video/' + path.substr(path.lastIndexOf('.') + 1);\n }\n\n var source = document.createElement('source');\n\n source.src = path;\n source.type = type;\n\n return source;\n}\n","var CONST = require('../const'),\n EventEmitter = require('eventemitter3'),\n // Internal event used by composed emitter\n TICK = 'tick';\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n * This class is composed around an EventEmitter object to add listeners\n * meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary,\n * e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI.ticker\n */\nfunction Ticker()\n{\n var _this = this;\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 */\n this._tick = function _tick(time) {\n\n _this._requestId = null;\n\n if (_this.started)\n {\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._emitter.listeners(TICK, true))\n {\n _this._requestId = requestAnimationFrame(_this._tick);\n }\n }\n };\n /**\n * Internal emitter used to fire 'tick' event\n * @private\n */\n this._emitter = new EventEmitter();\n /**\n * Internal current frame request ID\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 * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.ticker.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.ticker.Ticker#minFPS}\n * and is scaled with {@link PIXI.ticker.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 /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.ticker.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 *\n * @member {DOMHighResTimeStamp|number}\n * @default 1 / TARGET_FPMS\n */\n this.elapsedMS = 1 / CONST.TARGET_FPMS; // default to target frame time\n\n /**\n * The last time {@link PIXI.ticker.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 {DOMHighResTimeStamp|number}\n * @default 0\n */\n this.lastTime = 0;\n\n /**\n * Factor of current {@link PIXI.ticker.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 /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.ticker.Ticker#start} has been called.\n * `false` if {@link PIXI.ticker.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.ticker.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n}\n\nObject.defineProperties(Ticker.prototype, {\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.Ticker#speed}, which is specific\n * to scaling {@link PIXI.ticker.Ticker#deltaTime}.\n *\n * @member\n * @memberof PIXI.ticker.Ticker#\n * @readonly\n */\n FPS: {\n get: function()\n {\n return 1000 / this.elapsedMS;\n }\n },\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.ticker.Ticker#update}.\n * This value is used to cap {@link PIXI.ticker.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.ticker.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.TARGET_FPMS * 1000`.\n *\n * @member\n * @memberof PIXI.ticker.Ticker#\n * @default 10\n */\n minFPS: {\n get: function()\n {\n return 1000 / this._maxElapsedMS;\n },\n set: function(fps)\n {\n // Clamp: 0 to TARGET_FPMS\n var minFPMS = Math.min(Math.max(0, fps) / 1000, CONST.TARGET_FPMS);\n this._maxElapsedMS = 1 / minFPMS;\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 */\nTicker.prototype._requestIfNeeded = function _requestIfNeeded()\n{\n if (this._requestId === null && this._emitter.listeners(TICK, true))\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._requestId = requestAnimationFrame(this._tick);\n }\n};\n\n/**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\nTicker.prototype._cancelIfNeeded = function _cancelIfNeeded()\n{\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\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 */\nTicker.prototype._startIfPossible = function _startIfPossible()\n{\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n};\n\n/**\n * Calls {@link module:eventemitter3.EventEmitter#on} internally for the\n * internal 'tick' event. It checks if the emitter has listeners,\n * and if so it requests a new animation frame at this point.\n *\n * @param fn {Function} The listener function to be added for updates\n * @param [context] {Function} The listener context\n * @returns {PIXI.ticker.Ticker} this\n */\nTicker.prototype.add = function add(fn, context)\n{\n this._emitter.on(TICK, fn, context);\n\n this._startIfPossible();\n\n return this;\n};\n\n/**\n * Calls {@link module:eventemitter3.EventEmitter#once} internally for the\n * internal 'tick' event. It checks if the emitter has listeners,\n * and if so it requests a new animation frame at this point.\n *\n * @param fn {Function} The listener function to be added for one update\n * @param [context] {Function} The listener context\n * @returns {PIXI.ticker.Ticker} this\n */\nTicker.prototype.addOnce = function addOnce(fn, context)\n{\n this._emitter.once(TICK, fn, context);\n\n this._startIfPossible();\n\n return this;\n};\n\n/**\n * Calls {@link module:eventemitter3.EventEmitter#off} internally for 'tick' event.\n * It checks if the emitter has listeners for 'tick' event.\n * If it does, then it cancels the animation frame.\n *\n * @param [fn] {Function} The listener function to be removed\n * @param [context] {Function} The listener context to be removed\n * @returns {PIXI.ticker.Ticker} this\n */\nTicker.prototype.remove = function remove(fn, context)\n{\n this._emitter.off(TICK, fn, context);\n\n if (!this._emitter.listeners(TICK, true))\n {\n this._cancelIfNeeded();\n }\n\n return this;\n};\n\n/**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\nTicker.prototype.start = function start()\n{\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n};\n\n/**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\nTicker.prototype.stop = function stop()\n{\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n};\n\n/**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.ticker.Ticker#elapsedMS},\n * the current {@link PIXI.ticker.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.ticker.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 [currentTime=performance.now()] {DOMHighResTimeStamp|number} the current time of execution\n */\nTicker.prototype.update = function update(currentTime)\n{\n var elapsedMS;\n\n // Allow calling update directly with default currentTime.\n currentTime = currentTime || performance.now();\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n this.deltaTime = elapsedMS * CONST.TARGET_FPMS * this.speed;\n\n // Invoke listeners added to internal emitter\n this._emitter.emit(TICK, this.deltaTime);\n\n this.lastTime = currentTime;\n};\n\nmodule.exports = Ticker;\n","/**\n * @file Main export of the PIXI extras library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\nvar Ticker = require('./Ticker');\n\n/**\n * The shared ticker instance used by {@link PIXI.extras.MovieClip}.\n * and by {@link PIXI.interaction.InteractionManager}.\n * The property {@link PIXI.ticker.Ticker#autoStart} is set to `true`\n * for this instance. Please follow the examples for usage, including\n * how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * var 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 * var renderer = PIXI.autoDetectRenderer(800, 600);\n * var stage = new PIXI.Container();\n * var interactionManager = PIXI.interaction.InteractionManager(renderer);\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 * @type {PIXI.ticker.Ticker}\n * @memberof PIXI.ticker\n */\nvar shared = new Ticker();\nshared.autoStart = true;\n\n/**\n * @namespace PIXI.ticker\n */\nmodule.exports = {\n shared: shared,\n Ticker: Ticker\n};\n","var CONST = require('../const');\n\n/**\n * @namespace PIXI.utils\n */\nvar utils = module.exports = {\n _uid: 0,\n _saidHello: false,\n\n pluginTarget: require('./pluginTarget'),\n async: require('async'),\n\n /**\n * Gets the next uuid\n *\n * @return {number} The next uuid to use.\n */\n uuid: function ()\n {\n return ++utils._uid;\n },\n\n /**\n * Converts a hex color number to an [R, G, B] array\n *\n * @param hex {number}\n * @return {number[]} An array representing the [R, G, B] of the color.\n */\n hex2rgb: function (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 hex color number to a string.\n *\n * @param hex {number}\n * @return {string} The string color.\n */\n hex2string: function (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 color as an [R, G, B] array to a hex number\n *\n * @param rgb {number[]}\n * @return {number} The color number\n */\n rgb2hex: function (rgb)\n {\n return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255);\n },\n\n /**\n * Checks whether the Canvas BlendModes are supported by the current browser\n *\n * @return {boolean} whether they are supported\n */\n canUseNewCanvasBlendModes: function ()\n {\n if (typeof document === 'undefined')\n {\n return false;\n }\n\n var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/';\n var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==';\n\n var magenta = new Image();\n magenta.src = pngHead + 'AP804Oa6' + pngEnd;\n\n var yellow = new Image();\n yellow.src = pngHead + '/wCKxvRF' + pngEnd;\n\n var canvas = document.createElement('canvas');\n canvas.width = 6;\n canvas.height = 1;\n\n var context = canvas.getContext('2d');\n context.globalCompositeOperation = 'multiply';\n context.drawImage(magenta, 0, 0);\n context.drawImage(yellow, 2, 0);\n\n var data = context.getImageData(2,0,1,1).data;\n\n return (data[0] === 255 && data[1] === 0 && data[2] === 0);\n },\n\n /**\n * Given a number, this function returns the closest number that is a power of two\n * this function is taken from Starling Framework as its pretty neat ;)\n *\n * @param number {number}\n * @return {number} the closest number that is a power of two\n */\n getNextPowerOfTwo: function (number)\n {\n // see: http://en.wikipedia.org/wiki/Power_of_two#Fast_algorithm_to_check_if_a_positive_number_is_a_power_of_two\n if (number > 0 && (number & (number - 1)) === 0)\n {\n return number;\n }\n else\n {\n var result = 1;\n\n while (result < number)\n {\n result <<= 1;\n }\n\n return result;\n }\n },\n\n /**\n * checks if the given width and height make a power of two rectangle\n *\n * @param width {number}\n * @param height {number}\n * @return {boolean}\n */\n isPowerOfTwo: function (width, height)\n {\n return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0);\n },\n\n /**\n * get the resolution of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @param url {string} the image path\n * @return {boolean}\n */\n getResolutionOfUrl: function (url)\n {\n var resolution = CONST.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return 1;\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 set `PIXI.utils._saidHello = true;`\n * so the library thinks it already said it. Keep in mind that doing that will forever\n * makes you a jerk face.\n *\n * @param {string} type - The string renderer type to log.\n * @constant\n * @static\n */\n sayHello: function (type)\n {\n if (utils._saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n var args = [\n '\\n %c %c %c Pixi.js ' + CONST.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\n window.console.log.apply(console, args); //jshint ignore:line\n }\n else if (window.console)\n {\n window.console.log('Pixi.js ' + CONST.VERSION + ' - ' + type + ' - http://www.pixijs.com/'); //jshint ignore:line\n }\n\n utils._saidHello = true;\n },\n\n /**\n * Helper for checking for webgl support\n *\n * @return {boolean}\n */\n isWebGLSupported: function ()\n {\n var contextOptions = { stencil: true };\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n var canvas = document.createElement('canvas'),\n gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions);\n\n return !!(gl && gl.getContextAttributes().stencil);\n }\n catch (e)\n {\n return false;\n }\n },\n\n TextureCache: {},\n BaseTextureCache: {}\n};\n","/**\n * Mixins functionality to make an object have \"plugins\".\n *\n * @mixin\n * @memberof PIXI.utils\n * @param obj {object} The object to mix into.\n * @example\n * function MyObject() {}\n *\n * pluginTarget.mixin(MyObject);\n */\nfunction pluginTarget(obj)\n{\n obj.__plugins = {};\n\n /**\n * Adds a plugin to an object\n *\n * @param pluginName {string} The events that should be listed.\n * @param ctor {Object} ?? @alvin\n */\n obj.registerPlugin = function (pluginName, ctor)\n {\n obj.__plugins[pluginName] = ctor;\n };\n\n /**\n * Instantiates all the plugins of this object\n *\n */\n obj.prototype.initPlugins = function ()\n {\n this.plugins = this.plugins || {};\n\n for (var o in obj.__plugins)\n {\n this.plugins[o] = new (obj.__plugins[o])(this);\n }\n };\n\n /**\n * Removes all the plugins of this object\n *\n */\n obj.prototype.destroyPlugins = function ()\n {\n for (var o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n this.plugins = null;\n };\n}\n\n\nmodule.exports = {\n /**\n * Mixes in the properties of the pluginTarget into another object\n *\n * @param object {object} The obj to mix into\n */\n mixin: function mixin(obj)\n {\n pluginTarget(obj);\n }\n};\n","/*global console */\nvar core = require('./core'),\n mesh = require('./mesh'),\n extras = require('./extras'),\n utils = require('./core/utils');\n\n/**\n * @class\n * @private\n * @name PIXI.SpriteBatch\n * @see {@link PIXI.ParticleContainer}\n * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead.\n */\ncore.SpriteBatch = function() {\n throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.');\n};\n\n/**\n * @class\n * @private\n * @name PIXI.AssetLoader\n * @see {@link PIXI.loaders.Loader}\n * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.\n */\ncore.AssetLoader = function() {\n throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.');\n};\n\nObject.defineProperties(core, {\n\n /**\n * @class\n * @private\n * @name PIXI.Stage\n * @see {@link PIXI.Container}\n * @deprecated since version 3.0\n */\n Stage: {\n get: function() {\n console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.');\n return core.Container;\n }\n },\n\n /**\n * @class\n * @private\n * @name PIXI.DisplayObjectContainer\n * @see {@link PIXI.Container}\n * @deprecated since version 3.0\n */\n DisplayObjectContainer: {\n get: function() {\n console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.');\n return core.Container;\n }\n },\n\n /**\n * @class\n * @private\n * @name PIXI.Strip\n * @see {@link PIXI.mesh.Mesh}\n * @deprecated since version 3.0\n */\n Strip: {\n get: function() {\n console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.');\n return mesh.Mesh;\n }\n },\n\n /**\n * @class\n * @private\n * @name PIXI.Rope\n * @see {@link PIXI.mesh.Rope}\n * @deprecated since version 3.0\n */\n Rope: {\n get: function() {\n console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.');\n return mesh.Rope;\n }\n },\n\n /**\n * @class\n * @private\n * @name PIXI.MovieClip\n * @see {@link PIXI.MovieClip}\n * @deprecated since version 3.0\n */\n MovieClip: {\n get: function() {\n console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.');\n return extras.MovieClip;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.TilingSprite\n * @see {@link PIXI.TilingSprite}\n * @deprecated since version 3.0\n */\n TilingSprite: {\n get: function() {\n console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.');\n return extras.TilingSprite;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.BitmapText\n * @see {@link PIXI.extras.BitmapText}\n * @deprecated since version 3.0\n */\n BitmapText: {\n get: function() {\n console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.');\n return extras.BitmapText;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.blendModes\n * @see {@link PIXI.BLEND_MODES}\n * @deprecated since version 3.0\n */\n blendModes: {\n get: function() {\n console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.');\n return core.BLEND_MODES;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.scaleModes\n * @see {@link PIXI.SCALE_MODES}\n * @deprecated since version 3.0\n */\n scaleModes: {\n get: function() {\n console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.');\n return core.SCALE_MODES;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.BaseTextureCache\n * @see {@link PIXI.utils.BaseTextureCache}\n * @deprecated since version 3.0\n */\n BaseTextureCache: {\n get: function () {\n console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.');\n return utils.BaseTextureCache;\n }\n },\n /**\n * @class\n * @private\n * @name PIXI.TextureCache\n * @see {@link PIXI.utils.TextureCache}\n * @deprecated since version 3.0\n */\n TextureCache: {\n get: function () {\n console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.');\n return utils.TextureCache;\n }\n }\n});\n\n/**\n * @method\n * @private\n * @name PIXI.Sprite#setTexture\n * @see {@link PIXI.Sprite#texture}\n * @deprecated since version 3.0\n */\ncore.Sprite.prototype.setTexture = function(texture) {\n this.texture = texture;\n console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;');\n};\n\n/**\n * @method\n * @name PIXI.extras.BitmapText#setText\n * @see {@link PIXI.BitmapText#text}\n * @deprecated since version 3.0\n */\nextras.BitmapText.prototype.setText = function(text) {\n this.text = text;\n console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \\'my text\\';');\n};\n\n/**\n * @method\n * @name PIXI.Text#setText\n * @see {@link PIXI.Text#text}\n * @deprecated since version 3.0\n */\ncore.Text.prototype.setText = function(text) {\n this.text = text;\n console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \\'my text\\';');\n};\n\n/**\n * @method\n * @name PIXI.Text#setStyle\n * @see {@link PIXI.Text#style}\n * @deprecated since version 3.0\n */\ncore.Text.prototype.setStyle = function(style) {\n this.style = style;\n console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;');\n};\n\n/**\n * @method\n * @name PIXI.Texture#setFrame\n * @see {@link PIXI.Texture#setFrame}\n * @deprecated since version 3.0\n */\ncore.Texture.prototype.setFrame = function(frame) {\n this.frame = frame;\n console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;');\n};\n","var core = require('../core');\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\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 * var bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI.extras\n * @param text {string} The copy that you would like the text to display\n * @param style {object} The style parameters\n * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param [style.font.name] {string} The bitmap font id\n * @param [style.font.size] {number} The size of the font in pixels, e.g. 24\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect\n * single line text\n * @param [style.tint=0xFFFFFF] {number} The tint color\n */\nfunction BitmapText(text, style)\n{\n core.Container.call(this);\n\n style = style || {};\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 this.textWidth = 0;\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 this.textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {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 value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n this.maxWidth = 0;\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n}\n\n// constructor\nBitmapText.prototype = Object.create(core.Container.prototype);\nBitmapText.prototype.constructor = BitmapText;\nmodule.exports = BitmapText;\n\nObject.defineProperties(BitmapText.prototype, {\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n * @memberof BitmapText#\n */\n tint: {\n get: function ()\n {\n return this._font.tint;\n },\n set: function (value)\n {\n this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n },\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n * @memberof BitmapText#\n */\n align: {\n get: function ()\n {\n return this._font.align;\n },\n set: function (value)\n {\n this._font.align = value || 'left';\n\n this.dirty = true;\n }\n },\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {Font}\n * @memberof BitmapText#\n */\n font: {\n get: function ()\n {\n return this._font;\n },\n set: function (value)\n {\n if (!value) {\n return;\n }\n\n if (typeof value === 'string') {\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 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 /**\n * The text of the BitmapText object\n *\n * @member {string}\n * @memberof BitmapText#\n */\n text: {\n get: function ()\n {\n return this._text;\n },\n set: function (value)\n {\n value = value.toString() || ' ';\n if (this._text === value)\n {\n return;\n }\n this._text = value;\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nBitmapText.prototype.updateText = function ()\n{\n var data = BitmapText.fonts[this._font.name];\n var pos = new core.math.Point();\n var prevCharCode = null;\n var chars = [];\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var lineWidths = [];\n var line = 0;\n var scale = this._font.size / data.size;\n var lastSpace = -1;\n\n for (var i = 0; i < this.text.length; i++)\n {\n var charCode = this.text.charCodeAt(i);\n lastSpace = /(\\s)/.test(this.text.charAt(i)) ? i : lastSpace;\n\n if (/(?:\\r\\n|\\r|\\n)/.test(this.text.charAt(i)))\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth)\n {\n chars.splice(lastSpace, i - lastSpace);\n i = lastSpace;\n lastSpace = -1;\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\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({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});\n lastLineWidth = pos.x + (charData.texture.width + charData.xOffset);\n pos.x += charData.xAdvance;\n\n prevCharCode = charCode;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n\n var lineAlignOffsets = [];\n\n for (i = 0; i <= line; i++)\n {\n var alignOffset = 0;\n\n if (this._font.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._font.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (i = 0; i < lenChars; i++)\n {\n var c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].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 (i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this.textWidth = maxLineWidth * scale;\n this.textHeight = (pos.y + data.lineHeight) * scale;\n};\n\n/**\n * Updates the transform of this object\n *\n * @private\n */\nBitmapText.prototype.updateTransform = function ()\n{\n this.validate();\n this.containerUpdateTransform();\n};\n\n/**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {Rectangle} The rectangular bounding area\n */\n\nBitmapText.prototype.getLocalBounds = function()\n{\n this.validate();\n return core.Container.prototype.getLocalBounds.call(this);\n};\n\n/**\n * Updates text when needed\n *\n * @private\n */\nBitmapText.prototype.validate = function()\n{\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n};\n\nBitmapText.fonts = {};\n","var core = require('../core');\n\n/**\n * A MovieClip is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * var alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * var textureArray = [];\n *\n * for (var i=0; i < 4; i++)\n * {\n * var texture = PIXI.Texture.fromImage(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * var mc = new PIXI.MovieClip(textureArray);\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI.extras\n * @param textures {Texture[]} an array of {Texture} objects that make up the animation\n */\nfunction MovieClip(textures)\n{\n core.Sprite.call(this, textures[0]);\n\n /**\n * @private\n */\n this._textures = textures;\n\n /**\n * The speed that the MovieClip 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 movie clip repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Function to call when a MovieClip finishes playing\n *\n * @method\n * @memberof MovieClip#\n */\n this.onComplete = 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 MovieClip is currently playing\n *\n * @member {boolean}\n * @readonly\n */\n this.playing = false;\n}\n\n// constructor\nMovieClip.prototype = Object.create(core.Sprite.prototype);\nMovieClip.prototype.constructor = MovieClip;\nmodule.exports = MovieClip;\n\nObject.defineProperties(MovieClip.prototype, {\n /**\n * totalFrames is the total number of frames in the MovieClip. This is the same as number of textures\n * assigned to the MovieClip.\n *\n * @member {number}\n * @memberof PIXI.MovieClip#\n * @default 0\n * @readonly\n */\n totalFrames: {\n get: function()\n {\n return this._textures.length;\n }\n },\n\n /**\n * The array of textures used for this MovieClip\n *\n * @member {PIXI.Texture[]}\n * @memberof PIXI.MovieClip#\n *\n */\n textures: {\n get: function ()\n {\n return this._textures;\n },\n set: function (value)\n {\n this._textures = value;\n\n this.texture = this._textures[Math.floor(this._currentTime) % this._textures.length];\n }\n },\n\n /**\n * The MovieClips current frame index\n *\n * @member {number}\n * @memberof PIXI.MovieClip#\n * @readonly\n */\n currentFrame: {\n get: function ()\n {\n return Math.floor(this._currentTime) % this._textures.length;\n }\n }\n\n});\n\n/**\n * Stops the MovieClip\n *\n */\nMovieClip.prototype.stop = function ()\n{\n if(!this.playing)\n {\n return;\n }\n\n this.playing = false;\n core.ticker.shared.remove(this.update, this);\n};\n\n/**\n * Plays the MovieClip\n *\n */\nMovieClip.prototype.play = function ()\n{\n if(this.playing)\n {\n return;\n }\n\n this.playing = true;\n core.ticker.shared.add(this.update, this);\n};\n\n/**\n * Stops the MovieClip and goes to a specific frame\n *\n * @param frameNumber {number} frame index to stop at\n */\nMovieClip.prototype.gotoAndStop = function (frameNumber)\n{\n this.stop();\n\n this._currentTime = frameNumber;\n\n var round = Math.floor(this._currentTime);\n this._texture = this._textures[round % this._textures.length];\n};\n\n/**\n * Goes to a specific frame and begins playing the MovieClip\n *\n * @param frameNumber {number} frame index to start at\n */\nMovieClip.prototype.gotoAndPlay = function (frameNumber)\n{\n this._currentTime = frameNumber;\n this.play();\n};\n\n/*\n * Updates the object transform for rendering\n * @private\n */\nMovieClip.prototype.update = function (deltaTime)\n{\n\n this._currentTime += this.animationSpeed * deltaTime;\n\n var floor = Math.floor(this._currentTime);\n\n if (floor < 0)\n {\n if (this.loop)\n {\n this._texture = this._textures[this._textures.length - 1 + floor % this._textures.length];\n }\n else\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n }\n else if (this.loop || floor < this._textures.length)\n {\n this._texture = this._textures[floor % this._textures.length];\n }\n else if (floor >= this._textures.length)\n {\n this.gotoAndStop(this.textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n};\n\n/*\n * Stops the MovieClip and destroys it\n *\n */\nMovieClip.prototype.destroy = function ( )\n{\n this.stop();\n core.Sprite.prototype.destroy.call(this);\n};\n\n/**\n * A short hand way of creating a movieclip from an array of frame ids\n *\n * @static\n * @param frames {string[]} the array of frames ids the movieclip will use as its texture frames\n */\nMovieClip.fromFrames = function (frames)\n{\n var textures = [];\n\n for (var i = 0; i < frames.length; ++i)\n {\n textures.push(new core.Texture.fromFrame(frames[i]));\n }\n\n return new MovieClip(textures);\n};\n\n/**\n * A short hand way of creating a movieclip from an array of image ids\n *\n * @static\n * @param images {string[]} the array of image urls the movieclip will use as its texture frames\n */\nMovieClip.fromImages = function (images)\n{\n var textures = [];\n\n for (var i = 0; i < images.length; ++i)\n {\n textures.push(new core.Texture.fromImage(images[i]));\n }\n\n return new MovieClip(textures);\n};\n","var core = require('../core'),\n // a sprite use dfor rendering textures..\n tempPoint = new core.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.extras\n * @param texture {Texture} the texture of the tiling sprite\n * @param width {number} the width of the tiling sprite\n * @param height {number} the height of the tiling sprite\n */\nfunction TilingSprite(texture, width, height)\n{\n core.Sprite.call(this, texture);\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {Point}\n */\n this.tileScale = new core.math.Point(1,1);\n\n\n /**\n * The offset position of the image that is being tiled\n *\n * @member {Point}\n */\n this.tilePosition = new core.math.Point(0,0);\n\n ///// private\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width || 100;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height || 100;\n\n /**\n * An internal WebGL UV cache.\n *\n * @member {TextureUvs}\n * @private\n */\n this._uvs = new core.TextureUvs();\n\n this._canvasPattern = null;\n\n //TODO move..\n this.shader = new core.AbstractFilter(\n\n [\n 'precision lowp float;',\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n 'attribute vec4 aColor;',\n\n 'uniform mat3 projectionMatrix;',\n\n 'uniform vec4 uFrame;',\n 'uniform vec4 uTransform;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n\n ' vec2 coord = aTextureCoord;',\n ' coord -= uTransform.xy;',\n ' coord /= uTransform.zw;',\n ' coord /= uFrame.zw;',\n ' vTextureCoord = coord;',\n\n ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);',\n '}'\n ].join('\\n'),\n [\n 'precision lowp float;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'uniform sampler2D uSampler;',\n 'uniform vec4 uFrame;',\n\n 'void main(void){',\n\n ' vec2 coord = fract(vTextureCoord);',\n ' coord *= uFrame.zw;',\n ' coord += uFrame.xy;',\n\n ' gl_FragColor = texture2D(uSampler, coord) * vColor ;',\n '}'\n ].join('\\n'),\n\n // set the uniforms\n {\n uFrame: { type: '4fv', value: [0,0,1,1] },\n\n uTransform: { type: '4fv', value: [0,0,1,1] }\n }\n );\n}\n\nTilingSprite.prototype = Object.create(core.Sprite.prototype);\nTilingSprite.prototype.constructor = TilingSprite;\nmodule.exports = TilingSprite;\n\n\nObject.defineProperties(TilingSprite.prototype, {\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof TilingSprite#\n */\n width: {\n get: function ()\n {\n return this._width;\n },\n set: function (value)\n {\n this._width = value;\n }\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 * @memberof TilingSprite#\n */\n height: {\n get: function ()\n {\n return this._height;\n },\n set: function (value)\n {\n this._height = value;\n }\n }\n});\n\nTilingSprite.prototype._onTextureUpdate = function ()\n{\n return;\n};\n\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer}\n * @private\n */\nTilingSprite.prototype._renderWebGL = function (renderer)\n{\n // tweak our texture temporarily..\n var texture = this._texture;\n\n if(!texture || !texture._uvs)\n {\n return;\n }\n\n var tempUvs = texture._uvs,\n tempWidth = texture._frame.width,\n tempHeight = texture._frame.height,\n tw = texture.baseTexture.width,\n th = texture.baseTexture.height;\n\n texture._uvs = this._uvs;\n texture._frame.width = this.width;\n texture._frame.height = this.height;\n\n //PADDING\n\n // apply padding to stop gaps in the tile when numbers are not rounded\n this.shader.uniforms.uFrame.value[0] = tempUvs.x0;\n this.shader.uniforms.uFrame.value[1] = tempUvs.y0;\n this.shader.uniforms.uFrame.value[2] = tempUvs.x1 - tempUvs.x0;\n this.shader.uniforms.uFrame.value[3] = tempUvs.y2 - tempUvs.y0;\n\n this.shader.uniforms.uTransform.value[0] = (this.tilePosition.x % (tempWidth * this.tileScale.x)) / this._width;\n this.shader.uniforms.uTransform.value[1] = (this.tilePosition.y % (tempHeight * this.tileScale.y)) / this._height;\n this.shader.uniforms.uTransform.value[2] = ( tw / this._width ) * this.tileScale.x;\n this.shader.uniforms.uTransform.value[3] = ( th / this._height ) * this.tileScale.y;\n\n renderer.setObjectRenderer(renderer.plugins.sprite);\n renderer.plugins.sprite.render(this);\n\n texture._uvs = tempUvs;\n texture._frame.width = tempWidth;\n texture._frame.height = tempHeight;\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer} a reference to the canvas renderer\n * @private\n */\nTilingSprite.prototype._renderCanvas = function (renderer)\n{\n var texture = this._texture;\n\n if (!texture.baseTexture.hasLoaded)\n {\n return;\n }\n\n var context = renderer.context,\n transform = this.worldTransform,\n resolution = renderer.resolution,\n baseTexture = texture.baseTexture,\n modX = this.tilePosition.x % (texture._frame.width * this.tileScale.x),\n modY = this.tilePosition.y % (texture._frame.height * this.tileScale.y);\n\n // create a nice shiny pattern!\n // TODO this needs to be refreshed if texture changes..\n if(!this._canvasPattern)\n {\n // cut an object from a spritesheet..\n var tempCanvas = new core.CanvasBuffer(texture._frame.width, texture._frame.height);\n tempCanvas.context.drawImage(baseTexture.source, -texture._frame.x,-texture._frame.y);\n this._canvasPattern = tempCanvas.context.createPattern( tempCanvas.canvas, 'repeat' );\n }\n\n // set context state..\n context.globalAlpha = this.worldAlpha;\n context.setTransform(transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution);\n\n // TODO - this should be rolled into the setTransform above..\n context.scale(this.tileScale.x,this.tileScale.y);\n\n\n context.translate(modX + (this.anchor.x * -this._width ),\n modY + (this.anchor.y * -this._height));\n\n // check blend mode\n if (this.blendMode !== renderer.currentBlendMode)\n {\n renderer.currentBlendMode = this.blendMode;\n context.globalCompositeOperation = renderer.blendModes[renderer.currentBlendMode];\n }\n\n // fill the pattern!\n context.fillStyle = this._canvasPattern;\n context.fillRect(-modX,\n -modY,\n this._width / this.tileScale.x,\n this._height / this.tileScale.y);\n\n\n //TODO - pretty sure this can be deleted...\n //context.translate(-this.tilePosition.x + (this.anchor.x * this._width), -this.tilePosition.y + (this.anchor.y * this._height));\n //context.scale(1 / this.tileScale.x, 1 / this.tileScale.y);\n};\n\n\n/**\n * Returns the framing rectangle of the sprite as a Rectangle object\n*\n * @return {Rectangle} the framing rectangle\n */\nTilingSprite.prototype.getBounds = function ()\n{\n var width = this._width;\n var height = this._height;\n\n var w0 = width * (1-this.anchor.x);\n var w1 = width * -this.anchor.x;\n\n var h0 = height * (1-this.anchor.y);\n var h1 = height * -this.anchor.y;\n\n var worldTransform = this.worldTransform;\n\n var a = worldTransform.a;\n var b = worldTransform.b;\n var c = worldTransform.c;\n var d = worldTransform.d;\n var tx = worldTransform.tx;\n var ty = worldTransform.ty;\n\n var x1 = a * w1 + c * h1 + tx;\n var y1 = d * h1 + b * w1 + ty;\n\n var x2 = a * w0 + c * h1 + tx;\n var y2 = d * h1 + b * w0 + ty;\n\n var x3 = a * w0 + c * h0 + tx;\n var y3 = d * h0 + b * w0 + ty;\n\n var x4 = a * w1 + c * h0 + tx;\n var y4 = d * h0 + b * w1 + ty;\n\n var minX,\n maxX,\n minY,\n maxY;\n\n minX = x1;\n minX = x2 < minX ? x2 : minX;\n minX = x3 < minX ? x3 : minX;\n minX = x4 < minX ? x4 : minX;\n\n minY = y1;\n minY = y2 < minY ? y2 : minY;\n minY = y3 < minY ? y3 : minY;\n minY = y4 < minY ? y4 : minY;\n\n maxX = x1;\n maxX = x2 > maxX ? x2 : maxX;\n maxX = x3 > maxX ? x3 : maxX;\n maxX = x4 > maxX ? x4 : maxX;\n\n maxY = y1;\n maxY = y2 > maxY ? y2 : maxY;\n maxY = y3 > maxY ? y3 : maxY;\n maxY = y4 > maxY ? y4 : maxY;\n\n var bounds = this._bounds;\n\n bounds.x = minX;\n bounds.width = maxX - minX;\n\n bounds.y = minY;\n bounds.height = maxY - minY;\n\n // store a reference so that if this function gets called again in the render cycle we do not have to recalculate\n this._currentBounds = bounds;\n\n return bounds;\n};\n\n/**\n * Checks if a point is inside this tiling sprite\n * @param point {Point} the point to check\n */\nTilingSprite.prototype.containsPoint = function( 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 var y1;\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 tiling sprite\n *\n */\nTilingSprite.prototype.destroy = function () {\n core.Sprite.prototype.destroy.call(this);\n\n this.tileScale = null;\n this._tileScaleOffset = null;\n this.tilePosition = null;\n\n this._uvs = null;\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 frameId {String} The frame Id of the texture in the cache\n * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId\n * @param width {number} the width of the tiling sprite\n * @param height {number} the height of the tiling sprite\n */\nTilingSprite.fromFrame = function (frameId,width,height)\n{\n var texture = core.utils.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 imageId {String} The image url of the texture\n * @param width {number} the width of the tiling sprite\n * @param height {number} the height of the tiling sprite\n * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter\n * @param [scaleMode=scaleModes.DEFAULT] {number} if you want to specify the scale mode, see {@link SCALE_MODES} for possible values\n * @return {TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id\n */\nTilingSprite.fromImage = function (imageId, width, height, crossorigin, scaleMode)\n{\n return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height);\n};\n","var core = require('../core'),\n DisplayObject = core.DisplayObject,\n _tempMatrix = new core.Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._originalRenderWebGL = null;\nDisplayObject.prototype._originalRenderCanvas = null;\n\nDisplayObject.prototype._originalUpdateTransform = null;\nDisplayObject.prototype._originalHitTest = null;\nDisplayObject.prototype._originalDestroy = null;\nDisplayObject.prototype._cachedSprite = null;\n\nObject.defineProperties(DisplayObject.prototype, {\n\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 provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to 'null'\n *\n * @member {boolean}\n * @memberof DisplayObject#\n */\n cacheAsBitmap: {\n get: function ()\n {\n return this._cacheAsBitmap;\n },\n set: function (value)\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n if (value)\n {\n this._originalRenderWebGL = this.renderWebGL;\n this._originalRenderCanvas = this.renderCanvas;\n\n this._originalUpdateTransform = this.updateTransform;\n this._originalGetBounds = this.getBounds;\n\n this._originalDestroy = this.destroy;\n\n this._originalContainsPoint = this.containsPoint;\n\n this.renderWebGL = this._renderCachedWebGL;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n\n }\n else\n {\n if (this._cachedSprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.renderWebGL = this._originalRenderWebGL;\n this.renderCanvas = this._originalRenderCanvas;\n this.getBounds = this._originalGetBounds;\n\n this.destroy = this._originalDestroy;\n\n this.updateTransform = this._originalUpdateTransform;\n this.containsPoint = this._originalContainsPoint;\n }\n }\n }\n});\n/**\n* Renders a cached version of the sprite with WebGL\n*\n* @param renderer {WebGLRenderer} the WebGL renderer\n* @private\n*/\nDisplayObject.prototype._renderCachedWebGL = function (renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n \n this._initCachedDisplayObject( renderer );\n\n renderer.setObjectRenderer(renderer.plugins.sprite);\n renderer.plugins.sprite.render( this._cachedSprite );\n};\n\n/**\n* Prepares the WebGL renderer to cache the sprite\n*\n* @param renderer {WebGLRenderer} the WebGL renderer\n* @private\n*/\nDisplayObject.prototype._initCachedDisplayObject = function (renderer)\n{\n if(this._cachedSprite)\n {\n return;\n }\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.currentRenderer.flush();\n //this.filters= [];\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. 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 bounds.x -= padding;\n bounds.y -= padding;\n\n bounds.width += padding * 2;\n bounds.height += padding * 2;\n }\n\n // for now we cache the current renderTarget that the webGL renderer is currently using.\n // this could be more elegent..\n var cachedRenderTarget = renderer.currentRenderTarget;\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n var stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0);\n\n // need to set //\n var m = _tempMatrix;\n\n m.tx = -bounds.x;\n m.ty = -bounds.y;\n\n\n\n // set all properties to there original so we can render to a texture\n this.renderWebGL = this._originalRenderWebGL;\n\n renderTexture.render(this, m, true, true);\n\n // now restore the state be setting the new properties\n renderer.setRenderTarget(cachedRenderTarget);\n renderer.filterManager.filterStack = stack;\n\n this.renderWebGL = this._renderCachedWebGL;\n this.updateTransform = this.displayObjectUpdateTransform;\n this.getBounds = this._getCachedBounds;\n\n\n // create our cached sprite\n this._cachedSprite = new core.Sprite(renderTexture);\n this._cachedSprite.worldTransform = this.worldTransform;\n this._cachedSprite.anchor.x = -( bounds.x / bounds.width );\n this._cachedSprite.anchor.y = -( bounds.y / bounds.height );\n\n // restore the transform of the cached sprite to avoid the nasty flicker..\n this.updateTransform();\n\n // map the hit test..\n this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite);\n};\n\n/**\n* Renders a cached version of the sprite with canvas\n*\n* @param renderer {CanvasRenderer} the Canvas renderer\n* @private\n*/\nDisplayObject.prototype._renderCachedCanvas = function (renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n \n this._initCachedDisplayObjectCanvas( renderer );\n\n this._cachedSprite.worldAlpha = this.worldAlpha;\n\n this._cachedSprite.renderCanvas(renderer);\n};\n\n//TODO this can be the same as the webGL verison.. will need to do a little tweaking first though..\n/**\n* Prepares the Canvas renderer to cache the sprite\n*\n* @param renderer {CanvasRenderer} the Canvas renderer\n* @private\n*/\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function (renderer)\n{\n if(this._cachedSprite)\n {\n return;\n }\n\n //get bounds actually transforms the object for us already!\n var bounds = this.getLocalBounds();\n\n var cachedRenderTarget = renderer.context;\n\n var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0);\n\n // need to set //\n var m = _tempMatrix;\n\n m.tx = -bounds.x;\n m.ty = -bounds.y;\n\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._originalRenderCanvas;\n\n renderTexture.render(this, m, true);\n\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n\n this.renderCanvas = this._renderCachedCanvas;\n this.updateTransform = this.displayObjectUpdateTransform;\n this.getBounds = this._getCachedBounds;\n\n\n // create our cached sprite\n this._cachedSprite = new core.Sprite(renderTexture);\n this._cachedSprite.worldTransform = this.worldTransform;\n this._cachedSprite.anchor.x = -( bounds.x / bounds.width );\n this._cachedSprite.anchor.y = -( bounds.y / bounds.height );\n\n this.updateTransform();\n\n this.containsPoint = this._cachedSprite.containsPoint.bind(this._cachedSprite);\n};\n\n/**\n* Calculates the bounds of the cached sprite\n*\n* @private\n*/\nDisplayObject.prototype._getCachedBounds = function ()\n{\n this._cachedSprite._currentBounds = null;\n\n return this._cachedSprite.getBounds();\n};\n\n/**\n* Destroys the cached sprite.\n*\n* @private\n*/\nDisplayObject.prototype._destroyCachedDisplayObject = function ()\n{\n this._cachedSprite._texture.destroy();\n this._cachedSprite = null;\n};\n\nDisplayObject.prototype._cacheAsBitmapDestroy = function ()\n{\n this.cacheAsBitmap = false;\n this._originalDestroy();\n};\n","var core = require('../core');\n\n/**\n * The instance name of the object.\n *\n * @member {string}\n */\ncore.DisplayObject.prototype.name = null;\n\n/**\n* Returns the display object in the container\n*\n* @param name {string} instance name\n* @return {DisplayObject}\n*/\ncore.Container.prototype.getChildByName = function (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 return null;\n};\n","var core = require('../core');\n\n/**\n* Returns the global position of the displayObject\n*\n* @param point {Point} the point to write the global value to. If null a new point will be returned\n* @return {Point}\n*/\ncore.DisplayObject.prototype.getGlobalPosition = function (point)\n{\n point = point || new core.Point();\n\n if(this.parent)\n {\n this.displayObjectUpdateTransform();\n\n point.x = this.worldTransform.tx;\n point.y = this.worldTransform.ty;\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","/**\n * @file Main export of the PIXI extras library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\nrequire('./cacheAsBitmap');\nrequire('./getChildByName');\nrequire('./getGlobalPosition');\n\n/**\n * @namespace PIXI.extras\n */\nmodule.exports = {\n MovieClip: require('./MovieClip'),\n TilingSprite: require('./TilingSprite'),\n BitmapText: require('./BitmapText')\n};\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n// TODO (cengler) - The Y is flipped in this shader for some reason.\n\n/**\n * @author Vico @vicocotea\n * original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h\n */\n\n/**\n * An ASCII filter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction AsciiFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nuniform vec4 dimensions;\\nuniform float pixelSize;\\nuniform sampler2D uSampler;\\n\\nfloat character(float n, vec2 p)\\n{\\n p = floor(p*vec2(4.0, -4.0) + 2.5);\\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\\n {\\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\\n }\\n return 0.0;\\n}\\n\\nvoid main()\\n{\\n vec2 uv = gl_FragCoord.xy;\\n\\n vec3 col = texture2D(uSampler, floor( uv / pixelSize ) * pixelSize / dimensions.xy).rgb;\\n\\n float gray = (col.r + col.g + col.b) / 3.0;\\n\\n float n = 65536.0; // .\\n if (gray > 0.2) n = 65600.0; // :\\n if (gray > 0.3) n = 332772.0; // *\\n if (gray > 0.4) n = 15255086.0; // o\\n if (gray > 0.5) n = 23385164.0; // &\\n if (gray > 0.6) n = 15252014.0; // 8\\n if (gray > 0.7) n = 13199452.0; // @\\n if (gray > 0.8) n = 11512810.0; // #\\n\\n vec2 p = mod( uv / ( pixelSize * 0.5 ), 2.0) - vec2(1.0);\\n col = col * character(n, p);\\n\\n gl_FragColor = vec4(col, 1.0);\\n}\\n\",\n // custom uniforms\n {\n dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) },\n pixelSize: { type: '1f', value: 8 }\n }\n );\n}\n\nAsciiFilter.prototype = Object.create(core.AbstractFilter.prototype);\nAsciiFilter.prototype.constructor = AsciiFilter;\nmodule.exports = AsciiFilter;\n\nObject.defineProperties(AsciiFilter.prototype, {\n /**\n * The pixel size used by the filter.\n *\n * @member {number}\n * @memberof AsciiFilter#\n */\n size: {\n get: function ()\n {\n return this.uniforms.pixelSize.value;\n },\n set: function (value)\n {\n this.uniforms.pixelSize.value = value;\n }\n }\n});\n","var core = require('../../core'),\n BlurXFilter = require('../blur/BlurXFilter'),\n BlurYFilter = require('../blur/BlurYFilter');\n\n/**\n * The BloomFilter applies a Gaussian blur to an object.\n * The strength of the blur can be set for x- and y-axis separately.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BloomFilter()\n{\n core.AbstractFilter.call(this);\n\n this.blurXFilter = new BlurXFilter();\n this.blurYFilter = new BlurYFilter();\n\n this.defaultFilter = new core.AbstractFilter();\n}\n\nBloomFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBloomFilter.prototype.constructor = BloomFilter;\nmodule.exports = BloomFilter;\n\nBloomFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n\n //TODO - copyTexSubImage2D could be used here?\n this.defaultFilter.applyFilter(renderer, input, output);\n\n this.blurXFilter.applyFilter(renderer, input, renderTarget);\n\n renderer.blendModeManager.setBlendMode(core.BLEND_MODES.SCREEN);\n\n this.blurYFilter.applyFilter(renderer, renderTarget, output);\n\n renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n};\n\nObject.defineProperties(BloomFilter.prototype, {\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @memberOf BloomFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n }\n },\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @memberOf BloomFilter#\n * @default 2\n */\n blurX: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.blurXFilter.blur = value;\n }\n },\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @memberOf BloomFilter#\n * @default 2\n */\n blurY: {\n get: function ()\n {\n return this.blurYFilter.blur;\n },\n set: function (value)\n {\n this.blurYFilter.blur = value;\n }\n }\n});\n","var core = require('../../core');\n\n\n/**\n * The BlurDirFilter applies a Gaussian blur toward a direction to an object.\n *\n * @class\n * @param {number} dirX\n * @param {number} dirY\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BlurDirFilter(dirX, dirY)\n{\n core.AbstractFilter.call(this,\n // vertex shader\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform float strength;\\nuniform float dirX;\\nuniform float dirY;\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying vec2 vBlurTexCoords[3];\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n\\n vBlurTexCoords[0] = aTextureCoord + vec2( (0.004 * strength) * dirX, (0.004 * strength) * dirY );\\n vBlurTexCoords[1] = aTextureCoord + vec2( (0.008 * strength) * dirX, (0.008 * strength) * dirY );\\n vBlurTexCoords[2] = aTextureCoord + vec2( (0.012 * strength) * dirX, (0.012 * strength) * dirY );\\n\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec2 vBlurTexCoords[3];\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = vec4(0.0);\\n\\n gl_FragColor += texture2D(uSampler, vTextureCoord ) * 0.3989422804014327;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0]) * 0.2419707245191454;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1]) * 0.05399096651318985;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2]) * 0.004431848411938341;\\n}\\n\",\n // set the uniforms\n {\n strength: { type: '1f', value: 1 },\n dirX: { type: '1f', value: dirX || 0 },\n dirY: { type: '1f', value: dirY || 0 }\n }\n );\n\n this.defaultFilter = new core.AbstractFilter();\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @memberof BlurDirFilter#\n * @default 1\n */\n this.passes = 1;\n\n /**\n * Sets the X direction of the blur\n *\n * @member {number}\n * @memberof BlurDirFilter#\n * @default 0\n */\n this.dirX = dirX || 0;\n\n /**\n * Sets the Y direction of the blur\n *\n * @member {number}\n * @memberof BlurDirFilter#\n * @default 0\n */\n this.dirY = dirY || 0;\n\n this.strength = 4;\n}\n\nBlurDirFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBlurDirFilter.prototype.constructor = BlurDirFilter;\nmodule.exports = BlurDirFilter;\n\nBlurDirFilter.prototype.applyFilter = function (renderer, input, output, clear) {\n\n var shader = this.getShader(renderer);\n\n this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width);\n\n if (this.passes === 1) {\n renderer.filterManager.applyFilter(shader, input, output, clear);\n } else {\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n\n renderer.filterManager.applyFilter(shader, input, renderTarget, clear);\n\n for(var i = 0; i < this.passes-2; i++)\n {\n //this.uniforms.strength.value = this.strength / 4 / (this.passes+(i*2)) * (input.frame.width / input.size.width);\n renderer.filterManager.applyFilter(shader, renderTarget, renderTarget, clear);\n }\n\n renderer.filterManager.applyFilter(shader, renderTarget, output, clear);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n }\n};\n\n\nObject.defineProperties(BlurDirFilter.prototype, {\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @memberof BlurDirFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.strength;\n },\n set: function (value)\n {\n this.padding = value * 0.5;\n this.strength = value;\n }\n },\n /**\n * Sets the X direction of the blur.\n *\n * @member {number}\n * @memberof BlurYFilter#\n * @default 0\n */\n dirX: {\n get: function ()\n {\n return this.dirX;\n },\n set: function (value)\n {\n this.uniforms.dirX.value = value;\n }\n },\n /**\n * Sets the Y direction of the blur.\n *\n * @member {number}\n * @memberof BlurDirFilter#\n * @default 0\n */\n dirY: {\n get: function ()\n {\n return this.dirY;\n },\n set: function (value)\n {\n this.uniforms.dirY.value = value;\n }\n }\n});\n","var core = require('../../core'),\n BlurXFilter = require('./BlurXFilter'),\n BlurYFilter = require('./BlurYFilter');\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n * The strength of the blur can be set for x- and y-axis separately.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BlurFilter()\n{\n core.AbstractFilter.call(this);\n\n this.blurXFilter = new BlurXFilter();\n this.blurYFilter = new BlurYFilter();\n}\n\nBlurFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBlurFilter.prototype.constructor = BlurFilter;\nmodule.exports = BlurFilter;\n\nBlurFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n\n this.blurXFilter.applyFilter(renderer, input, renderTarget);\n this.blurYFilter.applyFilter(renderer, renderTarget, output);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n};\n\nObject.defineProperties(BlurFilter.prototype, {\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @memberOf BlurFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.padding = Math.abs(value) * 0.5;\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n }\n },\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @memberof BlurYFilter#\n * @default 1\n */\n passes: {\n get: function ()\n {\n return this.blurXFilter.passes;\n },\n set: function (value)\n {\n this.blurXFilter.passes = this.blurYFilter.passes = value;\n }\n },\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @memberOf BlurFilter#\n * @default 2\n */\n blurX: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.blurXFilter.blur = value;\n }\n },\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @memberOf BlurFilter#\n * @default 2\n */\n blurY: {\n get: function ()\n {\n return this.blurYFilter.blur;\n },\n set: function (value)\n {\n this.blurYFilter.blur = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The BlurXFilter applies a horizontal Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BlurXFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform float strength;\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying vec2 vBlurTexCoords[6];\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n\\n vBlurTexCoords[ 0] = aTextureCoord + vec2(-0.012 * strength, 0.0);\\n vBlurTexCoords[ 1] = aTextureCoord + vec2(-0.008 * strength, 0.0);\\n vBlurTexCoords[ 2] = aTextureCoord + vec2(-0.004 * strength, 0.0);\\n vBlurTexCoords[ 3] = aTextureCoord + vec2( 0.004 * strength, 0.0);\\n vBlurTexCoords[ 4] = aTextureCoord + vec2( 0.008 * strength, 0.0);\\n vBlurTexCoords[ 5] = aTextureCoord + vec2( 0.012 * strength, 0.0);\\n\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec2 vBlurTexCoords[6];\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = vec4(0.0);\\n\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\\n}\\n\",\n // set the uniforms\n {\n strength: { type: '1f', value: 1 }\n }\n );\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @memberof BlurXFilter#\n * @default 1\n */\n this.passes = 1;\n\n this.strength = 4;\n}\n\nBlurXFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBlurXFilter.prototype.constructor = BlurXFilter;\nmodule.exports = BlurXFilter;\n\nBlurXFilter.prototype.applyFilter = function (renderer, input, output, clear)\n{\n var shader = this.getShader(renderer);\n\n this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.width / input.size.width);\n\n if(this.passes === 1)\n {\n renderer.filterManager.applyFilter(shader, input, output, clear);\n }\n else\n {\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n var flip = input;\n var flop = renderTarget;\n\n for(var i = 0; i < this.passes-1; i++)\n {\n renderer.filterManager.applyFilter(shader, flip, flop, true);\n\n var temp = flop;\n flop = flip;\n flip = temp;\n }\n\n renderer.filterManager.applyFilter(shader, flip, output, clear);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n }\n};\n\n\nObject.defineProperties(BlurXFilter.prototype, {\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @memberof BlurXFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.strength;\n },\n set: function (value)\n {\n this.padding = Math.abs(value) * 0.5;\n this.strength = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The BlurYFilter applies a horizontal Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BlurYFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform float strength;\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying vec2 vBlurTexCoords[6];\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n\\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\\n\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec2 vBlurTexCoords[6];\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = vec4(0.0);\\n\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\\n}\\n\",\n // set the uniforms\n {\n strength: { type: '1f', value: 1 }\n }\n );\n\n this.passes = 1;\n this.strength = 4;\n}\n\nBlurYFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBlurYFilter.prototype.constructor = BlurYFilter;\nmodule.exports = BlurYFilter;\n\nBlurYFilter.prototype.applyFilter = function (renderer, input, output, clear)\n{\n var shader = this.getShader(renderer);\n\n this.uniforms.strength.value = Math.abs(this.strength) / 4 / this.passes * (input.frame.height / input.size.height);\n\n if(this.passes === 1)\n {\n renderer.filterManager.applyFilter(shader, input, output, clear);\n }\n else\n {\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n var flip = input;\n var flop = renderTarget;\n\n for(var i = 0; i < this.passes-1; i++)\n {\n renderer.filterManager.applyFilter(shader, flip, flop, true);\n\n var temp = flop;\n flop = flip;\n flip = temp;\n }\n\n renderer.filterManager.applyFilter(shader, flip, output, clear);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n }\n};\n\n\nObject.defineProperties(BlurYFilter.prototype, {\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @memberof BlurYFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.strength;\n },\n set: function (value)\n {\n this.padding = Math.abs(value) * 0.5;\n this.strength = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * A Smart Blur Filter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction SmartBlurFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec2 delta;\\n\\nfloat random(vec3 scale, float seed)\\n{\\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\\n}\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n float total = 0.0;\\n\\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\\n\\n for (float t = -30.0; t <= 30.0; t++)\\n {\\n float percent = (t + offset - 0.5) / 30.0;\\n float weight = 1.0 - abs(percent);\\n vec4 sample = texture2D(uSampler, vTextureCoord + delta * percent);\\n sample.rgb *= sample.a;\\n color += sample * weight;\\n total += weight;\\n }\\n\\n gl_FragColor = color / total;\\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\\n}\\n\",\n // uniforms\n {\n delta: { type: 'v2', value: { x: 0.1, y: 0.0 } }\n }\n );\n}\n\nSmartBlurFilter.prototype = Object.create(core.AbstractFilter.prototype);\nSmartBlurFilter.prototype.constructor = SmartBlurFilter;\nmodule.exports = SmartBlurFilter;\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\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 * var colorMatrix = new PIXI.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault <clement@goodboydigital.com>\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction ColorMatrixFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform float m[25];\\n\\nvoid main(void)\\n{\\n\\n vec4 c = texture2D(uSampler, vTextureCoord);\\n\\n gl_FragColor.r = (m[0] * c.r);\\n gl_FragColor.r += (m[1] * c.g);\\n gl_FragColor.r += (m[2] * c.b);\\n gl_FragColor.r += (m[3] * c.a);\\n gl_FragColor.r += m[4];\\n\\n gl_FragColor.g = (m[5] * c.r);\\n gl_FragColor.g += (m[6] * c.g);\\n gl_FragColor.g += (m[7] * c.b);\\n gl_FragColor.g += (m[8] * c.a);\\n gl_FragColor.g += m[9];\\n\\n gl_FragColor.b = (m[10] * c.r);\\n gl_FragColor.b += (m[11] * c.g);\\n gl_FragColor.b += (m[12] * c.b);\\n gl_FragColor.b += (m[13] * c.a);\\n gl_FragColor.b += m[14];\\n\\n gl_FragColor.a = (m[15] * c.r);\\n gl_FragColor.a += (m[16] * c.g);\\n gl_FragColor.a += (m[17] * c.b);\\n gl_FragColor.a += (m[18] * c.a);\\n gl_FragColor.a += m[19];\\n\\n}\\n\",\n // custom uniforms\n {\n m: {\n type: '1fv', value: [\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 }\n }\n );\n}\n\nColorMatrixFilter.prototype = Object.create(core.AbstractFilter.prototype);\nColorMatrixFilter.prototype.constructor = ColorMatrixFilter;\nmodule.exports = ColorMatrixFilter;\n\n\n/**\n * Transforms current matrix and set the new one\n *\n * @param matrix {number[]} (mat 5x4)\n * @param multiply {boolean} if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix\n */\nColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply)\n{\n multiply = !!multiply;\n\n var newMatrix = matrix;\n\n if (multiply) {\n this._multiply(newMatrix, this.uniforms.m.value, matrix);\n newMatrix = this._colorMatrix(newMatrix);\n }\n\n // set the new matrix\n this.uniforms.m.value = newMatrix;\n};\n\n/**\n * Multiplies two mat5's\n *\n * @param out {array} (mat 5x4) the receiving matrix\n * @param a {array} (mat 5x4) the first operand\n * @param b {array} (mat 5x4) the second operand\n * @returns out {array} (mat 5x4)\n */\nColorMatrixFilter.prototype._multiply = function (out, a, b)\n{\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]);\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]);\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]);\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]);\n\n return out;\n};\n\n/**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @param matrix {number[]} (mat 5x4)\n * @return m {number[]} (mat 5x4) with all values between 0-1\n */\nColorMatrixFilter.prototype._colorMatrix = function (matrix)\n{\n // Create a Float32 Array and normalize the offset component to 0-1\n var m = new Float32Array(matrix);\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 * Multiply the current matrix\n * @param b {number} value of the brigthness (0 is black)\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.brightness = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Set the matrices in grey scales\n *\n * Multiply the current matrix\n * @param scale {number} value of the grey (0 is black)\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.greyscale = function (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\n this._loadMatrix(matrix, multiply);\n};\n//Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n\n/**\n * Set the black and white matrice\n * Multiply the current matrix\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.blackAndWhite = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Set the hue property of the color\n *\n * Multiply the current matrix\n * @param rotation {number} in degrees\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.hue = function (rotation, multiply)\n{\n rotation = (rotation || 0) / 180 * Math.PI;\n var cos = Math.cos(rotation),\n sin = Math.sin(rotation);\n\n // luminanceRed, luminanceGreen, luminanceBlue\n var lumR = 0.213, // or 0.3086\n lumG = 0.715, // or 0.6094\n lumB = 0.072; // or 0.0820\n\n var matrix = [\n lumR + cos * (1 - lumR) + sin * (-lumR), lumG + cos * (-lumG) + sin * (-lumG), lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0,\n lumR + cos * (-lumR) + sin * (0.143), lumG + cos * (1 - lumG) + sin * (0.140), lumB + cos * (-lumB) + sin * (-0.283), 0, 0,\n lumR + cos * (-lumR) + sin * (-(1 - lumR)), lumG + cos * (-lumG) + sin * (lumG), lumB + cos * (1 - lumB) + sin * (lumB), 0, 0,\n 0, 0, 0, 1, 0\n ];\n\n this._loadMatrix(matrix, multiply);\n};\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 amount {number} value of the contrast\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.contrast = function (amount, multiply)\n{\n var v = (amount || 0) + 1;\n var o = -128 * (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\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 * @param amount {number}\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.saturate = function (amount, multiply)\n{\n var x = (amount || 0) * 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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.desaturate = function (multiply) // jshint unused:false\n{\n this.saturate(-1);\n};\n\n/**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.negative = function (multiply)\n{\n var matrix = [\n 0, 1, 1, 0, 0,\n 1, 0, 1, 0, 0,\n 1, 1, 0, 0, 0,\n 0, 0, 0, 1, 0\n ];\n\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Sepia image\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.sepia = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.technicolor = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Polaroid filter\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.polaroid = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.toBGR = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.kodachrome = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.browni = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/*\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.vintage = function (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\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 desaturation {number}\n * @param toned {number}\n * @param lightColor {string} (example : \"0xFFE580\")\n * @param darkColor {string} (example : \"0xFFE580\")\n *\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.colorTone = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/*\n * Night effect\n *\n * @param intensity {number}\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.night = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n\n/*\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param amount {number} how much the predator feels his future victim\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.predator = function (amount, multiply)\n{\n var matrix = [\n 11.224130630493164 * amount, -4.794486999511719 * amount, -2.8746118545532227 * amount, 0 * amount, 0.40342438220977783 * amount,\n -3.6330697536468506 * amount, 9.193157196044922 * amount, -2.951810836791992 * amount, 0 * amount, -1.316135048866272 * amount,\n -3.2184197902679443 * amount, -4.2375030517578125 * amount, 7.476448059082031 * amount, 0 * amount, 0.8044459223747253 * amount,\n 0, 0, 0, 1, 0\n ];\n\n this._loadMatrix(matrix, multiply);\n};\n\n/*\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param amount {number} How crazy is your effect\n * @param multiply {boolean} refer to ._loadMatrix() method\n */\nColorMatrixFilter.prototype.lsd = function (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\n this._loadMatrix(matrix, multiply);\n};\n\n/*\n * Reset function\n *\n * Erase the current matrix by setting the default one\n *\n */\nColorMatrixFilter.prototype.reset = function ()\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\n this._loadMatrix(matrix, false);\n};\n\n\nObject.defineProperties(ColorMatrixFilter.prototype, {\n /**\n * Sets the matrix of the color matrix filter\n *\n * @member {number[]}\n * @memberof ColorMatrixFilter#\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n matrix: {\n get: function ()\n {\n return this.uniforms.m.value;\n },\n set: function (value)\n {\n this.uniforms.m.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This lowers the color depth of your image by the given amount, producing an image with a smaller palette.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction ColorStepFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float step;\\n\\nvoid main(void)\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n color = floor(color * step) / step;\\n\\n gl_FragColor = color;\\n}\\n\",\n // custom uniforms\n {\n step: { type: '1f', value: 5 }\n }\n );\n}\n\nColorStepFilter.prototype = Object.create(core.AbstractFilter.prototype);\nColorStepFilter.prototype.constructor = ColorStepFilter;\nmodule.exports = ColorStepFilter;\n\nObject.defineProperties(ColorStepFilter.prototype, {\n /**\n * The number of steps to reduce the palette by.\n *\n * @member {number}\n * @memberof ColorStepFilter#\n */\n step: {\n get: function ()\n {\n return this.uniforms.step.value;\n },\n set: function (value)\n {\n this.uniforms.step.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The ConvolutionFilter class applies a matrix convolution filter effect.\n * A convolution combines pixels in the input image with neighboring pixels to produce a new image.\n * A wide variety of image effects can be achieved through convolutions, including blurring, edge\n * detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array.\n * See http://docs.gimp.org/en/plug-in-convmatrix.html for more info.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n * @param matrix {number[]} An array of values used for matrix transformation. Specified as a 9 point Array.\n * @param width {number} Width of the object you are transforming\n * @param height {number} Height of the object you are transforming\n */\nfunction ConvolutionFilter(matrix, width, height)\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying mediump vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec2 texelSize;\\nuniform float matrix[9];\\n\\nvoid main(void)\\n{\\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\\n\\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\\n\\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\\n\\n gl_FragColor =\\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\\n\\n gl_FragColor.a = c22.a;\\n}\\n\",\n // custom uniforms\n {\n matrix: { type: '1fv', value: new Float32Array(matrix) },\n texelSize: { type: 'v2', value: { x: 1 / width, y: 1 / height } }\n }\n );\n}\n\nConvolutionFilter.prototype = Object.create(core.AbstractFilter.prototype);\nConvolutionFilter.prototype.constructor = ConvolutionFilter;\nmodule.exports = ConvolutionFilter;\n\nObject.defineProperties(ConvolutionFilter.prototype, {\n /**\n * An array of values used for matrix transformation. Specified as a 9 point Array.\n *\n * @member {number[]}\n * @memberof ConvolutionFilter#\n */\n matrix: {\n get: function ()\n {\n return this.uniforms.matrix.value;\n },\n set: function (value)\n {\n this.uniforms.matrix.value = new Float32Array(value);\n }\n },\n\n /**\n * Width of the object you are transforming\n *\n * @member {number}\n * @memberof ConvolutionFilter#\n */\n width: {\n get: function ()\n {\n return 1/this.uniforms.texelSize.value.x;\n },\n set: function (value)\n {\n this.uniforms.texelSize.value.x = 1/value;\n }\n },\n\n /**\n * Height of the object you are transforming\n *\n * @member {number}\n * @memberof ConvolutionFilter#\n */\n height: {\n get: function ()\n {\n return 1/this.uniforms.texelSize.value.y;\n },\n set: function (value)\n {\n this.uniforms.texelSize.value.y = 1/value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * A Cross Hatch effect filter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction CrossHatchFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\\n\\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\\n\\n if (lum < 1.00)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.75)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.50)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.3)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n}\\n\"\n );\n}\n\nCrossHatchFilter.prototype = Object.create(core.AbstractFilter.prototype);\nCrossHatchFilter.prototype.constructor = CrossHatchFilter;\nmodule.exports = CrossHatchFilter;\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object.\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 and the g property of the texture is used to offset the y.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n * @param sprite {Sprite} the sprite used for the displacement map. (make sure its added to the scene!)\n */\nfunction DisplacementFilter(sprite)\n{\n var maskMatrix = new core.math.Matrix();\n sprite.renderable = false;\n\n core.AbstractFilter.call(this,\n // vertex shader\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMapCoord;\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n vMapCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vMapCoord;\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform vec2 scale;\\n\\nuniform sampler2D uSampler;\\nuniform sampler2D mapSampler;\\n\\nvoid main(void)\\n{\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 map = texture2D(mapSampler, vMapCoord);\\n\\n map -= 0.5;\\n map.xy *= scale;\\n\\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));\\n}\\n\",\n // uniforms\n {\n mapSampler: { type: 'sampler2D', value: sprite.texture },\n otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) },\n scale: { type: 'v2', value: { x: 1, y: 1 } }\n }\n );\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n\n this.scale = new core.math.Point(20,20);\n\n}\n\nDisplacementFilter.prototype = Object.create(core.AbstractFilter.prototype);\nDisplacementFilter.prototype.constructor = DisplacementFilter;\nmodule.exports = DisplacementFilter;\n\nDisplacementFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var filterManager = renderer.filterManager;\n\n filterManager.calculateMappedMatrix(input.frame, this.maskSprite, this.maskMatrix);\n\n this.uniforms.otherMatrix.value = this.maskMatrix.toArray(true);\n this.uniforms.scale.value.x = this.scale.x * (1/input.frame.width);\n this.uniforms.scale.value.y = this.scale.y * (1/input.frame.height);\n\n var shader = this.getShader(renderer);\n // draw the filter...\n filterManager.applyFilter(shader, input, output);\n};\n\n\nObject.defineProperties(DisplacementFilter.prototype, {\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {Texture}\n * @memberof DisplacementFilter#\n */\n map: {\n get: function ()\n {\n return this.uniforms.mapSampler.value;\n },\n set: function (value)\n {\n this.uniforms.mapSampler.value = value;\n\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * @author Mat Groves http://matgroves.com/ @Doormat23\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js\n */\n\n/**\n * This filter applies a dotscreen effect making display objects appear to be made out of\n * black and white halftone dots like an old printer.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction DotScreenFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform vec4 dimensions;\\nuniform sampler2D uSampler;\\n\\nuniform float angle;\\nuniform float scale;\\n\\nfloat pattern()\\n{\\n float s = sin(angle), c = cos(angle);\\n vec2 tex = vTextureCoord * dimensions.xy;\\n vec2 point = vec2(\\n c * tex.x - s * tex.y,\\n s * tex.x + c * tex.y\\n ) * scale;\\n return (sin(point.x) * sin(point.y)) * 4.0;\\n}\\n\\nvoid main()\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float average = (color.r + color.g + color.b) / 3.0;\\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\\n}\\n\",\n // custom uniforms\n {\n scale: { type: '1f', value: 1 },\n angle: { type: '1f', value: 5 },\n dimensions: { type: '4fv', value: [0, 0, 0, 0] }\n }\n );\n}\n\nDotScreenFilter.prototype = Object.create(core.AbstractFilter.prototype);\nDotScreenFilter.prototype.constructor = DotScreenFilter;\nmodule.exports = DotScreenFilter;\n\nObject.defineProperties(DotScreenFilter.prototype, {\n /**\n * The scale of the effect.\n * @member {number}\n * @memberof DotScreenFilter#\n */\n scale: {\n get: function ()\n {\n return this.uniforms.scale.value;\n },\n set: function (value)\n {\n this.uniforms.scale.value = value;\n }\n },\n\n /**\n * The radius of the effect.\n * @member {number}\n * @memberof DotScreenFilter#\n */\n angle: {\n get: function ()\n {\n return this.uniforms.angle.value;\n },\n set: function (value)\n {\n this.uniforms.angle.value = value;\n }\n }\n});\n","var core = require('../../core');\n\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The BlurYTintFilter applies a vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction BlurYTintFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\n\\nuniform float strength;\\nuniform vec2 offset;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying vec2 vBlurTexCoords[6];\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition+offset), 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n\\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\\n\\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\\n}\\n\",\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec2 vBlurTexCoords[6];\\nvarying vec4 vColor;\\n\\nuniform vec3 color;\\nuniform float alpha;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n vec4 sum = vec4(0.0);\\n\\n sum += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\\n sum += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\\n sum += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\\n sum += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\\n sum += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\\n sum += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\\n sum += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\\n\\n gl_FragColor = vec4( color.rgb * sum.a * alpha, sum.a * alpha );\\n}\\n\",\n // set the uniforms\n {\n blur: { type: '1f', value: 1 / 512 },\n color: { type: 'c', value: [0,0,0]},\n alpha: { type: '1f', value: 0.7 },\n offset: { type: '2f', value:[5, 5]},\n strength: { type: '1f', value:1}\n }\n );\n\n this.passes = 1;\n this.strength = 4;\n}\n\nBlurYTintFilter.prototype = Object.create(core.AbstractFilter.prototype);\nBlurYTintFilter.prototype.constructor = BlurYTintFilter;\nmodule.exports = BlurYTintFilter;\n\nBlurYTintFilter.prototype.applyFilter = function (renderer, input, output, clear)\n{\n var shader = this.getShader(renderer);\n\n this.uniforms.strength.value = this.strength / 4 / this.passes * (input.frame.height / input.size.height);\n\n if(this.passes === 1)\n {\n renderer.filterManager.applyFilter(shader, input, output, clear);\n }\n else\n {\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n var flip = input;\n var flop = renderTarget;\n\n for(var i = 0; i < this.passes-1; i++)\n {\n renderer.filterManager.applyFilter(shader, flip, flop, clear);\n\n var temp = flop;\n flop = flip;\n flip = temp;\n }\n\n renderer.filterManager.applyFilter(shader, flip, output, clear);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n }\n};\n\n\nObject.defineProperties(BlurYTintFilter.prototype, {\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @memberof BlurYFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.strength;\n },\n set: function (value)\n {\n this.padding = value * 0.5;\n this.strength = value;\n }\n }\n});\n","var core = require('../../core'),\n BlurXFilter = require('../blur/BlurXFilter'),\n BlurYTintFilter = require('./BlurYTintFilter');\n\n/**\n * The DropShadowFilter applies a Gaussian blur to an object.\n * The strength of the blur can be set for x- and y-axis separately.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction DropShadowFilter()\n{\n core.AbstractFilter.call(this);\n\n this.blurXFilter = new BlurXFilter();\n this.blurYTintFilter = new BlurYTintFilter();\n\n this.defaultFilter = new core.AbstractFilter();\n\n this.padding = 30;\n\n this._dirtyPosition = true;\n this._angle = 45 * Math.PI / 180;\n this._distance = 10;\n this.alpha = 0.75;\n this.hideObject = false;\n this.blendMode = core.BLEND_MODES.MULTIPLY;\n}\n\nDropShadowFilter.prototype = Object.create(core.AbstractFilter.prototype);\nDropShadowFilter.prototype.constructor = DropShadowFilter;\nmodule.exports = DropShadowFilter;\n\nDropShadowFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n\n //TODO - copyTexSubImage2D could be used here?\n if(this._dirtyPosition)\n {\n this._dirtyPosition = false;\n\n this.blurYTintFilter.uniforms.offset.value[0] = Math.sin(this._angle) * this._distance;\n this.blurYTintFilter.uniforms.offset.value[1] = Math.cos(this._angle) * this._distance;\n }\n\n this.blurXFilter.applyFilter(renderer, input, renderTarget);\n\n renderer.blendModeManager.setBlendMode(this.blendMode);\n\n this.blurYTintFilter.applyFilter(renderer, renderTarget, output);\n\n renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL);\n\n if(!this.hideObject)\n {\n\n this.defaultFilter.applyFilter(renderer, input, output);\n }\n\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n};\n\nObject.defineProperties(DropShadowFilter.prototype, {\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @memberOf DropShadowFilter#\n * @default 2\n */\n blur: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.blurXFilter.blur = this.blurYTintFilter.blur = value;\n }\n },\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @memberOf DropShadowFilter#\n * @default 2\n */\n blurX: {\n get: function ()\n {\n return this.blurXFilter.blur;\n },\n set: function (value)\n {\n this.blurXFilter.blur = value;\n }\n },\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @memberOf DropShadowFilter#\n * @default 2\n */\n blurY: {\n get: function ()\n {\n return this.blurYTintFilter.blur;\n },\n set: function (value)\n {\n this.blurYTintFilter.blur = value;\n }\n },\n\n color: {\n get: function ()\n {\n return core.utils.rgb2hex( this.blurYTintFilter.uniforms.color.value );\n },\n set: function (value)\n {\n this.blurYTintFilter.uniforms.color.value = core.utils.hex2rgb(value);\n }\n },\n\n alpha: {\n get: function ()\n {\n return this.blurYTintFilter.uniforms.alpha.value;\n },\n set: function (value)\n {\n this.blurYTintFilter.uniforms.alpha.value = value;\n }\n },\n\n distance: {\n get: function ()\n {\n return this._distance;\n },\n set: function (value)\n {\n this._dirtyPosition = true;\n this._distance = value;\n }\n },\n\n angle: {\n get: function ()\n {\n return this._angle;\n },\n set: function (value)\n {\n this._dirtyPosition = true;\n this._angle = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This greyscales the palette of your Display Objects.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction GrayFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform sampler2D uSampler;\\nuniform float gray;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);\\n}\\n\",\n // set the uniforms\n {\n gray: { type: '1f', value: 1 }\n }\n );\n}\n\nGrayFilter.prototype = Object.create(core.AbstractFilter.prototype);\nGrayFilter.prototype.constructor = GrayFilter;\nmodule.exports = GrayFilter;\n\nObject.defineProperties(GrayFilter.prototype, {\n /**\n * The strength of the gray. 1 will make the object black and white, 0 will make the object its normal color.\n *\n * @member {number}\n * @memberof GrayFilter#\n */\n gray: {\n get: function ()\n {\n return this.uniforms.gray.value;\n },\n set: function (value)\n {\n this.uniforms.gray.value = value;\n }\n }\n});\n","/**\n * @file Main export of the PIXI filters library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.filters\n */\nmodule.exports = {\n // expose some internal filters...\n AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'),\n FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'),\n SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'),\n // add the rest!\n AsciiFilter: require('./ascii/AsciiFilter'),\n BloomFilter: require('./bloom/BloomFilter'),\n BlurFilter: require('./blur/BlurFilter'),\n BlurXFilter: require('./blur/BlurXFilter'),\n BlurYFilter: require('./blur/BlurYFilter'),\n BlurDirFilter: require('./blur/BlurDirFilter'),\n ColorMatrixFilter: require('./color/ColorMatrixFilter'),\n ColorStepFilter: require('./color/ColorStepFilter'),\n ConvolutionFilter: require('./convolution/ConvolutionFilter'),\n CrossHatchFilter: require('./crosshatch/CrossHatchFilter'),\n DisplacementFilter: require('./displacement/DisplacementFilter'),\n DotScreenFilter: require('./dot/DotScreenFilter'),\n GrayFilter: require('./gray/GrayFilter'),\n DropShadowFilter: require('./dropshadow/DropShadowFilter'),\n InvertFilter: require('./invert/InvertFilter'),\n NoiseFilter: require('./noise/NoiseFilter'),\n NormalMapFilter: require('./normal/NormalMapFilter'),\n PixelateFilter: require('./pixelate/PixelateFilter'),\n RGBSplitFilter: require('./rgb/RGBSplitFilter'),\n ShockwaveFilter: require('./shockwave/ShockwaveFilter'),\n SepiaFilter: require('./sepia/SepiaFilter'),\n SmartBlurFilter: require('./blur/SmartBlurFilter'),\n TiltShiftFilter: require('./tiltshift/TiltShiftFilter'),\n TiltShiftXFilter: require('./tiltshift/TiltShiftXFilter'),\n TiltShiftYFilter: require('./tiltshift/TiltShiftYFilter'),\n TwistFilter: require('./twist/TwistFilter')\n};\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This inverts your Display Objects colors.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction InvertFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform float invert;\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n\\n gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);\\n}\\n\",\n // custom uniforms\n {\n invert: { type: '1f', value: 1 }\n }\n );\n}\n\nInvertFilter.prototype = Object.create(core.AbstractFilter.prototype);\nInvertFilter.prototype.constructor = InvertFilter;\nmodule.exports = InvertFilter;\n\nObject.defineProperties(InvertFilter.prototype, {\n /**\n * The strength of the invert. `1` will fully invert the colors, and\n * `0` will make the object its normal color.\n *\n * @member {number}\n * @memberof InvertFilter#\n */\n invert: {\n get: function ()\n {\n return this.uniforms.invert.value;\n },\n set: function (value)\n {\n this.uniforms.invert.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\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.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction NoiseFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform float noise;\\nuniform sampler2D uSampler;\\n\\nfloat rand(vec2 co)\\n{\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main()\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n float diff = (rand(vTextureCoord) - 0.5) * noise;\\n\\n color.r += diff;\\n color.g += diff;\\n color.b += diff;\\n\\n gl_FragColor = color;\\n}\\n\",\n // custom uniforms\n {\n noise: { type: '1f', value: 0.5 }\n }\n );\n}\n\nNoiseFilter.prototype = Object.create(core.AbstractFilter.prototype);\nNoiseFilter.prototype.constructor = NoiseFilter;\nmodule.exports = NoiseFilter;\n\nObject.defineProperties(NoiseFilter.prototype, {\n /**\n * The amount of noise to apply.\n *\n * @member {number}\n * @memberof NoiseFilter#\n * @default 0.5\n */\n noise: {\n get: function ()\n {\n return this.uniforms.noise.value;\n },\n set: function (value)\n {\n this.uniforms.noise.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The NormalMapFilter class uses the pixel values from the specified texture (called the normal map)\n * to project lighting onto an object.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n * @param texture {Texture} The texture used for the normal map, must be power of 2 texture at the moment\n */\nfunction NormalMapFilter(texture)\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform sampler2D displacementMap;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 dimensions;\\n\\nconst vec2 Resolution = vec2(1.0,1.0); //resolution of screen\\nuniform vec3 LightPos; //light position, normalized\\nconst vec4 LightColor = vec4(1.0, 1.0, 1.0, 1.0); //light RGBA -- alpha is intensity\\nconst vec4 AmbientColor = vec4(1.0, 1.0, 1.0, 0.5); //ambient RGBA -- alpha is intensity\\nconst vec3 Falloff = vec3(0.0, 1.0, 0.2); //attenuation coefficients\\n\\nuniform vec3 LightDir; // = vec3(1.0, 0.0, 1.0);\\n\\nuniform vec2 mapDimensions; // = vec2(256.0, 256.0);\\n\\n\\nvoid main(void)\\n{\\n vec2 mapCords = vTextureCoord.xy;\\n\\n vec4 color = texture2D(uSampler, vTextureCoord.st);\\n vec3 nColor = texture2D(displacementMap, vTextureCoord.st).rgb;\\n\\n\\n mapCords *= vec2(dimensions.x/512.0, dimensions.y/512.0);\\n\\n mapCords.y *= -1.0;\\n mapCords.y += 1.0;\\n\\n // RGBA of our diffuse color\\n vec4 DiffuseColor = texture2D(uSampler, vTextureCoord);\\n\\n // RGB of our normal map\\n vec3 NormalMap = texture2D(displacementMap, mapCords).rgb;\\n\\n // The delta position of light\\n // vec3 LightDir = vec3(LightPos.xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);\\n vec3 LightDir = vec3(LightPos.xy - (mapCords.xy), LightPos.z);\\n\\n // Correct for aspect ratio\\n // LightDir.x *= Resolution.x / Resolution.y;\\n\\n // Determine distance (used for attenuation) BEFORE we normalize our LightDir\\n float D = length(LightDir);\\n\\n // normalize our vectors\\n vec3 N = normalize(NormalMap * 2.0 - 1.0);\\n vec3 L = normalize(LightDir);\\n\\n // Pre-multiply light color with intensity\\n // Then perform 'N dot L' to determine our diffuse term\\n vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);\\n\\n // pre-multiply ambient color with intensity\\n vec3 Ambient = AmbientColor.rgb * AmbientColor.a;\\n\\n // calculate attenuation\\n float Attenuation = 1.0 / ( Falloff.x + (Falloff.y*D) + (Falloff.z*D*D) );\\n\\n // the calculation which brings it all together\\n vec3 Intensity = Ambient + Diffuse * Attenuation;\\n vec3 FinalColor = DiffuseColor.rgb * Intensity;\\n gl_FragColor = vColor * vec4(FinalColor, DiffuseColor.a);\\n\\n // gl_FragColor = vec4(1.0, 0.0, 0.0, Attenuation); // vColor * vec4(FinalColor, DiffuseColor.a);\\n\\n/*\\n // normalise color\\n vec3 normal = normalize(nColor * 2.0 - 1.0);\\n\\n vec3 deltaPos = vec3( (light.xy - gl_FragCoord.xy) / resolution.xy, light.z );\\n\\n float lambert = clamp(dot(normal, lightDir), 0.0, 1.0);\\n\\n float d = sqrt(dot(deltaPos, deltaPos));\\n float att = 1.0 / ( attenuation.x + (attenuation.y*d) + (attenuation.z*d*d) );\\n\\n vec3 result = (ambientColor * ambientIntensity) + (lightColor.rgb * lambert) * att;\\n result *= color.rgb;\\n\\n gl_FragColor = vec4(result, 1.0);\\n*/\\n}\\n\",\n // custom uniforms\n {\n displacementMap: { type: 'sampler2D', value: texture },\n scale: { type: '2f', value: { x: 15, y: 15 } },\n offset: { type: '2f', value: { x: 0, y: 0 } },\n mapDimensions: { type: '2f', value: { x: 1, y: 1 } },\n dimensions: { type: '4f', value: [0, 0, 0, 0] },\n // LightDir: { type: 'f3', value: [0, 1, 0] },\n LightPos: { type: '3f', value: [0, 1, 0] }\n }\n );\n\n texture.baseTexture._powerOf2 = true;\n\n if (texture.baseTexture.hasLoaded)\n {\n this.onTextureLoaded();\n }\n else\n {\n texture.baseTexture.once('loaded', this.onTextureLoaded, this);\n }\n}\n\nNormalMapFilter.prototype = Object.create(core.AbstractFilter.prototype);\nNormalMapFilter.prototype.constructor = NormalMapFilter;\nmodule.exports = NormalMapFilter;\n\n/**\n * Sets the map dimensions uniforms when the texture becomes available.\n *\n * @private\n */\nNormalMapFilter.prototype.onTextureLoaded = function ()\n{\n this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width;\n this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height;\n};\n\nObject.defineProperties(NormalMapFilter.prototype, {\n /**\n * The texture used for the displacement map. Must be power of 2 texture.\n *\n * @member {Texture}\n * @memberof NormalMapFilter#\n */\n map: {\n get: function ()\n {\n return this.uniforms.displacementMap.value;\n },\n set: function (value)\n {\n this.uniforms.displacementMap.value = value;\n }\n },\n\n /**\n * The multiplier used to scale the displacement result from the map calculation.\n *\n * @member {Point}\n * @memberof NormalMapFilter#\n */\n scale: {\n get: function ()\n {\n return this.uniforms.scale.value;\n },\n set: function (value)\n {\n this.uniforms.scale.value = value;\n }\n },\n\n /**\n * The offset used to move the displacement map.\n *\n * @member {Point}\n * @memberof NormalMapFilter#\n */\n offset: {\n get: function ()\n {\n return this.uniforms.offset.value;\n },\n set: function (value)\n {\n this.uniforms.offset.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This filter applies a pixelate effect making display objects appear 'blocky'.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction PixelateFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 dimensions;\\nuniform vec2 pixelSize;\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n vec2 coord = vTextureCoord;\\n\\n vec2 size = dimensions.xy / pixelSize;\\n\\n vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;\\n\\n gl_FragColor = texture2D(uSampler, color);\\n}\\n\",\n // custom uniforms\n {\n dimensions: { type: '4fv', value: new Float32Array([0, 0, 0, 0]) },\n pixelSize: { type: 'v2', value: { x: 10, y: 10 } }\n }\n );\n}\n\nPixelateFilter.prototype = Object.create(core.AbstractFilter.prototype);\nPixelateFilter.prototype.constructor = PixelateFilter;\nmodule.exports = PixelateFilter;\n\nObject.defineProperties(PixelateFilter.prototype, {\n /**\n * This a point that describes the size of the blocks.\n * x is the width of the block and y is the height.\n *\n * @member {Point}\n * @memberof PixelateFilter#\n */\n size: {\n get: function ()\n {\n return this.uniforms.pixelSize.value;\n },\n set: function (value)\n {\n this.uniforms.pixelSize.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * An RGB Split Filter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction RGBSplitFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec4 dimensions;\\nuniform vec2 red;\\nuniform vec2 green;\\nuniform vec2 blue;\\n\\nvoid main(void)\\n{\\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;\\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;\\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;\\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\\n}\\n\",\n // custom uniforms\n {\n red: { type: 'v2', value: { x: 20, y: 20 } },\n green: { type: 'v2', value: { x: -20, y: 20 } },\n blue: { type: 'v2', value: { x: 20, y: -20 } },\n dimensions: { type: '4fv', value: [0, 0, 0, 0] }\n }\n );\n}\n\nRGBSplitFilter.prototype = Object.create(core.AbstractFilter.prototype);\nRGBSplitFilter.prototype.constructor = RGBSplitFilter;\nmodule.exports = RGBSplitFilter;\n\nObject.defineProperties(RGBSplitFilter.prototype, {\n /**\n * Red channel offset.\n *\n * @member {Point}\n * @memberof RGBSplitFilter#\n */\n red: {\n get: function ()\n {\n return this.uniforms.red.value;\n },\n set: function (value)\n {\n this.uniforms.red.value = value;\n }\n },\n\n /**\n * Green channel offset.\n *\n * @member {Point}\n * @memberof RGBSplitFilter#\n */\n green: {\n get: function ()\n {\n return this.uniforms.green.value;\n },\n set: function (value)\n {\n this.uniforms.green.value = value;\n }\n },\n\n /**\n * Blue offset.\n *\n * @member {Point}\n * @memberof RGBSplitFilter#\n */\n blue: {\n get: function ()\n {\n return this.uniforms.blue.value;\n },\n set: function (value)\n {\n this.uniforms.blue.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This applies a sepia effect to your Display Objects.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction SepiaFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float sepia;\\n\\nconst mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);\\n}\\n\",\n // custom uniforms\n {\n sepia: { type: '1f', value: 1 }\n }\n );\n}\n\nSepiaFilter.prototype = Object.create(core.AbstractFilter.prototype);\nSepiaFilter.prototype.constructor = SepiaFilter;\nmodule.exports = SepiaFilter;\n\nObject.defineProperties(SepiaFilter.prototype, {\n /**\n * The strength of the sepia. `1` will apply the full sepia effect, and\n * `0` will make the object its normal color.\n *\n * @member {number}\n * @memberof SepiaFilter#\n */\n sepia: {\n get: function ()\n {\n return this.uniforms.sepia.value;\n },\n set: function (value)\n {\n this.uniforms.sepia.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * The ColorMatrixFilter class lets you apply a 4x4 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 * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction ShockwaveFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision lowp float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nuniform vec2 center;\\nuniform vec3 params; // 10.0, 0.8, 0.1\\nuniform float time;\\n\\nvoid main()\\n{\\n vec2 uv = vTextureCoord;\\n vec2 texCoord = uv;\\n\\n float dist = distance(uv, center);\\n\\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\\n {\\n float diff = (dist - time);\\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\\n\\n float diffTime = diff * powDiff;\\n vec2 diffUV = normalize(uv - center);\\n texCoord = uv + (diffUV * diffTime);\\n }\\n\\n gl_FragColor = texture2D(uSampler, texCoord);\\n}\\n\",\n // custom uniforms\n {\n center: { type: 'v2', value: { x: 0.5, y: 0.5 } },\n params: { type: 'v3', value: { x: 10, y: 0.8, z: 0.1 } },\n time: { type: '1f', value: 0 }\n }\n );\n}\n\nShockwaveFilter.prototype = Object.create(core.AbstractFilter.prototype);\nShockwaveFilter.prototype.constructor = ShockwaveFilter;\nmodule.exports = ShockwaveFilter;\n\nObject.defineProperties(ShockwaveFilter.prototype, {\n /**\n * Sets the center of the shockwave in normalized screen coords. That is\n * (0,0) is the top-left and (1,1) is the bottom right.\n *\n * @member {object<string, number>}\n * @memberof ShockwaveFilter#\n */\n center: {\n get: function ()\n {\n return this.uniforms.center.value;\n },\n set: function (value)\n {\n this.uniforms.center.value = value;\n }\n },\n /**\n * Sets the params of the shockwave. These modify the look and behavior of\n * the shockwave as it ripples out.\n *\n * @member {object<string, number>}\n * @memberof ShockwaveFilter#\n */\n params: {\n get: function ()\n {\n return this.uniforms.params.value;\n },\n set: function (value)\n {\n this.uniforms.params.value = value;\n }\n },\n /**\n * Sets the elapsed time of the shockwave. This controls the speed at which\n * the shockwave ripples out.\n *\n * @member {number}\n * @memberof ShockwaveFilter#\n */\n time: {\n get: function ()\n {\n return this.uniforms.time.value;\n },\n set: function (value)\n {\n this.uniforms.time.value = value;\n }\n }\n});\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * @author Vico @vicocotea\n * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/\n */\n\n/**\n * A TiltShiftAxisFilter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction TiltShiftAxisFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float blur;\\nuniform float gradientBlur;\\nuniform vec2 start;\\nuniform vec2 end;\\nuniform vec2 delta;\\nuniform vec2 texSize;\\n\\nfloat random(vec3 scale, float seed)\\n{\\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\\n}\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n float total = 0.0;\\n\\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\\n\\n for (float t = -30.0; t <= 30.0; t++)\\n {\\n float percent = (t + offset - 0.5) / 30.0;\\n float weight = 1.0 - abs(percent);\\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\\n sample.rgb *= sample.a;\\n color += sample * weight;\\n total += weight;\\n }\\n\\n gl_FragColor = color / total;\\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\\n}\\n\",\n // custom uniforms\n {\n blur: { type: '1f', value: 100 },\n gradientBlur: { type: '1f', value: 600 },\n start: { type: 'v2', value: { x: 0, y: window.innerHeight / 2 } },\n end: { type: 'v2', value: { x: 600, y: window.innerHeight / 2 } },\n delta: { type: 'v2', value: { x: 30, y: 30 } },\n texSize: { type: 'v2', value: { x: window.innerWidth, y: window.innerHeight } }\n }\n );\n\n this.updateDelta();\n}\n\nTiltShiftAxisFilter.prototype = Object.create(core.AbstractFilter.prototype);\nTiltShiftAxisFilter.prototype.constructor = TiltShiftAxisFilter;\nmodule.exports = TiltShiftAxisFilter;\n\n/**\n * Updates the filter delta values.\n * This is overridden in the X and Y filters, does nothing for this class.\n *\n */\nTiltShiftAxisFilter.prototype.updateDelta = function ()\n{\n this.uniforms.delta.value.x = 0;\n this.uniforms.delta.value.y = 0;\n};\n\nObject.defineProperties(TiltShiftAxisFilter.prototype, {\n /**\n * The strength of the blur.\n *\n * @member {number}\n * @memberof TiltShiftAxisFilter#\n */\n blur: {\n get: function ()\n {\n return this.uniforms.blur.value;\n },\n set: function (value)\n {\n this.uniforms.blur.value = value;\n }\n },\n\n /**\n * The strength of the gradient blur.\n *\n * @member {number}\n * @memberof TiltShiftAxisFilter#\n */\n gradientBlur: {\n get: function ()\n {\n return this.uniforms.gradientBlur.value;\n },\n set: function (value)\n {\n this.uniforms.gradientBlur.value = value;\n }\n },\n\n /**\n * The X value to start the effect at.\n *\n * @member {Point}\n * @memberof TiltShiftAxisFilter#\n */\n start: {\n get: function ()\n {\n return this.uniforms.start.value;\n },\n set: function (value)\n {\n this.uniforms.start.value = value;\n this.updateDelta();\n }\n },\n\n /**\n * The X value to end the effect at.\n *\n * @member {Point}\n * @memberof TiltShiftAxisFilter#\n */\n end: {\n get: function ()\n {\n return this.uniforms.end.value;\n },\n set: function (value)\n {\n this.uniforms.end.value = value;\n this.updateDelta();\n }\n }\n});\n","var core = require('../../core'),\n TiltShiftXFilter = require('./TiltShiftXFilter'),\n TiltShiftYFilter = require('./TiltShiftYFilter');\n\n/**\n * @author Vico @vicocotea\n * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/\n */\n\n/**\n * A TiltShift Filter. Manages the pass of both a TiltShiftXFilter and TiltShiftYFilter.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction TiltShiftFilter()\n{\n core.AbstractFilter.call(this);\n\n this.tiltShiftXFilter = new TiltShiftXFilter();\n this.tiltShiftYFilter = new TiltShiftYFilter();\n}\n\nTiltShiftFilter.prototype = Object.create(core.AbstractFilter.prototype);\nTiltShiftFilter.prototype.constructor = TiltShiftFilter;\nmodule.exports = TiltShiftFilter;\n\nTiltShiftFilter.prototype.applyFilter = function (renderer, input, output)\n{\n var renderTarget = renderer.filterManager.getRenderTarget(true);\n\n this.tiltShiftXFilter.applyFilter(renderer, input, renderTarget);\n\n this.tiltShiftYFilter.applyFilter(renderer, renderTarget, output);\n\n renderer.filterManager.returnRenderTarget(renderTarget);\n};\n\nObject.defineProperties(TiltShiftFilter.prototype, {\n /**\n * The strength of the blur.\n *\n * @member {number}\n * @memberof TiltShiftFilter#\n */\n blur: {\n get: function ()\n {\n return this.tiltShiftXFilter.blur;\n },\n set: function (value)\n {\n this.tiltShiftXFilter.blur = this.tiltShiftYFilter.blur = value;\n }\n },\n\n /**\n * The strength of the gradient blur.\n *\n * @member {number}\n * @memberof TiltShiftFilter#\n */\n gradientBlur: {\n get: function ()\n {\n return this.tiltShiftXFilter.gradientBlur;\n },\n set: function (value)\n {\n this.tiltShiftXFilter.gradientBlur = this.tiltShiftYFilter.gradientBlur = value;\n }\n },\n\n /**\n * The Y value to start the effect at.\n *\n * @member {number}\n * @memberof TiltShiftFilter#\n */\n start: {\n get: function ()\n {\n return this.tiltShiftXFilter.start;\n },\n set: function (value)\n {\n this.tiltShiftXFilter.start = this.tiltShiftYFilter.start = value;\n }\n },\n\n /**\n * The Y value to end the effect at.\n *\n * @member {number}\n * @memberof TiltShiftFilter#\n */\n end: {\n get: function ()\n {\n return this.tiltShiftXFilter.end;\n },\n set: function (value)\n {\n this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = value;\n }\n }\n});\n","var TiltShiftAxisFilter = require('./TiltShiftAxisFilter');\n\n/**\n * @author Vico @vicocotea\n * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/\n */\n\n/**\n * A TiltShiftXFilter.\n *\n * @class\n * @extends PIXI.TiltShiftAxisFilter\n * @memberof PIXI.filters\n */\nfunction TiltShiftXFilter()\n{\n TiltShiftAxisFilter.call(this);\n}\n\nTiltShiftXFilter.prototype = Object.create(TiltShiftAxisFilter.prototype);\nTiltShiftXFilter.prototype.constructor = TiltShiftXFilter;\nmodule.exports = TiltShiftXFilter;\n\n/**\n * Updates the filter delta values.\n *\n */\nTiltShiftXFilter.prototype.updateDelta = function ()\n{\n var dx = this.uniforms.end.value.x - this.uniforms.start.value.x;\n var dy = this.uniforms.end.value.y - this.uniforms.start.value.y;\n var d = Math.sqrt(dx * dx + dy * dy);\n\n this.uniforms.delta.value.x = dx / d;\n this.uniforms.delta.value.y = dy / d;\n};\n","var TiltShiftAxisFilter = require('./TiltShiftAxisFilter');\n\n/**\n * @author Vico @vicocotea\n * original filter https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js by Evan Wallace : http://madebyevan.com/\n */\n\n/**\n * A TiltShiftYFilter.\n *\n * @class\n * @extends PIXI.TiltShiftAxisFilter\n * @memberof PIXI.filters\n */\nfunction TiltShiftYFilter()\n{\n TiltShiftAxisFilter.call(this);\n}\n\nTiltShiftYFilter.prototype = Object.create(TiltShiftAxisFilter.prototype);\nTiltShiftYFilter.prototype.constructor = TiltShiftYFilter;\nmodule.exports = TiltShiftYFilter;\n\n/**\n * Updates the filter delta values.\n *\n */\nTiltShiftYFilter.prototype.updateDelta = function ()\n{\n var dx = this.uniforms.end.value.x - this.uniforms.start.value.x;\n var dy = this.uniforms.end.value.y - this.uniforms.start.value.y;\n var d = Math.sqrt(dx * dx + dy * dy);\n\n this.uniforms.delta.value.x = -dy / d;\n this.uniforms.delta.value.y = dx / d;\n};\n","var core = require('../../core');\n// @see https://github.com/substack/brfs/issues/25\n\n\n/**\n * This filter applies a twist effect making display objects appear twisted in the given direction.\n *\n * @class\n * @extends PIXI.AbstractFilter\n * @memberof PIXI.filters\n */\nfunction TwistFilter()\n{\n core.AbstractFilter.call(this,\n // vertex shader\n null,\n // fragment shader\n \"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float radius;\\nuniform float angle;\\nuniform vec2 offset;\\n\\nvoid main(void)\\n{\\n vec2 coord = vTextureCoord - offset;\\n float dist = length(coord);\\n\\n if (dist < radius)\\n {\\n float ratio = (radius - dist) / radius;\\n float angleMod = ratio * ratio * angle;\\n float s = sin(angleMod);\\n float c = cos(angleMod);\\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\\n }\\n\\n gl_FragColor = texture2D(uSampler, coord+offset);\\n}\\n\",\n // custom uniforms\n {\n radius: { type: '1f', value: 0.5 },\n angle: { type: '1f', value: 5 },\n offset: { type: 'v2', value: { x: 0.5, y: 0.5 } }\n }\n );\n}\n\nTwistFilter.prototype = Object.create(core.AbstractFilter.prototype);\nTwistFilter.prototype.constructor = TwistFilter;\nmodule.exports = TwistFilter;\n\nObject.defineProperties(TwistFilter.prototype, {\n /**\n * This point describes the the offset of the twist.\n *\n * @member {Point}\n * @memberof TwistFilter#\n */\n offset: {\n get: function ()\n {\n return this.uniforms.offset.value;\n },\n set: function (value)\n {\n this.uniforms.offset.value = value;\n }\n },\n\n /**\n * This radius of the twist.\n *\n * @member {number}\n * @memberof TwistFilter#\n */\n radius: {\n get: function ()\n {\n return this.uniforms.radius.value;\n },\n set: function (value)\n {\n this.uniforms.radius.value = value;\n }\n },\n\n /**\n * This angle of the twist.\n *\n * @member {number}\n * @memberof TwistFilter#\n */\n angle: {\n get: function ()\n {\n return this.uniforms.angle.value;\n },\n set: function (value)\n {\n this.uniforms.angle.value = value;\n }\n }\n});\n","var core = require('../core');\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI.interaction\n */\nfunction InteractionData()\n{\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {Point}\n */\n this.global = new core.Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {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 * @member {Event}\n */\n this.originalEvent = null;\n}\n\nInteractionData.prototype.constructor = InteractionData;\nmodule.exports = InteractionData;\n\n/**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param displayObject {DisplayObject} The DisplayObject that you would like the local coords off\n * @param [point] {Point} A Point object in which to store the value, optional (otherwise will create a new point)\n * param [globalPos] {Point} A Point object containing your custom global coords, optional (otherwise will use the current global coords)\n * @return {Point} A point containing the coordinates of the InteractionData position relative to the DisplayObject\n */\nInteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos)\n{\n var worldTransform = displayObject.worldTransform;\n var global = globalPos ? globalPos : this.global;\n\n // do a cheeky transform to get the mouse coords;\n var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx,\n a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty,\n id = 1 / (a00 * a11 + a01 * -a10);\n\n point = point || new core.math.Point();\n\n point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id;\n point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id;\n\n // set the mouse coords...\n return point;\n};\n","var core = require('../core'),\n InteractionData = require('./InteractionData');\n\n// Mix interactiveTarget into core.DisplayObject.prototype\nObject.assign(\n core.DisplayObject.prototype,\n require('./interactiveTarget')\n);\n\n/**\n * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive\n * if its interactive parameter is set to true\n * This manager also supports multitouch.\n *\n * @class\n * @memberof PIXI.interaction\n * @param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer\n * @param [options] {object}\n * @param [options.autoPreventDefault=true] {boolean} Should the manager automatically prevent default browser actions.\n * @param [options.interactionFrequency=10] {number} Frequency increases the interaction events will be checked.\n */\nfunction InteractionManager(renderer, options)\n{\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {SystemRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * As this frequency increases the interaction events will be checked more often.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {InteractionData}\n */\n this.mouse = new InteractionData();\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {EventData}\n */\n this.eventData = {\n stopped: false,\n target: null,\n type: null,\n data: this.mouse,\n stopPropagation:function(){\n this.stopped = true;\n }\n };\n\n /**\n * Tiny little interactiveData pool !\n *\n * @member {Array}\n */\n this.interactiveDataPool = [];\n\n /**\n * The DOM element to bind to.\n *\n * @member {HTMLElement}\n * @private\n */\n this.interactionDOMElement = null;\n\n /**\n * Have events been attached to the dom element?\n *\n * @member {boolean}\n * @private\n */\n this.eventsAdded = false;\n\n //this will make it so that you don't have to call bind all the time\n\n /**\n * @member {Function}\n */\n this.onMouseUp = this.onMouseUp.bind(this);\n this.processMouseUp = this.processMouseUp.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onMouseDown = this.onMouseDown.bind(this);\n this.processMouseDown = this.processMouseDown.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseMove = this.onMouseMove.bind( this );\n this.processMouseMove = this.processMouseMove.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseOut = this.onMouseOut.bind(this);\n this.processMouseOverOut = this.processMouseOverOut.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onTouchStart = this.onTouchStart.bind(this);\n this.processTouchStart = this.processTouchStart.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.processTouchEnd = this.processTouchEnd.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchMove = this.onTouchMove.bind(this);\n this.processTouchMove = this.processTouchMove.bind(this);\n\n /**\n * @member {number}\n */\n this.last = 0;\n\n /**\n * The css style of the cursor that is being used\n * @member {string}\n */\n this.currentCursorStyle = 'inherit';\n\n /**\n * Internal cached var\n * @member {Point}\n * @private\n */\n this._tempPoint = new core.Point();\n\n /**\n * The current resolution\n * @member {number}\n */\n this.resolution = 1;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n}\n\nInteractionManager.prototype.constructor = InteractionManager;\nmodule.exports = InteractionManager;\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 deletegate\n * another DOM element to receive those events.\n *\n * @param element {HTMLElement} the DOM element which will receive mouse and touch events.\n * @param [resolution=1] {number} THe resolution of the new element (relative to the canvas).\n * @private\n */\nInteractionManager.prototype.setTargetElement = function (element, resolution)\n{\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution || 1;\n\n this.addEvents();\n};\n\n/**\n * Registers all the DOM events\n * @private\n */\nInteractionManager.prototype.addEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n core.ticker.shared.add(this.update, this);\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\n window.document.addEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.addEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.addEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onTouchMove, true);\n\n window.addEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = true;\n};\n\n/**\n * Removes all the DOM events that were previously registered\n * @private\n */\nInteractionManager.prototype.removeEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n core.ticker.shared.remove(this.update);\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = '';\n this.interactionDOMElement.style['-ms-touch-action'] = '';\n }\n\n window.document.removeEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true);\n\n this.interactionDOMElement = null;\n\n window.removeEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = false;\n};\n\n/**\n * Updates the state of interactive objects.\n * Invoked by a throttled ticker update from\n * {@link PIXI.ticker.shared}.\n *\n * @param deltaTime {number}\n */\nInteractionManager.prototype.update = function (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 dfone using the mouse move!\n if(this.didMove)\n {\n this.didMove = false;\n return;\n }\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO\n};\n\n/**\n * Dispatches an event on the display object that was interacted with\n * @param displayObject {Container|Sprite|TilingSprite} the display object in question\n * @param eventString {string} the name of the event (e.g, mousedown)\n * @param eventData {EventData} the event data object\n * @private\n */\nInteractionManager.prototype.dispatchEvent = function ( displayObject, eventString, eventData )\n{\n if(!eventData.stopped)\n {\n eventData.target = 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 * Maps x and y coords from a DOM object and maps them correctly to the pixi view. The resulting value is stored in the point.\n * This takes into account the fact that the DOM element could be scaled and positioned anywhere on the screen.\n *\n * @param {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 */\nInteractionManager.prototype.mapPositionToPoint = function ( point, x, y )\n{\n var rect = this.interactionDOMElement.getBoundingClientRect();\n point.x = ( ( x - rect.left ) * (this.interactionDOMElement.width / rect.width ) ) / this.resolution;\n point.y = ( ( y - rect.top ) * (this.interactionDOMElement.height / rect.height ) ) / this.resolution;\n};\n\n/**\n * This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds.\n * It will also take care of hit testing the interactive objects and passes the hit across in the function.\n *\n * @param {Point} point the point that is tested for collision\n * @param {Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children)\n * @param {function} func the function that will be called on each interactive object. The 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 */\nInteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive )\n{\n if(!displayObject.visible)\n {\n return false;\n }\n\n var children = displayObject.children;\n\n var hit = false;\n\n // if the object is interactive we must hit test all its children..\n interactive = interactive || displayObject.interactive;\n\n if(displayObject.interactiveChildren)\n {\n\n for (var i = children.length-1; i >= 0; i--)\n {\n if(! hit && hitTest)\n {\n hit = this.processInteractive(point, children[i], func, true, interactive );\n }\n else\n {\n // now we know we can miss it all!\n this.processInteractive(point, children[i], func, false, false );\n }\n }\n\n }\n\n if(interactive)\n {\n if(hitTest)\n {\n if(displayObject.hitArea)\n {\n // lets use the hit object first!\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y );\n }\n else if(displayObject.containsPoint)\n {\n hit = displayObject.containsPoint(point);\n }\n }\n\n if(displayObject.interactive)\n {\n func(displayObject, hit);\n }\n }\n\n return hit;\n};\n\n\n\n\n/**\n * Is called when the mouse button is pressed down on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being pressed down\n * @private\n */\nInteractionManager.prototype.onMouseDown = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n // Update internal mouse reference\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n if (this.autoPreventDefault)\n {\n this.mouse.originalEvent.preventDefault();\n }\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseDown, true );\n};\n\n/**\n * Processes the result of the mouse down check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the dispay object\n * @private\n */\nInteractionManager.prototype.processMouseDown = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n\n if(hit)\n {\n displayObject[ isRightButton ? '_isRightDown' : '_isLeftDown' ] = true;\n this.dispatchEvent( displayObject, isRightButton ? 'rightdown' : 'mousedown', this.eventData );\n }\n};\n\n\n\n/**\n * Is called when the mouse button is released on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being released\n * @private\n */\nInteractionManager.prototype.onMouseUp = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n // Update internal mouse reference\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseUp, true );\n};\n\n/**\n * Processes the result of the mouse up check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseUp = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n var isDown = isRightButton ? '_isRightDown' : '_isLeftDown';\n\n if(hit)\n {\n this.dispatchEvent( displayObject, isRightButton ? 'rightup' : 'mouseup', this.eventData );\n\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightclick' : 'click', this.eventData );\n }\n }\n else\n {\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', this.eventData );\n }\n }\n};\n\n\n/**\n * Is called when the mouse moves across the renderer element\n *\n * @param event {Event} The DOM event of the mouse moving\n * @private\n */\nInteractionManager.prototype.onMouseMove = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n this.didMove = true;\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO BUG for parents ineractive object (border order issue)\n};\n\n/**\n * Processes the result of the mouse move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseMove = function ( displayObject, hit )\n{\n this.dispatchEvent( displayObject, 'mousemove', this.eventData);\n this.processMouseOverOut(displayObject, hit);\n};\n\n\n/**\n * Is called when the mouse is moved out of the renderer element\n *\n * @param event {Event} The DOM event of a mouse being moved out\n * @private\n */\nInteractionManager.prototype.onMouseOut = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.stopped = false;\n\n // Update internal mouse reference\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n this.interactionDOMElement.style.cursor = 'inherit';\n\n // TODO optimize by not check EVERY TIME! maybe half as often? //\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY );\n\n this.processInteractive( this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, false );\n};\n\n/**\n * Processes the result of the mouse over/out check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseOverOut = function ( displayObject, hit )\n{\n if(hit)\n {\n if(!displayObject._over)\n {\n displayObject._over = true;\n this.dispatchEvent( displayObject, 'mouseover', this.eventData );\n }\n\n if (displayObject.buttonMode)\n {\n this.cursor = displayObject.defaultCursor;\n }\n }\n else\n {\n if(displayObject._over)\n {\n displayObject._over = false;\n this.dispatchEvent( displayObject, 'mouseout', this.eventData);\n }\n }\n};\n\n\n/**\n * Is called when a touch is started on the renderer element\n *\n * @param event {Event} The DOM event of a touch starting on the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchStart = function (event)\n{\n if (this.autoPreventDefault)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n var cLength = changedTouches.length;\n\n for (var i=0; i < cLength; i++)\n {\n var touchEvent = changedTouches[i];\n //TODO POOL\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchStart, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchStart = function ( displayObject, hit )\n{\n //console.log(\"hit\" + hit)\n if(hit)\n {\n displayObject._touchDown = true;\n this.dispatchEvent( displayObject, 'touchstart', this.eventData );\n }\n};\n\n\n/**\n * Is called when a touch ends on the renderer element\n * @param event {Event} The DOM event of a touch ending on the renderer view\n *\n */\nInteractionManager.prototype.onTouchEnd = function (event)\n{\n if (this.autoPreventDefault)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n var cLength = changedTouches.length;\n\n for (var i=0; i < cLength; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n //TODO this should be passed along.. no set\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchEnd, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of the end of a touch and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchEnd = function ( displayObject, hit )\n{\n if(hit)\n {\n this.dispatchEvent( displayObject, 'touchend', this.eventData );\n\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'tap', this.eventData );\n }\n }\n else\n {\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );\n }\n }\n};\n\n/**\n * Is called when a touch is moved across the renderer element\n *\n * @param event {Event} The DOM event of a touch moving across the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchMove = function (event)\n{\n if (this.autoPreventDefault)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n var cLength = changedTouches.length;\n\n for (var i=0; i < cLength; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchMove, false );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchMove = function ( displayObject, hit )\n{\n hit = hit;\n this.dispatchEvent( displayObject, 'touchmove', this.eventData);\n};\n\n/**\n * Grabs an interaction data object from the internal pool\n *\n * @param touchEvent {EventData} The touch event we need to pair with an interactionData object\n *\n * @private\n */\nInteractionManager.prototype.getTouchData = function (touchEvent)\n{\n var touchData = this.interactiveDataPool.pop();\n\n if(!touchData)\n {\n touchData = new InteractionData();\n }\n\n touchData.identifier = touchEvent.identifier;\n this.mapPositionToPoint( touchData.global, touchEvent.clientX, touchEvent.clientY );\n\n if(navigator.isCocoonJS)\n {\n touchData.global.x = touchData.global.x / this.resolution;\n touchData.global.y = touchData.global.y / this.resolution;\n }\n\n touchEvent.globalX = touchData.global.x;\n touchEvent.globalY = touchData.global.y;\n\n return touchData;\n};\n\n/**\n * Returns an interaction data object to the internal pool\n *\n * @param touchData {InteractionData} The touch data object we want to return to the pool\n *\n * @private\n */\nInteractionManager.prototype.returnTouchData = function ( touchData )\n{\n this.interactiveDataPool.push( touchData );\n};\n\n/**\n * Destroys the interaction manager\n */\nInteractionManager.prototype.destroy = function () {\n this.removeEvents();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactiveDataPool = null;\n\n this.interactionDOMElement = null;\n\n this.onMouseUp = null;\n this.processMouseUp = null;\n\n\n this.onMouseDown = null;\n this.processMouseDown = null;\n\n this.onMouseMove = null;\n this.processMouseMove = null;\n\n this.onMouseOut = null;\n this.processMouseOverOut = null;\n\n\n this.onTouchStart = null;\n this.processTouchStart = null;\n\n this.onTouchEnd = null;\n this.processTouchEnd = null;\n\n this.onTouchMove = null;\n this.processTouchMove = null;\n\n this._tempPoint = null;\n};\n\ncore.WebGLRenderer.registerPlugin('interaction', InteractionManager);\ncore.CanvasRenderer.registerPlugin('interaction', InteractionManager);\n","/**\n * @file Main export of the PIXI interactions library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.interaction\n */\nmodule.exports = {\n InteractionData: require('./InteractionData'),\n InteractionManager: require('./InteractionManager'),\n interactiveTarget: require('./interactiveTarget')\n};\n","/**\n * Default property values of interactive objects\n * used by {@link PIXI.interaction.InteractionManager}.\n *\n * @mixin\n * @memberof PIXI.interaction\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.interaction.interactiveTarget\n * );\n */\nvar interactiveTarget = {\n /**\n * @todo Needs docs.\n */\n interactive: false,\n /**\n * @todo Needs docs.\n */\n buttonMode: false,\n /**\n * @todo Needs docs.\n */\n interactiveChildren: true,\n /**\n * @todo Needs docs.\n */\n defaultCursor: 'pointer',\n\n // some internal checks..\n\n /**\n * @todo Needs docs.\n * @private\n */\n _over: false,\n /**\n * @todo Needs docs.\n * @private\n */\n _touchDown: false\n};\n\nmodule.exports = interactiveTarget;\n","var Resource = require('resource-loader').Resource,\n core = require('../core'),\n utils = require('../core/utils'),\n extras = require('../extras'),\n path = require('path');\n\n\nfunction parse(resource, texture) {\n var data = {};\n var info = resource.data.getElementsByTagName('info')[0];\n var common = resource.data.getElementsByTagName('common')[0];\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);\n data.chars = {};\n\n //parse letters\n var letters = resource.data.getElementsByTagName('char');\n\n for (var i = 0; i < letters.length; i++)\n {\n var charCode = parseInt(letters[i].getAttribute('id'), 10);\n\n var textureRect = new core.math.Rectangle(\n parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x,\n parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y,\n parseInt(letters[i].getAttribute('width'), 10),\n parseInt(letters[i].getAttribute('height'), 10)\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),\n yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),\n xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),\n kerning: {},\n texture: new core.Texture(texture.baseTexture, textureRect)\n\n };\n }\n\n //parse kernings\n var kernings = resource.data.getElementsByTagName('kerning');\n for (i = 0; i < kernings.length; i++)\n {\n var first = parseInt(kernings[i].getAttribute('first'), 10);\n var second = parseInt(kernings[i].getAttribute('second'), 10);\n var amount = parseInt(kernings[i].getAttribute('amount'), 10);\n\n data.chars[second].kerning[first] = amount;\n }\n\n resource.bitmapFont = data;\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 extras.BitmapText.fonts[data.font] = data;\n}\n\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // skip if no data or not xml data\n if (!resource.data || !resource.isXml)\n {\n return next();\n }\n\n // skip if not bitmap font data, using some silly duck-typing\n if (\n 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 return next();\n }\n\n var xmlUrl = path.dirname(resource.url);\n\n if (xmlUrl === '.') {\n xmlUrl = '';\n }\n\n if (this.baseUrl && xmlUrl) {\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 xmlUrl += '/';\n }\n\n // remove baseUrl from xmlUrl\n xmlUrl = xmlUrl.replace(this.baseUrl, '');\n }\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 xmlUrl += '/';\n }\n var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file');\n if (utils.TextureCache[textureUrl]) {\n //reuse existing texture\n parse(resource, utils.TextureCache[textureUrl]);\n next();\n }\n else {\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n // load the texture for the font\n this.add(resource.name + '_image', textureUrl, loadOptions, function (res) {\n parse(resource, res.texture);\n next();\n });\n }\n };\n};\n","/**\n * @file Main export of the PIXI loaders library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.loaders\n */\nmodule.exports = {\n Loader: require('./loader'),\n\n // parsers\n bitmapFontParser: require('./bitmapFontParser'),\n spritesheetParser: require('./spritesheetParser'),\n textureParser: require('./textureParser'),\n Resource: require('resource-loader').Resource\n};\n","var ResourceLoader = require('resource-loader'),\n textureParser = require('./textureParser'),\n spritesheetParser = require('./spritesheetParser'),\n bitmapFontParser = require('./bitmapFontParser');\n\n/**\n *\n * The new loader, extends Resource Loader by Chad Engler : https://github.com/englercj/resource-loader\n *\n * ```js\n * var loader = PIXI.loader; // pixi exposes a premade instance for you to use.\n * //or\n * var loader = new PIXI.loaders.Loader(); // you can also create your own if you want\n *\n * loader.add('bunny',\"data/bunny.png\");\n *\n * loader.once('complete',onAssetsLoaded);\n *\n * loader.load();\n * ```\n *\n * @class\n * @extends PIXI.ResourceLoader\n * @memberof PIXI.loaders\n * @param [baseUrl=''] {string} The base url for all resources loaded by this loader.\n * @param [concurrency=10] {number} The number of resources to load concurrently.\n */\nfunction Loader(baseUrl, concurrency)\n{\n ResourceLoader.call(this, baseUrl, concurrency);\n\n for (var i = 0; i < Loader._pixiMiddleware.length; ++i) {\n this.use(Loader._pixiMiddleware[i]());\n }\n}\n\nLoader.prototype = Object.create(ResourceLoader.prototype);\nLoader.prototype.constructor = Loader;\n\nmodule.exports = Loader;\n\nLoader._pixiMiddleware = [\n // parse any blob into more usable objects (e.g. Image)\n ResourceLoader.middleware.parsing.blob,\n // parse any Image objects into textures\n textureParser,\n // parse any spritesheet data into multiple textures\n spritesheetParser,\n // parse any spritesheet data into multiple textures\n bitmapFontParser\n];\n\nLoader.addPixiMiddleware = function (fn) {\n Loader._pixiMiddleware.push(fn);\n};\n\n// Add custom extentions\nvar Resource = ResourceLoader.Resource;\n\nResource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT);\n","var Resource = require('resource-loader').Resource,\n path = require('path'),\n core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // skip if no data, its not json, or it isn't spritesheet data\n if (!resource.data || !resource.isJson || !resource.data.frames)\n {\n return next();\n }\n\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n var route = path.dirname(resource.url.replace(this.baseUrl, ''));\n\n var resolution = core.utils.getResolutionOfUrl( resource.url );\n\n // load the image for this sheet\n this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res)\n {\n resource.textures = {};\n\n var frames = resource.data.frames;\n\n for (var i in frames)\n {\n var rect = frames[i].frame;\n\n if (rect)\n {\n var size = null;\n var trim = null;\n\n if (frames[i].rotated) {\n size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);\n }\n else {\n size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);\n }\n\n // Check to see if the sprite is trimmed\n if (frames[i].trimmed)\n {\n trim = new core.math.Rectangle(\n frames[i].spriteSourceSize.x / resolution,\n frames[i].spriteSourceSize.y / resolution,\n frames[i].sourceSize.w / resolution,\n frames[i].sourceSize.h / resolution\n );\n }\n\n // flip the width and height!\n if (frames[i].rotated)\n {\n var temp = size.width;\n size.width = size.height;\n size.height = temp;\n }\n\n size.x /= resolution;\n size.y /= resolution;\n size.width /= resolution;\n size.height /= resolution;\n\n resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage functions\n core.utils.TextureCache[i] = resource.textures[i];\n }\n }\n\n next();\n });\n };\n};\n","var core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.isImage)\n {\n resource.texture = new core.Texture(new core.BaseTexture(resource.data, null, core.utils.getResolutionOfUrl(resource.url)));\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[resource.url] = resource.texture;\n }\n\n next();\n };\n};\n","var core = require('../core');\n\n/**\n * Base mesh class\n * @class\n * @extends PIXI.Container\n * @memberof PIXI.mesh\n * @param texture {Texture} The texture to use\n * @param [vertices] {Float32Arrif you want to specify the vertices\n * @param [uvs] {Float32Array} if you want to specify the uvs\n * @param [indices] {Uint16Array} if you want to specify the indices\n * @param [drawMode] {number} the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\nfunction Mesh(texture, vertices, uvs, indices, drawMode)\n{\n core.Container.call(this);\n\n /**\n * The texture of the Mesh\n *\n * @member {Texture}\n * @private\n */\n this._texture = null;\n\n /**\n * The Uvs of the Mesh\n *\n * @member {Float32Array}\n */\n this.uvs = uvs || new Float32Array([0, 1,\n 1, 1,\n 1, 0,\n 0, 1]);\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = vertices || new Float32Array([0, 0,\n 100, 0,\n 100, 100,\n 0, 100]);\n\n /*\n * @member {Uint16Array} An array containing the indices of the vertices\n */\n // TODO auto generate this based on draw mode!\n this.indices = indices || new Uint16Array([0, 1, 2, 3]);\n\n /**\n * Whether the Mesh is dirty or not\n *\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * The blend mode to be applied to the sprite. Set to blendModes.NORMAL to remove any blend mode.\n *\n * @member {number}\n * @default CONST.BLEND_MODES.NORMAL;\n */\n this.blendMode = core.BLEND_MODES.NORMAL;\n\n /**\n * Triangles in canvas mode are automatically antialiased, use this value to force triangles to overlap a bit with each other.\n *\n * @member {number}\n */\n this.canvasPadding = 0;\n\n /**\n * The way the Mesh should be drawn, can be any of the Mesh.DRAW_MODES consts\n *\n * @member {number}\n */\n this.drawMode = drawMode || Mesh.DRAW_MODES.TRIANGLE_MESH;\n\n // run texture setter;\n this.texture = texture;\n}\n\n// constructor\nMesh.prototype = Object.create(core.Container.prototype);\nMesh.prototype.constructor = Mesh;\nmodule.exports = Mesh;\n\nObject.defineProperties(Mesh.prototype, {\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n * @memberof PIXI.mesh.Mesh#\n */\n texture: {\n get: function ()\n {\n return this._texture;\n },\n set: function (value)\n {\n if (this._texture === value)\n {\n return;\n }\n\n this._texture = value;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.hasLoaded)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n }\n});\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer} a reference to the WebGL renderer\n * @private\n */\nMesh.prototype._renderWebGL = function (renderer)\n{\n renderer.setObjectRenderer(renderer.plugins.mesh);\n renderer.plugins.mesh.render(this);\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer}\n * @private\n */\nMesh.prototype._renderCanvas = function (renderer)\n{\n var context = renderer.context;\n\n var transform = this.worldTransform;\n\n if (renderer.roundPixels)\n {\n context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx | 0, transform.ty | 0);\n }\n else\n {\n context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty);\n }\n\n if (this.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH)\n {\n this._renderCanvasTriangleMesh(context);\n }\n else\n {\n this._renderCanvasTriangles(context);\n }\n};\n\n/**\n * Draws the object in Triangle Mesh mode using canvas\n *\n * @param context {CanvasRenderingContext2D} the current drawing context\n * @private\n */\nMesh.prototype._renderCanvasTriangleMesh = function (context)\n{\n // draw triangles!!\n var vertices = this.vertices;\n var uvs = this.uvs;\n\n var length = vertices.length / 2;\n // this.count++;\n\n for (var i = 0; i < length - 2; i++)\n {\n // draw some triangles!\n var index = i * 2;\n this._renderCanvasDrawTriangle(context, vertices, uvs, index, (index + 2), (index + 4));\n }\n};\n\n/**\n * Draws the object in triangle mode using canvas\n *\n * @param context {CanvasRenderingContext2D} the current drawing context\n * @private\n */\nMesh.prototype._renderCanvasTriangles = function (context)\n{\n // draw triangles!!\n var vertices = this.vertices;\n var uvs = this.uvs;\n var indices = this.indices;\n\n var length = indices.length;\n // this.count++;\n\n for (var i = 0; i < length; i += 3)\n {\n // draw some triangles!\n var index0 = indices[i] * 2, index1 = indices[i + 1] * 2, index2 = indices[i + 2] * 2;\n this._renderCanvasDrawTriangle(context, vertices, uvs, index0, index1, index2);\n }\n};\n\n/**\n * Draws one of the triangles that form this Mesh\n *\n * @param context {CanvasRenderingContext2D} the current drawing context\n * @param vertices {Float32Array} a reference to the vertices of the Mesh\n * @param uvs {Float32Array} a reference to the uvs of the Mesh\n * @param index0 {number} the index of the first vertex\n * @param index1 {number} the index of the second vertex\n * @param index2 {number} the index of the third vertex\n * @private\n */\nMesh.prototype._renderCanvasDrawTriangle = function (context, vertices, uvs, index0, index1, index2)\n{\n var textureSource = this._texture.baseTexture.source;\n var textureWidth = this._texture.baseTexture.width;\n var textureHeight = this._texture.baseTexture.height;\n\n var x0 = vertices[index0], x1 = vertices[index1], x2 = vertices[index2];\n var y0 = vertices[index0 + 1], y1 = vertices[index1 + 1], y2 = vertices[index2 + 1];\n\n var u0 = uvs[index0] * textureWidth, u1 = uvs[index1] * textureWidth, u2 = uvs[index2] * textureWidth;\n var v0 = uvs[index0 + 1] * textureHeight, v1 = uvs[index1 + 1] * textureHeight, v2 = uvs[index2 + 1] * textureHeight;\n\n if (this.canvasPadding > 0)\n {\n var paddingX = this.canvasPadding / this.worldTransform.a;\n var paddingY = this.canvasPadding / this.worldTransform.d;\n var centerX = (x0 + x1 + x2) / 3;\n var centerY = (y0 + y1 + y2) / 3;\n\n var normX = x0 - centerX;\n var normY = y0 - centerY;\n\n var dist = Math.sqrt(normX * normX + normY * normY);\n x0 = centerX + (normX / dist) * (dist + paddingX);\n y0 = centerY + (normY / dist) * (dist + paddingY);\n\n //\n\n normX = x1 - centerX;\n normY = y1 - centerY;\n\n dist = Math.sqrt(normX * normX + normY * normY);\n x1 = centerX + (normX / dist) * (dist + paddingX);\n y1 = centerY + (normY / dist) * (dist + paddingY);\n\n normX = x2 - centerX;\n normY = y2 - centerY;\n\n dist = Math.sqrt(normX * normX + normY * normY);\n x2 = centerX + (normX / dist) * (dist + paddingX);\n y2 = centerY + (normY / dist) * (dist + paddingY);\n }\n\n context.save();\n context.beginPath();\n\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n\n context.closePath();\n\n context.clip();\n\n // Compute matrix transform\n var delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2);\n var deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2);\n var deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2);\n var deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2);\n var deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2);\n var deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2);\n var deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2);\n\n context.transform(deltaA / delta, deltaD / delta,\n deltaB / delta, deltaE / delta,\n deltaC / delta, deltaF / delta);\n\n context.drawImage(textureSource, 0, 0);\n context.restore();\n};\n\n\n\n/**\n * Renders a flat Mesh\n *\n * @param Mesh {Mesh} The Mesh to render\n * @private\n */\nMesh.prototype.renderMeshFlat = function (Mesh)\n{\n var context = this.context;\n var vertices = Mesh.vertices;\n\n var length = vertices.length/2;\n // this.count++;\n\n context.beginPath();\n for (var i=1; i < length-2; i++)\n {\n // draw some triangles!\n var index = i*2;\n\n var x0 = vertices[index], x1 = vertices[index+2], x2 = vertices[index+4];\n var y0 = vertices[index+1], y1 = vertices[index+3], y2 = vertices[index+5];\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n }\n\n context.fillStyle = '#FF0000';\n context.fill();\n context.closePath();\n};\n\n/*\nMesh.prototype.setTexture = function (texture)\n{\n //TODO SET THE TEXTURES\n //TODO VISIBILITY\n //TODO SETTER\n\n // stop current texture\n this.texture = texture;\n this.width = texture.frame.width;\n this.height = texture.frame.height;\n this.updateFrame = true;\n};\n */\n\n/**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @param event\n * @private\n */\nMesh.prototype._onTextureUpdate = function ()\n{\n this.updateFrame = true;\n};\n\n/**\n * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n * @param matrix {Matrix} the transformation matrix of the sprite\n * @return {Rectangle} the framing rectangle\n */\nMesh.prototype.getBounds = function (matrix)\n{\n var worldTransform = matrix || this.worldTransform;\n\n var a = worldTransform.a;\n var b = worldTransform.b;\n var c = worldTransform.c;\n var d = worldTransform.d;\n var tx = worldTransform.tx;\n var ty = worldTransform.ty;\n\n var maxX = -Infinity;\n var maxY = -Infinity;\n\n var minX = Infinity;\n var minY = Infinity;\n\n var vertices = this.vertices;\n for (var i = 0, n = vertices.length; i < n; i += 2)\n {\n var rawX = vertices[i], rawY = vertices[i + 1];\n var x = (a * rawX) + (c * rawY) + tx;\n var y = (d * rawY) + (b * rawX) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n if (minX === -Infinity || maxY === Infinity)\n {\n return core.math.Rectangle.EMPTY;\n }\n\n var bounds = this._bounds;\n\n bounds.x = minX;\n bounds.width = maxX - minX;\n\n bounds.y = minY;\n bounds.height = maxY - minY;\n\n // store a reference so that if this function gets called again in the render cycle we do not have to recalculate\n this._currentBounds = bounds;\n\n return bounds;\n};\n\n/**\n * Different drawing buffer modes supported\n *\n * @static\n * @constant\n * @property {object} DRAW_MODES\n * @property {number} DRAW_MODES.TRIANGLE_MESH\n * @property {number} DRAW_MODES.TRIANGLES\n */\nMesh.DRAW_MODES = {\n TRIANGLE_MESH: 0,\n TRIANGLES: 1\n};\n","var Mesh = require('./Mesh');\nvar core = require('../core');\n\n/**\n * The rope allows you to draw a texture across several points and them manipulate these points\n *\n *```js\n * for (var i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * var rope = new PIXI.Rope(PIXI.Texture.fromImage(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI.mesh\n * @param {Texture} texture - The texture to use on the rope.\n * @param {Array} points - An array of {Point} objects to construct this rope.\n *\n */\nfunction Rope(texture, points)\n{\n Mesh.call(this, texture);\n\n /*\n * @member {Array} An array of points that determine the rope\n */\n this.points = points;\n\n /*\n * @member {Float32Array} An array of vertices used to construct this rope.\n */\n this.vertices = new Float32Array(points.length * 4);\n\n /*\n * @member {Float32Array} The WebGL Uvs of the rope.\n */\n this.uvs = new Float32Array(points.length * 4);\n\n /*\n * @member {Float32Array} An array containing the color components\n */\n this.colors = new Float32Array(points.length * 2);\n\n /*\n * @member {Uint16Array} An array containing the indices of the vertices\n */\n this.indices = new Uint16Array(points.length * 2);\n\n /**\n * Tracker for if the rope is ready to be drawn. Needed because Mesh ctor can\n * call _onTextureUpdated which could call refresh too early.\n *\n * @member {boolean}\n * @private\n */\n this._ready = true;\n\n this.refresh();\n}\n\n\n// constructor\nRope.prototype = Object.create(Mesh.prototype);\nRope.prototype.constructor = Rope;\nmodule.exports = Rope;\n\n/**\n * Refreshes\n *\n */\nRope.prototype.refresh = function ()\n{\n var points = this.points;\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1 || !this._texture._uvs)\n {\n return;\n }\n\n var uvs = this.uvs;\n\n var indices = this.indices;\n var colors = this.colors;\n\n var textureUvs = this._texture._uvs;\n var offset = new core.math.Point(textureUvs.x0, textureUvs.y0);\n var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0);\n\n uvs[0] = 0 + offset.x;\n uvs[1] = 0 + offset.y;\n uvs[2] = 0 + offset.x;\n uvs[3] = 1 * factor.y + offset.y;\n\n colors[0] = 1;\n colors[1] = 1;\n\n indices[0] = 0;\n indices[1] = 1;\n\n var total = points.length,\n point, index, amount;\n\n for (var i = 1; i < total; i++)\n {\n point = points[i];\n index = i * 4;\n // time to do some smart drawing!\n amount = i / (total-1);\n\n uvs[index] = amount * factor.x + offset.x;\n uvs[index+1] = 0 + offset.y;\n\n uvs[index+2] = amount * factor.x + offset.x;\n uvs[index+3] = 1 * factor.y + offset.y;\n\n index = i * 2;\n colors[index] = 1;\n colors[index+1] = 1;\n\n index = i * 2;\n indices[index] = index;\n indices[index + 1] = index + 1;\n }\n\n this.dirty = true;\n};\n\n/**\n * Clear texture UVs when new texture is set\n *\n * @private\n */\nRope.prototype._onTextureUpdate = function ()\n{\n Mesh.prototype._onTextureUpdate.call(this);\n\n // wait for the Rope ctor to finish before calling refresh\n if (this._ready) {\n this.refresh();\n }\n};\n\n/**\n * Updates the object transform for rendering\n *\n * @private\n */\nRope.prototype.updateTransform = function ()\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 // this.count -= 0.2;\n\n var vertices = this.vertices;\n var total = points.length,\n point, index, ratio, perpLength, num;\n\n for (var i = 0; i < total; i++)\n {\n point = points[i];\n 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 ratio = (1 - (i / (total-1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n perpLength = Math.sqrt(perpX * perpX + perpY * perpY);\n num = this._texture.height / 2; //(20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio;\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.containerUpdateTransform();\n};\n","/**\n * @file Main export of the PIXI extras library\n * @author Mat Groves <mat@goodboydigital.com>\n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.mesh\n */\nmodule.exports = {\n Mesh: require('./Mesh'),\n Rope: require('./Rope'),\n MeshRenderer: require('./webgl/MeshRenderer'),\n MeshShader: require('./webgl/MeshShader')\n};\n","var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'),\n WebGLRenderer = require('../../core/renderers/webgl/WebGLRenderer'),\n Mesh = require('../Mesh');\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original pixi version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's MeshRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/MeshRenderer.java\n */\n\n/**\n *\n * @class\n * @private\n * @memberof PIXI.mesh\n * @extends PIXI.ObjectRenderer\n * @param renderer {WebGLRenderer} The renderer this sprite batch works for.\n */\nfunction MeshRenderer(renderer)\n{\n ObjectRenderer.call(this, renderer);\n\n\n /**\n * Holds the indices\n *\n * @member {Uint16Array}\n */\n this.indices = new Uint16Array(15000);\n\n //TODO this could be a single buffer shared amongst all renderers as we reuse this set up in most renderers\n for (var i=0, j=0; i < 15000; i += 6, j += 4)\n {\n this.indices[i + 0] = j + 0;\n this.indices[i + 1] = j + 1;\n this.indices[i + 2] = j + 2;\n this.indices[i + 3] = j + 0;\n this.indices[i + 4] = j + 2;\n this.indices[i + 5] = j + 3;\n }\n}\n\nMeshRenderer.prototype = Object.create(ObjectRenderer.prototype);\nMeshRenderer.prototype.constructor = MeshRenderer;\nmodule.exports = MeshRenderer;\n\nWebGLRenderer.registerPlugin('mesh', MeshRenderer);\n\n/**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n * @param gl {WebGLRenderingContext} the current WebGL drawing context\n */\nMeshRenderer.prototype.onContextChange = function ()\n{\n\n};\n\n/**\n * Renders the sprite object.\n *\n * @param mesh {Mesh} the mesh to render\n */\nMeshRenderer.prototype.render = function (mesh)\n{\n// return;\n if(!mesh._vertexBuffer)\n {\n this._initWebGL(mesh);\n }\n\n var renderer = this.renderer,\n gl = renderer.gl,\n texture = mesh._texture.baseTexture,\n shader = renderer.shaderManager.plugins.meshShader;\n\n var drawMode = mesh.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH ? gl.TRIANGLE_STRIP : gl.TRIANGLES;\n\n renderer.blendModeManager.setBlendMode(mesh.blendMode);\n\n\n // set uniforms\n gl.uniformMatrix3fv(shader.uniforms.translationMatrix._location, false, mesh.worldTransform.toArray(true));\n\n gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, renderer.currentRenderTarget.projectionMatrix.toArray(true));\n gl.uniform1f(shader.uniforms.alpha._location, mesh.worldAlpha);\n\n if (!mesh.dirty)\n {\n\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, mesh.vertices);\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0);\n\n // update the uvs\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer);\n gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0);\n\n\n gl.activeTexture(gl.TEXTURE0);\n\n if (!texture._glTextures[gl.id])\n {\n this.renderer.updateTexture(texture);\n }\n else\n {\n // bind the current texture\n gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);\n }\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer);\n gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, mesh.indices);\n }\n else\n {\n\n mesh.dirty = false;\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.STATIC_DRAW);\n gl.vertexAttribPointer(shader.attributes.aVertexPosition, 2, gl.FLOAT, false, 0, 0);\n\n // update the uvs\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW);\n gl.vertexAttribPointer(shader.attributes.aTextureCoord, 2, gl.FLOAT, false, 0, 0);\n\n gl.activeTexture(gl.TEXTURE0);\n\n if (!texture._glTextures[gl.id])\n {\n this.renderer.updateTexture(texture);\n }\n else\n {\n // bind the current texture\n gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);\n }\n\n // dont need to upload!\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW);\n\n }\n\n gl.drawElements(drawMode, mesh.indices.length, gl.UNSIGNED_SHORT, 0);\n\n};\n\n/**\n * Prepares all the buffers to render this mesh\n * @param mesh {Mesh} the mesh to render\n */\nMeshRenderer.prototype._initWebGL = function (mesh)\n{\n // build the strip!\n var gl = this.renderer.gl;\n\n mesh._vertexBuffer = gl.createBuffer();\n mesh._indexBuffer = gl.createBuffer();\n mesh._uvBuffer = gl.createBuffer();\n\n\n\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, mesh.vertices, gl.DYNAMIC_DRAW);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._uvBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, mesh.uvs, gl.STATIC_DRAW);\n\n if(mesh.colors){\n mesh._colorBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, mesh._colorBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, mesh.colors, gl.STATIC_DRAW);\n }\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh._indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, mesh.indices, gl.STATIC_DRAW);\n};\n\n\n/**\n * Empties the current batch.\n *\n */\nMeshRenderer.prototype.flush = function ()\n{\n\n};\n\n/**\n * Starts a new mesh renderer.\n *\n */\nMeshRenderer.prototype.start = function ()\n{\n var shader = this.renderer.shaderManager.plugins.meshShader;\n\n this.renderer.shaderManager.setShader(shader);\n};\n\n/**\n * Destroys the Mesh renderer\n *\n */\nMeshRenderer.prototype.destroy = function ()\n{\n};\n","var core = require('../../core');\n\n/**\n * @class\n * @extends PIXI.Shader\n * @memberof PIXI.mesh\n * @param shaderManager {ShaderManager} The WebGL shader manager this shader works for.\n */\nfunction StripShader(shaderManager)\n{\n core.Shader.call(this,\n shaderManager,\n // vertex shader\n [\n 'precision lowp float;',\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n\n 'uniform mat3 translationMatrix;',\n 'uniform mat3 projectionMatrix;',\n\n 'varying vec2 vTextureCoord;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vTextureCoord = aTextureCoord;',\n '}'\n ].join('\\n'),\n [\n 'precision lowp float;',\n\n 'varying vec2 vTextureCoord;',\n 'uniform float alpha;',\n\n 'uniform sampler2D uSampler;',\n\n 'void main(void){',\n ' gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;',\n '}'\n ].join('\\n'),\n // custom uniforms\n {\n alpha: { type: '1f', value: 0 },\n translationMatrix: { type: 'mat3', value: new Float32Array(9) },\n projectionMatrix: { type: 'mat3', value: new Float32Array(9) }\n },\n // custom attributes\n {\n aVertexPosition:0,\n aTextureCoord:0\n }\n );\n}\n\nStripShader.prototype = Object.create(core.Shader.prototype);\nStripShader.prototype.constructor = StripShader;\nmodule.exports = StripShader;\n\ncore.ShaderManager.registerPlugin('meshShader', StripShader);\n","// References:\n// https://github.com/sindresorhus/object-assign\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\nif (!Object.assign)\n{\n Object.assign = require('object-assign');\n}\n","require('./Object.assign');\nrequire('./requestAnimationFrame');\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\n// Date.now\nif (!(Date.now && Date.prototype.getTime)) {\n Date.now = function now() {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(global.performance && global.performance.now)) {\n var startTime = Date.now();\n if (!global.performance) {\n global.performance = {};\n }\n global.performance.now = function () {\n return Date.now() - startTime;\n };\n}\n\n// requestAnimationFrame\nvar lastTime = Date.now();\nvar vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) {\n global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame'];\n global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] ||\n global[vendors[x] + 'CancelRequestAnimationFrame'];\n}\n\nif (!global.requestAnimationFrame) {\n global.requestAnimationFrame = function (callback) {\n if (typeof callback !== 'function') {\n throw new TypeError(callback + 'is not a function');\n }\n\n var currentTime = Date.now(),\n delay = 16 + lastTime - currentTime;\n\n if (delay < 0) {\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 (!global.cancelAnimationFrame) {\n global.cancelAnimationFrame = function(id) {\n clearTimeout(id);\n };\n}\n"]} |