(function(t,e,i){function n(i,r){var s=e[i];if(!s){var a=t[i];if(!a)return;var o={};s=e[i]={exports:o},a[0]((function(t){return n(a[1][t]||t)}),s,o)}return s.exports}for(var r=0;r=0;i--)e.push(cc.v2(t[i].x,t[i].y));return e}function a(t){for(var e=[],i=0;i=this._duration},_cloneDecoration:function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},_reverseEaseList:function(t){if(this._easeList){t._easeList=[];for(var e=0;e1.192092896e-7?this._duration:1.192092896e-7);e=1>e?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},startWithTarget:function(t){cc.Action.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},reverse:function(){return cc.logID(1010),null},setAmplitudeRate:function(t){cc.logID(1011)},getAmplitudeRate:function(){return cc.logID(1012),0},speed:function(t){return t<=0?(cc.logID(1013),this):(this._speedMethod=!0,this._speed*=t,this)},getSpeed:function(){return this._speed},setSpeed:function(t){return this._speed=t,this},repeat:function(t){return t=Math.round(t),isNaN(t)||t<1?(cc.logID(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},repeatForever:function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this}}),cc.actionInterval=function(t){return new cc.ActionInterval(t)},cc.Sequence=cc.Class({name:"cc.Sequence",extends:cc.ActionInterval,ctor:function(t){this._actions=[],this._split=null,this._last=0,this._reversed=!1;var e=t instanceof Array?t:arguments;if(1!==e.length){var i=e.length-1;if(i>=0&&null==e[i]&&cc.logID(1015),i>=0){for(var n,r=e[0],s=1;s1?e%1:e),this._last=n)},reverse:function(){var t=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t}}),cc.sequence=function(t){var e=t instanceof Array?t:arguments;if(1===e.length)return cc.errorID(1019),null;var i=e.length-1;i>=0&&null==e[i]&&cc.logID(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=cc.Sequence._actionOneTwo(n,e[r]))}return n},cc.Sequence._actionOneTwo=function(t,e){var i=new cc.Sequence;return i.initWithTwoActions(t,e),i},cc.Repeat=cc.Class({name:"cc.Repeat",extends:cc.ActionInterval,ctor:function(t,e){this._times=0,this._total=0,this._nextDt=0,this._actionInstant=!1,this._innerAction=null,void 0!==e&&this.initWithAction(t,e)},initWithAction:function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof cc.ActionInstant&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},clone:function(){var t=new cc.Repeat;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},startWithTarget:function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,cc.ActionInterval.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},stop:function(){this._innerAction.stop(),cc.Action.prototype.stop.call(this)},update:function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==e[i]&&cc.logID(1015),i>=0){for(var n,r=e[0],s=1;sr?this._two=cc.Sequence._actionOneTwo(e,cc.delayTime(n-r)):n0&&null==e[e.length-1]&&cc.logID(1015);for(var i=e[0],n=1;n180&&(i-=360),i<-180&&(i+=360),this._startAngle=e,this._angle=cc.RotateTo._reverse?i:-i},reverse:function(){cc.logID(1016)},update:function(t){t=this._computeEaseTime(t),this.target&&(this.target.angle=this._startAngle+this._angle*t)}}),cc.rotateTo=function(t,e){return new cc.RotateTo(t,e)},cc.RotateBy=cc.Class({name:"cc.RotateBy",extends:cc.ActionInterval,statics:{_reverse:!1},ctor:function(t,e){e*=cc.RotateBy._reverse?1:-1,this._deltaAngle=0,this._startAngle=0,void 0!==e&&this.initWithDuration(t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._deltaAngle=e,!0)},clone:function(){var t=new cc.RotateBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._deltaAngle),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._startAngle=t.angle},update:function(t){t=this._computeEaseTime(t),this.target&&(this.target.angle=this._startAngle+this._deltaAngle*t)},reverse:function(){var t=new cc.RotateBy;return t.initWithDuration(this._duration,-this._deltaAngle),this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.rotateBy=function(t,e){return new cc.RotateBy(t,e)},cc.MoveBy=cc.Class({name:"cc.MoveBy",extends:cc.ActionInterval,ctor:function(t,e,i){this._positionDelta=cc.v2(0,0),this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),void 0!==e&&cc.MoveBy.prototype.initWithDuration.call(this,t,e,i)},initWithDuration:function(t,e,i){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(void 0!==e.x&&(i=e.y,e=e.x),this._positionDelta.x=e,this._positionDelta.y=i,!0)},clone:function(){var t=new cc.MoveBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._positionDelta),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.x,i=t.y;this._previousPosition.x=e,this._previousPosition.y=i,this._startPosition.x=e,this._startPosition.y=i},update:function(t){if(t=this._computeEaseTime(t),this.target){var e=this._positionDelta.x*t,i=this._positionDelta.y*t,n=this._startPosition;if(cc.macro.ENABLE_STACKABLE_ACTIONS){var r=this.target.x,s=this.target.y,a=this._previousPosition;n.x=n.x+r-a.x,n.y=n.y+s-a.y,e+=n.x,i+=n.y,a.x=e,a.y=i,this.target.setPosition(e,i)}else this.target.setPosition(n.x+e,n.y+i)}},reverse:function(){var t=new cc.MoveBy(this._duration,cc.v2(-this._positionDelta.x,-this._positionDelta.y));return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.moveBy=function(t,e,i){return new cc.MoveBy(t,e,i)},cc.MoveTo=cc.Class({name:"cc.MoveTo",extends:cc.MoveBy,ctor:function(t,e,i){this._endPosition=cc.v2(0,0),void 0!==e&&this.initWithDuration(t,e,i)},initWithDuration:function(t,e,i){return!!cc.MoveBy.prototype.initWithDuration.call(this,t,e,i)&&(void 0!==e.x&&(i=e.y,e=e.x),this._endPosition.x=e,this._endPosition.y=i,!0)},clone:function(){var t=new cc.MoveTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endPosition),t},startWithTarget:function(t){cc.MoveBy.prototype.startWithTarget.call(this,t),this._positionDelta.x=this._endPosition.x-t.x,this._positionDelta.y=this._endPosition.y-t.y}}),cc.moveTo=function(t,e,i){return new cc.MoveTo(t,e,i)},cc.SkewTo=cc.Class({name:"cc.SkewTo",extends:cc.ActionInterval,ctor:function(t,e,i){this._skewX=0,this._skewY=0,this._startSkewX=0,this._startSkewY=0,this._endSkewX=0,this._endSkewY=0,this._deltaX=0,this._deltaY=0,void 0!==i&&cc.SkewTo.prototype.initWithDuration.call(this,t,e,i)},initWithDuration:function(t,e,i){var n=!1;return cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._endSkewX=e,this._endSkewY=i,n=!0),n},clone:function(){var t=new cc.SkewTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endSkewX,this._endSkewY),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._startSkewX=t.skewX%180,this._deltaX=this._endSkewX-this._startSkewX,this._deltaX>180&&(this._deltaX-=360),this._deltaX<-180&&(this._deltaX+=360),this._startSkewY=t.skewY%360,this._deltaY=this._endSkewY-this._startSkewY,this._deltaY>180&&(this._deltaY-=360),this._deltaY<-180&&(this._deltaY+=360)},update:function(t){t=this._computeEaseTime(t),this.target.skewX=this._startSkewX+this._deltaX*t,this.target.skewY=this._startSkewY+this._deltaY*t}}),cc.skewTo=function(t,e,i){return new cc.SkewTo(t,e,i)},cc.SkewBy=cc.Class({name:"cc.SkewBy",extends:cc.SkewTo,ctor:function(t,e,i){void 0!==i&&this.initWithDuration(t,e,i)},initWithDuration:function(t,e,i){var n=!1;return cc.SkewTo.prototype.initWithDuration.call(this,t,e,i)&&(this._skewX=e,this._skewY=i,n=!0),n},clone:function(){var t=new cc.SkewBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._skewX,this._skewY),t},startWithTarget:function(t){cc.SkewTo.prototype.startWithTarget.call(this,t),this._deltaX=this._skewX,this._deltaY=this._skewY,this._endSkewX=this._startSkewX+this._deltaX,this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var t=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.skewBy=function(t,e,i){return new cc.SkewBy(t,e,i)},cc.JumpBy=cc.Class({name:"cc.JumpBy",extends:cc.ActionInterval,ctor:function(t,e,i,n,r){this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),this._delta=cc.v2(0,0),this._height=0,this._jumps=0,void 0!==n&&cc.JumpBy.prototype.initWithDuration.call(this,t,e,i,n,r)},initWithDuration:function(t,e,i,n,r){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(void 0===r&&(r=n,n=i,i=e.y,e=e.x),this._delta.x=e,this._delta.y=i,this._height=n,this._jumps=r,!0)},clone:function(){var t=new cc.JumpBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._delta,this._height,this._jumps),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.x,i=t.y;this._previousPosition.x=e,this._previousPosition.y=i,this._startPosition.x=e,this._startPosition.y=i},update:function(t){if(t=this._computeEaseTime(t),this.target){var e=t*this._jumps%1,i=4*this._height*e*(1-e);i+=this._delta.y*t;var n=this._delta.x*t,r=this._startPosition;if(cc.macro.ENABLE_STACKABLE_ACTIONS){var s=this.target.x,a=this.target.y,o=this._previousPosition;r.x=r.x+s-o.x,r.y=r.y+a-o.y,n+=r.x,i+=r.y,o.x=n,o.y=i,this.target.setPosition(n,i)}else this.target.setPosition(r.x+n,r.y+i)}},reverse:function(){var t=new cc.JumpBy(this._duration,cc.v2(-this._delta.x,-this._delta.y),this._height,this._jumps);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.jumpBy=function(t,e,i,n,r){return new cc.JumpBy(t,e,i,n,r)},cc.JumpTo=cc.Class({name:"cc.JumpTo",extends:cc.JumpBy,ctor:function(t,e,i,n,r){this._endPosition=cc.v2(0,0),void 0!==n&&this.initWithDuration(t,e,i,n,r)},initWithDuration:function(t,e,i,n,r){return!!cc.JumpBy.prototype.initWithDuration.call(this,t,e,i,n,r)&&(void 0===r&&(i=e.y,e=e.x),this._endPosition.x=e,this._endPosition.y=i,!0)},startWithTarget:function(t){cc.JumpBy.prototype.startWithTarget.call(this,t),this._delta.x=this._endPosition.x-this._startPosition.x,this._delta.y=this._endPosition.y-this._startPosition.y},clone:function(){var t=new cc.JumpTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endPosition,this._height,this._jumps),t}}),cc.jumpTo=function(t,e,i,n,r){return new cc.JumpTo(t,e,i,n,r)},cc.BezierBy=cc.Class({name:"cc.BezierBy",extends:cc.ActionInterval,ctor:function(t,e){this._config=[],this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),e&&cc.BezierBy.prototype.initWithDuration.call(this,t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._config=e,!0)},clone:function(){var t=new cc.BezierBy;this._cloneDecoration(t);for(var e=[],i=0;ie/2?255:0}},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._originalState=t.opacity},stop:function(){this.target.opacity=this._originalState,cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var t=new cc.Blink(this._duration,this._times);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.blink=function(t,e){return new cc.Blink(t,e)},cc.FadeTo=cc.Class({name:"cc.FadeTo",extends:cc.ActionInterval,ctor:function(t,e){this._toOpacity=0,this._fromOpacity=0,void 0!==e&&cc.FadeTo.prototype.initWithDuration.call(this,t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._toOpacity=e,!0)},clone:function(){var t=new cc.FadeTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t},update:function(t){t=this._computeEaseTime(t);var e=void 0!==this._fromOpacity?this._fromOpacity:255;this.target.opacity=e+(this._toOpacity-e)*t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._fromOpacity=t.opacity}}),cc.fadeTo=function(t,e){return new cc.FadeTo(t,e)},cc.FadeIn=cc.Class({name:"cc.FadeIn",extends:cc.FadeTo,ctor:function(t){null==t&&(t=0),this._reverseAction=null,this.initWithDuration(t,255)},reverse:function(){var t=new cc.FadeOut;return t.initWithDuration(this._duration,0),this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.FadeIn;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t},startWithTarget:function(t){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity),cc.FadeTo.prototype.startWithTarget.call(this,t)}}),cc.fadeIn=function(t){return new cc.FadeIn(t)},cc.FadeOut=cc.Class({name:"cc.FadeOut",extends:cc.FadeTo,ctor:function(t){null==t&&(t=0),this._reverseAction=null,this.initWithDuration(t,0)},reverse:function(){var t=new cc.FadeIn;return t._reverseAction=this,t.initWithDuration(this._duration,255),this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.FadeOut;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t}}),cc.fadeOut=function(t){return new cc.FadeOut(t)},cc.TintTo=cc.Class({name:"cc.TintTo",extends:cc.ActionInterval,ctor:function(t,e,i,n){this._to=cc.color(0,0,0),this._from=cc.color(0,0,0),e instanceof cc.Color&&(n=e.b,i=e.g,e=e.r),void 0!==n&&this.initWithDuration(t,e,i,n)},initWithDuration:function(t,e,i,n){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._to=cc.color(e,i,n),!0)},clone:function(){var t=new cc.TintTo;this._cloneDecoration(t);var e=this._to;return t.initWithDuration(this._duration,e.r,e.g,e.b),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._from=this.target.color},update:function(t){t=this._computeEaseTime(t);var e=this._from,i=this._to;e&&(this.target.color=cc.color(e.r+(i.r-e.r)*t,e.g+(i.g-e.g)*t,e.b+(i.b-e.b)*t))}}),cc.tintTo=function(t,e,i,n){return new cc.TintTo(t,e,i,n)},cc.TintBy=cc.Class({name:"cc.TintBy",extends:cc.ActionInterval,ctor:function(t,e,i,n){this._deltaR=0,this._deltaG=0,this._deltaB=0,this._fromR=0,this._fromG=0,this._fromB=0,void 0!==n&&this.initWithDuration(t,e,i,n)},initWithDuration:function(t,e,i,n){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._deltaR=e,this._deltaG=i,this._deltaB=n,!0)},clone:function(){var t=new cc.TintBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.color;this._fromR=e.r,this._fromG=e.g,this._fromB=e.b},update:function(t){t=this._computeEaseTime(t),this.target.color=cc.color(this._fromR+this._deltaR*t,this._fromG+this._deltaG*t,this._fromB+this._deltaB*t)},reverse:function(){var t=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.tintBy=function(t,e,i,n){return new cc.TintBy(t,e,i,n)},cc.DelayTime=cc.Class({name:"cc.DelayTime",extends:cc.ActionInterval,update:function(t){},reverse:function(){var t=new cc.DelayTime(this._duration);return this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.DelayTime;return this._cloneDecoration(t),t.initWithDuration(this._duration),t}}),cc.delayTime=function(t){return new cc.DelayTime(t)},cc.ReverseTime=cc.Class({name:"cc.ReverseTime",extends:cc.ActionInterval,ctor:function(t){this._other=null,t&&this.initWithAction(t)},initWithAction:function(t){return t?t===this._other?(cc.errorID(1029),!1):!!cc.ActionInterval.prototype.initWithDuration.call(this,t._duration)&&(this._other=t,!0):(cc.errorID(1028),!1)},clone:function(){var t=new cc.ReverseTime;return this._cloneDecoration(t),t.initWithAction(this._other.clone()),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._other.startWithTarget(t)},update:function(t){t=this._computeEaseTime(t),this._other&&this._other.update(1-t)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop(),cc.Action.prototype.stop.call(this)}}),cc.reverseTime=function(t){return new cc.ReverseTime(t)},cc.TargetedAction=cc.Class({name:"cc.TargetedAction",extends:cc.ActionInterval,ctor:function(t,e){this._action=null,this._forcedTarget=null,e&&this.initWithTarget(t,e)},initWithTarget:function(t,e){return!!this.initWithDuration(e._duration)&&(this._forcedTarget=t,this._action=e,!0)},clone:function(){var t=new cc.TargetedAction;return this._cloneDecoration(t),t.initWithTarget(this._forcedTarget,this._action.clone()),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._action.startWithTarget(this._forcedTarget)},stop:function(){this._action.stop()},update:function(t){t=this._computeEaseTime(t),this._action.update(t)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(t){this._forcedTarget!==t&&(this._forcedTarget=t)}}),cc.targetedAction=function(t,e){return new cc.TargetedAction(t,e)}}),{}],6:[(function(t,e,i){"use strict";t("../core/platform/CCClass");var n=t("../core/platform/js"),r=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1};cc.ActionManager=function(){this._hashTargets=n.createMap(!0),this._arrayTargets=[],this._currentTarget=null,cc.director._scheduler&&cc.director._scheduler.enableForTarget(this)},cc.ActionManager.prototype={constructor:cc.ActionManager,_elementPool:[],_searchElementByTarget:function(t,e){for(var i=0;i=n&&i.actionIndex--;break}}else cc.logID(1001)}},_removeActionByTag:function(t,e,i){for(var n=0,r=e.actions.length;n=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},_deleteHashElement:function(t){var e=!1;if(t&&!t.lock&&this._hashTargets[t.target._id]){delete this._hashTargets[t.target._id];for(var i=this._arrayTargets,n=0,r=i.length;n=1?t:r%n>n/2?255:0},this.to(t,{opacity:1},i)}});var l=[];function h(t){return function(){l.length=0;for(var e=arguments.length,i=0;i=0?d=s.events[p]:(d=new o,s.ratios.push(f),s.events.push(d)),d.add(_.func,_.params)}}u.playState=function(t,e){t.clip&&(t.curveLoaded||_(this.target,t),t.animator=this,t.play(),"number"==typeof e&&t.setTime(e),this.play())},u.stopStatesExcept=function(t){var e=this._anims,i=e.array;for(e.i=0;e.i=0?(this._anims.fastRemoveAt(e),0===this._anims.array.length&&this.stop()):cc.errorID(3907),t.animator=null},u.sample=function(){var t=this._anims,e=t.array;for(t.i=0;t.i1e-6){g=!1;break}h._findFrameIndex=g?a:l;var b=h.values[0];return void 0===b||null===b||h._lerp||("number"==typeof b?h._lerp=s.prototype._lerpNumber:b instanceof cc.Quat?h._lerp=s.prototype._lerpQuat:b instanceof cc.Vec2||b instanceof cc.Vec3?h._lerp=s.prototype._lerpVector:b.lerp&&(h._lerp=s.prototype._lerpObject)),h},createTargetCurves:function(t,e,i){var n=e.props,r=e.comps;if(n)for(var s in n){var a=n[s],o=this.createPropCurve(t,s,a);i.push(o)}if(r)for(var l in r){var h=t.getComponent(l);if(h){var c=r[l];for(var u in c){var _=c[u],f=this.createPropCurve(h,u,_);i.push(f)}}}},createCurves:function(t,e){var i=this.curveData,n=i.paths,r=[];for(var s in this.createTargetCurves(e,i,r),n){var a=cc.find(s,e);if(a){var o=n[s];this.createTargetCurves(a,o,r)}}return r}});cc.AnimationClip=e.exports=h}),{"../core/utils/binary-search":286,"./animation-curves":11,"./motion-path-helper":17,"./types":19}],11:[(function(t,e,i){"use strict";var n=t("./bezier").bezierByTime,r=t("../core/utils/binary-search").binarySearchEpsilon,s=t("./types").WrapModeMask,a=t("./types").WrappedInfo;function o(t,e){if("string"==typeof e){var i=cc.easing[e];i?t=i(t):cc.errorID(3906,e)}else Array.isArray(e)&&(t=n(e,t));return t}var l=cc.Class({name:"cc.AnimCurve",sample:function(t,e,i){},onTimeChangedManually:void 0});function h(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return~t.length;var s=(e=(e-n)/(r-n))/(1/i),a=0|s;return s-a<1e-6?a:a+1-s<1e-6?a+1:~(a+1)}var c=cc.Class({name:"cc.DynamicAnimCurve",extends:l,ctor:function(){this._cachedIndex=0},properties:{target:null,prop:"",values:[],ratios:[],types:[]},_findFrameIndex:r,_lerp:void 0,_lerpNumber:function(t,e,i){return t+(e-t)*i},_lerpObject:function(t,e,i){return t.lerp(e,i)},_lerpQuat:(function(){var t=cc.quat();return function(e,i,n){return e.lerp(i,n,t)}})(),_lerpVector:(function(){var t=cc.v3();return function(e,i,n){return e.lerp(i,n,t)}})(),sample:function(t,e,i){var n=this.values,r=this.ratios,s=r.length;if(0!==s){var a,l=!0,h=this._cachedIndex;if(h<0&&(h=~h)>0&&hc&&e=s)a=n[s-1];else{var f=n[_-1];if(this._lerp){var d=r[_-1],p=r[_],m=this.types[_-1],y=(e-d)/(p-d);m&&(y=o(y,m));var v=n[_];a=this._lerp(f,v,y)}else a=f}else a=n[_];this.target[this.prop]=a}}});c.Linear=null,c.Bezier=function(t){return t};var u=function(){this.events=[]};u.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})};var _=cc.Class({name:"cc.EventAnimCurve",extends:l,properties:{target:null,ratios:[],events:[],_wrappedInfo:{default:function(){return new a}},_lastWrappedInfo:null,_ignoreIndex:NaN},_wrapIterations:function(t){return t-(0|t)==0&&(t-=1),0|t},sample:function(t,e,i){var n=this.ratios.length,o=i.getWrappedInfo(i.time,this._wrappedInfo),l=o.direction,h=r(this.ratios,o.ratio);if(h<0&&(h=~h-1,l<0&&(h+=1)),this._ignoreIndex!==h&&(this._ignoreIndex=NaN),o.frameIndex=h,!this._lastWrappedInfo)return this._fireEvent(h),void(this._lastWrappedInfo=new a(o));var c=i.wrapMode,u=this._wrapIterations(o.iterations),_=this._lastWrappedInfo,f=this._wrapIterations(_.iterations),d=_.frameIndex,p=_.direction,m=-1!==f&&u!==f;if(d===h&&m&&1===n)this._fireEvent(0);else if(d!==h||m){l=p;do{if(d!==h){if(-1===l&&0===d&&h>0?((c&s.PingPong)===s.PingPong?l*=-1:d=n,f++):1===l&&d===n-1&&hu)break}d+=l,cc.director.getAnimationManager().pushDelayEvent(this,"_fireEvent",[d])}while(d!==h&&d>-1&&d=this.events.length||this._ignoreIndex===t)){var e=this.events[t].events;if(this.target.isValid)for(var i=this.target._components,n=0;n=0?this._anims.fastRemoveAt(e):cc.errorID(3907)},pushDelayEvent:function(t,e,i){this._delayEvents.push({target:t,func:e,args:i})}});cc.AnimationManager=e.exports=r}),{}],13:[(function(t,e,i){"use strict";var n=cc.js,r=t("./playable"),s=t("./types"),a=s.WrappedInfo,o=s.WrapMode,l=s.WrapModeMask;function h(t,e){r.call(this),this._currentFramePlayed=!1,this._delay=0,this._delayTime=0,this._wrappedInfo=new a,this._lastWrappedInfo=null,this._process=u,this._clip=t,this._name=e||t&&t.name,this.animator=null,this.curves=[],this.delay=0,this.repeatCount=1,this.duration=1,this.speed=1,this.wrapMode=o.Normal,this.time=0,this._target=null,this._lastframeEventOn=!1,this.emit=function(){for(var t=new Array(arguments.length),e=0,i=t.length;e1&&(0|e.iterations)>(0|t.iterations)&&this.emit("lastframe",this),t.set(e));e.stopped&&(this.stop(),this.emit("finished",this))}function _(){var t=this.time,e=this.duration;t>e?0===(t%=e)&&(t=e):t<0&&0!==(t%=e)&&(t+=e);for(var i=t/e,n=this.curves,r=0,s=n.length;r0&&this._lastIterations>i||this.time<0&&this._lastIterations0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this.speed:this._currentFramePlayed=!0,this._process())},c._needRevers=function(t){var e=this.wrapMode,i=!1;(e&l.PingPong)===l.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i));return(e&l.Reverse)===l.Reverse&&(i=!i),i},c.getWrappedInfo=function(t,e){e=e||new a;var i=!1,n=this.duration,r=this.repeatCount,s=t>0?t/n:-t/n;if(s>=r){s=r,i=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!==(t%=n)&&(t+=n);var c=!1,u=this._wrapMode&l.ShouldWrap;u&&(c=this._needRevers(s));var _=c?-1:1;return this.speed<0&&(_*=-1),u&&c&&(t=n-t),e.ratio=t/n,e.time=t,e.direction=_,e.stopped=i,e.iterations=s,e},c.sample=function(){for(var t=this.getWrappedInfo(this.time,this._wrappedInfo),e=this.curves,i=0,n=e.length;i0}),(function(){this.curves.length=0})),n.getset(c,"wrapMode",(function(){return this._wrapMode}),(function(t){this._wrapMode=t,this.time=0,t&l.Loop?this.repeatCount=1/0:this.repeatCount=1})),n.getset(c,"repeatCount",(function(){return this._repeatCount}),(function(t){this._repeatCount=t;var e=this._wrapMode&l.ShouldWrap,i=(this.wrapMode&l.Reverse)===l.Reverse;this._process=t!==1/0||e||i?u:_})),n.getset(c,"delay",(function(){return this._delay}),(function(t){this._delayTime=this._delay=t})),cc.AnimationState=e.exports=h}),{"./playable":18,"./types":19}],14:[(function(t,e,i){"use strict";function n(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}var r=Math.cos,s=Math.acos,a=Math.max,o=2*Math.PI,l=Math.sqrt;function h(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function c(t,e){var i,n,c,u,_=e-0,f=e-t[0],d=3*_,p=3*f,m=3*(e-t[2]),y=1/(-_+p-m+(e-1)),v=(d-6*f+m)*y,g=v*(1/3),A=(-d+p)*y,x=1/3*(3*A-v*v),b=x*(1/3),C=(2*v*v*v-9*v*A+27*(_*y))/27,T=C/2,S=T*T+b*b*b;if(S<0){var w=1/3*-x,E=l(w*w*w),M=-C/(2*E),D=s(M<-1?-1:M>1?1:M),B=2*h(E);return n=B*r(D*(1/3))-g,c=B*r((D+o)*(1/3))-g,u=B*r((D+2*o)*(1/3))-g,0<=n&&n<=1?0<=c&&c<=1?0<=u&&u<=1?a(n,c,u):a(n,c):0<=u&&u<=1?a(n,u):n:0<=c&&c<=1?0<=u&&u<=1?a(c,u):c:u}if(0===S)return c=-(i=T<0?h(-T):-h(T))-g,0<=(n=2*i-g)&&n<=1?0<=c&&c<=1?a(n,c):n:c;var I=l(S);return n=(i=h(-T+I))-h(T+I)-g}function u(t,e){var i=c(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}e.exports={bezier:n,bezierByTime:u}}),{}],15:[(function(t,e,i){"use strict";var n={constant:function(){return 0},linear:function(t){return t},quadIn:function(t){return t*t},quadOut:function(t){return t*(2-t)},quadInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quartIn:function(t){return t*t*t*t},quartOut:function(t){return 1- --t*t*t*t},quartInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quintIn:function(t){return t*t*t*t*t},quintOut:function(t){return--t*t*t*t*t+1},quintInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sineIn:function(t){return 1-Math.cos(t*Math.PI/2)},sineOut:function(t){return Math.sin(t*Math.PI/2)},sineInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},expoIn:function(t){return 0===t?0:Math.pow(1024,t-1)},expoOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},expoInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circIn:function(t){return 1-Math.sqrt(1-t*t)},circOut:function(t){return Math.sqrt(1- --t*t)},circInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-n.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*n.bounceIn(2*t):.5*n.bounceOut(2*t-1)+.5},smooth:function(t){return t<=0?0:t>=1?1:t*t*(3-2*t)},fade:function(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}};function r(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}n.quadOutIn=r(n.quadIn,n.quadOut),n.cubicOutIn=r(n.cubicIn,n.cubicOut),n.quartOutIn=r(n.quartIn,n.quartOut),n.quintOutIn=r(n.quintIn,n.quintOut),n.sineOutIn=r(n.sineIn,n.sineOut),n.expoOutIn=r(n.expoIn,n.expoOut),n.circOutIn=r(n.circIn,n.circOut),n.backOutIn=r(n.backIn,n.backOut),n.bounceIn=function(t){return 1-n.bounceOut(1-t)},n.bounceInOut=function(t){return t<.5?.5*n.bounceIn(2*t):.5*n.bounceOut(2*t-1)+.5},n.bounceOutIn=r(n.bounceIn,n.bounceOut),cc.easing=e.exports=n}),{}],16:[(function(t,e,i){"use strict";t("./bezier"),t("./easing"),t("./types"),t("./motion-path-helper"),t("./animation-curves"),t("./animation-clip"),t("./animation-manager"),t("./animation-state"),t("./animation-animator")}),{"./animation-animator":9,"./animation-clip":10,"./animation-curves":11,"./animation-manager":12,"./animation-state":13,"./bezier":14,"./easing":15,"./motion-path-helper":17,"./types":19}],17:[(function(t,e,i){"use strict";var n=t("./animation-curves").DynamicAnimCurve,r=t("./animation-curves").computeRatioByType,s=t("./bezier").bezier,a=t("../core/utils/binary-search").binarySearchEpsilon,o=cc.v2;function l(t){this.points=t||[],this.beziers=[],this.ratios=[],this.progresses=[],this.length=0,this.computeBeziers()}function h(){this.start=o(),this.end=o(),this.startCtrlPoint=o(),this.endCtrlPoint=o()}function c(t){if(!Array.isArray(t))return!1;for(var e=0,i=t.length;e0){f=!0;break}}if(f&&1!==_.length){for(var m=e.types,y=e.ratios,v=e.values=[],g=e.types=[],A=e.ratios=[],x=0,b=n.Linear,C=0,T=t.length;C0){var L=[];L.push(u(D));for(var F=0,V=w.length;F1e-6;){var z,U,H,W;if((S=r(S=R,I))<0)W=(0-S)*(U=k.beziers[0]).getLength(),H=U.start.sub(U.endCtrlPoint).normalize(),z=U.start.add(H.mul(W));else if(S>1)W=(S-1)*(U=k.beziers[k.beziers.length-1]).getLength(),H=U.end.sub(U.startCtrlPoint).normalize(),z=U.end.add(H.mul(W));else{var j=a(G,S);j<0&&(j=~j),S-=j>0?G[j-1]:0,S/=k.ratios[j],z=k.beziers[j].getPointAt(S)}P.push(z),R+=O}}else for(;1-R>1e-6;)S=r(S=R,I),P.push(D.lerp(B,S)),R+=O;b="constant"===I?I:n.Linear;for(F=0,V=P.length;F1e-6?(R-1)*M:0}y[y.length-1]!==A[A.length-1]&&Y(_[_.length-1],b,y[y.length-1])}}function Y(t,e,i){v.push(t),g.push(e),A.push(i)}}l.prototype.computeBeziers=function(){var t;this.beziers.length=0,this.ratios.length=0,this.progresses.length=0,this.length=0;for(var e=1;e0)){l=r;break}l=r-1}if(n[r=l]===i)return r/(s-1);var h=n[r];return(r+(i-h)/(n[r+1]-h))/(s-1)},e.exports={sampleMotionPaths:u,Curve:l,Bezier:h}}),{"../core/utils/binary-search":286,"./animation-curves":11,"./bezier":14}],18:[(function(t,e,i){"use strict";var n=cc.js,r=t("../core/CCDebug");function s(){this._isPlaying=!1,this._isPaused=!1,this._stepOnce=!1}var a=s.prototype;n.get(a,"isPlaying",(function(){return this._isPlaying}),!0),n.get(a,"isPaused",(function(){return this._isPaused}),!0);var o=function(){};a.onPlay=o,a.onPause=o,a.onResume=o,a.onStop=o,a.onError=o,a.play=function(){this._isPlaying?this._isPaused?(this._isPaused=!1,this.onResume()):this.onError(r.getError(3912)):(this._isPlaying=!0,this.onPlay())},a.stop=function(){this._isPlaying&&(this._isPlaying=!1,this.onStop(),this._isPaused=!1)},a.pause=function(){this._isPlaying&&!this._isPaused&&(this._isPaused=!0,this.onPause())},a.resume=function(){this._isPlaying&&this._isPaused&&(this._isPaused=!1,this.onResume())},a.step=function(){this.pause(),this._stepOnce=!0,this._isPlaying||this.play()},e.exports=s}),{"../core/CCDebug":48}],19:[(function(t,e,i){"use strict";var n={Loop:2,ShouldWrap:4,PingPong:22,Reverse:36},r=cc.Enum({Default:0,Normal:1,Reverse:n.Reverse,Loop:n.Loop,LoopReverse:n.Loop|n.Reverse,PingPong:n.PingPong,PingPongReverse:n.PingPong|n.Reverse});function s(t){t?this.set(t):(this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0)}cc.WrapMode=r,s.prototype.set=function(t){this.ratio=t.ratio,this.time=t.time,this.direction=t.direction,this.stopped=t.stopped,this.iterations=t.iterations,this.frameIndex=t.frameIndex},e.exports={WrapModeMask:n,WrapMode:r,WrappedInfo:s}}),{}],20:[(function(t,e,i){"use strict";var n,r=t("../core/event/event-target"),s=t("../core/platform/CCSys"),a=t("../core/assets/CCAudioClip").LoadMode,o=!1,l=[],h=function t(e){r.call(this),this._shouldRecycleOnEnded=!1,this._src=e,this._element=null,this.id=0,this._volume=1,this._loop=!1,this._nextTime=0,this._state=t.State.INITIALZING,this._onended=function(){this._state=t.State.STOPPED,this.emit("ended")}.bind(this)};cc.js.extend(h,r),h.State={ERROR:-1,INITIALZING:0,PLAYING:1,PAUSED:2,STOPPED:3},(function(t){t._bindEnded=function(t){t=t||this._onended;var e=this._element;this._src&&e instanceof HTMLAudioElement?e.addEventListener("ended",t):e.onended=t},t._unbindEnded=function(){var t=this._element;t instanceof HTMLAudioElement?t.removeEventListener("ended",this._onended):t&&(t.onended=null)},t._onLoaded=function(){this._createElement(),this.setVolume(this._volume),this.setLoop(this._loop),0!==this._nextTime&&this.setCurrentTime(this._nextTime),this.getState(!1)===h.State.PLAYING?this.play():this._state=h.State.INITIALZING},t._createElement=function(){var t=this._src._nativeAsset;t instanceof HTMLAudioElement?(this._element||(this._element=document.createElement("audio")),this._element.src=t.src):this._element=new c(t,this)},t.play=function(){this._state=h.State.PLAYING,this._element&&(this._bindEnded(),this._element.play(),this._touchToPlay())},t._touchToPlay=function(){if(this._src&&this._src.loadMode===a.DOM_AUDIO&&this._element.paused&&l.push({instance:this,offset:0,audio:this._element}),!o){o=!0;var t="ontouchend"in window?"touchend":"mousedown";cc.game.canvas.addEventListener(t,(function(){for(var t;t=l.pop();)t.audio.play(t.offset)}))}},t.destroy=function(){this._element=null},t.pause=function(){this._element&&this.getState()===h.State.PLAYING&&(this._unbindEnded(),this._element.pause(),this._state=h.State.PAUSED)},t.resume=function(){this._element&&this.getState()===h.State.PAUSED&&(this._bindEnded(),this._element.play(),this._state=h.State.PLAYING)},t.stop=function(){if(this._element){this._element.pause();try{this._element.currentTime=0}catch(t){}for(var t=0;tthis._buffer.duration)},enumerable:!0,configurable:!0}),Object.defineProperty(t,"loop",{get:function(){return this._loop},set:function(t){return this._currentSource&&(this._currentSource.loop=t),this._loop=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"volume",{get:function(){return this._volume},set:function(t){if(this._volume=t,this._gainObj.gain.setTargetAtTime)try{this._gainObj.gain.setTargetAtTime(t,this._context.currentTime,n)}catch(e){this._gainObj.gain.setTargetAtTime(t,this._context.currentTime,.01)}else this._gainObj.gain.value=t;s.os===s.OS_IOS&&!this.paused&&this._currentSource&&(this._currentSource.onended=null,this.pause(),this.play())},enumerable:!0,configurable:!0}),Object.defineProperty(t,"currentTime",{get:function(){return this.paused?this.playedLength:(this.playedLength=this._context.currentTime-this._startTime,this.playedLength%=this._buffer.duration,this.playedLength)},set:function(t){return this.paused?this.playedLength=t:(this.pause(),this.playedLength=t,this.play()),t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"duration",{get:function(){return this._buffer.duration},enumerable:!0,configurable:!0})})(c.prototype),e.exports=cc.Audio=h}),{"../core/assets/CCAudioClip":56,"../core/event/event-target":135,"../core/platform/CCSys":218}],21:[(function(t,e,i){"use strict";var n=t("./CCAudio"),r=t("../core/assets/CCAudioClip"),s=cc.js,a=0,o=s.createMap(!0),l={},h=[],c=function(t){t._shouldRecycleOnEnded&&(t._finishCallback=null,t.off("ended"),t.off("stop"),t.src=null,h.includes(t)||(h.length<32?h.push(t):t.destroy()),t._shouldRecycleOnEnded=!1)},u=function(t){var e=a++,i=l[t];if(i||(i=l[t]=[]),d._maxAudioInstance<=i.length){var r=i.shift();_(r).stop()}var s=h.pop()||new n,u=function(){if(_(this.id)){delete o[this.id];var t=i.indexOf(this.id);cc.js.array.fastRemoveAt(i,t)}c(this)};return s.on("ended",(function(){this._finishCallback&&this._finishCallback(),u.call(this)}),s),s.on("stop",u,s),s.id=e,o[e]=s,i.push(e),s},_=function(t){return o[t]},f=function(t){return void 0===t?t=1:"string"==typeof t&&(t=Number.parseFloat(t)),t},d={AudioState:n.State,_maxWebAudioSize:2097152,_maxAudioInstance:24,_id2audio:o,play:function(t,e,i){var n,s=t;if("string"==typeof t)cc.warnID(8401,"cc.audioEngine","cc.AudioClip","AudioClip","cc.AudioClip","audio"),n=u(s=t),r._loadByUrl(s,(function(t,e){e&&(n.src=e)}));else{if(!t)return;s=t.nativeUrl,(n=u(s)).src=t}return n._shouldRecycleOnEnded=!0,n.setLoop(e||!1),i=f(i),n.setVolume(i),n.play(),n.id},setLoop:function(t,e){var i=_(t);i&&i.setLoop&&i.setLoop(e)},isLoop:function(t){var e=_(t);return!(!e||!e.getLoop)&&e.getLoop()},setVolume:function(t,e){var i=_(t);i&&i.setVolume(e)},getVolume:function(t){var e=_(t);return e?e.getVolume():1},setCurrentTime:function(t,e){var i=_(t);return!!i&&(i.setCurrentTime(e),!0)},getCurrentTime:function(t){var e=_(t);return e?e.getCurrentTime():0},getDuration:function(t){var e=_(t);return e?e.getDuration():0},getState:function(t){var e=_(t);return e?e.getState():this.AudioState.ERROR},setFinishCallback:function(t,e){var i=_(t);i&&(i._finishCallback=e)},pause:function(t){var e=_(t);return!!e&&(e.pause(),!0)},_pauseIDCache:[],pauseAll:function(){for(var t in o){var e=o[t];e.getState()===n.State.PLAYING&&(this._pauseIDCache.push(t),e.pause())}},resume:function(t){var e=_(t);e&&e.resume()},resumeAll:function(){for(var t=0;t0;){var n=i.pop(),r=o[n];r&&(r.stop(),delete o[n])}},uncacheAll:function(){var t;for(var e in this.stopAll(),o)(t=o[e])&&t.destroy();for(;t=h.pop();)t.destroy();o=s.createMap(!0),l={}},getProfile:function(t){},preload:function(t,e){cc.loader.load(t,e&&function(t){t||e()})},setMaxWebAudioSize:function(t){this._maxWebAudioSize=1024*t},_breakCache:null,_break:function(){for(var t in this._breakCache=[],o){var e=o[t];e.getState()===n.State.PLAYING&&(this._breakCache.push(t),e.pause())}},_restore:function(){if(this._breakCache){for(;this._breakCache.length>0;){var t=this._breakCache.pop(),e=_(t);e&&e.resume&&e.resume()}this._breakCache=null}},_music:{id:-1,loop:!1,volume:1},_effect:{volume:1,pauseCache:[]},playMusic:function(t,e){var i=this._music;return this.stop(i.id),i.id=this.play(t,e,i.volume),i.loop=e,i.id},stopMusic:function(){this.stop(this._music.id)},pauseMusic:function(){return this.pause(this._music.id),this._music.id},resumeMusic:function(){return this.resume(this._music.id),this._music.id},getMusicVolume:function(){return this._music.volume},setMusicVolume:function(t){t=f(t);var e=this._music;return e.volume=t,this.setVolume(e.id,e.volume),e.volume},isMusicPlaying:function(){return this.getState(this._music.id)===this.AudioState.PLAYING},playEffect:function(t,e){return this.play(t,e||!1,this._effect.volume)},setEffectsVolume:function(t){t=f(t);var e=this._music.id;for(var i in this._effect.volume=t,o){var n=o[i];n&&n.id!==e&&d.setVolume(i,t)}},getEffectsVolume:function(){return this._effect.volume},pauseEffect:function(t){return this.pause(t)},pauseAllEffects:function(){var t=this._music.id,e=this._effect;for(var i in e.pauseCache.length=0,o){var n=o[i];if(n&&n.id!==t)n.getState()===this.AudioState.PLAYING&&(e.pauseCache.push(i),n.pause())}},resumeEffect:function(t){this.resume(t)},resumeAllEffects:function(){for(var t=this._effect.pauseCache,e=0;e=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},n.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},cc.codec=e.exports=n}),{"./base64":23,"./gzip":24}],23:[(function(t,e,i){"use strict";var n=t("../core/utils/misc").BASE64_VALUES,r={name:"Jacob__Codec__Base64",decode:function(t){var e,i,r,s,a,o,l=[],h=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4,i=(15&s)<<4|(a=n[t.charCodeAt(h++)])>>2,r=(3&a)<<6|(o=n[t.charCodeAt(h++)]),l.push(String.fromCharCode(e)),64!==a&&l.push(String.fromCharCode(i)),64!==o&&l.push(String.fromCharCode(r));return l=l.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}};e.exports=r}),{"../core/utils/misc":294}],24:[(function(t,e,i){"use strict";var n=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(n.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};n.gunzip=function(t){return t.constructor===Array||(t.constructor,String),new n(t).gunzip()[0][0]},n.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},n.LITERALS=288,n.NAMEMAX=256,n.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],n.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],n.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],n.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],n.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],n.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],n.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},n.prototype.readByte=function(){return this.bits+=8,this.bytepos>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},n.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=n.bitReverse[e]>>8-t),e},n.prototype.flushBuffer=function(){this.bIdx=0},n.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},n.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},n.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},n.prototype.CreateTree=function(t,e,i,n){var r;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,r=0;r<17;r++)this.fpos[r]=0;return this.len=0,this.Rec()?-1:0},n.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(o=o<<1|this.readBit())>199?o=(o-=128)<<1|this.readBit():(o-=48)>143&&(o+=136):o+=256,o<256)this.addBuffer(o);else{if(256===o)break;for(o-=257,p=this.readBits(n.cplext[o])+n.cplens[o],o=n.bitReverse[this.readBits(5)]>>3,n.cpdext[o]>8?(m=this.readBits(8),m|=this.readBits(n.cpdext[o]-8)<<8):m=this.readBits(n.cpdext[o]),m+=n.cpdist[o],o=0;ol)return this.flushBuffer(),1;for(f=i?_[i-1]:0;o--;)_[i++]=f}else{if(i+(o=17===o?3+this.readBits(3):11+this.readBits(7))>l)return this.flushBuffer(),1;for(;o--;)_[i++]=0}for(p=this.literalTree.length,i=0;i=256){var p,m;if(0===(o-=256))break;for(o--,p=this.readBits(n.cplext[o])+n.cplens[o],o=this.DecodeValue(this.distanceTree),n.cpdext[o]>8?(m=this.readBits(8),m|=this.readBits(n.cpdext[o]-8)<<8):m=this.readBits(n.cpdext[o]),m+=n.cpdist[o];p--;){a=this.buf32k[this.bIdx-m&32767];this.addBuffer(a)}}else this.addBuffer(o)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},n.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e>>0;t=n}for(var r,s=1,a=0,o=t.length,l=0;0>>0}function o(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}o.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t>>8&255]<<16|f[t>>>16&255]<<8|f[t>>>24&255])>>32-e:f[t]>>8-e),8>e+a)o=o<>e-n-1&1,8==++a&&(a=0,r[s++]=f[o],o=0,s===r.length&&(r=this.f()));r[s]=o,this.buffer=r,this.i=a,this.index=s},o.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0l;++l){for(var c=_=l,u=7,_=_>>>1;_;_>>>=1)c<<=1,c|=1&_,--u;h[l]=(c<>>0}var f=h;function d(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,a,o,l,h,c,u=t.length,_=0,f=Number.POSITIVE_INFINITY;for(h=0;h_&&(_=t[h]),t[h]>=1;for(c=o;cs[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},d.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var y,v=2,g={NONE:0,r:1,j:v,N:3},A=[];for(y=0;288>y;y++)switch(i){case 143>=y:A.push([y+48,8]);break;case 255>=y:A.push([y-144+400,9]);break;case 279>=y:A.push([y-256+0,7]);break;case 287>=y:A.push([y-280+192,8]);break;default:t("invalid literal: "+y)}function x(t,e){this.length=t,this.G=e}function b(){var e=C;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}m.prototype.n=function(){var n,r,a,l,h=this.input;switch(this.h){case 0:for(a=0,l=h.length;a>>8&255,y[g++]=255&_,y[g++]=_>>>8&255,s)y.set(f,g),g+=f.length,y=y.subarray(0,g);else{for(p=0,m=f.length;pJ)for(;0J?J:138)>J-3&&Q=Q?(it[K++]=17,it[K++]=Q-3,nt[17]++):(it[K++]=18,it[K++]=Q-11,nt[18]++),J-=Q;else if(it[K++]=et[Y],nt[et[Y]]++,3>--J)for(;0J?J:6)>J-3&&QU;U++)X[U]=N[j[U]];for(R=19;4=C;C++)T=b(),S[C]=T[2]<<24|T[1]<<16|T[0];var w=s?new Uint32Array(S):S;function E(n,r){function a(e,n){var r,s,a,o,l=e.G,h=[],c=0;switch(r=w[e.length],h[c++]=65535&r,h[c++]=r>>16&255,h[c++]=r>>24,i){case 1===l:s=[0,l-1,0];break;case 2===l:s=[1,l-2,0];break;case 3===l:s=[2,l-3,0];break;case 4===l:s=[3,l-4,0];break;case 6>=l:s=[4,l-5,1];break;case 8>=l:s=[5,l-7,1];break;case 12>=l:s=[6,l-9,2];break;case 16>=l:s=[7,l-13,2];break;case 24>=l:s=[8,l-17,3];break;case 32>=l:s=[9,l-25,3];break;case 48>=l:s=[10,l-33,4];break;case 64>=l:s=[11,l-49,4];break;case 96>=l:s=[12,l-65,5];break;case 128>=l:s=[13,l-97,5];break;case 192>=l:s=[14,l-129,6];break;case 256>=l:s=[15,l-193,6];break;case 384>=l:s=[16,l-257,7];break;case 512>=l:s=[17,l-385,7];break;case 768>=l:s=[18,l-513,8];break;case 1024>=l:s=[19,l-769,8];break;case 1536>=l:s=[20,l-1025,9];break;case 2048>=l:s=[21,l-1537,9];break;case 3072>=l:s=[22,l-2049,10];break;case 4096>=l:s=[23,l-3073,10];break;case 6144>=l:s=[24,l-4097,11];break;case 8192>=l:s=[25,l-6145,11];break;case 12288>=l:s=[26,l-8193,12];break;case 16384>=l:s=[27,l-12289,12];break;case 24576>=l:s=[28,l-16385,13];break;case 32768>=l:s=[29,l-24577,13];break;default:t("invalid distance")}for(r=s,h[c++]=r[0],h[c++]=r[1],h[c++]=r[2],a=0,o=h.length;a=h;)A[h++]=0;for(h=0;29>=h;)b[h++]=0}for(A[256]=1,o=0,l=r.length;o=l){for(d&&a(d,-1),h=0,c=l-o;hM&&o+ME&&(S=T,E=M),258===M)break}f=new x(E,o-S),d?d.length2*g[f-1]+A[f]&&(g[f]=2*g[f-1]+A[f]),b[f]=Array(g[f]),C[f]=Array(g[f]);for(_=0;_r[_]?(b[f][p]=m,C[f][p]=v,y+=2):(b[f][p]=r[_],C[f][p]=_,++_);T[f]=0,1===A[f]&&i(f)}for(a=x,o=0,l=n.length;o1<c&&t("undercommitted"),i=0,n=e.length;i>>=1;return o}function B(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=I.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new m(this.input,n)}var I=g;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=O,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case R:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case O:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}B.prototype.n=function(){var e,i,n,r,o,l,h,c=0;switch(h=this.a,e=ct){case ct:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,h[c++]=n,e){case ct:switch(this.h){case I.NONE:o=0;break;case I.r:o=1;break;case I.j:o=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=o<<6|0,h[c++]=r|31-(256*n+r)%31,l=a(this.input),this.z.b=c,c=(h=this.z.n()).length,s&&((h=new Uint8Array(h.buffer)).length<=c+4&&(this.a=new Uint8Array(h.length+4),this.a.set(h),h=this.a),h=h.subarray(0,c+4)),h[c++]=l>>24&255,h[c++]=l>>16&255,h[c++]=l>>8&255,h[c++]=255&l,h},r("Zlib.Deflate",B),r("Zlib.Deflate.compress",(function(t,e){return new B(t,e).n()})),r("Zlib.Deflate.CompressionType",I),r("Zlib.Deflate.CompressionType.NONE",I.NONE),r("Zlib.Deflate.CompressionType.FIXED",I.r),r("Zlib.Deflate.CompressionType.DYNAMIC",I.j);var R=0,O=1,L={D:R,C:O};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,a=this.c,o=this.a,l=this.b,h=e,c=e,u=e,_=o.length,f=e;switch(this.e=this.g=0,(h=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),c=h,(h=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),c|=h<<8,(h=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),u=h,(h=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),c===~(u|=h<<8)&&t(Error("invalid uncompressed block header: length verify")),a+c>r.length&&t(Error("input buffer is broken")),this.m){case R:for(;l+c>o.length;){if(c-=f=_-l,s)o.set(r.subarray(a,a+f),l),l+=f,a+=f;else for(;f--;)o[l++]=r[a++];this.b=l,o=this.f(),l=this.b}break;case O:for(;l+c>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)o.set(r.subarray(a,a+c),l),l+=c,a+=c;else for(;c--;)o[l++]=r[a++];this.c=a,this.b=l,this.a=o;break;case 1:this.o(K,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var F,V,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=s?new Uint16Array(N):N,G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],z=s?new Uint16Array(G):G,U=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],H=s?new Uint8Array(U):U,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],j=s?new Uint16Array(W):W,X=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Y=s?new Uint8Array(X):X,q=new(s?Uint8Array:Array)(288);for(F=0,V=q.length;F=F?8:255>=F?9:279>=F?7:8;var J,Z,K=p(q),Q=new(s?Uint8Array:Array)(30);for(J=0,Z=Q.length;J>>n,i.e=a-n,i.c=l,r}function et(i,n){for(var r,s,a,o=i.g,l=i.e,h=i.input,c=i.c,u=n[0],_=n[1];l<_;)(r=h[c++])===e&&t(Error("input buffer is broken")),o|=r<>>16,i.g=o>>a,i.e=l-a,i.c=c,65535&s}function it(t){function e(t,e,i){var n,r,s,a;for(a=0;ar)n>=l&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(o=z[s=r-257],0=l&&(this.b=n,i=this.f(),n=this.b);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,a,o,l=i.length;256!==(r=et(this,t));)if(256>r)n>=l&&(l=(i=this.f()).length),i[n++]=r;else for(o=z[s=r-257],0l&&(l=(i=this.f()).length);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;tt;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,a=this.input,o=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),2>r?i=(n=(a.length-this.c)/this.u[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&((i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==a(e)&&t(Error("invalid adler-32 checksum"))),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",L),L.ADAPTIVE=L.C,L.BLOCK=L.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);s&&new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);s&&new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]);s&&new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]);s&&new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]);s&&new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);var rt,st,at=new(s?Uint8Array:Array)(288);for(rt=0,st=at.length;rt=rt?8:255>=rt?9:279>=rt?7:8;p(at);var ot,lt,ht=new(s?Uint8Array:Array)(30);for(ot=0,lt=ht.length;ot0&&f++,e>0&&f++);var d=(h+1)*(c+1);u&&(d+=(h+1)*f+h*f);var p=h*c*2*3;u&&(p+=h*f*3);var m=new Array(p),y=new Array(3*d),v=new Array(3*d),g=new Array(2*d),A=Math.max(t,e),x=new n.default(-A,-l,-A),b=new n.default(A,l,A),C=Math.sqrt(A*A+l*l),T=0,S=0;(function(){for(var r=[],s=t-e,u=s*s/i*Math.sign(s),f=0;f<=c;f++){for(var d=[],p=f/c,A=p*s+e,x=0;x<=h;++x){var b=x/h,C=b*_,w=Math.sin(C),E=Math.cos(C);y[3*T]=A*w,y[3*T+1]=p*i-l,y[3*T+2]=A*E,n.default.normalize(a,n.default.set(o,w,-u,E)),v[3*T]=a.x,v[3*T+1]=a.y,v[3*T+2]=a.z,g[2*T]=2*(1-b)%1,g[2*T+1]=p,d.push(T),++T}r.push(d)}for(var M=0;M0&&w(!1),t>0&&w(!0));return new r.default(y,v,g,m,x,b,C);function w(i){var n,r,s=i?t:e,a=i?1:-1;n=T;for(var o=1;o<=h;++o)y[3*T]=0,y[3*T+1]=l*a,y[3*T+2]=0,v[3*T]=0,v[3*T+1]=a,v[3*T+2]=0,g[2*T]=.5,g[2*T+1]=.5,++T;r=T;for(var c=0;c<=h;++c){var u=c/h,f=u*_,d=Math.cos(f),p=Math.sin(f);y[3*T]=s*p,y[3*T+1]=l*a,y[3*T+2]=s*d,v[3*T]=0,v[3*T+1]=a,v[3*T+2]=0,g[2*T]=.5-.5*p*a,g[2*T+1]=.5+.5*d,++T}for(var A=0;A=o.length)?0:t||0;for(var a=i.sizeX||e,l=i.sizeY||e,h=i.sizeZ||e,c=o[t],u=c.face.length,_=[],f=[],d=[],p=[],m=new s.Vec3(1/0,1/0,1/0),y=new s.Vec3(-1/0,-1/0,-1/0),v=0;vo?o<<16|a:a<<16|o;void 0===n[l]&&(n[l]=0,i.push(a,o))}return i},i.invWinding=function(t){for(var e=[],i=0;io){var y=d[p-1],v=(o-y.frame)/(m.frame-y.frame);y.value.lerp(m.value,v,i[f]);break}}h=cc.mat4(),n.default.fromRTS(h,i.quat,i.position,i.scale),l&&n.default.mul(h,l,h),_._jointMatrix||(_._jointMatrix=[]),i.uniqueBindPose&&(u=cc.mat4(),n.default.mul(u,h,i.uniqueBindPose)),r[i.path]||(r[i.path]=[]),u?r[i.path].push(a(u)):r[i.path].push(h)}var g=i.children;for(var A in g){s(g[A],o,h)}}for(var o=0,l=this.duration,h=1/this.sample;o256?64:t>64?32:t>16?16:8,this._jointsData=this._jointsFloat32Data=new Float32Array(i*i*4);var r=cc.Texture2D.PixelFormat.RGBA32F,s=i,a=i;n||(this._jointsData=new Uint8Array(this._jointsFloat32Data.buffer),r=cc.Texture2D.PixelFormat.RGBA8888,s*=4,this._usingRGBA8Texture=!0,cc.warn("SkinnedMeshRenderer ["+this.node.name+"] has too many joints ["+t+"] and device do not support float32 texture, fallback to use RGBA8888 texture, which is much slower."));var o=this._jointsTexture||new cc.Texture2D,l=cc.Texture2D.Filter.NEAREST;o.setFilters(l,l),o.initWithData(this._jointsData,r,s,a),this._jointsTexture=o,this._jointsTextureOptions={format:r,width:o.width,height:o.height,images:[]}}this._updateMaterial()}},_updateMaterial:function(){s.prototype._updateMaterial.call(this);for(var t=this.getMaterials(),e=0;eu.ERROR){var e=function(t){if(cc.game.canvas){if(!n){var e=document.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",cc.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(n=document.createElement("textarea")).setAttribute("rows","20"),n.setAttribute("cols","30"),n.setAttribute("disabled","true");var r=n.style;r.backgroundColor="transparent",r.borderBottom="1px solid #cccccc",r.borderTopWidth=r.borderLeftWidth=r.borderRightWidth="0px",r.borderTopStyle=r.borderLeftStyle=r.borderRightStyle="none",r.padding="0px",r.margin=0,e.appendChild(n),cc.game.canvas.parentNode.appendChild(e)}n.value=n.value+t+"\r\n",n.scrollTop=n.scrollHeight}};cc.error=function(){e("ERROR : "+cc.js.formatStr.apply(null,arguments))},cc.assert=function(t,i){!t&&i&&(i=cc.js.formatStr.apply(null,cc.js.shiftArguments.apply(null,arguments)),e("ASSERT: "+i))},t!==u.ERROR_FOR_WEB_PAGE&&(cc.warn=function(){e("WARN : "+cc.js.formatStr.apply(null,arguments))}),t===u.INFO_FOR_WEB_PAGE&&(cc.log=function(){e(cc.js.formatStr.apply(null,arguments))})}else console&&console.log.apply&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),console.error.bind?cc.error=console.error.bind(console):cc.error=function(){return console.error.apply(console,arguments)},cc.assert=function(t,e){if(!t)throw e&&(e=cc.js.formatStr.apply(null,cc.js.shiftArguments.apply(null,arguments))),new Error(e)});t!==u.ERROR&&(console.warn.bind?cc.warn=console.warn.bind(console):cc.warn=function(){return console.warn.apply(console,arguments)}),t===u.INFO&&(console.log.bind?cc.log=console.log.bind(console):cc.log=function(){return console.log.apply(console,arguments)})}},getError:a("ERROR"),isDisplayStats:function(){return!!cc.profiler&&cc.profiler.isShowingStats()},setDisplayStats:function(t){cc.profiler&&cc.game.renderType!==cc.game.RENDER_TYPE_CANVAS&&(t?cc.profiler.showStats():cc.profiler.hideStats(),cc.game.config.showFPS=!!t)}}}),{"../../DebugInfos":void 0,"./platform/utils":233}],49:[(function(t,e,i){"use strict";var n=t("./event/event-target"),r=t("./load-pipeline/auto-release-utils"),s=t("./component-scheduler"),a=t("./node-activator"),o=t("./platform/CCObject"),l=t("./CCGame"),h=t("./renderer"),c=t("./event-manager"),u=t("./CCScheduler");cc.Director=function(){n.call(this),this._paused=!1,this._purgeDirectorInNextLoop=!1,this._winSizeInPoints=null,this._loadingScene="",this._scene=null,this._totalFrames=0,this._lastUpdate=0,this._deltaTime=0,this._startTime=0,this._maxParticleDeltaTime=0,this._scheduler=null,this._compScheduler=null,this._nodeActivator=null,this._actionManager=null;var t=this;l.on(l.EVENT_SHOW,(function(){t._lastUpdate=performance.now()})),l.once(l.EVENT_ENGINE_INITED,this.init,this)},cc.Director.prototype={constructor:cc.Director,init:function(){return this._totalFrames=0,this._lastUpdate=performance.now(),this._startTime=this._lastUpdate,this._paused=!1,this._purgeDirectorInNextLoop=!1,this._winSizeInPoints=cc.size(0,0),this._scheduler=new u,cc.ActionManager?(this._actionManager=new cc.ActionManager,this._scheduler.scheduleUpdate(this._actionManager,u.PRIORITY_SYSTEM,!1)):this._actionManager=null,this.sharedInit(),!0},sharedInit:function(){this._compScheduler=new s,this._nodeActivator=new a,c&&c.setEnabled(!0),cc.AnimationManager?(this._animationManager=new cc.AnimationManager,this._scheduler.scheduleUpdate(this._animationManager,u.PRIORITY_SYSTEM,!1)):this._animationManager=null,cc.CollisionManager?(this._collisionManager=new cc.CollisionManager,this._scheduler.scheduleUpdate(this._collisionManager,u.PRIORITY_SYSTEM,!1)):this._collisionManager=null,cc.PhysicsManager?(this._physicsManager=new cc.PhysicsManager,this._scheduler.scheduleUpdate(this._physicsManager,u.PRIORITY_SYSTEM,!1)):this._physicsManager=null,cc.Physics3DManager?(this._physics3DManager=new cc.Physics3DManager,this._scheduler.scheduleUpdate(this._physics3DManager,u.PRIORITY_SYSTEM,!1)):this._physics3DManager=null,cc._widgetManager&&cc._widgetManager.init(this),cc.loader.init(this)},calculateDeltaTime:function(t){t||(t=performance.now()),this._deltaTime=t>this._lastUpdate?(t-this._lastUpdate)/1e3:0,this._lastUpdate=t},convertToGL:function(t){var e=l.container,i=cc.view,n=e.getBoundingClientRect(),r=n.left+window.pageXOffset-e.clientLeft,s=n.top+window.pageYOffset-e.clientTop,a=i._devicePixelRatio*(t.x-r),o=i._devicePixelRatio*(s+n.height-t.y);return i._isRotated?cc.v2(i._viewportRect.width-o,a):cc.v2(a,o)},convertToUI:function(t){var e=l.container,i=cc.view,n=e.getBoundingClientRect(),r=n.left+window.pageXOffset-e.clientLeft,s=n.top+window.pageYOffset-e.clientTop,a=cc.v2(0,0);return i._isRotated?(a.x=r+t.y/i._devicePixelRatio,a.y=s+n.height-(i._viewportRect.width-t.x)/i._devicePixelRatio):(a.x=r+t.x*i._devicePixelRatio,a.y=s+n.height-t.y*i._devicePixelRatio),a},end:function(){this._purgeDirectorInNextLoop=!0},getWinSize:function(){return cc.size(cc.winSize)},getWinSizeInPixels:function(){return cc.size(cc.winSize)},pause:function(){this._paused||(this._paused=!0)},purgeCachedData:function(){cc.loader.releaseAll()},purgeDirector:function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),c&&c.setEnabled(!1),cc.isValid(this._scene)&&this._scene.destroy(),this._scene=null,cc.renderer.clear(),cc.AssetLibrary.resetBuiltins(),cc.game.pause(),cc.loader.releaseAll()},reset:function(){this.purgeDirector(),c&&c.setEnabled(!0),this._actionManager&&this._scheduler.scheduleUpdate(this._actionManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._animationManager&&this._scheduler.scheduleUpdate(this._animationManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._collisionManager&&this._scheduler.scheduleUpdate(this._collisionManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._physicsManager&&this._scheduler.scheduleUpdate(this._physicsManager,cc.Scheduler.PRIORITY_SYSTEM,!1),cc.game.resume()},runSceneImmediate:function(t,e,i){cc.assertID(t instanceof cc.Scene,1216),t._load();for(var n=Object.keys(l._persistRootNodes).map((function(t){return l._persistRootNodes[t]})),s=0;s0?cc.loader.load(i,(function(i){if(i)throw new Error(JSON.stringify(i));e._loadPreviewScript((function(){e._prepareFinished(t)}))})):this._loadPreviewScript((function(){e._prepareFinished(t)}))}},run:function(t,e){this._initConfig(t),this.onStart=e,this.prepare(o.onStart&&o.onStart.bind(o))},addPersistRootNode:function(t){if(cc.Node.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=cc.director._scene;if(cc.isValid(i))if(t.parent){if(!(t.parent instanceof cc.Scene))return void cc.warnID(3801);if(t.parent!==i)return void cc.warnID(3802)}else t.parent=i;this._persistRootNodes[e]=t,t._persistNode=!0}}else cc.warnID(3800)},removePersistRootNode:function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1)},isPersistRootNode:function(t){return t._persistNode},_setAnimFrame:function(){this._lastTime=performance.now();var t=o.config.frameRate;this._frameTime=1e3/t,cc.director._maxParticleDeltaTime=this._frameTime/1e3*2,60!==t&&30!==t?(window.requestAnimFrame=this._stTime,window.cancelAnimFrame=this._ctTime):(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime,window.cancelAnimFrame=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.oCancelAnimationFrame||this._ctTime)},_stTime:function(t){var e=performance.now(),i=Math.max(0,o._frameTime-(e-o._lastTime)),n=window.setTimeout((function(){t()}),i);return o._lastTime=e+i,n},_ctTime:function(t){window.clearTimeout(t)},_runMainLoop:function(){if(this._prepared){var t,e=this,i=e.config,n=cc.director,s=!0,a=i.frameRate;r.setDisplayStats(i.showFPS),t=function(i){if(!e._paused){if(e._intervalId=window.requestAnimFrame(t),30===a&&(s=!s))return;n.mainLoop(i)}},e._intervalId=window.requestAnimFrame(t),e._paused=!1}},_initConfig:function(t){"number"!=typeof t.debugMode&&(t.debugMode=0),t.exposeClassName=!!t.exposeClassName,"number"!=typeof t.frameRate&&(t.frameRate=60);var e=t.renderMode;("number"!=typeof e||e>2||e<0)&&(t.renderMode=0),"boolean"!=typeof t.registerSystemEvent&&(t.registerSystemEvent=!0),t.showFPS=1!==e&&!!t.showFPS,this._sceneInfos=t.scenes||[],this.collisionMatrix=t.collisionMatrix||[],this.groupList=t.groupList||[],r._resetDebugSetting(t.debugMode),this.config=t,this._configLoaded=!0},_determineRenderType:function(){var t=this.config,e=parseInt(t.renderMode)||0;this.renderType=this.RENDER_TYPE_CANVAS;var i=!1;if(0===e?cc.sys.capabilities.opengl?(this.renderType=this.RENDER_TYPE_WEBGL,i=!0):cc.sys.capabilities.canvas&&(this.renderType=this.RENDER_TYPE_CANVAS,i=!0):1===e&&cc.sys.capabilities.canvas?(this.renderType=this.RENDER_TYPE_CANVAS,i=!0):2===e&&cc.sys.capabilities.opengl&&(this.renderType=this.RENDER_TYPE_WEBGL,i=!0),!i)throw new Error(r.getError(3820,e))},_initRenderer:function(){if(!this._rendererInitialized){var t,e,i,n,r=this.config.id,o=r instanceof HTMLElement?r:document.querySelector(r)||document.querySelector("#"+r);if("CANVAS"===o.tagName?(t=o.width,e=o.height,this.canvas=i=o,this.container=n=document.createElement("DIV"),i.parentNode&&i.parentNode.insertBefore(n,i)):("DIV"!==o.tagName&&cc.warnID(3819),t=o.clientWidth,e=o.clientHeight,this.canvas=i=document.createElement("CANVAS"),this.container=n=document.createElement("DIV"),o.appendChild(n)),n.setAttribute("id","Cocos2dGameContainer"),n.appendChild(i),this.frame=n.parentNode===document.body?document.documentElement:n.parentNode,(function(t,e){(" "+t.className+" ").indexOf(" "+e+" ")>-1||(t.className&&(t.className+=" "),t.className+=e)})(i,"gameCanvas"),i.setAttribute("width",t||480),i.setAttribute("height",e||320),i.setAttribute("tabindex",99),this._determineRenderType(),this.renderType===this.RENDER_TYPE_WEBGL){var l={stencil:!0,antialias:cc.macro.ENABLE_WEBGL_ANTIALIAS,alpha:cc.macro.ENABLE_TRANSPARENT_CANVAS};s.initWebGL(i,l),this._renderContext=s.device._gl,!cc.macro.CLEANUP_IMAGE_CACHE&&a&&(a.enabled=!0)}this._renderContext||(this.renderType=this.RENDER_TYPE_CANVAS,s.initCanvas(i),this._renderContext=s.device._ctx),this.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1},this._rendererInitialized=!0}},_initEvents:function(){var t,e=window;this.config.registerSystemEvent&&cc.internal.inputManager.registerSystemEvent(this.canvas),void 0!==document.hidden?t="hidden":void 0!==document.mozHidden?t="mozHidden":void 0!==document.msHidden?t="msHidden":void 0!==document.webkitHidden&&(t="webkitHidden");var i=!1;function n(){i||(i=!0,o.emit(o.EVENT_HIDE))}function r(t,e,n,r,s){i&&(i=!1,o.emit(o.EVENT_SHOW,t,e,n,r,s))}if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(e.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(e.addEventListener("pagehide",n),e.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r)),this.on(o.EVENT_HIDE,(function(){o.pause()})),this.on(o.EVENT_SHOW,(function(){o.resume()}))}};n.call(o),cc.js.addon(o,n.prototype),cc.game=e.exports=o}),{"../audio/CCAudioEngine":21,"../core/renderer/utils/dynamic-atlas/manager":244,"./CCDebug":48,"./event/event-target":135,"./renderer/index.js":241}],51:[(function(t,e,i){"use strict";var n=t("./value-types"),r=t("./utils/base-node"),s=t("./utils/prefab-helper"),a=t("./utils/trans-pool").NodeMemPool,o=t("./utils/affine-transform"),l=t("./event-manager"),h=t("./platform/CCMacro"),c=t("./platform/js"),u=(t("./event/event"),t("./event/event-target")),_=t("./renderer/render-flow"),f=cc.Object.Flags.Destroying,d=Math.PI/180,p=!!cc.ActionManager,m=function(){},y=new n.Vec3,v=new n.Quat,g=new n.Vec3,A=new n.Vec3,x=new n.Quat,b=new n.Quat,C=new n.Vec3,T=new n.Vec3,S=new n.Vec3,w=new n.Vec3,E=new n.Vec3,M=new n.Quat,D=new n.Quat,B=new n.Vec3,I=new n.Quat,P=new n.Vec3,R=new n.Quat,O=new n.Vec3,L=new n.Vec3,F=new n.Quat,V=new n.Quat,N=(new n.Quat,cc.mat4()),k=new n.Vec3,G=new Array(16);G.length=0;var z=cc.Enum({DEBUG:31}),U=cc.Enum({POSITION:1,SCALE:2,ROTATION:4,SKEW:8,TRS:7,RS:6,TRSS:15,PHYSICS_POSITION:16,PHYSICS_SCALE:32,PHYSICS_ROTATION:64,PHYSICS_TRS:112,PHYSICS_RS:96,ALL_POSITION:17,ALL_SCALE:34,ALL_ROTATION:68,ALL_TRS:119,ALL:65535}),H=cc.Enum({TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_WHEEL:"mousewheel",POSITION_CHANGED:"position-changed",ROTATION_CHANGED:"rotation-changed",SCALE_CHANGED:"scale-changed",SIZE_CHANGED:"size-changed",ANCHOR_CHANGED:"anchor-changed",COLOR_CHANGED:"color-changed",CHILD_ADDED:"child-added",CHILD_REMOVED:"child-removed",CHILD_REORDER:"child-reorder",GROUP_CHANGED:"group-changed",SIBLING_ORDER_CHANGED:"sibling-order-changed"}),W=[H.TOUCH_START,H.TOUCH_MOVE,H.TOUCH_END,H.TOUCH_CANCEL],j=[H.MOUSE_DOWN,H.MOUSE_ENTER,H.MOUSE_MOVE,H.MOUSE_LEAVE,H.MOUSE_UP,H.MOUSE_WHEEL],X=!0,Y=function(t,e){if(0!==t){var i="";X&&cc.warn("`cc.Node.skewX/Y` is deprecated since v2.2.1, please use 3D node instead.",i),X=!1}},q=null,J=function(t,e){var i=t.getLocation(),n=this.owner;return!!n._hitTest(i,this)&&(e.type=H.TOUCH_START,e.touch=t,e.bubbles=!0,n.dispatchEvent(e),!0)},Z=function(t,e){var i=this.owner;e.type=H.TOUCH_MOVE,e.touch=t,e.bubbles=!0,i.dispatchEvent(e)},K=function(t,e){var i=t.getLocation(),n=this.owner;n._hitTest(i,this)?e.type=H.TOUCH_END:e.type=H.TOUCH_CANCEL,e.touch=t,e.bubbles=!0,n.dispatchEvent(e)},Q=function(t,e){t.getLocation();var i=this.owner;e.type=H.TOUCH_CANCEL,e.touch=t,e.bubbles=!0,i.dispatchEvent(e)},$=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=H.MOUSE_DOWN,t.bubbles=!0,i.dispatchEvent(t))},tt=function(t){var e=t.getLocation(),i=this.owner;if(i._hitTest(e,this))this._previousIn||(q&&q._mouseListener&&(t.type=H.MOUSE_LEAVE,q.dispatchEvent(t),q._mouseListener._previousIn=!1),q=this.owner,t.type=H.MOUSE_ENTER,i.dispatchEvent(t),this._previousIn=!0),t.type=H.MOUSE_MOVE,t.bubbles=!0,i.dispatchEvent(t);else{if(!this._previousIn)return;t.type=H.MOUSE_LEAVE,i.dispatchEvent(t),this._previousIn=!1,q=null}t.stopPropagation()},et=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=H.MOUSE_UP,t.bubbles=!0,i.dispatchEvent(t),t.stopPropagation())},it=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=H.MOUSE_WHEEL,t.bubbles=!0,i.dispatchEvent(t),t.stopPropagation())};function nt(t,e){if(e){for(var i=0,n=null,r=t;r&&cc.Node.isNode(r);r=r._parent,++i)if(r.getComponent(e)){var s={index:i,node:r};n?n.push(s):n=[s]}return n}return null}function rt(t,e){if(!(t._objFlags&f)){var i=0;if(t._bubblingListeners)for(;i=0;--n)if((i=G[n])._capturingListeners&&(e.currentTarget=i,i._capturingListeners.emit(e.type,e,G),e._propagationStopped))return void(G.length=0);if(G.length=0,e.eventPhase=2,e.currentTarget=t,t._capturingListeners&&t._capturingListeners.emit(e.type,e),!e._propagationImmediateStopped&&t._bubblingListeners&&t._bubblingListeners.emit(e.type,e),!e._propagationStopped&&e.bubbles)for(t._getBubblingTargets(e.type,G),e.eventPhase=3,n=0;n>16},set:function(t){t>h.MAX_ZINDEX?(cc.warnID(1636),t=h.MAX_ZINDEX):t>16),this._color.a<255&&255===this._opacity&&(this._opacity=this._color.a,this._color.a=255)},_onBatchCreated:function(){var t=this._prefab;t&&t.sync&&t.root===this&&s.syncWithPrefab(this),this._upgrade_1x_to_2x(),this._updateOrderOfArrival(),this._cullingMask=1<0&&(this._renderFlag|=_.FLAG_CHILDREN)},_onBatchRestored:function(){if(this._upgrade_1x_to_2x(),this._cullingMask=1<0&&(this._renderFlag|=_.FLAG_CHILDREN)},_checkListenerMask:function(){if(this._touchListener){var t=this._touchListener.mask=nt(this,cc.Mask);this._mouseListener&&(this._mouseListener.mask=t)}else this._mouseListener&&(this._mouseListener.mask=nt(this,cc.Mask))},_checknSetupSysEvent:function(t){var e=!1,i=!1;return-1!==W.indexOf(t)?(this._touchListener||(this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,owner:this,mask:nt(this,cc.Mask),onTouchBegan:J,onTouchMoved:Z,onTouchEnded:K,onTouchCancelled:Q}),l.addListener(this._touchListener,this),e=!0),i=!0):-1!==j.indexOf(t)&&(this._mouseListener||(this._mouseListener=cc.EventListener.create({event:cc.EventListener.MOUSE,_previousIn:!1,owner:this,mask:nt(this,cc.Mask),onMouseDown:$,onMouseMove:tt,onMouseUp:et,onMouseScroll:it}),l.addListener(this._mouseListener,this),e=!0),i=!0),e&&!this._activeInHierarchy&&cc.director.getScheduler().schedule((function(){this._activeInHierarchy||l.pauseTarget(this)}),this,0,0,0,!1),i},on:function(t,e,i,n){if(this._checknSetupSysEvent(t))return this._onDispatch(t,e,i,n);switch(t){case H.POSITION_CHANGED:this._eventMask|=1;break;case H.SCALE_CHANGED:this._eventMask|=2;break;case H.ROTATION_CHANGED:this._eventMask|=4;break;case H.SIZE_CHANGED:this._eventMask|=8;break;case H.ANCHOR_CHANGED:this._eventMask|=16;break;case H.COLOR_CHANGED:this._eventMask|=32}return this._bubblingListeners||(this._bubblingListeners=new u),this._bubblingListeners.on(t,e,i)},once:function(t,e,i,n){(this._checknSetupSysEvent(t)&&n?this._capturingListeners=this._capturingListeners||new u:this._bubblingListeners=this._bubblingListeners||new u).once(t,e,i)},_onDispatch:function(t,e,i,n){if("boolean"==typeof i?(n=i,i=void 0):n=!!n,e){var r=null;return(r=n?this._capturingListeners=this._capturingListeners||new u:this._bubblingListeners=this._bubblingListeners||new u).hasEventListener(t,e,i)||(r.on(t,e,i),i&&i.__eventTargets&&i.__eventTargets.push(this)),e}cc.errorID(6800)},off:function(t,e,i,n){var r=-1!==W.indexOf(t),s=!r&&-1!==j.indexOf(t);if(r||s)this._offDispatch(t,e,i,n),r?this._touchListener&&!rt(this,W)&&(l.removeListener(this._touchListener),this._touchListener=null):s&&this._mouseListener&&!rt(this,j)&&(l.removeListener(this._mouseListener),this._mouseListener=null);else if(this._bubblingListeners){if(this._bubblingListeners.off(t,e,i),!this._bubblingListeners.hasEventListener(t))switch(t){case H.POSITION_CHANGED:this._eventMask&=-2;break;case H.SCALE_CHANGED:this._eventMask&=-3;break;case H.ROTATION_CHANGED:this._eventMask&=-5;break;case H.SIZE_CHANGED:this._eventMask&=-9;break;case H.ANCHOR_CHANGED:this._eventMask&=-17;break;case H.COLOR_CHANGED:this._eventMask&=-33}}},_offDispatch:function(t,e,i,n){if("boolean"==typeof i?(n=i,i=void 0):n=!!n,e){var r=n?this._capturingListeners:this._bubblingListeners;r&&(r.off(t,e,i),i&&i.__eventTargets&&c.array.fastRemove(i.__eventTargets,this))}else this._capturingListeners&&this._capturingListeners.removeAll(t),this._bubblingListeners&&this._bubblingListeners.removeAll(t)},targetOff:function(t){var e=this._bubblingListeners;e&&(e.targetOff(t),1&this._eventMask&&!e.hasEventListener(H.POSITION_CHANGED)&&(this._eventMask&=-2),2&this._eventMask&&!e.hasEventListener(H.SCALE_CHANGED)&&(this._eventMask&=-3),4&this._eventMask&&!e.hasEventListener(H.ROTATION_CHANGED)&&(this._eventMask&=-5),8&this._eventMask&&!e.hasEventListener(H.SIZE_CHANGED)&&(this._eventMask&=-9),16&this._eventMask&&!e.hasEventListener(H.ANCHOR_CHANGED)&&(this._eventMask&=-17),32&this._eventMask&&!e.hasEventListener(H.COLOR_CHANGED)&&(this._eventMask&=-33)),this._capturingListeners&&this._capturingListeners.targetOff(t),t&&t.__eventTargets&&c.array.fastRemove(t.__eventTargets,this),this._touchListener&&!rt(this,W)&&(l.removeListener(this._touchListener),this._touchListener=null),this._mouseListener&&!rt(this,j)&&(l.removeListener(this._mouseListener),this._mouseListener=null)},hasEventListener:function(t){var e=!1;return this._bubblingListeners&&(e=this._bubblingListeners.hasEventListener(t)),!e&&this._capturingListeners&&(e=this._capturingListeners.hasEventListener(t)),e},emit:function(t,e,i,n,r,s){this._bubblingListeners&&this._bubblingListeners.emit(t,e,i,n,r,s)},dispatchEvent:function(t){st(this,t),G.length=0},pauseSystemEvents:function(t){l.pauseTarget(this,t)},resumeSystemEvents:function(t){l.resumeTarget(this,t)},_hitTest:function(t,e){var i=this._contentSize.width,r=this._contentSize.height,s=O,a=L,o=cc.Camera.findCamera(this);if(o?o.getScreenToWorldPoint(t,s):s.set(t),this._updateWorldMatrix(),!n.Mat4.invert(N,this._worldMatrix))return!1;n.Vec2.transformMat4(a,s,N),a.x+=this._anchorPoint.x*i,a.y+=this._anchorPoint.y*r;var l=!1;if(a.x>=0&&a.y>=0&&a.x<=i&&a.y<=r&&(l=!0,e&&e.mask))for(var h=e.mask,c=this,u=h?h.length:0,_=0,f=0;c&&fd.index){h.length=f;break}}return l},_getCapturingTargets:function(t,e){for(var i=this.parent;i;)i._capturingListeners&&i._capturingListeners.hasEventListener(t)&&e.push(i),i=i.parent},_getBubblingTargets:function(t,e){for(var i=this.parent;i;)i._bubblingListeners&&i._bubblingListeners.hasEventListener(t)&&e.push(i),i=i.parent},runAction:p?function(t){if(this.active){cc.assertID(t,1618);var e=cc.director.getActionManager();return e._suppressDeprecation||(e._suppressDeprecation=!0,cc.warnID(1639)),e.addAction(t,this,!1),t}}:m,pauseAllActions:p?function(){cc.director.getActionManager().pauseTarget(this)}:m,resumeAllActions:p?function(){cc.director.getActionManager().resumeTarget(this)}:m,stopAllActions:p?function(){cc.director.getActionManager().removeAllActionsFromTarget(this)}:m,stopAction:p?function(t){cc.director.getActionManager().removeAction(t)}:m,stopActionByTag:p?function(t){t!==cc.Action.TAG_INVALID?cc.director.getActionManager().removeActionByTag(t,this):cc.logID(1612)}:m,getActionByTag:p?function(t){return t===cc.Action.TAG_INVALID?(cc.logID(1613),null):cc.director.getActionManager().getActionByTag(t,this)}:function(){return null},getNumberOfRunningActions:p?function(){return cc.director.getActionManager().getNumberOfRunningActionsInTarget(this)}:function(){return 0},getPosition:function(t){return t=t||new n.Vec3,n.Trs.toPosition(t,this._trs)},setPosition:function(t,e,i){var n;void 0===e?(n=t.x,e=t.y,i=t.z||0):(n=t,i=i||0);var r=this._trs;r[0]===n&&r[1]===e&&r[2]===i||(r[0]=n,r[1]=e,r[2]=i,this.setLocalDirty(U.ALL_POSITION),this._renderFlag|=_.FLAG_WORLD_TRANSFORM,1&this._eventMask&&this.emit(H.POSITION_CHANGED))},getScale:function(t){return void 0!==t?n.Trs.toScale(t,this._trs):(cc.errorID(1400,"cc.Node.getScale","cc.Node.scale or cc.Node.getScale(cc.Vec3)"),this._trs[7])},setScale:function(t,e,i){t&&"number"!=typeof t?(e=t.y,i=void 0===t.z?1:t.z,t=t.x):void 0!==t&&void 0===e?(e=t,i=t):void 0===i&&(i=1);var n=this._trs;n[7]===t&&n[8]===e&&n[9]===i||(n[7]=t,n[8]=e,n[9]=i,this.setLocalDirty(U.ALL_SCALE),this._renderFlag|=_.FLAG_TRANSFORM,2&this._eventMask&&this.emit(H.SCALE_CHANGED))},getRotation:function(t){return t instanceof n.Quat?n.Trs.toRotation(t,this._trs):-this.angle},setRotation:function(t,e,i,n){if("number"==typeof t&&void 0===e)this.angle=-t;else{var r=t;void 0===e&&(r=t.x,e=t.y,i=t.z,n=t.w);var s=this._trs;s[3]===r&&s[4]===e&&s[5]===i&&s[6]===n||(s[3]=r,s[4]=e,s[5]=i,s[6]=n,this.setLocalDirty(U.ALL_ROTATION),4&this._eventMask&&this.emit(H.ROTATION_CHANGED))}},getContentSize:function(){return cc.size(this._contentSize.width,this._contentSize.height)},setContentSize:function(t,e){var i=this._contentSize;if(void 0===e){if(t.width===i.width&&t.height===i.height)return;0,i.width=t.width,i.height=t.height}else{if(t===i.width&&e===i.height)return;0,i.width=t,i.height=e}8&this._eventMask&&this.emit(H.SIZE_CHANGED)},getAnchorPoint:function(){return cc.v2(this._anchorPoint)},setAnchorPoint:function(t,e){var i=this._anchorPoint;if(void 0===e){if(t.x===i.x&&t.y===i.y)return;i.x=t.x,i.y=t.y}else{if(t===i.x&&e===i.y)return;i.x=t,i.y=e}this.setLocalDirty(U.ALL_POSITION),16&this._eventMask&&this.emit(H.ANCHOR_CHANGED)},_invTransformPoint:function(t,e){this._parent?this._parent._invTransformPoint(t,e):n.Vec3.copy(t,e);var i=this._trs;return n.Trs.toPosition(g,i),n.Vec3.sub(t,t,g),n.Trs.toRotation(x,i),n.Quat.conjugate(b,x),n.Vec3.transformQuat(t,t,b),n.Trs.toScale(g,i),n.Vec3.inverseSafe(A,g),n.Vec3.mul(t,t,A),t},getWorldPosition:function(t){n.Trs.toPosition(t,this._trs);for(var e,i=this._parent;i;)e=i._trs,n.Trs.toScale(y,e),n.Vec3.mul(t,t,y),n.Trs.toRotation(v,e),n.Vec3.transformQuat(t,t,v),n.Trs.toPosition(y,e),n.Vec3.add(t,t,y),i=i._parent;return t},setWorldPosition:function(t){var e=this._trs;this._parent?this._parent._invTransformPoint(C,t):n.Vec3.copy(C,t),n.Trs.fromPosition(e,C),this.setLocalDirty(U.ALL_POSITION),1&this._eventMask&&this.emit(H.POSITION_CHANGED)},getWorldRotation:function(t){n.Trs.toRotation(F,this._trs),n.Quat.copy(t,F);for(var e=this._parent;e;)n.Trs.toRotation(F,e._trs),n.Quat.mul(t,F,t),e=e._parent;return t},setWorldRotation:function(t){this._parent?(this._parent.getWorldRotation(V),n.Quat.conjugate(V,V),n.Quat.mul(V,V,t)):n.Quat.copy(V,t),n.Trs.fromRotation(this._trs,V),this.setLocalDirty(U.ALL_ROTATION)},getWorldScale:function(t){n.Trs.toScale(T,this._trs),n.Vec3.copy(t,T);for(var e=this._parent;e;)n.Trs.toScale(T,e._trs),n.Vec3.mul(t,t,T),e=e._parent;return t},setWorldScale:function(t){this._parent?(this._parent.getWorldScale(S),n.Vec3.div(S,t,S)):n.Vec3.copy(S,t),n.Trs.fromScale(this._trs,S),this.setLocalDirty(U.ALL_SCALE)},getWorldRT:function(t){var e=w,i=M,r=this._trs;n.Trs.toPosition(e,r),n.Trs.toRotation(i,r);for(var s=this._parent;s;)r=s._trs,n.Trs.toScale(E,r),n.Vec3.mul(e,e,E),n.Trs.toRotation(D,r),n.Vec3.transformQuat(e,e,D),n.Trs.toPosition(E,r),n.Vec3.add(e,e,E),n.Quat.mul(i,D,i),s=s._parent;return n.Mat4.fromRT(t,i,e),t},lookAt:function(t,e){this.getWorldPosition(B),n.Vec3.sub(B,B,t),n.Vec3.normalize(B,B),n.Quat.fromViewUp(I,B,e),this.setWorldRotation(I)},_updateLocalMatrix:ht,_calculWorldMatrix:function(){this._localMatDirty&U.TRSS&&this._updateLocalMatrix();var t=this._parent;t?this._mulMat(this._worldMatrix,t._worldMatrix,this._matrix):n.Mat4.copy(this._worldMatrix,this._matrix),this._worldMatDirty=!1},_mulMat:_t,_updateWorldMatrix:function(){if(this._parent&&this._parent._updateWorldMatrix(),this._worldMatDirty){this._calculWorldMatrix();for(var t=this._children,e=0,i=t.length;e1){for(var n,r,s=1,a=t.length;s=0&&r._localZOrder0,this._repeat=r,this._runForever=this._repeat===cc.macro.REPEAT_FOREVER,!0},_.getInterval=function(){return this._interval},_.setInterval=function(t){this._interval=t},_.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},_.getCallback=function(){return this._callback},_.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},_.cancel=function(){this._scheduler.unschedule(this._callback,this._target)};var f=[];u.get=function(){return f.pop()||new u},u.put=function(t){f.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,f.push(t))},cc.Scheduler=function(){this._timeScale=1,this._updatesNegList=[],this._updates0List=[],this._updatesPosList=[],this._hashForUpdates=n.createMap(!0),this._hashForTimers=n.createMap(!0),this._currentTarget=null,this._currentTargetSalvaged=!1,this._updateHashLocked=!1,this._arrayForTimers=[]},cc.Scheduler.prototype={constructor:cc.Scheduler,_removeHashElement:function(t){delete this._hashForTimers[t.target._id];for(var e=this._arrayForTimers,i=0,n=e.length;i=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}},unscheduleUpdate:function(t){if(t){var e=t._id;e||(t.__instanceId?(cc.warnID(1513),e=t._id=t.__instanceId):cc.errorID(1510));var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}},unscheduleAllForTarget:function(t){if(t){var e=t._id;e||(t.__instanceId?(cc.warnID(1513),e=t._id=t.__instanceId):cc.errorID(1510));var i=this._hashForTimers[e];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)i=r[e],this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s==this._updatesNegList.length&&e++;if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s==this._updatesPosList.length&&e++},isScheduled:function(t,e){cc.assertID(t,1508),cc.assertID(e,1509);var i=e._id;i||(e.__instanceId?(cc.warnID(1513),i=e._id=e.__instanceId):cc.errorID(1510));var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target));if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target));return s},resumeTargets:function(t){if(t)for(var e=0;e=r.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):(this.data._prefab._synced=!0,t=this.data._instantiate()),++this._instantiatedTimes,t},destroy:function(){this.data&&this.data.destroy(),this._super()}});cc.Prefab=e.exports=r,cc.js.obsolete(cc,"cc._Prefab","Prefab")}),{"../platform/instantiate-jit":227}],63:[(function(t,e,i){"use strict";var n=t("../platform/CCObject"),r=t("../platform/js");cc.RawAsset=cc.Class({name:"cc.RawAsset",extends:n,ctor:function(){Object.defineProperty(this,"_uuid",{value:"",writable:!0})}}),r.value(cc.RawAsset,"isRawAssetType",(function(t){return r.isChildClassOf(t,cc.RawAsset)&&!r.isChildClassOf(t,cc.Asset)})),r.value(cc.RawAsset,"wasRawAssetType",(function(t){return t===cc.Texture2D||t===cc.AudioClip||t===cc.ParticleAsset||t===cc.Asset})),e.exports=cc.RawAsset}),{"../platform/CCObject":215,"../platform/js":229}],64:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../renderer/gfx"));var r=t("../renderer"),s=t("./CCTexture2D"),a=cc.Enum({RB_FMT_D24S8:n.default.RB_FMT_D24S8,RB_FMT_S8:n.default.RB_FMT_S8,RB_FMT_D16:n.default.RB_FMT_D16}),o=cc.Class({name:"cc.RenderTexture",extends:s,statics:{DepthStencilFormat:a},ctor:function(){this._framebuffer=null},initWithSize:function(t,e,i){this.width=Math.floor(t||cc.visibleRect.width),this.height=Math.floor(e||cc.visibleRect.height),this._resetUnderlyingMipmaps();var s,a={colors:[this._texture]};this._depthStencilBuffer&&this._depthStencilBuffer.destroy(),i&&(s=new n.default.RenderBuffer(r.device,i,t,e),i===n.default.RB_FMT_D24S8?a.depthStencil=s:i===n.default.RB_FMT_S8?a.stencil=s:i===n.default.RB_FMT_D16&&(a.depth=s)),this._depthStencilBuffer=s,this._framebuffer&&this._framebuffer.destroy(),this._framebuffer=new n.default.FrameBuffer(r.device,t,e,a),this._packable=!1,this.loaded=!0,this.emit("load")},updateSize:function(t,e){this.width=Math.floor(t||cc.visibleRect.width),this.height=Math.floor(e||cc.visibleRect.height),this._resetUnderlyingMipmaps();var i=this._depthStencilBuffer;i&&i.update(this.width,this.height),this._framebuffer._width=t,this._framebuffer._height=e},drawTextureAt:function(t,e,i){t._image&&0!==t._image.width&&this._texture.updateSubImage({x:e,y:i,image:t._image,width:t.width,height:t.height,level:0,flipY:!1,premultiplyAlpha:t._premultiplyAlpha})},readPixels:function(t,e,i,n,r){if(!this._framebuffer||!this._texture)return t;e=e||0,i=i||0;var s=n||this.width,a=r||this.height;t=t||new Uint8Array(s*a*4);var o=cc.game._renderContext,l=o.getParameter(o.FRAMEBUFFER_BINDING);return o.bindFramebuffer(o.FRAMEBUFFER,this._framebuffer.getHandle()),o.readPixels(e,i,s,a,o.RGBA,o.UNSIGNED_BYTE,t),o.bindFramebuffer(o.FRAMEBUFFER,l),t},destroy:function(){this._super(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null)}});cc.RenderTexture=e.exports=o}),{"../../renderer/gfx":342,"../renderer":241,"./CCTexture2D":71}],65:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.SceneAsset",extends:cc.Asset,properties:{scene:null,asyncLoadAssets:void 0}});cc.SceneAsset=n,e.exports=n}),{}],66:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.Script",extends:cc.Asset});cc._Script=n;var r=cc.Class({name:"cc.JavaScript",extends:n});cc._JavaScript=r;var s=cc.Class({name:"cc.CoffeeScript",extends:n});cc._CoffeeScript=s;var a=cc.Class({name:"cc.TypeScript",extends:n});cc._TypeScript=a}),{}],67:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.SpriteAtlas",extends:cc.Asset,properties:{_spriteFrames:{default:{}}},getTexture:function(){var t=Object.keys(this._spriteFrames);if(t.length>0){var e=this._spriteFrames[t[0]];return e?e.getTexture():null}return null},getSpriteFrame:function(t){var e=this._spriteFrames[t];return e?(e.name||(e.name=t),e):null},getSpriteFrames:function(){var t=[],e=this._spriteFrames;for(var i in e)t.push(this.getSpriteFrame(i));return t}});cc.SpriteAtlas=n,e.exports=n}),{}],68:[(function(t,e,i){"use strict";var n=t("../event/event-target"),r=t("../utils/texture-util"),s=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],a=cc.Class({name:"cc.SpriteFrame",extends:t("../assets/CCAsset"),mixins:[n],properties:{_textureSetter:{set:function(t){t&&(this._texture!==t&&this._refreshTexture(t),this._textureFilename=t.url)}},insetTop:{get:function(){return this._capInsets[1]},set:function(t){this._capInsets[1]=t,this._texture&&this._calculateSlicedUV()}},insetBottom:{get:function(){return this._capInsets[3]},set:function(t){this._capInsets[3]=t,this._texture&&this._calculateSlicedUV()}},insetLeft:{get:function(){return this._capInsets[0]},set:function(t){this._capInsets[0]=t,this._texture&&this._calculateSlicedUV()}},insetRight:{get:function(){return this._capInsets[2]},set:function(t){this._capInsets[2]=t,this._texture&&this._calculateSlicedUV()}}},ctor:function(){n.call(this);var t=arguments[0],e=arguments[1],i=arguments[2],r=arguments[3],s=arguments[4];this._rect=null,this.uv=[],this._texture=null,this._original=null,this._offset=null,this._originalSize=null,this._rotated=!1,this._flipX=!1,this._flipY=!1,this.vertices=null,this._capInsets=[0,0,0,0],this.uvSliced=[],this._textureFilename="",void 0!==t&&this.setTexture(t,e,i,r,s)},textureLoaded:function(){return this._texture&&this._texture.loaded},onTextureLoaded:function(t,e){return this.textureLoaded()?(t.call(e),!0):(this.once("load",t,e),this.ensureLoadTexture(),!1)},isRotated:function(){return this._rotated},setRotated:function(t){this._rotated=t,this._texture&&this._calculateUV()},isFlipX:function(){return this._flipX},isFlipY:function(){return this._flipY},setFlipX:function(t){this._flipX=t,this._texture&&this._calculateUV()},setFlipY:function(t){this._flipY=t,this._texture&&this._calculateUV()},getRect:function(){return cc.rect(this._rect)},setRect:function(t){this._rect=t,this._texture&&this._calculateUV()},getOriginalSize:function(){return cc.size(this._originalSize)},setOriginalSize:function(t){this._originalSize?(this._originalSize.width=t.width,this._originalSize.height=t.height):this._originalSize=cc.size(t)},getTexture:function(){return this._texture},_textureLoadedCallback:function(){var t=this._texture;if(t){var e=t.width,i=t.height;this._rect?this._checkRect(this._texture):this._rect=cc.rect(0,0,e,i),this._originalSize||this.setOriginalSize(cc.size(e,i)),this._offset||this.setOffset(cc.v2(0,0)),this._calculateUV(),this.emit("load")}},_refreshTexture:function(t){this._texture=t,t.loaded?this._textureLoadedCallback():t.once("load",this._textureLoadedCallback,this)},getOffset:function(){return cc.v2(this._offset)},setOffset:function(t){this._offset=cc.v2(t)},clone:function(){return new a(this._texture||this._textureFilename,this._rect,this._rotated,this._offset,this._originalSize)},setTexture:function(t,e,i,n,r){this._rect=e||null,n?this.setOffset(n):this._offset=null,r?this.setOriginalSize(r):this._originalSize=null,this._rotated=i||!1;var s=t;return"string"==typeof s&&s&&(this._textureFilename=s,this._loadTexture()),s instanceof cc.Texture2D&&this._texture!==s&&this._refreshTexture(s),!0},_loadTexture:function(){if(this._textureFilename){var t=r.loadImage(this._textureFilename);this._refreshTexture(t)}},ensureLoadTexture:function(){this._texture?this._texture.loaded||(this._refreshTexture(this._texture),r.postLoadTexture(this._texture)):this._textureFilename&&this._loadTexture()},_checkRect:function(t){var e=this._rect,i=e.x,n=e.y;this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width&&cc.errorID(3300,t.url+"/"+this.name,i,t.width),n>t.height&&cc.errorID(3400,t.url+"/"+this.name,n,t.height)},_flipXY:function(t){if(this._flipX){var e=t[0];t[0]=t[1],t[1]=e,e=t[2],t[2]=t[3],t[3]=e}if(this._flipY){var i=t[0];t[0]=t[2],t[2]=i,i=t[1],t[1]=t[3],t[3]=i}},_calculateSlicedUV:function(){var t=this._rect,e=this._texture.width,i=this._texture.height,n=this._capInsets[0],r=this._capInsets[2],a=t.width-n-r,o=this._capInsets[1],l=this._capInsets[3],h=t.height-o-l,c=this.uvSliced;if(c.length=0,this._rotated){s[0].u=t.x/e,s[1].u=(t.x+l)/e,s[2].u=(t.x+l+h)/e,s[3].u=(t.x+t.height)/e,s[3].v=t.y/i,s[2].v=(t.y+n)/i,s[1].v=(t.y+n+a)/i,s[0].v=(t.y+t.width)/i,this._flipXY(s);for(var u=0;u<4;++u)for(var _=s[u],f=0;f<4;++f){var d=s[3-f];c.push({u:_.u,v:d.v})}}else{s[0].u=t.x/e,s[1].u=(t.x+n)/e,s[2].u=(t.x+n+a)/e,s[3].u=(t.x+t.width)/e,s[3].v=t.y/i,s[2].v=(t.y+o)/i,s[1].v=(t.y+o+h)/i,s[0].v=(t.y+t.height)/i,this._flipXY(s);for(var p=0;p<4;++p)for(var m=s[p],y=0;y<4;++y){var v=s[y];c.push({u:v.u,v:m.v})}}},_setDynamicAtlasFrame:function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},_resetDynamicAtlasFrame:function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},_calculateUV:function(){var t=this._rect,e=this._texture,i=this.uv,n=e.width,r=e.height;if(this._rotated){var s=0===n?0:t.x/n,a=0===n?0:(t.x+t.height)/n,o=0===r?0:(t.y+t.width)/r,l=0===r?0:t.y/r;i[0]=s,i[1]=l,i[2]=s,i[3]=o,i[4]=a,i[5]=l,i[6]=a,i[7]=o}else{var h=0===n?0:t.x/n,c=0===n?0:(t.x+t.width)/n,u=0===r?0:(t.y+t.height)/r,_=0===r?0:t.y/r;i[0]=h,i[1]=u,i[2]=c,i[3]=u,i[4]=h,i[5]=_,i[6]=c,i[7]=_}if(this._flipX){var f=i[0];i[0]=i[2],i[2]=f,f=i[1],i[1]=i[3],i[3]=f,f=i[4],i[4]=i[6],i[6]=f,f=i[5],i[5]=i[7],i[7]=f}if(this._flipY){var d=i[0];i[0]=i[4],i[4]=d,d=i[1],i[1]=i[5],i[5]=d,d=i[2],i[2]=i[6],i[6]=d,d=i[3],i[3]=i[7],i[7]=d}var p=this.vertices;if(p){p.nu.length=0,p.nv.length=0;for(var m=0;m0?this._image=t.images[0]:void 0!==t.image&&(this._image=t.image,t.images||(_.length=0,t.images=_),t.images.push(t.image)),this._texture&&this._texture.update(t),this._hashDirty=!0}},initWithElement:function(t){if(t)if(this._image=t,t.complete||t instanceof HTMLCanvasElement)this.handleLoadedTexture();else{var e=this;t.addEventListener("load",(function(){e.handleLoadedTexture()})),t.addEventListener("error",(function(t){cc.warnID(3119,t.message)}))}},initWithData:function(t,e,i,n){var r=d();return r.image=t,r.images=[r.image],r.genMipmaps=this._genMipmaps,r.premultiplyAlpha=this._premultiplyAlpha,r.flipY=this._flipY,r.minFilter=u[this._minFilter],r.magFilter=u[this._magFilter],r.wrapS=this._wrapS,r.wrapT=this._wrapT,r.format=this._getGFXPixelFormat(e),r.width=i,r.height=n,this._texture?this._texture.update(r):this._texture=new s.Texture2D(s.device,r),this.width=i,this.height=n,this._checkPackable(),this.loaded=!0,this.emit("load"),!0},getHtmlElementObj:function(){return this._image},destroy:function(){this._packable&&cc.dynamicAtlasManager&&cc.dynamicAtlasManager.deleteAtlasTexture(this),this._image=null,this._texture&&this._texture.destroy(),this._super()},getPixelFormat:function(){return this._format},hasPremultipliedAlpha:function(){return this._premultiplyAlpha||!1},handleLoadedTexture:function(){if(this._image&&this._image.width&&this._image.height){this.width=this._image.width,this.height=this._image.height;var t=d();t.image=this._image,t.images=[t.image],t.width=this.width,t.height=this.height,t.genMipmaps=this._genMipmaps,t.format=this._getGFXPixelFormat(this._format),t.premultiplyAlpha=this._premultiplyAlpha,t.flipY=this._flipY,t.minFilter=u[this._minFilter],t.magFilter=u[this._magFilter],t.wrapS=this._wrapS,t.wrapT=this._wrapT,this._texture?this._texture.update(t):this._texture=new s.Texture2D(s.device,t),this._checkPackable(),this.loaded=!0,this.emit("load"),cc.macro.CLEANUP_IMAGE_CACHE&&this._image instanceof HTMLImageElement&&this._clearImage()}},description:function(){return""},releaseTexture:function(){this._image=null,this._texture&&this._texture.destroy()},setWrapMode:function(t,e){if(this._wrapS!==t||this._wrapT!==e){var i=d();i.wrapS=t,i.wrapT=e,this.update(i)}},setFilters:function(t,e){if(this._minFilter!==t||this._magFilter!==e){var i=d();i.minFilter=t,i.magFilter=e,this.update(i)}},setFlipY:function(t){if(this._flipY!==t){var e=d();e.flipY=t,this.update(e)}},setPremultiplyAlpha:function(t){if(this._premultiplyAlpha!==t){var e=d();e.premultiplyAlpha=t,this.update(e)}},_checkPackable:function(){var t=cc.dynamicAtlasManager;if(t)if(this._isCompressed())this._packable=!1;else{var e=this.width,i=this.height;!this._image||e>t.maxFrameSize||i>t.maxFrameSize||this._getHash()!==t.Atlas.DEFAULT_HASH?this._packable=!1:this._image&&this._image instanceof HTMLCanvasElement&&(this._packable=!0)}},_getOpts:function(){var t=d();return t.width=this.width,t.height=this.height,t.genMipmaps=this._genMipmaps,t.format=this._format,t.premultiplyAlpha=this._premultiplyAlpha,t.anisotropy=this._anisotropy,t.flipY=this._flipY,t.minFilter=u[this._minFilter],t.magFilter=u[this._magFilter],t.mipFilter=u[this._mipFilter],t.wrapS=this._wrapS,t.wrapT=this._wrapT,t},_getGFXPixelFormat:function(t){return t===l.RGBA_ETC1?t=l.RGB_ETC1:t===l.RGB_A_PVRTC_4BPPV1?t=l.RGB_PVRTC_4BPPV1:t===l.RGB_A_PVRTC_2BPPV1&&(t=l.RGB_PVRTC_2BPPV1),t},_resetUnderlyingMipmaps:function(t){var e=this._getOpts();e.images=t||[null],this._texture?this._texture.update(e):this._texture=new s.Texture2D(s.device,e)},_serialize:!1,_deserialize:function(t,e){var i=cc.renderer.device,n=t.split(","),r=n[0];if(r){for(var s=r.split("_"),a="",o="",h=999,c=this._format,u=cc.macro.SUPPORT_TEXTURE_FORMATS,_=0;_l.RGBA32F},_clearImage:function(){cc.loader.removeItem(this._image.id||this._image.src),this._image.src=""}});cc.Texture2D=e.exports=p}),{"../../renderer/gfx":342,"../assets/CCAsset":55,"../event/event-target":135,"../platform/CCClass":209,"../platform/id-generater":225,"../renderer":241}],72:[(function(t,e,i){"use strict";t("./CCRawAsset"),t("./CCAsset"),t("./CCFont"),t("./CCPrefab"),t("./CCAudioClip"),t("./CCScripts"),t("./CCSceneAsset"),t("./CCSpriteFrame"),t("./CCTexture2D"),t("./CCRenderTexture"),t("./CCTTFFont"),t("./CCSpriteAtlas"),t("./CCBitmapFont"),t("./CCLabelAtlas"),t("./CCTextAsset"),t("./CCJsonAsset"),t("./CCBufferAsset"),t("./material")}),{"./CCAsset":55,"./CCAudioClip":56,"./CCBitmapFont":57,"./CCBufferAsset":58,"./CCFont":59,"./CCJsonAsset":60,"./CCLabelAtlas":61,"./CCPrefab":62,"./CCRawAsset":63,"./CCRenderTexture":64,"./CCSceneAsset":65,"./CCScripts":66,"./CCSpriteAtlas":67,"./CCSpriteFrame":68,"./CCTTFFont":69,"./CCTextAsset":70,"./CCTexture2D":71,"./material":79}],73:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../CCAsset")),r=t("./effect-parser");var s=cc.Class({name:"cc.EffectAsset",extends:n.default,ctor:function(){this._effect=null},properties:{properties:Object,techniques:[],shaders:[]},onLoad:function(){if(cc.game.renderType!==cc.game.RENDER_TYPE_CANVAS){for(var t=cc.renderer._forward._programLib,e=0;e=i.length)){var n=0,r=i.length;void 0!==e&&(n=e,r=e+1);for(var s=n;s=i.length)){var n=0,r=i.length;void 0!==e&&(n=e,r=e+1);for(var s=n;s=this._techniques.length?cc.warn("Can not switch to technique with index ["+t+"]"):this._technique=this._techniques[t]},i.clear=function(){this._techniques=[]},i.clone=function(){for(var t=[],i=0;ithis.maxSize||(this._clean(t),e[i][r].push(t),this.count++)}},i.clear=function(){this._pool={},this.count=0},i._clean=function(t){t._owner=null},e}(r.default));r.default.register("material",o);var l=o;i.default=l,e.exports=i.default}),{"../../utils/pool":296,"./utils":82}],81:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n,r=o(t("./CCMaterial")),s=o(t("./effect-variant")),a=o(t("./material-pool"));function o(t){return t&&t.__esModule?t:{default:t}}function l(t,e){for(var i=0;iE&&(E=I),IM&&(M=P),P=0){e.splice(i,1);for(var n=this._contacts,r=n.length-1;r>=0;r--){var o=n[r];o.collider1!==t&&o.collider2!==t||(o.touching&&this._doCollide(s.CollisionExit,o),n.splice(r,1))}t.node.off(a.GROUP_CHANGED,this.onNodeGroupChanged,this)}else cc.errorID(6600)},onNodeGroupChanged:function(t){for(var e=t.getComponents(cc.Collider),i=0,n=e.length;i0){t.moveTo(s[0].x,s[0].y);for(var a=1;ar!=u>r&&n<(c-l)*(r-h)/(u-h)+l&&(i=!i)}return i}function o(t,e,i,n){var r,s=i.x-e.x,a=i.y-e.y,o=s*s+a*a,l=((t.x-e.x)*s+(t.y-e.y)*a)/o;return r=n?o?l<0?e:l>1?i:cc.v2(e.x+l*s,e.y+l*a):e:cc.v2(e.x+l*s,e.y+l*a),s=t.x-r.x,a=t.y-r.y,Math.sqrt(s*s+a*a)}n.lineLine=r,n.lineRect=function(t,e,i){var n=new cc.Vec2(i.x,i.y),s=new cc.Vec2(i.x,i.yMax),a=new cc.Vec2(i.xMax,i.yMax),o=new cc.Vec2(i.xMax,i.y);return!!(r(t,e,n,s)||r(t,e,s,a)||r(t,e,a,o)||r(t,e,o,n))},n.linePolygon=s,n.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,a=e.x,o=e.y,l=e.x+e.width,h=e.y+e.height;return i<=l&&r>=a&&n<=h&&s>=o},n.rectPolygon=function(t,e){var i,n,r=new cc.Vec2(t.x,t.y),o=new cc.Vec2(t.x,t.yMax),l=new cc.Vec2(t.xMax,t.yMax),h=new cc.Vec2(t.xMax,t.y);if(s(r,o,e))return!0;if(s(o,l,e))return!0;if(s(l,h,e))return!0;if(s(h,r,e))return!0;for(i=0,n=e.length;i>>1;r<=s;a=r+s>>>1){var o=t[a],l=o.constructor._executionOrder;if(l>i)s=a-1;else if(ln)s=a-1;else{if(!(h0&&(t.array.sort(c),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(c),this._invoke(e),e.array.length=0)}}),_=cc.Class({extends:h,add:function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=o(i,t);n<0&&i.splice(~n,0,t)}},remove:function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=o(i.array,t);n>=0&&i.removeAt(n)}},invoke:function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)}});function f(t,e,i,n){var r="var a=it.array;for(it.i=0;it.i=0?r.fastRemoveAt(this.scheduleInNextFrame,e):(!t.start||t._objFlags&s||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},enableComp:function(t,e){if(!(t._objFlags&a)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},disableComp:function(t){t._objFlags&a&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},_scheduleImmediate:function(t){!t.start||t._objFlags&s||this.startInvoker.add(t),t.update&&this.updateInvoker.add(t),t.lateUpdate&&this.lateUpdateInvoker.add(t)},_deferredSchedule:function(){for(var t=this.scheduleInNextFrame,e=0,i=t.length;e0&&(this._deferredSchedule(),this.startInvoker.invoke())},startPhase:function(){this._updating=!0,this.scheduleInNextFrame.length>0&&this._deferredSchedule(),this.startInvoker.invoke(),this._earlyStartForNewComps()},updatePhase:function(t){this.updateInvoker.invoke(t)},lateUpdatePhase:function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1},clearup:function(){this._earlyStartForNewComps()}});e.exports=v}),{"./platform/CCClass":209,"./platform/CCObject":215,"./platform/js":229,"./utils/misc":294}],94:[(function(t,e,i){"use strict";var n=t("../../animation/animation-animator"),r=t("../../animation/animation-clip"),s=t("../event/event-target"),a=t("../platform/js"),o=function(t,e){return t===e},l=cc.Enum({PLAY:"play",STOP:"stop",PAUSE:"pause",RESUME:"resume",LASTFRAME:"lastframe",FINISHED:"finished"}),h=cc.Class({name:"cc.Animation",extends:t("./CCComponent"),mixins:[s],editor:!1,statics:{EventType:l},ctor:function(){cc.EventTarget.call(this),this._animator=null,this._nameToState=a.createMap(!0),this._didInit=!1,this._currentClip=null},properties:{_defaultClip:{default:null,type:r},defaultClip:{type:r,get:function(){return this._defaultClip},set:function(t){},tooltip:!1},currentClip:{get:function(){return this._currentClip},set:function(t){this._currentClip=t},type:r,visible:!1},_writableClips:{get:function(){return this._clips},set:function(t){this._didInit=!1,this._clips=t,this._init()},type:[r]},_clips:{default:[],type:[r],tooltip:!1,visible:!0},playOnLoad:{default:!1,tooltip:!1}},start:function(){if(this.playOnLoad&&this._defaultClip&&!(this._animator&&this._animator.isPlaying)){var t=this.getAnimationState(this._defaultClip.name);this._animator.playState(t)}},onEnable:function(){this._animator&&this._animator.resume()},onDisable:function(){this._animator&&this._animator.pause()},onDestroy:function(){this.stop()},getClips:function(){return this._clips},play:function(t,e){var i=this.playAdditive(t,e);return this._animator.stopStatesExcept(i),i},playAdditive:function(t,e){this._init();var i=this.getAnimationState(t||this._defaultClip&&this._defaultClip.name);if(i){this.enabled=!0;var n=this._animator;n.isPlaying&&i.isPlaying?i.isPaused?n.resumeState(i):(n.stopState(i),n.playState(i,e)):n.playState(i,e),this.enabledInHierarchy||n.pause(),this.currentClip=i.clip}return i},stop:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.stopState(e)}else this._animator.stop()},pause:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.pauseState(e)}else this.enabled=!1},resume:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.resumeState(e)}else this.enabled=!0},setCurrentTime:function(t,e){if(this._init(),e){var i=this._nameToState[e];i&&this._animator.setStateTime(i,t)}else this._animator.setStateTime(t)},getAnimationState:function(t){this._init();var e=this._nameToState[t];return e&&!e.curveLoaded&&this._animator._reloadClip(e),e||null},addClip:function(t,e){if(t){this._init(),cc.js.array.contains(this._clips,t)||this._clips.push(t),e=e||t.name;var i=this._nameToState[e];if(i){if(i.clip===t)return i;var n=this._clips.indexOf(i.clip);-1!==n&&this._clips.splice(n,1)}var r=new cc.AnimationState(t,e);return this._nameToState[e]=r,r}cc.warnID(3900)},removeClip:function(t,e){if(t){var i;for(var n in this._init(),this._nameToState)if(i=this._nameToState[n],o(i.clip,t))break;if(t===this._defaultClip){if(!e)return void cc.warnID(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void cc.warnID(3903);this.stop(i.name)}this._clips=this._clips.filter((function(e){return!o(e,t)})),i&&delete this._nameToState[i.name]}else cc.warnID(3901)},sample:function(t){if(this._init(),t){var e=this._nameToState[t];e&&e.sample()}else this._animator.sample()},on:function(t,e,i,n){this._init();var r=this._EventTargetOn(t,e,i,n);if("lastframe"===t){var s=this._nameToState;for(var a in s)s[a]._lastframeEventOn=!0}return r},off:function(t,e,i,n){if(this._init(),"lastframe"===t){var r=this._nameToState;for(var s in r)r[s]._lastframeEventOn=!1}this._EventTargetOff(t,e,i,n)},_init:function(){this._didInit||(this._didInit=!0,this._animator=new n(this.node,this),this._createStates())},_createStates:function(){this._nameToState=a.createMap(!0);for(var t=null,e=!1,i=0;i0&&(i=this.time/this.duration),i>=1&&(i=1),this.transition===s.COLOR){var n=this._fromColor.lerp(this._toColor,i);this._setTargetColor(n)}else this.transition===s.SCALE&&this._originalScale&&(e.scale=this._fromScale.lerp(this._toScale,i));1===i&&(this._transitionFinished=!0)}},_registerNodeEvent:function(){this.node.on(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this),this.node.on(cc.Node.EventType.TOUCH_MOVE,this._onTouchMove,this),this.node.on(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.on(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(cc.Node.EventType.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(cc.Node.EventType.MOUSE_LEAVE,this._onMouseMoveOut,this)},_unregisterNodeEvent:function(){this.node.off(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this),this.node.off(cc.Node.EventType.TOUCH_MOVE,this._onTouchMove,this),this.node.off(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.off(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(cc.Node.EventType.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(cc.Node.EventType.MOUSE_LEAVE,this._onMouseMoveOut,this)},_registerTargetEvent:function(t){t.on(cc.Node.EventType.SCALE_CHANGED,this._onTargetScaleChanged,this)},_unregisterTargetEvent:function(t){t.off(cc.Node.EventType.SCALE_CHANGED,this._onTargetScaleChanged,this)},_getTargetSprite:function(t){var e=null;return t&&(e=t.getComponent(cc.Sprite)),e},_applyTarget:function(){var t=this._getTarget();this._sprite=this._getTargetSprite(t),this._originalScale||(this._originalScale=cc.Vec2.ZERO),this._originalScale.x=t.scaleX,this._originalScale.y=t.scaleY,this._registerTargetEvent(t)},_onTouchBegan:function(t){this.interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t.stopPropagation())},_onTouchMove:function(t){if(this.interactable&&this.enabledInHierarchy&&this._pressed){var e,i=t.touch,n=this.node._hitTest(i.getLocation()),r=this._getTarget(),o=this._originalScale;if(this.transition===s.SCALE&&o)n?(this._fromScale.x=o.x,this._fromScale.y=o.y,this._toScale.x=o.x*this.zoomScale,this._toScale.y=o.y*this.zoomScale,this._transitionFinished=!1):(this.time=0,this._transitionFinished=!0,r.setScale(o.x,o.y));else e=n?a.PRESSED:a.NORMAL,this._applyTransition(e);t.stopPropagation()}},_onTouchEnded:function(t){this.interactable&&this.enabledInHierarchy&&(this._pressed&&(cc.Component.EventHandler.emitEvents(this.clickEvents,t),this.node.emit("click",this)),this._pressed=!1,this._updateState(),t.stopPropagation())},_onTouchCancel:function(){this.interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},_onMouseMoveIn:function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this.transition!==s.SPRITE||this.hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},_onMouseMoveOut:function(){this._hovered&&(this._hovered=!1,this._updateState())},_updateState:function(){var t=this._getButtonState();this._applyTransition(t),this._updateDisabledState()},_getButtonState:function(){return this.interactable?this._pressed?a.PRESSED:this._hovered?a.HOVER:a.NORMAL:a.DISABLED},_updateColorTransitionImmediately:function(t){var e=this._getStateColor(t);this._setTargetColor(e),this._fromColor=e.clone(),this._toColor=e},_updateColorTransition:function(t){if(t===a.DISABLED)this._updateColorTransitionImmediately(t);else{var e=this._getTarget(),i=this._getStateColor(t);this._fromColor=e.color.clone(),this._toColor=i,this.time=0,this._transitionFinished=!1}},_updateSpriteTransition:function(t){var e=this._getStateSprite(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},_updateScaleTransition:function(t){t===a.PRESSED?this._zoomUp():this._zoomBack()},_zoomUp:function(){this._originalScale&&(this._fromScale.x=this._originalScale.x,this._fromScale.y=this._originalScale.y,this._toScale.x=this._originalScale.x*this.zoomScale,this._toScale.y=this._originalScale.y*this.zoomScale,this.time=0,this._transitionFinished=!1)},_zoomBack:function(){if(this._originalScale){var t=this._getTarget();this._fromScale.x=t.scaleX,this._fromScale.y=t.scaleY,this._toScale.x=this._originalScale.x,this._toScale.y=this._originalScale.y,this.time=0,this._transitionFinished=!1}},_updateTransition:function(t){t===s.COLOR?this._updateColorTransitionImmediately(a.NORMAL):t===s.SPRITE&&this._updateSpriteTransition(a.NORMAL),this._updateState()},_applyTransition:function(t){var e=this.transition;e===s.COLOR?this._updateColorTransition(t):e===s.SPRITE?this._updateSpriteTransition(t):e===s.SCALE&&this._updateScaleTransition(t)},_resizeNodeToTargetNode:!1,_updateDisabledState:function(){if(this._sprite){var t=!1;this.enableAutoGrayEffect&&(this.transition===s.SPRITE&&this.disabledSprite||this.interactable||(t=!0)),this._switchGrayMaterial(t,this._sprite)}}});cc.Button=e.exports=o}),{"../utils/gray-sprite-state":290,"./CCComponent":99}],98:[(function(t,e,i){"use strict";var n=t("../camera/CCCamera"),r=t("./CCComponent");var s=cc.Class({name:"cc.Canvas",extends:r,editor:!1,resetInEditor:!1,statics:{instance:null},properties:{_designResolution:cc.size(960,640),designResolution:{get:function(){return cc.size(this._designResolution)},set:function(t){this._designResolution.width=t.width,this._designResolution.height=t.height,this.applySettings()},tooltip:!1},_fitWidth:!1,_fitHeight:!0,fitHeight:{get:function(){return this._fitHeight},set:function(t){this._fitHeight!==t&&(this._fitHeight=t,this.applySettings())},tooltip:!1},fitWidth:{get:function(){return this._fitWidth},set:function(t){this._fitWidth!==t&&(this._fitWidth=t,this.applySettings())},tooltip:!1}},_fitDesignResolution:!1,__preload:function(){if(s.instance)return cc.warnID(6700,this.node.name,s.instance.node.name);s.instance=this,this.applySettings();var t=this.getComponent(cc.Widget);t&&t.updateAlignment();var e=cc.find("Main Camera",this.node);e||((e=new cc.Node("Main Camera")).parent=this.node,e.setSiblingIndex(0));var i=e.getComponent(n);if(!i){i=e.addComponent(n);var r=n.ClearFlags;i.clearFlags=r.COLOR|r.DEPTH|r.STENCIL,i.depth=-1}n.main=i},onDestroy:function(){s.instance===this&&(s.instance=null)},applySettings:function(){var t,e=cc.ResolutionPolicy;t=this.fitHeight&&this.fitWidth?e.SHOW_ALL:this.fitHeight||this.fitWidth?this.fitWidth?e.FIXED_WIDTH:e.FIXED_HEIGHT:e.NO_BORDER;var i=this._designResolution;cc.view.setDesignResolutionSize(i.width,i.height,t)}});cc.Canvas=e.exports=s}),{"../camera/CCCamera":84,"./CCComponent":99}],99:[(function(t,e,i){"use strict";var n=t("../platform/CCObject"),r=t("../platform/js"),s=new(t("../platform/id-generater"))("Comp"),a=(n.Flags.IsOnEnableCalled,n.Flags.IsOnLoadCalled),o=!!cc.ActionManager,l=cc.Class({name:"cc.Component",extends:n,ctor:function(){this._id=s.getNewId(),this.__eventTargets=[]},properties:{node:{default:null,visible:!1},name:{get:function(){if(this._name)return this._name;var t=cc.js.getClassName(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node.name+"<"+t+">"},set:function(t){this._name=t},visible:!1},uuid:{get:function(){return this._id},visible:!1},__scriptAsset:!1,_enabled:!0,enabled:{get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node._activeInHierarchy)){var e=cc.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}},visible:!1,animatable:!0},enabledInHierarchy:{get:function(){return this._enabled&&this.node._activeInHierarchy},visible:!1},_isOnLoadCalled:{get:function(){return this._objFlags&a}}},update:null,lateUpdate:null,__preload:null,onLoad:null,start:null,onEnable:null,onDisable:null,onDestroy:null,onFocusInEditor:null,onLostFocusInEditor:null,resetInEditor:null,addComponent:function(t){return this.node.addComponent(t)},getComponent:function(t){return this.node.getComponent(t)},getComponents:function(t){return this.node.getComponents(t)},getComponentInChildren:function(t){return this.node.getComponentInChildren(t)},getComponentsInChildren:function(t){return this.node.getComponentsInChildren(t)},_getLocalBounds:null,onRestore:null,destroy:function(){this._super()&&this._enabled&&this.node._activeInHierarchy&&cc.director._compScheduler.disableComp(this)},_onPreDestroy:function(){o&&cc.director.getActionManager().removeAllActionsFromTarget(this),this.unscheduleAllCallbacks();for(var t=this.__eventTargets,e=t.length-1;e>=0;--e){var i=t[e];i&&i.targetOff(this)}t.length=0,cc.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},_instantiate:function(t){return t||(t=cc.instantiate._clone(this,this)),t.node=null,t},schedule:function(t,e,i,n){cc.assertID(t,1619),e=e||0,cc.assertID(e>=0,1620),i=isNaN(i)?cc.macro.REPEAT_FOREVER:i,n=n||0;var r=cc.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},scheduleOnce:function(t,e){this.schedule(t,0,0,e)},unschedule:function(t){t&&cc.director.getScheduler().unschedule(t,this)},unscheduleAllCallbacks:function(){cc.director.getScheduler().unscheduleAllForTarget(this)}});l._requireComponent=null,l._executionOrder=0,r.value(l,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),l.prototype.__scriptUuid="",cc.Component=e.exports=l}),{"../platform/CCObject":215,"../platform/id-generater":225,"../platform/js":229}],100:[(function(t,e,i){"use strict";cc.Component.EventHandler=cc.Class({name:"cc.ClickEvent",properties:{target:{default:null,type:cc.Node},component:"",_componentId:"",_componentName:{get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(t){this._componentId=this._compName2Id(t)}},handler:{default:""},customEventData:{default:""}},statics:{emitEvents:function(t){var e;if(arguments.length>0)for(var i=0,n=(e=new Array(arguments.length-1)).length;ip&&(p=m),M>=p&&(m=p,p=M,g=C.getAnchorPoint().y),this.horizontalDirection===l.RIGHT_TO_LEFT&&(w=1-C.anchorX),f=f+c*w*E+c*this.spacingX;var D=c*(1-w)*E;if(e){var B=f+D+c*(c>0?this.paddingRight:this.paddingLeft),I=this.horizontalDirection===l.LEFT_TO_RIGHT&&B>(1-a.x)*t,P=this.horizontalDirection===l.RIGHT_TO_LEFT&&B<-a.x*t;(I||P)&&(M>=p?(0===m&&(m=p),d+=m,m=p):(d+=p,m=M,p=0),f=_+c*(u+w*E),y++)}var R=i(C,d,y);t>=E+this.paddingLeft+this.paddingRight&&n&&C.setPosition(cc.v2(f,R));var O,L=1,F=0===p?M:p;this.verticalDirection===o.TOP_TO_BOTTOM?(v=v||this.node._contentSize.height,(O=R+(L=-1)*(F*g+this.paddingBottom))v&&(v=O)),f+=D}}return v},_getVerticalBaseHeight:function(t){var e=0,i=0;if(this.resizeMode===s.CONTAINER){for(var n=0;np&&(p=m),E>=p&&(m=p,p=E,g=C.getAnchorPoint().x),this.verticalDirection===o.TOP_TO_BOTTOM&&(w=1-C.anchorY),f=f+c*w*M+c*this.spacingY;var D=c*(1-w)*M;if(e){var B=f+D+c*(c>0?this.paddingTop:this.paddingBottom),I=this.verticalDirection===o.BOTTOM_TO_TOP&&B>(1-a.y)*t,P=this.verticalDirection===o.TOP_TO_BOTTOM&&B<-a.y*t;(I||P)&&(E>=p?(0===m&&(m=p),d+=m,m=p):(d+=p,m=E,p=0),f=_+c*(u+w*M),y++)}var R=i(C,d,y);t>=M+(this.paddingTop+this.paddingBottom)&&n&&C.setPosition(cc.v2(R,f));var O,L=1,F=0===p?E:p;this.horizontalDirection===l.RIGHT_TO_LEFT?(L=-1,v=v||this.node._contentSize.width,(O=R+L*(F*g+this.paddingLeft))v&&(v=O)),f+=D}}return v},_doLayoutBasic:function(){for(var t=this.node.children,e=null,i=0;i0&&(this._doLayout(),this._layoutDirty=!1)}});cc.Layout=e.exports=h}),{"../CCNode":51,"./CCComponent":99}],105:[(function(t,e,i){"use strict";var n=o(t("../../renderer/gfx")),r=o(t("../value-types/mat4")),s=o(t("../value-types/vec2")),a=o(t("../assets/material/material-variant"));function o(t){return t&&t.__esModule?t:{default:t}}var l=t("../utils/misc"),h=t("./CCRenderComponent"),c=t("../renderer/render-flow"),u=t("../graphics/graphics"),_=new s.default,f=new r.default,d=[];function p(t,e,i){d.length=0;for(var n=2*Math.PI/i,r=0;r=0&&o.y>=0&&o.x<=n&&o.y<=a;else if(this.type===m.ELLIPSE){var h=n/2,c=a/2,u=o.x-.5*n,d=o.y-.5*a;l=u*u/(h*h)+d*d/(c*c)<1}return this.inverted&&(l=!l),l},markForRender:function(t){var e=c.FLAG_RENDER|c.FLAG_UPDATE_RENDER_DATA|c.FLAG_POST_RENDER;t?(this.node._renderFlag|=e,this.markForValidate()):t||(this.node._renderFlag&=~e)},disableRender:function(){this.node._renderFlag&=~(c.FLAG_RENDER|c.FLAG_UPDATE_RENDER_DATA|c.FLAG_POST_RENDER)}});cc.Mask=e.exports=y}),{"../../renderer/gfx":342,"../assets/material/material-variant":81,"../graphics/graphics":151,"../renderer/render-flow":242,"../utils/misc":294,"../value-types/mat4":311,"../value-types/vec2":318,"./CCRenderComponent":110}],106:[(function(t,e,i){"use strict";var n=t("../components/CCRenderComponent"),r=t("../../core/utils/blend-func"),s=cc.Class({name:"cc.MotionStreak",extends:n,mixins:[r],editor:!1,ctor:function(){this._points=[]},properties:{preview:{default:!1,editorOnly:!0,notify:!1,animatable:!1},_fadeTime:1,fadeTime:{get:function(){return this._fadeTime},set:function(t){this._fadeTime=t,this.reset()},animatable:!1,tooltip:!1},_minSeg:1,minSeg:{get:function(){return this._minSeg},set:function(t){this._minSeg=t},animatable:!1,tooltip:!1},_stroke:64,stroke:{get:function(){return this._stroke},set:function(t){this._stroke=t},animatable:!1,tooltip:!1},_texture:{default:null,type:cc.Texture2D},texture:{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t,this._updateMaterial())},type:cc.Texture2D,animatable:!1,tooltip:!1},_color:cc.Color.WHITE,color:{get:function(){return this._color},set:function(t){this._color=t},type:cc.Color,tooltip:!1},_fastMode:!1,fastMode:{get:function(){return this._fastMode},set:function(t){this._fastMode=t},animatable:!1,tooltip:!1}},onEnable:function(){this._super(),this.reset()},_updateMaterial:function(){var t=this.getMaterial(0);t&&t.setProperty("texture",this._texture),r.prototype._updateMaterial.call(this)},onFocusInEditor:!1,onLostFocusInEditor:!1,reset:function(){this._points.length=0,this._assembler&&this._assembler._renderData.clear()},lateUpdate:function(t){this._assembler&&this._assembler.update(this,t)}});cc.MotionStreak=e.exports=s}),{"../../core/utils/blend-func":287,"../components/CCRenderComponent":110}],107:[(function(t,e,i){"use strict";var n=cc.Enum({Unified:0,Free:1}),r=cc.Enum({Horizontal:0,Vertical:1}),s=cc.Enum({PAGE_TURNING:0}),a=cc.Class({name:"cc.PageView",extends:cc.ScrollView,editor:!1,ctor:function(){this._curPageIdx=0,this._lastPageIdx=0,this._pages=[],this._initContentPos=cc.v2(),this._scrollCenterOffsetX=[],this._scrollCenterOffsetY=[]},properties:{sizeMode:{default:n.Unified,type:n,tooltip:!1,notify:function(){this._syncSizeMode()}},direction:{default:r.Horizontal,type:r,tooltip:!1,notify:function(){this._syncScrollDirection()}},scrollThreshold:{default:.5,type:cc.Float,slide:!0,range:[0,1,.01],tooltip:!1},autoPageTurningThreshold:{default:100,type:cc.Float,tooltip:!1},pageTurningEventTiming:{default:.1,type:cc.Float,range:[0,1,.01],tooltip:!1},indicator:{default:null,type:cc.PageViewIndicator,tooltip:!1,notify:function(){this.indicator&&this.indicator.setPageView(this)}},pageTurningSpeed:{default:.3,type:cc.Float,tooltip:!1},pageEvents:{default:[],type:cc.Component.EventHandler,tooltip:!1}},statics:{SizeMode:n,Direction:r,EventType:s},__preload:function(){this.node.on(cc.Node.EventType.SIZE_CHANGED,this._updateAllPagesSize,this)},onEnable:function(){this._super(),this.node.on("scroll-ended-with-threshold",this._dispatchPageTurningEvent,this)},onDisable:function(){this._super(),this.node.off("scroll-ended-with-threshold",this._dispatchPageTurningEvent,this)},onLoad:function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},onDestroy:function(){this.node.off(cc.Node.EventType.SIZE_CHANGED,this._updateAllPagesSize,this)},getCurrentPageIndex:function(){return this._curPageIdx},setCurrentPageIndex:function(t){this.scrollToPage(t,!0)},getPages:function(){return this._pages},addPage:function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(this.content.addChild(t),this._pages.push(t),this._updatePageView())},insertPage:function(t,e){e<0||!t||-1!==this._pages.indexOf(t)||!this.content||(e>=this._pages.length?this.addPage(t):(this._pages.splice(e,0,t),this.content.addChild(t),this._updatePageView()))},removePage:function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):cc.warnID(4300,t.name)}},removePageAtIndex:function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},removeAllPages:function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(e=void 0!==e?e:.3,this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},getScrollEndedEventTiming:function(){return this.pageTurningEventTiming},_syncScrollDirection:function(){this.horizontal=this.direction===r.Horizontal,this.vertical=this.direction===r.Vertical},_syncSizeMode:function(){if(this.content){var t=this.content.getComponent(cc.Layout);if(t){if(this.sizeMode===n.Free&&this._pages.length>0){var e=this._pages[this._pages.length-1];this.direction===r.Horizontal?(t.paddingLeft=(this._view.width-this._pages[0].width)/2,t.paddingRight=(this._view.width-e.width)/2):this.direction===r.Vertical&&(t.paddingTop=(this._view.height-this._pages[0].height)/2,t.paddingBottom=(this._view.height-e.height)/2)}t.updateLayout()}}},_updatePageView:function(){var t=this.content.getComponent(cc.Layout);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},_dispatchPageTurningEvent:function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,cc.Component.EventHandler.emitEvents(this.pageEvents,this,s.PAGE_TURNING),this.node.emit("page-turning",this))},_isScrollable:function(t,e,i){if(this.sizeMode===n.Free){var s,a;if(this.direction===r.Horizontal)return s=this._scrollCenterOffsetX[e],a=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(s-a)*this.scrollThreshold;if(this.direction===r.Vertical)return s=this._scrollCenterOffsetY[e],a=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(s-a)*this.scrollThreshold}else{if(this.direction===r.Horizontal)return Math.abs(t.x)>=this._view.width*this.scrollThreshold;if(this.direction===r.Vertical)return Math.abs(t.y)>=this._view.height*this.scrollThreshold}},_isQuicklyScrollable:function(t){if(this.direction===r.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===r.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},_moveOffsetValue:function(t){var e=cc.v2(0,0);return this.sizeMode===n.Free?this.direction===r.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===r.Vertical&&(e.y=this._scrollCenterOffsetY[t]):this.direction===r.Horizontal?e.x=t*this._view.width:this.direction===r.Vertical&&(e.y=t*this._view.height),e},_getDragDirection:function(t){return this.direction===r.Horizontal?0===t.x?0:t.x>0?1:-1:this.direction===r.Vertical?0===t.y?0:t.y<0?1:-1:void 0},_handleReleaseLogic:function(t){this._autoScrollToPage(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent("scroll-ended"))},_autoScrollToPage:function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();((t=this._clampDelta(t)).x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=this._touchBeganPosition.sub(this._touchEndPosition),i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}}});cc.PageViewIndicator=e.exports=r}),{"./CCComponent":99}],109:[(function(t,e,i){"use strict";var n=t("../utils/misc"),r=t("./CCComponent"),s=cc.Enum({HORIZONTAL:0,VERTICAL:1,FILLED:2}),a=cc.Class({name:"cc.ProgressBar",extends:r,editor:!1,_initBarSprite:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e=this.node.getContentSize(),i=this.node.getAnchorPoint(),n=t.getContentSize();t.parent===this.node&&this.node.setContentSize(n),this.barSprite.fillType===cc.Sprite.FillType.RADIAL&&(this.mode=s.FILLED);var r=t.getContentSize();if(this.mode===s.HORIZONTAL?this.totalLength=r.width:this.mode===s.VERTICAL?this.totalLength=r.height:this.totalLength=this.barSprite.fillRange,t.parent===this.node){var a=-e.width*i.x;t.setPosition(cc.v2(a,0))}}},_updateBarStatus:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e,i,r,a=t.getAnchorPoint(),o=t.getContentSize(),l=t.getPosition(),h=cc.v2(0,.5),c=n.clamp01(this.progress),u=this.totalLength*c;switch(this.mode){case s.HORIZONTAL:this.reverse&&(h=cc.v2(1,.5)),e=cc.size(u,o.height),i=this.totalLength,r=o.height;break;case s.VERTICAL:h=this.reverse?cc.v2(.5,1):cc.v2(.5,0),e=cc.size(o.width,u),i=o.width,r=this.totalLength}if(this.mode===s.FILLED)this.barSprite.type!==cc.Sprite.Type.FILLED?cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this.reverse&&(u*=-1),this.barSprite.fillRange=u);else if(this.barSprite.type!==cc.Sprite.Type.FILLED){var _=h.x-a.x,f=h.y-a.y,d=cc.v2(i*_,r*f);t.setPosition(l.x+d.x,l.y+d.y),t.setAnchorPoint(h),t.setContentSize(e)}else cc.warn("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")}},properties:{barSprite:{default:null,type:cc.Sprite,tooltip:!1,notify:function(){this._initBarSprite()},animatable:!1},mode:{default:s.HORIZONTAL,type:s,tooltip:!1,notify:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e=t.getContentSize();this.mode===s.HORIZONTAL?this.totalLength=e.width:this.mode===s.VERTICAL?this.totalLength=e.height:this.mode===s.FILLED&&(this.totalLength=this.barSprite.fillRange)}},animatable:!1},_N$totalLength:1,totalLength:{range:[0,Number.MAX_VALUE],tooltip:!1,get:function(){return this._N$totalLength},set:function(t){this.mode===s.FILLED&&(t=n.clamp01(t)),this._N$totalLength=t,this._updateBarStatus()}},progress:{default:1,type:cc.Float,range:[0,1,.1],slide:!0,tooltip:!1,notify:function(){this._updateBarStatus()}},reverse:{default:!1,tooltip:!1,notify:function(){this.barSprite&&(this.barSprite.fillStart=1-this.barSprite.fillStart),this._updateBarStatus()},animatable:!1}},statics:{Mode:s}});cc.ProgressBar=e.exports=a}),{"../utils/misc":294,"./CCComponent":99}],110:[(function(t,e,i){"use strict";var n=s(t("../renderer/assembler")),r=s(t("../assets/material/material-variant"));function s(t){return t&&t.__esModule?t:{default:t}}var a=t("./CCComponent"),o=t("../renderer/render-flow"),l=t("../assets/material/CCMaterial"),h=cc.Class({name:"RenderComponent",extends:a,editor:!1,properties:{_materials:{default:[],type:l},materials:{get:function(){return this._materials},set:function(t){this._materials=t,this._activateMaterial()},type:[l],displayName:"Materials",animatable:!1}},ctor:function(){this._vertsDirty=!0,this._assembler=null},_resetAssembler:function(){n.default.init(this),this._updateColor(),this.setVertsDirty()},__preload:function(){this._resetAssembler(),this._activateMaterial()},onEnable:function(){this.node._renderComponent&&(this.node._renderComponent.enabled=!1),this.node._renderComponent=this,this.node._renderFlag|=o.FLAG_OPACITY_COLOR,this.setVertsDirty()},onDisable:function(){this.node._renderComponent=null,this.disableRender()},onDestroy:function(){for(var t=this._materials,e=0;e=this._materials.length)return null;var e=this._materials[t];if(!e)return null;var i=r.default.create(e,this);return i!==e&&this.setMaterial(t,i),i},getMaterials:function(){for(var t=this._materials,e=0;eRichText",multiline:!0,tooltip:!1,notify:function(){this._updateRichTextStatus()}},horizontalAlign:{default:o.LEFT,type:o,tooltip:!1,animatable:!1,notify:function(t){this.horizontalAlign!==t&&(this._layoutDirty=!0,this._updateRichTextStatus())}},fontSize:{default:40,tooltip:!1,notify:function(t){this.fontSize!==t&&(this._layoutDirty=!0,this._updateRichTextStatus())}},_fontFamily:"Arial",fontFamily:{tooltip:!1,get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())},animatable:!1},font:{default:null,type:cc.TTFFont,tooltip:!1,notify:function(t){this.font!==t&&(this._layoutDirty=!0,this.font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},_isSystemFontUsed:!0,useSystemFont:{get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())},animatable:!1,tooltip:!1},cacheMode:{default:h.NONE,type:h,tooltip:!1,notify:function(t){this.cacheMode!==t&&this._updateRichTextStatus()},animatable:!1},maxWidth:{default:0,tooltip:!1,notify:function(t){this.maxWidth!==t&&(this._layoutDirty=!0,this._updateRichTextStatus())}},lineHeight:{default:40,tooltip:!1,notify:function(t){this.lineHeight!==t&&(this._layoutDirty=!0,this._updateRichTextStatus())}},imageAtlas:{default:null,type:cc.SpriteAtlas,tooltip:!1,notify:function(t){this.imageAtlas!==t&&(this._layoutDirty=!0,this._updateRichTextStatus())}},handleTouchEvent:{default:!0,tooltip:!1,notify:function(t){this.handleTouchEvent!==t&&this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners())}}},statics:{HorizontalAlign:o,VerticalAlign:l},onEnable:function(){this.handleTouchEvent&&this._addEventListeners(),this._updateRichText(),this._activateChildren(!0)},onDisable:function(){this.handleTouchEvent&&this._removeEventListeners(),this._activateChildren(!1)},start:function(){this._onTTFLoaded()},_onColorChanged:function(t){this.node.children.forEach((function(e){e.color=t}))},_addEventListeners:function(){this.node.on(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.on(cc.Node.EventType.COLOR_CHANGED,this._onColorChanged,this)},_removeEventListeners:function(){this.node.off(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.off(cc.Node.EventType.COLOR_CHANGED,this._onColorChanged,this)},_updateLabelSegmentTextAttributes:function(){this._labelSegments.forEach(function(t){this._applyTextAttribute(t,null,!0)}.bind(this))},_createFontLabel:function(t){return c.get(t,this)},_onTTFLoaded:function(){if(this.font instanceof cc.TTFFont)if(this.font._nativeAsset)this._layoutDirty=!0,this._updateRichText();else{var t=this;cc.loader.load(this.font.nativeUrl,(function(e,i){t._layoutDirty=!0,t._updateRichText()}))}else this._layoutDirty=!0,this._updateRichText()},_measureText:function(t,e){var i=this,n=function(e){var n;return 0===i._labelSegmentsCache.length?(n=i._createFontLabel(e),i._labelSegmentsCache.push(n)):n=i._labelSegmentsCache[0],n._styleIndex=t,i._applyTextAttribute(n,e,!0),n.getContentSize().width};return e?n(e):n},_onTouchEnded:function(t){for(var e=this,i=this.node.getComponents(cc.Component),n=function(n){var r=e._labelSegments[n],s=r._clickHandler,a=r._clickParam;s&&e._containsTouchLocation(r,t.touch.getLocation())&&(i.forEach((function(e){e.enabledInHierarchy&&e[s]&&e[s](t,a)})),t.stopPropagation())},r=0;r=0;e--){var i=t[e];"RICHTEXT_CHILD"!==i.name&&"RICHTEXT_Image_CHILD"!==i.name||(i.parent===this.node?i.parent=null:t.splice(e,1),"RICHTEXT_CHILD"===i.name&&c.put(i))}this._labelSegments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},onRestore:!1,_activateChildren:function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];"RICHTEXT_CHILD"!==i.name&&"RICHTEXT_Image_CHILD"!==i.name||(i.active=t)}},_addLabelSegment:function(t,e){var i;return(i=0===this._labelSegmentsCache.length?this._createFontLabel(t):this._labelSegmentsCache.pop())._styleIndex=e,i._lineCount=this._lineCount,i.active=this.node.active,i.setAnchorPoint(0,0),this._applyTextAttribute(i,t),this.node.addChild(i),this._labelSegments.push(i),i},_updateRichTextWithMaxWidth:function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this.maxWidth)for(var r=0;this._lineOffsetX<=this.maxWidth;){var a=this._getFirstWordLen(t,r,t.length),o=t.substr(r,a),l=this._measureText(i,o);if(!(this._lineOffsetX+l<=this.maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=l,r+=a}if(n>this.maxWidth)for(var c=s.fragmentText(t,n,this.maxWidth,this._measureText(i)),u=0;u1&&u0?(o*=a=c/l,l*=a):(o*=a=this.lineHeight/l,l*=a),h>0&&(o=h),this.maxWidth>0?(this._lineOffsetX+o>this.maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.spriteFrame=i,n.setContentSize(o,l),n._lineCount=this._lineCount,t.style.event?(t.style.event.click&&(n._clickHandler=t.style.event.click),t.style.event.param?n._clickParam=t.style.event.param:n._clickParam=""):n._clickHandler=null}else cc.warnID(4400)},_updateRichText:function(){if(this.enabledInHierarchy){var t=a.parse(this.string);if(!this._needsUpdateTextLayout(t))return this._textArray=t,void this._updateLabelSegmentTextAttributes();this._textArray=t,this._resetState();for(var e,i=!1,n=0;n0){var u=this._measureText(n,c);this._updateRichTextWithMaxWidth(c,u,n),l.length>1&&hthis._labelWidth&&(this._labelWidth=this._lineOffsetX),l.length>1&&h0&&(this._labelWidth=this.maxWidth),this._labelHeight=(this._lineCount+s.BASELINE_RATIO)*this.lineHeight,this.node.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},_getFirstWordLen:function(t,e,i){var n=t.charAt(e);if(s.isUnicodeCJK(n)||s.isUnicodeSpace(n))return 1;for(var r=1,a=e+1;ae&&(t=0,e=a);var l=0;switch(this.horizontalAlign){case o.LEFT:l=-this._labelWidth/2;break;case o.CENTER:l=-this._linesWidth[a-1]/2;break;case o.RIGHT:l=this._labelWidth/2-this._linesWidth[a-1]}r.x=t+l;var h=r.getContentSize();if(r.y=this.lineHeight*(i-a)-this._labelHeight/2,a===e&&(t+=h.width),r.getComponent(cc.Sprite)){var c=this.lineHeight,u=this.lineHeight*(1+s.BASELINE_RATIO);switch(r.anchorY){case 1:r.y+=c+(u-c)/2;break;case.5:r.y+=u/2;break;default:r.y+=(u-c)/2}if(r._imageOffset){var _=r._imageOffset.split(",");if(1===_.length&&_[0]){var f=parseFloat(_[0]);Number.isInteger(f)&&(r.y+=f)}else if(2===_.length){var d=parseFloat(_[0]),p=parseFloat(_[1]);Number.isInteger(d)&&(r.x+=d),Number.isInteger(p)&&(r.y+=p)}}}var m=r.getComponent(cc.LabelOutline);m&&m.width&&(r.y=r.y-m.width)}},_convertLiteralColorValue:function(t){var e=t.toUpperCase();return cc.Color[e]?cc.Color[e]:cc.color().fromHEX(t)},_applyTextAttribute:function(t,e,i){var n=t.getComponent(cc.Label);if(n){var r=t._styleIndex,s=null;if(this._textArray[r]&&(s=this._textArray[r].style),s&&s.color?t.color=this._convertLiteralColorValue(s.color):t.color=this.node.color,n.cacheMode=this.cacheMode,this.font instanceof cc.Font&&!this._isSystemFontUsed?n.font=this.font:n.fontFamily=this.fontFamily,n.useSystemFont=this._isSystemFontUsed,n.lineHeight=this.lineHeight,n.enableBold=s&&s.bold,n.enableItalics=s&&s.italic,s&&s.italic&&(t.skewX=12),n.enableUnderline=s&&s.underline,s&&s.outline){var a=t.getComponent(cc.LabelOutline);a||(a=t.addComponent(cc.LabelOutline)),a.color=this._convertLiteralColorValue(s.outline.color),a.width=s.outline.width}s&&s.size?n.fontSize=s.size:n.fontSize=this.fontSize,null!==e&&("string"!=typeof e&&(e=""+e),n.string=e),i&&n._forceUpdateRenderData(),s&&s.event?(s.event.click&&(t._clickHandler=s.event.click),s.event.param?t._clickParam=s.event.param:t._clickParam=""):t._clickHandler=null}},onDestroy:function(){for(var t=0;t0?n:-n)),i*(e/r)},_calculatePosition:function(t,e,i,s,a,o){var l=t-e;a&&(l+=Math.abs(a));var h=0;l&&(h=s/l,h=n.clamp01(h));var c=(i-o)*h;return this.direction===r.VERTICAL?cc.v2(0,c):cc.v2(c,0)},_updateLength:function(t){if(this.handle){var e=this.handle.node,i=e.getContentSize();e.setAnchorPoint(cc.v2(0,0)),this.direction===r.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},_processAutoHide:function(t){if(this.enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this.autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this.autoHideTime);this._setOpacity(e)}},start:function(){this.enableAutoHide&&this._setOpacity(0)},hide:function(){this._autoHideRemainingTime=0,this._setOpacity(0)},show:function(){this._autoHideRemainingTime=this.autoHideTime,this._setOpacity(this._opacity)},update:function(t){this._processAutoHide(t)}});cc.Scrollbar=e.exports=s}),{"../utils/misc":294,"./CCComponent":99}],113:[(function(t,e,i){"use strict";var n=t("../CCNode").EventType,r=cc.v2(),s=cc.v2(),a=function(t){return(t-=1)*t*t*t*t+1},o=function(){return(new Date).getMilliseconds()},l=cc.Enum({SCROLL_TO_TOP:0,SCROLL_TO_BOTTOM:1,SCROLL_TO_LEFT:2,SCROLL_TO_RIGHT:3,SCROLLING:4,BOUNCE_TOP:5,BOUNCE_BOTTOM:6,BOUNCE_LEFT:7,BOUNCE_RIGHT:8,SCROLL_ENDED:9,TOUCH_UP:10,AUTOSCROLL_ENDED_WITH_THRESHOLD:11,SCROLL_BEGAN:12}),h={"scroll-to-top":l.SCROLL_TO_TOP,"scroll-to-bottom":l.SCROLL_TO_BOTTOM,"scroll-to-left":l.SCROLL_TO_LEFT,"scroll-to-right":l.SCROLL_TO_RIGHT,scrolling:l.SCROLLING,"bounce-bottom":l.BOUNCE_BOTTOM,"bounce-left":l.BOUNCE_LEFT,"bounce-right":l.BOUNCE_RIGHT,"bounce-top":l.BOUNCE_TOP,"scroll-ended":l.SCROLL_ENDED,"touch-up":l.TOUCH_UP,"scroll-ended-with-threshold":l.AUTOSCROLL_ENDED_WITH_THRESHOLD,"scroll-began":l.SCROLL_BEGAN},c=cc.Class({name:"cc.ScrollView",extends:t("./CCViewGroup"),editor:!1,ctor:function(){this._topBoundary=0,this._bottomBoundary=0,this._leftBoundary=0,this._rightBoundary=0,this._touchMoveDisplacements=[],this._touchMoveTimeDeltas=[],this._touchMovePreviousTimestamp=0,this._touchMoved=!1,this._autoScrolling=!1,this._autoScrollAttenuate=!1,this._autoScrollStartPosition=cc.v2(0,0),this._autoScrollTargetDelta=cc.v2(0,0),this._autoScrollTotalTime=0,this._autoScrollAccumulatedTime=0,this._autoScrollCurrentlyOutOfBoundary=!1,this._autoScrollBraking=!1,this._autoScrollBrakingStartPosition=cc.v2(0,0),this._outOfBoundaryAmount=cc.v2(0,0),this._outOfBoundaryAmountDirty=!0,this._stopMouseWheel=!1,this._mouseWheelEventElapsedTime=0,this._isScrollEndedWithThresholdEventFired=!1,this._scrollEventEmitMask=0,this._isBouncing=!1,this._scrolling=!1},properties:{content:{default:void 0,type:cc.Node,tooltip:!1,formerlySerializedAs:"content",notify:function(t){this._calculateBoundary()}},horizontal:{default:!0,animatable:!1,tooltip:!1},vertical:{default:!0,animatable:!1,tooltip:!1},inertia:{default:!0,tooltip:!1},brake:{default:.5,type:cc.Float,range:[0,1,.1],tooltip:!1},elastic:{default:!0,animatable:!1,tooltip:!1},bounceDuration:{default:1,range:[0,10],tooltip:!1},horizontalScrollBar:{default:void 0,type:cc.Scrollbar,tooltip:!1,notify:function(){this.horizontalScrollBar&&(this.horizontalScrollBar.setTargetScrollView(this),this._updateScrollBar(0))},animatable:!1},verticalScrollBar:{default:void 0,type:cc.Scrollbar,tooltip:!1,notify:function(){this.verticalScrollBar&&(this.verticalScrollBar.setTargetScrollView(this),this._updateScrollBar(0))},animatable:!1},scrollEvents:{default:[],type:cc.Component.EventHandler,tooltip:!1},cancelInnerEvents:{default:!0,animatable:!1,tooltip:!1},_view:{get:function(){if(this.content)return this.content.parent}}},statics:{EventType:l},scrollToBottom:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i,!0)},scrollToTop:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,1),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToTopLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToTopRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToBottomLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToBottomRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToOffset:function(t,e,i){var n=this.getMaxScrollOffset(),r=cc.v2(0,0);0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},getScrollOffset:function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return cc.v2(e,t)},getMaxScrollOffset:function(){var t=this._view.getContentSize(),e=this.content.getContentSize(),i=e.width-t.width,n=e.height-t.height;return i=i>=0?i:0,n=n>=0?n:0,cc.v2(i,n)},scrollToPercentHorizontal:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},scrollTo:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},scrollToPercentVertical:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},stopAutoScroll:function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},setContentPosition:function(t){t.fuzzyEquals(this.getContentPosition(),1e-4)||(this.content.setPosition(t),this._outOfBoundaryAmountDirty=!0)},getContentPosition:function(){return this.content.getPosition()},isScrolling:function(){return this._scrolling},isAutoScrolling:function(){return this._autoScrolling},_registerEvent:function(){this.node.on(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(cc.Node.EventType.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(cc.Node.EventType.MOUSE_WHEEL,this._onMouseWheel,this,!0)},_unregisterEvent:function(){this.node.off(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(cc.Node.EventType.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(cc.Node.EventType.MOUSE_WHEEL,this._onMouseWheel,this,!0)},_onMouseWheel:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=cc.v2(0,0),n=-.1;0,this.vertical?i=cc.v2(0,t.getScrollY()*n):this.horizontal&&(i=cc.v2(t.getScrollY()*n,0)),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60),this._stopMouseWheel=!0),this._stopPropagationIfTargetIsMe(t)}},_checkMouseWheel:function(t){if(!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent("scroll-ended"),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent("scroll-ended"),this._stopMouseWheel=!1)},_calculateMovePercentDelta:function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e=e.clampf(cc.v2(0,0),cc.v2(1,1));var r=this._view.getContentSize(),s=this.content.getContentSize(),a=this._getContentBottomBoundary()-this._bottomBoundary;a=-a;var o=this._getContentLeftBoundary()-this._leftBoundary;o=-o;var l=cc.v2(0,0),h=0;return i&&(h=s.width-r.width,l.x=o-h*e.x),n&&(h=s.height-r.height,l.y=a-h*e.y),l},_moveContentToTopLeft:function(t){var e=this.content.getContentSize(),i=this._getContentBottomBoundary()-this._bottomBoundary;i=-i;var n=cc.v2(0,0),r=0,s=this._getContentLeftBoundary()-this._leftBoundary;s=-s,e.height7&&!this._touchMoved&&t.target!==this.node){var n=new cc.Event.EventTouch(t.getTouches(),t.bubbles);n.type=cc.Node.EventType.TOUCH_CANCEL,n.touch=t.touch,n.simulate=!0,t.target.dispatchEvent(n),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},_onTouchEnded:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent("touch-up");var i=t.touch;this.content&&this._handleReleaseLogic(i),this._touchMoved?t.stopPropagation():this._stopPropagationIfTargetIsMe(t)}},_onTouchCancelled:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){if(!t.simulate){var i=t.touch;this.content&&this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},_processDeltaMove:function(t){this._scrollChildren(t),this._gatherTouchMove(t)},_getLocalAxisAlignDelta:function(t){return this.node.convertToNodeSpaceAR(t.getLocation(),r),this.node.convertToNodeSpaceAR(t.getPreviousLocation(),s),r.sub(s)},_handleMoveLogic:function(t){var e=this._getLocalAxisAlignDelta(t);this._processDeltaMove(e)},_scrollChildren:function(t){var e,i=t=this._clampDelta(t);this.elastic&&(e=this._getHowMuchOutOfBoundary(),i.x*=0===e.x?1:.5,i.y*=0===e.y?1:.5),this.elastic||(e=this._getHowMuchOutOfBoundary(i),i=i.add(e));var n=-1;if(i.y>0)this.content.y-this.content.anchorY*this.content.height+i.y>=this._bottomBoundary&&(n="scroll-to-bottom");else if(i.y<0){this.content.y-this.content.anchorY*this.content.height+this.content.height+i.y<=this._topBoundary&&(n="scroll-to-top")}if(i.x<0)this.content.x-this.content.anchorX*this.content.width+this.content.width+i.x<=this._rightBoundary&&(n="scroll-to-right");else if(i.x>0){this.content.x-this.content.anchorX*this.content.width+i.x>=this._leftBoundary&&(n="scroll-to-left")}this._moveContent(i,!1),0===i.x&&0===i.y||(this._scrolling||(this._scrolling=!0,this._dispatchEvent("scroll-began")),this._dispatchEvent("scrolling")),-1!==n&&this._dispatchEvent(n)},_handlePressLogic:function(){this._autoScrolling&&this._dispatchEvent("scroll-ended"),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=o(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},_clampDelta:function(t){var e=this.content.getContentSize(),i=this._view.getContentSize();return e.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(t);var e=o();this._touchMoveTimeDeltas.push((e-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=e},_startBounceBackIfNeeded:function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if((t=this._clampDelta(t)).fuzzyEquals(cc.v2(0,0),1e-4))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent("bounce-top"),t.y<0&&this._dispatchEvent("bounce-bottom"),t.x>0&&this._dispatchEvent("bounce-right"),t.x<0&&this._dispatchEvent("bounce-left"),this._isBouncing=!0),!0},_processInertiaScroll:function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.fuzzyEquals(cc.v2(0,0),1e-4)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},_handleReleaseLogic:function(t){var e=this._getLocalAxisAlignDelta(t);this._gatherTouchMove(e),this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent("scroll-ended"))},_isOutOfBoundary:function(){return!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4)},_isNecessaryAutoScrollBrake:function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,this._autoScrollBrakingStartPosition=this.getContentPosition(),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},getScrollEndedEventTiming:function(){return 1e-4},_processAutoScrolling:function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=a(n));var r=this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(n)),s=Math.abs(n-1)<=1e-4;if(Math.abs(n-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent("scroll-ended-with-threshold"),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var o=r.sub(this._autoScrollBrakingStartPosition);e&&(o=o.mul(i)),r=this._autoScrollBrakingStartPosition.add(o)}else{var l=r.sub(this.getContentPosition()),h=this._getHowMuchOutOfBoundary(l);h.fuzzyEquals(cc.v2(0,0),1e-4)||(r=r.add(h),s=!0)}s&&(this._autoScrolling=!1);var c=r.sub(this.getContentPosition());this._moveContent(this._clampDelta(c),s),this._dispatchEvent("scrolling"),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent("scroll-ended"))},_startInertiaScroll:function(t){var e=t.mul(.7);this._startAttenuatingAutoScroll(e,t)},_calculateAttenuatedFactor:function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},_startAttenuatingAutoScroll:function(t,e){var i=this._calculateAutoScrollTimeByInitalSpeed(e.mag()),n=t.normalize(),r=this.content.getContentSize(),s=this._view.getContentSize(),a=r.width-s.width,o=r.height-s.height,l=this._calculateAttenuatedFactor(a),h=this._calculateAttenuatedFactor(o);n=cc.v2(n.x*a*(1-this.brake)*l,n.y*o*h*(1-this.brake));var c=t.mag(),u=n.mag()/c;n=n.add(t),this.brake>0&&u>7&&(u=Math.sqrt(u),n=t.mul(u).add(t)),this.brake>0&&u>3&&(i*=u=3),0===this.brake&&u>1&&(i*=u),this._startAutoScroll(n,i,!0)},_calculateAutoScrollTimeByInitalSpeed:function(t){return Math.sqrt(Math.sqrt(t/5))},_startAutoScroll:function(t,e,i){var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,this._autoScrollStartPosition=this.getContentPosition(),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition=cc.v2(0,0),this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4)||(this._autoScrollCurrentlyOutOfBoundary=!0)},_calculateTouchMoveVelocity:function(){var t=0;if((t=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),t))<=0||t>=.5)return cc.v2(0,0);var e=cc.v2(0,0);return e=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e)}),e),cc.v2(e.x*(1-this.brake)/t,e.y*(1-this.brake)/t)},_flattenVectorByDirection:function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},_moveContent:function(t,e){var i=this._flattenVectorByDirection(t),n=this.getContentPosition().add(i);this.setContentPosition(n);var r=this._getHowMuchOutOfBoundary();this._updateScrollBar(r),this.elastic&&e&&this._startBounceBackIfNeeded()},_getContentLeftBoundary:function(){return this.getContentPosition().x-this.content.getAnchorPoint().x*this.content.getContentSize().width},_getContentRightBoundary:function(){var t=this.content.getContentSize();return this._getContentLeftBoundary()+t.width},_getContentTopBoundary:function(){var t=this.content.getContentSize();return this._getContentBottomBoundary()+t.height},_getContentBottomBoundary:function(){return this.getContentPosition().y-this.content.getAnchorPoint().y*this.content.getContentSize().height},_getHowMuchOutOfBoundary:function(t){if((t=t||cc.v2(0,0)).fuzzyEquals(cc.v2(0,0),1e-4)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=cc.v2(0,0);return this._getContentLeftBoundary()+t.x>this._leftBoundary?e.x=this._leftBoundary-(this._getContentLeftBoundary()+t.x):this._getContentRightBoundary()+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(this._getContentBottomBoundary()+t.y)),t.fuzzyEquals(cc.v2(0,0),1e-4)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),e=this._clampDelta(e)},_updateScrollBarState:function(){if(this.content){var t=this.content.getContentSize(),e=this._view.getContentSize();this.verticalScrollBar&&(t.height0&&t[0].check()}},onEnable:function(){this.node.on("child-added",this._allowOnlyOneToggleChecked,this),this.node.on("child-removed",this._makeAtLeastOneToggleChecked,this)},onDisable:function(){this.node.off("child-added",this._allowOnlyOneToggleChecked,this),this.node.off("child-removed",this._makeAtLeastOneToggleChecked,this)},start:function(){this._makeAtLeastOneToggleChecked()}});t("../platform/js").get(n.prototype,"toggleItems",(function(){return this.node.getComponentsInChildren(cc.Toggle)})),cc.ToggleContainer=e.exports=n}),{"../platform/js":229}],119:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.ToggleGroup",extends:cc.Component,ctor:function(){this._toggleItems=[]},editor:!1,properties:{allowSwitchOff:{tooltip:!1,default:!1},toggleItems:{get:function(){return this._toggleItems}}},updateToggles:function(t){this.enabledInHierarchy&&this._toggleItems.forEach((function(e){t.isChecked&&e!==t&&e.isChecked&&e.enabled&&e._hideCheckMark()}))},addToggle:function(t){-1===this._toggleItems.indexOf(t)&&this._toggleItems.push(t),this._allowOnlyOneToggleChecked()},removeToggle:function(t){var e=this._toggleItems.indexOf(t);e>-1&&this._toggleItems.splice(e,1),this._makeAtLeastOneToggleChecked()},_allowOnlyOneToggleChecked:function(){var t=!1;return this._toggleItems.forEach((function(e){t&&e.enabled&&e._hideCheckMark(),e.isChecked&&e.enabled&&(t=!0)})),t},_makeAtLeastOneToggleChecked:function(){this._allowOnlyOneToggleChecked()||this.allowSwitchOff||this._toggleItems.length>0&&(this._toggleItems[0].isChecked=!0)},start:function(){this._makeAtLeastOneToggleChecked()}}),r=!1;t("../platform/js").get(cc,"ToggleGroup",(function(){return r||(cc.errorID(1405,"cc.ToggleGroup","cc.ToggleContainer"),r=!0),n})),e.exports=n}),{"../platform/js":229}],120:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.ViewGroup",extends:t("./CCComponent")});cc.ViewGroup=e.exports=n}),{"./CCComponent":99}],121:[(function(t,e,i){"use strict";var n=t("../base-ui/CCWidgetManager"),r=n.AlignMode,s=n._AlignFlags,a=s.TOP,o=s.MID,l=s.BOT,h=s.LEFT,c=s.CENTER,u=s.RIGHT,_=a|l,f=h|u,d=cc.Class({name:"cc.Widget",extends:t("./CCComponent"),editor:!1,properties:{target:{get:function(){return this._target},set:function(t){this._target=t},type:cc.Node,tooltip:!1},isAlignTop:{get:function(){return(this._alignFlags&a)>0},set:function(t){this._setAlign(a,t)},animatable:!1,tooltip:!1},isAlignVerticalCenter:{get:function(){return(this._alignFlags&o)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=o):this._alignFlags&=~o},animatable:!1,tooltip:!1},isAlignBottom:{get:function(){return(this._alignFlags&l)>0},set:function(t){this._setAlign(l,t)},animatable:!1,tooltip:!1},isAlignLeft:{get:function(){return(this._alignFlags&h)>0},set:function(t){this._setAlign(h,t)},animatable:!1,tooltip:!1},isAlignHorizontalCenter:{get:function(){return(this._alignFlags&c)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=c):this._alignFlags&=~c},animatable:!1,tooltip:!1},isAlignRight:{get:function(){return(this._alignFlags&u)>0},set:function(t){this._setAlign(u,t)},animatable:!1,tooltip:!1},isStretchWidth:{get:function(){return(this._alignFlags&f)===f},visible:!1},isStretchHeight:{get:function(){return(this._alignFlags&_)===_},visible:!1},top:{get:function(){return this._top},set:function(t){this._top=t},tooltip:!1},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t},tooltip:!1},left:{get:function(){return this._left},set:function(t){this._left=t},tooltip:!1},right:{get:function(){return this._right},set:function(t){this._right=t},tooltip:!1},horizontalCenter:{get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t},tooltip:!1},verticalCenter:{get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t},tooltip:!1},isAbsoluteHorizontalCenter:{get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter=t},animatable:!1},isAbsoluteVerticalCenter:{get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter=t},animatable:!1},isAbsoluteTop:{get:function(){return this._isAbsTop},set:function(t){this._isAbsTop=t},animatable:!1},isAbsoluteBottom:{get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom=t},animatable:!1},isAbsoluteLeft:{get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft=t},animatable:!1},isAbsoluteRight:{get:function(){return this._isAbsRight},set:function(t){this._isAbsRight=t},animatable:!1},alignMode:{default:r.ON_WINDOW_RESIZE,type:r,tooltip:!1},_wasAlignOnce:{default:void 0,formerlySerializedAs:"isAlignOnce"},_target:null,_alignFlags:0,_left:0,_right:0,_top:0,_bottom:0,_verticalCenter:0,_horizontalCenter:0,_isAbsLeft:!0,_isAbsRight:!0,_isAbsTop:!0,_isAbsBottom:!0,_isAbsHorizontalCenter:!0,_isAbsVerticalCenter:!0,_originalWidth:0,_originalHeight:0},statics:{AlignMode:r},onLoad:function(){void 0!==this._wasAlignOnce&&(this.alignMode=this._wasAlignOnce?r.ONCE:r.ALWAYS,this._wasAlignOnce=void 0)},onEnable:function(){n.add(this)},onDisable:function(){n.remove(this)},_validateTargetInDEV:!1,_setAlign:function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&f)>0;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=this.node.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=this.node.height))):(i?this.isStretchWidth&&(this.node.width=this._originalWidth):this.isStretchHeight&&(this.node.height=this._originalHeight),this._alignFlags&=~t)}},updateAlignment:function(){n.updateAlignment(this.node)}});Object.defineProperty(d.prototype,"isAlignOnce",{get:function(){return this.alignMode===r.ONCE},set:function(t){this.alignMode=t?r.ONCE:r.ALWAYS}}),cc.Widget=e.exports=d}),{"../base-ui/CCWidgetManager":83,"./CCComponent":99}],122:[(function(t,e,i){"use strict";var n=t("../../platform/CCMacro"),r=t("../editbox/EditBoxImplBase"),s=t("../CCLabel"),a=t("./types"),o=a.InputMode,l=a.InputFlag,h=a.KeyboardReturnType;function c(t){return t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()}))}function u(t){return t.charAt(0).toUpperCase()+t.slice(1)}var _=cc.Class({name:"cc.EditBox",extends:cc.Component,editor:!1,properties:{_useOriginalSize:!0,_string:"",string:{tooltip:!1,get:function(){return this._string},set:function(t){t=""+t,this.maxLength>=0&&t.length>=this.maxLength&&(t=t.slice(0,this.maxLength)),this._string=t,this._updateString(t)}},textLabel:{tooltip:!1,default:null,type:s,notify:function(t){this.textLabel&&this.textLabel!==t&&(this._updateTextLabel(),this._updateLabels())}},placeholderLabel:{tooltip:!1,default:null,type:s,notify:function(t){this.placeholderLabel&&this.placeholderLabel!==t&&(this._updatePlaceholderLabel(),this._updateLabels())}},background:{tooltip:!1,default:null,type:cc.Sprite,notify:function(t){this.background&&this.background!==t&&this._updateBackgroundSprite()}},_N$backgroundImage:{default:void 0,type:cc.SpriteFrame},backgroundImage:{get:function(){return this.background?this.background.spriteFrame:null},set:function(t){this.background&&(this.background.spriteFrame=t)}},returnType:{default:h.DEFAULT,tooltip:!1,displayName:"KeyboardReturnType",type:h},_N$returnType:{default:void 0,type:cc.Float},inputFlag:{tooltip:!1,default:l.DEFAULT,type:l,notify:function(){this._updateString(this._string)}},inputMode:{tooltip:!1,default:o.ANY,type:o,notify:function(t){this.inputMode!==t&&(this._updateTextLabel(),this._updatePlaceholderLabel())}},fontSize:{get:function(){return this.textLabel?this.textLabel.fontSize:0},set:function(t){this.textLabel&&(this.textLabel.fontSize=t)}},_N$fontSize:{default:void 0,type:cc.Float},lineHeight:{get:function(){return this.textLabel?this.textLabel.lineHeight:0},set:function(t){this.textLabel&&(this.textLabel.lineHeight=t)}},_N$lineHeight:{default:void 0,type:cc.Float},fontColor:{get:function(){return this.textLabel?this.textLabel.node.color:cc.Color.BLACK},set:function(t){this.textLabel&&(this.textLabel.node.color=t,this.textLabel.node.opacity=t.a)}},_N$fontColor:void 0,placeholder:{tooltip:!1,get:function(){return this.placeholderLabel?this.placeholderLabel.string:""},set:function(t){this.placeholderLabel&&(this.placeholderLabel.string=t)}},_N$placeholder:{default:void 0,type:cc.String},placeholderFontSize:{get:function(){return this.placeholderLabel?this.placeholderLabel.fontSize:0},set:function(t){this.placeholderLabel&&(this.placeholderLabel.fontSize=t)}},_N$placeholderFontSize:{default:void 0,type:cc.Float},placeholderFontColor:{get:function(){return this.placeholderLabel?this.placeholderLabel.node.color:cc.Color.BLACK},set:function(t){this.placeholderLabel&&(this.placeholderLabel.node.color=t,this.placeholderLabel.node.opacity=t.a)}},_N$placeholderFontColor:void 0,maxLength:{tooltip:!1,default:20},_N$maxLength:{default:void 0,type:cc.Float},stayOnTop:{default:!1,notify:function(){cc.warn("editBox.stayOnTop is removed since v2.1.")}},_tabIndex:0,tabIndex:{tooltip:!1,get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}},editingDidBegan:{default:[],type:cc.Component.EventHandler},textChanged:{default:[],type:cc.Component.EventHandler},editingDidEnded:{default:[],type:cc.Component.EventHandler},editingReturn:{default:[],type:cc.Component.EventHandler}},statics:{_ImplClass:r,KeyboardReturnType:h,InputFlag:l,InputMode:o},_init:function(){this._upgradeComp(),this._isLabelVisible=!0,this.node.on(cc.Node.EventType.SIZE_CHANGED,this._syncSize,this),(this._impl=new _._ImplClass).init(this),this._updateString(this._string),this._syncSize()},_updateBackgroundSprite:function(){var t=this.background;if(!t){var e=this.node.getChildByName("BACKGROUND_SPRITE");e||(e=new cc.Node("BACKGROUND_SPRITE")),(t=e.getComponent(cc.Sprite))||(t=e.addComponent(cc.Sprite)),e.parent=this.node,this.background=t}t.type=cc.Sprite.Type.SLICED,void 0!==this._N$backgroundImage&&(t.spriteFrame=this._N$backgroundImage,this._N$backgroundImage=void 0)},_updateTextLabel:function(){var t=this.textLabel;if(!t){var e=this.node.getChildByName("TEXT_LABEL");e||(e=new cc.Node("TEXT_LABEL")),(t=e.getComponent(s))||(t=e.addComponent(s)),e.parent=this.node,this.textLabel=t}t.node.setAnchorPoint(0,1),t.overflow=s.Overflow.CLAMP,this.inputMode===o.ANY?(t.verticalAlign=n.VerticalTextAlignment.TOP,t.enableWrapText=!0):(t.verticalAlign=n.VerticalTextAlignment.CENTER,t.enableWrapText=!1),t.string=this._updateLabelStringStyle(this._string),void 0!==this._N$fontColor&&(t.node.color=this._N$fontColor,t.node.opacity=this._N$fontColor.a,this._N$fontColor=void 0),void 0!==this._N$fontSize&&(t.fontSize=this._N$fontSize,this._N$fontSize=void 0),void 0!==this._N$lineHeight&&(t.lineHeight=this._N$lineHeight,this._N$lineHeight=void 0)},_updatePlaceholderLabel:function(){var t=this.placeholderLabel;if(!t){var e=this.node.getChildByName("PLACEHOLDER_LABEL");e||(e=new cc.Node("PLACEHOLDER_LABEL")),(t=e.getComponent(s))||(t=e.addComponent(s)),e.parent=this.node,this.placeholderLabel=t}t.node.setAnchorPoint(0,1),t.overflow=s.Overflow.CLAMP,this.inputMode===o.ANY?(t.verticalAlign=n.VerticalTextAlignment.TOP,t.enableWrapText=!0):(t.verticalAlign=n.VerticalTextAlignment.CENTER,t.enableWrapText=!1),t.string=this.placeholder,void 0!==this._N$placeholderFontColor&&(t.node.color=this._N$placeholderFontColor,t.node.opacity=this._N$placeholderFontColor.a,this._N$placeholderFontColor=void 0),void 0!==this._N$placeholderFontSize&&(t.fontSize=this._N$placeholderFontSize,this._N$placeholderFontSize=void 0)},_upgradeComp:function(){void 0!==this._N$returnType&&(this.returnType=this._N$returnType,this._N$returnType=void 0),void 0!==this._N$maxLength&&(this.maxLength=this._N$maxLength,this._N$maxLength=void 0),void 0!==this._N$backgroundImage&&this._updateBackgroundSprite(),void 0===this._N$fontColor&&void 0===this._N$fontSize&&void 0===this._N$lineHeight||this._updateTextLabel(),void 0===this._N$placeholderFontColor&&void 0===this._N$placeholderFontSize||this._updatePlaceholderLabel(),void 0!==this._N$placeholder&&(this.placeholder=this._N$placeholder,this._N$placeholder=void 0)},_syncSize:function(){if(this._impl){var t=this.node.getContentSize();this._impl.setSize(t.width,t.height)}},_showLabels:function(){this._isLabelVisible=!0,this._updateLabels()},_hideLabels:function(){this._isLabelVisible=!1,this.textLabel&&(this.textLabel.node.active=!1),this.placeholderLabel&&(this.placeholderLabel.node.active=!1)},_updateLabels:function(){if(this._isLabelVisible){var t=this._string;this.textLabel&&(this.textLabel.node.active=""!==t),this.placeholderLabel&&(this.placeholderLabel.node.active=""===t)}},_updateString:function(t){var e=this.textLabel;if(e){var i=t;i&&(i=this._updateLabelStringStyle(i)),e.string=i,this._updateLabels()}},_updateLabelStringStyle:function(t,e){var i=this.inputFlag;if(e||i!==l.PASSWORD)i===l.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():i===l.INITIAL_CAPS_WORD?t=c(t):i===l.INITIAL_CAPS_SENTENCE&&(t=u(t));else{for(var n="",r=t.length,s=0;s=0&&n.setFocus(!0)}}}}),{}],126:[(function(t,e,i){"use strict";var n=cc.Enum({DEFAULT:0,DONE:1,SEND:2,SEARCH:3,GO:4,NEXT:5}),r=cc.Enum({ANY:0,EMAIL_ADDR:1,NUMERIC:2,PHONE_NUMBER:3,URL:4,DECIMAL:5,SINGLE_LINE:6}),s=cc.Enum({PASSWORD:0,SENSITIVE:1,INITIAL_CAPS_WORD:2,INITIAL_CAPS_SENTENCE:3,INITIAL_CAPS_ALL_CHARACTERS:4,DEFAULT:5});e.exports={KeyboardReturnType:n,InputMode:r,InputFlag:s}}),{}],127:[(function(t,e,i){"use strict";t("./CCComponent"),t("./CCComponentEventHandler"),t("./missing-script");var n=t("./WXSubContextView"),r=t("./SwanSubContextView");n||(n=cc.Class({name:"cc.WXSubContextView",extends:cc.Component})),r||(r=cc.Class({name:"cc.SwanSubContextView",extends:cc.Component}));var s=[t("./CCSprite"),t("./CCWidget"),t("./CCCanvas"),t("./CCAudioSource"),t("./CCAnimation"),t("./CCButton"),t("./CCLabel"),t("./CCProgressBar"),t("./CCMask"),t("./CCScrollBar"),t("./CCScrollView"),t("./CCPageViewIndicator"),t("./CCPageView"),t("./CCSlider"),t("./CCLayout"),t("./editbox/CCEditBox"),t("./CCLabelOutline"),t("./CCLabelShadow"),t("./CCRichText"),t("./CCToggleContainer"),t("./CCToggleGroup"),t("./CCToggle"),t("./CCBlockInputEvents"),t("./CCMotionStreak"),n,r];e.exports=s}),{"./CCAnimation":94,"./CCAudioSource":95,"./CCBlockInputEvents":96,"./CCButton":97,"./CCCanvas":98,"./CCComponent":99,"./CCComponentEventHandler":100,"./CCLabel":101,"./CCLabelOutline":102,"./CCLabelShadow":103,"./CCLayout":104,"./CCMask":105,"./CCMotionStreak":106,"./CCPageView":107,"./CCPageViewIndicator":108,"./CCProgressBar":109,"./CCRichText":111,"./CCScrollBar":112,"./CCScrollView":113,"./CCSlider":114,"./CCSprite":115,"./CCToggle":117,"./CCToggleContainer":118,"./CCToggleGroup":119,"./CCWidget":121,"./SwanSubContextView":void 0,"./WXSubContextView":void 0,"./editbox/CCEditBox":122,"./missing-script":128}],128:[(function(t,e,i){"use strict";var n=cc.js,r=t("../utils/misc").BUILTIN_CLASSID_RE,s=cc.Class({name:"cc.MissingClass",properties:{_$erialized:{default:null,visible:!1,editorOnly:!0}}}),a=cc.Class({name:"cc.MissingScript",extends:cc.Component,editor:{inspector:"packages://inspector/inspectors/comps/missing-script.js"},properties:{compiled:{default:!1,serializable:!1},_$erialized:{default:null,visible:!1,editorOnly:!0}},ctor:!1,statics:{safeFindClass:function(t,e){var i=n._getClassById(t);return i||(t?(cc.deserialize.reportMissingClass(t),a.getMissingWrapper(t,e)):null)},getMissingWrapper:function(t,e){return e.node&&(/^[0-9a-zA-Z+/]{23}$/.test(t)||r.test(t))?a:s}},onLoad:function(){cc.warnID(4600,this.node.name)}});cc._MissingScript=e.exports=a}),{"../utils/misc":294}],129:[(function(t,e,i){"use strict";var n=cc.js;t("../event/event");var r=function(t,e){cc.Event.call(this,cc.Event.MOUSE,e),this._eventType=t,this._button=0,this._x=0,this._y=0,this._prevX=0,this._prevY=0,this._scrollX=0,this._scrollY=0};n.extend(r,cc.Event);var s=r.prototype;s.setScrollData=function(t,e){this._scrollX=t,this._scrollY=e},s.getScrollX=function(){return this._scrollX},s.getScrollY=function(){return this._scrollY},s.setLocation=function(t,e){this._x=t,this._y=e},s.getLocation=function(){return cc.v2(this._x,this._y)},s.getLocationInView=function(){return cc.v2(this._x,cc.view._designResolutionSize.height-this._y)},s._setPrevCursor=function(t,e){this._prevX=t,this._prevY=e},s.getPreviousLocation=function(){return cc.v2(this._prevX,this._prevY)},s.getDelta=function(){return cc.v2(this._x-this._prevX,this._y-this._prevY)},s.getDeltaX=function(){return this._x-this._prevX},s.getDeltaY=function(){return this._y-this._prevY},s.setButton=function(t){this._button=t},s.getButton=function(){return this._button},s.getLocationX=function(){return this._x},s.getLocationY=function(){return this._y},r.NONE=0,r.DOWN=1,r.UP=2,r.MOVE=3,r.SCROLL=4,r.BUTTON_LEFT=0,r.BUTTON_RIGHT=2,r.BUTTON_MIDDLE=1,r.BUTTON_4=3,r.BUTTON_5=4,r.BUTTON_6=5,r.BUTTON_7=6,r.BUTTON_8=7;var a=function(t,e){cc.Event.call(this,cc.Event.TOUCH,e),this._eventCode=0,this._touches=t||[],this.touch=null,this.currentTouch=null};n.extend(a,cc.Event),(s=a.prototype).getEventCode=function(){return this._eventCode},s.getTouches=function(){return this._touches},s._setEventCode=function(t){this._eventCode=t},s._setTouches=function(t){this._touches=t},s.setLocation=function(t,e){this.touch&&this.touch.setTouchInfo(this.touch.getID(),t,e)},s.getLocation=function(){return this.touch?this.touch.getLocation():cc.v2()},s.getLocationInView=function(){return this.touch?this.touch.getLocationInView():cc.v2()},s.getPreviousLocation=function(){return this.touch?this.touch.getPreviousLocation():cc.v2()},s.getStartLocation=function(){return this.touch?this.touch.getStartLocation():cc.v2()},s.getID=function(){return this.touch?this.touch.getID():null},s.getDelta=function(){return this.touch?this.touch.getDelta():cc.v2()},s.getDeltaX=function(){return this.touch?this.touch.getDelta().x:0},s.getDeltaY=function(){return this.touch?this.touch.getDelta().y:0},s.getLocationX=function(){return this.touch?this.touch.getLocationX():0},s.getLocationY=function(){return this.touch?this.touch.getLocationY():0},a.MAX_TOUCHES=5,a.BEGAN=0,a.MOVED=1,a.ENDED=2,a.CANCELED=3;var o=function(t,e){cc.Event.call(this,cc.Event.ACCELERATION,e),this.acc=t};n.extend(o,cc.Event);var l=function(t,e,i){cc.Event.call(this,cc.Event.KEYBOARD,i),this.keyCode=t,this.isPressed=e};n.extend(l,cc.Event),cc.Event.EventMouse=r,cc.Event.EventTouch=a,cc.Event.EventAcceleration=o,cc.Event.EventKeyboard=l,e.exports=cc.Event}),{"../event/event":136}],130:[(function(t,e,i){"use strict";var n=t("../platform/js");cc.EventListener=function(t,e,i){this._onEvent=i,this._type=t||0,this._listenerID=e||"",this._registered=!1,this._fixedPriority=0,this._node=null,this._target=null,this._paused=!0,this._isEnabled=!0},cc.EventListener.prototype={constructor:cc.EventListener,_setPaused:function(t){this._paused=t},_isPaused:function(){return this._paused},_setRegistered:function(t){this._registered=t},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(t){this._fixedPriority=t},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(t){this._target=t,this._node=t},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return null!==this._onEvent},clone:function(){return null},setEnabled:function(t){this._isEnabled=t},isEnabled:function(){return this._isEnabled},retain:function(){},release:function(){}},cc.EventListener.UNKNOWN=0,cc.EventListener.TOUCH_ONE_BY_ONE=1,cc.EventListener.TOUCH_ALL_AT_ONCE=2,cc.EventListener.KEYBOARD=3,cc.EventListener.MOUSE=4,cc.EventListener.ACCELERATION=6,cc.EventListener.CUSTOM=8;var r=cc.EventListener.ListenerID={MOUSE:"__cc_mouse",TOUCH_ONE_BY_ONE:"__cc_touch_one_by_one",TOUCH_ALL_AT_ONCE:"__cc_touch_all_at_once",KEYBOARD:"__cc_keyboard",ACCELERATION:"__cc_acceleration"},s=function(t,e){this._onCustomEvent=e,cc.EventListener.call(this,cc.EventListener.CUSTOM,t,this._callback)};n.extend(s,cc.EventListener),n.mixin(s.prototype,{_onCustomEvent:null,_callback:function(t){null!==this._onCustomEvent&&this._onCustomEvent(t)},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&null!==this._onCustomEvent},clone:function(){return new s(this._listenerID,this._onCustomEvent)}});var a=function(){cc.EventListener.call(this,cc.EventListener.MOUSE,r.MOUSE,this._callback)};n.extend(a,cc.EventListener),n.mixin(a.prototype,{onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,_callback:function(t){var e=cc.Event.EventMouse;switch(t._eventType){case e.DOWN:this.onMouseDown&&this.onMouseDown(t);break;case e.UP:this.onMouseUp&&this.onMouseUp(t);break;case e.MOVE:this.onMouseMove&&this.onMouseMove(t);break;case e.SCROLL:this.onMouseScroll&&this.onMouseScroll(t)}},clone:function(){var t=new a;return t.onMouseDown=this.onMouseDown,t.onMouseUp=this.onMouseUp,t.onMouseMove=this.onMouseMove,t.onMouseScroll=this.onMouseScroll,t},checkAvailable:function(){return!0}});var o=function(){cc.EventListener.call(this,cc.EventListener.TOUCH_ONE_BY_ONE,r.TOUCH_ONE_BY_ONE,null),this._claimedTouches=[]};n.extend(o,cc.EventListener),n.mixin(o.prototype,{constructor:o,_claimedTouches:null,swallowTouches:!1,onTouchBegan:null,onTouchMoved:null,onTouchEnded:null,onTouchCancelled:null,setSwallowTouches:function(t){this.swallowTouches=t},isSwallowTouches:function(){return this.swallowTouches},clone:function(){var t=new o;return t.onTouchBegan=this.onTouchBegan,t.onTouchMoved=this.onTouchMoved,t.onTouchEnded=this.onTouchEnded,t.onTouchCancelled=this.onTouchCancelled,t.swallowTouches=this.swallowTouches,t},checkAvailable:function(){return!!this.onTouchBegan||(cc.logID(1801),!1)}});var l=function(){cc.EventListener.call(this,cc.EventListener.TOUCH_ALL_AT_ONCE,r.TOUCH_ALL_AT_ONCE,null)};n.extend(l,cc.EventListener),n.mixin(l.prototype,{constructor:l,onTouchesBegan:null,onTouchesMoved:null,onTouchesEnded:null,onTouchesCancelled:null,clone:function(){var t=new l;return t.onTouchesBegan=this.onTouchesBegan,t.onTouchesMoved=this.onTouchesMoved,t.onTouchesEnded=this.onTouchesEnded,t.onTouchesCancelled=this.onTouchesCancelled,t},checkAvailable:function(){return null!==this.onTouchesBegan||null!==this.onTouchesMoved||null!==this.onTouchesEnded||null!==this.onTouchesCancelled||(cc.logID(1802),!1)}});var h=function(t){this._onAccelerationEvent=t,cc.EventListener.call(this,cc.EventListener.ACCELERATION,r.ACCELERATION,this._callback)};n.extend(h,cc.EventListener),n.mixin(h.prototype,{constructor:h,_onAccelerationEvent:null,_callback:function(t){this._onAccelerationEvent(t.acc,t)},checkAvailable:function(){return cc.assertID(this._onAccelerationEvent,1803),!0},clone:function(){return new h(this._onAccelerationEvent)}});var c=function(){cc.EventListener.call(this,cc.EventListener.KEYBOARD,r.KEYBOARD,this._callback)};n.extend(c,cc.EventListener),n.mixin(c.prototype,{constructor:c,onKeyPressed:null,onKeyReleased:null,_callback:function(t){t.isPressed?this.onKeyPressed&&this.onKeyPressed(t.keyCode,t):this.onKeyReleased&&this.onKeyReleased(t.keyCode,t)},clone:function(){var t=new c;return t.onKeyPressed=this.onKeyPressed,t.onKeyReleased=this.onKeyReleased,t},checkAvailable:function(){return null!==this.onKeyPressed||null!==this.onKeyReleased||(cc.logID(1800),!1)}}),cc.EventListener.create=function(t){cc.assertID(t&&t.event,1900);var e=t.event;delete t.event;var i=null;for(var n in e===cc.EventListener.TOUCH_ONE_BY_ONE?i=new o:e===cc.EventListener.TOUCH_ALL_AT_ONCE?i=new l:e===cc.EventListener.MOUSE?i=new a:e===cc.EventListener.CUSTOM?(i=new s(t.eventName,t.callback),delete t.eventName,delete t.callback):e===cc.EventListener.KEYBOARD?i=new c:e===cc.EventListener.ACCELERATION&&(i=new h(t.callback),delete t.callback),t)i[n]=t[n];return i},e.exports=cc.EventListener}),{"../platform/js":229}],131:[(function(t,e,i){"use strict";var n=t("../platform/js");t("./CCEventListener");var r=cc.EventListener.ListenerID,s=function(){this._fixedListeners=[],this._sceneGraphListeners=[],this.gt0Index=0};s.prototype={constructor:s,size:function(){return this._fixedListeners.length+this._sceneGraphListeners.length},empty:function(){return 0===this._fixedListeners.length&&0===this._sceneGraphListeners.length},push:function(t){0===t._getFixedPriority()?this._sceneGraphListeners.push(t):this._fixedListeners.push(t)},clearSceneGraphListeners:function(){this._sceneGraphListeners.length=0},clearFixedListeners:function(){this._fixedListeners.length=0},clear:function(){this._sceneGraphListeners.length=0,this._fixedListeners.length=0},getFixedPriorityListeners:function(){return this._fixedListeners},getSceneGraphPriorityListeners:function(){return this._sceneGraphListeners}};var a=function(t){var e=cc.Event,i=t.type;return i===e.ACCELERATION?r.ACCELERATION:i===e.KEYBOARD?r.KEYBOARD:i.startsWith(e.MOUSE)?r.MOUSE:(i.startsWith(e.TOUCH)&&cc.logID(2e3),"")},o={DIRTY_NONE:0,DIRTY_FIXED_PRIORITY:1,DIRTY_SCENE_GRAPH_PRIORITY:2,DIRTY_ALL:3,_listenersMap:{},_priorityDirtyFlagMap:{},_nodeListenersMap:{},_toAddedListeners:[],_toRemovedListeners:[],_dirtyListeners:{},_inDispatch:0,_isEnabled:!1,_currentTouch:null,_currentTouchListener:null,_internalCustomListenerIDs:[],_setDirtyForNode:function(t){var e=this._nodeListenersMap[t._id];if(void 0!==e)for(var i=0,n=e.length;i0)for(var s=t._children,a=0,o=s.length;a=0;i--)(e=t[i])._setRegistered(!1),null!=e._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(e._getSceneGraphPriority(),e),e._setSceneGraphPriority(null)),0===this._inDispatch&&cc.js.array.removeAt(t,i)},_removeListenersForListenerID:function(t){var e,i=this._listenersMap[t];if(i){var n=i.getFixedPriorityListeners(),r=i.getSceneGraphPriorityListeners();this._removeAllListenersInVector(r),this._removeAllListenersInVector(n),delete this._priorityDirtyFlagMap[t],this._inDispatch||(i.clear(),delete this._listenersMap[t])}var s,a=this._toAddedListeners;for(e=a.length-1;e>=0;e--)(s=a[e])&&s._getListenerID()===t&&cc.js.array.removeAt(a,e)},_sortEventListeners:function(t){var e=this.DIRTY_NONE,i=this._priorityDirtyFlagMap;(i[t]&&(e=i[t]),e!==this.DIRTY_NONE)&&(i[t]=this.DIRTY_NONE,e&this.DIRTY_FIXED_PRIORITY&&this._sortListenersOfFixedPriority(t),e&this.DIRTY_SCENE_GRAPH_PRIORITY&&cc.director.getScene()&&this._sortListenersOfSceneGraphPriority(t))},_sortListenersOfSceneGraphPriority:function(t){var e=this._getListeners(t);if(e){var i=e.getSceneGraphPriorityListeners();i&&0!==i.length&&e.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes)}},_sortEventListenersOfSceneGraphPriorityDes:function(t,e){var i=t._getSceneGraphPriority(),n=e._getSceneGraphPriority();if(!(e&&n&&n._activeInHierarchy&&null!==n._parent))return-1;if(!t||!i||!i._activeInHierarchy||null===i._parent)return 1;for(var r=i,s=n,a=!1;r._parent._id!==s._parent._id;)r=null===r._parent._parent?(a=!0)&&n:r._parent,s=null===s._parent._parent?(a=!0)&&i:s._parent;if(r._id===s._id){if(r._id===n._id)return-1;if(r._id===i._id)return 1}return a?r._localZOrder-s._localZOrder:s._localZOrder-r._localZOrder},_sortListenersOfFixedPriority:function(t){var e=this._listenersMap[t];if(e){var i=e.getFixedPriorityListeners();if(i&&0!==i.length){i.sort(this._sortListenersOfFixedPriorityAsc);for(var n=0,r=i.length;n=0);)++n;e.gt0Index=n}}},_sortListenersOfFixedPriorityAsc:function(t,e){return t._getFixedPriority()-e._getFixedPriority()},_onUpdateListeners:function(t){var e,i,n,r=t.getFixedPriorityListeners(),s=t.getSceneGraphPriorityListeners(),a=this._toRemovedListeners;if(s)for(e=s.length-1;e>=0;e--)(i=s[e])._isRegistered()||(cc.js.array.removeAt(s,e),-1!==(n=a.indexOf(i))&&a.splice(n,1));if(r)for(e=r.length-1;e>=0;e--)(i=r[e])._isRegistered()||(cc.js.array.removeAt(r,e),-1!==(n=a.indexOf(i))&&a.splice(n,1));s&&0===s.length&&t.clearSceneGraphListeners(),r&&0===r.length&&t.clearFixedListeners()},frameUpdateListeners:function(){var t=this._listenersMap,e=this._priorityDirtyFlagMap;for(var i in t)t[i].empty()&&(delete e[i],delete t[i]);var n=this._toAddedListeners;if(0!==n.length){for(var r=0,s=n.length;r0,3508),!(e>1)){var i;(i=this._listenersMap[r.TOUCH_ONE_BY_ONE])&&this._onUpdateListeners(i),(i=this._listenersMap[r.TOUCH_ALL_AT_ONCE])&&this._onUpdateListeners(i),cc.assertID(1===e,3509);var n=this._toAddedListeners;if(0!==n.length){for(var s=0,a=n.length;s0&&-1!==(r=t._claimedTouches.indexOf(n))){if(s=!0,!cc.macro.ENABLE_MULTI_TOUCH&&o._currentTouch&&o._currentTouch!==n)return!1;a===l.MOVED&&t.onTouchMoved?t.onTouchMoved(n,i):a===l.ENDED?(t.onTouchEnded&&t.onTouchEnded(n,i),t._registered&&t._claimedTouches.splice(r,1),o._clearCurTouch()):a===l.CANCELED&&(t.onTouchCancelled&&t.onTouchCancelled(n,i),t._registered&&t._claimedTouches.splice(r,1),o._clearCurTouch())}return i.isStopped()?(o._updateTouchListeners(i),!0):!(!s||!t.swallowTouches)&&(e.needsMutableSet&&e.touches.splice(n,1),!0)},_dispatchTouchEvent:function(t){this._sortEventListeners(r.TOUCH_ONE_BY_ONE),this._sortEventListeners(r.TOUCH_ALL_AT_ONCE);var e=this._getListeners(r.TOUCH_ONE_BY_ONE),i=this._getListeners(r.TOUCH_ALL_AT_ONCE);if(null!==e||null!==i){var n=t.getTouches(),s=cc.js.array.copy(n),a={event:t,needsMutableSet:e&&i,touches:s,selTouch:null};if(e)for(var o=0;o0&&(this._dispatchEventToListeners(i,this._onTouchesEventCallback,{event:t,touches:s}),t.isStopped())||this._updateTouchListeners(t)}},_onTouchesEventCallback:function(t,e){if(!t._registered)return!1;var i=cc.Event.EventTouch,n=e.event,r=e.touches,s=n.getEventCode();return n.currentTarget=t._node,s===i.BEGAN&&t.onTouchesBegan?t.onTouchesBegan(r,n):s===i.MOVED&&t.onTouchesMoved?t.onTouchesMoved(r,n):s===i.ENDED&&t.onTouchesEnded?t.onTouchesEnded(r,n):s===i.CANCELED&&t.onTouchesCancelled&&t.onTouchesCancelled(r,n),!!n.isStopped()&&(o._updateTouchListeners(n),!0)},_associateNodeAndEventListener:function(t,e){var i=this._nodeListenersMap[t._id];i||(i=[],this._nodeListenersMap[t._id]=i),i.push(e)},_dissociateNodeAndEventListener:function(t,e){var i=this._nodeListenersMap[t._id];i&&(cc.js.array.remove(i,e),0===i.length&&delete this._nodeListenersMap[t._id])},_dispatchEventToListeners:function(t,e,i){var n,r,s=!1,a=t.getFixedPriorityListeners(),o=t.getSceneGraphPriorityListeners(),l=0;if(a&&0!==a.length)for(;l=0;l--){var h=o[l];if(h===t){cc.js.array.removeAt(o,l),h._setRegistered(!1);break}}this._currentTouchListener===t&&this._clearCurTouch()}},_clearCurTouch:function(){this._currentTouchListener=null,this._currentTouch=null},_removeListenerInCallback:function(t,e){if(null==t)return!1;for(var i=t.length-1;i>=0;i--){var n=t[i];if(n._onCustomEvent===e||n._onEvent===e)return n._setRegistered(!1),null!=n._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(n._getSceneGraphPriority(),n),n._setSceneGraphPriority(null)),0===this._inDispatch?cc.js.array.removeAt(t,i):this._toRemovedListeners.push(n),!0}return!1},_removeListenerInVector:function(t,e){if(null==t)return!1;for(var i=t.length-1;i>=0;i--){var n=t[i];if(n===e)return n._setRegistered(!1),null!=n._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(n._getSceneGraphPriority(),n),n._setSceneGraphPriority(null)),0===this._inDispatch?cc.js.array.removeAt(t,i):this._toRemovedListeners.push(n),!0}return!1},removeListeners:function(t,e){var i=this;if(cc.js.isNumber(t)||t instanceof cc._BaseNode)if(void 0!==t._id){var n,s=i._nodeListenersMap[t._id];if(s){var a=cc.js.array.copy(s);for(n=0;nh.x?h.x:t.x,t.y=t.y>h.x?h.y:t.y,t.z=t.z>h.x?h.z:t.z,t},i.pt_point_obb=function(t,e,i){var l=i.orientation.m;n.Vec3.set(r,l[0],l[1],l[2]),n.Vec3.set(s,l[3],l[4],l[5]),n.Vec3.set(a,l[6],l[7],l[8]),c[0]=r,c[1]=s,c[2]=a,u[0]=i.halfExtents.x,u[1]=i.halfExtents.y,u[2]=i.halfExtents.z,n.Vec3.subtract(o,e,i.center),n.Vec3.set(t,i.center.x,i.center.y,i.center.z);for(var h=0;h<3;h++){var _=n.Vec3.dot(o,c[h]);_>u[h]&&(_=u[h]),_<-u[h]&&(_=-u[h]),t.x+=_*c[h].x,t.y+=_*c[h].y,t.z+=_*c[h].z}return t};var n=t("../value-types"),r=new n.Vec3,s=new n.Vec3,a=new n.Vec3,o=new n.Vec3,l=new n.Vec3,h=new n.Vec3,c=new Array(3),u=new Array(3);function _(t,e){return n.Vec3.dot(e.n,t)-e.d}}),{"../value-types":309}],141:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;i.default={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256},e.exports=i.default}),{}],142:[(function(t,e,i){"use strict";i.__esModule=!0,i.frustum=void 0;var n=t("../value-types"),r=a(t("./enums")),s=a(t("./plane"));function a(t){return t&&t.__esModule?t:{default:t}}function o(t,e){for(var i=0;i0&&f=0;r--){t(n[r],i)}i(e)}function e(t,e){return t.distance-e.distance}function i(t,e,i){var n=i.m,r=e.x,s=e.y,a=e.z,o=n[3]*r+n[7]*s+n[11]*a;return o=o?1/o:1,t.x=(n[0]*r+n[4]*s+n[8]*a)*o,t.y=(n[1]*r+n[5]*s+n[9]*a)*o,t.z=(n[2]*r+n[6]*s+n[10]*a)*o,t}var n=new r.default(function(){return{distance:0,node:null}},1),o=[],l=a.default.create(),c=new s.Vec3,u=new s.Vec3,_=new h.default,f=cc.mat4(),d=cc.mat4(),p=new s.Vec3;function m(t){return t>0&&t<1/0}return function(r,h,y,v){return n.reset(),o.length=0,t(r=r||cc.director.getScene(),(function(t){if(!v||v(t)){s.Mat4.invert(d,t.getWorldMatrix(f)),s.Vec3.transformMat4(_.o,h.o,d),s.Vec3.normalize(_.d,i(_.d,h.d,d));var e=1/0,r=t._renderComponent;if(r instanceof cc.MeshRenderer?e=b(_,r._boundingBox):t.width&&t.height&&(s.Vec3.set(c,-t.width*t.anchorX,-t.height*t.anchorY,t.z),s.Vec3.set(u,t.width*(1-t.anchorX),t.height*(1-t.anchorY),t.z),a.default.fromPoints(l,c,u),e=b(_,l)),m(e)&&(y&&(e=y(_,t,e)),m(e))){s.Vec3.scale(p,_.d,e),i(p,p,f);var g=n.add();g.node=t,g.distance=s.Vec3.mag(p),o.push(g)}}})),o.sort(e),o}})(),p=(function(){var t=new s.Vec3(0,0,0);return function(e,i){var n=s.Vec3.dot(e.d,i.n);if(Math.abs(n)1?0:n}})(),y=(function(){var t=new s.Vec3(0,0,0),e=new s.Vec3(0,0,0),i=new s.Vec3(0,0,0),n=new s.Vec3(0,0,0),r=new s.Vec3(0,0,0);return function(a,o,l){s.Vec3.subtract(t,o.b,o.a),s.Vec3.subtract(e,o.c,o.a),s.Vec3.cross(i,a.d,e);var h=s.Vec3.dot(t,i);if(h-Number.EPSILON))return 0;var c=1/h;s.Vec3.subtract(n,a.o,o.a);var u=s.Vec3.dot(n,i)*c;if(u<0||u>1)return 0;s.Vec3.cross(r,n,t);var _=s.Vec3.dot(a.d,r)*c;if(_<0||u+_>1)return 0;var f=s.Vec3.dot(e,r)*c;return f<0?0:f}})(),v=y,g=(function(){var t=new s.Vec3(0,0,0),e=new s.Vec3(0,0,0),i=new s.Vec3(0,0,0),n=new s.Vec3(0,0,0),r=new s.Vec3(0,0,0),a=new s.Vec3(0,0,0);return function(o,l,h){s.Vec3.subtract(t,l.b,l.a),s.Vec3.subtract(e,l.c,l.a),s.Vec3.subtract(i,o.s,o.e),s.Vec3.cross(r,t,e);var c=s.Vec3.dot(i,r);if(c<=0)return 0;s.Vec3.subtract(n,o.s,l.a);var u=s.Vec3.dot(n,r);if(u<0||u>c)return 0;s.Vec3.cross(a,i,n);var _=s.Vec3.dot(e,a);if(_<0||_>c)return 0;var f=-s.Vec3.dot(t,a);if(f<0||_+f>c)return 0;if(h){var d=1/c,p=1-(_*=d)-(f*=d);s.Vec3.set(h,l.a.x*p+l.b.x*_+l.c.x*f,l.a.y*p+l.b.y*_+l.c.y*f,l.a.z*p+l.b.z*_+l.c.z*f)}return 1}})(),A=(function(){var t=new s.Vec3(0,0,0),e=new s.Vec3(0,0,0),i=new s.Vec3(0,0,0),n=new s.Vec3(0,0,0),r=new s.Vec3(0,0,0),a=new s.Vec3(0,0,0),o=new s.Vec3(0,0,0);return function(l,h,c,u,_,f,d){s.Vec3.subtract(t,h,l),s.Vec3.subtract(e,c,l),s.Vec3.subtract(i,u,l),s.Vec3.subtract(n,_,l),s.Vec3.cross(a,n,t);var p=s.Vec3.dot(e,a);if(p>=0){var m=-s.Vec3.dot(i,a);if(m<0)return 0;var y=s.Vec3.dot(s.Vec3.cross(o,t,i),e);if(y<0)return 0;if(d){var v=1/(m+p+y);m*=v,p*=v,y*=v,s.Vec3.set(d,c.x*m+u.x*p+_.x*y,c.y*m+u.y*p+_.y*y,c.z*m+u.z*p+_.z*y)}}else{s.Vec3.subtract(r,f,l);var g=s.Vec3.dot(r,a);if(g<0)return 0;var A=s.Vec3.dot(s.Vec3.cross(o,t,e),r);if(A<0)return 0;if(d){var x=1/(g+(p=-p)+A);g*=x,p*=x,A*=x,s.Vec3.set(d,c.x*g+f.x*p+_.x*A,c.y*g+f.y*p+_.y*A,c.z*g+f.z*p+_.z*A)}}return 1}})(),x=(function(){var t=new s.Vec3(0,0,0);return function(e,i){var n=i.radius,r=i.center,a=e.o,o=e.d,l=n*n;s.Vec3.subtract(t,r,a);var h=t.lengthSqr(),c=s.Vec3.dot(t,o),u=l-(h-c*c);if(u<0)return 0;var _=Math.sqrt(u),f=hy?0:m}})(),C=b,T=(function(){var t=new s.Vec3,e=new s.Vec3,i=new s.Vec3,n=new s.Vec3,r=new s.Vec3,a=new s.Vec3,o=new s.Vec3,l=new Array(3),h=new Array(3),c=new Array(3),u=new Array(6);return function(_,f){l[0]=f.halfExtents.x,l[1]=f.halfExtents.y,l[2]=f.halfExtents.z,t=f.center,e=_.o,i=_.d;var d=f.orientation.m;s.Vec3.set(n,d[0],d[1],d[2]),s.Vec3.set(r,d[3],d[4],d[5]),s.Vec3.set(a,d[6],d[7],d[8]),s.Vec3.subtract(o,t,e),h[0]=s.Vec3.dot(n,i),h[1]=s.Vec3.dot(r,i),h[2]=s.Vec3.dot(a,i),c[0]=s.Vec3.dot(n,o),c[1]=s.Vec3.dot(r,o),c[2]=s.Vec3.dot(a,o);for(var p=0;p<3;++p){if(0===h[p]){if(-c[p]-l[p]>0||-c[p]+l[p]<0)return 0;h[p]=1e-7}u[2*p+0]=(c[p]+l[p])/h[p],u[2*p+1]=(c[p]-l[p])/h[p]}var m=Math.max(Math.max(Math.min(u[0],u[1]),Math.min(u[2],u[3])),Math.min(u[4],u[5])),y=Math.min(Math.min(Math.max(u[0],u[1]),Math.max(u[2],u[3])),Math.max(u[4],u[5]));return y<0||m>y||m<0?0:m}})(),S=(function(){var t=new s.Vec3,e=new s.Vec3,i=new s.Vec3,n=new s.Vec3;return function(r,a){return s.Vec3.subtract(t,r.center,r.halfExtents),s.Vec3.add(e,r.center,r.halfExtents),s.Vec3.subtract(i,a.center,a.halfExtents),s.Vec3.add(n,a.center,a.halfExtents),t.x<=n.x&&e.x>=i.x&&t.y<=n.y&&e.y>=i.y&&t.z<=n.z&&e.z>=i.z}})();function w(t,e,i){s.Vec3.set(i[0],t.x,e.y,e.z),s.Vec3.set(i[1],t.x,e.y,t.z),s.Vec3.set(i[2],t.x,t.y,e.z),s.Vec3.set(i[3],t.x,t.y,t.z),s.Vec3.set(i[4],e.x,e.y,e.z),s.Vec3.set(i[5],e.x,e.y,t.z),s.Vec3.set(i[6],e.x,t.y,e.z),s.Vec3.set(i[7],e.x,t.y,t.z)}function E(t,e,i,n,r,a){s.Vec3.set(a[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),s.Vec3.set(a[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),s.Vec3.set(a[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),s.Vec3.set(a[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),s.Vec3.set(a[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),s.Vec3.set(a[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),s.Vec3.set(a[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),s.Vec3.set(a[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function M(t,e){for(var i=s.Vec3.dot(e,t[0]),n=i,r=1;r<8;++r){var a=s.Vec3.dot(e,t[r]);i=an?a:n}return[i,n]}var D=(function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new s.Vec3(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new s.Vec3(0,0,0),n[r]=new s.Vec3(0,0,0);var a=new s.Vec3,o=new s.Vec3;return function(e,r){var l=r.orientation.m;s.Vec3.set(t[0],1,0,0),s.Vec3.set(t[1],0,1,0),s.Vec3.set(t[2],0,0,1),s.Vec3.set(t[3],l[0],l[1],l[2]),s.Vec3.set(t[4],l[3],l[4],l[5]),s.Vec3.set(t[5],l[6],l[7],l[8]);for(var h=0;h<3;++h)s.Vec3.cross(t[6+3*h+0],t[h],t[0]),s.Vec3.cross(t[6+3*h+1],t[h],t[1]),s.Vec3.cross(t[6+3*h+1],t[h],t[2]);s.Vec3.subtract(a,e.center,e.halfExtents),s.Vec3.add(o,e.center,e.halfExtents),w(a,o,i),E(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var c=0;c<15;++c){var u=M(i,t[c]),_=M(n,t[c]);if(_[0]>u[1]||u[0]>_[1])return 0}return 1}})(),B=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=s.Vec3.dot(e.n,t.center);return n+ie.d?0:1},I=function(t,e){for(var i=0;in.halfExtents.x?e++:t[c].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var u=0;un.halfExtents.y?e++:t[u].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var _=0;_n.halfExtents.z?e++:t[_].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}})(),R=(function(){var t=new s.Vec3(0,0,0),e=new s.Mat3,i=function(t,e){return Math.abs(t.x)i.d?0:1}})(),L=function(t,e){for(var i=0;ir.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var d=0;dr.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var p=0;pr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===o.vertices.length||n===o.vertices.length?0:1}})(),V=(function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new s.Vec3(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new s.Vec3(0,0,0),n[r]=new s.Vec3(0,0,0);return function(e,r){var a=e.orientation.m,o=r.orientation.m;s.Vec3.set(t[0],a[0],a[1],a[2]),s.Vec3.set(t[1],a[3],a[4],a[5]),s.Vec3.set(t[2],a[6],a[7],a[8]),s.Vec3.set(t[3],o[0],o[1],o[2]),s.Vec3.set(t[4],o[3],o[4],o[5]),s.Vec3.set(t[5],o[6],o[7],o[8]);for(var l=0;l<3;++l)s.Vec3.cross(t[6+3*l+0],t[l],t[0]),s.Vec3.cross(t[6+3*l+1],t[l],t[1]),s.Vec3.cross(t[6+3*l+1],t[l],t[2]);E(e.center,e.halfExtents,t[0],t[1],t[2],i),E(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var c=M(i,t[h]),u=M(n,t[h]);if(u[0]>c[1]||c[0]>u[1])return 0}return 1}})(),N=function(t,e){var i=s.Vec3.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},k=function(t,e){for(var i=0;ic)){s.Vec3.add(t,l,s.Vec3.multiplyScalar(t,h,o));for(var _=0;_<6;_++)if(_!==r&&_!==r+e[r]){var f=n.planes[_];if(s.Vec3.dot(f.n,t)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){n.Mat4.invert(o,t),n.Mat4.transpose(o,o),n.Vec4.set(l,this.n.x,this.n.y,this.n.z,this.d),n.Vec4.transformMat4(l,l,o),n.Vec3.set(this.n,l.x,l.y,l.z),this.d=l.w},t})();i.default=h,e.exports=i.default}),{"../value-types":309,"./enums":141}],148:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../value-types"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("./enums"));var s=(function(){function t(t,e,i,s,a,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=r.default.SHAPE_RAY,this.o=new n.Vec3(t,e,i),this.d=new n.Vec3(s,a,o)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return n.Vec3.copy(t.o,e.o),n.Vec3.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return n.Vec3.copy(t.o,e),n.Vec3.normalize(t.d,n.Vec3.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){n.Vec3.normalize(t,this.d),n.Vec3.scaleAndAdd(t,this.o,t,e)},t})();i.default=s,e.exports=i.default}),{"../value-types":309,"./enums":141}],149:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../value-types"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("./enums"));var s=new n.Vec3,a=(function(){function t(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),this.center=void 0,this.radius=void 0,this._type=void 0,this._type=r.default.SHAPE_SPHERE,this.center=new n.Vec3(t,e,i),this.radius=s}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return n.Vec3.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return n.Vec3.multiplyScalar(t.center,n.Vec3.add(s,e,i),.5),t.radius=.5*n.Vec3.subtract(s,i,e).len(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){n.Vec3.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),n.Vec3.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,r,s){n.Vec3.transformMat4(s.center,this.center,t),s.radius=this.radius*r.maxAxis()},e.translateAndRotate=function(t,e,i){n.Vec3.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*t.maxAxis()},t})();i.default=a,e.exports=i.default}),{"../value-types":309,"./enums":141}],150:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=s(t("../value-types/vec3")),r=s(t("./enums"));function s(t){return t&&t.__esModule?t:{default:t}}var a=(function(){function t(t,e,i,s,a,o,l,h,c){this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this.a=new n.default(t,e,i),this.b=new n.default(s,a,o),this.c=new n.default(l,h,c),this._type=r.default.SHAPE_TRIANGLE}return t.create=function(e,i,n,r,s,a,o,l,h){return new t(e,i,n,r,s,a,o,l,h)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return n.default.copy(t.a,e.a),n.default.copy(t.b,e.b),n.default.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,r){return n.default.copy(t.a,e),n.default.copy(t.b,i),n.default.copy(t.c,r),t},t.set=function(t,e,i,n,r,s,a,o,l,h){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=l,t.c.z=h,t},t})();i.default=a,e.exports=i.default}),{"../value-types/vec3":319,"./enums":141}],151:[(function(t,e,i){"use strict";var n=t("../components/CCRenderComponent"),r=t("../assets/material/CCMaterial"),s=t("./types"),a=s.LineCap,o=s.LineJoin,l=cc.Class({name:"cc.Graphics",extends:n,editor:!1,ctor:function(){this._impl=new l._Impl(this)},properties:{_lineWidth:1,_strokeColor:cc.Color.BLACK,_lineJoin:o.MITER,_lineCap:a.BUTT,_fillColor:cc.Color.WHITE,_miterLimit:10,lineWidth:{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this._impl.lineWidth=t}},lineJoin:{get:function(){return this._lineJoin},set:function(t){this._lineJoin=t,this._impl.lineJoin=t},type:o},lineCap:{get:function(){return this._lineCap},set:function(t){this._lineCap=t,this._impl.lineCap=t},type:a},strokeColor:{get:function(){return this._strokeColor},set:function(t){this._impl.strokeColor=this._strokeColor=cc.color(t)}},fillColor:{get:function(){return this._fillColor},set:function(t){this._impl.fillColor=this._fillColor=cc.color(t)}},miterLimit:{get:function(){return this._miterLimit},set:function(t){this._miterLimit=t,this._impl.miterLimit=t}}},statics:{LineJoin:o,LineCap:a},onRestore:function(){this._impl||(this._impl=new l._Impl(this))},onDestroy:function(){this.clear(!0),this._super(),this._impl=null},_getDefaultMaterial:function(){return r.getBuiltinMaterial("2d-base")},_updateMaterial:function(){var t=this._materials[0];t&&t.define("CC_USE_MODEL",!0)},moveTo:function(t,e){this._impl.moveTo(t,e)},lineTo:function(t,e){this._impl.lineTo(t,e)},bezierCurveTo:function(t,e,i,n,r,s){this._impl.bezierCurveTo(t,e,i,n,r,s)},quadraticCurveTo:function(t,e,i,n){this._impl.quadraticCurveTo(t,e,i,n)},arc:function(t,e,i,n,r,s){this._impl.arc(t,e,i,n,r,s)},ellipse:function(t,e,i,n){this._impl.ellipse(t,e,i,n)},circle:function(t,e,i){this._impl.circle(t,e,i)},rect:function(t,e,i,n){this._impl.rect(t,e,i,n)},roundRect:function(t,e,i,n,r){this._impl.roundRect(t,e,i,n,r)},fillRect:function(t,e,i,n){this.rect(t,e,i,n),this.fill()},clear:function(t){this._impl.clear(t),this._assembler&&this._assembler.clear(t)},close:function(){this._impl.close()},stroke:function(){this._assembler||this._resetAssembler(),this._assembler.stroke(this)},fill:function(){this._assembler||this._resetAssembler(),this._assembler.fill(this)}});cc.Graphics=e.exports=l,cc.Graphics.Types=s,cc.Graphics.Helper=t("./helper")}),{"../assets/material/CCMaterial":74,"../components/CCRenderComponent":110,"./helper":152,"./types":154}],152:[(function(t,e,i){"use strict";var n=t("./types").PointFlags,r=Math.PI,s=Math.min,a=Math.max,o=Math.cos,l=Math.sin,h=Math.abs,c=Math.sign,u=.5522847493;e.exports={arc:function(t,e,i,n,c,u,_){var f,d,p,m=0,y=0,v=0,g=0,A=0,x=0,b=0,C=0,T=0,S=0,w=0,E=0,M=0;if(y=u-c,_=_||!1)if(h(y)>=2*r)y=2*r;else for(;y<0;)y+=2*r;else if(h(y)>=2*r)y=2*-r;else for(;y>0;)y-=2*r;for(p=0|a(1,s(h(y)/(.5*r)+.5,5)),v=h(4/3*(1-o(f=y/p/2))/l(f)),_||(v=-v),d=0;d<=p;d++)x=e+(g=o(m=c+y*(d/p)))*n,b=i+(A=l(m))*n,C=-A*n*v,T=g*n*v,0===d?t.moveTo(x,b):t.bezierCurveTo(S+E,w+M,x-C,b-T,x,b),S=x,w=b,E=C,M=T},ellipse:function(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*u,e-n*u,i+r,e,i+r),t.bezierCurveTo(e+n*u,i+r,e+n,i+r*u,e+n,i),t.bezierCurveTo(e+n,i-r*u,e+n*u,i-r,e,i-r),t.bezierCurveTo(e-n*u,i-r,e-n,i-r*u,e-n,i),t.close()},roundRect:function(t,e,i,n,r,a){if(a<.1)t.rect(e,i,n,r);else{var o=s(a,.5*h(n))*c(n),l=s(a,.5*h(r))*c(r);t.moveTo(e,i+l),t.lineTo(e,i+r-l),t.bezierCurveTo(e,i+r-l*(1-u),e+o*(1-u),i+r,e+o,i+r),t.lineTo(e+n-o,i+r),t.bezierCurveTo(e+n-o*(1-u),i+r,e+n,i+r-l*(1-u),e+n,i+r-l),t.lineTo(e+n,i+l),t.bezierCurveTo(e+n,i+l*(1-u),e+n-o*(1-u),i,e+n-o,i),t.lineTo(e+o,i),t.bezierCurveTo(e+o*(1-u),i,e,i+l*(1-u),e,i+l),t.close()}},tesselateBezier:function t(e,i,r,s,a,o,l,c,u,_,f){var d,p,m,y,v,g,A,x,b,C,T,S,w,E,M,D;_>10||(v=.5*(o+c),g=.5*(l+u),A=.5*((d=.5*(i+s))+(m=.5*(s+o))),x=.5*((p=.5*(r+a))+(y=.5*(a+l))),((M=h((s-c)*(E=u-r)-(a-u)*(w=c-i)))+(D=h((o-c)*E-(l-u)*w)))*(M+D)0){var r=this,s=t.map((function(t){return{type:"uuid",uuid:t}}));this.load(s,e,(function(t,e){if(i){for(var a=[],o=n&&[],l=0;le.length){var i=t.charCodeAt(e.length);return 46===i||47===i}return!0}var l=a.prototype;l.getUuid=function(t,e){t=cc.url.normalize(t);var i=this._pathToUuid[t];if(i)if(Array.isArray(i)){if(!e)return i[0].uuid;for(var n=0;n0&&n.src===s)return n;var a=function i(){n.removeEventListener("load",i),n.removeEventListener("error",o),n.id=t.id,e(null,n)},o=function i(){n.removeEventListener("load",a),n.removeEventListener("error",i),"https:"!==window.location.protocol&&n.crossOrigin&&"anonymous"===n.crossOrigin.toLowerCase()?f(t,e,!1,n):e(new Error(r.getError(4930,s)))};n.addEventListener("load",a),n.addEventListener("error",o),n.src=s}function d(t,e){e(null,t.url)}var p={js:_,png:f,jpg:f,bmp:f,jpeg:f,gif:f,ico:f,tiff:f,webp:f,image:f,pvr:l,pkm:l,mp3:s=t("./audio-downloader"),ogg:s,wav:s,m4a:s,txt:h,xml:h,vsh:h,fsh:h,atlas:h,tmx:h,tsx:h,json:h,ExportJson:h,plist:h,fnt:h,font:u,eot:u,ttf:u,woff:u,svg:u,ttc:u,uuid:function(t,e){var i=o.load(t,e);return void 0===i?this.extMap.json(t,e):i||void 0},binary:l,bin:l,dbbin:l,skel:l,mp4:d,avi:d,mov:d,mpg:d,mpeg:d,rm:d,rmvb:d,default:h},m="Downloader",y=function(t){this.id=m,this.async=!0,this.pipeline=null,this._curConcurrent=0,this._loadQueue=[],this._subpackages={},this.extMap=n.mixin(t,p)};y.ID=m,y.PackDownloader=o,y.prototype.addHandlers=function(t){n.mixin(this.extMap,t)},y.prototype._handleLoadQueue=function(){for(;this._curConcurrent@123\u4e01\u3041\u1101",a={},o=-1,l=[],h=3e3,c=(function(){var t=void 0;return function(){if(void 0===t)if(window.FontFace){var e=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),i=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);t=e?parseInt(e[1],10)>42:!i}else t=!1;return t}})();function u(){for(var t=!0,e=Date.now(),i=l.length-1;i>=0;i--){var a=l[i],c=a.fontFamilyName;if(e-a.startTime>h)cc.warnID(4933,c),a.callback(null,c),l.splice(i,1);else{var u=a.refWidth,_="40px "+c;r.font=_,u!==n.safeMeasureText(r,s,_)?(l.splice(i,1),a.callback(null,c)):t=!1}}t&&(clearInterval(o),o=-1)}function _(t,e,i){var n=new Promise(function(i,n){(function r(){Date.now()-t>=h?n():document.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))})()}),r=null,s=new Promise(function(t,e){r=setTimeout(e,h)});Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){cc.warnID(4933,e),i(null,e)}))}var f={loadFont:function(t,e){var i=t.url,h=f._getFontFamily(i);if(a[h])return h;if(!r){var d=document.createElement("canvas");d.width=100,d.height=100,r=d.getContext("2d")}var p="40px "+h;r.font=p;var m=n.safeMeasureText(r,s,p),y=document.createElement("style");y.type="text/css";var v="";isNaN(h-0)?v+="@font-face { font-family:"+h+"; src:":v+="@font-face { font-family:'"+h+"'; src:",v+="url('"+i+"');",y.textContent=v+"}",document.body.appendChild(y);var g=document.createElement("div"),A=g.style;if(A.fontFamily=h,g.innerHTML=".",A.position="absolute",A.left="-100px",A.top="-100px",document.body.appendChild(g),c())_(Date.now(),h,e);else{var x={fontFamilyName:h,refWidth:m,callback:e,startTime:Date.now()};l.push(x),-1===o&&(o=setInterval(u,100))}a[h]=y},_getFontFamily:function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}};e.exports=f}),{"../utils/text-utils":301}],164:[(function(t,e,i){"use strict";t("./downloader"),t("./loader"),t("./loading-items"),t("./pipeline"),t("./CCLoader")}),{"./CCLoader":156,"./downloader":162,"./loader":165,"./loading-items":166,"./pipeline":169}],165:[(function(t,e,i){"use strict";var n=t("../platform/js"),r=t("../platform/CCSAXParser").plistParser,s=t("./pipeline"),a=t("../assets/CCTexture2D"),o=t("./uuid-loader"),l=t("./font-loader");function h(t){if("string"!=typeof t.content)return new Error("JSON Loader: Input item doesn't contain string content");try{return JSON.parse(t.content)}catch(e){return new Error("JSON Loader: Parse json ["+t.id+"] failed : "+e)}}function c(t){if(t._owner instanceof cc.Asset)return null;var e=t.content;if(cc.sys.platform!==cc.sys.FB_PLAYABLE_ADS&&!(e instanceof Image))return new Error("Image Loader: Input item doesn't contain Image content");var i=t.texture||new a;return i._uuid=t.uuid,i.url=t.url,i._setRawAsset(t.rawUrl,!1),i._nativeAsset=e,i}function u(t,e){if(t._owner instanceof cc.Asset)return null;var i=new cc.AudioClip;return i._setRawAsset(t.rawUrl,!1),i._nativeAsset=t.content,i.url=t.url,i}function _(t){return t.load?t.load(t.content):null}var f=13,d=55727696,p=0,m=6,y=7,v=12;var g=16,A=6,x=8,b=10,C=12,T=14,S=0,w=1,E=3;function M(t,e){return t[e]<<8|t[e+1]}var D={png:c,jpg:c,bmp:c,jpeg:c,gif:c,ico:c,tiff:c,webp:c,image:c,pvr:function(t){var e=t.content instanceof ArrayBuffer?t.content:t.content.buffer,i=new Int32Array(e,0,f);if(i[p]!=d)return new Error("Invalid magic number in PVR header");var n=i[y],r=i[m],s=i[v]+52;return{_data:new Uint8Array(e,s),_compressed:!0,width:n,height:r}},pkm:function(t){var e=t.content instanceof ArrayBuffer?t.content:t.content.buffer,i=new Uint8Array(e),n=M(i,A);if(n!==S&&n!==w&&n!==E)return new Error("Invalid magic number in ETC header");var r=M(i,C),s=M(i,T);return M(i,x),M(i,b),{_data:new Uint8Array(e,g),_compressed:!0,width:r,height:s}},mp3:u,ogg:u,wav:u,m4a:u,json:h,ExportJson:h,plist:function(t){if("string"!=typeof t.content)return new Error("Plist Loader: Input item doesn't contain string content");var e=r.parse(t.content);return e||new Error("Plist Loader: Parse ["+t.id+"] failed")},uuid:o,prefab:o,fire:o,scene:o,binary:_,dbbin:_,bin:_,skel:_,font:l.loadFont,eot:l.loadFont,ttf:l.loadFont,woff:l.loadFont,svg:l.loadFont,ttc:l.loadFont,default:function(){return null}},B=function(t){this.id="Loader",this.async=!0,this.pipeline=null,this.extMap=n.mixin(t,D)};B.ID="Loader",B.prototype.addHandlers=function(t){this.extMap=n.mixin(this.extMap,t)},B.prototype.handle=function(t,e){return(this.extMap[t.type]||this.extMap.default).call(this,t,e)},s.Loader=e.exports=B}),{"../assets/CCTexture2D":71,"../platform/CCSAXParser":216,"../platform/js":229,"./font-loader":163,"./pipeline":169,"./uuid-loader":175}],166:[(function(t,e,i){"use strict";var n=t("../platform/callbacks-invoker");t("../utils/CCPath");var r=t("../platform/js"),s=0|998*Math.random(),a=r.createMap(!0),o=[],l={WORKING:1,COMPLETE:2,ERROR:3},h=r.createMap(!0);function c(t){return"string"==typeof(t.url||t)}function u(t){if(t){var e=t.split("?");if(e&&e[0]&&e[1]){var i={};return e[1].split("&").forEach((function(t){var e=t.split("=");i[e[0]]=e[1]})),i}}}function _(t,e){var i="object"==typeof t?t.url:t,n={queueId:e,id:i,url:i,rawUrl:void 0,urlParam:u(i),type:"",error:null,content:null,complete:!1,states:{},deps:null};if("object"==typeof t&&(r.mixin(n,t),t.skips))for(var s=0;s=0)&&(s.deps&&d(t,s,!0))){n=!0;break}}}return i||(f.length=0),n}var p=function(t,e,i,o){n.call(this),this._id=++s,a[this._id]=this,this._pipeline=t,this._errorUrls=r.createMap(!0),this._appending=!1,this._ownerQueue=null,this.onProgress=i,this.onComplete=o,this.map=r.createMap(!0),this.completed={},this.totalCount=0,this.completedCount=0,this._pipeline?this.active=!0:this.active=!1,e&&(e.length>0?this.append(e):this.allComplete())};p.ItemState=new cc.Enum(l),p.create=function(t,e,i,n){void 0===i?"function"==typeof e&&(n=e,e=i=null):void 0===n&&("function"==typeof e?(n=i,i=e,e=null):(n=i,i=null));var r=o.pop();return r?(r._pipeline=t,r.onProgress=i,r.onComplete=n,a[r._id]=r,r._pipeline&&(r.active=!0),e&&r.append(e)):r=new p(t,e,i,n),r},p.getQueue=function(t){return t.queueId?a[t.queueId]:null},p.itemComplete=function(t){var e=a[t.queueId];e&&e.itemComplete(t.id)},p.initQueueDeps=function(t){var e=h[t._id];e?(e.completed.length=0,e.deps.length=0):e=h[t._id]={completed:[],deps:[]}},p.registerQueueDep=function(t,e){var i=t.queueId||t;if(!i)return!1;var n=h[i];if(n)-1===n.deps.indexOf(e)&&n.deps.push(e);else if(t.id)for(var r in h){var s=h[r];-1!==s.deps.indexOf(t.id)&&-1===s.deps.indexOf(e)&&s.deps.push(e)}},p.finishDep=function(t){for(var e in h){var i=h[e];-1!==i.deps.indexOf(t)&&-1===i.completed.indexOf(t)&&i.completed.push(t)}};var m=p.prototype;r.mixin(m,n.prototype),m.append=function(t,e){if(!this.active)return[];e&&!e.deps&&(e.deps=[]),this._appending=!0;var i,n,r,s=[];for(i=0;i=this.totalCount},m.isItemCompleted=function(t){return!!this.completed[t]},m.exists=function(t){return!!this.map[t]},m.getContent=function(t){var e=this.map[t],i=null;return e&&(e.content?i=e.content:e.alias&&(i=e.alias.content)),i},m.getError=function(t){var e=this.map[t],i=null;return e&&(e.error?i=e.error:e.alias&&(i=e.alias.error)),i},m.addListener=n.prototype.on,m.hasListener=n.prototype.hasEventListener,m.removeListener=n.prototype.off,m.removeAllListeners=n.prototype.removeAll,m.removeItem=function(t){var e=this.map[t];e&&this.completed[e.alias||t]&&(delete this.completed[t],delete this.map[t],e.alias&&(delete this.completed[e.alias.id],delete this.map[e.alias.id]),this.completedCount--,this.totalCount--)},m.itemComplete=function(t){var e=this.map[t];if(e){var i=t in this._errorUrls;if(e.error instanceof Error||r.isString(e.error)?this._errorUrls[t]=e.error:e.error?r.mixin(this._errorUrls,e.error):!e.error&&i&&delete this._errorUrls[t],this.completed[t]=e,this.completedCount++,p.finishDep(e.id),this.onProgress){var n=h[this._id];this.onProgress(n?n.completed.length:this.completedCount,n?n.deps.length:this.totalCount,e)}this.emit(t,e),this.removeAll(t),!this._appending&&this.completedCount>=this.totalCount&&this.allComplete()}},m.destroy=function(){this.active=!1,this._appending=!1,this._pipeline=null,this._ownerQueue=null,r.clear(this._errorUrls),this.onProgress=null,this.onComplete=null,this.map=r.createMap(!0),this.completed={},this.totalCount=0,this.completedCount=0,n.call(this),h[this._id]&&(h[this._id].completed.length=0,h[this._id].deps.length=0),delete a[this._id],delete h[this._id],-1===o.indexOf(this)&&o.length<10&&o.push(this)},cc.LoadingItems=e.exports=p}),{"../platform/callbacks-invoker":222,"../platform/js":229,"../utils/CCPath":283}],167:[(function(t,e,i){"use strict";var n=t("./pipeline"),r="MD5Pipe",s=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/,a=function(t,e,i){this.id=r,this.async=!1,this.pipeline=null,this.md5AssetsMap=t,this.md5NativeAssetsMap=e,this.libraryBase=i};a.ID=r,a.prototype.handle=function(t){return t.url=this.transformURL(t.url),null},a.prototype.transformURL=function(t){var e=!t.startsWith(this.libraryBase)?this.md5NativeAssetsMap:this.md5AssetsMap;return t=t.replace(s,(function(t,i){var n=e[i];return n?t+"."+n:t}))},n.MD5Pipe=e.exports=a}),{"./pipeline":169}],168:[(function(t,e,i){"use strict";var n=t("./unpackers"),r=t("../utils/misc").pushToMap,s={Invalid:0,Removed:1,Downloading:2,Loaded:3};function a(){this.unpacker=null,this.state=s.Invalid,this.duration=0}var o={},l={},h={},c=[],u=null;function _(t,e){return new Error("Can not retrieve "+t+" from packer "+e)}e.exports={msToRelease:12e4,initPacks:function(t){for(var e in l=t,o={},t)for(var i=t[e],n=0;n=0;e--){var i=c[e];++h[i].duration>t&&a.release(i)}0===c.length&&(clearInterval(u),u=null)}),5e3))}return r.unpacker.retrieve(t)},_selectLoadedPack:function(t){for(var e=s.Invalid,i="",n=0;ne&&(e=o,i=r)}}return e!==s.Invalid?i:t[0]},load:function(t,e){var i=t.uuid,n=o[i];if(n){Array.isArray(n)&&(n=this._selectLoadedPack(n));var r=h[n];if(r&&r.state===s.Loaded){r.duration=0;var l=r.unpacker.retrieve(i);return l||_(i,n)}return r||(console.log("Create unpacker %s for %s",n,i),(r=h[n]=new a).state=s.Downloading),this._loadNewPack(i,n,e),null}},release:function(t){var e=h[t];e&&(cc.loader.release(e.url),delete h[t],cc.js.array.fastRemove(c,t))}}}),{"../utils/misc":294,"./unpackers":173}],169:[(function(t,e,i){"use strict";var n=t("../platform/js"),r=t("./loading-items"),s=r.ItemState;function a(t,e){var i=t.id,n=e.states[i],r=t.next,o=t.pipeline;if(!e.error&&n!==s.WORKING&&n!==s.ERROR)if(n===s.COMPLETE)r?a(r,e):o.flowOut(e);else{e.states[i]=s.WORKING;var l=t.handle(e,(function(t,n){t?(e.error=t,e.states[i]=s.ERROR,o.flowOut(e)):(n&&(e.content=n),e.states[i]=s.COMPLETE,r?a(r,e):o.flowOut(e))}));l instanceof Error?(e.error=l,e.states[i]=s.ERROR,o.flowOut(e)):void 0!==l&&(null!==l&&(e.content=l),e.states[i]=s.COMPLETE,r?a(r,e):o.flowOut(e))}}var o=function(t){this._pipes=t,this._cache=n.createMap(!0);for(var e=0;ethis._pipes.length)cc.warnID(4921);else if(this._pipes.indexOf(t)>0)cc.warnID(4922);else{t.pipeline=this;var i=null;e0&&(n=this._pipes[e-1]),n&&(n.next=t),t.next=i,this._pipes.splice(e,0,t)}},l.insertPipeAfter=function(t,e){var i=this._pipes.indexOf(t);i<0||this.insertPipe(e,i+1)},l.appendPipe=function(t){t.handle&&t.id&&(t.pipeline=this,t.next=null,this._pipes.length>0&&(this._pipes[this._pipes.length-1].next=t),this._pipes.push(t))},l.flowIn=function(t){var e,i,n=this._pipes[0];if(n){for(e=0;e0){for(var p=new DataView(i,r),m=n,y=l.num,v=0;v0||this.disableRender()},_updateMaterial:function(){var t=this.textures;if(t&&t.length>0)for(var e=this._getDefaultMaterial(),i=0;i>2,f=c.vertexOffset,d=h._vData,p=h._iData;!i.worldMatDirty&&this._worldDatas[n]||this._updateWorldVertices(n,a,r,s,t.node._worldMatrix),d.set(this._worldDatas[n],_);for(var m=0;ms&&(this._accumulator=s);this._accumulator>r;)e.Step(r,i,n),this._accumulator-=r}else{var a=1/cc.game.config.frameRate;e.Step(a,i,n)}this.debugDrawFlags&&(this._checkDebugDrawValid(),this._debugDrawer.clear(),e.DrawDebugData()),this._steping=!1;for(var o=this._delayEvents,l=0,h=o.length;l0){for(var s=n.getPoints(),o=n.getNormals(),h=n.getFractions(),c=[],u=0,_=r.length;u<_;u++){var p=r[u],m=p.collider;if(i===a.AllClosest){var y=c.find((function(t){return t.collider===m}));if(y){h[u]0}function h(t,e,i){return v(t,e,i)>=0}function c(t,e,i){return v(t,e,i)<=0}function u(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function _(t){f(t)||t.reverse()}function f(t){return t.length<3||d(t)>0}function d(t){var e,i=0;for(e=0;eE&&(M=S,E=D)}y=r(T,M,e),v=r(M,T,e)}return g=(g=g.concat(t(y))).concat(t(v))}g.push(e);for(T=g.length-1;T>=0;T--)0==g[T].length&&g.splice(T,0);return g},ForceCounterClockWise:_,IsCounterClockWise:f}}),{}],186:[(function(t,e,i){"use strict";var n=t("../CCNode").EventType,r=t("./CCPhysicsTypes").PTM_RATIO,s=t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,a=t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,o=t("./utils").getWorldRotation,l=t("./CCPhysicsTypes").BodyType,h=new b2.Vec2,c=new b2.Vec2,u=cc.Vec2.ZERO,_=cc.Class({name:"cc.RigidBody",extends:cc.Component,editor:!1,properties:{_type:l.Dynamic,_allowSleep:!0,_gravityScale:1,_linearDamping:0,_angularDamping:0,_linearVelocity:cc.v2(0,0),_angularVelocity:0,_fixedRotation:!1,enabled:{get:function(){return this._enabled},set:function(){cc.warnID(8200)},visible:!1,override:!0},enabledContactListener:{default:!1,tooltip:!1},bullet:{default:!1,tooltip:!1},type:{type:l,tooltip:!1,get:function(){return this._type},set:function(t){this._type=t,this._b2Body&&(t===l.Animated?this._b2Body.SetType(l.Kinematic):this._b2Body.SetType(t))}},allowSleep:{tooltip:!1,get:function(){return this._b2Body?this._b2Body.IsSleepingAllowed():this._allowSleep},set:function(t){this._allowSleep=t,this._b2Body&&this._b2Body.SetSleepingAllowed(t)}},gravityScale:{tooltip:!1,get:function(){return this._gravityScale},set:function(t){this._gravityScale=t,this._b2Body&&this._b2Body.SetGravityScale(t)}},linearDamping:{tooltip:!1,get:function(){return this._linearDamping},set:function(t){this._linearDamping=t,this._b2Body&&this._b2Body.SetLinearDamping(this._linearDamping)}},angularDamping:{tooltip:!1,get:function(){return this._angularDamping},set:function(t){this._angularDamping=t,this._b2Body&&this._b2Body.SetAngularDamping(t)}},linearVelocity:{tooltip:!1,type:cc.Vec2,get:function(){var t=this._linearVelocity;if(this._b2Body){var e=this._b2Body.GetLinearVelocity();t.x=e.x*r,t.y=e.y*r}return t},set:function(t){this._linearVelocity=t;var e=this._b2Body;if(e){var i=e.m_linearVelocity;i.Set(t.x/r,t.y/r),e.SetLinearVelocity(i)}}},angularVelocity:{tooltip:!1,get:function(){return this._b2Body?this._b2Body.GetAngularVelocity()*a:this._angularVelocity},set:function(t){this._angularVelocity=t,this._b2Body&&this._b2Body.SetAngularVelocity(t*s)}},fixedRotation:{tooltip:!1,get:function(){return this._fixedRotation},set:function(t){this._fixedRotation=t,this._b2Body&&this._b2Body.SetFixedRotation(t)}},awake:{visible:!1,tooltip:!1,get:function(){return!!this._b2Body&&this._b2Body.IsAwake()},set:function(t){this._b2Body&&this._b2Body.SetAwake(t)}},awakeOnLoad:{default:!0,tooltip:!1,animatable:!1},active:{visible:!1,get:function(){return!!this._b2Body&&this._b2Body.IsActive()},set:function(t){this._b2Body&&this._b2Body.SetActive(t)}}},getLocalPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){h.Set(t.x/r,t.y/r);var i=this._b2Body.GetLocalPoint(h,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){h.Set(t.x/r,t.y/r);var i=this._b2Body.GetWorldPoint(h,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldVector:function(t,e){if(e=e||cc.v2(),this._b2Body){h.Set(t.x/r,t.y/r);var i=this._b2Body.GetWorldVector(h,e);e.x=i.x*r,e.y=i.y*r}return e},getLocalVector:function(t,e){if(e=e||cc.v2(),this._b2Body){h.Set(t.x/r,t.y/r);var i=this._b2Body.GetLocalVector(h,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldPosition:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetPosition();t.x=e.x*r,t.y=e.y*r}return t},getWorldRotation:function(){return this._b2Body?this._b2Body.GetAngle()*a:0},getLocalCenter:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetLocalCenter();t.x=e.x*r,t.y=e.y*r}return t},getWorldCenter:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetWorldCenter();t.x=e.x*r,t.y=e.y*r}return t},getLinearVelocityFromWorldPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){h.Set(t.x/r,t.y/r);var i=this._b2Body.GetLinearVelocityFromWorldPoint(h,e);e.x=i.x*r,e.y=i.y*r}return e},getMass:function(){return this._b2Body?this._b2Body.GetMass():0},getInertia:function(){return this._b2Body?this._b2Body.GetInertia()*r*r:0},getJointList:function(){if(!this._b2Body)return[];var t=[],e=this._b2Body.GetJointList();if(!e)return[];t.push(e.joint._joint);for(var i=e.prev;i;)t.push(i.joint._joint),i=i.prev;for(var n=e.next;n;)t.push(n.joint._joint),n=n.next;return t},applyForce:function(t,e,i){this._b2Body&&(h.Set(t.x/r,t.y/r),c.Set(e.x/r,e.y/r),this._b2Body.ApplyForce(h,c,i))},applyForceToCenter:function(t,e){this._b2Body&&(h.Set(t.x/r,t.y/r),this._b2Body.ApplyForceToCenter(h,e))},applyTorque:function(t,e){this._b2Body&&this._b2Body.ApplyTorque(t/r,e)},applyLinearImpulse:function(t,e,i){this._b2Body&&(h.Set(t.x/r,t.y/r),c.Set(e.x/r,e.y/r),this._b2Body.ApplyLinearImpulse(h,c,i))},applyAngularImpulse:function(t,e){this._b2Body&&this._b2Body.ApplyAngularImpulse(t/r/r,e)},syncPosition:function(t){var e=this._b2Body;if(e){var i,n=this.node.convertToWorldSpaceAR(u);if((i=this.type===l.Animated?e.GetLinearVelocity():e.GetPosition()).x=n.x/r,i.y=n.y/r,this.type===l.Animated&&t){var s=e.GetPosition(),a=cc.game.config.frameRate;i.x=(i.x-s.x)*a,i.y=(i.y-s.y)*a,e.SetAwake(!0),e.SetLinearVelocity(i)}else e.SetTransformVec(i,e.GetAngle())}},syncRotation:function(t){var e=this._b2Body;if(e){var i=s*o(this.node);if(this.type===l.Animated&&t){var n=e.GetAngle(),r=cc.game.config.frameRate;e.SetAwake(!0),e.SetAngularVelocity((i-n)*r)}else e.SetTransformVec(e.GetPosition(),i)}},resetVelocity:function(){var t=this._b2Body;if(t){var e=t.m_linearVelocity;e.Set(0,0),t.SetLinearVelocity(e),t.SetAngularVelocity(0)}},onEnable:function(){this._init()},onDisable:function(){this._destroy()},_registerNodeEvents:function(){var t=this.node;t.on(n.POSITION_CHANGED,this._onNodePositionChanged,this),t.on(n.ROTATION_CHANGED,this._onNodeRotationChanged,this),t.on(n.SCALE_CHANGED,this._onNodeScaleChanged,this)},_unregisterNodeEvents:function(){var t=this.node;t.off(n.POSITION_CHANGED,this._onNodePositionChanged,this),t.off(n.ROTATION_CHANGED,this._onNodeRotationChanged,this),t.off(n.SCALE_CHANGED,this._onNodeScaleChanged,this)},_onNodePositionChanged:function(){this.syncPosition(!0)},_onNodeRotationChanged:function(t){this.syncRotation(!0)},_onNodeScaleChanged:function(t){if(this._b2Body)for(var e=this.getComponents(cc.PhysicsCollider),i=0;i=0;n--){var r=t[n];r.collider=null,i._unregisterContactFixture(r),e&&e.DestroyFixture(r)}this.body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},_createShape:function(){},apply:function(){this._destroy(),this._init()},getAABB:function(){for(var t=1e7,e=1e7,i=-1e7,r=-1e7,s=this._fixtures,a=0;ai&&(i=c.upperBound.x),c.upperBound.y>r&&(r=c.upperBound.y)}t*=n,e*=n,i*=n,r*=n;var u=this._rect;return u.x=t,u.y=e,u.width=i-t,u.height=r-e,u}});cc.PhysicsCollider=e.exports=s}),{"../CCPhysicsTypes":184,"../utils":207}],192:[(function(t,e,i){"use strict";var n=t("../CCPhysicsTypes").PTM_RATIO,r=t("../CCPolygonSeparator"),s=cc.Class({name:"cc.PhysicsPolygonCollider",extends:cc.PhysicsCollider,mixins:[cc.Collider.Polygon],editor:{menu:!1,inspector:!1,requireComponent:cc.RigidBody},_createShape:function(t){var e=[],i=this.points;i.length>0&&i[0].equals(i[i.length-1])&&(i.length-=1);for(var s=r.ConvexPartition(i),a=this.offset,o=0;o=2?1:n)},n.prototype.getFixtures=function(){return this._fixtures},n.prototype.getPoints=function(){return this._points},n.prototype.getNormals=function(){return this._normals},n.prototype.getFractions=function(){return this._fractions},cc.PhysicsRayCastCallback=e.exports=n}),{}],207:[(function(t,e,i){"use strict";e.exports={getWorldRotation:function(t){for(var e=t.angle,i=t.parent;i.parent;)e+=i.angle,i=i.parent;return-e},getWorldScale:function(t){for(var e=t.scaleX,i=t.scaleY,n=t.parent;n.parent;)e*=n.scaleX,i*=n.scaleY,n=n.parent;return cc.v2(e,i)},convertToNodeRotation:function(t,e){e-=-t.angle;for(var i=t.parent;i.parent;)e-=-i.angle,i=i.parent;return e}}}),{}],208:[(function(t,e,i){"use strict";t("../assets/CCAsset");var n=t("./utils").callInNextTick,r=t("../load-pipeline/CCLoader"),s=t("../load-pipeline/asset-table"),a=t("../load-pipeline/pack-downloader"),o=t("../load-pipeline/auto-release-utils"),l=t("../utils/decode-uuid"),h=t("../load-pipeline/md5-pipe"),c=t("../load-pipeline/subpackage-pipe"),u=t("./js"),_="",f="",d=u.createMap(!0);function p(t){return t&&(t.constructor===cc.SceneAsset||t instanceof cc.Scene)}function m(t,e){this.url=t,this.type=e}var y={loadAsset:function(t,e,i){if("string"!=typeof t)return n(e,new Error("[AssetLibrary] uuid must be string"),null);var s={uuid:t,type:"uuid"};i&&i.existingAsset&&(s.existingAsset=i.existingAsset),r.load(s,(function(i,n){if(i||!n){var s="string"==typeof i?i:i?i.message||i.errorMessage||JSON.stringify(i):"Unknown error";i=new Error("[AssetLibrary] loading JSON or dependencies failed:"+s)}else{if(n.constructor===cc.SceneAsset){var a=cc.loader._getReferenceKey(t);n.scene.dependAssets=o.getDependsRecursively(a)}if(p(n)){var l=cc.loader._getReferenceKey(t);r.removeItem(l)}}e&&e(i,n)}))},getLibUrlNoExt:function(t,e){return t=l(t),(e?f+"assets/":_)+t.slice(0,2)+"/"+t},_queryAssetInfoInEditor:function(t,e){0},_getAssetInfoInRuntime:function(t,e){e=e||{url:null,raw:!1};var i=d[t];return i&&!u.isChildClassOf(i.type,cc.Asset)?(e.url=f+i.url,e.raw=!0):(e.url=this.getLibUrlNoExt(t)+".json",e.raw=!1),e},_uuidInSettings:function(t){return t in d},queryAssetInfo:function(t,e){var i=this._getAssetInfoInRuntime(t);e(null,i.url,i.raw)},parseUuidInEditor:function(t){},loadJson:function(t,e){var i=""+((new Date).getTime()+Math.random()),n={uuid:i,type:"uuid",content:t,skips:[r.assetLoader.id,r.downloader.id]};r.load(n,(function(t,n){if(t)t=new Error("[AssetLibrary] loading JSON or dependencies failed: "+t.message);else{if(n.constructor===cc.SceneAsset){var s=cc.loader._getReferenceKey(i);n.scene.dependAssets=o.getDependsRecursively(s)}if(p(n)){var a=cc.loader._getReferenceKey(i);r.removeItem(a)}}n._uuid="",e&&e(t,n)}))},getAssetByUuid:function(t){return y._uuidToAsset[t]||null},init:function(t){var e=t.libraryPath;if(e=e.replace(/\\/g,"/"),_=cc.path.stripSep(e)+"/",f=t.rawAssetsBase,t.subpackages){var i=new c(t.subpackages);cc.loader.insertPipeAfter(cc.loader.assetLoader,i),cc.loader.subPackPipe=i}var n=t.md5AssetsMap;if(n&&n.import){var o=0,p=0,y=u.createMap(!0),v=n.import;for(o=0;o0?s:null,!0);var u=o.prototype;if(e&&(c||(n.extend(o,e),u=o.prototype),o.$super=e),i){for(var _=i.length-1;_>=0;_--){var f=i[_];m(u,f.prototype),m(o,f,(function(t){return f.hasOwnProperty(t)&&!0})),D._isCCClass(f)&&m(a.getClassAttrs(o),a.getClassAttrs(f))}u.constructor=o}return c||(u.__initProps__=C),n.setClassName(t,o),o}function v(t,e,i,r){var s=cc.Component,a=cc._RF.peek();if(a&&n.isChildClassOf(e,s)){if(n.isChildClassOf(a.cls,s))return cc.errorID(3615),null;0,t=t||a.script}var o=y(t,e,i,r);if(a)if(n.isChildClassOf(e,s)){var l=a.uuid;l&&n._setClassId(l,o),a.cls=o}else n.isChildClassOf(a.cls,s)||(a.cls=o);return o}function g(t){for(var e=n.getClassName(t),i=t.constructor,r="new "+e+"(",s=0;s0){0;var a="].apply(this,arguments);\n";if(1===s)r+="CCClass.__ctors__[0"+a;else{r+="var cs=CCClass.__ctors__;\n";for(var o=0;o=0)){var a=e[s];if("function"==typeof a){var o=n.getPropertyDescriptor(t.prototype,s);if(o){var l=o.value;if("function"==typeof l){w.test(a)&&(r=!0,e[s]=(function(t,e){return function(){var i=this._super;this._super=t;var n=e.apply(this,arguments);return this._super=i,n}})(l,a));continue}}0}}return r}function M(t,e,i,n,r,s){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),r)for(var h=0;h=0)){var f=t[_];l.validateMethodWithProps(f,_,e,s,i)&&n.value(s.prototype,_,f,!0,!0)}var d=t.editor;return d&&n.isChildClassOf(i,cc.Component)&&cc.Component._registerEditorProps(s,d),s}D._isCCClass=function(t){return t&&t.hasOwnProperty("__ctors__")},D._fastDefine=function(t,e,i){n.setClassName(t,e);for(var r=e.__props__=e.__values__=Object.keys(i),s=a.getClassAttrs(e),l=0;l=2&&((l||c())[h+"min"]=d[0],l[h+"max"]=d[1],d.length>2&&(l[h+"step"]=d[2])),f("min","number"),f("max","number"),f("step","number")}cc.Class=D,e.exports={isArray:function(t){return t=p(t),Array.isArray(t)},fastDefine:D._fastDefine,getNewValueTypeCode:g,IDENTIFIER_RE:b,escapeForJS:A,getDefault:p}}),{"./CCEnum":211,"./attribute":221,"./js":229,"./preprocess-class":230,"./requiring-frame":231,"./utils":233}],210:[(function(t,e,i){"use strict";t("./CCClass");var n=t("./preprocess-class"),r=t("./js"),s="__ccclassCache__";function a(t){return t}function o(t,e){return t[e]||(t[e]={})}function l(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function h(t,e,i){return function(t){return function(i){return e(i,t)}}}var c=h.bind(null,!1);function u(t){return h.bind(null,!1)}var _=u(),f=u();function d(t,e){return o(t,s)}function p(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function m(t){var e;try{e=new t}catch(t){return{}}return e}function y(t,e,i,s,a,o){var l,h=a&&(a.get||a.set);s&&(l=n.getFullFormOfProperty(s,h));var c=e[i],u=r.mixin(c||{},l||s||{});if(h){a.get&&(u.get=a.get),a.set&&(u.set=a.set)}else{0;var _=void 0;if(a)a.initializer&&(_=p(a.initializer),!0);else{var f=o.default||(o.default=m(t));f.hasOwnProperty(i)&&(_=f[i],!0)}0,u.default=_}e[i]=u}var v=l((function(t,e){var i=r.getSuper(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t,__ES6__:!0},a=t[s];if(a){var o=a.proto;o&&r.mixin(n,o),t[s]=void 0}return cc.Class(n)}));function g(t,e,i){return t((function(t,n){var r=d(t);if(r){var s=void 0!==i?i:n;o(o(r,"proto"),"editor")[e]=s}}),e)}function A(t){return t(a)}var x=A(l),b=g(c,"requireComponent"),C=A(_),T=g(f,"executionOrder"),S=A(l),w=A(l),E=A(_),M=A(_),D=A(_);cc._decorator=e.exports={ccclass:v,property:function(t,e,i){var n=null;function r(t,e,i){var r=d(t.constructor);if(r){var s=o(o(r,"proto"),"properties");y(t.constructor,s,e,n,i,r)}}if(void 0===e)return n=t,r;r(t,e,i)},executeInEditMode:x,requireComponent:b,menu:C,executionOrder:T,disallowMultiple:S,playOnFocus:w,inspector:E,icon:M,help:D,mixins:function(){for(var t=[],e=0;ea)return this._removeUsedIndexBit(i),delete this._touchesIntegerDict[n.getID()],i;t>>=1}return-1},_removeUsedIndexBit:function(t){if(!(t<0||t>=this._maxTouches)){var e=1<0){this._glView._convertTouchesWithScale(a);var _=new cc.Event.EventTouch(a);_._eventCode=cc.Event.EventTouch.BEGAN,s.dispatchEvent(_)}},handleTouchesMove:function(t){for(var e,i,n,a=[],o=this._touches,l=r.now(),h=0,c=t.length;h0){this._glView._convertTouchesWithScale(a);var u=new cc.Event.EventTouch(a);u._eventCode=cc.Event.EventTouch.MOVED,s.dispatchEvent(u)}},handleTouchesEnd:function(t){var e=this.getSetOfTouchesEndOrCancel(t);if(e.length>0){this._glView._convertTouchesWithScale(e);var i=new cc.Event.EventTouch(e);i._eventCode=cc.Event.EventTouch.ENDED,s.dispatchEvent(i)}this._preTouchPool.length=0},handleTouchesCancel:function(t){var e=this.getSetOfTouchesEndOrCancel(t);if(e.length>0){this._glView._convertTouchesWithScale(e);var i=new cc.Event.EventTouch(e);i._eventCode=cc.Event.EventTouch.CANCELED,s.dispatchEvent(i)}this._preTouchPool.length=0},getSetOfTouchesEndOrCancel:function(t){for(var e,i,n,r=[],s=this._touches,a=this._touchesIntegerDict,o=0,l=t.length;o=0;r--)if(i[r].getID()===n){e=i[r];break}return e||(e=t),e},setPreTouch:function(t){for(var e=!1,i=this._preTouchPool,n=t.getID(),r=i.length-1;r>=0;r--)if(i[r].getID()===n){i[r]=t,e=!0;break}e||(i.length<=50?i.push(t):(i[this._preTouchPoolPointer]=t,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(t,e,i){var n=this._preTouchPoint,r=this._glView.convertToLocationInView(t,e,i),s=new cc.Touch(r.x,r.y,0);return s._setPrevPoint(n.x,n.y),n.x=r.x,n.y=r.y,s},getMouseEvent:function(t,e,i){var n=this._prevMousePoint,r=new cc.Event.EventMouse(i);return r._setPrevCursor(n.x,n.y),n.x=t.x,n.y=t.y,this._glView._convertMouseToLocationInView(n,e),r.setLocation(n.x,n.y),r},getPointByEvent:function(t,e){return cc.sys.browserType!==cc.sys.BROWSER_TYPE_QQ&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_UC&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_SAFARI||this._updateCanvasBoundingRect(),null!=t.pageX?{x:t.pageX,y:t.pageY}:(e.left-=document.body.scrollLeft,e.top-=document.body.scrollTop,{x:t.clientX,y:t.clientY})},getTouchesByEvent:function(t,e){for(var i,n,s,a=[],l=this._glView,h=this._preTouchPoint,c=t.changedTouches.length,u=0;uthis._accelInterval&&(this._accelCurTime-=this._accelInterval,s.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration))),this._accelCurTime+=t}};e.exports=cc.internal.inputManager=l}),{"../event-manager":133,"./CCMacro":214,"./CCSys":218}],214:[(function(t,e,i){"use strict";cc.macro={RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,MIN_ZINDEX:-Math.pow(2,15),MAX_ZINDEX:Math.pow(2,15)-1,ONE:1,ZERO:0,SRC_ALPHA:770,SRC_ALPHA_SATURATE:776,SRC_COLOR:768,DST_ALPHA:772,DST_COLOR:774,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775,ONE_MINUS_CONSTANT_ALPHA:32772,ONE_MINUS_CONSTANT_COLOR:32770,ORIENTATION_PORTRAIT:1,ORIENTATION_LANDSCAPE:2,ORIENTATION_AUTO:3,DENSITYDPI_DEVICE:"device-dpi",DENSITYDPI_HIGH:"high-dpi",DENSITYDPI_MEDIUM:"medium-dpi",DENSITYDPI_LOW:"low-dpi",FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX:!0,DIRECTOR_STATS_POSITION:cc.v2(0,0),ENABLE_STACKABLE_ACTIONS:!0,TOUCH_TIMEOUT:5e3,BATCH_VERTEX_COUNT:2e4,ENABLE_TILEDMAP_CULLING:!0,DOWNLOAD_MAX_CONCURRENT:64,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!1,ENABLE_CULLING:!1,CLEANUP_IMAGE_CACHE:!1,SHOW_MESH_WIREFRAME:!1,SHOW_MESH_NORMAL:!1,ENABLE_MULTI_TOUCH:!0},Object.defineProperty(cc.macro,"ROTATE_ACTION_CCW",{set:function(t){cc.RotateTo&&cc.RotateBy&&(cc.RotateTo._reverse=cc.RotateBy._reverse=t)}});cc.macro.SUPPORT_TEXTURE_FORMATS=[".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],cc.macro.KEY={none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},cc.macro.ImageFormat=cc.Enum({JPG:0,PNG:1,TIFF:2,WEBP:3,PVR:4,ETC:5,S3TC:6,ATITC:7,TGA:8,RAWDATA:9,UNKNOWN:10}),cc.macro.BlendFactor=cc.Enum({ONE:1,ZERO:0,SRC_ALPHA:770,SRC_COLOR:768,DST_ALPHA:772,DST_COLOR:774,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775}),cc.macro.TextAlignment=cc.Enum({LEFT:0,CENTER:1,RIGHT:2}),cc.macro.VerticalTextAlignment=cc.Enum({TOP:0,CENTER:1,BOTTOM:2}),e.exports=cc.macro}),{}],215:[(function(t,e,i){"use strict";var n=t("./js"),r=t("./CCClass"),s=1;function a(){this._name="",this._objFlags=0}r.fastDefine("cc.Object",a,{_name:"",_objFlags:0}),n.value(a,"Flags",{Destroyed:s,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20});var o=[];function l(){for(var t=o.length,e=0;e0)return void(t.webkitEnterFullscreen&&t.webkitEnterFullscreen());t.setAttribute("x5-video-player-fullscreen","true")}if(this._supportsFullScreen){if(t=t||document.documentElement,e){var n=this._fn.fullscreenchange;this._onfullscreenchange&&document.removeEventListener(n,this._onfullscreenchange),this._onfullscreenchange=e,document.addEventListener(n,e,!1)}if(i){var r=this._fn.fullscreenerror;this._onfullscreenerror&&document.removeEventListener(r,this._onfullscreenerror),this._onfullscreenerror=i,document.addEventListener(r,i,{once:!0})}t[this._fn.requestFullscreen]()}},exitFullScreen:function(t){if(t&&"video"===t.tagName.toLowerCase()){if(cc.sys.os===cc.sys.OS_IOS&&cc.sys.isBrowser)return void(t.webkitExitFullscreen&&t.webkitExitFullscreen());t.setAttribute("x5-video-player-fullscreen","false")}return!this._supportsFullScreen||document[this._fn.exitFullscreen]()},autoFullScreen:function(t,e){t=t||document.body,this._ensureFullScreen(t,e),this.requestFullScreen(t,e)},disableAutoFullScreen:function(t){var e=cc.game.canvas||t,i=this._touchEvent;this._preOnTouch&&(e.removeEventListener(i,this._preOnTouch),this._preOnTouch=null)},_ensureFullScreen:function(t,e){var i=this,n=cc.game.canvas||t,r=this._fn.fullscreenerror;if(void 0!==document[r]){var s=this._touchEvent;this._preOnFullScreenError&&t.removeEventListener(r,this._preOnFullScreenError),this._preOnFullScreenError=a,t.addEventListener(r,a,{once:!0})}function a(){i._preOnFullScreenError=null,i._preOnTouch&&n.removeEventListener(s,i._preOnTouch),i._preOnTouch=function(){i._preOnTouch=null,i.requestFullScreen(t,e)},n.addEventListener(s,i._preOnTouch,{once:!0})}}},cc.screen.init()}),{}],218:[(function(t,e,i){"use strict";window._CCSettings&&_CCSettings.platform;var n="undefined"==typeof window?global:window;var r=cc&&cc.sys?cc.sys:(function(){cc.sys={};var t=cc.sys;if(t.LANGUAGE_ENGLISH="en",t.LANGUAGE_CHINESE="zh",t.LANGUAGE_FRENCH="fr",t.LANGUAGE_ITALIAN="it",t.LANGUAGE_GERMAN="de",t.LANGUAGE_SPANISH="es",t.LANGUAGE_DUTCH="du",t.LANGUAGE_RUSSIAN="ru",t.LANGUAGE_KOREAN="ko",t.LANGUAGE_JAPANESE="ja",t.LANGUAGE_HUNGARIAN="hu",t.LANGUAGE_PORTUGUESE="pt",t.LANGUAGE_ARABIC="ar",t.LANGUAGE_NORWEGIAN="no",t.LANGUAGE_POLISH="pl",t.LANGUAGE_TURKISH="tr",t.LANGUAGE_UKRAINIAN="uk",t.LANGUAGE_ROMANIAN="ro",t.LANGUAGE_BULGARIAN="bg",t.LANGUAGE_UNKNOWN="unknown",t.OS_IOS="iOS",t.OS_ANDROID="Android",t.OS_WINDOWS="Windows",t.OS_MARMALADE="Marmalade",t.OS_LINUX="Linux",t.OS_BADA="Bada",t.OS_BLACKBERRY="Blackberry",t.OS_OSX="OS X",t.OS_WP8="WP8",t.OS_WINRT="WINRT",t.OS_UNKNOWN="Unknown",t.UNKNOWN=-1,t.WIN32=0,t.LINUX=1,t.MACOS=2,t.ANDROID=3,t.IPHONE=4,t.IPAD=5,t.BLACKBERRY=6,t.NACL=7,t.EMSCRIPTEN=8,t.TIZEN=9,t.WINRT=10,t.WP8=11,t.MOBILE_BROWSER=100,t.DESKTOP_BROWSER=101,t.EDITOR_PAGE=102,t.EDITOR_CORE=103,t.WECHAT_GAME=104,t.QQ_PLAY=105,t.FB_PLAYABLE_ADS=106,t.BAIDU_GAME=107,t.VIVO_GAME=108,t.OPPO_GAME=109,t.HUAWEI_GAME=110,t.XIAOMI_GAME=111,t.JKW_GAME=112,t.ALIPAY_GAME=113,t.WECHAT_GAME_SUB=114,t.BAIDU_GAME_SUB=115,t.QTT_GAME=116,t.BROWSER_TYPE_WECHAT="wechat",t.BROWSER_TYPE_WECHAT_GAME="wechatgame",t.BROWSER_TYPE_WECHAT_GAME_SUB="wechatgamesub",t.BROWSER_TYPE_BAIDU_GAME="baidugame",t.BROWSER_TYPE_BAIDU_GAME_SUB="baidugamesub",t.BROWSER_TYPE_XIAOMI_GAME="xiaomigame",t.BROWSER_TYPE_ALIPAY_GAME="alipaygame",t.BROWSER_TYPE_QQ_PLAY="qqplay",t.BROWSER_TYPE_ANDROID="androidbrowser",t.BROWSER_TYPE_IE="ie",t.BROWSER_TYPE_EDGE="edge",t.BROWSER_TYPE_QQ="qqbrowser",t.BROWSER_TYPE_MOBILE_QQ="mqqbrowser",t.BROWSER_TYPE_UC="ucbrowser",t.BROWSER_TYPE_UCBS="ucbs",t.BROWSER_TYPE_360="360browser",t.BROWSER_TYPE_BAIDU_APP="baiduboxapp",t.BROWSER_TYPE_BAIDU="baidubrowser",t.BROWSER_TYPE_MAXTHON="maxthon",t.BROWSER_TYPE_OPERA="opera",t.BROWSER_TYPE_OUPENG="oupeng",t.BROWSER_TYPE_MIUI="miuibrowser",t.BROWSER_TYPE_FIREFOX="firefox",t.BROWSER_TYPE_SAFARI="safari",t.BROWSER_TYPE_CHROME="chrome",t.BROWSER_TYPE_LIEBAO="liebao",t.BROWSER_TYPE_QZONE="qzone",t.BROWSER_TYPE_SOUGOU="sogou",t.BROWSER_TYPE_UNKNOWN="unknown",t.isNative=!1,t.isBrowser="object"==typeof window&&"object"==typeof document&&!0,t.glExtension=function(t){return!!cc.renderer.device.ext(t)},t.getMaxJointMatrixSize=function(){if(!t._maxJointMatrixSize){var e=cc.game._renderContext,i=Math.floor(e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)/4)-10;t._maxJointMatrixSize=i<50?0:50}return t._maxJointMatrixSize},n.__globalAdapter&&n.__globalAdapter.adaptSys)n.__globalAdapter.adaptSys(t);else{var e=window,i=e.navigator,r=document,s=r.documentElement,a=i.userAgent.toLowerCase();t.isMobile=/mobile|android|iphone|ipad/.test(a),"undefined"!=typeof FbPlayableAd?t.platform=t.FB_PLAYABLE_ADS:t.platform=t.isMobile?t.MOBILE_BROWSER:t.DESKTOP_BROWSER;var o=i.language;o=o||i.browserLanguage,t.languageCode=o.toLowerCase(),o=o?o.split("-")[0]:t.LANGUAGE_ENGLISH,t.language=o;var l=!1,h=!1,c="",u=0,_=/android (\d+(?:\.\d+)*)/i.exec(a)||/android (\d+(?:\.\d+)*)/i.exec(i.platform);_&&(l=!0,c=_[1]||"",u=parseInt(c)||0),(_=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(a))?(h=!0,c=_[2]||"",u=parseInt(c)||0):(/(iPhone|iPad|iPod)/.exec(i.platform)||"MacIntel"===i.platform&&i.maxTouchPoints&&i.maxTouchPoints>1)&&(h=!0,c="",u=0);var f=t.OS_UNKNOWN;-1!==i.appVersion.indexOf("Win")?f=t.OS_WINDOWS:h?f=t.OS_IOS:-1!==i.appVersion.indexOf("Mac")?f=t.OS_OSX:-1!==i.appVersion.indexOf("X11")&&-1===i.appVersion.indexOf("Linux")?f=t.OS_UNIX:l?f=t.OS_ANDROID:-1===i.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(f=t.OS_LINUX),t.os=f,t.osVersion=c,t.osMainVersion=u,t.browserType=t.BROWSER_TYPE_UNKNOWN,(function(){var e=/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(a)||/qq|ucbrowser|ubrowser|edge/i.exec(a)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(a),i=e?e[0].toLowerCase():t.BROWSER_TYPE_UNKNOWN;"safari"===i&&l?i=t.BROWSER_TYPE_ANDROID:"qq"===i&&a.match(/android.*applewebkit/i)&&(i=t.BROWSER_TYPE_ANDROID);var n={micromessenger:t.BROWSER_TYPE_WECHAT,trident:t.BROWSER_TYPE_IE,edge:t.BROWSER_TYPE_EDGE,"360 aphone":t.BROWSER_TYPE_360,mxbrowser:t.BROWSER_TYPE_MAXTHON,"opr/":t.BROWSER_TYPE_OPERA,ubrowser:t.BROWSER_TYPE_UC};t.browserType=n[i]||i})(),t.browserVersion="",(function(){var e=a.match(/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i);e||(e=a.match(/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i)),t.browserVersion=e?e[4]:""})();var d=window.innerWidth||document.documentElement.clientWidth,p=window.innerHeight||document.documentElement.clientHeight,m=window.devicePixelRatio||1;t.windowPixelResolution={width:m*d,height:m*p},t._checkWebGLRenderMode=function(){if(cc.game.renderType!==cc.game.RENDER_TYPE_WEBGL)throw new Error("This feature supports WebGL render mode only.")};var y=document.createElement("canvas");try{var v=t.localStorage=e.localStorage;v.setItem("storage",""),v.removeItem("storage"),v=null}catch(e){var g=function(){cc.warnID(5200)};t.localStorage={getItem:g,setItem:g,removeItem:g,clear:g}}var A=y.toDataURL("image/webp").startsWith("data:image/webp"),x=!!y.getContext("2d"),b=!1;e.WebGLRenderingContext&&(b=!0);var C,T=t.capabilities={canvas:x,opengl:b,webp:A};(void 0!==s.ontouchstart||void 0!==r.ontouchstart||i.msPointerEnabled)&&(T.touches=!0),void 0!==s.onmouseup&&(T.mouse=!0),void 0!==s.onkeyup&&(T.keyboard=!0),(e.DeviceMotionEvent||e.DeviceOrientationEvent)&&(T.accelerometer=!0),(function(){t.browserVersion;var e=!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext);C={ONLY_ONE:!1,WEB_AUDIO:e,DELAY_CREATE_CTX:!1},t.os===t.OS_IOS&&(C.USE_LOADER_EVENT="loadedmetadata"),t.browserType===t.BROWSER_TYPE_FIREFOX&&(C.DELAY_CREATE_CTX=!0,C.USE_LOADER_EVENT="canplay"),t.os===t.OS_ANDROID&&t.browserType===t.BROWSER_TYPE_UC&&(C.ONE_SOURCE=!0)})();try{C.WEB_AUDIO&&(C.context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),C.DELAY_CREATE_CTX&&setTimeout((function(){C.context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext)}),0))}catch(t){C.WEB_AUDIO=!1,cc.logID(5201)}var S=[];(function(){var t=document.createElement("audio");t.canPlayType&&(t.canPlayType('audio/ogg; codecs="vorbis"')&&S.push(".ogg"),t.canPlayType("audio/mpeg")&&S.push(".mp3"),t.canPlayType('audio/wav; codecs="1"')&&S.push(".wav"),t.canPlayType("audio/mp4")&&S.push(".mp4"),t.canPlayType("audio/x-m4a")&&S.push(".m4a"))})(),C.format=S,t.__audioSupport=C}return t.NetworkType={NONE:0,LAN:1,WWAN:2},t.getNetworkType=function(){return t.NetworkType.LAN},t.getBatteryLevel=function(){return 1},t.garbageCollect=function(){},t.restartVM=function(){},t.getSafeAreaRect=function(){var t=cc.view.getVisibleSize();return cc.rect(0,0,t.width,t.height)},t.isObjectValid=function(t){return!!t},t.dump=function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",t+="Using "+(cc.game.renderType===cc.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n",cc.log(t)},t.openURL=function(t){window.open(t)},t.now=function(){return Date.now?Date.now():+new Date},t})();e.exports=r}),{}],219:[(function(t,e,i){"use strict";var n=t("../event/event-target"),r=t("../platform/js"),s=t("../renderer");t("../platform/CCClass");var a={init:function(){this.html=document.getElementsByTagName("html")[0]},availWidth:function(t){return t&&t!==this.html?t.clientWidth:window.innerWidth},availHeight:function(t){return t&&t!==this.html?t.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType};switch(cc.sys.os===cc.sys.OS_IOS&&(a.adaptationType=cc.sys.BROWSER_TYPE_SAFARI),a.adaptationType){case cc.sys.BROWSER_TYPE_SAFARI:a.meta["minimal-ui"]="true",a.availWidth=cc.sys.isMobile?function(t){return window.innerWidth}:function(t){return t.clientWidth},a.availHeight=cc.sys.isMobile?function(t){return window.innerHeight}:function(t){return t.clientHeight};break;case cc.sys.BROWSER_TYPE_SOUGOU:case cc.sys.BROWSER_TYPE_UC:a.meta["minimal-ui"]="true",a.availWidth=function(t){return t.clientWidth},a.availHeight=function(t){return t.clientHeight}}var o=null,l=function(){n.call(this);var t=this,e=cc.ContainerStrategy,i=cc.ContentStrategy;a.init(this),t._frameSize=cc.size(0,0),t._designResolutionSize=cc.size(0,0),t._originalDesignResolutionSize=cc.size(0,0),t._scaleX=1,t._scaleY=1,t._viewportRect=cc.rect(0,0,0,0),t._visibleRect=cc.rect(0,0,0,0),t._autoFullScreen=!1,t._devicePixelRatio=1,t._maxPixelRatio=2,t._retinaEnabled=!1,t._resizeCallback=null,t._resizing=!1,t._resizeWithBrowserSize=!1,t._orientationChanging=!0,t._isRotated=!1,t._orientation=cc.macro.ORIENTATION_AUTO,t._isAdjustViewport=!0,t._antiAliasEnabled=!1,t._resolutionPolicy=null,t._rpExactFit=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.EXACT_FIT),t._rpShowAll=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.SHOW_ALL),t._rpNoBorder=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.NO_BORDER),t._rpFixedHeight=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.FIXED_HEIGHT),t._rpFixedWidth=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.FIXED_WIDTH),cc.game.once(cc.game.EVENT_ENGINE_INITED,this.init,this)};cc.js.extend(l,n),cc.js.mixin(l.prototype,{init:function(){this._initFrameSize();var t=cc.game.canvas.width,e=cc.game.canvas.height;this._designResolutionSize.width=t,this._designResolutionSize.height=e,this._originalDesignResolutionSize.width=t,this._originalDesignResolutionSize.height=e,this._viewportRect.width=t,this._viewportRect.height=e,this._visibleRect.width=t,this._visibleRect.height=e,cc.winSize.width=this._visibleRect.width,cc.winSize.height=this._visibleRect.height,cc.visibleRect&&cc.visibleRect.init(this._visibleRect)},_resizeEvent:function(t){var e;e=this.setDesignResolutionSize?this:cc.view;var i=cc.sys;if(i.browserType!==i.BROWSER_TYPE_UC||i.os!==i.OS_IOS){var n=e._frameSize.width,r=e._frameSize.height,s=e._isRotated;if(cc.sys.isMobile){var a=cc.game.container.style,o=a.margin;a.margin="0",a.display="none",e._initFrameSize(),a.margin=o,a.display="block"}else e._initFrameSize();if(!0===t||e._isRotated!==s||e._frameSize.width!==n||e._frameSize.height!==r){var l=e._originalDesignResolutionSize.width,h=e._originalDesignResolutionSize.height;e._resizing=!0,l>0&&e.setDesignResolutionSize(l,h,e._resolutionPolicy),e._resizing=!1,e.emit("canvas-resize"),e._resizeCallback&&e._resizeCallback.call()}}else setTimeout((function(){e._resizeEvent(t)}),0)},_orientationChange:function(){cc.view._orientationChanging=!0,cc.view._resizeEvent(),cc.sys.browserType===cc.sys.BROWSER_TYPE_SAFARI&&cc.sys.isMobile&&setTimeout((function(){window.innerHeight>window.innerWidth&&window.scrollTo(0,1)}),500)},resizeWithBrowserSize:function(t){t?this._resizeWithBrowserSize||(this._resizeWithBrowserSize=!0,window.addEventListener("resize",this._resizeEvent),window.addEventListener("orientationchange",this._orientationChange)):this._resizeWithBrowserSize&&(this._resizeWithBrowserSize=!1,window.removeEventListener("resize",this._resizeEvent),window.removeEventListener("orientationchange",this._orientationChange))},setResizeCallback:function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},setOrientation:function(t){if((t&=cc.macro.ORIENTATION_AUTO)&&this._orientation!==t){this._orientation=t;var e=this._originalDesignResolutionSize.width,i=this._originalDesignResolutionSize.height;this.setDesignResolutionSize(e,i,this._resolutionPolicy)}},_initFrameSize:function(){var t=this._frameSize,e=a.availWidth(cc.game.frame),i=a.availHeight(cc.game.frame),n=e>=i;!cc.sys.isMobile||n&&this._orientation&cc.macro.ORIENTATION_LANDSCAPE||!n&&this._orientation&cc.macro.ORIENTATION_PORTRAIT?(t.width=e,t.height=i,cc.game.container.style["-webkit-transform"]="rotate(0deg)",cc.game.container.style.transform="rotate(0deg)",this._isRotated=!1):(t.width=i,t.height=e,cc.game.container.style["-webkit-transform"]="rotate(90deg)",cc.game.container.style.transform="rotate(90deg)",cc.game.container.style["-webkit-transform-origin"]="0px 0px 0px",cc.game.container.style.transformOrigin="0px 0px 0px",this._isRotated=!0),this._orientationChanging&&setTimeout((function(){cc.view._orientationChanging=!1}),1e3)},_setViewportMeta:function(t,e){var i=document.getElementById("cocosMetaElement");i&&e&&document.head.removeChild(i);var n,r,s,a=document.getElementsByName("viewport"),o=a?a[0]:null;for(r in n=o?o.content:"",(i=i||document.createElement("meta")).id="cocosMetaElement",i.name="viewport",i.content="",t)-1==n.indexOf(r)?n+=","+r+"="+t[r]:e&&(s=new RegExp(r+"s*=s*[^,]+"),n.replace(s,r+"="+t[r]));/^,/.test(n)&&(n=n.substr(1)),i.content=n,o&&(o.content=n),document.head.appendChild(i)},_adjustViewportMeta:function(){this._isAdjustViewport&&(this._setViewportMeta(a.meta,!1),this._isAdjustViewport=!1)},adjustViewportMeta:function(t){this._isAdjustViewport=t},enableRetina:function(t){this._retinaEnabled=!!t},isRetinaEnabled:function(){return this._retinaEnabled},enableAntiAlias:function(t){if(cc.warnID(9200),this._antiAliasEnabled!==t)if(this._antiAliasEnabled=t,cc.game.renderType===cc.game.RENDER_TYPE_WEBGL){var e=cc.loader._cache;for(var i in e){var n=e[i],r=n&&n.content instanceof cc.Texture2D?n.content:null;if(r){var s=cc.Texture2D.Filter;t?r.setFilters(s.LINEAR,s.LINEAR):r.setFilters(s.NEAREST,s.NEAREST)}}}else if(cc.game.renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.game.canvas.getContext("2d");a.imageSmoothingEnabled=t,a.mozImageSmoothingEnabled=t}},isAntiAliasEnabled:function(){return this._antiAliasEnabled},enableAutoFullScreen:function(t){t&&t!==this._autoFullScreen&&cc.sys.isMobile?(this._autoFullScreen=!0,cc.screen.autoFullScreen(cc.game.frame)):(this._autoFullScreen=!1,cc.screen.disableAutoFullScreen(cc.game.frame))},isAutoFullScreenEnabled:function(){return this._autoFullScreen},setCanvasSize:function(t,e){var i=cc.game.canvas,n=cc.game.container;i.width=t*this._devicePixelRatio,i.height=e*this._devicePixelRatio,i.style.width=t+"px",i.style.height=e+"px",n.style.width=t+"px",n.style.height=e+"px",this._resizeEvent()},getCanvasSize:function(){return cc.size(cc.game.canvas.width,cc.game.canvas.height)},getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(t,e){this._frameSize.width=t,this._frameSize.height=e,cc.game.frame.style.width=t+"px",cc.game.frame.style.height=e+"px",this._resizeEvent(!0)},getVisibleSize:function(){return cc.size(this._visibleRect.width,this._visibleRect.height)},getVisibleSizeInPixel:function(){return cc.size(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},getVisibleOrigin:function(){return cc.v2(this._visibleRect.x,this._visibleRect.y)},getVisibleOriginInPixel:function(){return cc.v2(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(t){var e=this;if(t instanceof cc.ResolutionPolicy)e._resolutionPolicy=t;else{var i=cc.ResolutionPolicy;t===i.EXACT_FIT&&(e._resolutionPolicy=e._rpExactFit),t===i.SHOW_ALL&&(e._resolutionPolicy=e._rpShowAll),t===i.NO_BORDER&&(e._resolutionPolicy=e._rpNoBorder),t===i.FIXED_HEIGHT&&(e._resolutionPolicy=e._rpFixedHeight),t===i.FIXED_WIDTH&&(e._resolutionPolicy=e._rpFixedWidth)}},setDesignResolutionSize:function(t,e,i){if(t>0||e>0){this.setResolutionPolicy(i);var n=this._resolutionPolicy;if(n&&n.preApply(this),cc.sys.isMobile&&this._adjustViewportMeta(),this._orientationChanging=!0,this._resizing||this._initFrameSize(),n){this._originalDesignResolutionSize.width=this._designResolutionSize.width=t,this._originalDesignResolutionSize.height=this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var a=this._viewportRect,o=this._visibleRect,l=r.viewport;a.x=l.x,a.y=l.y,a.width=l.width,a.height=l.height,o.x=0,o.y=0,o.width=l.width/this._scaleX,o.height=l.height/this._scaleY}n.postApply(this),cc.winSize.width=this._visibleRect.width,cc.winSize.height=this._visibleRect.height,cc.visibleRect&&cc.visibleRect.init(this._visibleRect),s.updateCameraViewport(),cc.internal.inputManager._updateCanvasBoundingRect(),this.emit("design-resolution-changed")}else cc.logID(2201)}else cc.logID(2200)},getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setRealPixelResolution:function(t,e,i){this._setViewportMeta({width:t},!0),document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},setViewportInPoints:function(t,e,i,n){var r=this._scaleX,s=this._scaleY;cc.game._renderContext.viewport(t*r+this._viewportRect.x,e*s+this._viewportRect.y,i*r,n*s)},setScissorInPoints:function(t,e,i,n){var r=this._scaleX,s=this._scaleY,a=Math.ceil(t*r+this._viewportRect.x),l=Math.ceil(e*s+this._viewportRect.y),h=Math.ceil(i*r),c=Math.ceil(n*s),u=cc.game._renderContext;if(!o){var _=u.getParameter(u.SCISSOR_BOX);o=cc.rect(_[0],_[1],_[2],_[3])}o.x===a&&o.y===l&&o.width===h&&o.height===c||(o.x=a,o.y=l,o.width=h,o.height=c,u.scissor(a,l,h,c))},isScissorEnabled:function(){return cc.game._renderContext.isEnabled(gl.SCISSOR_TEST)},getScissorRect:function(){if(!o){var t=gl.getParameter(gl.SCISSOR_BOX);o=cc.rect(t[0],t[1],t[2],t[3])}var e=1/this._scaleX,i=1/this._scaleY;return cc.rect((o.x-this._viewportRect.x)*e,(o.y-this._viewportRect.y)*i,o.width*e,o.height*i)},getViewportRect:function(){return this._viewportRect},getScaleX:function(){return this._scaleX},getScaleY:function(){return this._scaleY},getDevicePixelRatio:function(){return this._devicePixelRatio},convertToLocationInView:function(t,e,i,n){var r=n||cc.v2(),s=i.adjustedLeft?i.adjustedLeft:i.left,a=i.adjustedTop?i.adjustedTop:i.top,o=this._devicePixelRatio*(t-s),l=this._devicePixelRatio*(a+i.height-e);return this._isRotated?(r.x=cc.game.canvas.width-l,r.y=o):(r.x=o,r.y=l),r},_convertMouseToLocationInView:function(t,e){var i=this._viewportRect;t.x=(this._devicePixelRatio*(t.x-e.left)-i.x)/this._scaleX,t.y=(this._devicePixelRatio*(e.top+e.height-t.y)-i.y)/this._scaleY},_convertPointWithScale:function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},_convertTouchesWithScale:function(t){for(var e,i,n,r=this._viewportRect,s=this._scaleX,a=this._scaleY,o=0;o=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||s(r,(e=i[n+1])&&e.__attrs__)}return s(t,(e=i[0])&&e.__attrs__),t.__attrs__}function o(t,e,i){var n=l(t),s=e+r,a={};for(var o in n)o.startsWith(s)&&(a[o.slice(s.length)]=n[o]);return a}function l(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||a(t)}function h(t,e){this.name=t,this.default=e}h.prototype.toString=function(){return this.name},cc.Integer=new h("Integer",0),cc.Float=new h("Float",0),cc.Boolean=new h("Boolean",!1),cc.String=new h("String",""),e.exports={PrimitiveType:h,attr:o,getClassAttrs:l,setClassAttr:function(t,e,i,n){l(t)[e+r+i]=n},DELIMETER:r,getTypeChecker_ET:!1,getObjTypeChecker_ET:!1,ScriptUuid:{}}}),{"./CCClass":209,"./js":229,"./utils":233}],222:[(function(t,e,i){"use strict";var n=t("./js"),r=n.array.fastRemoveAt;function s(){}function a(){this.callback=s,this.target=void 0,this.once=!1}a.prototype.set=function(t,e,i){this.callback=t,this.target=e,this.once=!!i};var o=new n.Pool(function(t){return t.callback=s,t.target=void 0,t.once=!1,!0},32);function l(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}o.get=function(){return this._get()||new a};var h=l.prototype;h.removeByCallback=function(t){for(var e=0;e=0;--t){this.callbackInfos[t]||r(this.callbackInfos,t)}this.containCanceled=!1},h.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1};var c=new n.Pool(function(t){return t.callbackInfos=[],t.isInvoking=!1,t.containCanceled=!1,!0},16);function u(){this._callbackTable=n.createMap(!0)}c.get=function(){return this._get()||new l},(h=u.prototype).on=function(t,e,i,n){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=c.get());var s=o.get();s.set(e,i,n),r.callbackInfos.push(s)},h.hasEventListener=function(t,e,i){var n=this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a0?this.deserializedList[0]:[]}else this.deserializedList.length=1,this.deserializedData=t?this._deserializeObject(t,!1):null,this.deserializedList[0]=this.deserializedData;return e(this),this.deserializedData},i._deserializeObject=function(t,e,i,r,s){var a,o=null,l=null,c=t.__type__;if("TypedArray"===c){var u=t.array;o=new window[t.ctor](u.length);for(var _=0;_0&&(i=f+this.globalVariables.join(",")+";");var n=h.flattenCodeArray(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r1)t.push(p+"="+this._targetExp+";"),e=p;else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i=0&&(f(t,i),!0)}a.formatStr=function(){var t=arguments.length;if(0===t)return"";var e=arguments[0];if(1===t)return""+e;if("string"==typeof e&&u.test(e))for(var i=1;i=0&&(t[i]=t[t.length-1],--t.length)},removeAt:f,fastRemoveAt:function(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)},contains:function(t,e){return t.indexOf(e)>=0},verifyType:function(t,e){if(t&&t.length>0)for(var i=0;i0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},m.prototype.put=function(t){var e=this._pool;if(this.count=0&&(this._pool.length=t,this.count>t&&(this.count=t))},a.Pool=m,cc.js=a,e.exports=a}),{"../utils/mutable-forward-iterator":295,"./id-generater":225}],230:[(function(t,e,i){"use strict";var n=t("./js"),r=t("./attribute"),s={url:{canUsedInGet:!0},default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function a(t,e,i,n){if(!t.get&&!t.set)if(t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var a={};for(var o in n[r]=a,s){var l=s[o];t.hasOwnProperty(o)&&(a[o]=t[o],l.canUsedInGet||delete t[o])}}else 0}function o(t,e,i,n){Array.isArray(n)&&n.length>0&&(n=n[0]),t.type=n}function l(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return cc.errorID(5508,i,n);if(cc.RawAsset.isRawAssetType(e[0]))return t.url=e[0],void delete t.type;t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=cc.String:e===Boolean?t.type=cc.Boolean:e===Number&&(t.type=cc.Float))}function h(t,e,i,n){var r=t?{_short:!0}:{_short:!0,default:e};return i&&(n?r.url=i:r.type=i),r}i.getFullFormOfProperty=function(t,e,i,s){if(t&&t.constructor===Object)return null;if(Array.isArray(t)&&t.length>0){t[0];return h(e,[],t)}if("function"==typeof t){var a=t;return cc.RawAsset.isRawAssetType(a)||cc.RawAsset.wasRawAssetType(a)?h(e,"",a,!0):h(e,n.isChildClassOf(a,cc.ValueType)?new a:null,a)}return t instanceof r.PrimitiveType?h(e,t.default):h(e,t)},i.preprocessAttrs=function(t,e,n,r){for(var s in t){var h=t[s],c=i.getFullFormOfProperty(h,!1,s,e);if(c&&(h=t[s]=c),h){var u=h.notify;u&&a(h,s,u,t),"type"in h&&l(h,h.type,e,s),"url"in h&&o(h,0,0,h.url),"type"in h&&h.type}}},i.validateMethodWithProps=function(t,e,i,n,r){return"function"==typeof t||null===t}}),{"./CCClass":209,"./attribute":221,"./js":229}],231:[(function(t,e,i){"use strict";var n=[];cc._RF={push:function(t,e,i){void 0===i&&(i=e,e=""),n.push({uuid:e,script:i,module:t,exports:t.exports,beh:null})},pop:function(){var t=n.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var r in i)return;e.exports=i=t.cls}},peek:function(){return n[n.length-1]}}}),{}],232:[(function(t,e,i){"use strict";cc.url={_rawAssets:"",normalize:function(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t},raw:function(t){if((t=this.normalize(t)).startsWith("resources/")){var e=cc.loader._getResUuid(t.slice(10),cc.Asset,null,!0);if(e)return cc.AssetLibrary.getLibUrlNoExt(e,!0)+cc.path.extname(t)}else cc.errorID(7002,t);return this._rawAssets+t},_init:function(t){this._rawAssets=cc.path.stripSep(t)+"/"}},e.exports=cc.url}),{}],233:[(function(t,e,i){"use strict";t("./js");e.exports={contains:function(t,e){if("function"==typeof t.contains)return t.contains(e);if("function"==typeof t.compareDocumentPosition)return!!(16&t.compareDocumentPosition(e));var i=e.parentNode;if(i)do{if(i===t)return!0;i=i.parentNode}while(null!==i);return!1},isDomNode:"object"==typeof window&&("function"==typeof Node?function(t){return t instanceof Node}:function(t){return t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}),callInNextTick:function(t,e,i){t&&setTimeout((function(){t(e,i)}),0)}}}),{"./js":229}],234:[(function(t,e,i){"use strict";t("./platform/js"),t("./value-types"),t("./utils"),t("./platform/CCInputManager"),t("./platform/CCInputExtension"),t("./event"),t("./platform/CCSys"),t("./platform/CCMacro"),t("./load-pipeline"),t("./CCDirector"),t("./renderer"),t("./platform/CCView"),t("./platform/CCScreen"),t("./CCScheduler"),t("./event-manager")}),{"./CCDirector":49,"./CCScheduler":54,"./event":137,"./event-manager":133,"./load-pipeline":164,"./platform/CCInputExtension":212,"./platform/CCInputManager":213,"./platform/CCMacro":214,"./platform/CCScreen":217,"./platform/CCSys":218,"./platform/CCView":219,"./platform/js":229,"./renderer":241,"./utils":292,"./value-types":309}],235:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=a(t("./assembler")),r=a(t("./utils/dynamic-atlas/manager")),s=a(t("./webgl/render-data"));function a(t){return t&&t.__esModule?t:{default:t}}function o(t,e){for(var i=0;i>2,l=s._vData;n.length+o>l.length?l.set(n.subarray(0,l.length-o),o):l.set(n,o);for(var h=s._iData,c=a.indiceOffset,u=a.vertexOffset,_=0,f=r.length;_this.maxSize||(this._clean(t),i[e].push(t),this.count++)}},i.get=function(t){var e;if(this.enabled){var i=this._pool,n=a(t);e=i[n]&&i[n].pop()}return e?this.count--:e=new t,e},i.clear=function(){this._pool={},this.count=0},i._clean=function(t){t._renderComp=null},e}(n.default));n.default.register("assembler",o);var l=o;i.default=l,e.exports=i.default}),{"../utils/pool":296}],238:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./webgl/vertex-format"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("./assembler-pool"));var s=(function(){function t(){this._extendNative&&this._extendNative()}var e=t.prototype;return e.init=function(t){this._renderComp=t},e.updateRenderData=function(t){},e.fillBuffers=function(t,e){},e.getVfmt=function(){return n.vfmtPosUvColor},t})();i.default=s,s.register=function(t,e){t.__assembler__=e},s.init=function(t){for(var e=t.constructor,i=e.__assembler__;!i;){if(!(e=e.$super))return void cc.warn("Can not find assembler for render component : ["+cc.js.getClassName(t)+"]");i=e.__assembler__}if(i.getConstructor&&(i=i.getConstructor(t)),!t._assembler||t._assembler.constructor!==i){var n=r.default.get(i);n.init(t),t._assembler=n}},cc.Assembler=s,e.exports=i.default}),{"./assembler-pool":237,"./webgl/vertex-format":282}],239:[(function(t,e,i){"use strict";var n=function(t){var e;try{e=t.getContext("2d")}catch(t){return void console.error(t)}this._canvas=t,this._ctx=e,this._caps={},this._stats={drawcalls:0},this._vx=this._vy=this._vw=this._vh=0,this._sx=this._sy=this._sw=this._sh=0};n.prototype._restoreTexture=function(t){},n.prototype.setViewport=function(t,e,i,n){this._vx===t&&this._vy===e&&this._vw===i&&this._vh===n||(this._vx=t,this._vy=e,this._vw=i,this._vh=n)},n.prototype.setScissor=function(t,e,i,n){this._sx===t&&this._sy===e&&this._sw===i&&this._sh===n||(this._sx=t,this._sy=e,this._sw=i,this._sh=n)},n.prototype.clear=function(t){var e=this._ctx;e.clearRect(this._vx,this._vy,this._vw,this._vh),!t||0===t[0]&&0===t[1]&&0===t[2]||(e.fillStyle="rgb("+t[0]+","+t[1]+","+t[2]+")",e.globalAlpha=t[3],e.fillRect(this._vx,this._vy,this._vw,this._vh))},n.prototype.resetDrawCalls=function(){this._stats.drawcalls=0},n.prototype.getDrawCalls=function(){return this._stats.drawcalls},e.exports=n}),{}],240:[(function(t,e,i){"use strict";var n=function(t,e){this._device=t,this._width=4,this._height=4,this._image=null,e&&(void 0!==e.width&&(this._width=e.width),void 0!==e.height&&(this._height=e.height),this.updateImage(e))};n.prototype.update=function(t){this.updateImage(t)},n.prototype.updateImage=function(t){if(t.images&&t.images[0]){var e=t.images[0];e&&e!==this._image&&(this._image=e)}},n.prototype.destroy=function(){this._image=null},e.exports=n}),{}],241:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=a(t("../../renderer/gfx")),r=a(t("../../renderer/core/input-assembler")),s=a(t("../../renderer/core/pass"));function a(t){return t&&t.__esModule?t:{default:t}}function o(t){return{defaultTexture:new n.default.Texture2D(t,{images:[],width:128,height:128,wrapS:n.default.WRAP_REPEAT,wrapT:n.default.WRAP_REPEAT,format:n.default.TEXTURE_FMT_RGB8,mipmap:!1}),programTemplates:[],programChunks:{}}}var l=cc.renderer={Texture2D:null,InputAssembler:r.default,Pass:s.default,renderEngine:null,canvas:null,device:null,scene:null,drawCalls:0,_handle:null,_cameraNode:null,_camera:null,_forward:null,_flow:null,initWebGL:function(e,i){t("./webgl/assemblers");var r=t("./webgl/model-batcher");this.Texture2D=n.default.Texture2D,this.canvas=e,this._flow=cc.RenderFlow;var s=t("../../renderer/scene/scene"),a=t("../../renderer/renderers/forward-renderer");this.device=new n.default.Device(e,i),this.scene=new s;var l=o(this.device);this._forward=new a(this.device,l),this._handle=new r(this.device,this.scene),this._flow.init(this._handle,this._forward)},initCanvas:function(e){var i=t("./canvas"),n=t("./canvas/Texture2D"),r=t("./canvas/Device");this.Device=r,this.Texture2D=n,this.canvas=e,this.device=new r(e),this._camera={a:1,b:0,c:0,d:1,tx:0,ty:0},this._handle=new i.RenderComponentHandle(this.device,this._camera),this._forward=new i.ForwardRenderer,this._flow=cc.RenderFlow,this._flow.init(this._handle,this._forward)},updateCameraViewport:function(){if(cc.director){var t=cc.director.getScene();t&&t.setScale(1,1,1)}if(cc.game.renderType===cc.game.RENDER_TYPE_CANVAS){var e=cc.view.getViewportRect();this.device.setViewport(e.x,e.y,e.width,e.height),this._camera.a=cc.view.getScaleX(),this._camera.d=cc.view.getScaleY(),this._camera.tx=e.x,this._camera.ty=e.y+e.height}},render:function(t,e){this.device.resetDrawCalls(),t&&(this._flow.render(t,e),this.drawCalls=this.device.getDrawCalls())},clear:function(){this._handle.reset(),this._forward.clear()}};i.default=l,e.exports=i.default}),{"../../renderer/core/input-assembler":332,"../../renderer/core/pass":333,"../../renderer/gfx":342,"../../renderer/renderers/forward-renderer":361,"../../renderer/scene/scene":365,"./canvas":void 0,"./canvas/Device":239,"./canvas/Texture2D":240,"./webgl/assemblers":253,"./webgl/model-batcher":278}],242:[(function(t,e,i){"use strict";var n,r,s=0,a=1<0;)i&t&&(e=T(i,e)),i>>=1;return e}function w(t){var e=t._renderFlag;(C[e]=S(e))._func(t)}A.flows=C,A.createFlow=T;var E=[];A.registerValidate=function(t){t._inValidateList||(E.push(t),t._inValidateList=!0)},A.validateRenderers=function(){for(var t=0,e=E.length;tthis._width&&(this._x=r,this._y=this._nexty),this._y+l+r>this._nexty&&(this._nexty=this._y+l+r),this._nexty>this._height)return null;cc.dynamicAtlasManager.textureBleeding&&((o<=8||l<=8)&&(this._texture.drawTextureAt(i,this._x-1,this._y-1),this._texture.drawTextureAt(i,this._x-1,this._y+1),this._texture.drawTextureAt(i,this._x+1,this._y-1),this._texture.drawTextureAt(i,this._x+1,this._y+1)),this._texture.drawTextureAt(i,this._x-1,this._y),this._texture.drawTextureAt(i,this._x+1,this._y),this._texture.drawTextureAt(i,this._x,this._y-1),this._texture.drawTextureAt(i,this._x,this._y+1)),this._texture.drawTextureAt(i,this._x,this._y),this._innerTextureInfos[i._id]={x:this._x,y:this._y,texture:i},this._count++,s+=this._x,a+=this._y,this._x+=o+r,this._dirty=!0}var h={x:s,y:a,texture:this._texture};return this._innerSpriteFrames.push(t),h},update:function(){this._dirty&&(this._texture.update(),this._dirty=!1)},deleteInnerTexture:function(t){t&&this._innerTextureInfos[t._id]&&(delete this._innerTextureInfos[t._id],this._count--)},isEmpty:function(){return this._count<=0},reset:function(){this._x=r,this._y=r,this._nexty=r;for(var t=this._innerSpriteFrames,e=0,i=t.length;e=0;e--)r[e].deleteInnerTexture(t),r[e].isEmpty()&&(r[e].destroy(),r.splice(e,1),s--)},showDebug:!1,update:function(){if(this.enabled)for(var t=0;t<=s;t++)r[t].update()}};e.exports=cc.dynamicAtlasManager=f}),{"./atlas":243}],245:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler-2d"));function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=t("../../../utils/text-utils"),a=t("../../../platform/CCMacro"),o=t("../../../components/CCLabel").Overflow,l=t("../utils").shareLabelInfo,h=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},c=cc.rect(),u=null,_=[],f=[],d=[],p=[],m=null,y=0,v=0,g=0,A=0,x=0,b=1,C=null,T=cc.size(),S="",w=0,E=0,M=0,D=0,B=0,I=0,P=0,R=!1,O=0,L=0,F=0,V=(function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var i=e.prototype;return i.updateRenderData=function(t){t._vertsDirty&&u!==t&&(u=t,this._reserveQuads(t,t.string.toString().length),this._updateFontFamily(t),this._updateProperties(t),this._updateLabelInfo(t),this._updateContent(),this.updateWorldVerts(t),u._actualFontSize=w,u.node.setContentSize(T),u._vertsDirty=!1,u=null,this._resetProperties())},i._updateFontScale=function(){b=w/E},i._updateFontFamily=function(t){var e=t.font;C=e.spriteFrame,m=e._fntConfig,l.fontAtlas=e._fontDefDictionary,this.packToDynamicAtlas(t,C)},i._updateLabelInfo=function(){l.hash="",l.margin=0},i._updateProperties=function(t){S=t.string.toString(),w=t.fontSize,E=m?m.fontSize:t.fontSize,M=t.horizontalAlign,D=t.verticalAlign,B=t.spacingX,P=t.overflow,I=t._lineHeight,T.width=t.node.width,T.height=t.node.height,P===o.NONE?(R=!1,T.width+=2*l.margin,T.height+=2*l.margin):P===o.RESIZE_HEIGHT?(R=!0,T.height+=2*l.margin):R=t.enableWrapText,l.lineHeight=I,l.fontSize=w,this._setupBMFontOverflowMetrics()},i._resetProperties=function(){m=null,C=null,l.hash="",l.margin=0},i._updateContent=function(){this._updateFontScale(),this._computeHorizontalKerningForText(),this._alignText()},i._computeHorizontalKerningForText=function(){for(var t=S,e=t.length,i=m.kerningDict,n=_,r=-1,s=0;s0&&n>0&&z+f.w*b>F&&!s.isUnicodeSpace(C)){d.push(h),h=0,i++,n=0,r-=I*this._getFontScale()+0,N=!0;break}p.x=z,p.y=r-f.offsetY*b+l.margin,this._recordLetterInfo(p,C,G,i),G+1<_.length&&Gp.y-f.h*b&&(M=p.y-f.h*b)}else this._recordPlaceholderInfo(G,C),console.log("Can't find letter definition in texture atlas "+m.atlasName+" for letter:"+C);else this._recordPlaceholderInfo(G,C)}N||(n=V,h=D,cM&&(u=M),a1&&(v+=0*(y-1)),T.width=O,T.height=L,O<=0&&(T.width=parseFloat(a.toFixed(2))+2*l.margin),L<=0&&(T.height=parseFloat(v.toFixed(2))+2*l.margin),A=T.height,x=0,P!==o.CLAMP&&(c>0&&(A=T.height+c),u<-v&&(x=v+u)),!0},i._getFirstCharLen=function(){return 1},i._getFontScale=function(){return P===o.SHRINK?b:1},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(s.isUnicodeCJK(n)||"\n"===n||s.isUnicodeSpace(n))return 1;var r=1,a=l.fontAtlas.getLetterDefinitionForChar(n,l);if(!a)return r;for(var o=a.xAdvance*b+B,h=e+1;hF&&!s.isUnicodeSpace(n)&&F>0)return r;if(o+=a.xAdvance*b+B,"\n"===n||s.isUnicodeSpace(n)||s.isUnicodeCJK(n))break;r++}return r},i._multilineTextWrapByWord=function(){return this._multilineTextWrap(this._getFirstWordLen)},i._multilineTextWrapByChar=function(){return this._multilineTextWrap(this._getFirstCharLen)},i._recordPlaceholderInfo=function(t,e){if(t>=f.length){var i=new h;f.push(i)}f[t].char=e,f[t].hash=e.charCodeAt(0)+l.hash,f[t].valid=!1},i._recordLetterInfo=function(t,e,i,n){if(i>=f.length){var r=new h;f.push(r)}var s=e.charCodeAt(0)+l.hash;f[i].line=n,f[i].char=e,f[i].hash=s,f[i].valid=l.fontAtlas.getLetter(s).valid,f[i].x=t.x,f[i].y=t.y},i._alignText=function(){v=0,d.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),P===o.SHRINK&&w>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||P===o.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},i._scaleFontSizeDown=function(t){var e=!0;t||(t=.1,e=!1),w=t,e&&this._updateContent()},i._shrinkLabelToContentSize=function(t){for(var e=0,i=0|w,n=0;e>1;if(n<=0)break;b=n/E,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),t()?i=n-1:e=n}var r=e;r>=0&&this._scaleFontSizeDown(r)},i._isVerticalClamp=function(){return v>T.height},i._isHorizontalClamp=function(){for(var t=!1,e=0,i=S.length;e0)if(R){if(d[a]>T.width&&(s>T.width||s<0)){t=!0;break}}else if(s>T.width){t=!0;break}}}return t},i._isHorizontalClamped=function(t,e){var i=d[e],n=t>T.width||t<0;return R?i>T.width&&n:n},i._updateQuads=function(){var t=C?C._texture:l.fontAtlas.getTexture(),e=u.node;this.verticesCount=this.indicesCount=0,this._renderData&&(this._renderData.dataLength=0);for(var i=T,n=e._anchorPoint.x*i.width,r=e._anchorPoint.y*i.height,s=!0,a=0,h=S.length;a0){if(m>A){var y=m-A;c.y+=y,c.height-=y,m-=y}m-d.h*b0&&this._isHorizontalClamped(w,v))if(P===o.CLAMP)c.width=0;else if(P===o.SHRINK){if(T.width>d.w){s=!1;break}c.width=0}if(c.height>0&&c.width>0){var E=this._determineRect(c),M=_.x+p[_.line];this.appendQuad(u,t,c,E,M-n,m-r,b)}}}return this._quadsUpdated(u),s},i._determineRect=function(t){var e=C.isRotated(),i=C._originalSize,n=C._rect,r=C._offset,s=r.x+(i.width-n.width)/2,a=r.y-(i.height-n.height)/2;if(e){var o=t.x;t.x=n.x+n.height-t.y-t.height-a,t.y=o+n.y-s,t.y<0&&(t.height=t.height+a)}else t.x+=n.x-s,t.y+=n.y+a;return e},i._computeAlignmentOffset=function(){switch(p.length=0,M){case a.TextAlignment.LEFT:for(var t=0;t0&&(i=i+t.margin+t.out.toHEX("#rrggbb")),""+t.fontSize+t.fontFamily+e+i}v.prototype={constructor:v,updateRenderData:function(){this._updateProperties(),this._updateTexture()},_updateProperties:function(){this._texture=new cc.Texture2D,this._data=s._canvasPool.get(),this._canvas=this._data.canvas,this._context=this._data.context,this._context.font=this._labelInfo.fontDesc;var t=o.safeMeasureText(this._context,this._char,this._labelInfo.fontDesc),e=2*this._labelInfo.margin+2;this._width=parseFloat(t.toFixed(2))+e,this._height=(1+o.BASELINE_RATIO)*this._labelInfo.fontSize+e,this._offsetY=-this._labelInfo.fontSize*o.BASELINE_RATIO/2,this._canvas.width!==this._width&&(this._canvas.width=this._width),this._canvas.height!==this._height&&(this._canvas.height=this._height),this._texture.initWithElement(this._canvas)},_updateTexture:function(){var t=this._context,e=this._labelInfo,i=this._canvas.width,n=this._canvas.height,r=i/2,s=n/2+this._labelInfo.fontSize*o.MIDDLE_RATIO,a=e.color;if(t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle="rgba("+a.r+", "+a.g+", "+a.b+", "+y+")",t.fillRect(0,0,i,n),t.font=e.fontDesc,t.lineJoin="round",t.fillStyle="rgba("+a.r+", "+a.g+", "+a.b+", 1)",e.isOutlined&&e.margin>0){var l=e.out||p;t.strokeStyle="rgba("+l.r+", "+l.g+", "+l.b+", "+l.a/255+")",t.lineWidth=2*e.margin,t.strokeText(this._char,r,s)}t.fillText(this._char,r,s),this._texture.handleLoadedTexture()},destroy:function(){this._texture.destroy(),this._texture=null,s._canvasPool.put(this._data)}},cc.js.mixin(g.prototype,{insertLetterTexture:function(t){var e=t._texture,i=e.width,n=e.height;if(this._x+i+m>this._width&&(this._x=m,this._y=this._nexty),this._y+n>this._nexty&&(this._nexty=this._y+n+m),this._nexty>this._height)return null;this._fontDefDictionary._texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var r=new f;return r.u=this._x+1,r.v=this._y+1,r.texture=this._fontDefDictionary._texture,r.valid=!0,r.w=t._width-2,r.h=t._height-2,r.xAdvance=r.w,r.offsetY=t._offsetY,this._x+=i+m,this._fontDefDictionary.addLetterDefinitions(t._hash,r),r},update:function(){this._dirty&&(this._fontDefDictionary._texture.update(),this._dirty=!1)},reset:function(){this._x=m,this._y=m,this._nexty=m;for(var t=this._fontDefDictionary._letterDefinitions,e=0,i=t.length;e0?I:null)&&P.set(I.color),(R=(R=c&&t.getComponent(c))&&R.enabled?R:null)&&(O.set(R.color),O.a=O.a*t.node.color.a/255),this._updatePaddingRect()},i._calculateFillTextStartPosition=function(){var t=0;S===o.TextAlignment.RIGHT?t=C.width-L.width:S===o.TextAlignment.CENTER&&(t=(C.width-L.width)/2);var e=this._getLineHeight()*(b.length-1),i=A*(1-a.BASELINE_RATIO/2);if(w!==o.VerticalTextAlignment.TOP){var n=e+L.height+A-C.height;w===o.VerticalTextAlignment.BOTTOM?i-=n+=a.BASELINE_RATIO/2*A:i-=n/2}return i+=a.BASELINE_OFFSET*A,cc.v2(t+L.x,i+L.y)},i._setupOutline=function(){p.strokeStyle="rgba("+P.r+", "+P.g+", "+P.b+", "+P.a/255+")",p.lineWidth=2*I.width},i._setupShadow=function(){p.shadowColor="rgba("+O.r+", "+O.g+", "+O.b+", "+O.a/255+")",p.shadowBlur=R.blur,p.shadowOffsetX=R.offset.x,p.shadowOffsetY=-R.offset.y},i._drawUnderline=function(t){I&&(this._setupOutline(),p.strokeRect(U.x,U.y,t,z)),p.lineWidth=z,p.fillStyle="rgba("+E.r+", "+E.g+", "+E.b+", "+E.a/255+")",p.fillRect(U.x,U.y,t,z)},i._updateTexture=function(){p.clearRect(0,0,m.width,m.height);var t=I?P:E;p.fillStyle="rgba("+t.r+", "+t.g+", "+t.b+", "+d+")",p.fillRect(0,0,m.width,m.height),p.font=v;var e=this._calculateFillTextStartPosition(),i=this._getLineHeight();p.lineJoin="round",p.fillStyle="rgba("+E.r+", "+E.g+", "+E.b+", 1)";var n=b.length>1,r=this._measureText(p,v),s=0,a=0;R&&this._setupShadow(),I&&I.width>0&&this._setupOutline();for(var l=0;l0&&p.strokeText(b[l],s,a),p.fillText(b[l],s,a)),G&&(H=r(b[l]),S===o.TextAlignment.RIGHT?U.x=e.x-H:S===o.TextAlignment.CENTER?U.x=e.x-H/2:U.x=e.x,U.y=a+x/8,this._drawUnderline(H));R&&n&&(p.shadowColor="transparent");for(var h=0;h0&&p.strokeText(b[h],s,a),p.fillText(b[h],s,a);R&&(p.shadowColor="transparent"),y.handleLoadedTexture()},i._calDynamicAtlas=function(t){if(t.cacheMode===l.CacheMode.BITMAP){var e=t._frame;_(t,e),e._original||e.setRect(cc.rect(0,0,m.width,m.height)),this.packToDynamicAtlas(t,e)}},i._updateLabelDimensions=function(){var t=g.split("\n");if(D===u.RESIZE_HEIGHT){var e=(b.length+a.BASELINE_RATIO)*this._getLineHeight();C.height=e+L.height,V.height=e+F.height}else if(D===u.NONE){b=t;for(var i=0,n=0,r=0;rs?i:s}n=(b.length+a.BASELINE_RATIO)*this._getLineHeight();var o=parseFloat(i.toFixed(2)),l=parseFloat(n.toFixed(2));C.width=o+L.width,C.height=l+L.height,V.width=o+F.width,V.height=l+F.height}C.width=Math.min(C.width,2048),C.height=Math.min(C.height,2048),m.width!==C.width&&(m.width=C.width),m.height!==C.height&&(m.height=C.height)},i._calculateTextBaseline=function(){var t;t=S===o.TextAlignment.RIGHT?"right":S===o.TextAlignment.CENTER?"center":"left",p.textAlign=t,p.textBaseline="alphabetic"},i._calculateSplitedStrings=function(){var t=g.split("\n");if(B){b=[];for(var e=V.width,i=0;i>1)<=0){cc.logID(4003);break}for(A=_,v=this._getFontDesc(),p.font=v,n=0,i=0;io?c=_-1:h=_}0===h?cc.logID(4003):(A=h,v=this._getFontDesc(),p.font=v)}else{for(n=t.length*this._getLineHeight(),i=0;i80*i){n=o=t[0],s=l=t[1];for(var y=i;yo&&(o=h),c>l&&(l=c);_=Math.max(o-n,l-s)}return a(p,m,i,n,s,_),m}function r(t,e,i,n,r){var s,a;if(r===I(t,e,i,n)>0)for(s=e;s=e;s-=n)a=M(s,t[s],t[s+1],a);return a&&b(a,a.next)&&(D(a),a=a.next),a}function s(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!b(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(D(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function a(t,e,i,n,r,u,_){if(t){!_&&u&&p(t,n,r,u);for(var f,d,m=t;t.prev!==t.next;)if(f=t.prev,d=t.next,u?l(t,n,r,u):o(t))e.push(f.i/i),e.push(t.i/i),e.push(d.i/i),D(t),t=d.next,m=d.next;else if((t=d)===m){_?1===_?a(t=h(t,e,i),e,i,n,r,u,2):2===_&&c(t,e,i,n,r,u):a(s(t),e,i,n,r,u,1);break}}}function o(t){var e=t.prev,i=t,n=t.next;if(x(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&x(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function l(t,e,i,n){var r=t.prev,s=t,a=t.next;if(x(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,c=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,u=y(o,l,e,i,n),_=y(h,c,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&g(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=u;){if(f!==t.prev&&f!==t.next&&g(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function h(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!b(r,s)&&C(r,n,n.next,s)&&S(r,s)&&S(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),D(n),D(n.next),n=t=s),n=n.next}while(n!==t);return n}function c(t,e,i,n,r,o){var l=t;do{for(var h=l.next.next;h!==l.prev;){if(l.i!==h.i&&A(l,h)){var c=E(l,h);return l=s(l,l.next),c=s(c,c.next),a(l,e,i,n,r,o),void a(c,e,i,n,r,o)}h=h.next}l=l.next}while(l!==t)}function u(t,e,i,n){var a,o,l,h=[];for(a=0,o=e.length;a=n.next.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=r&&o>a){if(a=o,o===r){if(s===n.y)return n;if(s===n.next.y)return n.next}i=n.x=n.x&&n.x>=c&&g(si.x)&&S(n,t)&&(i=n,_=l),n=n.next;return i}function p(t,e,i,n){var r=t;do{null===r.z&&(r.z=y(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,m(r)}function m(t){var e,i,n,r,s,a,o,l,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||l>0&&n;)0===o?(r=n,n=n.nextZ,l--):0!==l&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1);return t}function y(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function v(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function A(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!T(t,e)&&S(t,e)&&S(e,t)&&w(t,e)}function x(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function C(t,e,i,n){return!!(b(t,e)&&b(i,n)||b(t,n)&&b(i,e))||x(t,e,i)>0!=x(t,e,n)>0&&x(i,n,t)>0!=x(i,n,e)>0}function T(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&C(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function S(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function w(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}function E(t,e){var i=new B(t.i,t.x,t.y),n=new B(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function M(t,e,i,n){var r=new B(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function D(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function B(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function I(t,e,i,n){for(var r=0,s=e,a=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i}}),{}],251:[(function(t,e,i){"use strict";var n=t("../../../../graphics/helper"),r=t("../../../../graphics/types").PointFlags,s=cc.Graphics.Point=cc.Class({name:"cc.GraphicsPoint",extends:cc.Vec2,ctor:function(t,e){this.reset()},reset:function(){this.dx=0,this.dy=0,this.dmx=0,this.dmy=0,this.flags=0,this.len=0}});function a(){this.reset()}function o(t){this._tessTol=.25,this._distTol=.01,this._updatePathOffset=!1,this._paths=null,this._pathLength=0,this._pathOffset=0,this._points=null,this._pointsOffset=0,this._commandx=0,this._commandy=0,this._paths=[],this._points=[]}cc.js.mixin(a.prototype,{reset:function(){this.closed=!1,this.nbevel=0,this.complex=!0,this.points?this.points.length=0:this.points=[]}}),cc.js.mixin(o.prototype,{moveTo:function(t,e){this._updatePathOffset&&(this._pathOffset=this._pathLength,this._updatePathOffset=!1),this._addPath(),this._addPoint(t,e,r.PT_CORNER),this._commandx=t,this._commandy=e},lineTo:function(t,e){this._addPoint(t,e,r.PT_CORNER),this._commandx=t,this._commandy=e},bezierCurveTo:function(t,e,i,s,a,o){var l=this._curPath,h=l.points[l.points.length-1];h.x!==t||h.y!==e||i!==a||s!==o?(n.tesselateBezier(this,h.x,h.y,t,e,i,s,a,o,0,r.PT_CORNER),this._commandx=a,this._commandy=o):this.lineTo(a,o)},quadraticCurveTo:function(t,e,i,n){var r=this._commandx,s=this._commandy;this.bezierCurveTo(r+2/3*(t-r),s+2/3*(e-s),i+2/3*(t-i),n+2/3*(e-n),i,n)},arc:function(t,e,i,r,s,a){n.arc(this,t,e,i,r,s,a)},ellipse:function(t,e,i,r){n.ellipse(this,t,e,i,r),this._curPath.complex=!1},circle:function(t,e,i){n.ellipse(this,t,e,i,i),this._curPath.complex=!1},rect:function(t,e,i,n){this.moveTo(t,e),this.lineTo(t,e+n),this.lineTo(t+i,e+n),this.lineTo(t+i,e),this.close(),this._curPath.complex=!1},roundRect:function(t,e,i,r,s){n.roundRect(this,t,e,i,r,s),this._curPath.complex=!1},clear:function(t){this._pathLength=0,this._pathOffset=0,this._pointsOffset=0,this._curPath=null,t&&(this._paths.length=0,this._points.length=0)},close:function(){this._curPath.closed=!0},_addPath:function(){var t=this._pathLength,e=this._paths[t];return e?e.reset():(e=new a,this._paths.push(e)),this._pathLength++,this._curPath=e,e},_addPoint:function(t,e,i){var n=this._curPath;if(n){var r,a=this._points,o=n.points;(r=a[this._pointsOffset++])?(r.x=t,r.y=e):(r=new s(t,e),a.push(r)),r.flags=i,o.push(r)}}}),cc.Graphics._Impl=o,e.exports=o}),{"../../../../graphics/helper":152,"../../../../graphics/types":154}],252:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=s(t("../../../assembler")),r=s(t("../../../../../renderer/core/input-assembler"));function s(t){return t&&t.__esModule?t:{default:t}}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=t("../../mesh-buffer"),l=t("../../vertex-format").vfmtPosColor,h=t("../../../index"),c=t("../../../../graphics/graphics"),u=t("../../../../graphics/types").PointFlags,_=c.LineJoin,f=c.LineCap,d=t("./earcut"),p=(t("./impl"),Math.PI),m=Math.min,y=Math.max,v=Math.ceil,g=Math.acos,A=Math.cos,x=Math.sin,b=Math.atan2;function C(t,e,i){var n=2*g(t/(t+i));return y(2,v(e/n))}function T(t,e,i){return ti?i:t}var S=(function(t){function e(e){var i;return(i=t.call(this,e)||this)._buffer=null,i._buffers=[],i._bufferOffset=0,i}a(e,t);var i=e.prototype;return i.getVfmt=function(){return l},i.requestBuffer=function(){var t={indiceStart:0,vertexStart:0},e=new o(h._handle,l);t.meshbuffer=e;var i=new r.default(e._vb,e._ib);return t.ia=i,this._buffers.push(t),t},i.getBuffers=function(){return 0===this._buffers.length&&this.requestBuffer(),this._buffers},i.clear=function(t){this._bufferOffset=0;var e=this._buffers;if(t){for(var i=0,n=e.length;i65535||3*s>131070)&&(++this._bufferOffset,s=e,this._bufferOffsetr.vertexOffset&&r.requestStatic(e,3*e),this._buffer=n,n},i.stroke=function(t){this._curColor=t._strokeColor._val,this._flattenPaths(t._impl),this._expandStroke(t),t._impl._updatePathOffset=!0},i.fill=function(t){this._curColor=t._fillColor._val,this._expandFill(t),t._impl._updatePathOffset=!0},i._expandStroke=function(t){var e=.5*t.lineWidth,i=t.lineCap,n=t.lineJoin,r=t.miterLimit,s=t._impl,a=C(e,p,s._tessTol);this._calculateJoins(s,e,n,r);for(var o=s._paths,l=0,h=s._pathOffset,c=s._pathLength;h0&&(r=1/e);for(var s=t._paths,a=t._pathOffset,o=t._pathLength;a1e-6){var T=1/v;T>600&&(T=600),d.dmx*=T,d.dmy*=T}d.dx*f.dy-f.dx*d.dy>0&&(0,d.flags|=u.PT_LEFT),v*(g=y(11,m(f.len,d.len)*r))*g<1&&(d.flags|=u.PT_INNERBEVEL),d.flags&u.PT_CORNER&&(v*n*n<1||i===_.BEVEL||i===_.ROUND)&&(d.flags|=u.PT_BEVEL),0!=(d.flags&(u.PT_BEVEL|u.PT_INNERBEVEL))&&l.nbevel++,f=d,d=h[p+1]}}},i._flattenPaths=function(t){for(var e=t._paths,i=t._pathOffset,n=t._pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var l=0,h=s.length;lg&&(C-=2*p),this._vset(f,d),this._vset(h-s*n,e.y-a*n);for(var S=T(v((g-C)/p)*r,2,r),w=0;wl?r+=i-e.width:l>c.x&&(r+=l-c.x),-c.y>h?a+=n-e.height:h>c.y&&(a+=h-c.y)}var u=this._local;u[0]=-r,u[1]=-a,u[2]=i-r,u[3]=n-a,this.updateUVs(t),this.updateWorldVerts(t)},e})(n.default);i.default=o,e.exports=i.default}),{"../../../../../components/CCLabelShadow":103,"../../../../utils/label/ttf":248}],257:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../../../../value-types/vec3"));function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=t("../../../../assembler-3d"),a=t("../2d/bmfont"),o=new n.default,l=new n.default,h=(function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e})(a);i.default=h,cc.js.mixin(h.prototype,s,{updateWorldVerts:function(t){for(var e=t.node._worldMatrix,i=this._local,r=this._renderData.vDatas[0],s=this.floatsPerVert,a=0;a=32||this.pool.push(t)}},n.default.register(cc.Label,{getConstructor:function(t){var e=t.node.is3DNode,i=e?l.default:s.default;return t.font instanceof cc.BitmapFont?i=e?h.default:a.default:t.cacheMode===r.default.CacheMode.CHAR&&(cc.sys.browserType===cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB?cc.warn("sorry, subdomain does not support CHAR mode currently!"):i=e?c.default:o.default),i},TTF:s.default,Bmfont:a.default,Letter:o.default,TTF3D:l.default,Bmfont3D:h.default,Letter3D:c.default})}),{"../../../../components/CCLabel":101,"../../../assembler":238,"./2d/bmfont":254,"./2d/letter":255,"./2d/ttf":256,"./3d/bmfont":257,"./3d/letter":258,"./3d/ttf":259}],261:[(function(t,e,i){"use strict";i.__esModule=!0,i.MaskAssembler=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler"));function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=t("../../../components/CCMask"),a=t("../../render-flow"),o=t("./sprite/2d/simple"),l=t("./graphics"),h=t("../../../../renderer/gfx"),c=t("../vertex-format").vfmtPos,u=8,_=[];function f(){return 1<<_.length-1}function d(){for(var t=0,e=0;e<_.length;++e)t+=1<u&&cc.errorID(9e3,u),_.push(t)}function y(t,e){0===_.length&&cc.errorID(9001),_.pop(),0===_.length?e._flushMaterial(t._exitMaterial):A(e)}function v(t,e){var i=h.DS_FUNC_NEVER,n=f(),r=n,s=n,a=t.inverted?h.STENCIL_OP_REPLACE:h.STENCIL_OP_ZERO;p(t._clearMaterial,i,a,n,r,s);var o=e.getBuffer("mesh",c),l=o.request(4,6),u=l.indiceOffset,_=l.byteOffset>>2,d=l.vertexOffset,m=o._vData,y=o._iData;m[_++]=-1,m[_++]=-1,m[_++]=-1,m[_++]=1,m[_++]=1,m[_++]=1,m[_++]=1,m[_++]=-1,y[u++]=d,y[u++]=d+3,y[u++]=d+1,y[u++]=d+1,y[u++]=d+3,y[u++]=d+2,e.node=e._dummyNode,e.material=t._clearMaterial,e._flush()}function g(t,e){var i=h.DS_FUNC_NEVER,n=f(),r=n,a=n,c=t.inverted?h.STENCIL_OP_ZERO:h.STENCIL_OP_REPLACE;p(t._materials[0],i,c,n,r,a),e.material=t._materials[0],t._type===s.Type.IMAGE_STENCIL?(e.node=e._dummyNode,o.prototype.fillBuffers.call(t._assembler,t,e),e._flush()):(e.node=t.node,l.prototype.fillBuffers.call(t._graphics._assembler,t._graphics,e))}function A(t){var e=h.DS_FUNC_EQUAL,i=h.STENCIL_OP_KEEP,n=d(),r=n,s=f(),a=_[_.length-1];p(a._enableMaterial,e,i,n,r,s),t._flushMaterial(a._enableMaterial)}var x=(function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var i=e.prototype;return i.updateRenderData=function(t){t._type===s.Type.IMAGE_STENCIL?t.spriteFrame?o.prototype.updateRenderData.call(this,t):t.setMaterial(0,null):(t._graphics.setMaterial(0,t._materials[0]),l.prototype.updateRenderData.call(t._graphics._assembler,t._graphics,t._graphics))},i.fillBuffers=function(t,e){(t._type!==s.Type.IMAGE_STENCIL||t.spriteFrame)&&(m(t),v(t,e),g(t,e),A(e)),t.node._renderFlag|=a.FLAG_UPDATE_RENDER_DATA},i.postFillBuffers=function(t,e){(t._type!==s.Type.IMAGE_STENCIL||t.spriteFrame)&&y(t,e),t.node._renderFlag|=a.FLAG_UPDATE_RENDER_DATA},e})(o);i.MaskAssembler=x,n.default.register(s,x)}),{"../../../../renderer/gfx":342,"../../../components/CCMask":105,"../../assembler":238,"../../render-flow":242,"../vertex-format":282,"./graphics":252,"./sprite/2d/simple":266}],262:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler-2d"));function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var s=t("../../../components/CCMotionStreak"),a=t("../../render-flow");function o(t,e){this.point=t||cc.v2(),this.dir=e||cc.v2(),this.distance=0,this.time=0}o.prototype.setPoint=function(t,e){this.point.x=t,this.point.y=e},o.prototype.setDir=function(t,e){this.dir.x=t,this.dir.y=e};cc.v2(),cc.v2();var l=cc.v2(),h=cc.v2();function c(t,e){return t.x=-e.y,t.y=e.x,t}var u=(function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var i=e.prototype;return i.initData=function(){this._renderData.createFlexData(0,16,42)},i.update=function(t,e){var i,n=t._stroke/2,r=t.node._worldMatrix.m,s=r[12],a=r[13],u=t._points;if(u.length>1){var _=u[0].point.x-s,f=u[0].point.y-a;_*_+f*f=0;E--){var M=u[E],D=M.point,B=M.dir;if(M.time-=e,M.time<0)u.splice(E,1);else{var I=M.time/S,P=u[E-1];if(!w){if(!P){u.splice(E,1);continue}D.x=P.point.x-B.x*I,D.y=P.point.y-B.y*I}w=!0,c(l,B);var R=(I*A<<24>>>0)+(g<<16)+(v<<8)+y,O=5*p;C[O]=D.x+l.x*n,C[O+1]=D.y+l.y*n,C[O+2]=1,C[O+3]=I,T[O+4]=R,C[O+=5]=D.x-l.x*n,C[O+1]=D.y-l.y*n,C[O+2]=0,C[O+3]=I,T[O+4]=R,p+=2}}d=p<=2?0:3*(p-2),b.used(p,d)}},i.fillBuffers=function(t,e){var i=this._renderData._flexBuffer,n=i.vData,r=i.usedVertices,s=i.usedIndices,o=i.usedVerticesFloats,l=e._meshBuffer,h=l.request(r,s),c=h.byteOffset>>2,u=l._vData;n.length+c>u.length?u.set(n.subarray(0,o),c):u.set(n,c);for(var _=l._iData,f=h.indiceOffset,d=h.vertexOffset,p=0,m=r;p1?1:i)<0?0:i,n=(n=n>1?1:n)<0?0:n;var r=i+(n=(n-=i)<0?0:n);r=r>1?1:r,this.updateUVs(t,i,r),this.updateVerts(t,i,r),t._vertsDirty=!1}},i.updateUVs=function(t,e,i){var n,r,a,o,l,h,c,u,_,f,d=t._spriteFrame,p=d._texture.width,m=d._texture.height,y=d._rect;d._rotated?(n=y.x/p,r=(y.y+y.width)/m,a=l=n,c=_=(y.x+y.height)/p,h=f=r,o=u=y.y/m):(n=y.x/p,r=(y.y+y.height)/m,a=c=n,l=_=(y.x+y.width)/p,o=h=r,u=f=y.y/m);var v=this._renderData.vDatas[0],g=this.uvOffset,A=this.floatsPerVert;switch(t._fillType){case s.HORIZONTAL:v[g]=a+(l-a)*e,v[g+1]=o+(h-o)*e,v[g+A]=a+(l-a)*i,v[g+A+1]=o+(h-o)*i,v[g+2*A]=c+(_-c)*e,v[g+2*A+1]=u+(f-u)*e,v[g+3*A]=c+(_-c)*i,v[g+3*A+1]=u+(f-u)*i;break;case s.VERTICAL:v[g]=a+(c-a)*e,v[g+1]=o+(u-o)*e,v[g+A]=l+(_-l)*e,v[g+A+1]=h+(f-h)*e,v[g+2*A]=a+(c-a)*i,v[g+2*A+1]=o+(u-o)*i,v[g+3*A]=l+(_-l)*i,v[g+3*A+1]=h+(f-h)*i;break;default:cc.errorID(2626)}},i.updateVerts=function(t,e,i){var n,r=t.node,a=r.width,o=r.height,l=r.anchorX*a,h=r.anchorY*o,c=-l,u=-h,_=a-l,f=o-h;switch(t._fillType){case s.HORIZONTAL:n=c+(_-c)*i,c=c+(_-c)*e,_=n;break;case s.VERTICAL:n=u+(f-u)*i,u=u+(f-u)*e,f=n;break;default:cc.errorID(2626)}var d=this._local;d[0]=c,d[1]=u,d[2]=_,d[3]=f,this.updateWorldVerts(t)},e})(n.default);i.default=a,e.exports=i.default}),{"../../../../../components/CCSprite":115,"../../../../assembler-2d":235}],264:[(function(t,e,i){"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}i.__esModule=!0,i.default=void 0;var r=(function(t){function e(){return t.apply(this,arguments)||this}n(e,t);var i=e.prototype;return i.initData=function(t){this._renderData.createFlexData(0,4,6,this.getVfmt())},i.updateRenderData=function(t){this.packToDynamicAtlas(t,t._spriteFrame);var e=t.spriteFrame;if(e){var i=e.vertices;if(i){this.verticesCount=i.x.length,this.indicesCount=i.triangles.length;var n=this._renderData._flexBuffer;n.reserve(this.verticesCount,this.indicesCount)&&(this.updateColor(t),t._vertsDirty=!0),n.used(this.verticesCount,this.indicesCount),this.updateIndices(i.triangles),t._vertsDirty&&(this.updateUVs(t),this.updateVerts(t),this.updateWorldVerts(t),t._vertsDirty=!1)}}},i.updateIndices=function(t){this._renderData.iDatas[0].set(t)},i.updateUVs=function(t){for(var e=t.spriteFrame.vertices,i=e.nu,n=e.nv,r=this.uvOffset,s=this.floatsPerVert,a=this._renderData.vDatas[0],o=0;o0){var u=r.y+o*(t-r.x);a[0].x=t,a[0].y=u}if((e-r.x)*c>0){var _=r.y+o*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==Math.sin(s)){if(l=c/h,(n-r.y)*h>0){var f=r.x+l*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*h>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function d(t){var e=t.node,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,l=-r,h=-s,c=i-r,f=n-s,d=o;d[0]=l,d[1]=h,d[2]=c,d[3]=f;var p=t._fillCenter,m=u.x=Math.min(Math.max(0,p.x),1)*(c-l)+l,y=u.y=Math.min(Math.max(0,p.y),1)*(f-h)+h;a[0].x=a[3].x=l,a[1].x=a[2].x=c,a[0].y=a[1].y=h,a[2].y=a[3].y=f,_.length=0,m!==d[0]&&(_[0]=[3,0]),m!==d[2]&&(_[2]=[1,2]),y!==d[1]&&(_[1]=[0,1]),y!==d[3]&&(_[3]=[2,3])}function p(t){var e,i,n,r,s=t._texture.width,a=t._texture.height,o=t._rect,h=l;t._rotated?(e=o.x/s,i=(o.x+o.height)/s,n=o.y/a,r=(o.y+o.width)/a,h[0]=h[2]=e,h[4]=h[6]=i,h[3]=h[7]=r,h[1]=h[5]=n):(e=o.x/s,i=(o.x+o.width)/s,n=o.y/a,r=(o.y+o.height)/a,h[0]=h[4]=e,h[2]=h[6]=i,h[1]=h[3]=r,h[5]=h[7]=n)}function m(t,e){var i,n;if(i=e.x-t.x,n=e.y-t.y,0!==i||0!==n){if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}}var y=(function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var i=e.prototype;return i.initData=function(t){this._renderData.createFlexData(0,4,6,this.getVfmt()),this.updateIndices()},i.updateRenderData=function(e){t.prototype.updateRenderData.call(this,e);var i=e.spriteFrame;if(this.packToDynamicAtlas(e,i),e._vertsDirty){var n=e._fillStart,r=e._fillRange;for(r<0&&(n+=r,r=-r);n>=1;)n-=1;for(;n<0;)n+=1;n*=s,r*=s,d(e),p(i),f(o[0],o[2],o[1],o[3],u,n,h),f(o[0],o[2],o[1],o[3],u,n+r,c),this.updateVerts(e,n,r),e._vertsDirty=!1}},i.updateVerts=function(t,e,i){var n=e+i,r=this._local;r.length=0;for(var o=0,l=3*this.floatsPerVert,f=0;f<4;++f){var d=_[f];if(d)if(i>=s)r.length=o+l,this._generateTriangle(r,o,u,a[d[0]],a[d[1]]),o+=l;else{var p=m(u,a[d[0]]),y=m(u,a[d[1]]);y=n||(p>=e?(r.length=o+l,y>=n?this._generateTriangle(r,o,u,a[d[0]],c[f]):this._generateTriangle(r,o,u,a[d[0]],a[d[1]]),o+=l):y<=e||(y<=n?(r.length=o+l,this._generateTriangle(r,o,u,h[f],a[d[1]]),o+=l):(r.length=o+l,this._generateTriangle(r,o,u,h[f],c[f]),o+=l))),p+=s,y+=s}}this.allocWorldVerts(t),this.updateWorldVerts(t)},i.allocWorldVerts=function(t){var e=t.node._color._val,i=this._renderData,n=this.floatsPerVert,r=this._local,s=r.length/n;this.verticesCount=this.indicesCount=s;var a=i._flexBuffer;a.reserve(s,s)&&this.updateIndices(),a.used(this.verticesCount,this.indicesCount);for(var o=i.vDatas[0],l=i.uintVDatas[0],h=this.uvOffset,c=0;c0)){this._renderData.createData(0,this.verticesFloats,this.indicesCount);for(var e=this._renderData.iDatas[0],i=0,n=0;n<3;++n)for(var r=0;r<3;++r){var s=4*n+r;e[i++]=s,e[i++]=s+1,e[i++]=s+4,e[i++]=s+1,e[i++]=s+5,e[i++]=s+4}}},i.initLocal=function(){this._local=[],this._local.length=8},i.updateRenderData=function(t){var e=t._spriteFrame;this.packToDynamicAtlas(t,e),t._vertsDirty&&(this.updateUVs(t),this.updateVerts(t),t._vertsDirty=!1)},i.updateVerts=function(t){var e=t.node,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=t.spriteFrame,o=a.insetLeft,l=a.insetRight,h=a.insetTop,c=a.insetBottom,u=i-o-l,_=n-h-c,f=i/(o+l),d=n/(h+c);f=isNaN(f)||f>1?1:f,d=isNaN(d)||d>1?1:d,u=u<0?0:u,_=_<0?0:_;var p=this._local;p[0]=-r,p[1]=-s,p[2]=o*f-r,p[3]=c*d-s,p[4]=p[2]+u,p[5]=p[3]+_,p[6]=i-r,p[7]=n-s,this.updateWorldVerts(t)},i.updateUVs=function(t){for(var e=this._renderData.vDatas[0],i=t.spriteFrame.uvSliced,n=this.uvOffset,r=this.floatsPerVert,s=0;s<4;++s)for(var a=0;a<4;++a){var o=4*s+a,l=i[o],h=o*r;e[h+n]=l.u,e[h+n+1]=l.v}},i.updateWorldVerts=function(t){for(var e=t.node._worldMatrix.m,i=e[0],n=e[1],r=e[4],s=e[5],a=e[12],o=e[13],l=this._local,h=this._renderData.vDatas[0],c=this.floatsPerVert,u=0;u<4;++u)for(var _=l[2*u+1],f=0;f<4;++f){var d=l[2*f],p=(4*u+f)*c;h[p]=d*i+_*r+a,h[p+1]=d*n+_*s+o}},e})(function(t){return t&&t.__esModule?t:{default:t}}(t("../../../../assembler-2d")).default);i.default=r,Object.assign(r.prototype,{verticesCount:16,indicesCount:54}),e.exports=i.default}),{"../../../../assembler-2d":235}],268:[(function(t,e,i){"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}i.__esModule=!0,i.default=void 0;var r=(function(t){function e(){return t.apply(this,arguments)||this}n(e,t);var i=e.prototype;return i.initData=function(t){this.verticesCount=0,this.contentWidth=0,this.contentHeight=0,this.rectWidth=0,this.rectHeight=0,this.hRepeat=0,this.vRepeat=0,this.row=0,this.col=0,this._renderData.createFlexData(0,4,6,this.getVfmt()),this._updateIndices()},i.initLocal=function(){this._local={x:[],y:[]}},i._updateIndices=function(){for(var t=this._renderData.iDatas[0],e=0,i=0,n=t.length;e0?this.sizableWidth:0,this.sizableHeight=this.sizableHeight>0?this.sizableHeight:0;var _=this.hRepeat=0===l?this.sizableWidth:this.sizableWidth/l,f=this.vRepeat=0===u?this.sizableHeight:this.sizableHeight/u,d=(this.row=Math.ceil(f+2))*(this.col=Math.ceil(_+2));this.verticesCount=4*d,this.indicesCount=6*d;var p=this._renderData._flexBuffer;p.reserve(this.verticesCount,this.indicesCount)&&(this._updateIndices(),this.updateColor(t)),p.used(this.verticesCount,this.indicesCount),t._vertsDirty&&(this.updateUVs(t),this.updateVerts(t),t._vertsDirty=!1)},i.updateVerts=function(t){var e=t._spriteFrame,i=e._rect,n=t.node,r=n.anchorX*n.width,s=n.anchorY*n.height,a=this.row,o=this.col,l=this.contentWidth,h=this.contentHeight,c=this._local,u=c.x,_=c.y;u.length=_.length=0;var f=e.insetLeft,d=e.insetRight,p=i.width-f-d,m=e.insetTop,y=e.insetBottom,v=i.height-m-y,g=n.width/(f+d)>1?1:n.width/(f+d),A=n.height/(m+y)>1?1:n.height/(m+y),x=0,b=0;x=p>0?Math.floor(1e3*this.sizableWidth)/1e3%p==0?p:this.sizableWidth%p:this.sizableWidth,b=v>0?Math.floor(1e3*this.sizableHeight)/1e3%v==0?v:this.sizableHeight%v:this.sizableHeight;for(var C=0;C<=o;C++)0===C?u[C]=-r:C>0&&C0?C===o-1?f+x+p*(C-2)-r:f+Math.min(p,this.sizableWidth)+p*(C-2)-r:f+this.sizableWidth-r:C===o&&(u[C]=Math.min(f+this.sizableWidth+d,l)-r);for(var T=0;T<=a;T++)0===T?_[T]=-s:T>0&&T0?T===a-1?y+b+(T-2)*v-s:y+Math.min(v,this.sizableHeight)+(T-2)*v-s:y+this.sizableHeight-s:T===a&&(_[T]=Math.min(y+this.sizableHeight+m,h)-s);this.updateWorldVerts(t)},i.updateWorldVerts=function(t){for(var e,i,n,r,s=this._renderData,a=this._local,o=a.x,l=a.y,h=s.vDatas[0],c=this.row,u=this.col,_=t.node._worldMatrix.m,f=_[0],d=_[1],p=_[4],m=_[5],y=_[12],v=_[13],g=this.floatsPerVert,A=0,x=0,b=c;xh?this.sizableHeight>=x*h?1:f%1:f;for(var C=0,T=u;Ca?this.sizableWidth>=C*a?1:_%1:_,v?(e[A]=m[0],e[A+1]=m[1],e[A+=g]=m[0],e[A+1]=m[1]+(m[7]-m[1])*d,e[A+=g]=m[0]+(m[6]-m[0])*p,e[A+1]=m[1],e[A+=g]=e[A-g],e[A+1]=e[A+1-2*g],A+=g):(0===C?e[A]=m[0]:C>0&&C0&&x0&&C0&&x0&&C0&&x>2,n=this.vData.length,r=!1;if(i>n){for(;ns){for(;s>2,this._handler.updateMeshRange(t,e)},e.reset=function(){var t=this._initVerticesCount*this._verticesBytes>>2;this._reallocVData(t),this._reallocIData(this._initIndicesCount),this.usedVertices=0,this.usedVerticesFloats=0,this.usedIndices=0},t})();i.default=n,cc.FlexBuffer=n,e.exports=i.default}),{}],277:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../../renderer/gfx"));var r=cc.Class({name:"cc.MeshBuffer",ctor:function(t,e){this.init(t,e)},init:function(t,e){this.byteOffset=0,this.indiceOffset=0,this.vertexOffset=0,this.indiceStart=0,this._dirty=!1,this._vertexFormat=e,this._vertexBytes=this._vertexFormat._bytes,this._arrOffset=0,this._vbArr=[],this._vb=new n.default.VertexBuffer(t._device,e,n.default.USAGE_DYNAMIC,new ArrayBuffer,0),this._vbArr[0]=this._vb,this._ibArr=[],this._ib=new n.default.IndexBuffer(t._device,n.default.INDEX_FMT_UINT16,n.default.USAGE_STATIC,new ArrayBuffer,0),this._ibArr[0]=this._ib,this._vData=null,this._uintVData=null,this._iData=null,this._batcher=t,this._initVDataCount=256*e._bytes,this._initIDataCount=1536,this._offsetInfo={byteOffset:0,vertexOffset:0,indiceOffset:0},this._reallocBuffer()},uploadData:function(){if(0!==this.byteOffset&&this._dirty){var t=new Float32Array(this._vData.buffer,0,this.byteOffset>>2),e=new Uint16Array(this._iData.buffer,0,this.indiceOffset);this._vb.update(0,t),this._ib.update(0,e),this._dirty=!1}},switchBuffer:function(){var t=++this._arrOffset;this.byteOffset=0,this.vertexOffset=0,this.indiceOffset=0,this.indiceStart=0,t65535&&(this.uploadData(),this._batcher._flush(),this.switchBuffer())},requestStatic:function(t,e){this.checkAndSwitchBuffer(t);var i=this.byteOffset+t*this._vertexBytes,n=this.indiceOffset+e,r=this._vData.byteLength,s=this._iData.length;if(i>r||n>s){for(;r>2);this._vb.update(0,t),this._dirty=!1}},switchBuffer:function(){this._super();var t=new Uint16Array(this._iData.buffer,0,this._initIDataCount);this._ib.update(0,t)},_reallocBuffer:function(){this._reallocVData(!0),this._reallocIData(),this._fillQuadBuffer()}});cc.QuadBuffer=e.exports=r}),{"./mesh-buffer":277}],280:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=s;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./flex-buffer")),r=t("./vertex-format");function s(){this.vDatas=[],this.uintVDatas=[],this.iDatas=[],this.meshCount=0,this._infos=null,this._flexBuffer=null}cc.js.mixin(s.prototype,{init:function(t){},clear:function(){this.vDatas.length=0,this.iDatas.length=0,this.uintVDatas.length=0,this.meshCount=0,this._infos=null,this._flexBuffer&&this._flexBuffer.reset()},updateMesh:function(t,e,i){this.vDatas[t]=e,this.uintVDatas[t]=new Uint32Array(e.buffer,0,e.length),this.iDatas[t]=i,this.meshCount=this.vDatas.length},updateMeshRange:function(t,e){},createData:function(t,e,i){var n=new Float32Array(e),r=new Uint16Array(i);this.updateMesh(t,n,r)},createQuadData:function(t,e,i){this.createData(t,e,i),this.initQuadIndices(this.iDatas[t])},createFlexData:function(t,e,i,s){s=s||r.vfmtPosUvColor,this._flexBuffer=new n.default(this,t,e,i,s)},initQuadIndices:function(t){for(var e=t.length/6,i=0,n=0;ir||n>s){for(;r0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return null;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r},dirname:function(t){var e=r.exec(t);return e?e[2]:""},changeExtname:function(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n},changeBasename:function(t,e,i){if(0===e.indexOf("."))return this.changeExtname(t,e);var n=t.indexOf("?"),r="",s=i?this.extname(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r},_normalize:function(t){var e=t=String(t);do{e=t,t=t.replace(s,"")}while(e.length!==t.length);return t},sep:cc.sys.os===cc.sys.OS_WINDOWS?"\\":"/",stripSep:function(t){return t.replace(/[\/\\]$/,"")}},e.exports=cc.path}),{"../platform/CCSys":218}],284:[(function(t,e,i){"use strict";var n=function(t,e,i,n,r,s){this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s};n.create=function(t,e,i,n,r,s){return{a:t,b:e,c:i,d:n,tx:r,ty:s}},n.identity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}},n.clone=function(t){return{a:t.a,b:t.b,c:t.c,d:t.d,tx:t.tx,ty:t.ty}},n.concat=function(t,e,i){var n=e.a,r=e.b,s=e.c,a=e.d,o=e.tx,l=e.ty;return t.a=n*i.a+r*i.c,t.b=n*i.b+r*i.d,t.c=s*i.a+a*i.c,t.d=s*i.b+a*i.d,t.tx=o*i.a+l*i.c+i.tx,t.ty=o*i.b+l*i.d+i.ty,t},n.invert=function(t,e){var i=e.a,n=e.b,r=e.c,s=e.d,a=1/(i*s-n*r),o=e.tx,l=e.ty;return t.a=a*s,t.b=-a*n,t.c=-a*r,t.d=a*i,t.tx=a*(r*l-s*o),t.ty=a*(n*o-i*l),t},n.fromMat4=function(t,e){var i=e.m;return t.a=i[0],t.b=i[1],t.c=i[4],t.d=i[5],t.tx=i[12],t.ty=i[13],t},n.transformVec2=function(t,e,i,n){var r,s;return void 0===n?(n=i,r=e.x,s=e.y):(r=e,s=i),t.x=n.a*r+n.c*s+n.tx,t.y=n.b*r+n.d*s+n.ty,t},n.transformSize=function(t,e,i){return t.width=i.a*e.width+i.c*e.height,t.height=i.b*e.width+i.d*e.height,t},n.transformRect=function(t,e,i){var n=e.x,r=e.y,s=n+e.width,a=r+e.height,o=i.a*n+i.c*r+i.tx,l=i.b*n+i.d*r+i.ty,h=i.a*s+i.c*r+i.tx,c=i.b*s+i.d*r+i.ty,u=i.a*n+i.c*a+i.tx,_=i.b*n+i.d*a+i.ty,f=i.a*s+i.c*a+i.tx,d=i.b*s+i.d*a+i.ty,p=Math.min(o,h,u,f),m=Math.max(o,h,u,f),y=Math.min(l,c,_,d),v=Math.max(l,c,_,d);return t.x=p,t.y=y,t.width=m-p,t.height=v-y,t},n.transformObb=function(t,e,i,n,r,s){var a=r.x,o=r.y,l=r.width,h=r.height,c=s.a*a+s.c*o+s.tx,u=s.b*a+s.d*o+s.ty,_=s.a*l,f=s.b*l,d=s.c*h,p=s.d*h;e.x=c,e.y=u,i.x=_+c,i.y=f+u,t.x=d+c,t.y=p+u,n.x=_+d+c,n.y=f+p+u},cc.AffineTransform=e.exports=n}),{}],285:[(function(t,e,i){"use strict";var n=t("../platform/CCObject").Flags,r=t("./misc"),s=t("../platform/js"),a=t("../platform/id-generater"),o=t("../event-manager"),l=t("../renderer/render-flow"),h=n.Destroying,c=n.DontDestroy,u=n.Deactivating,_=new a("Node");function f(t){return t?"string"==typeof t?s.getClassByName(t):t:(cc.errorID(3804),null)}function d(t,e){if(e._sealed)for(var i=0;i0&&(r=m(n._children,e)))return r}return null}function y(t,e,i){for(var n=0;n0&&y(r._children,e,i)}}var v=cc.Class({name:"cc._BaseNode",extends:cc.Object,properties:{_parent:null,_children:[],_active:!0,_components:[],_prefab:null,_persistNode:{get:function(){return(this._objFlags&c)>0},set:function(t){t?this._objFlags|=c:this._objFlags&=~c}},name:{get:function(){return this._name},set:function(t){this._name=t}},uuid:{get:function(){return this._id}},children:{get:function(){return this._children}},childrenCount:{get:function(){return this._children.length}},active:{get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;if(e)e._activeInHierarchy&&cc.director._nodeActivator.activateNode(this,t)}}},activeInHierarchy:{get:function(){return this._activeInHierarchy}}},ctor:function(t){this._name=void 0!==t?t:"New Node",this._activeInHierarchy=!1,this._id=_.getNewId(),cc.director._scheduler&&cc.director._scheduler.enableForTarget(this),this.__eventTargets=[]},getParent:function(){return this._parent},setParent:function(t){if(this._parent!==t){0;var e=this._parent;if(this._parent=t||null,this._onSetParent(t),t&&(o._setDirtyForNode(this),t._children.push(this),t.emit&&t.emit("child-added",this),t._renderFlag|=l.FLAG_CHILDREN),e){if(!(e._objFlags&h)){var i=e._children.indexOf(this);0,e._children.splice(i,1),e.emit&&e.emit("child-removed",this),this._onHierarchyChanged(e),0===e._children.length&&(e._renderFlag&=~l.FLAG_CHILDREN)}}else t&&this._onHierarchyChanged(null)}},attr:function(t){s.mixin(this,t)},getChildByUuid:function(t){if(!t)return cc.log("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(h=n,i=n._children,r=0,l[o]=i[r],o++):(l[o]=n,o++,s=!0);l.length=0,a._stackId--},cleanup:function(){},removeFromParent:function(t){this._parent&&(void 0===t&&(t=!0),this._parent.removeChild(this,t))},removeChild:function(t,e){this._children.indexOf(t)>-1&&((e||void 0===e)&&t.cleanup(),t.parent=null)},removeAllChildren:function(t){var e=this._children;void 0===t&&(t=!0);for(var i=e.length-1;i>=0;i--){var n=e[i];n&&(t&&n.cleanup(),n.parent=null)}this._children.length=0},isChildOf:function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},getComponent:function(t){var e=f(t);return e?d(this,e):null},getComponents:function(t){var e=f(t),i=[];return e&&p(this,e,i),i},getComponentInChildren:function(t){var e=f(t);return e?m(this._children,e):null},getComponentsInChildren:function(t){var e=f(t),i=[];return e&&(p(this,e,i),y(this._children,e,i)),i},_checkMultipleComp:!1,addComponent:function(t){var e;if("string"==typeof t){if(!(e=s.getClassByName(t)))return cc.errorID(3807,t),cc._RFpeek()&&cc.errorID(3808,t),null}else{if(!t)return cc.errorID(3804),null;e=t}if("function"!=typeof e)return cc.errorID(3809),null;if(!s.isChildClassOf(e,cc.Component))return cc.errorID(3810),null;var i=e._requireComponent;if(i&&!this.getComponent(i)&&!this.addComponent(i))return null;var n=new e;return n.node=this,this._components.push(n),this._activeInHierarchy&&cc.director._nodeActivator.activateComp(n),n},_addComponentAt:!1,removeComponent:function(t){t?(t instanceof cc.Component||(t=this.getComponent(t)),t&&t.destroy()):cc.errorID(3813)},_getDependComponent:!1,_removeComponent:function(t){if(t){if(!(this._objFlags&h)){var e=this._components.indexOf(t);-1!==e?this._components.splice(e,1):t.node!==this&&cc.errorID(3815)}}else cc.errorID(3814)},destroy:function(){cc.Object.prototype.destroy.call(this)&&(this.active=!1)},destroyAllChildren:function(){for(var t=this._children,e=0;e>>1;i<=r;s=i+r>>>1){var a=t[s];if(a>e+n)r=s-1;else{if(!(a>2],a[o[i++]]=r[(3&s)<<2|l>>4],a[o[i++]]=r[15&l]}return a.join("")}}),{"./misc":294}],289:[(function(t,e,i){"use strict";cc.find=e.exports=function(t,e){if(null==t)return cc.errorID(3814),null;if(e)0;else{var i=cc.director.getScene();if(!i)return null;e=i}for(var n=e,r="/"!==t[0]?0:1,s=t.split("/"),a=r;a"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"]),this._specialSymbolArray.push([/ /g," "])};s.prototype={constructor:s,parse:function(t){this._resultObjectArray=[],this._stack=[];for(var e=0,i=t.length;e",e),r=-1;if(n>=0)(r=t.lastIndexOf("<",n))",r+1));if(r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},_attributeToObject:function(t){var e,i,n,s,a={},o=(t=t.trim()).match(/^(color|size)(\s)*=/);if(o){if(e=o[0],""===(t=t.substring(e.length).trim()))return a;switch(i=t.indexOf(" "),e[0]){case"c":a.color=i>-1?t.substring(0,i).trim():t;break;case"s":a.size=parseInt(t)}return i>-1&&(s=t.substring(i+1).trim(),n=this._processEventHandler(s),a.event=n),a}if((o=t.match(/^(br(\s)*\/)/))&&o[0].length>0&&(e=o[0].trim()).startsWith("br")&&"/"===e[e.length-1])return a.isNewLine=!0,this._resultObjectArray.push({text:"",style:{newline:!0}}),a;if((o=t.match(/^(img(\s)*src(\s)*=[^>]+\/)/))&&o[0].length>0&&(e=o[0].trim()).startsWith("img")&&"/"===e[e.length-1]){var l;o=t.match(r);for(var h=!1;o;){if(e=(t=t.substring(t.indexOf(o[0]))).substr(0,o[0].length),u=(i=(l=t.substring(e.length).trim()).indexOf(" "))>-1?l.substr(0,i):l,e=(e=e.replace(/[^a-zA-Z]/g,"").trim()).toLocaleLowerCase(),t=l.substring(i).trim(),u.endsWith("/")&&(u=u.slice(0,-1)),"src"===e){switch(u.charCodeAt(0)){case 34:case 39:h=!0,u=u.slice(1,-1)}a.isImage=!0,a.src=u}else if("height"===e)a.imageHeight=parseInt(u);else if("width"===e)a.imageWidth=parseInt(u);else if("align"===e){switch(u.charCodeAt(0)){case 34:case 39:u=u.slice(1,-1)}a.imageAlign=u.toLocaleLowerCase()}else"offset"===e?a.imageOffset=u:"click"===e&&(a.event=this._processEventHandler(e+"="+u));a.event&&"param"===e&&(a.event.param=u.replace(/^\"|\"$/g,"")),o=t.match(r)}return h&&a.isImage&&this._resultObjectArray.push({text:"",style:a}),{}}if(o=t.match(/^(outline(\s)*[^>]*)/)){var c={color:"#ffffff",width:1};if(t=o[0].substring("outline".length).trim()){var u,_=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(o=t.match(_);o;)e=(t=t.substring(t.indexOf(o[0]))).substr(0,o[0].length),u=(i=(l=t.substring(e.length).trim()).indexOf(" "))>-1?l.substr(0,i):l,e=(e=e.replace(/[^a-zA-Z]/g,"").trim()).toLocaleLowerCase(),t=l.substring(i).trim(),"click"===e?a.event=this._processEventHandler(e+"="+u):"color"===e?c.color=u:"width"===e&&(c.width=parseInt(u)),a.event&&"param"===e&&(a.event.param=u.replace(/^\"|\"$/g,"")),o=t.match(_)}a.outline=c}if((o=t.match(/^(on|u|b|i)(\s)*/))&&o[0].length>0){switch(e=o[0],t=t.substring(e.length).trim(),e[0]){case"u":a.underline=!0;break;case"i":a.italic=!0;break;case"b":a.bold=!0}if(""===t)return a;n=this._processEventHandler(t),a.event=n}return a},_processEventHandler:function(t){for(var e=0,i={},r=t.match(n),s=!1;r;){var a=r[0],o="";if(s=!1,'"'===(t=t.substring(a.length).trim()).charAt(0))(e=t.indexOf('"',1))>-1&&(o=t.substring(1,e).trim(),s=!0),e++;else if("'"===t.charAt(0))(e=t.indexOf("'",1))>-1&&(o=t.substring(1,e).trim(),s=!0),e++;else{var l=t.match(/(\S)+/);e=(o=l?l[0]:"").length}s&&(i[a=a.substring(0,a.length-1).trim()]=o),r=(t=t.substring(e).trim()).match(n)}return i},_addToStack:function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},_processResult:function(t){""!==t&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},_escapeSpecialSymbol:function(t){for(var e=0;e>1,t|=t>>2,t|=t>>4,t|=t>>8,(t|=t>>16)+1},BUILTIN_CLASSID_RE:/^(?:cc|dragonBones|sp|ccsg)\..+/},s=new Array(123),a=0;a<123;++a)s[a]=64;for(var o=0;o<64;++o)s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(o)]=o;r.BASE64_VALUES=s,r.pushToMap=function(t,e,i,n){var r=t[e];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):t[e]=n?[i,r]:[r,i]:t[e]=i},r.clampf=function(t,e,i){if(e>i){var n=e;e=i,i=n}return t=0&&this.removeAt(e)},r.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},r.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},r.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},r.push=function(t){this.array.push(t)},e.exports=n}),{}],296:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(){function t(){this.enabled=!1,this.count=0,this.maxSize=1024}var e=t.prototype;return e.get=function(){},e.put=function(){},e.clear=function(){},t})();i.default=n,cc.pool={},n.register=function(t,e){cc.pool[t]=e},e.exports=i.default}),{}],297:[(function(t,e,i){"use strict";cc._PrefabInfo=cc.Class({name:"cc.PrefabInfo",properties:{root:null,asset:null,fileId:"",sync:!1,_synced:{default:!1,serializable:!1}}}),e.exports={syncWithPrefab:function(t){var e=t._prefab;if(e._synced=!0,!e.asset)return cc.errorID(3701,t.name),void(t._prefab=null);var i=t._objFlags,n=t._parent,r=t._id,s=t._name,a=t._active,o=t._eulerAngles.x,l=t._eulerAngles.y,h=t._eulerAngles.z,c=t._localZOrder,u=t._globalZOrder,_=t._trs,f=_[0],d=_[1],p=_[2];cc.game._isCloning=!0,e.asset._doInstantiate(t),cc.game._isCloning=!1,t._objFlags=i,t._parent=n,t._id=r,t._prefab=e,t._name=s,t._active=a,t._localZOrder=c,t._globalZOrder=u,(_=t._trs)[0]=f,_[1]=d,_[2]=p,t._eulerAngles.x=o,t._eulerAngles.y=l,t._eulerAngles.z=h}}}),{}],298:[(function(t,e,i){"use strict";var n=t("../../platform/CCMacro"),r=t("./perf-counter"),s=!1,a=15,o=null,l=null,h=null;function c(){if(!o){o={frame:{desc:"Frame time (ms)",min:0,max:50,average:500},fps:{desc:"Framerate (FPS)",below:30,average:500},draws:{desc:"Draw call"},logic:{desc:"Game Logic (ms)",min:0,max:50,average:500,color:"#080"},render:{desc:"Renderer (ms)",min:0,max:50,average:500,color:"#f90"},mode:{desc:cc.game.renderType===cc.game.RENDER_TYPE_WEBGL?"WebGL":"Canvas",min:1}};var t=performance.now();for(var e in o)o[e]._counter=new r(e,o[e],t)}}function u(){if(!l||!l.isValid){(l=new cc.Node("PROFILER-NODE")).x=l.y=10,l.groupIndex=cc.Node.BuiltinGroupIndex.DEBUG,cc.Camera._setupDebugCamera(),l.zIndex=n.MAX_ZINDEX,cc.game.addPersistRootNode(l);var t=new cc.Node("LEFT-PANEL");t.anchorX=t.anchorY=0;var e=t.addComponent(cc.Label);e.fontSize=a,e.lineHeight=a,t.parent=l;var i=new cc.Node("RIGHT-PANEL");i.anchorX=1,i.anchorY=0,i.x=200;var r=i.addComponent(cc.Label);r.horizontalAlign=cc.Label.HorizontalAlign.RIGHT,r.fontSize=a,r.lineHeight=a,i.parent=l,cc.sys.browserType!==cc.sys.BROWSER_TYPE_BAIDU_GAME_SUB&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB&&(e.cacheMode=cc.Label.CacheMode.CHAR,r.cacheMode=cc.Label.CacheMode.CHAR),h={left:e,right:r}}}function _(){u();var t=cc.director._lastUpdate;o.frame._counter.start(t),o.logic._counter.start(t)}function f(){var t=performance.now();cc.director.isPaused()?o.frame._counter.start(t):o.logic._counter.end(t),o.render._counter.start(t)}function d(){var t=performance.now();o.render._counter.end(t),o.draws._counter.value=cc.renderer.drawCalls,o.frame._counter.end(t),o.fps._counter.frame(t);var e="",i="";for(var n in o){var r=o[n];r._counter.sample(t),e+=r.desc+"\n",i+=r._counter.human()+"\n"}h&&(h.left.string=e,h.right.string=i)}cc.profiler=e.exports={isShowingStats:function(){return s},hideStats:function(){s&&(l&&(l.active=!1),cc.director.off(cc.Director.EVENT_BEFORE_UPDATE,_),cc.director.off(cc.Director.EVENT_AFTER_UPDATE,f),cc.director.off(cc.Director.EVENT_AFTER_DRAW,d),s=!1)},showStats:function(){s||(c(),l&&(l.active=!0),cc.director.on(cc.Director.EVENT_BEFORE_UPDATE,_),cc.director.on(cc.Director.EVENT_AFTER_UPDATE,f),cc.director.on(cc.Director.EVENT_AFTER_DRAW,d),s=!0)}}}),{"../../platform/CCMacro":214,"./perf-counter":300}],299:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.Counter",ctor:function(t,e,i){this._id=t,this._opts=e||{},this._value=0,this._total=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._accumStart=i},properties:{value:{get:function(){return this._value},set:function(t){this._value=t}}},_average:function(t,e){if(this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},sample:function(t){this._average(this._value,t)},human:function(){var t=this._opts.average?this._averageValue:this._value;return Math.round(100*t)/100},alarm:function(){return this._opts.below&&this._valuethis._opts.over}});e.exports=n}),{}],300:[(function(t,e,i){"use strict";var n=t("./counter"),r=cc.Class({name:"cc.PerfCounter",extends:n,ctor:function(t,e,i){this._time=i},start:function(t){this._time=t},end:function(t){this._value=t-this._time,this._average(this._value)},tick:function(){this.end(),this.start()},frame:function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))}});e.exports=r}),{"./counter":299}],301:[(function(t,e,i){"use strict";var n=0;var r=new(function(t){return t&&t.__esModule?t:{default:t}}(t("../platform/js")).default.Pool)(2);function s(t){this.count=0,this.limit=t,this.datas={},this.head=null,this.tail=null}r.get=function(){return this._get()||{key:null,value:null,prev:null,next:null}},s.prototype.moveToHead=function(t){t.next=this.head,t.prev=null,null!==this.head&&(this.head.prev=t),this.head=t,null===this.tail&&(this.tail=t),this.count++,this.datas[t.key]=t},s.prototype.put=function(t,e){var i=r.get();if(i.key=t,i.value=e,this.count>=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,r.put(n)}this.moveToHead(i)},s.prototype.remove=function(t){null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},s.prototype.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},s.prototype.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},s.prototype.has=function(t){return!!this.datas[t]},s.prototype.delete=function(t){var e=this.datas[t];this.remove(e)};var a=new s(100),o={BASELINE_RATIO:.26,MIDDLE_RATIO:.37,BASELINE_OFFSET:n,label_wordRex:/([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430-\u044f\u0410-\u042f\u0401\u0451]+|\S)/,label_symbolRex:/^[!,.:;'}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/,label_lastWordRex:/([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+|\S)$/,label_lastEnglish:/[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+$/,label_firstEnglish:/^[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]/,highSurrogateRex:/[\uD800-\uDBFF]/,lowSurrogateRex:/[\uDC00-\uDFFF]/,label_wrapinspection:!0,__CHINESE_REG:/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/,__JAPANESE_REG:/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g,__KOREAN_REG:/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/,isUnicodeCJK:function(t){return this.__CHINESE_REG.test(t)||this.__JAPANESE_REG.test(t)||this.__KOREAN_REG.test(t)},isUnicodeSpace:function(t){return(t=t.charCodeAt(0))>=9&&t<=13||32===t||133===t||160===t||5760===t||t>=8192&&t<=8202||8232===t||8233===t||8239===t||8287===t||12288===t},safeMeasureText:function(t,e,i){var n=(i||t.font)+"\ud83c\udfae"+e,r=a.get(n);if(null!==r)return r;var s=t.measureText(e),o=s&&s.width||0;return a.put(n,o),o},_safeSubstring:function(t,e,i){var n=e,r=i,s=t[e];if(this.lowSurrogateRex.test(s)&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];this.highSurrogateRex.test(a)&&r--}else this.highSurrogateRex.test(s)&&r++;return t.substring(n,r)},fragmentText:function(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=this._safeSubstring(s,a),l=e-n(o),h=o,c=0,u=0;l>i&&u++<10;)a*=i/l,a|=0,l=e-n(o=this._safeSubstring(s,a));for(u=0;l<=i&&u++<10;){if(o){var _=this.label_wordRex.exec(o);c=_?_[0].length:1,h=o}a+=c,l=e-n(o=this._safeSubstring(s,a))}0===(a-=c)?(a=1,h=this._safeSubstring(s,1)):1===a&&this.highSurrogateRex.test(s[0])&&(a=2,h=this._safeSubstring(s,2));var f,d=this._safeSubstring(s,0,a);this.label_wrapinspection&&this.label_symbolRex.test(h||o)&&(0===(a-=(f=this.label_lastWordRex.exec(d))?f[0].length:0)&&(a=1),h=this._safeSubstring(s,a),d=this._safeSubstring(s,0,a)),this.label_firstEnglish.test(h)&&(f=this.label_lastEnglish.exec(d))&&d!==f[0]&&(a-=f[0].length,h=this._safeSubstring(s,a),d=this._safeSubstring(s,0,a)),0===r.length?r.push(d):(d=d.trimLeft()).length>0&&r.push(d),e=n(s=h||o)}return 0===r.length?r.push(s):(s=s.trimLeft()).length>0&&r.push(s),r}};cc.textUtils=e.exports=o}),{"../platform/js":229}],302:[(function(t,e,i){"use strict";var n=t("../assets/CCTexture2D"),r={loadImage:function(t,e,i){cc.assertID(t,3103);var r=cc.loader.getRes(t);return r?r.loaded?(e&&e.call(i,null,r),r):(r.once("load",(function(){e&&e.call(i,null,r)}),i),r):((r=new n).url=t,cc.loader.load({url:t,texture:r},(function(t,n){if(t)return e&&e.call(i,t||new Error("Unknown error"));n.handleLoadedTexture(),e&&e.call(i,null,n)})),r)},cacheImage:function(t,e){if(t&&e){var i=new n;i.initWithElement(e);var r={id:t,url:t,error:null,content:i,complete:!1};return cc.loader.flowOut(r),i}},postLoadTexture:function(t,e){t.loaded?e&&e():t.url?cc.loader.load({url:t.url,skips:t._isCompressed()?void 0:["Loader"]},(function(i,n){n&&(t.loaded||(t._nativeAsset=n)),e&&e(i)})):e&&e()}};cc.textureUtil=e.exports=r}),{"../assets/CCTexture2D":71}],303:[(function(t,e,i){"use strict";var n=t("./node-unit"),r=t("./node-mem-pool");e.exports={NodeMemPool:new r(n)}}),{"./node-mem-pool":305,"./node-unit":306}],304:[(function(t,e,i){"use strict";var n=function(t){this._unitClass=t,this._pool=[],this._findOrder=[]},r=n.prototype;r._initNative=function(){this._nativeMemPool=new renderer.MemPool},r._buildUnit=function(t){var e=new this._unitClass(t,this);return e},r._destroyUnit=function(t){this._pool[t]=null;for(var e=0,i=this._findOrder.length;e1&&e.isAllFree()&&this._destroyUnit(t.unitID),e},e.exports=n}),{}],305:[(function(t,e,i){"use strict";var n=t("./mem-pool"),r=function(t){n.call(this,t)};(function(){var t=function(){};t.prototype=n.prototype,r.prototype=new t})();var s=r.prototype;s._initNative=function(){this._nativeMemPool=new renderer.NodeMemPool},s._destroyUnit=function(t){n.prototype._destroyUnit.call(this,t)},e.exports=r}),{"./mem-pool":304}],306:[(function(t,e,i){"use strict";var n=t("../../value-types/utils"),r=(Uint32Array,10*n.FLOAT_BYTES),s=16*n.FLOAT_BYTES,a=16*n.FLOAT_BYTES,o=(Uint32Array,Uint32Array,Int32Array,Uint8Array,Uint8Array,Uint32Array,n.FLOAT_BYTES,t("./unit-base")),l=function(t,e){o.call(this,t,e);var i=this._contentNum;this.trsList=new n.FLOAT_ARRAY_TYPE(10*i),this.localMatList=new n.FLOAT_ARRAY_TYPE(16*i),this.worldMatList=new n.FLOAT_ARRAY_TYPE(16*i);for(var l=0;l",e=this._signData[2*e+0];for(var n=0,r="",s=this._contentNum,a=0;a")}var o=t+n;console.log("unitID:",this.unitID,"spaceNum:",t,"calc using num:",n,"store using num:",this._data[1],"calc total num:",o,"actually total num:",this._contentNum),console.log("free info:",i),console.log("using info:",r),n!=this._data[1]&&cc.error("using num error","calc using num:",n,"store using num:",this._data[1]),t+n!=this._contentNum&&cc.error("total num error","calc total num:",o,"actually total num:",this._contentNum)},e.exports=n}),{}],308:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=a(t("./value-type")),r=a(t("../platform/CCClass")),s=a(t("../utils/misc"));function a(t){return t&&t.__esModule?t:{default:t}}function o(t,e){for(var i=0;i>>0)+(n<<16)+(i<<8)+e,s}h(e,t),e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.clone=function(t){return new e(t.r,t.g,t.b,t.a)},e.set=function(t,e,i,n,r){return void 0===e&&(e=255),void 0===i&&(i=255),void 0===n&&(n=255),void 0===r&&(r=255),t.r=e,t.g=i,t.b=n,t.a=r,t},e.fromHex=function(t,e){var i=(e>>24)/255,n=(e>>16&255)/255,r=(e>>8&255)/255,s=(255&e)/255;return t.r=i,t.g=n,t.b=r,t.a=s,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return t.r=r+n*(i.r-r),t.g=s+n*(i.g-s),t.b=a+n*(i.b-a),t.a=o+n*(i.a-o),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},l(e,null,[{key:"WHITE",get:function(){return new e(255,255,255,255)}},{key:"BLACK",get:function(){return new e(0,0,0,255)}},{key:"TRANSPARENT",get:function(){return new e(0,0,0,0)}},{key:"GRAY",get:function(){return new e(127.5,127.5,127.5)}},{key:"RED",get:function(){return new e(255,0,0)}},{key:"GREEN",get:function(){return new e(0,255,0)}},{key:"BLUE",get:function(){return new e(0,0,255)}},{key:"YELLOW",get:function(){return new e(255,235,4)}},{key:"ORANGE",get:function(){return new e(255,127,0)}},{key:"CYAN",get:function(){return new e(0,255,255)}},{key:"MAGENTA",get:function(){return new e(255,0,255)}}]);var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,i,n){n=n||new e;var r=this.r,s=this.g,a=this.b,o=this.a;return n.r=r+(t.r-r)*i,n.g=s+(t.g-s)*i,n.b=a+(t.b-a)*i,n.a=o+(t.a-o)*i,n},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.getR=function(){return 255&this._val},i.setR=function(t){return t=~~s.default.clampf(t,0,255),this._val=(4294967040&this._val|t)>>>0,this},i.getG=function(){return(65280&this._val)>>8},i.setG=function(t){return t=~~s.default.clampf(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0,this},i.getB=function(){return(16711680&this._val)>>16},i.setB=function(t){return t=~~s.default.clampf(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0,this},i.getA=function(){return(4278190080&this._val)>>>24},i.setA=function(t){return t=~~s.default.clampf(t,0,255),this._val=(16777215&this._val|t<<24)>>>0,this},i.toCSS=function(t){return t&&"rgba"!==t?"rgb"===t?"rgb("+(0|this.r)+","+(0|this.g)+","+(0|this.b)+")":"#"+this.toHEX(t):"rgba("+(0|this.r)+","+(0|this.g)+","+(0|this.b)+","+(this.a/255).toFixed(2)+")"},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16)||255;return this._val=(r<<24>>>0)+(n<<16)+(i<<8)+e,this},i.toHEX=function(t){var e=[(this.r<16?"0":"")+(0|this.r).toString(16),(this.g<16?"0":"")+(0|this.g).toString(16),(this.b<16?"0":"")+(0|this.b).toString(16)],i=-1;if("#rgb"===t)for(i=0;i1&&(e[i]=e[i][0]);else if("#rrggbb"===t)for(i=0;i>>0)+(s<<16)+(r<<8)+n,this},i.toHSV=function(){var t=this.r/255,e=this.g/255,i=this.b/255,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t){return t._val?this._val=t._val:(this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a),this},i._fastSetA=function(t){this._val=(16777215&this._val|t<<24)>>>0},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},l(e,[{key:"r",get:function(){return this.getR()},set:function(t){this.setR(t)}},{key:"g",get:function(){return this.getG()},set:function(t){this.setG(t)}},{key:"b",get:function(){return this.getB()},set:function(t){this.setB(t)}},{key:"a",get:function(){return this.getA()},set:function(t){this.setA(t)}}]),e})(n.default);i.default=c,c.div=c.divide,c.sub=c.subtract,c.mul=c.multiply,c.WHITE_R=c.WHITE,c.BLACK_R=c.BLACK,c.TRANSPARENT_R=c.TRANSPARENT,c.GRAY_R=c.GRAY,c.RED_R=c.RED,c.GREEN_R=c.GREEN,c.BLUE_R=c.BLUE,c.YELLOW_R=c.YELLOW,c.ORANGE_R=c.ORANGE,c.CYAN_R=c.CYAN,c.MAGENTA_R=c.MAGENTA,r.default.fastDefine("cc.Color",c,{r:0,g:0,b:0,a:255}),cc.Color=c,cc.color=function(t,e,i,n){return"string"==typeof t?(new c).fromHEX(t):"object"==typeof t?new c(t.r,t.g,t.b,t.a):new c(t,e,i,n)},e.exports=i.default}),{"../platform/CCClass":209,"../utils/misc":294,"./value-type":317}],309:[(function(t,e,i){"use strict";i.__esModule=!0;var n={Vec2:!0,Vec3:!0,Vec4:!0,Mat4:!0,Mat3:!0,Rect:!0,Size:!0,Color:!0,Quat:!0,Trs:!0};i.Trs=i.Quat=i.Color=i.Size=i.Rect=i.Mat3=i.Mat4=i.Vec4=i.Vec3=i.Vec2=void 0;var r=p(t("./vec2"));i.Vec2=r.default;var s=p(t("./vec3"));i.Vec3=s.default;var a=p(t("./vec4"));i.Vec4=a.default;var o=p(t("./mat4"));i.Mat4=o.default;var l=p(t("./mat3"));i.Mat3=l.default;var h=p(t("./rect"));i.Rect=h.default;var c=p(t("./size"));i.Size=c.default;var u=p(t("./color"));i.Color=u.default;var _=p(t("./quat"));i.Quat=_.default;var f=p(t("./trs"));i.Trs=f.default;var d=t("./utils");function p(t){return t&&t.__esModule?t:{default:t}}Object.keys(d).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||(i[t]=d[t]))})),cc.math=e.exports}),{"./color":308,"./mat3":310,"./mat4":311,"./quat":312,"./rect":313,"./size":314,"./trs":315,"./utils":316,"./vec2":318,"./vec3":319,"./vec4":320}],310:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../value-types/utils"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("./vec3"));var s=(function(){function t(t,e,i,r,s,a,o,l,h){if(void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l&&(l=0),void 0===h&&(h=1),this.m=void 0,t instanceof n.FLOAT_ARRAY_TYPE)this.m=t;else{this.m=new n.FLOAT_ARRAY_TYPE(9);var c=this.m;c[0]=t,c[1]=e,c[2]=i,c[3]=r,c[4]=s,c[5]=a,c[6]=o,c[7]=l,c[8]=h}}return t.create=function(e,i,n,r,s,a,o,l,h){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===l&&(l=0),void 0===h&&(h=1),new t(e,i,n,r,s,a,o,l,h)},t.clone=function(e){var i=e.m;return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},t.copy=function(t,e){return t.m.set(e.m),t},t.set=function(t,e,i,n,r,s,a,o,l,h){var c=t.m;return c[0]=e,c[1]=i,c[2]=n,c[3]=r,c[4]=s,c[5]=a,c[6]=o,c[7]=l,c[8]=h,t},t.identity=function(t){var e=t.m;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,t},t.transpose=function(t,e){var i=e.m,n=t.m;if(t===e){var r=i[1],s=i[2],a=i[5];n[1]=i[3],n[2]=i[6],n[3]=r,n[5]=i[7],n[6]=s,n[7]=a}else n[0]=i[0],n[1]=i[3],n[2]=i[6],n[3]=i[1],n[4]=i[4],n[5]=i[7],n[6]=i[2],n[7]=i[5],n[8]=i[8];return t},t.invert=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],h=i[5],c=i[6],u=i[7],_=i[8],f=_*l-h*u,d=-_*o+h*c,p=u*o-l*c,m=r*f+s*d+a*p;return m?(m=1/m,n[0]=f*m,n[1]=(-_*s+a*u)*m,n[2]=(h*s-a*l)*m,n[3]=d*m,n[4]=(_*r-a*c)*m,n[5]=(-h*r+a*o)*m,n[6]=p*m,n[7]=(-u*r+s*c)*m,n[8]=(l*r-s*o)*m,t):t},t.adjoint=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],h=i[5],c=i[6],u=i[7],_=i[8];return n[0]=l*_-h*u,n[1]=a*u-s*_,n[2]=s*h-a*l,n[3]=h*c-o*_,n[4]=r*_-a*c,n[5]=a*o-r*h,n[6]=o*u-l*c,n[7]=s*c-r*u,n[8]=r*l-s*o,t},t.determinant=function(t){var e=t.m,i=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],h=e[7],c=e[8];return i*(c*a-o*h)+n*(-c*s+o*l)+r*(h*s-a*l)},t.multiply=function(t,e,i){var n=e.m,r=i.m,s=t.m,a=n[0],o=n[1],l=n[2],h=n[3],c=n[4],u=n[5],_=n[6],f=n[7],d=n[8],p=r[0],m=r[1],y=r[2],v=r[3],g=r[4],A=r[5],x=r[6],b=r[7],C=r[8];return s[0]=p*a+m*h+y*_,s[1]=p*o+m*c+y*f,s[2]=p*l+m*u+y*d,s[3]=v*a+g*h+A*_,s[4]=v*o+g*c+A*f,s[5]=v*l+g*u+A*d,s[6]=x*a+b*h+C*_,s[7]=x*o+b*c+C*f,s[8]=x*l+b*u+C*d,t},t.multiplyMat4=function(t,e,i){var n=e.m,r=i.m,s=t.m,a=n[0],o=n[1],l=n[2],h=n[3],c=n[4],u=n[5],_=n[6],f=n[7],d=n[8],p=r[0],m=r[1],y=r[2],v=r[4],g=r[5],A=r[6],x=r[8],b=r[9],C=r[10];return s[0]=p*a+m*h+y*_,s[1]=p*o+m*c+y*f,s[2]=p*l+m*u+y*d,s[3]=v*a+g*h+A*_,s[4]=v*o+g*c+A*f,s[5]=v*l+g*u+A*d,s[6]=x*a+b*h+C*_,s[7]=x*o+b*c+C*f,s[8]=x*l+b*u+C*d,t},t.translate=function(t,e,i){var n=e.m,r=t.m,s=n[0],a=n[1],o=n[2],l=n[3],h=n[4],c=n[5],u=n[6],_=n[7],f=n[8],d=i.x,p=i.y;return r[0]=s,r[1]=a,r[2]=o,r[3]=l,r[4]=h,r[5]=c,r[6]=d*s+p*l+u,r[7]=d*a+p*h+_,r[8]=d*o+p*c+f,t},t.rotate=function(t,e,i){var n=e.m,r=t.m,s=n[0],a=n[1],o=n[2],l=n[3],h=n[4],c=n[5],u=n[6],_=n[7],f=n[8],d=Math.sin(i),p=Math.cos(i);return r[0]=p*s+d*l,r[1]=p*a+d*h,r[2]=p*o+d*c,r[3]=p*l-d*s,r[4]=p*h-d*a,r[5]=p*c-d*o,r[6]=u,r[7]=_,r[8]=f,t},t.scale=function(t,e,i){var n=i.x,r=i.y,s=e.m,a=t.m;return a[0]=n*s[0],a[1]=n*s[1],a[2]=n*s[2],a[3]=r*s[3],a[4]=r*s[4],a[5]=r*s[5],a[6]=s[6],a[7]=s[7],a[8]=s[8],t},t.fromMat4=function(t,e){var i=e.m,n=t.m;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[4],n[4]=i[5],n[5]=i[6],n[6]=i[8],n[7]=i[9],n[8]=i[10],t},t.fromTranslation=function(t,e){var i=t.m;return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=1,i[5]=0,i[6]=e.x,i[7]=e.y,i[8]=1,t},t.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e),r=t.m;return r[0]=n,r[1]=i,r[2]=0,r[3]=-i,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,t},t.fromScaling=function(t,e){var i=t.m;return i[0]=e.x,i[1]=0,i[2]=0,i[3]=0,i[4]=e.y,i[5]=0,i[6]=0,i[7]=0,i[8]=1,t},t.fromQuat=function(t,e){var i=t.m,n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,l=r+r,h=s+s,c=n*o,u=r*o,_=r*l,f=s*o,d=s*l,p=s*h,m=a*o,y=a*l,v=a*h;return i[0]=1-_-p,i[3]=u-v,i[6]=f+y,i[1]=u+v,i[4]=1-c-p,i[7]=d-m,i[2]=f-y,i[5]=d+m,i[8]=1-c-_,t},t.fromViewUp=function(e,i,s){return (function(){var e=new r.default(0,1,0),i=new r.default,s=new r.default;return function(a,o,l){return r.default.lengthSqr(o)0?(r=2*Math.sqrt(n+1),t.w=.25*r,t.x=(i[6]-i[9])/r,t.y=(i[8]-i[2])/r,t.z=(i[1]-i[4])/r):i[0]>i[5]&&i[0]>i[10]?(r=2*Math.sqrt(1+i[0]-i[5]-i[10]),t.w=(i[6]-i[9])/r,t.x=.25*r,t.y=(i[1]+i[4])/r,t.z=(i[8]+i[2])/r):i[5]>i[10]?(r=2*Math.sqrt(1+i[5]-i[0]-i[10]),t.w=(i[8]-i[2])/r,t.x=(i[1]+i[4])/r,t.y=.25*r,t.z=(i[6]+i[9])/r):(r=2*Math.sqrt(1+i[10]-i[0]-i[5]),t.w=(i[1]-i[4])/r,t.x=(i[8]+i[2])/r,t.y=(i[6]+i[9])/r,t.z=.25*r),t},i.toRTS=function(t,e,i,n){var r=t.m,o=D.m;n.x=s.default.set(M,r[0],r[1],r[2]).mag(),o[0]=r[0]/n.x,o[1]=r[1]/n.x,o[2]=r[2]/n.x,n.y=s.default.set(M,r[4],r[5],r[6]).mag(),o[3]=r[4]/n.y,o[4]=r[5]/n.y,o[5]=r[6]/n.y,n.z=s.default.set(M,r[8],r[9],r[10]).mag(),o[6]=r[8]/n.z,o[7]=r[9]/n.z,o[8]=r[10]/n.z,l.default.determinant(D)<0&&(n.x*=-1,o[0]*=-1,o[1]*=-1,o[2]*=-1),a.default.fromMat3(e,D),s.default.set(i,r[12],r[13],r[14])},i.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,l=r+r,h=s+s,c=a+a,u=r*l,_=r*h,f=r*c,d=s*h,p=s*c,m=a*c,y=o*l,v=o*h,g=o*c,A=n.x,x=n.y,b=n.z,C=t.m;return C[0]=(1-(d+m))*A,C[1]=(_+g)*A,C[2]=(f-v)*A,C[3]=0,C[4]=(_-g)*x,C[5]=(1-(u+m))*x,C[6]=(p+y)*x,C[7]=0,C[8]=(f+v)*b,C[9]=(p-y)*b,C[10]=(1-(u+d))*b,C[11]=0,C[12]=i.x,C[13]=i.y,C[14]=i.z,C[15]=1,t},i.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,l=e.w,h=s+s,c=a+a,u=o+o,_=s*h,f=s*c,d=s*u,p=a*c,m=a*u,y=o*u,v=l*h,g=l*c,A=l*u,x=n.x,b=n.y,C=n.z,T=r.x,S=r.y,w=r.z,E=t.m;return E[0]=(1-(p+y))*x,E[1]=(f+A)*x,E[2]=(d-g)*x,E[3]=0,E[4]=(f-A)*b,E[5]=(1-(_+y))*b,E[6]=(m+v)*b,E[7]=0,E[8]=(d+g)*C,E[9]=(m-v)*C,E[10]=(1-(_+p))*C,E[11]=0,E[12]=i.x+T-(E[0]*T+E[4]*S+E[8]*w),E[13]=i.y+S-(E[1]*T+E[5]*S+E[9]*w),E[14]=i.z+w-(E[2]*T+E[6]*S+E[10]*w),E[15]=1,t},i.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,l=r+r,h=i*a,c=n*a,u=n*o,_=r*a,f=r*o,d=r*l,p=s*a,m=s*o,y=s*l,v=t.m;return v[0]=1-u-d,v[1]=c+y,v[2]=_-m,v[3]=0,v[4]=c-y,v[5]=1-h-d,v[6]=f+p,v[7]=0,v[8]=_+m,v[9]=f-p,v[10]=1-h-u,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,t},i.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),l=1/(r-n),h=1/(s-a),c=t.m;return c[0]=2*s*o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=2*s*l,c[6]=0,c[7]=0,c[8]=(i+e)*o,c[9]=(r+n)*l,c[10]=(a+s)*h,c[11]=-1,c[12]=0,c[13]=0,c[14]=a*s*2*h,c[15]=0,t},i.perspective=function(t,e,i,n,r){var s=1/Math.tan(e/2),a=1/(n-r),o=t.m;return o[0]=s/i,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+n)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*n*a,o[15]=0,t},i.ortho=function(t,e,i,n,r,s,a){var o=1/(e-i),l=1/(n-r),h=1/(s-a),c=t.m;return c[0]=-2*o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*l,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*h,c[11]=0,c[12]=(e+i)*o,c[13]=(r+n)*l,c[14]=(a+s)*h,c[15]=1,t},i.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,l=n.y,h=n.z,c=r-i.x,u=s-i.y,_=a-i.z,f=1/Math.sqrt(c*c+u*u+_*_),d=l*(_*=f)-h*(u*=f),p=h*(c*=f)-o*_,m=o*u-l*c,y=u*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),v=_*(d*=f)-c*m,g=c*p-u*d,A=t.m;return A[0]=d,A[1]=y,A[2]=c,A[3]=0,A[4]=p,A[5]=v,A[6]=u,A[7]=0,A[8]=m,A[9]=g,A[10]=_,A[11]=0,A[12]=-(d*r+p*s+m*a),A[13]=-(y*r+v*s+g*a),A[14]=-(c*r+u*s+_*a),A[15]=1,t},i.inverseTranspose=function(t,e){var i=e.m;u=i[0],_=i[1],f=i[2],d=i[3],p=i[4],m=i[5],y=i[6],v=i[7],g=i[8],A=i[9],x=i[10],b=i[11],C=i[12],T=i[13],S=i[14],w=i[15];var n=u*m-_*p,r=u*y-f*p,s=u*v-d*p,a=_*y-f*m,o=_*v-d*m,l=f*v-d*y,h=g*T-A*C,c=g*S-x*C,E=g*w-b*C,M=A*S-x*T,D=A*w-b*T,B=x*w-b*S,I=n*B-r*D+s*M+a*E-o*c+l*h;return I?(I=1/I,(i=t.m)[0]=(m*B-y*D+v*M)*I,i[1]=(y*E-p*B-v*c)*I,i[2]=(p*D-m*E+v*h)*I,i[3]=0,i[4]=(f*D-_*B-d*M)*I,i[5]=(u*B-f*E+d*c)*I,i[6]=(_*E-u*D-d*h)*I,i[7]=0,i[8]=(T*l-S*o+w*a)*I,i[9]=(S*s-C*l-w*r)*I,i[10]=(C*o-T*s+w*n)*I,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,t):null},i.add=function(t,e,i){var n=t.m,r=e.m,s=i.m;return n[0]=r[0]+s[0],n[1]=r[1]+s[1],n[2]=r[2]+s[2],n[3]=r[3]+s[3],n[4]=r[4]+s[4],n[5]=r[5]+s[5],n[6]=r[6]+s[6],n[7]=r[7]+s[7],n[8]=r[8]+s[8],n[9]=r[9]+s[9],n[10]=r[10]+s[10],n[11]=r[11]+s[11],n[12]=r[12]+s[12],n[13]=r[13]+s[13],n[14]=r[14]+s[14],n[15]=r[15]+s[15],t},i.subtract=function(t,e,i){var n=t.m,r=e.m,s=i.m;return n[0]=r[0]-s[0],n[1]=r[1]-s[1],n[2]=r[2]-s[2],n[3]=r[3]-s[3],n[4]=r[4]-s[4],n[5]=r[5]-s[5],n[6]=r[6]-s[6],n[7]=r[7]-s[7],n[8]=r[8]-s[8],n[9]=r[9]-s[9],n[10]=r[10]-s[10],n[11]=r[11]-s[11],n[12]=r[12]-s[12],n[13]=r[13]-s[13],n[14]=r[14]-s[14],n[15]=r[15]-s[15],t},i.multiplyScalar=function(t,e,i){var n=t.m,r=e.m;return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=r[3]*i,n[4]=r[4]*i,n[5]=r[5]*i,n[6]=r[6]*i,n[7]=r[7]*i,n[8]=r[8]*i,n[9]=r[9]*i,n[10]=r[10]*i,n[11]=r[11]*i,n[12]=r[12]*i,n[13]=r[13]*i,n[14]=r[14]*i,n[15]=r[15]*i,t},i.multiplyScalarAndAdd=function(t,e,i,n){var r=t.m,s=e.m,a=i.m;return r[0]=s[0]+a[0]*n,r[1]=s[1]+a[1]*n,r[2]=s[2]+a[2]*n,r[3]=s[3]+a[3]*n,r[4]=s[4]+a[4]*n,r[5]=s[5]+a[5]*n,r[6]=s[6]+a[6]*n,r[7]=s[7]+a[7]*n,r[8]=s[8]+a[8]*n,r[9]=s[9]+a[9]*n,r[10]=s[10]+a[10]*n,r[11]=s[11]+a[11]*n,r[12]=s[12]+a[12]*n,r[13]=s[13]+a[13]*n,r[14]=s[14]+a[14]*n,r[15]=s[15]+a[15]*n,t},i.strictEquals=function(t,e){var i=t.m,n=e.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},i.equals=function(t,e,i){void 0===i&&(i=o.EPSILON);var n=t.m,r=e.m;return Math.abs(n[0]-r[0])<=i*Math.max(1,Math.abs(n[0]),Math.abs(r[0]))&&Math.abs(n[1]-r[1])<=i*Math.max(1,Math.abs(n[1]),Math.abs(r[1]))&&Math.abs(n[2]-r[2])<=i*Math.max(1,Math.abs(n[2]),Math.abs(r[2]))&&Math.abs(n[3]-r[3])<=i*Math.max(1,Math.abs(n[3]),Math.abs(r[3]))&&Math.abs(n[4]-r[4])<=i*Math.max(1,Math.abs(n[4]),Math.abs(r[4]))&&Math.abs(n[5]-r[5])<=i*Math.max(1,Math.abs(n[5]),Math.abs(r[5]))&&Math.abs(n[6]-r[6])<=i*Math.max(1,Math.abs(n[6]),Math.abs(r[6]))&&Math.abs(n[7]-r[7])<=i*Math.max(1,Math.abs(n[7]),Math.abs(r[7]))&&Math.abs(n[8]-r[8])<=i*Math.max(1,Math.abs(n[8]),Math.abs(r[8]))&&Math.abs(n[9]-r[9])<=i*Math.max(1,Math.abs(n[9]),Math.abs(r[9]))&&Math.abs(n[10]-r[10])<=i*Math.max(1,Math.abs(n[10]),Math.abs(r[10]))&&Math.abs(n[11]-r[11])<=i*Math.max(1,Math.abs(n[11]),Math.abs(r[11]))&&Math.abs(n[12]-r[12])<=i*Math.max(1,Math.abs(n[12]),Math.abs(r[12]))&&Math.abs(n[13]-r[13])<=i*Math.max(1,Math.abs(n[13]),Math.abs(r[13]))&&Math.abs(n[14]-r[14])<=i*Math.max(1,Math.abs(n[14]),Math.abs(r[14]))&&Math.abs(n[15]-r[15])<=i*Math.max(1,Math.abs(n[15]),Math.abs(r[15]))},i.adjoint=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],h=i[5],c=i[6],u=i[7],_=i[8],f=i[9],d=i[10],p=i[11],m=i[12],y=i[13],v=i[14],g=i[15];return n[0]=h*(d*g-p*v)-f*(c*g-u*v)+y*(c*p-u*d),n[1]=-(s*(d*g-p*v)-f*(a*g-o*v)+y*(a*p-o*d)),n[2]=s*(c*g-u*v)-h*(a*g-o*v)+y*(a*u-o*c),n[3]=-(s*(c*p-u*d)-h*(a*p-o*d)+f*(a*u-o*c)),n[4]=-(l*(d*g-p*v)-_*(c*g-u*v)+m*(c*p-u*d)),n[5]=r*(d*g-p*v)-_*(a*g-o*v)+m*(a*p-o*d),n[6]=-(r*(c*g-u*v)-l*(a*g-o*v)+m*(a*u-o*c)),n[7]=r*(c*p-u*d)-l*(a*p-o*d)+_*(a*u-o*c),n[8]=l*(f*g-p*y)-_*(h*g-u*y)+m*(h*p-u*f),n[9]=-(r*(f*g-p*y)-_*(s*g-o*y)+m*(s*p-o*f)),n[10]=r*(h*g-u*y)-l*(s*g-o*y)+m*(s*u-o*h),n[11]=-(r*(h*p-u*f)-l*(s*p-o*f)+_*(s*u-o*h)),n[12]=-(l*(f*v-d*y)-_*(h*v-c*y)+m*(h*d-c*f)),n[13]=r*(f*v-d*y)-_*(s*v-a*y)+m*(s*d-a*f),n[14]=-(r*(h*v-c*y)-l*(s*v-a*y)+m*(s*c-a*h)),n[15]=r*(h*d-c*f)-l*(s*d-a*f)+_*(s*c-a*h),t},i.toArray=function(t,e,i){void 0===i&&(i=0);for(var n=e.m,r=0;r<16;r++)t[i+r]=n[r];return t},i.fromArray=function(t,e,i){void 0===i&&(i=0);for(var n=t.m,r=0;r<16;r++)n[r]=e[i+r];return t},e.clone=function(){var t=this.m;return new i(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},e.set=function(t){var e=this.m,i=t.m;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},e.equals=function(t){return i.strictEquals(this,t)},e.fuzzyEquals=function(t){return i.equals(this,t)},e.toString=function(){var t=this.m;return t?"[\n"+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+",\n"+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+",\n"+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+",\n"+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+"\n]":"[\n1, 0, 0, 0\n0, 1, 0, 0\n0, 0, 1, 0\n0, 0, 0, 1\n]"},e.identity=function(){return i.identity(this)},e.transpose=function(t){return t=t||new i,i.transpose(t,this)},e.invert=function(t){return t=t||new i,i.invert(t,this)},e.adjoint=function(t){return t=t||new i,i.adjoint(t,this)},e.determinant=function(){return i.determinant(this)},e.add=function(t,e){return e=e||new i,i.add(e,this,t)},e.subtract=function(t){return i.subtract(this,this,t)},e.multiply=function(t){return i.multiply(this,this,t)},e.multiplyScalar=function(t){return i.multiplyScalar(this,this,t)},e.translate=function(t,e){return e=e||new i,i.translate(e,this,t)},e.scale=function(t,e){return e=e||new i,i.scale(e,this,t)},e.rotate=function(t,e,n){return n=n||new i,i.rotate(n,this,t,e)},e.getTranslation=function(t){return t=t||new s.default,i.getTranslation(t,this)},e.getScale=function(t){return t=t||new s.default,i.getScaling(t,this)},e.getRotation=function(t){return t=t||new a.default,i.getRotation(t,this)},e.fromRTS=function(t,e,n){return i.fromRTS(this,t,e,n)},e.fromQuat=function(t){return i.fromQuat(this,t)},i})(n.default);i.default=E,E.mul=E.multiply,E.sub=E.subtract,E.IDENTITY=Object.freeze(new E);var M=new s.default,D=new l.default;r.default.fastDefine("cc.Mat4",E,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1});for(var B=function(t){Object.defineProperty(E.prototype,"m"+t,{get:function(){return this.m[t]},set:function(e){this.m[t]=e}})},I=0;I<16;I++)B(I);cc.mat4=function(t,e,i,n,r,s,a,o,l,h,c,u,_,f,d,p){var m=new E(t,e,i,n,r,s,a,o,l,h,c,u,_,f,d,p);return void 0===t&&E.identity(m),m},cc.Mat4=E,e.exports=i.default}),{"../platform/CCClass":209,"./mat3":310,"./quat":312,"./utils":316,"./value-type":317,"./vec3":319}],312:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=l(t("./value-type")),r=l(t("../platform/CCClass")),s=l(t("./vec3")),a=l(t("./mat3")),o=t("./utils");function l(t){return t&&t.__esModule?t:{default:t}}function h(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var c=0,u=0,_=0,f=0,d=(function(t){h(i,t);var e=i.prototype;function i(e,i,n,r){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),(s=t.call(this)||this).x=void 0,s.y=void 0,s.z=void 0,s.w=void 0,e&&"object"==typeof e?(s.z=e.z,s.y=e.y,s.w=e.w,s.x=e.x):(s.x=e,s.y=i,s.z=n,s.w=r),s}return e.mul=function(t,e){return i.multiply(e||new i,this,t)},i.clone=function(t){return new i(t.x,t.y,t.z,t.w)},i.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},i.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},i.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},i.rotationTo=function(t,e,n){var r=s.default.dot(e,n);return r<-.999999?(s.default.cross(y,s.default.RIGHT,e),y.mag()<1e-6&&s.default.cross(y,s.default.UP,e),s.default.normalize(y,y),i.fromAxisAngle(t,y,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(s.default.cross(y,e,n),t.x=y.x,t.y=y.y,t.z=y.z,t.w=1+r,i.normalize(t,t))},i.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},i.multiply=function(t,e,i){return c=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,u=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,_=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,f=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z,t.x=c,t.y=u,t.z=_,t.w=f,t},i.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},i.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},i.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i);return t.x=e.x*r+e.w*n,t.y=e.y*r+e.z*n,t.z=e.z*r-e.y*n,t.w=e.w*r-e.x*n,t},i.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i);return t.x=e.x*r-e.z*n,t.y=e.y*r+e.w*n,t.z=e.z*r+e.x*n,t.w=e.w*r-e.y*n,t},i.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i);return t.x=e.x*r+e.y*n,t.y=e.y*r-e.x*n,t.z=e.z*r+e.w*n,t.w=e.w*r-e.z*n,t},i.rotateAround=function(t,e,n,r){return i.invert(p,e),s.default.transformQuat(y,n,p),i.fromAxisAngle(p,y,r),i.multiply(t,e,p),t},i.rotateAroundLocal=function(t,e,n,r){return i.fromAxisAngle(p,n,r),i.multiply(t,e,p),t},i.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},i.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},i.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},i.slerp=function(t,e,i,n){var r=0,s=0,a=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(a<0&&(a=-a,i.x=-i.x,i.y=-i.y,i.z=-i.z,i.w=-i.w),1-a>1e-6){var o=Math.acos(a),l=Math.sin(o);r=Math.sin((1-n)*o)/l,s=Math.sin(n*o)/l}else r=1-n,s=n;return t.x=r*e.x+s*i.x,t.y=r*e.y+s*i.y,t.z=r*e.z+s*i.z,t.w=r*e.w+s*i.w,t},i.sqlerp=function(t,e,n,r,s,a){return i.slerp(p,e,s,a),i.slerp(m,n,r,a),i.slerp(t,p,m,2*a*(1-a)),t},i.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},i.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},i.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},i.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},i.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0&&(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i),t},i.fromAxes=function(t,e,n,r){return a.default.set(v,e.x,e.y,e.z,n.x,n.y,n.z,r.x,r.y,r.z),i.normalize(t,i.fromMat3(t,v))},i.fromViewUp=function(t,e,n){return a.default.fromViewUp(v,e,n),i.normalize(t,i.fromMat3(t,v))},i.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},i.fromAngleZ=function(t,e){return e*=g,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},i.fromMat3=function(t,e){var i=e.m,n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],u=i[8],_=n+o+u;if(_>0){var f=.5/Math.sqrt(_+1);t.w=.25/f,t.x=(l-c)*f,t.y=(h-s)*f,t.z=(r-a)*f}else if(n>o&&n>u){var d=2*Math.sqrt(1+n-o-u);t.w=(l-c)/d,t.x=.25*d,t.y=(a+r)/d,t.z=(h+s)/d}else if(o>u){var p=2*Math.sqrt(1+o-n-u);t.w=(h-s)/p,t.x=(a+r)/p,t.y=.25*p,t.z=(c+l)/p}else{var m=2*Math.sqrt(1+u-n-o);t.w=(r-a)/m,t.x=(h+s)/m,t.y=(c+l)/m,t.z=.25*m}return t},i.fromEuler=function(t,e,i,n){e*=g,i*=g,n*=g;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),l=Math.sin(n),h=Math.cos(n);return t.x=r*o*h+s*a*l,t.y=s*a*h+r*o*l,t.z=s*o*l-r*a*h,t.w=s*o*h-r*a*l,t},i.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x+i*e.w,t},i.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},i.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x-n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},i.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,l=0,h=0,c=0,u=n*r+s*a;if(u>.499999)l=0,h=(0,o.toDegree)(2*Math.atan2(n,a)),c=90;else if(u<-.499999)l=0,h=-(0,o.toDegree)(2*Math.atan2(n,a)),c=-90;else{var _=n*n,f=r*r,d=s*s;l=(0,o.toDegree)(Math.atan2(2*n*a-2*r*s,1-2*_-2*d)),h=(0,o.toDegree)(Math.atan2(2*r*a-2*n*s,1-2*f-2*d)),c=(0,o.toDegree)(Math.asin(2*u)),i&&(l=-180*Math.sign(l+1e-6)+l,h=-180*Math.sign(h+1e-6)+h,c=180*Math.sign(c+1e-6)-c)}return t.x=l,t.y=h,t.z=c,t},i.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},i.equals=function(t,e,i){return void 0===i&&(i=o.EPSILON),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},i.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},i.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.clone=function(){return new i(this.x,this.y,this.z,this.w)},e.set=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.toEuler=function(t){return i.toEuler(t,this)},e.fromEuler=function(t){return i.fromEuler(this,t.x,t.y,t.z)},e.lerp=function(t,e,n){return n=n||new i,i.slerp(n,this,t,e),n},e.multiply=function(t){return i.multiply(this,this,t)},e.rotateAround=function(t,e,n,r){return r=r||new i,i.rotateAround(r,t,e,n)},i})(n.default);i.default=d,d.mul=d.multiply,d.scale=d.multiplyScalar,d.mag=d.len,d.IDENTITY=Object.freeze(new d);var p=new d,m=new d,y=new s.default,v=new a.default,g=.5*Math.PI/180;r.default.fastDefine("cc.Quat",d,{x:0,y:0,z:0,w:1}),cc.quat=function(t,e,i,n){return new d(t,e,i,n)},cc.Quat=d,e.exports=i.default}),{"../platform/CCClass":209,"./mat3":310,"./utils":316,"./value-type":317,"./vec3":319}],313:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=o(t("./value-type")),r=o(t("../platform/CCClass")),s=o(t("./vec2")),a=o(t("./size"));function o(t){return t&&t.__esModule?t:{default:t}}function l(t,e){for(var i=0;i=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.union=function(t,e){var i=this.x,n=this.y,r=this.width,s=this.height,a=e.x,o=e.y,l=e.width,h=e.height;return t.x=Math.min(i,a),t.y=Math.min(n,o),t.width=Math.max(i+r,a+l)-t.x,t.height=Math.max(n+s,o+h)-t.y,t},i.transformMat4=function(t,e){var i=this.x,n=this.y,r=i+this.width,s=n+this.height,a=e.m,o=a[0]*i+a[4]*n+a[12],l=a[1]*i+a[5]*n+a[13],h=a[0]*r+a[4]*n+a[12],c=a[1]*r+a[5]*n+a[13],u=a[0]*i+a[4]*s+a[12],_=a[1]*i+a[5]*s+a[13],f=a[0]*r+a[4]*s+a[12],d=a[1]*r+a[5]*s+a[13],p=Math.min(o,h,u,f),m=Math.max(o,h,u,f),y=Math.min(l,c,_,d),v=Math.max(l,c,_,d);return t.x=p,t.y=y,t.width=m-p,t.height=v-y,t},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},h(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new s.default(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new s.default(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new a.default(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}}]),e})(n.default);i.default=u,r.default.fastDefine("cc.Rect",u,{x:0,y:0,width:0,height:0}),cc.Rect=u,cc.rect=function(t,e,i,n){return new u(t,e,i,n)},e.exports=i.default}),{"../platform/CCClass":209,"./size":314,"./value-type":317,"./vec2":318}],314:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=s(t("./value-type")),r=s(t("../platform/CCClass"));function s(t){return t&&t.__esModule?t:{default:t}}function a(t,e){for(var i=0;ii?i:t},i.clamp01=function(t){return t<0?0:t>1?1:t},i.lerp=function(t,e,i){return t+(e-t)*i},i.toRadian=function(t){return t*n},i.toDegree=function(t){return t*r},i.randomRange=l,i.randomRangeInt=function(t,e){return Math.floor(l(t,e))},i.pseudoRandom=h,i.pseudoRandomRange=c,i.pseudoRandomRangeInt=function(t,e,i){return Math.floor(c(t,e,i))},i.nextPow2=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},i.repeat=u,i.pingPong=function(t,e){return t=u(t,2*e),t=e-Math.abs(t-e)},i.inverseLerp=function(t,e,i){return(i-t)/(e-t)},i.sign=function(t){return(t>0)-(t<0)},i.random=i.FLOAT_BYTES=i.FLOAT_ARRAY_TYPE=i.INT_MIN=i.INT_MAX=i.INT_BITS=i.EPSILON=void 0;var n=Math.PI/180,r=180/Math.PI,s=1e-6;i.EPSILON=s;i.INT_BITS=32;i.INT_MAX=2147483647;i.INT_MIN=-1<<31;var a=Float64Array;i.FLOAT_ARRAY_TYPE=a;i.FLOAT_BYTES=8;var o=Math.random;function l(t,e){return Math.random()*(e-t)+t}function h(t){return(t=(9301*t+49297)%233280)/233280}function c(t,e,i){return h(t)*(i-e)+e}function u(t,e){return t-Math.floor(t/e)*e}i.random=o}),{}],317:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../platform/js"));var r=(function(){function t(){}var e=t.prototype;return e.clone=function(){return cc.errorID("0100",n.default.getClassName(this)+".clone"),null},e.equals=function(t){return cc.errorID("0100",n.default.getClassName(this)+".equals"),!1},e.lerp=function(t,e){return cc.errorID("0100",n.default.getClassName(this)+".lerp"),this.clone()},e.set=function(t){cc.errorID("0100",n.default.getClassName(this)+".set")},e.toString=function(){return""+{}},t})();i.default=r,n.default.setClassName("cc.ValueType",r),cc.ValueType=r,e.exports=i.default}),{"../platform/js":229}],318:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=o(t("./value-type")),r=o(t("../platform/CCClass")),s=o(t("../utils/misc")),a=t("./utils");function o(t){return t&&t.__esModule?t:{default:t}}function l(t,e){for(var i=0;i0&&(i=1/Math.sqrt(i),t.x=u*i,t.y=_*i),t},i.dot=function(t,e){return t.x*e.x+t.y*e.y},i.cross=function(t,e,i){return t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t},i.lerp=function(t,e,i,n){return u=e.x,_=e.y,t.x=u+n*(i.x-u),t.y=_+n*(i.y-_),t},i.random=function(t,e){e=e||1;var i=2*(0,a.random)()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},i.transformMat3=function(t,e,i){u=e.x,_=e.y;var n=i.m;return t.x=n[0]*u+n[3]*_+n[6],t.y=n[1]*u+n[4]*_+n[7],t},i.transformMat4=function(t,e,i){u=e.x,_=e.y;var n=i.m;return t.x=n[0]*u+n[4]*_+n[12],t.y=n[1]*u+n[5]*_+n[13],t},i.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},i.equals=function(t,e,i){return void 0===i&&(i=a.EPSILON),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))},i.angle=function(t,e){i.normalize(d,t),i.normalize(p,e);var n=i.dot(d,p);return n>1?0:n<-1?Math.PI:Math.acos(n)},i.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},i.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},h(i,null,[{key:"ONE",get:function(){return new i(1,1)}},{key:"ZERO",get:function(){return new i(0,0)}},{key:"UP",get:function(){return new i(0,1)}},{key:"RIGHT",get:function(){return new i(1,0)}}]),e.clone=function(){return new i(this.x,this.y)},e.set=function(t){return this.x=t.x,this.y=t.y,this},e.equals=function(t){return t&&this.x===t.x&&this.y===t.y},e.fuzzyEquals=function(t,e){return this.x-e<=t.x&&t.x<=this.x+e&&this.y-e<=t.y&&t.y<=this.y+e},e.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},e.lerp=function(t,e,n){n=n||new i;var r=this.x,s=this.y;return n.x=r+(t.x-r)*e,n.y=s+(t.y-s)*e,n},e.clampf=function(t,e){return this.x=s.default.clampf(this.x,t.x,e.x),this.y=s.default.clampf(this.y,t.y,e.y),this},e.add=function(t,e){return(e=e||new i).x=this.x+t.x,e.y=this.y+t.y,e},e.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this},e.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.divide=function(t){return this.x/=t,this.y/=t,this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSqr=function(){return this.x*this.x+this.y*this.y},e.normalizeSelf=function(){var t=this.x*this.x+this.y*this.y;if(1===t)return this;if(0===t)return this;var e=1/Math.sqrt(t);return this.x*=e,this.y*=e,this},e.normalize=function(t){return(t=t||new i).x=this.x,t.y=this.y,t.normalizeSelf(),t},e.angle=function(t){var e=this.magSqr(),i=t.magSqr();if(0===e||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(t)/Math.sqrt(e*i);return n=s.default.clampf(n,-1,1),Math.acos(n)},e.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},e.rotate=function(t,e){return(e=e||new i).x=this.x,e.y=this.y,e.rotateSelf(t)},e.rotateSelf=function(t){var e=Math.sin(t),i=Math.cos(t),n=this.x;return this.x=i*n-e*this.y,this.y=e*n+i*this.y,this},e.project=function(t){return t.multiplyScalar(this.dot(t)/t.dot(t))},e.transformMat4=function(t,e){return e=e||new i,i.transformMat4(e,this,t),e},e.maxAxis=function(){return Math.max(this.x,this.y)},i})(n.default);i.default=f,f.sub=f.subtract,f.mul=f.multiply,f.scale=f.multiplyScalar,f.mag=f.len,f.squaredMagnitude=f.lengthSqr,f.div=f.divide,f.ONE_R=f.ONE,f.ZERO_R=f.ZERO,f.UP_R=f.UP,f.RIGHT_R=f.RIGHT;var d=new f,p=new f;r.default.fastDefine("cc.Vec2",f,{x:0,y:0}),cc.v2=function(t,e){return new f(t,e)},cc.Vec2=f,e.exports=i.default}),{"../platform/CCClass":209,"../utils/misc":294,"./utils":316,"./value-type":317}],319:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=l(t("./value-type")),r=l(t("../platform/CCClass")),s=l(t("../utils/misc")),a=l(t("./vec2")),o=t("./utils");function l(t){return t&&t.__esModule?t:{default:t}}function h(t,e){for(var i=0;i0&&(i=1/Math.sqrt(i),t.x=_*i,t.y=f*i,t.z=d*i),t},i.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},i.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,l=i.z;return t.x=r*l-s*o,t.y=s*a-n*l,t.z=n*o-r*a,t},i.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},i.random=function(t,e){e=e||1;var i=2*(0,o.random)()*Math.PI,n=2*(0,o.random)()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},i.transformMat4=function(t,e,i){_=e.x,f=e.y,d=e.z;var n=i.m,r=n[3]*_+n[7]*f+n[11]*d+n[15];return r=r?1/r:1,t.x=(n[0]*_+n[4]*f+n[8]*d+n[12])*r,t.y=(n[1]*_+n[5]*f+n[9]*d+n[13])*r,t.z=(n[2]*_+n[6]*f+n[10]*d+n[14])*r,t},i.transformMat4Normal=function(t,e,i){_=e.x,f=e.y,d=e.z;var n=i.m,r=n[3]*_+n[7]*f+n[11]*d;return r=r?1/r:1,t.x=(n[0]*_+n[4]*f+n[8]*d)*r,t.y=(n[1]*_+n[5]*f+n[9]*d)*r,t.z=(n[2]*_+n[6]*f+n[10]*d)*r,t},i.transformMat3=function(t,e,i){_=e.x,f=e.y,d=e.z;var n=i.m;return t.x=_*n[0]+f*n[3]+d*n[6],t.y=_*n[1]+f*n[4]+d*n[7],t.z=_*n[2]+f*n[5]+d*n[8],t},i.transformAffine=function(t,e,i){_=e.x,f=e.y,d=e.z;var n=i.m;return t.x=n[0]*_+n[1]*f+n[2]*d+n[3],t.y=n[4]*_+n[5]*f+n[6]*d+n[7],t.x=n[8]*_+n[9]*f+n[10]*d+n[11],t},i.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},i.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,l=i.w*s+i.y*o-i.z*a,h=i.w*a+i.z*s-i.x*o,c=i.w*o+i.x*a-i.y*s,u=-i.x*s-i.y*a-i.z*o;return t.x=l*i.w+u*-i.x+h*-i.z-c*-i.y+n.x,t.y=h*i.w+u*-i.y+c*-i.x-l*-i.z+n.y,t.z=c*i.w+u*-i.z+l*-i.y-h*-i.x+n.z,t},i.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,l=i.w*s-i.y*o+i.z*a,h=i.w*a-i.z*s+i.x*o,c=i.w*o-i.x*a+i.y*s,u=i.x*s+i.y*a+i.z*o;return t.x=(l*i.w+u*i.x+h*i.z-c*i.y)/r.x,t.y=(h*i.w+u*i.y+c*i.x-l*i.z)/r.y,t.z=(c*i.w+u*i.z+l*i.y-h*i.x)/r.z,t},i.rotateX=function(t,e,i,n){_=e.x-i.x,f=e.y-i.y,d=e.z-i.z;var r=Math.cos(n),s=Math.sin(n),a=_,o=f*r-d*s,l=f*s+d*r;return t.x=a+i.x,t.y=o+i.y,t.z=l+i.z,t},i.rotateY=function(t,e,i,n){_=e.x-i.x,f=e.y-i.y,d=e.z-i.z;var r=Math.cos(n),s=Math.sin(n),a=d*s+_*r,o=f,l=d*r-_*s;return t.x=a+i.x,t.y=o+i.y,t.z=l+i.z,t},i.rotateZ=function(t,e,i,n){_=e.x-i.x,f=e.y-i.y,d=e.z-i.z;var r=Math.cos(n),s=Math.sin(n),a=_*r-f*s,o=_*s+f*r,l=d;return t.x=a+i.x,t.y=o+i.y,t.z=l+i.z,t},i.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},i.equals=function(t,e,i){void 0===i&&(i=o.EPSILON);var n=t.x,r=t.y,s=t.z,a=e.x,l=e.y,h=e.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-l)<=i*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},i.angle=function(t,e){i.normalize(m,t),i.normalize(y,e);var n=i.dot(m,y);return n>1?0:n<-1?Math.PI:Math.acos(n)},i.projectOnPlane=function(t,e,n){return i.subtract(t,e,i.project(t,e,n))},i.project=function(t,e,n){var r=i.lengthSqr(n);return r<1e-6?i.set(t,0,0,0):i.multiplyScalar(t,n,i.dot(e,n)/r)},i.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},i.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},c(i,null,[{key:"ONE",get:function(){return new i(1,1,1)}},{key:"ZERO",get:function(){return new i}},{key:"UP",get:function(){return new i(0,1,0)}},{key:"RIGHT",get:function(){return new i(1,0,0)}},{key:"FORWARD",get:function(){return new i(0,0,1)}}]),e.clone=function(){return new i(this.x,this.y,this.z)},e.set=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z},e.fuzzyEquals=function(t,e){return this.x-e<=t.x&&t.x<=this.x+e&&this.y-e<=t.y&&t.y<=this.y+e&&this.z-e<=t.z&&t.z<=this.z+e},e.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},e.lerp=function(t,e,n){return n=n||new i,i.lerp(n,this,t,e),n},e.clampf=function(t,e){return this.x=s.default.clampf(this.x,t.x,e.x),this.y=s.default.clampf(this.y,t.y,e.y),this.z=s.default.clampf(this.z,t.z,e.z),this},e.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.add=function(t,e){return(e=e||new i).x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e},e.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.divide=function(t){return this.x/=t,this.y/=t,this.z/=t,this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t,e){return e=e||new i,i.cross(e,this,t),e},e.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalizeSelf=function(){return i.normalize(this,this),this},e.normalize=function(t){return t=t||new i,i.normalize(t,this),t},e.transformMat4=function(t,e){return e=e||new i,i.transformMat4(e,this,t),e},e.maxAxis=function(){return Math.max(this.x,this.y,this.z)},e.signAngle=function(t){cc.warnID(1408,"vec3.signAngle","v2.1","cc.v2(selfVector).signAngle(vector)");var e=new a.default(this.x,this.y),i=new a.default(t.x,t.y);return e.signAngle(i)},e.rotate=function(t,e){return cc.warnID(1408,"vec3.rotate","v2.1","cc.v2(selfVector).rotate(radians, out)"),a.default.prototype.rotate.call(this,t,e)},e.rotateSelf=function(t){return cc.warnID(1408,"vec3.rotateSelf","v2.1","cc.v2(selfVector).rotateSelf(radians)"),a.default.prototype.rotateSelf.call(this,t)},i})(n.default);i.default=p,p.sub=p.subtract,p.mul=p.multiply,p.scale=p.multiplyScalar,p.mag=p.len,p.squaredMagnitude=p.lengthSqr,p.div=p.divide,p.ONE_R=p.ONE,p.ZERO_R=p.ZERO,p.UP_R=p.UP,p.RIGHT_R=p.RIGHT,p.FRONT_R=p.FORWARD;var m=new p,y=new p;r.default.fastDefine("cc.Vec3",p,{x:0,y:0,z:0}),cc.v3=function(t,e,i){return new p(t,e,i)},cc.Vec3=p,e.exports=i.default}),{"../platform/CCClass":209,"../utils/misc":294,"./utils":316,"./value-type":317,"./vec2":318}],320:[(function(t,e,i){"use strict";i.__esModule=!0,i.v4=p,i.default=void 0;var n=a(t("../platform/CCClass")),r=a(t("./value-type")),s=t("./utils");function a(t){return t&&t.__esModule?t:{default:t}}function o(t,e){for(var i=0;i0&&(i=1/Math.sqrt(i),t.x=c*i,t.y=u*i,t.z=_*i,t.w=f*i),t},i.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},i.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},i.random=function(t,e){e=e||1;var i=2*(0,s.random)()*Math.PI,n=2*(0,s.random)()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},i.transformMat4=function(t,e,i){c=e.x,u=e.y,_=e.z,f=e.w;var n=i.m;return t.x=n[0]*c+n[4]*u+n[8]*_+n[12]*f,t.y=n[1]*c+n[5]*u+n[9]*_+n[13]*f,t.z=n[2]*c+n[6]*u+n[10]*_+n[14]*f,t.w=n[3]*c+n[7]*u+n[11]*_+n[15]*f,t},i.transformAffine=function(t,e,i){c=e.x,u=e.y,_=e.z,f=e.w;var n=i.m;return t.x=n[0]*c+n[1]*u+n[2]*_+n[3]*f,t.y=n[4]*c+n[5]*u+n[6]*_+n[7]*f,t.x=n[8]*c+n[9]*u+n[10]*_+n[11]*f,t.w=e.w,t},i.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z;c=i.x,u=i.y,_=i.z;var a=(f=i.w)*n+u*s-_*r,o=f*r+_*n-c*s,l=f*s+c*r-u*n,h=-c*n-u*r-_*s;return t.x=a*f+h*-c+o*-_-l*-u,t.y=o*f+h*-u+l*-c-a*-_,t.z=l*f+h*-_+a*-u-o*-c,t.w=e.w,t},i.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},i.equals=function(t,e,i){return void 0===i&&(i=s.EPSILON),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},i.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},i.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},l(i,null,[{key:"ZERO",get:function(){return new i(0,0,0,0)}},{key:"ONE",get:function(){return new i(1,1,1,1)}},{key:"NEG_ONE",get:function(){return new i(-1,-1,-1,-1)}}]),e.clone=function(){return new i(this.x,this.y,this.z,this.w)},e.set=function(t,e,i,n){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},e.equals=function(t,e){return void 0===e&&(e=s.EPSILON),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},e.equals4f=function(t,e,i,n,r){return void 0===r&&(r=s.EPSILON),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},e.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},e.lerp=function(t,e){return c=this.x,u=this.y,_=this.z,f=this.w,this.x=c+e*(t.x-c),this.y=u+e*(t.y-u),this.z=_+e*(t.z-_),this.w=f+e*(t.w-f),this},e.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},e.clampf=function(t,e){return this.x=(0,s.clamp)(this.x,t.x,e.x),this.y=(0,s.clamp)(this.y,t.y,e.y),this.z=(0,s.clamp)(this.z,t.z,e.z),this.w=(0,s.clamp)(this.w,t.w,e.w),this},e.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},e.add=function(t,e){return(e=e||new i).x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e.w=this.w+t.w,e},e.subtract=function(t,e){return(e=e||new i).x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z,e.w=this.w-t.w,e},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.divide=function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.cross=function(t,e){e=e||new i;var n=this.x,r=this.y,s=this.z,a=t.x,o=t.y,l=t.z;return e.x=r*l-s*o,e.y=s*a-n*l,e.z=n*o-r*a,e},e.len=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},e.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},e.normalizeSelf=function(){return this.normalize(this),this},e.normalize=function(t){t=t||new i,c=this.x,u=this.y,_=this.z,f=this.w;var e=c*c+u*u+_*_+f*f;return e>0&&(e=1/Math.sqrt(e),t.x=c*e,t.y=u*e,t.z=_*e,t.w=f*e),t},e.transformMat4=function(t,e){e=e||new i,c=this.x,u=this.y,_=this.z,f=this.w;var n=t.m;return e.x=n[0]*c+n[4]*u+n[8]*_+n[12]*f,e.y=n[1]*c+n[5]*u+n[9]*_+n[13]*f,e.z=n[2]*c+n[6]*u+n[10]*_+n[14]*f,e.w=n[3]*c+n[7]*u+n[11]*_+n[15]*f,e},e.maxAxis=function(){return Math.max(this.x,this.y,this.z,this.w)},i})(r.default);function p(t,e,i,n){return new d(t,e,i,n)}i.default=d,d.sub=d.subtract,d.mul=d.multiply,d.div=d.divide,d.scale=d.multiplyScalar,d.mag=d.len,d.squaredMagnitude=d.lengthSqr,d.ZERO_R=d.ZERO,d.ONE_R=d.ONE,d.NEG_ONE_R=d.NEG_ONE,n.default.fastDefine("cc.Vec4",d,{x:0,y:0,z:0,w:0}),cc.v4=p,cc.Vec4=d}),{"../platform/CCClass":209,"./utils":316,"./value-type":317}],321:[(function(t,e,i){"use strict";cc.js}),{}],322:[(function(t,e,i){"use strict";t("./core/CCGame"),t("./actions")}),{"./actions":7,"./core/CCGame":50}],323:[(function(t,e,i){"use strict";var n=t("../compression/zlib.min"),r=t("../core/CCDebug"),s=function(t){var e,i,n,s,a,o,l,h,c,u,_,f,d;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},a=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join("")){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":a&&this.animation.frames.push(a),this.pos+=4,a={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),n=this.readUInt16()||100,a.delay=1e3*s/n,a.disposeOp=this.data[this.pos++],a.blendOp=this.data[this.pos++],a.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=a?a.data:void 0)||this.imgData,_=0;0<=e?_e;0<=e?++_:--_)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(f=0;0<=c?fc;0<=c?++f:--f)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":o=(u=this.read(e)).indexOf(0),l=String.fromCharCode.apply(String,u.slice(0,o)),this.text[l]=String.fromCharCode.apply(String,u.slice(o+1));break;case"IEND":return a&&this.animation.frames.push(a),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(d=this.colorType)||6===d,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error(r.getError(6017))}};s.prototype={constructor:s,read:function(t){var e,i;for(i=[],e=0;0<=t?et;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},readUInt32:function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},readUInt16:function(){return this.data[this.pos++]<<8|this.data[this.pos++]},decodePixels:function(t){var e,i,s,a,o,l,h,c,u,_,f,d,p,m,y,v,g,A,x,b,C,T,S;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=new n.Inflate(t,{index:0,verify:!1}).decompress(),v=(d=this.pixelBitlength/8)*this.width,p=new Uint8Array(v*this.height),l=t.length,y=0,m=0,i=0;m8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?n.ImageFormat.PNG:t.length>2&&(73===t[0]&&73===t[1]||77===t[0]&&77===t[1]||255===t[0]&&216===t[1])?n.ImageFormat.TIFF:n.ImageFormat.UNKNOWN}var f=cc.Enum({GRAVITY:0,RADIUS:1}),d=cc.Enum({FREE:0,RELATIVE:1,GROUPED:2}),p={preview:{default:!0,editorOnly:!0,notify:!1,animatable:!1,tooltip:!1},_custom:!1,custom:{get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile())},animatable:!1,tooltip:!1},_file:{default:null,type:r},file:{get:function(){return this._file},set:function(t,e){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)},animatable:!1,type:r,tooltip:!1},_spriteFrame:{default:null,type:cc.SpriteFrame},spriteFrame:{get:function(){return this._spriteFrame},set:function(t,e){var i=this._renderSpriteFrame;i!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),(i&&i.getTexture())!==(t&&t.getTexture())&&this._applySpriteFrame(i))},type:cc.SpriteFrame,tooltip:!1},_texture:{default:null,type:cc.Texture2D,editorOnly:!0},texture:{get:function(){return this._getTexture()},set:function(t){t&&cc.warnID(6017)},type:cc.Texture2D,tooltip:!1,readonly:!0,visible:!1,animatable:!1},particleCount:{visible:!1,get:function(){return this._simulator.particles.length},readonly:!0},_stopped:!0,stopped:{get:function(){return this._stopped},animatable:!1,visible:!1},playOnLoad:!0,autoRemoveOnFinish:{default:!1,animatable:!1,tooltip:!1},active:{get:function(){return this._simulator.active},visible:!1},totalParticles:150,duration:-1,emissionRate:10,life:1,lifeVar:0,_startColor:null,startColor:{type:cc.Color,get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},_startColorVar:null,startColorVar:{type:cc.Color,get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},_endColor:null,endColor:{type:cc.Color,get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},_endColorVar:null,endColorVar:{type:cc.Color,get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},angle:90,angleVar:20,startSize:50,startSizeVar:0,endSize:0,endSizeVar:0,startSpin:0,startSpinVar:0,endSpin:0,endSpinVar:0,sourcePos:cc.Vec2.ZERO,posVar:cc.Vec2.ZERO,_positionType:{default:d.FREE,formerlySerializedAs:"positionType"},positionType:{type:d,get:function(){return this._positionType},set:function(t){this._positionType=t,this._updateMaterial()}},emitterMode:{default:f.GRAVITY,type:f},gravity:cc.Vec2.ZERO,speed:180,speedVar:50,tangentialAccel:80,tangentialAccelVar:0,radialAccel:0,radialAccelVar:0,rotationIsDir:!1,startRadius:0,startRadiusVar:0,endRadius:0,endRadiusVar:0,rotatePerS:0,rotatePerSVar:0},m=cc.Class({name:"cc.ParticleSystem",extends:s,mixins:[u],editor:!1,ctor:function(){this.initProperties()},initProperties:function(){this._previewTimer=null,this._focused=!1,this._aspectRatio=1,this._simulator=new c(this),this._startColor=cc.color(255,255,255,255),this._startColorVar=cc.color(0,0,0,0),this._endColor=cc.color(255,255,255,0),this._endColorVar=cc.color(0,0,0,0),this._renderSpriteFrame=null},properties:p,statics:{DURATION_INFINITY:-1,START_SIZE_EQUAL_TO_END_SIZE:-1,START_RADIUS_EQUAL_TO_END_RADIUS:-1,EmitterMode:f,PositionType:d,_PNGReader:o,_TIFFReader:l},onFocusInEditor:!1,onLostFocusInEditor:!1,_startPreview:!1,_stopPreview:!1,_convertTextureToSpriteFrame:!1,__preload:function(){if(this._super(),this._custom&&this.spriteFrame&&!this._renderSpriteFrame)this._applySpriteFrame(this.spriteFrame);else if(this._file){if(this._custom)!this._getTexture()&&this._applyFile();else this._applyFile()}this.playOnLoad&&this.resetSystem()},onDestroy:function(){this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._buffer&&(this._buffer.destroy(),this._buffer=null),this._simulator._uvFilled=0,this._super()},lateUpdate:function(t){this._simulator.finished||this._simulator.step(t)},addParticle:function(){},stopSystem:function(){this._stopped=!0,this._simulator.stop()},resetSystem:function(){this._stopped=!1,this._simulator.reset(),this.markForRender(!0)},isFull:function(){return this.particleCount>=this.totalParticles},setTextureWithRect:function(t,e){t instanceof cc.Texture2D&&(this.spriteFrame=new cc.SpriteFrame(t,e))},_applyFile:function(){var t=this._file;if(t){var e=this;cc.loader.load(t.nativeUrl,(function(i,n){!i&&n?e.isValid&&(e._plistFile=t.nativeUrl,e._custom||e._initWithDictionary(n),e._spriteFrame?!e._renderSpriteFrame&&e._spriteFrame&&e._applySpriteFrame(e.spriteFrame):t.spriteFrame?e.spriteFrame=t.spriteFrame:e._custom&&e._initTextureWithDictionary(n)):cc.errorID(6029)}))}},_initTextureWithDictionary:function(t){var e=cc.path.changeBasename(this._plistFile,t.textureFileName||"");if(t.textureFileName)h.loadImage(e,(function(e,i){e?(t.textureFileName=void 0,this._initTextureWithDictionary(t)):this.spriteFrame=new cc.SpriteFrame(i)}),this);else if(t.textureImageData){var i=t.textureImageData;if(!(i&&i.length>0))return!1;var r=cc.loader.getRes(e);if(!r){var s=a.unzipBase64AsArray(i,1);if(!s)return cc.logID(6030),!1;var c=_(s);if(c!==n.ImageFormat.TIFF&&c!==n.ImageFormat.PNG)return cc.logID(6031),!1;var u=document.createElement("canvas");if(c===n.ImageFormat.PNG)new o(s).render(u);else l.parseTIFF(s,u);r=h.cacheImage(e,u)}r||cc.logID(6032),this.spriteFrame=new cc.SpriteFrame(r)}return!0},_initWithDictionary:function(t){this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this.srcBlendFactor=parseInt(t.blendFuncSource||n.SRC_ALPHA),this.dstBlendFactor=parseInt(t.blendFuncDestination||n.ONE_MINUS_SRC_ALPHA);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var r=this._startColorVar;r.r=255*parseFloat(t.startColorVarianceRed||0),r.g=255*parseFloat(t.startColorVarianceGreen||0),r.b=255*parseFloat(t.startColorVarianceBlue||0),r.a=255*parseFloat(t.startColorVarianceAlpha||0);var s=this._endColor;s.r=255*parseFloat(t.finishColorRed||0),s.g=255*parseFloat(t.finishColorGreen||0),s.b=255*parseFloat(t.finishColorBlue||0),s.a=255*parseFloat(t.finishColorAlpha||0);var a=this._endColorVar;if(a.r=255*parseFloat(t.finishColorVarianceRed||0),a.g=255*parseFloat(t.finishColorVarianceGreen||0),a.b=255*parseFloat(t.finishColorVarianceBlue||0),a.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(void 0!==t.positionType?t.positionType:d.RELATIVE),this.sourcePos.x=0,this.sourcePos.y=0,this.posVar.x=parseFloat(t.sourcePositionVariancex||0),this.posVar.y=parseFloat(t.sourcePositionVariancey||0),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||f.GRAVITY),this.emitterMode===f.GRAVITY){this.gravity.x=parseFloat(t.gravityx||0),this.gravity.y=parseFloat(t.gravityy||0),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var o=t.rotationIsDir||"";null!==o?(o=o.toString().toLowerCase(),this.rotationIsDir="true"===o||"1"===o):this.rotationIsDir=!1}else{if(this.emitterMode!==f.RADIUS)return cc.warnID(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},_validateRender:function(){var t=this._getTexture();t&&t.loaded?this._super():this.disableRender()},_onTextureLoaded:function(){this._simulator.updateUVs(!0),this._syncAspect(),this._updateMaterial(),this.markForRender(!0)},_syncAspect:function(){var t=this._renderSpriteFrame._rect;this._aspectRatio=t.width/t.height},_applySpriteFrame:function(){this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame,this._renderSpriteFrame&&(this._renderSpriteFrame.textureLoaded()?this._onTextureLoaded():this._renderSpriteFrame.onTextureLoaded(this._onTextureLoaded,this))},_getTexture:function(){return this._renderSpriteFrame&&this._renderSpriteFrame.getTexture()||this._texture},_updateMaterial:function(){var t=this.getMaterial(0);t&&(t.define("CC_USE_MODEL",this._positionType!==d.FREE),t.setProperty("texture",this._getTexture()),u.prototype._updateMaterial.call(this))},_finishedSimulation:function(){this.resetSystem(),this.stopSystem(),this.disableRender(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()}});cc.ParticleSystem=e.exports=m}),{"../compression/ZipUtils":22,"../core/assets/material/CCMaterial":74,"../core/components/CCRenderComponent":110,"../core/platform/CCMacro":214,"../core/renderer/render-flow":242,"../core/utils/blend-func":287,"../core/utils/texture-util":302,"./CCPNGReader":323,"./CCParticleAsset":324,"./CCTIFFReader":326,"./particle-simulator":328,"fire-url":void 0}],326:[(function(t,e,i){"use strict";var n=t("../core/CCDebug"),r={_littleEndian:!1,_tiffData:null,_fileDirectories:[],getUint8:function(t){return this._tiffData[t]},getUint16:function(t){return this._littleEndian?this._tiffData[t+1]<<8|this._tiffData[t]:this._tiffData[t]<<8|this._tiffData[t+1]},getUint32:function(t){var e=this._tiffData;return this._littleEndian?e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]:e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},checkLittleEndian:function(){var t=this.getUint16(0);if(18761===t)this.littleEndian=!0;else{if(19789!==t)throw console.log(t),TypeError(n.getError(6019));this.littleEndian=!1}return this.littleEndian},hasTowel:function(){if(42!==this.getUint16(2))throw RangeError(n.getError(6020));return!0},getFieldTypeName:function(t){var e=this.fieldTypeNames;return t in e?e[t]:null},getFieldTagName:function(t){var e=this.fieldTagNames;return t in e?e[t]:(cc.logID(6021,t),"Tag"+t)},getFieldTypeLength:function(t){return-1!==["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(t)?1:-1!==["SHORT","SSHORT"].indexOf(t)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(t)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(t)?8:null},getFieldValues:function(t,e,i,n){var r=[],s=this.getFieldTypeLength(e);if(s*i<=4)!1===this.littleEndian?r.push(n>>>8*(4-s)):r.push(n);else for(var a=0;a=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+o)),r.push(this.getUint32(n+o+4))):cc.logID(8e3):r.push(this.getBytes(s,n+o))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},getBytes:function(t,e){if(t<=0)cc.logID(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);cc.logID(8002)}},getBits:function(t,e,i){i=i||0;var n,r,s=e+Math.floor(i/8),a=i+t,o=32-t;return a<=0?cc.logID(6023):a<=8?(n=24+i,r=this.getUint8(s)):a<=16?(n=16+i,r=this.getUint16(s)):a<=32?(n=i,r=this.getUint32(s)):cc.logID(6022),{bits:r<>>o,byteOffset:s+Math.floor(a/8),bitOffset:a%8}},parseFileDirectory:function(t){for(var e=this.getUint16(t),i=[],n=t+2,r=0;r=0&&R<=127?I=R+1:R>=-127&&R<=-1?P=1-R:C=!0}else{var O=this.getUint8(v+A);for(M=0;M0)for(var nt=0;nt1?c=h/u:h=c*u;var _=h/2,f=c/2;if(t.rotation){var d=-_,p=-f,m=_,y=f,v=-s.degreesToRadians(t.rotation),g=Math.cos(v),A=Math.sin(v);r[n]=d*g-p*A+o,r[n+1]=d*A+p*g+l,r[n+5]=m*g-p*A+o,r[n+6]=m*A+p*g+l,r[n+10]=d*g-y*A+o,r[n+11]=d*A+y*g+l,r[n+15]=m*g-y*A+o,r[n+16]=m*A+y*g+l}else r[n]=o-_,r[n+1]=l-f,r[n+5]=o+_,r[n+6]=l-f,r[n+10]=o-_,r[n+11]=l+f,r[n+15]=o+_,r[n+16]=l+f;a[n+4]=t.color._val,a[n+9]=t.color._val,a[n+14]=t.color._val,a[n+19]=t.color._val},d.prototype.step=function(t){t=t>cc.director._maxParticleDeltaTime?cc.director._maxParticleDeltaTime:t;var e=this.sys,i=e.node,r=this.particles,_=4*this.sys._assembler._vfmt._bytes/4;if(i._updateWorldMatrix(),o=n.identity(),e.positionType===cc.ParticleSystem.PositionType.FREE){var d=i._worldMatrix.m;o.tx=d[12],o.ty=d[13],n.transformVec2(l,a,o)}else if(e.positionType===cc.ParticleSystem.PositionType.RELATIVE){var p=s.degreesToRadians(-i.angle),m=Math.cos(p),y=Math.sin(p);o=n.create(m,-y,y,m,0,0),l.x=i.x,l.y=i.y}n.invert(o,o);var v=o;if(this.active&&e.emissionRate){var g=1/e.emissionRate;for(r.lengthg;)this.emitParticle(l),this.emitCounter-=g;this.elapsed+=t,-1!==e.duration&&e.durationthis._uvFilled&&this.updateUVs();for(var b=0;b0){if(e.emitterMode===cc.ParticleSystem.EmitterMode.GRAVITY){var T=u,S=h,w=c;(C.pos.x||C.pos.y)&&(S.set(C.pos),S.normalizeSelf()),w.set(S),S.mulSelf(C.radialAccel);var E=w.x;w.x=-w.y,w.y=E,w.mulSelf(C.tangentialAccel),T.set(S),T.addSelf(w),T.addSelf(e.gravity),T.mulSelf(t),C.dir.addSelf(T),T.set(C.dir),T.mulSelf(t),C.pos.addSelf(T)}else C.angle+=C.degreesPerSecond*t,C.radius+=C.deltaRadius*t,C.pos.x=-Math.cos(C.angle)*C.radius,C.pos.y=-Math.sin(C.angle)*C.radius;C.color.r+=C.deltaColor.r*t,C.color.g+=C.deltaColor.g*t,C.color.b+=C.deltaColor.b*t,C.color.a+=C.deltaColor.a*t,C.size+=C.deltaSize*t,C.size<0&&(C.size=0),C.rotation+=C.deltaRotation*t;var M=h,D=c;if(e.positionType===cc.ParticleSystem.PositionType.FREE)D.set(C.startPos),D.negSelf(),M.set(C.pos),M.subSelf(D);else if(e.positionType===cc.ParticleSystem.PositionType.RELATIVE){var B=u;n.transformVec2(D,l,v),n.transformVec2(B,C.startPos,v),D.subSelf(B),M.set(C.pos),M.subSelf(D)}else M.set(C.pos);var I=_*b;this.updateParticleBuffer(C,M,A,I),++b}else{var P=r[b];b!==r.length-1&&(r[b]=r[r.length-1]),f.put(P),r.length--}}r.length>0?(A.uploadData(),e._assembler._ia._count=6*r.length):this.active||this.readyToPlay||(this.finished=!0,e._finishedSimulation())},e.exports=d}),{"../core/platform/js":229,"../core/utils/affine-transform":284,"../core/utils/misc":294}],329:[(function(t,e,i){"use strict";var n=s(t("../core/renderer/assembler")),r=s(t("../renderer/core/input-assembler"));function s(t){return t&&t.__esModule?t:{default:t}}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=t("./CCParticleSystem"),l=t("../core/renderer/"),h=t("../core/renderer/webgl/quad-buffer"),c=t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,u=(function(t){function e(e){var i;return(i=t.call(this,e)||this)._buffer=null,i._ia=null,i._vfmt=c,i}a(e,t);var i=e.prototype;return i.getBuffer=function(){return this._buffer||(this._buffer=new h(l._handle,c),this._ia=new r.default,this._ia._vertexBuffer=this._buffer._vb,this._ia._indexBuffer=this._buffer._ib,this._ia._start=0,this._ia._count=0),this._buffer},i.fillBuffers=function(t,e){this._ia&&(e.node=t.node,e.material=t._materials[0],e._flushIA(this._ia))},e})(n.default);n.default.register(o,u),e.exports=u}),{"../core/renderer/":241,"../core/renderer/assembler":238,"../core/renderer/webgl/quad-buffer":279,"../core/renderer/webgl/vertex-format":282,"../renderer/core/input-assembler":332,"./CCParticleSystem":325}],330:[(function(t,e,i){"use strict";var n,r,s,a=512,o=513,l=514,h=515,c=516,u=517,_=518,f=519,d=32774,p=32778,m=32779,y=0,v=1,g=768,A=769,x=774,b=775,C=770,T=771,S=772,w=773,E=32769,M=32770,D=32771,B=32772,I=776,P=7680,R=7681,O=7682,L=34055,F=7683,V=34056,N=5386,k=0,G=1028,z=1029;(function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL"})(n||(n={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BUFFER=1]="BUFFER",t[t.TEXTURE=2]="TEXTURE",t[t.TEXTURE_VIEW=3]="TEXTURE_VIEW",t[t.RENDER_PASS=4]="RENDER_PASS",t[t.FRAMEBUFFER=5]="FRAMEBUFFER",t[t.SAMPLER=6]="SAMPLER",t[t.SHADER=7]="SHADER",t[t.PIPELINE_LAYOUT=8]="PIPELINE_LAYOUT",t[t.PIPELINE_STATE=9]="PIPELINE_STATE",t[t.BINDING_LAYOUT=10]="BINDING_LAYOUT",t[t.INPUT_ASSEMBLER=11]="INPUT_ASSEMBLER",t[t.COMMAND_ALLOCATOR=12]="COMMAND_ALLOCATOR",t[t.COMMAND_BUFFER=13]="COMMAND_BUFFER",t[t.QUEUE=14]="QUEUE",t[t.WINDOW=15]="WINDOW"})(r||(r={})),(function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"})(s||(s={}));var U,H,W,j,X,Y,q,J,Z,K,Q,$,tt,et,it,nt,rt,st,at,ot,lt,ht,ct,ut,_t,ft,dt,pt,mt,yt,vt,gt,At,xt,bt;(function(){function t(t){this._gfxType=r.UNKNOWN,this._status=s.UNREADY,this._gfxType=t}Object.defineProperty(t.prototype,"gfxType",{get:function(){return this._gfxType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0})})();(function(t){t.ATTR_POSITION="a_position",t.ATTR_NORMAL="a_normal",t.ATTR_TANGENT="a_tangent",t.ATTR_BITANGENT="a_bitangent",t.ATTR_WEIGHTS="a_weights",t.ATTR_JOINTS="a_joints",t.ATTR_COLOR="a_color",t.ATTR_COLOR1="a_color1",t.ATTR_COLOR2="a_color2",t.ATTR_TEX_COORD="a_texCoord",t.ATTR_TEX_COORD1="a_texCoord1",t.ATTR_TEX_COORD2="a_texCoord2",t.ATTR_TEX_COORD3="a_texCoord3",t.ATTR_TEX_COORD4="a_texCoord4",t.ATTR_TEX_COORD5="a_texCoord5",t.ATTR_TEX_COORD6="a_texCoord6",t.ATTR_TEX_COORD7="a_texCoord7",t.ATTR_TEX_COORD8="a_texCoord8"})(U||(U={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BOOL=1]="BOOL",t[t.BOOL2=2]="BOOL2",t[t.BOOL3=3]="BOOL3",t[t.BOOL4=4]="BOOL4",t[t.INT=5]="INT",t[t.INT2=6]="INT2",t[t.INT3=7]="INT3",t[t.INT4=8]="INT4",t[t.UINT=9]="UINT",t[t.UINT2=10]="UINT2",t[t.UINT3=11]="UINT3",t[t.UINT4=12]="UINT4",t[t.FLOAT=13]="FLOAT",t[t.FLOAT2=14]="FLOAT2",t[t.FLOAT3=15]="FLOAT3",t[t.FLOAT4=16]="FLOAT4",t[t.COLOR4=17]="COLOR4",t[t.MAT2=18]="MAT2",t[t.MAT2X3=19]="MAT2X3",t[t.MAT2X4=20]="MAT2X4",t[t.MAT3X2=21]="MAT3X2",t[t.MAT3=22]="MAT3",t[t.MAT3X4=23]="MAT3X4",t[t.MAT4X2=24]="MAT4X2",t[t.MAT4X3=25]="MAT4X3",t[t.MAT4=26]="MAT4",t[t.SAMPLER1D=27]="SAMPLER1D",t[t.SAMPLER1D_ARRAY=28]="SAMPLER1D_ARRAY",t[t.SAMPLER2D=29]="SAMPLER2D",t[t.SAMPLER2D_ARRAY=30]="SAMPLER2D_ARRAY",t[t.SAMPLER3D=31]="SAMPLER3D",t[t.SAMPLER_CUBE=32]="SAMPLER_CUBE",t[t.COUNT=33]="COUNT"})(H||(H={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A8=1]="A8",t[t.L8=2]="L8",t[t.LA8=3]="LA8",t[t.R8=4]="R8",t[t.R8SN=5]="R8SN",t[t.R8UI=6]="R8UI",t[t.R8I=7]="R8I",t[t.R16F=8]="R16F",t[t.R16UI=9]="R16UI",t[t.R16I=10]="R16I",t[t.R32F=11]="R32F",t[t.R32UI=12]="R32UI",t[t.R32I=13]="R32I",t[t.RG8=14]="RG8",t[t.RG8SN=15]="RG8SN",t[t.RG8UI=16]="RG8UI",t[t.RG8I=17]="RG8I",t[t.RG16F=18]="RG16F",t[t.RG16UI=19]="RG16UI",t[t.RG16I=20]="RG16I",t[t.RG32F=21]="RG32F",t[t.RG32UI=22]="RG32UI",t[t.RG32I=23]="RG32I",t[t.RGB8=24]="RGB8",t[t.SRGB8=25]="SRGB8",t[t.RGB8SN=26]="RGB8SN",t[t.RGB8UI=27]="RGB8UI",t[t.RGB8I=28]="RGB8I",t[t.RGB16F=29]="RGB16F",t[t.RGB16UI=30]="RGB16UI",t[t.RGB16I=31]="RGB16I",t[t.RGB32F=32]="RGB32F",t[t.RGB32UI=33]="RGB32UI",t[t.RGB32I=34]="RGB32I",t[t.RGBA8=35]="RGBA8",t[t.SRGB8_A8=36]="SRGB8_A8",t[t.RGBA8SN=37]="RGBA8SN",t[t.RGBA8UI=38]="RGBA8UI",t[t.RGBA8I=39]="RGBA8I",t[t.RGBA16F=40]="RGBA16F",t[t.RGBA16UI=41]="RGBA16UI",t[t.RGBA16I=42]="RGBA16I",t[t.RGBA32F=43]="RGBA32F",t[t.RGBA32UI=44]="RGBA32UI",t[t.RGBA32I=45]="RGBA32I",t[t.R5G6B5=46]="R5G6B5",t[t.R11G11B10F=47]="R11G11B10F",t[t.RGB5A1=48]="RGB5A1",t[t.RGBA4=49]="RGBA4",t[t.RGB10A2=50]="RGB10A2",t[t.RGB10A2UI=51]="RGB10A2UI",t[t.RGB9E5=52]="RGB9E5",t[t.D16=53]="D16",t[t.D16S8=54]="D16S8",t[t.D24=55]="D24",t[t.D24S8=56]="D24S8",t[t.D32F=57]="D32F",t[t.D32F_S8=58]="D32F_S8",t[t.BC1=59]="BC1",t[t.BC1_ALPHA=60]="BC1_ALPHA",t[t.BC1_SRGB=61]="BC1_SRGB",t[t.BC1_SRGB_ALPHA=62]="BC1_SRGB_ALPHA",t[t.BC2=63]="BC2",t[t.BC2_SRGB=64]="BC2_SRGB",t[t.BC3=65]="BC3",t[t.BC3_SRGB=66]="BC3_SRGB",t[t.BC4=67]="BC4",t[t.BC4_SNORM=68]="BC4_SNORM",t[t.BC5=69]="BC5",t[t.BC5_SNORM=70]="BC5_SNORM",t[t.BC6H_UF16=71]="BC6H_UF16",t[t.BC6H_SF16=72]="BC6H_SF16",t[t.BC7=73]="BC7",t[t.BC7_SRGB=74]="BC7_SRGB",t[t.ETC_RGB8=75]="ETC_RGB8",t[t.ETC2_RGB8=76]="ETC2_RGB8",t[t.ETC2_SRGB8=77]="ETC2_SRGB8",t[t.ETC2_RGB8_A1=78]="ETC2_RGB8_A1",t[t.ETC2_SRGB8_A1=79]="ETC2_SRGB8_A1",t[t.ETC2_RGBA8=80]="ETC2_RGBA8",t[t.ETC2_SRGB8_A8=81]="ETC2_SRGB8_A8",t[t.EAC_R11=82]="EAC_R11",t[t.EAC_R11SN=83]="EAC_R11SN",t[t.EAC_RG11=84]="EAC_RG11",t[t.EAC_RG11SN=85]="EAC_RG11SN",t[t.PVRTC_RGB2=86]="PVRTC_RGB2",t[t.PVRTC_RGBA2=87]="PVRTC_RGBA2",t[t.PVRTC_RGB4=88]="PVRTC_RGB4",t[t.PVRTC_RGBA4=89]="PVRTC_RGBA4",t[t.PVRTC2_2BPP=90]="PVRTC2_2BPP",t[t.PVRTC2_4BPP=91]="PVRTC2_4BPP"})(W||(W={})),(function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.INDEX=4]="INDEX",t[t.VERTEX=8]="VERTEX",t[t.UNIFORM=16]="UNIFORM",t[t.STORAGE=32]="STORAGE",t[t.INDIRECT=64]="INDIRECT"})(j||(j={})),(function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"})(X||(X={})),(function(t){t[t.NONE=0]="NONE",t[t.READ=1]="READ",t[t.WRITE=2]="WRITE"})(Y||(Y={})),(function(t){t[t.POINT_LIST=0]="POINT_LIST",t[t.LINE_LIST=1]="LINE_LIST",t[t.LINE_STRIP=2]="LINE_STRIP",t[t.LINE_LOOP=3]="LINE_LOOP",t[t.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",t[t.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",t[t.ISO_LINE_LIST=6]="ISO_LINE_LIST",t[t.TRIANGLE_LIST=7]="TRIANGLE_LIST",t[t.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=9]="TRIANGLE_FAN",t[t.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",t[t.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",t[t.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",t[t.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"})(q||(q={})),(function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"})(J||(J={})),(function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"})(Z||(Z={})),(function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"})(K||(K={})),(function(t){t[t.NEVER=0]="NEVER",t[t.LESS=1]="LESS",t[t.EQUAL=2]="EQUAL",t[t.LESS_EQUAL=3]="LESS_EQUAL",t[t.GREATER=4]="GREATER",t[t.NOT_EQUAL=5]="NOT_EQUAL",t[t.GREATER_EQUAL=6]="GREATER_EQUAL",t[t.ALWAYS=7]="ALWAYS"})(Q||(Q={})),(function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=1]="KEEP",t[t.REPLACE=2]="REPLACE",t[t.INCR=3]="INCR",t[t.DECR=4]="DECR",t[t.INVERT=5]="INVERT",t[t.INCR_WRAP=6]="INCR_WRAP",t[t.DECR_WRAP=7]="DECR_WRAP"})($||($={})),(function(t){t[t.ADD=0]="ADD",t[t.SUB=1]="SUB",t[t.REV_SUB=2]="REV_SUB",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"})(tt||(tt={})),(function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=2]="SRC_ALPHA",t[t.DST_ALPHA=3]="DST_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",t[t.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",t[t.SRC_COLOR=6]="SRC_COLOR",t[t.DST_COLOR=7]="DST_COLOR",t[t.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",t[t.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=11]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"})(et||(et={})),(function(t){t[t.NONE=0]="NONE",t[t.R=1]="R",t[t.G=2]="G",t[t.B=4]="B",t[t.A=8]="A",t[t.ALL=15]="ALL"})(it||(it={})),(function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"})(nt||(nt={})),(function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"})(rt||(rt={})),(function(t){t[t.TEX1D=0]="TEX1D",t[t.TEX2D=1]="TEX2D",t[t.TEX3D=2]="TEX3D"})(st||(st={})),(function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.TRANSIENT_ATTACHMENT=64]="TRANSIENT_ATTACHMENT",t[t.INPUT_ATTACHMENT=128]="INPUT_ATTACHMENT"})(at||(at={})),(function(t){t[t.X1=0]="X1",t[t.X2=1]="X2",t[t.X4=2]="X4",t[t.X8=3]="X8",t[t.X16=4]="X16",t[t.X32=5]="X32",t[t.X64=6]="X64"})(ot||(ot={})),(function(t){t[t.NONE=0]="NONE",t[t.GEN_MIPMAP=1]="GEN_MIPMAP",t[t.CUBEMAP=2]="CUBEMAP",t[t.BAKUP_BUFFER=4]="BAKUP_BUFFER"})(lt||(lt={})),(function(t){t[t.TV1D=0]="TV1D",t[t.TV2D=1]="TV2D",t[t.TV3D=2]="TV3D",t[t.CUBE=3]="CUBE",t[t.TV1D_ARRAY=4]="TV1D_ARRAY",t[t.TV2D_ARRAY=5]="TV2D_ARRAY"})(ht||(ht={})),(function(t){t[t.VERTEX=0]="VERTEX",t[t.HULL=1]="HULL",t[t.DOMAIN=2]="DOMAIN",t[t.GEOMETRY=3]="GEOMETRY",t[t.FRAGMENT=4]="FRAGMENT",t[t.COMPUTE=5]="COMPUTE",t[t.COUNT=6]="COUNT"})(ct||(ct={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",t[t.SAMPLER=2]="SAMPLER",t[t.STORAGE_BUFFER=3]="STORAGE_BUFFER"})(ut||(ut={})),(function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"})(_t||(_t={})),(function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"})(ft||(ft={})),(function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"})(dt||(dt={})),(function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.GENERAL=1]="GENERAL",t[t.COLOR_ATTACHMENT_OPTIMAL=2]="COLOR_ATTACHMENT_OPTIMAL",t[t.DEPTH_STENCIL_ATTACHMENT_OPTIMAL=3]="DEPTH_STENCIL_ATTACHMENT_OPTIMAL",t[t.DEPTH_STENCIL_READONLY_OPTIMAL=4]="DEPTH_STENCIL_READONLY_OPTIMAL",t[t.SHADER_READONLY_OPTIMAL=5]="SHADER_READONLY_OPTIMAL",t[t.TRANSFER_SRC_OPTIMAL=6]="TRANSFER_SRC_OPTIMAL",t[t.TRANSFER_DST_OPTIMAL=7]="TRANSFER_DST_OPTIMAL",t[t.PREINITIALIZED=8]="PREINITIALIZED",t[t.PRESENT_SRC=9]="PRESENT_SRC"})(pt||(pt={})),(function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"})(mt||(mt={})),(function(t){t[t.VIEWPORT=0]="VIEWPORT",t[t.SCISSOR=1]="SCISSOR",t[t.LINE_WIDTH=2]="LINE_WIDTH",t[t.DEPTH_BIAS=3]="DEPTH_BIAS",t[t.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",t[t.DEPTH_BOUNDS=5]="DEPTH_BOUNDS",t[t.STENCIL_WRITE_MASK=6]="STENCIL_WRITE_MASK",t[t.STENCIL_COMPARE_MASK=7]="STENCIL_COMPARE_MASK"})(yt||(yt={})),(function(t){t[t.FRONT=0]="FRONT",t[t.BACK=1]="BACK",t[t.ALL=2]="ALL"})(vt||(vt={})),(function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"})(gt||(gt={})),(function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL",t[t.DEPTH_STENCIL=6]="DEPTH_STENCIL",t[t.ALL=7]="ALL"})(At||(At={})),(function(t){t[t.DEFAULT=100]="DEFAULT"})(xt||(xt={})),(function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"})(bt||(bt={}));var Ct,Tt,St,wt;(function(t){t[t.UBO_GLOBAL=23]="UBO_GLOBAL",t[t.UBO_SHADOW=22]="UBO_SHADOW",t[t.UBO_LOCAL=21]="UBO_LOCAL",t[t.UBO_FORWARD_LIGHTS=20]="UBO_FORWARD_LIGHTS",t[t.UBO_SKINNING=19]="UBO_SKINNING",t[t.UBO_SKINNING_TEXTURE=18]="UBO_SKINNING_TEXTURE",t[t.UBO_UI=17]="UBO_UI",t[t.SAMPLER_JOINTS=25]="SAMPLER_JOINTS",t[t.SAMPLER_ENVIRONMENT=26]="SAMPLER_ENVIRONMENT",t[t.CUSTUM_UBO_BINDING_END_POINT=17]="CUSTUM_UBO_BINDING_END_POINT",t[t.CUSTOM_SAMPLER_BINDING_START_POINT=30]="CUSTOM_SAMPLER_BINDING_START_POINT"})(Ct||(Ct={})),(function(t){t[t.minFilter=0]="minFilter",t[t.magFilter=1]="magFilter",t[t.mipFilter=2]="mipFilter",t[t.addressU=3]="addressU",t[t.addressV=4]="addressV",t[t.addressW=5]="addressW",t[t.maxAnisotropy=6]="maxAnisotropy",t[t.cmpFunc=7]="cmpFunc",t[t.minLOD=8]="minLOD",t[t.maxLOD=9]="maxLOD",t[t.mipLODBias=10]="mipLODBias",t[t.borderColor=11]="borderColor",t[t.total=15]="total"})(wt||(wt={}));var Et={};Et[Et.bool=H.BOOL]="bool",Et[Et.int=H.INT]="int",Et[Et.ivec2=H.INT2]="ivec2invTypeParams",Et[Et.ivec3=H.INT3]="ivec3",Et[Et.ivec4=H.INT4]="ivec4",Et[Et.float=H.FLOAT]="float",Et[Et.vec2=H.FLOAT2]="vec2",Et[Et.vec3=H.FLOAT3]="vec3",Et[Et.vec4=H.FLOAT4]="vec4",Et[Et.mat2=H.MAT2]="mat2",Et[Et.mat3=H.MAT3]="mat3",Et[Et.mat4=H.MAT4]="mat4",Et[Et.sampler2D=H.SAMPLER2D]="sampler2D",Et[Et.samplerCube=H.SAMPLER_CUBE]="samplerCube";var Mt=((Tt={})[H.BOOL]=4,Tt[H.INT]=4,Tt[H.INT2]=8,Tt[H.INT3]=12,Tt[H.INT4]=16,Tt[H.FLOAT]=4,Tt[H.FLOAT2]=8,Tt[H.FLOAT3]=12,Tt[H.FLOAT4]=16,Tt[H.MAT2]=16,Tt[H.MAT3]=36,Tt[H.MAT4]=64,Tt[H.SAMPLER2D]=4,Tt[H.SAMPLER_CUBE]=4,Tt),Dt=((St={})[H.BOOL]=W.R32I,St[H.INT]=W.R32I,St[H.INT2]=W.RG32I,St[H.INT3]=W.RGB32I,St[H.INT4]=W.RGBA32I,St[H.FLOAT]=W.R32F,St[H.FLOAT2]=W.RG32F,St[H.FLOAT3]=W.RGB32F,St[H.FLOAT4]=W.RGBA32F,St),Bt={BACK:z,FRONT:G,NONE:k,ADD:d,SUB:p,REV_SUB:m,ZERO:y,ONE:v,SRC_COLOR:g,ONE_MINUS_SRC_COLOR:A,DST_COLOR:x,ONE_MINUS_DST_COLOR:b,SRC_ALPHA:C,ONE_MINUS_SRC_ALPHA:T,DST_ALPHA:S,ONE_MINUS_DST_ALPHA:w,CONSTANT_COLOR:E,ONE_MINUS_CONSTANT_COLOR:M,CONSTANT_ALPHA:D,ONE_MINUS_CONSTANT_ALPHA:B,SRC_ALPHA_SATURATE:I,NEVER:a,LESS:o,EQUAL:l,LEQUAL:h,GREATER:c,NOTEQUAL:u,GEQUAL:_,ALWAYS:f,KEEP:P,REPLACE:R,INCR:O,INCR_WRAP:L,DECR:F,DECR_WRAP:V,INVERT:N};Object.assign(Bt,xt);var It={murmurhash2_32_gc:function(t,e){for(var i,n=t.length,r=e^n,s=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:r^=(255&t.charCodeAt(s+2))<<16;case 2:r^=(255&t.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0},SamplerInfoIndex:wt,effectStructure:{$techniques:[{$passes:[{depthStencilState:{},rasterizerState:{},blendState:{targets:[{}]},properties:{any:{sampler:{},inspector:{}}}}]}]},typeMap:Et,sizeMap:Mt,formatMap:Dt,passParams:Bt,RenderQueue:{OPAQUE:0,TRANSPARENT:1,OVERLAY:2},RenderPriority:bt,GFXGetTypeSize:function(t){switch(t){case H.BOOL:case H.INT:case H.UINT:case H.FLOAT:return 4;case H.BOOL2:case H.INT2:case H.UINT2:case H.FLOAT2:return 8;case H.BOOL3:case H.INT3:case H.UINT3:case H.FLOAT3:return 12;case H.BOOL4:case H.INT4:case H.UINT4:case H.FLOAT4:case H.MAT2:return 16;case H.MAT2X3:return 24;case H.MAT2X4:return 32;case H.MAT3X2:return 24;case H.MAT3:return 36;case H.MAT3X4:return 48;case H.MAT4X2:case H.MAT4X2:return 32;case H.MAT4:return 64;case H.SAMPLER1D:case H.SAMPLER1D_ARRAY:case H.SAMPLER2D:case H.SAMPLER2D_ARRAY:case H.SAMPLER3D:case H.SAMPLER_CUBE:return 4;default:return 0}},UniformBinding:Ct};e.exports=It}),{}],331:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../memop"),r=h(t("../enums")),s=t("../../core/value-types"),a=h(t("./program-lib")),o=h(t("./view")),l=h(t("../gfx"));function h(t){return t&&t.__esModule?t:{default:t}}var c=new s.Mat4,u=new n.RecyclePool(function(){return{stage:null,items:null}},8),_=new n.RecyclePool(function(){return new Float32Array(2)},8),f=new n.RecyclePool(function(){return new Float32Array(3)},8),d=new n.RecyclePool(function(){return new Float32Array(4)},8),p=new n.RecyclePool(function(){return new Float32Array(9)},8),m=new n.RecyclePool(function(){return new Float32Array(16)},8),y=new n.RecyclePool(function(){return new Float32Array(64)},8),v=new n.RecyclePool(function(){return new Int32Array(2)},8),g=new n.RecyclePool(function(){return new Int32Array(3)},8),A=new n.RecyclePool(function(){return new Int32Array(4)},8),x=new n.RecyclePool(function(){return new Int32Array(64)},8),b=(function(){function t(t,e){var i;this._device=t,this._programLib=new a.default(t),this._opts=e,this._type2defaultValue=((i={})[r.default.PARAM_INT]=0,i[r.default.PARAM_INT2]=new s.Vec2(0,0),i[r.default.PARAM_INT3]=new s.Vec3(0,0,0),i[r.default.PARAM_INT4]=new s.Vec4(0,0,0,0),i[r.default.PARAM_FLOAT]=0,i[r.default.PARAM_FLOAT2]=new s.Vec2(0,0),i[r.default.PARAM_FLOAT3]=new s.Vec3(0,0,0),i[r.default.PARAM_FLOAT4]=new s.Vec4(0,0,0,0),i[r.default.PARAM_COLOR4]=new s.Color(0,0,0,1),i[r.default.PARAM_MAT3]=new s.Mat3,i[r.default.PARAM_MAT4]=new s.Mat4,i[r.default.PARAM_TEXTURE_2D]=e.defaultTexture,i[r.default.PARAM_TEXTURE_CUBE]=e.defaultTextureCube,i),this._stage2fn={},this._usedTextureUnits=0,this._viewPools=new n.RecyclePool(function(){return new o.default},8),this._drawItemsPools=new n.RecyclePool(function(){return{model:null,node:null,ia:null,effect:null,defines:null,uniforms:null}},100),this._stageItemsPools=new n.RecyclePool(function(){return new n.RecyclePool(function(){return{model:null,node:null,ia:null,effect:null,defines:null,passes:[],sortKey:-1,uniforms:null}},100)},16)}var e=t.prototype;return e._resetTextuerUnit=function(){this._usedTextureUnits=0},e._allocTextureUnit=function(){var t=this._device,e=this._usedTextureUnits;return e>=t._caps.maxTextureUnits&&console.warn("Trying to use "+e+" texture units while this GPU supports only "+t._caps.maxTextureUnits),this._usedTextureUnits+=1,e},e._registerStage=function(t,e){this._stage2fn[t]=e},e.clear=function(){this._programLib.clear(),this.reset()},e.reset=function(){this._viewPools.reset(),this._stageItemsPools.reset()},e._requestView=function(){return this._viewPools.add()},e._render=function(t,e){var i=this._device;i.setFrameBuffer(t._framebuffer),i.setViewport(t._rect.x,t._rect.y,t._rect.w,t._rect.h);var n={};t._clearFlags&r.default.CLEAR_COLOR&&(n.color=s.Vec4.toArray([],t._color)),t._clearFlags&r.default.CLEAR_DEPTH&&(n.depth=t._depth),t._clearFlags&r.default.CLEAR_STENCIL&&(n.stencil=t._stencil),i.clear(n),this._drawItemsPools.reset();for(var a=0;at.count)return void console.error("Failed to set property ["+t.name+"] : The length of texture array ["+i.length+"] is bigger than ["+t.count+"].");for(var n=x.add(),s=0;s0&&n&&n.precision>0}e||cc.warnID(9102),this._highpSupported=e},t})();i.default=h,e.exports=i.default}),{"../gfx":342}],335:[(function(t,e,i){"use strict";function n(t,e){for(var i=0;i>24)/255,(i.blendColor>>16&255)/255,(i.blendColor>>8&255)/255,(255&i.blendColor)/255),void(i.blendSep?(t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(t.blendFunc(i.blendSrc,i.blendDst),t.blendEquation(i.blendEq)))):void t.disable(t.BLEND);!1!==i.blend&&(e.blendColor!==i.blendColor&&t.blendColor((i.blendColor>>24)/255,(i.blendColor>>16&255)/255,(i.blendColor>>8&255)/255,(255&i.blendColor)/255),e.blendSep===i.blendSep?i.blendSep?(e.blendSrc===i.blendSrc&&e.blendDst===i.blendDst&&e.blendSrcAlpha===i.blendSrcAlpha&&e.blendDstAlpha===i.blendDstAlpha||t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),e.blendEq===i.blendEq&&e.blendAlphaEq===i.blendAlphaEq||t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(e.blendSrc===i.blendSrc&&e.blendDst===i.blendDst||t.blendFunc(i.blendSrc,i.blendDst),e.blendEq!==i.blendEq&&t.blendEquation(i.blendEq)):i.blendSep?(t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(t.blendFunc(i.blendSrc,i.blendDst),t.blendEquation(i.blendEq)))}function p(t,e,i){if(e.depthTest!==i.depthTest)return i.depthTest?(t.enable(t.DEPTH_TEST),t.depthFunc(i.depthFunc),void t.depthMask(i.depthWrite)):void t.disable(t.DEPTH_TEST);e.depthWrite!==i.depthWrite&&t.depthMask(i.depthWrite),!1!==i.depthTest?e.depthFunc!==i.depthFunc&&t.depthFunc(i.depthFunc):i.depthWrite&&(i.depthTest=!0,i.depthFunc=a.enums.DS_FUNC_ALWAYS,t.enable(t.DEPTH_TEST),t.depthFunc(i.depthFunc))}function m(t,e,i){if(i.stencilTest!==a.enums.STENCIL_INHERIT)return i.stencilTest!==e.stencilTest?i.stencilTest===a.enums.STENCIL_DISABLE?void t.disable(t.STENCIL_TEST):(t.enable(t.STENCIL_TEST),void(i.stencilSep?(t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMask(i.stencilWriteMaskFront),t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront)))):void(i.stencilTest!==a.enums.STENCIL_DISABLE&&(e.stencilSep===i.stencilSep?i.stencilSep?(e.stencilFuncFront===i.stencilFuncFront&&e.stencilRefFront===i.stencilRefFront&&e.stencilMaskFront===i.stencilMaskFront||t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),e.stencilWriteMaskFront!==i.stencilWriteMaskFront&&t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),e.stencilFailOpFront===i.stencilFailOpFront&&e.stencilZFailOpFront===i.stencilZFailOpFront&&e.stencilZPassOpFront===i.stencilZPassOpFront||t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),e.stencilFuncBack===i.stencilFuncBack&&e.stencilRefBack===i.stencilRefBack&&e.stencilMaskBack===i.stencilMaskBack||t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),e.stencilWriteMaskBack!==i.stencilWriteMaskBack&&t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),e.stencilFailOpBack===i.stencilFailOpBack&&e.stencilZFailOpBack===i.stencilZFailOpBack&&e.stencilZPassOpBack===i.stencilZPassOpBack||t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(e.stencilFuncFront===i.stencilFuncFront&&e.stencilRefFront===i.stencilRefFront&&e.stencilMaskFront===i.stencilMaskFront||t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),e.stencilWriteMaskFront!==i.stencilWriteMaskFront&&t.stencilMask(i.stencilWriteMaskFront),e.stencilFailOpFront===i.stencilFailOpFront&&e.stencilZFailOpFront===i.stencilZFailOpFront&&e.stencilZPassOpFront===i.stencilZPassOpFront||t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront)):i.stencilSep?(t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMask(i.stencilWriteMaskFront),t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront))))}function y(t,e,i){e.cullMode!==i.cullMode&&(i.cullMode!==a.enums.CULL_NONE?(t.enable(t.CULL_FACE),t.cullFace(i.cullMode)):t.disable(t.CULL_FACE))}function v(t,e,i,n){var r=!1;if(-1!==n.maxStream){if(i.maxStream!==n.maxStream)r=!0;else if(i.program!==n.program)r=!0;else for(var s=0;s>>0},e.setBlendFunc=function(t,e){this._next.blendSep=!1,this._next.blendSrc=t,this._next.blendDst=e},e.setBlendFuncSep=function(t,e,i,n){this._next.blendSep=!0,this._next.blendSrc=t,this._next.blendDst=e,this._next.blendSrcAlpha=i,this._next.blendDstAlpha=n},e.setBlendEq=function(t){this._next.blendSep=!1,this._next.blendEq=t},e.setBlendEqSep=function(t,e){this._next.blendSep=!0,this._next.blendEq=t,this._next.blendAlphaEq=e},e.setCullMode=function(t){this._next.cullMode=t},e.setVertexBuffer=function(t,e,i){void 0===i&&(i=0),this._next.vertexBuffers[t]=e,this._next.vertexBufferOffsets[t]=i,this._next.maxStream=this._caps.maxTextureUnits?console.warn("Can not set texture "+t+" at stage "+i+", max texture exceed: "+this._caps.maxTextureUnits):(this._next.textureUnits[i]=e,this.setUniform(t,i),this._next.maxTextureSlot=this._caps.maxTextureUnits)console.warn("Can not set "+n+" textures for "+t+", max texture exceed: "+this._caps.maxTextureUnits);else{for(var r=0;rthis._bytes){if(t)return void console.error("Failed to update data, bytes exceed.");this._needExpandDataStore=!0,this._bytes=t+e.byteLength,this._numIndices=this._bytes/this._bytesPerIndex}var i=this._device._gl,n=this._usage;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._glID),this._needExpandDataStore?(i.bufferData(i.ELEMENT_ARRAY_BUFFER,e,n),this._needExpandDataStore=!1):i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,t,e),this._device._restoreIndexBuffer()}}else console.error("The buffer is destroyed")},e.setUsage=function(t){this._usage=t},a(t,[{key:"count",get:function(){return this._numIndices}}]),t})();l.BYTES_PER_INDEX=o;var h=l;i.default=h,e.exports=i.default}),{"./enums":339}],342:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./enums"),r=null;r={VertexFormat:t("./vertex-format"),IndexBuffer:t("./index-buffer"),VertexBuffer:t("./vertex-buffer"),Program:t("./program"),Texture:t("./texture"),Texture2D:t("./texture-2d"),TextureCube:t("./texture-cube"),RenderBuffer:t("./render-buffer"),FrameBuffer:t("./frame-buffer"),Device:t("./device"),attrTypeBytes:n.attrTypeBytes,glFilter:n.glFilter,glTextureFmt:n.glTextureFmt},Object.assign(r,n.enums);var s=r;i.default=s,cc.gfx=r,e.exports=i.default}),{"./device":338,"./enums":339,"./frame-buffer":340,"./index-buffer":341,"./program":344,"./render-buffer":345,"./texture":349,"./texture-2d":347,"./texture-cube":348,"./vertex-buffer":350,"./vertex-format":351}],343:[(function(t,e,i){"use strict";i.__esModule=!0,i.isPow2=function(t){return!(t&t-1||!t)}}),{}],344:[(function(t,e,i){"use strict";function n(t,e){for(var i=0;i0&&t.push({type:e,fileID:-1,line:0,message:i})}}))}var o=(function(){function t(t,e){this._device=t,this._attributes=[],this._uniforms=[],this._samplers=[],this._errors=[],this._linked=!1,this._vertSource=e.vert,this._fragSource=e.frag,this._glID=null,this._id=s++}var e=t.prototype;return e.link=function(){if(!this._linked){var t=this._device._gl,e=l(t,t.VERTEX_SHADER,this._vertSource),i=l(t,t.FRAGMENT_SHADER,this._fragSource),n=t.createProgram();t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n);var r=!1,s=this._errors;if(t.getShaderParameter(e,t.COMPILE_STATUS)||(a(s,"vs",t.getShaderInfoLog(e)),r=!0),t.getShaderParameter(i,t.COMPILE_STATUS)||(a(s,"fs",t.getShaderInfoLog(i)),r=!0),t.deleteShader(e),t.deleteShader(i),r)return s;if(!t.getProgramParameter(n,t.LINK_STATUS))return s.push({info:"Failed to link shader program: "+t.getProgramInfoLog(n)}),s;this._glID=n;for(var o=t.getProgramParameter(n,t.ACTIVE_ATTRIBUTES),h=0;h=r.enums.TEXTURE_FMT_RGB_DXT1&&this._format<=r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1||this._format>=r.enums.TEXTURE_FMT_RGB_ETC2&&this._format<=r.enums.TEXTURE_FMT_RGBA_ETC2),void 0!==t.genMipmaps&&(this._genMipmap=t.genMipmaps,i=t.genMipmaps);var n=this._device.caps.maxTextureSize||Number.MAX_VALUE,a=Math.max(t.width||0,t.height||0);if(n1)i=!1,(t.width>t.height?t.width:t.height)>>t.images.length-1!=1&&console.error("texture-2d mipmap is invalid, should have a 1x1 mipmap.")}(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height)||(i=!1),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),void 0!==t.images&&t.images.length>0&&(this._setMipmap(t.images,t.flipY,t.premultiplyAlpha),t.images.length>1&&(this._genMipmap=!0)),i&&(e.hint(e.GENERATE_MIPMAP_HINT,e.NICEST),e.generateMipmap(e.TEXTURE_2D),this._genMipmap=!0),this._setTexInfo(),this._device._restoreTexture(0)},i.updateSubImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),this._setSubImage(i,t),this._device._restoreTexture(0)},i.updateImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),this._setImage(i,t),this._device._restoreTexture(0)},i._setSubImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.image;!s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer?(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this._compressed?i.compressedTexSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,e.width,e.height,t.format,s):i.texSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,e.width,e.height,t.format,t.pixelType,s)):(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),i.texSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,t.format,t.pixelType,s))},i._setImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.image;!s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer?(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this._compressed?i.compressedTexImage2D(i.TEXTURE_2D,e.level,t.internalFormat,e.width,e.height,0,s):i.texImage2D(i.TEXTURE_2D,e.level,t.internalFormat,e.width,e.height,0,t.format,t.pixelType,s)):(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),i.texImage2D(i.TEXTURE_2D,e.level,t.internalFormat,t.format,t.pixelType,s))},i._setMipmap=function(t,e,i){for(var n=(0,r.glTextureFmt)(this._format),s={width:this._width,height:this._height,flipY:e,premultiplyAlpha:i,level:0,image:null},a=0;a>a,s.height=this._height>>a,s.image=t[a],this._setImage(n,s)},i._setTexInfo=function(){var t=this._device._gl,e=(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height);e||this._wrapS===r.enums.WRAP_CLAMP&&this._wrapT===r.enums.WRAP_CLAMP||(console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"),this._wrapS=r.enums.WRAP_CLAMP,this._wrapT=r.enums.WRAP_CLAMP);var i=this._genMipmap?this._mipFilter:-1;e||-1===i||(console.warn("NPOT textures do not support mipmap filter"),i=-1),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,(0,r.glFilter)(t,this._minFilter,i)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,(0,r.glFilter)(t,this._magFilter,-1)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT);var n=this._device.ext("EXT_texture_filter_anisotropic");n&&t.texParameteri(t.TEXTURE_2D,n.TEXTURE_MAX_ANISOTROPY_EXT,this._anisotropy)},e})(n.default);i.default=o,e.exports=i.default}),{"./enums":339,"./misc":343,"./texture":349}],348:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./texture")),r=t("./enums"),s=t("./misc");function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var o=(function(t){function e(e,i){var n,r=(n=t.call(this,e)||this)._device._gl;return n._target=r.TEXTURE_CUBE_MAP,n._glID=r.createTexture(),n.update(i),n}a(e,t);var i=e.prototype;return i.update=function(t){var e=this._device._gl,i=this._genMipmaps;t&&(void 0!==t.width&&(this._width=t.width),void 0!==t.height&&(this._height=t.height),void 0!==t.anisotropy&&(this._anisotropy=t.anisotropy),void 0!==t.minFilter&&(this._minFilter=t.minFilter),void 0!==t.magFilter&&(this._magFilter=t.magFilter),void 0!==t.mipFilter&&(this._mipFilter=t.mipFilter),void 0!==t.wrapS&&(this._wrapS=t.wrapS),void 0!==t.wrapT&&(this._wrapT=t.wrapT),void 0!==t.format&&(this._format=t.format,this._compressed=this._format>=r.enums.TEXTURE_FMT_RGB_DXT1&&this._format<=r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1||this._format>=r.enums.TEXTURE_FMT_RGB_ETC2&&this._format<=r.enums.TEXTURE_FMT_RGBA_ETC2),void 0!==t.genMipmaps&&(this._genMipmaps=t.genMipmaps,i=t.genMipmaps),void 0!==t.images&&t.images.length>1&&(i=!1,t.width!==t.height&&console.warn("texture-cube width and height should be identical."),t.width>>t.images.length-1!=1&&console.error("texture-cube mipmap is invalid. please set mipmap as 1x1, 2x2, 4x4 ... nxn"))),(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height)||(i=!1),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),void 0!==t.images&&t.images.length>0&&(this._setMipmap(t.images,t.flipY,t.premultiplyAlpha),t.images.length>1&&(this._genMipmaps=!0)),i&&(e.hint(e.GENERATE_MIPMAP_HINT,e.NICEST),e.generateMipmap(e.TEXTURE_CUBE_MAP),this._genMipmaps=!0),this._setTexInfo(),this._device._restoreTexture(0)},i.updateSubImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),this._setSubImage(i,t),this._device._restoreTexture(0)},i.updateImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),this._setImage(i,t),this._device._restoreTexture(0)},i._setSubImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.faceIndex,a=e.image;void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),!a||ArrayBuffer.isView(a)||a instanceof ArrayBuffer?this._compressed?i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,e.width,e.height,t.format,a):i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,e.width,e.height,t.format,t.pixelType,a):i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,t.format,t.pixelType,a)},i._setImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.faceIndex,a=e.image;void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),!a||ArrayBuffer.isView(a)||a instanceof ArrayBuffer?this._compressed?i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,e.width,e.height,0,a):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,e.width,e.height,0,t.format,t.pixelType,a):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,t.format,t.pixelType,a)},i._setMipmap=function(t,e,i){for(var n=(0,r.glTextureFmt)(this._format),s={width:this._width,height:this._height,faceIndex:0,flipY:e,premultiplyAlpha:i,level:0,image:null},a=0;a>a,s.height=this._height>>a;for(var l=0;l<6;++l)s.faceIndex=l,s.image=o[l],this._setImage(n,s)}},i._setTexInfo=function(){var t=this._device._gl,e=(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height);e||this._wrapS===r.enums.WRAP_CLAMP&&this._wrapT===r.enums.WRAP_CLAMP||(console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"),this._wrapS=r.enums.WRAP_CLAMP,this._wrapT=r.enums.WRAP_CLAMP);var i=this._genMipmaps?this._mipFilter:-1;e||-1===i||(console.warn("NPOT textures do not support mipmap filter"),i=-1),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,(0,r.glFilter)(t,this._minFilter,i)),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,(0,r.glFilter)(t,this._magFilter,-1)),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,this._wrapT);var n=this._device.ext("EXT_texture_filter_anisotropic");n&&t.texParameteri(t.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this._anisotropy)},e})(n.default);i.default=o,e.exports=i.default}),{"./enums":339,"./misc":343,"./texture":349}],349:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./enums"),r=0,s=(function(){function t(t){this._device=t,this._width=4,this._height=4,this._genMipmaps=!1,this._compressed=!1,this._anisotropy=1,this._minFilter=n.enums.FILTER_LINEAR,this._magFilter=n.enums.FILTER_LINEAR,this._mipFilter=n.enums.FILTER_LINEAR,this._wrapS=n.enums.WRAP_REPEAT,this._wrapT=n.enums.WRAP_REPEAT,this._format=n.enums.TEXTURE_FMT_RGBA8,this._target=-1,this._id=r++}return t.prototype.destroy=function(){null!==this._glID?(this._device._gl.deleteTexture(this._glID),this._device._stats.tex-=this.bytes,this._glID=null):console.error("The texture already destroyed")},t})();i.default=s,e.exports=i.default}),{"./enums":339}],350:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;t("./enums");function n(t,e){for(var i=0;ithis._bytes){if(t)return void console.error("Failed to update data, bytes exceed.");this._needExpandDataStore=!0,this._bytes=t+e.byteLength,this._numVertices=this._bytes/this._bytesPerVertex}var i=this._device._gl,n=this._usage;i.bindBuffer(i.ARRAY_BUFFER,this._glID),this._needExpandDataStore?(i.bufferData(i.ARRAY_BUFFER,e,n),this._needExpandDataStore=!1):i.bufferSubData(i.ARRAY_BUFFER,t,e),i.bindBuffer(i.ARRAY_BUFFER,null)}}else console.error("The buffer is destroyed")},e.getFormat=function(t){return this._format.element(t)},e.setUsage=function(t){this._usage=t},r(t,[{key:"count",get:function(){return this._numVertices}}]),t})();i.default=s,e.exports=i.default}),{"./enums":339}],351:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./enums"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("../murmurhash2_gc"));var s=(function(){function t(t){this._attr2el={},this._elements=[],this._bytes=0;for(var e="",i=0,s=t.length;ithis._data.length)for(var e=this._data.length;e=this._data.length&&this._resize(2*this._data.length),this._data[this._count]=t,++this._count},e.pop=function(){--this._count,this._count<0&&(this._count=0);var t=this._data[this._count];return this._data[this._count]=void 0,t},e.fastRemove=function(t){if(!(t>=this._count||t<0)){var e=this._count-1;this._data[t]=this._data[e],this._data[e]=void 0,this._count-=1}},e.indexOf=function(t){return this._data.indexOf(t)},e.sort=function(t){return(0,n.default)(this._data,0,this._count,t)},s(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t})();i.default=a,e.exports=i.default}),{"./timsort":358}],354:[(function(t,e,i){"use strict";i.__esModule=!0,i.TypedArrayPool=i.RecyclePool=i.Pool=i.LinkedArray=i.FixedArray=i.CircularPool=void 0;var n=h(t("./circular-pool"));i.CircularPool=n.default;var r=h(t("./fixed-array"));i.FixedArray=r.default;var s=h(t("./linked-array"));i.LinkedArray=s.default;var a=h(t("./pool"));i.Pool=a.default;var o=h(t("./recycle-pool"));i.RecyclePool=o.default;var l=h(t("./typed-array-pool"));function h(t){return t&&t.__esModule?t:{default:t}}i.TypedArrayPool=l.default}),{"./circular-pool":352,"./fixed-array":353,"./linked-array":355,"./pool":356,"./recycle-pool":357,"./typed-array-pool":359}],355:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./pool"));function r(t,e){for(var i=0;ithis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(2*this._data.length),this._data[this._count++]},e.remove=function(t){if(!(t>=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},e.sort=function(t){return(0,n.default)(this._data,0,this._count,t)},s(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t})();i.default=a,cc.RecyclePool=a,e.exports=i.default}),{"./timsort":358}],358:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=function(t,e,i,r){if(!Array.isArray(t))throw new TypeError("Can only sort arrays");void 0===e&&(e=0);void 0===i&&(i=t.length);void 0===r&&(r=l);var s=i-e;if(s<2)return;var a=0;if(su&&(f=u),_(t,e,e+f,e+a,r),a=f}o.pushRun(e,a),o.mergeRuns(),s-=a,e+=a}while(0!==s);o.forceMergeRuns()};var n=32,r=7,s=256,a=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function o(t){return t<1e5?t<100?t<10?0:1:t<1e4?t<1e3?2:3:4:t<1e7?t<1e6?5:6:t<1e9?t<1e8?7:8:9}function l(t,e){if(t===e)return 0;if(~~t===t&&~~e===e){if(0===t||0===e)return t=0)return-1;if(t>=0)return 1;t=-t,e=-e}var i=o(t),n=o(e),r=0;return in&&(e*=a[i-n-1],t/=10,r=1),t===e?r:t=n;)e|=1&t,t>>=1;return t+e}function c(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function u(t,e,i){for(i--;e>>1;r(s,t[l])<0?o=l:a=l+1}var h=n-a;switch(h){case 3:t[a+3]=t[a+2];case 2:t[a+2]=t[a+1];case 1:t[a+1]=t[a];break;default:for(;h>0;)t[a+h]=t[a+h-1],h--}t[a]=s}}function f(t,e,i,n,r,s){var a=0,o=0,l=1;if(s(t,e[i+r])>0){for(o=n-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=o);l>o&&(l=o),a+=r,l+=r}else{for(o=r+1;lo&&(l=o);var h=a;a=r-l,l=r-h}for(a++;a>>1);s(t,e[i+c])>0?a=c+1:l=c}return l}function d(t,e,i,n,r,s){var a=0,o=0,l=1;if(s(t,e[i+r])<0){for(o=r+1;lo&&(l=o);var h=a;a=r-l,l=r-h}else{for(o=n-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=o);l>o&&(l=o),a+=r,l+=r}for(a++;a>>1);s(t,e[i+c])<0?l=c:a=c+1}return l}var p=(function(){function t(t,e){this.array=t,this.compare=e,this.minGallop=r,this.length=t.length,this.tmpStorageLength=s,this.length<2*s&&(this.tmpStorageLength=this.length>>>1),this.tmp=new Array(this.tmpStorageLength),this.stackLength=this.length<120?5:this.length<1542?10:this.length<119151?19:40,this.runStart=new Array(this.stackLength),this.runLength=new Array(this.stackLength),this.stackSize=0}var e=t.prototype;return e.pushRun=function(t,e){this.runStart[this.stackSize]=t,this.runLength[this.stackSize]=e,this.stackSize+=1},e.mergeRuns=function(){for(;this.stackSize>1;){var t=this.stackSize-2;if(t>=1&&this.runLength[t-1]<=this.runLength[t]+this.runLength[t+1]||t>=2&&this.runLength[t-2]<=this.runLength[t]+this.runLength[t-1])this.runLength[t-1]this.runLength[t+1])break;this.mergeAt(t)}},e.forceMergeRuns=function(){for(;this.stackSize>1;){var t=this.stackSize-2;t>0&&this.runLength[t-1]=r||m>=r);if(y)break;_<0&&(_=0),_+=2}if(this.minGallop=_,_<1&&(this.minGallop=1),1===e){for(l=0;l=0;l--)a[p+l]=a[_+l];if(0===e){g=!0;break}}if(a[u--]=o[c--],1==--n){g=!0;break}if(0!==(v=n-f(a[h],o,0,n,n-1,s))){for(n-=v,p=(u-=v)+1,_=(c-=v)+1,l=0;l=r||v>=r);if(g)break;m<0&&(m=0),m+=2}if(this.minGallop=m,m<1&&(this.minGallop=1),1===n){for(p=(u-=e)+1,_=(h-=e)+1,l=e-1;l>=0;l--)a[p+l]=a[_+l];a[u]=o[c]}else{if(0===n)throw new Error("mergeHigh preconditions were not respected");for(_=u-(n-1),l=0;l=0;l--)a[p+l]=a[_+l];a[u]=o[c]}else for(_=u-(n-1),l=0;l65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function o(t){var e=s(t),i=n[a(e)>>2];return i.length>0?i.pop():new ArrayBuffer(e)}function l(t){n[a(t.byteLength)>>2].push(t)}var h={alloc_int8:function(t){var e=new Int8Array(o(t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint8:function(t){var e=new Uint8Array(o(t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_int16:function(t){var e=new Int16Array(o(2*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint16:function(t){var e=new Uint16Array(o(2*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_int32:function(t){var e=new Int32Array(o(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint32:function(t){var e=new Uint32Array(o(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_float32:function(t){var e=new Float32Array(o(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_float64:function(t){var e=new Float64Array(o(8*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_dataview:function(t){var e=new DataView(o(t),0,t);return e.length!==t?e.subarray(0,t):e},free:function(t){l(t.buffer)},reset:function(){for(var t=Array(8),e=0;e<8;++e)t[e]=[]}};i.default=h,e.exports=i.default}),{}],360:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=function(t,e){var i,n=t.length,r=e^n,s=0;for(;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:r^=(255&t.charCodeAt(s+2))<<16;case 2:r^=(255&t.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0},e.exports=i.default}),{}],361:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../../core/value-types"),r=o(t("../core/base-renderer")),s=o(t("../enums")),a=t("../memop");function o(t){return t&&t.__esModule?t:{default:t}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var c=new Float32Array(16),u=new Float32Array(16),_=new Float32Array(16),f=new Float32Array(16),d=new Float32Array(4),p=new Float32Array(64),m=[],y=new Float32Array(4),v=new n.Vec4(0,0,0,0),g=new n.Vec3(0,0,0),A=new n.Vec3(0,0,0),x=new a.RecyclePool(function(){return new Float32Array(16)},8),b=(function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._time=new Float32Array(4),n._lights=[],n._shadowLights=[],n._numLights=0,n._defines={},n._registerStage("shadowcast",n._shadowStage.bind(l(n))),n._registerStage("opaque",n._opaqueStage.bind(l(n))),n._registerStage("transparent",n._transparentStage.bind(l(n))),n}h(e,t);var i=e.prototype;return i.reset=function(){x.reset(),t.prototype.reset.call(this)},i.render=function(t,e){this.reset(),this._time[0]+=e,this._device.setUniform("cc_time",this._time),this._updateLights(t);for(var i=this._device._gl.canvas,n=0;n0){for(var e=x.add(),i=x.add(),n=x.add(),r=Math.min(4,this._lights.length),a=0;a1,C=x[0],T=C.getAttribute("source");T.replace(/\\/g,"/");var S=y.getElementsByTagName("tile"),w=S&&S.length||1,E=null,M=y.getAttribute("name")||"",D=parseInt(y.getAttribute("spacing"))||0,B=parseInt(y.getAttribute("margin"))||0,I=parseInt(e);I||(I=parseInt(y.getAttribute("firstgid"))||0);var P=cc.size(0,0);P.width=parseFloat(y.getAttribute("tilewidth")),P.height=parseFloat(y.getAttribute("tileheight"));var R=y.getElementsByTagName("tileoffset")[0],O=cc.v2(0,0);R&&(O.x=parseFloat(R.getAttribute("x")),O.y=parseFloat(R.getAttribute("y")));for(var L=null,F=0;F0){var N=(C=V[0]).getAttribute("source");N.replace(/\\/g,"/"),L.sourceImage=this._textures[N],L.sourceImage||cc.errorID(7221,N);var k=cc.size(0,0);k.width=parseFloat(C.getAttribute("width")),k.height=parseFloat(C.getAttribute("height")),L._tileSize=k,L.firstGid=this.parentGID}this._tileProperties[this.parentGID]=c(E);var G=E.getElementsByTagName("animation");if(G&&G.length>0){var z=G[0].getElementsByTagName("frame"),U={frames:[],dt:0,frameIdx:0};this._tileAnimations[this.parentGID]=U;for(var H=U.frames,W=0;W0){var m=p[0];f.type=cc.TiledMap.TMXObjectType.TEXT,f.wrap="1"==m.getAttribute("wrap"),f.color=h(m.getAttribute("color")),f.halign=o(m.getAttribute("halign")),f.valign=l(m.getAttribute("valign")),f.pixelsize=parseInt(m.getAttribute("pixelsize"))||16,f.text=m.childNodes[0].nodeValue}var y=_.getAttribute("gid");y&&(f.gid=parseInt(y),f.type=cc.TiledMap.TMXObjectType.IMAGE);var v=_.getElementsByTagName("ellipse");v&&v.length>0&&(f.type=cc.TiledMap.TMXObjectType.ELLIPSE);var g=_.getElementsByTagName("polygon");if(g&&g.length>0){f.type=cc.TiledMap.TMXObjectType.POLYGON;var A=g[0].getAttribute("points");A&&(f.points=this._parsePointsString(A))}var x=_.getElementsByTagName("polyline");if(x&&x.length>0){f.type=cc.TiledMap.TMXObjectType.POLYLINE;var b=x[0].getAttribute("points");b&&(f.polylinePoints=this._parsePointsString(b))}f.type||(f.type=cc.TiledMap.TMXObjectType.RECT),e._objects.push(f)}"index"!==s&&e._objects.sort((function(t,e){return t.y-e.y}))}return e},_parsePointsString:function(t){if(!t)return null;for(var e=[],i=t.split(" "),n=0;nthis._rightTop.row&&(t.row=this._rightTop.row),i<0&&(t.col=0),i>this._rightTop.col&&(t.col=this._rightTop.col)},_addUserNodeToGrid:function(t,e){var i=e.row,n=e.col,r=this._userNodeGrid[i]=this._userNodeGrid[i]||{count:0},s=r[n]=r[n]||{count:0,list:[]};t._row=i,t._col=n,t._index=s.list.length,r.count++,s.count++,s.list.push(t),this._userNodeDirty=!0},_isUserNodeDirty:function(){return this._userNodeDirty},_setUserNodeDirty:function(t){this._userNodeDirty=t},onEnable:function(){this._super(),this.node.on(cc.Node.EventType.ANCHOR_CHANGED,this._syncAnchorPoint,this),this._activateMaterial()},onDisable:function(){this._super(),this.node.off(cc.Node.EventType.ANCHOR_CHANGED,this._syncAnchorPoint,this)},_syncAnchorPoint:function(){var t=this.node;this._leftDownToCenterX=t.width*t.anchorX*t.scaleX,this._leftDownToCenterY=t.height*t.anchorY*t.scaleY,this._cullingDirty=!0},onDestroy:function(){this._super(),this._buffer&&(this._buffer.destroy(),this._buffer=null),this._renderDataList=null},getLayerName:function(){return this._layerName},setLayerName:function(t){this._layerName=t},getProperty:function(t){return this._properties[t]},getPositionAt:function(t,e){var i,n;switch(void 0!==e?(i=Math.floor(t),e=Math.floor(e)):(i=Math.floor(t.x),e=Math.floor(t.y)),this._layerOrientation){case cc.TiledMap.Orientation.ORTHO:n=this._positionForOrthoAt(i,e);break;case cc.TiledMap.Orientation.ISO:n=this._positionForIsoAt(i,e);break;case cc.TiledMap.Orientation.HEX:n=this._positionForHexAt(i,e)}return n},_isInvalidPosition:function(t,e){if(t&&"object"==typeof t){var i=t;e=i.y,t=i.x}return t>=this._layerSize.width||e>=this._layerSize.height||t<0||e<0},_positionForIsoAt:function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this._tiles[r];if(s){var a=this._texGrids[s].tileset.tileOffset;i=a.x,n=a.y}return cc.v2(.5*this._mapTileSize.width*(this._layerSize.height+t-e-1)+i,.5*this._mapTileSize.height*(this._layerSize.width-t+this._layerSize.height-e-2)-n)},_positionForOrthoAt:function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this._tiles[r];if(s){var a=this._texGrids[s].tileset.tileOffset;i=a.x,n=a.y}return cc.v2(t*this._mapTileSize.width+i,(this._layerSize.height-e-1)*this._mapTileSize.height-n)},_positionForHexAt:function(t,e){var i=this._mapTileSize.width,n=this._mapTileSize.height,r=this._layerSize.height,s=Math.floor(t)+Math.floor(e)*this._layerSize.width,a=this._tiles[s],o=this._texGrids[a].tileset.tileOffset,l=this._staggerIndex===cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD?1:-1,h=0,c=0,u=0,_=0;switch(this._staggerAxis){case cc.TiledMap.StaggerAxis.STAGGERAXIS_Y:u=0,e%2==1&&(u=i/2*l),h=t*i+u+o.x,c=(r-e-1)*(n-(n-this._hexSideLength)/2)-o.y;break;case cc.TiledMap.StaggerAxis.STAGGERAXIS_X:_=0,t%2==1&&(_=n/2*-l),h=t*(i-(i-this._hexSideLength)/2)+o.x,c=(r-e-1)*n+_-o.y}return cc.v2(h,c)},setTileGIDAt:function(t,e,i,n){if(void 0===e)throw new Error("cc.TiledLayer.setTileGIDAt(): pos should be non-null");var r;if(void 0===n&&e instanceof cc.Vec2?(r=e,n=i):r=cc.v2(e,i),r.x=Math.floor(r.x),r.y=Math.floor(r.y),this._isInvalidPosition(r))throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");if(this._tiles&&this._tilesets&&0!=this._tilesets.length)if(0!==t&&t>>0;this._updateTileForGID(a,r)}}else cc.logID(7238)},_updateTileForGID:function(t,e){if(0===t||this._texGrids[t]){var i=0|e.x+e.y*this._layerSize.width;i>>0},getTileFlagsAt:function(t,e){if(!t)throw new Error("TiledLayer.getTileFlagsAt: pos should be non-null");if(void 0!==e&&(t=cc.v2(t,e)),this._isInvalidPosition(t))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this._tiles)return cc.logID(7240),null;var i=Math.floor(t.x)+Math.floor(t.y)*this._layerSize.width;return(this._tiles[i]&cc.TiledMap.TileFlag.FLIPPED_ALL)>>>0},_setCullingDirty:function(t){this._cullingDirty=t},_isCullingDirty:function(){return this._cullingDirty},_updateViewPort:function(t,e,i,n){if(this._viewPort.width!==i||this._viewPort.height!==n||this._viewPort.x!==t||this._viewPort.y!==e){this._viewPort.x=t,this._viewPort.y=e,this._viewPort.width=i,this._viewPort.height=n;var r=1;this._layerOrientation===cc.TiledMap.Orientation.ISO&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,a=this._viewPort.y-this._offset.y+this._leftDownToCenterY,o=s-this._leftOffset,l=a-this._downOffset,h=s+i+this._rightOffset,c=a+n+this._topOffset,_=this._cullingRect.leftDown,f=this._cullingRect.rightTop;o<0&&(o=0),l<0&&(l=0),this._positionToRowCol(o,l,u),u.row-=r,u.col-=r,u.row=u.row>0?u.row:0,u.col=u.col>0?u.col:0,u.row===_.row&&u.col===_.col||(_.row=u.row,_.col=u.col,this._cullingDirty=!0),h<0||c<0?(u.row=-1,u.col=-1):(this._positionToRowCol(h,c,u),u.row++,u.col++),u.row>this._rightTop.row&&(u.row=this._rightTop.row),u.col>this._rightTop.col&&(u.col=this._rightTop.col),u.row===f.row&&u.col===f.col||(f.row=u.row,f.col=u.col,this._cullingDirty=!0)}},_positionToRowCol:function(t,e,i){var n=cc.TiledMap,r=n.Orientation,s=n.StaggerAxis,a=this._mapTileSize.width,o=this._mapTileSize.height,l=.5*a,h=.5*o,c=0,u=0,_=0,f=0,d=this._staggerAxis;this._layerSize.width;switch(this._layerOrientation){case r.ORTHO:u=Math.floor(t/a),c=Math.floor(e/o);break;case r.ISO:u=Math.floor(t/l),c=Math.floor(e/h);break;case r.HEX:d===s.STAGGERAXIS_Y?(_=(c=Math.floor(e/(o-this._diffY1)))%2==1?l*this._odd_even:0,u=Math.floor((t-_)/a)):(f=(u=Math.floor(t/(a-this._diffX1)))%2==1?h*-this._odd_even:0,c=Math.floor((e-f)/o))}return i.row=c,i.col=u,i},_updateCulling:function(){if(this._enableCulling){this.node._updateWorldMatrix(),n.Mat4.invert(l,this.node._worldMatrix);var t=cc.visibleRect,e=cc.Camera.findCamera(this.node);e&&(h.x=0,h.y=0,c.x=h.x+t.width,c.y=h.y+t.height,e.getScreenToWorldPoint(h,h),e.getScreenToWorldPoint(c,c),n.Vec2.transformMat4(h,h,l),n.Vec2.transformMat4(c,c,l),this._updateViewPort(h.x,h.y,c.x-h.x,c.y-h.y))}},getLayerOrientation:function(){return this._layerOrientation},getProperties:function(){return this._properties},_updateVertices:function(){var t=cc.TiledMap,e=t.TileFlag.FLIPPED_MASK,i=t.StaggerAxis,n=t.Orientation,r=this._vertices;r.length=0;var s=this._layerOrientation,a=this._tiles;if(a){var o=this._rightTop;o.row=-1,o.col=-1;var l,h,c,u,_,f,d,p=this._mapTileSize.width,m=this._mapTileSize.height,y=.5*p,v=.5*m,g=this._layerSize.height,A=this._layerSize.width,x=this._texGrids,b=0;s===n.HEX&&(u=this._staggerAxis,_=this._diffX1,f=this._diffY1,d=this._odd_even);var C=0,T=0,S=null,w=0;this._topOffset=0,this._downOffset=0,this._leftOffset=0,this._rightOffset=0,this._hasAniGrid=!1;for(var E=0,M=0,D=0,B=0,I=0;I>>0],this._animations[w]&&(this._hasAniGrid=!0),l){switch(s){case n.ORTHO:h=(C=P)*p,c=(T=g-I-1)*m;break;case n.ISO:h=y*(C=g+P-I-1),c=v*(T=g+A-P-I-2);break;case n.HEX:h=P*(p-_)+(u===i.STAGGERAXIS_Y&&I%2==1?y*d:0),c=(g-I-1)*(m-f)+(u===i.STAGGERAXIS_X&&P%2==1?v*-d:0),C=P,T=g-I-1}var O=r[T]=r[T]||{minCol:0,maxCol:0},L=O[C]=O[C]||{};O.minCol>C&&(O.minCol=C),O.maxCol=0&&this._textures.length>t?this._textures[t]:null},getTextures:function(){return this._textures},setTexture:function(t){this.setTextures([t])},setTextures:function(t){this._textures=t,this._activateMaterial()},getLayerSize:function(){return this._layerSize},getMapTileSize:function(){return this._mapTileSize},getTileSet:function(t){return t=t||0,this._tilesets&&t>=0&&this._tilesets.length>t?this._tilesets[t]:null},getTileSets:function(){return this._tilesets},setTileSet:function(t){this.setTileSets([t])},setTileSets:function(t){this._tilesets=t;for(var e=this._textures=[],i=this._texGrids=[],n=0;n>>0];if(o){var l=o.texId;n[l]||(n[l]=!0,i.push(l))}else cc.error("CCTiledLayer:_traverseAllGrid grid is null, gid is:",a)}}},_init:function(t,e,i,n,r){this._cullingDirty=!0,this._layerInfo=t,this._mapInfo=e;var s=t._layerSize;this._layerName=t.name,this._tiles=t._tiles,this._properties=t.properties,this._layerSize=s,this._minGID=t._minGID,this._maxGID=t._maxGID,this._opacity=t._opacity,this._renderOrder=e.renderOrder,this._staggerAxis=e.getStaggerAxis(),this._staggerIndex=e.getStaggerIndex(),this._hexSideLength=e.getHexSideLength(),this._animations=e.getTileAnimations(),this._tilesets=i,this._textures=n,this._texGrids=r,this._layerOrientation=e.orientation,this._mapTileSize=e.getTileSize();var a=this._mapTileSize.width,o=this._mapTileSize.height,l=this._layerSize.width,h=this._layerSize.height;if(this._layerOrientation===cc.TiledMap.Orientation.HEX){var c=cc.TiledMap,u=c.StaggerAxis,_=c.StaggerIndex,f=0,d=0;this._odd_even=this._staggerIndex===_.STAGGERINDEX_ODD?1:-1,this._staggerAxis===u.STAGGERAXIS_X?(this._diffX1=(a-this._hexSideLength)/2,this._diffY1=0,d=o*(h+.5),f=(a+this._hexSideLength)*Math.floor(l/2)+a*(l%2)):(this._diffX1=0,this._diffY1=(o-this._hexSideLength)/2,f=a*(l+.5),d=(o+this._hexSideLength)*Math.floor(h/2)+o*(h%2)),this.node.setContentSize(f,d)}else if(this._layerOrientation===cc.TiledMap.Orientation.ISO){var p=l+h;this.node.setContentSize(.5*a*p,.5*o*p)}else this.node.setContentSize(l*a,h*o);this._offset=cc.v2(t.offset.x,-t.offset.y),this._useAutomaticVertexZ=!1,this._vertexZvalue=0,this._syncAnchorPoint(),this._prepareToRender()},_prepareToRender:function(){this._updateVertices(),this._traverseAllGrid(),this._updateAllUserNode(),this._activateMaterial()},_activateMaterial:function(){var t=this._tilesetIndexArr;if(0!==t.length){for(var e=this._texIdToMatIndex={},i=this._textures,n=t.length,s=0;s0&&(_[c[f]]=u[f].text);var d=new cc.TMXMapInfo(t.tmxXmlStr,_,r,s,l),p=d.getTilesets();p&&0!==p.length||cc.logID(7241),this._buildWithMapInfo(d)}else this._releaseMapInfo()},_releaseMapInfo:function(){for(var t=this._layers,e=0,i=t.length;e0)for(var b=0,C=v.length;b=s.length&&(r.frameIdx=0),a=s[r.frameIdx]),i[n]=a.grid}}});cc.TiledMap=e.exports=c,cc.TiledMap.loadAllTextures=function(t,e){var i=t.length;if(0!==i)for(var n=0,r=function(){++n>=i&&e()},s=0;s=this._dataList.length&&this._pushRenderData();var e=this._dataList[this._offset];e.nodesRenderList.length=0;var i=e.ia;return i._vertexBuffer=t._vb,i._indexBuffer=t._ib,i._start=t.indiceOffset,i._count=0,this._offset++,e},pushNodesList:function(t,e){t.nodesRenderList.push(e)},reset:function(){this._offset=0}});cc.TiledMapRenderDataList=e.exports=r}),{"../renderer/core/input-assembler":332}],372:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.TiledObjectGroup",extends:cc.Component,getPositionOffset:function(){return this._positionOffset},getProperties:function(){this._properties},getGroupName:function(){return this._groupName},getProperty:function(t){return this._properties[t.toString()]},getObject:function(t){for(var e=0,i=this._objects.length;e>>0];if(!P)continue;var R=P.tileset,O="img"+b.id;g[O]=!0;var L=this.node.getChildByName(O),F=b.width||P.width,V=b.height||P.height,N=R.tileOffset.x,k=R.tileOffset.y;L instanceof cc.PrivateNode&&(L.removeFromParent(),L.destroy(),L=null),L||(L=new cc.Node),s.ISO==e.orientation?(L.anchorX=.5+N/F,L.anchorY=k/V):(L.anchorX=N/F,L.anchorY=k/V),L.angle=-b.rotation,L.x=b.x-m,L.y=b.y-y,L.name=O,L.parent=this.node,L.opacity=this._opacity,L.setSiblingIndex(A);var G=L.getComponent(cc.Sprite);G||(G=L.addComponent(cc.Sprite));var z=G.spriteFrame;z||(z=new cc.SpriteFrame),(I&h)>>>0?z.setFlipX(!0):z.setFlipX(!1),(I&c)>>>0?z.setFlipY(!0):z.setFlipY(!1),z.setTexture(P.tileset.sourceImage,cc.rect(P)),G.spriteFrame=z,G.setVertsDirty(),L.width=F,L.height=V}}this._objects=v;for(var U=this.node.children,H=/^(?:img|text)\d+$/,W=0,j=U.length;W=_?(I.uploadData(),I.switchBuffer(),O=I._vData,L=I._uintVData,b=B.popRenderData(I),C=b.ia,S=0,T=0):(b=B.popRenderData(I),C=b.ia),b.material=P)}function N(t,e){var i=R._getNodesByRowCol(t,e);if(i&&0!=i.count){var n=i.list,r=0,s=0;for(V(),D.worldMatDirty++;r>>0&&(i=g,g=A,A=i),(e&l.HORIZONTAL)>>>0&&(i=v,v=g,g=i,i=A,A=x,x=i),(e&l.VERTICAL)>>>0&&(i=v,v=A,A=i,i=g,g=x,x=i)}var G=(function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateRenderData=function(t){t._renderDataList||(t._buffer=new cc.TiledMapBuffer(c._handle,u),t._renderDataList=new cc.TiledMapRenderDataList)},i.fillBuffers=function(t,e){if(0!==t._vertices.length){t._updateCulling();var i=t.node;if(w=t._leftDownToCenterX,E=t._leftDownToCenterY,M=i._worldMatrix,D=e,R=t,B=t._renderDataList,I=t._buffer,t._isCullingDirty()||t._isUserNodeDirty()||t._hasAnimation()||t._hasTiledNode()){var n,r;if(I.reset(),t._enableCulling){var s=t._cullingRect;n=s.leftDown,r=s.rightTop}else n=y,r=t._rightTop;var a=(r.row-n.row+1)*(r.col-n.col+1);switch(a>_&&(a=_),I.request(4*a,6*a),t._renderOrder){case f.RightDown:this.traverseGrids(n,r,-1,1);break;case f.LeftDown:this.traverseGrids(n,r,-1,-1);break;case f.RightUp:this.traverseGrids(n,r,1,1);break;case f.LeftUp:this.traverseGrids(n,r,1,-1)}t._setCullingDirty(!1),t._setUserNodeDirty(!1)}else{for(var o=null,l=null,h=null,c=0;c0){e.worldMatDirty++;for(var u=0;u0&&(e.material=o.material,e.node=i,e._flushIA(o.ia))}}b=null,C=null,M=null,D=null,B=null,I=null,P=null,R=null,O=null,L=null}},i.traverseGrids=function(t,e,i,n){if(B.reset(),!(e.row<0||e.col<0)){b=B.popRenderData(I),C=b.ia,O=I._vData,L=I._uintVData,T=0,S=0,P=null;var r,s,a,o,l,c,u,f,d=R.node._color._val,p=R._tiledTiles,m=R._texGrids,y=R._tiles,M=R._texIdToMatIndex,F=R._materials,G=R._vertices,z=null,U=0,H=0,W=0,j=0,X=0,Y=null,q=-1,J=0,Z=!0;for(-1==i?(o=e.row,l=t.row):(o=t.row,l=e.row);(l-o)*i>=0;o+=i)for(r=G[o],Z=0==(J=R._getNodesCountByRow(o))&&void 0!=r,1==n?(s=Z&&t.colr.maxCol?r.maxCol:e.col):(s=Z&&e.col>r.maxCol?r.maxCol:e.col,a=Z&&t.col=0;s+=n)(c=r&&r[s])?(z=m[((U=y[c.index])&h)>>>0])&&(q!==z.texId&&(-1!==q&&V(),f=M[q=z.texId],P=F[f],b.material=P),P&&(H=c.left-w,W=c.bottom-E,j=H+(u=z.tileset._tileSize).width,X=W+u.height,(Y=p[c.index])?this.fillByTiledNode(Y.node,O,L,H,j,X,W):(O[S]=H,O[S+1]=X,L[S+4]=d,O[S+5]=H,O[S+6]=W,L[S+9]=d,O[S+10]=j,O[S+11]=X,L[S+14]=d,O[S+15]=j,O[S+16]=W,L[S+19]=d),k(z,U),O[S+2]=v.x,O[S+3]=v.y,O[S+7]=A.x,O[S+8]=A.y,O[S+12]=g.x,O[S+13]=g.y,O[S+17]=x.x,O[S+18]=x.y,S+=20,I.adjust(4,6),C._count+=6,T++,J>0&&N(o,s),T>=_&&V())):J>0&&N(o,s);I.uploadData(),C._count>0&&(D.material=b.material,D.node=R.node,D._flushIA(b.ia))}},i.fillByTiledNode=function(t,e,i,n,s,a,o){t._updateLocalMatrix(),r.Mat4.copy(p,t._matrix),r.Vec3.set(m,-(n+w),-(o+E),0),r.Mat4.transform(p,p,m);var l=p.m,h=l[0],c=l[1],u=l[4],_=l[5],f=l[12],d=l[13],y=t._color._val;e[S]=n*h+a*u+f,e[S+1]=n*c+a*_+d,i[S+4]=y,e[S+5]=n*h+o*u+f,e[S+6]=n*c+o*_+d,i[S+9]=y,e[S+10]=s*h+a*u+f,e[S+11]=s*c+a*_+d,i[S+14]=y,e[S+15]=s*h+o*u+f,e[S+16]=s*c+o*_+d,i[S+19]=y},e})(n.default);i.default=G,n.default.register(a,G),e.exports=i.default}),{"../core/renderer/":241,"../core/renderer/assembler":238,"../core/renderer/render-flow":242,"../core/renderer/webgl/vertex-format":282,"../core/value-types":309,"./CCTiledLayer":368,"./CCTiledMap":369}],377:[(function(t,e,i){"use strict";var n=t("./video-player-impl"),r=n.EventType,s=cc.Enum({REMOTE:0,LOCAL:1}),a=cc.Class({name:"cc.VideoPlayer",extends:cc.Component,editor:!1,properties:{_resourceType:s.REMOTE,resourceType:{tooltip:!1,type:s,set:function(t){this._resourceType=t,this._updateVideoSource()},get:function(){return this._resourceType}},_remoteURL:"",remoteURL:{tooltip:!1,type:cc.String,set:function(t){this._remoteURL=t,this._updateVideoSource()},get:function(){return this._remoteURL}},_clip:{default:null,type:cc.Asset},clip:{tooltip:!1,get:function(){return this._clip},set:function(t){this._clip=t,this._updateVideoSource()},type:cc.Asset},currentTime:{tooltip:!1,type:cc.Float,set:function(t){this._impl&&this._impl.seekTo(t)},get:function(){return this._impl?this._currentStatus===r.NONE||this._currentStatus===r.STOPPED||this._currentStatus===r.META_LOADED||this._currentStatus===r.READY_TO_PLAY?0:this._currentStatus===r.COMPLETED?this._impl.duration():this._impl.currentTime():-1}},_volume:1,volume:{get:function(){return this._volume},set:function(t){this._volume=t,this.isPlaying()&&!this._mute&&this._syncVolume()},range:[0,1],type:cc.Float,tooltip:!1},_mute:!1,mute:{get:function(){return this._mute},set:function(t){this._mute=t,this._syncVolume()},tooltip:!1},keepAspectRatio:{tooltip:!1,default:!0,type:cc.Boolean,notify:function(){this._impl&&this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio)}},_isFullscreen:{default:!1,formerlySerializedAs:"_N$isFullscreen"},isFullscreen:{get:function(){return this._isFullscreen=this._impl&&this._impl.isFullScreenEnabled(),this._isFullscreen},set:function(t){this._isFullscreen=t,this._impl&&this._impl.setFullScreenEnabled(t)},animatable:!1,tooltip:!1},_stayOnBottom:!1,stayOnBottom:{get:function(){return this._stayOnBottom},set:function(t){this._stayOnBottom=t,this._impl&&this._impl.setStayOnBottom(t)},animatable:!1,tooltip:!1},videoPlayerEvent:{default:[],type:cc.Component.EventHandler}},statics:{EventType:r,ResourceType:s,Impl:n},ctor:function(){this._impl=new n,this._currentStatus=r.NONE},_syncVolume:function(){var t=this._impl;if(t){var e=this._mute?0:this._volume;t.setVolume(e)}},_updateVideoSource:function(){var t="";this.resourceType===s.REMOTE?t=this.remoteURL:this._clip&&(t=this._clip.nativeUrl||""),t&&cc.loader.md5Pipe&&(t=cc.loader.md5Pipe.transformURL(t)),this._impl.setURL(t,this._mute||0===this._volume),this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio)},onLoad:function(){var t=this._impl;t&&(t.createDomElementIfNeeded(this._mute||0===this._volume),t.setStayOnBottom(this._stayOnBottom),this._updateVideoSource(),t.seekTo(this.currentTime),t.setFullScreenEnabled(this._isFullscreen),this.pause(),t.setEventListener(r.PLAYING,this.onPlaying.bind(this)),t.setEventListener(r.PAUSED,this.onPasued.bind(this)),t.setEventListener(r.STOPPED,this.onStopped.bind(this)),t.setEventListener(r.COMPLETED,this.onCompleted.bind(this)),t.setEventListener(r.META_LOADED,this.onMetaLoaded.bind(this)),t.setEventListener(r.CLICKED,this.onClicked.bind(this)),t.setEventListener(r.READY_TO_PLAY,this.onReadyToPlay.bind(this)))},onRestore:function(){this._impl||(this._impl=new n)},onEnable:function(){this._impl&&this._impl.enable()},onDisable:function(){this._impl&&this._impl.disable()},onDestroy:function(){this._impl&&(this._impl.destroy(),this._impl=null)},update:function(t){this._impl&&this._impl.updateMatrix(this.node)},onReadyToPlay:function(){this._currentStatus=r.READY_TO_PLAY,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.READY_TO_PLAY),this.node.emit("ready-to-play",this)},onMetaLoaded:function(){this._currentStatus=r.META_LOADED,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.META_LOADED),this.node.emit("meta-loaded",this)},onClicked:function(){this._currentStatus=r.CLICKED,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.CLICKED),this.node.emit("clicked",this)},onPlaying:function(){this._currentStatus=r.PLAYING,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.PLAYING),this.node.emit("playing",this)},onPasued:function(){this._currentStatus=r.PAUSED,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.PAUSED),this.node.emit("paused",this)},onStopped:function(){this._currentStatus=r.STOPPED,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.STOPPED),this.node.emit("stopped",this)},onCompleted:function(){this._currentStatus=r.COMPLETED,cc.Component.EventHandler.emitEvents(this.videoPlayerEvent,this,r.COMPLETED),this.node.emit("completed",this)},play:function(){this._impl&&(this._syncVolume(),this._impl.play())},resume:function(){this._impl&&(this._syncVolume(),this._impl.resume())},pause:function(){this._impl&&this._impl.pause()},stop:function(){this._impl&&this._impl.stop()},getDuration:function(){return this._impl?this._impl.duration():-1},isPlaying:function(){return!!this._impl&&this._impl.isPlaying()}});cc.VideoPlayer=e.exports=a}),{"./video-player-impl":378}],378:[(function(t,e,i){"use strict";var n=t("../core/platform/utils"),r=t("../core/platform/CCSys"),s=t("../core/platform/CCMacro"),a={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},o=cc.mat4(),l=cc.Class({name:"VideoPlayerImpl",ctor:function(){this._EventList={},this._video=null,this._url="",this._waitingFullscreen=!1,this._fullScreenEnabled=!1,this._stayOnBottom=!1,this._loadedmeta=!1,this._loaded=!1,this._visible=!1,this._playing=!1,this._ignorePause=!1,this._forceUpdate=!1,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._w=0,this._h=0,this.__eventListeners={}},_bindEvent:function(){var t=this._video,e=this,i=this.__eventListeners;i.loadedmetadata=function(){e._loadedmeta=!0,e._forceUpdate=!0,e._waitingFullscreen&&(e._waitingFullscreen=!1,e._toggleFullscreen(!0)),e._dispatchEvent(l.EventType.META_LOADED)},i.ended=function(){e._video===t&&(e._playing=!1,e._dispatchEvent(l.EventType.COMPLETED))},i.play=function(){e._video===t&&(e._playing=!0,e._updateVisibility(),e._dispatchEvent(l.EventType.PLAYING))},i.pause=function(){e._video===t&&(e._playing=!1,e._ignorePause||e._dispatchEvent(l.EventType.PAUSED))},i.click=function(){e._dispatchEvent(l.EventType.CLICKED)},t.addEventListener("loadedmetadata",i.loadedmetadata),t.addEventListener("ended",i.ended),t.addEventListener("play",i.play),t.addEventListener("pause",i.pause),t.addEventListener("click",i.click),i.onCanPlay=function(){if(!e._loaded&&!e._playing){var t=e._video;t.readyState!==a.HAVE_ENOUGH_DATA&&t.readyState!==a.HAVE_METADATA||(t.currentTime=0,e._loaded=!0,e._forceUpdate=!0,e._dispatchEvent(l.EventType.READY_TO_PLAY),e._updateVisibility())}},t.addEventListener("canplay",i.onCanPlay),t.addEventListener("canplaythrough",i.onCanPlay),t.addEventListener("suspend",i.onCanPlay)},_updateVisibility:function(){var t=this._video;t&&(this._visible?t.style.visibility="visible":(t.style.visibility="hidden",t.pause(),this._playing=!1))},_updateSize:function(t,e){var i=this._video;i&&(i.style.width=t+"px",i.style.height=e+"px")},_createDom:function(t){var e=document.createElement("video");e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style["z-index"]=this._stayOnBottom?s.MIN_ZINDEX:0,e.className="cocosVideo",e.setAttribute("preload","auto"),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""),e.setAttribute("playsinline",""),t&&e.setAttribute("muted",""),this._video=e,cc.game.container.appendChild(e)},createDomElementIfNeeded:function(t){this._video||this._createDom(t)},removeDom:function(){var t=this._video;if(t){n.contains(cc.game.container,t)&&cc.game.container.removeChild(t);var e=this.__eventListeners;t.removeEventListener("loadedmetadata",e.loadedmetadata),t.removeEventListener("ended",e.ended),t.removeEventListener("play",e.play),t.removeEventListener("pause",e.pause),t.removeEventListener("click",e.click),t.removeEventListener("canplay",e.onCanPlay),t.removeEventListener("canplaythrough",e.onCanPlay),t.removeEventListener("suspend",e.onCanPlay),e.loadedmetadata=null,e.ended=null,e.play=null,e.pause=null,e.click=null,e.onCanPlay=null}this._video=null,this._url=""},setURL:function(t,e){var i,n;if(this._url!==t){this.removeDom(),this._url=t,this.createDomElementIfNeeded(e),this._bindEvent();var r=this._video;r.style.visibility="hidden",this._loaded=!1,this._playing=!1,this._loadedmeta=!1,(i=document.createElement("source")).src=t,r.appendChild(i),n=cc.path.extname(t);for(var s=l._polyfill,a=0;a0&&(r[p-1].vfOffset=h),r.length=p,y.length=o;var v=d-1;if(v>=0)if(f>0){var g=n[v];g.indexCount=f,g.vfCount=5*_,g.vertexCount=_,n.length=d}else n.length=d-1;if(0!==n.length){var A=i.vertices,x=i.uintVert;(!A||A.length=0&&(f>0?((T=w[C]).indexCount=f,T.vertexCount=_,T.vfCount=5*_):d--),w[d]={tex:b,blendMode:v._blendMode,indexCount:0,vertexCount:0,vfCount:0},d++,f=0,_=0),x=(A.a*e<<24>>>0)+(A.b<<16)+(A.g<<8)+A.r,m!==x&&(m=x,p>0&&(S[p-1].vfOffset=h),S[p++]={r:A.r,g:A.g,b:A.b,a:A.a*e,vfOffset:0}),i=v._localVertices,y=v._indices,g=v._worldMatrix.m;for(var k=0,G=i.length;k":0}),u=(cc.Enum({REALTIME:0}),cc.Enum({REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2}));var _=cc.Class({name:"dragonBones.ArmatureDisplay",extends:n,editor:!1,statics:{AnimationCacheMode:u},properties:{_factory:{default:null,type:dragonBones.CCFactory,serializable:!1},dragonAsset:{default:null,type:dragonBones.DragonBonesAsset,notify:function(){this._refresh()},tooltip:!1},dragonAtlasAsset:{default:null,type:dragonBones.DragonBonesAtlasAsset,notify:function(){this._parseDragonAtlasAsset(),this._refresh()},tooltip:!1},_armatureName:"",armatureName:{get:function(){return this._armatureName},set:function(t){this._armatureName=t;var e=this.getAnimationNames(this._armatureName);(!this.animationName||e.indexOf(this.animationName)<0)&&(this.animationName=""),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),this._refresh(),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature)},visible:!1},_animationName:"",animationName:{get:function(){return this._animationName},set:function(t){this._animationName=t},visible:!1},_defaultArmatureIndex:{default:0,notify:function(){var t="";if(this.dragonAsset){var e;if(this.dragonAsset&&(e=this.dragonAsset.getArmatureEnum()),!e)return cc.errorID(7400,this.name);t=e[this._defaultArmatureIndex]}void 0!==t?this.armatureName=t:cc.errorID(7401,this.name)},type:h,visible:!0,editorOnly:!0,animatable:!1,displayName:"Armature",tooltip:!1},_animationIndex:{default:0,notify:function(){var t;if(0!==this._animationIndex){if(this.dragonAsset&&(t=this.dragonAsset.getAnimsEnum(this.armatureName)),t){var e=t[this._animationIndex];void 0!==e?this.playAnimation(e,this.playTimes):cc.errorID(7402,this.name)}}else this.animationName=""},type:c,visible:!0,editorOnly:!0,displayName:"Animation",tooltip:!1},_preCacheMode:-1,_cacheMode:u.REALTIME,_defaultCacheMode:{default:0,type:u,notify:function(){if(this._defaultCacheMode!==u.REALTIME&&this._armature&&!o.canCache(this._armature))return this._defaultCacheMode=u.REALTIME,void cc.warn("Animation cache mode doesn't support skeletal nesting");this.setAnimationCacheMode(this._defaultCacheMode)},editorOnly:!0,visible:!0,animatable:!1,displayName:"Animation Cache Mode",tooltip:!1},timeScale:{default:1,notify:function(){this._armature&&!this.isAnimationCached()&&(this._armature.animation.timeScale=this.timeScale)},tooltip:!1},playTimes:{default:-1,tooltip:!1},premultipliedAlpha:{default:!1,tooltip:!1},debugBones:{default:!1,notify:function(){this._updateDebugDraw()},tooltip:!1},enableBatch:{default:!1,notify:function(){this._updateBatch()},tooltip:!1},_armatureKey:"",_accTime:0,_playCount:0,_frameCache:null,_curFrame:null,_playing:!1,_armatureCache:null},ctor:function(){this._eventTarget=new r,this._materialCache={},this._inited=!1,this.attachUtil=new l,this._factory=dragonBones.CCFactory.getInstance()},onLoad:function(){for(var t=this.node.children,e=0,i=t.length;e=i.length){if(this._playCount++,this.playTimes>0&&this._playCount>=this.playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playing=!1,this._playCount=0,void this._emitCacheCompleteEvent();this._accTime=0,s=0,this._emitCacheCompleteEvent()}this._curFrame=i[s]}else e.isInvalid()&&(e.updateToFrame(),this._curFrame=i[i.length-1])}}},onDestroy:function(){this._super(),this._inited=!1,this._cacheMode===u.PRIVATE_CACHE?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):this._cacheMode===u.SHARED_CACHE?(this._armatureCache=null,this._armature=null):this._armature&&(this._armature.dispose(),this._armature=null)},_updateDebugDraw:function(){if(this.debugBones){if(!this._debugDraw){var t=new cc.PrivateNode;t.name="DEBUG_DRAW_NODE";var e=t.addComponent(s);e.lineWidth=1,e.strokeColor=cc.color(255,0,0,255),this._debugDraw=e}this._debugDraw.node.parent=this.node}else this._debugDraw&&(this._debugDraw.node.parent=null)},_buildArmature:function(){if(this.dragonAsset&&this.dragonAtlasAsset&&this.armatureName){this._armature&&(this._preCacheMode===u.PRIVATE_CACHE?this._armatureCache.dispose():this._preCacheMode===u.REALTIME&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=null),this._cacheMode===u.SHARED_CACHE?this._armatureCache=o.sharedCache:this._cacheMode===u.PRIVATE_CACHE&&(this._armatureCache=new o,this._armatureCache.enablePrivateMode());var t=this.dragonAtlasAsset._uuid;if(this._armatureKey=this.dragonAsset.init(this._factory,t),this.isAnimationCached()&&(this._armature=this._armatureCache.getArmatureCache(this.armatureName,this._armatureKey,t),this._armature||(this._cacheMode=u.REALTIME)),this._preCacheMode=this._cacheMode,this._cacheMode===u.REALTIME){if(this._displayProxy=this._factory.buildArmatureDisplay(this.armatureName,this._armatureKey,"",t),!this._displayProxy)return;this._displayProxy._ccNode=this.node,this._displayProxy.setEventTarget(this._eventTarget),this._armature=this._displayProxy._armature,this._armature.animation.timeScale=this.timeScale,this._factory._dragonBones.clock.add(this._armature)}if(this._cacheMode!==u.REALTIME&&this.debugBones&&cc.warn("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node.setContentSize(e.width,e.height)}this._updateBatch(),this.attachUtil.init(this),this.attachUtil._associateAttachedNode(),this.animationName&&this.playAnimation(this.animationName,this.playTimes),this.markForRender(!0)}},_parseDragonAtlasAsset:function(){this.dragonAtlasAsset&&this.dragonAtlasAsset.init(this._factory)},_refresh:function(){this._buildArmature()},_updateCacheModeEnum:!1,_updateAnimEnum:!1,_updateArmatureEnum:!1,playAnimation:function(t,e){if(this.playTimes=void 0===e?-1:e,this.animationName=t,this.isAnimationCached()){var i=this._armatureCache.getAnimationCache(this._armatureKey,t);i||(i=this._armatureCache.initAnimationCache(this._armatureKey,t)),i&&(this._accTime=0,this._playCount=0,this._frameCache=i,this.attachUtil._hasAttachedNode()&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._playing=!0,this._curFrame=this._frameCache.frames[0])}else if(this._armature)return this._armature.animation.play(t,this.playTimes)},updateAnimationCache:function(t){this.isAnimationCached()&&this._armatureCache.updateAnimationCache(this._armatureKey,t)},invalidAnimationCache:function(){this.isAnimationCached()&&this._armatureCache.invalidAnimationCache(this._armatureKey)},getArmatureNames:function(){var t=this._factory.getDragonBonesData(this._armatureKey);return t&&t.armatureNames||[]},getAnimationNames:function(t){var e=[],i=this._factory.getDragonBonesData(this._armatureKey);if(i){var n=i.getArmature(t);if(n)for(var r in n.animations)n.animations.hasOwnProperty(r)&&e.push(r)}return e},on:function(t,e,i){this.addEventListener(t,e,i)},off:function(t,e,i){this.removeEventListener(t,e,i)},once:function(t,e,i){this._eventTarget.once(t,e,i)},addEventListener:function(t,e,i){this._eventTarget.on(t,e,i)},removeEventListener:function(t,e,i){this._eventTarget.off(t,e,i)},buildArmature:function(t,e){return this._factory.createArmatureNode(this,t,e)},armature:function(){return this._armature}});e.exports=dragonBones.ArmatureDisplay=_}),{"../../cocos2d/core/components/CCRenderComponent":110,"../../cocos2d/core/event/event-target":135,"../../cocos2d/core/graphics/graphics":151,"../../cocos2d/core/renderer/render-flow":242,"./ArmatureCache":383,"./AttachUtil":385}],385:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../cocos2d/core/value-types/mat4"));var r=t("../../cocos2d/core/renderer/render-flow").FLAG_TRANSFORM,s=function(){},a=function(t){Object.defineProperty(t,"_worldMatDirty",{get:function(){return!0},set:function(t){}}),t._calculWorldMatrix=s,t._mulMat=s},o=new n.default,l=cc.Class({name:"dragonBones.AttachUtil",ctor:function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null,this._attachedRootNode=null,this._attachedNodeArray=[],this._boneIndexToNode={}},init:function(t){this._inited=!0,this._armature=t._armature,this._armatureNode=t.node,this._armatureDisplay=t},reset:function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null},_prepareAttachNode:function(){if(this._armature){var t=this._armatureNode.getChildByName("ATTACHED_NODE_TREE");return t&&t.isValid||(t=new cc.Node("ATTACHED_NODE_TREE"),a(t),this._armatureNode.addChild(t)),this._armatureDisplay.isAnimationCached()&&this._armatureDisplay._frameCache&&this._armatureDisplay._frameCache.enableCacheAttachedInfo(),this._attachedRootNode=t,t}},_buildBoneAttachedNode:function(t,e){var i="ATTACHED_NODE:"+t.name,n=new cc.Node(i);return this._buildBoneRelation(n,t,e),n},_buildBoneRelation:function(t,e,i){a(t),t._bone=e,t._boneIndex=i,this._attachedNodeArray.push(t),this._boneIndexToNode[i]=t},getAttachedRootNode:function(){return this._attachedRootNode},getAttachedNodes:function(t){var e=this._attachedNodeArray,i=[];if(!this._inited)return i;for(var n=0,r=e.length;n=0;o--)if(s>=e[o]._zOrder){e.splice(o+1,0,r),a=!0;break}a||e.splice(0,0,r)}this._slots=e},_buildArmature:function(t){var e=n.borrowObject(dragonBones.Armature);e._skinData=t.skin,e._animation=n.borrowObject(dragonBones.Animation),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new dragonBones.CCArmatureDisplay;return e.init(t.armature,i,i,this._dragonBones),e},_buildSlot:function(t,e,i){var r=n.borrowObject(dragonBones.CCSlot),s=r;return r.init(e,i,s,s),r},getDragonBonesDataByUUID:function(t){for(var e in this._dragonBonesDataMap)if(-1!=e.indexOf(t))return this._dragonBonesDataMap[e];return null},removeDragonBonesDataByUUID:function(t,e){for(var i in void 0===e&&(e=!0),this._dragonBonesDataMap)-1!==i.indexOf(t)&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[i]),delete this._dragonBonesDataMap[i])}})}),{}],388:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../cocos2d/core/value-types/mat4"));var r=dragonBones.BinaryOffset,s=dragonBones.BoneType;dragonBones.CCSlot=cc.Class({name:"dragonBones.CCSlot",extends:dragonBones.Slot,ctor:function(){this._localVertices=[],this._indices=[],this._matrix=cc.mat4(),this._worldMatrix=cc.mat4(),this._worldMatrixDirty=!0,this._visible=!1,this._color=cc.color()},_onClear:function(){this._super(),this._localVertices.length=0,this._indices.length=0,n.default.identity(this._matrix),n.default.identity(this._worldMatrix),this._worldMatrixDirty=!0,this._color=cc.color(),this._visible=!1},statics:{toString:function(){return"[class dragonBones.CCSlot]"}},_onUpdateDisplay:function(){},_initDisplay:function(t){},_addDisplay:function(){this._visible=!0},_replaceDisplay:function(t){},_removeDisplay:function(){this._visible=!1},_disposeDisplay:function(t){},_updateVisible:function(){this._visible=this.parent._visible},_updateZOrder:function(){},_updateBlendMode:function(){if(this._childArmature)for(var t=this._childArmature.getSlots(),e=0,i=t.length;e0&&n.inheritDeform,l=this._localVertices;if(a){var h=n.data,c=h.intArray,u=h.floatArray,_=c[n.offset+r.MeshVertexCount],f=c[a.offset+r.WeigthFloatOffset];f<0&&(f+=65536);for(var d=0,p=a.offset+r.WeigthBoneIndices+i.length,m=f,y=0,v=0;d<_;d++,v+=4){for(var g=c[p++],A=0,x=0,b=0;b0){for(var i=0,n=this._objects;i0){for(var r=0;ri&&(r.length=i),t._maxCountMap[n]=i;else for(var n in t._defaultMaxCount=i,t._poolsMap){var r;(r=t._poolsMap[n]).length>i&&(r.length=i),n in t._maxCountMap&&(t._maxCountMap[n]=i)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var i=String(e);null!==(r=i in t._poolsMap?t._poolsMap[i]:null)&&r.length>0&&(r.length=0)}else for(var n in t._poolsMap){var r;(r=t._poolsMap[n]).length=0}},t.borrowObject=function(e){var i=String(e),n=i in t._poolsMap?t._poolsMap[i]:null;if(null!==n&&n.length>0){var r=n.pop();return r._isInPool=!1,r}var s=new e;return s._onClear(),s},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t})();t.BaseObject=e})(r||(r={})),(function(t){var e=(function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,i=0,n=0,r=this.d*t.d,s=this.tx*t.a+t.tx,a=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,i+=this.b*t.d,n+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(i+=this.a*t.b,n+=this.d*t.c,s+=this.ty*t.c,a+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=a,this},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=this.ty;if(0===e&&0===i)return this.b=this.c=0,0===t||0===n?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,n=this.d=1/n,this.tx=-t*r,this.ty=-n*s),this;var a=t*n-e*i;if(0===a)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;a=1/a;var o=this.a=n*a;return e=this.b=-e*a,i=this.c=-i*a,n=this.d=t*a,this.tx=-(o*r+i*s),this.ty=-(e*r+n*s),this},t.prototype.transformPoint=function(t,e,i,n){void 0===n&&(n=!1),i.x=this.a*t+this.c*e,i.y=this.b*t+this.d*e,n||(i.x+=this.tx,i.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var i=this.a,n=this.b,r=this.c,s=this.d,a=e?0:this.tx,o=e?0:this.ty,l=t.x,h=t.y,c=l+t.width,u=h+t.height,_=i*l+r*h+a,f=n*l+s*h+o,d=i*c+r*h+a,p=n*c+s*h+o,m=i*c+r*u+a,y=n*c+s*u+o,v=i*l+r*u+a,g=n*l+s*u+o,A=0;_>d&&(A=_,_=d,d=A),m>v&&(A=m,m=v,v=A),t.x=Math.floor(_v?d:v)-t.x),f>p&&(A=f,f=p,p=A),y>g&&(A=y,y=g,g=A),t.y=Math.floor(fg?p:g)-t.y)},t})();t.Matrix=e})(r||(r={})),(function(t){var e=(function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=1),this.x=t,this.y=e,this.skew=i,this.rotation=n,this.scaleX=r,this.scaleY=s}return t.normalizeRadian=function(t){return t=(t+Math.PI)%(2*Math.PI),t+=t>0?-Math.PI:Math.PI},t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+180*this.skew/Math.PI+" skewY:"+180*this.rotation/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var i=this.scaleX,n=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var s=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation-r&&s=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),n>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s-=Math.PI),this.skew=s-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t})();t.Transform=e})(r||(r={})),(function(t){var e=(function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=a,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t})();t.ColorTransform=e})(r||(r={})),(function(t){var e=(function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t})();t.Point=e})(r||(r={})),(function(t){var e=(function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t})();t.Rectangle=e})(r||(r={})),(function(t){var e=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t=0&&t=0&&t=t&&(i=0),!(this.sortedBones.indexOf(r)>=0)){var s=!1;for(var a in this.constraints){var o=this.constraints[a];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){s=!0;break}}s||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),n++)}}}},i.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},i.prototype.setCacheFrame=function(t,e){var i=this.parent.cachedFrames,n=i.length;return i.length+=10,i[n]=t.a,i[n+1]=t.b,i[n+2]=t.c,i[n+3]=t.d,i[n+4]=t.tx,i[n+5]=t.ty,i[n+6]=e.rotation,i[n+7]=e.skew,i[n+8]=e.scaleX,i[n+9]=e.scaleY,n},i.prototype.getCacheFrame=function(t,e,i){var n=this.parent.cachedFrames;t.a=n[i],t.b=n[i+1],t.c=n[i+2],t.d=n[i+3],t.tx=n[i+4],t.ty=n[i+5],e.rotation=n[i+6],e.skew=n[i+7],e.scaleX=n[i+8],e.scaleY=n[i+9],e.x=t.tx,e.y=t.ty},i.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},i.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},i.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},i.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},i.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},i.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},i.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},i.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},i.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},i.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},i.prototype.getMesh=function(t,e,i){var n=this.getSkin(t);return null===n?null:n.getDisplay(e,i)},i.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},i})(t.BaseObject);t.ArmatureData=e;var i=(function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i.userData=null,i}return n(i,e),i.toString=function(){return"[class dragonBones.BoneData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.name="",this.transform.identity(),this.userData=null,this.parent=null},i})(t.BaseObject);t.BoneData=i;var r=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.SurfaceData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.vertices.length=0},e})(i);t.SurfaceData=r;var s=(function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return n(i,e),i.createColor=function(){return new t.ColorTransform},i.toString=function(){return"[class dragonBones.SlotData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.name="",this.color=null,this.userData=null,this.parent=null},i.DEFAULT_COLOR=new t.ColorTransform,i})(t.BaseObject);t.SlotData=s})(r||(r={})),(function(t){var e=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e})(t.BaseObject);t.ConstraintData=e;var i=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e})(e);t.IKConstraintData=i;var r=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e})(e);t.PathConstraintData=r})(r||(r={})),(function(t){var e=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e})(t.BaseObject);t.CanvasData=e})(r||(r={})),(function(t){var e=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return n(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,i=this.displays[t];er&&(a|=2),es&&(a|=8),a},e.rectangleIntersectsSegment=function(t,i,n,r,s,a,o,l,h,c,u){void 0===h&&(h=null),void 0===c&&(c=null),void 0===u&&(u=null);var _=t>s&&ta&&is&&na&&r=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return!0}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null);var l=.5*this.width,h=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-l,-h,l,h,s,a,o)},e})(e);t.RectangleBoundingBoxData=i;var r=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,a,o,l,h,c){void 0===l&&(l=null),void 0===h&&(h=null),void 0===c&&(c=null);var u=a/o,_=u*u,f=i-t,d=(n*=u)-(e*=u),p=Math.sqrt(f*f+d*d),m=f/p,y=d/p,v=(r-t)*m+(s-e)*y,g=a*a,A=g-(t*t+e*e)+v*v,x=0;if(A>=0){var b=Math.sqrt(A),C=v-b,T=v+b,S=C<0?-1:C<=p?0:1,w=T<0?-1:T<=p?0:1,E=S*w;if(E<0)return-1;0===E&&(-1===S?(x=2,i=t+T*m,n=(e+T*y)/u,null!==l&&(l.x=i,l.y=n),null!==h&&(h.x=i,h.y=n),null!==c&&(c.x=Math.atan2(n/g*_,i/g),c.y=c.x+Math.PI)):1===w?(x=1,t+=C*m,e=(e+C*y)/u,null!==l&&(l.x=t,l.y=e),null!==h&&(h.x=t,h.y=e),null!==c&&(c.x=Math.atan2(e/g*_,t/g),c.y=c.x+Math.PI)):(x=3,null!==l&&(l.x=t+C*m,l.y=(e+C*y)/u,null!==c&&(c.x=Math.atan2(l.y/g*_,l.x/g))),null!==h&&(h.x=t+T*m,h.y=(e+T*y)/u,null!==c&&(c.y=Math.atan2(h.y/g*_,h.x/g)))))}return x},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e})(e);t.EllipseBoundingBoxData=r;var s=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),t===i&&(t=i+1e-6),e===n&&(e=n+1e-6);for(var l=r.length,h=t-i,c=e-n,u=t*n-e*i,_=0,f=r[l-2],d=r[l-1],p=0,m=0,y=0,v=0,g=0,A=0,x=0;x=f&&M<=b||M>=b&&M<=f)&&(0===h||M>=t&&M<=i||M>=i&&M<=t)){var D=(u*S-c*w)/E;if((D>=d&&D<=C||D>=C&&D<=d)&&(0===c||D>=e&&D<=n||D>=n&&D<=e)){if(null===a){y=M,v=D,g=M,A=D,_++,null!==o&&(o.x=Math.atan2(C-d,b-f)-.5*Math.PI,o.y=o.x);break}var B=M-t;B<0&&(B=-B),0===_?(p=B,m=B,y=M,v=D,g=M,A=D,null!==o&&(o.x=Math.atan2(C-d,b-f)-.5*Math.PI,o.y=o.x)):(Bm&&(m=B,g=M,A=D,null!==o&&(o.y=Math.atan2(C-d,b-f)-.5*Math.PI))),_++}}f=b,d=C}return 1===_?(null!==s&&(s.x=y,s.y=v),null!==a&&(a.x=y,a.y=v),null!==o&&(o.y=o.x+Math.PI)):_>1&&(_++,null!==s&&(s.x=y,s.y=v),null!==a&&(a.x=g,a.y=A)),_},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var i=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var n=0,r=this.vertices.length,s=r-2;n=e||a=e){var l=this.vertices[s],h=this.vertices[n];(e-o)*(l-h)/(a-o)+h0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var i=0,n=this.cacheFrames.length;i=0},e.prototype.addBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=t.getBone(e);if(null!==n&&(this.boneMask.indexOf(e)<0&&this.boneMask.push(e),i))for(var r=0,s=t.getBones();r=0&&this.boneMask.splice(n,1),i){var r=t.getBone(e);if(null!==r)if(this.boneMask.length>0)for(var s=0,a=t.getBones();s=0&&r.contains(o)&&this.boneMask.splice(l,1)}else for(var h=0,c=t.getBones();he._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t=s)){var o=i[a],l=this.getSlot(o.name);null!==l&&l._setZorder(r)}}this._slotsDirty=!0,this._zOrderDirty=!n}},i.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},i.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},i.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},i.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},i.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},i.prototype.init=function(e,i,n,r){null===this._armatureData&&(this._armatureData=e,this._animation=t.BaseObject.borrowObject(t.Animation),this._proxy=i,this._display=n,this._dragonBones=r,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},i.prototype.advanceTime=function(t){if(!this._lockUpdate)if(null!==this._armatureData)if(null!==this._armatureData.parent){var e=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty&&(this._slotsDirty=!1,this._slots.sort(i._onSortSlots)),this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var n=0,r=0;for(n=0,r=this._bones.length;n0){this._lockUpdate=!0;for(var s=0,a=this._actions;s0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i0){if(null===r&&null===s){m=A;break}var x;null!==r&&((x=o?r.y-e:r.x-t)<0&&(x=-x),(null===m||xh)&&(h=x,_=s.x,f=s.y,y=A,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=c,r.y=u,null!==a&&(a.x=d)),null!==y&&null!==s&&(s.x=_,s.y=f,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var i=0,n=this._armature._constraints;i=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},i.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},i.prototype.invalidUpdate=function(){this._transformDirty=!0},i.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(i.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,i=this._armature.getSlots();e=s)return this.globalTransformMatrix;if(d=7*(2*(o*(l+1)+2*o+l+f)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[d]>0)v.copyFromArray(y,d+1);else{var g=f*(h+2),A=this._hullCache[4],x=this._hullCache[5],b=this._hullCache[2]-(l-f)*A,C=this._hullCache[3]-(l-f)*x,T=this._vertices;r?this._getAffineTransform(-s,m+u,800,u,T[g+h+2],T[g+h+3],b+A,C+x,T[g],T[g+1],e._helpTransform,v,!0):this._getAffineTransform(-n,m,800,u,b,C,T[g],T[g+1],b+A,C+x,e._helpTransform,v,!1),y[d]=1,y[d+1]=v.a,y[d+2]=v.b,y[d+3]=v.c,y[d+4]=v.d,y[d+5]=v.tx,y[d+6]=v.ty}}else if(t>=s){if(i<-s||i>=s)return this.globalTransformMatrix;if(d=7*(2*(o*(l+1)+o+f)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[d]>0)v.copyFromArray(y,d+1);else{g=(f+1)*(h+2)-2,A=this._hullCache[4],x=this._hullCache[5],b=this._hullCache[0]+f*A,C=this._hullCache[1]+f*x,T=this._vertices;r?this._getAffineTransform(n,m+u,800,u,b+A,C+x,T[g+h+2],T[g+h+3],b,C,e._helpTransform,v,!0):this._getAffineTransform(s,m,800,u,T[g],T[g+1],b,C,T[g+h+2],T[g+h+3],e._helpTransform,v,!1),y[d]=1,y[d+1]=v.a,y[d+2]=v.b,y[d+3]=v.c,y[d+4]=v.d,y[d+5]=v.tx,y[d+6]=v.ty}}else if(i<-s){if(t<-s||t>=s)return this.globalTransformMatrix;if(d=7*(o*(l+1)+2*_+((r=i>this._kY*(t-p-c)-n)?1:0)),this._matrixCahce[d]>0)v.copyFromArray(y,d+1);else{g=2*_,A=this._hullCache[10],x=this._hullCache[11],b=this._hullCache[8]+_*A,C=this._hullCache[9]+_*x,T=this._vertices;r?this._getAffineTransform(p+c,-s,c,800,T[g+2],T[g+3],T[g],T[g+1],b+A,C+x,e._helpTransform,v,!0):this._getAffineTransform(p,-n,c,800,b,C,b+A,C+x,T[g],T[g+1],e._helpTransform,v,!1),y[d]=1,y[d+1]=v.a,y[d+2]=v.b,y[d+3]=v.c,y[d+4]=v.d,y[d+5]=v.tx,y[d+6]=v.ty}}else if(i>=s){if(t<-s||t>=s)return this.globalTransformMatrix;if(d=7*(2*(o*(l+1)+o+l+f)+((r=i>this._kY*(t-p-c)+s)?1:0)),this._matrixCahce[d]>0)v.copyFromArray(y,d+1);else{g=l*(h+2)+2*_,A=this._hullCache[10],x=this._hullCache[11],b=this._hullCache[6]-(o-_)*A,C=this._hullCache[7]-(o-_)*x,T=this._vertices;r?this._getAffineTransform(p+c,n,c,800,b+A,C+x,b,C,T[g+2],T[g+3],e._helpTransform,v,!0):this._getAffineTransform(p,s,c,800,T[g],T[g+1],T[g+2],T[g+3],b,C,e._helpTransform,v,!1),y[d]=1,y[d+1]=v.a,y[d+2]=v.b,y[d+3]=v.c,y[d+4]=v.d,y[d+5]=v.tx,y[d+6]=v.ty}}else if(d=7*(2*(o*f+_)+((r=i>this._k*(t-p-c)+m)?1:0)),this._matrixCahce[d]>0)v.copyFromArray(y,d+1);else{g=2*_+f*(h+2),T=this._vertices;r?this._getAffineTransform(p+c,m+u,c,u,T[g+h+4],T[g+h+5],T[g+h+2],T[g+h+3],T[g+2],T[g+3],e._helpTransform,v,!0):this._getAffineTransform(p,m,c,u,T[g],T[g+1],T[g+2],T[g+3],T[g+h+2],T[g+h+3],e._helpTransform,v,!1),y[d]=1,y[d+1]=v.a,y[d+2]=v.b,y[d+3]=v.c,y[d+4]=v.d,y[d+5]=v.tx,y[d+6]=v.ty}return v},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=2*(n*r+2*n+2*r)*7,this._hullCache.length=10;for(var a=0;a=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];if(i>=0&&this._cachedFrameIndex===i)this._transformDirty=!1;else if(i>=0)this._transformDirty=!0,this._cachedFrameIndex=i;else{if(this._hasConstraint)for(var n=0,r=this._armature._constraints;n=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s=0;this._localDirty&&this._updateGlobalTransformMatrix(c),c&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var u=2*this.global.x,_=2*this.global.y,f=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,f),this._hullCache[0]=f.x,this._hullCache[1]=f.y,this._hullCache[2]=u-f.x,this._hullCache[3]=_-f.y,this.globalTransformMatrix.transformPoint(0,this._dY,f,!0),this._hullCache[4]=f.x,this._hullCache[5]=f.y,this.globalTransformMatrix.transformPoint(200,1e3,f),this._hullCache[6]=f.x,this._hullCache[7]=f.y,this._hullCache[8]=u-f.x,this._hullCache[9]=_-f.y,this.globalTransformMatrix.transformPoint(this._dX,0,f,!0),this._hullCache[10]=f.x,this._hullCache[11]=f.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e})(t.Bone);t.Surface=e})(r||(r={})),(function(t){var e=(function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._localMatrix=new t.Matrix,i._colorTransform=new t.ColorTransform,i._displayDatas=[],i._displayList=[],i._deformVertices=null,i._rawDisplay=null,i._meshDisplay=null,i}return n(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex=0&&this._displayIndex=0&&null!==this._rawDisplayDatas){var a=this._displayIndex0)for(var o=0,l=s;o0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];e>=0&&this._cachedFrameIndex===e?this._transformDirty=!1:e>=0?(this._transformDirty=!0,this._cachedFrameIndex=e):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(null!==this._display){if(this._visibleDirty&&(this._visibleDirty=!1,this._updateVisible()),this._blendModeDirty&&(this._blendModeDirty=!1,this._updateBlendMode()),this._colorDirty&&(this._colorDirty=!1,this._updateColor()),null!==this._deformVertices&&null!==this._deformVertices.verticesData&&this._display===this._meshDisplay){var i=null!==this._deformVertices.verticesData.weight,n=0!==this._parent._boneData.type;if((this._deformVertices.verticesDirty||i&&this._deformVertices.isBonesUpdate()||n&&this._parent._childrenTransformDirty)&&(this._deformVertices.verticesDirty=!1,this._updateMesh()),i||n)return}if(this._transformDirty){if(this._transformDirty=!1,this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._isFromCache=!0,this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform()}}},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._transformDirty=!1,this._updateGlobalTransformMatrix(!1))},i.prototype.replaceDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0&&(e=this._displayIndex<0?0:this._displayIndex),this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var i=0,n=this._displayDatas.length;i0&&(1===l||2===l?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&(a.x=s.x,a.y=s.y)):null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),l},i.prototype.invalidUpdate=function(){this._displayDirty=!0,this._transformDirty=!0},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){this._setDisplayIndex(t)&&this.update(-1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._slotData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var i=this._displayList.concat(),n=new Array;this._setDisplayList(e)&&this.update(-1);for(var r=0,s=i;rd)continue}for(;;W++){var V=p[W];if(!(F>V)){if(0===W)F/=V;else F=(F-(G=p[W-1]))/(V-G);break}}if(W!==_){_=W;var N=6*W;for(T=h[N],S=h[N+1],w=h[N+2],E=h[N+3],M=h[N+4],D=h[N+5],B=h[N+6],I=h[N+7],A=2*(m=.03*(T-2*w+M))+(v=.006*(3*(w-M)-T+B)),x=2*(y=.03*(S-2*E+D))+(g=.006*(3*(E-D)-S+I)),b=.3*(w-T)+m+.16666667*v,C=.3*(E-S)+y+.16666667*g,O=Math.sqrt(b*b+C*C),R[0]=O,N=1;N<8;N++)b+=A,C+=x,A+=v,x+=g,O+=Math.sqrt(b*b+C*C),R[N]=O;b+=A,C+=x,O+=Math.sqrt(b*b+C*C),R[8]=O,b+=A+v,C+=x+g,O+=Math.sqrt(b*b+C*C),R[9]=O,L=0}for(F*=O;;L++){var k=R[L];if(!(F>k)){var G;if(0===L)F/=k;else F=L+(F-(G=R[L-1]))/(k-G);break}}this.addCurvePosition(.1*F,T,S,w,E,M,D,B,I,a,H,i)}}else{var z=t.curveLengths;if(d=z[u-=l?1:2],n&&(f*=d),r)for(var U=0;Ud)continue}for(var j=0;;W++){var X=z[W];if(!(f>X)){if(0===W)j=f/X;else{var Y=z[W-1];j=(f-Y)/(X-Y)}break}}W!==_&&(_=W,l&&W===u?(this._computeVertices(c-4,4,0,h),this._computeVertices(0,4,4,h)):this._computeVertices(6*W+2,8,0,h)),this.addCurvePosition(j,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,l,h,c,u){if(0===t)return h[c]=e,h[c+1]=i,void(h[c+2]=0);if(1===t)return h[c]=o,h[c+1]=l,void(h[c+2]=0);var _=1-t,f=_*_,d=t*t,p=f*_,m=f*t*3,y=_*d*3,v=t*d,g=p*e+m*n+y*s+v*o,A=p*i+m*r+y*a+v*l;h[c]=g,h[c+1]=A,h[c+2]=u?Math.atan2(A-(p*i+m*r+y*a),g-(p*e+m*n+y*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD;for(var M=this.rotateMix,D=this.translateMix,B=(y=0,3);y0){var V=P.a,N=P.b,k=P.c,G=P.d,z=void 0,U=void 0,H=void 0;if(z=_?T[B-1]:Math.atan2(O,R),z-=Math.atan2(N,V),C){U=Math.cos(z),H=Math.sin(z);var W=I._boneData.length;w+=(W*(U*V-H*N)-R)*M,E+=(W*(H*V+U*N)-O)*M}else z+=S;z>t.Transform.PI?z-=t.Transform.PI_D:z<-t.Transform.PI&&(z+=t.Transform.PI_D),z*=M,U=Math.cos(z),H=Math.sin(z),P.a=U*V-H*N,P.b=H*V+U*N,P.c=U*k-H*G,P.d=H*k+U*G}I.global.fromMatrix(P)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i})(e);t.PathConstraint=r})(r||(r={})),(function(t){var e=(function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var i=0,n=0,r=this._animatebles.length;i0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&d._subFadeState>0)this._armature._dragonBones.bufferObject(d),this._animationStates.length=0,this._lastAnimationState=null;else{var i=d._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r0){var u=c[0];if(null!==u&&u.parent===this._armature.armatureData.defaultSkin){h._cachedFrameIndices=i.getSlotCachedFrameIndices(h.name);continue}}h._cachedFrameIndices=null}}d.advanceTime(t,n)}else if(e>1){for(var _=0,f=0;_0&&d._subFadeState>0?(f++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(f>0&&(this._animationStates[_-f]=d),d.advanceTime(t,0)),_===e-1&&f>0&&(this._animationStates.length-=f,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},i.prototype.reset=function(){for(var t=0,e=this._animationStates;t1?(e.position<0?(e.position%=n.duration,e.position=n.duration-e.position):e.position===n.duration?e.position-=1e-6:e.position>n.duration&&(e.position%=n.duration),e.duration>0&&e.position+e.duration>n.duration&&(e.duration=n.duration-e.position),e.playTimes<0&&(e.playTimes=n.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,n,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var l=!1,h=0,c=this._animationStates.length;hthis._animationStates[h].layer){l=!0,this._animationStates.splice(h,0,o);break}if(h!==c-1&&o.layer>this._animationStates[h+1].layer){l=!0,this._animationStates.splice(h+1,0,o);break}}l||this._animationStates.push(o)}else this._animationStates.push(o);for(var u=0,_=this._armature.getSlots();u<_.length;u++){var f=_[u].childArmature;null!==f&&f.inheritAnimation&&f.animation.hasAnimation(i)&&null===f.animation.getState(i)&&f.animation.fadeIn(i)}var d=!1;for(var p in n.animationTimelines){this._lockUpdate||(d=!0,this._lockUpdate=!0);var m=this.fadeIn(p,e.fadeInTime,1,o.layer,null,0);null!==m&&(m.resetToPose=!1,m._parent=o,m.stop())}return d&&(this._lockUpdate=!1),this._lockUpdate||(e.fadeInTime<=0&&this._armature.advanceTime(0),this._lastAnimationState=o),o},i.prototype.play=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=null!==t?t:"",null!==t&&t.length>0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),i.prototype.gotoAndPlay=function(t,e,i,n,r,s,a,o,l){void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=-1),void 0===r&&(r=0),void 0===s&&(s=null),void 0===a&&(a=3),void 0===o&&(o=!0),void 0===l&&(l=!0),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=a,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var h=this._animations[t];return h&&i>0&&(this._animationConfig.timeScale=h.duration/i),this.playConfig(this._animationConfig)},i.prototype.gotoAndStop=function(t,e){return void 0===e&&(e=0),console.warn("Deprecated."),this.gotoAndStopByTime(t,e)},Object.defineProperty(i.prototype,"animationList",{get:function(){return console.warn("Deprecated."),this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");for(var t=[],e=0,i=this._animationNames.length;e0;if(this._subFadeState<0){this._subFadeState=0;var n=i?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;if(this._armature.eventDispatcher.hasDBEventListener(n))(r=t.BaseObject.borrowObject(t.EventObject)).type=n,r.armature=this._armature,r.animationState=this,this._armature._dragonBones.bufferEvent(r)}if(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=i?0:1):this._fadeTime>0?this._fadeProgress=i?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=i?1:0,this._subFadeState>0){i||(this._playheadState|=1,this._fadeState=0);var r;n=i?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE;if(this._armature.eventDispatcher.hasDBEventListener(n))(r=t.BaseObject.borrowObject(t.EventObject)).type=n,r.armature=this._armature,r.animationState=this,this._armature._dragonBones.bufferEvent(r)}},s.prototype.init=function(e,i,n){if(null===this._armature){if(this._armature=e,this._animationData=i,this.resetToPose=n.resetToPose,this.additiveBlending=n.additiveBlending,this.displayControl=n.displayControl,this.actionEnabled=n.actionEnabled,this.layer=n.layer,this.playTimes=n.playTimes,this.timeScale=n.timeScale,this.fadeTotalTime=n.fadeInTime,this.autoFadeOutTime=n.autoFadeOutTime,this.weight=n.weight,this.name=n.name.length>0?n.name:n.animation,this.group=n.group,n.pauseFadeIn?this._playheadState=2:this._playheadState=3,n.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==n.position?this.timeScale>=0?this._time=n.position:this._time=n.position-this._duration:this._time=0):(this._position=n.position,this._duration=n.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),n.boneMask.length>0){this._boneMask.length=n.boneMask.length;for(var r=0,s=this._boneMask.length;r0,r=!0,s=!0,a=this._time;if(this._weightResult=this.weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult/this._parent._fadeProgress),this._actionTimeline.playState<=0&&this._actionTimeline.update(a),n){var o=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(a),n){var l=Math.floor(this._actionTimeline.currentTime*i);this._armature._cacheFrameIndex===l?(r=!1,s=!1):(this._armature._cacheFrameIndex=l,this._animationData.cachedFrames[l]?s=!1:this._animationData.cachedFrames[l]=!0)}if(r){if(s)for(var h=0,c=this._boneTimelines.length;h0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var f=0,d=this._poseTimelines;f0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},s.prototype.play=function(){this._playheadState=3},s.prototype.stop=function(){this._playheadState&=1},s.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var i=0,n=this._boneTimelines;i1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},s.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},s.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._armature.getBone(t);if(null!==i){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var n=0,r=this._armature.getBones();n=0&&this._boneMask.splice(i,1),e){var n=this._armature.getBone(t);if(null!==n){var r=this._armature.getBones();if(this._boneMask.length>0)for(var s=0,a=r;s=0&&n.contains(o)&&this._boneMask.splice(l,1)}else for(var h=0,c=r;h0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isPlaying",{get:function(){return 0!=(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration0&&e===this.playTimes-1&&t===this._duration&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var i=0,n=this._boneTimelines;i0))return 0;if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.leftWeight=0,0;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return t*=this.leftWeight,this.layerWeight+=t,this.blendWeight=t,2}return this.dirty=!0,this.layer=e,this.layerWeight=t,this.leftWeight=1,this.blendWeight=t,1},t.prototype.clear=function(){this.dirty=!1,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},t})();t.BlendState=r})(r||(r={})),(function(t){var e=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._onClear=function(){this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this._tweenState=0,this._frameRate=0,this._frameValueOffset=0,this._frameCount=0,this._frameOffset=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._dragonBonesData=null,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._frameIntArray=null,this._frameFloatArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,i=this.currentPlayTimes,n=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,s=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=s||t<=-s)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==i||this.currentTime!==n)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,i){this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState._animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._dragonBonesData=this._animationData.parent.parent,null!==this._timelineData&&(this._frameIntArray=this._dragonBonesData.frameIntArray,this._frameFloatArray=this._dragonBonesData.frameFloatArray,this._frameArray=this._dragonBonesData.frameArray,this._timelineArray=this._dragonBonesData.timelineArray,this._frameIndices=this._dragonBonesData.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1])},e.prototype.fadeOut=function(){},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());0!==this._tweenState&&this._onUpdateFrame()}},e})(t.BaseObject);t.TimelineState=e;var i=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e._getEasingValue=function(t,e,i){var n=e;switch(t){case 3:n=Math.pow(e,2);break;case 4:n=1-Math.pow(1-e,2);break;case 5:n=.5*(1-Math.cos(e*Math.PI))}return(n-e)*i+e},e._getEasingCurveValue=function(t,e,i,n){if(t<=0)return 0;if(t>=1)return 1;var r=i+1,s=Math.floor(t*r),a=0===s?0:e[n+s-1];return 1e-4*(a+((s===r-1?1e4:e[n+s])-a)*(t*r-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenProgress=0,this._tweenEasing=0},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes0?1/e:0}else this._tweenState=1},e.prototype._onUpdateFrame=function(){2===this._tweenState?(this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,2===this._tweenType?this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3):1!==this._tweenType&&(this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing))):this._tweenProgress=0},e})(e);t.TweenTimelineState=i;var r=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.bone=null,this.bonePose=null},e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight,i=this.bone.animationPose,n=this.bonePose.result;2===t?(i.x+=n.x*e,i.y+=n.y*e,i.rotation+=n.rotation*e,i.skew+=n.skew*e,i.scaleX+=(n.scaleX-1)*e,i.scaleY+=(n.scaleY-1)*e):1!==e?(i.x=n.x*e,i.y=n.y*e,i.rotation=n.rotation*e,i.skew=n.skew*e,i.scaleX=(n.scaleX-1)*e+1,i.scaleY=(n.scaleY-1)*e+1):(i.x=n.x,i.y=n.y,i.rotation=n.rotation,i.skew=n.skew,i.scaleX=n.scaleX,i.scaleY=n.scaleY),0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.bone._transformDirty=!0)},e})(i);t.BoneTimelineState=r;var s=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.slot=null},e})(i);t.SlotTimelineState=s;var a=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e})(i);t.ConstraintTimelineState=a})(r||(r={})),(function(t){var e=(function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return n(i,e),i.toString=function(){return"[class dragonBones.ActionTimelineState]"},i.prototype._onCrossFrame=function(e){var i=this._armature.eventDispatcher;if(this._animationState.actionEnabled)for(var n=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e],r=this._frameArray[n+1],s=this._animationData.parent.actions,a=0;a0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((h=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,h.armature=this._armature,h.animationState=this._animationState)),this._frameCount>1){var c=this._timelineData,u=Math.floor(this.currentTime*this._frameRate),_=this._frameIndices[c.frameIndicesOffset+u];if(this._frameIndex!==_){var f=this._frameIndex;if(this._frameIndex=_,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[c.offset+5+this._frameIndex],o){if(f<0){var d=Math.floor(r*this._frameRate);f=this._frameIndices[c.frameIndicesOffset+d],this.currentPlayTimes===n&&f===_&&(f=-1)}for(;f>=0;){var p=this._animationData.frameOffset+this._timelineArray[c.offset+5+f],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==l&&0===f&&(this._armature._dragonBones.bufferEvent(l),l=null),f>0?f--:f=this._frameCount-1,f===_)break}}else{if(f<0){d=Math.floor(r*this._frameRate);f=this._frameIndices[c.frameIndicesOffset+d];p=this._animationData.frameOffset+this._timelineArray[c.offset+5+f],m=this._frameArray[p]/this._frameRate;this.currentPlayTimes===n&&(r<=m?f>0?f--:f=this._frameCount-1:f===_&&(f=-1))}for(;f>=0;){f=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e})(t.TimelineState);t.ZOrderTimelineState=i;var r=(function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return n(i,e),i.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var t=this._animationData.frameFloatOffset+this._frameValueOffset+6*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[t++]*i,r.y=n[t++]*i,r.rotation=n[t++],r.skew=n[t++],r.scaleX=n[t++],r.scaleY=n[t++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(t=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[t++]*i-r.x,s.y=n[t++]*i-r.y,s.rotation=n[t++]-r.rotation,s.skew=n[t++]-r.skew,s.scaleX=n[t++]-r.scaleX,s.scaleY=n[t++]-r.scaleY):(s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0)}else{r=this.bonePose.current,s=this.bonePose.delta;r.x=0,r.y=0,r.rotation=0,r.skew=0,r.scaleX=1,r.scaleY=1,s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0}},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=t.x+i.x*this._tweenProgress,n.y=t.y+i.y*this._tweenProgress,n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress,n.scaleX=t.scaleX+i.scaleX*this._tweenProgress,n.scaleY=t.scaleY+i.scaleY*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i})(t.BoneTimelineState);t.BoneAllTimelineState=r;var s=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[e++]*i,r.y=n[e++]*i,2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[e++]*i-r.x,s.y=n[e++]*i-r.y):(s.x=0,s.y=0)}else{r=this.bonePose.current,s=this.bonePose.delta;r.x=0,r.y=0,s.x=0,s.y=0}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=e.x+i.x*this._tweenProgress,n.y=e.y+i.y*this._tweenProgress},e})(t.BoneTimelineState);t.BoneTranslateTimelineState=s;var a=(function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return n(i,e),i.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var i=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.rotation=n[i++],r.skew=n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1?(i=this._animationData.frameFloatOffset+this._frameValueOffset,s.rotation=t.Transform.normalizeRadian(n[i++]-r.rotation)):s.rotation=n[i++]-r.rotation,s.skew=n[i++]-r.skew):(s.rotation=0,s.skew=0)}else{r=this.bonePose.current,s=this.bonePose.delta;r.rotation=0,r.skew=0,s.rotation=0,s.skew=0}},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i})(t.BoneTimelineState);t.BoneRotateTimelineState=a;var o=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._frameFloatArray,n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=i[e++],n.scaleY=i[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),r.scaleX=i[e++]-n.scaleX,r.scaleY=i[e++]-n.scaleY):(r.scaleX=0,r.scaleY=0)}else{n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=1,n.scaleY=1,r.scaleX=0,r.scaleY=0}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.scaleX=e.scaleX+i.scaleX*this._tweenProgress,n.scaleY=e.scaleY+i.scaleY*this._tweenProgress},e})(t.BoneTimelineState);t.BoneScaleTimelineState=o;var l=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.surface=null,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0){var t=null!==this._timelineData?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;this.slot.displayIndex!==t&&this.slot._setDisplayIndex(t,!0)}},e})(t.SlotTimelineState);t.SlotDislayTimelineState=h;var c=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._delta=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return n(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dirty=!1},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._dragonBonesData.intArray,i=this._frameIntArray,n=this._animationData.frameIntOffset+this._frameValueOffset+1*this._frameIndex,r=i[n];r<0&&(r+=65536),this._current[0]=e[r++],this._current[1]=e[r++],this._current[2]=e[r++],this._current[3]=e[r++],this._current[4]=e[r++],this._current[5]=e[r++],this._current[6]=e[r++],this._current[7]=e[r++],2===this._tweenState&&((r=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[n+1])<0&&(r+=65536),this._delta[0]=e[r++]-this._current[0],this._delta[1]=e[r++]-this._current[1],this._delta[2]=e[r++]-this._current[2],this._delta[3]=e[r++]-this._current[3],this._delta[4]=e[r++]-this._current[4],this._delta[5]=e[r++]-this._current[5],this._delta[6]=e[r++]-this._current[6],this._delta[7]=e[r++]-this._current[7])}else{var s=this.slot._slotData.color;this._current[0]=100*s.alphaMultiplier,this._current[1]=100*s.redMultiplier,this._current[2]=100*s.greenMultiplier,this._current[3]=100*s.blueMultiplier,this._current[4]=s.alphaOffset,this._current[5]=s.redOffset,this._current[6]=s.greenOffset,this._current[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0),this._result[0]=.01*(this._current[0]+this._delta[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._delta[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._delta[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._delta[3]*this._tweenProgress),this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress,this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress,this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress,this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty){var i=this.slot._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){var n=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*n,i.redMultiplier+=(this._result[1]-i.redMultiplier)*n,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*n,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*n,i.alphaOffset+=(this._result[4]-i.alphaOffset)*n,i.redOffset+=(this._result[5]-i.redOffset)*n,i.greenOffset+=(this._result[6]-i.greenOffset)*n,i.blueOffset+=(this._result[7]-i.blueOffset)*n,this.slot._colorDirty=!0}}else this._dirty&&(this._dirty=!1,i.alphaMultiplier===this._result[0]&&i.redMultiplier===this._result[1]&&i.greenMultiplier===this._result[2]&&i.blueMultiplier===this._result[3]&&i.alphaOffset===this._result[4]&&i.redOffset===this._result[5]&&i.greenOffset===this._result[6]&&i.blueOffset===this._result[7]||(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],this.slot._colorDirty=!0))}},e})(t.SlotTimelineState);t.SlotColorTimelineState=c;var u=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return n(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.vertexOffset=0,this._dirty=!1,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0&&(this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress),this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress},e.prototype.blend=function(t){var e=this.animationState,i=e._blendState.blendWeight;2===t?(e.weight+=this._floats[5]*i,e.currentTime+=this._floats[2]*i):(e.weight=this._floats[5]*i,e.currentTime=this._floats[2]*i)},e})(t.TweenTimelineState);t.AnimationTimelineState=f})(r||(r={})),(function(t){var e=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.actionDataToInstance=function(t,i,n){0===t.type?i.type=e.FRAME_EVENT:i.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,i.name=t.name,i.armature=n,i.actionData=t,i.data=t.data,null!==t.bone&&(i.bone=n.getBone(t.bone.name)),null!==t.slot&&(i.slot=n.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e})(t.BaseObject);t.EventObject=e})(r||(r={})),(function(t){var e=(function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13;default:return 0}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}},e.parseDragonBonesData=function(e){return console.warn("Deprecated."),e instanceof ArrayBuffer?t.BinaryDataParser.getInstance().parseDragonBonesData(e):t.ObjectDataParser.getInstance().parseDragonBonesData(e)},e.parseTextureAtlasData=function(i,n){void 0===n&&(n=1),console.warn("\u5df2\u5e9f\u5f03");for(var r={},s=i[e.SUB_TEXTURE],a=0,o=s.length;a255)return encodeURI(r);return r}return String(r)}return n},r.prototype._getCurvePoint=function(t,e,i,n,r,s,a,o,l,h){var c=1-l,u=c*c,_=l*l,f=c*u,d=3*l*u,p=3*c*_,m=l*_;h.x=f*t+d*i+p*r+m*a,h.y=f*e+d*n+p*s+m*o},r.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r=0&&n+61e-4;){var v=.5*(y+m);this._getCurvePoint(l,h,c,u,_,f,d,p,v,this._helpPoint),a-this._helpPoint.x>0?m=v:y=v}e[r]=this._helpPoint.y}},r.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},r.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,l=this._parseActionData(e,r,s,a),h=0,c=null,u=0,_=l;u<_.length;u++){var f=_[u];this._armature.addAction(f,!1)}0===this._actionFrames.length&&((c=new i).frameStart=0,this._actionFrames.push(c),c=null);for(var d=0,p=this._actionFrames;dn)break;h++}null===c&&((c=new i).frameStart=n,this._actionFrames.splice(h+1,0,c));for(var y=0;y0){var f=n.getBone(u);null!==f?_.parent=f:(u in this._cacheBones||(this._cacheBones[u]=[]),this._cacheBones[u].push(_))}if(_.name in this._cacheBones){for(var d=0,p=this._cacheBones[_.name];d0&&null!==i.parent?(s.root=i.parent,s.bone=i):(s.root=i,s.bone=null),s},r.prototype._parsePathConstraint=function(e){var i=this._armature.getSlot(r._getString(e,t.DataParser.TARGET,""));if(null===i)return null;var n=this._armature.defaultSkin;if(null===n)return null;var s=n.getDisplay(i.name,r._getString(e,t.DataParser.TARGET_DISPLAY,i.name));if(null===s||!(s instanceof t.PathDisplayData))return null;var a=e[t.DataParser.BONES];if(null===a||0===a.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=r._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=i,o.pathDisplayData=s,o.target=i.parent,o.positionMode=t.DataParser._getPositionMode(r._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(r._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(r._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=r._getNumber(e,t.DataParser.POSITION,0),o.spacing=r._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=r._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=r._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=r._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var l=0,h=a;l0?n:i,this._parsePivot(e,o);break;case 1:var l=a=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(l.name=i,l.path=n.length>0?n:i,l.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var h=0,c=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);h0?n:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var y=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);y.name=i,y.path=n.length>0?n:i,y.boundingBox=m}break;case 4:var v=e[t.DataParser.LENGTHS],g=a=t.BaseObject.borrowObject(t.PathDisplayData);g.closed=r._getBoolean(e,t.DataParser.CLOSED,!1),g.constantSpeed=r._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),g.name=i,g.path=n.length>0?n:i,g.vertices.data=this._data,g.curveLengths.length=v.length;for(var A=0,x=v.length;Ai.width&&(i.width=l),hi.height&&(i.height=h))}i.width-=i.x,i.height-=i.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return i},r.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);if(i.frameCount=Math.max(r._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=r._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=r._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=r._getNumber(e,t.DataParser.SCALE,1),i.name=r._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),i.frameIntOffset=this._frameIntArray.length,i.frameFloatOffset=this._frameFloatArray.length,i.frameOffset=this._frameArray.length,this._animation=i,t.DataParser.FRAME in e){var n=e[t.DataParser.FRAME],s=n.length;if(s>0)for(var a=0,o=0;a0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,!1,!1,0,this._parseActionFrame),this._actionFrames.length=0),this._animation=null,i},r.prototype._parseTimeline=function(e,n,s,a,o,l,h,c){if(null!==e&&s.length>0&&s in e&&(n=e[s]),null===n)return null;var u=n.length;if(0===u)return null;var _=this._frameIntArray.length,f=this._frameFloatArray.length,d=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+u,null!==e?(this._timelineArray[p+0]=Math.round(100*r._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*r._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=u,this._timelineArray[p+3]=h,this._timelineArray[p+4]=o?_-this._animation.frameIntOffset:l?f-this._animation.frameFloatOffset:0,this._timeline=d,d.type=a,d.offset=p,1===u)d.frameIndicesOffset=-1,this._timelineArray[p+5+0]=c.call(this,n[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,y=this._data.frameIndices,v=0;t.DragonBones.webAssembly?(v=y.size(),y.resize(v+m,0)):(v=y.length,y.length+=m),d.frameIndicesOffset=v;for(var g=0,A=0,x=0,b=0;g0)if(t.DataParser.CURVE in e){var a=n+1;this._helpArray.length=a,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=a;for(var o=0;o0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),l=new Array(a),h=0;h0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=r._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,n),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),a},r.prototype._parseBoneTranslateFrame=function(e,i,n){var s=this._parseTweenFrame(e,i,n),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=r._getNumber(e,t.DataParser.X,0),this._frameFloatArray[a++]=r._getNumber(e,t.DataParser.Y,0),s},r.prototype._parseBoneRotateFrame=function(e,i,n){var s=r._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=r._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,n),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=r._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,a},r.prototype._parseBoneScaleFrame=function(e,i,n){var s=this._parseTweenFrame(e,i,n),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=r._getNumber(e,t.DataParser.X,1),this._frameFloatArray[a++]=r._getNumber(e,t.DataParser.Y,1),s},r.prototype._parseSurfaceFrame=function(e,i,n){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,n),o=e[t.DataParser.VERTICES],l=r._getNumber(e,t.DataParser.OFFSET,0),h=this._surface.vertices.length/2,c=0,u=0;this._frameFloatArray.length+=2*h;for(var _=0;_<2*h;_+=2)c=_=o.length?0:o[_-l],u=_+1=o.length?0:o[_+1-l],this._frameFloatArray[s+_]=c,this._frameFloatArray[s+_+1]=u;if(0===i){var f=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[f+0]=0,this._frameIntArray[f+1]=this._frameFloatArray.length-s,this._frameIntArray[f+2]=this._frameFloatArray.length-s,this._frameIntArray[f+3]=0,this._frameIntArray[f+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=f-this._animation.frameIntOffset}return a},r.prototype._parseSlotDisplayFrame=function(e,i,n){var s=this._parseFrame(e,i,n);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[s+1]=r._getNumber(e,t.DataParser.VALUE,0):this._frameArray[s+1]=r._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,i,this._slot.parent,this._slot),s},r.prototype._parseSlotColorFrame=function(e,i,n){var r=this._parseTweenFrame(e,i,n),s=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var a=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in a){this._parseColorTransform(a,this._helpColorTransform),s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.redMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._intArray[s++]=Math.round(this._helpColorTransform.alphaOffset),this._intArray[s++]=Math.round(this._helpColorTransform.redOffset),this._intArray[s++]=Math.round(this._helpColorTransform.greenOffset),this._intArray[s++]=Math.round(this._helpColorTransform.blueOffset),s-=8;break}}s<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0),s=this._defaultColorOffset);var l=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[l]=s,r},r.prototype._parseSlotFFDFrame=function(e,i,n){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,n),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,l=r._getNumber(e,t.DataParser.OFFSET,0),h=this._intArray[this._mesh.vertices.offset+0],c=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,u=this._mesh.vertices.weight,_=0,f=0,d=0,p=0;if(null!==u){var m=this._weightSlotPose[c];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*u.count,d=u.offset+2+u.bones.length}else this._frameFloatArray.length+=2*h;for(var y=0;y<2*h;y+=2)if(null===o?(_=0,f=0):(_=y=o.length?0:o[y-l],f=y+1=o.length?0:o[y+1-l]),null!==u){var v=this._weightBonePoses[c],g=this._intArray[d++];this._helpMatrixA.transformPoint(_,f,this._helpPoint,!0),_=this._helpPoint.x,f=this._helpPoint.y;for(var A=0;A=0||t.DataParser.DATA_VERSIONS.indexOf(s)>=0){var a=t.BaseObject.borrowObject(t.DragonBonesData);if(a.version=n,a.name=r._getString(e,t.DataParser.NAME,""),a.frameRate=r._getNumber(e,t.DataParser.FRAME_RATE,24),0===a.frameRate&&(a.frameRate=24),t.DataParser.ARMATURE in e){this._data=a,this._parseArray(e);for(var o=0,l=e[t.DataParser.ARMATURE];o0&&(a.stage=a.getArmature(a.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),a}return console.assert(!1,"Nonsupport data version: "+n+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},r.prototype.parseTextureAtlasData=function(e,i,n){if(void 0===n&&(n=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var s=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(s,i,n),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(i.width=r._getNumber(e,t.DataParser.WIDTH,0),i.height=r._getNumber(e,t.DataParser.HEIGHT,0),i.scale=1===n?1/r._getNumber(e,t.DataParser.SCALE,1):n,i.name=r._getString(e,t.DataParser.NAME,""),i.imagePath=r._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var a=e[t.DataParser.SUB_TEXTURE],o=0,l=a.length;o0&&_>0&&(c.frame=t.TextureData.createRectangle(),c.frame.x=r._getNumber(h,t.DataParser.FRAME_X,0),c.frame.y=r._getNumber(h,t.DataParser.FRAME_Y,0),c.frame.width=u,c.frame.height=_),i.addTexture(c)}return!0},r.getInstance=function(){return null===r._objectDataParserInstance&&(r._objectDataParserInstance=new r),r._objectDataParserInstance},r._objectDataParserInstance=null,r})(t.DataParser);t.ObjectDataParser=e;var i=(function(){return function(){this.frameStart=0,this.actions=[]}})();t.ActionFrame=i})(r||(r={})),(function(t){var e=(function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return n(i,e),i.prototype._inRange=function(t,e,i){return e<=t&&t<=i},i.prototype._decodeUTF8=function(t){for(var e,i=0,n="",r=0,s=0,a=0,o=0;t.length>i;){var l=t[i++];if(-1===l)e=0!==s?65533:-1;else if(0===s)this._inRange(l,0,127)?e=l:(this._inRange(l,194,223)?(s=1,o=128,r=l-192):this._inRange(l,224,239)?(s=2,o=2048,r=l-224):this._inRange(l,240,244)&&(s=3,o=65536,r=l-240),r*=Math.pow(64,s),e=null);else if(this._inRange(l,128,191))if(a+=1,r+=(l-128)*Math.pow(64,s-a),a!==s)e=null;else{var h=r,c=o;r=0,s=0,a=0,o=0,e=this._inRange(h,c,1114111)&&!this._inRange(h,55296,57343)?h:l}else r=0,s=0,a=0,o=0,i--,e=l;null!==e&&-1!==e&&(e<=65535?e>0&&(n+=String.fromCharCode(e)):(e-=65536,n+=String.fromCharCode(55296+(e>>10&1023)),n+=String.fromCharCode(56320+(1023&e))))}return n},i.prototype._getUTF16Key=function(t){for(var e=0,i=t.length;e255)return encodeURI(t);return t},i.prototype._parseBinaryTimeline=function(e,i,n){void 0===n&&(n=null);var r=null!==n?n:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=i,this._timeline=r;var s=this._timelineArrayBuffer[r.offset+2];if(1===s)r.frameIndicesOffset=-1;else{var a=0,o=this._animation.frameCount+1,l=this._data.frameIndices;t.DragonBones.webAssembly?(a=l.size(),l.resize(a+o,0)):(a=l.length,l.length+=o),r.frameIndicesOffset=a;for(var h=0,c=0,u=0,_=0;h=0){var r=t.BaseObject.borrowObject(t.WeightData),s=this._intArrayBuffer[i.offset+0],a=this._intArrayBuffer[n+0];r.offset=n;for(var o=0;o0&&e in this._dragonBonesDataMap&&(a=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===a&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[o],(0===e.length||s.autoSearch)&&null!==(a=s.getArmature(i))){e=o;break}if(null!==a){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=a,t.skin=null,n.length>0&&(t.skin=a.getSkin(n),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var l=this._dragonBonesDataMap[o].getArmature(n);if(null!==l){t.skin=l.defaultSkin;break}}return null===t.skin&&(t.skin=a.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,i){for(var n=0,r=e.armature.sortedBones;n0&&(o.texture=this._getTextureData(e.textureAtlasName,i.path)),null===o.texture&&(o.texture=this._getTextureData(s,i.path)),a=null!==n&&2===n.type&&this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 2:var l=i;null!==e&&e.textureAtlasName.length>0&&(l.texture=this._getTextureData(e.textureAtlasName,l.path)),null===l.texture&&(l.texture=this._getTextureData(s,l.path)),a=this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 1:var h=i,c=this._buildChildArmature(e,r,i);if(null!==c){if(c.inheritAnimation=h.inheritAnimation,!c.inheritAnimation){var u=h.actions.length>0?h.actions:c.armatureData.defaultActions;if(u.length>0)for(var _=0,f=u;_=0)){var c=i.getDisplays(h.name);if(c||(null!==a&&i!==a&&(c=a.getDisplays(h.name)),c)){var u=t.DragonBones.webAssembly?c.size():c.length,_=h.displayList;_.length=u;for(var f=0,d=u;f>>0)+(M<<16)+(E<<8)+w}var j=(function(t){function e(){return t.apply(this,arguments)||this}a(e,t);var i=e.prototype;return i.updateRenderData=function(t,e){},i.realTimeTraverse=function(t,e,i){for(var n,s,a,o,l,h,c,u,_,y,w=t._slots,E=0,M=w.length;E>2,h=u._indices,b=h.length,y=d.request(x,b),g=y.indiceOffset,v=y.byteOffset>>2,A=y.vertexOffset,n=d._vData,s=d._iData,a=d._uintVData,I=_[0],P=_[4],R=_[12],O=_[1],L=_[5],F=_[13];for(var D=0,B=l.length;D>2,n=d._vData,r=d._iData,s=d._uintVData;for(var U=g,j=g+b;U=N&&(W(V=D[M++],1),N=V.vfOffset),s[K]=S}}}},i.fillBuffers=function(t,e){t.node._renderFlag|=N.FLAG_UPDATE_RENDER_DATA;var i=t._armature;if(i){f=!0,u=t.premultipliedAlpha,p=t.node,d=e._meshBuffer,m=e,y=t,B=0;var n=p._color;o=n.r/255,l=n.g/255,h=n.b/255,c=n.a/255,4294967295!==n._val&&(B|=1);var r=void 0;if(y.enableBatch&&(r=p._worldMatrix,f=!1,B|=16),t.isAnimationCached())this.cacheTraverse(t._curFrame,r);else{this.realTimeTraverse(i,r,1);var s=t._debugDraw;if(t.debugBones&&s){s.clear(),s.lineWidth=5,s.strokeColor=G,s.fillColor=z;for(var a=i.getBones(),_=0,v=a.length;_":0}),_=cc.Enum({REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2});sp.Skeleton=cc.Class({name:"sp.Skeleton",extends:r,editor:!1,statics:{AnimationCacheMode:_},properties:{paused:{default:!1,visible:!1},skeletonData:{default:null,type:sp.SkeletonData,notify:function(){this.defaultSkin="",this.defaultAnimation="",this._updateSkeletonData()},tooltip:!1},defaultSkin:{default:"",visible:!1},defaultAnimation:{default:"",visible:!1},animation:{get:function(){if(this.isAnimationCached())return this._animationName;var t=this.getCurrent(0);return t&&t.animation.name||""},set:function(t){this.defaultAnimation=t,t?this.setAnimation(0,t,this.loop):this.isAnimationCached()||(this.clearTrack(0),this.setToSetupPose())},visible:!1},_defaultSkinIndex:{get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),!e)return cc.errorID("",this.name);var i=e[t];void 0!==i?(this.defaultSkin=i,this.setSkin(this.defaultSkin)):cc.errorID(7501,this.name)},type:c,visible:!0,displayName:"Default Skin",tooltip:!1},_animationIndex:{get:function(){var t=this.animation;if(this.skeletonData&&t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}return 0},set:function(t){if(0!==t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),!e)return cc.errorID(7502,this.name);var i=e[t];void 0!==i?this.animation=i:cc.errorID(7503,this.name)}else this.animation=""},type:u,visible:!0,displayName:"Animation",tooltip:!1},_preCacheMode:-1,_cacheMode:_.REALTIME,_defaultCacheMode:{default:0,type:_,notify:function(){this.setAnimationCacheMode(this._defaultCacheMode)},editorOnly:!0,visible:!0,animatable:!1,displayName:"Animation Cache Mode",tooltip:!1},loop:{default:!0,tooltip:!1},premultipliedAlpha:{default:!0,tooltip:!1},timeScale:{default:1,tooltip:!1},debugSlots:{default:!1,editorOnly:!0,tooltip:!1,notify:function(){this._updateDebugDraw()}},debugBones:{default:!1,editorOnly:!0,tooltip:!1,notify:function(){this._updateDebugDraw()}},debugMesh:{default:!1,editorOnly:!0,tooltip:!1,notify:function(){this._updateDebugDraw()}},useTint:{default:!1,tooltip:!1,notify:function(){this._updateUseTint()}},enableBatch:{default:!1,notify:function(){this._updateBatch()},tooltip:!1},_accTime:0,_playCount:0,_frameCache:null,_curFrame:null,_skeletonCache:null,_animationName:"",_animationQueue:[],_headAniInfo:null,_playTimes:0,_isAniComplete:!0},ctor:function(){this._effectDelegate=null,this._skeleton=null,this._rootBone=null,this._listener=null,this._materialCache={},this._debugRenderer=null,this._startSlotIndex=-1,this._endSlotIndex=-1,this._startEntry={animation:{name:""},trackIndex:0},this._endEntry={animation:{name:""},trackIndex:0},this.attachUtil=new h},_getDefaultMaterial:function(){return cc.Material.getBuiltinMaterial("2d-spine")},_updateMaterial:function(){var t=this.useTint||this.isAnimationCached()&&!0,e=this.getMaterial(0);e&&(e.define("USE_TINT",t),e.define("CC_USE_MODEL",!this.enableBatch)),this._materialCache={}},disableRender:function(){this._super(),this.node._renderFlag&=~o},markForRender:function(t){this._super(t),t?this.node._renderFlag|=o:this.node._renderFlag&=~o},_updateUseTint:function(){var t=this.getMaterial(0);if(t){var e=this.useTint||this.isAnimationCached()&&!0;t.define("USE_TINT",e)}this._materialCache={}},_updateBatch:function(){var t=this.getMaterial(0);t&&t.define("CC_USE_MODEL",!this.enableBatch),this._materialCache={}},_validateRender:function(){var t=this.skeletonData;t&&t.isTexturesLoaded()?this._super():this.disableRender()},setSkeletonData:function(t){if(null!=t.width&&null!=t.height&&this.node.setContentSize(t.width,t.height),this._cacheMode===_.SHARED_CACHE?this._skeletonCache=l.sharedCache:this._cacheMode===_.PRIVATE_CACHE&&(this._skeletonCache=new l,this._skeletonCache.enablePrivateMode()),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&cc.warn("Debug bones or slots is invalid in cached mode");var e=this._skeletonCache.getSkeletonCache(this.skeletonData._uuid,t);this._skeleton=e.skeleton,this._clipper=e.clipper,this._rootBone=this._skeleton.getRootBone()}else this._skeleton=new s.Skeleton(t),this._clipper=new s.SkeletonClipping,this._rootBone=this._skeleton.getRootBone();this.markForRender(!0)},setSlotsRange:function(t,e){this.isAnimationCached()?cc.warn("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},setAnimationStateData:function(t){if(this.isAnimationCached())cc.warn("'setAnimationStateData' interface can not be invoked in cached mode.");else{var e=new s.AnimationState(t);this._listener&&(this._state&&this._state.removeListener(this._listener),e.addListener(this._listener)),this._state=e}},__preload:function(){this._super();for(var t=this.node.children,e=0,i=t.length;ethis._headAniInfo.delay){var n=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,n.animationName,n.loop)}return}this._updateCache(t)}else this._updateRealtime(t)},_emitCacheCompleteEvent:function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},_updateCache:function(t){var e=this._frameCache;if(e.isInited()){var i=e.frames,n=l.FrameTime;0==this._accTime&&0==this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r]}},_updateRealtime:function(t){var e=this._skeleton,i=this._state;e&&(e.update(t),i&&(i.update(t),i.apply(e)))},setVertexEffectDelegate:function(t){this._effectDelegate=t},updateWorldTransform:function(){this.isAnimationCached()&&this._skeleton&&this._skeleton.updateWorldTransform()},setToSetupPose:function(){this._skeleton&&this._skeleton.setToSetupPose()},setBonesToSetupPose:function(){this._skeleton&&this._skeleton.setBonesToSetupPose()},setSlotsToSetupPose:function(){this._skeleton&&this._skeleton.setSlotsToSetupPose()},updateAnimationCache:function(t){if(this.isAnimationCached()){var e=this.skeletonData._uuid;this._skeletonCache&&this._skeletonCache.updateAnimationCache(e,t)}},invalidAnimationCache:function(){this.isAnimationCached()&&this._skeletonCache&&this._skeletonCache.invalidAnimationCache(this.skeletonData._uuid)},findBone:function(t){return this._skeleton?this._skeleton.findBone(t):null},findSlot:function(t){return this._skeleton?this._skeleton.findSlot(t):null},setSkin:function(t){this._skeleton&&(this._skeleton.setSkinByName(t),this._skeleton.setSlotsToSetupPose()),this.invalidAnimationCache()},getAttachment:function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},setAttachment:function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},getTextureAtlas:function(t){return t.region},setMix:function(t,e,i){this._state&&this._state.data.setMix(t,e,i)},setAnimation:function(t,e,i){if(this._playTimes=i?0:1,this._animationName=e,this.isAnimationCached()){if(0!==t&&cc.warn("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var n=this._skeletonCache.getAnimationCache(this.skeletonData._uuid,e);n||(n=this._skeletonCache.initAnimationCache(this.skeletonData._uuid,e)),n&&(this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._frameCache=n,this.attachUtil._hasAttachedNode()&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._curFrame=this._frameCache.frames[0])}else if(this._skeleton){var r=this._skeleton.data.findAnimation(e);if(!r)return cc.logID(7509,e),null;var s=this._state.setAnimationWith(t,r,i);return this._state.apply(this._skeleton),s}return null},addAnimation:function(t,e,i,n){if(n=n||0,this.isAnimationCached())0!==t&&cc.warn("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n});else if(this._skeleton){var r=this._skeleton.data.findAnimation(e);return r?this._state.addAnimationWith(t,r,i,n):(cc.logID(7510,e),null)}return null},findAnimation:function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},getCurrent:function(t){if(this.isAnimationCached())cc.warn("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},clearTracks:function(){this.isAnimationCached()?cc.warn("'clearTracks' interface can not be invoked in cached mode."):this._state&&this._state.clearTracks()},clearTrack:function(t){this.isAnimationCached()?cc.warn("'clearTrack' interface can not be invoked in cached mode."):this._state&&this._state.clearTrack(t)},setStartListener:function(t){this._ensureListener(),this._listener.start=t},setInterruptListener:function(t){this._ensureListener(),this._listener.interrupt=t},setEndListener:function(t){this._ensureListener(),this._listener.end=t},setDisposeListener:function(t){this._ensureListener(),this._listener.dispose=t},setCompleteListener:function(t){this._ensureListener(),this._listener.complete=t},setEventListener:function(t){this._ensureListener(),this._listener.event=t},setTrackStartListener:function(t,e){n.getListeners(t).start=e},setTrackInterruptListener:function(t,e){n.getListeners(t).interrupt=e},setTrackEndListener:function(t,e){n.getListeners(t).end=e},setTrackDisposeListener:function(t,e){n.getListeners(t).dispose=e},setTrackCompleteListener:function(t,e){n.getListeners(t).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},setTrackEventListener:function(t,e){n.getListeners(t).event=e},getState:function(){return this._state},_updateAnimEnum:!1,_updateSkinEnum:!1,_ensureListener:function(){this._listener||(this._listener=new n,this._state&&this._state.addListener(this._listener))},_updateSkeletonData:function(){if(this.skeletonData){var t=this.skeletonData.getRuntimeData();if(t){try{this.setSkeletonData(t),this.isAnimationCached()||this.setAnimationStateData(new s.AnimationStateData(this._skeleton.data)),this.defaultSkin&&this.setSkin(this.defaultSkin)}catch(t){cc.warn(t)}this.attachUtil.init(this),this.attachUtil._associateAttachedNode(),this._preCacheMode=this._cacheMode,this.animation=this.defaultAnimation}else this.disableRender()}else this.disableRender()},_refreshInspector:function(){this._updateAnimEnum(),this._updateSkinEnum(),Editor.Utils.refreshSelectedInspector("node",this.node.uuid)},_updateDebugDraw:function(){if(this.debugBones||this.debugSlots){if(!this._debugRenderer){var t=new cc.PrivateNode;t.name="DEBUG_DRAW_NODE";var e=t.addComponent(a);e.lineWidth=1,e.strokeColor=cc.color(255,0,0,255),this._debugRenderer=e}this._debugRenderer.node.parent=this.node,this.isAnimationCached()&&cc.warn("Debug bones or slots is invalid in cached mode")}else this._debugRenderer&&(this._debugRenderer.node.parent=null)}}),e.exports=sp.Skeleton}),{"../../cocos2d/core/components/CCRenderComponent":110,"../../cocos2d/core/graphics/graphics":151,"../../cocos2d/core/renderer/render-flow":242,"./AttachUtil":395,"./lib/spine":398,"./skeleton-cache":399,"./track-entry-listeners":403}],397:[(function(t,e,i){"use strict";var n="undefined"==typeof window?global:window,r=!0;n.spine=t("./lib/spine"),r&&(n.sp={},sp._timeScale=1,Object.defineProperty(sp,"timeScale",{get:function(){return this._timeScale},set:function(t){this._timeScale=t},configurable:!0}),sp.ATTACHMENT_TYPE={REGION:0,BOUNDING_BOX:1,MESH:2,SKINNED_MESH:3},sp.AnimationEventType=cc.Enum({START:0,INTERRUPT:1,END:2,DISPOSE:3,COMPLETE:4,EVENT:5}),sp.spine=n.spine,t("./skeleton-texture"),t("./skeleton-data"),t("./vertex-effect-delegate"),t("./Skeleton"),t("./spine-assembler"))}),{"./Skeleton":396,"./lib/spine":398,"./skeleton-data":400,"./skeleton-texture":401,"./spine-assembler":402,"./vertex-effect-delegate":404}],398:[(function(t,e,i){"use strict";var n,r=(function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}})();(function(t){var e,i,n,s=(function(){function t(t,e,i){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n0&&(e%=this.duration));for(var l=this.timelines,h=0,c=l.length;h>>1;;){if(t[(s+1)*i]<=e?n=s+1:r=s,n==r)return(n+1)*i;s=n+r>>>1}},t.linearSearch=function(t,e,i){for(var n=0,r=t.length-i;n<=r;n+=i)if(t[n]>e)return n;return-1},t})();t.Animation=s,(function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"})(e=t.MixBlend||(t.MixBlend={})),(function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"})(i=t.MixDirection||(t.MixDirection={})),(function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"})(n=t.TimelineType||(t.TimelineType={}));var a=(function(){function e(i){if(i<=0)throw new Error("frameCount must be > 0: "+i);this.curves=t.Utils.newFloatArray((i-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var i=t*e.BEZIER_SIZE;if(i==this.curves.length)return e.LINEAR;var n=this.curves[i];return n==e.LINEAR?e.LINEAR:n==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,i,n,r,s){var a=.03*(2*-i+r),o=.03*(2*-n+s),l=.006*(3*(i-r)+1),h=.006*(3*(n-s)+1),c=2*a+l,u=2*o+h,_=.3*i+a+.16666667*l,f=.3*n+o+.16666667*h,d=t*e.BEZIER_SIZE,p=this.curves;p[d++]=e.BEZIER;for(var m=_,y=f,v=d+e.BEZIER_SIZE-1;d=n){var c=void 0,u=void 0;return s==l?(c=0,u=0):(c=r[s-2],u=r[s-1]),u+(r[s+1]-u)*(n-c)/(o-c)}var _=r[s-1];return _+(1-_)*(n-o)/(1-o)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e})();t.CurveTimeline=a;var o=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e<<1),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.rotate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+a.ROTATION]=i},a.prototype.apply=function(t,i,n,r,o,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=c[c.length-a.ENTRIES]){var f=c[c.length+a.PREV_ROTATION];switch(l){case e.setup:u.rotation=u.data.rotation+f*o;break;case e.first:case e.replace:f+=u.data.rotation-u.rotation,f-=360*(16384-(16384.499999999996-f/360|0));case e.add:u.rotation+=f*o}}else{var d=s.binarySearch(c,n,a.ENTRIES),p=c[d+a.PREV_ROTATION],m=c[d],y=this.getCurvePercent((d>>1)-1,1-(n-m)/(c[d+a.PREV_TIME]-m)),v=c[d+a.ROTATION]-p;switch(v=p+(v-360*(16384-(16384.499999999996-v/360|0)))*y,l){case e.setup:u.rotation=u.data.rotation+(v-360*(16384-(16384.499999999996-v/360|0)))*o;break;case e.first:case e.replace:v+=u.data.rotation-u.rotation;case e.add:u.rotation+=(v-360*(16384-(16384.499999999996-v/360|0)))*o}}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_ROTATION=-1,a.ROTATION=1,a})(a);t.RotateTimeline=o;var l=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.translate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,i,n){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.X]=i,this.frames[t+a.Y]=n},a.prototype.apply=function(t,i,n,r,o,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=c[c.length-a.ENTRIES])_=c[c.length+a.PREV_X],f=c[c.length+a.PREV_Y];else{var d=s.binarySearch(c,n,a.ENTRIES);_=c[d+a.PREV_X],f=c[d+a.PREV_Y];var p=c[d],m=this.getCurvePercent(d/a.ENTRIES-1,1-(n-p)/(c[d+a.PREV_TIME]-p));_+=(c[d+a.X]-_)*m,f+=(c[d+a.Y]-f)*m}switch(l){case e.setup:u.x=u.data.x+_*o,u.y=u.data.y+f*o;break;case e.first:case e.replace:u.x+=(u.data.x+_-u.x)*o,u.y+=(u.data.y+f-u.y)*o;break;case e.add:u.x+=_*o,u.y+=f*o}}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_X=-2,a.PREV_Y=-1,a.X=1,a.Y=2,a})(a);t.TranslateTimeline=l;var h=(function(a){function o(t){return a.call(this,t)||this}return r(o,a),o.prototype.getPropertyId=function(){return(n.scale<<24)+this.boneIndex},o.prototype.apply=function(n,r,a,l,h,c,u){var _=this.frames,f=n.bones[this.boneIndex];if(f.active)if(a<_[0])switch(c){case e.setup:return f.scaleX=f.data.scaleX,void(f.scaleY=f.data.scaleY);case e.first:f.scaleX+=(f.data.scaleX-f.scaleX)*h,f.scaleY+=(f.data.scaleY-f.scaleY)*h}else{var d=0,p=0;if(a>=_[_.length-o.ENTRIES])d=_[_.length+o.PREV_X]*f.data.scaleX,p=_[_.length+o.PREV_Y]*f.data.scaleY;else{var m=s.binarySearch(_,a,o.ENTRIES);d=_[m+o.PREV_X],p=_[m+o.PREV_Y];var y=_[m],v=this.getCurvePercent(m/o.ENTRIES-1,1-(a-y)/(_[m+o.PREV_TIME]-y));d=(d+(_[m+o.X]-d)*v)*f.data.scaleX,p=(p+(_[m+o.Y]-p)*v)*f.data.scaleY}if(1==h)c==e.add?(f.scaleX+=d-f.data.scaleX,f.scaleY+=p-f.data.scaleY):(f.scaleX=d,f.scaleY=p);else{var g=0,A=0;if(u==i.mixOut)switch(c){case e.setup:g=f.data.scaleX,A=f.data.scaleY,f.scaleX=g+(Math.abs(d)*t.MathUtils.signum(g)-g)*h,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-A)*h;break;case e.first:case e.replace:g=f.scaleX,A=f.scaleY,f.scaleX=g+(Math.abs(d)*t.MathUtils.signum(g)-g)*h,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-A)*h;break;case e.add:g=f.scaleX,A=f.scaleY,f.scaleX=g+(Math.abs(d)*t.MathUtils.signum(g)-f.data.scaleX)*h,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-f.data.scaleY)*h}else switch(c){case e.setup:g=Math.abs(f.data.scaleX)*t.MathUtils.signum(d),A=Math.abs(f.data.scaleY)*t.MathUtils.signum(p),f.scaleX=g+(d-g)*h,f.scaleY=A+(p-A)*h;break;case e.first:case e.replace:g=Math.abs(f.scaleX)*t.MathUtils.signum(d),A=Math.abs(f.scaleY)*t.MathUtils.signum(p),f.scaleX=g+(d-g)*h,f.scaleY=A+(p-A)*h;break;case e.add:g=t.MathUtils.signum(d),A=t.MathUtils.signum(p),f.scaleX=Math.abs(f.scaleX)*g+(d-Math.abs(f.data.scaleX)*g)*h,f.scaleY=Math.abs(f.scaleY)*A+(p-Math.abs(f.data.scaleY)*A)*h}}}},o})(l);t.ScaleTimeline=h;var c=(function(t){function i(e){return t.call(this,e)||this}return r(i,t),i.prototype.getPropertyId=function(){return(n.shear<<24)+this.boneIndex},i.prototype.apply=function(t,n,r,a,o,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(r=c[c.length-i.ENTRIES])_=c[c.length+i.PREV_X],f=c[c.length+i.PREV_Y];else{var d=s.binarySearch(c,r,i.ENTRIES);_=c[d+i.PREV_X],f=c[d+i.PREV_Y];var p=c[d],m=this.getCurvePercent(d/i.ENTRIES-1,1-(r-p)/(c[d+i.PREV_TIME]-p));_+=(c[d+i.X]-_)*m,f+=(c[d+i.Y]-f)*m}switch(l){case e.setup:u.shearX=u.data.shearX+_*o,u.shearY=u.data.shearY+f*o;break;case e.first:case e.replace:u.shearX+=(u.data.shearX+_-u.shearX)*o,u.shearY+=(u.data.shearY+f-u.shearY)*o;break;case e.add:u.shearX+=_*o,u.shearY+=f*o}}},i})(l);t.ShearTimeline=c;var u=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.color<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,i,n,r,s){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=i,this.frames[t+a.G]=n,this.frames[t+a.B]=r,this.frames[t+a.A]=s},a.prototype.apply=function(t,i,n,r,o,l,h){var c=t.slots[this.slotIndex];if(c.bone.active){var u=this.frames;if(n=u[u.length-a.ENTRIES]){var v=u.length;d=u[v+a.PREV_R],p=u[v+a.PREV_G],m=u[v+a.PREV_B],y=u[v+a.PREV_A]}else{var g=s.binarySearch(u,n,a.ENTRIES);d=u[g+a.PREV_R],p=u[g+a.PREV_G],m=u[g+a.PREV_B],y=u[g+a.PREV_A];var A=u[g],x=this.getCurvePercent(g/a.ENTRIES-1,1-(n-A)/(u[g+a.PREV_TIME]-A));d+=(u[g+a.R]-d)*x,p+=(u[g+a.G]-p)*x,m+=(u[g+a.B]-m)*x,y+=(u[g+a.A]-y)*x}if(1==o)c.color.set(d,p,m,y);else{_=c.color;l==e.setup&&_.setFromColor(c.data.color),_.add((d-_.r)*o,(p-_.g)*o,(m-_.b)*o,(y-_.a)*o)}}}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_R=-4,a.PREV_G=-3,a.PREV_B=-2,a.PREV_A=-1,a.R=1,a.G=2,a.B=3,a.A=4,a})(a);t.ColorTimeline=u;var _=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.twoColor<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,i,n,r,s,o,l,h){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=i,this.frames[t+a.G]=n,this.frames[t+a.B]=r,this.frames[t+a.A]=s,this.frames[t+a.R2]=o,this.frames[t+a.G2]=l,this.frames[t+a.B2]=h},a.prototype.apply=function(t,i,n,r,o,l,h){var c=t.slots[this.slotIndex];if(c.bone.active){var u=this.frames;if(n=u[u.length-a.ENTRIES]){var C=u.length;m=u[C+a.PREV_R],y=u[C+a.PREV_G],v=u[C+a.PREV_B],g=u[C+a.PREV_A],A=u[C+a.PREV_R2],x=u[C+a.PREV_G2],b=u[C+a.PREV_B2]}else{var T=s.binarySearch(u,n,a.ENTRIES);m=u[T+a.PREV_R],y=u[T+a.PREV_G],v=u[T+a.PREV_B],g=u[T+a.PREV_A],A=u[T+a.PREV_R2],x=u[T+a.PREV_G2],b=u[T+a.PREV_B2];var S=u[T],w=this.getCurvePercent(T/a.ENTRIES-1,1-(n-S)/(u[T+a.PREV_TIME]-S));m+=(u[T+a.R]-m)*w,y+=(u[T+a.G]-y)*w,v+=(u[T+a.B]-v)*w,g+=(u[T+a.A]-g)*w,A+=(u[T+a.R2]-A)*w,x+=(u[T+a.G2]-x)*w,b+=(u[T+a.B2]-b)*w}if(1==o)c.color.set(m,y,v,g),c.darkColor.set(A,x,b,1);else{_=c.color,f=c.darkColor;l==e.setup&&(_.setFromColor(c.data.color),f.setFromColor(c.data.darkColor)),_.add((m-_.r)*o,(y-_.g)*o,(v-_.b)*o,(g-_.a)*o),f.add((A-f.r)*o,(x-f.g)*o,(b-f.b)*o,0)}}}},a.ENTRIES=8,a.PREV_TIME=-8,a.PREV_R=-7,a.PREV_G=-6,a.PREV_B=-5,a.PREV_A=-4,a.PREV_R2=-3,a.PREV_G2=-2,a.PREV_B2=-1,a.R=1,a.G=2,a.B=3,a.A=4,a.R2=5,a.G2=6,a.B2=7,a})(a);t.TwoColorTimeline=_;var f=(function(){function r(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return r.prototype.getPropertyId=function(){return(n.attachment<<24)+this.slotIndex},r.prototype.getFrameCount=function(){return this.frames.length},r.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},r.prototype.apply=function(t,n,r,a,o,l,h){var c=t.slots[this.slotIndex];if(c.bone.active)if(h!=i.mixOut||l!=e.setup){var u=this.frames;if(r=u[u.length-1]?u.length-1:s.binarySearch(u,r,1)-1;var d=this.attachmentNames[f];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else{var p=c.data.attachmentName;c.setAttachment(null==p?null:t.getAttachment(this.slotIndex,p))}},r})();t.AttachmentTimeline=f;var d=null,p=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e),n.frameVertices=new Array(e),null==d&&(d=t.Utils.newFloatArray(64)),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.deform<<27)+ +this.attachment.id+this.slotIndex},a.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},a.prototype.apply=function(i,n,r,a,o,l,h){var c=i.slots[this.slotIndex];if(c.bone.active){var u=c.getAttachment();if(u instanceof t.VertexAttachment&&u.deformAttachment==this.attachment){var _=c.deform;0==_.length&&(l=e.setup);var f=this.frameVertices,d=f[0].length,p=this.frames;if(r=p[p.length-1]){var x=f[p.length-1];if(1==o)if(l==e.add)if(null==(m=u).bones){v=m.vertices;for(var b=0;bi)this.apply(t,e,Number.MAX_VALUE,n,r,a,o),e=-1;else if(e>=l[h-1])return;if(!(i0&&l[c-1]==u;)c--;for(;c=l[c];c++)n.push(this.events[c])}}},e})();t.EventTimeline=m;var y=(function(){function r(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return r.prototype.getPropertyId=function(){return n.drawOrder<<24},r.prototype.getFrameCount=function(){return this.frames.length},r.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},r.prototype.apply=function(n,r,a,o,l,h,c){var u=n.drawOrder,_=n.slots;if(c!=i.mixOut||h!=e.setup){var f=this.frames;if(a=f[f.length-1]?f.length-1:s.binarySearch(f,a)-1;var p=this.drawOrders[d];if(null==p)t.Utils.arrayCopy(_,0,u,0,_.length);else for(var m=0,y=p.length;m=u[u.length-o.ENTRIES])h==e.setup?(_.mix=_.data.mix+(u[u.length+o.PREV_MIX]-_.data.mix)*l,_.softness=_.data.softness+(u[u.length+o.PREV_SOFTNESS]-_.data.softness)*l,c==i.mixOut?(_.bendDirection=_.data.bendDirection,_.compress=_.data.compress,_.stretch=_.data.stretch):(_.bendDirection=u[u.length+o.PREV_BEND_DIRECTION],_.compress=0!=u[u.length+o.PREV_COMPRESS],_.stretch=0!=u[u.length+o.PREV_STRETCH])):(_.mix+=(u[u.length+o.PREV_MIX]-_.mix)*l,_.softness+=(u[u.length+o.PREV_SOFTNESS]-_.softness)*l,c==i.mixIn&&(_.bendDirection=u[u.length+o.PREV_BEND_DIRECTION],_.compress=0!=u[u.length+o.PREV_COMPRESS],_.stretch=0!=u[u.length+o.PREV_STRETCH]));else{var f=s.binarySearch(u,r,o.ENTRIES),d=u[f+o.PREV_MIX],p=u[f+o.PREV_SOFTNESS],m=u[f],y=this.getCurvePercent(f/o.ENTRIES-1,1-(r-m)/(u[f+o.PREV_TIME]-m));h==e.setup?(_.mix=_.data.mix+(d+(u[f+o.MIX]-d)*y-_.data.mix)*l,_.softness=_.data.softness+(p+(u[f+o.SOFTNESS]-p)*y-_.data.softness)*l,c==i.mixOut?(_.bendDirection=_.data.bendDirection,_.compress=_.data.compress,_.stretch=_.data.stretch):(_.bendDirection=u[f+o.PREV_BEND_DIRECTION],_.compress=0!=u[f+o.PREV_COMPRESS],_.stretch=0!=u[f+o.PREV_STRETCH])):(_.mix+=(d+(u[f+o.MIX]-d)*y-_.mix)*l,_.softness+=(p+(u[f+o.SOFTNESS]-p)*y-_.softness)*l,c==i.mixIn&&(_.bendDirection=u[f+o.PREV_BEND_DIRECTION],_.compress=0!=u[f+o.PREV_COMPRESS],_.stretch=0!=u[f+o.PREV_STRETCH]))}},o.ENTRIES=6,o.PREV_TIME=-6,o.PREV_MIX=-5,o.PREV_SOFTNESS=-4,o.PREV_BEND_DIRECTION=-3,o.PREV_COMPRESS=-2,o.PREV_STRETCH=-1,o.MIX=1,o.SOFTNESS=2,o.BEND_DIRECTION=3,o.COMPRESS=4,o.STRETCH=5,o})(a);t.IkConstraintTimeline=v;var g=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.transformConstraint<<24)+this.transformConstraintIndex},a.prototype.setFrame=function(t,e,i,n,r,s){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=i,this.frames[t+a.TRANSLATE]=n,this.frames[t+a.SCALE]=r,this.frames[t+a.SHEAR]=s},a.prototype.apply=function(t,i,n,r,o,l,h){var c=this.frames,u=t.transformConstraints[this.transformConstraintIndex];if(u.active)if(n=c[c.length-a.ENTRIES]){var y=c.length;f=c[y+a.PREV_ROTATE],d=c[y+a.PREV_TRANSLATE],p=c[y+a.PREV_SCALE],m=c[y+a.PREV_SHEAR]}else{var v=s.binarySearch(c,n,a.ENTRIES);f=c[v+a.PREV_ROTATE],d=c[v+a.PREV_TRANSLATE],p=c[v+a.PREV_SCALE],m=c[v+a.PREV_SHEAR];var g=c[v],A=this.getCurvePercent(v/a.ENTRIES-1,1-(n-g)/(c[v+a.PREV_TIME]-g));f+=(c[v+a.ROTATE]-f)*A,d+=(c[v+a.TRANSLATE]-d)*A,p+=(c[v+a.SCALE]-p)*A,m+=(c[v+a.SHEAR]-m)*A}if(l==e.setup){_=u.data;u.rotateMix=_.rotateMix+(f-_.rotateMix)*o,u.translateMix=_.translateMix+(d-_.translateMix)*o,u.scaleMix=_.scaleMix+(p-_.scaleMix)*o,u.shearMix=_.shearMix+(m-_.shearMix)*o}else u.rotateMix+=(f-u.rotateMix)*o,u.translateMix+=(d-u.translateMix)*o,u.scaleMix+=(p-u.scaleMix)*o,u.shearMix+=(m-u.shearMix)*o}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_ROTATE=-4,a.PREV_TRANSLATE=-3,a.PREV_SCALE=-2,a.PREV_SHEAR=-1,a.ROTATE=1,a.TRANSLATE=2,a.SCALE=3,a.SHEAR=4,a})(a);t.TransformConstraintTimeline=g;var A=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.pathConstraintPosition<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,i){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.VALUE]=i},a.prototype.apply=function(t,i,n,r,o,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=c[c.length-a.ENTRIES])_=c[c.length+a.PREV_VALUE];else{var f=s.binarySearch(c,n,a.ENTRIES);_=c[f+a.PREV_VALUE];var d=c[f],p=this.getCurvePercent(f/a.ENTRIES-1,1-(n-d)/(c[f+a.PREV_TIME]-d));_+=(c[f+a.VALUE]-_)*p}l==e.setup?u.position=u.data.position+(_-u.data.position)*o:u.position+=(_-u.position)*o}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_VALUE=-1,a.VALUE=1,a})(a);t.PathConstraintPositionTimeline=A;var x=(function(t){function i(e){return t.call(this,e)||this}return r(i,t),i.prototype.getPropertyId=function(){return(n.pathConstraintSpacing<<24)+this.pathConstraintIndex},i.prototype.apply=function(t,n,r,a,o,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(r=c[c.length-i.ENTRIES])_=c[c.length+i.PREV_VALUE];else{var f=s.binarySearch(c,r,i.ENTRIES);_=c[f+i.PREV_VALUE];var d=c[f],p=this.getCurvePercent(f/i.ENTRIES-1,1-(r-d)/(c[f+i.PREV_TIME]-d));_+=(c[f+i.VALUE]-_)*p}l==e.setup?u.spacing=u.data.spacing+(_-u.data.spacing)*o:u.spacing+=(_-u.spacing)*o}},i})(A);t.PathConstraintSpacingTimeline=x;var b=(function(i){function a(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*a.ENTRIES),n}return r(a,i),a.prototype.getPropertyId=function(){return(n.pathConstraintMix<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,i,n){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=i,this.frames[t+a.TRANSLATE]=n},a.prototype.apply=function(t,i,n,r,o,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=c[c.length-a.ENTRIES])_=c[c.length+a.PREV_ROTATE],f=c[c.length+a.PREV_TRANSLATE];else{var d=s.binarySearch(c,n,a.ENTRIES);_=c[d+a.PREV_ROTATE],f=c[d+a.PREV_TRANSLATE];var p=c[d],m=this.getCurvePercent(d/a.ENTRIES-1,1-(n-p)/(c[d+a.PREV_TIME]-p));_+=(c[d+a.ROTATE]-_)*m,f+=(c[d+a.TRANSLATE]-f)*m}l==e.setup?(u.rotateMix=u.data.rotateMix+(_-u.data.rotateMix)*o,u.translateMix=u.data.translateMix+(f-u.data.translateMix)*o):(u.rotateMix+=(_-u.rotateMix)*o,u.translateMix+=(f-u.translateMix)*o)}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_ROTATE=-2,a.PREV_TRANSLATE=-1,a.ROTATE=1,a.TRANSLATE=2,a})(a);t.PathConstraintMixTimeline=b})(n||(n={})),(function(t){var e=(function(){function e(e){this.tracks=new Array,this.timeScale=1,this.events=new Array,this.listeners=new Array,this.queue=new r(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool(function(){return new i}),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,i=0,n=e.length;i0){if(r.delay-=s,r.delay>0)continue;s=-r.delay,r.delay=0}var a=r.next;if(null!=a){var o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=0==r.timeScale?0:(o/r.timeScale+t)*a.timeScale,r.trackTime+=s,this.setCurrent(i,a,!0);null!=a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&null==r.mixingFrom){e[i]=null,this.queue.end(r),this.disposeNext(r);continue}if(null!=r.mixingFrom&&this.updateMixingFrom(r,t)){var l=r.mixingFrom;for(r.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=s}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var i=t.mixingFrom;if(null==i)return!0;var n=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=i.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=i.mixingFrom,null!=i.mixingFrom&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),n):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(i){if(null==i)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,s=!1,a=0,o=r.length;a0)){s=!0;var h=0==a?t.MixBlend.first:l.mixBlend,c=l.alpha;null!=l.mixingFrom?c*=this.applyMixingFrom(l,i,h):l.trackTime>=l.trackEnd&&null==l.next&&(c=0);var u=l.animationLast,_=l.getAnimationTime(),f=l.animation.timelines.length,d=l.animation.timelines;if(0==a&&1==c||h==t.MixBlend.add)for(var p=0;p1&&(a=1),r!=t.MixBlend.first&&(r=s.mixBlend));var o=a0&&this.queueEvents(s,u),this.events.length=0,s.nextAnimationLast=u,s.nextTrackLast=s.trackTime,a},e.prototype.applyRotateTimeline=function(e,i,n,r,s,a,o,l){if(l&&(a[o]=0),1!=r){var h=e,c=h.frames,u=i.bones[h.boneIndex];if(u.active){var _=0,f=0;if(n=c[c.length-t.RotateTimeline.ENTRIES])f=u.data.rotation+c[c.length+t.RotateTimeline.PREV_ROTATION];else{var d=t.Animation.binarySearch(c,n,t.RotateTimeline.ENTRIES),p=c[d+t.RotateTimeline.PREV_ROTATION],m=c[d],y=h.getCurvePercent((d>>1)-1,1-(n-m)/(c[d+t.RotateTimeline.PREV_TIME]-m));f=c[d+t.RotateTimeline.ROTATION]-p,f=p+(f-=360*(16384-(16384.499999999996-f/360|0)))*y+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var v=0,g=f-_;if(0==(g-=360*(16384-(16384.499999999996-g/360|0))))v=a[o];else{var A=0,x=0;l?(A=0,x=g):(A=a[o],x=a[o+1]);var b=g>0,C=A>=0;t.MathUtils.signum(x)!=t.MathUtils.signum(g)&&Math.abs(x)<=90&&(Math.abs(A)>180&&(A+=360*t.MathUtils.signum(A)),C=b),v=g+A-A%360,C!=b&&(v+=360*t.MathUtils.signum(A)),a[o]=v}a[o+1]=g,_+=v*r,u.rotation=_-360*(16384-(16384.499999999996-_/360|0))}}else e.apply(i,0,n,null,1,s,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var i=t.animationStart,n=t.animationEnd,r=n-i,s=t.trackLast%r,a=this.events,o=0,l=a.length;on||this.queue.event(t,h)}for((t.loop?0==r||s>t.trackTime%r:e>=n&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var i=e;;){var n=i.mixingFrom;if(null==n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,i){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(i&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,i){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,i)},e.prototype.setAnimationWith=function(t,e,i){if(null==e)throw new Error("animation cannot be null.");var n=!0,r=this.expandToIndex(t);null!=r&&(-1==r.nextTrackLast?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,n=!1):this.disposeNext(r));var s=this.trackEntry(t,e,i,r);return this.setCurrent(t,s,n),this.queue.drain(),s},e.prototype.addAnimation=function(t,e,i,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,r,i,n)},e.prototype.addAnimationWith=function(t,e,i,n){if(null==e)throw new Error("animation cannot be null.");var r=this.expandToIndex(t);if(null!=r)for(;null!=r.next;)r=r.next;var s=this.trackEntry(t,e,i,r);if(null==r)this.setCurrent(t,s,!0),this.queue.drain();else if(r.next=s,n<=0){var a=r.animationEnd-r.animationStart;0!=a?(r.loop?n+=a*(1+(r.trackTime/a|0)):n+=Math.max(a,r.trackTime),n-=this.data.getMix(r.animation,e)):n=r.trackTime}return s.delay=n,s},e.prototype.setEmptyAnimation=function(t,i){var n=this.setAnimationWith(t,e.emptyAnimation,!1);return n.mixDuration=i,n.trackEnd=i,n},e.prototype.addEmptyAnimation=function(t,i,n){n<=0&&(n-=i);var r=this.addAnimationWith(t,e.emptyAnimation,!1,n);return r.mixDuration=i,r.trackEnd=i,r},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var i=0,n=this.tracks.length;i=0;e--)for(var n=this.tracks[e];null!=n;)this.computeNotLast(n),n=n.mixingFrom},e.prototype.computeHold=function(i){var n=i.mixingTo,r=i.animation.timelines,s=i.animation.timelines.length,a=t.Utils.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;var o=t.Utils.setArraySize(i.timelineHoldMix,s),l=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var h=0;h0){a[h]=e.HOLD_MIX,o[h]=_;continue t}break}a[h]=e.HOLD}else a[h]=e.SUBSEQUENT}},e.prototype.computeNotLast=function(i){for(var n=i.animation.timelines,r=i.animation.timelines.length,s=i.timelineMode,a=this.propertyIDs,o=0;o=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD=2,e.HOLD_MIX=3,e.NOT_LAST=4,e})();t.AnimationState=e;var i=(function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.prototype.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},e})();t.TrackEntry=i;var n,r=(function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(n.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(n.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(n.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(n.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(n.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(n.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,i=0;i=0?i.substring(0,i.lastIndexOf("/")):"";i=this.pathPrefix+i,this.toLoad++,e.downloadText(i,(function(e){var o={count:0},l=new Array;try{new t.TextureAtlas(e,function(e){l.push(a+"/"+e);var i=document.createElement("img");return i.width=16,i.height=16,new t.FakeTexture(i)})}catch(t){var h=t;return s.errors[i]="Couldn't load texture atlas "+i+": "+h.message,r&&r(i,"Couldn't load texture atlas "+i+": "+h.message),s.toLoad--,void s.loaded++}for(var c=function(h){var c=!1;s.loadTexture(h,(function(h,u){if(o.count++,o.count==l.length)if(c)s.errors[i]="Couldn't load texture atlas page "+h+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+h+" of atlas "+i),s.toLoad--,s.loaded++;else try{var _=new t.TextureAtlas(e,function(t){return s.get(a+"/"+t)});s.assets[i]=_,n&&n(i,_),s.toLoad--,s.loaded++}catch(t){var f=t;s.errors[i]="Couldn't load texture atlas "+i+": "+f.message,r&&r(i,"Couldn't load texture atlas "+i+": "+f.message),s.toLoad--,s.loaded++}}),(function(t,e){c=!0,o.count++,o.count==l.length&&(s.errors[i]="Couldn't load texture atlas page "+t+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+t+" of atlas "+i),s.toLoad--,s.loaded++)}))},u=0,_=l;u<_.length;u++){c(_[u])}}),(function(t,e){s.errors[i]="Couldn't load texture atlas "+i+": status "+status+", "+e,r&&r(i,"Couldn't load texture atlas "+i+": status "+status+", "+e),s.toLoad--,s.loaded++}))},e.prototype.get=function(t){return t=this.pathPrefix+t,this.assets[t]},e.prototype.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},e.prototype.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},e.prototype.isLoadingComplete=function(){return 0==this.toLoad},e.prototype.getToLoad=function(){return this.toLoad},e.prototype.getLoaded=function(){return this.loaded},e.prototype.dispose=function(){this.removeAll()},e.prototype.hasErrors=function(){return Object.keys(this.errors).length>0},e.prototype.getErrors=function(){return this.errors},e})();t.AssetManager=e})(n||(n={})),(function(t){var e=(function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.RegionAttachment(i);return s.setRegion(r),s},e.prototype.newMeshAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.MeshAttachment(i);return s.region=r,s},e.prototype.newBoundingBoxAttachment=function(e,i){return new t.BoundingBoxAttachment(i)},e.prototype.newPathAttachment=function(e,i){return new t.PathAttachment(i)},e.prototype.newPointAttachment=function(e,i){return new t.PointAttachment(i)},e.prototype.newClippingAttachment=function(e,i){return new t.ClippingAttachment(i)},e})();t.AtlasAttachmentLoader=e})(n||(n={})),(function(t){(function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"})(t.BlendMode||(t.BlendMode={}))})(n||(n={})),(function(t){var e=(function(){function e(t,e,i){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}return e.prototype.isActive=function(){return this.active},e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,i,n,r,s,a,o){this.ax=e,this.ay=i,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;var l=this.parent;if(null==l){var h=this.skeleton,c=n+90+o,u=h.scaleX,_=h.scaleY;return this.a=t.MathUtils.cosDeg(n+a)*r*u,this.b=t.MathUtils.cosDeg(c)*s*u,this.c=t.MathUtils.sinDeg(n+a)*r*_,this.d=t.MathUtils.sinDeg(c)*s*_,this.worldX=e*u+h.x,void(this.worldY=i*_+h.y)}var f=l.a,d=l.b,p=l.c,m=l.d;switch(this.worldX=f*e+d*i+l.worldX,this.worldY=p*e+m*i+l.worldY,this.data.transformMode){case t.TransformMode.Normal:c=n+90+o;var y=t.MathUtils.cosDeg(n+a)*r,v=t.MathUtils.cosDeg(c)*s,g=t.MathUtils.sinDeg(n+a)*r,A=t.MathUtils.sinDeg(c)*s;return this.a=f*y+d*g,this.b=f*v+d*A,this.c=p*y+m*g,void(this.d=p*v+m*A);case t.TransformMode.OnlyTranslation:c=n+90+o;this.a=t.MathUtils.cosDeg(n+a)*r,this.b=t.MathUtils.cosDeg(c)*s,this.c=t.MathUtils.sinDeg(n+a)*r,this.d=t.MathUtils.sinDeg(c)*s;break;case t.TransformMode.NoRotationOrReflection:var x=0;(T=f*f+p*p)>1e-4?(d=p*(T=Math.abs(f*m-d*p)/T),m=f*T,x=Math.atan2(p,f)*t.MathUtils.radDeg):(f=0,p=0,x=90-Math.atan2(m,d)*t.MathUtils.radDeg);var b=n+a-x,C=n+o-x+90;y=t.MathUtils.cosDeg(b)*r,v=t.MathUtils.cosDeg(C)*s,g=t.MathUtils.sinDeg(b)*r,A=t.MathUtils.sinDeg(C)*s;this.a=f*y-d*g,this.b=f*v-d*A,this.c=p*y+m*g,this.d=p*v+m*A;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var T,S=t.MathUtils.cosDeg(n),w=t.MathUtils.sinDeg(n),E=(f*S+d*w)/this.skeleton.scaleX,M=(p*S+m*w)/this.skeleton.scaleY;(T=Math.sqrt(E*E+M*M))>1e-5&&(T=1/T),E*=T,M*=T,T=Math.sqrt(E*E+M*M),this.data.transformMode==t.TransformMode.NoScale&&f*m-d*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(T=-T);var D=Math.PI/2+Math.atan2(M,E),B=Math.cos(D)*T,I=Math.sin(D)*T;y=t.MathUtils.cosDeg(a)*r,v=t.MathUtils.cosDeg(90+o)*s,g=t.MathUtils.sinDeg(a)*r,A=t.MathUtils.sinDeg(90+o)*s;this.a=E*y+B*g,this.b=E*v+B*A,this.c=M*y+I*g,this.d=M*v+I*A}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*t.MathUtils.radDeg);var i=e.a,n=e.b,r=e.c,s=e.d,a=1/(i*s-n*r),o=this.worldX-e.worldX,l=this.worldY-e.worldY;this.ax=o*s*a-l*n*a,this.ay=l*i*a-o*r*a;var h=a*s,c=a*i,u=a*n,_=a*r,f=h*this.a-u*this.c,d=h*this.b-u*this.d,p=c*this.c-_*this.a,m=c*this.d-_*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+p*p),this.ascaleX>1e-4){var y=f*m-d*p;this.ascaleY=y/this.ascaleX,this.ashearY=Math.atan2(f*d+p*m,y)*t.MathUtils.radDeg,this.arotation=Math.atan2(p,f)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,i=this.b,n=this.c,r=this.d,s=1/(e*r-i*n),a=t.x-this.worldX,o=t.y-this.worldY;return t.x=a*r*s-o*i*s,t.y=o*e*s-a*n*s,t},e.prototype.localToWorld=function(t){var e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(this.a*i-this.c*n,this.d*n-this.b*i)*t.MathUtils.radDeg+this.rotation-this.shearX},e.prototype.localToWorldRotation=function(e){e-=this.rotation-this.shearX;var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(n*this.c+i*this.d,n*this.a+i*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var i=this.a,n=this.b,r=this.c,s=this.d,a=t.MathUtils.cosDeg(e),o=t.MathUtils.sinDeg(e);this.a=a*i-o*r,this.b=a*n-o*s,this.c=o*i+a*r,this.d=o*n+a*s,this.appliedValid=!1},e})();t.Bone=e})(n||(n={})),(function(t){var e,i=(function(){return function(i,n,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=e.Normal,this.skinRequired=!1,this.color=new t.Color,i<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=i,this.name=n,this.parent=r}})();t.BoneData=i,(function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"})(e=t.TransformMode||(t.TransformMode={}))})(n||(n={})),(function(t){var e=(function(){return function(t,e,i){this.name=t,this.order=e,this.skinRequired=i}})();t.ConstraintData=e})(n||(n={})),(function(t){var e=(function(){return function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}})();t.Event=e})(n||(n={})),(function(t){var e=(function(){return function(t){this.name=t}})();t.EventData=e})(n||(n={})),(function(t){var e=(function(){function e(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var i=0;i180?d-=360:d<-180&&(d+=360);var p=e.ascaleX,m=e.ascaleY;if(r||s){var y=e.data.length*p,v=Math.sqrt(_*_+f*f);if(r&&vy&&y>1e-4){var g=(v/y-1)*o+1;p*=g,a&&(m*=g)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,m,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,i,n,r,s,a,o,l){if(0!=l){e.appliedValid||e.updateAppliedTransform(),i.appliedValid||i.updateAppliedTransform();var h=e.ax,c=e.ay,u=e.ascaleX,_=u,f=e.ascaleY,d=i.ascaleX,p=0,m=0,y=0;u<0?(u=-u,p=180,y=-1):(p=0,y=1),f<0&&(f=-f,y=-y),d<0?(d=-d,m=180):m=0;var v=i.ax,g=0,A=0,x=0,b=e.a,C=e.b,T=e.c,S=e.d,w=Math.abs(u-f)<=1e-4;w?(A=b*v+C*(g=i.ay)+e.worldX,x=T*v+S*g+e.worldY):(g=0,A=b*v+e.worldX,x=T*v+e.worldY);var E=e.parent;b=E.a,C=E.b,T=E.c;var M,D,B=1/(b*(S=E.d)-C*T),I=A-E.worldX,P=x-E.worldY,R=(I*S-P*C)*B-h,O=(P*b-I*T)*B-c,L=Math.sqrt(R*R+O*O),F=i.data.length*d;if(L<1e-4)return this.apply1(e,n,r,!1,a,!1,l),void i.updateWorldTransformWith(v,g,0,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY);var V=((I=n-E.worldX)*S-(P=r-E.worldY)*C)*B-h,N=(P*b-I*T)*B-c,k=V*V+N*N;if(0!=o){o*=u*(d+1)/2;var G=Math.sqrt(k),z=G-L-F*u+o;if(z>0){var U=Math.min(1,z/(2*o))-1;k=(V-=(U=(z-o*(1-U*U))/G)*V)*V+(N-=U*N)*N}}t:if(w){var H=(k-L*L-(F*=u)*F)/(2*L*F);H<-1?H=-1:H>1&&(H=1,a&&(_*=(Math.sqrt(k)/(L+F)-1)*l+1)),D=Math.acos(H)*s,b=L+F*H,C=F*Math.sin(D),M=Math.atan2(N*b-V*C,V*b+N*C)}else{var W=(b=u*F)*b,j=(C=f*F)*C,X=Math.atan2(N,V),Y=-2*j*L,q=j-W;if((S=Y*Y-4*q*(T=j*L*L+W*k-W*j))>=0){var J=Math.sqrt(S);Y<0&&(J=-J);var Z=(J=-(Y+J)/2)/q,K=T/J,Q=Math.abs(Z)=-1&&T<=1&&(T=Math.acos(T),(S=(I=b*Math.cos(T)+L)*I+(P=C*Math.sin(T))*P)st&&(nt=T,st=S,rt=I,at=P)),k<=(et+st)/2?(M=X-Math.atan2(it*s,tt),D=$*s):(M=X-Math.atan2(at*s,rt),D=nt*s)}var ot=Math.atan2(g,v)*y,lt=e.arotation;(M=(M-ot)*t.MathUtils.radDeg+p-lt)>180?M-=360:M<-180&&(M+=360),e.updateWorldTransformWith(h,c,lt+M*l,_,e.ascaleY,0,0),lt=i.arotation,(D=((D+ot)*t.MathUtils.radDeg-i.ashearX)*y+m-lt)>180?D-=360:D<-180&&(D+=360),i.updateWorldTransformWith(v,g,lt+D*l,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY)}else i.updateWorldTransform()},e})();t.IkConstraint=e})(n||(n={})),(function(t){var e=(function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.bendDirection=1,i.compress=!1,i.stretch=!1,i.uniform=!1,i.mix=1,i.softness=0,i}return r(e,t),e})(t.ConstraintData);t.IkConstraintData=e})(n||(n={})),(function(t){var e=(function(){function e(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0,n=t.bones.length;i0;if(r>0||s){var a=this.data,o=a.spacingMode==t.SpacingMode.Percent,l=a.rotateMode,h=l==t.RotateMode.Tangent,c=l==t.RotateMode.ChainScale,u=this.bones.length,_=h?u:u+1,f=this.bones,d=t.Utils.setArraySize(this.spaces,_),p=null,m=this.spacing;if(c||!o){c&&(p=t.Utils.setArraySize(this.lengths,u));for(var y=a.spacingMode==t.SpacingMode.Length,v=0,g=_-1;v0?t.MathUtils.degRad:-t.MathUtils.degRad;v=0;for(var B=3;vt.MathUtils.PI?G-=t.MathUtils.PI2:G<-t.MathUtils.PI&&(G+=t.MathUtils.PI2),G*=n,z=Math.cos(G),U=Math.sin(G),I.a=z*F-U*N,I.b=z*V-U*k,I.c=U*F+z*N,I.d=U*V+z*k}I.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(i,n,r,s,a){var o=this.target,l=this.position,h=this.spaces,c=t.Utils.setArraySize(this.positions,3*n+2),u=null,_=i.closed,f=i.worldVerticesLength,d=f/6,p=e.NONE;if(!i.constantSpeed){var m=i.lengths,y=m[d-=_?1:2];if(s&&(l*=y),a)for(var v=1;vy){p!=e.AFTER&&(p=e.AFTER,i.computeWorldVertices(o,f-6,4,u,0,2)),this.addAfterPosition(x-y,u,0,c,g);continue}}for(;;A++){var b=m[A];if(!(x>b)){if(0==A)x/=b;else x=(x-(J=m[A-1]))/(b-J);break}}A!=p&&(p=A,_&&A==d?(i.computeWorldVertices(o,f-4,4,u,0,2),i.computeWorldVertices(o,0,4,u,4,2)):i.computeWorldVertices(o,6*A+2,8,u,0,2)),this.addCurvePosition(x,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],c,g,r||v>0&&0==j)}return c}_?(f+=2,u=t.Utils.setArraySize(this.world,f),i.computeWorldVertices(o,2,f-4,u,0,2),i.computeWorldVertices(o,0,2,u,f-4,2),u[f-2]=u[0],u[f-1]=u[1]):(d--,f-=4,u=t.Utils.setArraySize(this.world,f),i.computeWorldVertices(o,2,f,u,0,2));for(var C=t.Utils.setArraySize(this.curves,d),T=0,S=u[0],w=u[1],E=0,M=0,D=0,B=0,I=0,P=0,R=0,O=0,L=0,F=0,V=0,N=0,k=0,G=0,z=(v=0,2);vT){this.addAfterPosition(x-T,u,f-4,c,g);continue}}for(;;A++){var X=C[A];if(!(x>X)){if(0==A)x/=X;else x=(x-(J=C[A-1]))/(X-J);break}}if(A!=p){p=A;var Y=6*A;for(S=u[Y],w=u[Y+1],E=u[Y+2],M=u[Y+3],D=u[Y+4],B=u[Y+5],I=u[Y+6],P=u[Y+7],V=2*(R=.03*(S-2*E+D))+(L=.006*(3*(E-D)-S+I)),N=2*(O=.03*(w-2*M+B))+(F=.006*(3*(M-B)-w+P)),k=.3*(E-S)+R+.16666667*L,G=.3*(M-w)+O+.16666667*F,H=Math.sqrt(k*k+G*G),U[0]=H,Y=1;Y<8;Y++)k+=V,G+=N,V+=L,N+=F,H+=Math.sqrt(k*k+G*G),U[Y]=H;k+=V,G+=N,H+=Math.sqrt(k*k+G*G),U[8]=H,k+=V+L,G+=N+F,H+=Math.sqrt(k*k+G*G),U[9]=H,W=0}for(x*=H;;W++){var q=U[W];if(!(x>q)){var J;if(0==W)x/=q;else x=W+(x-(J=U[W-1]))/(q-J);break}}this.addCurvePosition(.1*x,S,w,E,M,D,B,I,P,c,g,r||v>0&&0==j)}return c},e.prototype.addBeforePosition=function(t,e,i,n,r){var s=e[i],a=e[i+1],o=e[i+2]-s,l=e[i+3]-a,h=Math.atan2(l,o);n[r]=s+t*Math.cos(h),n[r+1]=a+t*Math.sin(h),n[r+2]=h},e.prototype.addAfterPosition=function(t,e,i,n,r){var s=e[i+2],a=e[i+3],o=s-e[i],l=a-e[i+1],h=Math.atan2(l,o);n[r]=s+t*Math.cos(h),n[r+1]=a+t*Math.sin(h),n[r+2]=h},e.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,l,h,c,u){if(0==t||isNaN(t))return h[c]=e,h[c+1]=i,void(h[c+2]=Math.atan2(r-i,n-e));var _=t*t,f=_*t,d=1-t,p=d*d,m=p*d,y=d*t,v=3*y,g=d*v,A=v*t,x=e*m+n*g+s*A+o*f,b=i*m+r*g+a*A+l*f;h[c]=x,h[c+1]=b,u&&(h[c+2]=t<.001?Math.atan2(r-i,n-e):Math.atan2(b-(i*p+r*y*2+a*_),x-(e*p+n*y*2+s*_)))},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e})();t.PathConstraint=e})(n||(n={})),(function(t){var e=(function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i}return r(e,t),e})(t.ConstraintData);t.PathConstraintData=e,(function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"})(t.PositionMode||(t.PositionMode={})),(function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"})(t.SpacingMode||(t.SpacingMode={})),(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(t.RotateMode||(t.RotateMode={}))})(n||(n={})),(function(t){var e=(function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t})(),i=(function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,i,n){var r=this.clientAssets[t];return null!==r&&void 0!==r||(r=new e(t),this.clientAssets[t]=r),null!==i&&(r.textureLoader=i),r.toLoad.push(n),this.queuedAssets[n]!==n&&(this.queuedAssets[n]=n,!0)},t.prototype.loadText=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=n.responseText:i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadJson=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=JSON.parse(n.responseText):i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadTexture=function(t,e,i){var n=this;if(i=this.pathPrefix+i,this.queueAsset(t,e,i)){var r=new Image;r.src=i,r.crossOrigin="anonymous",r.onload=function(t){n.rawAssets[i]=r},r.onerror=function(t){n.errors[i]="Couldn't load image "+i}}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var i=this.clientAssets[t];return null===i||void 0===i||i.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=0;e0},t.prototype.getErrors=function(){return this.errors},t})();t.SharedAssetManager=i})(n||(n={})),(function(t){var e=(function(){function e(e){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var i=0;i1){var s=n[n.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(e),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.prototype.sortPathConstraint=function(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||null!=this.skin&&t.Utils.contains(this.skin.constraints,e.data,!0)),e.active){var i=e.target,n=i.data.index,r=i.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var s=0,a=this.data.skins.length;s-1||this.updateCacheReset.push(s)}else for(r=0;r0){A=new t.DrawOrderTimeline(F);var V=r.slots.length;for(c=0;c=0;f--)k[f]=-1;var G=t.Utils.newArray(V-N,0),z=0,U=0;for(f=0;f=0;f--)-1==k[f]&&(k[f]=G[--U]);A.setFrame(c,v,k)}s.push(A),o=Math.max(o,A.frames[F-1])}var H=i.readInt(!0);if(H>0){for(A=new t.EventTimeline(H),c=0;c>>1^-(1&i)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",i=0;i>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),i+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),i+=3;break;default:e+=String.fromCharCode(n),i++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t})(),n=(function(){return function(t,e,i,n,r){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=n,this.inheritDeform=r}})(),r=(function(){return function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}})()})(n||(n={})),(function(t){var e=(function(){function e(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new t.Pool(function(){return t.Utils.newFloatArray(16)})}return e.prototype.update=function(e,i){if(null==e)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,s=this.polygonPool,a=e.slots,o=a.length;n.length=0,s.freeAll(r),r.length=0;for(var l=0;l=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,i,n){var r=this.minX,s=this.minY,a=this.maxX,o=this.maxY;if(t<=r&&i<=r||e<=s&&n<=s||t>=a&&i>=a||e>=o&&n>=o)return!1;var l=(n-e)/(i-t),h=l*(r-t)+e;if(h>s&&hs&&hr&&cr&&ct.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var i=this.polygons,n=0,r=i.length;n=i||h=i){var c=n[o];c+(i-l)/(h-l)*(n[s]-c)=c&&g<=f||g>=f&&g<=c)&&(g>=e&&g<=n||g>=n&&g<=e)){var A=(h*y-l*p)/v;if((A>=u&&A<=d||A>=d&&A<=u)&&(A>=i&&A<=r||A>=r&&A<=i))return!0}c=f,u=d}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e})();t.SkeletonBounds=e})(n||(n={})),(function(t){var e=(function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(i,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,s=t.Utils.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(i,0,r,s,0,2);var a=this.clippingPolygon;e.makeClockwise(a);for(var o=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a)),l=0,h=o.length;l>1,X=this.clipOutput,Y=t.Utils.setArraySize(d,N+j*v),q=0;q=2?(c=o,o=this.scratch):c=this.scratch,c.length=0,c.push(t),c.push(e),c.push(i),c.push(n),c.push(r),c.push(s),c.push(t),c.push(e),o.length=0;for(var u=a,_=a.length-4,f=0;;f+=2){for(var d=u[f],p=u[f+1],m=u[f+2],y=u[f+3],v=d-m,g=p-y,A=c,x=c.length-2,b=o.length,C=0;C0;if(v*(S-y)-g*(T-m)>0){if(M){o.push(w),o.push(E);continue}var D=(I=E-S)*(m-d)-(P=w-T)*(y-p);if(Math.abs(D)>1e-6){var B=(P*(p-S)-I*(d-T))/D;o.push(d+(m-d)*B),o.push(p+(y-p)*B)}else o.push(d),o.push(p)}else if(M){var I,P;D=(I=E-S)*(m-d)-(P=w-T)*(y-p);if(Math.abs(D)>1e-6){B=(P*(p-S)-I*(d-T))/D;o.push(d+(m-d)*B),o.push(p+(y-p)*B)}else o.push(d),o.push(p);o.push(w),o.push(E)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==_)break;var R=o;(o=c).length=0,c=R}if(l!=o){l.length=0;f=0;for(var O=o.length-2;f>1;o=0;_--)-1==X[_]&&(X[_]=q[--Z])}A.setFrame(u++,this.getValue(j,"time",0),X)}s.push(A),a=Math.max(a,A.frames[A.getFrameCount()-1])}if(e.events){for(A=new t.EventTimeline(e.events.length),u=0,_=0;_=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=i},i.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==i)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=e,this.name=i,this.boneData=n}})();t.SlotData=e})(n||(n={})),(function(t){var e,i,n=(function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return i.MirroredRepeat;case"clamptoedge":return i.ClampToEdge;case"repeat":return i.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t})();t.Texture=n,(function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"})(e=t.TextureFilter||(t.TextureFilter={})),(function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"})(i=t.TextureWrap||(t.TextureWrap={}));var s=(function(){return function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}})();t.TextureRegion=s;var a=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.setFilters=function(t,e){},e.prototype.setWraps=function(t,e){},e.prototype.dispose=function(){},e})(n);t.FakeTexture=a})(n||(n={})),(function(t){var e=(function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,r){if(null==r)throw new Error("textureLoader cannot be null.");for(var a=new i(e),o=new Array(4),l=null;;){var h=a.readLine();if(null==h)break;if(0==(h=h.trim()).length)l=null;else if(l){var c=new s;c.name=h,c.page=l;var u=a.readValue();"true"==u.toLocaleLowerCase()?c.degrees=90:"false"==u.toLocaleLowerCase()?c.degrees=0:c.degrees=parseFloat(u),c.rotate=90==c.degrees,a.readTuple(o);var _=parseInt(o[0]),f=parseInt(o[1]);a.readTuple(o);var d=parseInt(o[0]),p=parseInt(o[1]);c.u=_/l.width,c.v=f/l.height,c.rotate?(c.u2=(_+p)/l.width,c.v2=(f+d)/l.height):(c.u2=(_+d)/l.width,c.v2=(f+p)/l.height),c.x=_,c.y=f,c.width=Math.abs(d),c.height=Math.abs(p),4==a.readTuple(o)&&4==a.readTuple(o)&&a.readTuple(o),c.originalWidth=parseInt(o[0]),c.originalHeight=parseInt(o[1]),a.readTuple(o),c.offsetX=parseInt(o[0]),c.offsetY=parseInt(o[1]),c.index=parseInt(a.readValue()),c.texture=l.texture,this.regions.push(c)}else{(l=new n).name=h,2==a.readTuple(o)&&(l.width=parseInt(o[0]),l.height=parseInt(o[1]),a.readTuple(o)),a.readTuple(o),l.minFilter=t.Texture.filterFromString(o[0]),l.magFilter=t.Texture.filterFromString(o[1]);var m=a.readValue();l.uWrap=t.TextureWrap.ClampToEdge,l.vWrap=t.TextureWrap.ClampToEdge,"x"==m?l.uWrap=t.TextureWrap.Repeat:"y"==m?l.vWrap=t.TextureWrap.Repeat:"xy"==m&&(l.uWrap=l.vWrap=t.TextureWrap.Repeat),l.texture=r(h),l.texture.setFilters(l.minFilter,l.magFilter),l.texture.setWraps(l.uWrap,l.vWrap),l.width=l.texture.getImage().width,l.height=l.texture.getImage().height,this.pages.push(l)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw new Error("Invalid line: "+e);for(var n=0,r=i+1;n<3;n++){var s=e.indexOf(",",r);if(-1==s)break;t[n]=e.substr(r,s-r).trim(),r=s+1}return t[n]=e.substring(r).trim(),n+1},t})(),n=(function(){return function(){}})();t.TextureAtlasPage=n;var s=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e})(t.TextureRegion);t.TextureAtlasRegion=s})(n||(n={})),(function(t){var e=(function(){function e(e,i){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,this.active=!1,null==e)throw new Error("data cannot be null.");if(null==i)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var n=0;n0?t.MathUtils.degRad:-t.MathUtils.degRad,u=this.data.offsetRotation*c,_=this.data.offsetShearY*c,f=this.bones,d=0,p=f.length;dt.MathUtils.PI?E-=t.MathUtils.PI2:E<-t.MathUtils.PI&&(E+=t.MathUtils.PI2),E*=e;var b=Math.cos(E),C=Math.sin(E);m.a=b*v-C*A,m.b=b*g-C*x,m.c=C*v+b*A,m.d=C*g+b*x,y=!0}if(0!=i){var T=this.temp;s.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),m.worldX+=(T.x-m.worldX)*i,m.worldY+=(T.y-m.worldY)*i,y=!0}if(n>0){var S=Math.sqrt(m.a*m.a+m.c*m.c),w=Math.sqrt(a*a+l*l);S>1e-5&&(S=(S+(w-S+this.data.offsetScaleX)*n)/S),m.a*=S,m.c*=S,S=Math.sqrt(m.b*m.b+m.d*m.d),w=Math.sqrt(o*o+h*h),S>1e-5&&(S=(S+(w-S+this.data.offsetScaleY)*n)/S),m.b*=S,m.d*=S,y=!0}if(r>0){g=m.b,x=m.d;var E,M=Math.atan2(x,g);(E=Math.atan2(h,o)-Math.atan2(l,a)-(M-Math.atan2(m.c,m.a)))>t.MathUtils.PI?E-=t.MathUtils.PI2:E<-t.MathUtils.PI&&(E+=t.MathUtils.PI2),E=M+(E+_)*r;S=Math.sqrt(g*g+x*x);m.b=Math.cos(E)*S,m.d=Math.sin(E)*S,y=!0}y&&(m.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,i=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,a=s.a,o=s.b,l=s.c,h=s.d,c=a*h-o*l>0?t.MathUtils.degRad:-t.MathUtils.degRad,u=this.data.offsetRotation*c,_=this.data.offsetShearY*c,f=this.bones,d=0,p=f.length;dt.MathUtils.PI?w-=t.MathUtils.PI2:w<-t.MathUtils.PI&&(w+=t.MathUtils.PI2),w*=e;var b=Math.cos(w),C=Math.sin(w);m.a=b*v-C*A,m.b=b*g-C*x,m.c=C*v+b*A,m.d=C*g+b*x,y=!0}if(0!=i){var T=this.temp;s.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),m.worldX+=T.x*i,m.worldY+=T.y*i,y=!0}if(n>0){var S=(Math.sqrt(a*a+l*l)-1+this.data.offsetScaleX)*n+1;m.a*=S,m.c*=S,S=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleY)*n+1,m.b*=S,m.d*=S,y=!0}if(r>0){var w;(w=Math.atan2(h,o)-Math.atan2(l,a))>t.MathUtils.PI?w-=t.MathUtils.PI2:w<-t.MathUtils.PI&&(w+=t.MathUtils.PI2);g=m.b,x=m.d;w=Math.atan2(x,g)+(w-t.MathUtils.PI/2+_)*r;S=Math.sqrt(g*g+x*x);m.b=Math.cos(w)*S,m.d=Math.sin(w)*S,y=!0}y&&(m.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(f=(f+(r.ascaleX-f+this.data.offsetScaleX)*i)/f),d>1e-5&&(d=(d+(r.ascaleY-d+this.data.offsetScaleY)*i)/d));var p=l.ashearY;if(0!=n){c=r.ashearY-p+this.data.offsetShearY;c-=360*(16384-(16384.499999999996-c/360|0)),l.shearY+=c*n}l.updateWorldTransformWith(u,_,h,f,d,l.ashearX,p)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(_*=(r.ascaleX-1+this.data.offsetScaleX)*i+1),f>1e-5&&(f*=(r.ascaleY-1+this.data.offsetScaleY)*i+1));var d=l.ashearY;0!=n&&(d+=(r.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(c,u,h,_,f,l.ashearX,d)}},e})();t.TransformConstraint=e})(n||(n={})),(function(t){var e=(function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.rotateMix=0,i.translateMix=0,i.scaleMix=0,i.shearMix=0,i.offsetRotation=0,i.offsetX=0,i.offsetY=0,i.offsetScaleX=0,i.offsetScaleY=0,i.offsetShearY=0,i.relative=!1,i.local=!1,i}return r(e,t),e})(t.ConstraintData);t.TransformConstraintData=e})(n||(n={})),(function(t){var e=(function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool(function(){return new Array}),this.polygonIndicesPool=new t.Pool(function(){return new Array})}return e.prototype.triangulate=function(t){var i=t,n=t.length>>1,r=this.indicesArray;r.length=0;for(var s=0;s3;){for(var h=n-1,c=(s=0,1);;){t:if(!a[s]){for(var u=r[h]<<1,_=r[s]<<1,f=r[c]<<1,d=i[u],p=i[u+1],m=i[_],y=i[_+1],v=i[f],g=i[f+1],A=(c+1)%n;A!=h;A=(A+1)%n)if(a[A]){var x=r[A]<<1,b=i[x],C=i[x+1];if(e.positiveArea(v,g,d,p,b,C)&&e.positiveArea(d,p,m,y,b,C)&&e.positiveArea(m,y,v,g,b,C))break t}break}if(0==c){do{if(!a[s])break;s--}while(s>0);break}h=s,s=c,c=(c+1)%n}l.push(r[(n+s-1)%n]),l.push(r[s]),l.push(r[(s+1)%n]),r.splice(s,1),a.splice(s,1);var T=(--n+s-1)%n,S=s==n?0:s;a[T]=e.isConcave(T,n,i,r),a[S]=e.isConcave(S,n,i,r)}return 3==n&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l},e.prototype.decompose=function(t,i){var n=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;var s=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(s),s.length=0;var a=this.polygonIndicesPool.obtain();a.length=0;var o=this.polygonPool.obtain();o.length=0;for(var l=-1,h=0,c=0,u=i.length;c0?(r.push(o),s.push(a)):(this.polygonPool.free(o),this.polygonIndicesPool.free(a)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(m),o.push(y),o.push(v),o.push(g),o.push(A),(a=this.polygonIndicesPool.obtain()).length=0,a.push(_),a.push(f),a.push(d),h=e.winding(p,m,y,v,g,A),l=_)}o.length>0&&(r.push(o),s.push(a));for(c=0,u=r.length;c=0;c--)0==(o=r[c]).length&&(r.splice(c,1),this.polygonPool.free(o),a=s[c],s.splice(c,1),this.polygonIndicesPool.free(a));return r},e.isConcave=function(t,e,i,n){var r=n[(e+t-1)%e]<<1,s=n[t]<<1,a=n[(t+1)%e]<<1;return!this.positiveArea(i[r],i[r+1],i[s],i[s+1],i[a],i[a+1])},e.positiveArea=function(t,e,i,n,r,s){return t*(s-n)+i*(e-s)+r*(n-e)>=0},e.winding=function(t,e,i,n,r,s){var a=i-t,o=n-e;return r*o-s*a+a*e-t*o>=0?1:-1},e})();t.Triangulator=e})(n||(n={})),(function(t){var e=(function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return void 0!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t})();t.IntSet=e;var i=(function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=i,this.a=n}return t.prototype.set=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,i,n){return this.r+=t,this.g+=e,this.b+=i,this.a+=n,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t})();t.Color=i;var n=(function(){function t(){}return t.clamp=function(t,e,i){return ti?i:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var n=Math.random(),r=e-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):e-Math.sqrt((1-n)*r*(e-i))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t})();t.MathUtils=n;var s=(function(){function t(){}return t.prototype.apply=function(t,e,i){return t+(e-t)*this.applyInternal(i)},t})();t.Interpolation=s;var a=(function(t){function e(e){var i=t.call(this)||this;return i.power=2,i.power=e,i}return r(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e})(s);t.Pow=a;var o=(function(t){function e(e){return t.call(this,e)||this}return r(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e})(a);t.PowOut=o;var l=(function(){function t(){}return t.arrayCopy=function(t,e,i,n,r){for(var s=e,a=n;s=i?e:t.setArraySize(e,i,n)},t.newArray=function(t,e){for(var i=new Array(t),n=0;n0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t})();t.TimeKeeper=_;var f=(function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*s;var a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var c=0,u=0,_=0;_0&&(l=o);for(var A,x=(A=t.bone).worldX,b=A.worldY,C=A.a,T=A.b,S=A.c,w=A.d,E=e,M=r;M0&&(s[x-1].vfOffset=p),s.length=x,a.length=f;var o=A-1;if(o>=0)if(g>0){var l=r[o];l.indexCount=g,l.vfCount=6*v,l.vertexCount=v,r.length=A}else r.length=A-1;if(0!=r.length){var h=n.vertices,c=n.uintVert;(!h||h.length>>0)+(w.b<<16)+(w.g<<8)+w.r,l=(E.a<<24>>>0)+(E.b<<16)+(E.g<<8)+E.r,b!==o||C!==l){var f=this._tempColors;b=o,C=l,x>0&&(f[x-1].vfOffset=p),f[x++]={fr:w.r,fg:w.g,fb:w.b,fa:w.a,dr:E.r,dg:E.g,db:E.b,da:E.a,vfOffset:0}}if(h.isClipping()){h.clipTriangles(u,T,_,S,u,w,E,!0,6,d,p,p+2);var m=h.clippedVertices,y=h.clippedTriangles;S=y.length,T=m.length/12*6;for(var v=0,g=d,A=y.length;v=0&&(g>0?((b=E[x]).indexCount=g,b.vertexCount=v,b.vfCount=6*v):A--),E[A]={tex:h,blendMode:C,indexCount:0,vertexCount:0,vfCount:0},A++,g=0,v=0),o?(a=M,T=24,S=6,i.computeWorldVertices(w.bone,u,p,6)):l&&(a=i.triangles,T=6*(i.worldVerticesLength>>1),S=a.length,i.computeWorldVertices(w,0,i.worldVerticesLength,u,p,6)),0!=T&&0!=S){for(var N=0,k=d,G=a.length;N0){for(var W=d,j=d+S;W=n&&(t&&t.call(e,!0),t=null)},a=0;a0)&&this.textureNames&&this.textureNames.length>0)return t||cc.errorID(7507,this.name),null;var e=this._getAtlas(t);if(!e)return null;var i=new sp.spine.AtlasAttachmentLoader(e),n=null,r=null;return this.skeletonJson?(r=new sp.spine.SkeletonJson(i),n=this.skeletonJson):(r=new sp.spine.SkeletonBinary(i),n=new Uint8Array(this._nativeAsset)),r.scale=this.scale,this._skeletonCache=r.readSkeletonData(n),e.dispose(),this._skeletonCache},getSkinsEnum:!1,getAnimsEnum:!1,_getTexture:function(t){for(var e=this.textureNames,i=0;i>>0)+(nt<<16)+(it<<8)+et,st=t.dr*Q,at=t.dg*$,ot=t.db*tt,v=((s?255:0)<<24>>>0)+(ot<<16)+(at<<8)+st}function Ct(t){return(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r}var Tt=(function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var i=e.prototype;return i.updateRenderData=function(t){if(!t.isAnimationCached()){var e=t._skeleton;e&&e.updateWorldTransform()}},i.fillVertices=function(t,e,i,n,r){var o,l=ht._vData,c=ht._iData,u=ht._uintVData;if(L.a=i.a*e.a*t.a*m*255,a=s?L.a:255,k=f*e.r*t.r*a,G=d*e.g*t.g*a,z=p*e.b*t.b*a,L.r=k*i.r,L.g=G*i.g,L.b=z*i.b,null==r.darkColor?F.set(0,0,0,1):(F.r=r.darkColor.r*k,F.g=r.darkColor.g*G,F.b=r.darkColor.b*z),F.a=s?255:0,n.isClipping()){var _=l.subarray(mt+2);n.clipTriangles(l.subarray(mt),dt,c.subarray(gt),vt,_,L,F,h,A);var g=new Float32Array(n.clippedVertices),b=n.clippedTriangles;if(vt=b.length,dt=g.length/x*A,o=ht.request(dt/A,vt),gt=o.indiceOffset,yt=o.vertexOffset,mt=o.byteOffset>>2,l=ht._vData,c=ht._iData,u=ht._uintVData,c.set(b,gt),ft)for(var C=0,T=g.length,S=mt;C>>0)+(g[w+4]<<16)+(g[w+3]<<8)+g[w+2],u[M+4]=y,h&&(v=(g[w+11]<<24>>>0)+(g[w+10]<<16)+(g[w+9]<<8)+g[w+8],u[M+5]=v)}else if(ft)for(var D=mt,B=mt+dt;D=0&&o==y.data.index&&(U=!0),U)if(l>=0&&l==y.data.index&&(U=!1),dt=0,vt=0,n=y.getAttachment())if(d=n instanceof C.RegionAttachment,p=n instanceof C.MeshAttachment,n instanceof C.ClippingAttachment)S.clipStart(y,n);else if(d||p)if(w=xt(n.region.texture._texture,y.data.blendMode)){if((H||w.getHash()!==ct.material.getHash())&&(H=!1,ct._flush(),ct.node=ut,ct.material=w),d){if(f=B,dt=4*A,vt=6,m=ht.request(4,6),gt=m.indiceOffset,yt=m.vertexOffset,mt=m.byteOffset>>2,e=ht._vData,i=ht._iData,n.computeWorldVertices(y.bone,e,mt,A),T&&c){T.strokeColor=I,T.moveTo(e[mt],e[mt+1]);for(var D=mt+A,L=mt+dt;D>1)*A,vt=f.length,m=ht.request(dt/A,vt),gt=m.indiceOffset,yt=m.vertexOffset,mt=m.byteOffset>>2,e=ht._vData,i=ht._iData,n.computeWorldVertices(y,0,n.worldVerticesLength,e,mt,A),T&&_)){T.strokeColor=O;for(var F=0,V=f.length;F0){for(var tt=gt,et=gt+vt;tt>2,n=ht._vData,r=ht._iData,s=ht._uintVData;for(var S=gt,w=gt+vt;S=x&&(bt(A=g[m++]),x=A.vfOffset),s[R]=y,s[R+1]=v}}}}},i.fillBuffers=function(t,e){var i=t.node;if(i._renderFlag|=T.FLAG_UPDATE_RENDER_DATA,t._skeleton){var n=i._color;f=n.r/255,d=n.g/255,p=n.b/255,m=n.a/255,h=t.useTint||t.isAnimationCached(),g=h?E:w,A=h?6:5,ut=t.node,ht=e.getBuffer("spine",g),ct=e,lt=t,H=!0,s=t.premultipliedAlpha,a=1,D=0,_t=!1,ft=t._effectDelegate&&t._effectDelegate._vertexEffect,(4294967295!==n._val||s)&&(_t=!0),h&&(D|=1);var r=void 0;lt.enableBatch&&(r=ut._worldMatrix,H=!1,D|=16),t.isAnimationCached()?this.cacheTraverse(r):(ft&&ft.begin(t._skeleton),this.realTimeTraverse(r),ft&&ft.end()),e.worldMatDirty++,t.attachUtil._syncAttachedNode(),ut=void 0,ht=void 0,ct=void 0,lt=void 0,ft=null}},i.postFillBuffers=function(t,e){e.worldMatDirty--},e})(n.default);i.default=Tt,n.default.register(b,Tt),e.exports=i.default}),{"../../cocos2d/core/renderer/assembler":238,"../../cocos2d/core/renderer/render-flow":242,"../../cocos2d/core/renderer/webgl/vertex-format":282,"./Skeleton":396,"./lib/spine":398}],403:[(function(t,e,i){"use strict";var n=function(){this.start=null,this.end=null,this.complete=null,this.event=null,this.interrupt=null,this.dispose=null};n.getListeners=function(t){return t.listener||(t.listener=new n),t.listener},e.exports=n}),{}],404:[(function(t,e,i){"use strict";var n=t("./lib/spine");sp.VertexEffectDelegate=cc.Class({name:"sp.VertexEffectDelegate",ctor:function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},clear:function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},initJitter:function(t,e){return this._effectType="jitter",this._vertexEffect=new n.JitterEffect(t,e),this._vertexEffect},initSwirlWithPow:function(t,e){return this._interpolation=new n.Pow(e),this._vertexEffect=new n.SwirlEffect(t,this._interpolation),this._vertexEffect},initSwirlWithPowOut:function(t,e){return this._interpolation=new n.PowOut(e),this._vertexEffect=new n.SwirlEffect(t,this._interpolation),this._vertexEffect},getJitterVertexEffect:function(){return this._vertexEffect},getSwirlVertexEffect:function(){return this._vertexEffect},getVertexEffect:function(){return this._vertexEffect},getEffectType:function(){return this._effectType}}),e.exports=sp.VertexEffectDelegate}),{"./lib/spine":398}],405:[(function(t,e,i){"use strict";(function(t,n){"object"==typeof i&&void 0!==e?n(i):"function"==typeof define&&define.amd?define(["exports"],n):n((void 0).box2d={})})(0,(function(t){function e(t,e){return void 0!==t?t:e}var i=1e37,n=1e-5,r=n*n,s=3.14159265359,a=2,o=8,l=.008,h=2/180*s,c=2*l,u=-1;var _=(function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.major=0,this.minor=0,this.revision=0,this.major=t,this.minor=e,this.revision=i}return t.prototype.toString=function(){return this.major+"."+this.minor+"."+this.revision},t})(),f=new _(2,3,2);function d(t,e){for(var i=[],n=0;ni?i:t}var b=isFinite;function C(t){return t*t}function T(t){return 1/Math.sqrt(t)}var S=Math.sqrt,w=Math.pow;var E=Math.cos,M=Math.sin,D=Math.acos,B=Math.asin,I=Math.atan2;var P=(function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.Clone=function(){return new t(this.x,this.y)},t.prototype.SetZero=function(){return this.x=0,this.y=0,this},t.prototype.Set=function(t,e){return this.x=t,this.y=e,this},t.prototype.Copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.SelfAddXY=function(t,e){return this.x+=t,this.y+=e,this},t.prototype.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.SelfSubXY=function(t,e){return this.x-=t,this.y-=e,this},t.prototype.SelfMul=function(t){return this.x*=t,this.y*=t,this},t.prototype.SelfMulAdd=function(t,e){return this.x+=t*e.x,this.y+=t*e.y,this},t.prototype.SelfMulSub=function(t,e){return this.x-=t*e.x,this.y-=t*e.y,this},t.prototype.Dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.Cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.Length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},t.prototype.LengthSquared=function(){var t=this.x,e=this.y;return t*t+e*e},t.prototype.Normalize=function(){var t=this.Length();if(t>=n){var e=1/t;this.x*=e,this.y*=e}return t},t.prototype.SelfNormalize=function(){var t=this.Length();if(t>=n){var e=1/t;this.x*=e,this.y*=e}return this},t.prototype.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},t.prototype.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},t.prototype.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},t.prototype.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},t.prototype.SelfMinV=function(t){return this.x=g(this.x,t.x),this.y=g(this.y,t.y),this},t.prototype.SelfMaxV=function(t){return this.x=A(this.x,t.x),this.y=A(this.y,t.y),this},t.prototype.SelfAbs=function(){return this.x=v(this.x),this.y=v(this.y),this},t.prototype.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return d(e,(function(e){return new t}))},t.AbsV=function(t,e){return e.x=v(t.x),e.y=v(t.y),e},t.MinV=function(t,e,i){return i.x=g(t.x,e.x),i.y=g(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=A(t.x,e.x),i.y=A(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=x(t.x,e.x,i.x),n.y=x(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),a=Math.sin(e);return i.x=s*n-a*r,i.y=a*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},t.ZERO=new t(0,0),t.UNITX=new t(1,0),t.UNITY=new t(0,1),t.s_t0=new t,t.s_t1=new t,t.s_t2=new t,t.s_t3=new t,t})(),R=new P(0,0),O=(function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.Clone=function(){return new t(this.x,this.y,this.z)},t.prototype.SetZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.SetXYZ=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},t.prototype.Copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.SelfAddXYZ=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},t.prototype.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},t.prototype.SelfSubXYZ=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},t.prototype.SelfMul=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.DotV3V3=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.CrossV3V3=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return i.x=r*l-s*o,i.y=s*a-n*l,i.z=n*o-r*a,i},t.ZERO=new t(0,0,0),t.s_t0=new t,t})(),L=(function(){function t(){this.ex=new P(1,0),this.ey=new P(0,1)}return t.prototype.Clone=function(){return(new t).Copy(this)},t.FromVV=function(e,i){return(new t).SetVV(e,i)},t.FromSSSS=function(e,i,n,r){return(new t).SetSSSS(e,i,n,r)},t.FromAngle=function(e){return(new t).SetAngle(e)},t.prototype.SetSSSS=function(t,e,i,n){return this.ex.Set(t,i),this.ey.Set(e,n),this},t.prototype.SetVV=function(t,e){return this.ex.Copy(t),this.ey.Copy(e),this},t.prototype.SetAngle=function(t){var e=Math.cos(t),i=Math.sin(t);return this.ex.Set(e,i),this.ey.Set(-i,e),this},t.prototype.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this},t.prototype.SetIdentity=function(){return this.ex.Set(1,0),this.ey.Set(0,1),this},t.prototype.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this},t.prototype.GetAngle=function(){return Math.atan2(this.ex.y,this.ex.x)},t.prototype.GetInverse=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;return 0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.y=-s*n,t.ey.y=s*e,t},t.prototype.Solve=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},t.prototype.SelfAbs=function(){return this.ex.SelfAbs(),this.ey.SelfAbs(),this},t.prototype.SelfInv=function(){return this.GetInverse(this),this},t.prototype.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this},t.prototype.SelfSubM=function(t){return this.ex.SelfSub(t.ex),this.ey.SelfSub(t.ey),this},t.AbsM=function(t,e){var i=t.ex,n=t.ey;return e.ex.x=v(i.x),e.ex.y=v(i.y),e.ey.x=v(n.x),e.ey.y=v(n.y),e},t.MulMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+r.x*a,i.y=n.y*s+r.y*a,i},t.MulTMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+n.y*a,i.y=r.x*s+r.y*a,i},t.AddMM=function(t,e,i){var n=t.ex,r=t.ey,s=e.ex,a=e.ey;return i.ex.x=n.x+s.x,i.ex.y=n.y+s.y,i.ey.x=r.x+a.x,i.ey.y=r.y+a.y,i},t.MulMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,l=e.ex.y,h=e.ey.x,c=e.ey.y;return i.ex.x=n*o+s*l,i.ex.y=r*o+a*l,i.ey.x=n*h+s*c,i.ey.y=r*h+a*c,i},t.MulTMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,l=e.ex.y,h=e.ey.x,c=e.ey.y;return i.ex.x=n*o+r*l,i.ex.y=s*o+a*l,i.ey.x=n*h+r*c,i.ey.y=s*h+a*c,i},t.IDENTITY=new t,t})(),F=(function(){function t(){this.ex=new O(1,0,0),this.ey=new O(0,1,0),this.ez=new O(0,0,1)}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.SetVVV=function(t,e,i){return this.ex.Copy(t),this.ey.Copy(e),this.ez.Copy(i),this},t.prototype.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this.ez.Copy(t.ez),this},t.prototype.SetIdentity=function(){return this.ex.SetXYZ(1,0,0),this.ey.SetXYZ(0,1,0),this.ez.SetXYZ(0,0,1),this},t.prototype.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this.ez.SetZero(),this},t.prototype.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this.ez.SelfAdd(t.ez),this},t.prototype.Solve33=function(t,e,i,n){var r=this.ex.x,s=this.ex.y,a=this.ex.z,o=this.ey.x,l=this.ey.y,h=this.ey.z,c=this.ez.x,u=this.ez.y,_=this.ez.z,f=r*(l*_-h*u)+s*(h*c-o*_)+a*(o*u-l*c);return 0!==f&&(f=1/f),n.x=f*(t*(l*_-h*u)+e*(h*c-o*_)+i*(o*u-l*c)),n.y=f*(r*(e*_-i*u)+s*(i*c-t*_)+a*(t*u-e*c)),n.z=f*(r*(l*i-h*e)+s*(h*t-o*i)+a*(o*e-l*t)),n},t.prototype.Solve22=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},t.prototype.GetInverse22=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.z=0,t.ex.y=-s*n,t.ey.y=s*e,t.ey.z=0,t.ez.x=0,t.ez.y=0,t.ez.z=0},t.prototype.GetSymInverse33=function(t){var e=O.DotV3V3(this.ex,O.CrossV3V3(this.ey,this.ez,O.s_t0));0!==e&&(e=1/e);var i=this.ex.x,n=this.ey.x,r=this.ez.x,s=this.ey.y,a=this.ez.y,o=this.ez.z;t.ex.x=e*(s*o-a*a),t.ex.y=e*(r*a-n*o),t.ex.z=e*(n*a-r*s),t.ey.x=t.ex.y,t.ey.y=e*(i*o-r*r),t.ey.z=e*(r*n-i*a),t.ez.x=t.ex.z,t.ez.y=t.ey.z,t.ez.z=e*(i*s-n*n)},t.MulM33V3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return i.x=t.ex.x*n+t.ey.x*r+t.ez.x*s,i.y=t.ex.y*n+t.ey.y*r+t.ez.y*s,i.z=t.ex.z*n+t.ey.z*r+t.ez.z*s,i},t.MulM33XYZ=function(t,e,i,n,r){return r.x=t.ex.x*e+t.ey.x*i+t.ez.x*n,r.y=t.ex.y*e+t.ey.y*i+t.ez.y*n,r.z=t.ex.z*e+t.ey.z*i+t.ez.z*n,r},t.MulM33V2=function(t,e,i){var n=e.x,r=e.y;return i.x=t.ex.x*n+t.ey.x*r,i.y=t.ex.y*n+t.ey.y*r,i},t.MulM33XY=function(t,e,i,n){return n.x=t.ex.x*e+t.ey.x*i,n.y=t.ex.y*e+t.ey.y*i,n},t.IDENTITY=new t,t})(),V=(function(){function t(t){void 0===t&&(t=0),this.s=0,this.c=1,t&&(this.s=Math.sin(t),this.c=Math.cos(t))}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.s=t.s,this.c=t.c,this},t.prototype.SetAngle=function(t){return this.s=Math.sin(t),this.c=Math.cos(t),this},t.prototype.SetIdentity=function(){return this.s=0,this.c=1,this},t.prototype.GetAngle=function(){return Math.atan2(this.s,this.c)},t.prototype.GetXAxis=function(t){return t.x=this.c,t.y=this.s,t},t.prototype.GetYAxis=function(t){return t.x=-this.s,t.y=this.c,t},t.MulRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=r*s+n*a,i.c=n*s-r*a,i},t.MulTRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=n*a-r*s,i.c=n*s+r*a,i},t.MulRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s-r*a,i.y=r*s+n*a,i},t.MulTRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t.IDENTITY=new t,t})(),N=(function(){function t(){this.p=new P,this.q=new V}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.p.Copy(t.p),this.q.Copy(t.q),this},t.prototype.SetIdentity=function(){return this.p.SetZero(),this.q.SetIdentity(),this},t.prototype.SetPositionRotation=function(t,e){return this.p.Copy(t),this.q.Copy(e),this},t.prototype.SetPositionAngle=function(t,e){return this.p.Copy(t),this.q.SetAngle(e),this},t.prototype.SetPosition=function(t){return this.p.Copy(t),this},t.prototype.SetPositionXY=function(t,e){return this.p.Set(t,e),this},t.prototype.SetRotation=function(t){return this.q.Copy(t),this},t.prototype.SetRotationAngle=function(t){return this.q.SetAngle(t),this},t.prototype.GetPosition=function(){return this.p},t.prototype.GetRotation=function(){return this.q},t.prototype.GetRotationAngle=function(){return this.q.GetAngle()},t.prototype.GetAngle=function(){return this.q.GetAngle()},t.MulXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x,a=e.y;return i.x=n*s-r*a+t.p.x,i.y=r*s+n*a+t.p.y,i},t.MulTXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x-t.p.x,a=e.y-t.p.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t.MulXX=function(t,e,i){return V.MulRR(t.q,e.q,i.q),P.AddVV(V.MulRV(t.q,e.p,i.p),t.p,i.p),i},t.MulTXX=function(t,e,i){return V.MulTRR(t.q,e.q,i.q),V.MulTRV(t.q,P.SubVV(e.p,t.p,i.p),i.p),i},t.IDENTITY=new t,t})(),k=(function(){function t(){this.localCenter=new P,this.c0=new P,this.c=new P,this.a0=0,this.a=0,this.alpha0=0}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.localCenter.Copy(t.localCenter),this.c0.Copy(t.c0),this.c.Copy(t.c),this.a0=t.a0,this.a=t.a,this.alpha0=t.alpha0,this},t.prototype.GetTransform=function(t,e){var i=1-e;t.p.x=i*this.c0.x+e*this.c.x,t.p.y=i*this.c0.y+e*this.c.y;var n=i*this.a0+e*this.a;return t.q.SetAngle(n),t.p.SelfSub(V.MulRV(t.q,this.localCenter,P.s_t0)),t},t.prototype.Advance=function(t){var e=(t-this.alpha0)/(1-this.alpha0),i=1-e;this.c0.x=i*this.c0.x+e*this.c.x,this.c0.y=i*this.c0.y+e*this.c.y,this.a0=i*this.a0+e*this.a,this.alpha0=t},t.prototype.Normalize=function(){var t=6.28318530718*Math.floor(this.a0/6.28318530718);this.a0-=t,this.a-=t},t})(),G=(function(){function t(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.IsEqual=function(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},t.prototype.IsZero=function(){return 0===this.r&&0===this.g&&0===this.b&&0===this.a},t.prototype.Set=function(t,e,i,n){void 0===n&&(n=this.a),this.SetRGBA(t,e,i,n)},t.prototype.SetByteRGB=function(t,e,i){return this.r=t/255,this.g=e/255,this.b=i/255,this},t.prototype.SetByteRGBA=function(t,e,i,n){return this.r=t/255,this.g=e/255,this.b=i/255,this.a=n/255,this},t.prototype.SetRGB=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},t.prototype.SetRGBA=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this},t.prototype.SelfAdd=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},t.prototype.Add=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,e.a=this.a+t.a,e},t.prototype.SelfSub=function(t){return this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a,this},t.prototype.Sub=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,e},t.prototype.SelfMul=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.Mul=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,e},t.prototype.Mix=function(e,i){t.MixColors(this,e,i)},t.MixColors=function(t,e,i){var n=i*(e.r-t.r),r=i*(e.g-t.g),s=i*(e.b-t.b),a=i*(e.a-t.a);t.r+=n,t.g+=r,t.b+=s,t.a+=a,e.r-=n,e.g-=r,e.b-=s,e.a-=a},t.prototype.MakeStyleString=function(e){return void 0===e&&(e=this.a),t.MakeStyleString(this.r,this.g,this.b,e)},t.MakeStyleString=function(t,e,i,n){return void 0===n&&(n=1),t*=255,e*=255,i*=255,n<1?"rgba("+t+","+e+","+i+","+n+")":"rgb("+t+","+e+","+i+")"},t.ZERO=new t(0,0,0,0),t.RED=new t(1,0,0),t.GREEN=new t(0,1,0),t.BLUE=new t(0,0,1),t})();(function(t){t[t.e_none=0]="e_none",t[t.e_shapeBit=1]="e_shapeBit",t[t.e_jointBit=2]="e_jointBit",t[t.e_aabbBit=4]="e_aabbBit",t[t.e_pairBit=8]="e_pairBit",t[t.e_centerOfMassBit=16]="e_centerOfMassBit",t[t.e_particleBit=32]="e_particleBit",t[t.e_controllerBit=64]="e_controllerBit",t[t.e_all=63]="e_all"})(t.b2DrawFlags||(t.b2DrawFlags={}));var z=(function(){function t(){this.m_drawFlags=0}return t.prototype.SetFlags=function(t){this.m_drawFlags=t},t.prototype.GetFlags=function(){return this.m_drawFlags},t.prototype.AppendFlags=function(t){this.m_drawFlags|=t},t.prototype.ClearFlags=function(t){this.m_drawFlags&=~t},t})(),U=(function(){function t(){this.m_start=Date.now()}return t.prototype.Reset=function(){return this.m_start=Date.now(),this},t.prototype.GetMilliseconds=function(){return Date.now()-this.m_start},t})(),H=(function(){function t(){this.m_count=0,this.m_min_count=0,this.m_max_count=0}return t.prototype.GetCount=function(){return this.m_count},t.prototype.GetMinCount=function(){return this.m_min_count},t.prototype.GetMaxCount=function(){return this.m_max_count},t.prototype.ResetCount=function(){var t=this.m_count;return this.m_count=0,t},t.prototype.ResetMinCount=function(){this.m_min_count=0},t.prototype.ResetMaxCount=function(){this.m_max_count=0},t.prototype.Increment=function(){this.m_count++,this.m_max_countthis.m_count&&(this.m_min_count=this.m_count)},t})(),W=(function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=d(t,(function(t){return null})),this.m_count=0}return t.prototype.Reset=function(){return this.m_count=0,this},t.prototype.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},t.prototype.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},t.prototype.GetCount=function(){return this.m_count},t})(),j=(function(){return function(){}})(),X=(function(){return function(){}})(),Y=(function(){function t(){this.m_buffer=P.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}return t.prototype.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},t.prototype.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},t.prototype.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},t.prototype.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},t.prototype.GetSupport=function(t){for(var e=0,i=P.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return e},t.prototype.GetSupportVertex=function(t){for(var e=0,i=P.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return this.m_vertices[e]},t.prototype.GetVertexCount=function(){return this.m_count},t.prototype.GetVertex=function(t){return this.m_vertices[t]},t})(),q=(function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t})(),J=(function(){function t(){this.proxyA=new Y,this.proxyB=new Y,this.transformA=new N,this.transformB=new N,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t})(),Z=(function(){function t(){this.pointA=new P,this.pointB=new P,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t})(),K=(function(){return function(){this.proxyA=new Y,this.proxyB=new Y,this.transformA=new N,this.transformB=new N,this.translationB=new P}})(),Q=(function(){return function(){this.point=new P,this.normal=new P,this.lambda=0,this.iterations=0}})();t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var $=(function(){function t(){this.wA=new P,this.wB=new P,this.w=new P,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t})(),tt=(function(){function t(){this.m_v1=new $,this.m_v2=new $,this.m_v3=new $,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}return t.prototype.ReadCache=function(t,e,i,r,s){this.m_count=t.count;for(var a=this.m_vertices,o=0;o1){var c=t.metric,u=this.GetMetric();(u<.5*c||2*c0?P.CrossOneV(e,t):P.CrossVOne(e,t);default:return t.SetZero()}},t.prototype.GetClosestPoint=function(t){switch(this.m_count){case 0:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2:return t.Set(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);case 3:default:return t.SetZero()}},t.prototype.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y}},t.prototype.GetMetric=function(){switch(this.m_count){case 0:case 1:return 0;case 2:return P.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return P.CrossVV(P.SubVV(this.m_v2.w,this.m_v1.w,P.s_t0),P.SubVV(this.m_v3.w,this.m_v1.w,P.s_t1));default:return 0}},t.prototype.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=P.SubVV(i,e,t.s_e12),r=-P.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=P.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var a=1/(s+r);this.m_v1.a=s*a,this.m_v2.a=r*a,this.m_count=2},t.prototype.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=P.SubVV(i,e,t.s_e12),s=P.DotVV(e,r),a=P.DotVV(i,r),o=-s,l=P.SubVV(n,e,t.s_e13),h=P.DotVV(e,l),c=P.DotVV(n,l),u=-h,_=P.SubVV(n,i,t.s_e23),f=P.DotVV(i,_),d=P.DotVV(n,_),p=-f,m=P.CrossVV(r,l),y=m*P.CrossVV(i,n),v=m*P.CrossVV(n,e),g=m*P.CrossVV(e,i);if(o<=0&&u<=0)return this.m_v1.a=1,void(this.m_count=1);if(a>0&&o>0&&g<=0){var A=1/(a+o);return this.m_v1.a=a*A,this.m_v2.a=o*A,void(this.m_count=2)}if(c>0&&u>0&&v<=0){var x=1/(c+u);return this.m_v1.a=c*x,this.m_v3.a=u*x,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(c<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(d>0&&p>0&&y<=0){var b=1/(d+p);return this.m_v2.a=d*b,this.m_v3.a=p*b,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var C=1/(y+v+g);this.m_v1.a=y*C,this.m_v2.a=v*C,this.m_v3.a=g*C,this.m_count=3},t.s_e12=new P,t.s_e13=new P,t.s_e23=new P,t})(),et=new tt,it=[0,0,0],nt=[0,0,0],rt=new P,st=new P,at=new P,ot=new P,lt=new P;function ht(e,i,s){++t.b2_gjkCalls;var a=s.proxyA,o=s.proxyB,l=s.transformA,h=s.transformB,c=et;c.ReadCache(i,a,l,o,h);for(var u=c.m_vertices,_=it,f=nt,d=0,p=0;p<20;){d=c.m_count;for(var m=0;mx+b&&e.distance>n){e.distance-=x+b;var C=P.SubVV(e.pointB,e.pointA,at);C.Normalize(),e.pointA.SelfMulAdd(x,C),e.pointB.SelfMulSub(b,C)}else{var T=P.MidVV(e.pointA,e.pointB,rt);e.pointA.Copy(T),e.pointB.Copy(T),e.distance=0}}}var ct=new P,ut=new tt,_t=new P,ft=new P,dt=new P,pt=new P,mt=new P,yt=new P;(function(t){t[t.e_vertex=0]="e_vertex",t[t.e_face=1]="e_face"})(t.b2ContactFeatureType||(t.b2ContactFeatureType={}));var vt=(function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexA",{get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexB",{get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeA",{get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeB",{get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),t})(),gt=(function(){function t(){this.cf=new vt}return t.prototype.Copy=function(t){return this.key=t.key,this},t.prototype.Clone=function(){return(new t).Copy(this)},Object.defineProperty(t.prototype,"key",{get:function(){return this.cf.key},set:function(t){this.cf.key=t},enumerable:!0,configurable:!0}),t})(),At=(function(){function t(){this.localPoint=new P,this.normalImpulse=0,this.tangentImpulse=0,this.id=new gt}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t.prototype.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},t.prototype.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t})();(function(t){t[t.e_unknown=-1]="e_unknown",t[t.e_circles=0]="e_circles",t[t.e_faceA=1]="e_faceA",t[t.e_faceB=2]="e_faceB"})(t.b2ManifoldType||(t.b2ManifoldType={}));var xt=(function(){function e(){this.points=At.MakeArray(a),this.localNormal=new P,this.localPoint=new P,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}return e.prototype.Reset=function(){for(var e=0;er&&P.SubVV(h,l,this.normal).SelfNormalize();var c=P.AddVMulSV(l,s,this.normal,e.Initialize_s_cA),u=P.SubVMulSV(h,o,this.normal,e.Initialize_s_cB);P.MidVV(c,u,this.points[0]),this.separations[0]=P.DotVV(P.SubVV(u,c,P.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:V.MulRV(n.q,i.localNormal,this.normal);for(var _=N.MulXV(n,i.localPoint,e.Initialize_s_planePoint),f=0;f=0&&e>=0;return i=i&&this.lowerBound.IsValid()&&this.upperBound.IsValid()},t.prototype.GetCenter=function(){return P.MidVV(this.lowerBound,this.upperBound,this.m_cache_center)},t.prototype.GetExtents=function(){return P.ExtVV(this.lowerBound,this.upperBound,this.m_cache_extent)},t.prototype.GetPerimeter=function(){return 2*(this.upperBound.x-this.lowerBound.x+(this.upperBound.y-this.lowerBound.y))},t.prototype.Combine1=function(t){return this.lowerBound.x=g(this.lowerBound.x,t.lowerBound.x),this.lowerBound.y=g(this.lowerBound.y,t.lowerBound.y),this.upperBound.x=A(this.upperBound.x,t.upperBound.x),this.upperBound.y=A(this.upperBound.y,t.upperBound.y),this},t.prototype.Combine2=function(t,e){return this.lowerBound.x=g(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=g(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=A(t.upperBound.x,e.upperBound.x),this.upperBound.y=A(t.upperBound.y,e.upperBound.y),this},t.Combine=function(t,e,i){return i.Combine2(t,e),i},t.prototype.Contains=function(t){var e=!0;return e=(e=(e=(e=e&&this.lowerBound.x<=t.lowerBound.x)&&this.lowerBound.y<=t.lowerBound.y)&&t.upperBound.x<=this.upperBound.x)&&t.upperBound.y<=this.upperBound.y},t.prototype.RayCast=function(t,e){var r=-i,s=i,a=e.p1.x,o=e.p1.y,l=e.p2.x-e.p1.x,h=e.p2.y-e.p1.y,c=v(l),u=v(h),_=t.normal;if(c(y=(this.upperBound.x-a)*f)){var p=m;m=y,y=p,d=1}if(m>r&&(_.x=d,_.y=0,r=m),r>(s=g(s,y)))return!1}if(u(y=(this.upperBound.y-o)*f)){p=m;m=y,y=p,d=1}if(m>r&&(_.x=0,_.y=d,r=m),r>(s=g(s,y)))return!1}return!(r<0||e.maxFraction0||i>0)&&!(n>0||r>0)},t})();function Et(t,e){var i=e.lowerBound.x-t.upperBound.x,n=e.lowerBound.y-t.upperBound.y,r=t.lowerBound.x-e.upperBound.x,s=t.lowerBound.y-e.upperBound.y;return!(i>0||n>0)&&!(r>0||s>0)}function Mt(e,i,n,r,s){var a=0,o=i[0],l=i[1],h=P.DotVV(n,o.v)-r,c=P.DotVV(n,l.v)-r;if(h<=0&&e[a++].Copy(o),c<=0&&e[a++].Copy(l),h*c<0){var u=h/(h-c),_=e[a].v;_.x=o.v.x+u*(l.v.x-o.v.x),_.y=o.v.y+u*(l.v.y-o.v.y);var f=e[a].id;f.cf.indexA=s,f.cf.indexB=o.id.cf.indexB,f.cf.typeA=t.b2ContactFeatureType.e_vertex,f.cf.typeB=t.b2ContactFeatureType.e_face,++a}return a}var Dt=new J,Bt=new q,It=new Z;function Pt(t,e,i,r,s,a){var o=Dt.Reset();o.proxyA.SetShape(t,e),o.proxyB.SetShape(i,r),o.transformA.Copy(s),o.transformB.Copy(a),o.useRadii=!0;var l=Bt.Reset();l.count=0;var h=It.Reset();return ht(h,l,o),h.distance<10*n}function Rt(t){if(null===t)throw new Error;return t}var Ot=(function(){function t(t){void 0===t&&(t=0),this.m_id=0,this.aabb=new wt,this.parent=null,this.child1=null,this.child2=null,this.height=0,this.m_id=t}return t.prototype.IsLeaf=function(){return null===this.child1},t})(),Lt=(function(){function t(){this.m_root=null,this.m_freeList=null,this.m_path=0,this.m_insertionCount=0,this.m_stack=new W(256)}return t.prototype.Query=function(t,e){if(null!==this.m_root){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(Rt(n.child1)),i.Push(Rt(n.child2))}}},t.prototype.QueryPoint=function(t,e){if(null!==this.m_root){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(Rt(n.child1)),i.Push(Rt(n.child2))}}},t.prototype.RayCast=function(e,i){if(null!==this.m_root){var n=e.p1,r=e.p2,s=P.SubVV(r,n,t.s_r);s.Normalize();var a=P.CrossOneV(s,t.s_v),o=P.AbsV(a,t.s_abs_v),l=e.maxFraction,h=t.s_segmentAABB,c=n.x+l*(r.x-n.x),u=n.y+l*(r.y-n.y);h.lowerBound.x=g(n.x,c),h.lowerBound.y=g(n.y,u),h.upperBound.x=A(n.x,c),h.upperBound.y=A(n.y,u);var _=this.m_stack.Reset();for(_.Push(this.m_root);_.GetCount()>0;){var f=_.Pop();if(Et(f.aabb,h)){var d=f.aabb.GetCenter(),p=f.aabb.GetExtents();if(!(v(P.DotVV(a,P.SubVV(n,d,P.s_t0)))-P.DotVV(o,p)>0))if(f.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=l;var y=i(m,f);if(0===y)return;y>0&&(l=y,c=n.x+l*(r.x-n.x),u=n.y+l*(r.y-n.y),h.lowerBound.x=g(n.x,c),h.lowerBound.y=g(n.y,u),h.upperBound.x=A(n.x,c),h.upperBound.y=A(n.y,u))}else _.Push(Rt(f.child1)),_.Push(Rt(f.child2))}}}},t.prototype.AllocateNode=function(){if(this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,delete e.userData,e}return new Ot(t.s_node_id++)},t.prototype.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,delete t.userData,this.m_freeList=t},t.prototype.CreateProxy=function(t,e){var i=this.AllocateNode();return i.aabb.lowerBound.x=t.lowerBound.x-.1,i.aabb.lowerBound.y=t.lowerBound.y-.1,i.aabb.upperBound.x=t.upperBound.x+.1,i.aabb.upperBound.y=t.upperBound.y+.1,i.userData=e,i.height=0,this.InsertLeaf(i),i},t.prototype.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},t.prototype.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);var n=.1+2*(i.x>0?i.x:-i.x),r=.1+2*(i.y>0?i.y:-i.y);return t.aabb.lowerBound.x=e.lowerBound.x-n,t.aabb.lowerBound.y=e.lowerBound.y-r,t.aabb.upperBound.x=e.upperBound.x+n,t.aabb.upperBound.y=e.upperBound.y+r,this.InsertLeaf(t),!0},t.prototype.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=Rt(n.child1),s=Rt(n.child2),a=n.aabb.GetPerimeter(),o=t.s_combinedAABB;o.Combine2(n.aabb,i);var l=o.GetPerimeter(),h=2*l,c=2*(l-a),u=void 0,_=t.s_aabb,f=void 0;r.IsLeaf()?(_.Combine2(i,r.aabb),u=_.GetPerimeter()+c):(_.Combine2(i,r.aabb),f=r.aabb.GetPerimeter(),u=_.GetPerimeter()-f+c);var d=void 0;if(s.IsLeaf()?(_.Combine2(i,s.aabb),d=_.GetPerimeter()+c):(_.Combine2(i,s.aabb),f=s.aabb.GetPerimeter(),d=_.GetPerimeter()-f+c),h1){var r=Rt(i.child1),s=Rt(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+A(e.height,s.height),i.height=1+A(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+A(e.height,r.height),i.height=1+A(t.height,s.height)),i}if(n<-1){var a=Rt(e.child1),o=Rt(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,a.height>o.height?(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+A(i.height,o.height),e.height=1+A(t.height,a.height)):(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+A(i.height,a.height),e.height=1+A(t.height,o.height)),e}return t},t.prototype.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return i+=t.GetAreaNode(e.child1),i+=t.GetAreaNode(e.child2)},t.prototype.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.prototype.ComputeHeightNode=function(t){if(!t||t.IsLeaf())return 0;var e=this.ComputeHeightNode(t.child1),i=this.ComputeHeightNode(t.child2);return 1+A(e,i)},t.prototype.ComputeHeight=function(){return this.ComputeHeightNode(this.m_root)},t.prototype.ValidateStructure=function(t){if(null!==t){this.m_root;var e=t;if(!e.IsLeaf()){var i=Rt(e.child1),n=Rt(e.child2);this.ValidateStructure(i),this.ValidateStructure(n)}}},t.prototype.ValidateMetrics=function(e){if(null!==e){var i=e;if(!i.IsLeaf()){var n=Rt(i.child1),r=Rt(i.child2);t.s_aabb.Combine2(n.aabb,r.aabb),this.ValidateMetrics(n),this.ValidateMetrics(r)}}},t.prototype.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=Rt(t.child1),n=Rt(t.child2),r=v(n.height-i.height);return A(e,r)},t.prototype.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},t.prototype.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},t.prototype.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t.s_r=new P,t.s_v=new P,t.s_abs_v=new P,t.s_segmentAABB=new wt,t.s_subInput=new Tt,t.s_combinedAABB=new wt,t.s_aabb=new wt,t.s_node_id=0,t})(),Ft=(function(){return function(t,e){this.proxyA=t,this.proxyB=e}})(),Vt=(function(){function t(){this.m_tree=new Lt,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}return t.prototype.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},t.prototype.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},t.prototype.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},t.prototype.TouchProxy=function(t){this.BufferMove(t)},t.prototype.GetProxyCount=function(){return this.m_proxyCount},t.prototype.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(t){var i=n.m_moveBuffer[t];if(null===i)return"continue";var r=i.aabb;n.m_tree.Query(r,(function(t){if(t.m_id===i.m_id)return!0;var n,r;if(t.m_id_+f){e.state=t.b2TOIOutputState.e_separated,e.t=c,T=!0;break}if(D>_-f){d=S;break}var B=C.Evaluate(E[0],M[0],d);if(B<_-f){e.state=t.b2TOIOutputState.e_failed,e.t=d,T=!0;break}if(B<=_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d,T=!0;break}for(var I=0,P=d,R=S;;){var O=0;O=1&I?P+(_-B)*(R-P)/(D-B):.5*(P+R),++I,++t.b2_toiRootIters;var L=C.Evaluate(E[0],M[0],O);if(v(L-_)_?(P=O,B=L):(R=O,D=L),50===I)break}if(t.b2_toiMaxRootIters=A(t.b2_toiMaxRootIters,I),++w===o)break}if(++p,++t.b2_toiIters,T)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=d;break}}t.b2_toiMaxIters=A(t.b2_toiMaxIters,p);var F=n.GetMilliseconds();t.b2_toiMaxTime=A(t.b2_toiMaxTime,F),t.b2_toiTime+=F}var se=new P,ae=new P;function oe(e,i,n,r,s){e.pointCount=0;var a=N.MulXV(n,i.m_p,se),o=N.MulXV(s,r.m_p,ae),l=P.DistanceSquaredVV(a,o),h=i.m_radius+r.m_radius;l>h*h||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var le=new P,he=new P,ce=new P;function ue(e,r,s,a,o){e.pointCount=0;for(var l=N.MulXV(o,a.m_p,le),h=N.MulTXV(s,l,he),c=0,u=-i,_=r.m_radius+a.m_radius,f=r.m_count,d=r.m_vertices,p=r.m_normals,m=0;m_)return;y>u&&(u=y,c=m)}var v=c,g=(v+1)%f,A=d[v],x=d[g];if(u_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,P.SubVV(h,A,e.localNormal).SelfNormalize(),e.localPoint.Copy(A),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else if(C<=0){if(P.DistanceSquaredVV(h,x)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,P.SubVV(h,x,e.localNormal).SelfNormalize(),e.localPoint.Copy(x),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else{var T=P.MidVV(A,x,ce);if(P.DotVV(P.SubVV(h,T,P.s_t1),p[v])>_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[v]).SelfNormalize(),e.localPoint.Copy(T),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}}var _e=new P,fe=new P,de=new P,pe=new P;function me(t,e,n,r,s){for(var a=t.m_vertices,o=t.m_normals,l=r.m_count,h=r.m_vertices,c=V.MulRV(e.q,o[n],_e),u=V.MulTRV(s.q,c,fe),_=0,f=i,d=0;du&&(u=f,c=_)}var d=me(e,n,c,r,s),p=(c+a-1)%a,m=me(e,n,p,r,s),y=(c+1)%a,v=me(e,n,y,r,s),g=0,A=0,x=0;if(m>d&&m>v)x=-1,g=p,A=m;else{if(!(v>d))return t[0]=c,d;x=1,g=y,A=v}for(;(d=me(e,n,c=-1===x?(g+a-1)%a:(g+1)%a,r,s))>A;)g=c,A=d;return t[0]=g,A}var Ae=new P;function xe(e,n,r,s,a,o){for(var l=n.m_normals,h=a.m_count,c=a.m_vertices,u=a.m_normals,_=V.MulTRV(o.q,V.MulRV(r.q,l[s],P.s_t0),Ae),f=0,d=i,p=0;po)){var c=we;c[0]=0;var u=ge(c,r,s,i,n);if(!(u>o)){var _,f,d,p,m=0,y=0;u>.98*h+.001?(_=r,f=i,d=s,p=n,m=c[0],e.type=t.b2ManifoldType.e_faceB,y=1):(_=i,f=r,d=n,p=s,m=l[0],e.type=t.b2ManifoldType.e_faceA,y=0);var v=be;xe(v,_,d,m,f,p);var g=_.m_count,A=_.m_vertices,x=m,b=(m+1)%g,C=A[x],T=A[b],S=P.SubVV(T,C,Ee);S.Normalize();var w=P.CrossVOne(S,Me),E=P.MidVV(C,T,De),M=V.MulRV(d.q,S,Ie),D=P.CrossVOne(M,Be),B=N.MulXV(d,C,Re),I=N.MulXV(d,T,Oe),R=P.DotVV(D,B),O=-P.DotVV(M,B)+o,L=P.DotVV(M,I)+o,F=Ce,k=Te;if(!(Mt(F,v,P.NegV(M,Pe),O,x)<2||Mt(k,F,M,L,b)<2)){e.localNormal.Copy(w),e.localPoint.Copy(E);for(var G=0,z=0;z_*_)return;if(i.m_hasVertex0){var m=i.m_vertex0,y=o,v=P.SubVV(y,m,ke);if(P.DotVV(v,P.SubVV(y,a,P.s_t0))>0)return}return f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(d),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}if(c<=0){var g=l,A=P.SubVV(a,g,Ne);if(P.DotVV(A,A)>_*_)return;if(i.m_hasVertex3){var x=i.m_vertex3,b=l,C=P.SubVV(x,b,Ge);if(P.DotVV(C,P.SubVV(a,b,P.s_t0))>0)return}return f.cf.indexA=1,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(g),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}var T=P.DotVV(h,h),S=ze;S.x=1/T*(c*o.x+u*l.x),S.y=1/T*(c*o.y+u*l.y);var w=P.SubVV(a,S,Ne);if(!(P.DotVV(w,w)>_*_)){var E=Ue.Set(-h.y,h.x);P.DotVV(E,P.SubVV(a,o,P.s_t0))<0&&E.Set(-E.x,-E.y),E.Normalize(),f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(E),e.localPoint.Copy(o),e.points[0].id.Copy(f),e.points[0].localPoint.Copy(r.m_p)}}var je=(function(){return function(){this.type=0,this.index=0,this.separation=0}})(),Xe=(function(){return function(){this.vertices=P.MakeArray(o),this.normals=P.MakeArray(o),this.count=0}})(),Ye=(function(){return function(){this.i1=0,this.i2=0,this.v1=new P,this.v2=new P,this.normal=new P,this.sideNormal1=new P,this.sideOffset1=0,this.sideNormal2=new P,this.sideOffset2=0}})(),qe=new(function(){function e(){this.m_polygonB=new Xe,this.m_xf=new N,this.m_centroidB=new P,this.m_v0=new P,this.m_v1=new P,this.m_v2=new P,this.m_v3=new P,this.m_normal0=new P,this.m_normal1=new P,this.m_normal2=new P,this.m_normal=new P,this.m_type1=0,this.m_type2=0,this.m_lowerLimit=new P,this.m_upperLimit=new P,this.m_radius=0,this.m_front=!1}return e.prototype.Collide=function(i,n,r,s,o){N.MulTXX(r,o,this.m_xf),N.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var l=n.m_hasVertex0,h=n.m_hasVertex3,c=P.SubVV(this.m_v2,this.m_v1,e.s_edge1);c.Normalize(),this.m_normal1.Set(c.y,-c.x);var u=P.DotVV(this.m_normal1,P.SubVV(this.m_centroidB,this.m_v1,P.s_t0)),_=0,f=0,d=!1,p=!1;if(l){var m=P.SubVV(this.m_v1,this.m_v0,e.s_edge0);m.Normalize(),this.m_normal0.Set(m.y,-m.x),d=P.CrossVV(m,c)>=0,_=P.DotVV(this.m_normal0,P.SubVV(this.m_centroidB,this.m_v0,P.s_t0))}if(h){var y=P.SubVV(this.m_v3,this.m_v2,e.s_edge2);y.Normalize(),this.m_normal2.Set(y.y,-y.x),p=P.CrossVV(c,y)>0,f=P.DotVV(this.m_normal2,P.SubVV(this.m_centroidB,this.m_v2,P.s_t0))}l&&h?d&&p?(this.m_front=_>=0||u>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=_>=0||u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):p?(this.m_front=f>=0||_>=0&&u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=_>=0&&u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):l?d?(this.m_front=_>=0||u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=_>=0&&u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):h?p?(this.m_front=u>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var v=0;vthis.m_radius)){var A=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(0!==A.type&&A.separation>this.m_radius)){var x;x=0===A.type?g:A.separation>.98*g.separation+.001?A:g;var b=e.s_ie,C=e.s_rf;if(1===x.type){i.type=t.b2ManifoldType.e_faceA;var T=0,S=P.DotVV(this.m_normal,this.m_polygonB.normals[0]);for(v=1;vthis.m_radius)return n.type=2,n.index=s,n.separation=c,n;if(P.DotVV(a,r)>=0){if(P.DotVV(P.SubVV(a,this.m_upperLimit,P.s_t0),this.m_normal)<-h)continue}else if(P.DotVV(P.SubVV(a,this.m_lowerLimit,P.s_t0),this.m_normal)<-h)continue;c>n.separation&&(n.type=2,n.index=s,n.separation=c)}return n},e.s_edge1=new P,e.s_edge0=new P,e.s_edge2=new P,e.s_ie=Ct.MakeArray(2),e.s_rf=new Ye,e.s_clipPoints1=Ct.MakeArray(2),e.s_clipPoints2=Ct.MakeArray(2),e.s_edgeAxis=new je,e.s_polygonAxis=new je,e.s_n=new P,e.s_perp=new P,e}());function Je(t,e,i,n,r){qe.Collide(t,e,i,n,r)}var Ze=(function(){return function(){this.mass=0,this.center=new P(0,0),this.I=0}})();(function(t){t[t.e_unknown=-1]="e_unknown",t[t.e_circleShape=0]="e_circleShape",t[t.e_edgeShape=1]="e_edgeShape",t[t.e_polygonShape=2]="e_polygonShape",t[t.e_chainShape=3]="e_chainShape",t[t.e_shapeTypeCount=4]="e_shapeTypeCount"})(t.b2ShapeType||(t.b2ShapeType={}));var Ke=(function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}return e.prototype.Copy=function(t){return this.m_radius=t.m_radius,this},e.prototype.GetType=function(){return this.m_type},e})(),Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};function $e(t,e){function i(){this.constructor=t}Qe(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var ti=(function(e){function i(i){void 0===i&&(i=0);var n=e.call(this,t.b2ShapeType.e_circleShape,i)||this;return n.m_p=new P,n}return $e(i,e),i.prototype.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},i.prototype.Clone=function(){return(new i).Copy(this)},i.prototype.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},i.prototype.GetChildCount=function(){return 1},i.prototype.TestPoint=function(t,e){var n=N.MulXV(t,this.m_p,i.TestPoint_s_center),r=P.SubVV(e,n,i.TestPoint_s_d);return P.DotVV(r,r)<=C(this.m_radius)},i.prototype.ComputeDistance=function(t,e,n,r){var s=N.MulXV(t,this.m_p,i.ComputeDistance_s_center);return P.SubVV(e,s,n),n.Normalize()-this.m_radius},i.prototype.RayCast=function(t,e,r,s){var a=N.MulXV(r,this.m_p,i.RayCast_s_position),o=P.SubVV(e.p1,a,i.RayCast_s_s),l=P.DotVV(o,o)-C(this.m_radius),h=P.SubVV(e.p2,e.p1,i.RayCast_s_r),c=P.DotVV(o,h),u=P.DotVV(h,h),_=c*c-u*l;if(_<0||uthis.m_radius)return r.Copy(a),s*this.m_radius*this.m_radius;var l=this.m_radius*this.m_radius,h=o*o,c=l*(B(o/this.m_radius)+s/2)+o*S(l-h),u=-2/3*w(l-h,1.5)/c;return r.x=a.x+t.x*u,r.y=a.y+t.y*u,c},i.prototype.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i.TestPoint_s_center=new P,i.TestPoint_s_d=new P,i.ComputeDistance_s_center=new P,i.RayCast_s_position=new P,i.RayCast_s_s=new P,i.RayCast_s_r=new P,i.ComputeAABB_s_p=new P,i})(Ke),ei=(function(e){function r(){var i=e.call(this,t.b2ShapeType.e_polygonShape,c)||this;return i.m_centroid=new P(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}return $e(r,e),r.prototype.Clone=function(){return(new r).Copy(this)},r.prototype.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=P.MakeArray(this.m_count),this.m_normals=P.MakeArray(this.m_count);for(var i=0;id||p===d&&s[h].yx.LengthSquared()&&(A=_)}else A=_;if(++y,v=A,A===f)break}this.m_count=y,this.m_vertices=P.MakeArray(this.m_count),this.m_normals=P.MakeArray(this.m_count);for(h=0;h0)return!1}return!0},r.prototype.ComputeDistance=function(t,e,n,s){for(var a=N.MulTXV(t,e,r.ComputeDistance_s_pLocal),o=-i,l=r.ComputeDistance_s_normalForMaxDistance.Copy(a),h=0;ho&&(o=c,l.Copy(this.m_normals[h]))}if(o>0){var u=r.ComputeDistance_s_minDistance.Copy(l),_=o*o;for(h=0;hd&&(u.Copy(f),_=d)}return V.MulRV(t.q,u,n),n.Normalize(),Math.sqrt(_)}return V.MulRV(t.q,l,n),o},r.prototype.RayCast=function(t,e,i,n){for(var s=N.MulTXV(i,e.p1,r.RayCast_s_p1),a=N.MulTXV(i,e.p2,r.RayCast_s_p2),o=P.SubVV(a,s,r.RayCast_s_d),l=0,h=e.maxFraction,c=-1,u=0;u0&&_=0&&(t.fraction=l,V.MulRV(i.q,this.m_normals[c],t.normal),!0)},r.prototype.ComputeAABB=function(t,e,i){for(var n=N.MulXV(e,this.m_vertices[0],t.lowerBound),s=t.upperBound.Copy(n),a=0;a0&&(d?_||(c=f-1,h++):_&&(u=f-1,h++)),_=d}switch(h){case 0:if(_){var p=r.ComputeSubmergedArea_s_md;return this.ComputeMass(p,1),N.MulXV(i,p.center,s),p.mass}return 0;case 1:-1===c?c=this.m_count-1:u=this.m_count-1}for(var m,y=(c+1)%this.m_count,v=(u+1)%this.m_count,g=(0-l[c])/(l[y]-l[c]),A=(0-l[u])/(l[v]-l[u]),x=r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[c].x*(1-g)+this.m_vertices[y].x*g,this.m_vertices[c].y*(1-g)+this.m_vertices[y].y*g),b=r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[u].x*(1-A)+this.m_vertices[v].x*A,this.m_vertices[u].y*(1-A)+this.m_vertices[v].y*A),C=0,T=r.ComputeSubmergedArea_s_center.SetZero(),S=this.m_vertices[y],w=y;w!==v;){m=(w=(w+1)%this.m_count)===v?b:this.m_vertices[w];var E=.5*((S.x-x.x)*(m.y-x.y)-(S.y-x.y)*(m.x-x.x));C+=E,T.x+=E*(x.x+S.x+m.x)/3,T.y+=E*(x.y+S.y+m.y)/3,S=m}return T.SelfMul(1/C),N.MulXV(i,T,s),C},r.prototype.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n",o);for(var e=0;e0){var c=P.DotVV(l,l);h>c?P.SubVV(e,a,o):o.SelfMulSub(h/c,l)}return n.Copy(o),n.Normalize()},i.prototype.RayCast=function(t,e,n,r){var s=N.MulTXV(n,e.p1,i.RayCast_s_p1),a=N.MulTXV(n,e.p2,i.RayCast_s_p2),o=P.SubVV(a,s,i.RayCast_s_d),l=this.m_vertex1,h=this.m_vertex2,c=P.SubVV(h,l,i.RayCast_s_e),u=t.normal.Set(c.y,-c.x).SelfNormalize(),_=P.DotVV(u,P.SubVV(l,s,P.s_t0)),f=P.DotVV(u,o);if(0===f)return!1;var d=_/f;if(d<0||e.maxFraction0&&t.normal.SelfNeg(),!0)},i.prototype.ComputeAABB=function(t,e,n){var r=N.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),s=N.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);P.MinV(r,s,t.lowerBound),P.MaxV(r,s,t.upperBound);var a=this.m_radius;t.lowerBound.SelfSubXY(a,a),t.upperBound.SelfAddXY(a,a)},i.prototype.ComputeMass=function(t,e){t.mass=0,P.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},i.prototype.SetupDistanceProxy=function(t,e){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},i.prototype.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},i.prototype.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i.ComputeDistance_s_v1=new P,i.ComputeDistance_s_v2=new P,i.ComputeDistance_s_d=new P,i.ComputeDistance_s_s=new P,i.RayCast_s_p1=new P,i.RayCast_s_p2=new P,i.RayCast_s_d=new P,i.RayCast_s_e=new P,i.RayCast_s_q=new P,i.RayCast_s_r=new P,i.ComputeAABB_s_v1=new P,i.ComputeAABB_s_v2=new P,i})(Ke),ni=(function(e){function i(){var i=e.call(this,t.b2ShapeType.e_chainShape,c)||this;return i.m_vertices=[],i.m_count=0,i.m_prevVertex=new P,i.m_nextVertex=new P,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}return $e(i,e),i.prototype.CreateLoop=function(t,e,i){if(void 0===e&&(e=t.length),void 0===i&&(i=0),e<3)return this;this.m_count=e+1,this.m_vertices=P.MakeArray(this.m_count);for(var n=0;n0?(e.m_vertex0.Copy(this.m_vertices[i-1]),e.m_hasVertex0=!0):(e.m_vertex0.Copy(this.m_prevVertex),e.m_hasVertex0=this.m_hasPrevVertex),i0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},i.prototype.CreateFixtureShapeDensity=function(t,e){void 0===e&&(e=0);var n=i.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=e,this.CreateFixtureDef(n)},i.prototype.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),a=r.GetFixtureB();t!==s&&t!==a||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Destroy(),--this.m_fixtureCount,this.ResetMassData()},i.prototype.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},i.prototype.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.Synchronize(this.m_xf,this.m_xf);this.m_world.m_contactManager.FindNewContacts()},i.prototype.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},i.prototype.GetTransform=function(){return this.m_xf},i.prototype.GetPosition=function(){return this.m_xf.p},i.prototype.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},i.prototype.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},i.prototype.GetAngle=function(){return this.m_sweep.a},i.prototype.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},i.prototype.GetWorldCenter=function(){return this.m_sweep.c},i.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter},i.prototype.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(P.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},i.prototype.GetLinearVelocity=function(){return this.m_linearVelocity},i.prototype.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},i.prototype.GetAngularVelocity=function(){return this.m_angularVelocity},i.prototype.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},i.prototype.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},i.prototype.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},i.prototype.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},i.prototype.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},i.prototype.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},i.prototype.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},i.prototype.GetMass=function(){return this.m_mass},i.prototype.GetInertia=function(){return this.m_I+this.m_mass*P.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},i.prototype.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*P.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},i.prototype.SetMassData=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=e.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,e.I>0&&!this.m_fixedRotationFlag&&(this.m_I=e.I-this.m_mass*P.DotVV(e.center,e.center),this.m_invI=1/this.m_I);var n=i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e.center),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(this.m_sweep.c,n,P.s_t0),this.m_linearVelocity)}},i.prototype.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var e=i.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(i.ResetMassData_s_massData);this.m_mass+=r.mass,e.x+=r.center.x*r.mass,e.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,e.x*=this.m_invMass,e.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*P.DotVV(e,e),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(this.m_sweep.c,s,P.s_t0),this.m_linearVelocity)},i.prototype.GetWorldPoint=function(t,e){return N.MulXV(this.m_xf,t,e)},i.prototype.GetWorldVector=function(t,e){return V.MulRV(this.m_xf.q,t,e)},i.prototype.GetLocalPoint=function(t,e){return N.MulTXV(this.m_xf,t,e)},i.prototype.GetLocalVector=function(t,e){return V.MulTRV(this.m_xf.q,t,e)},i.prototype.GetLinearVelocityFromWorldPoint=function(t,e){return P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(t,this.m_sweep.c,P.s_t0),e)},i.prototype.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},i.prototype.GetLinearDamping=function(){return this.m_linearDamping},i.prototype.SetLinearDamping=function(t){this.m_linearDamping=t},i.prototype.GetAngularDamping=function(){return this.m_angularDamping},i.prototype.SetAngularDamping=function(t){this.m_angularDamping=t},i.prototype.GetGravityScale=function(){return this.m_gravityScale},i.prototype.SetGravityScale=function(t){this.m_gravityScale=t},i.prototype.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},i.prototype.GetType=function(){return this.m_type},i.prototype.SetBullet=function(t){this.m_bulletFlag=t},i.prototype.IsBullet=function(){return this.m_bulletFlag},i.prototype.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},i.prototype.IsSleepingAllowed=function(){return this.m_autoSleepFlag},i.prototype.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},i.prototype.IsAwake=function(){return this.m_awakeFlag},i.prototype.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies(this.m_xf);else{for(e=this.m_fixtureList;e;e=e.m_next)e.DestroyProxies();for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null}},i.prototype.IsActive=function(){return this.m_activeFlag},i.prototype.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},i.prototype.IsFixedRotation=function(){return this.m_fixedRotationFlag},i.prototype.GetFixtureList=function(){return this.m_fixtureList},i.prototype.GetJointList=function(){return this.m_jointList},i.prototype.GetContactList=function(){return this.m_contactList},i.prototype.GetNext=function(){return this.m_next},i.prototype.GetUserData=function(){return this.m_userData},i.prototype.SetUserData=function(t){this.m_userData=t},i.prototype.GetWorld=function(){return this.m_world},i.prototype.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},i.prototype.SynchronizeFixtures=function(){var t=i.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),V.MulRV(t.q,this.m_sweep.localCenter,t.p),P.SubVV(this.m_sweep.c0,t.p,t.p);for(var e=this.m_fixtureList;e;e=e.m_next)e.Synchronize(t,this.m_xf)},i.prototype.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),V.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),P.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},i.prototype.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},i.prototype.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},i.prototype.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),V.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),P.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},i.prototype.GetControllerList=function(){return this.m_controllerList},i.prototype.GetControllerCount=function(){return this.m_controllerCount},i.CreateFixtureShapeDensity_s_def=new si,i.SetMassData_s_oldCenter=new P,i.ResetMassData_s_localCenter=new P,i.ResetMassData_s_oldCenter=new P,i.ResetMassData_s_massData=new Ze,i.SynchronizeFixtures_s_xf1=new N,i})();(function(t){t[t.e_unknownJoint=0]="e_unknownJoint",t[t.e_revoluteJoint=1]="e_revoluteJoint",t[t.e_prismaticJoint=2]="e_prismaticJoint",t[t.e_distanceJoint=3]="e_distanceJoint",t[t.e_pulleyJoint=4]="e_pulleyJoint",t[t.e_mouseJoint=5]="e_mouseJoint",t[t.e_gearJoint=6]="e_gearJoint",t[t.e_wheelJoint=7]="e_wheelJoint",t[t.e_weldJoint=8]="e_weldJoint",t[t.e_frictionJoint=9]="e_frictionJoint",t[t.e_ropeJoint=10]="e_ropeJoint",t[t.e_motorJoint=11]="e_motorJoint",t[t.e_areaJoint=12]="e_areaJoint"})(t.b2JointType||(t.b2JointType={})),(function(t){t[t.e_inactiveLimit=0]="e_inactiveLimit",t[t.e_atLowerLimit=1]="e_atLowerLimit",t[t.e_atUpperLimit=2]="e_atUpperLimit",t[t.e_equalLimits=3]="e_equalLimits"})(t.b2LimitState||(t.b2LimitState={}));var ci=(function(){function t(){this.linear=new P,this.angularA=0,this.angularB=0}return t.prototype.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},t.prototype.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t})(),ui=(function(){return function(t,e){this.prev=null,this.next=null,this.joint=t,this.other=e}})(),_i=(function(){return function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e}})(),fi=(function(){function i(i){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=i.type,this.m_edgeA=new ui(this,i.bodyB),this.m_edgeB=new ui(this,i.bodyA),this.m_bodyA=i.bodyA,this.m_bodyB=i.bodyB,this.m_collideConnected=e(i.collideConnected,!1),this.m_userData=i.userData}return i.prototype.GetType=function(){return this.m_type},i.prototype.GetBodyA=function(){return this.m_bodyA},i.prototype.GetBodyB=function(){return this.m_bodyB},i.prototype.GetNext=function(){return this.m_next},i.prototype.GetUserData=function(){return this.m_userData},i.prototype.SetUserData=function(t){this.m_userData=t},i.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},i.prototype.GetCollideConnected=function(){return this.m_collideConnected},i.prototype.Dump=function(t){t("// Dump is not supported for this joint type.\n")},i.prototype.ShiftOrigin=function(t){},i})(),di=(function(e){function i(){var i=e.call(this,t.b2JointType.e_distanceJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=P.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i})(_i),pi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new P,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new V,n.m_qB=new V,n.m_lalcA=new P,n.m_lalcB=new P,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_length=i.length,n}return $e(i,t),i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},i.prototype.GetReactionTorque=function(t){return 0},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.SetLength=function(t){this.m_length=t},i.prototype.Length=function(){return this.m_length},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,a=t.velocities[this.m_indexA].w,o=t.positions[this.m_indexB].c,h=t.positions[this.m_indexB].a,c=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(n),f=this.m_qB.SetAngle(h);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),V.MulRV(_,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),V.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.x=o.x+this.m_rB.x-e.x-this.m_rA.x,this.m_u.y=o.y+this.m_rB.y-e.y-this.m_rA.y;var d=this.m_u.Length();d>l?this.m_u.SelfMul(1/d):this.m_u.SetZero();var p=P.CrossVV(this.m_rA,this.m_u),m=P.CrossVV(this.m_rB,this.m_u),y=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==y?1/y:0,this.m_frequencyHz>0){var v=d-this.m_length,g=2*s*this.m_frequencyHz,A=2*this.m_mass*this.m_dampingRatio*g,x=this.m_mass*g*g,b=t.step.dt;this.m_gamma=b*(A+b*x),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*b*x*this.m_gamma,y+=this.m_gamma,this.m_mass=0!==y?1/y:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var C=P.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,C),a-=this.m_invIA*P.CrossVV(this.m_rA,C),c.SelfMulAdd(this.m_invMassB,C),u+=this.m_invIB*P.CrossVV(this.m_rB,C)}else this.m_impulse=0;t.velocities[this.m_indexA].w=a,t.velocities[this.m_indexB].w=u},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=P.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=P.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),l=P.DotVV(this.m_u,P.SubVV(o,a,P.s_t0)),h=-this.m_mass*(l+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=h;var c=P.MulSV(h,this.m_u,i.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,c),n-=this.m_invIA*P.CrossVV(this.m_rA,c),r.SelfMulAdd(this.m_invMassB,c),s+=this.m_invIB*P.CrossVV(this.m_rB,c),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=V.MulRV(a,this.m_lalcA,this.m_rA),c=V.MulRV(o,this.m_lalcB,this.m_rB),u=this.m_u;u.x=r.x+c.x-e.x-h.x,u.y=r.y+c.y-e.y-h.y;var _=this.m_u.Normalize()-this.m_length;_=x(_,-.2,.2);var f=-this.m_mass*_,d=P.MulSV(f,u,i.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,d),n-=this.m_invIA*P.CrossVV(h,d),r.SelfMulAdd(this.m_invMassB,d),s+=this.m_invIB*P.CrossVV(c,d),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,v(_)C(.2)&&f.SelfMul(.2/S(p)),p>C(l)&&(_=!1),o.x+=f.x,o.y+=f.y}return _},i})(fi),vi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_frictionJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.maxForce=0,i.maxTorque=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i})(_i),gi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_linearImpulse=new P,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new L,n.m_angularMass=0,n.m_qA=new V,n.m_qB=new V,n.m_lalcA=new P,n.m_lalcB=new P,n.m_K=new L,n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_linearMass.SetZero(),n}return $e(i,t),i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,a=t.velocities[this.m_indexB].w,o=this.m_qA.SetAngle(e),l=this.m_qB.SetAngle(r);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=V.MulRV(o,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var c=V.MulRV(l,this.m_lalcB,this.m_rB),u=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=u+_+f*h.y*h.y+d*c.y*c.y,p.ex.y=-f*h.x*h.y-d*c.x*c.y,p.ey.x=p.ex.y,p.ey.y=u+_+f*h.x*h.x+d*c.x*c.x,p.GetInverse(this.m_linearMass),this.m_angularMass=f+d,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(u,m),n-=f*(P.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(_,m),a+=d*(P.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=a},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,l=this.m_invIA,h=this.m_invIB,c=t.step.dt,u=s-n,_=-this.m_angularMass*u,f=this.m_angularImpulse,d=c*this.m_maxTorque;this.m_angularImpulse=x(this.m_angularImpulse+_,-d,d),n-=l*(_=this.m_angularImpulse-f),s+=h*_;var p=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot_v2),m=L.MulMV(this.m_linearMass,p,i.SolveVelocityConstraints_s_impulseV).SelfNeg(),y=i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);d=c*this.m_maxForce;this.m_linearImpulse.LengthSquared()>d*d&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(d)),P.SubVV(this.m_linearImpulse,y,m),e.SelfMulSub(a,m),n-=l*P.CrossVV(this.m_rA,m),r.SelfMulAdd(o,m),s+=h*P.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},i.prototype.GetReactionTorque=function(t){return t*this.m_angularImpulse},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.SetMaxForce=function(t){this.m_maxForce=t},i.prototype.GetMaxForce=function(){return this.m_maxForce},i.prototype.SetMaxTorque=function(t){this.m_maxTorque=t},i.prototype.GetMaxTorque=function(){return this.m_maxTorque},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.SolveVelocityConstraints_s_Cdot_v2=new P,i.SolveVelocityConstraints_s_impulseV=new P,i.SolveVelocityConstraints_s_oldImpulseV=new P,i})(fi),Ai=(function(e){function i(){var i=e.call(this,t.b2JointType.e_gearJoint)||this;return i.ratio=1,i}return $e(i,e),i})(_i),xi=(function(i){function n(n){var r,s,a=i.call(this,n)||this;a.m_typeA=t.b2JointType.e_unknownJoint,a.m_typeB=t.b2JointType.e_unknownJoint,a.m_localAnchorA=new P,a.m_localAnchorB=new P,a.m_localAnchorC=new P,a.m_localAnchorD=new P,a.m_localAxisC=new P,a.m_localAxisD=new P,a.m_referenceAngleA=0,a.m_referenceAngleB=0,a.m_constant=0,a.m_ratio=0,a.m_impulse=0,a.m_indexA=0,a.m_indexB=0,a.m_indexC=0,a.m_indexD=0,a.m_lcA=new P,a.m_lcB=new P,a.m_lcC=new P,a.m_lcD=new P,a.m_mA=0,a.m_mB=0,a.m_mC=0,a.m_mD=0,a.m_iA=0,a.m_iB=0,a.m_iC=0,a.m_iD=0,a.m_JvAC=new P,a.m_JvBD=new P,a.m_JwA=0,a.m_JwB=0,a.m_JwC=0,a.m_JwD=0,a.m_mass=0,a.m_qA=new V,a.m_qB=new V,a.m_qC=new V,a.m_qD=new V,a.m_lalcA=new P,a.m_lalcB=new P,a.m_lalcC=new P,a.m_lalcD=new P,a.m_joint1=n.joint1,a.m_joint2=n.joint2,a.m_typeA=a.m_joint1.GetType(),a.m_typeB=a.m_joint2.GetType(),a.m_bodyC=a.m_joint1.GetBodyA(),a.m_bodyA=a.m_joint1.GetBodyB();var o=a.m_bodyA.m_xf,l=a.m_bodyA.m_sweep.a,h=a.m_bodyC.m_xf,c=a.m_bodyC.m_sweep.a;if(a.m_typeA===t.b2JointType.e_revoluteJoint){var u=n.joint1;a.m_localAnchorC.Copy(u.m_localAnchorA),a.m_localAnchorA.Copy(u.m_localAnchorB),a.m_referenceAngleA=u.m_referenceAngle,a.m_localAxisC.SetZero(),r=l-c-a.m_referenceAngleA}else{var _=n.joint1;a.m_localAnchorC.Copy(_.m_localAnchorA),a.m_localAnchorA.Copy(_.m_localAnchorB),a.m_referenceAngleA=_.m_referenceAngle,a.m_localAxisC.Copy(_.m_localXAxisA);var f=a.m_localAnchorC,d=V.MulTRV(h.q,P.AddVV(V.MulRV(o.q,a.m_localAnchorA,P.s_t0),P.SubVV(o.p,h.p,P.s_t1),P.s_t0),P.s_t0);r=P.DotVV(P.SubVV(d,f,P.s_t0),a.m_localAxisC)}a.m_bodyD=a.m_joint2.GetBodyA(),a.m_bodyB=a.m_joint2.GetBodyB();var p=a.m_bodyB.m_xf,m=a.m_bodyB.m_sweep.a,y=a.m_bodyD.m_xf,v=a.m_bodyD.m_sweep.a;if(a.m_typeB===t.b2JointType.e_revoluteJoint){u=n.joint2;a.m_localAnchorD.Copy(u.m_localAnchorA),a.m_localAnchorB.Copy(u.m_localAnchorB),a.m_referenceAngleB=u.m_referenceAngle,a.m_localAxisD.SetZero(),s=m-v-a.m_referenceAngleB}else{_=n.joint2;a.m_localAnchorD.Copy(_.m_localAnchorA),a.m_localAnchorB.Copy(_.m_localAnchorB),a.m_referenceAngleB=_.m_referenceAngle,a.m_localAxisD.Copy(_.m_localXAxisA);var g=a.m_localAnchorD,A=V.MulTRV(y.q,P.AddVV(V.MulRV(p.q,a.m_localAnchorB,P.s_t0),P.SubVV(p.p,y.p,P.s_t1),P.s_t0),P.s_t0);s=P.DotVV(P.SubVV(A,g,P.s_t0),a.m_localAxisD)}return a.m_ratio=e(n.ratio,1),a.m_constant=r+a.m_ratio*s,a.m_impulse=0,a}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,h=e.positions[this.m_indexC].a,c=e.velocities[this.m_indexC].v,u=e.velocities[this.m_indexC].w,_=e.positions[this.m_indexD].a,f=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),y=this.m_qC.SetAngle(h),v=this.m_qD.SetAngle(_);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var g=V.MulRV(y,this.m_localAxisC,n.InitVelocityConstraints_s_u);P.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var A=V.MulRV(y,this.m_lalcC,n.InitVelocityConstraints_s_rC);P.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var x=V.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(g),this.m_JwC=P.CrossVV(A,g),this.m_JwA=P.CrossVV(x,g),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{g=V.MulRV(v,this.m_localAxisD,n.InitVelocityConstraints_s_u);P.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var b=V.MulRV(v,this.m_lalcD,n.InitVelocityConstraints_s_rD);P.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var C=V.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);P.MulSV(this.m_ratio,g,this.m_JvBD),this.m_JwD=this.m_ratio*P.CrossVV(b,g),this.m_JwB=this.m_ratio*P.CrossVV(C,g),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,o.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),l+=this.m_iB*this.m_impulse*this.m_JwB,c.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),u-=this.m_iC*this.m_impulse*this.m_JwC,f.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),d-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=l,e.velocities[this.m_indexC].w=u,e.velocities[this.m_indexD].w=d},n.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,l=t.velocities[this.m_indexD].w,h=P.DotVV(this.m_JvAC,P.SubVV(e,s,P.s_t0))+P.DotVV(this.m_JvBD,P.SubVV(n,o,P.s_t0));h+=this.m_JwA*i-this.m_JwC*a+(this.m_JwB*r-this.m_JwD*l);var c=-this.m_mass*h;this.m_impulse+=c,e.SelfMulAdd(this.m_mA*c,this.m_JvAC),i+=this.m_iA*c*this.m_JwA,n.SelfMulAdd(this.m_mB*c,this.m_JvBD),r+=this.m_iB*c*this.m_JwB,s.SelfMulSub(this.m_mC*c,this.m_JvAC),a-=this.m_iC*c*this.m_JwC,o.SelfMulSub(this.m_mD*c,this.m_JvBD),l-=this.m_iD*c*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=a,t.velocities[this.m_indexD].w=l},n.prototype.SolvePositionConstraints=function(e){var i,r,s,a,o,h,c=e.positions[this.m_indexA].c,u=e.positions[this.m_indexA].a,_=e.positions[this.m_indexB].c,f=e.positions[this.m_indexB].a,d=e.positions[this.m_indexC].c,p=e.positions[this.m_indexC].a,m=e.positions[this.m_indexD].c,y=e.positions[this.m_indexD].a,v=this.m_qA.SetAngle(u),g=this.m_qB.SetAngle(f),A=this.m_qC.SetAngle(p),x=this.m_qD.SetAngle(y),b=this.m_JvAC,C=this.m_JvBD,T=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)b.SetZero(),s=1,o=1,T+=this.m_iA+this.m_iC,i=u-p-this.m_referenceAngleA;else{var S=V.MulRV(A,this.m_localAxisC,n.SolvePositionConstraints_s_u),w=V.MulRV(A,this.m_lalcC,n.SolvePositionConstraints_s_rC),E=V.MulRV(v,this.m_lalcA,n.SolvePositionConstraints_s_rA);b.Copy(S),o=P.CrossVV(w,S),s=P.CrossVV(E,S),T+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var M=this.m_lalcC,D=V.MulTRV(A,P.AddVV(E,P.SubVV(c,d,P.s_t0),P.s_t0),P.s_t0);i=P.DotVV(P.SubVV(D,M,P.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)C.SetZero(),a=this.m_ratio,h=this.m_ratio,T+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=f-y-this.m_referenceAngleB;else{S=V.MulRV(x,this.m_localAxisD,n.SolvePositionConstraints_s_u);var B=V.MulRV(x,this.m_lalcD,n.SolvePositionConstraints_s_rD),I=V.MulRV(g,this.m_lalcB,n.SolvePositionConstraints_s_rB);P.MulSV(this.m_ratio,S,C),h=this.m_ratio*P.CrossVV(B,S),a=this.m_ratio*P.CrossVV(I,S),T+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*a*a;var R=this.m_lalcD,O=V.MulTRV(x,P.AddVV(I,P.SubVV(_,m,P.s_t0),P.s_t0),P.s_t0);r=P.DotVV(P.SubVV(O,R,P.s_t0),this.m_localAxisD)}var L=i+this.m_ratio*r-this.m_constant,F=0;return T>0&&(F=-L/T),c.SelfMulAdd(this.m_mA*F,b),u+=this.m_iA*F*s,_.SelfMulAdd(this.m_mB*F,C),f+=this.m_iB*F*a,d.SelfMulSub(this.m_mC*F,b),p-=this.m_iC*F*o,m.SelfMulSub(this.m_mD*F,C),y-=this.m_iD*F*h,e.positions[this.m_indexA].a=u,e.positions[this.m_indexB].a=f,e.positions[this.m_indexC].a=p,e.positions[this.m_indexD].a=y,00&&(this.m_angularMass=1/this.m_angularMass),P.SubVV(P.AddVV(s,_,P.s_t0),P.AddVV(e,u,P.s_t1),this.m_linearError),this.m_angularError=a-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var v=this.m_linearImpulse;n.SelfMulSub(f,v),r-=p*(P.CrossVV(u,v)+this.m_angularImpulse),o.SelfMulAdd(d,v),l+=m*(P.CrossVV(_,v)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=l},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,l=this.m_invIA,h=this.m_invIB,c=t.step.dt,u=t.step.inv_dt,_=s-n+u*this.m_correctionFactor*this.m_angularError,f=-this.m_angularMass*_,d=this.m_angularImpulse,p=c*this.m_maxTorque;this.m_angularImpulse=x(this.m_angularImpulse+f,-p,p),n-=l*(f=this.m_angularImpulse-d),s+=h*f;var m=this.m_rA,y=this.m_rB,v=P.AddVV(P.SubVV(P.AddVV(r,P.CrossSV(s,y,P.s_t0),P.s_t0),P.AddVV(e,P.CrossSV(n,m,P.s_t1),P.s_t1),P.s_t2),P.MulSV(u*this.m_correctionFactor,this.m_linearError,P.s_t3),i.SolveVelocityConstraints_s_Cdot_v2),g=L.MulMV(this.m_linearMass,v,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),A=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(g);p=c*this.m_maxForce;this.m_linearImpulse.LengthSquared()>p*p&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(p)),P.SubVV(this.m_linearImpulse,A,g),e.SelfMulSub(a,g),n-=l*P.CrossVV(m,g),r.SelfMulAdd(o,g),s+=h*P.CrossVV(y,g),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.SolveVelocityConstraints_s_Cdot_v2=new P,i.SolveVelocityConstraints_s_impulse_v2=new P,i.SolveVelocityConstraints_s_oldImpulse_v2=new P,i})(fi),Ti=(function(e){function i(){var i=e.call(this,t.b2JointType.e_mouseJoint)||this;return i.target=new P,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return $e(i,e),i})(_i),Si=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_localAnchorB=new P,n.m_targetA=new P,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new P,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new P,n.m_localCenterB=new P,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new L,n.m_C=new P,n.m_qB=new V,n.m_lalcB=new P,n.m_K=new L,n.m_targetA.Copy(e(i.target,P.ZERO)),N.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=e(i.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}return $e(i,t),i.prototype.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},i.prototype.GetTarget=function(){return this.m_targetA},i.prototype.SetMaxForce=function(t){this.m_maxForce=t},i.prototype.GetMaxForce=function(){return this.m_maxForce},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,a=this.m_qB.SetAngle(i),o=this.m_bodyB.GetMass(),l=2*s*this.m_frequencyHz,h=2*o*this.m_dampingRatio*l,c=o*(l*l),u=t.step.dt;this.m_gamma=u*(h+u*c),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=u*c*this.m_gamma,P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),V.MulRV(a,this.m_lalcB,this.m_rB);var _=this.m_K;_.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,_.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,_.ey.x=_.ex.y,_.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,_.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*P.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=P.AddVCrossSV(e,n,this.m_rB,i.SolveVelocityConstraints_s_Cdot),s=L.MulMV(this.m_mass,P.AddVV(r,P.AddVV(this.m_C,P.MulSV(this.m_gamma,this.m_impulse,P.s_t0),P.s_t0),P.s_t0).SelfNeg(),i.SolveVelocityConstraints_s_impulse),a=i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var o=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>o*o&&this.m_impulse.SelfMul(o/this.m_impulse.Length()),P.SubVV(this.m_impulse,a,s),e.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*P.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return P.MulSV(t,this.m_impulse,e)},i.prototype.GetReactionTorque=function(t){return 0},i.prototype.Dump=function(t){t("Mouse joint dumping is not supported.\n")},i.prototype.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},i.SolveVelocityConstraints_s_Cdot=new P,i.SolveVelocityConstraints_s_impulse=new P,i.SolveVelocityConstraints_s_oldImpulse=new P,i})(fi),wi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_prismaticJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.localAxisA=new P(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i})(_i),Ei=(function(i){function n(n){var r=i.call(this,n)||this;return r.m_localAnchorA=new P,r.m_localAnchorB=new P,r.m_localXAxisA=new P,r.m_localYAxisA=new P,r.m_referenceAngle=0,r.m_impulse=new O(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new P,r.m_localCenterB=new P,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new P(0,0),r.m_perp=new P(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new F,r.m_K3=new F,r.m_K2=new L,r.m_motorMass=0,r.m_qA=new V,r.m_qB=new V,r.m_lalcA=new P,r.m_lalcB=new P,r.m_rA=new P,r.m_rB=new P,r.m_localAnchorA.Copy(e(n.localAnchorA,P.ZERO)),r.m_localAnchorB.Copy(e(n.localAnchorB,P.ZERO)),r.m_localXAxisA.Copy(e(n.localAxisA,new P(1,0))).SelfNormalize(),P.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=e(n.referenceAngle,0),r.m_lowerTranslation=e(n.lowerTranslation,0),r.m_upperTranslation=e(n.upperTranslation,0),r.m_maxMotorForce=e(n.maxMotorForce,0),r.m_motorSpeed=e(n.motorSpeed,0),r.m_enableLimit=e(n.enableLimit,!1),r.m_enableMotor=e(n.enableMotor,!1),r}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,c=e.velocities[this.m_indexB].v,u=e.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(h);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=V.MulRV(_,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p=V.MulRV(f,this.m_lalcB,this.m_rB),m=P.AddVV(P.SubVV(o,i,P.s_t0),P.SubVV(p,d,P.s_t1),n.InitVelocityConstraints_s_d),y=this.m_invMassA,g=this.m_invMassB,A=this.m_invIA,x=this.m_invIB;if(V.MulRV(_,this.m_localXAxisA,this.m_axis),this.m_a1=P.CrossVV(P.AddVV(m,d,P.s_t0),this.m_axis),this.m_a2=P.CrossVV(p,this.m_axis),this.m_motorMass=y+g+A*this.m_a1*this.m_a1+x*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),V.MulRV(_,this.m_localYAxisA,this.m_perp),this.m_s1=P.CrossVV(P.AddVV(m,d,P.s_t0),this.m_perp),this.m_s2=P.CrossVV(p,this.m_perp),this.m_K.ex.x=y+g+A*this.m_s1*this.m_s1+x*this.m_s2*this.m_s2,this.m_K.ex.y=A*this.m_s1+x*this.m_s2,this.m_K.ex.z=A*this.m_s1*this.m_a1+x*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=A+x,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=A*this.m_a1+x*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=y+g+A*this.m_a1*this.m_a1+x*this.m_a2*this.m_a2,this.m_enableLimit){var b=P.DotVV(this.m_axis,m);v(this.m_upperTranslation-this.m_lowerTranslation)<2*l?this.m_limitState=t.b2LimitState.e_equalLimits:b<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):b>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var C=P.AddVV(P.MulSV(this.m_impulse.x,this.m_perp,P.s_t0),P.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,P.s_t1),n.InitVelocityConstraints_s_P),T=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,S=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(y,C),a-=A*T,c.SelfMulAdd(g,C),u+=x*S}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=u},n.prototype.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,l=this.m_invMassB,h=this.m_invIA,c=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var u=P.DotVV(this.m_axis,P.SubVV(s,i,P.s_t0))+this.m_a2*a-this.m_a1*r,_=this.m_motorMass*(this.m_motorSpeed-u),f=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=x(this.m_motorImpulse+_,-d,d),_=this.m_motorImpulse-f;var p=P.MulSV(_,this.m_axis,n.SolveVelocityConstraints_s_P),m=_*this.m_a1,y=_*this.m_a2;i.SelfMulSub(o,p),r-=h*m,s.SelfMulAdd(l,p),a+=c*y}var v=P.DotVV(this.m_perp,P.SubVV(s,i,P.s_t0))+this.m_s2*a-this.m_s1*r,b=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var C=P.DotVV(this.m_axis,P.SubVV(s,i,P.s_t0))+this.m_a2*a-this.m_a1*r,T=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),S=this.m_K.Solve33(-v,-b,-C,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(S),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=A(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=g(this.m_impulse.z,0));var w=-v-(this.m_impulse.z-T.z)*this.m_K.ez.x,E=-b-(this.m_impulse.z-T.z)*this.m_K.ez.y,M=this.m_K.Solve22(w,E,n.SolveVelocityConstraints_s_f2r);M.x+=T.x,M.y+=T.y,this.m_impulse.x=M.x,this.m_impulse.y=M.y,S.x=this.m_impulse.x-T.x,S.y=this.m_impulse.y-T.y,S.z=this.m_impulse.z-T.z;p=P.AddVV(P.MulSV(S.x,this.m_perp,P.s_t0),P.MulSV(S.z,this.m_axis,P.s_t1),n.SolveVelocityConstraints_s_P),m=S.x*this.m_s1+S.y+S.z*this.m_a1,y=S.x*this.m_s2+S.y+S.z*this.m_a2;i.SelfMulSub(o,p),r-=h*m,s.SelfMulAdd(l,p),a+=c*y}else{var D=this.m_K.Solve22(-v,-b,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=D.x,this.m_impulse.y+=D.y;p=P.MulSV(D.x,this.m_perp,n.SolveVelocityConstraints_s_P),m=D.x*this.m_s1+D.y,y=D.x*this.m_s2+D.y;i.SelfMulSub(o,p),r-=h*m,s.SelfMulAdd(l,p),a+=c*y}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},n.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s),c=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB,d=V.MulRV(a,this.m_lalcA,this.m_rA),p=V.MulRV(o,this.m_lalcB,this.m_rB),m=P.SubVV(P.AddVV(r,p,P.s_t0),P.AddVV(e,d,P.s_t1),n.SolvePositionConstraints_s_d),y=V.MulRV(a,this.m_localXAxisA,this.m_axis),g=P.CrossVV(P.AddVV(m,d,P.s_t0),y),b=P.CrossVV(p,y),C=V.MulRV(a,this.m_localYAxisA,this.m_perp),T=P.CrossVV(P.AddVV(m,d,P.s_t0),C),S=P.CrossVV(p,C),w=n.SolvePositionConstraints_s_impulse,E=P.DotVV(C,m),M=s-i-this.m_referenceAngle,D=v(E),B=v(M),I=!1,R=0;if(this.m_enableLimit){var O=P.DotVV(y,m);v(this.m_upperTranslation-this.m_lowerTranslation)<2*l?(R=x(O,-.2,.2),D=A(D,v(O)),I=!0):O<=this.m_lowerTranslation?(R=x(O-this.m_lowerTranslation+l,-.2,0),D=A(D,this.m_lowerTranslation-O),I=!0):O>=this.m_upperTranslation&&(R=x(O-this.m_upperTranslation-l,0,.2),D=A(D,O-this.m_upperTranslation),I=!0)}if(I){var L=c+u+_*T*T+f*S*S,F=_*T+f*S,N=_*T*g+f*S*b;0===(U=_+f)&&(U=1);var k=_*g+f*b,G=c+u+_*g*g+f*b*b,z=this.m_K3;z.ex.SetXYZ(L,F,N),z.ey.SetXYZ(F,U,k),z.ez.SetXYZ(N,k,G),w=z.Solve33(-E,-M,-R,w)}else{var U;L=c+u+_*T*T+f*S*S,F=_*T+f*S;0===(U=_+f)&&(U=1);var H=this.m_K2;H.ex.Set(L,F),H.ey.Set(F,U);var W=H.Solve(-E,-M,n.SolvePositionConstraints_s_impulse1);w.x=W.x,w.y=W.y,w.z=0}var j=P.AddVV(P.MulSV(w.x,C,P.s_t0),P.MulSV(w.z,y,P.s_t1),n.SolvePositionConstraints_s_P),X=w.x*T+w.y+w.z*g,Y=w.x*S+w.y+w.z*b;return e.SelfMulSub(c,j),i-=_*X,r.SelfMulAdd(u,j),s+=f*Y,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,D<=l&&B<=h},n.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.prototype.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},n.prototype.GetReactionTorque=function(t){return t*this.m_impulse.y},n.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},n.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},n.prototype.GetLocalAxisA=function(){return this.m_localXAxisA},n.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},n.prototype.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=P.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return P.DotVV(i,r)},n.prototype.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;P.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=V.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=V.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=P.AddVV(t.m_sweep.c,i,P.s_t0),s=P.AddVV(e.m_sweep.c,n,P.s_t1),a=P.SubVV(s,r,P.s_t2),o=t.GetWorldVector(this.m_localXAxisA,this.m_axis),l=t.m_linearVelocity,h=e.m_linearVelocity,c=t.m_angularVelocity,u=e.m_angularVelocity;return P.DotVV(a,P.CrossSV(c,o,P.s_t0))+P.DotVV(o,P.SubVV(P.AddVCrossSV(h,u,n,P.s_t0),P.AddVCrossSV(l,c,i,P.s_t1),P.s_t0))},n.prototype.IsLimitEnabled=function(){return this.m_enableLimit},n.prototype.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},n.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},n.prototype.GetUpperLimit=function(){return this.m_upperTranslation},n.prototype.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},n.prototype.IsMotorEnabled=function(){return this.m_enableMotor},n.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},n.prototype.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},n.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce},n.prototype.GetMotorForce=function(t){return t*this.m_motorImpulse},n.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints_s_d=new P,n.InitVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_f2r=new P,n.SolveVelocityConstraints_s_f1=new O,n.SolveVelocityConstraints_s_df3=new O,n.SolveVelocityConstraints_s_df2=new P,n.SolvePositionConstraints_s_d=new P,n.SolvePositionConstraints_s_impulse=new O,n.SolvePositionConstraints_s_impulse1=new P,n.SolvePositionConstraints_s_P=new P,n.GetJointTranslation_s_pA=new P,n.GetJointTranslation_s_pB=new P,n.GetJointTranslation_s_d=new P,n.GetJointTranslation_s_axis=new P,n})(fi),Mi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_pulleyJoint)||this;return i.groundAnchorA=new P(-1,1),i.groundAnchorB=new P(1,1),i.localAnchorA=new P(-1,0),i.localAnchorB=new P(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,a){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=P.DistanceVV(r,i),this.lengthB=P.DistanceVV(s,n),this.ratio=a},i})(_i),Di=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_groundAnchorA=new P,n.m_groundAnchorB=new P,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new P,n.m_uB=new P,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new V,n.m_qB=new V,n.m_lalcA=new P,n.m_lalcB=new P,n.m_groundAnchorA.Copy(e(i.groundAnchorA,new P(-1,1))),n.m_groundAnchorB.Copy(e(i.groundAnchorB,new P(1,0))),n.m_localAnchorA.Copy(e(i.localAnchorA,new P(-1,0))),n.m_localAnchorB.Copy(e(i.localAnchorB,new P(1,0))),n.m_lengthA=e(i.lengthA,0),n.m_lengthB=e(i.lengthB,0),n.m_ratio=e(i.ratio,1),n.m_constant=e(i.lengthA,0)+n.m_ratio*e(i.lengthB,0),n.m_impulse=0,n}return $e(i,t),i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,c=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(n),_=this.m_qB.SetAngle(o);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),V.MulRV(u,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),V.MulRV(_,this.m_lalcB,this.m_rB),this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var f=this.m_uA.Length(),d=this.m_uB.Length();f>10*l?this.m_uA.SelfMul(1/f):this.m_uA.SetZero(),d>10*l?this.m_uB.SelfMul(1/d):this.m_uB.SetZero();var p=P.CrossVV(this.m_rA,this.m_uA),m=P.CrossVV(this.m_rB,this.m_uB),y=this.m_invMassA+this.m_invIA*p*p,v=this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=y+this.m_ratio*this.m_ratio*v,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var g=P.MulSV(-this.m_impulse,this.m_uA,i.InitVelocityConstraints_s_PA),A=P.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,i.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,g),s+=this.m_invIA*P.CrossVV(this.m_rA,g),h.SelfMulAdd(this.m_invMassB,A),c+=this.m_invIB*P.CrossVV(this.m_rB,A)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=c},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=P.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=P.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),l=-P.DotVV(this.m_uA,a)-this.m_ratio*P.DotVV(this.m_uB,o),h=-this.m_mass*l;this.m_impulse+=h;var c=P.MulSV(-h,this.m_uA,i.SolveVelocityConstraints_s_PA),u=P.MulSV(-this.m_ratio*h,this.m_uB,i.SolveVelocityConstraints_s_PB);e.SelfMulAdd(this.m_invMassA,c),n+=this.m_invIA*P.CrossVV(this.m_rA,c),r.SelfMulAdd(this.m_invMassB,u),s+=this.m_invIB*P.CrossVV(this.m_rB,u),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=V.MulRV(a,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var c=V.MulRV(o,this.m_lalcB,this.m_rB),u=this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),_=this.m_uB.Copy(r).SelfAdd(c).SelfSub(this.m_groundAnchorB),f=u.Length(),d=_.Length();f>10*l?u.SelfMul(1/f):u.SetZero(),d>10*l?_.SelfMul(1/d):_.SetZero();var p=P.CrossVV(h,u),m=P.CrossVV(c,_),y=this.m_invMassA+this.m_invIA*p*p,g=this.m_invMassB+this.m_invIB*m*m,A=y+this.m_ratio*this.m_ratio*g;A>0&&(A=1/A);var x=this.m_constant-f-this.m_ratio*d,b=v(x),C=-A*x,T=P.MulSV(-C,u,i.SolvePositionConstraints_s_PA),S=P.MulSV(-this.m_ratio*C,_,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,T),n+=this.m_invIA*P.CrossVV(h,T),r.SelfMulAdd(this.m_invMassB,S),s+=this.m_invIB*P.CrossVV(c,S),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,b0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!m||(this.m_motorImpulse=0),this.m_enableLimit&&!m){var y=a-i-this.m_referenceAngle;v(this.m_upperAngle-this.m_lowerAngle)<2*h?this.m_limitState=t.b2LimitState.e_equalLimits:y<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):y>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var g=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(_,g),s-=d*(P.CrossVV(this.m_rA,g)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(f,g),l+=p*(P.CrossVV(this.m_rB,g)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=l},n.prototype.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,l=this.m_invMassB,h=this.m_invIA,c=this.m_invIB,u=h+c===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!u){var _=a-r-this.m_motorSpeed,f=-this.m_motorMass*_,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=x(this.m_motorImpulse+f,-p,p),r-=h*(f=this.m_motorImpulse-d),a+=c*f}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!u){var m=P.SubVV(P.AddVCrossSV(s,a,this.m_rB,P.s_t0),P.AddVCrossSV(i,r,this.m_rA,P.s_t1),n.SolveVelocityConstraints_s_Cdot1),y=a-r,v=this.m_mass.Solve33(m.x,m.y,y,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){if(this.m_impulse.z+v.z<0){var g=-m.x+this.m_impulse.z*this.m_mass.ez.x,A=-m.y+this.m_impulse.z*this.m_mass.ez.y,b=this.m_mass.Solve22(g,A,n.SolveVelocityConstraints_s_reduced_v2);v.x=b.x,v.y=b.y,v.z=-this.m_impulse.z,this.m_impulse.x+=b.x,this.m_impulse.y+=b.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v)}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){if(this.m_impulse.z+v.z>0){g=-m.x+this.m_impulse.z*this.m_mass.ez.x,A=-m.y+this.m_impulse.z*this.m_mass.ez.y,b=this.m_mass.Solve22(g,A,n.SolveVelocityConstraints_s_reduced_v2);v.x=b.x,v.y=b.y,v.z=-this.m_impulse.z,this.m_impulse.x+=b.x,this.m_impulse.y+=b.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v)}var C=n.SolveVelocityConstraints_s_P.Set(v.x,v.y);i.SelfMulSub(o,C),r-=h*(P.CrossVV(this.m_rA,C)+v.z),s.SelfMulAdd(l,C),a+=c*(P.CrossVV(this.m_rB,C)+v.z)}else{var T=P.SubVV(P.AddVCrossSV(s,a,this.m_rB,P.s_t0),P.AddVCrossSV(i,r,this.m_rA,P.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),S=this.m_mass.Solve22(-T.x,-T.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=S.x,this.m_impulse.y+=S.y,i.SelfMulSub(o,S),r-=h*P.CrossVV(this.m_rA,S),s.SelfMulAdd(l,S),a+=c*P.CrossVV(this.m_rB,S)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},n.prototype.SolvePositionConstraints=function(e){var i,r=e.positions[this.m_indexA].c,s=e.positions[this.m_indexA].a,a=e.positions[this.m_indexB].c,o=e.positions[this.m_indexB].a,c=this.m_qA.SetAngle(s),u=this.m_qB.SetAngle(o),_=0,f=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!f){var d=o-s-this.m_referenceAngle,p=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var m=x(d-this.m_lowerAngle,-.13962634015955555,.13962634015955555);p=-this.m_motorMass*m,_=v(m)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){_=-(m=d-this.m_lowerAngle),m=x(m+h,-.13962634015955555,0),p=-this.m_motorMass*m}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){_=m=d-this.m_upperAngle,m=x(m-h,0,.13962634015955555),p=-this.m_motorMass*m}s-=this.m_invIA*p,o+=this.m_invIB*p}c.SetAngle(s),u.SetAngle(o),P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var y=V.MulRV(c,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var g=V.MulRV(u,this.m_lalcB,this.m_rB),A=P.SubVV(P.AddVV(a,g,P.s_t0),P.AddVV(r,y,P.s_t1),n.SolvePositionConstraints_s_C_v2);i=A.Length();var b=this.m_invMassA,C=this.m_invMassB,T=this.m_invIA,S=this.m_invIB,w=this.m_K;w.ex.x=b+C+T*y.y*y.y+S*g.y*g.y,w.ex.y=-T*y.x*y.y-S*g.x*g.y,w.ey.x=w.ex.y,w.ey.y=b+C+T*y.x*y.x+S*g.x*g.x;var E=w.Solve(A.x,A.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(b,E),s-=T*P.CrossVV(y,E),a.SelfMulAdd(C,E),o+=S*P.CrossVV(g,E),e.positions[this.m_indexA].a=s,e.positions[this.m_indexB].a=o,i<=l&&_<=h},n.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},n.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},n.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},n.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},n.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},n.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},n.prototype.IsMotorEnabled=function(){return this.m_enableMotor},n.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.prototype.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},n.prototype.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.prototype.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.prototype.IsLimitEnabled=function(){return this.m_enableLimit},n.prototype.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},n.prototype.GetLowerLimit=function(){return this.m_lowerAngle},n.prototype.GetUpperLimit=function(){return this.m_upperAngle},n.prototype.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},n.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_Cdot_v2=new P,n.SolveVelocityConstraints_s_Cdot1=new P,n.SolveVelocityConstraints_s_impulse_v3=new O,n.SolveVelocityConstraints_s_reduced_v2=new P,n.SolveVelocityConstraints_s_impulse_v2=new P,n.SolvePositionConstraints_s_C_v2=new P,n.SolvePositionConstraints_s_impulse=new P,n})(fi),Pi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_ropeJoint)||this;return i.localAnchorA=new P(-1,0),i.localAnchorB=new P(1,0),i.maxLength=0,i}return $e(i,e),i})(_i),Ri=(function(i){function n(n){var r=i.call(this,n)||this;return r.m_localAnchorA=new P,r.m_localAnchorB=new P,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new P,r.m_rA=new P,r.m_rB=new P,r.m_localCenterA=new P,r.m_localCenterB=new P,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new V,r.m_qB=new V,r.m_lalcA=new P,r.m_lalcB=new P,r.m_localAnchorA.Copy(e(n.localAnchorA,new P(-1,0))),r.m_localAnchorB.Copy(e(n.localAnchorB,new P(1,0))),r.m_maxLength=e(n.maxLength,0),r}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,c=e.velocities[this.m_indexB].v,u=e.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(h);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),V.MulRV(_,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),V.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var d=this.m_length-this.m_maxLength;if(this.m_state=d>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>l))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var p=P.CrossVV(this.m_rA,this.m_u),m=P.CrossVV(this.m_rB,this.m_u),y=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==y?1/y:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var v=P.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,v),a-=this.m_invIA*P.CrossVV(this.m_rA,v),c.SelfMulAdd(this.m_invMassB,v),u+=this.m_invIB*P.CrossVV(this.m_rB,v)}else this.m_impulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=u},n.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=P.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),o=P.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),l=this.m_length-this.m_maxLength,h=P.DotVV(this.m_u,P.SubVV(o,a,P.s_t0));l<0&&(h+=t.step.inv_dt*l);var c=-this.m_mass*h,u=this.m_impulse;this.m_impulse=g(0,this.m_impulse+c),c=this.m_impulse-u;var _=P.MulSV(c,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,_),i-=this.m_invIA*P.CrossVV(this.m_rA,_),r.SelfMulAdd(this.m_invMassB,_),s+=this.m_invIB*P.CrossVV(this.m_rB,_),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},n.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=V.MulRV(a,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var c=V.MulRV(o,this.m_lalcB,this.m_rB),u=this.m_u.Copy(r).SelfAdd(c).SelfSub(e).SelfSub(h),_=u.Normalize(),f=_-this.m_maxLength;f=x(f,0,.2);var d=-this.m_mass*f,p=P.MulSV(d,u,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,p),i-=this.m_invIA*P.CrossVV(h,p),r.SelfMulAdd(this.m_invMassB,p),s+=this.m_invIB*P.CrossVV(c,p),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,_-this.m_maxLength0){p.GetInverse22(this.m_mass);var m=f+d,y=m>0?1/m:0,v=a-e-this.m_referenceAngle,g=2*s*this.m_frequencyHz,A=2*y*this.m_dampingRatio*g,x=y*g*g,b=t.step.dt;this.m_gamma=b*(A+b*x),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*b*x*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var C=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(u,C),r-=f*(P.CrossVV(this.m_rA,C)+this.m_impulse.z),o.SelfMulAdd(_,C),l+=d*(P.CrossVV(this.m_rB,C)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=l},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,l=this.m_invIA,h=this.m_invIB;if(this.m_frequencyHz>0){var c=s-n,u=-this.m_mass.ez.z*(c+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=u,n-=l*u,s+=h*u;var _=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot1),f=F.MulM33XY(this.m_mass,_.x,_.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=f.x,this.m_impulse.y+=f.y;var d=f;e.SelfMulSub(a,d),n-=l*P.CrossVV(this.m_rA,d),r.SelfMulAdd(o,d),s+=h*P.CrossVV(this.m_rB,d)}else{_=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot1),c=s-n;var p=F.MulM33XYZ(this.m_mass,_.x,_.y,c,i.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(p);d=i.SolveVelocityConstraints_s_P.Set(p.x,p.y);e.SelfMulSub(a,d),n-=l*(P.CrossVV(this.m_rA,d)+p.z),r.SelfMulAdd(o,d),s+=h*(P.CrossVV(this.m_rB,d)+p.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),c=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB;P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=V.MulRV(a,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,y=V.MulRV(o,this.m_lalcB,this.m_rB),g=this.m_K;if(g.ex.x=c+u+d.y*d.y*_+y.y*y.y*f,g.ey.x=-d.y*d.x*_-y.y*y.x*f,g.ez.x=-d.y*_-y.y*f,g.ex.y=g.ey.x,g.ey.y=c+u+d.x*d.x*_+y.x*y.x*f,g.ez.y=d.x*_+y.x*f,g.ex.z=g.ez.x,g.ey.z=g.ez.y,g.ez.z=_+f,this.m_frequencyHz>0){p=(x=P.SubVV(P.AddVV(r,y,P.s_t0),P.AddVV(e,d,P.s_t1),i.SolvePositionConstraints_s_C1)).Length(),m=0;var A=g.Solve22(x.x,x.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(c,A),n-=_*P.CrossVV(d,A),r.SelfMulAdd(u,A),s+=f*P.CrossVV(y,A)}else{var x=P.SubVV(P.AddVV(r,y,P.s_t0),P.AddVV(e,d,P.s_t1),i.SolvePositionConstraints_s_C1),b=s-n-this.m_referenceAngle;p=x.Length(),m=v(b);var C=g.Solve33(x.x,x.y,b,i.SolvePositionConstraints_s_impulse).SelfNeg();A=i.SolvePositionConstraints_s_P.Set(C.x,C.y);e.SelfMulSub(c,A),n-=_*(P.CrossVV(this.m_rA,A)+C.z),r.SelfMulAdd(u,A),s+=f*(P.CrossVV(this.m_rB,A)+C.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,p<=l&&m<=h},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},i.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.InitVelocityConstraints_s_P=new P,i.SolveVelocityConstraints_s_Cdot1=new P,i.SolveVelocityConstraints_s_impulse1=new P,i.SolveVelocityConstraints_s_impulse=new O,i.SolveVelocityConstraints_s_P=new P,i.SolvePositionConstraints_s_C1=new P,i.SolvePositionConstraints_s_P=new P,i.SolvePositionConstraints_s_impulse=new O,i})(fi),Fi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_wheelJoint)||this;return i.localAnchorA=new P(0,0),i.localAnchorB=new P(0,0),i.localAxisA=new P(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i})(_i),Vi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_localXAxisA=new P,n.m_localYAxisA=new P,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new P,n.m_ay=new P,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new V,n.m_qB=new V,n.m_lalcA=new P,n.m_lalcB=new P,n.m_rA=new P,n.m_rB=new P,n.m_frequencyHz=e(i.frequencyHz,2),n.m_dampingRatio=e(i.dampingRatio,.7),n.m_localAnchorA.Copy(e(i.localAnchorA,P.ZERO)),n.m_localAnchorB.Copy(e(i.localAnchorB,P.ZERO)),n.m_localXAxisA.Copy(e(i.localAxisA,P.UNITX)),P.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=e(i.maxMotorTorque,0),n.m_motorSpeed=e(i.motorSpeed,0),n.m_enableMotor=e(i.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}return $e(i,t),i.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},i.prototype.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},i.prototype.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},i.prototype.GetSpringFrequencyHz=function(){return this.m_frequencyHz},i.prototype.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetSpringDampingRatio=function(){return this.m_dampingRatio},i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,a=this.m_invIB,o=t.positions[this.m_indexA].c,l=t.positions[this.m_indexA].a,h=t.velocities[this.m_indexA].v,c=t.velocities[this.m_indexA].w,u=t.positions[this.m_indexB].c,_=t.positions[this.m_indexB].a,f=t.velocities[this.m_indexB].v,d=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(l),m=this.m_qB.SetAngle(_);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var y=V.MulRV(p,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var v=V.MulRV(m,this.m_lalcB,this.m_rB),g=P.SubVV(P.AddVV(u,v,P.s_t0),P.AddVV(o,y,P.s_t1),i.InitVelocityConstraints_s_d);if(V.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=P.CrossVV(P.AddVV(g,y,P.s_t0),this.m_ay),this.m_sBy=P.CrossVV(v,this.m_ay),this.m_mass=e+n+r*this.m_sAy*this.m_sAy+a*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){V.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=P.CrossVV(P.AddVV(g,y,P.s_t0),this.m_ax),this.m_sBx=P.CrossVV(v,this.m_ax);var A=e+n+r*this.m_sAx*this.m_sAx+a*this.m_sBx*this.m_sBx;if(A>0){this.m_springMass=1/A;var x=P.DotVV(g,this.m_ax),b=2*s*this.m_frequencyHz,C=2*this.m_springMass*this.m_dampingRatio*b,T=this.m_springMass*b*b,S=t.step.dt;this.m_gamma=S*(C+S*T),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=x*S*T*this.m_gamma,this.m_springMass=A+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+a,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var w=P.AddVV(P.MulSV(this.m_impulse,this.m_ay,P.s_t0),P.MulSV(this.m_springImpulse,this.m_ax,P.s_t1),i.InitVelocityConstraints_s_P),E=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,M=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;h.SelfMulSub(this.m_invMassA,w),c-=this.m_invIA*E,f.SelfMulAdd(this.m_invMassB,w),d+=this.m_invIB*M}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=c,t.velocities[this.m_indexB].w=d},i.prototype.SolveVelocityConstraints=function(t){var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,l=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,c=P.DotVV(this.m_ax,P.SubVV(l,a,P.s_t0))+this.m_sBx*h-this.m_sAx*o,u=-this.m_springMass*(c+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=u;var _=P.MulSV(u,this.m_ax,i.SolveVelocityConstraints_s_P),f=u*this.m_sAx,d=u*this.m_sBx;a.SelfMulSub(e,_),o-=r*f,l.SelfMulAdd(n,_);c=(h+=s*d)-o-this.m_motorSpeed,u=-this.m_motorMass*c;var p=this.m_motorImpulse,m=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=x(this.m_motorImpulse+u,-m,m),o-=r*(u=this.m_motorImpulse-p),h+=s*u;c=P.DotVV(this.m_ay,P.SubVV(l,a,P.s_t0))+this.m_sBy*h-this.m_sAy*o,u=-this.m_mass*c;this.m_impulse+=u;_=P.MulSV(u,this.m_ay,i.SolveVelocityConstraints_s_P),f=u*this.m_sAy,d=u*this.m_sBy;a.SelfMulSub(e,_),o-=r*f,l.SelfMulAdd(n,_),h+=s*d,t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=h},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=V.MulRV(a,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var c,u=V.MulRV(o,this.m_lalcB,this.m_rB),_=P.AddVV(P.SubVV(r,e,P.s_t0),P.SubVV(u,h,P.s_t1),i.SolvePositionConstraints_s_d),f=V.MulRV(a,this.m_localYAxisA,this.m_ay),d=P.CrossVV(P.AddVV(_,h,P.s_t0),f),p=P.CrossVV(u,f),m=P.DotVV(_,this.m_ay),y=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;c=0!==y?-m/y:0;var g=P.MulSV(c,f,i.SolvePositionConstraints_s_P),A=c*d,x=c*p;return e.SelfMulSub(this.m_invMassA,g),n-=this.m_invIA*A,r.SelfMulAdd(this.m_invMassB,g),s+=this.m_invIB*x,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,v(m)<=l},i.prototype.GetDefinition=function(t){return t},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},i.prototype.GetReactionTorque=function(t){return t*this.m_motorImpulse},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.GetLocalAxisA=function(){return this.m_localXAxisA},i.prototype.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},i.prototype.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},i.prototype.GetJointAngle=function(){return this.GetRevoluteJointAngle()},i.prototype.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},i.prototype.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new P),n=e.GetWorldPoint(this.m_localAnchorB,new P),r=P.SubVV(n,i,new P),s=t.GetWorldVector(this.m_localXAxisA,new P);return P.DotVV(r,s)},i.prototype.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;P.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=V.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=V.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=P.AddVV(t.m_sweep.c,i,P.s_t0),s=P.AddVV(e.m_sweep.c,n,P.s_t1),a=P.SubVV(s,r,P.s_t2),o=t.GetWorldVector(this.m_localXAxisA,new P),l=t.m_linearVelocity,h=e.m_linearVelocity,c=t.m_angularVelocity,u=e.m_angularVelocity;return P.DotVV(a,P.CrossSV(c,o,P.s_t0))+P.DotVV(o,P.SubVV(P.AddVCrossSV(h,u,n,P.s_t0),P.AddVCrossSV(l,c,i,P.s_t1),P.s_t0))},i.prototype.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},i.prototype.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},i.prototype.IsMotorEnabled=function(){return this.m_enableMotor},i.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},i.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},i.prototype.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},i.prototype.GetMotorTorque=function(t){return t*this.m_motorImpulse},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.InitVelocityConstraints_s_d=new P,i.InitVelocityConstraints_s_P=new P,i.SolveVelocityConstraints_s_P=new P,i.SolvePositionConstraints_s_d=new P,i.SolvePositionConstraints_s_P=new P,i})(fi);function Ni(t,e){return S(t*e)}function ki(t,e){return t>e?t:e}var Gi=(function(){return function(t){this.prev=null,this.next=null,this.contact=t}})(),zi=(function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_indexA=0,this.m_indexB=0,this.m_manifold=new xt,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new xt,this.m_nodeA=new Gi(this),this.m_nodeB=new Gi(this)}return t.prototype.GetManifold=function(){return this.m_manifold},t.prototype.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.m_fixtureA.GetShape(),r=this.m_fixtureB.GetShape();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},t.prototype.IsTouching=function(){return this.m_touchingFlag},t.prototype.SetEnabled=function(t){this.m_enabledFlag=t},t.prototype.IsEnabled=function(){return this.m_enabledFlag},t.prototype.GetNext=function(){return this.m_next},t.prototype.GetFixtureA=function(){return this.m_fixtureA},t.prototype.GetChildIndexA=function(){return this.m_indexA},t.prototype.GetFixtureB=function(){return this.m_fixtureB},t.prototype.GetChildIndexB=function(){return this.m_indexB},t.prototype.FlagForFiltering=function(){this.m_filterFlag=!0},t.prototype.SetFriction=function(t){this.m_friction=t},t.prototype.GetFriction=function(){return this.m_friction},t.prototype.ResetFriction=function(){this.m_friction=Ni(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},t.prototype.SetRestitution=function(t){this.m_restitution=t},t.prototype.GetRestitution=function(){return this.m_restitution},t.prototype.ResetRestitution=function(){this.m_restitution=ki(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},t.prototype.SetTangentSpeed=function(t){this.m_tangentSpeed=t},t.prototype.GetTangentSpeed=function(){return this.m_tangentSpeed},t.prototype.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,delete this.m_nodeA.contact,this.m_nodeA.prev=null,this.m_nodeA.next=null,delete this.m_nodeA.other,delete this.m_nodeB.contact,this.m_nodeB.prev=null,this.m_nodeB.next=null,delete this.m_nodeB.other,this.m_toiCount=0,this.m_friction=Ni(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=ki(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},t.prototype.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),a=r||s,o=this.m_fixtureA.GetBody(),l=this.m_fixtureB.GetBody(),h=o.GetTransform(),c=l.GetTransform();if(a){var u=this.m_fixtureA.GetShape(),_=this.m_fixtureB.GetShape();i=Pt(u,this.m_indexA,_,this.m_indexB,h,c),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,h,c),i=this.m_manifold.pointCount>0;for(var f=0;f0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0));var n=e.GetType(),r=i.GetType(),s=this.m_registers[n][r];s.destroyFcn&&s.destroyFcn(t,this.m_allocator)},e})(),Ki=(function(){function t(){}return t.prototype.SayGoodbyeJoint=function(t){},t.prototype.SayGoodbyeFixture=function(t){},t.prototype.SayGoodbyeParticleGroup=function(t){},t.prototype.SayGoodbyeParticle=function(t,e){},t})(),Qi=(function(){function e(){}return e.prototype.ShouldCollide=function(e,i){var n=e.GetBody(),r=i.GetBody();if(r.GetType()===t.b2BodyType.b2_staticBody&&n.GetType()===t.b2BodyType.b2_staticBody)return!1;if(!r.ShouldCollideConnected(n))return!1;var s=e.GetFilterData(),a=i.GetFilterData();return s.groupIndex===a.groupIndex&&0!==s.groupIndex?s.groupIndex>0:0!=(s.maskBits&a.categoryBits)&&0!=(s.categoryBits&a.maskBits)},e.prototype.ShouldCollideFixtureParticle=function(t,e,i){return!0},e.prototype.ShouldCollideParticleParticle=function(t,e,i){return!0},e.b2_defaultFilter=new e,e})(),$i=(function(){return function(){this.normalImpulses=p(a),this.tangentImpulses=p(a),this.count=0}})(),tn=(function(){function t(){}return t.prototype.BeginContact=function(t){},t.prototype.EndContact=function(t){},t.prototype.BeginContactFixtureParticle=function(t,e){},t.prototype.EndContactFixtureParticle=function(t,e){},t.prototype.BeginContactParticleParticle=function(t,e){},t.prototype.EndContactParticleParticle=function(t,e){},t.prototype.PreSolve=function(t,e){},t.prototype.PostSolve=function(t,e){},t.b2_defaultListener=new t,t})(),en=(function(){function t(){}return t.prototype.ReportFixture=function(t){return!0},t.prototype.ReportParticle=function(t,e){return!1},t.prototype.ShouldQueryParticleSystem=function(t){return!0},t})(),nn=(function(){function t(){}return t.prototype.ReportFixture=function(t,e,i,n){return n},t.prototype.ReportParticle=function(t,e,i,n,r){return 0},t.prototype.ShouldQueryParticleSystem=function(t){return!0},t})(),rn=(function(){function e(){this.m_broadPhase=new Vt,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=Qi.b2_defaultFilter,this.m_contactListener=tn.b2_defaultListener,this.m_allocator=null,this.m_contactFactory=new Zi(this.m_allocator)}return e.prototype.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,a=i.GetBody(),o=n.GetBody();if(a!==o){for(var l=o.GetContactList();l;){if(l.other===a){var h=l.contact.GetFixtureA(),c=l.contact.GetFixtureB(),u=l.contact.GetChildIndexA(),_=l.contact.GetChildIndexB();if(h===i&&c===n&&u===r&&_===s)return;if(h===n&&c===i&&u===s&&_===r)return}l=l.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var f=this.m_contactFactory.Create(i,r,n,s);null!==f&&(i=f.GetFixtureA(),n=f.GetFixtureB(),r=f.GetChildIndexA(),s=f.GetChildIndexB(),a=i.m_body,o=n.m_body,f.m_prev=null,f.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=f),this.m_contactList=f,f.m_nodeA.contact=f,f.m_nodeA.other=o,f.m_nodeA.prev=null,f.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=f.m_nodeA),a.m_contactList=f.m_nodeA,f.m_nodeB.contact=f,f.m_nodeB.other=a,f.m_nodeB.prev=null,f.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=f.m_nodeB),o.m_contactList=f.m_nodeB,i.IsSensor()||n.IsSensor()||(a.SetAwake(!0),o.SetAwake(!0)),++this.m_contactCount)}}},e.prototype.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},e.prototype.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),this.m_contactFactory.Destroy(t),--this.m_contactCount},e.prototype.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),a=i.GetBody(),o=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){e=(c=e).m_next,this.Destroy(c);continue}e.m_filterFlag=!1}var l=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody,h=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody;if(l||h){var c,u=i.m_proxies[r].treeNode,_=n.m_proxies[s].treeNode;if(Et(u.aabb,_.aabb))e.Update(this.m_contactListener),e=e.m_next;else e=(c=e).m_next,this.Destroy(c)}else e=e.m_next}},e})(),sn=(function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t})(),an=(function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t})(),on=(function(){function t(){this.c=new P,this.a=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),ln=(function(){function t(){this.v=new P,this.w=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),hn=(function(){return function(){this.step=new an}})(),cn=(function(){function t(){this.rA=new P,this.rB=new P,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),un=(function(){function t(){this.points=cn.MakeArray(a),this.normal=new P,this.tangent=new P,this.normalMass=new L,this.K=new L,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),_n=(function(){function e(){this.localPoints=P.MakeArray(a),this.localNormal=new P,this.localPoint=new P,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new P,this.localCenterB=new P,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return d(t,(function(t){return new e}))},e})(),fn=(function(){return function(){this.step=new an,this.count=0,this.allocator=null}})(),dn=(function(){function e(){this.normal=new P,this.point=new P,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var a=e.Initialize_s_pointA,o=e.Initialize_s_pointB,l=e.Initialize_s_planePoint,h=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:N.MulXV(n,i.localPoint,a),N.MulXV(r,i.localPoints[0],o),P.SubVV(o,a,this.normal).SelfNormalize(),P.MidVV(a,o,this.point),this.separation=P.DotVV(P.SubVV(o,a,P.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:V.MulRV(n.q,i.localNormal,this.normal),N.MulXV(n,i.localPoint,l),N.MulXV(r,i.localPoints[s],h),this.separation=P.DotVV(P.SubVV(h,l,P.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(h);break;case t.b2ManifoldType.e_faceB:V.MulRV(r.q,i.localNormal,this.normal),N.MulXV(r,i.localPoint,l),N.MulXV(n,i.localPoints[s],h),this.separation=P.DotVV(P.SubVV(h,l,P.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(h),this.normal.SelfNeg()}},e.Initialize_s_pointA=new P,e.Initialize_s_pointB=new P,e.Initialize_s_planePoint=new P,e.Initialize_s_clipPoint=new P,e})(),pn=(function(){function t(){this.m_step=new an,this.m_allocator=null,this.m_positionConstraints=_n.MakeArray(1024),this.m_velocityConstraints=un.MakeArray(1024),this.m_count=0}return t.prototype.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_allocator=t.allocator,this.m_count=t.count,this.m_positionConstraints.length0?1/I:0;var R=s.tangent,O=P.CrossVV(M.rA,R),L=P.CrossVV(M.rB,R),F=_+f+d*O*O+p*L*L;M.tangentMass=F>0?1/F:0,M.velocityBias=0;var N=P.DotVV(s.normal,P.SubVV(P.AddVCrossSV(T,S,M.rB,P.s_t0),P.AddVCrossSV(A,x,M.rA,P.s_t1),P.s_t0));N<-1&&(M.velocityBias+=-s.restitution*N)}s.pointCount}},t.prototype.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i0?-B/O:0;P.MulSV(L,E,a),b.SelfMulSub(d,a),C-=p*P.CrossVV(r,a),T.SelfMulAdd(y,a),S+=v*P.CrossVV(s,a)}this.m_positions[u].a=C,this.m_positions[_].a=S}return o>-3*l},t.prototype.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,a=t.SolveTOIPositionConstraints_s_rA,o=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,c=0,u=0;u0?-R/F:0;P.MulSV(N,D,h),T.SelfMulSub(v,h),S-=A*P.CrossVV(a,h),w.SelfMulAdd(b,h),E+=C*P.CrossVV(o,h)}this.m_positions[f].a=S,this.m_positions[d].a=E}return c>=-1.5*l},t.InitializeVelocityConstraints_s_xfA=new N,t.InitializeVelocityConstraints_s_xfB=new N,t.InitializeVelocityConstraints_s_worldManifold=new bt,t.WarmStart_s_P=new P,t.SolveVelocityConstraints_s_dv=new P,t.SolveVelocityConstraints_s_dv1=new P,t.SolveVelocityConstraints_s_dv2=new P,t.SolveVelocityConstraints_s_P=new P,t.SolveVelocityConstraints_s_a=new P,t.SolveVelocityConstraints_s_b=new P,t.SolveVelocityConstraints_s_x=new P,t.SolveVelocityConstraints_s_d=new P,t.SolveVelocityConstraints_s_P1=new P,t.SolveVelocityConstraints_s_P2=new P,t.SolveVelocityConstraints_s_P1P2=new P,t.SolvePositionConstraints_s_xfA=new N,t.SolvePositionConstraints_s_xfB=new N,t.SolvePositionConstraints_s_psm=new dn,t.SolvePositionConstraints_s_rA=new P,t.SolvePositionConstraints_s_rB=new P,t.SolvePositionConstraints_s_P=new P,t.SolveTOIPositionConstraints_s_xfA=new N,t.SolveTOIPositionConstraints_s_xfB=new N,t.SolveTOIPositionConstraints_s_psm=new dn,t.SolveTOIPositionConstraints_s_rA=new P,t.SolveTOIPositionConstraints_s_rB=new P,t.SolveTOIPositionConstraints_s_P=new P,t})(),mn=(function(){function e(){this.m_allocator=null,this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=on.MakeArray(1024),this.m_velocities=ln.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}return e.prototype.Initialize=function(t,e,i,n,r){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_allocator=n,this.m_listener=r,this.m_positions.length4){var b=2/x.Length();_.SelfMul(b)}var C=l*f;if(C*C>2.4674011002726646)f*=b=1.570796326795/v(C);A.x+=l*_.x,A.y+=l*_.y,u+=l*f,this.m_positions[h].a=u,this.m_velocities[h].w=f}o.Reset();var T=!1;for(h=0;h.0012184696791469947||P.DotVV(c.m_linearVelocity,c.m_linearVelocity)>1e-4?(c.m_sleepTime=0,D=0):(c.m_sleepTime+=l,D=g(D,c.m_sleepTime)))}if(D>=.5&&T)for(h=0;h4){var d=2/f.Length();u.SelfMul(d)}var p=l*_;if(p*p>2.4674011002726646)_*=d=1.570796326795/v(p);h.SelfMulAdd(l,u),c+=l*_,this.m_positions[r].a=c,this.m_velocities[r].w=_;var m=this.m_bodies[r];m.m_sweep.c.Copy(h),m.m_sweep.a=c,m.m_linearVelocity.Copy(u),m.m_angularVelocity=_,m.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},e.prototype.Report=function(t){if(null!==this.m_listener)for(var i=0;i0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(n=this.m_firstIndex;n0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e.GetLinearVelocityFromWorldPoint_s_t0=new P,e})(),bn=(function(){function t(t){this.m_front=0,this.m_back=0,this.m_capacity=0,this.m_buffer=d(t,(function(t){return null})),this.m_capacity=t}return t.prototype.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e=this.m_capacity&&(this.m_capacity>0?(this.m_buffer.concat(d(this.m_capacity,(function(t){return null}))),this.m_capacity*=2):(this.m_buffer.concat(d(1,(function(t){return null}))),this.m_capacity=1))}this.m_buffer[this.m_back]=t,this.m_back++},t.prototype.Pop=function(){this.m_buffer[this.m_front]=null,this.m_front++},t.prototype.Empty=function(){return this.m_front===this.m_back},t.prototype.Front=function(){var t=this.m_buffer[this.m_front];if(!t)throw new Error;return t},t})(),Cn=(function(){function t(e){this.m_generatorCapacity=0,this.m_generatorCount=0,this.m_countX=0,this.m_countY=0,this.m_diagram=[],this.m_generatorBuffer=d(e,(function(e){return new t.Generator})),this.m_generatorCapacity=e}return t.prototype.AddGenerator=function(t,e,i){var n=this.m_generatorBuffer[this.m_generatorCount++];n.center.Copy(t),n.tag=e,n.necessary=i},t.prototype.Generate=function(e,n){for(var r=1/e,s=new P(+i,+i),a=new P(-i,-i),o=0,l=0;l=0&&u>=0&&c0&&h.Push(new t.Task(c-1,u,_-1,f)),u>0&&h.Push(new t.Task(c,u-1,_-this.m_countX,f)),cg*g+A*A&&(this.m_diagram[_]=m,c>0&&h.Push(new t.Task(c-1,u,_-1,m)),u>0&&h.Push(new t.Task(c,u-1,_-this.m_countX,m)),c=i)break;Tn(t,l,i)}}if(0===a)break;r=i,i=s[--a]}return t}function En(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Sn),wn(t,e,i,n)}function Mn(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r0;){var a=Math.floor(s/2),o=e+a;r(t[o],n)?(e=++o,s-=a+1):s=a}return e}function Bn(t,e,i,n,r){void 0===r&&(r=Sn);for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(n,t[o])?s=a:(e=++o,s-=a+1)}return e}function In(t,e,i,n){for(var r=i;e!==r;)Tn(t,e++,r++),r===n?r=i:e===i&&(i=r)}function Pn(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Tn(t,++r,e);return++r}(function(t){var e=(function(){return function(){this.center=new P,this.tag=0,this.necessary=!1}})();t.Generator=e;var i=(function(){return function(t,e,i,n){this.m_x=t,this.m_y=e,this.m_i=i,this.m_generator=n}})();t.Task=i})(Cn||(Cn={}));var Rn=(function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}return t.prototype.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},t.prototype.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e=0;)this.ReportFixtureAndParticle(t,i,s);return!0},e.prototype.ReportParticle=function(t,e){return!1},e.prototype.ReportFixtureAndParticle=function(t,e,i){},e})(en),Ln=(function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new P,this.flags=0}return t.prototype.SetIndices=function(t,e){this.indexA=t,this.indexB=e},t.prototype.SetWeight=function(t){this.weight=t},t.prototype.SetNormal=function(t){this.normal.Copy(t)},t.prototype.SetFlags=function(t){this.flags=t},t.prototype.GetIndexA=function(){return this.indexA},t.prototype.GetIndexB=function(){return this.indexB},t.prototype.GetWeight=function(){return this.weight},t.prototype.GetNormal=function(){return this.normal},t.prototype.GetFlags=function(){return this.flags},t.prototype.IsEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&this.weight===t.weight&&this.normal.x===t.normal.x&&this.normal.y===t.normal.y},t.prototype.IsNotEqual=function(t){return!this.IsEqual(t)},t.prototype.ApproximatelyEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&v(this.weight-t.weight)<.01&&P.DistanceSquaredVV(this.normal,t.normal)<1e-4},t})(),Fn=(function(){return function(){this.index=0,this.weight=0,this.normal=new P,this.mass=0}})(),Vn=(function(){return function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0}})(),Nn=(function(){return function(){this.indexA=0,this.indexB=0,this.indexC=0,this.flags=0,this.strength=0,this.pa=new P(0,0),this.pb=new P(0,0),this.pc=new P(0,0),this.ka=0,this.kb=0,this.kc=0,this.s=0}})(),kn=(function(){function t(){this.strictContactCheck=!1,this.density=1,this.gravityScale=1,this.radius=1,this.maxCount=0,this.pressureStrength=.005,this.dampingStrength=1,this.elasticStrength=.25,this.springStrength=.25,this.viscousStrength=.25,this.surfaceTensionPressureStrength=.2,this.surfaceTensionNormalStrength=.2,this.repulsiveStrength=1,this.powderStrength=.5,this.ejectionStrength=.5,this.staticPressureStrength=.2,this.staticPressureRelaxation=.2,this.staticPressureIterations=8,this.colorMixingStrength=.5,this.destroyByAge=!0,this.lifetimeGranularity=1/60}return t.prototype.Copy=function(t){return this.strictContactCheck=t.strictContactCheck,this.density=t.density,this.gravityScale=t.gravityScale,this.radius=t.radius,this.maxCount=t.maxCount,this.pressureStrength=t.pressureStrength,this.dampingStrength=t.dampingStrength,this.elasticStrength=t.elasticStrength,this.springStrength=t.springStrength,this.viscousStrength=t.viscousStrength,this.surfaceTensionPressureStrength=t.surfaceTensionPressureStrength,this.surfaceTensionNormalStrength=t.surfaceTensionNormalStrength,this.repulsiveStrength=t.repulsiveStrength,this.powderStrength=t.powderStrength,this.ejectionStrength=t.ejectionStrength,this.staticPressureStrength=t.staticPressureStrength,this.staticPressureRelaxation=t.staticPressureRelaxation,this.staticPressureIterations=t.staticPressureIterations,this.colorMixingStrength=t.colorMixingStrength,this.destroyByAge=t.destroyByAge,this.lifetimeGranularity=t.lifetimeGranularity,this},t.prototype.Clone=function(){return(new t).Copy(this)},t})();t.b2ParticleSystem=(function(){function n(t,e){this.m_paused=!1,this.m_timestamp=0,this.m_allParticleFlags=0,this.m_needsUpdateAllParticleFlags=!1,this.m_allGroupFlags=0,this.m_needsUpdateAllGroupFlags=!1,this.m_hasForce=!1,this.m_iterationIndex=0,this.m_inverseDensity=0,this.m_particleDiameter=0,this.m_inverseDiameter=0,this.m_squaredDiameter=0,this.m_count=0,this.m_internalAllocatedCapacity=0,this.m_handleIndexBuffer=new n.UserOverridableBuffer,this.m_flagsBuffer=new n.UserOverridableBuffer,this.m_positionBuffer=new n.UserOverridableBuffer,this.m_velocityBuffer=new n.UserOverridableBuffer,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new n.UserOverridableBuffer,this.m_groupBuffer=[],this.m_userDataBuffer=new n.UserOverridableBuffer,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new n.UserOverridableBuffer,this.m_bodyContactCountBuffer=new n.UserOverridableBuffer,this.m_consecutiveContactStepsBuffer=new n.UserOverridableBuffer,this.m_stuckParticleBuffer=new Rn(function(){return 0}),this.m_proxyBuffer=new Rn(function(){return new n.Proxy}),this.m_contactBuffer=new Rn(function(){return new Ln}),this.m_bodyContactBuffer=new Rn(function(){return new Fn}),this.m_pairBuffer=new Rn(function(){return new Vn}),this.m_triadBuffer=new Rn(function(){return new Nn}),this.m_expirationTimeBuffer=new n.UserOverridableBuffer,this.m_indexByExpirationTimeBuffer=new n.UserOverridableBuffer,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new kn,this.m_prev=null,this.m_next=null,this.SetStrictContactCheck(t.strictContactCheck),this.SetDensity(t.density),this.SetGravityScale(t.gravityScale),this.SetRadius(t.radius),this.SetMaxParticleCount(t.maxCount),this.m_def=t.Clone(),this.m_world=e,this.SetDestructionByAge(this.m_def.destroyByAge)}return n.computeTag=function(t,e){return(e+n.yOffset>>>0<>>0)>>>0},n.computeRelativeTag=function(t,e,i){return t+(i<>>0},n.prototype.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},n.prototype.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var i=this.m_count?2*this.m_count:256;this.ReallocateInternalAllocatedBuffers(i)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return u;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;if(!this.m_flagsBuffer.data)throw new Error;if(this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),!this.m_positionBuffer.data)throw new Error;if(!this.m_velocityBuffer.data)throw new Error;this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new P).Copy(e(t.position,P.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new P).Copy(e(t.velocity,P.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new P).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new G).Copy(e(t.color,G.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new G).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],a=e(t.lifetime,0),o=a>0;if(this.m_expirationTimeBuffer.data||o){if(this.SetParticleLifetime(n,o?a:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),!this.m_indexByExpirationTimeBuffer.data)throw new Error;this.m_indexByExpirationTimeBuffer.data[n]=n}s.index=n;var l=e(t.group,null);return this.m_groupBuffer[n]=l,l&&(l.m_firstIndex0?n:r,e)},n.prototype.DestroyParticlesInShape=function(t,e,i){void 0===i&&(i=!1);var r=n.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new n.DestroyParticlesInShapeCallback(this,t,e,i),a=r;return t.ComputeAABB(a,e,0),this.m_world.QueryAABB(s,a),s.Destroyed()},n.prototype.CreateParticleGroup=function(t){var i=n.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=i;r.SetPositionAngle(e(t.position,P.ZERO),e(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,e(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var a=e(t.particleCount,t.positionData.length),o=0;o0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},n.prototype.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},n.prototype.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},n.prototype.ComputeCollisionEnergy=function(){if(!this.m_velocityBuffer.data)throw new Error;for(var t=n.ComputeCollisionEnergy_s_v,e=this.m_velocityBuffer.data,i=0,r=0;r0?this.GetQuantizedTimeElapsed()+s:s;a!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=a,this.m_expirationTimeBufferRequiresSorting=!0)},n.prototype.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},n.prototype.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},n.prototype.GetDestructionByAge=function(){return this.m_def.destroyByAge},n.prototype.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},n.prototype.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},n.prototype.GetIndexByExpirationTimeBuffer=function(){if(this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),!this.m_indexByExpirationTimeBuffer.data)throw new Error;return this.m_indexByExpirationTimeBuffer.data},n.prototype.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},n.prototype.ApplyLinearImpulse=function(t,e,i){if(!this.m_velocityBuffer.data)throw new Error;for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new P).Copy(i).SelfMul(1/r),a=t;a=0;){var m=P.SubVV(e,h[u],s),y=P.DotVV(m,f),v=y*y-d*(P.DotVV(m,m)-this.m_squaredDiameter);if(v>=0){var A=S(v),x=(-y-A)/d;if(x>_)continue;if(x<0&&((x=(-y+A)/d)<0||x>_))continue;var b=P.AddVMulSV(m,x,f,o);b.Normalize();var C=t.ReportParticle(this,u,P.AddVMulSV(e,x,f,l),b,x);if((_=g(_,C))<=0)break}}}},n.prototype.ComputeAABB=function(t){var e=this.GetParticleCount();if(t.lowerBound.x=+i,t.lowerBound.y=+i,t.upperBound.x=-i,t.upperBound.y=-i,!this.m_positionBuffer.data)throw new Error;for(var n=this.m_positionBuffer.data,r=0;re?e:t}if(t=e(t=e(t=e(t=e(t=e(t=e(t,this.m_def.maxCount),this.m_flagsBuffer.userSuppliedCapacity),this.m_positionBuffer.userSuppliedCapacity),this.m_velocityBuffer.userSuppliedCapacity),this.m_colorBuffer.userSuppliedCapacity),this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},n.prototype.CreateParticleForGroup=function(t,i,n){var r=new yn;r.flags=e(t.flags,0),N.MulXV(i,n,r.position),P.AddVV(e(t.linearVelocity,P.ZERO),P.CrossSV(e(t.angularVelocity,0),P.SubVV(r.position,e(t.position,P.ZERO),P.s_t0),P.s_t0),r.velocity),r.color.Copy(e(t.color,G.ZERO)),r.lifetime=e(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},n.prototype.CreateParticlesStrokeShapeForGroup=function(i,r,s){var a=n.CreateParticlesStrokeShapeForGroup_s_edge,o=n.CreateParticlesStrokeShapeForGroup_s_d,l=n.CreateParticlesStrokeShapeForGroup_s_p,h=e(r.stride,0);0===h&&(h=this.GetParticleStride());for(var c=0,u=i.GetChildCount(),_=0;_=e&&f=e&&dv||P.DotVV(m,m)>v||P.DotVV(y,y)>v)return;var A=S.m_groupBuffer[t],x=S.m_groupBuffer[e],b=S.m_groupBuffer[i],C=S.m_triadBuffer.data[S.m_triadBuffer.Append()];C.indexA=t,C.indexB=e,C.indexC=i,C.flags=h|c|u,C.strength=g(g(A?A.m_strength:1,x?x.m_strength:1),b?b.m_strength:1);var T=(_.x+f.x+d.x)/3,w=(_.y+f.y+d.y)/3;C.pa.x=_.x-T,C.pa.y=_.y-w,C.pb.x=f.x-T,C.pb.y=f.y-w,C.pc.x=d.x-T,C.pc.y=d.y-w,C.ka=-P.DotVV(y,p),C.kb=-P.DotVV(p,m),C.kc=-P.DotVV(m,y),C.s=P.CrossVV(_,f)+P.CrossVV(f,d)+P.CrossVV(d,_)}})),En(this.m_triadBuffer.data,0,this.m_triadBuffer.count,n.CompareTriadIndices),this.m_triadBuffer.Unique(n.MatchTriadIndices)}},n.prototype.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new n.ReactiveFilter(this.m_flagsBuffer);if(this.UpdatePairsAndTriads(0,this.m_count,e),!this.m_flagsBuffer.data)throw new Error;for(var i=0;i>0,m=0;mb&&(this.m_depthBuffer[s]=b,y=!0),x>C&&(this.m_depthBuffer[a]=C,y=!0)}if(!y)break}for(_=0;_0){if(!this.m_bodyContactCountBuffer.data)throw new Error;if(!this.m_lastBodyContactStepBuffer.data)throw new Error;if(!this.m_consecutiveContactStepsBuffer.data)throw new Error;for(var i=this.GetParticleCount(),r=0;rthis.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0)}this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s);var a=new n.UpdateBodyContactsCallback(this,this.GetFixtureContactFilter());this.m_world.QueryAABB(a,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(e)},n.prototype.Solve=function(e){var i=n.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(e),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndexi&&r.SelfMul(S(i/s))}},n.prototype.SolveGravity=function(t){if(!this.m_velocityBuffer.data)throw new Error;for(var e=n.SolveGravity_s_gravity,i=this.m_velocityBuffer.data,r=P.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),e),s=0;s=0;){var V=p[F],N=this.m_groupBuffer[F];if(M!==N&&D!==N){var k=this.GetLinearVelocity(N,F,V,l),G=P.SubVV(V,T,h),z=P.SubVV(k,B,c),U=P.CrossVV(O,z),H=P.CrossVV(R,z)-P.CrossVV(G,O),W=P.CrossVV(R,G),j=void 0,X=void 0,Y=u,q=_;if(0===U){if(0===H)continue;if(!((X=-W/H)>=0&&X=0&&j<=1))continue}else{var J=H*H-4*W*U;if(J<0)continue;var Z=S(J),K=(-H-Z)/(2*U),Q=(-H+Z)/(2*U);if(K>Q){var $=K;K=Q,Q=$}if(X=K,P.AddVMulSV(R,X,O,Y),P.AddVMulSV(G,X,z,q),j=P.DotVV(Y,q)/P.DotVV(Y,Y),!(X>=0&&X=0&&j<=1)){if(!((X=Q)>=0&&X=0&&j<=1))continue}}var tt=f;tt.x=B.x+j*O.x-k.x,tt.y=B.y+j*O.y-k.y;var et=P.MulSV(g,tt,d);if(N&&this.IsRigidGroup(N)){var it=N.GetMass(),nt=N.GetInertia();it>0&&N.m_linearVelocity.SelfMulAdd(1/it,et),nt>0&&(N.m_angularVelocity+=P.CrossVV(P.SubVV(V,N.GetCenter(),P.s_t0),et)/nt)}else m[F].SelfAdd(tt);this.ParticleApplyForce(F,et.SelfMul(-e.inv_dt))}}}}},n.prototype.SolveStaticPressure=function(e){if(!this.m_flagsBuffer.data)throw new Error;this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=.25*i,s=this.m_def.staticPressureRelaxation,a=0;a.25){var c=p.body,u=p.mass,_=r[h],f=p.normal,d=P.MulSV(a*u*(m-.25),f,i);s[h].SelfMulSub(o,d),c.ApplyLinearImpulse(d,_,!0)}}for(l=0;l.25){h=p.indexA,c=p.indexB,f=p.normal,d=P.MulSV(a*(m-.25),f,i);s[h].SelfSub(d),s[c].SelfAdd(d)}}},n.prototype.SolveSolid=function(t){var e=n.SolveSolid_s_f;if(!this.m_velocityBuffer.data)throw new Error;var i=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s=0?(S=g(S,M),w=A(w,M+1)):E=!0}Sr:s})),this.m_expirationTimeBufferRequiresSorting=!1}for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(ee.weight:t.index3)return!0;var o=t.Copy(n.normal);if(o.SelfMul(r.m_particleDiameter*(1-n.weight)),!r.m_positionBuffer.data)throw new Error;var h=P.AddVV(r.m_positionBuffer.data[n.index],o,e);if(!n.fixture.TestPoint(h)){for(var c=n.fixture.GetShape().GetChildCount(),u=0;uthis.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp}},n.prototype.ValidateParticleIndex=function(t){return t>=0&&t0?1/n:0,e[0]=r>0?1/r:0,i[0]=P.CrossVV(P.SubVV(a,s,P.s_t0),o)},n.prototype.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,a,o,l){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),o,l);else{if(!this.m_flagsBuffer.data)throw new Error;var h=this.m_flagsBuffer.data[a];this.InitDampingParameter(e,i,n,h&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,o,o,l)}},n.prototype.ComputeDampingImpulse=function(t,e,i,n,r,s,a){var o=t+e*i*i+n+r*s*s;return o>0?a/o:0},n.prototype.ApplyDamping=function(t,e,i,n,r,s,a,o){if(r&&n)r.m_linearVelocity.SelfMulAdd(a*t,o),r.m_angularVelocity+=a*i*e;else{if(!this.m_velocityBuffer.data)throw new Error;this.m_velocityBuffer.data[s].SelfMulAdd(a*t,o)}},n.xTruncBits=12,n.yTruncBits=12,n.tagBits=32,n.yOffset=1<>>0,this.m_xUpper=(n&e.xMask)>>>0,this.m_yLower=(i&e.yMask)>>>0,this.m_yUpper=(n&e.yMask)>>>0,this.m_first=r,this.m_last=s}return t.prototype.GetNext=function(){for(;this.m_first>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return u},t})();e.InsideBoundsEnumerator=s;var a=(function(){return function(){this.next=null,this.count=0,this.index=0}})();e.ParticleListNode=a;var o=(function(){function t(){}return t.prototype.Allocate=function(t,e){return e},t.prototype.Clear=function(){},t.prototype.GetCount=function(){return 0},t.prototype.Invalidate=function(t){},t.prototype.GetValidBuffer=function(){return[]},t.prototype.GetBuffer=function(){return[]},t.prototype.SetCount=function(t){},t})();e.FixedSetAllocator=o;var h=(function(){return function(t,e){this.second=u,this.first=t,this.second=e}})();e.FixtureParticle=h;var c=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return $e(e,t),e.prototype.Initialize=function(t,e){},e.prototype.Find=function(t){return u},e})(e.FixedSetAllocator);e.FixtureParticleSet=c;var _=(function(){return function(t,e){this.first=u,this.second=u,this.first=t,this.second=e}})();e.ParticlePair=_;var f=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return $e(e,t),e.prototype.Initialize=function(t,e){},e.prototype.Find=function(t){return u},e})(e.FixedSetAllocator);e.b2ParticlePairSet=f;var d=(function(){function t(){}return t.prototype.IsNecessary=function(t){return!0},t.prototype.ShouldCreatePair=function(t,e){return!0},t.prototype.ShouldCreateTriad=function(t,e,i){return!0},t})();e.ConnectionFilter=d;var p=(function(t){function e(e,i,n,r){var s=t.call(this)||this;return s.m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}return $e(e,t),e.prototype.ReportFixture=function(t){return!1},e.prototype.ReportParticle=function(t,e){if(t!==this.m_system)return!1;if(!this.m_system.m_positionBuffer.data)throw new Error;return this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0},e.prototype.Destroyed=function(){return this.m_destroyed},e})(en);e.DestroyParticlesInShapeCallback=p;var m=(function(t){function e(e){var i=t.call(this)||this;return i.m_threshold=0,i.m_threshold=e,i}return $e(e,t),e.prototype.ShouldCreatePair=function(t,e){return t0?1/_:0,p=f>0?1/f:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),y=P.SubVV(o,u,a),v=P.CrossVV(y,l),g=m+d+p*v*v,A=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];A.index=r,A.body=c,A.fixture=i,A.weight=1-h*this.m_system.m_inverseDiameter,A.normal.Copy(l.SelfNeg()),A.mass=g>0?1/g:0,this.m_system.DetectStuckParticle(r)}},n.ReportFixtureAndParticle_s_n=new P,n.ReportFixtureAndParticle_s_rp=new P,n})(On);e.UpdateBodyContactsCallback=g;var A=(function(i){function n(t,e){var n=i.call(this,t)||this;return n.m_step=e,n}return $e(n,i),n.prototype.ReportFixtureAndParticle=function(i,n,r){var s=e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1,a=e.SolveCollisionCallback.ReportFixtureAndParticle_s_output,o=e.SolveCollisionCallback.ReportFixtureAndParticle_s_input,h=e.SolveCollisionCallback.ReportFixtureAndParticle_s_p,c=e.SolveCollisionCallback.ReportFixtureAndParticle_s_v,u=e.SolveCollisionCallback.ReportFixtureAndParticle_s_f,_=i.GetBody();if(!this.m_system.m_positionBuffer.data)throw new Error;if(!this.m_system.m_velocityBuffer.data)throw new Error;var f=this.m_system.m_positionBuffer.data[r],d=this.m_system.m_velocityBuffer.data[r],p=a,m=o;if(0===this.m_system.m_iterationIndex){var y=N.MulTXV(_.m_xf0,f,s);i.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(y.SelfSub(_.GetLocalCenter()),V.MulRV(_.m_xf0.q,y,y),V.MulTRV(_.m_xf.q,y,y),y.SelfAdd(_.GetLocalCenter())),N.MulXV(_.m_xf,y,m.p1)}else m.p1.Copy(f);if(P.AddVMulSV(f,this.m_step.dt,d,m.p2),m.maxFraction=1,i.RayCast(p,m,n)){var v=p.normal,g=h;g.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+l*v.x,g.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+l*v.y;var A=c;A.x=this.m_step.inv_dt*(g.x-f.x),A.y=this.m_step.inv_dt*(g.y-f.y),this.m_system.m_velocityBuffer.data[r].Copy(A);var x=u;x.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.x-A.x),x.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.y-A.y),this.m_system.ParticleApplyForce(r,x)}},n.prototype.ReportParticle=function(t,e){return!1},n.ReportFixtureAndParticle_s_p1=new P,n.ReportFixtureAndParticle_s_output=new St,n.ReportFixtureAndParticle_s_input=new Tt,n.ReportFixtureAndParticle_s_p=new P,n.ReportFixtureAndParticle_s_v=new P,n.ReportFixtureAndParticle_s_f=new P,n})(On);e.SolveCollisionCallback=A})(t.b2ParticleSystem||(t.b2ParticleSystem={}));var Gn=(function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new rn,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new P,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new sn,this.m_island=new mn,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}return e.prototype.SetDestructionListener=function(t){this.m_destructionListener=t},e.prototype.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},e.prototype.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},e.prototype.SetDebugDraw=function(t){this.m_debugDraw=t},e.prototype.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new hi(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},e.prototype.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var a=s;s=s.next,this.m_contactManager.Destroy(a.contact)}t.m_contactList=null;for(var o=t.m_fixtureList;o;){var l=o;o=o.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(l),l.DestroyProxies(),l.Destroy(),t.m_fixtureList=o,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e,i){switch(e.type){case t.b2JointType.e_distanceJoint:return new pi(e);case t.b2JointType.e_mouseJoint:return new Si(e);case t.b2JointType.e_prismaticJoint:return new Ei(e);case t.b2JointType.e_revoluteJoint:return new Ii(e);case t.b2JointType.e_pulleyJoint:return new Di(e);case t.b2JointType.e_gearJoint:return new xi(e);case t.b2JointType.e_wheelJoint:return new Vi(e);case t.b2JointType.e_weldJoint:return new Li(e);case t.b2JointType.e_frictionJoint:return new gi(e);case t.b2JointType.e_ropeJoint:return new Ri(e);case t.b2JointType.e_motorJoint:return new Ci(e);case t.b2JointType.e_areaJoint:return new yi(e)}throw new Error},e._Joint_Destroy=function(t,e){},e.prototype.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t,null);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=t.bodyA,r=t.bodyB;if(!t.collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},e.prototype.DestroyJoint=function(t){if(this.IsLocked())throw new Error;var i=t.m_collideConnected;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var n=t.m_bodyA,r=t.m_bodyB;if(n.SetAwake(!0),r.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===n.m_jointList&&(n.m_jointList=t.m_edgeA.next),t.m_edgeA.prev=null,t.m_edgeA.next=null,t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===r.m_jointList&&(r.m_jointList=t.m_edgeB.next),t.m_edgeB.prev=null,t.m_edgeB.next=null,e._Joint_Destroy(t,null),--this.m_jointCount,!i)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next},e.prototype.CreateParticleSystem=function(e){if(this.IsLocked())throw new Error;var i=new t.b2ParticleSystem(e,this);return i.m_prev=null,i.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=i),this.m_particleSystemList=i,i},e.prototype.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},e.prototype.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;return vn(this.m_gravity.Length(),(function(t){for(var e=i,n=t.GetParticleSystemList();null!==n;n=n.m_next)e=g(e,n.GetRadius());return e})(this),t)},e.prototype.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var a=e.Step_s_step;a.dt=t,a.velocityIterations=i,a.positionIterations=n,a.particleIterations=r,a.inv_dt=t>0?1/t:0,a.dtRatio=this.m_inv_dt0*t,a.warmStarting=this.m_warmStarting;var o=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=o.GetMilliseconds(),this.m_stepComplete&&a.dt>0){for(var l=e.Step_s_timer.Reset(),h=this.m_particleSystemList;h;h=h.m_next)h.Solve(a);this.Solve(a),this.m_profile.solve=l.GetMilliseconds()}if(this.m_continuousPhysics&&a.dt>0){var c=e.Step_s_timer.Reset();this.SolveTOI(a),this.m_profile.solveTOI=c.GetMilliseconds()}a.dt>0&&(this.m_inv_dt0=a.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},e.prototype.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},e.prototype.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},e.prototype.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var a=r.GetFixtureList();a;a=a.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(a,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(a,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(a,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(a,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(a,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var o=this.m_particleSystemList;o;o=o.m_next)this.DrawParticleSystem(o);if(i&t.b2DrawFlags.e_jointBit)for(var l=this.m_jointList;l;l=l.m_next)this.DrawJoint(l);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);var h=e.DrawDebugData_s_vs;for(r=this.m_bodyList;r;r=r.m_next)if(r.IsActive())for(a=r.GetFixtureList();a;a=a.m_next)for(var c=0;c0;){if(!(i=o[--h]))throw new Error;if(r.AddBody(i),i.m_awakeFlag=!0,i.GetType()!==t.b2BodyType.b2_staticBody){for(var c=i.m_contactList;c;c=c.next){var u=c.contact;if(!u.m_islandFlag&&(u.IsEnabled()&&u.IsTouching())){var _=u.m_fixtureA.m_isSensor,f=u.m_fixtureB.m_isSensor;if(!_&&!f){if(r.AddContact(u),u.m_islandFlag=!0,!(p=c.other))throw new Error;p.m_islandFlag||(o[h++]=p,p.m_islandFlag=!0)}}}for(var d=i.m_jointList;d;d=d.next){var p;if(!d.joint.m_islandFlag)(p=d.other).IsActive()&&(r.AddJoint(d.joint),d.joint.m_islandFlag=!0,p.m_islandFlag||(o[h++]=p,p.m_islandFlag=!0))}}}var m=new sn;r.Solve(m,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=m.solveInit,this.m_profile.solveVelocity+=m.solveVelocity,this.m_profile.solvePosition+=m.solvePosition;for(var y=0;y8)){var h=1;if(a.m_toiFlag)h=a.m_toi;else{var c=a.GetFixtureA(),u=a.GetFixtureB();if(c.IsSensor()||u.IsSensor())continue;var _=c.GetBody(),f=u.GetBody(),d=_.m_type,p=f.m_type,m=_.IsAwake()&&d!==t.b2BodyType.b2_staticBody,y=f.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!y)continue;var v=_.IsBullet()||d!==t.b2BodyType.b2_dynamicBody,A=f.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!v&&!A)continue;var x=_.m_sweep.alpha0;_.m_sweep.alpha0this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var r=this.m_bodyList;r;r=r.nextBody){var s=r.body;if(s.IsAwake()){var a=s.GetWorldVector(L.MulMV(this.T,s.GetLocalVector(s.GetLinearVelocity(),P.s_t0),P.s_t1),e.Step_s_damping);s.SetLinearVelocity(P.AddVV(s.GetLinearVelocity(),P.MulSV(i,a,P.s_t0),P.s_t1))}}}},e.prototype.Draw=function(t){},e.prototype.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/A(t,e):0},e.Step_s_damping=new P,e})(Un),qn=(function(){return function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new P(0,0),this.damping=.1,this.k2=.9,this.k3=.1}})(),Jn=(function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new P,this.m_damping=0,this.m_k2=1,this.m_k3=.1}return t.prototype.GetVertexCount=function(){return this.m_count},t.prototype.GetVertices=function(){return this.m_ps},t.prototype.Initialize=function(t){this.m_count=t.count,this.m_ps=P.MakeArray(this.m_count),this.m_p0s=P.MakeArray(this.m_count),this.m_vs=P.MakeArray(this.m_count),this.m_ims=p(this.m_count);for(var e=0;e0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=p(n),this.m_as=p(r);for(e=0;e0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(n=0;ns;)C=(m-=2*s)-this.m_as[i];for(;C<-s;)C=(m+=2*s)-this.m_as[i];var T=-this.m_k3*b*C;n.SelfMulAdd(o*T,g),r.SelfMulAdd(l*T,A),a.SelfMulAdd(h*T,x)}}}},t.prototype.Draw=function(t){for(var e=new G(.4,.5,.7),i=0;i>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,t|=t>>8&16777215,1+(t|=t>>16&65535)},t.b2IsPowerOfTwo=function(t){return t>0&&0==(t&t-1)},t.b2Random=function(){return 2*Math.random()-1},t.b2RandomRange=function(t,e){return(e-t)*Math.random()+t},t.b2Vec2=P,t.b2Vec2_zero=R,t.b2Vec3=O,t.b2Mat22=L,t.b2Mat33=F,t.b2Rot=V,t.b2Transform=N,t.b2Sweep=k,t.b2Color=G,t.b2Draw=z,t.b2Timer=U,t.b2Counter=H,t.b2GrowableStack=W,t.b2BlockAllocator=j,t.b2StackAllocator=X,t.b2ContactFeature=vt,t.b2ContactID=gt,t.b2ManifoldPoint=At,t.b2Manifold=xt,t.b2WorldManifold=bt,t.b2GetPointStates=function(e,i,n,r){var s;for(s=0;sb;){t.iterations+=1,d=i.GetSupport(V.MulTRV(s.q,P.NegV(g,P.s_t1),P.s_t0)),p=N.MulXV(s,i.GetVertex(d),_t),m=n.GetSupport(V.MulTRV(a.q,g,P.s_t0)),y=N.MulXV(a,n.GetVertex(m),ft);var T=P.SubVV(p,y,pt);g.Normalize();var S=P.DotVV(g,T),w=P.DotVV(g,o);if(S-x>u*w){if(w<=0)return!1;if((u=(S-x)/w)>1)return!1;h.Copy(g).SelfNeg(),_.m_count=0}var E=f[_.m_count];switch(E.indexA=m,E.wA.Copy(y).SelfMulAdd(u,o),E.indexB=d,E.wB.Copy(p),E.w.Copy(E.wB).SelfSub(E.wA),E.a=1,_.m_count+=1,_.m_count){case 1:break;case 2:_.Solve2();break;case 3:_.Solve3()}if(3===_.m_count)return!1;_.GetClosestPoint(g),++C}var M=mt,D=yt;return _.GetWitnessPoints(M,D),g.LengthSquared()>0&&(h.Copy(g).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=C,!0},t.b2Pair=Ft,t.b2BroadPhase=Vt,t.b2PairLessThan=Nt,t.b2TreeNode=Ot,t.b2DynamicTree=Lt,t.b2_toi_reset=function(){t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0},t.b2TOIInput=Xt,t.b2TOIOutput=Yt,t.b2SeparationFunction=qt,t.b2TimeOfImpact=re,t.b2CollideCircles=oe,t.b2CollidePolygonAndCircle=ue,t.b2CollidePolygons=Le,t.b2CollideEdgeAndCircle=We,t.b2CollideEdgeAndPolygon=Je,t.b2MassData=Ze,t.b2Shape=Ke,t.b2CircleShape=ti,t.b2PolygonShape=ei,t.b2EdgeShape=ii,t.b2ChainShape=ni,t.b2Filter=ri,t.b2FixtureDef=si,t.b2FixtureProxy=ai,t.b2Fixture=oi,t.b2BodyDef=li,t.b2Body=hi,t.b2World=Gn,t.b2DestructionListener=Ki,t.b2ContactFilter=Qi,t.b2ContactImpulse=$i,t.b2ContactListener=tn,t.b2QueryCallback=en,t.b2RayCastCallback=nn,t.b2Island=mn,t.b2Profile=sn,t.b2TimeStep=an,t.b2Position=on,t.b2Velocity=ln,t.b2SolverData=hn,t.b2ContactManager=rn,t.b2MixFriction=Ni,t.b2MixRestitution=ki,t.b2ContactEdge=Gi,t.b2Contact=zi,t.b2ContactRegister=Ji,t.b2ContactFactory=Zi,t.g_blockSolve=!1,t.b2VelocityConstraintPoint=cn,t.b2ContactVelocityConstraint=un,t.b2ContactPositionConstraint=_n,t.b2ContactSolverDef=fn,t.b2PositionSolverManifold=dn,t.b2ContactSolver=pn,t.b2CircleContact=Ui,t.b2PolygonContact=Hi,t.b2PolygonAndCircleContact=Wi,t.b2EdgeAndCircleContact=ji,t.b2EdgeAndPolygonContact=Xi,t.b2ChainAndCircleContact=Yi,t.b2ChainAndPolygonContact=qi,t.b2Jacobian=ci,t.b2JointEdge=ui,t.b2JointDef=_i,t.b2Joint=fi,t.b2AreaJointDef=mi,t.b2AreaJoint=yi,t.b2DistanceJointDef=di,t.b2DistanceJoint=pi,t.b2FrictionJointDef=vi,t.b2FrictionJoint=gi,t.b2GearJointDef=Ai,t.b2GearJoint=xi,t.b2MotorJointDef=bi,t.b2MotorJoint=Ci,t.b2MouseJointDef=Ti,t.b2MouseJoint=Si,t.b2PrismaticJointDef=wi,t.b2PrismaticJoint=Ei,t.b2_minPulleyLength=2,t.b2PulleyJointDef=Mi,t.b2PulleyJoint=Di,t.b2RevoluteJointDef=Bi,t.b2RevoluteJoint=Ii,t.b2RopeJointDef=Pi,t.b2RopeJoint=Ri,t.b2WeldJointDef=Oi,t.b2WeldJoint=Li,t.b2WheelJointDef=Fi,t.b2WheelJoint=Vi,t.b2ControllerEdge=zn,t.b2Controller=Un,t.b2BuoyancyController=Hn,t.b2ConstantAccelController=Wn,t.b2ConstantForceController=jn,t.b2GravityController=Xn,t.b2TensorDampingController=Yn,t.b2ParticleDef=yn,t.b2CalculateParticleIterations=vn,t.b2ParticleHandle=gn,t.b2ParticleGroupDef=An,t.b2ParticleGroup=xn,t.b2GrowableBuffer=Rn,t.b2FixtureParticleQueryCallback=On,t.b2ParticleContact=Ln,t.b2ParticleBodyContact=Fn,t.b2ParticlePair=Vn,t.b2ParticleTriad=Nn,t.b2ParticleSystemDef=kn,t.b2RopeDef=qn,t.b2Rope=Jn,Object.defineProperty(t,"__esModule",{value:!0})}))}),{}],406:[(function(t,e,i){"use strict";var n="undefined"==typeof window?global:window;n.cc=n.cc||{},cc.internal=cc.internal||{},t("./predefine"),t("./polyfill/string"),t("./polyfill/misc"),t("./polyfill/array"),t("./polyfill/object"),t("./polyfill/array-buffer"),t("./polyfill/number"),t("./polyfill/typescript"),t("./cocos2d/core/predefine"),t("./cocos2d"),t("./extends"),e.exports=n.cc}),{"./cocos2d":322,"./cocos2d/core/predefine":234,"./extends":381,"./package":void 0,"./polyfill/array":408,"./polyfill/array-buffer":407,"./polyfill/misc":409,"./polyfill/number":410,"./polyfill/object":411,"./polyfill/string":412,"./polyfill/typescript":413,"./predefine":414}],407:[(function(t,e,i){"use strict";if(!ArrayBuffer.isView){var n=Object.getPrototypeOf(Int8Array);ArrayBuffer.isView="function"==typeof n?function(t){return t instanceof n}:function(t){if("object"!=typeof t)return!1;var e=t.constructor;return e===Float32Array||e===Uint8Array||e===Uint32Array||e===Int8Array}}}),{}],408:[(function(t,e,i){"use strict";Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.find||(Array.prototype.find=function(t){for(var e=this.length,i=0;i0?1:-1}),Math.log2||(Math.log2=function(t){return Math.log(t)*Math.LOG2E}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),!console.time){var n=window.performance||Date,r=Object.create(null);console.time=function(t){r[t]=n.now()},console.timeEnd=function(t){var e=r[t],i=n.now()-e;console.log(t+": "+i+"ms")}}}),{}],410:[(function(t,e,i){"use strict";Number.parseFloat=Number.parseFloat||parseFloat,Number.parseInt=Number.parseInt||parseInt}),{}],411:[(function(t,e,i){"use strict";Object.assign||(Object.assign=function(t,e){return cc.js.mixin(t,e)}),Object.getOwnPropertyDescriptors||(Object.getOwnPropertyDescriptors=function(t){var e={},i=Object.getOwnPropertyNames(t);Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(t)));for(var n=0;nthis.length)&&(e=this.length),e-=t.length;var i=this.indexOf(t,e);return-1!==i&&i===e}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")})}),{}],413:[(function(t,e,i){"use strict";var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};window.__extends=function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},window.__assign=Object.assign||function(t){for(var e,i=1,n=arguments.length;i=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},window.__param=function(t,e){return function(i,n){e(i,n,t)}},window.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},window.__awaiter=function(t,e,i,n){return new(i||(i=Promise))(function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(a,o)}l((n=n.apply(t,e||[])).next())})},window.__generator=function(t,e){var i,n,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return l([t,e])}}function l(s){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}},window.__read=function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,s=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return a},window.__spread=function(){for(var t=[],e=0;e1||o(t,e)})})}function o(t,e){try{l(r[t](e))}catch(t){u(s[0][3],t)}}function l(t){t.value instanceof __await?Promise.resolve(t.value.v).then(h,c):u(s[0][2],t)}function h(t){o("next",t)}function c(t){o("throw",t)}function u(t,e){t(e),s.shift(),s.length&&o(s[0][0],s[0][1])}},window.__asyncDelegator=function(t){var e,i;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,r){e[n]=t[n]?function(e){return(i=!i)?{value:__await(t[n](e)),done:"return"===n}:r?r(e):e}:r}},window.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=t[i]&&function(e){return new Promise(function(n,s){r(n,s,(e=t[i](e)).done,e.value)})}}function r(t,e,i,n){Promise.resolve(n).then((function(e){t({value:e,done:i})}),e)}},window.__makeTemplateObject=function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},window.__importStar=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e},window.__importDefault=function(t){return t&&t.__esModule?t:{default:t}}}),{}],414:[(function(t,e,i){"use strict";var n="undefined"==typeof window?global:window;function r(t,e){void 0===n[t]&&(n[t]=e)}function s(t,e){void 0===n[t]&&Object.defineProperty(n,t,{get:function(){var i;return"CC_WECHATGAMESUB"===t?i="cc.sys.platform === cc.sys.WECHAT_GAME_SUB":"CC_WECHATGAME"===t?i="cc.sys.platform === cc.sys.WECHAT_GAME":"CC_QQPLAY"===t&&(i="cc.sys.platform === cc.sys.QQ_PLAY"),cc.warnID(1400,t,i),e}})}function a(t){return"object"==typeof n[t]}r("CC_BUILD",!1),n.CC_BUILD=!0,n.CC_DEV=!1,n.CC_DEBUG=!1,n.CC_JSB=!1,n.CC_NATIVERENDERER=!1,n.CC_SUPPORT_JIT=!0,n.CC_PHYSICS_BUILTIN=!1,n.CC_PHYSICS_CANNON=!1,n.CC_EDITOR=!1,n.CC_PREVIEW=!1,n.CC_TEST=!1,n.CC_RUNTIME=!1,n.CC_JSB=!1;var o=!(!a("wx")||!wx.getSharedCanvas),l=!(!a("wx")||!wx.getSystemInfoSync&&!wx.getSharedCanvas),h=a("bk");s("CC_WECHATGAMESUB",o),s("CC_WECHATGAME",l),s("CC_QQPLAY",h);n.CocosEngine=cc.ENGINE_VERSION="2.3.4"}),{}]},{},[406]);