diff --git a/bin/pixi.js b/bin/pixi.js index e3877d6..d7c2e5d 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -521,7 +521,7 @@ /** * Uploads this texture to the GPU - * @param source {HTMLImageElement|ImageData} the source image of the texture + * @param source {HTMLImageElement|ImageData|HTMLVideoElement} the source image of the texture */ Texture.prototype.upload = function(source) { @@ -529,8 +529,9 @@ var gl = this.gl; - this.width = source.width; - this.height = source.height; + // if the source is a video, we need to use the videoWidth / videoHeight properties as width / height will be incorrect. + this.width = source.videoWidth || source.width; + this.height = source.videoHeight || source.height; gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha); gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source); @@ -7435,7 +7436,7 @@ core.WebGLRenderer.registerPlugin('accessibility', AccessibilityManager); core.CanvasRenderer.registerPlugin('accessibility', AccessibilityManager); -},{"../core":56,"./accessibleTarget":36}],36:[function(require,module,exports){ +},{"../core":55,"./accessibleTarget":36}],36:[function(require,module,exports){ /** * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. @@ -7675,283 +7676,6 @@ /** * The wrap modes that are supported by pixi. * - * The DEFAULT Garbage Collection mode for pixi textures is AUTO - * If set to AUTO, the renderer will occasianally check textures usage. If they are not used for a specified period of time they will be removed from the GPU. - * They will of corse be uploaded again when they are required. This is a silent behind the scenes process that should ensure that the GPU does not get filled up. - * Handy for mobile devices! - * This property only affects WebGL - * @static - * @constant - * @property {object} GC_MODES - * @property {number} GC_MODES.DEFAULT=DEFAULT - * @property {number} GC_MODES.AUTO Garbage collection will happen periodically automatically - * @property {number} GC_MODES.MANUAL Garbage collection will need to be called manually - */ - GC_MODES: { - DEFAULT: 0, - AUTO: 0, - MANUAL: 1, - }, - - /** - * If set to true WebGL will attempt make textures mimpaped by default - * Mipmapping will only succeed if the base texture uploaded has power of two dimensions - * @static - * @constant - * @property {bool} MIPMAP_TEXTURES - */ - MIPMAP_TEXTURES:true, - - /** - * The prefix that denotes a URL is for a retina asset - * - * @static - * @constant - * @property {string} RETINA_PREFIX - */ - //example: '@2x', - RETINA_PREFIX: /@(.+)x/, - - RESOLUTION:1, - - FILTER_RESOLUTION:1, - - /** - * The default render options if none are supplied to {@link PIXI.WebGLRenderer} - * or {@link PIXI.CanvasRenderer}. - * - * @static - * @constant - * @property {object} DEFAULT_RENDER_OPTIONS - * @property {HTMLCanvasElement} DEFAULT_RENDER_OPTIONS.view=null - * @property {boolean} DEFAULT_RENDER_OPTIONS.transparent=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.antialias=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.forceFXAA=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.preserveDrawingBuffer=false - * @property {number} DEFAULT_RENDER_OPTIONS.resolution=1 - * @property {number} DEFAULT_RENDER_OPTIONS.backgroundColor=0x000000 - * @property {boolean} DEFAULT_RENDER_OPTIONS.clearBeforeRender=true - * @property {boolean} DEFAULT_RENDER_OPTIONS.autoResize=false - */ - DEFAULT_RENDER_OPTIONS: { - view: null, - resolution: 1, - antialias: false, - forceFXAA: false, - autoResize: false, - transparent: false, - backgroundColor: 0x000000, - clearBeforeRender: true, - preserveDrawingBuffer: false, - roundPixels: false - }, - - /** - * Constants that identify shapes, mainly to prevent `instanceof` calls. - * - * @static - * @constant - * @property {object} SHAPES - * @property {object} SHAPES.POLY=0 - * @property {object} SHAPES.RECT=1 - * @property {object} SHAPES.CIRC=2 - * @property {object} SHAPES.ELIP=3 - * @property {object} SHAPES.RREC=4 - */ - SHAPES: { - POLY: 0, - RECT: 1, - CIRC: 2, - ELIP: 3, - RREC: 4 - }, - - // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 - // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - SPRITE_BATCH_SIZE: 4096, //nice balance between mobile and desktop machines - SPRITE_MAX_TEXTURES: require('./utils/maxRecommendedTextures')(32)//this is the MAXIMUM - various gpus will have there own limits. -}; - -module.exports = CONST; - -},{"./utils/maxRecommendedTextures":107}],39:[function(require,module,exports){ - -/** - * Constant values used in pixi - * - * @lends PIXI - */ -var CONST = { - /** - * String of the current PIXI version - * - * @static - * @constant - * @property {string} VERSION - */ - VERSION: '4.0.0', - - /** - * @property {number} PI_2 - Two Pi - * @constant - * @static - */ - PI_2: Math.PI * 2, - - /** - * @property {number} RAD_TO_DEG - Constant conversion factor for converting radians to degrees - * @constant - * @static - */ - RAD_TO_DEG: 180 / Math.PI, - - /** - * @property {Number} DEG_TO_RAD - Constant conversion factor for converting degrees to radians - * @constant - * @static - */ - DEG_TO_RAD: Math.PI / 180, - - /** - * Target frames per millisecond. - * - * @static - * @constant - * @property {number} TARGET_FPMS=0.06 - */ - TARGET_FPMS: 0.06, - - /** - * Constant to identify the Renderer Type. - * - * @static - * @constant - * @property {object} RENDERER_TYPE - * @property {number} RENDERER_TYPE.UNKNOWN - * @property {number} RENDERER_TYPE.WEBGL - * @property {number} RENDERER_TYPE.CANVAS - */ - RENDERER_TYPE: { - UNKNOWN: 0, - WEBGL: 1, - CANVAS: 2 - }, - - /** - * Various blend modes supported by PIXI. IMPORTANT - The WebGL renderer only supports - * the NORMAL, ADD, MULTIPLY and SCREEN blend modes. Anything else will silently act like - * NORMAL. - * - * @static - * @constant - * @property {object} BLEND_MODES - * @property {number} BLEND_MODES.NORMAL - * @property {number} BLEND_MODES.ADD - * @property {number} BLEND_MODES.MULTIPLY - * @property {number} BLEND_MODES.SCREEN - * @property {number} BLEND_MODES.OVERLAY - * @property {number} BLEND_MODES.DARKEN - * @property {number} BLEND_MODES.LIGHTEN - * @property {number} BLEND_MODES.COLOR_DODGE - * @property {number} BLEND_MODES.COLOR_BURN - * @property {number} BLEND_MODES.HARD_LIGHT - * @property {number} BLEND_MODES.SOFT_LIGHT - * @property {number} BLEND_MODES.DIFFERENCE - * @property {number} BLEND_MODES.EXCLUSION - * @property {number} BLEND_MODES.HUE - * @property {number} BLEND_MODES.SATURATION - * @property {number} BLEND_MODES.COLOR - * @property {number} BLEND_MODES.LUMINOSITY - */ - BLEND_MODES: { - NORMAL: 0, - ADD: 1, - MULTIPLY: 2, - SCREEN: 3, - OVERLAY: 4, - DARKEN: 5, - LIGHTEN: 6, - COLOR_DODGE: 7, - COLOR_BURN: 8, - HARD_LIGHT: 9, - SOFT_LIGHT: 10, - DIFFERENCE: 11, - EXCLUSION: 12, - HUE: 13, - SATURATION: 14, - COLOR: 15, - LUMINOSITY: 16 - }, - - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @static - * @constant - * @property {object} DRAW_MODES - * @property {number} DRAW_MODES.POINTS - * @property {number} DRAW_MODES.LINES - * @property {number} DRAW_MODES.LINE_LOOP - * @property {number} DRAW_MODES.LINE_STRIP - * @property {number} DRAW_MODES.TRIANGLES - * @property {number} DRAW_MODES.TRIANGLE_STRIP - * @property {number} DRAW_MODES.TRIANGLE_FAN - */ - DRAW_MODES: { - POINTS: 0, - LINES: 1, - LINE_LOOP: 2, - LINE_STRIP: 3, - TRIANGLES: 4, - TRIANGLE_STRIP: 5, - TRIANGLE_FAN: 6 - }, - - /** - * The scale modes that are supported by pixi. - * - * The DEFAULT scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @static - * @constant - * @property {object} SCALE_MODES - * @property {number} SCALE_MODES.DEFAULT=LINEAR - * @property {number} SCALE_MODES.LINEAR Smooth scaling - * @property {number} SCALE_MODES.NEAREST Pixelating scaling - */ - SCALE_MODES: { - DEFAULT: 0, - LINEAR: 0, - NEAREST: 1 - }, - - /** - * The wrap modes that are supported by pixi. - * - * The DEFAULT wrap mode affects the default wraping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can only use REPEAT if the texture is po2 - * This property only affects WebGL - * @static - * @constant - * @property {object} WRAP_MODES - * @property {number} WRAP_MODES.DEFAULT=CLAMP - * @property {number} WRAP_MODES.CLAMP The textures uvs are clamped - * @property {number} WRAP_MODES.REPEAT The texture uvs tile and repeat - * @property {number} WRAP_MODES.MIRRORED_REPEAT The texture uvs tile and repeat with mirroring - */ - WRAP_MODES: { - DEFAULT: 0, - CLAMP: 0, - REPEAT: 1, - MIRRORED_REPEAT:2 - }, - - /** - * The wrap modes that are supported by pixi. - * * The DEFAULT Garbage Collection mode for pixi textures is MANUAL * If set to DEFAULT, the renderer will occasianally check textures usage. If they are not used for a specified period of time they will be removed from the GPU. * They will of corse be uploaded again when they are required. This is a silent behind the scenes process that should ensure that the GPU does not get filled up. @@ -8051,7 +7775,7 @@ module.exports = CONST; -},{"./utils/maxRecommendedTextures":107}],40:[function(require,module,exports){ +},{"./utils/maxRecommendedTextures":106}],39:[function(require,module,exports){ var math = require('../math'), utils = require('../utils'), DisplayObject = require('./DisplayObject'), @@ -8680,7 +8404,7 @@ this.children = null; }; -},{"../math":60,"../textures/RenderTexture":98,"../utils":106,"./DisplayObject":41}],41:[function(require,module,exports){ +},{"../math":59,"../textures/RenderTexture":97,"../utils":105,"./DisplayObject":40}],40:[function(require,module,exports){ var math = require('../math'), RenderTexture = require('../textures/RenderTexture'), EventEmitter = require('eventemitter3'), @@ -8747,11 +8471,20 @@ * The area the filter is applied to. This is used as more of an optimisation * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * + * Also works as an interaction mask + * * @member {PIXI.Rectangle} */ this.filterArea = null; /** + * Interaction shape. Children will be hit first, then this shape will be checked. + * + * @member {PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle} + */ + this.hitArea = null; + + /** * The original, cached bounds of the object * * @member {PIXI.Rectangle} @@ -9179,7 +8912,7 @@ this.filterArea = null; }; -},{"../math":60,"../textures/RenderTexture":98,"./Transform":43,"eventemitter3":25}],42:[function(require,module,exports){ +},{"../math":59,"../textures/RenderTexture":97,"./Transform":42,"eventemitter3":25}],41:[function(require,module,exports){ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. @@ -9256,7 +8989,7 @@ this.transform._versionLocal++; }; -},{}],43:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ var math = require('../math'), ObservablePoint = require('./ObservablePoint'); @@ -9393,7 +9126,7 @@ module.exports = Transform; -},{"../math":60,"./ObservablePoint":42}],44:[function(require,module,exports){ +},{"../math":59,"./ObservablePoint":41}],43:[function(require,module,exports){ var Container = require('../display/Container'), RenderTexture = require('../textures/RenderTexture'), Texture = require('../textures/Texture'), @@ -10459,7 +10192,7 @@ this._localBounds = null; }; -},{"../const":39,"../display/Container":40,"../math":60,"../renderers/canvas/CanvasRenderer":67,"../renderers/canvas/utils/CanvasRenderTarget":69,"../sprites/Sprite":89,"../textures/RenderTexture":98,"../textures/Texture":99,"./GraphicsData":45,"./utils/bezierCurveTo":47}],45:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../renderers/canvas/CanvasRenderer":66,"../renderers/canvas/utils/CanvasRenderTarget":68,"../sprites/Sprite":88,"../textures/RenderTexture":97,"../textures/Texture":98,"./GraphicsData":44,"./utils/bezierCurveTo":46}],44:[function(require,module,exports){ /** * A GraphicsData object. * @@ -10552,7 +10285,7 @@ this.shape = null; }; -},{}],46:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ var CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'), CONST = require('../../const'); @@ -10831,7 +10564,7 @@ this.renderer = null; }; -},{"../../const":39,"../../renderers/canvas/CanvasRenderer":67}],47:[function(require,module,exports){ +},{"../../const":38,"../../renderers/canvas/CanvasRenderer":66}],46:[function(require,module,exports){ /** * Calculate the points for a bezier curve and then draws it. @@ -10879,7 +10612,7 @@ module.exports = bezierCurveTo; -},{}],48:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ var utils = require('../../utils'), CONST = require('../../const'), ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'), @@ -11100,7 +10833,7 @@ return webGLData; }; -},{"../../const":39,"../../renderers/webgl/WebGLRenderer":74,"../../renderers/webgl/utils/ObjectRenderer":84,"../../utils":106,"./WebGLGraphicsData":49,"./shaders/PrimitiveShader":50,"./utils/buildCircle":51,"./utils/buildPoly":53,"./utils/buildRectangle":54,"./utils/buildRoundedRectangle":55}],49:[function(require,module,exports){ +},{"../../const":38,"../../renderers/webgl/WebGLRenderer":73,"../../renderers/webgl/utils/ObjectRenderer":83,"../../utils":105,"./WebGLGraphicsData":48,"./shaders/PrimitiveShader":49,"./utils/buildCircle":50,"./utils/buildPoly":52,"./utils/buildRectangle":53,"./utils/buildRoundedRectangle":54}],48:[function(require,module,exports){ var glCore = require('pixi-gl-core'); @@ -11225,7 +10958,7 @@ this.glIndices = null; }; -},{"pixi-gl-core":1}],50:[function(require,module,exports){ +},{"pixi-gl-core":1}],49:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -11276,7 +11009,7 @@ module.exports = PrimitiveShader; -},{"pixi-gl-core":1}],51:[function(require,module,exports){ +},{"pixi-gl-core":1}],50:[function(require,module,exports){ var buildLine = require('./buildLine'), CONST = require('../../../const'), utils = require('../../../utils'); @@ -11365,7 +11098,7 @@ module.exports = buildCircle; -},{"../../../const":39,"../../../utils":106,"./buildLine":52}],52:[function(require,module,exports){ +},{"../../../const":38,"../../../utils":105,"./buildLine":51}],51:[function(require,module,exports){ var math = require('../../../math'), utils = require('../../../utils'); @@ -11585,7 +11318,7 @@ }; module.exports = buildLine; -},{"../../../math":60,"../../../utils":106}],53:[function(require,module,exports){ +},{"../../../math":59,"../../../utils":105}],52:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'), earcut = require('earcut'); @@ -11665,7 +11398,7 @@ module.exports = buildPoly; -},{"../../../utils":106,"./buildLine":52,"earcut":24}],54:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51,"earcut":24}],53:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'); @@ -11736,9 +11469,9 @@ }; module.exports = buildRectangle; -},{"../../../utils":106,"./buildLine":52}],55:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51}],54:[function(require,module,exports){ var earcut = require('earcut'), - // buildLine = require('./buildLine'), + buildLine = require('./buildLine'), utils = require('../../../utils'); /** @@ -11760,10 +11493,10 @@ var recPoints = []; recPoints.push(x, y + radius); - this.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints); - this.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints); - this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); - this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); + quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints); + quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints); + quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); + quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. @@ -11806,7 +11539,7 @@ graphicsData.points = recPoints; - this.buildLine(graphicsData, webGLData); + buildLine(graphicsData, webGLData); graphicsData.points = tempPoints; } @@ -11826,47 +11559,47 @@ * @param [out] {number[]} The output array to add points into. If not passed, a new array is created. * @return {number[]} an array of points */ -// var quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out) -// { -// var xa, -// ya, -// xb, -// yb, -// x, -// y, -// n = 20, -// points = out || []; -// -// function getPt(n1 , n2, perc) { -// var diff = n2 - n1; -// -// return n1 + ( diff * perc ); -// } -// -// var j = 0; -// for (var i = 0; i <= n; i++ ) { -// j = i / n; -// -// // The Green Line -// xa = getPt( fromX , cpX , j ); -// ya = getPt( fromY , cpY , j ); -// xb = getPt( cpX , toX , j ); -// yb = getPt( cpY , toY , j ); -// -// // The Black Dot -// x = getPt( xa , xb , j ); -// y = getPt( ya , yb , j ); -// -// points.push(x, y); -// } -// -// return points; -// }; +var quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out) +{ + var xa, + ya, + xb, + yb, + x, + y, + n = 20, + points = out || []; + + function getPt(n1 , n2, perc) { + var diff = n2 - n1; + + return n1 + ( diff * perc ); + } + + var j = 0; + for (var i = 0; i <= n; i++ ) { + j = i / n; + + // The Green Line + xa = getPt( fromX , cpX , j ); + ya = getPt( fromY , cpY , j ); + xb = getPt( cpX , toX , j ); + yb = getPt( cpY , toY , j ); + + // The Black Dot + x = getPt( xa , xb , j ); + y = getPt( ya , yb , j ); + + points.push(x, y); + } + + return points; +}; module.exports = buildRoundedRectangle; -},{"../../../utils":106,"earcut":24}],56:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51,"earcut":24}],55:[function(require,module,exports){ /** * @file Main export of the PIXI core library * @author Mat Groves @@ -11959,7 +11692,7 @@ } }); -},{"./const":39,"./display/Container":40,"./display/DisplayObject":41,"./graphics/Graphics":44,"./graphics/GraphicsData":45,"./graphics/canvas/CanvasGraphicsRenderer":46,"./graphics/webgl/GraphicsRenderer":48,"./math":60,"./renderers/canvas/CanvasRenderer":67,"./renderers/canvas/utils/CanvasRenderTarget":69,"./renderers/webgl/WebGLRenderer":74,"./renderers/webgl/filters/Filter":76,"./renderers/webgl/filters/spriteMask/SpriteMaskFilter":79,"./renderers/webgl/managers/WebGLManager":83,"./renderers/webgl/utils/ObjectRenderer":84,"./renderers/webgl/utils/Quad":85,"./renderers/webgl/utils/RenderTarget":86,"./sprites/Sprite":89,"./sprites/canvas/CanvasSpriteRenderer":90,"./sprites/webgl/SpriteRenderer":93,"./text/Text":95,"./textures/BaseRenderTexture":96,"./textures/BaseTexture":97,"./textures/RenderTexture":98,"./textures/Texture":99,"./textures/TextureUvs":100,"./textures/VideoBaseTexture":101,"./ticker":103,"./utils":106,"pixi-gl-core":1}],57:[function(require,module,exports){ +},{"./const":38,"./display/Container":39,"./display/DisplayObject":40,"./graphics/Graphics":43,"./graphics/GraphicsData":44,"./graphics/canvas/CanvasGraphicsRenderer":45,"./graphics/webgl/GraphicsRenderer":47,"./math":59,"./renderers/canvas/CanvasRenderer":66,"./renderers/canvas/utils/CanvasRenderTarget":68,"./renderers/webgl/WebGLRenderer":73,"./renderers/webgl/filters/Filter":75,"./renderers/webgl/filters/spriteMask/SpriteMaskFilter":78,"./renderers/webgl/managers/WebGLManager":82,"./renderers/webgl/utils/ObjectRenderer":83,"./renderers/webgl/utils/Quad":84,"./renderers/webgl/utils/RenderTarget":85,"./sprites/Sprite":88,"./sprites/canvas/CanvasSpriteRenderer":89,"./sprites/webgl/SpriteRenderer":92,"./text/Text":94,"./textures/BaseRenderTexture":95,"./textures/BaseTexture":96,"./textures/RenderTexture":97,"./textures/Texture":98,"./textures/TextureUvs":99,"./textures/VideoBaseTexture":100,"./ticker":102,"./utils":105,"pixi-gl-core":1}],56:[function(require,module,exports){ // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group of order 16 var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; @@ -12123,7 +11856,7 @@ module.exports = GroupD8; -},{"./Matrix":58}],58:[function(require,module,exports){ +},{"./Matrix":57}],57:[function(require,module,exports){ // @todo - ignore the too many parameters warning for now // should either fix it or change the jshint config // jshint -W072 @@ -12564,7 +12297,7 @@ */ Matrix.TEMP_MATRIX = new Matrix(); -},{"./Point":59}],59:[function(require,module,exports){ +},{"./Point":58}],58:[function(require,module,exports){ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. @@ -12634,7 +12367,7 @@ this.y = y || ( (y !== 0) ? this.x : 0 ) ; }; -},{}],60:[function(require,module,exports){ +},{}],59:[function(require,module,exports){ /** * Math classes and utilities mixed into PIXI namespace. * @@ -12657,7 +12390,7 @@ RoundedRectangle: require('./shapes/RoundedRectangle') }; -},{"./GroupD8":57,"./Matrix":58,"./Point":59,"./shapes/Circle":61,"./shapes/Ellipse":62,"./shapes/Polygon":63,"./shapes/Rectangle":64,"./shapes/RoundedRectangle":65}],61:[function(require,module,exports){ +},{"./GroupD8":56,"./Matrix":57,"./Point":58,"./shapes/Circle":60,"./shapes/Ellipse":61,"./shapes/Polygon":62,"./shapes/Rectangle":63,"./shapes/RoundedRectangle":64}],60:[function(require,module,exports){ var Rectangle = require('./Rectangle'), CONST = require('../../const'); @@ -12745,7 +12478,7 @@ return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); }; -},{"../../const":39,"./Rectangle":64}],62:[function(require,module,exports){ +},{"../../const":38,"./Rectangle":63}],61:[function(require,module,exports){ var Rectangle = require('./Rectangle'), CONST = require('../../const'); @@ -12840,7 +12573,7 @@ return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); }; -},{"../../const":39,"./Rectangle":64}],63:[function(require,module,exports){ +},{"../../const":38,"./Rectangle":63}],62:[function(require,module,exports){ var Point = require('../Point'), CONST = require('../../const'); @@ -12943,7 +12676,7 @@ return inside; }; -},{"../../const":39,"../Point":59}],64:[function(require,module,exports){ +},{"../../const":38,"../Point":58}],63:[function(require,module,exports){ var CONST = require('../../const'); /** @@ -13109,7 +12842,7 @@ this.height = y2 - y1; }; -},{"../../const":39}],65:[function(require,module,exports){ +},{"../../const":38}],64:[function(require,module,exports){ var CONST = require('../../const'); /** @@ -13201,7 +12934,7 @@ return false; }; -},{"../../const":39}],66:[function(require,module,exports){ +},{"../../const":38}],65:[function(require,module,exports){ var utils = require('../utils'), math = require('../math'), CONST = require('../const'), @@ -13491,7 +13224,7 @@ this._lastObjectRendered = null; }; -},{"../const":39,"../display/Container":40,"../math":60,"../textures/RenderTexture":98,"../utils":106,"eventemitter3":25}],67:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../textures/RenderTexture":97,"../utils":105,"eventemitter3":25}],66:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), CanvasMaskManager = require('./utils/CanvasMaskManager'), CanvasRenderTarget = require('./utils/CanvasRenderTarget'), @@ -13746,7 +13479,7 @@ }; -},{"../../const":39,"../../utils":106,"../SystemRenderer":66,"./utils/CanvasMaskManager":68,"./utils/CanvasRenderTarget":69,"./utils/mapCanvasBlendModesToPixi":71}],68:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"../SystemRenderer":65,"./utils/CanvasMaskManager":67,"./utils/CanvasRenderTarget":68,"./utils/mapCanvasBlendModesToPixi":70}],67:[function(require,module,exports){ var CONST = require('../../../const'); /** * A set of functions used to handle masking. @@ -13909,7 +13642,7 @@ CanvasMaskManager.prototype.destroy = function () {}; -},{"../../../const":39}],69:[function(require,module,exports){ +},{"../../../const":38}],68:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -14013,7 +13746,7 @@ this.canvas = null; }; -},{"../../../const":39}],70:[function(require,module,exports){ +},{"../../../const":38}],69:[function(require,module,exports){ /** * Checks whether the Canvas BlendModes are supported by the current browser @@ -14052,8 +13785,8 @@ module.exports = canUseNewCanvasBlendModes; -},{}],71:[function(require,module,exports){ -var CONST = require('../../../Const'), +},{}],70:[function(require,module,exports){ +var CONST = require('../../../const'), canUseNewCanvasBlendModes = require('./canUseNewCanvasBlendModes'); /** @@ -14112,7 +13845,7 @@ module.exports = mapWebGLBlendModesToPixi; -},{"../../../Const":38,"./canUseNewCanvasBlendModes":70}],72:[function(require,module,exports){ +},{"../../../const":38,"./canUseNewCanvasBlendModes":69}],71:[function(require,module,exports){ var CONST = require('../../const'); @@ -14188,7 +13921,7 @@ } }; -},{"../../const":39}],73:[function(require,module,exports){ +},{"../../const":38}],72:[function(require,module,exports){ var GLTexture = require('pixi-gl-core').GLTexture, CONST = require('../../const'), RenderTarget = require('./utils/RenderTarget'), @@ -14394,7 +14127,7 @@ module.exports = TextureManager; -},{"../../const":39,"../../utils":106,"./utils/RenderTarget":86,"pixi-gl-core":1}],74:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"./utils/RenderTarget":85,"pixi-gl-core":1}],73:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), MaskManager = require('./managers/MaskManager'), StencilManager = require('./managers/StencilManager'), @@ -14946,7 +14679,7 @@ // this = null; }; -},{"../../const":39,"../../utils":106,"../SystemRenderer":66,"./TextureGarbageCollector":72,"./TextureManager":73,"./WebGLState":75,"./managers/FilterManager":80,"./managers/MaskManager":81,"./managers/StencilManager":82,"./utils/ObjectRenderer":84,"./utils/RenderTarget":86,"./utils/mapWebGLDrawModesToPixi":88,"pixi-gl-core":1}],75:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"../SystemRenderer":65,"./TextureGarbageCollector":71,"./TextureManager":72,"./WebGLState":74,"./managers/FilterManager":79,"./managers/MaskManager":80,"./managers/StencilManager":81,"./utils/ObjectRenderer":83,"./utils/RenderTarget":85,"./utils/mapWebGLDrawModesToPixi":87,"pixi-gl-core":1}],74:[function(require,module,exports){ var mapWebGLBlendModesToPixi = require('./utils/mapWebGLBlendModesToPixi'); @@ -15216,7 +14949,7 @@ module.exports = WebGLState; -},{"./utils/mapWebGLBlendModesToPixi":87}],76:[function(require,module,exports){ +},{"./utils/mapWebGLBlendModesToPixi":86}],75:[function(require,module,exports){ var extractUniformsFromSrc = require('./extractUniformsFromSrc'); // var math = require('../../../math'); /** @@ -15344,7 +15077,7 @@ '}' ].join('\n'); -},{"./extractUniformsFromSrc":77}],77:[function(require,module,exports){ +},{"./extractUniformsFromSrc":76}],76:[function(require,module,exports){ var defaultValue = require('pixi-gl-core/lib/shader/defaultValue'); var mapSize = require('pixi-gl-core/lib/shader/mapSize'); @@ -15407,7 +15140,7 @@ module.exports = extractUniformsFromSrc; -},{"pixi-gl-core/lib/shader/defaultValue":10,"pixi-gl-core/lib/shader/mapSize":14}],78:[function(require,module,exports){ +},{"pixi-gl-core/lib/shader/defaultValue":10,"pixi-gl-core/lib/shader/mapSize":14}],77:[function(require,module,exports){ var math = require('../../../math'); /* @@ -15516,7 +15249,7 @@ calculateSpriteMatrix:calculateSpriteMatrix }; -},{"../../../math":60}],79:[function(require,module,exports){ +},{"../../../math":59}],78:[function(require,module,exports){ var Filter = require('../Filter'), math = require('../../../../math'); @@ -15567,7 +15300,7 @@ filterManager.applyFilter(this, input, output); }; -},{"../../../../math":60,"../Filter":76}],80:[function(require,module,exports){ +},{"../../../../math":59,"../Filter":75}],79:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'), RenderTarget = require('../utils/RenderTarget'), @@ -15911,7 +15644,7 @@ FilterManager.pool[key].push(renderTarget); }; -},{"../../../math":60,"../filters/filterTransforms":78,"../utils/Quad":85,"../utils/RenderTarget":86,"./WebGLManager":83,"bit-twiddle":16,"pixi-gl-core":1}],81:[function(require,module,exports){ +},{"../../../math":59,"../filters/filterTransforms":77,"../utils/Quad":84,"../utils/RenderTarget":85,"./WebGLManager":82,"bit-twiddle":16,"pixi-gl-core":1}],80:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'), AlphaMaskFilter = require('../filters/spriteMask/SpriteMaskFilter'); @@ -16090,7 +15823,7 @@ gl.disable(gl.SCISSOR_TEST); }; -},{"../filters/spriteMask/SpriteMaskFilter":79,"./WebGLManager":83}],82:[function(require,module,exports){ +},{"../filters/spriteMask/SpriteMaskFilter":78,"./WebGLManager":82}],81:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'); /** @@ -16206,7 +15939,7 @@ this.stencilMaskStack.stencilStack = null; }; -},{"./WebGLManager":83}],83:[function(require,module,exports){ +},{"./WebGLManager":82}],82:[function(require,module,exports){ /** * @class * @memberof PIXI @@ -16247,7 +15980,7 @@ this.renderer = null; }; -},{}],84:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ var WebGLManager = require('../managers/WebGLManager'); /** @@ -16305,7 +16038,7 @@ // render the object }; -},{"../managers/WebGLManager":83}],85:[function(require,module,exports){ +},{"../managers/WebGLManager":82}],84:[function(require,module,exports){ var glCore = require('pixi-gl-core'), createIndicesForQuads = require('../../../utils/createIndicesForQuads'); @@ -16477,7 +16210,7 @@ module.exports = Quad; -},{"../../../utils/createIndicesForQuads":104,"pixi-gl-core":1}],86:[function(require,module,exports){ +},{"../../../utils/createIndicesForQuads":103,"pixi-gl-core":1}],85:[function(require,module,exports){ var math = require('../../../math'), CONST = require('../../../const'), GLTexture = require('pixi-gl-core').GLTexture, @@ -16804,7 +16537,7 @@ this.texture = null; }; -},{"../../../const":39,"../../../math":60,"pixi-gl-core":1}],87:[function(require,module,exports){ +},{"../../../const":38,"../../../math":59,"pixi-gl-core":1}],86:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -16841,7 +16574,7 @@ module.exports = mapWebGLBlendModesToPixi; -},{"../../../const":39}],88:[function(require,module,exports){ +},{"../../../const":38}],87:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -16865,7 +16598,7 @@ module.exports = mapWebGLDrawModesToPixi; -},{"../../../const":39}],89:[function(require,module,exports){ +},{"../../../const":38}],88:[function(require,module,exports){ var math = require('../math'), Texture = require('../textures/Texture'), Container = require('../display/Container'), @@ -17345,11 +17078,11 @@ return new Sprite(Texture.fromImage(imageId, crossorigin, scaleMode)); }; -},{"../const":39,"../display/Container":40,"../math":60,"../textures/Texture":99,"../utils":106}],90:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../textures/Texture":98,"../utils":105}],89:[function(require,module,exports){ var CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'), CONST = require('../../const'), math = require('../../math'), - canvasRenderWorldTransform = new math.Matrix(); + canvasRenderWorldTransform = new math.Matrix(), CanvasTinter = require('./CanvasTinter'); /** @@ -17511,7 +17244,7 @@ this.renderer = null; }; -},{"../../const":39,"../../math":60,"../../renderers/canvas/CanvasRenderer":67,"./CanvasTinter":91}],91:[function(require,module,exports){ +},{"../../const":38,"../../math":59,"../../renderers/canvas/CanvasRenderer":66,"./CanvasTinter":90}],90:[function(require,module,exports){ var utils = require('../../utils'), canUseNewCanvasBlendModes = require('../../renderers/canvas/utils/canUseNewCanvasBlendModes'); /** @@ -17744,7 +17477,7 @@ */ CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -},{"../../renderers/canvas/utils/canUseNewCanvasBlendModes":70,"../../utils":106}],92:[function(require,module,exports){ +},{"../../renderers/canvas/utils/canUseNewCanvasBlendModes":69,"../../utils":105}],91:[function(require,module,exports){ var Buffer = function(size) @@ -17775,7 +17508,7 @@ this.uvs = null; this.colors = null; }; -},{}],93:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ var ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'), WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'), createIndicesForQuads = require('../../utils/createIndicesForQuads'), @@ -18129,7 +17862,7 @@ }; -},{"../../const":39,"../../renderers/webgl/WebGLRenderer":74,"../../renderers/webgl/utils/ObjectRenderer":84,"../../utils/createIndicesForQuads":104,"./BatchBuffer":92,"./generateMultiTextureShader":94,"bit-twiddle":16,"pixi-gl-core":1}],94:[function(require,module,exports){ +},{"../../const":38,"../../renderers/webgl/WebGLRenderer":73,"../../renderers/webgl/utils/ObjectRenderer":83,"../../utils/createIndicesForQuads":103,"./BatchBuffer":91,"./generateMultiTextureShader":93,"bit-twiddle":16,"pixi-gl-core":1}],93:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; var fragTemplate = [ @@ -18203,7 +17936,7 @@ module.exports = generateMultiTextureShader; -},{"pixi-gl-core":1}],95:[function(require,module,exports){ +},{"pixi-gl-core":1}],94:[function(require,module,exports){ var Sprite = require('../sprites/Sprite'), Texture = require('../textures/Texture'), math = require('../math'), @@ -18827,11 +18560,10 @@ this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture); }; -},{"../const":39,"../math":60,"../sprites/Sprite":89,"../textures/Texture":99,"../utils":106}],96:[function(require,module,exports){ +},{"../const":38,"../math":59,"../sprites/Sprite":88,"../textures/Texture":98,"../utils":105}],95:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), math = require('../math'), - CONST = require('../const'), - tempRect = new math.Rectangle(); + CONST = require('../const'); /** * A BaseRenderTexture is a special texture that allows any Pixi display object to be rendered to it. @@ -18863,15 +18595,17 @@ * * doc.addChild(sprite); * - * BaserenderTexture.render(doc); // Renders to center of BaserenderTexture + * var baseRenderTexture = new PIXI.BaserenderTexture(100, 100); + * var renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(doc, renderTexture); // Renders to center of RenderTexture * ``` * * @class - * @extends PIXI.Texture + * @extends PIXI.BaseTexture * @memberof PIXI - * @param renderer {PIXI.CanvasRenderer|PIXI.WebGLRenderer} The renderer used for this BaseRenderTexture - * @param [width=100] {number} The width of the render texture - * @param [height=100] {number} The height of the render texture + * @param [width=100] {number} The width of the base render texture + * @param [height=100] {number} The height of the base render texture * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @param [resolution=1] {number} The resolution of the texture being generated */ @@ -18886,15 +18620,21 @@ this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT; this.hasLoaded = true; + /** + * A map of renderer IDs to webgl renderTargets + * + * @member {object} + * @private + */ this._glRenderTargets = []; - this._canvasRenderTarget = null; - /** - * The renderer this BaseRenderTexture uses. A BaseRenderTexture can only belong to one renderer at the moment if its webGL. + * A reference to the canvas render target (we only need one as this can be shared accross renderers) * - * @member {PIXI.CanvasRenderer|PIXI.WebGLRenderer} + * @member {object} + * @private */ + this._canvasRenderTarget = null; /** * @member {boolean} @@ -18958,153 +18698,8 @@ this.renderer = null; }; -/** - * Will return a HTML Image of the texture - * - * @return {Image} - */ -BaseRenderTexture.prototype.getImage = function (frame) -{ - var image = new Image(); - image.src = this.getBase64(frame); - return image; -}; -/** - * Will return a a base64 encoded string of this texture. It works by calling BaseRenderTexture.getCanvas and then running toDataURL on that. - * - * @return {string} A base64 encoded string of the texture. - */ -BaseRenderTexture.prototype.getBase64 = function ( frame ) -{ - return this.getCanvas(frame).toDataURL(); -}; - -/** - * Creates a Canvas element, renders this BaseRenderTexture to it and then returns it. - * - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ -BaseRenderTexture.prototype.getCanvas = function ( frame ) -{ - - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.size.width; - frame.height = this.textureBuffer.size.height; - } - - var width = frame.width * this.resolution; - var height = frame.height * this.resolution; - - var gl = this.renderer.gl; - - var webGLPixels = new Uint8Array(4 * width * height); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - gl.readPixels(frame.x * this.resolution, frame.y * this.resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - var tempCanvas = new CanvasBuffer(width, height); - var canvasData = tempCanvas.context.getImageData(0, 0, width, height); - canvasData.data.set(webGLPixels); - - tempCanvas.context.putImageData(canvasData, 0, 0); - - return tempCanvas.canvas; - } - else - { - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.canvas.width; - frame.height = this.textureBuffer.canvas.height; - } - - if(frame.width === this.textureBuffer.canvas.width && - frame.height === this.textureBuffer.canvas.height ) - { - return this.textureBuffer.canvas; - } - else - { - - var resolution = this.resolution; - - var tempCanvas2 = new CanvasBuffer(frame.width * resolution, frame.height * resolution); - var canvasData2 = this.textureBuffer.context.getImageData(frame.x * resolution, frame.y * resolution, frame.width * resolution, frame.height * resolution); - - tempCanvas2.context.putImageData(canvasData2, 0, 0); - - return tempCanvas2.canvas; - } - } -}; - -/** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * - * @return {Uint8ClampedArray} - */ -BaseRenderTexture.prototype.getPixels = function ( frame ) -{ - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.size.width; - frame.height = this.textureBuffer.size.height; - } - - var width = frame.width * this.resolution; - var height = frame.height * this.resolution; - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - var gl = this.renderer.gl; - - var webGLPixels = new Uint8Array(4 * width * height); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - gl.readPixels(frame.x * this.resolution, frame.y * this.resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - return webGLPixels; - } - else - { - return this.textureBuffer.canvas.getContext('2d').getImageData(frame.x * this.resolution, frame.y * this.resolution, width, height).data; - } -}; - -/** - * 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). - * - * @param x {number} The x coordinate of the pixel to retrieve. - * @param y {number} The y coordinate of the pixel to retrieve. - * @return {Uint8ClampedArray} - */ -BaseRenderTexture.prototype.getPixel = function (frame, x, y) -{ - tempRect.x = x; - tempRect.y = y; - tempRect.width = 1 / this.resolution; - tempRect.height = 1 / this.resolution; - - if(frame) - { - tempRect.x += frame.x; - tempRect.y += frame.y; - } - - return this.getPixels(tempRect); -}; - -},{"../const":39,"../math":60,"./BaseTexture":97}],97:[function(require,module,exports){ +},{"../const":38,"../math":59,"./BaseTexture":96}],96:[function(require,module,exports){ var utils = require('../utils'), CONST = require('../const'), EventEmitter = require('eventemitter3'), @@ -19553,7 +19148,7 @@ return baseTexture; }; -},{"../const":39,"../utils":106,"../utils/determineCrossOrigin":105,"bit-twiddle":16,"eventemitter3":25}],98:[function(require,module,exports){ +},{"../const":38,"../utils":105,"../utils/determineCrossOrigin":104,"bit-twiddle":16,"eventemitter3":25}],97:[function(require,module,exports){ var BaseRenderTexture = require('./BaseRenderTexture'), Texture = require('./Texture'); @@ -19568,7 +19163,7 @@ * * ```js * var renderer = PIXI.autoDetectRenderer(1024, 1024, { view: canvas, ratio: 1 }); - * var renderTexture = new PIXI.RenderTexture(renderer, 800, 600); + * var renderTexture = PIXI.RenderTexture.create(800, 600); * var sprite = PIXI.Sprite.fromImage("spinObj_01.png"); * * sprite.position.x = 800/2; @@ -19576,7 +19171,7 @@ * sprite.anchor.x = 0.5; * sprite.anchor.y = 0.5; * - * renderTexture.render(sprite); + * renderer.render(sprite, renderTexture); * ``` * * The Sprite in this case will be rendered to a position of 0,0. To render this sprite at its actual @@ -19587,17 +19182,13 @@ * * doc.addChild(sprite); * - * renderTexture.render(doc); // Renders to center of renderTexture + * renderer.render(doc, renderTexture); // Renders to center of renderTexture * ``` * * @class * @extends PIXI.Texture * @memberof PIXI - * @param renderer {PIXI.CanvasRenderer|PIXI.WebGLRenderer} The renderer used for this RenderTexture - * @param [width=100] {number} The width of the render texture - * @param [height=100] {number} The height of the render texture - * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values - * @param [resolution=1] {number} The resolution of the texture being generated + * @param baseRenderTexture {PIXI.BaseRenderTexture} The renderer used for this RenderTexture */ function RenderTexture(baseRenderTexture, frame) { @@ -19608,17 +19199,18 @@ { var width = arguments[1]; var height = arguments[2]; + var scaleMode = arguments[3] || 0; + var resolution = arguments[4] || 1; // we have an old render texture.. console.warn('v4 RenderTexture now expects a new BaseRenderTexture. Please use RenderTexture.create('+width+', '+height+')'); this.legacyRenderer = arguments[0]; frame = null; - baseRenderTexture = new BaseRenderTexture(width, height, 0, 1); - + baseRenderTexture = new BaseRenderTexture(width, height, scaleMode, resolution); } - + /** * The base texture object that this texture uses * @@ -19665,13 +19257,19 @@ this._updateUvs(); }; - +/** + * A short hand way of creating a render texture.. + * @param [width=100] {number} The width of the render texture + * @param [height=100] {number} The height of the render texture + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [resolution=1] {number} The resolution of the texture being generated + */ RenderTexture.create = function(width, height, scaleMode, resolution) { return new RenderTexture(new BaseRenderTexture(width, height, scaleMode, resolution)); }; -},{"./BaseRenderTexture":96,"./Texture":99}],99:[function(require,module,exports){ +},{"./BaseRenderTexture":95,"./Texture":98}],98:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), VideoBaseTexture = require('./VideoBaseTexture'), TextureUvs = require('./TextureUvs'), @@ -20103,7 +19701,7 @@ if (!texture) { // check if its a video.. - var isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) != null; + var isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) !== null; if(isVideo) { return Texture.fromVideoUrl(source); @@ -20166,7 +19764,7 @@ */ Texture.EMPTY = new Texture(new BaseTexture()); -},{"../math":60,"../utils":106,"./BaseTexture":97,"./TextureUvs":100,"./VideoBaseTexture":101,"eventemitter3":25}],100:[function(require,module,exports){ +},{"../math":59,"../utils":105,"./BaseTexture":96,"./TextureUvs":99,"./VideoBaseTexture":100,"eventemitter3":25}],99:[function(require,module,exports){ /** * A standard object to store the Uvs of a texture @@ -20256,7 +19854,7 @@ this.uvs_uint32[3] = (((this.y3 * 65535) & 0xFFFF) << 16) | ((this.x3 * 65535) & 0xFFFF); }; -},{"../math/GroupD8":57}],101:[function(require,module,exports){ +},{"../math/GroupD8":56}],100:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), utils = require('../utils'); @@ -20493,7 +20091,7 @@ return source; } -},{"../utils":106,"./BaseTexture":97}],102:[function(require,module,exports){ +},{"../utils":105,"./BaseTexture":96}],101:[function(require,module,exports){ var CONST = require('../const'), EventEmitter = require('eventemitter3'), // Internal event used by composed emitter @@ -20848,7 +20446,7 @@ module.exports = Ticker; -},{"../const":39,"eventemitter3":25}],103:[function(require,module,exports){ +},{"../const":38,"eventemitter3":25}],102:[function(require,module,exports){ var Ticker = require('./Ticker'); /** @@ -20904,7 +20502,7 @@ Ticker: Ticker }; -},{"./Ticker":102}],104:[function(require,module,exports){ +},{"./Ticker":101}],103:[function(require,module,exports){ /** * Generic Mask Stack data structure * @class @@ -20935,7 +20533,7 @@ module.exports = createIndicesForQuads; -},{}],105:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ var tempAnchor; var _url = require('url'); @@ -20979,7 +20577,7 @@ }; module.exports = determineCrossOrigin; -},{"url":23}],106:[function(require,module,exports){ +},{"url":23}],105:[function(require,module,exports){ var CONST = require('../const'); /** @@ -21182,7 +20780,7 @@ BaseTextureCache: {} }; -},{"../const":39,"./pluginTarget":108,"eventemitter3":25}],107:[function(require,module,exports){ +},{"../const":38,"./pluginTarget":107,"eventemitter3":25}],106:[function(require,module,exports){ var Device = require('ismobilejs'); @@ -21203,7 +20801,7 @@ } module.exports = maxRecommendedTextures; -},{"ismobilejs":26}],108:[function(require,module,exports){ +},{"ismobilejs":26}],107:[function(require,module,exports){ /** * Mixins functionality to make an object have "plugins". * @@ -21273,10 +20871,11 @@ } }; -},{}],109:[function(require,module,exports){ +},{}],108:[function(require,module,exports){ /*global console */ var core = require('./core'), mesh = require('./mesh'), + particles = require('./particles'), extras = require('./extras'), filters = require('./filters'); @@ -21377,6 +20976,21 @@ /** * @class * @private + * @name ParticleContainer + * @memberof PIXI + * @see PIXI.particles.ParticleContainer + * @deprecated since version 4.0.0 + */ + ParticleContainer: { + get: function() { + console.warn('The ParticleContainer class has been moved to particles.ParticleContainer, please useparticles.ParticleContainer from now on.'); + return particles.ParticleContainer; + } + }, + + /** + * @class + * @private * @name MovieClip * @memberof PIXI * @see PIXI.extras.MovieClip @@ -21647,7 +21261,336 @@ return core.utils.uid(); }; -},{"./core":56,"./extras":116,"./filters":128,"./mesh":143}],110:[function(require,module,exports){ +},{"./core":55,"./extras":118,"./filters":130,"./mesh":145,"./particles":148}],109:[function(require,module,exports){ +var core = require('../../core'); +tempRect = new core.Rectangle(); + +/** + * The extract manager provides functionality to export content from the renderers + * @class + * @memberof PIXI + * @param renderer {PIXI.WebGLRenderer} A reference to the current renderer + */ +function WebGLExtract(renderer) +{ + this.renderer = renderer; + renderer.extract = this; +} + + +WebGLExtract.prototype.constructor = WebGLExtract; +module.exports = WebGLExtract; + +/** + * Will return a HTML Image of the target + * + * @return {Image} + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + */ +WebGLExtract.prototype.image = function ( target ) +{ + var image = new Image(); + image.src = this.base64( target ); + return image; +} + +/** + * Will return a a base64 encoded string of this target. It works by calling WebGLExtract.getCanvas and then running toDataURL on that. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ +WebGLExtract.prototype.base64 = function ( target ) +{ + return this.canvas( target ).toDataURL(); +}; + +/** + * Creates a Canvas element, renders this target to it and then returns it. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ +WebGLExtract.prototype.canvas = function ( target ) +{ + var renderer = this.renderer; + var context; + var resolution; + var frame; + var renderTexture; + + if(target) + { + if(target instanceof core.RenderTexture) + { + renderTexture = target; + } + else + { + renderTexture = this.renderer.generateTexture(target); + } + } + + if(renderTexture) + { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } + else + { + context = this.renderer.rootContext; + resolution = this.renderer.rootResolution; + + frame = tempRect; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + } + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var canvasBuffer = new core.CanvasRenderTarget(width, height); + var canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height); + canvasBuffer.context.putImageData(canvasData, 0, 0); + + + // send the canvas back.. + return canvasBuffer.canvas; +}; + +/** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} + */ +WebGLExtract.prototype.pixels = function ( renderTexture ) +{ + var renderer = this.renderer; + var context; + var resolution; + + if(renderTexture) + { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } + else + { + context = this.renderer.rootContext; + resolution = this.renderer.rootResolution; + + frame = tempRect; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + } + + return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data; +}; + +/** + * Destroys the extract + * + */ +WebGLExtract.prototype.destroy = function () +{ + this.renderer.extract = null; + this.renderer = null; +}; + +core.CanvasRenderer.registerPlugin('extract', WebGLExtract); + +},{"../../core":55}],110:[function(require,module,exports){ + +module.exports = { + webGL: require('./webgl/WebGLExtract'), + canvas: require('./canvas/CanvasExtract') +} +},{"./canvas/CanvasExtract":109,"./webgl/WebGLExtract":111}],111:[function(require,module,exports){ +var core = require('../../core'); +tempRect = new core.Rectangle(); + +/** + * The extract manager provides functionality to export content from the renderers + * @class + * @memberof PIXI + * @param renderer {PIXI.CanvasRenderer} A reference to the current renderer + */ +function Extract(renderer) +{ + this.renderer = renderer; + renderer.extract = this; +} + + +Extract.prototype.constructor = Extract; +module.exports = Extract; + +/** + * Will return a HTML Image of the target + * + * @return {Image} + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + */ +Extract.prototype.image = function ( target ) +{ + var image = new Image(); + image.src = this.base64( target ); + return image; +} + +/** + * Will return a a base64 encoded string of this target. It works by calling WebGLExtract.getCanvas and then running toDataURL on that. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ +Extract.prototype.base64 = function ( target ) +{ + return this.canvas( target ).toDataURL(); +}; + +/** + * Creates a Canvas element, renders this target to it and then returns it. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ +Extract.prototype.canvas = function ( target ) +{ + var renderer = this.renderer; + var textureBuffer; + var resolution; + var frame; + var flipY = false; + var renderTexture; + + if(target) + { + if(target instanceof core.RenderTexture) + { + renderTexture = target; + } + else + { + renderTexture = this.renderer.generateTexture(target); + + } + } + + if(renderTexture) + { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + flipY = false; + } + else + { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + flipY = true; + + frame = tempRect; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + + } + + + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var canvasBuffer = new core.CanvasRenderTarget(width, height); + + if(textureBuffer) + { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + + // set up an array of pixels + var webGLPixels = new Uint8Array(4 * width * height); + + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); + + // add the pixels to the canvas + var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); + canvasData.data.set(webGLPixels); + + canvasBuffer.context.putImageData(canvasData, 0, 0); + + // pulling pixels + if(flipY) + { + canvasBuffer.context.scale(1, -1); + canvasBuffer.context.drawImage(canvasBuffer.canvas, 0,-height); + } + } + + // send the canvas back.. + return canvasBuffer.canvas; +}; + +/** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} + */ +Extract.prototype.pixels = function ( renderTexture, area ) +{ + var renderer = this.renderer; + var textureBuffer; + var resolution; + + if(renderTexture) + { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + + } + else + { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + + frame = tempRect; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + } + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var gl = this.renderer.gl; + + var webGLPixels = new Uint8Array(4 * width * height); + + if(textureBuffer) + { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); + } + + return webGLPixels; +}; + +/** + * Destroys the extract + * + */ +Extract.prototype.destroy = function () +{ + this.renderer.extract = null; + this.renderer = null; +}; + +core.WebGLRenderer.registerPlugin('extract', Extract); + +},{"../../core":55}],112:[function(require,module,exports){ var core = require('../core'); /** @@ -22035,7 +21978,7 @@ BitmapText.fonts = {}; -},{"../core":56}],111:[function(require,module,exports){ +},{"../core":55}],113:[function(require,module,exports){ var core = require('../core'); /** @@ -22355,7 +22298,7 @@ return new MovieClip(textures); }; -},{"../core":56}],112:[function(require,module,exports){ +},{"../core":55}],114:[function(require,module,exports){ var core = require('../core'), // a sprite use dfor rendering textures.. tempPoint = new core.Point(), @@ -22787,7 +22730,7 @@ return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); }; -},{"../core":56,"../core/sprites/canvas/CanvasTinter":91,"./webgl/TilingShader":117}],113:[function(require,module,exports){ +},{"../core":55,"../core/sprites/canvas/CanvasTinter":90,"./webgl/TilingShader":119}],115:[function(require,module,exports){ var core = require('../core'), DisplayObject = core.DisplayObject, _tempMatrix = new core.Matrix(); @@ -23063,7 +23006,7 @@ this._originalDestroy(); }; -},{"../core":56}],114:[function(require,module,exports){ +},{"../core":55}],116:[function(require,module,exports){ var core = require('../core'); /** @@ -23093,7 +23036,7 @@ return null; }; -},{"../core":56}],115:[function(require,module,exports){ +},{"../core":55}],117:[function(require,module,exports){ var core = require('../core'); /** @@ -23123,7 +23066,7 @@ return point; }; -},{"../core":56}],116:[function(require,module,exports){ +},{"../core":55}],118:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -23144,7 +23087,7 @@ BitmapText: require('./BitmapText') }; -},{"./BitmapText":110,"./MovieClip":111,"./TilingSprite":112,"./cacheAsBitmap":113,"./getChildByName":114,"./getGlobalPosition":115}],117:[function(require,module,exports){ +},{"./BitmapText":112,"./MovieClip":113,"./TilingSprite":114,"./cacheAsBitmap":115,"./getChildByName":116,"./getGlobalPosition":117}],119:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; @@ -23168,7 +23111,7 @@ module.exports = TilingShader; -},{"pixi-gl-core":1}],118:[function(require,module,exports){ +},{"pixi-gl-core":1}],120:[function(require,module,exports){ var core = require('../../core'), BlurXFilter = require('./BlurXFilter'), BlurYFilter = require('./BlurYFilter'); @@ -23284,7 +23227,7 @@ } }); -},{"../../core":56,"./BlurXFilter":119,"./BlurYFilter":120}],119:[function(require,module,exports){ +},{"../../core":55,"./BlurXFilter":121,"./BlurYFilter":122}],121:[function(require,module,exports){ var core = require('../../core'); var generateBlurVertSource = require('./generateBlurVertSource'); var generateBlurFragSource = require('./generateBlurFragSource'); @@ -23392,7 +23335,7 @@ } }); -},{"../../core":56,"./generateBlurFragSource":121,"./generateBlurVertSource":122,"./getMaxBlurKernelSize":123}],120:[function(require,module,exports){ +},{"../../core":55,"./generateBlurFragSource":123,"./generateBlurVertSource":124,"./getMaxBlurKernelSize":125}],122:[function(require,module,exports){ var core = require('../../core'); var generateBlurVertSource = require('./generateBlurVertSource'); var generateBlurFragSource = require('./generateBlurFragSource'); @@ -23490,7 +23433,7 @@ } }); -},{"../../core":56,"./generateBlurFragSource":121,"./generateBlurVertSource":122,"./getMaxBlurKernelSize":123}],121:[function(require,module,exports){ +},{"../../core":55,"./generateBlurFragSource":123,"./generateBlurVertSource":124,"./getMaxBlurKernelSize":125}],123:[function(require,module,exports){ var GAUSSIAN_VALUES = { 5:[0.153388, 0.221461, 0.250301], 7:[0.071303, 0.131514, 0.189879, 0.214607], @@ -23555,7 +23498,7 @@ module.exports = generateFragBlurSource; -},{}],122:[function(require,module,exports){ +},{}],124:[function(require,module,exports){ var vertTemplate = [ 'attribute vec2 aVertexPosition;', @@ -23621,7 +23564,7 @@ module.exports = generateVertBlurSource; -},{}],123:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ var getMaxKernelSize = function(gl) @@ -23639,7 +23582,7 @@ module.exports = getMaxKernelSize; -},{}],124:[function(require,module,exports){ +},{}],126:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 @@ -24173,7 +24116,7 @@ } }); -},{"../../core":56}],125:[function(require,module,exports){ +},{"../../core":55}],127:[function(require,module,exports){ var core = require('../../core'); @@ -24252,7 +24195,7 @@ } }); -},{"../../core":56}],126:[function(require,module,exports){ +},{"../../core":55}],128:[function(require,module,exports){ var core = require('../../core'); @@ -24345,7 +24288,7 @@ } }); -},{"../../core":56}],127:[function(require,module,exports){ +},{"../../core":55}],129:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 @@ -24394,7 +24337,7 @@ } }); -},{"../../core":56}],128:[function(require,module,exports){ +},{"../../core":55}],130:[function(require,module,exports){ /** * @file Main export of the PIXI filters library * @author Mat Groves @@ -24435,7 +24378,7 @@ GodrayFilter: require('./godray/GodrayFilter') }; -},{"./blur/BlurFilter":118,"./blur/BlurXFilter":119,"./blur/BlurYFilter":120,"./colormatrix/ColorMatrixFilter":124,"./displacement/DisplacementFilter":125,"./godray/GodrayFilter":126,"./gray/GrayFilter":127,"./twist/TwistFilter":129}],129:[function(require,module,exports){ +},{"./blur/BlurFilter":120,"./blur/BlurXFilter":121,"./blur/BlurYFilter":122,"./colormatrix/ColorMatrixFilter":126,"./displacement/DisplacementFilter":127,"./godray/GodrayFilter":128,"./gray/GrayFilter":129,"./twist/TwistFilter":131}],131:[function(require,module,exports){ var core = require('../../core'); @@ -24533,7 +24476,7 @@ } }); -},{"../../core":56}],130:[function(require,module,exports){ +},{"../../core":55}],132:[function(require,module,exports){ (function (global){ // run the polyfills require('./polyfill'); @@ -24548,6 +24491,7 @@ core.mesh = require('./mesh'); core.particles = require('./particles'); core.accessibility = require('./accessibility'); +core.extract = require('./extract'); // export a premade loader instance /** @@ -24566,7 +24510,7 @@ global.PIXI = core; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./accessibility":37,"./core":56,"./deprecation":109,"./extras":116,"./filters":128,"./interaction":133,"./loaders":136,"./mesh":143,"./particles":146,"./polyfill":152}],131:[function(require,module,exports){ +},{"./accessibility":37,"./core":55,"./deprecation":108,"./extract":110,"./extras":118,"./filters":130,"./interaction":135,"./loaders":138,"./mesh":145,"./particles":148,"./polyfill":154}],133:[function(require,module,exports){ var core = require('../core'); /** @@ -24615,7 +24559,7 @@ return displayObject.worldTransform.applyInverse(globalPos || this.global, point); }; -},{"../core":56}],132:[function(require,module,exports){ +},{"../core":55}],134:[function(require,module,exports){ var core = require('../core'), InteractionData = require('./InteractionData'); @@ -24709,7 +24653,7 @@ * @private */ this.moveWhenInside = false; - + /** * Have events been attached to the dom element? * @@ -24770,6 +24714,13 @@ this.last = 0; /** + * Every update cursor will be reset to this value, if some element wont override it in its hitTest + * @member {string} + * @default 'inherit' + */ + this.defaultCursorStyle = 'inherit'; + + /** * The css style of the cursor that is being used * @member {string} */ @@ -24781,7 +24732,7 @@ * @private */ this._tempPoint = new core.Point(); - + /** * The current resolution @@ -24913,7 +24864,7 @@ return; } - this.cursor = 'inherit'; + this.cursor = this.defaultCursorStyle; this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, true ); @@ -24983,21 +24934,21 @@ } // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ - // + // // This function will now loop through all objects and then only hit test the objects it HAS to, not all of them. MUCH faster.. // An object will be hit test if the following is true: - // + // // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // + // // As another little optimisation once an interactive object has been hit we can carry on through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests // A final optimisation is that an object is not hit test directly if a child has already been hit. - + var hit = false, interactiveParent = interactive = displayObject.interactive || interactive; - + // if the displayobject has a hitArea, then it does not need to hitTest children. if(displayObject.hitArea) @@ -25006,23 +24957,31 @@ } // it has a mask! Then lets hit test that before continuing.. - if(displayObject._mask) + if(hitTest && displayObject._mask) { if(!displayObject._mask.containsPoint(point)) { - return false; + hitTest = false; } } - // ** FREE TIP **! If an object is not interacttive or has no buttons in it (such as a game scene!) set interactiveChildren to false for that displayObject. + // it has a filterArea! Same as mask but easier, its a rectangle + if(hitTest && displayObject.filterArea) + { + if(!displayObject.filterArea.contains(point)) + { + hitTest = false; + } + } + + // ** FREE TIP **! If an object is not interactive or has no buttons in it (such as a game scene!) set interactiveChildren to false for that displayObject. // This will allow pixi to completly ignore and bypass checking the displayObjects children. if(displayObject.interactiveChildren) - { + { var children = displayObject.children; - + for (var i = children.length-1; i >= 0; i--) { - var child = children[i]; // time to get recursive.. if this function will return if somthing is hit.. @@ -25039,8 +24998,8 @@ // we no longer need to hit test any more objects in this container as we we now know the parent has been hit interactiveParent = false; - - // If the child is interactive , that means that the object hit was actually interactive and not just the child of an interactive object. + + // If the child is interactive , that means that the object hit was actually interactive and not just the child of an interactive object. // This means we no longer need to hit test anything else. We still need to run through all objects, but we don't need to perform any hit tests. // if(child.interactive) //{ @@ -25048,12 +25007,12 @@ //} // we can break now as we have hit an object. - + } } } - + // no point running this if the item is not interactive or does not have an interactive parent. if(interactive) @@ -25061,7 +25020,7 @@ // if we are hit testing (as in we have no hit any objects yet) // We also don't need to worry about hit testing if once of the displayObjects children has already been hit! if(hitTest && !hit) - { + { if(displayObject.hitArea) { @@ -25078,12 +25037,12 @@ if(displayObject.interactive) { - func(displayObject, hit); + func(displayObject, hit); } } return hit; - + }; @@ -25120,7 +25079,7 @@ InteractionManager.prototype.processMouseDown = function ( displayObject, hit ) { var e = this.mouse.originalEvent; - + var isRightButton = e.button === 2 || e.which === 3; if(hit) @@ -25202,7 +25161,7 @@ this.didMove = true; - this.cursor = 'inherit'; + this.cursor = this.defaultCursorStyle; this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true ); @@ -25225,7 +25184,7 @@ InteractionManager.prototype.processMouseMove = function ( displayObject, hit ) { this.processMouseOverOut(displayObject, hit); - + // only display on mouse over if(!this.moveWhenInside || hit) { @@ -25248,7 +25207,7 @@ // Update internal mouse reference this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); - this.interactionDOMElement.style.cursor = 'inherit'; + this.interactionDOMElement.style.cursor = this.defaultCursorStyle; // TODO optimize by not check EVERY TIME! maybe half as often? // this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY ); @@ -25539,7 +25498,7 @@ core.WebGLRenderer.registerPlugin('interaction', InteractionManager); core.CanvasRenderer.registerPlugin('interaction', InteractionManager); -},{"../core":56,"./InteractionData":131,"./interactiveTarget":134}],133:[function(require,module,exports){ +},{"../core":55,"./InteractionData":133,"./interactiveTarget":136}],135:[function(require,module,exports){ /** * @file Main export of the PIXI interactions library * @author Mat Groves @@ -25556,7 +25515,7 @@ interactiveTarget: require('./interactiveTarget') }; -},{"./InteractionData":131,"./InteractionManager":132,"./interactiveTarget":134}],134:[function(require,module,exports){ +},{"./InteractionData":133,"./InteractionManager":134,"./interactiveTarget":136}],136:[function(require,module,exports){ /** * Default property values of interactive objects * used by {@link PIXI.interaction.InteractionManager}. @@ -25605,7 +25564,7 @@ module.exports = interactiveTarget; -},{}],135:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ var Resource = require('resource-loader').Resource, core = require('../core'), extras = require('../extras'), @@ -25729,7 +25688,7 @@ }; }; -},{"../core":56,"../extras":116,"path":17,"resource-loader":32}],136:[function(require,module,exports){ +},{"../core":55,"../extras":118,"path":17,"resource-loader":32}],138:[function(require,module,exports){ /** * @file Main export of the PIXI loaders library * @author Mat Groves @@ -25750,7 +25709,7 @@ Resource: require('resource-loader').Resource }; -},{"./bitmapFontParser":135,"./loader":137,"./spritesheetParser":138,"./textureParser":139,"resource-loader":32}],137:[function(require,module,exports){ +},{"./bitmapFontParser":137,"./loader":139,"./spritesheetParser":140,"./textureParser":141,"resource-loader":32}],139:[function(require,module,exports){ var ResourceLoader = require('resource-loader'), textureParser = require('./textureParser'), spritesheetParser = require('./spritesheetParser'), @@ -25812,7 +25771,7 @@ Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT); -},{"./bitmapFontParser":135,"./spritesheetParser":138,"./textureParser":139,"resource-loader":32}],138:[function(require,module,exports){ +},{"./bitmapFontParser":137,"./spritesheetParser":140,"./textureParser":141,"resource-loader":32}],140:[function(require,module,exports){ var Resource = require('resource-loader').Resource, path = require('path'), core = require('../core'); @@ -25884,7 +25843,7 @@ }; }; -},{"../core":56,"path":17,"resource-loader":32}],139:[function(require,module,exports){ +},{"../core":55,"path":17,"resource-loader":32}],141:[function(require,module,exports){ var core = require('../core'); module.exports = function () @@ -25906,7 +25865,7 @@ }; }; -},{"../core":56}],140:[function(require,module,exports){ +},{"../core":55}],142:[function(require,module,exports){ var core = require('../core'), glCore = require('pixi-gl-core'), Shader = require('./webgl/MeshShader'), @@ -25968,6 +25927,7 @@ * @member {boolean} */ this.dirty = true; + this.indexDirty = true; /** * The blend mode to be applied to the sprite. Set to `PIXI.BLEND_MODES.NORMAL` to remove any blend mode. @@ -26081,12 +26041,22 @@ .addAttribute(glData.uvBuffer, glData.shader.attributes.aTextureCoord, gl.FLOAT, false, 2 * 4, 0); this._glDatas[renderer.CONTEXT_UID] = glData; + + + this.indexDirty = false; } if(this.dirty) { this.dirty = false; glData.uvBuffer.upload(); + + } + + if(this.indexDirty) + { + this.indexDirty = false; + glData.indexBuffer.upload(); } glData.vertexBuffer.upload(); @@ -26431,7 +26401,7 @@ TRIANGLES: 1 }; -},{"../core":56,"./webgl/MeshShader":144,"pixi-gl-core":1}],141:[function(require,module,exports){ +},{"../core":55,"./webgl/MeshShader":146,"pixi-gl-core":1}],143:[function(require,module,exports){ var Mesh = require('./Mesh'); /** @@ -26492,9 +26462,6 @@ var indices = []; var texture = this.texture; - // texture.width = 800 texture.width || 800; - // texture.height = 800//texture.height || 800; - var segmentsXSub = this.segmentsX - 1; var segmentsYSub = this.segmentsY - 1; var i = 0; @@ -26540,6 +26507,8 @@ this.uvs = new Float32Array(uvs); this.colors = new Float32Array(colors); this.indices = new Uint16Array(indices); + + this.indexDirty = true; }; /** @@ -26557,7 +26526,7 @@ } }; -},{"./Mesh":140}],142:[function(require,module,exports){ +},{"./Mesh":142}],144:[function(require,module,exports){ var Mesh = require('./Mesh'); var core = require('../core'); @@ -26685,6 +26654,7 @@ } this.dirty = true; + this.indexDirty = true; }; /** @@ -26694,6 +26664,7 @@ */ Rope.prototype._onTextureUpdate = function () { + Mesh.prototype._onTextureUpdate.call(this); // wait for the Rope ctor to finish before calling refresh @@ -26770,7 +26741,7 @@ this.containerUpdateTransform(); }; -},{"../core":56,"./Mesh":140}],143:[function(require,module,exports){ +},{"../core":55,"./Mesh":142}],145:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -26788,7 +26759,7 @@ MeshShader: require('./webgl/MeshShader') }; -},{"./Mesh":140,"./Plane":141,"./Rope":142,"./webgl/MeshShader":144}],144:[function(require,module,exports){ +},{"./Mesh":142,"./Plane":143,"./Rope":144,"./webgl/MeshShader":146}],146:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -26838,7 +26809,7 @@ module.exports = MeshShader; -},{"pixi-gl-core":1}],145:[function(require,module,exports){ +},{"pixi-gl-core":1}],147:[function(require,module,exports){ var core = require('../core'); /** @@ -26863,7 +26834,7 @@ * * @class * @extends PIXI.Container - * @memberof PIXI + * @memberof PIXI.particles * @param [maxSize=15000] {number} The maximum number of particles that can be renderer by the container. * @param [properties] {object} The properties of children that should be uploaded to the gpu and applied. * @param [properties.scale=false] {boolean} When true, scale be uploaded and applied. @@ -27171,7 +27142,7 @@ this._buffers = null; }; -},{"../core":56}],146:[function(require,module,exports){ +},{"../core":55}],148:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -27187,7 +27158,7 @@ ParticleRenderer: require('./webgl/ParticleRenderer') }; -},{"./ParticleContainer":145,"./webgl/ParticleRenderer":148}],147:[function(require,module,exports){ +},{"./ParticleContainer":147,"./webgl/ParticleRenderer":150}],149:[function(require,module,exports){ var glCore = require('pixi-gl-core'), createIndicesForQuads = require('../../core/utils/createIndicesForQuads'); @@ -27408,7 +27379,7 @@ this.staticBuffer.destroy(); }; -},{"../../core/utils/createIndicesForQuads":104,"pixi-gl-core":1}],148:[function(require,module,exports){ +},{"../../core/utils/createIndicesForQuads":103,"pixi-gl-core":1}],150:[function(require,module,exports){ var core = require('../../core'), ParticleShader = require('./ParticleShader'), ParticleBuffer = require('./ParticleBuffer'); @@ -27839,7 +27810,7 @@ this.tempMatrix = null; }; -},{"../../core":56,"./ParticleBuffer":147,"./ParticleShader":149}],149:[function(require,module,exports){ +},{"../../core":55,"./ParticleBuffer":149,"./ParticleShader":151}],151:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -27907,7 +27878,7 @@ module.exports = ParticleShader; -},{"pixi-gl-core":1}],150:[function(require,module,exports){ +},{"pixi-gl-core":1}],152:[function(require,module,exports){ // References: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign @@ -27923,7 +27894,7 @@ }; } -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ // References: // https://github.com/sindresorhus/object-assign // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign @@ -27933,7 +27904,7 @@ Object.assign = require('object-assign'); } -},{"object-assign":27}],152:[function(require,module,exports){ +},{"object-assign":27}],154:[function(require,module,exports){ require('./Object.assign'); require('./requestAnimationFrame'); require('./Math.sign'); @@ -27951,7 +27922,7 @@ window.Uint16Array = Array; } -},{"./Math.sign":150,"./Object.assign":151,"./requestAnimationFrame":153}],153:[function(require,module,exports){ +},{"./Math.sign":152,"./Object.assign":153,"./requestAnimationFrame":155}],155:[function(require,module,exports){ (function (global){ // References: // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ @@ -28021,6 +27992,6 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[130])(130) +},{}]},{},[132])(132) }); //# sourceMappingURL=pixi.js.map diff --git a/bin/pixi.js b/bin/pixi.js index e3877d6..d7c2e5d 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -521,7 +521,7 @@ /** * Uploads this texture to the GPU - * @param source {HTMLImageElement|ImageData} the source image of the texture + * @param source {HTMLImageElement|ImageData|HTMLVideoElement} the source image of the texture */ Texture.prototype.upload = function(source) { @@ -529,8 +529,9 @@ var gl = this.gl; - this.width = source.width; - this.height = source.height; + // if the source is a video, we need to use the videoWidth / videoHeight properties as width / height will be incorrect. + this.width = source.videoWidth || source.width; + this.height = source.videoHeight || source.height; gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha); gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source); @@ -7435,7 +7436,7 @@ core.WebGLRenderer.registerPlugin('accessibility', AccessibilityManager); core.CanvasRenderer.registerPlugin('accessibility', AccessibilityManager); -},{"../core":56,"./accessibleTarget":36}],36:[function(require,module,exports){ +},{"../core":55,"./accessibleTarget":36}],36:[function(require,module,exports){ /** * Default property values of accessible objects * used by {@link PIXI.accessibility.AccessibilityManager}. @@ -7675,283 +7676,6 @@ /** * The wrap modes that are supported by pixi. * - * The DEFAULT Garbage Collection mode for pixi textures is AUTO - * If set to AUTO, the renderer will occasianally check textures usage. If they are not used for a specified period of time they will be removed from the GPU. - * They will of corse be uploaded again when they are required. This is a silent behind the scenes process that should ensure that the GPU does not get filled up. - * Handy for mobile devices! - * This property only affects WebGL - * @static - * @constant - * @property {object} GC_MODES - * @property {number} GC_MODES.DEFAULT=DEFAULT - * @property {number} GC_MODES.AUTO Garbage collection will happen periodically automatically - * @property {number} GC_MODES.MANUAL Garbage collection will need to be called manually - */ - GC_MODES: { - DEFAULT: 0, - AUTO: 0, - MANUAL: 1, - }, - - /** - * If set to true WebGL will attempt make textures mimpaped by default - * Mipmapping will only succeed if the base texture uploaded has power of two dimensions - * @static - * @constant - * @property {bool} MIPMAP_TEXTURES - */ - MIPMAP_TEXTURES:true, - - /** - * The prefix that denotes a URL is for a retina asset - * - * @static - * @constant - * @property {string} RETINA_PREFIX - */ - //example: '@2x', - RETINA_PREFIX: /@(.+)x/, - - RESOLUTION:1, - - FILTER_RESOLUTION:1, - - /** - * The default render options if none are supplied to {@link PIXI.WebGLRenderer} - * or {@link PIXI.CanvasRenderer}. - * - * @static - * @constant - * @property {object} DEFAULT_RENDER_OPTIONS - * @property {HTMLCanvasElement} DEFAULT_RENDER_OPTIONS.view=null - * @property {boolean} DEFAULT_RENDER_OPTIONS.transparent=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.antialias=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.forceFXAA=false - * @property {boolean} DEFAULT_RENDER_OPTIONS.preserveDrawingBuffer=false - * @property {number} DEFAULT_RENDER_OPTIONS.resolution=1 - * @property {number} DEFAULT_RENDER_OPTIONS.backgroundColor=0x000000 - * @property {boolean} DEFAULT_RENDER_OPTIONS.clearBeforeRender=true - * @property {boolean} DEFAULT_RENDER_OPTIONS.autoResize=false - */ - DEFAULT_RENDER_OPTIONS: { - view: null, - resolution: 1, - antialias: false, - forceFXAA: false, - autoResize: false, - transparent: false, - backgroundColor: 0x000000, - clearBeforeRender: true, - preserveDrawingBuffer: false, - roundPixels: false - }, - - /** - * Constants that identify shapes, mainly to prevent `instanceof` calls. - * - * @static - * @constant - * @property {object} SHAPES - * @property {object} SHAPES.POLY=0 - * @property {object} SHAPES.RECT=1 - * @property {object} SHAPES.CIRC=2 - * @property {object} SHAPES.ELIP=3 - * @property {object} SHAPES.RREC=4 - */ - SHAPES: { - POLY: 0, - RECT: 1, - CIRC: 2, - ELIP: 3, - RREC: 4 - }, - - // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 - // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - SPRITE_BATCH_SIZE: 4096, //nice balance between mobile and desktop machines - SPRITE_MAX_TEXTURES: require('./utils/maxRecommendedTextures')(32)//this is the MAXIMUM - various gpus will have there own limits. -}; - -module.exports = CONST; - -},{"./utils/maxRecommendedTextures":107}],39:[function(require,module,exports){ - -/** - * Constant values used in pixi - * - * @lends PIXI - */ -var CONST = { - /** - * String of the current PIXI version - * - * @static - * @constant - * @property {string} VERSION - */ - VERSION: '4.0.0', - - /** - * @property {number} PI_2 - Two Pi - * @constant - * @static - */ - PI_2: Math.PI * 2, - - /** - * @property {number} RAD_TO_DEG - Constant conversion factor for converting radians to degrees - * @constant - * @static - */ - RAD_TO_DEG: 180 / Math.PI, - - /** - * @property {Number} DEG_TO_RAD - Constant conversion factor for converting degrees to radians - * @constant - * @static - */ - DEG_TO_RAD: Math.PI / 180, - - /** - * Target frames per millisecond. - * - * @static - * @constant - * @property {number} TARGET_FPMS=0.06 - */ - TARGET_FPMS: 0.06, - - /** - * Constant to identify the Renderer Type. - * - * @static - * @constant - * @property {object} RENDERER_TYPE - * @property {number} RENDERER_TYPE.UNKNOWN - * @property {number} RENDERER_TYPE.WEBGL - * @property {number} RENDERER_TYPE.CANVAS - */ - RENDERER_TYPE: { - UNKNOWN: 0, - WEBGL: 1, - CANVAS: 2 - }, - - /** - * Various blend modes supported by PIXI. IMPORTANT - The WebGL renderer only supports - * the NORMAL, ADD, MULTIPLY and SCREEN blend modes. Anything else will silently act like - * NORMAL. - * - * @static - * @constant - * @property {object} BLEND_MODES - * @property {number} BLEND_MODES.NORMAL - * @property {number} BLEND_MODES.ADD - * @property {number} BLEND_MODES.MULTIPLY - * @property {number} BLEND_MODES.SCREEN - * @property {number} BLEND_MODES.OVERLAY - * @property {number} BLEND_MODES.DARKEN - * @property {number} BLEND_MODES.LIGHTEN - * @property {number} BLEND_MODES.COLOR_DODGE - * @property {number} BLEND_MODES.COLOR_BURN - * @property {number} BLEND_MODES.HARD_LIGHT - * @property {number} BLEND_MODES.SOFT_LIGHT - * @property {number} BLEND_MODES.DIFFERENCE - * @property {number} BLEND_MODES.EXCLUSION - * @property {number} BLEND_MODES.HUE - * @property {number} BLEND_MODES.SATURATION - * @property {number} BLEND_MODES.COLOR - * @property {number} BLEND_MODES.LUMINOSITY - */ - BLEND_MODES: { - NORMAL: 0, - ADD: 1, - MULTIPLY: 2, - SCREEN: 3, - OVERLAY: 4, - DARKEN: 5, - LIGHTEN: 6, - COLOR_DODGE: 7, - COLOR_BURN: 8, - HARD_LIGHT: 9, - SOFT_LIGHT: 10, - DIFFERENCE: 11, - EXCLUSION: 12, - HUE: 13, - SATURATION: 14, - COLOR: 15, - LUMINOSITY: 16 - }, - - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @static - * @constant - * @property {object} DRAW_MODES - * @property {number} DRAW_MODES.POINTS - * @property {number} DRAW_MODES.LINES - * @property {number} DRAW_MODES.LINE_LOOP - * @property {number} DRAW_MODES.LINE_STRIP - * @property {number} DRAW_MODES.TRIANGLES - * @property {number} DRAW_MODES.TRIANGLE_STRIP - * @property {number} DRAW_MODES.TRIANGLE_FAN - */ - DRAW_MODES: { - POINTS: 0, - LINES: 1, - LINE_LOOP: 2, - LINE_STRIP: 3, - TRIANGLES: 4, - TRIANGLE_STRIP: 5, - TRIANGLE_FAN: 6 - }, - - /** - * The scale modes that are supported by pixi. - * - * The DEFAULT scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @static - * @constant - * @property {object} SCALE_MODES - * @property {number} SCALE_MODES.DEFAULT=LINEAR - * @property {number} SCALE_MODES.LINEAR Smooth scaling - * @property {number} SCALE_MODES.NEAREST Pixelating scaling - */ - SCALE_MODES: { - DEFAULT: 0, - LINEAR: 0, - NEAREST: 1 - }, - - /** - * The wrap modes that are supported by pixi. - * - * The DEFAULT wrap mode affects the default wraping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can only use REPEAT if the texture is po2 - * This property only affects WebGL - * @static - * @constant - * @property {object} WRAP_MODES - * @property {number} WRAP_MODES.DEFAULT=CLAMP - * @property {number} WRAP_MODES.CLAMP The textures uvs are clamped - * @property {number} WRAP_MODES.REPEAT The texture uvs tile and repeat - * @property {number} WRAP_MODES.MIRRORED_REPEAT The texture uvs tile and repeat with mirroring - */ - WRAP_MODES: { - DEFAULT: 0, - CLAMP: 0, - REPEAT: 1, - MIRRORED_REPEAT:2 - }, - - /** - * The wrap modes that are supported by pixi. - * * The DEFAULT Garbage Collection mode for pixi textures is MANUAL * If set to DEFAULT, the renderer will occasianally check textures usage. If they are not used for a specified period of time they will be removed from the GPU. * They will of corse be uploaded again when they are required. This is a silent behind the scenes process that should ensure that the GPU does not get filled up. @@ -8051,7 +7775,7 @@ module.exports = CONST; -},{"./utils/maxRecommendedTextures":107}],40:[function(require,module,exports){ +},{"./utils/maxRecommendedTextures":106}],39:[function(require,module,exports){ var math = require('../math'), utils = require('../utils'), DisplayObject = require('./DisplayObject'), @@ -8680,7 +8404,7 @@ this.children = null; }; -},{"../math":60,"../textures/RenderTexture":98,"../utils":106,"./DisplayObject":41}],41:[function(require,module,exports){ +},{"../math":59,"../textures/RenderTexture":97,"../utils":105,"./DisplayObject":40}],40:[function(require,module,exports){ var math = require('../math'), RenderTexture = require('../textures/RenderTexture'), EventEmitter = require('eventemitter3'), @@ -8747,11 +8471,20 @@ * The area the filter is applied to. This is used as more of an optimisation * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * + * Also works as an interaction mask + * * @member {PIXI.Rectangle} */ this.filterArea = null; /** + * Interaction shape. Children will be hit first, then this shape will be checked. + * + * @member {PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle} + */ + this.hitArea = null; + + /** * The original, cached bounds of the object * * @member {PIXI.Rectangle} @@ -9179,7 +8912,7 @@ this.filterArea = null; }; -},{"../math":60,"../textures/RenderTexture":98,"./Transform":43,"eventemitter3":25}],42:[function(require,module,exports){ +},{"../math":59,"../textures/RenderTexture":97,"./Transform":42,"eventemitter3":25}],41:[function(require,module,exports){ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. @@ -9256,7 +8989,7 @@ this.transform._versionLocal++; }; -},{}],43:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ var math = require('../math'), ObservablePoint = require('./ObservablePoint'); @@ -9393,7 +9126,7 @@ module.exports = Transform; -},{"../math":60,"./ObservablePoint":42}],44:[function(require,module,exports){ +},{"../math":59,"./ObservablePoint":41}],43:[function(require,module,exports){ var Container = require('../display/Container'), RenderTexture = require('../textures/RenderTexture'), Texture = require('../textures/Texture'), @@ -10459,7 +10192,7 @@ this._localBounds = null; }; -},{"../const":39,"../display/Container":40,"../math":60,"../renderers/canvas/CanvasRenderer":67,"../renderers/canvas/utils/CanvasRenderTarget":69,"../sprites/Sprite":89,"../textures/RenderTexture":98,"../textures/Texture":99,"./GraphicsData":45,"./utils/bezierCurveTo":47}],45:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../renderers/canvas/CanvasRenderer":66,"../renderers/canvas/utils/CanvasRenderTarget":68,"../sprites/Sprite":88,"../textures/RenderTexture":97,"../textures/Texture":98,"./GraphicsData":44,"./utils/bezierCurveTo":46}],44:[function(require,module,exports){ /** * A GraphicsData object. * @@ -10552,7 +10285,7 @@ this.shape = null; }; -},{}],46:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ var CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'), CONST = require('../../const'); @@ -10831,7 +10564,7 @@ this.renderer = null; }; -},{"../../const":39,"../../renderers/canvas/CanvasRenderer":67}],47:[function(require,module,exports){ +},{"../../const":38,"../../renderers/canvas/CanvasRenderer":66}],46:[function(require,module,exports){ /** * Calculate the points for a bezier curve and then draws it. @@ -10879,7 +10612,7 @@ module.exports = bezierCurveTo; -},{}],48:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ var utils = require('../../utils'), CONST = require('../../const'), ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'), @@ -11100,7 +10833,7 @@ return webGLData; }; -},{"../../const":39,"../../renderers/webgl/WebGLRenderer":74,"../../renderers/webgl/utils/ObjectRenderer":84,"../../utils":106,"./WebGLGraphicsData":49,"./shaders/PrimitiveShader":50,"./utils/buildCircle":51,"./utils/buildPoly":53,"./utils/buildRectangle":54,"./utils/buildRoundedRectangle":55}],49:[function(require,module,exports){ +},{"../../const":38,"../../renderers/webgl/WebGLRenderer":73,"../../renderers/webgl/utils/ObjectRenderer":83,"../../utils":105,"./WebGLGraphicsData":48,"./shaders/PrimitiveShader":49,"./utils/buildCircle":50,"./utils/buildPoly":52,"./utils/buildRectangle":53,"./utils/buildRoundedRectangle":54}],48:[function(require,module,exports){ var glCore = require('pixi-gl-core'); @@ -11225,7 +10958,7 @@ this.glIndices = null; }; -},{"pixi-gl-core":1}],50:[function(require,module,exports){ +},{"pixi-gl-core":1}],49:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -11276,7 +11009,7 @@ module.exports = PrimitiveShader; -},{"pixi-gl-core":1}],51:[function(require,module,exports){ +},{"pixi-gl-core":1}],50:[function(require,module,exports){ var buildLine = require('./buildLine'), CONST = require('../../../const'), utils = require('../../../utils'); @@ -11365,7 +11098,7 @@ module.exports = buildCircle; -},{"../../../const":39,"../../../utils":106,"./buildLine":52}],52:[function(require,module,exports){ +},{"../../../const":38,"../../../utils":105,"./buildLine":51}],51:[function(require,module,exports){ var math = require('../../../math'), utils = require('../../../utils'); @@ -11585,7 +11318,7 @@ }; module.exports = buildLine; -},{"../../../math":60,"../../../utils":106}],53:[function(require,module,exports){ +},{"../../../math":59,"../../../utils":105}],52:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'), earcut = require('earcut'); @@ -11665,7 +11398,7 @@ module.exports = buildPoly; -},{"../../../utils":106,"./buildLine":52,"earcut":24}],54:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51,"earcut":24}],53:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'); @@ -11736,9 +11469,9 @@ }; module.exports = buildRectangle; -},{"../../../utils":106,"./buildLine":52}],55:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51}],54:[function(require,module,exports){ var earcut = require('earcut'), - // buildLine = require('./buildLine'), + buildLine = require('./buildLine'), utils = require('../../../utils'); /** @@ -11760,10 +11493,10 @@ var recPoints = []; recPoints.push(x, y + radius); - this.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints); - this.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints); - this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); - this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); + quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints); + quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints); + quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); + quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. @@ -11806,7 +11539,7 @@ graphicsData.points = recPoints; - this.buildLine(graphicsData, webGLData); + buildLine(graphicsData, webGLData); graphicsData.points = tempPoints; } @@ -11826,47 +11559,47 @@ * @param [out] {number[]} The output array to add points into. If not passed, a new array is created. * @return {number[]} an array of points */ -// var quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out) -// { -// var xa, -// ya, -// xb, -// yb, -// x, -// y, -// n = 20, -// points = out || []; -// -// function getPt(n1 , n2, perc) { -// var diff = n2 - n1; -// -// return n1 + ( diff * perc ); -// } -// -// var j = 0; -// for (var i = 0; i <= n; i++ ) { -// j = i / n; -// -// // The Green Line -// xa = getPt( fromX , cpX , j ); -// ya = getPt( fromY , cpY , j ); -// xb = getPt( cpX , toX , j ); -// yb = getPt( cpY , toY , j ); -// -// // The Black Dot -// x = getPt( xa , xb , j ); -// y = getPt( ya , yb , j ); -// -// points.push(x, y); -// } -// -// return points; -// }; +var quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out) +{ + var xa, + ya, + xb, + yb, + x, + y, + n = 20, + points = out || []; + + function getPt(n1 , n2, perc) { + var diff = n2 - n1; + + return n1 + ( diff * perc ); + } + + var j = 0; + for (var i = 0; i <= n; i++ ) { + j = i / n; + + // The Green Line + xa = getPt( fromX , cpX , j ); + ya = getPt( fromY , cpY , j ); + xb = getPt( cpX , toX , j ); + yb = getPt( cpY , toY , j ); + + // The Black Dot + x = getPt( xa , xb , j ); + y = getPt( ya , yb , j ); + + points.push(x, y); + } + + return points; +}; module.exports = buildRoundedRectangle; -},{"../../../utils":106,"earcut":24}],56:[function(require,module,exports){ +},{"../../../utils":105,"./buildLine":51,"earcut":24}],55:[function(require,module,exports){ /** * @file Main export of the PIXI core library * @author Mat Groves @@ -11959,7 +11692,7 @@ } }); -},{"./const":39,"./display/Container":40,"./display/DisplayObject":41,"./graphics/Graphics":44,"./graphics/GraphicsData":45,"./graphics/canvas/CanvasGraphicsRenderer":46,"./graphics/webgl/GraphicsRenderer":48,"./math":60,"./renderers/canvas/CanvasRenderer":67,"./renderers/canvas/utils/CanvasRenderTarget":69,"./renderers/webgl/WebGLRenderer":74,"./renderers/webgl/filters/Filter":76,"./renderers/webgl/filters/spriteMask/SpriteMaskFilter":79,"./renderers/webgl/managers/WebGLManager":83,"./renderers/webgl/utils/ObjectRenderer":84,"./renderers/webgl/utils/Quad":85,"./renderers/webgl/utils/RenderTarget":86,"./sprites/Sprite":89,"./sprites/canvas/CanvasSpriteRenderer":90,"./sprites/webgl/SpriteRenderer":93,"./text/Text":95,"./textures/BaseRenderTexture":96,"./textures/BaseTexture":97,"./textures/RenderTexture":98,"./textures/Texture":99,"./textures/TextureUvs":100,"./textures/VideoBaseTexture":101,"./ticker":103,"./utils":106,"pixi-gl-core":1}],57:[function(require,module,exports){ +},{"./const":38,"./display/Container":39,"./display/DisplayObject":40,"./graphics/Graphics":43,"./graphics/GraphicsData":44,"./graphics/canvas/CanvasGraphicsRenderer":45,"./graphics/webgl/GraphicsRenderer":47,"./math":59,"./renderers/canvas/CanvasRenderer":66,"./renderers/canvas/utils/CanvasRenderTarget":68,"./renderers/webgl/WebGLRenderer":73,"./renderers/webgl/filters/Filter":75,"./renderers/webgl/filters/spriteMask/SpriteMaskFilter":78,"./renderers/webgl/managers/WebGLManager":82,"./renderers/webgl/utils/ObjectRenderer":83,"./renderers/webgl/utils/Quad":84,"./renderers/webgl/utils/RenderTarget":85,"./sprites/Sprite":88,"./sprites/canvas/CanvasSpriteRenderer":89,"./sprites/webgl/SpriteRenderer":92,"./text/Text":94,"./textures/BaseRenderTexture":95,"./textures/BaseTexture":96,"./textures/RenderTexture":97,"./textures/Texture":98,"./textures/TextureUvs":99,"./textures/VideoBaseTexture":100,"./ticker":102,"./utils":105,"pixi-gl-core":1}],56:[function(require,module,exports){ // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group of order 16 var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; @@ -12123,7 +11856,7 @@ module.exports = GroupD8; -},{"./Matrix":58}],58:[function(require,module,exports){ +},{"./Matrix":57}],57:[function(require,module,exports){ // @todo - ignore the too many parameters warning for now // should either fix it or change the jshint config // jshint -W072 @@ -12564,7 +12297,7 @@ */ Matrix.TEMP_MATRIX = new Matrix(); -},{"./Point":59}],59:[function(require,module,exports){ +},{"./Point":58}],58:[function(require,module,exports){ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. @@ -12634,7 +12367,7 @@ this.y = y || ( (y !== 0) ? this.x : 0 ) ; }; -},{}],60:[function(require,module,exports){ +},{}],59:[function(require,module,exports){ /** * Math classes and utilities mixed into PIXI namespace. * @@ -12657,7 +12390,7 @@ RoundedRectangle: require('./shapes/RoundedRectangle') }; -},{"./GroupD8":57,"./Matrix":58,"./Point":59,"./shapes/Circle":61,"./shapes/Ellipse":62,"./shapes/Polygon":63,"./shapes/Rectangle":64,"./shapes/RoundedRectangle":65}],61:[function(require,module,exports){ +},{"./GroupD8":56,"./Matrix":57,"./Point":58,"./shapes/Circle":60,"./shapes/Ellipse":61,"./shapes/Polygon":62,"./shapes/Rectangle":63,"./shapes/RoundedRectangle":64}],60:[function(require,module,exports){ var Rectangle = require('./Rectangle'), CONST = require('../../const'); @@ -12745,7 +12478,7 @@ return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); }; -},{"../../const":39,"./Rectangle":64}],62:[function(require,module,exports){ +},{"../../const":38,"./Rectangle":63}],61:[function(require,module,exports){ var Rectangle = require('./Rectangle'), CONST = require('../../const'); @@ -12840,7 +12573,7 @@ return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); }; -},{"../../const":39,"./Rectangle":64}],63:[function(require,module,exports){ +},{"../../const":38,"./Rectangle":63}],62:[function(require,module,exports){ var Point = require('../Point'), CONST = require('../../const'); @@ -12943,7 +12676,7 @@ return inside; }; -},{"../../const":39,"../Point":59}],64:[function(require,module,exports){ +},{"../../const":38,"../Point":58}],63:[function(require,module,exports){ var CONST = require('../../const'); /** @@ -13109,7 +12842,7 @@ this.height = y2 - y1; }; -},{"../../const":39}],65:[function(require,module,exports){ +},{"../../const":38}],64:[function(require,module,exports){ var CONST = require('../../const'); /** @@ -13201,7 +12934,7 @@ return false; }; -},{"../../const":39}],66:[function(require,module,exports){ +},{"../../const":38}],65:[function(require,module,exports){ var utils = require('../utils'), math = require('../math'), CONST = require('../const'), @@ -13491,7 +13224,7 @@ this._lastObjectRendered = null; }; -},{"../const":39,"../display/Container":40,"../math":60,"../textures/RenderTexture":98,"../utils":106,"eventemitter3":25}],67:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../textures/RenderTexture":97,"../utils":105,"eventemitter3":25}],66:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), CanvasMaskManager = require('./utils/CanvasMaskManager'), CanvasRenderTarget = require('./utils/CanvasRenderTarget'), @@ -13746,7 +13479,7 @@ }; -},{"../../const":39,"../../utils":106,"../SystemRenderer":66,"./utils/CanvasMaskManager":68,"./utils/CanvasRenderTarget":69,"./utils/mapCanvasBlendModesToPixi":71}],68:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"../SystemRenderer":65,"./utils/CanvasMaskManager":67,"./utils/CanvasRenderTarget":68,"./utils/mapCanvasBlendModesToPixi":70}],67:[function(require,module,exports){ var CONST = require('../../../const'); /** * A set of functions used to handle masking. @@ -13909,7 +13642,7 @@ CanvasMaskManager.prototype.destroy = function () {}; -},{"../../../const":39}],69:[function(require,module,exports){ +},{"../../../const":38}],68:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -14013,7 +13746,7 @@ this.canvas = null; }; -},{"../../../const":39}],70:[function(require,module,exports){ +},{"../../../const":38}],69:[function(require,module,exports){ /** * Checks whether the Canvas BlendModes are supported by the current browser @@ -14052,8 +13785,8 @@ module.exports = canUseNewCanvasBlendModes; -},{}],71:[function(require,module,exports){ -var CONST = require('../../../Const'), +},{}],70:[function(require,module,exports){ +var CONST = require('../../../const'), canUseNewCanvasBlendModes = require('./canUseNewCanvasBlendModes'); /** @@ -14112,7 +13845,7 @@ module.exports = mapWebGLBlendModesToPixi; -},{"../../../Const":38,"./canUseNewCanvasBlendModes":70}],72:[function(require,module,exports){ +},{"../../../const":38,"./canUseNewCanvasBlendModes":69}],71:[function(require,module,exports){ var CONST = require('../../const'); @@ -14188,7 +13921,7 @@ } }; -},{"../../const":39}],73:[function(require,module,exports){ +},{"../../const":38}],72:[function(require,module,exports){ var GLTexture = require('pixi-gl-core').GLTexture, CONST = require('../../const'), RenderTarget = require('./utils/RenderTarget'), @@ -14394,7 +14127,7 @@ module.exports = TextureManager; -},{"../../const":39,"../../utils":106,"./utils/RenderTarget":86,"pixi-gl-core":1}],74:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"./utils/RenderTarget":85,"pixi-gl-core":1}],73:[function(require,module,exports){ var SystemRenderer = require('../SystemRenderer'), MaskManager = require('./managers/MaskManager'), StencilManager = require('./managers/StencilManager'), @@ -14946,7 +14679,7 @@ // this = null; }; -},{"../../const":39,"../../utils":106,"../SystemRenderer":66,"./TextureGarbageCollector":72,"./TextureManager":73,"./WebGLState":75,"./managers/FilterManager":80,"./managers/MaskManager":81,"./managers/StencilManager":82,"./utils/ObjectRenderer":84,"./utils/RenderTarget":86,"./utils/mapWebGLDrawModesToPixi":88,"pixi-gl-core":1}],75:[function(require,module,exports){ +},{"../../const":38,"../../utils":105,"../SystemRenderer":65,"./TextureGarbageCollector":71,"./TextureManager":72,"./WebGLState":74,"./managers/FilterManager":79,"./managers/MaskManager":80,"./managers/StencilManager":81,"./utils/ObjectRenderer":83,"./utils/RenderTarget":85,"./utils/mapWebGLDrawModesToPixi":87,"pixi-gl-core":1}],74:[function(require,module,exports){ var mapWebGLBlendModesToPixi = require('./utils/mapWebGLBlendModesToPixi'); @@ -15216,7 +14949,7 @@ module.exports = WebGLState; -},{"./utils/mapWebGLBlendModesToPixi":87}],76:[function(require,module,exports){ +},{"./utils/mapWebGLBlendModesToPixi":86}],75:[function(require,module,exports){ var extractUniformsFromSrc = require('./extractUniformsFromSrc'); // var math = require('../../../math'); /** @@ -15344,7 +15077,7 @@ '}' ].join('\n'); -},{"./extractUniformsFromSrc":77}],77:[function(require,module,exports){ +},{"./extractUniformsFromSrc":76}],76:[function(require,module,exports){ var defaultValue = require('pixi-gl-core/lib/shader/defaultValue'); var mapSize = require('pixi-gl-core/lib/shader/mapSize'); @@ -15407,7 +15140,7 @@ module.exports = extractUniformsFromSrc; -},{"pixi-gl-core/lib/shader/defaultValue":10,"pixi-gl-core/lib/shader/mapSize":14}],78:[function(require,module,exports){ +},{"pixi-gl-core/lib/shader/defaultValue":10,"pixi-gl-core/lib/shader/mapSize":14}],77:[function(require,module,exports){ var math = require('../../../math'); /* @@ -15516,7 +15249,7 @@ calculateSpriteMatrix:calculateSpriteMatrix }; -},{"../../../math":60}],79:[function(require,module,exports){ +},{"../../../math":59}],78:[function(require,module,exports){ var Filter = require('../Filter'), math = require('../../../../math'); @@ -15567,7 +15300,7 @@ filterManager.applyFilter(this, input, output); }; -},{"../../../../math":60,"../Filter":76}],80:[function(require,module,exports){ +},{"../../../../math":59,"../Filter":75}],79:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'), RenderTarget = require('../utils/RenderTarget'), @@ -15911,7 +15644,7 @@ FilterManager.pool[key].push(renderTarget); }; -},{"../../../math":60,"../filters/filterTransforms":78,"../utils/Quad":85,"../utils/RenderTarget":86,"./WebGLManager":83,"bit-twiddle":16,"pixi-gl-core":1}],81:[function(require,module,exports){ +},{"../../../math":59,"../filters/filterTransforms":77,"../utils/Quad":84,"../utils/RenderTarget":85,"./WebGLManager":82,"bit-twiddle":16,"pixi-gl-core":1}],80:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'), AlphaMaskFilter = require('../filters/spriteMask/SpriteMaskFilter'); @@ -16090,7 +15823,7 @@ gl.disable(gl.SCISSOR_TEST); }; -},{"../filters/spriteMask/SpriteMaskFilter":79,"./WebGLManager":83}],82:[function(require,module,exports){ +},{"../filters/spriteMask/SpriteMaskFilter":78,"./WebGLManager":82}],81:[function(require,module,exports){ var WebGLManager = require('./WebGLManager'); /** @@ -16206,7 +15939,7 @@ this.stencilMaskStack.stencilStack = null; }; -},{"./WebGLManager":83}],83:[function(require,module,exports){ +},{"./WebGLManager":82}],82:[function(require,module,exports){ /** * @class * @memberof PIXI @@ -16247,7 +15980,7 @@ this.renderer = null; }; -},{}],84:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ var WebGLManager = require('../managers/WebGLManager'); /** @@ -16305,7 +16038,7 @@ // render the object }; -},{"../managers/WebGLManager":83}],85:[function(require,module,exports){ +},{"../managers/WebGLManager":82}],84:[function(require,module,exports){ var glCore = require('pixi-gl-core'), createIndicesForQuads = require('../../../utils/createIndicesForQuads'); @@ -16477,7 +16210,7 @@ module.exports = Quad; -},{"../../../utils/createIndicesForQuads":104,"pixi-gl-core":1}],86:[function(require,module,exports){ +},{"../../../utils/createIndicesForQuads":103,"pixi-gl-core":1}],85:[function(require,module,exports){ var math = require('../../../math'), CONST = require('../../../const'), GLTexture = require('pixi-gl-core').GLTexture, @@ -16804,7 +16537,7 @@ this.texture = null; }; -},{"../../../const":39,"../../../math":60,"pixi-gl-core":1}],87:[function(require,module,exports){ +},{"../../../const":38,"../../../math":59,"pixi-gl-core":1}],86:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -16841,7 +16574,7 @@ module.exports = mapWebGLBlendModesToPixi; -},{"../../../const":39}],88:[function(require,module,exports){ +},{"../../../const":38}],87:[function(require,module,exports){ var CONST = require('../../../const'); /** @@ -16865,7 +16598,7 @@ module.exports = mapWebGLDrawModesToPixi; -},{"../../../const":39}],89:[function(require,module,exports){ +},{"../../../const":38}],88:[function(require,module,exports){ var math = require('../math'), Texture = require('../textures/Texture'), Container = require('../display/Container'), @@ -17345,11 +17078,11 @@ return new Sprite(Texture.fromImage(imageId, crossorigin, scaleMode)); }; -},{"../const":39,"../display/Container":40,"../math":60,"../textures/Texture":99,"../utils":106}],90:[function(require,module,exports){ +},{"../const":38,"../display/Container":39,"../math":59,"../textures/Texture":98,"../utils":105}],89:[function(require,module,exports){ var CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'), CONST = require('../../const'), math = require('../../math'), - canvasRenderWorldTransform = new math.Matrix(); + canvasRenderWorldTransform = new math.Matrix(), CanvasTinter = require('./CanvasTinter'); /** @@ -17511,7 +17244,7 @@ this.renderer = null; }; -},{"../../const":39,"../../math":60,"../../renderers/canvas/CanvasRenderer":67,"./CanvasTinter":91}],91:[function(require,module,exports){ +},{"../../const":38,"../../math":59,"../../renderers/canvas/CanvasRenderer":66,"./CanvasTinter":90}],90:[function(require,module,exports){ var utils = require('../../utils'), canUseNewCanvasBlendModes = require('../../renderers/canvas/utils/canUseNewCanvasBlendModes'); /** @@ -17744,7 +17477,7 @@ */ CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; -},{"../../renderers/canvas/utils/canUseNewCanvasBlendModes":70,"../../utils":106}],92:[function(require,module,exports){ +},{"../../renderers/canvas/utils/canUseNewCanvasBlendModes":69,"../../utils":105}],91:[function(require,module,exports){ var Buffer = function(size) @@ -17775,7 +17508,7 @@ this.uvs = null; this.colors = null; }; -},{}],93:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ var ObjectRenderer = require('../../renderers/webgl/utils/ObjectRenderer'), WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'), createIndicesForQuads = require('../../utils/createIndicesForQuads'), @@ -18129,7 +17862,7 @@ }; -},{"../../const":39,"../../renderers/webgl/WebGLRenderer":74,"../../renderers/webgl/utils/ObjectRenderer":84,"../../utils/createIndicesForQuads":104,"./BatchBuffer":92,"./generateMultiTextureShader":94,"bit-twiddle":16,"pixi-gl-core":1}],94:[function(require,module,exports){ +},{"../../const":38,"../../renderers/webgl/WebGLRenderer":73,"../../renderers/webgl/utils/ObjectRenderer":83,"../../utils/createIndicesForQuads":103,"./BatchBuffer":91,"./generateMultiTextureShader":93,"bit-twiddle":16,"pixi-gl-core":1}],93:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; var fragTemplate = [ @@ -18203,7 +17936,7 @@ module.exports = generateMultiTextureShader; -},{"pixi-gl-core":1}],95:[function(require,module,exports){ +},{"pixi-gl-core":1}],94:[function(require,module,exports){ var Sprite = require('../sprites/Sprite'), Texture = require('../textures/Texture'), math = require('../math'), @@ -18827,11 +18560,10 @@ this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture); }; -},{"../const":39,"../math":60,"../sprites/Sprite":89,"../textures/Texture":99,"../utils":106}],96:[function(require,module,exports){ +},{"../const":38,"../math":59,"../sprites/Sprite":88,"../textures/Texture":98,"../utils":105}],95:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), math = require('../math'), - CONST = require('../const'), - tempRect = new math.Rectangle(); + CONST = require('../const'); /** * A BaseRenderTexture is a special texture that allows any Pixi display object to be rendered to it. @@ -18863,15 +18595,17 @@ * * doc.addChild(sprite); * - * BaserenderTexture.render(doc); // Renders to center of BaserenderTexture + * var baseRenderTexture = new PIXI.BaserenderTexture(100, 100); + * var renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(doc, renderTexture); // Renders to center of RenderTexture * ``` * * @class - * @extends PIXI.Texture + * @extends PIXI.BaseTexture * @memberof PIXI - * @param renderer {PIXI.CanvasRenderer|PIXI.WebGLRenderer} The renderer used for this BaseRenderTexture - * @param [width=100] {number} The width of the render texture - * @param [height=100] {number} The height of the render texture + * @param [width=100] {number} The width of the base render texture + * @param [height=100] {number} The height of the base render texture * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @param [resolution=1] {number} The resolution of the texture being generated */ @@ -18886,15 +18620,21 @@ this.scaleMode = scaleMode || CONST.SCALE_MODES.DEFAULT; this.hasLoaded = true; + /** + * A map of renderer IDs to webgl renderTargets + * + * @member {object} + * @private + */ this._glRenderTargets = []; - this._canvasRenderTarget = null; - /** - * The renderer this BaseRenderTexture uses. A BaseRenderTexture can only belong to one renderer at the moment if its webGL. + * A reference to the canvas render target (we only need one as this can be shared accross renderers) * - * @member {PIXI.CanvasRenderer|PIXI.WebGLRenderer} + * @member {object} + * @private */ + this._canvasRenderTarget = null; /** * @member {boolean} @@ -18958,153 +18698,8 @@ this.renderer = null; }; -/** - * Will return a HTML Image of the texture - * - * @return {Image} - */ -BaseRenderTexture.prototype.getImage = function (frame) -{ - var image = new Image(); - image.src = this.getBase64(frame); - return image; -}; -/** - * Will return a a base64 encoded string of this texture. It works by calling BaseRenderTexture.getCanvas and then running toDataURL on that. - * - * @return {string} A base64 encoded string of the texture. - */ -BaseRenderTexture.prototype.getBase64 = function ( frame ) -{ - return this.getCanvas(frame).toDataURL(); -}; - -/** - * Creates a Canvas element, renders this BaseRenderTexture to it and then returns it. - * - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ -BaseRenderTexture.prototype.getCanvas = function ( frame ) -{ - - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.size.width; - frame.height = this.textureBuffer.size.height; - } - - var width = frame.width * this.resolution; - var height = frame.height * this.resolution; - - var gl = this.renderer.gl; - - var webGLPixels = new Uint8Array(4 * width * height); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - gl.readPixels(frame.x * this.resolution, frame.y * this.resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - var tempCanvas = new CanvasBuffer(width, height); - var canvasData = tempCanvas.context.getImageData(0, 0, width, height); - canvasData.data.set(webGLPixels); - - tempCanvas.context.putImageData(canvasData, 0, 0); - - return tempCanvas.canvas; - } - else - { - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.canvas.width; - frame.height = this.textureBuffer.canvas.height; - } - - if(frame.width === this.textureBuffer.canvas.width && - frame.height === this.textureBuffer.canvas.height ) - { - return this.textureBuffer.canvas; - } - else - { - - var resolution = this.resolution; - - var tempCanvas2 = new CanvasBuffer(frame.width * resolution, frame.height * resolution); - var canvasData2 = this.textureBuffer.context.getImageData(frame.x * resolution, frame.y * resolution, frame.width * resolution, frame.height * resolution); - - tempCanvas2.context.putImageData(canvasData2, 0, 0); - - return tempCanvas2.canvas; - } - } -}; - -/** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * - * @return {Uint8ClampedArray} - */ -BaseRenderTexture.prototype.getPixels = function ( frame ) -{ - if(!frame) - { - frame = tempRect; - frame.width = this.textureBuffer.size.width; - frame.height = this.textureBuffer.size.height; - } - - var width = frame.width * this.resolution; - var height = frame.height * this.resolution; - - if (this.renderer.type === CONST.RENDERER_TYPE.WEBGL) - { - var gl = this.renderer.gl; - - var webGLPixels = new Uint8Array(4 * width * height); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.textureBuffer.frameBuffer); - gl.readPixels(frame.x * this.resolution, frame.y * this.resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - return webGLPixels; - } - else - { - return this.textureBuffer.canvas.getContext('2d').getImageData(frame.x * this.resolution, frame.y * this.resolution, width, height).data; - } -}; - -/** - * 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). - * - * @param x {number} The x coordinate of the pixel to retrieve. - * @param y {number} The y coordinate of the pixel to retrieve. - * @return {Uint8ClampedArray} - */ -BaseRenderTexture.prototype.getPixel = function (frame, x, y) -{ - tempRect.x = x; - tempRect.y = y; - tempRect.width = 1 / this.resolution; - tempRect.height = 1 / this.resolution; - - if(frame) - { - tempRect.x += frame.x; - tempRect.y += frame.y; - } - - return this.getPixels(tempRect); -}; - -},{"../const":39,"../math":60,"./BaseTexture":97}],97:[function(require,module,exports){ +},{"../const":38,"../math":59,"./BaseTexture":96}],96:[function(require,module,exports){ var utils = require('../utils'), CONST = require('../const'), EventEmitter = require('eventemitter3'), @@ -19553,7 +19148,7 @@ return baseTexture; }; -},{"../const":39,"../utils":106,"../utils/determineCrossOrigin":105,"bit-twiddle":16,"eventemitter3":25}],98:[function(require,module,exports){ +},{"../const":38,"../utils":105,"../utils/determineCrossOrigin":104,"bit-twiddle":16,"eventemitter3":25}],97:[function(require,module,exports){ var BaseRenderTexture = require('./BaseRenderTexture'), Texture = require('./Texture'); @@ -19568,7 +19163,7 @@ * * ```js * var renderer = PIXI.autoDetectRenderer(1024, 1024, { view: canvas, ratio: 1 }); - * var renderTexture = new PIXI.RenderTexture(renderer, 800, 600); + * var renderTexture = PIXI.RenderTexture.create(800, 600); * var sprite = PIXI.Sprite.fromImage("spinObj_01.png"); * * sprite.position.x = 800/2; @@ -19576,7 +19171,7 @@ * sprite.anchor.x = 0.5; * sprite.anchor.y = 0.5; * - * renderTexture.render(sprite); + * renderer.render(sprite, renderTexture); * ``` * * The Sprite in this case will be rendered to a position of 0,0. To render this sprite at its actual @@ -19587,17 +19182,13 @@ * * doc.addChild(sprite); * - * renderTexture.render(doc); // Renders to center of renderTexture + * renderer.render(doc, renderTexture); // Renders to center of renderTexture * ``` * * @class * @extends PIXI.Texture * @memberof PIXI - * @param renderer {PIXI.CanvasRenderer|PIXI.WebGLRenderer} The renderer used for this RenderTexture - * @param [width=100] {number} The width of the render texture - * @param [height=100] {number} The height of the render texture - * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values - * @param [resolution=1] {number} The resolution of the texture being generated + * @param baseRenderTexture {PIXI.BaseRenderTexture} The renderer used for this RenderTexture */ function RenderTexture(baseRenderTexture, frame) { @@ -19608,17 +19199,18 @@ { var width = arguments[1]; var height = arguments[2]; + var scaleMode = arguments[3] || 0; + var resolution = arguments[4] || 1; // we have an old render texture.. console.warn('v4 RenderTexture now expects a new BaseRenderTexture. Please use RenderTexture.create('+width+', '+height+')'); this.legacyRenderer = arguments[0]; frame = null; - baseRenderTexture = new BaseRenderTexture(width, height, 0, 1); - + baseRenderTexture = new BaseRenderTexture(width, height, scaleMode, resolution); } - + /** * The base texture object that this texture uses * @@ -19665,13 +19257,19 @@ this._updateUvs(); }; - +/** + * A short hand way of creating a render texture.. + * @param [width=100] {number} The width of the render texture + * @param [height=100] {number} The height of the render texture + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [resolution=1] {number} The resolution of the texture being generated + */ RenderTexture.create = function(width, height, scaleMode, resolution) { return new RenderTexture(new BaseRenderTexture(width, height, scaleMode, resolution)); }; -},{"./BaseRenderTexture":96,"./Texture":99}],99:[function(require,module,exports){ +},{"./BaseRenderTexture":95,"./Texture":98}],98:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), VideoBaseTexture = require('./VideoBaseTexture'), TextureUvs = require('./TextureUvs'), @@ -20103,7 +19701,7 @@ if (!texture) { // check if its a video.. - var isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) != null; + var isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) !== null; if(isVideo) { return Texture.fromVideoUrl(source); @@ -20166,7 +19764,7 @@ */ Texture.EMPTY = new Texture(new BaseTexture()); -},{"../math":60,"../utils":106,"./BaseTexture":97,"./TextureUvs":100,"./VideoBaseTexture":101,"eventemitter3":25}],100:[function(require,module,exports){ +},{"../math":59,"../utils":105,"./BaseTexture":96,"./TextureUvs":99,"./VideoBaseTexture":100,"eventemitter3":25}],99:[function(require,module,exports){ /** * A standard object to store the Uvs of a texture @@ -20256,7 +19854,7 @@ this.uvs_uint32[3] = (((this.y3 * 65535) & 0xFFFF) << 16) | ((this.x3 * 65535) & 0xFFFF); }; -},{"../math/GroupD8":57}],101:[function(require,module,exports){ +},{"../math/GroupD8":56}],100:[function(require,module,exports){ var BaseTexture = require('./BaseTexture'), utils = require('../utils'); @@ -20493,7 +20091,7 @@ return source; } -},{"../utils":106,"./BaseTexture":97}],102:[function(require,module,exports){ +},{"../utils":105,"./BaseTexture":96}],101:[function(require,module,exports){ var CONST = require('../const'), EventEmitter = require('eventemitter3'), // Internal event used by composed emitter @@ -20848,7 +20446,7 @@ module.exports = Ticker; -},{"../const":39,"eventemitter3":25}],103:[function(require,module,exports){ +},{"../const":38,"eventemitter3":25}],102:[function(require,module,exports){ var Ticker = require('./Ticker'); /** @@ -20904,7 +20502,7 @@ Ticker: Ticker }; -},{"./Ticker":102}],104:[function(require,module,exports){ +},{"./Ticker":101}],103:[function(require,module,exports){ /** * Generic Mask Stack data structure * @class @@ -20935,7 +20533,7 @@ module.exports = createIndicesForQuads; -},{}],105:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ var tempAnchor; var _url = require('url'); @@ -20979,7 +20577,7 @@ }; module.exports = determineCrossOrigin; -},{"url":23}],106:[function(require,module,exports){ +},{"url":23}],105:[function(require,module,exports){ var CONST = require('../const'); /** @@ -21182,7 +20780,7 @@ BaseTextureCache: {} }; -},{"../const":39,"./pluginTarget":108,"eventemitter3":25}],107:[function(require,module,exports){ +},{"../const":38,"./pluginTarget":107,"eventemitter3":25}],106:[function(require,module,exports){ var Device = require('ismobilejs'); @@ -21203,7 +20801,7 @@ } module.exports = maxRecommendedTextures; -},{"ismobilejs":26}],108:[function(require,module,exports){ +},{"ismobilejs":26}],107:[function(require,module,exports){ /** * Mixins functionality to make an object have "plugins". * @@ -21273,10 +20871,11 @@ } }; -},{}],109:[function(require,module,exports){ +},{}],108:[function(require,module,exports){ /*global console */ var core = require('./core'), mesh = require('./mesh'), + particles = require('./particles'), extras = require('./extras'), filters = require('./filters'); @@ -21377,6 +20976,21 @@ /** * @class * @private + * @name ParticleContainer + * @memberof PIXI + * @see PIXI.particles.ParticleContainer + * @deprecated since version 4.0.0 + */ + ParticleContainer: { + get: function() { + console.warn('The ParticleContainer class has been moved to particles.ParticleContainer, please useparticles.ParticleContainer from now on.'); + return particles.ParticleContainer; + } + }, + + /** + * @class + * @private * @name MovieClip * @memberof PIXI * @see PIXI.extras.MovieClip @@ -21647,7 +21261,336 @@ return core.utils.uid(); }; -},{"./core":56,"./extras":116,"./filters":128,"./mesh":143}],110:[function(require,module,exports){ +},{"./core":55,"./extras":118,"./filters":130,"./mesh":145,"./particles":148}],109:[function(require,module,exports){ +var core = require('../../core'); +tempRect = new core.Rectangle(); + +/** + * The extract manager provides functionality to export content from the renderers + * @class + * @memberof PIXI + * @param renderer {PIXI.WebGLRenderer} A reference to the current renderer + */ +function WebGLExtract(renderer) +{ + this.renderer = renderer; + renderer.extract = this; +} + + +WebGLExtract.prototype.constructor = WebGLExtract; +module.exports = WebGLExtract; + +/** + * Will return a HTML Image of the target + * + * @return {Image} + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + */ +WebGLExtract.prototype.image = function ( target ) +{ + var image = new Image(); + image.src = this.base64( target ); + return image; +} + +/** + * Will return a a base64 encoded string of this target. It works by calling WebGLExtract.getCanvas and then running toDataURL on that. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ +WebGLExtract.prototype.base64 = function ( target ) +{ + return this.canvas( target ).toDataURL(); +}; + +/** + * Creates a Canvas element, renders this target to it and then returns it. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ +WebGLExtract.prototype.canvas = function ( target ) +{ + var renderer = this.renderer; + var context; + var resolution; + var frame; + var renderTexture; + + if(target) + { + if(target instanceof core.RenderTexture) + { + renderTexture = target; + } + else + { + renderTexture = this.renderer.generateTexture(target); + } + } + + if(renderTexture) + { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } + else + { + context = this.renderer.rootContext; + resolution = this.renderer.rootResolution; + + frame = tempRect; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + } + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var canvasBuffer = new core.CanvasRenderTarget(width, height); + var canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height); + canvasBuffer.context.putImageData(canvasData, 0, 0); + + + // send the canvas back.. + return canvasBuffer.canvas; +}; + +/** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} + */ +WebGLExtract.prototype.pixels = function ( renderTexture ) +{ + var renderer = this.renderer; + var context; + var resolution; + + if(renderTexture) + { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } + else + { + context = this.renderer.rootContext; + resolution = this.renderer.rootResolution; + + frame = tempRect; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + } + + return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data; +}; + +/** + * Destroys the extract + * + */ +WebGLExtract.prototype.destroy = function () +{ + this.renderer.extract = null; + this.renderer = null; +}; + +core.CanvasRenderer.registerPlugin('extract', WebGLExtract); + +},{"../../core":55}],110:[function(require,module,exports){ + +module.exports = { + webGL: require('./webgl/WebGLExtract'), + canvas: require('./canvas/CanvasExtract') +} +},{"./canvas/CanvasExtract":109,"./webgl/WebGLExtract":111}],111:[function(require,module,exports){ +var core = require('../../core'); +tempRect = new core.Rectangle(); + +/** + * The extract manager provides functionality to export content from the renderers + * @class + * @memberof PIXI + * @param renderer {PIXI.CanvasRenderer} A reference to the current renderer + */ +function Extract(renderer) +{ + this.renderer = renderer; + renderer.extract = this; +} + + +Extract.prototype.constructor = Extract; +module.exports = Extract; + +/** + * Will return a HTML Image of the target + * + * @return {Image} + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + */ +Extract.prototype.image = function ( target ) +{ + var image = new Image(); + image.src = this.base64( target ); + return image; +} + +/** + * Will return a a base64 encoded string of this target. It works by calling WebGLExtract.getCanvas and then running toDataURL on that. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ +Extract.prototype.base64 = function ( target ) +{ + return this.canvas( target ).toDataURL(); +}; + +/** + * Creates a Canvas element, renders this target to it and then returns it. + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ +Extract.prototype.canvas = function ( target ) +{ + var renderer = this.renderer; + var textureBuffer; + var resolution; + var frame; + var flipY = false; + var renderTexture; + + if(target) + { + if(target instanceof core.RenderTexture) + { + renderTexture = target; + } + else + { + renderTexture = this.renderer.generateTexture(target); + + } + } + + if(renderTexture) + { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + flipY = false; + } + else + { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + flipY = true; + + frame = tempRect; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + + } + + + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var canvasBuffer = new core.CanvasRenderTarget(width, height); + + if(textureBuffer) + { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + + // set up an array of pixels + var webGLPixels = new Uint8Array(4 * width * height); + + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); + + // add the pixels to the canvas + var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); + canvasData.data.set(webGLPixels); + + canvasBuffer.context.putImageData(canvasData, 0, 0); + + // pulling pixels + if(flipY) + { + canvasBuffer.context.scale(1, -1); + canvasBuffer.context.drawImage(canvasBuffer.canvas, 0,-height); + } + } + + // send the canvas back.. + return canvasBuffer.canvas; +}; + +/** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). + * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} + */ +Extract.prototype.pixels = function ( renderTexture, area ) +{ + var renderer = this.renderer; + var textureBuffer; + var resolution; + + if(renderTexture) + { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + + } + else + { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + + frame = tempRect; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + } + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var gl = this.renderer.gl; + + var webGLPixels = new Uint8Array(4 * width * height); + + if(textureBuffer) + { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webGLPixels); + } + + return webGLPixels; +}; + +/** + * Destroys the extract + * + */ +Extract.prototype.destroy = function () +{ + this.renderer.extract = null; + this.renderer = null; +}; + +core.WebGLRenderer.registerPlugin('extract', Extract); + +},{"../../core":55}],112:[function(require,module,exports){ var core = require('../core'); /** @@ -22035,7 +21978,7 @@ BitmapText.fonts = {}; -},{"../core":56}],111:[function(require,module,exports){ +},{"../core":55}],113:[function(require,module,exports){ var core = require('../core'); /** @@ -22355,7 +22298,7 @@ return new MovieClip(textures); }; -},{"../core":56}],112:[function(require,module,exports){ +},{"../core":55}],114:[function(require,module,exports){ var core = require('../core'), // a sprite use dfor rendering textures.. tempPoint = new core.Point(), @@ -22787,7 +22730,7 @@ return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode),width,height); }; -},{"../core":56,"../core/sprites/canvas/CanvasTinter":91,"./webgl/TilingShader":117}],113:[function(require,module,exports){ +},{"../core":55,"../core/sprites/canvas/CanvasTinter":90,"./webgl/TilingShader":119}],115:[function(require,module,exports){ var core = require('../core'), DisplayObject = core.DisplayObject, _tempMatrix = new core.Matrix(); @@ -23063,7 +23006,7 @@ this._originalDestroy(); }; -},{"../core":56}],114:[function(require,module,exports){ +},{"../core":55}],116:[function(require,module,exports){ var core = require('../core'); /** @@ -23093,7 +23036,7 @@ return null; }; -},{"../core":56}],115:[function(require,module,exports){ +},{"../core":55}],117:[function(require,module,exports){ var core = require('../core'); /** @@ -23123,7 +23066,7 @@ return point; }; -},{"../core":56}],116:[function(require,module,exports){ +},{"../core":55}],118:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -23144,7 +23087,7 @@ BitmapText: require('./BitmapText') }; -},{"./BitmapText":110,"./MovieClip":111,"./TilingSprite":112,"./cacheAsBitmap":113,"./getChildByName":114,"./getGlobalPosition":115}],117:[function(require,module,exports){ +},{"./BitmapText":112,"./MovieClip":113,"./TilingSprite":114,"./cacheAsBitmap":115,"./getChildByName":116,"./getGlobalPosition":117}],119:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; @@ -23168,7 +23111,7 @@ module.exports = TilingShader; -},{"pixi-gl-core":1}],118:[function(require,module,exports){ +},{"pixi-gl-core":1}],120:[function(require,module,exports){ var core = require('../../core'), BlurXFilter = require('./BlurXFilter'), BlurYFilter = require('./BlurYFilter'); @@ -23284,7 +23227,7 @@ } }); -},{"../../core":56,"./BlurXFilter":119,"./BlurYFilter":120}],119:[function(require,module,exports){ +},{"../../core":55,"./BlurXFilter":121,"./BlurYFilter":122}],121:[function(require,module,exports){ var core = require('../../core'); var generateBlurVertSource = require('./generateBlurVertSource'); var generateBlurFragSource = require('./generateBlurFragSource'); @@ -23392,7 +23335,7 @@ } }); -},{"../../core":56,"./generateBlurFragSource":121,"./generateBlurVertSource":122,"./getMaxBlurKernelSize":123}],120:[function(require,module,exports){ +},{"../../core":55,"./generateBlurFragSource":123,"./generateBlurVertSource":124,"./getMaxBlurKernelSize":125}],122:[function(require,module,exports){ var core = require('../../core'); var generateBlurVertSource = require('./generateBlurVertSource'); var generateBlurFragSource = require('./generateBlurFragSource'); @@ -23490,7 +23433,7 @@ } }); -},{"../../core":56,"./generateBlurFragSource":121,"./generateBlurVertSource":122,"./getMaxBlurKernelSize":123}],121:[function(require,module,exports){ +},{"../../core":55,"./generateBlurFragSource":123,"./generateBlurVertSource":124,"./getMaxBlurKernelSize":125}],123:[function(require,module,exports){ var GAUSSIAN_VALUES = { 5:[0.153388, 0.221461, 0.250301], 7:[0.071303, 0.131514, 0.189879, 0.214607], @@ -23555,7 +23498,7 @@ module.exports = generateFragBlurSource; -},{}],122:[function(require,module,exports){ +},{}],124:[function(require,module,exports){ var vertTemplate = [ 'attribute vec2 aVertexPosition;', @@ -23621,7 +23564,7 @@ module.exports = generateVertBlurSource; -},{}],123:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ var getMaxKernelSize = function(gl) @@ -23639,7 +23582,7 @@ module.exports = getMaxKernelSize; -},{}],124:[function(require,module,exports){ +},{}],126:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 @@ -24173,7 +24116,7 @@ } }); -},{"../../core":56}],125:[function(require,module,exports){ +},{"../../core":55}],127:[function(require,module,exports){ var core = require('../../core'); @@ -24252,7 +24195,7 @@ } }); -},{"../../core":56}],126:[function(require,module,exports){ +},{"../../core":55}],128:[function(require,module,exports){ var core = require('../../core'); @@ -24345,7 +24288,7 @@ } }); -},{"../../core":56}],127:[function(require,module,exports){ +},{"../../core":55}],129:[function(require,module,exports){ var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 @@ -24394,7 +24337,7 @@ } }); -},{"../../core":56}],128:[function(require,module,exports){ +},{"../../core":55}],130:[function(require,module,exports){ /** * @file Main export of the PIXI filters library * @author Mat Groves @@ -24435,7 +24378,7 @@ GodrayFilter: require('./godray/GodrayFilter') }; -},{"./blur/BlurFilter":118,"./blur/BlurXFilter":119,"./blur/BlurYFilter":120,"./colormatrix/ColorMatrixFilter":124,"./displacement/DisplacementFilter":125,"./godray/GodrayFilter":126,"./gray/GrayFilter":127,"./twist/TwistFilter":129}],129:[function(require,module,exports){ +},{"./blur/BlurFilter":120,"./blur/BlurXFilter":121,"./blur/BlurYFilter":122,"./colormatrix/ColorMatrixFilter":126,"./displacement/DisplacementFilter":127,"./godray/GodrayFilter":128,"./gray/GrayFilter":129,"./twist/TwistFilter":131}],131:[function(require,module,exports){ var core = require('../../core'); @@ -24533,7 +24476,7 @@ } }); -},{"../../core":56}],130:[function(require,module,exports){ +},{"../../core":55}],132:[function(require,module,exports){ (function (global){ // run the polyfills require('./polyfill'); @@ -24548,6 +24491,7 @@ core.mesh = require('./mesh'); core.particles = require('./particles'); core.accessibility = require('./accessibility'); +core.extract = require('./extract'); // export a premade loader instance /** @@ -24566,7 +24510,7 @@ global.PIXI = core; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./accessibility":37,"./core":56,"./deprecation":109,"./extras":116,"./filters":128,"./interaction":133,"./loaders":136,"./mesh":143,"./particles":146,"./polyfill":152}],131:[function(require,module,exports){ +},{"./accessibility":37,"./core":55,"./deprecation":108,"./extract":110,"./extras":118,"./filters":130,"./interaction":135,"./loaders":138,"./mesh":145,"./particles":148,"./polyfill":154}],133:[function(require,module,exports){ var core = require('../core'); /** @@ -24615,7 +24559,7 @@ return displayObject.worldTransform.applyInverse(globalPos || this.global, point); }; -},{"../core":56}],132:[function(require,module,exports){ +},{"../core":55}],134:[function(require,module,exports){ var core = require('../core'), InteractionData = require('./InteractionData'); @@ -24709,7 +24653,7 @@ * @private */ this.moveWhenInside = false; - + /** * Have events been attached to the dom element? * @@ -24770,6 +24714,13 @@ this.last = 0; /** + * Every update cursor will be reset to this value, if some element wont override it in its hitTest + * @member {string} + * @default 'inherit' + */ + this.defaultCursorStyle = 'inherit'; + + /** * The css style of the cursor that is being used * @member {string} */ @@ -24781,7 +24732,7 @@ * @private */ this._tempPoint = new core.Point(); - + /** * The current resolution @@ -24913,7 +24864,7 @@ return; } - this.cursor = 'inherit'; + this.cursor = this.defaultCursorStyle; this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, true ); @@ -24983,21 +24934,21 @@ } // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ - // + // // This function will now loop through all objects and then only hit test the objects it HAS to, not all of them. MUCH faster.. // An object will be hit test if the following is true: - // + // // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // + // // As another little optimisation once an interactive object has been hit we can carry on through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests // A final optimisation is that an object is not hit test directly if a child has already been hit. - + var hit = false, interactiveParent = interactive = displayObject.interactive || interactive; - + // if the displayobject has a hitArea, then it does not need to hitTest children. if(displayObject.hitArea) @@ -25006,23 +24957,31 @@ } // it has a mask! Then lets hit test that before continuing.. - if(displayObject._mask) + if(hitTest && displayObject._mask) { if(!displayObject._mask.containsPoint(point)) { - return false; + hitTest = false; } } - // ** FREE TIP **! If an object is not interacttive or has no buttons in it (such as a game scene!) set interactiveChildren to false for that displayObject. + // it has a filterArea! Same as mask but easier, its a rectangle + if(hitTest && displayObject.filterArea) + { + if(!displayObject.filterArea.contains(point)) + { + hitTest = false; + } + } + + // ** FREE TIP **! If an object is not interactive or has no buttons in it (such as a game scene!) set interactiveChildren to false for that displayObject. // This will allow pixi to completly ignore and bypass checking the displayObjects children. if(displayObject.interactiveChildren) - { + { var children = displayObject.children; - + for (var i = children.length-1; i >= 0; i--) { - var child = children[i]; // time to get recursive.. if this function will return if somthing is hit.. @@ -25039,8 +24998,8 @@ // we no longer need to hit test any more objects in this container as we we now know the parent has been hit interactiveParent = false; - - // If the child is interactive , that means that the object hit was actually interactive and not just the child of an interactive object. + + // If the child is interactive , that means that the object hit was actually interactive and not just the child of an interactive object. // This means we no longer need to hit test anything else. We still need to run through all objects, but we don't need to perform any hit tests. // if(child.interactive) //{ @@ -25048,12 +25007,12 @@ //} // we can break now as we have hit an object. - + } } } - + // no point running this if the item is not interactive or does not have an interactive parent. if(interactive) @@ -25061,7 +25020,7 @@ // if we are hit testing (as in we have no hit any objects yet) // We also don't need to worry about hit testing if once of the displayObjects children has already been hit! if(hitTest && !hit) - { + { if(displayObject.hitArea) { @@ -25078,12 +25037,12 @@ if(displayObject.interactive) { - func(displayObject, hit); + func(displayObject, hit); } } return hit; - + }; @@ -25120,7 +25079,7 @@ InteractionManager.prototype.processMouseDown = function ( displayObject, hit ) { var e = this.mouse.originalEvent; - + var isRightButton = e.button === 2 || e.which === 3; if(hit) @@ -25202,7 +25161,7 @@ this.didMove = true; - this.cursor = 'inherit'; + this.cursor = this.defaultCursorStyle; this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true ); @@ -25225,7 +25184,7 @@ InteractionManager.prototype.processMouseMove = function ( displayObject, hit ) { this.processMouseOverOut(displayObject, hit); - + // only display on mouse over if(!this.moveWhenInside || hit) { @@ -25248,7 +25207,7 @@ // Update internal mouse reference this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY); - this.interactionDOMElement.style.cursor = 'inherit'; + this.interactionDOMElement.style.cursor = this.defaultCursorStyle; // TODO optimize by not check EVERY TIME! maybe half as often? // this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY ); @@ -25539,7 +25498,7 @@ core.WebGLRenderer.registerPlugin('interaction', InteractionManager); core.CanvasRenderer.registerPlugin('interaction', InteractionManager); -},{"../core":56,"./InteractionData":131,"./interactiveTarget":134}],133:[function(require,module,exports){ +},{"../core":55,"./InteractionData":133,"./interactiveTarget":136}],135:[function(require,module,exports){ /** * @file Main export of the PIXI interactions library * @author Mat Groves @@ -25556,7 +25515,7 @@ interactiveTarget: require('./interactiveTarget') }; -},{"./InteractionData":131,"./InteractionManager":132,"./interactiveTarget":134}],134:[function(require,module,exports){ +},{"./InteractionData":133,"./InteractionManager":134,"./interactiveTarget":136}],136:[function(require,module,exports){ /** * Default property values of interactive objects * used by {@link PIXI.interaction.InteractionManager}. @@ -25605,7 +25564,7 @@ module.exports = interactiveTarget; -},{}],135:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ var Resource = require('resource-loader').Resource, core = require('../core'), extras = require('../extras'), @@ -25729,7 +25688,7 @@ }; }; -},{"../core":56,"../extras":116,"path":17,"resource-loader":32}],136:[function(require,module,exports){ +},{"../core":55,"../extras":118,"path":17,"resource-loader":32}],138:[function(require,module,exports){ /** * @file Main export of the PIXI loaders library * @author Mat Groves @@ -25750,7 +25709,7 @@ Resource: require('resource-loader').Resource }; -},{"./bitmapFontParser":135,"./loader":137,"./spritesheetParser":138,"./textureParser":139,"resource-loader":32}],137:[function(require,module,exports){ +},{"./bitmapFontParser":137,"./loader":139,"./spritesheetParser":140,"./textureParser":141,"resource-loader":32}],139:[function(require,module,exports){ var ResourceLoader = require('resource-loader'), textureParser = require('./textureParser'), spritesheetParser = require('./spritesheetParser'), @@ -25812,7 +25771,7 @@ Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT); -},{"./bitmapFontParser":135,"./spritesheetParser":138,"./textureParser":139,"resource-loader":32}],138:[function(require,module,exports){ +},{"./bitmapFontParser":137,"./spritesheetParser":140,"./textureParser":141,"resource-loader":32}],140:[function(require,module,exports){ var Resource = require('resource-loader').Resource, path = require('path'), core = require('../core'); @@ -25884,7 +25843,7 @@ }; }; -},{"../core":56,"path":17,"resource-loader":32}],139:[function(require,module,exports){ +},{"../core":55,"path":17,"resource-loader":32}],141:[function(require,module,exports){ var core = require('../core'); module.exports = function () @@ -25906,7 +25865,7 @@ }; }; -},{"../core":56}],140:[function(require,module,exports){ +},{"../core":55}],142:[function(require,module,exports){ var core = require('../core'), glCore = require('pixi-gl-core'), Shader = require('./webgl/MeshShader'), @@ -25968,6 +25927,7 @@ * @member {boolean} */ this.dirty = true; + this.indexDirty = true; /** * The blend mode to be applied to the sprite. Set to `PIXI.BLEND_MODES.NORMAL` to remove any blend mode. @@ -26081,12 +26041,22 @@ .addAttribute(glData.uvBuffer, glData.shader.attributes.aTextureCoord, gl.FLOAT, false, 2 * 4, 0); this._glDatas[renderer.CONTEXT_UID] = glData; + + + this.indexDirty = false; } if(this.dirty) { this.dirty = false; glData.uvBuffer.upload(); + + } + + if(this.indexDirty) + { + this.indexDirty = false; + glData.indexBuffer.upload(); } glData.vertexBuffer.upload(); @@ -26431,7 +26401,7 @@ TRIANGLES: 1 }; -},{"../core":56,"./webgl/MeshShader":144,"pixi-gl-core":1}],141:[function(require,module,exports){ +},{"../core":55,"./webgl/MeshShader":146,"pixi-gl-core":1}],143:[function(require,module,exports){ var Mesh = require('./Mesh'); /** @@ -26492,9 +26462,6 @@ var indices = []; var texture = this.texture; - // texture.width = 800 texture.width || 800; - // texture.height = 800//texture.height || 800; - var segmentsXSub = this.segmentsX - 1; var segmentsYSub = this.segmentsY - 1; var i = 0; @@ -26540,6 +26507,8 @@ this.uvs = new Float32Array(uvs); this.colors = new Float32Array(colors); this.indices = new Uint16Array(indices); + + this.indexDirty = true; }; /** @@ -26557,7 +26526,7 @@ } }; -},{"./Mesh":140}],142:[function(require,module,exports){ +},{"./Mesh":142}],144:[function(require,module,exports){ var Mesh = require('./Mesh'); var core = require('../core'); @@ -26685,6 +26654,7 @@ } this.dirty = true; + this.indexDirty = true; }; /** @@ -26694,6 +26664,7 @@ */ Rope.prototype._onTextureUpdate = function () { + Mesh.prototype._onTextureUpdate.call(this); // wait for the Rope ctor to finish before calling refresh @@ -26770,7 +26741,7 @@ this.containerUpdateTransform(); }; -},{"../core":56,"./Mesh":140}],143:[function(require,module,exports){ +},{"../core":55,"./Mesh":142}],145:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -26788,7 +26759,7 @@ MeshShader: require('./webgl/MeshShader') }; -},{"./Mesh":140,"./Plane":141,"./Rope":142,"./webgl/MeshShader":144}],144:[function(require,module,exports){ +},{"./Mesh":142,"./Plane":143,"./Rope":144,"./webgl/MeshShader":146}],146:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -26838,7 +26809,7 @@ module.exports = MeshShader; -},{"pixi-gl-core":1}],145:[function(require,module,exports){ +},{"pixi-gl-core":1}],147:[function(require,module,exports){ var core = require('../core'); /** @@ -26863,7 +26834,7 @@ * * @class * @extends PIXI.Container - * @memberof PIXI + * @memberof PIXI.particles * @param [maxSize=15000] {number} The maximum number of particles that can be renderer by the container. * @param [properties] {object} The properties of children that should be uploaded to the gpu and applied. * @param [properties.scale=false] {boolean} When true, scale be uploaded and applied. @@ -27171,7 +27142,7 @@ this._buffers = null; }; -},{"../core":56}],146:[function(require,module,exports){ +},{"../core":55}],148:[function(require,module,exports){ /** * @file Main export of the PIXI extras library * @author Mat Groves @@ -27187,7 +27158,7 @@ ParticleRenderer: require('./webgl/ParticleRenderer') }; -},{"./ParticleContainer":145,"./webgl/ParticleRenderer":148}],147:[function(require,module,exports){ +},{"./ParticleContainer":147,"./webgl/ParticleRenderer":150}],149:[function(require,module,exports){ var glCore = require('pixi-gl-core'), createIndicesForQuads = require('../../core/utils/createIndicesForQuads'); @@ -27408,7 +27379,7 @@ this.staticBuffer.destroy(); }; -},{"../../core/utils/createIndicesForQuads":104,"pixi-gl-core":1}],148:[function(require,module,exports){ +},{"../../core/utils/createIndicesForQuads":103,"pixi-gl-core":1}],150:[function(require,module,exports){ var core = require('../../core'), ParticleShader = require('./ParticleShader'), ParticleBuffer = require('./ParticleBuffer'); @@ -27839,7 +27810,7 @@ this.tempMatrix = null; }; -},{"../../core":56,"./ParticleBuffer":147,"./ParticleShader":149}],149:[function(require,module,exports){ +},{"../../core":55,"./ParticleBuffer":149,"./ParticleShader":151}],151:[function(require,module,exports){ var Shader = require('pixi-gl-core').GLShader; /** @@ -27907,7 +27878,7 @@ module.exports = ParticleShader; -},{"pixi-gl-core":1}],150:[function(require,module,exports){ +},{"pixi-gl-core":1}],152:[function(require,module,exports){ // References: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign @@ -27923,7 +27894,7 @@ }; } -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ // References: // https://github.com/sindresorhus/object-assign // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign @@ -27933,7 +27904,7 @@ Object.assign = require('object-assign'); } -},{"object-assign":27}],152:[function(require,module,exports){ +},{"object-assign":27}],154:[function(require,module,exports){ require('./Object.assign'); require('./requestAnimationFrame'); require('./Math.sign'); @@ -27951,7 +27922,7 @@ window.Uint16Array = Array; } -},{"./Math.sign":150,"./Object.assign":151,"./requestAnimationFrame":153}],153:[function(require,module,exports){ +},{"./Math.sign":152,"./Object.assign":153,"./requestAnimationFrame":155}],155:[function(require,module,exports){ (function (global){ // References: // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ @@ -28021,6 +27992,6 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[130])(130) +},{}]},{},[132])(132) }); //# sourceMappingURL=pixi.js.map diff --git a/bin/pixi.js.map b/bin/pixi.js.map index 9eed427..7cbc440 100644 --- a/bin/pixi.js.map +++ b/bin/pixi.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["pixi.js"],"sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.PIXI = f()}})(function(){var define,module,exports;return (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= data.byteLength)\n\t{\n\t\tgl.bufferSubData(this.type, offset, data);\n\t}\n\telse\n\t{\n\t\tgl.bufferData(this.type, data, this.drawType);\n\t}\n\n\tthis.data = data;\n}\n/**\n * Binds the buffer\n *\n */\nBuffer.prototype.bind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindBuffer(this.type, this.buffer);\n}\n\nBuffer.createVertexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ARRAY_BUFFER, data, drawType);\n}\n\nBuffer.createIndexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ELEMENT_ARRAY_BUFFER, data, drawType);\n}\n\nBuffer.create = function(gl, type, data, drawType)\n{\n\treturn new Buffer(gl, type, drawType);\n}\n\n/**\n * Destroys the buffer\n *\n */\nBuffer.prototype.destroy = function(){\n\tthis.gl.deleteBuffer(this.buffer);\n}\n\nmodule.exports = Buffer;\n\n},{}],3:[function(require,module,exports){\n\nvar Texture = require('./GLTexture');\n\n/**\n * Helper class to create a webGL Framebuffer\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n */\nvar Framebuffer = function(gl, width, height)\n{\n\t/**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n\tthis.gl = gl;\n\n\t/**\n * The frame buffer\n *\n * @member {WebGLFramebuffer}\n */\n\tthis.framebuffer = gl.createFramebuffer();\n\n\t/**\n * The stencil buffer\n *\n * @member {WebGLRenderbuffer}\n */\n\tthis.stencil = null;\n\n\t/**\n * The stencil buffer\n *\n * @member {GLTexture}\n */\n\tthis.texture = null;\n\n\t/**\n * The width of the drawing area of the buffer\n *\n * @member {Number}\n */\n\tthis.width = width || 100;\n\t/**\n * The height of the drawing area of the buffer\n *\n * @member {Number}\n */\n\tthis.height = height || 100;\n}\n\n/**\n * Adds a texture to the frame buffer\n * @param texture {GLTexture}\n */\nFramebuffer.prototype.enableTexture = function(texture)\n{\n\tvar gl = this.gl;\n\n\tthis.texture = texture || new Texture(gl);\n\n\tthis.texture.bind();\n\n\t//gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n\tthis.bind();\n\n\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture.texture, 0);\n}\n\n/**\n * Initialises the stencil buffer\n * @mat maybe you can come up with a better explaination\n */\nFramebuffer.prototype.enableStencil = function()\n{\n\tif(this.stencil)return;\n\n\tvar gl = this.gl;\n\n\tthis.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n\n // TODO.. this is depth AND stencil?\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.width , this.height );\n}\n\n/**\n * Erases the drawing area and fills it with a colour\n * @param r {Number} the red value of the clearing colour\n * @param g {Number} the green value of the clearing colour\n * @param b {Number} the blue value of the clearing colour\n * @param a {Number} the alpha value of the clearing colour\n */\nFramebuffer.prototype.clear = function( r, g, b, a )\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n gl.clearColor(r, g, b, a);\n gl.clear(gl.COLOR_BUFFER_BIT);\n}\n\n/**\n * Binds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.bind = function()\n{\n\tvar gl = this.gl;\n\n\tif(this.texture)\n\t{\n\t\tthis.texture.unbind();\n\t}\n\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer );\n}\n\n/**\n * Unbinds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.unbind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, null );\t\n}\n/**\n * Resizes the drawing area of the buffer to the given width and height\n * @param width {Number} the new width\n * @param height {Number} the new height\n */\nFramebuffer.prototype.resize = function(width, height)\n{\n\tvar gl = this.gl;\n\n\tthis.width = width;\n\tthis.height = height;\n\n\tif ( this.texture )\n {\n \tthis.texture.uploadData(null, width, height);\n\t}\n\n\tif ( this.stencil )\n {\n // update the stencil buffer width and height\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\n }\n}\n\n/**\n * Destroys this buffer\n */\nFramebuffer.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n\n\t//TODO\n\tif(this.texture)\n\t{\n\t\tthis.texture.destroy();\n\t}\n\n\tgl.deleteFramebuffer(this.framebuffer);\n\n\tthis.gl = null;\n\n\tthis.stencil = null;\n\tthis.texture = null;\n}\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @mat can you confirm ? :)\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createRGBA = function(gl, width, height, data)\n{\n\tvar texture = Texture.fromData(gl, null, width, height);\n\ttexture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture);\n\n fbo.unbind();\n\n return fbo;\n}\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @mat not sure what the difference is with the method above ?\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createFloat32 = function(gl, width, height, data)\n{\n\t// create a new texture..\n var texture = new Texture.fromData(gl, data, width, height);\n texture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture)\n\n fbo.unbind();\n\n return fbo;\n}\n\nmodule.exports = Framebuffer;\n\n},{\"./GLTexture\":5}],4:[function(require,module,exports){\n\nvar compileProgram = require('./shader/compileProgram'),\n\textractAttributes = require('./shader/extractAttributes'),\n\textractUniforms = require('./shader/extractUniforms'),\n\tgenerateUniformAccessObject = require('./shader/generateUniformAccessObject');\n\n/**\n * Helper class to create a webGL Shader\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext}\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 */\nvar Shader = function(gl, vertexSrc, fragmentSrc)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\t/**\n\t * The shader program\n\t *\n\t * @member {WebGLProgram}\n\t */\n\t// First compile the program..\n\tthis.program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n\n\t/**\n\t * The attributes of the shader as an object containing the following properties\n\t * {\n\t * \ttype,\n\t * \tsize,\n\t * \tlocation,\n\t * \tpointer\n\t * }\n\t * @member {Object}\n\t */\n\t// next extract the attributes\n\tthis.attributes = extractAttributes(gl, this.program);\n\n var uniformData = extractUniforms(gl, this.program);\n\n\t/**\n\t * The uniforms of the shader as an object containing the following properties\n\t * {\n\t * \tgl,\n\t * \tdata\n\t * }\n\t * @member {Object}\n\t */\n this.uniforms = generateUniformAccessObject( gl, uniformData );\n}\n/**\n * Uses this shader\n */\nShader.prototype.bind = function()\n{\n\tthis.gl.useProgram(this.program);\n}\n\n/**\n * Destroys this shader\n * TODO\n */\nShader.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n}\n\nmodule.exports = Shader;\n\n},{\"./shader/compileProgram\":9,\"./shader/extractAttributes\":11,\"./shader/extractUniforms\":12,\"./shader/generateUniformAccessObject\":13}],5:[function(require,module,exports){\n\n/**\n * Helper class to create a WebGL Texture\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param width {number} the width of the texture\n * @param height {number} the height of the texture\n * @param format {number} the pixel format of the texture. defaults to gl.RGBA\n * @param type {number} the gl type of the texture. defaults to gl.UNSIGNED_BYTE\n */\nvar Texture = function(gl, width, height, format, type)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\n\t/**\n\t * The WebGL texture\n\t *\n\t * @member {WebGLTexture}\n\t */\n\tthis.texture = gl.createTexture();\n\n\t/**\n\t * If mipmapping was used for this texture, enable and disable with enableMipmap()\n\t *\n\t * @member {Boolean}\n\t */\n\t// some settings..\n\tthis.mipmap = false;\n\n\n\t/**\n\t * Set to true to enable pre-multiplied alpha\n\t *\n\t * @member {Boolean}\n\t */\n\tthis.premultiplyAlpha = false;\n\n\t/**\n\t * The width of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.width = width || 0;\n\t/**\n\t * The height of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.height = height || 0;\n\n\t/**\n\t * The pixel format of the texture. defaults to gl.RGBA\n\t *\n\t * @member {Number}\n\t */\n\tthis.format = format || gl.RGBA;\n\n\t/**\n\t * The gl type of the texture. defaults to gl.UNSIGNED_BYTE\n\t *\n\t * @member {Number}\n\t */\n\tthis.type = type || gl.UNSIGNED_BYTE;\n\n\n}\n\n/**\n * Uploads this texture to the GPU\n * @param source {HTMLImageElement|ImageData} the source image of the texture\n */\nTexture.prototype.upload = function(source)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\tthis.width = source.width;\n\tthis.height = source.height;\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source);\n}\n\nvar FLOATING_POINT_AVAILABLE = false;\n\n/**\n * Use a data source and uploads this texture to the GPU\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.prototype.uploadData = function(data, width, height)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\tthis.width = width || this.width;\n\tthis.height = height || this.height;\n\n\tif(data instanceof Float32Array)\n\t{\n\t\tif(!FLOATING_POINT_AVAILABLE)\n\t\t{\n\t\t\tvar ext = gl.getExtension(\"OES_texture_float\");\n\n\t\t\tif(ext)\n\t\t\t{\n\t\t\t\tFLOATING_POINT_AVAILABLE = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Error('floating point textures not available');\n\t\t\t}\n\t\t}\n\n\t\tthis.type = gl.FLOAT;\n\t}\n\telse\n\t{\n\t\t// TODO support for other types\n\t\tthis.type = gl.UNSIGNED_BYTE;\n\t}\n\n\t\n\n\t// what type of data?\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n\tgl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.width, this.height, 0, this.format, this.type, data || null);\n\n}\n\n/**\n * Binds the texture\n * @param location {@mat}\n */\nTexture.prototype.bind = function(location)\n{\n\tvar gl = this.gl;\n\n\tif(location !== undefined)\n\t{\n\t\tgl.activeTexture(gl.TEXTURE0 + location);\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, this.texture);\n}\n\n/**\n * Unbinds the texture\n */\nTexture.prototype.unbind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n}\n\n/**\n * @mat\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.minFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tif(this.mipmap)\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n\t}\n\telse\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n\t}\n}\n\n/**\n * @mat\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.magFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n}\n\n/**\n * Enables mipmapping\n */\nTexture.prototype.enableMipmap = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tthis.mipmap = true;\n\n\tgl.generateMipmap(gl.TEXTURE_2D);\n}\n\n/**\n * Enables linear filtering\n */\nTexture.prototype.enableLinearScaling = function()\n{\n\tthis.minFilter(true);\n\tthis.magFilter(true);\n}\n\n/**\n * Enables nearest neighbour interpolation\n */\nTexture.prototype.enableNearestScaling = function()\n{\n\tthis.minFilter(false);\n\tthis.magFilter(false);\n}\n\n/**\n * Enables clamping on the texture so WebGL will not repeat it\n */\nTexture.prototype.enableWrapClamp = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.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\n/**\n * Enable tiling on the texture\n */\nTexture.prototype.enableWrapRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.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/**\n * @mat\n */\nTexture.prototype.enableWrapMirrorRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n}\n\n\n/**\n * Destroys this texture\n */\nTexture.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n\t//TODO\n\tgl.deleteTexture(this.texture);\n}\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param source {HTMLImageElement|ImageData} the source image of the texture\n * @param premultiplyAlpha {Boolean} If we want to use pre-multiplied alpha\n */\nTexture.fromSource = function(gl, source, premultiplyAlpha)\n{\n\tvar texture = new Texture(gl);\n\ttexture.premultiplyAlpha = premultiplyAlpha || false;\n\ttexture.upload(source);\n\n\treturn texture;\n}\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.fromData = function(gl, data, width, height)\n{\n\t//console.log(data, width, height);\n\tvar texture = new Texture(gl);\n\ttexture.uploadData(data, width, height);\n\n\treturn texture;\n}\n\n\nmodule.exports = Texture;\n\n},{}],6:[function(require,module,exports){\n\n// state object//\nvar setVertexAttribArrays = require( './setVertexAttribArrays' );\n\n/**\n * Helper class to work with WebGL VertexArrayObjects (vaos)\n * Only works if WebGL extensions are enabled (they usually are)\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n */\nfunction VertexArrayObject(gl, state)\n{\n\n\tthis.nativeVaoExtension = (\n gl.getExtension('OES_vertex_array_object') ||\n gl.getExtension('MOZ_OES_vertex_array_object') ||\n gl.getExtension('WEBKIT_OES_vertex_array_object')\n );\n\n\tthis.nativeState = state;\n\n\tif(this.nativeVaoExtension)\n\t{\n\t\tthis.nativeVao = this.nativeVaoExtension.createVertexArrayOES();\n\t\t\n\t\tvar maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\t\t\n\t\t// VAO - overwrite the state..\n\t\tthis.nativeState = {tempAttribState:new Array(maxAttribs)\n\t\t\t\t\t\t\t,attribState:new Array(maxAttribs)};\n\t}\n\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\t/**\n\t * An array of attributes ? @mat\n\t *\n\t * @member {Array}\n\t */\n\tthis.attributes = [];\n\n\t/**\n\t * @mat\n\t *\n\t * @member {Array}\n\t */\n\tthis.indexBuffer = null;\n\n\t/**\n\t * A boolean flag\n\t *\n\t * @member {Boolean}\n\t */\n\tthis.dirty = false;\n}\n\nVertexArrayObject.prototype.constructor = VertexArrayObject;\nmodule.exports = VertexArrayObject;\n\n\n/**\n * Binds the buffer\n */\nVertexArrayObject.prototype.bind = function()\n{\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n\n\t\tif(this.dirty)\n\t\t{\n\t\t\tthis.dirty = false;\n\t\t\tthis.activate();\n\t\t}\n\t}\n\telse\n\t{\n\t\t\n\t\tthis.activate();\n\t}\n\n\treturn this;\n}\n\n/**\n * Unbinds the buffer\n */\nVertexArrayObject.prototype.unbind = function()\n{\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(null);\n\t}\n\n\treturn this;\n}\n\n/**\n * Uses this vao\n */\nVertexArrayObject.prototype.activate = function()\n{\n\t\n\tvar gl = this.gl;\n\tvar lastBuffer = null;\n\n\tfor (var i = 0; i < this.attributes.length; i++)\n\t{\n\t\tvar attrib = this.attributes[i];\n\n\t\tif(lastBuffer !== attrib.buffer)\n\t\t{\n\t\t\tattrib.buffer.bind();\n\t\t\tlastBuffer = attrib.buffer;\n\t\t}\n\n\t\t//attrib.attribute.pointer(attrib.type, attrib.normalized, attrib.stride, attrib.start);\n\t\tgl.vertexAttribPointer(attrib.attribute.location,\n\t\t\t\t\t\t\t attrib.attribute.size, attrib.type || gl.FLOAT,\n\t\t\t\t\t\t\t attrib.normalized || false,\n\t\t\t\t\t\t\t attrib.stride || 0,\n\t\t\t\t\t\t\t attrib.start || 0);\n\n\n\t};\n\n\tsetVertexAttribArrays(gl, this.attributes, this.nativeState);\n\t\n\tthis.indexBuffer.bind();\n\n\treturn this;\n}\n\n/**\n *\n * @param buffer {WebGLBuffer}\n * @param attribute {[type]}\n * @param type {[type]}\n * @param normalized {[type]}\n * @param stride {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.addAttribute = function(buffer, attribute, type, normalized, stride, start)\n{\n this.attributes.push({\n \tbuffer: \tbuffer,\n \tattribute: \tattribute,\n\n \tlocation: \tattribute.location,\n\t \ttype: \t\ttype || this.gl.FLOAT,\n\t \tnormalized: normalized || false,\n\t \tstride: \tstride || 0,\n\t \tstart: \t\tstart || 0\n\t})\n\n\tthis.dirty = true;\n\n\treturn this;\n}\n\n/**\n *\n * @param buffer {WebGLBuffer}\n * @param options {Object}\n */\nVertexArrayObject.prototype.addIndex = function(buffer, options)\n{\n this.indexBuffer = buffer;\n\n this.dirty = true;\n\n return this;\n}\n\n/**\n * Unbinds this vao and disables it\n */\nVertexArrayObject.prototype.clear = function()\n{\n\tvar gl = this.gl;\n\n\t// TODO - should this function unbind after clear?\n\t// for now, no but lets see what happens in the real world!\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n\t}\n\n\tthis.attributes.length = 0;\n\tthis.indexBuffer = null;\n\n\treturn this;\n}\n\n/**\n * @mat\n * @param type {Number}\n * @param size {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.draw = function(type, size, start)\n{\n\tvar gl = this.gl;\n\tgl.drawElements(type, size, gl.UNSIGNED_SHORT, start || 0);\n\n\treturn this;\n}\n\n},{\"./setVertexAttribArrays\":8}],7:[function(require,module,exports){\n\n/**\n * Helper class to create a webGL Context\n *\n * @class\n * @memberof pixi.gl\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {Object} An options object that gets passed in to the canvas element containing the context attributes,\n * see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext for the options available\n * @return {WebGLRenderingContext} the WebGL context\n */\nvar createContext = function(canvas, options)\n{\n var gl = canvas.getContext('webgl', options) || \n \t canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support webGL. Try using the canvas renderer');\n }\n\n return gl;\n}\n\nmodule.exports = createContext;\n\n},{}],8:[function(require,module,exports){\nvar GL_MAP = {};\n\n/**\n * @mat\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param attribs {[type]}\n */\nvar setVertexAttribArrays = function (gl, attribs, state)\n{\n\n if(state)\n {\n\n var i,\n tempAttribState = state.tempAttribState,\n attribState = state.attribState;\n\n for (i = 0; i < tempAttribState.length; i++)\n {\n tempAttribState[i] = false;\n }\n\n // set the new attribs\n for (i in attribs)\n {\n tempAttribState[attribs[i].attribute.location] = true;\n }\n\n for (i = 0; i < attribState.length; i++)\n {\n if (attribState[i] !== tempAttribState[i])\n {\n attribState[i] = tempAttribState[i];\n\n if (state.attribState[i])\n {\n gl.enableVertexAttribArray(i);\n }\n else\n {\n gl.disableVertexAttribArray(i);\n }\n }\n }\n\n }\n else\n {\n for (var i = 0; i < attribs.length; i++)\n {\n var attrib = attribs[i];\n gl.enableVertexAttribArray(attrib.attribute.location);\n }\n }\n};\n\nmodule.exports = setVertexAttribArrays;\n\n},{}],9:[function(require,module,exports){\n\n/**\n *\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @return {WebGLProgram} the shader program\n */\ncompileProgram = function(gl, vertexSrc, fragmentSrc)\n{\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n var program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n\n/**\n *\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nvar compileShader = function (gl, type, src)\n{\n var shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n console.log(gl.getShaderInfoLog(shader));\n return null;\n }\n\n return shader;\n};\n\nmodule.exports = compileProgram;\n\n},{}],10:[function(require,module,exports){\n\n\nvar defaultValue = function(type, size) \n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2': \n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4': \n return new Float32Array(4 * size);\n \n case 'int':\n case 'sampler2D':\n return 0;\n\n case 'ivec2': \n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4': \n return new Int32Array(4 * size);\n\n case 'bool': \n return false;\n\n case 'bvec2':\n\n return booleanArray( 2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0\n ,0, 1]);\n\n case 'mat3': \n return new Float32Array([1, 0, 0\n ,0, 1, 0\n ,0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0\n ,0, 1, 0, 0\n ,0, 0, 1, 0\n ,0, 0, 0, 1]);\n }\n}\n\nvar booleanArray = function(size)\n{\n var array = new Array(size);\n\n for (var i = 0; i < array.length; i++) \n {\n array[i] = false;\n };\n\n return array;\n}\n\nmodule.exports = defaultValue;\n\n},{}],11:[function(require,module,exports){\n\nvar mapType = require('./mapType');\nvar mapSize = require('./mapSize');\n\n/**\n * Extracts the attributes\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the attributes from\n * @return attributes {Object}\n */\nvar extractAttributes = function(gl, program)\n{\n var attributes = {};\n\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)\n\n for (var i = 0; i < totalAttributes; i++)\n {\n var attribData = gl.getActiveAttrib(program, i);\n var type = mapType(gl, attribData.type);\n\n attributes[attribData.name] = {\n type:type,\n size:mapSize(type),\n location:gl.getAttribLocation(program, attribData.name),\n //TODO - make an attribute object\n pointer:function(type, normalized, stride, start){\n\n // console.log(this.location)\n gl.vertexAttribPointer(this.location,this.size, type || gl.FLOAT, normalized || false, stride || 0, start || 0);\n\n }\n }\n };\n\n return attributes;\n}\n\nmodule.exports = extractAttributes;\n\n},{\"./mapSize\":14,\"./mapType\":15}],12:[function(require,module,exports){\nvar mapType = require('./mapType');\nvar defaultValue = require('./defaultValue');\n\n/**\n * Extracts the uniforms\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the uniforms from\n * @return uniforms {Object}\n */\nvar extractUniforms = function(gl, program)\n{\n\tvar uniforms = {};\n\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)\n\n for (var i = 0; i < totalUniforms; i++)\n {\n \tvar uniformData = gl.getActiveUniform(program, i);\n \tvar name = uniformData.name.replace(/\\[.*?\\]/, \"\");\n var type = mapType(gl, uniformData.type );\n\n \tuniforms[name] = {\n \t\ttype:type,\n \t\tsize:uniformData.size,\n \t\tlocation:gl.getUniformLocation(program, name),\n \t\tvalue:defaultValue(type, uniformData.size)\n \t}\n };\n\n\treturn uniforms;\n}\n\nmodule.exports = extractUniforms;\n\n},{\"./defaultValue\":10,\"./mapType\":15}],13:[function(require,module,exports){\n/**\n * Extracts the attributes\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param uniforms {Array} @mat ?\n * @return attributes {Object}\n */\nvar generateUniformAccessObject = function(gl, uniformData)\n{\n // this is the object we will be sending back.\n // an object hierachy will be created for structs\n var uniforms = {data:{}};\n\n uniforms.gl = gl;\n\n var uniformKeys= Object.keys(uniformData);\n\n for (var i = 0; i < uniformKeys.length; i++)\n {\n var fullName = uniformKeys[i]\n\n var nameTokens = fullName.split('.');\n var name = nameTokens[nameTokens.length - 1];\n\n var uniformGroup = getUniformGroup(nameTokens, uniforms);\n\n var uniform = uniformData[fullName];\n uniformGroup.data[name] = uniform;\n\n uniformGroup.gl = gl;\n\n Object.defineProperty(uniformGroup, name, {\n get: generateGetter(name),\n set: generateSetter(name, uniform)\n })\n };\n\n return uniforms;\n}\n\nvar generateGetter = function(name)\n{\n\tvar template = getterTemplate.replace('%%', name);\n\treturn new Function(template);\n}\n\nvar generateSetter = function(name, uniform)\n{\n var template = setterTemplate.replace(/%%/g, name);\n var setTemplate\n\n if(uniform.size === 1)\n {\n setTemplate = GLSL_TO_SINGLE_SETTERS[uniform.type];\n }\n else\n {\n setTemplate = GLSL_TO_ARRAY_SETTERS[uniform.type];\n }\n\n if(setTemplate)\n {\n template += \"\\nthis.gl.\" + setTemplate + \";\";\n }\n\n \treturn new Function('value', template);\n}\n\nvar getUniformGroup = function(nameTokens, uniform)\n{\n var cur = uniform;\n\n for (var i = 0; i < nameTokens.length - 1; i++)\n {\n var o = cur[nameTokens[i]] || {data:{}};\n cur[nameTokens[i]] = o;\n cur = o;\n };\n\n return cur\n}\n\nvar getterTemplate = [\n 'return this.data.%%.value;',\n].join('\\n');\n\nvar setterTemplate = [\n 'this.data.%%.value = value;',\n 'var location = this.data.%%.location;'\n].join('\\n');\n\n\nvar GLSL_TO_SINGLE_SETTERS = {\n\n 'float': 'uniform1f(location, value)',\n\n 'vec2': 'uniform2f(location, value[0], value[1])',\n 'vec3': 'uniform3f(location, value[0], value[1], value[2])',\n 'vec4': 'uniform4f(location, value[0], value[1], value[2], value[3])',\n\n 'int': 'uniform1i(location, value)',\n 'ivec2': 'uniform2i(location, value[0], value[1])',\n 'ivec3': 'uniform3i(location, value[0], value[1], value[2])',\n 'ivec4': 'uniform4i(location, value[0], value[1], value[2], value[3])',\n\n 'bool': 'uniform1i(location, value)',\n 'bvec2': 'uniform2i(location, value[0], value[1])',\n 'bvec3': 'uniform3i(location, value[0], value[1], value[2])',\n 'bvec4': 'uniform4i(location, value[0], value[1], value[2], value[3])',\n\n 'mat2': 'uniformMatrix2fv(location, false, value)',\n 'mat3': 'uniformMatrix3fv(location, false, value)',\n 'mat4': 'uniformMatrix4fv(location, false, value)',\n\n 'sampler2D':'uniform1i(location, value)'\n}\n\nvar GLSL_TO_ARRAY_SETTERS = {\n\n 'float': 'uniform1fv(location, value)',\n\n 'vec2': 'uniform2fv(location, value)',\n 'vec3': 'uniform3fv(location, value)',\n 'vec4': 'uniform4fv(location, value)',\n\n 'int': 'uniform1iv(location, value)',\n 'ivec2': 'uniform2iv(location, value)',\n 'ivec3': 'uniform3iv(location, value)',\n 'ivec4': 'uniform4iv(location, value)',\n\n 'bool': 'uniform1iv(location, value)',\n 'bvec2': 'uniform2iv(location, value)',\n 'bvec3': 'uniform3iv(location, value)',\n 'bvec4': 'uniform4iv(location, value)',\n\n 'sampler2D':'uniform1iv(location, value)'\n}\n\nmodule.exports = generateUniformAccessObject;\n\n},{}],14:[function(require,module,exports){\n\n\nvar mapSize = function(type) \n{ \n return GLSL_TO_SIZE[type];\n}\n\n\nvar GLSL_TO_SIZE = {\n 'float': 1,\n 'vec2': 2,\n 'vec3': 3,\n 'vec4': 4,\n\n 'int': 1,\n 'ivec2': 2,\n 'ivec3': 3,\n 'ivec4': 4,\n\n 'bool': 1,\n 'bvec2': 2,\n 'bvec3': 3,\n 'bvec4': 4,\n\n 'mat2': 4,\n 'mat3': 9,\n 'mat4': 16,\n\n 'sampler2D': 1\n}\n\nmodule.exports = mapSize;\n\n},{}],15:[function(require,module,exports){\n\n\nvar mapSize = function(gl, type) \n{\n if(!GL_TABLE) \n {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for(var i = 0; i < typeNames.length; ++i) \n {\n var tn = typeNames[i];\n GL_TABLE[ gl[tn] ] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n\nvar GL_TABLE = null;\n\nvar GL_TO_GLSL_TYPES = {\n 'FLOAT': 'float',\n 'FLOAT_VEC2': 'vec2',\n 'FLOAT_VEC3': 'vec3',\n 'FLOAT_VEC4': 'vec4',\n\n 'INT': 'int',\n 'INT_VEC2': 'ivec2',\n 'INT_VEC3': 'ivec3',\n 'INT_VEC4': 'ivec4',\n \n 'BOOL': 'bool',\n 'BOOL_VEC2': 'bvec2',\n 'BOOL_VEC3': 'bvec3',\n 'BOOL_VEC4': 'bvec4',\n \n 'FLOAT_MAT2': 'mat2',\n 'FLOAT_MAT3': 'mat3',\n 'FLOAT_MAT4': 'mat4',\n \n 'SAMPLER_2D': 'sampler2D' \n}\n\nmodule.exports = mapSize;\n\n},{}],16:[function(require,module,exports){\n/**\n * Bit twiddling hacks for JavaScript.\n *\n * Author: Mikola Lysenko\n *\n * Ported from Stanford bit twiddling hack library:\n * http://graphics.stanford.edu/~seander/bithacks.html\n */\n\n\"use strict\"; \"use restrict\";\n\n//Number of bits in an integer\nvar INT_BITS = 32;\n\n//Constants\nexports.INT_BITS = INT_BITS;\nexports.INT_MAX = 0x7fffffff;\nexports.INT_MIN = -1<<(INT_BITS-1);\n\n//Returns -1, 0, +1 depending on sign of x\nexports.sign = function(v) {\n return (v > 0) - (v < 0);\n}\n\n//Computes absolute value of integer\nexports.abs = function(v) {\n var mask = v >> (INT_BITS-1);\n return (v ^ mask) - mask;\n}\n\n//Computes minimum of integers x and y\nexports.min = function(x, y) {\n return y ^ ((x ^ y) & -(x < y));\n}\n\n//Computes maximum of integers x and y\nexports.max = function(x, y) {\n return x ^ ((x ^ y) & -(x < y));\n}\n\n//Checks if a number is a power of two\nexports.isPow2 = function(v) {\n return !(v & (v-1)) && (!!v);\n}\n\n//Computes log base 2 of v\nexports.log2 = function(v) {\n var r, shift;\n r = (v > 0xFFFF) << 4; v >>>= r;\n shift = (v > 0xFF ) << 3; v >>>= shift; r |= shift;\n shift = (v > 0xF ) << 2; v >>>= shift; r |= shift;\n shift = (v > 0x3 ) << 1; v >>>= shift; r |= shift;\n return r | (v >> 1);\n}\n\n//Computes log base 10 of v\nexports.log10 = function(v) {\n return (v >= 1000000000) ? 9 : (v >= 100000000) ? 8 : (v >= 10000000) ? 7 :\n (v >= 1000000) ? 6 : (v >= 100000) ? 5 : (v >= 10000) ? 4 :\n (v >= 1000) ? 3 : (v >= 100) ? 2 : (v >= 10) ? 1 : 0;\n}\n\n//Counts number of bits\nexports.popCount = function(v) {\n v = v - ((v >>> 1) & 0x55555555);\n v = (v & 0x33333333) + ((v >>> 2) & 0x33333333);\n return ((v + (v >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24;\n}\n\n//Counts number of trailing zeros\nfunction countTrailingZeros(v) {\n var c = 32;\n v &= -v;\n if (v) c--;\n if (v & 0x0000FFFF) c -= 16;\n if (v & 0x00FF00FF) c -= 8;\n if (v & 0x0F0F0F0F) c -= 4;\n if (v & 0x33333333) c -= 2;\n if (v & 0x55555555) c -= 1;\n return c;\n}\nexports.countTrailingZeros = countTrailingZeros;\n\n//Rounds to next power of 2\nexports.nextPow2 = function(v) {\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n}\n\n//Rounds down to previous power of 2\nexports.prevPow2 = function(v) {\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v - (v>>>1);\n}\n\n//Computes parity of word\nexports.parity = function(v) {\n v ^= v >>> 16;\n v ^= v >>> 8;\n v ^= v >>> 4;\n v &= 0xf;\n return (0x6996 >>> v) & 1;\n}\n\nvar REVERSE_TABLE = new Array(256);\n\n(function(tab) {\n for(var i=0; i<256; ++i) {\n var v = i, r = i, s = 7;\n for (v >>>= 1; v; v >>>= 1) {\n r <<= 1;\n r |= v & 1;\n --s;\n }\n tab[i] = (r << s) & 0xff;\n }\n})(REVERSE_TABLE);\n\n//Reverse bits in a 32 bit word\nexports.reverse = function(v) {\n return (REVERSE_TABLE[ v & 0xff] << 24) |\n (REVERSE_TABLE[(v >>> 8) & 0xff] << 16) |\n (REVERSE_TABLE[(v >>> 16) & 0xff] << 8) |\n REVERSE_TABLE[(v >>> 24) & 0xff];\n}\n\n//Interleave bits of 2 coordinates with 16 bits. Useful for fast quadtree codes\nexports.interleave2 = function(x, y) {\n x &= 0xFFFF;\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 &= 0xFFFF;\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//Extracts the nth interleaved component\nexports.deinterleave2 = function(v, n) {\n v = (v >>> n) & 0x55555555;\n v = (v | (v >>> 1)) & 0x33333333;\n v = (v | (v >>> 2)) & 0x0F0F0F0F;\n v = (v | (v >>> 4)) & 0x00FF00FF;\n v = (v | (v >>> 16)) & 0x000FFFF;\n return (v << 16) >> 16;\n}\n\n\n//Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes\nexports.interleave3 = function(x, y, z) {\n x &= 0x3FF;\n x = (x | (x<<16)) & 4278190335;\n x = (x | (x<<8)) & 251719695;\n x = (x | (x<<4)) & 3272356035;\n x = (x | (x<<2)) & 1227133513;\n\n y &= 0x3FF;\n y = (y | (y<<16)) & 4278190335;\n y = (y | (y<<8)) & 251719695;\n y = (y | (y<<4)) & 3272356035;\n y = (y | (y<<2)) & 1227133513;\n x |= (y << 1);\n \n z &= 0x3FF;\n z = (z | (z<<16)) & 4278190335;\n z = (z | (z<<8)) & 251719695;\n z = (z | (z<<4)) & 3272356035;\n z = (z | (z<<2)) & 1227133513;\n \n return x | (z << 2);\n}\n\n//Extracts nth interleaved component of a 3-tuple\nexports.deinterleave3 = function(v, n) {\n v = (v >>> n) & 1227133513;\n v = (v | (v>>>2)) & 3272356035;\n v = (v | (v>>>4)) & 251719695;\n v = (v | (v>>>8)) & 4278190335;\n v = (v | (v>>>16)) & 0x3FF;\n return (v<<22)>>22;\n}\n\n//Computes next combination in colexicographic order (this is mistakenly called nextPermutation on the bit twiddling hacks page)\nexports.nextCombination = function(v) {\n var t = v | (v - 1);\n return (t + 1) | (((~t & -~t) - 1) >>> (countTrailingZeros(v) + 1));\n}\n\n\n},{}],17:[function(require,module,exports){\n(function (process){\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\n}).call(this,require('_process'))\n},{\"_process\":18}],18:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\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\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],19:[function(require,module,exports){\n(function (global){\n/*! https://mths.be/punycode v1.4.0 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\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 = /[^\\x20-\\x7E]/, // 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 new 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\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\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\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\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 \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 * https://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 (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only 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 state to ,\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 or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, 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 or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, 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.3.2',\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 \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 && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// 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 {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],20:[function(require,module,exports){\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\n},{}],21:[function(require,module,exports){\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\n},{}],22:[function(require,module,exports){\n'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n\n},{\"./decode\":20,\"./encode\":21}],23:[function(require,module,exports){\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\n},{\"punycode\":19,\"querystring\":22}],24:[function(require,module,exports){\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 = 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(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, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(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 (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next 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(filterPoints(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(ear, triangles, dim);\n earcutLinked(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(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(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(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(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(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 = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= m.x &&\n pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n\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 non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next 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 // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n},{}],25:[function(require,module,exports){\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 (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[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//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n},{}],26:[function(require,module,exports){\n/**\n * isMobile.js v0.3.9\n *\n * A simple library to detect Apple phones and tablets,\n * Android phones and tablets, other mobile devices (like blackberry, mini-opera and windows phone),\n * and any kind of seven inch device, via user agent sniffing.\n *\n * @author: Kai Mallea (kmallea@gmail.com)\n *\n * @license: http://creativecommons.org/publicdomain/zero/1.0/\n */\n(function (global) {\n\n var apple_phone = /iPhone/i,\n apple_ipod = /iPod/i,\n apple_tablet = /iPad/i,\n android_phone = /(?=.*\\bAndroid\\b)(?=.*\\bMobile\\b)/i, // Match 'Android' AND 'Mobile'\n android_tablet = /Android/i,\n amazon_phone = /(?=.*\\bAndroid\\b)(?=.*\\bSD4930UR\\b)/i,\n amazon_tablet = /(?=.*\\bAndroid\\b)(?=.*\\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\\b)/i,\n windows_phone = /IEMobile/i,\n windows_tablet = /(?=.*\\bWindows\\b)(?=.*\\bARM\\b)/i, // Match 'Windows' AND 'ARM'\n other_blackberry = /BlackBerry/i,\n other_blackberry_10 = /BB10/i,\n other_opera = /Opera Mini/i,\n other_chrome = /(CriOS|Chrome)(?=.*\\bMobile\\b)/i,\n other_firefox = /(?=.*\\bFirefox\\b)(?=.*\\bMobile\\b)/i, // Match 'Firefox' AND 'Mobile'\n seven_inch = new RegExp(\n '(?:' + // Non-capturing group\n\n 'Nexus 7' + // Nexus 7\n\n '|' + // OR\n\n 'BNTV250' + // B&N Nook Tablet 7 inch\n\n '|' + // OR\n\n 'Kindle Fire' + // Kindle Fire\n\n '|' + // OR\n\n 'Silk' + // Kindle Fire, Silk Accelerated\n\n '|' + // OR\n\n 'GT-P1000' + // Galaxy Tab 7 inch\n\n ')', // End non-capturing group\n\n 'i'); // Case-insensitive matching\n\n var match = function(regex, userAgent) {\n return regex.test(userAgent);\n };\n\n var IsMobileClass = function(userAgent) {\n var ua = userAgent || navigator.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n var tmp = ua.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n ua = tmp[0];\n }\n\n this.apple = {\n phone: match(apple_phone, ua),\n ipod: match(apple_ipod, ua),\n tablet: !match(apple_phone, ua) && match(apple_tablet, ua),\n device: match(apple_phone, ua) || match(apple_ipod, ua) || match(apple_tablet, ua)\n };\n this.amazon = {\n phone: match(amazon_phone, ua),\n tablet: !match(amazon_phone, ua) && match(amazon_tablet, ua),\n device: match(amazon_phone, ua) || match(amazon_tablet, ua)\n };\n this.android = {\n phone: match(amazon_phone, ua) || match(android_phone, ua),\n tablet: !match(amazon_phone, ua) && !match(android_phone, ua) && (match(amazon_tablet, ua) || match(android_tablet, ua)),\n device: match(amazon_phone, ua) || match(amazon_tablet, ua) || match(android_phone, ua) || match(android_tablet, ua)\n };\n this.windows = {\n phone: match(windows_phone, ua),\n tablet: match(windows_tablet, ua),\n device: match(windows_phone, ua) || match(windows_tablet, ua)\n };\n this.other = {\n blackberry: match(other_blackberry, ua),\n blackberry10: match(other_blackberry_10, ua),\n opera: match(other_opera, ua),\n firefox: match(other_firefox, ua),\n chrome: match(other_chrome, ua),\n device: match(other_blackberry, ua) || match(other_blackberry_10, ua) || match(other_opera, ua) || match(other_firefox, ua) || match(other_chrome, ua)\n };\n this.seven_inch = match(seven_inch, ua);\n this.any = this.apple.device || this.android.device || this.windows.device || this.other.device || this.seven_inch;\n\n // excludes 'other' devices and ipods, targeting touchscreen phones\n this.phone = this.apple.phone || this.android.phone || this.windows.phone;\n\n // excludes 7 inch devices, classifying as phone or tablet is left to the user\n this.tablet = this.apple.tablet || this.android.tablet || this.windows.tablet;\n\n if (typeof window === 'undefined') {\n return this;\n }\n };\n\n var instantiate = function() {\n var IM = new IsMobileClass();\n IM.Class = IsMobileClass;\n return IM;\n };\n\n if (typeof module !== 'undefined' && module.exports && typeof window === 'undefined') {\n //node\n module.exports = IsMobileClass;\n } else if (typeof module !== 'undefined' && module.exports && typeof window !== 'undefined') {\n //browserify\n module.exports = instantiate();\n } else if (typeof define === 'function' && define.amd) {\n //AMD\n define('isMobile', [], global.isMobile = instantiate());\n } else {\n global.isMobile = instantiate();\n }\n\n})(this);\n\n},{}],27:[function(require,module,exports){\n/* eslint-disable no-unused-vars */\n'use strict';\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nmodule.exports = Object.assign || function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (Object.getOwnPropertySymbols) {\n\t\t\tsymbols = Object.getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n},{}],28:[function(require,module,exports){\n(function (process){\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 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 },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (var w = 1; w <= q.concurrency; w++) {\n async.setImmediate(q.process);\n }\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