phaser/v2/build/phaser-creature.min.js

22 lines
576 KiB
JavaScript
Raw Normal View History

/* Phaser v2.6.2 - http://phaser.io - @photonstorm - (c) 2016 Photon Storm Ltd. */
(function(){function a(a,b){this._scaleFactor=a,this._deltaMode=b,this.originalEvent=null}var b=this,c=c||{VERSION:"2.6.2",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4,SPRITE:0,BUTTON:1,IMAGE:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,POLYGON:12,BITMAPDATA:13,CANVAS_FILTER:14,WEBGL_FILTER:15,ELLIPSE:16,SPRITEBATCH:17,RETROFONT:18,POINTER:19,ROPE:20,CIRCLE:21,RECTANGLE:22,LINE:23,MATRIX:24,POINT:25,ROUNDEDRECTANGLE:26,CREATURE:27,VIDEO:28,PENDING_ATLAS:-1,HORIZONTAL:0,VERTICAL:1,LANDSCAPE:0,PORTRAIT:1,ANGLE_UP:270,ANGLE_DOWN:90,ANGLE_LEFT:180,ANGLE_RIGHT:0,ANGLE_NORTH_EAST:315,ANGLE_NORTH_WEST:225,ANGLE_SOUTH_EAST:45,ANGLE_SOUTH_WEST:135,TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12,blendModes:{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},scaleModes:{DEFAULT:0,LINEAR:0,NEAREST:1},PIXI:PIXI||{}};if(Math.trunc||(Math.trunc=function(a){return a<0?Math.ceil(a):Math.floor(a)}),Function.prototype.bind||(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;return c.prototype=function a(b){if(b&&(a.prototype=b),!(this instanceof a))return new a}(d.prototype),c}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.forEach||(Array.prototype.forEach=function(a){"use strict";if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=arguments.length>=2?arguments[1]:void 0,e=0;e<c;e++)e in b&&a.call(d,b[e],e,b)}),"function"!=typeof window.Uint32Array&&"object"!=typeof window.Uint32Array){var d=function(a){var b=new Array;window[a]=function(a){if("number"==typeof a){Array.call(this,a),this.length=a;for(var b=0;b<this.length;b++)this[b]=0}else{Array.call(this,a.length),this.length=a.length;for(var b=0;b<this.length;b++)this[b]=a[b]}},window[a].prototype=b,window[a].constructor=window[a]};d("Uint32Array"),d("Int16Array")}window.console||(window.console={},window.console.log=window.console.assert=function(){},window.console.warn=window.console.assert=function(){}),c.Utils={reverseString:function(a){return a.split("").reverse().join("")},getProperty:function(a,b){for(var c=b.split("."),d=c.pop(),e=c.length,f=1,g=c[0];f<e&&(a=a[g]);)g=c[f],f++;return a?a[d]:null},setProperty:function(a,b,c){for(var d=b.split("."),e=d.pop(),f=d.length,g=1,h=d[0];g<f&&(a=a[h]);)h=d[g],g++;return a&&(a[e]=c),a},chanceRoll:function(a){return void 0===a&&(a=50),a>0&&100*Math.random()<=a},randomChoice:function(a,b){return Math.random()<.5?a:b},parseDimension:function(a,b){var c=0,d=0;return"string"==typeof a?"%"===a.substr(-1)?(c=parseInt(a,10)/100,d=0===b?window.innerWidth*c:window.innerHeight*c):d=parseInt(a,10):d=a,d},pad:function(a,b,c,d){if(void 0===b)var b=0;if(void 0===c)var c=" ";if(void 0===d)var d=3;a=a.toString();var e=0;if(b+1>=a.length)switch(d){case 1:a=new Array(b+1-a.length).join(c)+a;break;case 3:var f=Math.ceil((e=b-a.length)/2),g=e-f;a=new Array(g+1).join(c)+a+new Array(f+1).join(c);break;default:a+=new Array(b+1-a.length).join(c)}return a},isPlainObject:function(a){if("object"!=typeof a||a.nodeType||a===a.window)return!1;try{if(a.constructor&&!{}.hasOwnProperty.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(a){return!1}return!0},extend:function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),j===i&&(h=this,--i);i<j;i++)if(null!=(a=arguments[i]))for(b in a)d=h[b],e=a[b],h!==e&&(k&&e&&(c.Utils.isPlainObject(e)||(f=Array.isArray(e)))?(f?(f=!1,g=d&&Array.isArray(d)?d:[
},c.Camera.FOLLOW_LOCKON=0,c.Camera.FOLLOW_PLATFORMER=1,c.Camera.FOLLOW_TOPDOWN=2,c.Camera.FOLLOW_TOPDOWN_TIGHT=3,c.Camera.SHAKE_BOTH=4,c.Camera.SHAKE_HORIZONTAL=5,c.Camera.SHAKE_VERTICAL=6,c.Camera.ENABLE_FX=!0,c.Camera.prototype={boot:function(){this.displayObject=this.game.world,this.scale=this.game.world.scale,this.game.camera=this,c.Graphics&&c.Camera.ENABLE_FX&&(this.fx=new c.Graphics(this.game),this.game.stage.addChild(this.fx))},preUpdate:function(){this.totalInView=0},follow:function(a,b,d,e){void 0===b&&(b=c.Camera.FOLLOW_LOCKON),void 0===d&&(d=1),void 0===e&&(e=1),this.target=a,this.lerp.set(d,e);var f;switch(b){case c.Camera.FOLLOW_PLATFORMER:var g=this.width/8,h=this.height/3;this.deadzone=new c.Rectangle((this.width-g)/2,(this.height-h)/2-.25*h,g,h);break;case c.Camera.FOLLOW_TOPDOWN:f=Math.max(this.width,this.height)/4,this.deadzone=new c.Rectangle((this.width-f)/2,(this.height-f)/2,f,f);break;case c.Camera.FOLLOW_TOPDOWN_TIGHT:f=Math.max(this.width,this.height)/8,this.deadzone=new c.Rectangle((this.width-f)/2,(this.height-f)/2,f,f);break;case c.Camera.FOLLOW_LOCKON:this.deadzone=null;break;default:this.deadzone=null}},unfollow:function(){this.target=null},focusOn:function(a){this.setPosition(Math.round(a.x-this.view.halfWidth),Math.round(a.y-this.view.halfHeight))},focusOnXY:function(a,b){this.setPosition(Math.round(a-this.view.halfWidth),Math.round(b-this.view.halfHeight))},shake:function(a,b,d,e,f){return void 0===a&&(a=.05),void 0===b&&(b=500),void 0===d&&(d=!0),void 0===e&&(e=c.Camera.SHAKE_BOTH),void 0===f&&(f=!0),!(!d&&this._shake.duration>0)&&(this._shake.intensity=a,this._shake.duration=b,this._shake.shakeBounds=f,this._shake.x=0,this._shake.y=0,this._shake.horizontal=e===c.Camera.SHAKE_BOTH||e===c.Camera.SHAKE_HORIZONTAL,this._shake.vertical=e===c.Camera.SHAKE_BOTH||e===c.Camera.SHAKE_VERTICAL,!0)},flash:function(a,b,c){return void 0===a&&(a=16777215),void 0===b&&(b=500),void 0===c&&(c=!1),!(!this.fx||!c&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(a),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=1,this._fxDuration=b,this._fxType=0,!0)},fade:function(a,b,c){return void 0===a&&(a=0),void 0===b&&(b=500),void 0===c&&(c=!1),!(!this.fx||!c&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(a),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=0,this._fxDuration=b,this._fxType=1,!0)},update:function(){this._fxDuration>0&&this.updateFX(),this._shake.duration>0&&this.updateShake(),this.bounds&&this.checkBounds(),this.roundPx&&(this.view.floor(),this._shake.x=Math.floor(this._shake.x),this._shake.y=Math.floor(this._shake.y)),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateFX:function(){0===this._fxType?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFlashComplete.dispatch())):(this.fx.alpha+=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha>=1&&(this._fxDuration=0,this.fx.alpha=1,this.onFadeComplete.dispatch()))},updateShake:function(){this._shake.duration-=this.game.time.elapsedMS,this._shake.duration<=0?(this.onShakeComplete.dispatch(),this._shake.x=0,this._shake.y=0):(this._shake.horizontal&&(this._shake.x=this.game.rnd.frac()*this._shake.intensity*this.view.width*2-this._shake.intensity*this.view.width),this._shake.vertical&&(this._shake.y=this.game.rnd.frac()*this._shake.intensity*this.view.height*2-this._shake.intensity*this.view.height))},updateTarget:function(){this._targetPosition.x=this.view.x+this.target.worldPosition.x,this._targetPosition.y=this.view.y+this.target.worldPosition.y,this.deadzone?(this._edge=this._targetPosition.x-this.view.x,this._edge<this.deadzone.left?this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.left,this.lerp.x):this._edge>this.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edge<this.deadzone.top?this.view.y=this.game.m
this.remove(a),this.addAt(b,d),a},c.Group.prototype.hasProperty=function(a,b){var c=b.length;return 1===c&&b[0]in a||(2===c&&b[0]in a&&b[1]in a[b[0]]||(3===c&&b[0]in a&&b[1]in a[b[0]]&&b[2]in a[b[0]][b[1]]||4===c&&b[0]in a&&b[1]in a[b[0]]&&b[2]in a[b[0]][b[1]]&&b[3]in a[b[0]][b[1]][b[2]]))},c.Group.prototype.setProperty=function(a,b,c,d,e){if(void 0===e&&(e=!1),d=d||0,!this.hasProperty(a,b)&&(!e||d>0))return!1;var f=b.length;return 1===f?0===d?a[b[0]]=c:1===d?a[b[0]]+=c:2===d?a[b[0]]-=c:3===d?a[b[0]]*=c:4===d&&(a[b[0]]/=c):2===f?0===d?a[b[0]][b[1]]=c:1===d?a[b[0]][b[1]]+=c:2===d?a[b[0]][b[1]]-=c:3===d?a[b[0]][b[1]]*=c:4===d&&(a[b[0]][b[1]]/=c):3===f?0===d?a[b[0]][b[1]][b[2]]=c:1===d?a[b[0]][b[1]][b[2]]+=c:2===d?a[b[0]][b[1]][b[2]]-=c:3===d?a[b[0]][b[1]][b[2]]*=c:4===d&&(a[b[0]][b[1]][b[2]]/=c):4===f&&(0===d?a[b[0]][b[1]][b[2]][b[3]]=c:1===d?a[b[0]][b[1]][b[2]][b[3]]+=c:2===d?a[b[0]][b[1]][b[2]][b[3]]-=c:3===d?a[b[0]][b[1]][b[2]][b[3]]*=c:4===d&&(a[b[0]][b[1]][b[2]][b[3]]/=c)),!0},c.Group.prototype.checkProperty=function(a,b,d,e){return void 0===e&&(e=!1),!(!c.Utils.getProperty(a,b)&&e)&&c.Utils.getProperty(a,b)===d},c.Group.prototype.set=function(a,b,c,d,e,f,g){if(void 0===g&&(g=!1),b=b.split("."),void 0===d&&(d=!1),void 0===e&&(e=!1),(d===!1||d&&a.alive)&&(e===!1||e&&a.visible))return this.setProperty(a,b,c,f,g)},c.Group.prototype.setAll=function(a,b,c,d,e,f){void 0===c&&(c=!1),void 0===d&&(d=!1),void 0===f&&(f=!1),a=a.split("."),e=e||0;for(var g=0;g<this.children.length;g++)(!c||c&&this.children[g].alive)&&(!d||d&&this.children[g].visible)&&this.setProperty(this.children[g],a,b,e,f)},c.Group.prototype.setAllChildren=function(a,b,d,e,f,g){void 0===d&&(d=!1),void 0===e&&(e=!1),void 0===g&&(g=!1),f=f||0;for(var h=0;h<this.children.length;h++)(!d||d&&this.children[h].alive)&&(!e||e&&this.children[h].visible)&&(this.children[h]instanceof c.Group?this.children[h].setAllChildren(a,b,d,e,f,g):this.setProperty(this.children[h],a.split("."),b,f,g))},c.Group.prototype.checkAll=function(a,b,c,d,e){void 0===c&&(c=!1),void 0===d&&(d=!1),void 0===e&&(e=!1);for(var f=0;f<this.children.length;f++)if((!c||c&&this.children[f].alive)&&(!d||d&&this.children[f].visible)&&!this.checkProperty(this.children[f],a,b,e))return!1;return!0},c.Group.prototype.addAll=function(a,b,c,d){this.setAll(a,b,c,d,1)},c.Group.prototype.subAll=function(a,b,c,d){this.setAll(a,b,c,d,2)},c.Group.prototype.multiplyAll=function(a,b,c,d){this.setAll(a,b,c,d,3)},c.Group.prototype.divideAll=function(a,b,c,d){this.setAll(a,b,c,d,4)},c.Group.prototype.callAllExists=function(a,b){var c;if(arguments.length>2){c=[];for(var d=2;d<arguments.length;d++)c.push(arguments[d])}for(var d=0;d<this.children.length;d++)this.children[d].exists===b&&this.children[d][a]&&this.children[d][a].apply(this.children[d],c)},c.Group.prototype.callbackFromArray=function(a,b,c){if(1===c){if(a[b[0]])return a[b[0]]}else if(2===c){if(a[b[0]][b[1]])return a[b[0]][b[1]]}else if(3===c){if(a[b[0]][b[1]][b[2]])return a[b[0]][b[1]][b[2]]}else if(4===c){if(a[b[0]][b[1]][b[2]][b[3]])return a[b[0]][b[1]][b[2]][b[3]]}else if(a[b])return a[b];return!1},c.Group.prototype.callAll=function(a,b){if(void 0!==a){a=a.split(".");var c=a.length;if(void 0===b||null===b||""===b)b=null;else if("string"==typeof b){b=b.split(".");var d=b.length}var e;if(arguments.length>2){e=[];for(var f=2;f<arguments.length;f++)e.push(arguments[f])}for(var g=null,h=null,f=0;f<this.children.length;f++)g=this.callbackFromArray(this.children[f],a,c),b&&g?(h=this.callbackFromArray(this.children[f],b,d),g&&g.apply(h,e)):g&&g.apply(this.children[f],e)}},c.Group.prototype.preUpdate=function(){if(this.pendingDestroy)return this.destroy(),!1;if(!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1;for(var a=0;a<this.children.length;a++)this.children[a].preUpdate();return!0},c.Group.prototype.update=function(){for(var a=this.children.length;a--;)this.children[a].update()},c.Group.prototype.postUpdate=function(){this.fixedToCamera&&(this.x=this.game.camera.view.x+this.cameraOffset.x,this.y=this.game.camera.view.y+this.cameraOffset.y);for(
get:function(){return this.game.camera.view.y+this.y}}),c.Mouse=function(a){this.game=a,this.input=a.input,this.callbackContext=this.game,this.mouseDownCallback=null,this.mouseUpCallback=null,this.mouseOutCallback=null,this.mouseOverCallback=null,this.mouseWheelCallback=null,this.capture=!1,this.button=-1,this.wheelDelta=0,this.enabled=!0,this.locked=!1,this.stopOnGameOut=!1,this.pointerLock=new c.Signal,this.event=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null,this._onMouseOut=null,this._onMouseOver=null,this._onMouseWheel=null,this._wheelEvent=null},c.Mouse.NO_BUTTON=-1,c.Mouse.LEFT_BUTTON=0,c.Mouse.MIDDLE_BUTTON=1,c.Mouse.RIGHT_BUTTON=2,c.Mouse.BACK_BUTTON=3,c.Mouse.FORWARD_BUTTON=4,c.Mouse.WHEEL_UP=1,c.Mouse.WHEEL_DOWN=-1,c.Mouse.prototype={start:function(){if((!this.game.device.android||this.game.device.chrome!==!1)&&null===this._onMouseDown){var b=this;this._onMouseDown=function(a){return b.onMouseDown(a)},this._onMouseMove=function(a){return b.onMouseMove(a)},this._onMouseUp=function(a){return b.onMouseUp(a)},this._onMouseUpGlobal=function(a){return b.onMouseUpGlobal(a)},this._onMouseOutGlobal=function(a){return b.onMouseOutGlobal(a)},this._onMouseOut=function(a){return b.onMouseOut(a)},this._onMouseOver=function(a){return b.onMouseOver(a)},this._onMouseWheel=function(a){return b.onMouseWheel(a)};var c=this.game.canvas;c.addEventListener("mousedown",this._onMouseDown,!0),c.addEventListener("mousemove",this._onMouseMove,!0),c.addEventListener("mouseup",this._onMouseUp,!0),this.game.device.cocoonJS||(window.addEventListener("mouseup",this._onMouseUpGlobal,!0),window.addEventListener("mouseout",this._onMouseOutGlobal,!0),c.addEventListener("mouseover",this._onMouseOver,!0),c.addEventListener("mouseout",this._onMouseOut,!0));var d=this.game.device.wheelEvent;d&&(c.addEventListener(d,this._onMouseWheel,!0),"mousewheel"===d?this._wheelEvent=new a((-.025),1):"DOMMouseScroll"===d&&(this._wheelEvent=new a(1,1)))}},onMouseDown:function(a){this.event=a,this.capture&&a.preventDefault(),this.mouseDownCallback&&this.mouseDownCallback.call(this.callbackContext,a),this.input.enabled&&this.enabled&&(a.identifier=0,this.input.mousePointer.start(a))},onMouseMove:function(a){this.event=a,this.capture&&a.preventDefault(),this.mouseMoveCallback&&this.mouseMoveCallback.call(this.callbackContext,a),this.input.enabled&&this.enabled&&(a.identifier=0,this.input.mousePointer.move(a))},onMouseUp:function(a){this.event=a,this.capture&&a.preventDefault(),this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,a),this.input.enabled&&this.enabled&&(a.identifier=0,this.input.mousePointer.stop(a))},onMouseUpGlobal:function(a){this.input.mousePointer.withinGame||(this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,a),a.identifier=0,this.input.mousePointer.stop(a))},onMouseOutGlobal:function(a){this.event=a,this.capture&&a.preventDefault(),this.input.mousePointer.withinGame=!1,this.input.enabled&&this.enabled&&(this.input.mousePointer.stop(a),this.input.mousePointer.leftButton.stop(a),this.input.mousePointer.rightButton.stop(a))},onMouseOut:function(a){this.event=a,this.capture&&a.preventDefault(),this.input.mousePointer.withinGame=!1,this.mouseOutCallback&&this.mouseOutCallback.call(this.callbackContext,a),this.input.enabled&&this.enabled&&this.stopOnGameOut&&(a.identifier=0,this.input.mousePointer.stop(a))},onMouseOver:function(a){this.event=a,this.capture&&a.preventDefault(),this.input.mousePointer.withinGame=!0,this.mouseOverCallback&&this.mouseOverCallback.call(this.callbackContext,a)},onMouseWheel:function(a){this._wheelEvent&&(a=this._wheelEvent.bindEvent(a)),this.event=a,this.capture&&a.preventDefault(),this.wheelDelta=c.Math.clamp(-a.deltaY,-1,1),this.mouseWheelCallback&&this.mouseWheelCallback.call(this.callbackContext,a)},requestPointerLock:function(){if(this.game.device.pointerLock){var a=this.game.canvas;a.requestPointerLock=a.requestPointerLock||a.mozRequestPointerLock||a.webkitRequestPointerLock,a.requestPointerLock();var b=this;this._pointerLockChange=function(a){return b.pointer
this._dragDistancePass&&this._dragTimePass&&this.startDrag(a),!0):this.draggable&&this._draggedPointerID===a.id?this.updateDrag(a,!1):this._pointerData[a.id].isOver?this.checkPointerOver(a)?(this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,!0):(this._pointerOutHandler(a),!1):void 0:(this._pointerOutHandler(a),!1)},_pointerOverHandler:function(a,b){if(null!==this.sprite){var d=this._pointerData[a.id];if(d.isOver===!1||a.dirty){var e=d.isOver===!1;d.isOver=!0,d.isOut=!1,d.timeOver=this.game.time.time,d.x=a.x-this.sprite.x,d.y=a.y-this.sprite.y,this.useHandCursor&&d.isDragged===!1&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!0),!b&&e&&this.sprite&&this.sprite.events&&this.sprite.events.onInputOver$dispatch(this.sprite,a),this.sprite.parent&&this.sprite.parent.type===c.GROUP&&this.sprite.parent.onChildInputOver.dispatch(this.sprite,a)}}},_pointerOutHandler:function(a,b){if(null!==this.sprite){var d=this._pointerData[a.id];d.isOver=!1,d.isOut=!0,d.timeOut=this.game.time.time,this.useHandCursor&&d.isDragged===!1&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),!b&&this.sprite&&this.sprite.events&&(this.sprite.events.onInputOut$dispatch(this.sprite,a),this.sprite&&this.sprite.parent&&this.sprite.parent.type===c.GROUP&&this.sprite.parent.onChildInputOut.dispatch(this.sprite,a))}},_touchedHandler:function(a){if(null!==this.sprite){var b=this._pointerData[a.id];if(!b.isDown&&b.isOver){if(this.pixelPerfectClick&&!this.checkPixel(null,null,a))return;if(b.isDown=!0,b.isUp=!1,b.timeDown=this.game.time.time,this.downPoint.set(a.x,a.y),a.dirty=!0,this.sprite&&this.sprite.events&&(this.sprite.events.onInputDown$dispatch(this.sprite,a),this.sprite&&this.sprite.parent&&this.sprite.parent.type===c.GROUP&&this.sprite.parent.onChildInputDown.dispatch(this.sprite,a),null===this.sprite))return;this.draggable&&this.isDragged===!1&&(0===this.dragTimeThreshold&&0===this.dragDistanceThreshold?this.startDrag(a):(this._pendingDrag=!0,this._dragDistancePass=0===this.dragDistanceThreshold,this.dragTimeThreshold>0?(this._dragTimePass=!1,this.game.time.events.add(this.dragTimeThreshold,this.dragTimeElapsed,this,a)):this._dragTimePass=!0)),this.bringToTop&&this.sprite.bringToTop()}}},dragTimeElapsed:function(a){this._dragTimePass=!0,this._pendingDrag&&this.sprite&&this._dragDistancePass&&this.startDrag(a)},_releasedHandler:function(a){if(null!==this.sprite){var b=this._pointerData[a.id];if(b.isDown&&a.isUp){b.isDown=!1,b.isUp=!0,b.timeUp=this.game.time.time,b.downDuration=b.timeUp-b.timeDown;var d=this.checkPointerOver(a);this.sprite&&this.sprite.events&&(this.dragStopBlocksInputUp&&(!this.dragStopBlocksInputUp||this.draggable&&this.isDragged&&this._draggedPointerID===a.id)||this.sprite.events.onInputUp$dispatch(this.sprite,a,d),this.sprite&&this.sprite.parent&&this.sprite.parent.type===c.GROUP&&this.sprite.parent.onChildInputUp.dispatch(this.sprite,a,d),d&&(d=this.checkPointerOver(a))),b.isOver=d,!d&&this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),a.dirty=!0,this._pendingDrag=!1,this.draggable&&this.isDragged&&this._draggedPointerID===a.id&&this.stopDrag(a)}}},updateDrag:function(a,b){if(void 0===b&&(b=!1),a.isUp)return this.stopDrag(a),!1;var c=this.globalToLocalX(a.x)+this._dragPoint.x+this.dragOffset.x,d=this.globalToLocalY(a.y)+this._dragPoint.y+this.dragOffset.y;if(this.sprite.fixedToCamera)this.allowHorizontalDrag&&(this.sprite.cameraOffset.x=c),this.allowVerticalDrag&&(this.sprite.cameraOffset.y=d),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,this.snapPoint.set(this.sprite.cameraOffset.x,this.sprite.cameraOffset.y));else{var e=this.game.camera.x-this._pointerData[a.id].camX,f=this.game.camera.y-
return this.parent&&this.parent.sendToBack(this),this},c.Component.BringToTop.prototype.moveUp=function(){return this.parent&&this.parent.moveUp(this),this},c.Component.BringToTop.prototype.moveDown=function(){return this.parent&&this.parent.moveDown(this),this},c.Component.Core=function(){},c.Component.Core.install=function(a){c.Utils.mixinPrototype(this,c.Component.Core.prototype),this.components={};for(var b=0;b<a.length;b++){var d=a[b],e=!1;"Destroy"===d&&(e=!0),c.Utils.mixinPrototype(this,c.Component[d].prototype,e),this.components[d]=!0}},c.Component.Core.init=function(a,b,d,e,f){this.game=a,this.key=e,this.data={},this.position.set(b,d),this.world=new c.Point(b,d),this.previousPosition=new c.Point(b,d),this.events=new c.Events(this),this._bounds=new c.Rectangle,this.components.PhysicsBody&&(this.body=this.body),this.components.Animation&&(this.animations=new c.AnimationManager(this)),this.components.LoadTexture&&null!==e&&this.loadTexture(e,f),this.components.FixedToCamera&&(this.cameraOffset=new c.Point(b,d))},c.Component.Core.preUpdate=function(){if(this.pendingDestroy)return void this.destroy();if(this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1;this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this.renderOrderID=this.game.stage.currentRenderOrderID++),this.animations&&this.animations.update(),this.body&&this.body.preUpdate();for(var a=0;a<this.children.length;a++)this.children[a].preUpdate();return!0},c.Component.Core.prototype={game:null,name:"",data:{},components:{},z:0,events:void 0,animations:void 0,key:"",world:null,debug:!1,previousPosition:null,previousRotation:0,renderOrderID:0,fresh:!0,pendingDestroy:!1,_bounds:null,_exists:!0,exists:{get:function(){return this._exists},set:function(a){a?(this._exists=!0,this.body&&this.body.type===c.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._exists=!1,this.body&&this.body.type===c.Physics.P2JS&&this.body.removeFromWorld(),this.visible=!1)}},update:function(){},postUpdate:function(){this.customRender&&this.key.render(),this.components.PhysicsBody&&c.Component.PhysicsBody.postUpdate.call(this),this.components.FixedToCamera&&c.Component.FixedToCamera.postUpdate.call(this);for(var a=0;a<this.children.length;a++)this.children[a].postUpdate()}},c.Component.Crop=function(){},c.Component.Crop.prototype={cropRect:null,_crop:null,crop:function(a,b){void 0===b&&(b=!1),a?(b&&null!==this.cropRect?this.cropRect.setTo(a.x,a.y,a.width,a.height):b&&null===this.cropRect?this.cropRect=new c.Rectangle(a.x,a.y,a.width,a.height):this.cropRect=a,this.updateCrop()):(this._crop=null,this.cropRect=null,this.resetFrame())},updateCrop:function(){if(this.cropRect){var a=this.texture.crop.x,b=this.texture.crop.y,d=this.texture.crop.width,e=this.texture.crop.height;this._crop=c.Rectangle.clone(this.cropRect,this._crop),this._crop.x+=this._frame.x,this._crop.y+=this._frame.y;var f=Math.max(this._frame.x,this._crop.x),g=Math.max(this._frame.y,this._crop.y),h=Math.min(this._frame.right,this._crop.right)-f,i=Math.min(this._frame.bottom,this._crop.bottom)-g;this.texture.crop.x=f,this.texture.crop.y=g,this.texture.crop.width=h,this.texture.crop.height=i,this.texture.frame.width=Math.min(h,this.cropRect.width),this.texture.frame.height=Math.min(i,this.cropRect.height),this.texture.width=this.texture.frame.width,this.texture.height=this.texture.frame.height,this.texture._updateUvs(),16777215===this.tint||a===f&&b===g&&d===h&&e===i||(this.texture.requiresReTint=!0)}}},c.Component.Delta=function(){},c.Component.Delta.prototype={deltaX:{get:function(){return this.world.x-this.previousPosition.x}},deltaY:{get:function(){return this.world.y-this.previousPosition.y}},deltaZ:{get:function(){return this.rotation-this.previousRotation}}},c.Component.Destroy=function(){},c.Component.Destroy.prototype={destroyPhase:!1,destroy:function(a,b){if(null!==this.game&&!this.destroyPhase){void 0===a&&(a=!0),void 0===b&&(b=!1),this.destr
this},setPixel:function(a,b,c,d,e,f){return this.setPixel32(a,b,c,d,e,255,f)},getPixel:function(a,b,d){d||(d=c.Color.createColor());var e=~~(a+b*this.width);return e*=4,d.r=this.data[e],d.g=this.data[++e],d.b=this.data[++e],d.a=this.data[++e],d},getPixel32:function(a,b){if(a>=0&&a<=this.width&&b>=0&&b<=this.height)return this.pixels[b*this.width+a]},getPixelRGB:function(a,b,d,e,f){return c.Color.unpackPixel(this.getPixel32(a,b),d,e,f)},getPixels:function(a){return this.context.getImageData(a.x,a.y,a.width,a.height)},getFirstPixel:function(a){void 0===a&&(a=0);var b=c.Color.createColor(),d=0,e=0,f=1,g=!1;1===a?(f=-1,e=this.height):3===a&&(f=-1,d=this.width);do c.Color.unpackPixel(this.getPixel32(d,e),b),0===a||1===a?(d++,d===this.width&&(d=0,e+=f,(e>=this.height||e<=0)&&(g=!0))):2!==a&&3!==a||(e++,e===this.height&&(e=0,d+=f,(d>=this.width||d<=0)&&(g=!0)));while(0===b.a&&!g);return b.x=d,b.y=e,b},getBounds:function(a){return void 0===a&&(a=new c.Rectangle),a.x=this.getFirstPixel(2).x,a.x===this.width?a.setTo(0,0,0,0):(a.y=this.getFirstPixel(0).y,a.width=this.getFirstPixel(3).x-a.x+1,a.height=this.getFirstPixel(1).y-a.y+1,a)},addToWorld:function(a,b,c,d,e,f){e=e||1,f=f||1;var g=this.game.add.image(a,b,this);return g.anchor.set(c,d),g.scale.set(e,f),g},copy:function(a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){if(void 0!==a&&null!==a||(a=this),(a instanceof c.RenderTexture||a instanceof PIXI.RenderTexture)&&(a=a.getCanvas()),this._image=a,a instanceof c.Sprite||a instanceof c.Image||a instanceof c.Text||a instanceof PIXI.Sprite)this._pos.set(a.texture.crop.x,a.texture.crop.y),this._size.set(a.texture.crop.width,a.texture.crop.height),this._scale.set(a.scale.x,a.scale.y),this._anchor.set(a.anchor.x,a.anchor.y),this._rotate=a.rotation,this._alpha.current=a.alpha,a.texture instanceof c.RenderTexture||a.texture instanceof PIXI.RenderTexture?this._image=a.texture.getCanvas():this._image=a.texture.baseTexture.source,void 0!==g&&null!==g||(g=a.x),void 0!==h&&null!==h||(h=a.y),a.texture.trim&&(g+=a.texture.trim.x-a.anchor.x*a.texture.trim.width,h+=a.texture.trim.y-a.anchor.y*a.texture.trim.height),16777215!==a.tint&&(a.cachedTint!==a.tint&&(a.cachedTint=a.tint,a.tintedTexture=PIXI.CanvasTinter.getTintedTexture(a,a.tint)),this._image=a.tintedTexture,this._pos.set(0));else{if(this._pos.set(0),this._scale.set(1),this._anchor.set(0),this._rotate=0,this._alpha.current=1,a instanceof c.BitmapData)this._image=a.canvas;else if("string"==typeof a){if(a=this.game.cache.getImage(a),null===a)return;this._image=a}this._size.set(this._image.width,this._image.height)}if(void 0!==b&&null!==b||(b=0),void 0!==d&&null!==d||(d=0),e&&(this._size.x=e),f&&(this._size.y=f),void 0!==g&&null!==g||(g=b),void 0!==h&&null!==h||(h=d),void 0!==i&&null!==i||(i=this._size.x),void 0!==j&&null!==j||(j=this._size.y),"number"==typeof k&&(this._rotate=k),"number"==typeof l&&(this._anchor.x=l),"number"==typeof m&&(this._anchor.y=m),"number"==typeof n&&(this._scale.x=n),"number"==typeof o&&(this._scale.y=o),"number"==typeof p&&(this._alpha.current=p),void 0===q&&(q=null),void 0===r&&(r=!1),!(this._alpha.current<=0||0===this._scale.x||0===this._scale.y||0===this._size.x||0===this._size.y)){var s=this.context;return this._alpha.prev=s.globalAlpha,s.save(),s.globalAlpha=this._alpha.current,q&&(this.op=q),r&&(g|=0,h|=0),s.translate(g,h),s.scale(this._scale.x,this._scale.y),s.rotate(this._rotate),s.drawImage(this._image,this._pos.x+b,this._pos.y+d,this._size.x,this._size.y,-i*this._anchor.x,-j*this._anchor.y,i,j),s.restore(),s.globalAlpha=this._alpha.prev,this.dirty=!0,this}},copyTransform:function(a,b,d){if(void 0===b&&(b=null),void 0===d&&(d=!1),!a.hasOwnProperty("worldTransform")||!a.worldVisible||0===a.worldAlpha)return this;var e=a.worldTransform;if(this._pos.set(a.texture.crop.x,a.texture.crop.y),this._size.set(a.texture.crop.width,a.texture.crop.height),0===e.a||0===e.d||0===this._size.x||0===this._size.y)return this;a.texture instanceof c.RenderTexture||a.texture instanceof PIXI.RenderTexture?this._image=a.texture.getCanvas():this._image=a.texture.baseTexture.source;var f=e.tx,
m.push(d,e),m.push(j,k,l,i),m.push(d+f,e),m.push(j,k,l,i),m.push(d,e+g),m.push(j,k,l,i),m.push(d+f,e+g),m.push(j,k,l,i),n.push(o,o,o+1,o+2,o+3,o+3)}if(a.lineWidth){var p=a.points;a.points=[d,e,d+f,e,d+f,e+g,d,e+g,d,e],PIXI.WebGLGraphics.buildLine(a,b),a.points=p}},PIXI.WebGLGraphics.buildRoundedRectangle=function(a,b){var c=a.shape,d=c.x,e=c.y,f=c.width,g=c.height,h=c.radius,i=[];if(i.push(d,e+h),i=i.concat(PIXI.WebGLGraphics.quadraticBezierCurve(d,e+g-h,d,e+g,d+h,e+g)),i=i.concat(PIXI.WebGLGraphics.quadraticBezierCurve(d+f-h,e+g,d+f,e+g,d+f,e+g-h)),i=i.concat(PIXI.WebGLGraphics.quadraticBezierCurve(d+f,e+h,d+f,e,d+f-h,e)),i=i.concat(PIXI.WebGLGraphics.quadraticBezierCurve(d+h,e,d,e,d,e+h)),a.fill){var j=PIXI.hex2rgb(a.fillColor),k=a.fillAlpha,l=j[0]*k,m=j[1]*k,n=j[2]*k,o=b.points,p=b.indices,q=o.length/6,r=PIXI.EarCut.Triangulate(i,null,2),s=0;for(s=0;s<r.length;s+=3)p.push(r[s]+q),p.push(r[s]+q),p.push(r[s+1]+q),p.push(r[s+2]+q),p.push(r[s+2]+q);for(s=0;s<i.length;s++)o.push(i[s],i[++s],l,m,n,k)}if(a.lineWidth){var t=a.points;a.points=i,PIXI.WebGLGraphics.buildLine(a,b),a.points=t}},PIXI.WebGLGraphics.quadraticBezierCurve=function(a,b,c,d,e,f){function g(a,b,c){var d=b-a;return a+d*c}for(var h,i,j,k,l,m,n=20,o=[],p=0,q=0;q<=n;q++)p=q/n,h=g(a,c,p),i=g(b,d,p),j=g(c,e,p),k=g(d,f,p),l=g(h,j,p),m=g(i,k,p),o.push(l,m);return o},PIXI.WebGLGraphics.buildCircle=function(a,b){var c,d,e=a.shape,f=e.x,g=e.y;a.type===PIXI.Graphics.CIRC?(c=e.radius,d=e.radius):(c=e.width,d=e.height);var h=40,i=2*Math.PI/h,j=0;if(a.fill){var k=PIXI.hex2rgb(a.fillColor),l=a.fillAlpha,m=k[0]*l,n=k[1]*l,o=k[2]*l,p=b.points,q=b.indices,r=p.length/6;for(q.push(r),j=0;j<h+1;j++)p.push(f,g,m,n,o,l),p.push(f+Math.sin(i*j)*c,g+Math.cos(i*j)*d,m,n,o,l),q.push(r++,r++);q.push(r-1)}if(a.lineWidth){var s=a.points;for(a.points=[],j=0;j<h+1;j++)a.points.push(f+Math.sin(i*j)*c,g+Math.cos(i*j)*d);PIXI.WebGLGraphics.buildLine(a,b),a.points=s}},PIXI.WebGLGraphics.buildLine=function(a,b){var c=0,d=a.points;if(0!==d.length){if(a.lineWidth%2)for(c=0;c<d.length;c++)d[c]+=.5;var e=new PIXI.Point(d[0],d[1]),f=new PIXI.Point(d[d.length-2],d[d.length-1]);if(e.x===f.x&&e.y===f.y){d=d.slice(),d.pop(),d.pop(),f=new PIXI.Point(d[d.length-2],d[d.length-1]);var g=f.x+.5*(e.x-f.x),h=f.y+.5*(e.y-f.y);d.unshift(g,h),d.push(g,h)}var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=b.points,G=b.indices,H=d.length/2,I=d.length,J=F.length/6,K=a.lineWidth/2,L=PIXI.hex2rgb(a.lineColor),M=a.lineAlpha,N=L[0]*M,O=L[1]*M,P=L[2]*M;for(k=d[0],l=d[1],m=d[2],n=d[3],q=-(l-n),r=k-m,E=Math.sqrt(q*q+r*r),q/=E,r/=E,q*=K,r*=K,F.push(k-q,l-r,N,O,P,M),F.push(k+q,l+r,N,O,P,M),c=1;c<H-1;c++)k=d[2*(c-1)],l=d[2*(c-1)+1],m=d[2*c],n=d[2*c+1],o=d[2*(c+1)],p=d[2*(c+1)+1],q=-(l-n),r=k-m,E=Math.sqrt(q*q+r*r),q/=E,r/=E,q*=K,r*=K,s=-(n-p),t=m-o,E=Math.sqrt(s*s+t*t),s/=E,t/=E,s*=K,t*=K,w=-r+l-(-r+n),x=-q+m-(-q+k),y=(-q+k)*(-r+n)-(-q+m)*(-r+l),z=-t+p-(-t+n),A=-s+m-(-s+o),B=(-s+o)*(-t+n)-(-s+m)*(-t+p),C=w*A-z*x,Math.abs(C)<.1?(C+=10.1,F.push(m-q,n-r,N,O,P,M),F.push(m+q,n+r,N,O,P,M)):(i=(x*B-A*y)/C,j=(z*y-w*B)/C,D=(i-m)*(i-m)+(j-n)+(j-n),D>19600?(u=q-s,v=r-t,E=Math.sqrt(u*u+v*v),u/=E,v/=E,u*=K,v*=K,F.push(m-u,n-v),F.push(N,O,P,M),F.push(m+u,n+v),F.push(N,O,P,M),F.push(m-u,n-v),F.push(N,O,P,M),I++):(F.push(i,j),F.push(N,O,P,M),F.push(m-(i-m),n-(j-n)),F.push(N,O,P,M)));for(k=d[2*(H-2)],l=d[2*(H-2)+1],m=d[2*(H-1)],n=d[2*(H-1)+1],q=-(l-n),r=k-m,E=Math.sqrt(q*q+r*r),q/=E,r/=E,q*=K,r*=K,F.push(m-q,n-r),F.push(N,O,P,M),F.push(m+q,n+r),F.push(N,O,P,M),G.push(J),c=0;c<I;c++)G.push(J++);G.push(J-1)}},PIXI.WebGLGraphics.buildComplexPoly=function(a,b){var c=a.points.slice();if(!(c.length<6)){var d=b.indices;b.points=c,b.alpha=a.fillAlpha,b.color=PIXI.hex2rgb(a.fillColor);for(var e,f,g=1/0,h=-(1/0),i=1/0,j=-(1/0),k=0;k<c.length;k+=2)e=c[k],f=c[k+1],g=e<g?e:g,h=e>h?e:h,i=f<i?f:i,j=f>j?f:j;c.push(g,i,h,i,h,j,g,j);var l=c.length/2;for(k=0;k<l;k++)d.push(k)}},PIXI.WebGLGraphics.buildPoly=function(a,b){var c=a.points;if(!(c.length<6)){var d=b.points,e=b.indices,f=c.length/2,g=PIXI.hex2rgb(a.fillColor),h=a.fillAlpha,i=g[0]*h,j=g[1]*h,k=g[2]*
this.updateText(),this.dirty=!1,c.Component.Core.init.call(this,a,b,d,"",null)},c.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),c.BitmapText.prototype.constructor=c.BitmapText,c.Component.Core.install.call(c.BitmapText.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),c.BitmapText.prototype.preUpdatePhysics=c.Component.PhysicsBody.preUpdate,c.BitmapText.prototype.preUpdateLifeSpan=c.Component.LifeSpan.preUpdate,c.BitmapText.prototype.preUpdateInWorld=c.Component.InWorld.preUpdate,c.BitmapText.prototype.preUpdateCore=c.Component.Core.preUpdate,c.BitmapText.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},c.BitmapText.prototype.postUpdate=function(){c.Component.PhysicsBody.postUpdate.call(this),c.Component.FixedToCamera.postUpdate.call(this),this.body&&this.body.type===c.Physics.ARCADE&&(this.textWidth===this.body.sourceWidth&&this.textHeight===this.body.sourceHeight||this.body.setSize(this.textWidth,this.textHeight))},c.BitmapText.prototype.setText=function(a){this.text=a};c.BitmapText.prototype.scanLine=function(a,b,c){for(var d=0,e=0,f=-1,g=0,h=null,i=this._maxWidth>0?this._maxWidth:null,j=[],k=0;k<c.length;k++){var l=k===c.length-1;if(/(?:\r\n|\r|\n)/.test(c.charAt(k)))return{width:e,text:c.substr(0,k),end:l,chars:j};var m=c.charCodeAt(k),n=a.chars[m],o=0;void 0===n&&(m=32,n=a.chars[m]);var p=h&&n.kerning[h]?n.kerning[h]:0;if(/(\s)/.test(c.charAt(k))&&(f=k,g=e),o=(p+n.texture.width+n.xOffset)*b,i&&e+o>=i&&f>-1)return{width:g||e,text:c.substr(0,k-(k-f)),end:l,chars:j};e+=(n.xAdvance+p)*b,j.push(d+(n.xOffset+p)*b),d+=(n.xAdvance+p)*b,h=m}return{width:e,text:c,end:l,chars:j}};c.BitmapText.prototype.cleanText=function(a,b){void 0===b&&(b="");var c=this._data.font;if(!c)return"";for(var d=/\r\n|\n\r|\n|\r/g,e=a.replace(d,"\n").split("\n"),f=0;f<e.length;f++){for(var g="",h=e[f],i=0;i<h.length;i++)g=c.chars[h.charCodeAt(i)]?g.concat(h[i]):g.concat(b);e[f]=g}return e.join("\n")},c.BitmapText.prototype.updateText=function(){var a=this._data.font;if(a){var b=this.text,c=this._fontSize/a.size,d=[],e=0;this.textWidth=0;do{var f=this.scanLine(a,c,b);f.y=e,d.push(f),f.width>this.textWidth&&(this.textWidth=f.width),e+=a.lineHeight*c,b=b.substr(f.text.length+1)}while(f.end===!1);this.textHeight=e;for(var g=0,h=0,i=this.textWidth*this.anchor.x,j=this.textHeight*this.anchor.y,k=0;k<d.length;k++){var f=d[k];"right"===this._align?h=this.textWidth-f.width:"center"===this._align&&(h=(this.textWidth-f.width)/2);for(var l=0;l<f.text.length;l++){var m=f.text.charCodeAt(l),n=a.chars[m];void 0===n&&(m=32,n=a.chars[m]);var o=this._glyphs[g];o?o.texture=n.texture:(o=new PIXI.Sprite(n.texture),o.name=f.text[l],this._glyphs.push(o)),o.position.x=f.chars[l]+h-i,o.position.y=f.y+n.yOffset*c-j,o.scale.set(c),o.tint=this.tint,o.texture.requiresReTint=!0,o.parent||this.addChild(o),g++}}for(k=g;k<this._glyphs.length;k++)this.removeChild(this._glyphs[k])}},c.BitmapText.prototype.purgeGlyphs=function(){for(var a=this._glyphs.length,b=[],c=0;c<this._glyphs.length;c++)this._glyphs[c].parent!==this?this._glyphs[c].destroy():b.push(this._glyphs[c]);return this._glyphs=[],this._glyphs=b,this.updateText(),a-b.length},c.BitmapText.prototype.updateTransform=function(){!this.dirty&&this.anchor.equals(this._prevAnchor)||(this.updateText(),this.dirty=!1,this._prevAnchor.copyFrom(this.anchor)),PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)},Object.defineProperty(c.BitmapText.prototype,"align",{get:function(){return this._align},set:function(a){a===this._align||"left"!==a&&"center"!==a&&"right"!==a||(this._align=a,this.updateText())}}),Object.defineProperty(c.BitmapText.prototype,"tint",{get:function(){return this._tint},set:function(a){a!==this._tint&&(this._tint=a,this.updateText())}}),Object.defineProperty(c.BitmapText.prototype,"font",{get:function(){return this._font},set:function(a){a!==this._font&&(this._font=a.trim(),this._data=this.game.cache.getBitmap
a*a*(3-2*a)},smootherstep:function(a,b,c){return a=Math.max(0,Math.min(1,(a-b)/(c-b))),a*a*a*(a*(6*a-15)+10)},sign:function(a){return a<0?-1:a>0?1:0},percent:function(a,b,c){return void 0===c&&(c=0),a>b||c>b?1:a<c||c>a?0:(a-c)/b}};var k=Math.PI/180,l=180/Math.PI;return c.Math.degToRad=function(a){return a*k},c.Math.radToDeg=function(a){return a*l},c.RandomDataGenerator=function(a){void 0===a&&(a=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,"string"==typeof a?this.state(a):this.sow(a)},c.RandomDataGenerator.prototype={rnd:function(){var a=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|a,this.s0=this.s1,this.s1=this.s2,this.s2=a-this.c,this.s2},sow:function(a){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,a)for(var b=0;b<a.length&&null!=a[b];b++){var c=a[b];this.s0-=this.hash(c),this.s0+=~~(this.s0<0),this.s1-=this.hash(c),this.s1+=~~(this.s1<0),this.s2-=this.hash(c),this.s2+=~~(this.s2<0)}},hash:function(a){var b,c,d;for(d=4022871197,a=a.toString(),c=0;c<a.length;c++)d+=a.charCodeAt(c),b=.02519603282416938*d,d=b>>>0,b-=d,b*=d,d=b>>>0,b-=d,d+=4294967296*b;return 2.3283064365386963e-10*(d>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(a,b){return Math.floor(this.realInRange(0,b-a+1)+a)},between:function(a,b){return this.integerInRange(a,b)},realInRange:function(a,b){return this.frac()*(b-a)+a},normal:function(){return 1-2*this.frac()},uuid:function(){var a="",b="";for(b=a="";a++<36;b+=~a%5|3*a&4?(15^a?8^this.frac()*(20^a?16:4):4).toString(16):"-");return b},pick:function(a){return a[this.integerInRange(0,a.length-1)]},sign:function(){return this.pick([-1,1])},weightedPick:function(a){return a[~~(Math.pow(this.frac(),2)*(a.length-1)+.5)]},timestamp:function(a,b){return this.realInRange(a||9466848e5,b||1577862e6)},angle:function(){return this.integerInRange(-180,180)},state:function(a){return"string"==typeof a&&a.match(/^!rnd/)&&(a=a.split(","),this.c=parseFloat(a[1]),this.s0=parseFloat(a[2]),this.s1=parseFloat(a[3]),this.s2=parseFloat(a[4])),["!rnd",this.c,this.s0,this.s1,this.s2].join(",")}},c.RandomDataGenerator.prototype.constructor=c.RandomDataGenerator,c.QuadTree=function(a,b,c,d,e,f,g){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this._empty=[],this.reset(a,b,c,d,e,f,g)},c.QuadTree.prototype={reset:function(a,b,c,d,e,f,g){this.maxObjects=e||10,this.maxLevels=f||4,this.level=g||0,this.bounds={x:Math.round(a),y:Math.round(b),width:c,height:d,subWidth:Math.floor(c/2),subHeight:Math.floor(d/2),right:Math.round(a)+Math.floor(c/2),bottom:Math.round(b)+Math.floor(d/2)},this.objects.length=0,this.nodes.length=0},populate:function(a){a.forEach(this.populateHandler,this,!0)},populateHandler:function(a){a.body&&a.exists&&this.insert(a.body)},split:function(){this.nodes[0]=new c.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[1]=new c.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[2]=new c.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[3]=new c.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1)},insert:function(a){var b,c=0;if(null!=this.nodes[0]&&(b=this.getIndex(a),b!==-1))return void this.nodes[b].insert(a);if(this.objects.push(a),this.objects.length>this.maxObjects&&this.level<this.maxLevels)for(null==this.nodes[0]&&this.split();c<this.objects.length;)b=this.getIndex(this.objects[c]),b!==-1?this.nodes[b].insert(this.objects.splice(c,1)[0]):c++},getIndex:function(a){var b=-1;return a.x<this.bounds.right&&a.right<this.bounds.right?a.y<this.bounds.bottom&&a.bottom<this.bounds.bottom?b
this.sprite=null,this.game=null}},c.AnimationManager.prototype.constructor=c.AnimationManager,Object.defineProperty(c.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(c.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData.total}}),Object.defineProperty(c.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(c.AnimationManager.prototype,"name",{get:function(){if(this.currentAnim)return this.currentAnim.name}}),Object.defineProperty(c.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame)return this.currentFrame.index},set:function(a){"number"==typeof a&&this._frameData&&null!==this._frameData.getFrame(a)&&(this.currentFrame=this._frameData.getFrame(a),this.currentFrame&&this.sprite.setFrame(this.currentFrame))}}),Object.defineProperty(c.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame)return this.currentFrame.name},set:function(a){"string"==typeof a&&this._frameData&&null!==this._frameData.getFrameByName(a)?(this.currentFrame=this._frameData.getFrameByName(a),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame))):console.warn("Cannot set frameName: "+a)}}),c.Animation=function(a,b,d,e,f,g,h){void 0===h&&(h=!1),this.game=a,this._parent=b,this._frameData=e,this.name=d,this._frames=[],this._frames=this._frames.concat(f),this.delay=1e3/g,this.loop=h,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new c.Signal,this.onUpdate=null,this.onComplete=new c.Signal,this.onLoop=new c.Signal,this.isReversed=!1,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},c.Animation.prototype={play:function(a,b,c){return"number"==typeof a&&(this.delay=1e3/a),"boolean"==typeof b&&(this.loop=b),"undefined"!=typeof c&&(this.killOnComplete=c),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=this.isReversed?this._frames.length-1:0,this.updateCurrentFrame(!1,!0),this._parent.events.onAnimationStart$dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setFrame(this.currentFrame),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this.onStart.dispatch(this._parent,this)},reverse:function(){return this.reversed=!this.reversed,this},reverseOnce:function(){return this.onComplete.addOnce(this.reverse,this),this.reverse()},setFrame:function(a,b){var c;if(void 0===b&&(b=!1),"string"==typeof a)for(var d=0;d<this._frames.length;d++)this._frameData.getFrame(this._frames[d]).name===a&&(c=d);else if("number"==typeof a)if(b)c=a;else for(var d=0;d<this._frames.length;d++)this._frames[d]===a&&(c=d);c&&(this._frameIndex=c-1,this._timeNextFrame=this.game.time.time,this.update())},stop:function(a,b){void 0===a&&(a=!1),void 0===b&&(b=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,a&&(this.currentFrame=this._frameData.getFrame(this._frames[0]),this._parent.setFrame(this.currentFrame)),b&&(this._parent.events.onAnimationComplete$dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this))},onPause:function(){this.isPlaying&&(this._frameDiff=this._timeNextFrame-this.game.time.time)},onResume:function(){this.isPlaying&&(this._timeNextFrame=this.game.time.time+this._frameDiff)},upda
this.cache.addPhysicsData(a,null,d,e)):this.addToFileList("physics",a,b,{format:e}),this},bitmapFont:function(a,b,c,d,e,f){if(void 0!==b&&null!==b||(b=a+".png"),void 0===c&&(c=null),void 0===d&&(d=null),null===c&&null===d&&(c=a+".xml"),void 0===e&&(e=0),void 0===f&&(f=0),c)this.addToFileList("bitmapfont",a,b,{atlasURL:c,xSpacing:e,ySpacing:f});else if("string"==typeof d){var g,h;try{g=JSON.parse(d)}catch(a){h=this.parseXml(d)}if(!h&&!g)throw new Error("Phaser.Loader. Invalid Bitmap Font atlas given");this.addToFileList("bitmapfont",a,b,{atlasURL:null,atlasData:g||h,atlasType:g?"json":"xml",xSpacing:e,ySpacing:f})}return this},atlasJSONArray:function(a,b,d,e){return this.atlas(a,b,d,e,c.Loader.TEXTURE_ATLAS_JSON_ARRAY)},atlasJSONHash:function(a,b,d,e){return this.atlas(a,b,d,e,c.Loader.TEXTURE_ATLAS_JSON_HASH)},atlasXML:function(a,b,d,e){return void 0===d&&(d=null),void 0===e&&(e=null),d||e||(d=a+".xml"),this.atlas(a,b,d,e,c.Loader.TEXTURE_ATLAS_XML_STARLING)},atlas:function(a,b,d,e,f){if(void 0!==b&&null!==b||(b=a+".png"),void 0===d&&(d=null),void 0===e&&(e=null),void 0===f&&(f=c.Loader.TEXTURE_ATLAS_JSON_ARRAY),d||e||(d=f===c.Loader.TEXTURE_ATLAS_XML_STARLING?a+".xml":a+".json"),d)this.addToFileList("textureatlas",a,b,{atlasURL:d,format:f});else{switch(f){case c.Loader.TEXTURE_ATLAS_JSON_ARRAY:"string"==typeof e&&(e=JSON.parse(e));break;case c.Loader.TEXTURE_ATLAS_XML_STARLING:if("string"==typeof e){var g=this.parseXml(e);if(!g)throw new Error("Phaser.Loader. Invalid Texture Atlas XML given");e=g}}this.addToFileList("textureatlas",a,b,{atlasURL:null,atlasData:e,format:f})}return this},withSyncPoint:function(a,b){this._withSyncPointDepth++;try{a.call(b||this,this)}finally{this._withSyncPointDepth--}return this},addSyncPoint:function(a,b){var c=this.getAsset(a,b);return c&&(c.file.syncPoint=!0),this},removeFile:function(a,b){var c=this.getAsset(a,b);c&&(c.loaded||c.loading||this._fileList.splice(c.index,1))},removeAll:function(){this._fileList.length=0,this._flightQueue.length=0},start:function(){this.isLoading||(this.hasLoaded=!1,this.isLoading=!0,this.updateProgress(),this.processLoadQueue())},processLoadQueue:function(){if(!this.isLoading)return console.warn("Phaser.Loader - active loading canceled / reset"),void this.finishedLoading(!0);for(var a=0;a<this._flightQueue.length;a++){var b=this._flightQueue[a];(b.loaded||b.error)&&(this._flightQueue.splice(a,1),a--,b.loading=!1,b.requestUrl=null,b.requestObject=null,b.error&&this.onFileError.dispatch(b.key,b),"packfile"!==b.type?(this._loadedFileCount++,this.onFileComplete.dispatch(this.progress,b.key,!b.error,this._loadedFileCount,this._totalFileCount)):"packfile"===b.type&&b.error&&(this._loadedPackCount++,this.onPackComplete.dispatch(b.key,!b.error,this._loadedPackCount,this._totalPackCount)))}for(var d=!1,e=this.enableParallel?c.Math.clamp(this.maxParallelDownloads,1,12):1,a=this._processingHead;a<this._fileList.length;a++){var b=this._fileList[a];if("packfile"===b.type&&!b.error&&b.loaded&&a===this._processingHead&&(this.processPack(b),this._loadedPackCount++,this.onPackComplete.dispatch(b.key,!b.error,this._loadedPackCount,this._totalPackCount)),b.loaded||b.error?a===this._processingHead&&(this._processingHead=a+1):!b.loading&&this._flightQueue.length<e&&("packfile"!==b.type||b.data?d||(this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.dispatch()),this._flightQueue.push(b),b.loading=!0,this.onFileStart.dispatch(this.progress,b.key,b.url),this.loadFile(b)):(this._flightQueue.push(b),b.loading=!0,this.loadFile(b))),!b.loaded&&b.syncPoint&&(d=!0),this._flightQueue.length>=e||d&&this._loadedPackCount===this._totalPackCount)break}if(this.updateProgress(),this._processingHead>=this._fileList.length)this.finishedLoading();else if(!this._flightQueue.length){console.warn("Phaser.Loader - aborting: processing queue empty, loading may have stalled");var f=this;setTimeout(function(){f.finishedLoading(!0)},2e3)}},finishedLoading:function(a){this.hasLoaded||(this.hasLoaded=!0,this.isLoading=!1,a||this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.d
this._watchList.reset();for(var e=0;e<a.length;e++)a[e]instanceof c.Sound?this.game.cache.isSoundDecoded(a[e].key)||this._watchList.add(a[e].key):this.game.cache.isSoundDecoded(a[e])||this._watchList.add(a[e]);0===this._watchList.total?(this._watching=!1,b.call(d)):(this._watching=!0,this._watchCallback=b,this._watchContext=d)},update:function(){if(!this.noAudio){!this.touchLocked||null===this._unlockSource||this._unlockSource.playbackState!==this._unlockSource.PLAYING_STATE&&this._unlockSource.playbackState!==this._unlockSource.FINISHED_STATE||(this.touchLocked=!1,this._unlockSource=null);for(var a=0;a<this._sounds.length;a++)this._sounds[a].update();if(this._watching){for(var b=this._watchList.first;b;)this.game.cache.isSoundDecoded(b)&&this._watchList.remove(b),b=this._watchList.next;0===this._watchList.total&&(this._watching=!1,this._watchCallback.call(this._watchContext))}}},add:function(a,b,d,e){void 0===b&&(b=1),void 0===d&&(d=!1),void 0===e&&(e=this.connectToMaster);var f=new c.Sound(this.game,a,b,d,e);return this._sounds.push(f),f},addSprite:function(a){var b=new c.AudioSprite(this.game,a);return b},remove:function(a){for(var b=this._sounds.length;b--;)if(this._sounds[b]===a)return this._sounds[b].destroy(!1),this._sounds.splice(b,1),!0;return!1},removeByKey:function(a){for(var b=this._sounds.length,c=0;b--;)this._sounds[b].key===a&&(this._sounds[b].destroy(!1),this._sounds.splice(b,1),c++);return c},play:function(a,b,c){if(!this.noAudio){var d=this.add(a,b,c);return d.play(),d}},setMute:function(){if(!this._muted){this._muted=!0,this.usingWebAudio&&(this._muteVolume=this.masterGain.gain.value,this.masterGain.gain.value=0);for(var a=0;a<this._sounds.length;a++)this._sounds[a].usingAudioTag&&(this._sounds[a].mute=!0);this.onMute.dispatch()}},unsetMute:function(){if(this._muted&&!this._codeMuted){this._muted=!1,this.usingWebAudio&&(this.masterGain.gain.value=this._muteVolume);for(var a=0;a<this._sounds.length;a++)this._sounds[a].usingAudioTag&&(this._sounds[a].mute=!1);this.onUnMute.dispatch()}},destroy:function(){this.stopAll();for(var a=0;a<this._sounds.length;a++)this._sounds[a]&&this._sounds[a].destroy();this._sounds=[],this.onSoundDecode.dispose(),this.context&&(window.PhaserGlobal?window.PhaserGlobal.audioContext=this.context:this.context.close&&this.context.close())}},c.SoundManager.prototype.constructor=c.SoundManager,Object.defineProperty(c.SoundManager.prototype,"mute",{get:function(){return this._muted},set:function(a){if(a=a||!1){if(this._muted)return;this._codeMuted=!0,this.setMute()}else{if(!this._muted)return;this._codeMuted=!1,this.unsetMute()}}}),Object.defineProperty(c.SoundManager.prototype,"volume",{get:function(){return this._volume},set:function(a){if(a<0?a=0:a>1&&(a=1),this._volume!==a){if(this._volume=a,this.usingWebAudio)this.masterGain.gain.value=a;else for(var b=0;b<this._sounds.length;b++)this._sounds[b].usingAudioTag&&this._sounds[b].updateGlobalVolume(a);this.onVolumeChange.dispatch(a)}}}),c.ScaleManager=function(a,b,d){this.game=a,this.dom=c.DOM,this.grid=null,this.width=0,this.height=0,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.offset=new c.Point,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this._pageAlignHorizontally=!1,this._pageAlignVertically=!1,this.onOrientationChange=new c.Signal,this.enterIncorrectOrientation=new c.Signal,this.leaveIncorrectOrientation=new c.Signal,this.hasPhaserSetFullScreen=!1,this.fullScreenTarget=null,this._createdFullScreenTarget=null,this.onFullScreenInit=new c.Signal,this.onFullScreenChange=new c.Signal,this.onFullScreenError=new c.Signal,this.screenOrientation=this.dom.getScreenOrientation(),this.scaleFactor=new c.Point(1,1),this.scaleFactorInversed=new c.Point(1,1),this.margin={left:0,top:0,right:0,bottom:0,x:0,y:0},this.bounds=new c.Rectangle,this.aspectRatio=0,this.sourceAspectRatio=0,this.event=null,this.windowConstraints={right:"layout",bottom:""},this.compatibility={supportsFullScreen:!1,orientationFallback:null,noMargins:!1,scrollTo:null,forceMinimumDocumentHeight:!1,canExpa
return b.x=d.left+f-h,b.y=d.top+e-g,b},getBounds:function(a,b){return void 0===b&&(b=0),a=a&&!a.nodeType?a[0]:a,!(!a||1!==a.nodeType)&&this.calibrate(a.getBoundingClientRect(),b)},calibrate:function(a,b){b=+b||0;var c={width:0,height:0,left:0,right:0,top:0,bottom:0};return c.width=(c.right=a.right+b)-(c.left=a.left-b),c.height=(c.bottom=a.bottom+b)-(c.top=a.top-b),c},getAspectRatio:function(a){a=null==a?this.visualBounds:1===a.nodeType?this.getBounds(a):a;var b=a.width,c=a.height;return"function"==typeof b&&(b=b.call(a)),"function"==typeof c&&(c=c.call(a)),b/c},inLayoutViewport:function(a,b){var c=this.getBounds(a,b);return!!c&&c.bottom>=0&&c.right>=0&&c.top<=this.layoutBounds.width&&c.left<=this.layoutBounds.height},getScreenOrientation:function(a){var b=window.screen,c=b.orientation||b.mozOrientation||b.msOrientation;if(c&&"string"==typeof c.type)return c.type;if("string"==typeof c)return c;var d="portrait-primary",e="landscape-primary";if("screen"===a)return b.height>b.width?d:e;if("viewport"===a)return this.visualBounds.height>this.visualBounds.width?d:e;if("window.orientation"===a&&"number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?d:e;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return d;if(window.matchMedia("(orientation: landscape)").matches)return e}return this.visualBounds.height>this.visualBounds.width?d:e},visualBounds:new c.Rectangle,layoutBounds:new c.Rectangle,documentBounds:new c.Rectangle},c.Device.whenReady(function(a){var b=window&&"pageXOffset"in window?function(){return window.pageXOffset}:function(){return document.documentElement.scrollLeft},d=window&&"pageYOffset"in window?function(){return window.pageYOffset}:function(){return document.documentElement.scrollTop};Object.defineProperty(c.DOM,"scrollX",{get:b}),Object.defineProperty(c.DOM,"scrollY",{get:d}),Object.defineProperty(c.DOM.visualBounds,"x",{get:b}),Object.defineProperty(c.DOM.visualBounds,"y",{get:d}),Object.defineProperty(c.DOM.layoutBounds,"x",{value:0}),Object.defineProperty(c.DOM.layoutBounds,"y",{value:0});var e=a.desktop&&document.documentElement.clientWidth<=window.innerWidth&&document.documentElement.clientHeight<=window.innerHeight;if(e){var f=function(){return Math.max(window.innerWidth,document.documentElement.clientWidth)},g=function(){return Math.max(window.innerHeight,document.documentElement.clientHeight)};Object.defineProperty(c.DOM.visualBounds,"width",{get:f}),Object.defineProperty(c.DOM.visualBounds,"height",{get:g}),Object.defineProperty(c.DOM.layoutBounds,"width",{get:f}),Object.defineProperty(c.DOM.layoutBounds,"height",{get:g})}else Object.defineProperty(c.DOM.visualBounds,"width",{get:function(){return window.innerWidth}}),Object.defineProperty(c.DOM.visualBounds,"height",{get:function(){return window.innerHeight}}),Object.defineProperty(c.DOM.layoutBounds,"width",{get:function(){var a=document.documentElement.clientWidth,b=window.innerWidth;return a<b?b:a}}),Object.defineProperty(c.DOM.layoutBounds,"height",{get:function(){var a=document.documentElement.clientHeight,b=window.innerHeight;return a<b?b:a}});Object.defineProperty(c.DOM.documentBounds,"x",{value:0}),Object.defineProperty(c.DOM.documentBounds,"y",{value:0}),Object.defineProperty(c.DOM.documentBounds,"width",{get:function(){var a=document.documentElement;return Math.max(a.clientWidth,a.offsetWidth,a.scrollWidth)}}),Object.defineProperty(c.DOM.documentBounds,"height",{get:function(){var a=document.documentElement;return Math.max(a.clientHeight,a.offsetHeight,a.scrollHeight)}})},null,!0),c.ArraySet=function(a){this.position=0,this.list=a||[]},c.ArraySet.prototype={add:function(a){return this.exists(a)||this.list.push(a),a},getIndex:function(a){return this.list.indexOf(a)},getByKey:function(a,b){for(var c=this.list.length;c--;)if(this.list[c][a]===b)return this.list[c];return null},exists:function(a){return this.list.indexOf(a)>-1},reset:function(){this.list.length=0},remove:function(a){var b=this.list.indexOf(a);if(b>-1)return this.list.splice(b,1),a},setAll:function(a,b){for(var c
b.onCollide&&b.onCollide.dispatch(b.sprite,a.sprite))),l},intersects:function(a,b){return a!==b&&(a.isCircle?b.isCircle?c.Math.distance(a.center.x,a.center.y,b.center.x,b.center.y)<=a.radius+b.radius:this.circleBodyIntersects(a,b):b.isCircle?this.circleBodyIntersects(b,a):!(a.right<=b.position.x)&&(!(a.bottom<=b.position.y)&&(!(a.position.x>=b.right)&&!(a.position.y>=b.bottom))))},circleBodyIntersects:function(a,b){var d=c.Math.clamp(a.center.x,b.left,b.right),e=c.Math.clamp(a.center.y,b.top,b.bottom),f=(a.center.x-d)*(a.center.x-d),g=(a.center.y-e)*(a.center.y-e);return f+g<=a.radius*a.radius},separateCircle:function(a,b,d){this.getOverlapX(a,b),this.getOverlapY(a,b);var e=b.center.x-a.center.x,f=b.center.y-a.center.y,g=Math.atan2(f,e),h=0;if(a.isCircle!==b.isCircle){var i={x:b.isCircle?a.position.x:b.position.x,y:b.isCircle?a.position.y:b.position.y,right:b.isCircle?a.right:b.right,bottom:b.isCircle?a.bottom:b.bottom},j={x:a.isCircle?a.position.x+a.radius:b.position.x+b.radius,y:a.isCircle?a.position.y+a.radius:b.position.y+b.radius,radius:a.isCircle?a.radius:b.radius};j.y<i.y?j.x<i.x?h=c.Math.distance(j.x,j.y,i.x,i.y)-j.radius:j.x>i.right&&(h=c.Math.distance(j.x,j.y,i.right,i.y)-j.radius):j.y>i.bottom&&(j.x<i.x?h=c.Math.distance(j.x,j.y,i.x,i.bottom)-j.radius:j.x>i.right&&(h=c.Math.distance(j.x,j.y,i.right,i.bottom)-j.radius)),h*=-1}else h=a.radius+b.radius-c.Math.distance(a.center.x,a.center.y,b.center.x,b.center.y);if(d||0===h||a.immovable&&b.immovable||a.customSeparateX||b.customSeparateX)return 0!==h&&(a.onOverlap&&a.onOverlap.dispatch(a.sprite,b.sprite),b.onOverlap&&b.onOverlap.dispatch(b.sprite,a.sprite)),0!==h;var k={x:a.velocity.x*Math.cos(g)+a.velocity.y*Math.sin(g),y:a.velocity.x*Math.sin(g)-a.velocity.y*Math.cos(g)},l={x:b.velocity.x*Math.cos(g)+b.velocity.y*Math.sin(g),y:b.velocity.x*Math.sin(g)-b.velocity.y*Math.cos(g)},m=((a.mass-b.mass)*k.x+2*b.mass*l.x)/(a.mass+b.mass),n=(2*a.mass*k.x+(b.mass-a.mass)*l.x)/(a.mass+b.mass);return a.immovable||(a.velocity.x=(m*Math.cos(g)-k.y*Math.sin(g))*a.bounce.x,a.velocity.y=(k.y*Math.cos(g)+m*Math.sin(g))*a.bounce.y),b.immovable||(b.velocity.x=(n*Math.cos(g)-l.y*Math.sin(g))*b.bounce.x,b.velocity.y=(l.y*Math.cos(g)+n*Math.sin(g))*b.bounce.y),Math.abs(g)<Math.PI/2?a.velocity.x>0&&!a.immovable&&b.velocity.x>a.velocity.x?a.velocity.x*=-1:b.velocity.x<0&&!b.immovable&&a.velocity.x<b.velocity.x?b.velocity.x*=-1:a.velocity.y>0&&!a.immovable&&b.velocity.y>a.velocity.y?a.velocity.y*=-1:b.velocity.y<0&&!b.immovable&&a.velocity.y<b.velocity.y&&(b.velocity.y*=-1):Math.abs(g)>Math.PI/2&&(a.velocity.x<0&&!a.immovable&&b.velocity.x<a.velocity.x?a.velocity.x*=-1:b.velocity.x>0&&!b.immovable&&a.velocity.x>b.velocity.x?b.velocity.x*=-1:a.velocity.y<0&&!a.immovable&&b.velocity.y<a.velocity.y?a.velocity.y*=-1:b.velocity.y>0&&!b.immovable&&a.velocity.x>b.velocity.y&&(b.velocity.y*=-1)),a.immovable||(a.x+=a.velocity.x*this.game.time.physicsElapsed-h*Math.cos(g),a.y+=a.velocity.y*this.game.time.physicsElapsed-h*Math.sin(g)),b.immovable||(b.x+=b.velocity.x*this.game.time.physicsElapsed+h*Math.cos(g),b.y+=b.velocity.y*this.game.time.physicsElapsed+h*Math.sin(g)),a.onCollide&&a.onCollide.dispatch(a.sprite,b.sprite),b.onCollide&&b.onCollide.dispatch(b.sprite,a.sprite),!0},getOverlapX:function(a,b,c){var d=0,e=a.deltaAbsX()+b.deltaAbsX()+this.OVERLAP_BIAS;return 0===a.deltaX()&&0===b.deltaX()?(a.embedded=!0,b.embedded=!0):a.deltaX()>b.deltaX()?(d=a.right-b.x,d>e&&!c||a.checkCollision.right===!1||b.checkCollision.left===!1?d=0:(a.touching.none=!1,a.touching.right=!0,b.touching.none=!1,b.touching.left=!0)):a.deltaX()<b.deltaX()&&(d=a.x-b.width-b.x,-d>e&&!c||a.checkCollision.left===!1||b.checkCollision.right===!1?d=0:(a.touching.none=!1,a.touching.left=!0,b.touching.none=!1,b.touching.right=!0)),a.overlapX=d,b.overlapX=d,d},getOverlapY:function(a,b,c){var d=0,e=a.deltaAbsY()+b.deltaAbsY()+this.OVERLAP_BIAS;return 0===a.deltaY()&&0===b.deltaY()?(a.embedded=!0,b.embedded=!0):a.deltaY()>b.deltaY()?(d=a.bottom-b.y,d>e&&!c||a.checkCollision.down===!1||b.checkCollision.up===!1?d=0:(a.touching.none=!1,
for(var d=this.world.springs,b=d.length-1;b>=0;b--)this.world.removeSpring(d[b]);for(var e=this.world.contactMaterials,b=e.length-1;b>=0;b--)this.world.removeContactMaterial(e[b]);this.world.off("beginContact",this.beginContactHandler,this),this.world.off("endContact",this.endContactHandler,this),this.postBroadphaseCallback=null,this.callbackContext=null,this.impactCallback=null,this.collisionGroups=[],this._toRemove=[],this.boundsCollidesWith=[],this.walls={left:null,right:null,top:null,bottom:null}},destroy:function(){this.clear(),this.game=null},addBody:function(a){return!a.data.world&&(this.world.addBody(a.data),this.onBodyAdded.dispatch(a),!0)},removeBody:function(a){return a.data.world===this.world&&(this.world.removeBody(a.data),this.onBodyRemoved.dispatch(a)),a},addSpring:function(a){return a instanceof c.Physics.P2.Spring||a instanceof c.Physics.P2.RotationalSpring?this.world.addSpring(a.data):this.world.addSpring(a),this.onSpringAdded.dispatch(a),a},removeSpring:function(a){return a instanceof c.Physics.P2.Spring||a instanceof c.Physics.P2.RotationalSpring?this.world.removeSpring(a.data):this.world.removeSpring(a),this.onSpringRemoved.dispatch(a),a},createDistanceConstraint:function(a,b,d,e,f,g){return a=this.getBody(a),b=this.getBody(b),a&&b?this.addConstraint(new c.Physics.P2.DistanceConstraint(this,a,b,d,e,f,g)):void console.warn("Cannot create Constraint, invalid body objects given")},createGearConstraint:function(a,b,d,e){return a=this.getBody(a),b=this.getBody(b),a&&b?this.addConstraint(new c.Physics.P2.GearConstraint(this,a,b,d,e)):void console.warn("Cannot create Constraint, invalid body objects given")},createRevoluteConstraint:function(a,b,d,e,f,g){return a=this.getBody(a),d=this.getBody(d),a&&d?this.addConstraint(new c.Physics.P2.RevoluteConstraint(this,a,b,d,e,f,g)):void console.warn("Cannot create Constraint, invalid body objects given")},createLockConstraint:function(a,b,d,e,f){return a=this.getBody(a),b=this.getBody(b),a&&b?this.addConstraint(new c.Physics.P2.LockConstraint(this,a,b,d,e,f)):void console.warn("Cannot create Constraint, invalid body objects given")},createPrismaticConstraint:function(a,b,d,e,f,g,h){return a=this.getBody(a),b=this.getBody(b),a&&b?this.addConstraint(new c.Physics.P2.PrismaticConstraint(this,a,b,d,e,f,g,h)):void console.warn("Cannot create Constraint, invalid body objects given")},addConstraint:function(a){return this.world.addConstraint(a),this.onConstraintAdded.dispatch(a),a},removeConstraint:function(a){return this.world.removeConstraint(a),this.onConstraintRemoved.dispatch(a),a},addContactMaterial:function(a){return this.world.addContactMaterial(a),this.onContactMaterialAdded.dispatch(a),a},removeContactMaterial:function(a){return this.world.removeContactMaterial(a),this.onContactMaterialRemoved.dispatch(a),a},getContactMaterial:function(a,b){return this.world.getContactMaterial(a,b)},setMaterial:function(a,b){for(var c=b.length;c--;)b[c].setMaterial(a)},createMaterial:function(a,b){a=a||"";var d=new c.Physics.P2.Material(a);return this.materials.push(d),"undefined"!=typeof b&&b.setMaterial(d),d},createContactMaterial:function(a,b,d){void 0===a&&(a=this.createMaterial()),void 0===b&&(b=this.createMaterial());var e=new c.Physics.P2.ContactMaterial(a,b,d);return this.addContactMaterial(e)},getBodies:function(){for(var a=[],b=this.world.bodies.length;b--;)a.push(this.world.bodies[b].parent);return a},getBody:function(a){return a instanceof p2.Body?a:a instanceof c.Physics.P2.Body?a.data:a.body&&a.body.type===c.Physics.P2JS?a.body.data:null},getSprings:function(){for(var a=[],b=this.world.springs.length;b--;)a.push(this.world.springs[b].parent);return a},getConstraints:function(){for(var a=[],b=this.world.constraints.length;b--;)a.push(this.world.constraints[b]);return a},hitTest:function(a,b,d,e){void 0===b&&(b=this.world.bodies),void 0===d&&(d=5),void 0===e&&(e=!1);for(var f=[this.pxmi(a.x),this.pxmi(a.y)],g=[],h=b.length;h--;)b[h]instanceof c.Physics.P2.Body&&(!e||b[h].data.type!==p2.Body.STATIC)?g.push(b[h].data):b[h]instanceof p2.Body&&b[h].parent&&(!e||b[h].typ
},c.Physics.P2.Spring.prototype.constructor=c.Physics.P2.Spring,c.Physics.P2.RotationalSpring=function(a,b,c,d,e,f){this.game=a.game,this.world=a,void 0===d&&(d=null),void 0===e&&(e=100),void 0===f&&(f=1),d&&(d=a.pxm(d));var g={restAngle:d,stiffness:e,damping:f};this.data=new p2.RotationalSpring(b,c,g),this.data.parent=this},c.Physics.P2.Spring.prototype.constructor=c.Physics.P2.Spring,c.Physics.P2.Material=function(a){this.name=a,p2.Material.call(this)},c.Physics.P2.Material.prototype=Object.create(p2.Material.prototype),c.Physics.P2.Material.prototype.constructor=c.Physics.P2.Material,c.Physics.P2.ContactMaterial=function(a,b,c){p2.ContactMaterial.call(this,a,b,c)},c.Physics.P2.ContactMaterial.prototype=Object.create(p2.ContactMaterial.prototype),c.Physics.P2.ContactMaterial.prototype.constructor=c.Physics.P2.ContactMaterial,c.Physics.P2.CollisionGroup=function(a){this.mask=a},c.Physics.P2.DistanceConstraint=function(a,b,c,d,e,f,g){void 0===d&&(d=100),void 0===e&&(e=[0,0]),void 0===f&&(f=[0,0]),void 0===g&&(g=Number.MAX_VALUE),this.game=a.game,this.world=a,d=a.pxm(d),e=[a.pxmi(e[0]),a.pxmi(e[1])],f=[a.pxmi(f[0]),a.pxmi(f[1])];var h={distance:d,localAnchorA:e,localAnchorB:f,maxForce:g};p2.DistanceConstraint.call(this,b,c,h)},c.Physics.P2.DistanceConstraint.prototype=Object.create(p2.DistanceConstraint.prototype),c.Physics.P2.DistanceConstraint.prototype.constructor=c.Physics.P2.DistanceConstraint,c.Physics.P2.GearConstraint=function(a,b,c,d,e){void 0===d&&(d=0),void 0===e&&(e=1),this.game=a.game,this.world=a;var f={angle:d,ratio:e};p2.GearConstraint.call(this,b,c,f)},c.Physics.P2.GearConstraint.prototype=Object.create(p2.GearConstraint.prototype),c.Physics.P2.GearConstraint.prototype.constructor=c.Physics.P2.GearConstraint,c.Physics.P2.LockConstraint=function(a,b,c,d,e,f){void 0===d&&(d=[0,0]),void 0===e&&(e=0),void 0===f&&(f=Number.MAX_VALUE),this.game=a.game,this.world=a,d=[a.pxm(d[0]),a.pxm(d[1])];var g={localOffsetB:d,localAngleB:e,maxForce:f};p2.LockConstraint.call(this,b,c,g)},c.Physics.P2.LockConstraint.prototype=Object.create(p2.LockConstraint.prototype),c.Physics.P2.LockConstraint.prototype.constructor=c.Physics.P2.LockConstraint,c.Physics.P2.PrismaticConstraint=function(a,b,c,d,e,f,g,h){void 0===d&&(d=!0),void 0===e&&(e=[0,0]),void 0===f&&(f=[0,0]),void 0===g&&(g=[0,0]),void 0===h&&(h=Number.MAX_VALUE),this.game=a.game,this.world=a,e=[a.pxmi(e[0]),a.pxmi(e[1])],f=[a.pxmi(f[0]),a.pxmi(f[1])];var i={localAnchorA:e,localAnchorB:f,localAxisA:g,maxForce:h,disableRotationalLock:!d};p2.PrismaticConstraint.call(this,b,c,i)},c.Physics.P2.PrismaticConstraint.prototype=Object.create(p2.PrismaticConstraint.prototype),c.Physics.P2.PrismaticConstraint.prototype.constructor=c.Physics.P2.PrismaticConstraint,c.Physics.P2.RevoluteConstraint=function(a,b,c,d,e,f,g){void 0===f&&(f=Number.MAX_VALUE),void 0===g&&(g=null),this.game=a.game,this.world=a,c=[a.pxmi(c[0]),a.pxmi(c[1])],e=[a.pxmi(e[0]),a.pxmi(e[1])],g&&(g=[a.pxmi(g[0]),a.pxmi(g[1])]);var h={worldPivot:g,localPivotA:c,localPivotB:e,maxForce:f};p2.RevoluteConstraint.call(this,b,d,h)},c.Physics.P2.RevoluteConstraint.prototype=Object.create(p2.RevoluteConstraint.prototype),c.Physics.P2.RevoluteConstraint.prototype.constructor=c.Physics.P2.RevoluteConstraint,c.ImageCollection=function(a,b,c,d,e,f,g){(void 0===c||c<=0)&&(c=32),(void 0===d||d<=0)&&(d=32),void 0===e&&(e=0),void 0===f&&(f=0),this.name=a,this.firstgid=0|b,this.imageWidth=0|c,this.imageHeight=0|d,this.imageMargin=0|e,this.imageSpacing=0|f,this.properties=g||{},this.images=[],this.total=0},c.ImageCollection.prototype={containsImageIndex:function(a){return a>=this.firstgid&&a<this.firstgid+this.total},addImage:function(a,b){this.images.push({gid:a,image:b}),this.total++}},c.ImageCollection.prototype.constructor=c.ImageCollection,c.Tile=function(a,b,c,d,e,f){this.layer=a,this.index=b,this.x=c,this.y=d,this.rotation=0,this.flipped=!1,this.worldX=c*e,this.worldY=d*f,this.width=e,this.height=f,this.centerX=Math.abs(e/2),this.centerY=Math.abs(f/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBo
},parseCSV:function(a,b,d,e){var f=this.getEmptyData();b=b.trim();for(var g=[],h=b.split("\n"),i=h.length,j=0,k=0;k<h.length;k++){g[k]=[];for(var l=h[k].split(","),m=0;m<l.length;m++)g[k][m]=new c.Tile(f.layers[0],parseInt(l[m],10),m,k,d,e);0===j&&(j=l.length)}return f.format=c.Tilemap.CSV,f.name=a,f.width=j,f.height=i,f.tileWidth=d,f.tileHeight=e,f.widthInPixels=j*d,f.heightInPixels=i*e,f.layers[0].width=j,f.layers[0].height=i,f.layers[0].widthInPixels=f.widthInPixels,f.layers[0].heightInPixels=f.heightInPixels,f.layers[0].data=g,f},getEmptyData:function(a,b,c,d){return{width:void 0!==c&&null!==c?c:0,height:void 0!==d&&null!==d?d:0,tileWidth:void 0!==a&&null!==a?a:0,tileHeight:void 0!==b&&null!==b?b:0,orientation:"orthogonal",version:"1",properties:{},widthInPixels:0,heightInPixels:0,layers:[{name:"layer",x:0,y:0,width:0,height:0,widthInPixels:0,heightInPixels:0,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:[]}],images:[],objects:{},collision:{},tilesets:[],tiles:[]}},parseTiledJSON:function(a){function b(a,b){var c={};for(var d in b){var e=b[d];"undefined"!=typeof a[e]&&(c[e]=a[e])}return c}if("orthogonal"!==a.orientation)return console.warn("TilemapParser.parseTiledJSON - Only orthogonal map types are supported in this version of Phaser"),null;for(var d={width:a.width,height:a.height,tileWidth:a.tilewidth,tileHeight:a.tileheight,orientation:a.orientation,format:c.Tilemap.TILED_JSON,version:a.version,properties:a.properties,widthInPixels:a.width*a.tilewidth,heightInPixels:a.height*a.tileheight},e=[],f=0;f<a.layers.length;f++)if("tilelayer"===a.layers[f].type){var g=a.layers[f];if(!g.compression&&g.encoding&&"base64"===g.encoding){for(var h=window.atob(g.data),i=h.length,j=new Array(i),k=0;k<i;k+=4)j[k/4]=(h.charCodeAt(k)|h.charCodeAt(k+1)<<8|h.charCodeAt(k+2)<<16|h.charCodeAt(k+3)<<24)>>>0;g.data=j,delete g.encoding}else if(g.compression){console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+g.name+"'");continue}var l={name:g.name,x:g.x,y:g.y,width:g.width,height:g.height,widthInPixels:g.width*a.tilewidth,heightInPixels:g.height*a.tileheight,alpha:g.opacity,visible:g.visible,properties:{},indexes:[],callbacks:[],bodies:[]};g.properties&&(l.properties=g.properties);for(var m,n,o,p,q=0,r=[],s=[],t=0,i=g.data.length;t<i;t++){if(m=0,n=!1,p=g.data[t],o=0,p>536870912)switch(p>2147483648&&(p-=2147483648,o+=4),p>1073741824&&(p-=1073741824,o+=2),p>536870912&&(p-=536870912,o+=1),o){case 5:m=Math.PI/2;break;case 6:m=Math.PI;break;case 3:m=3*Math.PI/2;break;case 4:m=0,n=!0;break;case 7:m=Math.PI/2,n=!0;break;case 2:m=Math.PI,n=!0;break;case 1:m=3*Math.PI/2,n=!0}if(p>0){var u=new c.Tile(l,p,q,s.length,a.tilewidth,a.tileheight);u.rotation=m,u.flipped=n,0!==o&&(u.flippedVal=o),r.push(u)}else c.TilemapParser.INSERT_NULL?r.push(null):r.push(new c.Tile(l,(-1),q,s.length,a.tilewidth,a.tileheight));q++,q===g.width&&(s.push(r),q=0,r=[])}l.data=s,e.push(l)}d.layers=e;for(var v=[],f=0;f<a.layers.length;f++)if("imagelayer"===a.layers[f].type){var w=a.layers[f],x={name:w.name,image:w.image,x:w.x,y:w.y,alpha:w.opacity,visible:w.visible,properties:{}};w.properties&&(x.properties=w.properties),v.push(x)}d.images=v;for(var y=[],z=[],A=null,f=0;f<a.tilesets.length;f++){var B=a.tilesets[f];if(B.image){var C=new c.Tileset(B.name,B.firstgid,B.tilewidth,B.tileheight,B.margin,B.spacing,B.properties);B.tileproperties&&(C.tileProperties=B.tileproperties),C.updateTileData(B.imagewidth,B.imageheight),y.push(C)}else{var D=new c.ImageCollection(B.name,B.firstgid,B.tilewidth,B.tileheight,B.margin,B.spacing,B.properties);for(var E in B.tiles){var x=B.tiles[E].image,p=B.firstgid+parseInt(E,10);D.addImage(p,x)}z.push(D)}A&&(A.lastgid=B.firstgid-1),A=B}d.tilesets=y,d.imagecollections=z;for(var F={},G={},f=0;f<a.layers.length;f++)if("objectgroup"===a.layers[f].type){var H=a.layers[f];F[H.name]=[],G[H.name]=[];for(var I=0,i=H.objects.length;I<i;I++)if(H.objects[I].gid){var J={gid:H.objects[I].gid,name:H.objects[I].name,type:H.objects[I].hasOwnProperty("type")?H.objects[I].type:"",x:H.objects[I].x,
},c.Creature.prototype.updateData=function(){var a=this.manager.target_creature,b=a.render_pts,c=a.global_uvs;this.updateRenderData(b,c),this.updateCreatureBounds(),this.dirty=!0},c.Creature.prototype.updateRenderData=function(a,b){for(var c=this.manager.target_creature,d=0,e=0,f=0,g=0;g<c.total_num_pts;g++)this.vertices[f]=a[d],this.vertices[f+1]=-a[d+1],this.uvs[e]=b[e],this.uvs[e+1]=b[e+1],d+=3,e+=2,f+=2},c.Creature.prototype.setAnimation=function(a){this.manager.SetActiveAnimationName(a,!0)},c.Creature.prototype.play=function(a){void 0===a&&(a=!1),this.loop=a,this.manager.SetIsPlaying(!0),this.manager.RunAtTime(0)},c.Creature.prototype.stop=function(){this.manager.SetIsPlaying(!1)},Object.defineProperty(c.Creature.prototype,"isPlaying",{get:function(){return this.manager.GetIsPlaying()},set:function(a){this.manager.SetIsPlaying(a)}}),Object.defineProperty(c.Creature.prototype,"loop",{get:function(){return this.manager.should_loop},set:function(a){this.manager.SetShouldLoop(a)}}),c.Video=function(a,b,d){if(void 0===b&&(b=null),void 0===d&&(d=null),this.game=a,this.key=b,this.width=0,this.height=0,this.type=c.VIDEO,this.disableTextureUpload=!1,this.touchLocked=!1,this.onPlay=new c.Signal,this.onChangeSource=new c.Signal,this.onComplete=new c.Signal,this.onAccess=new c.Signal,this.onError=new c.Signal,this.onTimeout=new c.Signal,this.timeout=15e3,this._timeOutID=null,this.video=null,this.videoStream=null,this.isStreaming=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._codeMuted=!1,this._muted=!1,this._codePaused=!1,this._paused=!1,this._pending=!1,this._autoplay=!1,this._endCallback=null,this._playCallback=null,b&&this.game.cache.checkVideoKey(b)){var e=this.game.cache.getVideo(b);e.isBlob?this.createVideoFromBlob(e.data):this.video=e.data,this.width=this.video.videoWidth,this.height=this.video.videoHeight}else d&&this.createVideoFromURL(d,!1);this.video&&!d?(this.baseTexture=new PIXI.BaseTexture(this.video),this.baseTexture.forceLoaded(this.width,this.height)):(this.baseTexture=new PIXI.BaseTexture(c.Cache.DEFAULT.baseTexture.source),this.baseTexture.forceLoaded(this.width,this.height)),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new c.Frame(0,0,0,this.width,this.height,"video"),this.texture.setFrame(this.textureFrame),this.texture.valid=!1,null!==b&&this.video&&(this.texture.valid=this.video.canplay),this.snapshot=null,c.BitmapData&&(this.snapshot=new c.BitmapData(this.game,"",this.width,this.height)),!this.game.device.cocoonJS&&(this.game.device.iOS||this.game.device.android)||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock?this.setTouchLock():e&&(e.locked=!1)},c.Video.prototype={connectToMediaStream:function(a,b){return a&&b&&(this.video=a,this.videoStream=b,this.isStreaming=!0,this.baseTexture.source=this.video,this.updateTexture(null,this.video.videoWidth,this.video.videoHeight),this.onAccess.dispatch(this)),this},startMediaStream:function(a,b,c){if(void 0===a&&(a=!1),void 0===b&&(b=null),void 0===c&&(c=null),!this.game.device.getUserMedia)return this.onError.dispatch(this,"No getUserMedia"),!1;null!==this.videoStream&&(this.videoStream.active?this.videoStream.active=!1:this.videoStream.stop()),this.removeVideoElement(),this.video=document.createElement("video"),this.video.setAttribute("autoplay","autoplay"),null!==b&&(this.video.width=b),null!==c&&(this.video.height=c),this._timeOutID=window.setTimeout(this.getUserMediaTimeout.bind(this),this.timeout);try{navigator.getUserMedia({audio:a,video:!0},this.getUserMediaSuccess.bind(this),this.getUserMediaError.bind(this))}catch(a){this.getUserMediaError(a)}return this},getUserMediaTimeout:function(){clearTimeout(this._timeOutID),this.onTimeout.dispatch(this)},getUserMediaError:function(a){clearTimeout(this._timeOutID),this.onError.dispatch(this,a)},getUserMediaSuccess:function(a){clearTimeout(this._timeOutID),this.videoStream=a,void 0!==this.video.mozSrcObject?this.video.mozSrcObject=a:this.video.src=window.URL&&window.URL.createObjectURL(a)||a;var b=this;this.video.onloadeddata=function(){function a()
//# sourceMappingURL=phaser-creature.map